maxsimcli 3.1.0 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.tsbuildinfo +1 -1
- package/dist/assets/CHANGELOG.md +14 -0
- package/dist/assets/dashboard/client/assets/{index-C9L-BuXA.js → index-22m82eWY.js} +30 -30
- package/dist/assets/dashboard/client/assets/index-OELE7ZOu.css +32 -0
- package/dist/assets/dashboard/client/index.html +2 -2
- package/dist/assets/dashboard/server.js +3 -2
- package/dist/install.cjs +33 -13
- package/dist/install.cjs.map +1 -1
- package/dist/install.js +36 -7
- package/dist/install.js.map +1 -1
- package/package.json +1 -1
- package/dist/assets/dashboard/client/assets/index-CD4PAJwU.css +0 -32
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
`+V[p].replace(" at new "," at ");return a.displayName&&re.includes("<anonymous>")&&(re=re.replace("<anonymous>",a.displayName)),re}while(1<=p&&0<=O);break}}}finally{ln=!1,Error.prepareStackTrace=f}return(f=a?a.displayName||a.name:"")?Pe(f):""}function Vh(a,h){switch(a.tag){case 26:case 27:case 5:return Pe(a.type);case 16:return Pe("Lazy");case 13:return a.child!==h&&h!==null?Pe("Suspense Fallback"):Pe("Suspense");case 19:return Pe("SuspenseList");case 0:case 15:return Xh(a.type,!1);case 11:return Xh(a.type.render,!1);case 1:return Xh(a.type,!0);case 31:return Pe("Activity");default:return""}}function Zh(a){try{var h="",f=null;do h+=Vh(a,f),f=a,a=a.return;while(a);return h}catch(p){return`
|
|
47
47
|
Error generating stack: `+p.message+`
|
|
48
48
|
`+p.stack}}var el=Object.prototype.hasOwnProperty,jh=i.unstable_scheduleCallback,Tg=i.unstable_cancelCallback,s4=i.unstable_shouldYield,r4=i.unstable_requestPaint,vs=i.unstable_now,n4=i.unstable_getCurrentPriorityLevel,rx=i.unstable_ImmediatePriority,nx=i.unstable_UserBlockingPriority,Qf=i.unstable_NormalPriority,o4=i.unstable_LowPriority,ox=i.unstable_IdlePriority,a4=i.log,l4=i.unstable_setDisableYieldValue,Ih=null,ys=null;function Hn(a){if(typeof a4=="function"&&l4(a),ys&&typeof ys.setStrictMode=="function")try{ys.setStrictMode(Ih,a)}catch{}}var bs=Math.clz32?Math.clz32:u4,h4=Math.log,c4=Math.LN2;function u4(a){return a>>>=0,a===0?32:31-(h4(a)/c4|0)|0}var Rf=256,Lf=262144,$f=4194304;function Jo(a){var h=a&42;if(h!==0)return h;switch(a&-a){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return a&261888;case 262144:case 524288:case 1048576:case 2097152:return a&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return a&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return a}}function Bf(a,h,f){var p=a.pendingLanes;if(p===0)return 0;var O=0,v=a.suspendedLanes,S=a.pingedLanes;a=a.warmLanes;var T=p&134217727;return T!==0?(p=T&~v,p!==0?O=Jo(p):(S&=T,S!==0?O=Jo(S):f||(f=T&~a,f!==0&&(O=Jo(f))))):(T=p&~v,T!==0?O=Jo(T):S!==0?O=Jo(S):f||(f=p&~a,f!==0&&(O=Jo(f)))),O===0?0:h!==0&&h!==O&&(h&v)===0&&(v=O&-O,f=h&-h,v>=f||v===32&&(f&4194048)!==0)?h:O}function qh(a,h){return(a.pendingLanes&~(a.suspendedLanes&~a.pingedLanes)&h)===0}function f4(a,h){switch(a){case 1:case 2:case 4:case 8:case 64:return h+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return h+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ax(){var a=$f;return $f<<=1,($f&62914560)===0&&($f=4194304),a}function Ag(a){for(var h=[],f=0;31>f;f++)h.push(a);return h}function Wh(a,h){a.pendingLanes|=h,h!==268435456&&(a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0)}function d4(a,h,f,p,O,v){var S=a.pendingLanes;a.pendingLanes=f,a.suspendedLanes=0,a.pingedLanes=0,a.warmLanes=0,a.expiredLanes&=f,a.entangledLanes&=f,a.errorRecoveryDisabledLanes&=f,a.shellSuspendCounter=0;var T=a.entanglements,V=a.expirationTimes,J=a.hiddenUpdates;for(f=S&~f;0<f;){var re=31-bs(f),ae=1<<re;T[re]=0,V[re]=-1;var ee=J[re];if(ee!==null)for(J[re]=null,re=0;re<ee.length;re++){var te=ee[re];te!==null&&(te.lane&=-536870913)}f&=~ae}p!==0&&lx(a,p,0),v!==0&&O===0&&a.tag!==0&&(a.suspendedLanes|=v&~(S&~h))}function lx(a,h,f){a.pendingLanes|=h,a.suspendedLanes&=~h;var p=31-bs(h);a.entangledLanes|=h,a.entanglements[p]=a.entanglements[p]|1073741824|f&261930}function hx(a,h){var f=a.entangledLanes|=h;for(a=a.entanglements;f;){var p=31-bs(f),O=1<<p;O&h|a[p]&h&&(a[p]|=h),f&=~O}}function cx(a,h){var f=h&-h;return f=(f&42)!==0?1:Mg(f),(f&(a.suspendedLanes|h))!==0?0:f}function Mg(a){switch(a){case 2:a=1;break;case 8:a=4;break;case 32:a=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:a=128;break;case 268435456:a=134217728;break;default:a=0}return a}function Eg(a){return a&=-a,2<a?8<a?(a&134217727)!==0?32:268435456:8:2}function ux(){var a=X.p;return a!==0?a:(a=window.event,a===void 0?32:Fk(a.type))}function fx(a,h){var f=X.p;try{return X.p=a,h()}finally{X.p=f}}var Fn=Math.random().toString(36).slice(2),wi="__reactFiber$"+Fn,rs="__reactProps$"+Fn,tl="__reactContainer$"+Fn,Pg="__reactEvents$"+Fn,p4="__reactListeners$"+Fn,m4="__reactHandles$"+Fn,dx="__reactResources$"+Fn,Uh="__reactMarker$"+Fn;function Qg(a){delete a[wi],delete a[rs],delete a[Pg],delete a[p4],delete a[m4]}function il(a){var h=a[wi];if(h)return h;for(var f=a.parentNode;f;){if(h=f[tl]||f[wi]){if(f=h.alternate,h.child!==null||f!==null&&f.child!==null)for(a=Lk(a);a!==null;){if(f=a[wi])return f;a=Lk(a)}return h}a=f,f=a.parentNode}return null}function sl(a){if(a=a[wi]||a[tl]){var h=a.tag;if(h===5||h===6||h===13||h===31||h===26||h===27||h===3)return a}return null}function Yh(a){var h=a.tag;if(h===5||h===26||h===27||h===6)return a.stateNode;throw Error(s(33))}function rl(a){var h=a[dx];return h||(h=a[dx]={hoistableStyles:new Map,hoistableScripts:new Map}),h}function ai(a){a[Uh]=!0}var px=new Set,mx={};function ea(a,h){nl(a,h),nl(a+"Capture",h)}function nl(a,h){for(mx[a]=h,a=0;a<h.length;a++)px.add(h[a])}var g4=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),gx={},Ox={};function O4(a){return el.call(Ox,a)?!0:el.call(gx,a)?!1:g4.test(a)?Ox[a]=!0:(gx[a]=!0,!1)}function Df(a,h,f){if(O4(h))if(f===null)a.removeAttribute(h);else{switch(typeof f){case"undefined":case"function":case"symbol":a.removeAttribute(h);return;case"boolean":var p=h.toLowerCase().slice(0,5);if(p!=="data-"&&p!=="aria-"){a.removeAttribute(h);return}}a.setAttribute(h,""+f)}}function zf(a,h,f){if(f===null)a.removeAttribute(h);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(h);return}a.setAttribute(h,""+f)}}function hn(a,h,f,p){if(p===null)a.removeAttribute(f);else{switch(typeof p){case"undefined":case"function":case"symbol":case"boolean":a.removeAttribute(f);return}a.setAttributeNS(h,f,""+p)}}function Ns(a){switch(typeof a){case"bigint":case"boolean":case"number":case"string":case"undefined":return a;case"object":return a;default:return""}}function _x(a){var h=a.type;return(a=a.nodeName)&&a.toLowerCase()==="input"&&(h==="checkbox"||h==="radio")}function _4(a,h,f){var p=Object.getOwnPropertyDescriptor(a.constructor.prototype,h);if(!a.hasOwnProperty(h)&&typeof p<"u"&&typeof p.get=="function"&&typeof p.set=="function"){var O=p.get,v=p.set;return Object.defineProperty(a,h,{configurable:!0,get:function(){return O.call(this)},set:function(S){f=""+S,v.call(this,S)}}),Object.defineProperty(a,h,{enumerable:p.enumerable}),{getValue:function(){return f},setValue:function(S){f=""+S},stopTracking:function(){a._valueTracker=null,delete a[h]}}}}function Rg(a){if(!a._valueTracker){var h=_x(a)?"checked":"value";a._valueTracker=_4(a,h,""+a[h])}}function vx(a){if(!a)return!1;var h=a._valueTracker;if(!h)return!0;var f=h.getValue(),p="";return a&&(p=_x(a)?a.checked?"true":"false":a.value),a=p,a!==f?(h.setValue(a),!0):!1}function Nf(a){if(a=a||(typeof document<"u"?document:void 0),typeof a>"u")return null;try{return a.activeElement||a.body}catch{return a.body}}var v4=/[\n"\\]/g;function Xs(a){return a.replace(v4,function(h){return"\\"+h.charCodeAt(0).toString(16)+" "})}function Lg(a,h,f,p,O,v,S,T){a.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?a.type=S:a.removeAttribute("type"),h!=null?S==="number"?(h===0&&a.value===""||a.value!=h)&&(a.value=""+Ns(h)):a.value!==""+Ns(h)&&(a.value=""+Ns(h)):S!=="submit"&&S!=="reset"||a.removeAttribute("value"),h!=null?$g(a,S,Ns(h)):f!=null?$g(a,S,Ns(f)):p!=null&&a.removeAttribute("value"),O==null&&v!=null&&(a.defaultChecked=!!v),O!=null&&(a.checked=O&&typeof O!="function"&&typeof O!="symbol"),T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?a.name=""+Ns(T):a.removeAttribute("name")}function yx(a,h,f,p,O,v,S,T){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(a.type=v),h!=null||f!=null){if(!(v!=="submit"&&v!=="reset"||h!=null)){Rg(a);return}f=f!=null?""+Ns(f):"",h=h!=null?""+Ns(h):f,T||h===a.value||(a.value=h),a.defaultValue=h}p=p??O,p=typeof p!="function"&&typeof p!="symbol"&&!!p,a.checked=T?a.checked:!!p,a.defaultChecked=!!p,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(a.name=S),Rg(a)}function $g(a,h,f){h==="number"&&Nf(a.ownerDocument)===a||a.defaultValue===""+f||(a.defaultValue=""+f)}function ol(a,h,f,p){if(a=a.options,h){h={};for(var O=0;O<f.length;O++)h["$"+f[O]]=!0;for(f=0;f<a.length;f++)O=h.hasOwnProperty("$"+a[f].value),a[f].selected!==O&&(a[f].selected=O),O&&p&&(a[f].defaultSelected=!0)}else{for(f=""+Ns(f),h=null,O=0;O<a.length;O++){if(a[O].value===f){a[O].selected=!0,p&&(a[O].defaultSelected=!0);return}h!==null||a[O].disabled||(h=a[O])}h!==null&&(h.selected=!0)}}function bx(a,h,f){if(h!=null&&(h=""+Ns(h),h!==a.value&&(a.value=h),f==null)){a.defaultValue!==h&&(a.defaultValue=h);return}a.defaultValue=f!=null?""+Ns(f):""}function Sx(a,h,f,p){if(h==null){if(p!=null){if(f!=null)throw Error(s(92));if(Z(p)){if(1<p.length)throw Error(s(93));p=p[0]}f=p}f==null&&(f=""),h=f}f=Ns(h),a.defaultValue=f,p=a.textContent,p===f&&p!==""&&p!==null&&(a.value=p),Rg(a)}function al(a,h){if(h){var f=a.firstChild;if(f&&f===a.lastChild&&f.nodeType===3){f.nodeValue=h;return}}a.textContent=h}var y4=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function xx(a,h,f){var p=h.indexOf("--")===0;f==null||typeof f=="boolean"||f===""?p?a.setProperty(h,""):h==="float"?a.cssFloat="":a[h]="":p?a.setProperty(h,f):typeof f!="number"||f===0||y4.has(h)?h==="float"?a.cssFloat=f:a[h]=(""+f).trim():a[h]=f+"px"}function wx(a,h,f){if(h!=null&&typeof h!="object")throw Error(s(62));if(a=a.style,f!=null){for(var p in f)!f.hasOwnProperty(p)||h!=null&&h.hasOwnProperty(p)||(p.indexOf("--")===0?a.setProperty(p,""):p==="float"?a.cssFloat="":a[p]="");for(var O in h)p=h[O],h.hasOwnProperty(O)&&f[O]!==p&&xx(a,O,p)}else for(var v in h)h.hasOwnProperty(v)&&xx(a,v,h[v])}function Bg(a){if(a.indexOf("-")===-1)return!1;switch(a){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 b4=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),S4=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xf(a){return S4.test(""+a)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":a}function cn(){}var Dg=null;function zg(a){return a=a.target||a.srcElement||window,a.correspondingUseElement&&(a=a.correspondingUseElement),a.nodeType===3?a.parentNode:a}var ll=null,hl=null;function Cx(a){var h=sl(a);if(h&&(a=h.stateNode)){var f=a[rs]||null;e:switch(a=h.stateNode,h.type){case"input":if(Lg(a,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name),h=f.name,f.type==="radio"&&h!=null){for(f=a;f.parentNode;)f=f.parentNode;for(f=f.querySelectorAll('input[name="'+Xs(""+h)+'"][type="radio"]'),h=0;h<f.length;h++){var p=f[h];if(p!==a&&p.form===a.form){var O=p[rs]||null;if(!O)throw Error(s(90));Lg(p,O.value,O.defaultValue,O.defaultValue,O.checked,O.defaultChecked,O.type,O.name)}}for(h=0;h<f.length;h++)p=f[h],p.form===a.form&&vx(p)}break e;case"textarea":bx(a,f.value,f.defaultValue);break e;case"select":h=f.value,h!=null&&ol(a,!!f.multiple,h,!1)}}}var Ng=!1;function kx(a,h,f){if(Ng)return a(h,f);Ng=!0;try{var p=a(h);return p}finally{if(Ng=!1,(ll!==null||hl!==null)&&(Td(),ll&&(h=ll,a=hl,hl=ll=null,Cx(h),a)))for(h=0;h<a.length;h++)Cx(a[h])}}function Hh(a,h){var f=a.stateNode;if(f===null)return null;var p=f[rs]||null;if(p===null)return null;f=p[h];e:switch(h){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(p=!p.disabled)||(a=a.type,p=!(a==="button"||a==="input"||a==="select"||a==="textarea")),a=!p;break e;default:a=!1}if(a)return null;if(f&&typeof f!="function")throw Error(s(231,h,typeof f));return f}var un=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Xg=!1;if(un)try{var Fh={};Object.defineProperty(Fh,"passive",{get:function(){Xg=!0}}),window.addEventListener("test",Fh,Fh),window.removeEventListener("test",Fh,Fh)}catch{Xg=!1}var Gn=null,Vg=null,Vf=null;function Tx(){if(Vf)return Vf;var a,h=Vg,f=h.length,p,O="value"in Gn?Gn.value:Gn.textContent,v=O.length;for(a=0;a<f&&h[a]===O[a];a++);var S=f-a;for(p=1;p<=S&&h[f-p]===O[v-p];p++);return Vf=O.slice(a,1<p?1-p:void 0)}function Zf(a){var h=a.keyCode;return"charCode"in a?(a=a.charCode,a===0&&h===13&&(a=13)):a=h,a===10&&(a=13),32<=a||a===13?a:0}function jf(){return!0}function Ax(){return!1}function ns(a){function h(f,p,O,v,S){this._reactName=f,this._targetInst=O,this.type=p,this.nativeEvent=v,this.target=S,this.currentTarget=null;for(var T in a)a.hasOwnProperty(T)&&(f=a[T],this[T]=f?f(v):v[T]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?jf:Ax,this.isPropagationStopped=Ax,this}return m(h.prototype,{preventDefault:function(){this.defaultPrevented=!0;var f=this.nativeEvent;f&&(f.preventDefault?f.preventDefault():typeof f.returnValue!="unknown"&&(f.returnValue=!1),this.isDefaultPrevented=jf)},stopPropagation:function(){var f=this.nativeEvent;f&&(f.stopPropagation?f.stopPropagation():typeof f.cancelBubble!="unknown"&&(f.cancelBubble=!0),this.isPropagationStopped=jf)},persist:function(){},isPersistent:jf}),h}var ta={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(a){return a.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},If=ns(ta),Gh=m({},ta,{view:0,detail:0}),x4=ns(Gh),Zg,jg,Kh,qf=m({},Gh,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:qg,button:0,buttons:0,relatedTarget:function(a){return a.relatedTarget===void 0?a.fromElement===a.srcElement?a.toElement:a.fromElement:a.relatedTarget},movementX:function(a){return"movementX"in a?a.movementX:(a!==Kh&&(Kh&&a.type==="mousemove"?(Zg=a.screenX-Kh.screenX,jg=a.screenY-Kh.screenY):jg=Zg=0,Kh=a),Zg)},movementY:function(a){return"movementY"in a?a.movementY:jg}}),Mx=ns(qf),w4=m({},qf,{dataTransfer:0}),C4=ns(w4),k4=m({},Gh,{relatedTarget:0}),Ig=ns(k4),T4=m({},ta,{animationName:0,elapsedTime:0,pseudoElement:0}),A4=ns(T4),M4=m({},ta,{clipboardData:function(a){return"clipboardData"in a?a.clipboardData:window.clipboardData}}),E4=ns(M4),P4=m({},ta,{data:0}),Ex=ns(P4),Q4={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},R4={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"},L4={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $4(a){var h=this.nativeEvent;return h.getModifierState?h.getModifierState(a):(a=L4[a])?!!h[a]:!1}function qg(){return $4}var B4=m({},Gh,{key:function(a){if(a.key){var h=Q4[a.key]||a.key;if(h!=="Unidentified")return h}return a.type==="keypress"?(a=Zf(a),a===13?"Enter":String.fromCharCode(a)):a.type==="keydown"||a.type==="keyup"?R4[a.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:qg,charCode:function(a){return a.type==="keypress"?Zf(a):0},keyCode:function(a){return a.type==="keydown"||a.type==="keyup"?a.keyCode:0},which:function(a){return a.type==="keypress"?Zf(a):a.type==="keydown"||a.type==="keyup"?a.keyCode:0}}),D4=ns(B4),z4=m({},qf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Px=ns(z4),N4=m({},Gh,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:qg}),X4=ns(N4),V4=m({},ta,{propertyName:0,elapsedTime:0,pseudoElement:0}),Z4=ns(V4),j4=m({},qf,{deltaX:function(a){return"deltaX"in a?a.deltaX:"wheelDeltaX"in a?-a.wheelDeltaX:0},deltaY:function(a){return"deltaY"in a?a.deltaY:"wheelDeltaY"in a?-a.wheelDeltaY:"wheelDelta"in a?-a.wheelDelta:0},deltaZ:0,deltaMode:0}),I4=ns(j4),q4=m({},ta,{newState:0,oldState:0}),W4=ns(q4),U4=[9,13,27,32],Wg=un&&"CompositionEvent"in window,Jh=null;un&&"documentMode"in document&&(Jh=document.documentMode);var Y4=un&&"TextEvent"in window&&!Jh,Qx=un&&(!Wg||Jh&&8<Jh&&11>=Jh),Rx=" ",Lx=!1;function $x(a,h){switch(a){case"keyup":return U4.indexOf(h.keyCode)!==-1;case"keydown":return h.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bx(a){return a=a.detail,typeof a=="object"&&"data"in a?a.data:null}var cl=!1;function H4(a,h){switch(a){case"compositionend":return Bx(h);case"keypress":return h.which!==32?null:(Lx=!0,Rx);case"textInput":return a=h.data,a===Rx&&Lx?null:a;default:return null}}function F4(a,h){if(cl)return a==="compositionend"||!Wg&&$x(a,h)?(a=Tx(),Vf=Vg=Gn=null,cl=!1,a):null;switch(a){case"paste":return null;case"keypress":if(!(h.ctrlKey||h.altKey||h.metaKey)||h.ctrlKey&&h.altKey){if(h.char&&1<h.char.length)return h.char;if(h.which)return String.fromCharCode(h.which)}return null;case"compositionend":return Qx&&h.locale!=="ko"?null:h.data;default:return null}}var G4={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 Dx(a){var h=a&&a.nodeName&&a.nodeName.toLowerCase();return h==="input"?!!G4[a.type]:h==="textarea"}function zx(a,h,f,p){ll?hl?hl.push(p):hl=[p]:ll=p,h=Ld(h,"onChange"),0<h.length&&(f=new If("onChange","change",null,f,p),a.push({event:f,listeners:h}))}var ec=null,tc=null;function K4(a){yk(a,0)}function Wf(a){var h=Yh(a);if(vx(h))return a}function Nx(a,h){if(a==="change")return h}var Xx=!1;if(un){var Ug;if(un){var Yg="oninput"in document;if(!Yg){var Vx=document.createElement("div");Vx.setAttribute("oninput","return;"),Yg=typeof Vx.oninput=="function"}Ug=Yg}else Ug=!1;Xx=Ug&&(!document.documentMode||9<document.documentMode)}function Zx(){ec&&(ec.detachEvent("onpropertychange",jx),tc=ec=null)}function jx(a){if(a.propertyName==="value"&&Wf(tc)){var h=[];zx(h,tc,a,zg(a)),kx(K4,h)}}function J4(a,h,f){a==="focusin"?(Zx(),ec=h,tc=f,ec.attachEvent("onpropertychange",jx)):a==="focusout"&&Zx()}function e6(a){if(a==="selectionchange"||a==="keyup"||a==="keydown")return Wf(tc)}function t6(a,h){if(a==="click")return Wf(h)}function i6(a,h){if(a==="input"||a==="change")return Wf(h)}function s6(a,h){return a===h&&(a!==0||1/a===1/h)||a!==a&&h!==h}var Ss=typeof Object.is=="function"?Object.is:s6;function ic(a,h){if(Ss(a,h))return!0;if(typeof a!="object"||a===null||typeof h!="object"||h===null)return!1;var f=Object.keys(a),p=Object.keys(h);if(f.length!==p.length)return!1;for(p=0;p<f.length;p++){var O=f[p];if(!el.call(h,O)||!Ss(a[O],h[O]))return!1}return!0}function Ix(a){for(;a&&a.firstChild;)a=a.firstChild;return a}function qx(a,h){var f=Ix(a);a=0;for(var p;f;){if(f.nodeType===3){if(p=a+f.textContent.length,a<=h&&p>=h)return{node:f,offset:h-a};a=p}e:{for(;f;){if(f.nextSibling){f=f.nextSibling;break e}f=f.parentNode}f=void 0}f=Ix(f)}}function Wx(a,h){return a&&h?a===h?!0:a&&a.nodeType===3?!1:h&&h.nodeType===3?Wx(a,h.parentNode):"contains"in a?a.contains(h):a.compareDocumentPosition?!!(a.compareDocumentPosition(h)&16):!1:!1}function Ux(a){a=a!=null&&a.ownerDocument!=null&&a.ownerDocument.defaultView!=null?a.ownerDocument.defaultView:window;for(var h=Nf(a.document);h instanceof a.HTMLIFrameElement;){try{var f=typeof h.contentWindow.location.href=="string"}catch{f=!1}if(f)a=h.contentWindow;else break;h=Nf(a.document)}return h}function Hg(a){var h=a&&a.nodeName&&a.nodeName.toLowerCase();return h&&(h==="input"&&(a.type==="text"||a.type==="search"||a.type==="tel"||a.type==="url"||a.type==="password")||h==="textarea"||a.contentEditable==="true")}var r6=un&&"documentMode"in document&&11>=document.documentMode,ul=null,Fg=null,sc=null,Gg=!1;function Yx(a,h,f){var p=f.window===f?f.document:f.nodeType===9?f:f.ownerDocument;Gg||ul==null||ul!==Nf(p)||(p=ul,"selectionStart"in p&&Hg(p)?p={start:p.selectionStart,end:p.selectionEnd}:(p=(p.ownerDocument&&p.ownerDocument.defaultView||window).getSelection(),p={anchorNode:p.anchorNode,anchorOffset:p.anchorOffset,focusNode:p.focusNode,focusOffset:p.focusOffset}),sc&&ic(sc,p)||(sc=p,p=Ld(Fg,"onSelect"),0<p.length&&(h=new If("onSelect","select",null,h,f),a.push({event:h,listeners:p}),h.target=ul)))}function ia(a,h){var f={};return f[a.toLowerCase()]=h.toLowerCase(),f["Webkit"+a]="webkit"+h,f["Moz"+a]="moz"+h,f}var fl={animationend:ia("Animation","AnimationEnd"),animationiteration:ia("Animation","AnimationIteration"),animationstart:ia("Animation","AnimationStart"),transitionrun:ia("Transition","TransitionRun"),transitionstart:ia("Transition","TransitionStart"),transitioncancel:ia("Transition","TransitionCancel"),transitionend:ia("Transition","TransitionEnd")},Kg={},Hx={};un&&(Hx=document.createElement("div").style,"AnimationEvent"in window||(delete fl.animationend.animation,delete fl.animationiteration.animation,delete fl.animationstart.animation),"TransitionEvent"in window||delete fl.transitionend.transition);function sa(a){if(Kg[a])return Kg[a];if(!fl[a])return a;var h=fl[a],f;for(f in h)if(h.hasOwnProperty(f)&&f in Hx)return Kg[a]=h[f];return a}var Fx=sa("animationend"),Gx=sa("animationiteration"),Kx=sa("animationstart"),n6=sa("transitionrun"),o6=sa("transitionstart"),a6=sa("transitioncancel"),Jx=sa("transitionend"),ew=new Map,Jg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Jg.push("scrollEnd");function fr(a,h){ew.set(a,h),ea(h,[a])}var Uf=typeof reportError=="function"?reportError:function(a){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof a=="object"&&a!==null&&typeof a.message=="string"?String(a.message):String(a),error:a});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",a);return}console.error(a)},Vs=[],dl=0,eO=0;function Yf(){for(var a=dl,h=eO=dl=0;h<a;){var f=Vs[h];Vs[h++]=null;var p=Vs[h];Vs[h++]=null;var O=Vs[h];Vs[h++]=null;var v=Vs[h];if(Vs[h++]=null,p!==null&&O!==null){var S=p.pending;S===null?O.next=O:(O.next=S.next,S.next=O),p.pending=O}v!==0&&tw(f,O,v)}}function Hf(a,h,f,p){Vs[dl++]=a,Vs[dl++]=h,Vs[dl++]=f,Vs[dl++]=p,eO|=p,a.lanes|=p,a=a.alternate,a!==null&&(a.lanes|=p)}function tO(a,h,f,p){return Hf(a,h,f,p),Ff(a)}function ra(a,h){return Hf(a,null,null,h),Ff(a)}function tw(a,h,f){a.lanes|=f;var p=a.alternate;p!==null&&(p.lanes|=f);for(var O=!1,v=a.return;v!==null;)v.childLanes|=f,p=v.alternate,p!==null&&(p.childLanes|=f),v.tag===22&&(a=v.stateNode,a===null||a._visibility&1||(O=!0)),a=v,v=v.return;return a.tag===3?(v=a.stateNode,O&&h!==null&&(O=31-bs(f),a=v.hiddenUpdates,p=a[O],p===null?a[O]=[h]:p.push(h),h.lane=f|536870912),v):null}function Ff(a){if(50<Cc)throw Cc=0,c0=null,Error(s(185));for(var h=a.return;h!==null;)a=h,h=a.return;return a.tag===3?a.stateNode:null}var pl={};function l6(a,h,f,p){this.tag=a,this.key=f,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=p,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xs(a,h,f,p){return new l6(a,h,f,p)}function iO(a){return a=a.prototype,!(!a||!a.isReactComponent)}function fn(a,h){var f=a.alternate;return f===null?(f=xs(a.tag,h,a.key,a.mode),f.elementType=a.elementType,f.type=a.type,f.stateNode=a.stateNode,f.alternate=a,a.alternate=f):(f.pendingProps=h,f.type=a.type,f.flags=0,f.subtreeFlags=0,f.deletions=null),f.flags=a.flags&65011712,f.childLanes=a.childLanes,f.lanes=a.lanes,f.child=a.child,f.memoizedProps=a.memoizedProps,f.memoizedState=a.memoizedState,f.updateQueue=a.updateQueue,h=a.dependencies,f.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},f.sibling=a.sibling,f.index=a.index,f.ref=a.ref,f.refCleanup=a.refCleanup,f}function iw(a,h){a.flags&=65011714;var f=a.alternate;return f===null?(a.childLanes=0,a.lanes=h,a.child=null,a.subtreeFlags=0,a.memoizedProps=null,a.memoizedState=null,a.updateQueue=null,a.dependencies=null,a.stateNode=null):(a.childLanes=f.childLanes,a.lanes=f.lanes,a.child=f.child,a.subtreeFlags=0,a.deletions=null,a.memoizedProps=f.memoizedProps,a.memoizedState=f.memoizedState,a.updateQueue=f.updateQueue,a.type=f.type,h=f.dependencies,a.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),a}function Gf(a,h,f,p,O,v){var S=0;if(p=a,typeof a=="function")iO(a)&&(S=1);else if(typeof a=="string")S=dz(a,f,ce.current)?26:a==="html"||a==="head"||a==="body"?27:5;else e:switch(a){case I:return a=xs(31,f,h,O),a.elementType=I,a.lanes=v,a;case b:return na(f.children,O,v,h);case x:S=8,O|=24;break;case w:return a=xs(12,f,h,O|2),a.elementType=w,a.lanes=v,a;case P:return a=xs(13,f,h,O),a.elementType=P,a.lanes=v,a;case E:return a=xs(19,f,h,O),a.elementType=E,a.lanes=v,a;default:if(typeof a=="object"&&a!==null)switch(a.$$typeof){case C:S=10;break e;case k:S=9;break e;case A:S=11;break e;case $:S=14;break e;case z:S=16,p=null;break e}S=29,f=Error(s(130,a===null?"null":typeof a,"")),p=null}return h=xs(S,f,h,O),h.elementType=a,h.type=p,h.lanes=v,h}function na(a,h,f,p){return a=xs(7,a,p,h),a.lanes=f,a}function sO(a,h,f){return a=xs(6,a,null,h),a.lanes=f,a}function sw(a){var h=xs(18,null,null,0);return h.stateNode=a,h}function rO(a,h,f){return h=xs(4,a.children!==null?a.children:[],a.key,h),h.lanes=f,h.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation},h}var rw=new WeakMap;function Zs(a,h){if(typeof a=="object"&&a!==null){var f=rw.get(a);return f!==void 0?f:(h={value:a,source:h,stack:Zh(h)},rw.set(a,h),h)}return{value:a,source:h,stack:Zh(h)}}var ml=[],gl=0,Kf=null,rc=0,js=[],Is=0,Kn=null,Mr=1,Er="";function dn(a,h){ml[gl++]=rc,ml[gl++]=Kf,Kf=a,rc=h}function nw(a,h,f){js[Is++]=Mr,js[Is++]=Er,js[Is++]=Kn,Kn=a;var p=Mr;a=Er;var O=32-bs(p)-1;p&=~(1<<O),f+=1;var v=32-bs(h)+O;if(30<v){var S=O-O%5;v=(p&(1<<S)-1).toString(32),p>>=S,O-=S,Mr=1<<32-bs(h)+O|f<<O|p,Er=v+a}else Mr=1<<v|f<<O|p,Er=a}function nO(a){a.return!==null&&(dn(a,1),nw(a,1,0))}function oO(a){for(;a===Kf;)Kf=ml[--gl],ml[gl]=null,rc=ml[--gl],ml[gl]=null;for(;a===Kn;)Kn=js[--Is],js[Is]=null,Er=js[--Is],js[Is]=null,Mr=js[--Is],js[Is]=null}function ow(a,h){js[Is++]=Mr,js[Is++]=Er,js[Is++]=Kn,Mr=h.id,Er=h.overflow,Kn=a}var Ci=null,gt=null,Ue=!1,Jn=null,qs=!1,aO=Error(s(519));function eo(a){var h=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nc(Zs(h,a)),aO}function aw(a){var h=a.stateNode,f=a.type,p=a.memoizedProps;switch(h[wi]=a,h[rs]=p,f){case"dialog":Ze("cancel",h),Ze("close",h);break;case"iframe":case"object":case"embed":Ze("load",h);break;case"video":case"audio":for(f=0;f<Tc.length;f++)Ze(Tc[f],h);break;case"source":Ze("error",h);break;case"img":case"image":case"link":Ze("error",h),Ze("load",h);break;case"details":Ze("toggle",h);break;case"input":Ze("invalid",h),yx(h,p.value,p.defaultValue,p.checked,p.defaultChecked,p.type,p.name,!0);break;case"select":Ze("invalid",h);break;case"textarea":Ze("invalid",h),Sx(h,p.value,p.defaultValue,p.children)}f=p.children,typeof f!="string"&&typeof f!="number"&&typeof f!="bigint"||h.textContent===""+f||p.suppressHydrationWarning===!0||wk(h.textContent,f)?(p.popover!=null&&(Ze("beforetoggle",h),Ze("toggle",h)),p.onScroll!=null&&Ze("scroll",h),p.onScrollEnd!=null&&Ze("scrollend",h),p.onClick!=null&&(h.onclick=cn),h=!0):h=!1,h||eo(a,!0)}function lw(a){for(Ci=a.return;Ci;)switch(Ci.tag){case 5:case 31:case 13:qs=!1;return;case 27:case 3:qs=!0;return;default:Ci=Ci.return}}function Ol(a){if(a!==Ci)return!1;if(!Ue)return lw(a),Ue=!0,!1;var h=a.tag,f;if((f=h!==3&&h!==27)&&((f=h===5)&&(f=a.type,f=!(f!=="form"&&f!=="button")||C0(a.type,a.memoizedProps)),f=!f),f&>&&eo(a),lw(a),h===13){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(s(317));gt=Rk(a)}else if(h===31){if(a=a.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(s(317));gt=Rk(a)}else h===27?(h=gt,mo(a.type)?(a=E0,E0=null,gt=a):gt=h):gt=Ci?Us(a.stateNode.nextSibling):null;return!0}function oa(){gt=Ci=null,Ue=!1}function lO(){var a=Jn;return a!==null&&(hs===null?hs=a:hs.push.apply(hs,a),Jn=null),a}function nc(a){Jn===null?Jn=[a]:Jn.push(a)}var hO=D(null),aa=null,pn=null;function to(a,h,f){ie(hO,h._currentValue),h._currentValue=f}function mn(a){a._currentValue=hO.current,G(hO)}function cO(a,h,f){for(;a!==null;){var p=a.alternate;if((a.childLanes&h)!==h?(a.childLanes|=h,p!==null&&(p.childLanes|=h)):p!==null&&(p.childLanes&h)!==h&&(p.childLanes|=h),a===f)break;a=a.return}}function uO(a,h,f,p){var O=a.child;for(O!==null&&(O.return=a);O!==null;){var v=O.dependencies;if(v!==null){var S=O.child;v=v.firstContext;e:for(;v!==null;){var T=v;v=O;for(var V=0;V<h.length;V++)if(T.context===h[V]){v.lanes|=f,T=v.alternate,T!==null&&(T.lanes|=f),cO(v.return,f,a),p||(S=null);break e}v=T.next}}else if(O.tag===18){if(S=O.return,S===null)throw Error(s(341));S.lanes|=f,v=S.alternate,v!==null&&(v.lanes|=f),cO(S,f,a),S=null}else S=O.child;if(S!==null)S.return=O;else for(S=O;S!==null;){if(S===a){S=null;break}if(O=S.sibling,O!==null){O.return=S.return,S=O;break}S=S.return}O=S}}function _l(a,h,f,p){a=null;for(var O=h,v=!1;O!==null;){if(!v){if((O.flags&524288)!==0)v=!0;else if((O.flags&262144)!==0)break}if(O.tag===10){var S=O.alternate;if(S===null)throw Error(s(387));if(S=S.memoizedProps,S!==null){var T=O.type;Ss(O.pendingProps.value,S.value)||(a!==null?a.push(T):a=[T])}}else if(O===ge.current){if(S=O.alternate,S===null)throw Error(s(387));S.memoizedState.memoizedState!==O.memoizedState.memoizedState&&(a!==null?a.push(Qc):a=[Qc])}O=O.return}a!==null&&uO(h,a,f,p),h.flags|=262144}function Jf(a){for(a=a.firstContext;a!==null;){if(!Ss(a.context._currentValue,a.memoizedValue))return!0;a=a.next}return!1}function la(a){aa=a,pn=null,a=a.dependencies,a!==null&&(a.firstContext=null)}function ki(a){return hw(aa,a)}function ed(a,h){return aa===null&&la(a),hw(a,h)}function hw(a,h){var f=h._currentValue;if(h={context:h,memoizedValue:f,next:null},pn===null){if(a===null)throw Error(s(308));pn=h,a.dependencies={lanes:0,firstContext:h},a.flags|=524288}else pn=pn.next=h;return f}var h6=typeof AbortController<"u"?AbortController:function(){var a=[],h=this.signal={aborted:!1,addEventListener:function(f,p){a.push(p)}};this.abort=function(){h.aborted=!0,a.forEach(function(f){return f()})}},c6=i.unstable_scheduleCallback,u6=i.unstable_NormalPriority,Xt={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fO(){return{controller:new h6,data:new Map,refCount:0}}function oc(a){a.refCount--,a.refCount===0&&c6(u6,function(){a.controller.abort()})}var ac=null,dO=0,vl=0,yl=null;function f6(a,h){if(ac===null){var f=ac=[];dO=0,vl=g0(),yl={status:"pending",value:void 0,then:function(p){f.push(p)}}}return dO++,h.then(cw,cw),h}function cw(){if(--dO===0&&ac!==null){yl!==null&&(yl.status="fulfilled");var a=ac;ac=null,vl=0,yl=null;for(var h=0;h<a.length;h++)(0,a[h])()}}function d6(a,h){var f=[],p={status:"pending",value:null,reason:null,then:function(O){f.push(O)}};return a.then(function(){p.status="fulfilled",p.value=h;for(var O=0;O<f.length;O++)(0,f[O])(h)},function(O){for(p.status="rejected",p.reason=O,O=0;O<f.length;O++)(0,f[O])(void 0)}),p}var uw=Q.S;Q.S=function(a,h){YC=vs(),typeof h=="object"&&h!==null&&typeof h.then=="function"&&f6(a,h),uw!==null&&uw(a,h)};var ha=D(null);function pO(){var a=ha.current;return a!==null?a:lt.pooledCache}function td(a,h){h===null?ie(ha,ha.current):ie(ha,h.pool)}function fw(){var a=pO();return a===null?null:{parent:Xt._currentValue,pool:a}}var bl=Error(s(460)),mO=Error(s(474)),id=Error(s(542)),sd={then:function(){}};function dw(a){return a=a.status,a==="fulfilled"||a==="rejected"}function pw(a,h,f){switch(f=a[f],f===void 0?a.push(h):f!==h&&(h.then(cn,cn),h=f),h.status){case"fulfilled":return h.value;case"rejected":throw a=h.reason,gw(a),a;default:if(typeof h.status=="string")h.then(cn,cn);else{if(a=lt,a!==null&&100<a.shellSuspendCounter)throw Error(s(482));a=h,a.status="pending",a.then(function(p){if(h.status==="pending"){var O=h;O.status="fulfilled",O.value=p}},function(p){if(h.status==="pending"){var O=h;O.status="rejected",O.reason=p}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw a=h.reason,gw(a),a}throw ua=h,bl}}function ca(a){try{var h=a._init;return h(a._payload)}catch(f){throw f!==null&&typeof f=="object"&&typeof f.then=="function"?(ua=f,bl):f}}var ua=null;function mw(){if(ua===null)throw Error(s(459));var a=ua;return ua=null,a}function gw(a){if(a===bl||a===id)throw Error(s(483))}var Sl=null,lc=0;function rd(a){var h=lc;return lc+=1,Sl===null&&(Sl=[]),pw(Sl,a,h)}function hc(a,h){h=h.props.ref,a.ref=h!==void 0?h:null}function nd(a,h){throw h.$$typeof===g?Error(s(525)):(a=Object.prototype.toString.call(h),Error(s(31,a==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":a)))}function Ow(a){function h(H,j){if(a){var K=H.deletions;K===null?(H.deletions=[j],H.flags|=16):K.push(j)}}function f(H,j){if(!a)return null;for(;j!==null;)h(H,j),j=j.sibling;return null}function p(H){for(var j=new Map;H!==null;)H.key!==null?j.set(H.key,H):j.set(H.index,H),H=H.sibling;return j}function O(H,j){return H=fn(H,j),H.index=0,H.sibling=null,H}function v(H,j,K){return H.index=K,a?(K=H.alternate,K!==null?(K=K.index,K<j?(H.flags|=67108866,j):K):(H.flags|=67108866,j)):(H.flags|=1048576,j)}function S(H){return a&&H.alternate===null&&(H.flags|=67108866),H}function T(H,j,K,oe){return j===null||j.tag!==6?(j=sO(K,H.mode,oe),j.return=H,j):(j=O(j,K),j.return=H,j)}function V(H,j,K,oe){var Me=K.type;return Me===b?re(H,j,K.props.children,oe,K.key):j!==null&&(j.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===z&&ca(Me)===j.type)?(j=O(j,K.props),hc(j,K),j.return=H,j):(j=Gf(K.type,K.key,K.props,null,H.mode,oe),hc(j,K),j.return=H,j)}function J(H,j,K,oe){return j===null||j.tag!==4||j.stateNode.containerInfo!==K.containerInfo||j.stateNode.implementation!==K.implementation?(j=rO(K,H.mode,oe),j.return=H,j):(j=O(j,K.children||[]),j.return=H,j)}function re(H,j,K,oe,Me){return j===null||j.tag!==7?(j=na(K,H.mode,oe,Me),j.return=H,j):(j=O(j,K),j.return=H,j)}function ae(H,j,K){if(typeof j=="string"&&j!==""||typeof j=="number"||typeof j=="bigint")return j=sO(""+j,H.mode,K),j.return=H,j;if(typeof j=="object"&&j!==null){switch(j.$$typeof){case _:return K=Gf(j.type,j.key,j.props,null,H.mode,K),hc(K,j),K.return=H,K;case y:return j=rO(j,H.mode,K),j.return=H,j;case z:return j=ca(j),ae(H,j,K)}if(Z(j)||R(j))return j=na(j,H.mode,K,null),j.return=H,j;if(typeof j.then=="function")return ae(H,rd(j),K);if(j.$$typeof===C)return ae(H,ed(H,j),K);nd(H,j)}return null}function ee(H,j,K,oe){var Me=j!==null?j.key:null;if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return Me!==null?null:T(H,j,""+K,oe);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case _:return K.key===Me?V(H,j,K,oe):null;case y:return K.key===Me?J(H,j,K,oe):null;case z:return K=ca(K),ee(H,j,K,oe)}if(Z(K)||R(K))return Me!==null?null:re(H,j,K,oe,null);if(typeof K.then=="function")return ee(H,j,rd(K),oe);if(K.$$typeof===C)return ee(H,j,ed(H,K),oe);nd(H,K)}return null}function te(H,j,K,oe,Me){if(typeof oe=="string"&&oe!==""||typeof oe=="number"||typeof oe=="bigint")return H=H.get(K)||null,T(j,H,""+oe,Me);if(typeof oe=="object"&&oe!==null){switch(oe.$$typeof){case _:return H=H.get(oe.key===null?K:oe.key)||null,V(j,H,oe,Me);case y:return H=H.get(oe.key===null?K:oe.key)||null,J(j,H,oe,Me);case z:return oe=ca(oe),te(H,j,K,oe,Me)}if(Z(oe)||R(oe))return H=H.get(K)||null,re(j,H,oe,Me,null);if(typeof oe.then=="function")return te(H,j,K,rd(oe),Me);if(oe.$$typeof===C)return te(H,j,K,ed(j,oe),Me);nd(j,oe)}return null}function be(H,j,K,oe){for(var Me=null,He=null,Ce=j,De=j=0,qe=null;Ce!==null&&De<K.length;De++){Ce.index>De?(qe=Ce,Ce=null):qe=Ce.sibling;var Fe=ee(H,Ce,K[De],oe);if(Fe===null){Ce===null&&(Ce=qe);break}a&&Ce&&Fe.alternate===null&&h(H,Ce),j=v(Fe,j,De),He===null?Me=Fe:He.sibling=Fe,He=Fe,Ce=qe}if(De===K.length)return f(H,Ce),Ue&&dn(H,De),Me;if(Ce===null){for(;De<K.length;De++)Ce=ae(H,K[De],oe),Ce!==null&&(j=v(Ce,j,De),He===null?Me=Ce:He.sibling=Ce,He=Ce);return Ue&&dn(H,De),Me}for(Ce=p(Ce);De<K.length;De++)qe=te(Ce,H,De,K[De],oe),qe!==null&&(a&&qe.alternate!==null&&Ce.delete(qe.key===null?De:qe.key),j=v(qe,j,De),He===null?Me=qe:He.sibling=qe,He=qe);return a&&Ce.forEach(function(yo){return h(H,yo)}),Ue&&dn(H,De),Me}function Ee(H,j,K,oe){if(K==null)throw Error(s(151));for(var Me=null,He=null,Ce=j,De=j=0,qe=null,Fe=K.next();Ce!==null&&!Fe.done;De++,Fe=K.next()){Ce.index>De?(qe=Ce,Ce=null):qe=Ce.sibling;var yo=ee(H,Ce,Fe.value,oe);if(yo===null){Ce===null&&(Ce=qe);break}a&&Ce&&yo.alternate===null&&h(H,Ce),j=v(yo,j,De),He===null?Me=yo:He.sibling=yo,He=yo,Ce=qe}if(Fe.done)return f(H,Ce),Ue&&dn(H,De),Me;if(Ce===null){for(;!Fe.done;De++,Fe=K.next())Fe=ae(H,Fe.value,oe),Fe!==null&&(j=v(Fe,j,De),He===null?Me=Fe:He.sibling=Fe,He=Fe);return Ue&&dn(H,De),Me}for(Ce=p(Ce);!Fe.done;De++,Fe=K.next())Fe=te(Ce,H,De,Fe.value,oe),Fe!==null&&(a&&Fe.alternate!==null&&Ce.delete(Fe.key===null?De:Fe.key),j=v(Fe,j,De),He===null?Me=Fe:He.sibling=Fe,He=Fe);return a&&Ce.forEach(function(wz){return h(H,wz)}),Ue&&dn(H,De),Me}function nt(H,j,K,oe){if(typeof K=="object"&&K!==null&&K.type===b&&K.key===null&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case _:e:{for(var Me=K.key;j!==null;){if(j.key===Me){if(Me=K.type,Me===b){if(j.tag===7){f(H,j.sibling),oe=O(j,K.props.children),oe.return=H,H=oe;break e}}else if(j.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===z&&ca(Me)===j.type){f(H,j.sibling),oe=O(j,K.props),hc(oe,K),oe.return=H,H=oe;break e}f(H,j);break}else h(H,j);j=j.sibling}K.type===b?(oe=na(K.props.children,H.mode,oe,K.key),oe.return=H,H=oe):(oe=Gf(K.type,K.key,K.props,null,H.mode,oe),hc(oe,K),oe.return=H,H=oe)}return S(H);case y:e:{for(Me=K.key;j!==null;){if(j.key===Me)if(j.tag===4&&j.stateNode.containerInfo===K.containerInfo&&j.stateNode.implementation===K.implementation){f(H,j.sibling),oe=O(j,K.children||[]),oe.return=H,H=oe;break e}else{f(H,j);break}else h(H,j);j=j.sibling}oe=rO(K,H.mode,oe),oe.return=H,H=oe}return S(H);case z:return K=ca(K),nt(H,j,K,oe)}if(Z(K))return be(H,j,K,oe);if(R(K)){if(Me=R(K),typeof Me!="function")throw Error(s(150));return K=Me.call(K),Ee(H,j,K,oe)}if(typeof K.then=="function")return nt(H,j,rd(K),oe);if(K.$$typeof===C)return nt(H,j,ed(H,K),oe);nd(H,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,j!==null&&j.tag===6?(f(H,j.sibling),oe=O(j,K),oe.return=H,H=oe):(f(H,j),oe=sO(K,H.mode,oe),oe.return=H,H=oe),S(H)):f(H,j)}return function(H,j,K,oe){try{lc=0;var Me=nt(H,j,K,oe);return Sl=null,Me}catch(Ce){if(Ce===bl||Ce===id)throw Ce;var He=xs(29,Ce,null,H.mode);return He.lanes=oe,He.return=H,He}finally{}}}var fa=Ow(!0),_w=Ow(!1),io=!1;function gO(a){a.updateQueue={baseState:a.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function OO(a,h){a=a.updateQueue,h.updateQueue===a&&(h.updateQueue={baseState:a.baseState,firstBaseUpdate:a.firstBaseUpdate,lastBaseUpdate:a.lastBaseUpdate,shared:a.shared,callbacks:null})}function so(a){return{lane:a,tag:0,payload:null,callback:null,next:null}}function ro(a,h,f){var p=a.updateQueue;if(p===null)return null;if(p=p.shared,(Ge&2)!==0){var O=p.pending;return O===null?h.next=h:(h.next=O.next,O.next=h),p.pending=h,h=Ff(a),tw(a,null,f),h}return Hf(a,p,h,f),Ff(a)}function cc(a,h,f){if(h=h.updateQueue,h!==null&&(h=h.shared,(f&4194048)!==0)){var p=h.lanes;p&=a.pendingLanes,f|=p,h.lanes=f,hx(a,f)}}function _O(a,h){var f=a.updateQueue,p=a.alternate;if(p!==null&&(p=p.updateQueue,f===p)){var O=null,v=null;if(f=f.firstBaseUpdate,f!==null){do{var S={lane:f.lane,tag:f.tag,payload:f.payload,callback:null,next:null};v===null?O=v=S:v=v.next=S,f=f.next}while(f!==null);v===null?O=v=h:v=v.next=h}else O=v=h;f={baseState:p.baseState,firstBaseUpdate:O,lastBaseUpdate:v,shared:p.shared,callbacks:p.callbacks},a.updateQueue=f;return}a=f.lastBaseUpdate,a===null?f.firstBaseUpdate=h:a.next=h,f.lastBaseUpdate=h}var vO=!1;function uc(){if(vO){var a=yl;if(a!==null)throw a}}function fc(a,h,f,p){vO=!1;var O=a.updateQueue;io=!1;var v=O.firstBaseUpdate,S=O.lastBaseUpdate,T=O.shared.pending;if(T!==null){O.shared.pending=null;var V=T,J=V.next;V.next=null,S===null?v=J:S.next=J,S=V;var re=a.alternate;re!==null&&(re=re.updateQueue,T=re.lastBaseUpdate,T!==S&&(T===null?re.firstBaseUpdate=J:T.next=J,re.lastBaseUpdate=V))}if(v!==null){var ae=O.baseState;S=0,re=J=V=null,T=v;do{var ee=T.lane&-536870913,te=ee!==T.lane;if(te?(Ie&ee)===ee:(p&ee)===ee){ee!==0&&ee===vl&&(vO=!0),re!==null&&(re=re.next={lane:0,tag:T.tag,payload:T.payload,callback:null,next:null});e:{var be=a,Ee=T;ee=h;var nt=f;switch(Ee.tag){case 1:if(be=Ee.payload,typeof be=="function"){ae=be.call(nt,ae,ee);break e}ae=be;break e;case 3:be.flags=be.flags&-65537|128;case 0:if(be=Ee.payload,ee=typeof be=="function"?be.call(nt,ae,ee):be,ee==null)break e;ae=m({},ae,ee);break e;case 2:io=!0}}ee=T.callback,ee!==null&&(a.flags|=64,te&&(a.flags|=8192),te=O.callbacks,te===null?O.callbacks=[ee]:te.push(ee))}else te={lane:ee,tag:T.tag,payload:T.payload,callback:T.callback,next:null},re===null?(J=re=te,V=ae):re=re.next=te,S|=ee;if(T=T.next,T===null){if(T=O.shared.pending,T===null)break;te=T,T=te.next,te.next=null,O.lastBaseUpdate=te,O.shared.pending=null}}while(!0);re===null&&(V=ae),O.baseState=V,O.firstBaseUpdate=J,O.lastBaseUpdate=re,v===null&&(O.shared.lanes=0),ho|=S,a.lanes=S,a.memoizedState=ae}}function vw(a,h){if(typeof a!="function")throw Error(s(191,a));a.call(h)}function yw(a,h){var f=a.callbacks;if(f!==null)for(a.callbacks=null,a=0;a<f.length;a++)vw(f[a],h)}var xl=D(null),od=D(0);function bw(a,h){a=wn,ie(od,a),ie(xl,h),wn=a|h.baseLanes}function yO(){ie(od,wn),ie(xl,xl.current)}function bO(){wn=od.current,G(xl),G(od)}var ws=D(null),Ws=null;function no(a){var h=a.alternate;ie($t,$t.current&1),ie(ws,a),Ws===null&&(h===null||xl.current!==null||h.memoizedState!==null)&&(Ws=a)}function SO(a){ie($t,$t.current),ie(ws,a),Ws===null&&(Ws=a)}function Sw(a){a.tag===22?(ie($t,$t.current),ie(ws,a),Ws===null&&(Ws=a)):oo()}function oo(){ie($t,$t.current),ie(ws,ws.current)}function Cs(a){G(ws),Ws===a&&(Ws=null),G($t)}var $t=D(0);function ad(a){for(var h=a;h!==null;){if(h.tag===13){var f=h.memoizedState;if(f!==null&&(f=f.dehydrated,f===null||A0(f)||M0(f)))return h}else if(h.tag===19&&(h.memoizedProps.revealOrder==="forwards"||h.memoizedProps.revealOrder==="backwards"||h.memoizedProps.revealOrder==="unstable_legacy-backwards"||h.memoizedProps.revealOrder==="together")){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===a)break;for(;h.sibling===null;){if(h.return===null||h.return===a)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}var gn=0,Be=null,st=null,Vt=null,ld=!1,wl=!1,da=!1,hd=0,dc=0,Cl=null,p6=0;function Tt(){throw Error(s(321))}function xO(a,h){if(h===null)return!1;for(var f=0;f<h.length&&f<a.length;f++)if(!Ss(a[f],h[f]))return!1;return!0}function wO(a,h,f,p,O,v){return gn=v,Be=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,Q.H=a===null||a.memoizedState===null?nC:NO,da=!1,v=f(p,O),da=!1,wl&&(v=ww(h,f,p,O)),xw(a),v}function xw(a){Q.H=gc;var h=st!==null&&st.next!==null;if(gn=0,Vt=st=Be=null,ld=!1,dc=0,Cl=null,h)throw Error(s(300));a===null||Zt||(a=a.dependencies,a!==null&&Jf(a)&&(Zt=!0))}function ww(a,h,f,p){Be=a;var O=0;do{if(wl&&(Cl=null),dc=0,wl=!1,25<=O)throw Error(s(301));if(O+=1,Vt=st=null,a.updateQueue!=null){var v=a.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}Q.H=oC,v=h(f,p)}while(wl);return v}function m6(){var a=Q.H,h=a.useState()[0];return h=typeof h.then=="function"?pc(h):h,a=a.useState()[0],(st!==null?st.memoizedState:null)!==a&&(Be.flags|=1024),h}function CO(){var a=hd!==0;return hd=0,a}function kO(a,h,f){h.updateQueue=a.updateQueue,h.flags&=-2053,a.lanes&=~f}function TO(a){if(ld){for(a=a.memoizedState;a!==null;){var h=a.queue;h!==null&&(h.pending=null),a=a.next}ld=!1}gn=0,Vt=st=Be=null,wl=!1,dc=hd=0,Cl=null}function Ui(){var a={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Vt===null?Be.memoizedState=Vt=a:Vt=Vt.next=a,Vt}function Bt(){if(st===null){var a=Be.alternate;a=a!==null?a.memoizedState:null}else a=st.next;var h=Vt===null?Be.memoizedState:Vt.next;if(h!==null)Vt=h,st=a;else{if(a===null)throw Be.alternate===null?Error(s(467)):Error(s(310));st=a,a={memoizedState:st.memoizedState,baseState:st.baseState,baseQueue:st.baseQueue,queue:st.queue,next:null},Vt===null?Be.memoizedState=Vt=a:Vt=Vt.next=a}return Vt}function cd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function pc(a){var h=dc;return dc+=1,Cl===null&&(Cl=[]),a=pw(Cl,a,h),h=Be,(Vt===null?h.memoizedState:Vt.next)===null&&(h=h.alternate,Q.H=h===null||h.memoizedState===null?nC:NO),a}function ud(a){if(a!==null&&typeof a=="object"){if(typeof a.then=="function")return pc(a);if(a.$$typeof===C)return ki(a)}throw Error(s(438,String(a)))}function AO(a){var h=null,f=Be.updateQueue;if(f!==null&&(h=f.memoCache),h==null){var p=Be.alternate;p!==null&&(p=p.updateQueue,p!==null&&(p=p.memoCache,p!=null&&(h={data:p.data.map(function(O){return O.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),f===null&&(f=cd(),Be.updateQueue=f),f.memoCache=h,f=h.data[h.index],f===void 0)for(f=h.data[h.index]=Array(a),p=0;p<a;p++)f[p]=se;return h.index++,f}function On(a,h){return typeof h=="function"?h(a):h}function fd(a){var h=Bt();return MO(h,st,a)}function MO(a,h,f){var p=a.queue;if(p===null)throw Error(s(311));p.lastRenderedReducer=f;var O=a.baseQueue,v=p.pending;if(v!==null){if(O!==null){var S=O.next;O.next=v.next,v.next=S}h.baseQueue=O=v,p.pending=null}if(v=a.baseState,O===null)a.memoizedState=v;else{h=O.next;var T=S=null,V=null,J=h,re=!1;do{var ae=J.lane&-536870913;if(ae!==J.lane?(Ie&ae)===ae:(gn&ae)===ae){var ee=J.revertLane;if(ee===0)V!==null&&(V=V.next={lane:0,revertLane:0,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),ae===vl&&(re=!0);else if((gn&ee)===ee){J=J.next,ee===vl&&(re=!0);continue}else ae={lane:0,revertLane:J.revertLane,gesture:null,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(T=V=ae,S=v):V=V.next=ae,Be.lanes|=ee,ho|=ee;ae=J.action,da&&f(v,ae),v=J.hasEagerState?J.eagerState:f(v,ae)}else ee={lane:ae,revertLane:J.revertLane,gesture:J.gesture,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},V===null?(T=V=ee,S=v):V=V.next=ee,Be.lanes|=ae,ho|=ae;J=J.next}while(J!==null&&J!==h);if(V===null?S=v:V.next=T,!Ss(v,a.memoizedState)&&(Zt=!0,re&&(f=yl,f!==null)))throw f;a.memoizedState=v,a.baseState=S,a.baseQueue=V,p.lastRenderedState=v}return O===null&&(p.lanes=0),[a.memoizedState,p.dispatch]}function EO(a){var h=Bt(),f=h.queue;if(f===null)throw Error(s(311));f.lastRenderedReducer=a;var p=f.dispatch,O=f.pending,v=h.memoizedState;if(O!==null){f.pending=null;var S=O=O.next;do v=a(v,S.action),S=S.next;while(S!==O);Ss(v,h.memoizedState)||(Zt=!0),h.memoizedState=v,h.baseQueue===null&&(h.baseState=v),f.lastRenderedState=v}return[v,p]}function Cw(a,h,f){var p=Be,O=Bt(),v=Ue;if(v){if(f===void 0)throw Error(s(407));f=f()}else f=h();var S=!Ss((st||O).memoizedState,f);if(S&&(O.memoizedState=f,Zt=!0),O=O.queue,RO(Aw.bind(null,p,O,a),[a]),O.getSnapshot!==h||S||Vt!==null&&Vt.memoizedState.tag&1){if(p.flags|=2048,kl(9,{destroy:void 0},Tw.bind(null,p,O,f,h),null),lt===null)throw Error(s(349));v||(gn&127)!==0||kw(p,h,f)}return f}function kw(a,h,f){a.flags|=16384,a={getSnapshot:h,value:f},h=Be.updateQueue,h===null?(h=cd(),Be.updateQueue=h,h.stores=[a]):(f=h.stores,f===null?h.stores=[a]:f.push(a))}function Tw(a,h,f,p){h.value=f,h.getSnapshot=p,Mw(h)&&Ew(a)}function Aw(a,h,f){return f(function(){Mw(h)&&Ew(a)})}function Mw(a){var h=a.getSnapshot;a=a.value;try{var f=h();return!Ss(a,f)}catch{return!0}}function Ew(a){var h=ra(a,2);h!==null&&cs(h,a,2)}function PO(a){var h=Ui();if(typeof a=="function"){var f=a;if(a=f(),da){Hn(!0);try{f()}finally{Hn(!1)}}}return h.memoizedState=h.baseState=a,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:a},h}function Pw(a,h,f,p){return a.baseState=f,MO(a,st,typeof p=="function"?p:On)}function g6(a,h,f,p,O){if(md(a))throw Error(s(485));if(a=h.action,a!==null){var v={payload:O,action:a,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){v.listeners.push(S)}};Q.T!==null?f(!0):v.isTransition=!1,p(v),f=h.pending,f===null?(v.next=h.pending=v,Qw(h,v)):(v.next=f.next,h.pending=f.next=v)}}function Qw(a,h){var f=h.action,p=h.payload,O=a.state;if(h.isTransition){var v=Q.T,S={};Q.T=S;try{var T=f(O,p),V=Q.S;V!==null&&V(S,T),Rw(a,h,T)}catch(J){QO(a,h,J)}finally{v!==null&&S.types!==null&&(v.types=S.types),Q.T=v}}else try{v=f(O,p),Rw(a,h,v)}catch(J){QO(a,h,J)}}function Rw(a,h,f){f!==null&&typeof f=="object"&&typeof f.then=="function"?f.then(function(p){Lw(a,h,p)},function(p){return QO(a,h,p)}):Lw(a,h,f)}function Lw(a,h,f){h.status="fulfilled",h.value=f,$w(h),a.state=f,h=a.pending,h!==null&&(f=h.next,f===h?a.pending=null:(f=f.next,h.next=f,Qw(a,f)))}function QO(a,h,f){var p=a.pending;if(a.pending=null,p!==null){p=p.next;do h.status="rejected",h.reason=f,$w(h),h=h.next;while(h!==p)}a.action=null}function $w(a){a=a.listeners;for(var h=0;h<a.length;h++)(0,a[h])()}function Bw(a,h){return h}function Dw(a,h){if(Ue){var f=lt.formState;if(f!==null){e:{var p=Be;if(Ue){if(gt){t:{for(var O=gt,v=qs;O.nodeType!==8;){if(!v){O=null;break t}if(O=Us(O.nextSibling),O===null){O=null;break t}}v=O.data,O=v==="F!"||v==="F"?O:null}if(O){gt=Us(O.nextSibling),p=O.data==="F!";break e}}eo(p)}p=!1}p&&(h=f[0])}}return f=Ui(),f.memoizedState=f.baseState=h,p={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bw,lastRenderedState:h},f.queue=p,f=iC.bind(null,Be,p),p.dispatch=f,p=PO(!1),v=zO.bind(null,Be,!1,p.queue),p=Ui(),O={state:h,dispatch:null,action:a,pending:null},p.queue=O,f=g6.bind(null,Be,O,v,f),O.dispatch=f,p.memoizedState=a,[h,f,!1]}function zw(a){var h=Bt();return Nw(h,st,a)}function Nw(a,h,f){if(h=MO(a,h,Bw)[0],a=fd(On)[0],typeof h=="object"&&h!==null&&typeof h.then=="function")try{var p=pc(h)}catch(S){throw S===bl?id:S}else p=h;h=Bt();var O=h.queue,v=O.dispatch;return f!==h.memoizedState&&(Be.flags|=2048,kl(9,{destroy:void 0},O6.bind(null,O,f),null)),[p,v,a]}function O6(a,h){a.action=h}function Xw(a){var h=Bt(),f=st;if(f!==null)return Nw(h,f,a);Bt(),h=h.memoizedState,f=Bt();var p=f.queue.dispatch;return f.memoizedState=a,[h,p,!1]}function kl(a,h,f,p){return a={tag:a,create:f,deps:p,inst:h,next:null},h=Be.updateQueue,h===null&&(h=cd(),Be.updateQueue=h),f=h.lastEffect,f===null?h.lastEffect=a.next=a:(p=f.next,f.next=a,a.next=p,h.lastEffect=a),a}function Vw(){return Bt().memoizedState}function dd(a,h,f,p){var O=Ui();Be.flags|=a,O.memoizedState=kl(1|h,{destroy:void 0},f,p===void 0?null:p)}function pd(a,h,f,p){var O=Bt();p=p===void 0?null:p;var v=O.memoizedState.inst;st!==null&&p!==null&&xO(p,st.memoizedState.deps)?O.memoizedState=kl(h,v,f,p):(Be.flags|=a,O.memoizedState=kl(1|h,v,f,p))}function Zw(a,h){dd(8390656,8,a,h)}function RO(a,h){pd(2048,8,a,h)}function _6(a){Be.flags|=4;var h=Be.updateQueue;if(h===null)h=cd(),Be.updateQueue=h,h.events=[a];else{var f=h.events;f===null?h.events=[a]:f.push(a)}}function jw(a){var h=Bt().memoizedState;return _6({ref:h,nextImpl:a}),function(){if((Ge&2)!==0)throw Error(s(440));return h.impl.apply(void 0,arguments)}}function Iw(a,h){return pd(4,2,a,h)}function qw(a,h){return pd(4,4,a,h)}function Ww(a,h){if(typeof h=="function"){a=a();var f=h(a);return function(){typeof f=="function"?f():h(null)}}if(h!=null)return a=a(),h.current=a,function(){h.current=null}}function Uw(a,h,f){f=f!=null?f.concat([a]):null,pd(4,4,Ww.bind(null,h,a),f)}function LO(){}function Yw(a,h){var f=Bt();h=h===void 0?null:h;var p=f.memoizedState;return h!==null&&xO(h,p[1])?p[0]:(f.memoizedState=[a,h],a)}function Hw(a,h){var f=Bt();h=h===void 0?null:h;var p=f.memoizedState;if(h!==null&&xO(h,p[1]))return p[0];if(p=a(),da){Hn(!0);try{a()}finally{Hn(!1)}}return f.memoizedState=[p,h],p}function $O(a,h,f){return f===void 0||(gn&1073741824)!==0&&(Ie&261930)===0?a.memoizedState=h:(a.memoizedState=f,a=FC(),Be.lanes|=a,ho|=a,f)}function Fw(a,h,f,p){return Ss(f,h)?f:xl.current!==null?(a=$O(a,f,p),Ss(a,h)||(Zt=!0),a):(gn&42)===0||(gn&1073741824)!==0&&(Ie&261930)===0?(Zt=!0,a.memoizedState=f):(a=FC(),Be.lanes|=a,ho|=a,h)}function Gw(a,h,f,p,O){var v=X.p;X.p=v!==0&&8>v?v:8;var S=Q.T,T={};Q.T=T,zO(a,!1,h,f);try{var V=O(),J=Q.S;if(J!==null&&J(T,V),V!==null&&typeof V=="object"&&typeof V.then=="function"){var re=d6(V,p);mc(a,h,re,As(a))}else mc(a,h,p,As(a))}catch(ae){mc(a,h,{then:function(){},status:"rejected",reason:ae},As())}finally{X.p=v,S!==null&&T.types!==null&&(S.types=T.types),Q.T=S}}function v6(){}function BO(a,h,f,p){if(a.tag!==5)throw Error(s(476));var O=Kw(a).queue;Gw(a,O,h,W,f===null?v6:function(){return Jw(a),f(p)})}function Kw(a){var h=a.memoizedState;if(h!==null)return h;h={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:W},next:null};var f={};return h.next={memoizedState:f,baseState:f,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:On,lastRenderedState:f},next:null},a.memoizedState=h,a=a.alternate,a!==null&&(a.memoizedState=h),h}function Jw(a){var h=Kw(a);h.next===null&&(h=a.alternate.memoizedState),mc(a,h.next.queue,{},As())}function DO(){return ki(Qc)}function eC(){return Bt().memoizedState}function tC(){return Bt().memoizedState}function y6(a){for(var h=a.return;h!==null;){switch(h.tag){case 24:case 3:var f=As();a=so(f);var p=ro(h,a,f);p!==null&&(cs(p,h,f),cc(p,h,f)),h={cache:fO()},a.payload=h;return}h=h.return}}function b6(a,h,f){var p=As();f={lane:p,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},md(a)?sC(h,f):(f=tO(a,h,f,p),f!==null&&(cs(f,a,p),rC(f,h,p)))}function iC(a,h,f){var p=As();mc(a,h,f,p)}function mc(a,h,f,p){var O={lane:p,revertLane:0,gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null};if(md(a))sC(h,O);else{var v=a.alternate;if(a.lanes===0&&(v===null||v.lanes===0)&&(v=h.lastRenderedReducer,v!==null))try{var S=h.lastRenderedState,T=v(S,f);if(O.hasEagerState=!0,O.eagerState=T,Ss(T,S))return Hf(a,h,O,0),lt===null&&Yf(),!1}catch{}finally{}if(f=tO(a,h,O,p),f!==null)return cs(f,a,p),rC(f,h,p),!0}return!1}function zO(a,h,f,p){if(p={lane:2,revertLane:g0(),gesture:null,action:p,hasEagerState:!1,eagerState:null,next:null},md(a)){if(h)throw Error(s(479))}else h=tO(a,f,p,2),h!==null&&cs(h,a,2)}function md(a){var h=a.alternate;return a===Be||h!==null&&h===Be}function sC(a,h){wl=ld=!0;var f=a.pending;f===null?h.next=h:(h.next=f.next,f.next=h),a.pending=h}function rC(a,h,f){if((f&4194048)!==0){var p=h.lanes;p&=a.pendingLanes,f|=p,h.lanes=f,hx(a,f)}}var gc={readContext:ki,use:ud,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};gc.useEffectEvent=Tt;var nC={readContext:ki,use:ud,useCallback:function(a,h){return Ui().memoizedState=[a,h===void 0?null:h],a},useContext:ki,useEffect:Zw,useImperativeHandle:function(a,h,f){f=f!=null?f.concat([a]):null,dd(4194308,4,Ww.bind(null,h,a),f)},useLayoutEffect:function(a,h){return dd(4194308,4,a,h)},useInsertionEffect:function(a,h){dd(4,2,a,h)},useMemo:function(a,h){var f=Ui();h=h===void 0?null:h;var p=a();if(da){Hn(!0);try{a()}finally{Hn(!1)}}return f.memoizedState=[p,h],p},useReducer:function(a,h,f){var p=Ui();if(f!==void 0){var O=f(h);if(da){Hn(!0);try{f(h)}finally{Hn(!1)}}}else O=h;return p.memoizedState=p.baseState=O,a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:O},p.queue=a,a=a.dispatch=b6.bind(null,Be,a),[p.memoizedState,a]},useRef:function(a){var h=Ui();return a={current:a},h.memoizedState=a},useState:function(a){a=PO(a);var h=a.queue,f=iC.bind(null,Be,h);return h.dispatch=f,[a.memoizedState,f]},useDebugValue:LO,useDeferredValue:function(a,h){var f=Ui();return $O(f,a,h)},useTransition:function(){var a=PO(!1);return a=Gw.bind(null,Be,a.queue,!0,!1),Ui().memoizedState=a,[!1,a]},useSyncExternalStore:function(a,h,f){var p=Be,O=Ui();if(Ue){if(f===void 0)throw Error(s(407));f=f()}else{if(f=h(),lt===null)throw Error(s(349));(Ie&127)!==0||kw(p,h,f)}O.memoizedState=f;var v={value:f,getSnapshot:h};return O.queue=v,Zw(Aw.bind(null,p,v,a),[a]),p.flags|=2048,kl(9,{destroy:void 0},Tw.bind(null,p,v,f,h),null),f},useId:function(){var a=Ui(),h=lt.identifierPrefix;if(Ue){var f=Er,p=Mr;f=(p&~(1<<32-bs(p)-1)).toString(32)+f,h="_"+h+"R_"+f,f=hd++,0<f&&(h+="H"+f.toString(32)),h+="_"}else f=p6++,h="_"+h+"r_"+f.toString(32)+"_";return a.memoizedState=h},useHostTransitionStatus:DO,useFormState:Dw,useActionState:Dw,useOptimistic:function(a){var h=Ui();h.memoizedState=h.baseState=a;var f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=f,h=zO.bind(null,Be,!0,f),f.dispatch=h,[a,h]},useMemoCache:AO,useCacheRefresh:function(){return Ui().memoizedState=y6.bind(null,Be)},useEffectEvent:function(a){var h=Ui(),f={impl:a};return h.memoizedState=f,function(){if((Ge&2)!==0)throw Error(s(440));return f.impl.apply(void 0,arguments)}}},NO={readContext:ki,use:ud,useCallback:Yw,useContext:ki,useEffect:RO,useImperativeHandle:Uw,useInsertionEffect:Iw,useLayoutEffect:qw,useMemo:Hw,useReducer:fd,useRef:Vw,useState:function(){return fd(On)},useDebugValue:LO,useDeferredValue:function(a,h){var f=Bt();return Fw(f,st.memoizedState,a,h)},useTransition:function(){var a=fd(On)[0],h=Bt().memoizedState;return[typeof a=="boolean"?a:pc(a),h]},useSyncExternalStore:Cw,useId:eC,useHostTransitionStatus:DO,useFormState:zw,useActionState:zw,useOptimistic:function(a,h){var f=Bt();return Pw(f,st,a,h)},useMemoCache:AO,useCacheRefresh:tC};NO.useEffectEvent=jw;var oC={readContext:ki,use:ud,useCallback:Yw,useContext:ki,useEffect:RO,useImperativeHandle:Uw,useInsertionEffect:Iw,useLayoutEffect:qw,useMemo:Hw,useReducer:EO,useRef:Vw,useState:function(){return EO(On)},useDebugValue:LO,useDeferredValue:function(a,h){var f=Bt();return st===null?$O(f,a,h):Fw(f,st.memoizedState,a,h)},useTransition:function(){var a=EO(On)[0],h=Bt().memoizedState;return[typeof a=="boolean"?a:pc(a),h]},useSyncExternalStore:Cw,useId:eC,useHostTransitionStatus:DO,useFormState:Xw,useActionState:Xw,useOptimistic:function(a,h){var f=Bt();return st!==null?Pw(f,st,a,h):(f.baseState=a,[a,f.queue.dispatch])},useMemoCache:AO,useCacheRefresh:tC};oC.useEffectEvent=jw;function XO(a,h,f,p){h=a.memoizedState,f=f(p,h),f=f==null?h:m({},h,f),a.memoizedState=f,a.lanes===0&&(a.updateQueue.baseState=f)}var VO={enqueueSetState:function(a,h,f){a=a._reactInternals;var p=As(),O=so(p);O.payload=h,f!=null&&(O.callback=f),h=ro(a,O,p),h!==null&&(cs(h,a,p),cc(h,a,p))},enqueueReplaceState:function(a,h,f){a=a._reactInternals;var p=As(),O=so(p);O.tag=1,O.payload=h,f!=null&&(O.callback=f),h=ro(a,O,p),h!==null&&(cs(h,a,p),cc(h,a,p))},enqueueForceUpdate:function(a,h){a=a._reactInternals;var f=As(),p=so(f);p.tag=2,h!=null&&(p.callback=h),h=ro(a,p,f),h!==null&&(cs(h,a,f),cc(h,a,f))}};function aC(a,h,f,p,O,v,S){return a=a.stateNode,typeof a.shouldComponentUpdate=="function"?a.shouldComponentUpdate(p,v,S):h.prototype&&h.prototype.isPureReactComponent?!ic(f,p)||!ic(O,v):!0}function lC(a,h,f,p){a=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(f,p),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(f,p),h.state!==a&&VO.enqueueReplaceState(h,h.state,null)}function pa(a,h){var f=h;if("ref"in h){f={};for(var p in h)p!=="ref"&&(f[p]=h[p])}if(a=a.defaultProps){f===h&&(f=m({},f));for(var O in a)f[O]===void 0&&(f[O]=a[O])}return f}function hC(a){Uf(a)}function cC(a){console.error(a)}function uC(a){Uf(a)}function gd(a,h){try{var f=a.onUncaughtError;f(h.value,{componentStack:h.stack})}catch(p){setTimeout(function(){throw p})}}function fC(a,h,f){try{var p=a.onCaughtError;p(f.value,{componentStack:f.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(O){setTimeout(function(){throw O})}}function ZO(a,h,f){return f=so(f),f.tag=3,f.payload={element:null},f.callback=function(){gd(a,h)},f}function dC(a){return a=so(a),a.tag=3,a}function pC(a,h,f,p){var O=f.type.getDerivedStateFromError;if(typeof O=="function"){var v=p.value;a.payload=function(){return O(v)},a.callback=function(){fC(h,f,p)}}var S=f.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(a.callback=function(){fC(h,f,p),typeof O!="function"&&(co===null?co=new Set([this]):co.add(this));var T=p.stack;this.componentDidCatch(p.value,{componentStack:T!==null?T:""})})}function S6(a,h,f,p,O){if(f.flags|=32768,p!==null&&typeof p=="object"&&typeof p.then=="function"){if(h=f.alternate,h!==null&&_l(h,f,O,!0),f=ws.current,f!==null){switch(f.tag){case 31:case 13:return Ws===null?Ad():f.alternate===null&&At===0&&(At=3),f.flags&=-257,f.flags|=65536,f.lanes=O,p===sd?f.flags|=16384:(h=f.updateQueue,h===null?f.updateQueue=new Set([p]):h.add(p),d0(a,p,O)),!1;case 22:return f.flags|=65536,p===sd?f.flags|=16384:(h=f.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([p])},f.updateQueue=h):(f=h.retryQueue,f===null?h.retryQueue=new Set([p]):f.add(p)),d0(a,p,O)),!1}throw Error(s(435,f.tag))}return d0(a,p,O),Ad(),!1}if(Ue)return h=ws.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=O,p!==aO&&(a=Error(s(422),{cause:p}),nc(Zs(a,f)))):(p!==aO&&(h=Error(s(423),{cause:p}),nc(Zs(h,f))),a=a.current.alternate,a.flags|=65536,O&=-O,a.lanes|=O,p=Zs(p,f),O=ZO(a.stateNode,p,O),_O(a,O),At!==4&&(At=2)),!1;var v=Error(s(520),{cause:p});if(v=Zs(v,f),wc===null?wc=[v]:wc.push(v),At!==4&&(At=2),h===null)return!0;p=Zs(p,f),f=h;do{switch(f.tag){case 3:return f.flags|=65536,a=O&-O,f.lanes|=a,a=ZO(f.stateNode,p,a),_O(f,a),!1;case 1:if(h=f.type,v=f.stateNode,(f.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(co===null||!co.has(v))))return f.flags|=65536,O&=-O,f.lanes|=O,O=dC(O),pC(O,a,f,p),_O(f,O),!1}f=f.return}while(f!==null);return!1}var jO=Error(s(461)),Zt=!1;function Ti(a,h,f,p){h.child=a===null?_w(h,null,f,p):fa(h,a.child,f,p)}function mC(a,h,f,p,O){f=f.render;var v=h.ref;if("ref"in p){var S={};for(var T in p)T!=="ref"&&(S[T]=p[T])}else S=p;return la(h),p=wO(a,h,f,S,v,O),T=CO(),a!==null&&!Zt?(kO(a,h,O),_n(a,h,O)):(Ue&&T&&nO(h),h.flags|=1,Ti(a,h,p,O),h.child)}function gC(a,h,f,p,O){if(a===null){var v=f.type;return typeof v=="function"&&!iO(v)&&v.defaultProps===void 0&&f.compare===null?(h.tag=15,h.type=v,OC(a,h,v,p,O)):(a=Gf(f.type,null,p,h,h.mode,O),a.ref=h.ref,a.return=h,h.child=a)}if(v=a.child,!GO(a,O)){var S=v.memoizedProps;if(f=f.compare,f=f!==null?f:ic,f(S,p)&&a.ref===h.ref)return _n(a,h,O)}return h.flags|=1,a=fn(v,p),a.ref=h.ref,a.return=h,h.child=a}function OC(a,h,f,p,O){if(a!==null){var v=a.memoizedProps;if(ic(v,p)&&a.ref===h.ref)if(Zt=!1,h.pendingProps=p=v,GO(a,O))(a.flags&131072)!==0&&(Zt=!0);else return h.lanes=a.lanes,_n(a,h,O)}return IO(a,h,f,p,O)}function _C(a,h,f,p){var O=p.children,v=a!==null?a.memoizedState:null;if(a===null&&h.stateNode===null&&(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),p.mode==="hidden"){if((h.flags&128)!==0){if(v=v!==null?v.baseLanes|f:f,a!==null){for(p=h.child=a.child,O=0;p!==null;)O=O|p.lanes|p.childLanes,p=p.sibling;p=O&~v}else p=0,h.child=null;return vC(a,h,v,f,p)}if((f&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},a!==null&&td(h,v!==null?v.cachePool:null),v!==null?bw(h,v):yO(),Sw(h);else return p=h.lanes=536870912,vC(a,h,v!==null?v.baseLanes|f:f,f,p)}else v!==null?(td(h,v.cachePool),bw(h,v),oo(),h.memoizedState=null):(a!==null&&td(h,null),yO(),oo());return Ti(a,h,O,f),h.child}function Oc(a,h){return a!==null&&a.tag===22||h.stateNode!==null||(h.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.sibling}function vC(a,h,f,p,O){var v=pO();return v=v===null?null:{parent:Xt._currentValue,pool:v},h.memoizedState={baseLanes:f,cachePool:v},a!==null&&td(h,null),yO(),Sw(h),a!==null&&_l(a,h,p,!0),h.childLanes=O,null}function Od(a,h){return h=vd({mode:h.mode,children:h.children},a.mode),h.ref=a.ref,a.child=h,h.return=a,h}function yC(a,h,f){return fa(h,a.child,null,f),a=Od(h,h.pendingProps),a.flags|=2,Cs(h),h.memoizedState=null,a}function x6(a,h,f){var p=h.pendingProps,O=(h.flags&128)!==0;if(h.flags&=-129,a===null){if(Ue){if(p.mode==="hidden")return a=Od(h,p),h.lanes=536870912,Oc(null,a);if(SO(h),(a=gt)?(a=Qk(a,qs),a=a!==null&&a.data==="&"?a:null,a!==null&&(h.memoizedState={dehydrated:a,treeContext:Kn!==null?{id:Mr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},f=sw(a),f.return=h,h.child=f,Ci=h,gt=null)):a=null,a===null)throw eo(h);return h.lanes=536870912,null}return Od(h,p)}var v=a.memoizedState;if(v!==null){var S=v.dehydrated;if(SO(h),O)if(h.flags&256)h.flags&=-257,h=yC(a,h,f);else if(h.memoizedState!==null)h.child=a.child,h.flags|=128,h=null;else throw Error(s(558));else if(Zt||_l(a,h,f,!1),O=(f&a.childLanes)!==0,Zt||O){if(p=lt,p!==null&&(S=cx(p,f),S!==0&&S!==v.retryLane))throw v.retryLane=S,ra(a,S),cs(p,a,S),jO;Ad(),h=yC(a,h,f)}else a=v.treeContext,gt=Us(S.nextSibling),Ci=h,Ue=!0,Jn=null,qs=!1,a!==null&&ow(h,a),h=Od(h,p),h.flags|=4096;return h}return a=fn(a.child,{mode:p.mode,children:p.children}),a.ref=h.ref,h.child=a,a.return=h,a}function _d(a,h){var f=h.ref;if(f===null)a!==null&&a.ref!==null&&(h.flags|=4194816);else{if(typeof f!="function"&&typeof f!="object")throw Error(s(284));(a===null||a.ref!==f)&&(h.flags|=4194816)}}function IO(a,h,f,p,O){return la(h),f=wO(a,h,f,p,void 0,O),p=CO(),a!==null&&!Zt?(kO(a,h,O),_n(a,h,O)):(Ue&&p&&nO(h),h.flags|=1,Ti(a,h,f,O),h.child)}function bC(a,h,f,p,O,v){return la(h),h.updateQueue=null,f=ww(h,p,f,O),xw(a),p=CO(),a!==null&&!Zt?(kO(a,h,v),_n(a,h,v)):(Ue&&p&&nO(h),h.flags|=1,Ti(a,h,f,v),h.child)}function SC(a,h,f,p,O){if(la(h),h.stateNode===null){var v=pl,S=f.contextType;typeof S=="object"&&S!==null&&(v=ki(S)),v=new f(p,v),h.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=VO,h.stateNode=v,v._reactInternals=h,v=h.stateNode,v.props=p,v.state=h.memoizedState,v.refs={},gO(h),S=f.contextType,v.context=typeof S=="object"&&S!==null?ki(S):pl,v.state=h.memoizedState,S=f.getDerivedStateFromProps,typeof S=="function"&&(XO(h,f,S,p),v.state=h.memoizedState),typeof f.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(S=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),S!==v.state&&VO.enqueueReplaceState(v,v.state,null),fc(h,p,v,O),uc(),v.state=h.memoizedState),typeof v.componentDidMount=="function"&&(h.flags|=4194308),p=!0}else if(a===null){v=h.stateNode;var T=h.memoizedProps,V=pa(f,T);v.props=V;var J=v.context,re=f.contextType;S=pl,typeof re=="object"&&re!==null&&(S=ki(re));var ae=f.getDerivedStateFromProps;re=typeof ae=="function"||typeof v.getSnapshotBeforeUpdate=="function",T=h.pendingProps!==T,re||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T||J!==S)&&lC(h,v,p,S),io=!1;var ee=h.memoizedState;v.state=ee,fc(h,p,v,O),uc(),J=h.memoizedState,T||ee!==J||io?(typeof ae=="function"&&(XO(h,f,ae,p),J=h.memoizedState),(V=io||aC(h,f,V,p,ee,J,S))?(re||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(h.flags|=4194308)):(typeof v.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=p,h.memoizedState=J),v.props=p,v.state=J,v.context=S,p=V):(typeof v.componentDidMount=="function"&&(h.flags|=4194308),p=!1)}else{v=h.stateNode,OO(a,h),S=h.memoizedProps,re=pa(f,S),v.props=re,ae=h.pendingProps,ee=v.context,J=f.contextType,V=pl,typeof J=="object"&&J!==null&&(V=ki(J)),T=f.getDerivedStateFromProps,(J=typeof T=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(S!==ae||ee!==V)&&lC(h,v,p,V),io=!1,ee=h.memoizedState,v.state=ee,fc(h,p,v,O),uc();var te=h.memoizedState;S!==ae||ee!==te||io||a!==null&&a.dependencies!==null&&Jf(a.dependencies)?(typeof T=="function"&&(XO(h,f,T,p),te=h.memoizedState),(re=io||aC(h,f,re,p,ee,te,V)||a!==null&&a.dependencies!==null&&Jf(a.dependencies))?(J||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(p,te,V),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(p,te,V)),typeof v.componentDidUpdate=="function"&&(h.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof v.componentDidUpdate!="function"||S===a.memoizedProps&&ee===a.memoizedState||(h.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===a.memoizedProps&&ee===a.memoizedState||(h.flags|=1024),h.memoizedProps=p,h.memoizedState=te),v.props=p,v.state=te,v.context=V,p=re):(typeof v.componentDidUpdate!="function"||S===a.memoizedProps&&ee===a.memoizedState||(h.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||S===a.memoizedProps&&ee===a.memoizedState||(h.flags|=1024),p=!1)}return v=p,_d(a,h),p=(h.flags&128)!==0,v||p?(v=h.stateNode,f=p&&typeof f.getDerivedStateFromError!="function"?null:v.render(),h.flags|=1,a!==null&&p?(h.child=fa(h,a.child,null,O),h.child=fa(h,null,f,O)):Ti(a,h,f,O),h.memoizedState=v.state,a=h.child):a=_n(a,h,O),a}function xC(a,h,f,p){return oa(),h.flags|=256,Ti(a,h,f,p),h.child}var qO={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function WO(a){return{baseLanes:a,cachePool:fw()}}function UO(a,h,f){return a=a!==null?a.childLanes&~f:0,h&&(a|=Ts),a}function wC(a,h,f){var p=h.pendingProps,O=!1,v=(h.flags&128)!==0,S;if((S=v)||(S=a!==null&&a.memoizedState===null?!1:($t.current&2)!==0),S&&(O=!0,h.flags&=-129),S=(h.flags&32)!==0,h.flags&=-33,a===null){if(Ue){if(O?no(h):oo(),(a=gt)?(a=Qk(a,qs),a=a!==null&&a.data!=="&"?a:null,a!==null&&(h.memoizedState={dehydrated:a,treeContext:Kn!==null?{id:Mr,overflow:Er}:null,retryLane:536870912,hydrationErrors:null},f=sw(a),f.return=h,h.child=f,Ci=h,gt=null)):a=null,a===null)throw eo(h);return M0(a)?h.lanes=32:h.lanes=536870912,null}var T=p.children;return p=p.fallback,O?(oo(),O=h.mode,T=vd({mode:"hidden",children:T},O),p=na(p,O,f,null),T.return=h,p.return=h,T.sibling=p,h.child=T,p=h.child,p.memoizedState=WO(f),p.childLanes=UO(a,S,f),h.memoizedState=qO,Oc(null,p)):(no(h),YO(h,T))}var V=a.memoizedState;if(V!==null&&(T=V.dehydrated,T!==null)){if(v)h.flags&256?(no(h),h.flags&=-257,h=HO(a,h,f)):h.memoizedState!==null?(oo(),h.child=a.child,h.flags|=128,h=null):(oo(),T=p.fallback,O=h.mode,p=vd({mode:"visible",children:p.children},O),T=na(T,O,f,null),T.flags|=2,p.return=h,T.return=h,p.sibling=T,h.child=p,fa(h,a.child,null,f),p=h.child,p.memoizedState=WO(f),p.childLanes=UO(a,S,f),h.memoizedState=qO,h=Oc(null,p));else if(no(h),M0(T)){if(S=T.nextSibling&&T.nextSibling.dataset,S)var J=S.dgst;S=J,p=Error(s(419)),p.stack="",p.digest=S,nc({value:p,source:null,stack:null}),h=HO(a,h,f)}else if(Zt||_l(a,h,f,!1),S=(f&a.childLanes)!==0,Zt||S){if(S=lt,S!==null&&(p=cx(S,f),p!==0&&p!==V.retryLane))throw V.retryLane=p,ra(a,p),cs(S,a,p),jO;A0(T)||Ad(),h=HO(a,h,f)}else A0(T)?(h.flags|=192,h.child=a.child,h=null):(a=V.treeContext,gt=Us(T.nextSibling),Ci=h,Ue=!0,Jn=null,qs=!1,a!==null&&ow(h,a),h=YO(h,p.children),h.flags|=4096);return h}return O?(oo(),T=p.fallback,O=h.mode,V=a.child,J=V.sibling,p=fn(V,{mode:"hidden",children:p.children}),p.subtreeFlags=V.subtreeFlags&65011712,J!==null?T=fn(J,T):(T=na(T,O,f,null),T.flags|=2),T.return=h,p.return=h,p.sibling=T,h.child=p,Oc(null,p),p=h.child,T=a.child.memoizedState,T===null?T=WO(f):(O=T.cachePool,O!==null?(V=Xt._currentValue,O=O.parent!==V?{parent:V,pool:V}:O):O=fw(),T={baseLanes:T.baseLanes|f,cachePool:O}),p.memoizedState=T,p.childLanes=UO(a,S,f),h.memoizedState=qO,Oc(a.child,p)):(no(h),f=a.child,a=f.sibling,f=fn(f,{mode:"visible",children:p.children}),f.return=h,f.sibling=null,a!==null&&(S=h.deletions,S===null?(h.deletions=[a],h.flags|=16):S.push(a)),h.child=f,h.memoizedState=null,f)}function YO(a,h){return h=vd({mode:"visible",children:h},a.mode),h.return=a,a.child=h}function vd(a,h){return a=xs(22,a,null,h),a.lanes=0,a}function HO(a,h,f){return fa(h,a.child,null,f),a=YO(h,h.pendingProps.children),a.flags|=2,h.memoizedState=null,a}function CC(a,h,f){a.lanes|=h;var p=a.alternate;p!==null&&(p.lanes|=h),cO(a.return,h,f)}function FO(a,h,f,p,O,v){var S=a.memoizedState;S===null?a.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:p,tail:f,tailMode:O,treeForkCount:v}:(S.isBackwards=h,S.rendering=null,S.renderingStartTime=0,S.last=p,S.tail=f,S.tailMode=O,S.treeForkCount=v)}function kC(a,h,f){var p=h.pendingProps,O=p.revealOrder,v=p.tail;p=p.children;var S=$t.current,T=(S&2)!==0;if(T?(S=S&1|2,h.flags|=128):S&=1,ie($t,S),Ti(a,h,p,f),p=Ue?rc:0,!T&&a!==null&&(a.flags&128)!==0)e:for(a=h.child;a!==null;){if(a.tag===13)a.memoizedState!==null&&CC(a,f,h);else if(a.tag===19)CC(a,f,h);else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===h)break e;for(;a.sibling===null;){if(a.return===null||a.return===h)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}switch(O){case"forwards":for(f=h.child,O=null;f!==null;)a=f.alternate,a!==null&&ad(a)===null&&(O=f),f=f.sibling;f=O,f===null?(O=h.child,h.child=null):(O=f.sibling,f.sibling=null),FO(h,!1,O,f,v,p);break;case"backwards":case"unstable_legacy-backwards":for(f=null,O=h.child,h.child=null;O!==null;){if(a=O.alternate,a!==null&&ad(a)===null){h.child=O;break}a=O.sibling,O.sibling=f,f=O,O=a}FO(h,!0,f,null,v,p);break;case"together":FO(h,!1,null,null,void 0,p);break;default:h.memoizedState=null}return h.child}function _n(a,h,f){if(a!==null&&(h.dependencies=a.dependencies),ho|=h.lanes,(f&h.childLanes)===0)if(a!==null){if(_l(a,h,f,!1),(f&h.childLanes)===0)return null}else return null;if(a!==null&&h.child!==a.child)throw Error(s(153));if(h.child!==null){for(a=h.child,f=fn(a,a.pendingProps),h.child=f,f.return=h;a.sibling!==null;)a=a.sibling,f=f.sibling=fn(a,a.pendingProps),f.return=h;f.sibling=null}return h.child}function GO(a,h){return(a.lanes&h)!==0?!0:(a=a.dependencies,!!(a!==null&&Jf(a)))}function w6(a,h,f){switch(h.tag){case 3:Ae(h,h.stateNode.containerInfo),to(h,Xt,a.memoizedState.cache),oa();break;case 27:case 5:mt(h);break;case 4:Ae(h,h.stateNode.containerInfo);break;case 10:to(h,h.type,h.memoizedProps.value);break;case 31:if(h.memoizedState!==null)return h.flags|=128,SO(h),null;break;case 13:var p=h.memoizedState;if(p!==null)return p.dehydrated!==null?(no(h),h.flags|=128,null):(f&h.child.childLanes)!==0?wC(a,h,f):(no(h),a=_n(a,h,f),a!==null?a.sibling:null);no(h);break;case 19:var O=(a.flags&128)!==0;if(p=(f&h.childLanes)!==0,p||(_l(a,h,f,!1),p=(f&h.childLanes)!==0),O){if(p)return kC(a,h,f);h.flags|=128}if(O=h.memoizedState,O!==null&&(O.rendering=null,O.tail=null,O.lastEffect=null),ie($t,$t.current),p)break;return null;case 22:return h.lanes=0,_C(a,h,f,h.pendingProps);case 24:to(h,Xt,a.memoizedState.cache)}return _n(a,h,f)}function TC(a,h,f){if(a!==null)if(a.memoizedProps!==h.pendingProps)Zt=!0;else{if(!GO(a,f)&&(h.flags&128)===0)return Zt=!1,w6(a,h,f);Zt=(a.flags&131072)!==0}else Zt=!1,Ue&&(h.flags&1048576)!==0&&nw(h,rc,h.index);switch(h.lanes=0,h.tag){case 16:e:{var p=h.pendingProps;if(a=ca(h.elementType),h.type=a,typeof a=="function")iO(a)?(p=pa(a,p),h.tag=1,h=SC(null,h,a,p,f)):(h.tag=0,h=IO(null,h,a,p,f));else{if(a!=null){var O=a.$$typeof;if(O===A){h.tag=11,h=mC(null,h,a,p,f);break e}else if(O===$){h.tag=14,h=gC(null,h,a,p,f);break e}}throw h=N(a)||a,Error(s(306,h,""))}}return h;case 0:return IO(a,h,h.type,h.pendingProps,f);case 1:return p=h.type,O=pa(p,h.pendingProps),SC(a,h,p,O,f);case 3:e:{if(Ae(h,h.stateNode.containerInfo),a===null)throw Error(s(387));p=h.pendingProps;var v=h.memoizedState;O=v.element,OO(a,h),fc(h,p,null,f);var S=h.memoizedState;if(p=S.cache,to(h,Xt,p),p!==v.cache&&uO(h,[Xt],f,!0),uc(),p=S.element,v.isDehydrated)if(v={element:p,isDehydrated:!1,cache:S.cache},h.updateQueue.baseState=v,h.memoizedState=v,h.flags&256){h=xC(a,h,p,f);break e}else if(p!==O){O=Zs(Error(s(424)),h),nc(O),h=xC(a,h,p,f);break e}else{switch(a=h.stateNode.containerInfo,a.nodeType){case 9:a=a.body;break;default:a=a.nodeName==="HTML"?a.ownerDocument.body:a}for(gt=Us(a.firstChild),Ci=h,Ue=!0,Jn=null,qs=!0,f=_w(h,null,p,f),h.child=f;f;)f.flags=f.flags&-3|4096,f=f.sibling}else{if(oa(),p===O){h=_n(a,h,f);break e}Ti(a,h,p,f)}h=h.child}return h;case 26:return _d(a,h),a===null?(f=zk(h.type,null,h.pendingProps,null))?h.memoizedState=f:Ue||(f=h.type,a=h.pendingProps,p=$d(de.current).createElement(f),p[wi]=h,p[rs]=a,Ai(p,f,a),ai(p),h.stateNode=p):h.memoizedState=zk(h.type,a.memoizedProps,h.pendingProps,a.memoizedState),null;case 27:return mt(h),a===null&&Ue&&(p=h.stateNode=$k(h.type,h.pendingProps,de.current),Ci=h,qs=!0,O=gt,mo(h.type)?(E0=O,gt=Us(p.firstChild)):gt=O),Ti(a,h,h.pendingProps.children,f),_d(a,h),a===null&&(h.flags|=4194304),h.child;case 5:return a===null&&Ue&&((O=p=gt)&&(p=ez(p,h.type,h.pendingProps,qs),p!==null?(h.stateNode=p,Ci=h,gt=Us(p.firstChild),qs=!1,O=!0):O=!1),O||eo(h)),mt(h),O=h.type,v=h.pendingProps,S=a!==null?a.memoizedProps:null,p=v.children,C0(O,v)?p=null:S!==null&&C0(O,S)&&(h.flags|=32),h.memoizedState!==null&&(O=wO(a,h,m6,null,null,f),Qc._currentValue=O),_d(a,h),Ti(a,h,p,f),h.child;case 6:return a===null&&Ue&&((a=f=gt)&&(f=tz(f,h.pendingProps,qs),f!==null?(h.stateNode=f,Ci=h,gt=null,a=!0):a=!1),a||eo(h)),null;case 13:return wC(a,h,f);case 4:return Ae(h,h.stateNode.containerInfo),p=h.pendingProps,a===null?h.child=fa(h,null,p,f):Ti(a,h,p,f),h.child;case 11:return mC(a,h,h.type,h.pendingProps,f);case 7:return Ti(a,h,h.pendingProps,f),h.child;case 8:return Ti(a,h,h.pendingProps.children,f),h.child;case 12:return Ti(a,h,h.pendingProps.children,f),h.child;case 10:return p=h.pendingProps,to(h,h.type,p.value),Ti(a,h,p.children,f),h.child;case 9:return O=h.type._context,p=h.pendingProps.children,la(h),O=ki(O),p=p(O),h.flags|=1,Ti(a,h,p,f),h.child;case 14:return gC(a,h,h.type,h.pendingProps,f);case 15:return OC(a,h,h.type,h.pendingProps,f);case 19:return kC(a,h,f);case 31:return x6(a,h,f);case 22:return _C(a,h,f,h.pendingProps);case 24:return la(h),p=ki(Xt),a===null?(O=pO(),O===null&&(O=lt,v=fO(),O.pooledCache=v,v.refCount++,v!==null&&(O.pooledCacheLanes|=f),O=v),h.memoizedState={parent:p,cache:O},gO(h),to(h,Xt,O)):((a.lanes&f)!==0&&(OO(a,h),fc(h,null,null,f),uc()),O=a.memoizedState,v=h.memoizedState,O.parent!==p?(O={parent:p,cache:p},h.memoizedState=O,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=O),to(h,Xt,p)):(p=v.cache,to(h,Xt,p),p!==O.cache&&uO(h,[Xt],f,!0))),Ti(a,h,h.pendingProps.children,f),h.child;case 29:throw h.pendingProps}throw Error(s(156,h.tag))}function vn(a){a.flags|=4}function KO(a,h,f,p,O){if((h=(a.mode&32)!==0)&&(h=!1),h){if(a.flags|=16777216,(O&335544128)===O)if(a.stateNode.complete)a.flags|=8192;else if(ek())a.flags|=8192;else throw ua=sd,mO}else a.flags&=-16777217}function AC(a,h){if(h.type!=="stylesheet"||(h.state.loading&4)!==0)a.flags&=-16777217;else if(a.flags|=16777216,!jk(h))if(ek())a.flags|=8192;else throw ua=sd,mO}function yd(a,h){h!==null&&(a.flags|=4),a.flags&16384&&(h=a.tag!==22?ax():536870912,a.lanes|=h,El|=h)}function _c(a,h){if(!Ue)switch(a.tailMode){case"hidden":h=a.tail;for(var f=null;h!==null;)h.alternate!==null&&(f=h),h=h.sibling;f===null?a.tail=null:f.sibling=null;break;case"collapsed":f=a.tail;for(var p=null;f!==null;)f.alternate!==null&&(p=f),f=f.sibling;p===null?h||a.tail===null?a.tail=null:a.tail.sibling=null:p.sibling=null}}function Ot(a){var h=a.alternate!==null&&a.alternate.child===a.child,f=0,p=0;if(h)for(var O=a.child;O!==null;)f|=O.lanes|O.childLanes,p|=O.subtreeFlags&65011712,p|=O.flags&65011712,O.return=a,O=O.sibling;else for(O=a.child;O!==null;)f|=O.lanes|O.childLanes,p|=O.subtreeFlags,p|=O.flags,O.return=a,O=O.sibling;return a.subtreeFlags|=p,a.childLanes=f,h}function C6(a,h,f){var p=h.pendingProps;switch(oO(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ot(h),null;case 1:return Ot(h),null;case 3:return f=h.stateNode,p=null,a!==null&&(p=a.memoizedState.cache),h.memoizedState.cache!==p&&(h.flags|=2048),mn(Xt),ye(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(a===null||a.child===null)&&(Ol(h)?vn(h):a===null||a.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,lO())),Ot(h),null;case 26:var O=h.type,v=h.memoizedState;return a===null?(vn(h),v!==null?(Ot(h),AC(h,v)):(Ot(h),KO(h,O,null,p,f))):v?v!==a.memoizedState?(vn(h),Ot(h),AC(h,v)):(Ot(h),h.flags&=-16777217):(a=a.memoizedProps,a!==p&&vn(h),Ot(h),KO(h,O,a,p,f)),null;case 27:if(Ft(h),f=de.current,O=h.type,a!==null&&h.stateNode!=null)a.memoizedProps!==p&&vn(h);else{if(!p){if(h.stateNode===null)throw Error(s(166));return Ot(h),null}a=ce.current,Ol(h)?aw(h):(a=$k(O,p,f),h.stateNode=a,vn(h))}return Ot(h),null;case 5:if(Ft(h),O=h.type,a!==null&&h.stateNode!=null)a.memoizedProps!==p&&vn(h);else{if(!p){if(h.stateNode===null)throw Error(s(166));return Ot(h),null}if(v=ce.current,Ol(h))aw(h);else{var S=$d(de.current);switch(v){case 1:v=S.createElementNS("http://www.w3.org/2000/svg",O);break;case 2:v=S.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;default:switch(O){case"svg":v=S.createElementNS("http://www.w3.org/2000/svg",O);break;case"math":v=S.createElementNS("http://www.w3.org/1998/Math/MathML",O);break;case"script":v=S.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof p.is=="string"?S.createElement("select",{is:p.is}):S.createElement("select"),p.multiple?v.multiple=!0:p.size&&(v.size=p.size);break;default:v=typeof p.is=="string"?S.createElement(O,{is:p.is}):S.createElement(O)}}v[wi]=h,v[rs]=p;e:for(S=h.child;S!==null;){if(S.tag===5||S.tag===6)v.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===h)break e;for(;S.sibling===null;){if(S.return===null||S.return===h)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}h.stateNode=v;e:switch(Ai(v,O,p),O){case"button":case"input":case"select":case"textarea":p=!!p.autoFocus;break e;case"img":p=!0;break e;default:p=!1}p&&vn(h)}}return Ot(h),KO(h,h.type,a===null?null:a.memoizedProps,h.pendingProps,f),null;case 6:if(a&&h.stateNode!=null)a.memoizedProps!==p&&vn(h);else{if(typeof p!="string"&&h.stateNode===null)throw Error(s(166));if(a=de.current,Ol(h)){if(a=h.stateNode,f=h.memoizedProps,p=null,O=Ci,O!==null)switch(O.tag){case 27:case 5:p=O.memoizedProps}a[wi]=h,a=!!(a.nodeValue===f||p!==null&&p.suppressHydrationWarning===!0||wk(a.nodeValue,f)),a||eo(h,!0)}else a=$d(a).createTextNode(p),a[wi]=h,h.stateNode=a}return Ot(h),null;case 31:if(f=h.memoizedState,a===null||a.memoizedState!==null){if(p=Ol(h),f!==null){if(a===null){if(!p)throw Error(s(318));if(a=h.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(s(557));a[wi]=h}else oa(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ot(h),a=!1}else f=lO(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=f),a=!0;if(!a)return h.flags&256?(Cs(h),h):(Cs(h),null);if((h.flags&128)!==0)throw Error(s(558))}return Ot(h),null;case 13:if(p=h.memoizedState,a===null||a.memoizedState!==null&&a.memoizedState.dehydrated!==null){if(O=Ol(h),p!==null&&p.dehydrated!==null){if(a===null){if(!O)throw Error(s(318));if(O=h.memoizedState,O=O!==null?O.dehydrated:null,!O)throw Error(s(317));O[wi]=h}else oa(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;Ot(h),O=!1}else O=lO(),a!==null&&a.memoizedState!==null&&(a.memoizedState.hydrationErrors=O),O=!0;if(!O)return h.flags&256?(Cs(h),h):(Cs(h),null)}return Cs(h),(h.flags&128)!==0?(h.lanes=f,h):(f=p!==null,a=a!==null&&a.memoizedState!==null,f&&(p=h.child,O=null,p.alternate!==null&&p.alternate.memoizedState!==null&&p.alternate.memoizedState.cachePool!==null&&(O=p.alternate.memoizedState.cachePool.pool),v=null,p.memoizedState!==null&&p.memoizedState.cachePool!==null&&(v=p.memoizedState.cachePool.pool),v!==O&&(p.flags|=2048)),f!==a&&f&&(h.child.flags|=8192),yd(h,h.updateQueue),Ot(h),null);case 4:return ye(),a===null&&y0(h.stateNode.containerInfo),Ot(h),null;case 10:return mn(h.type),Ot(h),null;case 19:if(G($t),p=h.memoizedState,p===null)return Ot(h),null;if(O=(h.flags&128)!==0,v=p.rendering,v===null)if(O)_c(p,!1);else{if(At!==0||a!==null&&(a.flags&128)!==0)for(a=h.child;a!==null;){if(v=ad(a),v!==null){for(h.flags|=128,_c(p,!1),a=v.updateQueue,h.updateQueue=a,yd(h,a),h.subtreeFlags=0,a=f,f=h.child;f!==null;)iw(f,a),f=f.sibling;return ie($t,$t.current&1|2),Ue&&dn(h,p.treeForkCount),h.child}a=a.sibling}p.tail!==null&&vs()>Cd&&(h.flags|=128,O=!0,_c(p,!1),h.lanes=4194304)}else{if(!O)if(a=ad(v),a!==null){if(h.flags|=128,O=!0,a=a.updateQueue,h.updateQueue=a,yd(h,a),_c(p,!0),p.tail===null&&p.tailMode==="hidden"&&!v.alternate&&!Ue)return Ot(h),null}else 2*vs()-p.renderingStartTime>Cd&&f!==536870912&&(h.flags|=128,O=!0,_c(p,!1),h.lanes=4194304);p.isBackwards?(v.sibling=h.child,h.child=v):(a=p.last,a!==null?a.sibling=v:h.child=v,p.last=v)}return p.tail!==null?(a=p.tail,p.rendering=a,p.tail=a.sibling,p.renderingStartTime=vs(),a.sibling=null,f=$t.current,ie($t,O?f&1|2:f&1),Ue&&dn(h,p.treeForkCount),a):(Ot(h),null);case 22:case 23:return Cs(h),bO(),p=h.memoizedState!==null,a!==null?a.memoizedState!==null!==p&&(h.flags|=8192):p&&(h.flags|=8192),p?(f&536870912)!==0&&(h.flags&128)===0&&(Ot(h),h.subtreeFlags&6&&(h.flags|=8192)):Ot(h),f=h.updateQueue,f!==null&&yd(h,f.retryQueue),f=null,a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),p=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(p=h.memoizedState.cachePool.pool),p!==f&&(h.flags|=2048),a!==null&&G(ha),null;case 24:return f=null,a!==null&&(f=a.memoizedState.cache),h.memoizedState.cache!==f&&(h.flags|=2048),mn(Xt),Ot(h),null;case 25:return null;case 30:return null}throw Error(s(156,h.tag))}function k6(a,h){switch(oO(h),h.tag){case 1:return a=h.flags,a&65536?(h.flags=a&-65537|128,h):null;case 3:return mn(Xt),ye(),a=h.flags,(a&65536)!==0&&(a&128)===0?(h.flags=a&-65537|128,h):null;case 26:case 27:case 5:return Ft(h),null;case 31:if(h.memoizedState!==null){if(Cs(h),h.alternate===null)throw Error(s(340));oa()}return a=h.flags,a&65536?(h.flags=a&-65537|128,h):null;case 13:if(Cs(h),a=h.memoizedState,a!==null&&a.dehydrated!==null){if(h.alternate===null)throw Error(s(340));oa()}return a=h.flags,a&65536?(h.flags=a&-65537|128,h):null;case 19:return G($t),null;case 4:return ye(),null;case 10:return mn(h.type),null;case 22:case 23:return Cs(h),bO(),a!==null&&G(ha),a=h.flags,a&65536?(h.flags=a&-65537|128,h):null;case 24:return mn(Xt),null;case 25:return null;default:return null}}function MC(a,h){switch(oO(h),h.tag){case 3:mn(Xt),ye();break;case 26:case 27:case 5:Ft(h);break;case 4:ye();break;case 31:h.memoizedState!==null&&Cs(h);break;case 13:Cs(h);break;case 19:G($t);break;case 10:mn(h.type);break;case 22:case 23:Cs(h),bO(),a!==null&&G(ha);break;case 24:mn(Xt)}}function vc(a,h){try{var f=h.updateQueue,p=f!==null?f.lastEffect:null;if(p!==null){var O=p.next;f=O;do{if((f.tag&a)===a){p=void 0;var v=f.create,S=f.inst;p=v(),S.destroy=p}f=f.next}while(f!==O)}}catch(T){it(h,h.return,T)}}function ao(a,h,f){try{var p=h.updateQueue,O=p!==null?p.lastEffect:null;if(O!==null){var v=O.next;p=v;do{if((p.tag&a)===a){var S=p.inst,T=S.destroy;if(T!==void 0){S.destroy=void 0,O=h;var V=f,J=T;try{J()}catch(re){it(O,V,re)}}}p=p.next}while(p!==v)}}catch(re){it(h,h.return,re)}}function EC(a){var h=a.updateQueue;if(h!==null){var f=a.stateNode;try{yw(h,f)}catch(p){it(a,a.return,p)}}}function PC(a,h,f){f.props=pa(a.type,a.memoizedProps),f.state=a.memoizedState;try{f.componentWillUnmount()}catch(p){it(a,h,p)}}function yc(a,h){try{var f=a.ref;if(f!==null){switch(a.tag){case 26:case 27:case 5:var p=a.stateNode;break;case 30:p=a.stateNode;break;default:p=a.stateNode}typeof f=="function"?a.refCleanup=f(p):f.current=p}}catch(O){it(a,h,O)}}function Pr(a,h){var f=a.ref,p=a.refCleanup;if(f!==null)if(typeof p=="function")try{p()}catch(O){it(a,h,O)}finally{a.refCleanup=null,a=a.alternate,a!=null&&(a.refCleanup=null)}else if(typeof f=="function")try{f(null)}catch(O){it(a,h,O)}else f.current=null}function QC(a){var h=a.type,f=a.memoizedProps,p=a.stateNode;try{e:switch(h){case"button":case"input":case"select":case"textarea":f.autoFocus&&p.focus();break e;case"img":f.src?p.src=f.src:f.srcSet&&(p.srcset=f.srcSet)}}catch(O){it(a,a.return,O)}}function JO(a,h,f){try{var p=a.stateNode;Y6(p,a.type,f,h),p[rs]=h}catch(O){it(a,a.return,O)}}function RC(a){return a.tag===5||a.tag===3||a.tag===26||a.tag===27&&mo(a.type)||a.tag===4}function e0(a){e:for(;;){for(;a.sibling===null;){if(a.return===null||RC(a.return))return null;a=a.return}for(a.sibling.return=a.return,a=a.sibling;a.tag!==5&&a.tag!==6&&a.tag!==18;){if(a.tag===27&&mo(a.type)||a.flags&2||a.child===null||a.tag===4)continue e;a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}function t0(a,h,f){var p=a.tag;if(p===5||p===6)a=a.stateNode,h?(f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f).insertBefore(a,h):(h=f.nodeType===9?f.body:f.nodeName==="HTML"?f.ownerDocument.body:f,h.appendChild(a),f=f._reactRootContainer,f!=null||h.onclick!==null||(h.onclick=cn));else if(p!==4&&(p===27&&mo(a.type)&&(f=a.stateNode,h=null),a=a.child,a!==null))for(t0(a,h,f),a=a.sibling;a!==null;)t0(a,h,f),a=a.sibling}function bd(a,h,f){var p=a.tag;if(p===5||p===6)a=a.stateNode,h?f.insertBefore(a,h):f.appendChild(a);else if(p!==4&&(p===27&&mo(a.type)&&(f=a.stateNode),a=a.child,a!==null))for(bd(a,h,f),a=a.sibling;a!==null;)bd(a,h,f),a=a.sibling}function LC(a){var h=a.stateNode,f=a.memoizedProps;try{for(var p=a.type,O=h.attributes;O.length;)h.removeAttributeNode(O[0]);Ai(h,p,f),h[wi]=a,h[rs]=f}catch(v){it(a,a.return,v)}}var yn=!1,jt=!1,i0=!1,$C=typeof WeakSet=="function"?WeakSet:Set,li=null;function T6(a,h){if(a=a.containerInfo,x0=Zd,a=Ux(a),Hg(a)){if("selectionStart"in a)var f={start:a.selectionStart,end:a.selectionEnd};else e:{f=(f=a.ownerDocument)&&f.defaultView||window;var p=f.getSelection&&f.getSelection();if(p&&p.rangeCount!==0){f=p.anchorNode;var O=p.anchorOffset,v=p.focusNode;p=p.focusOffset;try{f.nodeType,v.nodeType}catch{f=null;break e}var S=0,T=-1,V=-1,J=0,re=0,ae=a,ee=null;t:for(;;){for(var te;ae!==f||O!==0&&ae.nodeType!==3||(T=S+O),ae!==v||p!==0&&ae.nodeType!==3||(V=S+p),ae.nodeType===3&&(S+=ae.nodeValue.length),(te=ae.firstChild)!==null;)ee=ae,ae=te;for(;;){if(ae===a)break t;if(ee===f&&++J===O&&(T=S),ee===v&&++re===p&&(V=S),(te=ae.nextSibling)!==null)break;ae=ee,ee=ae.parentNode}ae=te}f=T===-1||V===-1?null:{start:T,end:V}}else f=null}f=f||{start:0,end:0}}else f=null;for(w0={focusedElem:a,selectionRange:f},Zd=!1,li=h;li!==null;)if(h=li,a=h.child,(h.subtreeFlags&1028)!==0&&a!==null)a.return=h,li=a;else for(;li!==null;){switch(h=li,v=h.alternate,a=h.flags,h.tag){case 0:if((a&4)!==0&&(a=h.updateQueue,a=a!==null?a.events:null,a!==null))for(f=0;f<a.length;f++)O=a[f],O.ref.impl=O.nextImpl;break;case 11:case 15:break;case 1:if((a&1024)!==0&&v!==null){a=void 0,f=h,O=v.memoizedProps,v=v.memoizedState,p=f.stateNode;try{var be=pa(f.type,O);a=p.getSnapshotBeforeUpdate(be,v),p.__reactInternalSnapshotBeforeUpdate=a}catch(Ee){it(f,f.return,Ee)}}break;case 3:if((a&1024)!==0){if(a=h.stateNode.containerInfo,f=a.nodeType,f===9)T0(a);else if(f===1)switch(a.nodeName){case"HEAD":case"HTML":case"BODY":T0(a);break;default:a.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((a&1024)!==0)throw Error(s(163))}if(a=h.sibling,a!==null){a.return=h.return,li=a;break}li=h.return}}function BC(a,h,f){var p=f.flags;switch(f.tag){case 0:case 11:case 15:Sn(a,f),p&4&&vc(5,f);break;case 1:if(Sn(a,f),p&4)if(a=f.stateNode,h===null)try{a.componentDidMount()}catch(S){it(f,f.return,S)}else{var O=pa(f.type,h.memoizedProps);h=h.memoizedState;try{a.componentDidUpdate(O,h,a.__reactInternalSnapshotBeforeUpdate)}catch(S){it(f,f.return,S)}}p&64&&EC(f),p&512&&yc(f,f.return);break;case 3:if(Sn(a,f),p&64&&(a=f.updateQueue,a!==null)){if(h=null,f.child!==null)switch(f.child.tag){case 27:case 5:h=f.child.stateNode;break;case 1:h=f.child.stateNode}try{yw(a,h)}catch(S){it(f,f.return,S)}}break;case 27:h===null&&p&4&&LC(f);case 26:case 5:Sn(a,f),h===null&&p&4&&QC(f),p&512&&yc(f,f.return);break;case 12:Sn(a,f);break;case 31:Sn(a,f),p&4&&NC(a,f);break;case 13:Sn(a,f),p&4&&XC(a,f),p&64&&(a=f.memoizedState,a!==null&&(a=a.dehydrated,a!==null&&(f=B6.bind(null,f),iz(a,f))));break;case 22:if(p=f.memoizedState!==null||yn,!p){h=h!==null&&h.memoizedState!==null||jt,O=yn;var v=jt;yn=p,(jt=h)&&!v?xn(a,f,(f.subtreeFlags&8772)!==0):Sn(a,f),yn=O,jt=v}break;case 30:break;default:Sn(a,f)}}function DC(a){var h=a.alternate;h!==null&&(a.alternate=null,DC(h)),a.child=null,a.deletions=null,a.sibling=null,a.tag===5&&(h=a.stateNode,h!==null&&Qg(h)),a.stateNode=null,a.return=null,a.dependencies=null,a.memoizedProps=null,a.memoizedState=null,a.pendingProps=null,a.stateNode=null,a.updateQueue=null}var bt=null,os=!1;function bn(a,h,f){for(f=f.child;f!==null;)zC(a,h,f),f=f.sibling}function zC(a,h,f){if(ys&&typeof ys.onCommitFiberUnmount=="function")try{ys.onCommitFiberUnmount(Ih,f)}catch{}switch(f.tag){case 26:jt||Pr(f,h),bn(a,h,f),f.memoizedState?f.memoizedState.count--:f.stateNode&&(f=f.stateNode,f.parentNode.removeChild(f));break;case 27:jt||Pr(f,h);var p=bt,O=os;mo(f.type)&&(bt=f.stateNode,os=!1),bn(a,h,f),Mc(f.stateNode),bt=p,os=O;break;case 5:jt||Pr(f,h);case 6:if(p=bt,O=os,bt=null,bn(a,h,f),bt=p,os=O,bt!==null)if(os)try{(bt.nodeType===9?bt.body:bt.nodeName==="HTML"?bt.ownerDocument.body:bt).removeChild(f.stateNode)}catch(v){it(f,h,v)}else try{bt.removeChild(f.stateNode)}catch(v){it(f,h,v)}break;case 18:bt!==null&&(os?(a=bt,Ek(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,f.stateNode),zl(a)):Ek(bt,f.stateNode));break;case 4:p=bt,O=os,bt=f.stateNode.containerInfo,os=!0,bn(a,h,f),bt=p,os=O;break;case 0:case 11:case 14:case 15:ao(2,f,h),jt||ao(4,f,h),bn(a,h,f);break;case 1:jt||(Pr(f,h),p=f.stateNode,typeof p.componentWillUnmount=="function"&&PC(f,h,p)),bn(a,h,f);break;case 21:bn(a,h,f);break;case 22:jt=(p=jt)||f.memoizedState!==null,bn(a,h,f),jt=p;break;default:bn(a,h,f)}}function NC(a,h){if(h.memoizedState===null&&(a=h.alternate,a!==null&&(a=a.memoizedState,a!==null))){a=a.dehydrated;try{zl(a)}catch(f){it(h,h.return,f)}}}function XC(a,h){if(h.memoizedState===null&&(a=h.alternate,a!==null&&(a=a.memoizedState,a!==null&&(a=a.dehydrated,a!==null))))try{zl(a)}catch(f){it(h,h.return,f)}}function A6(a){switch(a.tag){case 31:case 13:case 19:var h=a.stateNode;return h===null&&(h=a.stateNode=new $C),h;case 22:return a=a.stateNode,h=a._retryCache,h===null&&(h=a._retryCache=new $C),h;default:throw Error(s(435,a.tag))}}function Sd(a,h){var f=A6(a);h.forEach(function(p){if(!f.has(p)){f.add(p);var O=D6.bind(null,a,p);p.then(O,O)}})}function as(a,h){var f=h.deletions;if(f!==null)for(var p=0;p<f.length;p++){var O=f[p],v=a,S=h,T=S;e:for(;T!==null;){switch(T.tag){case 27:if(mo(T.type)){bt=T.stateNode,os=!1;break e}break;case 5:bt=T.stateNode,os=!1;break e;case 3:case 4:bt=T.stateNode.containerInfo,os=!0;break e}T=T.return}if(bt===null)throw Error(s(160));zC(v,S,O),bt=null,os=!1,v=O.alternate,v!==null&&(v.return=null),O.return=null}if(h.subtreeFlags&13886)for(h=h.child;h!==null;)VC(h,a),h=h.sibling}var dr=null;function VC(a,h){var f=a.alternate,p=a.flags;switch(a.tag){case 0:case 11:case 14:case 15:as(h,a),ls(a),p&4&&(ao(3,a,a.return),vc(3,a),ao(5,a,a.return));break;case 1:as(h,a),ls(a),p&512&&(jt||f===null||Pr(f,f.return)),p&64&&yn&&(a=a.updateQueue,a!==null&&(p=a.callbacks,p!==null&&(f=a.shared.hiddenCallbacks,a.shared.hiddenCallbacks=f===null?p:f.concat(p))));break;case 26:var O=dr;if(as(h,a),ls(a),p&512&&(jt||f===null||Pr(f,f.return)),p&4){var v=f!==null?f.memoizedState:null;if(p=a.memoizedState,f===null)if(p===null)if(a.stateNode===null){e:{p=a.type,f=a.memoizedProps,O=O.ownerDocument||O;t:switch(p){case"title":v=O.getElementsByTagName("title")[0],(!v||v[Uh]||v[wi]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=O.createElement(p),O.head.insertBefore(v,O.querySelector("head > title"))),Ai(v,p,f),v[wi]=a,ai(v),p=v;break e;case"link":var S=Vk("link","href",O).get(p+(f.href||""));if(S){for(var T=0;T<S.length;T++)if(v=S[T],v.getAttribute("href")===(f.href==null||f.href===""?null:f.href)&&v.getAttribute("rel")===(f.rel==null?null:f.rel)&&v.getAttribute("title")===(f.title==null?null:f.title)&&v.getAttribute("crossorigin")===(f.crossOrigin==null?null:f.crossOrigin)){S.splice(T,1);break t}}v=O.createElement(p),Ai(v,p,f),O.head.appendChild(v);break;case"meta":if(S=Vk("meta","content",O).get(p+(f.content||""))){for(T=0;T<S.length;T++)if(v=S[T],v.getAttribute("content")===(f.content==null?null:""+f.content)&&v.getAttribute("name")===(f.name==null?null:f.name)&&v.getAttribute("property")===(f.property==null?null:f.property)&&v.getAttribute("http-equiv")===(f.httpEquiv==null?null:f.httpEquiv)&&v.getAttribute("charset")===(f.charSet==null?null:f.charSet)){S.splice(T,1);break t}}v=O.createElement(p),Ai(v,p,f),O.head.appendChild(v);break;default:throw Error(s(468,p))}v[wi]=a,ai(v),p=v}a.stateNode=p}else Zk(O,a.type,a.stateNode);else a.stateNode=Xk(O,p,a.memoizedProps);else v!==p?(v===null?f.stateNode!==null&&(f=f.stateNode,f.parentNode.removeChild(f)):v.count--,p===null?Zk(O,a.type,a.stateNode):Xk(O,p,a.memoizedProps)):p===null&&a.stateNode!==null&&JO(a,a.memoizedProps,f.memoizedProps)}break;case 27:as(h,a),ls(a),p&512&&(jt||f===null||Pr(f,f.return)),f!==null&&p&4&&JO(a,a.memoizedProps,f.memoizedProps);break;case 5:if(as(h,a),ls(a),p&512&&(jt||f===null||Pr(f,f.return)),a.flags&32){O=a.stateNode;try{al(O,"")}catch(be){it(a,a.return,be)}}p&4&&a.stateNode!=null&&(O=a.memoizedProps,JO(a,O,f!==null?f.memoizedProps:O)),p&1024&&(i0=!0);break;case 6:if(as(h,a),ls(a),p&4){if(a.stateNode===null)throw Error(s(162));p=a.memoizedProps,f=a.stateNode;try{f.nodeValue=p}catch(be){it(a,a.return,be)}}break;case 3:if(zd=null,O=dr,dr=Bd(h.containerInfo),as(h,a),dr=O,ls(a),p&4&&f!==null&&f.memoizedState.isDehydrated)try{zl(h.containerInfo)}catch(be){it(a,a.return,be)}i0&&(i0=!1,ZC(a));break;case 4:p=dr,dr=Bd(a.stateNode.containerInfo),as(h,a),ls(a),dr=p;break;case 12:as(h,a),ls(a);break;case 31:as(h,a),ls(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Sd(a,p)));break;case 13:as(h,a),ls(a),a.child.flags&8192&&a.memoizedState!==null!=(f!==null&&f.memoizedState!==null)&&(wd=vs()),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Sd(a,p)));break;case 22:O=a.memoizedState!==null;var V=f!==null&&f.memoizedState!==null,J=yn,re=jt;if(yn=J||O,jt=re||V,as(h,a),jt=re,yn=J,ls(a),p&8192)e:for(h=a.stateNode,h._visibility=O?h._visibility&-2:h._visibility|1,O&&(f===null||V||yn||jt||ma(a)),f=null,h=a;;){if(h.tag===5||h.tag===26){if(f===null){V=f=h;try{if(v=V.stateNode,O)S=v.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{T=V.stateNode;var ae=V.memoizedProps.style,ee=ae!=null&&ae.hasOwnProperty("display")?ae.display:null;T.style.display=ee==null||typeof ee=="boolean"?"":(""+ee).trim()}}catch(be){it(V,V.return,be)}}}else if(h.tag===6){if(f===null){V=h;try{V.stateNode.nodeValue=O?"":V.memoizedProps}catch(be){it(V,V.return,be)}}}else if(h.tag===18){if(f===null){V=h;try{var te=V.stateNode;O?Pk(te,!0):Pk(V.stateNode,!1)}catch(be){it(V,V.return,be)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===a)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===a)break e;for(;h.sibling===null;){if(h.return===null||h.return===a)break e;f===h&&(f=null),h=h.return}f===h&&(f=null),h.sibling.return=h.return,h=h.sibling}p&4&&(p=a.updateQueue,p!==null&&(f=p.retryQueue,f!==null&&(p.retryQueue=null,Sd(a,f))));break;case 19:as(h,a),ls(a),p&4&&(p=a.updateQueue,p!==null&&(a.updateQueue=null,Sd(a,p)));break;case 30:break;case 21:break;default:as(h,a),ls(a)}}function ls(a){var h=a.flags;if(h&2){try{for(var f,p=a.return;p!==null;){if(RC(p)){f=p;break}p=p.return}if(f==null)throw Error(s(160));switch(f.tag){case 27:var O=f.stateNode,v=e0(a);bd(a,v,O);break;case 5:var S=f.stateNode;f.flags&32&&(al(S,""),f.flags&=-33);var T=e0(a);bd(a,T,S);break;case 3:case 4:var V=f.stateNode.containerInfo,J=e0(a);t0(a,J,V);break;default:throw Error(s(161))}}catch(re){it(a,a.return,re)}a.flags&=-3}h&4096&&(a.flags&=-4097)}function ZC(a){if(a.subtreeFlags&1024)for(a=a.child;a!==null;){var h=a;ZC(h),h.tag===5&&h.flags&1024&&h.stateNode.reset(),a=a.sibling}}function Sn(a,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)BC(a,h.alternate,h),h=h.sibling}function ma(a){for(a=a.child;a!==null;){var h=a;switch(h.tag){case 0:case 11:case 14:case 15:ao(4,h,h.return),ma(h);break;case 1:Pr(h,h.return);var f=h.stateNode;typeof f.componentWillUnmount=="function"&&PC(h,h.return,f),ma(h);break;case 27:Mc(h.stateNode);case 26:case 5:Pr(h,h.return),ma(h);break;case 22:h.memoizedState===null&&ma(h);break;case 30:ma(h);break;default:ma(h)}a=a.sibling}}function xn(a,h,f){for(f=f&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var p=h.alternate,O=a,v=h,S=v.flags;switch(v.tag){case 0:case 11:case 15:xn(O,v,f),vc(4,v);break;case 1:if(xn(O,v,f),p=v,O=p.stateNode,typeof O.componentDidMount=="function")try{O.componentDidMount()}catch(J){it(p,p.return,J)}if(p=v,O=p.updateQueue,O!==null){var T=p.stateNode;try{var V=O.shared.hiddenCallbacks;if(V!==null)for(O.shared.hiddenCallbacks=null,O=0;O<V.length;O++)vw(V[O],T)}catch(J){it(p,p.return,J)}}f&&S&64&&EC(v),yc(v,v.return);break;case 27:LC(v);case 26:case 5:xn(O,v,f),f&&p===null&&S&4&&QC(v),yc(v,v.return);break;case 12:xn(O,v,f);break;case 31:xn(O,v,f),f&&S&4&&NC(O,v);break;case 13:xn(O,v,f),f&&S&4&&XC(O,v);break;case 22:v.memoizedState===null&&xn(O,v,f),yc(v,v.return);break;case 30:break;default:xn(O,v,f)}h=h.sibling}}function s0(a,h){var f=null;a!==null&&a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(f=a.memoizedState.cachePool.pool),a=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(a=h.memoizedState.cachePool.pool),a!==f&&(a!=null&&a.refCount++,f!=null&&oc(f))}function r0(a,h){a=null,h.alternate!==null&&(a=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==a&&(h.refCount++,a!=null&&oc(a))}function pr(a,h,f,p){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)jC(a,h,f,p),h=h.sibling}function jC(a,h,f,p){var O=h.flags;switch(h.tag){case 0:case 11:case 15:pr(a,h,f,p),O&2048&&vc(9,h);break;case 1:pr(a,h,f,p);break;case 3:pr(a,h,f,p),O&2048&&(a=null,h.alternate!==null&&(a=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==a&&(h.refCount++,a!=null&&oc(a)));break;case 12:if(O&2048){pr(a,h,f,p),a=h.stateNode;try{var v=h.memoizedProps,S=v.id,T=v.onPostCommit;typeof T=="function"&&T(S,h.alternate===null?"mount":"update",a.passiveEffectDuration,-0)}catch(V){it(h,h.return,V)}}else pr(a,h,f,p);break;case 31:pr(a,h,f,p);break;case 13:pr(a,h,f,p);break;case 23:break;case 22:v=h.stateNode,S=h.alternate,h.memoizedState!==null?v._visibility&2?pr(a,h,f,p):bc(a,h):v._visibility&2?pr(a,h,f,p):(v._visibility|=2,Tl(a,h,f,p,(h.subtreeFlags&10256)!==0||!1)),O&2048&&s0(S,h);break;case 24:pr(a,h,f,p),O&2048&&r0(h.alternate,h);break;default:pr(a,h,f,p)}}function Tl(a,h,f,p,O){for(O=O&&((h.subtreeFlags&10256)!==0||!1),h=h.child;h!==null;){var v=a,S=h,T=f,V=p,J=S.flags;switch(S.tag){case 0:case 11:case 15:Tl(v,S,T,V,O),vc(8,S);break;case 23:break;case 22:var re=S.stateNode;S.memoizedState!==null?re._visibility&2?Tl(v,S,T,V,O):bc(v,S):(re._visibility|=2,Tl(v,S,T,V,O)),O&&J&2048&&s0(S.alternate,S);break;case 24:Tl(v,S,T,V,O),O&&J&2048&&r0(S.alternate,S);break;default:Tl(v,S,T,V,O)}h=h.sibling}}function bc(a,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var f=a,p=h,O=p.flags;switch(p.tag){case 22:bc(f,p),O&2048&&s0(p.alternate,p);break;case 24:bc(f,p),O&2048&&r0(p.alternate,p);break;default:bc(f,p)}h=h.sibling}}var Sc=8192;function Al(a,h,f){if(a.subtreeFlags&Sc)for(a=a.child;a!==null;)IC(a,h,f),a=a.sibling}function IC(a,h,f){switch(a.tag){case 26:Al(a,h,f),a.flags&Sc&&a.memoizedState!==null&&pz(f,dr,a.memoizedState,a.memoizedProps);break;case 5:Al(a,h,f);break;case 3:case 4:var p=dr;dr=Bd(a.stateNode.containerInfo),Al(a,h,f),dr=p;break;case 22:a.memoizedState===null&&(p=a.alternate,p!==null&&p.memoizedState!==null?(p=Sc,Sc=16777216,Al(a,h,f),Sc=p):Al(a,h,f));break;default:Al(a,h,f)}}function qC(a){var h=a.alternate;if(h!==null&&(a=h.child,a!==null)){h.child=null;do h=a.sibling,a.sibling=null,a=h;while(a!==null)}}function xc(a){var h=a.deletions;if((a.flags&16)!==0){if(h!==null)for(var f=0;f<h.length;f++){var p=h[f];li=p,UC(p,a)}qC(a)}if(a.subtreeFlags&10256)for(a=a.child;a!==null;)WC(a),a=a.sibling}function WC(a){switch(a.tag){case 0:case 11:case 15:xc(a),a.flags&2048&&ao(9,a,a.return);break;case 3:xc(a);break;case 12:xc(a);break;case 22:var h=a.stateNode;a.memoizedState!==null&&h._visibility&2&&(a.return===null||a.return.tag!==13)?(h._visibility&=-3,xd(a)):xc(a);break;default:xc(a)}}function xd(a){var h=a.deletions;if((a.flags&16)!==0){if(h!==null)for(var f=0;f<h.length;f++){var p=h[f];li=p,UC(p,a)}qC(a)}for(a=a.child;a!==null;){switch(h=a,h.tag){case 0:case 11:case 15:ao(8,h,h.return),xd(h);break;case 22:f=h.stateNode,f._visibility&2&&(f._visibility&=-3,xd(h));break;default:xd(h)}a=a.sibling}}function UC(a,h){for(;li!==null;){var f=li;switch(f.tag){case 0:case 11:case 15:ao(8,f,h);break;case 23:case 22:if(f.memoizedState!==null&&f.memoizedState.cachePool!==null){var p=f.memoizedState.cachePool.pool;p!=null&&p.refCount++}break;case 24:oc(f.memoizedState.cache)}if(p=f.child,p!==null)p.return=f,li=p;else e:for(f=a;li!==null;){p=li;var O=p.sibling,v=p.return;if(DC(p),p===f){li=null;break e}if(O!==null){O.return=v,li=O;break e}li=v}}}var M6={getCacheForType:function(a){var h=ki(Xt),f=h.data.get(a);return f===void 0&&(f=a(),h.data.set(a,f)),f},cacheSignal:function(){return ki(Xt).controller.signal}},E6=typeof WeakMap=="function"?WeakMap:Map,Ge=0,lt=null,Ve=null,Ie=0,tt=0,ks=null,lo=!1,Ml=!1,n0=!1,wn=0,At=0,ho=0,ga=0,o0=0,Ts=0,El=0,wc=null,hs=null,a0=!1,wd=0,YC=0,Cd=1/0,kd=null,co=null,Kt=0,uo=null,Pl=null,Cn=0,l0=0,h0=null,HC=null,Cc=0,c0=null;function As(){return(Ge&2)!==0&&Ie!==0?Ie&-Ie:Q.T!==null?g0():ux()}function FC(){if(Ts===0)if((Ie&536870912)===0||Ue){var a=Lf;Lf<<=1,(Lf&3932160)===0&&(Lf=262144),Ts=a}else Ts=536870912;return a=ws.current,a!==null&&(a.flags|=32),Ts}function cs(a,h,f){(a===lt&&(tt===2||tt===9)||a.cancelPendingCommit!==null)&&(Ql(a,0),fo(a,Ie,Ts,!1)),Wh(a,f),((Ge&2)===0||a!==lt)&&(a===lt&&((Ge&2)===0&&(ga|=f),At===4&&fo(a,Ie,Ts,!1)),Qr(a))}function GC(a,h,f){if((Ge&6)!==0)throw Error(s(327));var p=!f&&(h&127)===0&&(h&a.expiredLanes)===0||qh(a,h),O=p?R6(a,h):f0(a,h,!0),v=p;do{if(O===0){Ml&&!p&&fo(a,h,0,!1);break}else{if(f=a.current.alternate,v&&!P6(f)){O=f0(a,h,!1),v=!1;continue}if(O===2){if(v=h,a.errorRecoveryDisabledLanes&v)var S=0;else S=a.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){h=S;e:{var T=a;O=wc;var V=T.current.memoizedState.isDehydrated;if(V&&(Ql(T,S).flags|=256),S=f0(T,S,!1),S!==2){if(n0&&!V){T.errorRecoveryDisabledLanes|=v,ga|=v,O=4;break e}v=hs,hs=O,v!==null&&(hs===null?hs=v:hs.push.apply(hs,v))}O=S}if(v=!1,O!==2)continue}}if(O===1){Ql(a,0),fo(a,h,0,!0);break}e:{switch(p=a,v=O,v){case 0:case 1:throw Error(s(345));case 4:if((h&4194048)!==h)break;case 6:fo(p,h,Ts,!lo);break e;case 2:hs=null;break;case 3:case 5:break;default:throw Error(s(329))}if((h&62914560)===h&&(O=wd+300-vs(),10<O)){if(fo(p,h,Ts,!lo),Bf(p,0,!0)!==0)break e;Cn=h,p.timeoutHandle=Ak(KC.bind(null,p,f,hs,kd,a0,h,Ts,ga,El,lo,v,"Throttled",-0,0),O);break e}KC(p,f,hs,kd,a0,h,Ts,ga,El,lo,v,null,-0,0)}}break}while(!0);Qr(a)}function KC(a,h,f,p,O,v,S,T,V,J,re,ae,ee,te){if(a.timeoutHandle=-1,ae=h.subtreeFlags,ae&8192||(ae&16785408)===16785408){ae={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:cn},IC(h,v,ae);var be=(v&62914560)===v?wd-vs():(v&4194048)===v?YC-vs():0;if(be=mz(ae,be),be!==null){Cn=v,a.cancelPendingCommit=be(ok.bind(null,a,h,v,f,p,O,S,T,V,re,ae,null,ee,te)),fo(a,v,S,!J);return}}ok(a,h,v,f,p,O,S,T,V)}function P6(a){for(var h=a;;){var f=h.tag;if((f===0||f===11||f===15)&&h.flags&16384&&(f=h.updateQueue,f!==null&&(f=f.stores,f!==null)))for(var p=0;p<f.length;p++){var O=f[p],v=O.getSnapshot;O=O.value;try{if(!Ss(v(),O))return!1}catch{return!1}}if(f=h.child,h.subtreeFlags&16384&&f!==null)f.return=h,h=f;else{if(h===a)break;for(;h.sibling===null;){if(h.return===null||h.return===a)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function fo(a,h,f,p){h&=~o0,h&=~ga,a.suspendedLanes|=h,a.pingedLanes&=~h,p&&(a.warmLanes|=h),p=a.expirationTimes;for(var O=h;0<O;){var v=31-bs(O),S=1<<v;p[v]=-1,O&=~S}f!==0&&lx(a,f,h)}function Td(){return(Ge&6)===0?(kc(0),!1):!0}function u0(){if(Ve!==null){if(tt===0)var a=Ve.return;else a=Ve,pn=aa=null,TO(a),Sl=null,lc=0,a=Ve;for(;a!==null;)MC(a.alternate,a),a=a.return;Ve=null}}function Ql(a,h){var f=a.timeoutHandle;f!==-1&&(a.timeoutHandle=-1,G6(f)),f=a.cancelPendingCommit,f!==null&&(a.cancelPendingCommit=null,f()),Cn=0,u0(),lt=a,Ve=f=fn(a.current,null),Ie=h,tt=0,ks=null,lo=!1,Ml=qh(a,h),n0=!1,El=Ts=o0=ga=ho=At=0,hs=wc=null,a0=!1,(h&8)!==0&&(h|=h&32);var p=a.entangledLanes;if(p!==0)for(a=a.entanglements,p&=h;0<p;){var O=31-bs(p),v=1<<O;h|=a[O],p&=~v}return wn=h,Yf(),f}function JC(a,h){Be=null,Q.H=gc,h===bl||h===id?(h=mw(),tt=3):h===mO?(h=mw(),tt=4):tt=h===jO?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,ks=h,Ve===null&&(At=1,gd(a,Zs(h,a.current)))}function ek(){var a=ws.current;return a===null?!0:(Ie&4194048)===Ie?Ws===null:(Ie&62914560)===Ie||(Ie&536870912)!==0?a===Ws:!1}function tk(){var a=Q.H;return Q.H=gc,a===null?gc:a}function ik(){var a=Q.A;return Q.A=M6,a}function Ad(){At=4,lo||(Ie&4194048)!==Ie&&ws.current!==null||(Ml=!0),(ho&134217727)===0&&(ga&134217727)===0||lt===null||fo(lt,Ie,Ts,!1)}function f0(a,h,f){var p=Ge;Ge|=2;var O=tk(),v=ik();(lt!==a||Ie!==h)&&(kd=null,Ql(a,h)),h=!1;var S=At;e:do try{if(tt!==0&&Ve!==null){var T=Ve,V=ks;switch(tt){case 8:u0(),S=6;break e;case 3:case 2:case 9:case 6:ws.current===null&&(h=!0);var J=tt;if(tt=0,ks=null,Rl(a,T,V,J),f&&Ml){S=0;break e}break;default:J=tt,tt=0,ks=null,Rl(a,T,V,J)}}Q6(),S=At;break}catch(re){JC(a,re)}while(!0);return h&&a.shellSuspendCounter++,pn=aa=null,Ge=p,Q.H=O,Q.A=v,Ve===null&&(lt=null,Ie=0,Yf()),S}function Q6(){for(;Ve!==null;)sk(Ve)}function R6(a,h){var f=Ge;Ge|=2;var p=tk(),O=ik();lt!==a||Ie!==h?(kd=null,Cd=vs()+500,Ql(a,h)):Ml=qh(a,h);e:do try{if(tt!==0&&Ve!==null){h=Ve;var v=ks;t:switch(tt){case 1:tt=0,ks=null,Rl(a,h,v,1);break;case 2:case 9:if(dw(v)){tt=0,ks=null,rk(h);break}h=function(){tt!==2&&tt!==9||lt!==a||(tt=7),Qr(a)},v.then(h,h);break e;case 3:tt=7;break e;case 4:tt=5;break e;case 7:dw(v)?(tt=0,ks=null,rk(h)):(tt=0,ks=null,Rl(a,h,v,7));break;case 5:var S=null;switch(Ve.tag){case 26:S=Ve.memoizedState;case 5:case 27:var T=Ve;if(S?jk(S):T.stateNode.complete){tt=0,ks=null;var V=T.sibling;if(V!==null)Ve=V;else{var J=T.return;J!==null?(Ve=J,Md(J)):Ve=null}break t}}tt=0,ks=null,Rl(a,h,v,5);break;case 6:tt=0,ks=null,Rl(a,h,v,6);break;case 8:u0(),At=6;break e;default:throw Error(s(462))}}L6();break}catch(re){JC(a,re)}while(!0);return pn=aa=null,Q.H=p,Q.A=O,Ge=f,Ve!==null?0:(lt=null,Ie=0,Yf(),At)}function L6(){for(;Ve!==null&&!s4();)sk(Ve)}function sk(a){var h=TC(a.alternate,a,wn);a.memoizedProps=a.pendingProps,h===null?Md(a):Ve=h}function rk(a){var h=a,f=h.alternate;switch(h.tag){case 15:case 0:h=bC(f,h,h.pendingProps,h.type,void 0,Ie);break;case 11:h=bC(f,h,h.pendingProps,h.type.render,h.ref,Ie);break;case 5:TO(h);default:MC(f,h),h=Ve=iw(h,wn),h=TC(f,h,wn)}a.memoizedProps=a.pendingProps,h===null?Md(a):Ve=h}function Rl(a,h,f,p){pn=aa=null,TO(h),Sl=null,lc=0;var O=h.return;try{if(S6(a,O,h,f,Ie)){At=1,gd(a,Zs(f,a.current)),Ve=null;return}}catch(v){if(O!==null)throw Ve=O,v;At=1,gd(a,Zs(f,a.current)),Ve=null;return}h.flags&32768?(Ue||p===1?a=!0:Ml||(Ie&536870912)!==0?a=!1:(lo=a=!0,(p===2||p===9||p===3||p===6)&&(p=ws.current,p!==null&&p.tag===13&&(p.flags|=16384))),nk(h,a)):Md(h)}function Md(a){var h=a;do{if((h.flags&32768)!==0){nk(h,lo);return}a=h.return;var f=C6(h.alternate,h,wn);if(f!==null){Ve=f;return}if(h=h.sibling,h!==null){Ve=h;return}Ve=h=a}while(h!==null);At===0&&(At=5)}function nk(a,h){do{var f=k6(a.alternate,a);if(f!==null){f.flags&=32767,Ve=f;return}if(f=a.return,f!==null&&(f.flags|=32768,f.subtreeFlags=0,f.deletions=null),!h&&(a=a.sibling,a!==null)){Ve=a;return}Ve=a=f}while(a!==null);At=6,Ve=null}function ok(a,h,f,p,O,v,S,T,V){a.cancelPendingCommit=null;do Ed();while(Kt!==0);if((Ge&6)!==0)throw Error(s(327));if(h!==null){if(h===a.current)throw Error(s(177));if(v=h.lanes|h.childLanes,v|=eO,d4(a,f,v,S,T,V),a===lt&&(Ve=lt=null,Ie=0),Pl=h,uo=a,Cn=f,l0=v,h0=O,HC=p,(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?(a.callbackNode=null,a.callbackPriority=0,z6(Qf,function(){return uk(),null})):(a.callbackNode=null,a.callbackPriority=0),p=(h.flags&13878)!==0,(h.subtreeFlags&13878)!==0||p){p=Q.T,Q.T=null,O=X.p,X.p=2,S=Ge,Ge|=4;try{T6(a,h,f)}finally{Ge=S,X.p=O,Q.T=p}}Kt=1,ak(),lk(),hk()}}function ak(){if(Kt===1){Kt=0;var a=uo,h=Pl,f=(h.flags&13878)!==0;if((h.subtreeFlags&13878)!==0||f){f=Q.T,Q.T=null;var p=X.p;X.p=2;var O=Ge;Ge|=4;try{VC(h,a);var v=w0,S=Ux(a.containerInfo),T=v.focusedElem,V=v.selectionRange;if(S!==T&&T&&T.ownerDocument&&Wx(T.ownerDocument.documentElement,T)){if(V!==null&&Hg(T)){var J=V.start,re=V.end;if(re===void 0&&(re=J),"selectionStart"in T)T.selectionStart=J,T.selectionEnd=Math.min(re,T.value.length);else{var ae=T.ownerDocument||document,ee=ae&&ae.defaultView||window;if(ee.getSelection){var te=ee.getSelection(),be=T.textContent.length,Ee=Math.min(V.start,be),nt=V.end===void 0?Ee:Math.min(V.end,be);!te.extend&&Ee>nt&&(S=nt,nt=Ee,Ee=S);var H=qx(T,Ee),j=qx(T,nt);if(H&&j&&(te.rangeCount!==1||te.anchorNode!==H.node||te.anchorOffset!==H.offset||te.focusNode!==j.node||te.focusOffset!==j.offset)){var K=ae.createRange();K.setStart(H.node,H.offset),te.removeAllRanges(),Ee>nt?(te.addRange(K),te.extend(j.node,j.offset)):(K.setEnd(j.node,j.offset),te.addRange(K))}}}}for(ae=[],te=T;te=te.parentNode;)te.nodeType===1&&ae.push({element:te,left:te.scrollLeft,top:te.scrollTop});for(typeof T.focus=="function"&&T.focus(),T=0;T<ae.length;T++){var oe=ae[T];oe.element.scrollLeft=oe.left,oe.element.scrollTop=oe.top}}Zd=!!x0,w0=x0=null}finally{Ge=O,X.p=p,Q.T=f}}a.current=h,Kt=2}}function lk(){if(Kt===2){Kt=0;var a=uo,h=Pl,f=(h.flags&8772)!==0;if((h.subtreeFlags&8772)!==0||f){f=Q.T,Q.T=null;var p=X.p;X.p=2;var O=Ge;Ge|=4;try{BC(a,h.alternate,h)}finally{Ge=O,X.p=p,Q.T=f}}Kt=3}}function hk(){if(Kt===4||Kt===3){Kt=0,r4();var a=uo,h=Pl,f=Cn,p=HC;(h.subtreeFlags&10256)!==0||(h.flags&10256)!==0?Kt=5:(Kt=0,Pl=uo=null,ck(a,a.pendingLanes));var O=a.pendingLanes;if(O===0&&(co=null),Eg(f),h=h.stateNode,ys&&typeof ys.onCommitFiberRoot=="function")try{ys.onCommitFiberRoot(Ih,h,void 0,(h.current.flags&128)===128)}catch{}if(p!==null){h=Q.T,O=X.p,X.p=2,Q.T=null;try{for(var v=a.onRecoverableError,S=0;S<p.length;S++){var T=p[S];v(T.value,{componentStack:T.stack})}}finally{Q.T=h,X.p=O}}(Cn&3)!==0&&Ed(),Qr(a),O=a.pendingLanes,(f&261930)!==0&&(O&42)!==0?a===c0?Cc++:(Cc=0,c0=a):Cc=0,kc(0)}}function ck(a,h){(a.pooledCacheLanes&=h)===0&&(h=a.pooledCache,h!=null&&(a.pooledCache=null,oc(h)))}function Ed(){return ak(),lk(),hk(),uk()}function uk(){if(Kt!==5)return!1;var a=uo,h=l0;l0=0;var f=Eg(Cn),p=Q.T,O=X.p;try{X.p=32>f?32:f,Q.T=null,f=h0,h0=null;var v=uo,S=Cn;if(Kt=0,Pl=uo=null,Cn=0,(Ge&6)!==0)throw Error(s(331));var T=Ge;if(Ge|=4,WC(v.current),jC(v,v.current,S,f),Ge=T,kc(0,!1),ys&&typeof ys.onPostCommitFiberRoot=="function")try{ys.onPostCommitFiberRoot(Ih,v)}catch{}return!0}finally{X.p=O,Q.T=p,ck(a,h)}}function fk(a,h,f){h=Zs(f,h),h=ZO(a.stateNode,h,2),a=ro(a,h,2),a!==null&&(Wh(a,2),Qr(a))}function it(a,h,f){if(a.tag===3)fk(a,a,f);else for(;h!==null;){if(h.tag===3){fk(h,a,f);break}else if(h.tag===1){var p=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof p.componentDidCatch=="function"&&(co===null||!co.has(p))){a=Zs(f,a),f=dC(2),p=ro(h,f,2),p!==null&&(pC(f,p,h,a),Wh(p,2),Qr(p));break}}h=h.return}}function d0(a,h,f){var p=a.pingCache;if(p===null){p=a.pingCache=new E6;var O=new Set;p.set(h,O)}else O=p.get(h),O===void 0&&(O=new Set,p.set(h,O));O.has(f)||(n0=!0,O.add(f),a=$6.bind(null,a,h,f),h.then(a,a))}function $6(a,h,f){var p=a.pingCache;p!==null&&p.delete(h),a.pingedLanes|=a.suspendedLanes&f,a.warmLanes&=~f,lt===a&&(Ie&f)===f&&(At===4||At===3&&(Ie&62914560)===Ie&&300>vs()-wd?(Ge&2)===0&&Ql(a,0):o0|=f,El===Ie&&(El=0)),Qr(a)}function dk(a,h){h===0&&(h=ax()),a=ra(a,h),a!==null&&(Wh(a,h),Qr(a))}function B6(a){var h=a.memoizedState,f=0;h!==null&&(f=h.retryLane),dk(a,f)}function D6(a,h){var f=0;switch(a.tag){case 31:case 13:var p=a.stateNode,O=a.memoizedState;O!==null&&(f=O.retryLane);break;case 19:p=a.stateNode;break;case 22:p=a.stateNode._retryCache;break;default:throw Error(s(314))}p!==null&&p.delete(h),dk(a,f)}function z6(a,h){return jh(a,h)}var Pd=null,Ll=null,p0=!1,Qd=!1,m0=!1,po=0;function Qr(a){a!==Ll&&a.next===null&&(Ll===null?Pd=Ll=a:Ll=Ll.next=a),Qd=!0,p0||(p0=!0,X6())}function kc(a,h){if(!m0&&Qd){m0=!0;do for(var f=!1,p=Pd;p!==null;){if(a!==0){var O=p.pendingLanes;if(O===0)var v=0;else{var S=p.suspendedLanes,T=p.pingedLanes;v=(1<<31-bs(42|a)+1)-1,v&=O&~(S&~T),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(f=!0,Ok(p,v))}else v=Ie,v=Bf(p,p===lt?v:0,p.cancelPendingCommit!==null||p.timeoutHandle!==-1),(v&3)===0||qh(p,v)||(f=!0,Ok(p,v));p=p.next}while(f);m0=!1}}function N6(){pk()}function pk(){Qd=p0=!1;var a=0;po!==0&&F6()&&(a=po);for(var h=vs(),f=null,p=Pd;p!==null;){var O=p.next,v=mk(p,h);v===0?(p.next=null,f===null?Pd=O:f.next=O,O===null&&(Ll=f)):(f=p,(a!==0||(v&3)!==0)&&(Qd=!0)),p=O}Kt!==0&&Kt!==5||kc(a),po!==0&&(po=0)}function mk(a,h){for(var f=a.suspendedLanes,p=a.pingedLanes,O=a.expirationTimes,v=a.pendingLanes&-62914561;0<v;){var S=31-bs(v),T=1<<S,V=O[S];V===-1?((T&f)===0||(T&p)!==0)&&(O[S]=f4(T,h)):V<=h&&(a.expiredLanes|=T),v&=~T}if(h=lt,f=Ie,f=Bf(a,a===h?f:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p=a.callbackNode,f===0||a===h&&(tt===2||tt===9)||a.cancelPendingCommit!==null)return p!==null&&p!==null&&Tg(p),a.callbackNode=null,a.callbackPriority=0;if((f&3)===0||qh(a,f)){if(h=f&-f,h===a.callbackPriority)return h;switch(p!==null&&Tg(p),Eg(f)){case 2:case 8:f=nx;break;case 32:f=Qf;break;case 268435456:f=ox;break;default:f=Qf}return p=gk.bind(null,a),f=jh(f,p),a.callbackPriority=h,a.callbackNode=f,h}return p!==null&&p!==null&&Tg(p),a.callbackPriority=2,a.callbackNode=null,2}function gk(a,h){if(Kt!==0&&Kt!==5)return a.callbackNode=null,a.callbackPriority=0,null;var f=a.callbackNode;if(Ed()&&a.callbackNode!==f)return null;var p=Ie;return p=Bf(a,a===lt?p:0,a.cancelPendingCommit!==null||a.timeoutHandle!==-1),p===0?null:(GC(a,p,h),mk(a,vs()),a.callbackNode!=null&&a.callbackNode===f?gk.bind(null,a):null)}function Ok(a,h){if(Ed())return null;GC(a,h,!0)}function X6(){K6(function(){(Ge&6)!==0?jh(rx,N6):pk()})}function g0(){if(po===0){var a=vl;a===0&&(a=Rf,Rf<<=1,(Rf&261888)===0&&(Rf=256)),po=a}return po}function _k(a){return a==null||typeof a=="symbol"||typeof a=="boolean"?null:typeof a=="function"?a:Xf(""+a)}function vk(a,h){var f=h.ownerDocument.createElement("input");return f.name=h.name,f.value=h.value,a.id&&f.setAttribute("form",a.id),h.parentNode.insertBefore(f,h),a=new FormData(a),f.parentNode.removeChild(f),a}function V6(a,h,f,p,O){if(h==="submit"&&f&&f.stateNode===O){var v=_k((O[rs]||null).action),S=p.submitter;S&&(h=(h=S[rs]||null)?_k(h.formAction):S.getAttribute("formAction"),h!==null&&(v=h,S=null));var T=new If("action","action",null,p,O);a.push({event:T,listeners:[{instance:null,listener:function(){if(p.defaultPrevented){if(po!==0){var V=S?vk(O,S):new FormData(O);BO(f,{pending:!0,data:V,method:O.method,action:v},null,V)}}else typeof v=="function"&&(T.preventDefault(),V=S?vk(O,S):new FormData(O),BO(f,{pending:!0,data:V,method:O.method,action:v},v,V))},currentTarget:O}]})}}for(var O0=0;O0<Jg.length;O0++){var _0=Jg[O0],Z6=_0.toLowerCase(),j6=_0[0].toUpperCase()+_0.slice(1);fr(Z6,"on"+j6)}fr(Fx,"onAnimationEnd"),fr(Gx,"onAnimationIteration"),fr(Kx,"onAnimationStart"),fr("dblclick","onDoubleClick"),fr("focusin","onFocus"),fr("focusout","onBlur"),fr(n6,"onTransitionRun"),fr(o6,"onTransitionStart"),fr(a6,"onTransitionCancel"),fr(Jx,"onTransitionEnd"),nl("onMouseEnter",["mouseout","mouseover"]),nl("onMouseLeave",["mouseout","mouseover"]),nl("onPointerEnter",["pointerout","pointerover"]),nl("onPointerLeave",["pointerout","pointerover"]),ea("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ea("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ea("onBeforeInput",["compositionend","keypress","textInput","paste"]),ea("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ea("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ea("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Tc="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(" "),I6=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Tc));function yk(a,h){h=(h&4)!==0;for(var f=0;f<a.length;f++){var p=a[f],O=p.event;p=p.listeners;e:{var v=void 0;if(h)for(var S=p.length-1;0<=S;S--){var T=p[S],V=T.instance,J=T.currentTarget;if(T=T.listener,V!==v&&O.isPropagationStopped())break e;v=T,O.currentTarget=J;try{v(O)}catch(re){Uf(re)}O.currentTarget=null,v=V}else for(S=0;S<p.length;S++){if(T=p[S],V=T.instance,J=T.currentTarget,T=T.listener,V!==v&&O.isPropagationStopped())break e;v=T,O.currentTarget=J;try{v(O)}catch(re){Uf(re)}O.currentTarget=null,v=V}}}}function Ze(a,h){var f=h[Pg];f===void 0&&(f=h[Pg]=new Set);var p=a+"__bubble";f.has(p)||(bk(h,a,2,!1),f.add(p))}function v0(a,h,f){var p=0;h&&(p|=4),bk(f,a,p,h)}var Rd="_reactListening"+Math.random().toString(36).slice(2);function y0(a){if(!a[Rd]){a[Rd]=!0,px.forEach(function(f){f!=="selectionchange"&&(I6.has(f)||v0(f,!1,a),v0(f,!0,a))});var h=a.nodeType===9?a:a.ownerDocument;h===null||h[Rd]||(h[Rd]=!0,v0("selectionchange",!1,h))}}function bk(a,h,f,p){switch(Fk(h)){case 2:var O=_z;break;case 8:O=vz;break;default:O=$0}f=O.bind(null,h,f,a),O=void 0,!Xg||h!=="touchstart"&&h!=="touchmove"&&h!=="wheel"||(O=!0),p?O!==void 0?a.addEventListener(h,f,{capture:!0,passive:O}):a.addEventListener(h,f,!0):O!==void 0?a.addEventListener(h,f,{passive:O}):a.addEventListener(h,f,!1)}function b0(a,h,f,p,O){var v=p;if((h&1)===0&&(h&2)===0&&p!==null)e:for(;;){if(p===null)return;var S=p.tag;if(S===3||S===4){var T=p.stateNode.containerInfo;if(T===O)break;if(S===4)for(S=p.return;S!==null;){var V=S.tag;if((V===3||V===4)&&S.stateNode.containerInfo===O)return;S=S.return}for(;T!==null;){if(S=il(T),S===null)return;if(V=S.tag,V===5||V===6||V===26||V===27){p=v=S;continue e}T=T.parentNode}}p=p.return}kx(function(){var J=v,re=zg(f),ae=[];e:{var ee=ew.get(a);if(ee!==void 0){var te=If,be=a;switch(a){case"keypress":if(Zf(f)===0)break e;case"keydown":case"keyup":te=D4;break;case"focusin":be="focus",te=Ig;break;case"focusout":be="blur",te=Ig;break;case"beforeblur":case"afterblur":te=Ig;break;case"click":if(f.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":te=Mx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":te=C4;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":te=X4;break;case Fx:case Gx:case Kx:te=A4;break;case Jx:te=Z4;break;case"scroll":case"scrollend":te=x4;break;case"wheel":te=I4;break;case"copy":case"cut":case"paste":te=E4;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":te=Px;break;case"toggle":case"beforetoggle":te=W4}var Ee=(h&4)!==0,nt=!Ee&&(a==="scroll"||a==="scrollend"),H=Ee?ee!==null?ee+"Capture":null:ee;Ee=[];for(var j=J,K;j!==null;){var oe=j;if(K=oe.stateNode,oe=oe.tag,oe!==5&&oe!==26&&oe!==27||K===null||H===null||(oe=Hh(j,H),oe!=null&&Ee.push(Ac(j,oe,K))),nt)break;j=j.return}0<Ee.length&&(ee=new te(ee,be,null,f,re),ae.push({event:ee,listeners:Ee}))}}if((h&7)===0){e:{if(ee=a==="mouseover"||a==="pointerover",te=a==="mouseout"||a==="pointerout",ee&&f!==Dg&&(be=f.relatedTarget||f.fromElement)&&(il(be)||be[tl]))break e;if((te||ee)&&(ee=re.window===re?re:(ee=re.ownerDocument)?ee.defaultView||ee.parentWindow:window,te?(be=f.relatedTarget||f.toElement,te=J,be=be?il(be):null,be!==null&&(nt=n(be),Ee=be.tag,be!==nt||Ee!==5&&Ee!==27&&Ee!==6)&&(be=null)):(te=null,be=J),te!==be)){if(Ee=Mx,oe="onMouseLeave",H="onMouseEnter",j="mouse",(a==="pointerout"||a==="pointerover")&&(Ee=Px,oe="onPointerLeave",H="onPointerEnter",j="pointer"),nt=te==null?ee:Yh(te),K=be==null?ee:Yh(be),ee=new Ee(oe,j+"leave",te,f,re),ee.target=nt,ee.relatedTarget=K,oe=null,il(re)===J&&(Ee=new Ee(H,j+"enter",be,f,re),Ee.target=K,Ee.relatedTarget=nt,oe=Ee),nt=oe,te&&be)t:{for(Ee=q6,H=te,j=be,K=0,oe=H;oe;oe=Ee(oe))K++;oe=0;for(var Me=j;Me;Me=Ee(Me))oe++;for(;0<K-oe;)H=Ee(H),K--;for(;0<oe-K;)j=Ee(j),oe--;for(;K--;){if(H===j||j!==null&&H===j.alternate){Ee=H;break t}H=Ee(H),j=Ee(j)}Ee=null}else Ee=null;te!==null&&Sk(ae,ee,te,Ee,!1),be!==null&&nt!==null&&Sk(ae,nt,be,Ee,!0)}}e:{if(ee=J?Yh(J):window,te=ee.nodeName&&ee.nodeName.toLowerCase(),te==="select"||te==="input"&&ee.type==="file")var He=Nx;else if(Dx(ee))if(Xx)He=i6;else{He=e6;var Ce=J4}else te=ee.nodeName,!te||te.toLowerCase()!=="input"||ee.type!=="checkbox"&&ee.type!=="radio"?J&&Bg(J.elementType)&&(He=Nx):He=t6;if(He&&(He=He(a,J))){zx(ae,He,f,re);break e}Ce&&Ce(a,ee,J),a==="focusout"&&J&&ee.type==="number"&&J.memoizedProps.value!=null&&$g(ee,"number",ee.value)}switch(Ce=J?Yh(J):window,a){case"focusin":(Dx(Ce)||Ce.contentEditable==="true")&&(ul=Ce,Fg=J,sc=null);break;case"focusout":sc=Fg=ul=null;break;case"mousedown":Gg=!0;break;case"contextmenu":case"mouseup":case"dragend":Gg=!1,Yx(ae,f,re);break;case"selectionchange":if(r6)break;case"keydown":case"keyup":Yx(ae,f,re)}var De;if(Wg)e:{switch(a){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else cl?$x(a,f)&&(qe="onCompositionEnd"):a==="keydown"&&f.keyCode===229&&(qe="onCompositionStart");qe&&(Qx&&f.locale!=="ko"&&(cl||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&cl&&(De=Tx()):(Gn=re,Vg="value"in Gn?Gn.value:Gn.textContent,cl=!0)),Ce=Ld(J,qe),0<Ce.length&&(qe=new Ex(qe,a,null,f,re),ae.push({event:qe,listeners:Ce}),De?qe.data=De:(De=Bx(f),De!==null&&(qe.data=De)))),(De=Y4?H4(a,f):F4(a,f))&&(qe=Ld(J,"onBeforeInput"),0<qe.length&&(Ce=new Ex("onBeforeInput","beforeinput",null,f,re),ae.push({event:Ce,listeners:qe}),Ce.data=De)),V6(ae,a,J,f,re)}yk(ae,h)})}function Ac(a,h,f){return{instance:a,listener:h,currentTarget:f}}function Ld(a,h){for(var f=h+"Capture",p=[];a!==null;){var O=a,v=O.stateNode;if(O=O.tag,O!==5&&O!==26&&O!==27||v===null||(O=Hh(a,f),O!=null&&p.unshift(Ac(a,O,v)),O=Hh(a,h),O!=null&&p.push(Ac(a,O,v))),a.tag===3)return p;a=a.return}return[]}function q6(a){if(a===null)return null;do a=a.return;while(a&&a.tag!==5&&a.tag!==27);return a||null}function Sk(a,h,f,p,O){for(var v=h._reactName,S=[];f!==null&&f!==p;){var T=f,V=T.alternate,J=T.stateNode;if(T=T.tag,V!==null&&V===p)break;T!==5&&T!==26&&T!==27||J===null||(V=J,O?(J=Hh(f,v),J!=null&&S.unshift(Ac(f,J,V))):O||(J=Hh(f,v),J!=null&&S.push(Ac(f,J,V)))),f=f.return}S.length!==0&&a.push({event:h,listeners:S})}var W6=/\r\n?/g,U6=/\u0000|\uFFFD/g;function xk(a){return(typeof a=="string"?a:""+a).replace(W6,`
|
|
49
|
-
`).replace(U6,"")}function wk(a,h){return h=xk(h),xk(a)===h}function rt(a,h,f,p,O,v){switch(f){case"children":typeof p=="string"?h==="body"||h==="textarea"&&p===""||al(a,p):(typeof p=="number"||typeof p=="bigint")&&h!=="body"&&al(a,""+p);break;case"className":zf(a,"class",p);break;case"tabIndex":zf(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":zf(a,f,p);break;case"style":wx(a,p,v);break;case"data":if(h!=="object"){zf(a,"data",p);break}case"src":case"href":if(p===""&&(h!=="a"||f!=="href")){a.removeAttribute(f);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(f);break}p=Xf(""+p),a.setAttribute(f,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(f==="formAction"?(h!=="input"&&rt(a,h,"name",O.name,O,null),rt(a,h,"formEncType",O.formEncType,O,null),rt(a,h,"formMethod",O.formMethod,O,null),rt(a,h,"formTarget",O.formTarget,O,null)):(rt(a,h,"encType",O.encType,O,null),rt(a,h,"method",O.method,O,null),rt(a,h,"target",O.target,O,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(f);break}p=Xf(""+p),a.setAttribute(f,p);break;case"onClick":p!=null&&(a.onclick=cn);break;case"onScroll":p!=null&&Ze("scroll",a);break;case"onScrollEnd":p!=null&&Ze("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(s(61));if(f=p.__html,f!=null){if(O.children!=null)throw Error(s(60));a.innerHTML=f}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}f=Xf(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,""+p):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":p===!0?a.setAttribute(f,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,p):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(f,p):a.removeAttribute(f);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(f):a.setAttribute(f,p);break;case"popover":Ze("beforetoggle",a),Ze("toggle",a),Df(a,"popover",p);break;case"xlinkActuate":hn(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":hn(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":hn(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":hn(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":hn(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":hn(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":hn(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":hn(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":hn(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Df(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=b4.get(f)||f,Df(a,f,p))}}function S0(a,h,f,p,O,v){switch(f){case"style":wx(a,p,v);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(s(61));if(f=p.__html,f!=null){if(O.children!=null)throw Error(s(60));a.innerHTML=f}}break;case"children":typeof p=="string"?al(a,p):(typeof p=="number"||typeof p=="bigint")&&al(a,""+p);break;case"onScroll":p!=null&&Ze("scroll",a);break;case"onScrollEnd":p!=null&&Ze("scrollend",a);break;case"onClick":p!=null&&(a.onclick=cn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mx.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(O=f.endsWith("Capture"),h=f.slice(2,O?f.length-7:void 0),v=a[rs]||null,v=v!=null?v[f]:null,typeof v=="function"&&a.removeEventListener(h,v,O),typeof p=="function")){typeof v!="function"&&v!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(h,p,O);break e}f in a?a[f]=p:p===!0?a.setAttribute(f,""):Df(a,f,p)}}}function Ai(a,h,f){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",a),Ze("load",a);var p=!1,O=!1,v;for(v in f)if(f.hasOwnProperty(v)){var S=f[v];if(S!=null)switch(v){case"src":p=!0;break;case"srcSet":O=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,h));default:rt(a,h,v,S,f,null)}}O&&rt(a,h,"srcSet",f.srcSet,f,null),p&&rt(a,h,"src",f.src,f,null);return;case"input":Ze("invalid",a);var T=v=S=O=null,V=null,J=null;for(p in f)if(f.hasOwnProperty(p)){var re=f[p];if(re!=null)switch(p){case"name":O=re;break;case"type":S=re;break;case"checked":V=re;break;case"defaultChecked":J=re;break;case"value":v=re;break;case"defaultValue":T=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(s(137,h));break;default:rt(a,h,p,re,f,null)}}yx(a,v,T,V,J,S,O,!1);return;case"select":Ze("invalid",a),p=S=v=null;for(O in f)if(f.hasOwnProperty(O)&&(T=f[O],T!=null))switch(O){case"value":v=T;break;case"defaultValue":S=T;break;case"multiple":p=T;default:rt(a,h,O,T,f,null)}h=v,f=S,a.multiple=!!p,h!=null?ol(a,!!p,h,!1):f!=null&&ol(a,!!p,f,!0);return;case"textarea":Ze("invalid",a),v=O=p=null;for(S in f)if(f.hasOwnProperty(S)&&(T=f[S],T!=null))switch(S){case"value":p=T;break;case"defaultValue":O=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(s(91));break;default:rt(a,h,S,T,f,null)}Sx(a,p,O,v);return;case"option":for(V in f)if(f.hasOwnProperty(V)&&(p=f[V],p!=null))switch(V){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:rt(a,h,V,p,f,null)}return;case"dialog":Ze("beforetoggle",a),Ze("toggle",a),Ze("cancel",a),Ze("close",a);break;case"iframe":case"object":Ze("load",a);break;case"video":case"audio":for(p=0;p<Tc.length;p++)Ze(Tc[p],a);break;case"image":Ze("error",a),Ze("load",a);break;case"details":Ze("toggle",a);break;case"embed":case"source":case"link":Ze("error",a),Ze("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in f)if(f.hasOwnProperty(J)&&(p=f[J],p!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,h));default:rt(a,h,J,p,f,null)}return;default:if(Bg(h)){for(re in f)f.hasOwnProperty(re)&&(p=f[re],p!==void 0&&S0(a,h,re,p,f,void 0));return}}for(T in f)f.hasOwnProperty(T)&&(p=f[T],p!=null&&rt(a,h,T,p,f,null))}function Y6(a,h,f,p){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var O=null,v=null,S=null,T=null,V=null,J=null,re=null;for(te in f){var ae=f[te];if(f.hasOwnProperty(te)&&ae!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":V=ae;default:p.hasOwnProperty(te)||rt(a,h,te,null,p,ae)}}for(var ee in p){var te=p[ee];if(ae=f[ee],p.hasOwnProperty(ee)&&(te!=null||ae!=null))switch(ee){case"type":v=te;break;case"name":O=te;break;case"checked":J=te;break;case"defaultChecked":re=te;break;case"value":S=te;break;case"defaultValue":T=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,h));break;default:te!==ae&&rt(a,h,ee,te,p,ae)}}Lg(a,S,T,V,J,re,v,O);return;case"select":te=S=T=ee=null;for(v in f)if(V=f[v],f.hasOwnProperty(v)&&V!=null)switch(v){case"value":break;case"multiple":te=V;default:p.hasOwnProperty(v)||rt(a,h,v,null,p,V)}for(O in p)if(v=p[O],V=f[O],p.hasOwnProperty(O)&&(v!=null||V!=null))switch(O){case"value":ee=v;break;case"defaultValue":T=v;break;case"multiple":S=v;default:v!==V&&rt(a,h,O,v,p,V)}h=T,f=S,p=te,ee!=null?ol(a,!!f,ee,!1):!!p!=!!f&&(h!=null?ol(a,!!f,h,!0):ol(a,!!f,f?[]:"",!1));return;case"textarea":te=ee=null;for(T in f)if(O=f[T],f.hasOwnProperty(T)&&O!=null&&!p.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:rt(a,h,T,null,p,O)}for(S in p)if(O=p[S],v=f[S],p.hasOwnProperty(S)&&(O!=null||v!=null))switch(S){case"value":ee=O;break;case"defaultValue":te=O;break;case"children":break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(s(91));break;default:O!==v&&rt(a,h,S,O,p,v)}bx(a,ee,te);return;case"option":for(var be in f)if(ee=f[be],f.hasOwnProperty(be)&&ee!=null&&!p.hasOwnProperty(be))switch(be){case"selected":a.selected=!1;break;default:rt(a,h,be,null,p,ee)}for(V in p)if(ee=p[V],te=f[V],p.hasOwnProperty(V)&&ee!==te&&(ee!=null||te!=null))switch(V){case"selected":a.selected=ee&&typeof ee!="function"&&typeof ee!="symbol";break;default:rt(a,h,V,ee,p,te)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in f)ee=f[Ee],f.hasOwnProperty(Ee)&&ee!=null&&!p.hasOwnProperty(Ee)&&rt(a,h,Ee,null,p,ee);for(J in p)if(ee=p[J],te=f[J],p.hasOwnProperty(J)&&ee!==te&&(ee!=null||te!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,h));break;default:rt(a,h,J,ee,p,te)}return;default:if(Bg(h)){for(var nt in f)ee=f[nt],f.hasOwnProperty(nt)&&ee!==void 0&&!p.hasOwnProperty(nt)&&S0(a,h,nt,void 0,p,ee);for(re in p)ee=p[re],te=f[re],!p.hasOwnProperty(re)||ee===te||ee===void 0&&te===void 0||S0(a,h,re,ee,p,te);return}}for(var H in f)ee=f[H],f.hasOwnProperty(H)&&ee!=null&&!p.hasOwnProperty(H)&&rt(a,h,H,null,p,ee);for(ae in p)ee=p[ae],te=f[ae],!p.hasOwnProperty(ae)||ee===te||ee==null&&te==null||rt(a,h,ae,ee,p,te)}function Ck(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function H6(){if(typeof performance.getEntriesByType=="function"){for(var a=0,h=0,f=performance.getEntriesByType("resource"),p=0;p<f.length;p++){var O=f[p],v=O.transferSize,S=O.initiatorType,T=O.duration;if(v&&T&&Ck(S)){for(S=0,T=O.responseEnd,p+=1;p<f.length;p++){var V=f[p],J=V.startTime;if(J>T)break;var re=V.transferSize,ae=V.initiatorType;re&&Ck(ae)&&(V=V.responseEnd,S+=re*(V<T?1:(T-J)/(V-J)))}if(--p,h+=8*(v+S)/(O.duration/1e3),a++,10<a)break}}if(0<a)return h/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var x0=null,w0=null;function $d(a){return a.nodeType===9?a:a.ownerDocument}function kk(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tk(a,h){if(a===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&h==="foreignObject"?0:a}function C0(a,h){return a==="textarea"||a==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var k0=null;function F6(){var a=window.event;return a&&a.type==="popstate"?a===k0?!1:(k0=a,!0):(k0=null,!1)}var Ak=typeof setTimeout=="function"?setTimeout:void 0,G6=typeof clearTimeout=="function"?clearTimeout:void 0,Mk=typeof Promise=="function"?Promise:void 0,K6=typeof queueMicrotask=="function"?queueMicrotask:typeof Mk<"u"?function(a){return Mk.resolve(null).then(a).catch(J6)}:Ak;function J6(a){setTimeout(function(){throw a})}function mo(a){return a==="head"}function Ek(a,h){var f=h,p=0;do{var O=f.nextSibling;if(a.removeChild(f),O&&O.nodeType===8)if(f=O.data,f==="/$"||f==="/&"){if(p===0){a.removeChild(O),zl(h);return}p--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")p++;else if(f==="html")Mc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,Mc(f);for(var v=f.firstChild;v;){var S=v.nextSibling,T=v.nodeName;v[Uh]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||f.removeChild(v),v=S}}else f==="body"&&Mc(a.ownerDocument.body);f=O}while(f);zl(h)}function Pk(a,h){var f=a;a=0;do{var p=f.nextSibling;if(f.nodeType===1?h?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(h?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),p&&p.nodeType===8)if(f=p.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=p}while(f)}function T0(a){var h=a.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var f=h;switch(h=h.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":T0(f),Qg(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function ez(a,h,f,p){for(;a.nodeType===1;){var O=f;if(a.nodeName.toLowerCase()!==h.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Uh])switch(h){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(v=a.getAttribute("rel"),v==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(v!==O.rel||a.getAttribute("href")!==(O.href==null||O.href===""?null:O.href)||a.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin)||a.getAttribute("title")!==(O.title==null?null:O.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(v=a.getAttribute("src"),(v!==(O.src==null?null:O.src)||a.getAttribute("type")!==(O.type==null?null:O.type)||a.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin))&&v&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(h==="input"&&a.type==="hidden"){var v=O.name==null?null:""+O.name;if(O.type==="hidden"&&a.getAttribute("name")===v)return a}else return a;if(a=Us(a.nextSibling),a===null)break}return null}function tz(a,h,f){if(h==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=Us(a.nextSibling),a===null))return null;return a}function Qk(a,h){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!h||(a=Us(a.nextSibling),a===null))return null;return a}function A0(a){return a.data==="$?"||a.data==="$~"}function M0(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function iz(a,h){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=h;else if(a.data!=="$?"||f.readyState!=="loading")h();else{var p=function(){h(),f.removeEventListener("DOMContentLoaded",p)};f.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Us(a){for(;a!=null;a=a.nextSibling){var h=a.nodeType;if(h===1||h===3)break;if(h===8){if(h=a.data,h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"||h==="F!"||h==="F")break;if(h==="/$"||h==="/&")return null}}return a}var E0=null;function Rk(a){a=a.nextSibling;for(var h=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(h===0)return Us(a.nextSibling);h--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||h++}a=a.nextSibling}return null}function Lk(a){a=a.previousSibling;for(var h=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(h===0)return a;h--}else f!=="/$"&&f!=="/&"||h++}a=a.previousSibling}return null}function $k(a,h,f){switch(h=$d(f),a){case"html":if(a=h.documentElement,!a)throw Error(s(452));return a;case"head":if(a=h.head,!a)throw Error(s(453));return a;case"body":if(a=h.body,!a)throw Error(s(454));return a;default:throw Error(s(451))}}function Mc(a){for(var h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Qg(a)}var Ys=new Map,Bk=new Set;function Bd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var kn=X.d;X.d={f:sz,r:rz,D:nz,C:oz,L:az,m:lz,X:cz,S:hz,M:uz};function sz(){var a=kn.f(),h=Td();return a||h}function rz(a){var h=sl(a);h!==null&&h.tag===5&&h.type==="form"?Jw(h):kn.r(a)}var $l=typeof document>"u"?null:document;function Dk(a,h,f){var p=$l;if(p&&typeof h=="string"&&h){var O=Xs(h);O='link[rel="'+a+'"][href="'+O+'"]',typeof f=="string"&&(O+='[crossorigin="'+f+'"]'),Bk.has(O)||(Bk.add(O),a={rel:a,crossOrigin:f,href:h},p.querySelector(O)===null&&(h=p.createElement("link"),Ai(h,"link",a),ai(h),p.head.appendChild(h)))}}function nz(a){kn.D(a),Dk("dns-prefetch",a,null)}function oz(a,h){kn.C(a,h),Dk("preconnect",a,h)}function az(a,h,f){kn.L(a,h,f);var p=$l;if(p&&a&&h){var O='link[rel="preload"][as="'+Xs(h)+'"]';h==="image"&&f&&f.imageSrcSet?(O+='[imagesrcset="'+Xs(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(O+='[imagesizes="'+Xs(f.imageSizes)+'"]')):O+='[href="'+Xs(a)+'"]';var v=O;switch(h){case"style":v=Bl(a);break;case"script":v=Dl(a)}Ys.has(v)||(a=m({rel:"preload",href:h==="image"&&f&&f.imageSrcSet?void 0:a,as:h},f),Ys.set(v,a),p.querySelector(O)!==null||h==="style"&&p.querySelector(Ec(v))||h==="script"&&p.querySelector(Pc(v))||(h=p.createElement("link"),Ai(h,"link",a),ai(h),p.head.appendChild(h)))}}function lz(a,h){kn.m(a,h);var f=$l;if(f&&a){var p=h&&typeof h.as=="string"?h.as:"script",O='link[rel="modulepreload"][as="'+Xs(p)+'"][href="'+Xs(a)+'"]',v=O;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Dl(a)}if(!Ys.has(v)&&(a=m({rel:"modulepreload",href:a},h),Ys.set(v,a),f.querySelector(O)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Pc(v)))return}p=f.createElement("link"),Ai(p,"link",a),ai(p),f.head.appendChild(p)}}}function hz(a,h,f){kn.S(a,h,f);var p=$l;if(p&&a){var O=rl(p).hoistableStyles,v=Bl(a);h=h||"default";var S=O.get(v);if(!S){var T={loading:0,preload:null};if(S=p.querySelector(Ec(v)))T.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":h},f),(f=Ys.get(v))&&P0(a,f);var V=S=p.createElement("link");ai(V),Ai(V,"link",a),V._p=new Promise(function(J,re){V.onload=J,V.onerror=re}),V.addEventListener("load",function(){T.loading|=1}),V.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Dd(S,h,p)}S={type:"stylesheet",instance:S,count:1,state:T},O.set(v,S)}}}function cz(a,h){kn.X(a,h);var f=$l;if(f&&a){var p=rl(f).hoistableScripts,O=Dl(a),v=p.get(O);v||(v=f.querySelector(Pc(O)),v||(a=m({src:a,async:!0},h),(h=Ys.get(O))&&Q0(a,h),v=f.createElement("script"),ai(v),Ai(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},p.set(O,v))}}function uz(a,h){kn.M(a,h);var f=$l;if(f&&a){var p=rl(f).hoistableScripts,O=Dl(a),v=p.get(O);v||(v=f.querySelector(Pc(O)),v||(a=m({src:a,async:!0,type:"module"},h),(h=Ys.get(O))&&Q0(a,h),v=f.createElement("script"),ai(v),Ai(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},p.set(O,v))}}function zk(a,h,f,p){var O=(O=de.current)?Bd(O):null;if(!O)throw Error(s(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(h=Bl(f.href),f=rl(O).hoistableStyles,p=f.get(h),p||(p={type:"style",instance:null,count:0,state:null},f.set(h,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Bl(f.href);var v=rl(O).hoistableStyles,S=v.get(a);if(S||(O=O.ownerDocument||O,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(a,S),(v=O.querySelector(Ec(a)))&&!v._p&&(S.instance=v,S.state.loading=5),Ys.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Ys.set(a,f),v||fz(O,a,f,S.state))),h&&p===null)throw Error(s(528,""));return S}if(h&&p!==null)throw Error(s(529,""));return null;case"script":return h=f.async,f=f.src,typeof f=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=Dl(f),f=rl(O).hoistableScripts,p=f.get(h),p||(p={type:"script",instance:null,count:0,state:null},f.set(h,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,a))}}function Bl(a){return'href="'+Xs(a)+'"'}function Ec(a){return'link[rel="stylesheet"]['+a+"]"}function Nk(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function fz(a,h,f,p){a.querySelector('link[rel="preload"][as="style"]['+h+"]")?p.loading=1:(h=a.createElement("link"),p.preload=h,h.addEventListener("load",function(){return p.loading|=1}),h.addEventListener("error",function(){return p.loading|=2}),Ai(h,"link",f),ai(h),a.head.appendChild(h))}function Dl(a){return'[src="'+Xs(a)+'"]'}function Pc(a){return"script[async]"+a}function Xk(a,h,f){if(h.count++,h.instance===null)switch(h.type){case"style":var p=a.querySelector('style[data-href~="'+Xs(f.href)+'"]');if(p)return h.instance=p,ai(p),p;var O=m({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),ai(p),Ai(p,"style",O),Dd(p,f.precedence,a),h.instance=p;case"stylesheet":O=Bl(f.href);var v=a.querySelector(Ec(O));if(v)return h.state.loading|=4,h.instance=v,ai(v),v;p=Nk(f),(O=Ys.get(O))&&P0(p,O),v=(a.ownerDocument||a).createElement("link"),ai(v);var S=v;return S._p=new Promise(function(T,V){S.onload=T,S.onerror=V}),Ai(v,"link",p),h.state.loading|=4,Dd(v,f.precedence,a),h.instance=v;case"script":return v=Dl(f.src),(O=a.querySelector(Pc(v)))?(h.instance=O,ai(O),O):(p=f,(O=Ys.get(v))&&(p=m({},f),Q0(p,O)),a=a.ownerDocument||a,O=a.createElement("script"),ai(O),Ai(O,"link",p),a.head.appendChild(O),h.instance=O);case"void":return null;default:throw Error(s(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(p=h.instance,h.state.loading|=4,Dd(p,f.precedence,a));return h.instance}function Dd(a,h,f){for(var p=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=p.length?p[p.length-1]:null,v=O,S=0;S<p.length;S++){var T=p[S];if(T.dataset.precedence===h)v=T;else if(v!==O)break}v?v.parentNode.insertBefore(a,v.nextSibling):(h=f.nodeType===9?f.head:f,h.insertBefore(a,h.firstChild))}function P0(a,h){a.crossOrigin==null&&(a.crossOrigin=h.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=h.referrerPolicy),a.title==null&&(a.title=h.title)}function Q0(a,h){a.crossOrigin==null&&(a.crossOrigin=h.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=h.referrerPolicy),a.integrity==null&&(a.integrity=h.integrity)}var zd=null;function Vk(a,h,f){if(zd===null){var p=new Map,O=zd=new Map;O.set(f,p)}else O=zd,p=O.get(f),p||(p=new Map,O.set(f,p));if(p.has(a))return p;for(p.set(a,null),f=f.getElementsByTagName(a),O=0;O<f.length;O++){var v=f[O];if(!(v[Uh]||v[wi]||a==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(h)||"";S=a+S;var T=p.get(S);T?T.push(v):p.set(S,[v])}}return p}function Zk(a,h,f){a=a.ownerDocument||a,a.head.insertBefore(f,h==="title"?a.querySelector("head > title"):null)}function dz(a,h,f){if(f===1||h.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return a=h.disabled,typeof h.precedence=="string"&&a==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function jk(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function pz(a,h,f,p){if(f.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var O=Bl(p.href),v=h.querySelector(Ec(O));if(v){h=v._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(a.count++,a=Nd.bind(a),h.then(a,a)),f.state.loading|=4,f.instance=v,ai(v);return}v=h.ownerDocument||h,p=Nk(p),(O=Ys.get(O))&&P0(p,O),v=v.createElement("link"),ai(v);var S=v;S._p=new Promise(function(T,V){S.onload=T,S.onerror=V}),Ai(v,"link",p),f.instance=v}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,h),(h=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=Nd.bind(a),h.addEventListener("load",f),h.addEventListener("error",f))}}var R0=0;function mz(a,h){return a.stylesheets&&a.count===0&&Vd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var p=setTimeout(function(){if(a.stylesheets&&Vd(a,a.stylesheets),a.unsuspend){var v=a.unsuspend;a.unsuspend=null,v()}},6e4+h);0<a.imgBytes&&R0===0&&(R0=62500*H6());var O=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Vd(a,a.stylesheets),a.unsuspend)){var v=a.unsuspend;a.unsuspend=null,v()}},(a.imgBytes>R0?50:800)+h);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(O)}}:null}function Nd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Xd=null;function Vd(a,h){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Xd=new Map,h.forEach(gz,a),Xd=null,Nd.call(a))}function gz(a,h){if(!(h.state.loading&4)){var f=Xd.get(a);if(f)var p=f.get(null);else{f=new Map,Xd.set(a,f);for(var O=a.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<O.length;v++){var S=O[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(f.set(S.dataset.precedence,S),p=S)}p&&f.set(null,p)}O=h.instance,S=O.getAttribute("data-precedence"),v=f.get(S)||p,v===p&&f.set(null,O),f.set(S,O),this.count++,p=Nd.bind(this),O.addEventListener("load",p),O.addEventListener("error",p),v?v.parentNode.insertBefore(O,v.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(O,a.firstChild)),h.state.loading|=4}}var Qc={$$typeof:C,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Oz(a,h,f,p,O,v,S,T,V){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ag(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ag(0),this.hiddenUpdates=Ag(null),this.identifierPrefix=p,this.onUncaughtError=O,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Ik(a,h,f,p,O,v,S,T,V,J,re,ae){return a=new Oz(a,h,f,S,V,J,re,ae,T),h=1,v===!0&&(h|=24),v=xs(3,null,null,h),a.current=v,v.stateNode=a,h=fO(),h.refCount++,a.pooledCache=h,h.refCount++,v.memoizedState={element:p,isDehydrated:f,cache:h},gO(v),a}function qk(a){return a?(a=pl,a):pl}function Wk(a,h,f,p,O,v){O=qk(O),p.context===null?p.context=O:p.pendingContext=O,p=so(h),p.payload={element:f},v=v===void 0?null:v,v!==null&&(p.callback=v),f=ro(a,p,h),f!==null&&(cs(f,a,h),cc(f,a,h))}function Uk(a,h){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<h?f:h}}function L0(a,h){Uk(a,h),(a=a.alternate)&&Uk(a,h)}function Yk(a){if(a.tag===13||a.tag===31){var h=ra(a,67108864);h!==null&&cs(h,a,67108864),L0(a,67108864)}}function Hk(a){if(a.tag===13||a.tag===31){var h=As();h=Mg(h);var f=ra(a,h);f!==null&&cs(f,a,h),L0(a,h)}}var Zd=!0;function _z(a,h,f,p){var O=Q.T;Q.T=null;var v=X.p;try{X.p=2,$0(a,h,f,p)}finally{X.p=v,Q.T=O}}function vz(a,h,f,p){var O=Q.T;Q.T=null;var v=X.p;try{X.p=8,$0(a,h,f,p)}finally{X.p=v,Q.T=O}}function $0(a,h,f,p){if(Zd){var O=B0(p);if(O===null)b0(a,h,p,jd,f),Gk(a,p);else if(bz(O,a,h,f,p))p.stopPropagation();else if(Gk(a,p),h&4&&-1<yz.indexOf(a)){for(;O!==null;){var v=sl(O);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Jo(v.pendingLanes);if(S!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var V=1<<31-bs(S);T.entanglements[1]|=V,S&=~V}Qr(v),(Ge&6)===0&&(Cd=vs()+500,kc(0))}}break;case 31:case 13:T=ra(v,2),T!==null&&cs(T,v,2),Td(),L0(v,2)}if(v=B0(p),v===null&&b0(a,h,p,jd,f),v===O)break;O=v}O!==null&&p.stopPropagation()}else b0(a,h,p,null,f)}}function B0(a){return a=zg(a),D0(a)}var jd=null;function D0(a){if(jd=null,a=il(a),a!==null){var h=n(a);if(h===null)a=null;else{var f=h.tag;if(f===13){if(a=o(h),a!==null)return a;a=null}else if(f===31){if(a=l(h),a!==null)return a;a=null}else if(f===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;a=null}else h!==a&&(a=null)}}return jd=a,null}function Fk(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(n4()){case rx:return 2;case nx:return 8;case Qf:case o4:return 32;case ox:return 268435456;default:return 32}default:return 32}}var z0=!1,go=null,Oo=null,_o=null,Rc=new Map,Lc=new Map,vo=[],yz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Gk(a,h){switch(a){case"focusin":case"focusout":go=null;break;case"dragenter":case"dragleave":Oo=null;break;case"mouseover":case"mouseout":_o=null;break;case"pointerover":case"pointerout":Rc.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lc.delete(h.pointerId)}}function $c(a,h,f,p,O,v){return a===null||a.nativeEvent!==v?(a={blockedOn:h,domEventName:f,eventSystemFlags:p,nativeEvent:v,targetContainers:[O]},h!==null&&(h=sl(h),h!==null&&Yk(h)),a):(a.eventSystemFlags|=p,h=a.targetContainers,O!==null&&h.indexOf(O)===-1&&h.push(O),a)}function bz(a,h,f,p,O){switch(h){case"focusin":return go=$c(go,a,h,f,p,O),!0;case"dragenter":return Oo=$c(Oo,a,h,f,p,O),!0;case"mouseover":return _o=$c(_o,a,h,f,p,O),!0;case"pointerover":var v=O.pointerId;return Rc.set(v,$c(Rc.get(v)||null,a,h,f,p,O)),!0;case"gotpointercapture":return v=O.pointerId,Lc.set(v,$c(Lc.get(v)||null,a,h,f,p,O)),!0}return!1}function Kk(a){var h=il(a.target);if(h!==null){var f=n(h);if(f!==null){if(h=f.tag,h===13){if(h=o(f),h!==null){a.blockedOn=h,fx(a.priority,function(){Hk(f)});return}}else if(h===31){if(h=l(f),h!==null){a.blockedOn=h,fx(a.priority,function(){Hk(f)});return}}else if(h===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Id(a){if(a.blockedOn!==null)return!1;for(var h=a.targetContainers;0<h.length;){var f=B0(a.nativeEvent);if(f===null){f=a.nativeEvent;var p=new f.constructor(f.type,f);Dg=p,f.target.dispatchEvent(p),Dg=null}else return h=sl(f),h!==null&&Yk(h),a.blockedOn=f,!1;h.shift()}return!0}function Jk(a,h,f){Id(a)&&f.delete(h)}function Sz(){z0=!1,go!==null&&Id(go)&&(go=null),Oo!==null&&Id(Oo)&&(Oo=null),_o!==null&&Id(_o)&&(_o=null),Rc.forEach(Jk),Lc.forEach(Jk)}function qd(a,h){a.blockedOn===h&&(a.blockedOn=null,z0||(z0=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Sz)))}var Wd=null;function e2(a){Wd!==a&&(Wd=a,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Wd===a&&(Wd=null);for(var h=0;h<a.length;h+=3){var f=a[h],p=a[h+1],O=a[h+2];if(typeof p!="function"){if(D0(p||f)===null)continue;break}var v=sl(f);v!==null&&(a.splice(h,3),h-=3,BO(v,{pending:!0,data:O,method:f.method,action:p},p,O))}}))}function zl(a){function h(V){return qd(V,a)}go!==null&&qd(go,a),Oo!==null&&qd(Oo,a),_o!==null&&qd(_o,a),Rc.forEach(h),Lc.forEach(h);for(var f=0;f<vo.length;f++){var p=vo[f];p.blockedOn===a&&(p.blockedOn=null)}for(;0<vo.length&&(f=vo[0],f.blockedOn===null);)Kk(f),f.blockedOn===null&&vo.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(p=0;p<f.length;p+=3){var O=f[p],v=f[p+1],S=O[rs]||null;if(typeof v=="function")S||e2(f);else if(S){var T=null;if(v&&v.hasAttribute("formAction")){if(O=v,S=v[rs]||null)T=S.formAction;else if(D0(O)!==null)continue}else T=S.action;typeof T=="function"?f[p+1]=T:(f.splice(p,3),p-=3),e2(f)}}}function t2(){function a(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return O=S})},focusReset:"manual",scroll:"manual"})}function h(){O!==null&&(O(),O=null),p||setTimeout(f,20)}function f(){if(!p&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,O=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(f,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),O!==null&&(O(),O=null)}}}function N0(a){this._internalRoot=a}Ud.prototype.render=N0.prototype.render=function(a){var h=this._internalRoot;if(h===null)throw Error(s(409));var f=h.current,p=As();Wk(f,p,a,h,null,null)},Ud.prototype.unmount=N0.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var h=a.containerInfo;Wk(a.current,2,null,a,null,null),Td(),h[tl]=null}};function Ud(a){this._internalRoot=a}Ud.prototype.unstable_scheduleHydration=function(a){if(a){var h=ux();a={blockedOn:null,target:a,priority:h};for(var f=0;f<vo.length&&h!==0&&h<vo[f].priority;f++);vo.splice(f,0,a),f===0&&Kk(a)}};var i2=e.version;if(i2!=="19.2.4")throw Error(s(527,i2,"19.2.4"));X.findDOMNode=function(a){var h=a._reactInternals;if(h===void 0)throw typeof a.render=="function"?Error(s(188)):(a=Object.keys(a).join(","),Error(s(268,a)));return a=u(h),a=a!==null?d(a):null,a=a===null?null:a.stateNode,a};var xz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yd.isDisabled&&Yd.supportsFiber)try{Ih=Yd.inject(xz),ys=Yd}catch{}}return Dc.createRoot=function(a,h){if(!r(a))throw Error(s(299));var f=!1,p="",O=hC,v=cC,S=uC;return h!=null&&(h.unstable_strictMode===!0&&(f=!0),h.identifierPrefix!==void 0&&(p=h.identifierPrefix),h.onUncaughtError!==void 0&&(O=h.onUncaughtError),h.onCaughtError!==void 0&&(v=h.onCaughtError),h.onRecoverableError!==void 0&&(S=h.onRecoverableError)),h=Ik(a,1,!1,null,null,f,p,null,O,v,S,t2),a[tl]=h.current,y0(a),new N0(h)},Dc.hydrateRoot=function(a,h,f){if(!r(a))throw Error(s(299));var p=!1,O="",v=hC,S=cC,T=uC,V=null;return f!=null&&(f.unstable_strictMode===!0&&(p=!0),f.identifierPrefix!==void 0&&(O=f.identifierPrefix),f.onUncaughtError!==void 0&&(v=f.onUncaughtError),f.onCaughtError!==void 0&&(S=f.onCaughtError),f.onRecoverableError!==void 0&&(T=f.onRecoverableError),f.formState!==void 0&&(V=f.formState)),h=Ik(a,1,!0,h,f??null,p,O,V,v,S,T,t2),h.context=qk(null),f=h.current,p=As(),p=Mg(p),O=so(p),O.callback=null,ro(f,O,p),f=p,h.current.lanes=f,Wh(h,f),Qr(h),a[tl]=h.current,y0(a),new Ud(h)},Dc.version="19.2.4",Dc}var f2;function Lz(){if(f2)return Z0.exports;f2=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Z0.exports=Rz(),Z0.exports}var $z=Lz();const _P=Y.createContext({connected:!1,lastChange:0}),d2=2e3,Bz=3e4,Dz=1.5;function zz({children:i}){const[e,t]=Y.useState(!1),[s,r]=Y.useState(0),n=Y.useRef(null),o=Y.useRef(null),l=Y.useRef(d2);return Y.useEffect(()=>{function c(){const d=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws`,m=new WebSocket(d);n.current=m,m.onopen=()=>{t(!0),l.current=d2},m.onclose=()=>{t(!1),n.current=null;const g=l.current;l.current=Math.min(g*Dz,Bz),o.current=setTimeout(c,g)},m.onmessage=g=>{try{const _=JSON.parse(g.data);_.type==="file-changes"&&typeof _.timestamp=="number"&&r(_.timestamp)}catch{}},m.onerror=()=>{console.warn("[ws-provider] WebSocket error occurred")}}return c(),()=>{o.current!==null&&(clearTimeout(o.current),o.current=null),n.current&&(n.current.onclose=null,n.current.close(),n.current=null)}},[]),M.jsx(_P.Provider,{value:{connected:e,lastChange:s},children:i})}function ff(){return Y.useContext(_P)}function fb(){const{lastChange:i}=ff(),[e,t]=Y.useState(null),[s,r]=Y.useState(null),[n,o]=Y.useState(null),[l,c]=Y.useState(!0),[u,d]=Y.useState(null),m=Y.useCallback(async()=>{try{d(null);const[g,_,y]=await Promise.all([fetch("/api/roadmap"),fetch("/api/state"),fetch("/api/todos")]);if(!g.ok&&g.status!==404)throw new Error(`Roadmap fetch failed: ${g.status}`);if(!_.ok&&_.status!==404)throw new Error(`State fetch failed: ${_.status}`);if(!y.ok)throw new Error(`Todos fetch failed: ${y.status}`);const b=g.ok?await g.json():null,x=_.ok?await _.json():null,w=y.ok?await y.json():{pending:[],completed:[]};t(b),r(x),o(w)}catch(g){const _=g instanceof Error?g.message:"Failed to fetch dashboard data";d(_),console.error("[use-dashboard-data]",_)}finally{c(!1)}},[]);return Y.useEffect(()=>{m()},[m]),Y.useEffect(()=>{i>0&&m()},[i,m]),{roadmap:e,state:s,todos:n,loading:l,error:u}}const vP=Y.createContext({});function Nz(i){const e=Y.useRef(null);return e.current===null&&(e.current=i()),e.current}const yP=typeof window<"u",Xz=yP?Y.useLayoutEffect:Y.useEffect,db=Y.createContext(null);function pb(i,e){i.indexOf(e)===-1&&i.push(e)}function cm(i,e){const t=i.indexOf(e);t>-1&&i.splice(t,1)}const tn=(i,e,t)=>t>e?e:t<i?i:t;let mb=()=>{};const Zn={},bP=i=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i);function SP(i){return typeof i=="object"&&i!==null}const xP=i=>/^0[^.\s]+$/u.test(i);function wP(i){let e;return()=>(e===void 0&&(e=i()),e)}const ar=i=>i,Vz=(i,e)=>t=>e(i(t)),df=(...i)=>i.reduce(Vz),Pu=(i,e,t)=>{const s=e-i;return s===0?1:(t-i)/s};class gb{constructor(){this.subscriptions=[]}add(e){return pb(this.subscriptions,e),()=>cm(this.subscriptions,e)}notify(e,t,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,s);else for(let n=0;n<r;n++){const o=this.subscriptions[n];o&&o(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const br=i=>i*1e3,tr=i=>i/1e3;function CP(i,e){return e?i*(1e3/e):0}const kP=(i,e,t)=>(((1-3*t+3*e)*i+(3*t-6*e))*i+3*e)*i,Zz=1e-7,jz=12;function Iz(i,e,t,s,r){let n,o,l=0;do o=e+(t-e)/2,n=kP(o,s,r)-i,n>0?t=o:e=o;while(Math.abs(n)>Zz&&++l<jz);return o}function pf(i,e,t,s){if(i===e&&t===s)return ar;const r=n=>Iz(n,0,1,i,t);return n=>n===0||n===1?n:kP(r(n),e,s)}const TP=i=>e=>e<=.5?i(2*e)/2:(2-i(2*(1-e)))/2,AP=i=>e=>1-i(1-e),MP=pf(.33,1.53,.69,.99),Ob=AP(MP),EP=TP(Ob),PP=i=>(i*=2)<1?.5*Ob(i):.5*(2-Math.pow(2,-10*(i-1))),_b=i=>1-Math.sin(Math.acos(i)),QP=AP(_b),RP=TP(_b),qz=pf(.42,0,1,1),Wz=pf(0,0,.58,1),LP=pf(.42,0,.58,1),Uz=i=>Array.isArray(i)&&typeof i[0]!="number",$P=i=>Array.isArray(i)&&typeof i[0]=="number",Yz={linear:ar,easeIn:qz,easeInOut:LP,easeOut:Wz,circIn:_b,circInOut:RP,circOut:QP,backIn:Ob,backInOut:EP,backOut:MP,anticipate:PP},Hz=i=>typeof i=="string",p2=i=>{if($P(i)){mb(i.length===4);const[e,t,s,r]=i;return pf(e,t,s,r)}else if(Hz(i))return Yz[i];return i},Hd=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Fz(i,e){let t=new Set,s=new Set,r=!1,n=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),i()),d(l)}const u={schedule:(d,m=!1,g=!1)=>{const y=g&&r?t:s;return m&&o.add(d),y.has(d)||y.add(d),d},cancel:d=>{s.delete(d),o.delete(d)},process:d=>{if(l=d,r){n=!0;return}r=!0,[t,s]=[s,t],t.forEach(c),t.clear(),r=!1,n&&(n=!1,u.process(d))}};return u}const Gz=40;function BP(i,e){let t=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},n=()=>t=!0,o=Hd.reduce((C,A)=>(C[A]=Fz(n),C),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:m,preRender:g,render:_,postRender:y}=o,b=()=>{const C=Zn.useManualTiming?r.timestamp:performance.now();t=!1,Zn.useManualTiming||(r.delta=s?1e3/60:Math.max(Math.min(C-r.timestamp,Gz),1)),r.timestamp=C,r.isProcessing=!0,l.process(r),c.process(r),u.process(r),d.process(r),m.process(r),g.process(r),_.process(r),y.process(r),r.isProcessing=!1,t&&e&&(s=!1,i(b))},x=()=>{t=!0,s=!0,r.isProcessing||i(b)};return{schedule:Hd.reduce((C,A)=>{const P=o[A];return C[A]=(E,$=!1,z=!1)=>(t||x(),P.schedule(E,$,z)),C},{}),cancel:C=>{for(let A=0;A<Hd.length;A++)o[Hd[A]].cancel(C)},state:r,steps:o}}const{schedule:pt,cancel:Zo,state:Pi,steps:W0}=BP(typeof requestAnimationFrame<"u"?requestAnimationFrame:ar,!0);let Bp;function Kz(){Bp=void 0}const Ji={now:()=>(Bp===void 0&&Ji.set(Pi.isProcessing||Zn.useManualTiming?Pi.timestamp:performance.now()),Bp),set:i=>{Bp=i,queueMicrotask(Kz)}},DP=i=>e=>typeof e=="string"&&e.startsWith(i),zP=DP("--"),Jz=DP("var(--"),vb=i=>Jz(i)?e8.test(i.split("/*")[0].trim()):!1,e8=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function m2(i){return typeof i!="string"?!1:i.split("/*")[0].includes("var(--")}const Ah={test:i=>typeof i=="number",parse:parseFloat,transform:i=>i},Qu={...Ah,transform:i=>tn(0,1,i)},Fd={...Ah,default:1},Ou=i=>Math.round(i*1e5)/1e5,yb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function t8(i){return i==null}const i8=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,bb=(i,e)=>t=>!!(typeof t=="string"&&i8.test(t)&&t.startsWith(i)||e&&!t8(t)&&Object.prototype.hasOwnProperty.call(t,e)),NP=(i,e,t)=>s=>{if(typeof s!="string")return s;const[r,n,o,l]=s.match(yb);return{[i]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},s8=i=>tn(0,255,i),U0={...Ah,transform:i=>Math.round(s8(i))},Ea={test:bb("rgb","red"),parse:NP("red","green","blue"),transform:({red:i,green:e,blue:t,alpha:s=1})=>"rgba("+U0.transform(i)+", "+U0.transform(e)+", "+U0.transform(t)+", "+Ou(Qu.transform(s))+")"};function r8(i){let e="",t="",s="",r="";return i.length>5?(e=i.substring(1,3),t=i.substring(3,5),s=i.substring(5,7),r=i.substring(7,9)):(e=i.substring(1,2),t=i.substring(2,3),s=i.substring(3,4),r=i.substring(4,5),e+=e,t+=t,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Hv={test:bb("#"),parse:r8,transform:Ea.transform},mf=i=>({test:e=>typeof e=="string"&&e.endsWith(i)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${i}`}),Mo=mf("deg"),Gr=mf("%"),xe=mf("px"),n8=mf("vh"),o8=mf("vw"),g2={...Gr,parse:i=>Gr.parse(i)/100,transform:i=>Gr.transform(i*100)},Yl={test:bb("hsl","hue"),parse:NP("hue","saturation","lightness"),transform:({hue:i,saturation:e,lightness:t,alpha:s=1})=>"hsla("+Math.round(i)+", "+Gr.transform(Ou(e))+", "+Gr.transform(Ou(t))+", "+Ou(Qu.transform(s))+")"},qt={test:i=>Ea.test(i)||Hv.test(i)||Yl.test(i),parse:i=>Ea.test(i)?Ea.parse(i):Yl.test(i)?Yl.parse(i):Hv.parse(i),transform:i=>typeof i=="string"?i:i.hasOwnProperty("red")?Ea.transform(i):Yl.transform(i),getAnimatableNone:i=>{const e=qt.parse(i);return e.alpha=0,qt.transform(e)}},a8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function l8(i){var e,t;return isNaN(i)&&typeof i=="string"&&(((e=i.match(yb))==null?void 0:e.length)||0)+(((t=i.match(a8))==null?void 0:t.length)||0)>0}const XP="number",VP="color",h8="var",c8="var(",O2="${}",u8=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ru(i){const e=i.toString(),t=[],s={color:[],number:[],var:[]},r=[];let n=0;const l=e.replace(u8,c=>(qt.test(c)?(s.color.push(n),r.push(VP),t.push(qt.parse(c))):c.startsWith(c8)?(s.var.push(n),r.push(h8),t.push(c)):(s.number.push(n),r.push(XP),t.push(parseFloat(c))),++n,O2)).split(O2);return{values:t,split:l,indexes:s,types:r}}function ZP(i){return Ru(i).values}function jP(i){const{split:e,types:t}=Ru(i),s=e.length;return r=>{let n="";for(let o=0;o<s;o++)if(n+=e[o],r[o]!==void 0){const l=t[o];l===XP?n+=Ou(r[o]):l===VP?n+=qt.transform(r[o]):n+=r[o]}return n}}const f8=i=>typeof i=="number"?0:qt.test(i)?qt.getAnimatableNone(i):i;function d8(i){const e=ZP(i);return jP(i)(e.map(f8))}const Sr={test:l8,parse:ZP,createTransformer:jP,getAnimatableNone:d8};function Y0(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function p8({hue:i,saturation:e,lightness:t,alpha:s}){i/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const l=t<.5?t*(1+e):t+e-t*e,c=2*t-l;r=Y0(c,l,i+1/3),n=Y0(c,l,i),o=Y0(c,l,i-1/3)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:s}}function um(i,e){return t=>t>0?e:i}const kt=(i,e,t)=>i+(e-i)*t,H0=(i,e,t)=>{const s=i*i,r=t*(e*e-s)+s;return r<0?0:Math.sqrt(r)},m8=[Hv,Ea,Yl],g8=i=>m8.find(e=>e.test(i));function _2(i){const e=g8(i);if(!e)return!1;let t=e.parse(i);return e===Yl&&(t=p8(t)),t}const v2=(i,e)=>{const t=_2(i),s=_2(e);if(!t||!s)return um(i,e);const r={...t};return n=>(r.red=H0(t.red,s.red,n),r.green=H0(t.green,s.green,n),r.blue=H0(t.blue,s.blue,n),r.alpha=kt(t.alpha,s.alpha,n),Ea.transform(r))},Fv=new Set(["none","hidden"]);function O8(i,e){return Fv.has(i)?t=>t<=0?i:e:t=>t>=1?e:i}function _8(i,e){return t=>kt(i,e,t)}function Sb(i){return typeof i=="number"?_8:typeof i=="string"?vb(i)?um:qt.test(i)?v2:b8:Array.isArray(i)?IP:typeof i=="object"?qt.test(i)?v2:v8:um}function IP(i,e){const t=[...i],s=t.length,r=i.map((n,o)=>Sb(n)(n,e[o]));return n=>{for(let o=0;o<s;o++)t[o]=r[o](n);return t}}function v8(i,e){const t={...i,...e},s={};for(const r in t)i[r]!==void 0&&e[r]!==void 0&&(s[r]=Sb(i[r])(i[r],e[r]));return r=>{for(const n in s)t[n]=s[n](r);return t}}function y8(i,e){const t=[],s={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const n=e.types[r],o=i.indexes[n][s[n]],l=i.values[o]??0;t[r]=l,s[n]++}return t}const b8=(i,e)=>{const t=Sr.createTransformer(e),s=Ru(i),r=Ru(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Fv.has(i)&&!r.values.length||Fv.has(e)&&!s.values.length?O8(i,e):df(IP(y8(s,r),r.values),t):um(i,e)};function qP(i,e,t){return typeof i=="number"&&typeof e=="number"&&typeof t=="number"?kt(i,e,t):Sb(i)(i,e)}const S8=i=>{const e=({timestamp:t})=>i(t);return{start:(t=!0)=>pt.update(e,t),stop:()=>Zo(e),now:()=>Pi.isProcessing?Pi.timestamp:Ji.now()}},WP=(i,e,t=10)=>{let s="";const r=Math.max(Math.round(e/t),2);for(let n=0;n<r;n++)s+=Math.round(i(n/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},fm=2e4;function xb(i){let e=0;const t=50;let s=i.next(e);for(;!s.done&&e<fm;)e+=t,s=i.next(e);return e>=fm?1/0:e}function x8(i,e=100,t){const s=t({...i,keyframes:[0,e]}),r=Math.min(xb(s),fm);return{type:"keyframes",ease:n=>s.next(r*n).value/e,duration:tr(r)}}const w8=5;function UP(i,e,t){const s=Math.max(e-w8,0);return CP(t-i(s),e-s)}const Et={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},F0=.001;function C8({duration:i=Et.duration,bounce:e=Et.bounce,velocity:t=Et.velocity,mass:s=Et.mass}){let r,n,o=1-e;o=tn(Et.minDamping,Et.maxDamping,o),i=tn(Et.minDuration,Et.maxDuration,tr(i)),o<1?(r=u=>{const d=u*o,m=d*i,g=d-t,_=Gv(u,o),y=Math.exp(-m);return F0-g/_*y},n=u=>{const m=u*o*i,g=m*t+t,_=Math.pow(o,2)*Math.pow(u,2)*i,y=Math.exp(-m),b=Gv(Math.pow(u,2),o);return(-r(u)+F0>0?-1:1)*((g-_)*y)/b}):(r=u=>{const d=Math.exp(-u*i),m=(u-t)*i+1;return-F0+d*m},n=u=>{const d=Math.exp(-u*i),m=(t-u)*(i*i);return d*m});const l=5/i,c=T8(r,n,l);if(i=br(i),isNaN(c))return{stiffness:Et.stiffness,damping:Et.damping,duration:i};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:o*2*Math.sqrt(s*u),duration:i}}}const k8=12;function T8(i,e,t){let s=t;for(let r=1;r<k8;r++)s=s-i(s)/e(s);return s}function Gv(i,e){return i*Math.sqrt(1-e*e)}const A8=["duration","bounce"],M8=["stiffness","damping","mass"];function y2(i,e){return e.some(t=>i[t]!==void 0)}function E8(i){let e={velocity:Et.velocity,stiffness:Et.stiffness,damping:Et.damping,mass:Et.mass,isResolvedFromDuration:!1,...i};if(!y2(i,M8)&&y2(i,A8))if(e.velocity=0,i.visualDuration){const t=i.visualDuration,s=2*Math.PI/(t*1.2),r=s*s,n=2*tn(.05,1,1-(i.bounce||0))*Math.sqrt(r);e={...e,mass:Et.mass,stiffness:r,damping:n}}else{const t=C8({...i,velocity:0});e={...e,...t,mass:Et.mass},e.isResolvedFromDuration=!0}return e}function dm(i=Et.visualDuration,e=Et.bounce){const t=typeof i!="object"?{visualDuration:i,keyframes:[0,1],bounce:e}:i;let{restSpeed:s,restDelta:r}=t;const n=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],l={done:!1,value:n},{stiffness:c,damping:u,mass:d,duration:m,velocity:g,isResolvedFromDuration:_}=E8({...t,velocity:-tr(t.velocity||0)}),y=g||0,b=u/(2*Math.sqrt(c*d)),x=o-n,w=tr(Math.sqrt(c/d)),k=Math.abs(x)<5;s||(s=k?Et.restSpeed.granular:Et.restSpeed.default),r||(r=k?Et.restDelta.granular:Et.restDelta.default);let C;if(b<1){const P=Gv(w,b);C=E=>{const $=Math.exp(-b*w*E);return o-$*((y+b*w*x)/P*Math.sin(P*E)+x*Math.cos(P*E))}}else if(b===1)C=P=>o-Math.exp(-w*P)*(x+(y+w*x)*P);else{const P=w*Math.sqrt(b*b-1);C=E=>{const $=Math.exp(-b*w*E),z=Math.min(P*E,300);return o-$*((y+b*w*x)*Math.sinh(z)+P*x*Math.cosh(z))/P}}const A={calculatedDuration:_&&m||null,next:P=>{const E=C(P);if(_)l.done=P>=m;else{let $=P===0?y:0;b<1&&($=P===0?br(y):UP(C,P,E));const z=Math.abs($)<=s,I=Math.abs(o-E)<=r;l.done=z&&I}return l.value=l.done?o:E,l},toString:()=>{const P=Math.min(xb(A),fm),E=WP($=>A.next(P*$).value,P,30);return P+"ms "+E},toTransition:()=>{}};return A}dm.applyToOptions=i=>{const e=x8(i,100,dm);return i.ease=e.ease,i.duration=br(e.duration),i.type="keyframes",i};function Kv({keyframes:i,velocity:e=0,power:t=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:n=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const m=i[0],g={done:!1,value:m},_=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let b=t*e;const x=m+b,w=o===void 0?x:o(x);w!==x&&(b=w-m);const k=z=>-b*Math.exp(-z/s),C=z=>w+k(z),A=z=>{const I=k(z),se=C(z);g.done=Math.abs(I)<=u,g.value=g.done?w:se};let P,E;const $=z=>{_(g.value)&&(P=z,E=dm({keyframes:[g.value,y(g.value)],velocity:UP(C,z,g.value),damping:r,stiffness:n,restDelta:u,restSpeed:d}))};return $(0),{calculatedDuration:null,next:z=>{let I=!1;return!E&&P===void 0&&(I=!0,A(z),$(z)),P!==void 0&&z>=P?E.next(z-P):(!I&&A(z),g)}}}function P8(i,e,t){const s=[],r=t||Zn.mix||qP,n=i.length-1;for(let o=0;o<n;o++){let l=r(i[o],i[o+1]);if(e){const c=Array.isArray(e)?e[o]||ar:e;l=df(c,l)}s.push(l)}return s}function Q8(i,e,{clamp:t=!0,ease:s,mixer:r}={}){const n=i.length;if(mb(n===e.length),n===1)return()=>e[0];if(n===2&&e[0]===e[1])return()=>e[1];const o=i[0]===i[1];i[0]>i[n-1]&&(i=[...i].reverse(),e=[...e].reverse());const l=P8(e,s,r),c=l.length,u=d=>{if(o&&d<i[0])return e[0];let m=0;if(c>1)for(;m<i.length-2&&!(d<i[m+1]);m++);const g=Pu(i[m],i[m+1],d);return l[m](g)};return t?d=>u(tn(i[0],i[n-1],d)):u}function R8(i,e){const t=i[i.length-1];for(let s=1;s<=e;s++){const r=Pu(0,e,s);i.push(kt(t,1,r))}}function L8(i){const e=[0];return R8(e,i.length-1),e}function $8(i,e){return i.map(t=>t*e)}function B8(i,e){return i.map(()=>e||LP).splice(0,i.length-1)}function _u({duration:i=300,keyframes:e,times:t,ease:s="easeInOut"}){const r=Uz(s)?s.map(p2):p2(s),n={done:!1,value:e[0]},o=$8(t&&t.length===e.length?t:L8(e),i),l=Q8(o,e,{ease:Array.isArray(r)?r:B8(e,r)});return{calculatedDuration:i,next:c=>(n.value=l(c),n.done=c>=i,n)}}const D8=i=>i!==null;function wb(i,{repeat:e,repeatType:t="loop"},s,r=1){const n=i.filter(D8),l=r<0||e&&t!=="loop"&&e%2===1?0:n.length-1;return!l||s===void 0?n[l]:s}const z8={decay:Kv,inertia:Kv,tween:_u,keyframes:_u,spring:dm};function YP(i){typeof i.type=="string"&&(i.type=z8[i.type])}class Cb{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const N8=i=>i/100;class kb extends Cb{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,r;const{motionValue:t}=this.options;t&&t.updatedAt!==Ji.now()&&this.tick(Ji.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;YP(e);const{type:t=_u,repeat:s=0,repeatDelay:r=0,repeatType:n,velocity:o=0}=e;let{keyframes:l}=e;const c=t||_u;c!==_u&&typeof l[0]!="number"&&(this.mixKeyframes=df(N8,qP(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});n==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=xb(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=u}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:s,totalDuration:r,mixKeyframes:n,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:u=0,keyframes:d,repeat:m,repeatType:g,repeatDelay:_,type:y,onUpdate:b,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const w=this.currentTime-u*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?w<0:w>r;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let C=this.currentTime,A=s;if(m){const z=Math.min(this.currentTime,r)/l;let I=Math.floor(z),se=z%1;!se&&z>=1&&(se=1),se===1&&I--,I=Math.min(I,m+1),!!(I%2)&&(g==="reverse"?(se=1-se,_&&(se-=_/l)):g==="mirror"&&(A=o)),C=tn(0,1,se)*l}const P=k?{done:!1,value:d[0]}:A.next(C);n&&(P.value=n(P.value));let{done:E}=P;!k&&c!==null&&(E=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return $&&y!==Kv&&(P.value=wb(d,this.options,x,this.speed)),b&&b(P.value),$&&this.finish(),P}then(e,t){return this.finished.then(e,t)}get duration(){return tr(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tr(e)}get time(){return tr(this.currentTime)}set time(e){var t;e=br(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(t=this.driver)==null||t.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ji.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=tr(this.currentTime))}play(){var r,n;if(this.isStopped)return;const{driver:e=S8,startTime:t}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(n=(r=this.options).onPlay)==null||n.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ji.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(e=this.options).onComplete)==null||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(e=this.options).onCancel)==null||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),e.observe(this)}}function X8(i){for(let e=1;e<i.length;e++)i[e]??(i[e]=i[e-1])}const Pa=i=>i*180/Math.PI,Jv=i=>{const e=Pa(Math.atan2(i[1],i[0]));return e1(e)},V8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:i=>(Math.abs(i[0])+Math.abs(i[3]))/2,rotate:Jv,rotateZ:Jv,skewX:i=>Pa(Math.atan(i[1])),skewY:i=>Pa(Math.atan(i[2])),skew:i=>(Math.abs(i[1])+Math.abs(i[2]))/2},e1=i=>(i=i%360,i<0&&(i+=360),i),b2=Jv,S2=i=>Math.sqrt(i[0]*i[0]+i[1]*i[1]),x2=i=>Math.sqrt(i[4]*i[4]+i[5]*i[5]),Z8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:S2,scaleY:x2,scale:i=>(S2(i)+x2(i))/2,rotateX:i=>e1(Pa(Math.atan2(i[6],i[5]))),rotateY:i=>e1(Pa(Math.atan2(-i[2],i[0]))),rotateZ:b2,rotate:b2,skewX:i=>Pa(Math.atan(i[4])),skewY:i=>Pa(Math.atan(i[1])),skew:i=>(Math.abs(i[1])+Math.abs(i[4]))/2};function t1(i){return i.includes("scale")?1:0}function i1(i,e){if(!i||i==="none")return t1(e);const t=i.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(t)s=Z8,r=t;else{const l=i.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=V8,r=l}if(!r)return t1(e);const n=s[e],o=r[1].split(",").map(I8);return typeof n=="function"?n(o):o[n]}const j8=(i,e)=>{const{transform:t="none"}=getComputedStyle(i);return i1(t,e)};function I8(i){return parseFloat(i.trim())}const Mh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Eh=new Set(Mh),w2=i=>i===Ah||i===xe,q8=new Set(["x","y","z"]),W8=Mh.filter(i=>!q8.has(i));function U8(i){const e=[];return W8.forEach(t=>{const s=i.getValue(t);s!==void 0&&(e.push([t,s.get()]),s.set(t.startsWith("scale")?1:0))}),e}const Do={width:({x:i},{paddingLeft:e="0",paddingRight:t="0"})=>i.max-i.min-parseFloat(e)-parseFloat(t),height:({y:i},{paddingTop:e="0",paddingBottom:t="0"})=>i.max-i.min-parseFloat(e)-parseFloat(t),top:(i,{top:e})=>parseFloat(e),left:(i,{left:e})=>parseFloat(e),bottom:({y:i},{top:e})=>parseFloat(e)+(i.max-i.min),right:({x:i},{left:e})=>parseFloat(e)+(i.max-i.min),x:(i,{transform:e})=>i1(e,"x"),y:(i,{transform:e})=>i1(e,"y")};Do.translateX=Do.x;Do.translateY=Do.y;const za=new Set;let s1=!1,r1=!1,n1=!1;function HP(){if(r1){const i=Array.from(za).filter(s=>s.needsMeasurement),e=new Set(i.map(s=>s.element)),t=new Map;e.forEach(s=>{const r=U8(s);r.length&&(t.set(s,r),s.render())}),i.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const r=t.get(s);r&&r.forEach(([n,o])=>{var l;(l=s.getValue(n))==null||l.set(o)})}),i.forEach(s=>s.measureEndState()),i.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}r1=!1,s1=!1,za.forEach(i=>i.complete(n1)),za.clear()}function FP(){za.forEach(i=>{i.readKeyframes(),i.needsMeasurement&&(r1=!0)})}function Y8(){n1=!0,FP(),HP(),n1=!1}class Tb{constructor(e,t,s,r,n,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=r,this.element=n,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(za.add(this),s1||(s1=!0,pt.read(FP),pt.resolveKeyframes(HP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:s,motionValue:r}=this;if(e[0]===null){const n=r==null?void 0:r.get(),o=e[e.length-1];if(n!==void 0)e[0]=n;else if(s&&t){const l=s.readValue(t,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),r&&n===void 0&&r.set(e[0])}X8(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),za.delete(this)}cancel(){this.state==="scheduled"&&(za.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const H8=i=>i.startsWith("--");function F8(i,e,t){H8(e)?i.style.setProperty(e,t):i.style[e]=t}const G8={};function GP(i,e){const t=wP(i);return()=>G8[e]??t()}const K8=GP(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),KP=GP(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),nu=([i,e,t,s])=>`cubic-bezier(${i}, ${e}, ${t}, ${s})`,C2={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nu([0,.65,.55,1]),circOut:nu([.55,0,1,.45]),backIn:nu([.31,.01,.66,-.59]),backOut:nu([.33,1.53,.69,.99])};function JP(i,e){if(i)return typeof i=="function"?KP()?WP(i,e):"ease-out":$P(i)?nu(i):Array.isArray(i)?i.map(t=>JP(t,e)||C2.easeOut):C2[i]}function J8(i,e,t,{delay:s=0,duration:r=300,repeat:n=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:t};c&&(d.offset=c);const m=JP(l,r);Array.isArray(m)&&(d.easing=m);const g={delay:s,duration:r,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:n+1,direction:o==="reverse"?"alternate":"normal"};return u&&(g.pseudoElement=u),i.animate(d,g)}function eQ(i){return typeof i=="function"&&"applyToOptions"in i}function eN({type:i,...e}){return eQ(i)&&KP()?i.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class tQ extends Cb{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:r,pseudoElement:n,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!n,this.allowFlatten=o,this.options=e,mb(typeof e.type!="string");const u=eN(e);this.animation=J8(t,s,r,u,n),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!n){const d=wb(r,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):F8(t,s,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;(t=(e=this.animation).finish)==null||t.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,s,r;const e=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(s=this.animation).commitStyles)==null||r.call(s))}get duration(){var t,s;const e=((s=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:s.call(t).duration)||0;return tr(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tr(e)}get time(){return tr(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=br(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&K8()?(this.animation.timeline=e,ar):t(this)}}const iQ={anticipate:PP,backInOut:EP,circInOut:RP};function tN(i){return i in iQ}function iN(i){typeof i.ease=="string"&&tN(i.ease)&&(i.ease=iQ[i.ease])}const G0=10;class sN extends tQ{constructor(e){iN(e),YP(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:s,onComplete:r,element:n,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new kb({...o,autoplay:!1}),c=Math.max(G0,Ji.now()-this.startTime),u=tn(0,G0,c-G0);t.setWithVelocity(l.sample(Math.max(0,c-u)).value,l.sample(c).value,u),l.stop()}}const k2=(i,e)=>e==="zIndex"?!1:!!(typeof i=="number"||Array.isArray(i)||typeof i=="string"&&(Sr.test(i)||i==="0")&&!i.startsWith("url("));function rN(i){const e=i[0];if(i.length===1)return!0;for(let t=0;t<i.length;t++)if(i[t]!==e)return!0}function nN(i,e,t,s){const r=i[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const n=i[i.length-1],o=k2(r,e),l=k2(n,e);return!o||!l?!1:rN(i)||(t==="spring"||eQ(t))&&s}function o1(i){i.duration=0,i.type="keyframes"}const oN=new Set(["opacity","clipPath","filter","transform"]),aN=wP(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function lN(i){var d;const{motionValue:e,name:t,repeatDelay:s,repeatType:r,damping:n,type:o}=i;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return aN()&&t&&oN.has(t)&&(t!=="transform"||!u)&&!c&&!s&&r!=="mirror"&&n!==0&&o!=="inertia"}const hN=40;class cN extends Cb{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:r=0,repeatDelay:n=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...m}){var y;super(),this.stop=()=>{var b,x;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=Ji.now();const g={autoplay:e,delay:t,type:s,repeat:r,repeatDelay:n,repeatType:o,name:c,motionValue:u,element:d,...m},_=(d==null?void 0:d.KeyframeResolver)||Tb;this.keyframeResolver=new _(l,(b,x,w)=>this.onKeyframesResolved(b,x,g,!w),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,t,s,r){var x,w;this.keyframeResolver=void 0;const{name:n,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=s;this.resolvedAt=Ji.now(),nN(e,n,o,l)||((Zn.instantAnimations||!c)&&(d==null||d(wb(e,s,t))),e[0]=e[e.length-1],o1(s),s.repeat=0);const g={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>hN?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},_=!u&&lN(g),y=(w=(x=g.motionValue)==null?void 0:x.owner)==null?void 0:w.current,b=_?new sN({...g,element:y}):new kb(g);b.finished.then(()=>{this.notifyFinished()}).catch(ar),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Y8()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function sQ(i,e,t,s=0,r=1){const n=Array.from(i).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=i.size,l=(o-1)*s;return typeof t=="function"?t(n,o):r===1?n*s:l-n*s}const uN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fN(i){const e=uN.exec(i);if(!e)return[,];const[,t,s,r]=e;return[`--${t??s}`,r]}function rQ(i,e,t=1){const[s,r]=fN(i);if(!s)return;const n=window.getComputedStyle(e).getPropertyValue(s);if(n){const o=n.trim();return bP(o)?parseFloat(o):o}return vb(r)?rQ(r,e,t+1):r}const dN={type:"spring",stiffness:500,damping:25,restSpeed:10},pN=i=>({type:"spring",stiffness:550,damping:i===0?2*Math.sqrt(550):30,restSpeed:10}),mN={type:"keyframes",duration:.8},gN={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ON=(i,{keyframes:e})=>e.length>2?mN:Eh.has(i)?i.startsWith("scale")?pN(e[1]):dN:gN,_N=i=>i!==null;function vN(i,{repeat:e,repeatType:t="loop"},s){const r=i.filter(_N),n=e&&t!=="loop"&&e%2===1?0:r.length-1;return r[n]}function nQ(i,e){if(i!=null&&i.inherit&&e){const{inherit:t,...s}=i;return{...e,...s}}return i}function Ab(i,e){const t=(i==null?void 0:i[e])??(i==null?void 0:i.default)??i;return t!==i?nQ(t,i):t}function yN({when:i,delay:e,delayChildren:t,staggerChildren:s,staggerDirection:r,repeat:n,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Mb=(i,e,t,s={},r,n)=>o=>{const l=Ab(s,i)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-br(c);const d={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:g=>{e.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:i,motionValue:e,element:n?void 0:r};yN(l)||Object.assign(d,ON(i,d)),d.duration&&(d.duration=br(d.duration)),d.repeatDelay&&(d.repeatDelay=br(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let m=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(o1(d),d.delay===0&&(m=!0)),(Zn.instantAnimations||Zn.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(m=!0,o1(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,m&&!n&&e.get()!==void 0){const g=vN(d.keyframes,l);if(g!==void 0){pt.update(()=>{d.onUpdate(g),d.onComplete()});return}}return l.isSync?new kb(d):new cN(d)};function T2(i){const e=[{},{}];return i==null||i.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function Eb(i,e,t,s){if(typeof e=="function"){const[r,n]=T2(s);e=e(t!==void 0?t:i.custom,r,n)}if(typeof e=="string"&&(e=i.variants&&i.variants[e]),typeof e=="function"){const[r,n]=T2(s);e=e(t!==void 0?t:i.custom,r,n)}return e}function nh(i,e,t){const s=i.getProps();return Eb(s,e,t!==void 0?t:s.custom,i)}const oQ=new Set(["width","height","top","left","right","bottom",...Mh]),A2=30,bN=i=>!isNaN(parseFloat(i));class SN{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var n;const r=Ji.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((n=this.events.change)==null||n.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ji.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bN(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new gb);const s=this.events[e].add(t);return e==="change"?()=>{s(),pt.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ji.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>A2)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,A2);return CP(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mh(i,e){return new SN(i,e)}const a1=i=>Array.isArray(i);function xN(i,e,t){i.hasValue(e)?i.getValue(e).set(t):i.addValue(e,mh(t))}function wN(i){return a1(i)?i[i.length-1]||0:i}function CN(i,e){const t=nh(i,e);let{transitionEnd:s={},transition:r={},...n}=t||{};n={...n,...s};for(const o in n){const l=wN(n[o]);xN(i,o,l)}}const Ii=i=>!!(i&&i.getVelocity);function kN(i){return!!(Ii(i)&&i.add)}function l1(i,e){const t=i.getValue("willChange");if(kN(t))return t.add(e);if(!t&&Zn.WillChange){const s=new Zn.WillChange("auto");i.addValue("willChange",s),s.add(e)}}function Pb(i){return i.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const TN="framerAppearId",aQ="data-"+Pb(TN);function lQ(i){return i.props[aQ]}function AN({protectedKeys:i,needsAnimating:e},t){const s=i.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,s}function hQ(i,e,{delay:t=0,transitionOverride:s,type:r}={}){let{transition:n,transitionEnd:o,...l}=e;const c=i.getDefaultTransition();n=n?nQ(n,c):c;const u=n==null?void 0:n.reduceMotion;s&&(n=s);const d=[],m=r&&i.animationState&&i.animationState.getState()[r];for(const g in l){const _=i.getValue(g,i.latestValues[g]??null),y=l[g];if(y===void 0||m&&AN(m,g))continue;const b={delay:t,...Ab(n||{},g)},x=_.get();if(x!==void 0&&!_.isAnimating&&!Array.isArray(y)&&y===x&&!b.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const A=lQ(i);if(A){const P=window.MotionHandoffAnimation(A,g,pt);P!==null&&(b.startTime=P,w=!0)}}l1(i,g);const k=u??i.shouldReduceMotion;_.start(Mb(g,_,y,k&&oQ.has(g)?{type:!1}:b,i,w));const C=_.animation;C&&d.push(C)}if(o){const g=()=>pt.update(()=>{o&&CN(i,o)});d.length?Promise.all(d).then(g):g()}return d}function h1(i,e,t={}){var c;const s=nh(i,e,t.type==="exit"?(c=i.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=i.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(r=t.transitionOverride);const n=s?()=>Promise.all(hQ(i,s,t)):()=>Promise.resolve(),o=i.variantChildren&&i.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:m,staggerDirection:g}=r;return MN(i,e,u,d,m,g,t)}:()=>Promise.resolve(),{when:l}=r;if(l){const[u,d]=l==="beforeChildren"?[n,o]:[o,n];return u().then(()=>d())}else return Promise.all([n(),o(t.delay)])}function MN(i,e,t=0,s=0,r=0,n=1,o){const l=[];for(const c of i.variantChildren)c.notify("AnimationStart",e),l.push(h1(c,e,{...o,delay:t+(typeof s=="function"?0:s)+sQ(i.variantChildren,c,s,r,n)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function EN(i,e,t={}){i.notify("AnimationStart",e);let s;if(Array.isArray(e)){const r=e.map(n=>h1(i,n,t));s=Promise.all(r)}else if(typeof e=="string")s=h1(i,e,t);else{const r=typeof e=="function"?nh(i,e,t.custom):e;s=Promise.all(hQ(i,r,t))}return s.then(()=>{i.notify("AnimationComplete",e)})}const PN={test:i=>i==="auto",parse:i=>i},cQ=i=>e=>e.test(i),uQ=[Ah,xe,Gr,Mo,o8,n8,PN],M2=i=>uQ.find(cQ(i));function QN(i){return typeof i=="number"?i===0:i!==null?i==="none"||i==="0"||xP(i):!0}const RN=new Set(["brightness","contrast","saturate","opacity"]);function LN(i){const[e,t]=i.slice(0,-1).split("(");if(e==="drop-shadow")return i;const[s]=t.match(yb)||[];if(!s)return i;const r=t.replace(s,"");let n=RN.has(e)?1:0;return s!==t&&(n*=100),e+"("+n+r+")"}const $N=/\b([a-z-]*)\(.*?\)/gu,c1={...Sr,getAnimatableNone:i=>{const e=i.match($N);return e?e.map(LN).join(" "):i}},u1={...Sr,getAnimatableNone:i=>{const e=Sr.parse(i);return Sr.createTransformer(i)(e.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},E2={...Ah,transform:Math.round},BN={rotate:Mo,rotateX:Mo,rotateY:Mo,rotateZ:Mo,scale:Fd,scaleX:Fd,scaleY:Fd,scaleZ:Fd,skew:Mo,skewX:Mo,skewY:Mo,distance:xe,translateX:xe,translateY:xe,translateZ:xe,x:xe,y:xe,z:xe,perspective:xe,transformPerspective:xe,opacity:Qu,originX:g2,originY:g2,originZ:xe},Qb={borderWidth:xe,borderTopWidth:xe,borderRightWidth:xe,borderBottomWidth:xe,borderLeftWidth:xe,borderRadius:xe,borderTopLeftRadius:xe,borderTopRightRadius:xe,borderBottomRightRadius:xe,borderBottomLeftRadius:xe,width:xe,maxWidth:xe,height:xe,maxHeight:xe,top:xe,right:xe,bottom:xe,left:xe,inset:xe,insetBlock:xe,insetBlockStart:xe,insetBlockEnd:xe,insetInline:xe,insetInlineStart:xe,insetInlineEnd:xe,padding:xe,paddingTop:xe,paddingRight:xe,paddingBottom:xe,paddingLeft:xe,paddingBlock:xe,paddingBlockStart:xe,paddingBlockEnd:xe,paddingInline:xe,paddingInlineStart:xe,paddingInlineEnd:xe,margin:xe,marginTop:xe,marginRight:xe,marginBottom:xe,marginLeft:xe,marginBlock:xe,marginBlockStart:xe,marginBlockEnd:xe,marginInline:xe,marginInlineStart:xe,marginInlineEnd:xe,fontSize:xe,backgroundPositionX:xe,backgroundPositionY:xe,...BN,zIndex:E2,fillOpacity:Qu,strokeOpacity:Qu,numOctaves:E2},DN={...Qb,color:qt,backgroundColor:qt,outlineColor:qt,fill:qt,stroke:qt,borderColor:qt,borderTopColor:qt,borderRightColor:qt,borderBottomColor:qt,borderLeftColor:qt,filter:c1,WebkitFilter:c1,mask:u1,WebkitMask:u1},fQ=i=>DN[i],zN=new Set([c1,u1]);function dQ(i,e){let t=fQ(i);return zN.has(t)||(t=Sr),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const NN=new Set(["auto","none","0"]);function XN(i,e,t){let s=0,r;for(;s<i.length&&!r;){const n=i[s];typeof n=="string"&&!NN.has(n)&&Ru(n).values.length&&(r=i[s]),s++}if(r&&t)for(const n of e)i[n]=dQ(t,r)}class VN extends Tb{constructor(e,t,s,r,n){super(e,t,s,r,n,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let m=e[d];if(typeof m=="string"&&(m=m.trim(),vb(m))){const g=rQ(m,t.current);g!==void 0&&(e[d]=g),d===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!oQ.has(s)||e.length!==2)return;const[r,n]=e,o=M2(r),l=M2(n),c=m2(r),u=m2(n);if(c!==u&&Do[s]){this.needsMeasurement=!0;return}if(o!==l)if(w2(o)&&w2(l))for(let d=0;d<e.length;d++){const m=e[d];typeof m=="string"&&(e[d]=parseFloat(m))}else Do[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,s=[];for(let r=0;r<e.length;r++)(e[r]===null||QN(e[r]))&&s.push(r);s.length&&XN(e,s,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Do[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&e.getValue(s,r).jump(r,!1)}measureEndState(){var l;const{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);const n=s.length-1,o=s[n];s[n]=Do[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const ZN=new Set(["opacity","clipPath","filter","transform"]);function pQ(i,e,t){if(i==null)return[];if(i instanceof EventTarget)return[i];if(typeof i=="string"){let s=document;const r=(t==null?void 0:t[i])??s.querySelectorAll(i);return r?Array.from(r):[]}return Array.from(i).filter(s=>s!=null)}const mQ=(i,e)=>e&&typeof i=="number"?e.transform(i):i;function jN(i){return SP(i)&&"offsetHeight"in i}const{schedule:Rb}=BP(queueMicrotask,!1),_r={x:!1,y:!1};function gQ(){return _r.x||_r.y}function IN(i){return i==="x"||i==="y"?_r[i]?null:(_r[i]=!0,()=>{_r[i]=!1}):_r.x||_r.y?null:(_r.x=_r.y=!0,()=>{_r.x=_r.y=!1})}function OQ(i,e){const t=pQ(i),s=new AbortController,r={passive:!0,...e,signal:s.signal};return[t,r,()=>s.abort()]}function qN(i){return!(i.pointerType==="touch"||gQ())}function WN(i,e,t={}){const[s,r,n]=OQ(i,t);return s.forEach(o=>{let l=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",y)},m=x=>{u&&(u(x),u=void 0),d()},g=x=>{l=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),c&&(c=!1,m(x))},_=()=>{l=!0,window.addEventListener("pointerup",g,r),window.addEventListener("pointercancel",g,r)},y=x=>{if(x.pointerType!=="touch"){if(l){c=!0;return}m(x)}},b=x=>{if(!qN(x))return;c=!1;const w=e(o,x);typeof w=="function"&&(u=w,o.addEventListener("pointerleave",y,r))};o.addEventListener("pointerenter",b,r),o.addEventListener("pointerdown",_,r)}),n}const _Q=(i,e)=>e?i===e?!0:_Q(i,e.parentElement):!1,Lb=i=>i.pointerType==="mouse"?typeof i.button!="number"||i.button<=0:i.isPrimary!==!1,UN=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function YN(i){return UN.has(i.tagName)||i.isContentEditable===!0}const HN=new Set(["INPUT","SELECT","TEXTAREA"]);function FN(i){return HN.has(i.tagName)||i.isContentEditable===!0}const Dp=new WeakSet;function P2(i){return e=>{e.key==="Enter"&&i(e)}}function K0(i,e){i.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const GN=(i,e)=>{const t=i.currentTarget;if(!t)return;const s=P2(()=>{if(Dp.has(t))return;K0(t,"down");const r=P2(()=>{K0(t,"up")}),n=()=>K0(t,"cancel");t.addEventListener("keyup",r,e),t.addEventListener("blur",n,e)});t.addEventListener("keydown",s,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",s),e)};function Q2(i){return Lb(i)&&!gQ()}const R2=new WeakSet;function KN(i,e,t={}){const[s,r,n]=OQ(i,t),o=l=>{const c=l.currentTarget;if(!Q2(l)||R2.has(l))return;Dp.add(c),t.stopPropagation&&R2.add(l);const u=e(c,l),d=(_,y)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",g),Dp.has(c)&&Dp.delete(c),Q2(_)&&typeof u=="function"&&u(_,{success:y})},m=_=>{d(_,c===window||c===document||t.useGlobalTarget||_Q(c,_.target))},g=_=>{d(_,!1)};window.addEventListener("pointerup",m,r),window.addEventListener("pointercancel",g,r)};return s.forEach(l=>{(t.useGlobalTarget?window:l).addEventListener("pointerdown",o,r),jN(l)&&(l.addEventListener("focus",u=>GN(u,r)),!YN(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),n}function $b(i){return SP(i)&&"ownerSVGElement"in i}const zp=new WeakMap;let Eo;const vQ=(i,e,t)=>(s,r)=>r&&r[0]?r[0][i+"Size"]:$b(s)&&"getBBox"in s?s.getBBox()[e]:s[t],JN=vQ("inline","width","offsetWidth"),e7=vQ("block","height","offsetHeight");function t7({target:i,borderBoxSize:e}){var t;(t=zp.get(i))==null||t.forEach(s=>{s(i,{get width(){return JN(i,e)},get height(){return e7(i,e)}})})}function i7(i){i.forEach(t7)}function s7(){typeof ResizeObserver>"u"||(Eo=new ResizeObserver(i7))}function r7(i,e){Eo||s7();const t=pQ(i);return t.forEach(s=>{let r=zp.get(s);r||(r=new Set,zp.set(s,r)),r.add(e),Eo==null||Eo.observe(s)}),()=>{t.forEach(s=>{const r=zp.get(s);r==null||r.delete(e),r!=null&&r.size||Eo==null||Eo.unobserve(s)})}}const Np=new Set;let Hl;function n7(){Hl=()=>{const i={get width(){return window.innerWidth},get height(){return window.innerHeight}};Np.forEach(e=>e(i))},window.addEventListener("resize",Hl)}function o7(i){return Np.add(i),Hl||n7(),()=>{Np.delete(i),!Np.size&&typeof Hl=="function"&&(window.removeEventListener("resize",Hl),Hl=void 0)}}function L2(i,e){return typeof i=="function"?o7(i):r7(i,e)}function a7(i){return $b(i)&&i.tagName==="svg"}const l7=[...uQ,qt,Sr],h7=i=>l7.find(cQ(i)),$2=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fl=()=>({x:$2(),y:$2()}),B2=()=>({min:0,max:0}),ii=()=>({x:B2(),y:B2()}),c7=new WeakMap;function rg(i){return i!==null&&typeof i=="object"&&typeof i.start=="function"}function Lu(i){return typeof i=="string"||Array.isArray(i)}const Bb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Db=["initial",...Bb];function ng(i){return rg(i.animate)||Db.some(e=>Lu(i[e]))}function yQ(i){return!!(ng(i)||i.variants)}function u7(i,e,t){for(const s in e){const r=e[s],n=t[s];if(Ii(r))i.addValue(s,r);else if(Ii(n))i.addValue(s,mh(r,{owner:i}));else if(n!==r)if(i.hasValue(s)){const o=i.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=i.getStaticValue(s);i.addValue(s,mh(o!==void 0?o:r,{owner:i}))}}for(const s in t)e[s]===void 0&&i.removeValue(s);return e}const f1={current:null},bQ={current:!1},f7=typeof window<"u";function d7(){if(bQ.current=!0,!!f7)if(window.matchMedia){const i=window.matchMedia("(prefers-reduced-motion)"),e=()=>f1.current=i.matches;i.addEventListener("change",e),e()}else f1.current=!1}const D2=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let pm={};function SQ(i){pm=i}function p7(){return pm}class m7{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:r,skipAnimations:n,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Tb,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=Ji.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,pt.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=l;this.latestValues=u,this.baseTarget={...u},this.initialValues=t.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=n,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=ng(t),this.isVariantNode=yQ(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...g}=this.scrapeMotionValuesFromProps(t,{},this);for(const _ in g){const y=g[_];u[_]!==void 0&&Ii(y)&&y.set(u[_])}}mount(e){var t,s;if(this.hasBeenMounted)for(const r in this.initialValues)(t=this.values.get(r))==null||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,c7.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(bQ.current||d7(),this.shouldReduceMotion=f1.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Zo(this.notifyUpdate),Zo(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ZN.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:u,duration:d}=t.accelerate,m=new tQ({element:this.current,name:e,keyframes:l,times:c,ease:u,duration:br(d)}),g=o(m);this.valueSubscriptions.set(e,()=>{g(),m.cancel()});return}const s=Eh.has(e);s&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&pt.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let n;typeof window<"u"&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),n&&n(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in pm){const t=pm[e];if(!t)continue;const{isEnabled:s,Feature:r}=t;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){const n=this.features[e];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ii()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let s=0;s<D2.length;s++){const r=D2[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const n="on"+r,o=e[n];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=u7(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&t!==void 0&&(s=mh(t===null?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(bP(s)||xP(s))?s=parseFloat(s):!h7(s)&&Sr.test(t)&&(s=dQ(e,t)),this.setBaseTarget(e,Ii(s)?s.get():s)),Ii(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var n;const{initial:t}=this.props;let s;if(typeof t=="string"||typeof t=="object"){const o=Eb(this.props,t,(n=this.presenceContext)==null?void 0:n.custom);o&&(s=o[e])}if(t&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Ii(r)?r:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new gb),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Rb.render(this.render)}}class xQ extends m7{constructor(){super(...arguments),this.KeyframeResolver=VN}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ii(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class Fo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function wQ({top:i,left:e,right:t,bottom:s}){return{x:{min:e,max:t},y:{min:i,max:s}}}function g7({x:i,y:e}){return{top:e.min,right:i.max,bottom:e.max,left:i.min}}function O7(i,e){if(!e)return i;const t=e({x:i.left,y:i.top}),s=e({x:i.right,y:i.bottom});return{top:t.y,left:t.x,bottom:s.y,right:s.x}}function J0(i){return i===void 0||i===1}function d1({scale:i,scaleX:e,scaleY:t}){return!J0(i)||!J0(e)||!J0(t)}function xa(i){return d1(i)||CQ(i)||i.z||i.rotate||i.rotateX||i.rotateY||i.skewX||i.skewY}function CQ(i){return z2(i.x)||z2(i.y)}function z2(i){return i&&i!=="0%"}function mm(i,e,t){const s=i-t,r=e*s;return t+r}function N2(i,e,t,s,r){return r!==void 0&&(i=mm(i,r,s)),mm(i,t,s)+e}function p1(i,e=0,t=1,s,r){i.min=N2(i.min,e,t,s,r),i.max=N2(i.max,e,t,s,r)}function kQ(i,{x:e,y:t}){p1(i.x,e.translate,e.scale,e.originPoint),p1(i.y,t.translate,t.scale,t.originPoint)}const X2=.999999999999,V2=1.0000000000001;function _7(i,e,t,s=!1){const r=t.length;if(!r)return;e.x=e.y=1;let n,o;for(let l=0;l<r;l++){n=t[l],o=n.projectionDelta;const{visualElement:c}=n.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&n.options.layoutScroll&&n.scroll&&n!==n.root&&Kl(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,kQ(i,o)),s&&xa(n.latestValues)&&Kl(i,n.latestValues))}e.x<V2&&e.x>X2&&(e.x=1),e.y<V2&&e.y>X2&&(e.y=1)}function Gl(i,e){i.min=i.min+e,i.max=i.max+e}function Z2(i,e,t,s,r=.5){const n=kt(i.min,i.max,r);p1(i,e,t,n,s)}function Kl(i,e){Z2(i.x,e.x,e.scaleX,e.scale,e.originX),Z2(i.y,e.y,e.scaleY,e.scale,e.originY)}function TQ(i,e){return wQ(O7(i.getBoundingClientRect(),e))}function v7(i,e,t){const s=TQ(i,t),{scroll:r}=e;return r&&(Gl(s.x,r.offset.x),Gl(s.y,r.offset.y)),s}const y7={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},b7=Mh.length;function S7(i,e,t){let s="",r=!0;for(let n=0;n<b7;n++){const o=Mh[n],l=i[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const u=parseFloat(l);c=o.startsWith("scale")?u===1:u===0}if(!c||t){const u=mQ(l,Qb[o]);if(!c){r=!1;const d=y7[o]||o;s+=`${d}(${u}) `}t&&(e[o]=u)}}return s=s.trim(),t?s=t(e,r?"":s):r&&(s="none"),s}function zb(i,e,t){const{style:s,vars:r,transformOrigin:n}=i;let o=!1,l=!1;for(const c in e){const u=e[c];if(Eh.has(c)){o=!0;continue}else if(zP(c)){r[c]=u;continue}else{const d=mQ(u,Qb[c]);c.startsWith("origin")?(l=!0,n[c]=d):s[c]=d}}if(e.transform||(o||t?s.transform=S7(e,i.transform,t):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=n;s.transformOrigin=`${c} ${u} ${d}`}}function AQ(i,{style:e,vars:t},s,r){const n=i.style;let o;for(o in e)n[o]=e[o];r==null||r.applyProjectionStyles(n,s);for(o in t)n.setProperty(o,t[o])}function j2(i,e){return e.max===e.min?0:i/(e.max-e.min)*100}const zc={correct:(i,e)=>{if(!e.target)return i;if(typeof i=="string")if(xe.test(i))i=parseFloat(i);else return i;const t=j2(i,e.target.x),s=j2(i,e.target.y);return`${t}% ${s}%`}},x7={correct:(i,{treeScale:e,projectionDelta:t})=>{const s=i,r=Sr.parse(i);if(r.length>5)return s;const n=Sr.createTransformer(i),o=typeof r[0]!="number"?1:0,l=t.x.scale*e.x,c=t.y.scale*e.y;r[0+o]/=l,r[1+o]/=c;const u=kt(l,c,.5);return typeof r[2+o]=="number"&&(r[2+o]/=u),typeof r[3+o]=="number"&&(r[3+o]/=u),n(r)}},m1={borderRadius:{...zc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zc,borderTopRightRadius:zc,borderBottomLeftRadius:zc,borderBottomRightRadius:zc,boxShadow:x7};function MQ(i,{layout:e,layoutId:t}){return Eh.has(i)||i.startsWith("origin")||(e||t!==void 0)&&(!!m1[i]||i==="opacity")}function Nb(i,e,t){var o;const s=i.style,r=e==null?void 0:e.style,n={};if(!s)return n;for(const l in s)(Ii(s[l])||r&&Ii(r[l])||MQ(l,i)||((o=t==null?void 0:t.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(n[l]=s[l]);return n}function w7(i){return window.getComputedStyle(i)}class C7 extends xQ{constructor(){super(...arguments),this.type="html",this.renderInstance=AQ}readValueFromInstance(e,t){var s;if(Eh.has(t))return(s=this.projection)!=null&&s.isProjecting?t1(t):j8(e,t);{const r=w7(e),n=(zP(t)?r.getPropertyValue(t):r[t])||0;return typeof n=="string"?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return TQ(e,t)}build(e,t,s){zb(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return Nb(e,t,s)}}const k7={offset:"stroke-dashoffset",array:"stroke-dasharray"},T7={offset:"strokeDashoffset",array:"strokeDasharray"};function A7(i,e,t=1,s=0,r=!0){i.pathLength=1;const n=r?k7:T7;i[n.offset]=`${-s}`,i[n.array]=`${e} ${t}`}const M7=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function EQ(i,{attrX:e,attrY:t,attrScale:s,pathLength:r,pathSpacing:n=1,pathOffset:o=0,...l},c,u,d){if(zb(i,l,u),c){i.style.viewBox&&(i.attrs.viewBox=i.style.viewBox);return}i.attrs=i.style,i.style={};const{attrs:m,style:g}=i;m.transform&&(g.transform=m.transform,delete m.transform),(g.transform||m.transformOrigin)&&(g.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),g.transform&&(g.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete m.transformBox);for(const _ of M7)m[_]!==void 0&&(g[_]=m[_],delete m[_]);e!==void 0&&(m.x=e),t!==void 0&&(m.y=t),s!==void 0&&(m.scale=s),r!==void 0&&A7(m,r,n,o,!1)}const PQ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),QQ=i=>typeof i=="string"&&i.toLowerCase()==="svg";function E7(i,e,t,s){AQ(i,e,void 0,s);for(const r in e.attrs)i.setAttribute(PQ.has(r)?r:Pb(r),e.attrs[r])}function RQ(i,e,t){const s=Nb(i,e,t);for(const r in i)if(Ii(i[r])||Ii(e[r])){const n=Mh.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[n]=i[r]}return s}class P7 extends xQ{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ii}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Eh.has(t)){const s=fQ(t);return s&&s.default||0}return t=PQ.has(t)?t:Pb(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return RQ(e,t,s)}build(e,t,s){EQ(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,r){E7(e,t,s,r)}mount(e){this.isSVGTag=QQ(e.tagName),super.mount(e)}}const Q7=Db.length;function LQ(i){if(!i)return;if(!i.isControllingVariants){const t=i.parent?LQ(i.parent)||{}:{};return i.props.initial!==void 0&&(t.initial=i.props.initial),t}const e={};for(let t=0;t<Q7;t++){const s=Db[t],r=i.props[s];(Lu(r)||r===!1)&&(e[s]=r)}return e}function $Q(i,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==i.length)return!1;for(let s=0;s<t;s++)if(e[s]!==i[s])return!1;return!0}const R7=[...Bb].reverse(),L7=Bb.length;function $7(i){return e=>Promise.all(e.map(({animation:t,options:s})=>EN(i,t,s)))}function B7(i){let e=$7(i),t=I2(),s=!0;const r=c=>(u,d)=>{var g;const m=nh(i,d,c==="exit"?(g=i.presenceContext)==null?void 0:g.custom:void 0);if(m){const{transition:_,transitionEnd:y,...b}=m;u={...u,...b,...y}}return u};function n(c){e=c(i)}function o(c){const{props:u}=i,d=LQ(i.parent)||{},m=[],g=new Set;let _={},y=1/0;for(let x=0;x<L7;x++){const w=R7[x],k=t[w],C=u[w]!==void 0?u[w]:d[w],A=Lu(C),P=w===c?k.isActive:null;P===!1&&(y=x);let E=C===d[w]&&C!==u[w]&&A;if(E&&s&&i.manuallyAnimateOnMount&&(E=!1),k.protectedKeys={..._},!k.isActive&&P===null||!C&&!k.prevProp||rg(C)||typeof C=="boolean")continue;if(w==="exit"&&k.isActive&&P!==!0){k.prevResolvedValues&&(_={..._,...k.prevResolvedValues});continue}const $=D7(k.prevProp,C);let z=$||w===c&&k.isActive&&!E&&A||x>y&&A,I=!1;const se=Array.isArray(C)?C:[C];let F=se.reduce(r(w),{});P===!1&&(F={});const{prevResolvedValues:R={}}=k,L={...R,...F},N=X=>{z=!0,g.has(X)&&(I=!0,g.delete(X)),k.needsAnimating[X]=!0;const W=i.getValue(X);W&&(W.liveStyle=!1)};for(const X in L){const W=F[X],U=R[X];if(_.hasOwnProperty(X))continue;let q=!1;a1(W)&&a1(U)?q=!$Q(W,U):q=W!==U,q?W!=null?N(X):g.add(X):W!==void 0&&g.has(X)?N(X):k.protectedKeys[X]=!0}k.prevProp=C,k.prevResolvedValues=F,k.isActive&&(_={..._,...F}),s&&i.blockInitialAnimation&&(z=!1);const Z=E&&$;z&&(!Z||I)&&m.push(...se.map(X=>{const W={type:w};if(typeof X=="string"&&s&&!Z&&i.manuallyAnimateOnMount&&i.parent){const{parent:U}=i,q=nh(U,X);if(U.enteringChildren&&q){const{delayChildren:D}=q.transition||{};W.delay=sQ(U.enteringChildren,i,D)}}return{animation:X,options:W}}))}if(g.size){const x={};if(typeof u.initial!="boolean"){const w=nh(i,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(x.transition=w.transition)}g.forEach(w=>{const k=i.getBaseTarget(w),C=i.getValue(w);C&&(C.liveStyle=!0),x[w]=k??null}),m.push({animation:x})}let b=!!m.length;return s&&(u.initial===!1||u.initial===u.animate)&&!i.manuallyAnimateOnMount&&(b=!1),s=!1,b?e(m):Promise.resolve()}function l(c,u){var m;if(t[c].isActive===u)return Promise.resolve();(m=i.variantChildren)==null||m.forEach(g=>{var _;return(_=g.animationState)==null?void 0:_.setActive(c,u)}),t[c].isActive=u;const d=o(c);for(const g in t)t[g].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:n,getState:()=>t,reset:()=>{t=I2()}}}function D7(i,e){return typeof e=="string"?e!==i:Array.isArray(e)?!$Q(e,i):!1}function Oa(i=!1){return{isActive:i,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function I2(){return{animate:Oa(!0),whileInView:Oa(),whileHover:Oa(),whileTap:Oa(),whileDrag:Oa(),whileFocus:Oa(),exit:Oa()}}function q2(i,e){i.min=e.min,i.max=e.max}function mr(i,e){q2(i.x,e.x),q2(i.y,e.y)}function W2(i,e){i.translate=e.translate,i.scale=e.scale,i.originPoint=e.originPoint,i.origin=e.origin}const BQ=1e-4,z7=1-BQ,N7=1+BQ,DQ=.01,X7=0-DQ,V7=0+DQ;function es(i){return i.max-i.min}function Z7(i,e,t){return Math.abs(i-e)<=t}function U2(i,e,t,s=.5){i.origin=s,i.originPoint=kt(e.min,e.max,i.origin),i.scale=es(t)/es(e),i.translate=kt(t.min,t.max,i.origin)-i.originPoint,(i.scale>=z7&&i.scale<=N7||isNaN(i.scale))&&(i.scale=1),(i.translate>=X7&&i.translate<=V7||isNaN(i.translate))&&(i.translate=0)}function vu(i,e,t,s){U2(i.x,e.x,t.x,s?s.originX:void 0),U2(i.y,e.y,t.y,s?s.originY:void 0)}function Y2(i,e,t){i.min=t.min+e.min,i.max=i.min+es(e)}function j7(i,e,t){Y2(i.x,e.x,t.x),Y2(i.y,e.y,t.y)}function H2(i,e,t){i.min=e.min-t.min,i.max=i.min+es(e)}function gm(i,e,t){H2(i.x,e.x,t.x),H2(i.y,e.y,t.y)}function F2(i,e,t,s,r){return i-=e,i=mm(i,1/t,s),r!==void 0&&(i=mm(i,1/r,s)),i}function I7(i,e=0,t=1,s=.5,r,n=i,o=i){if(Gr.test(e)&&(e=parseFloat(e),e=kt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=kt(n.min,n.max,s);i===n&&(l-=e),i.min=F2(i.min,e,t,l,r),i.max=F2(i.max,e,t,l,r)}function G2(i,e,[t,s,r],n,o){I7(i,e[t],e[s],e[r],e.scale,n,o)}const q7=["x","scaleX","originX"],W7=["y","scaleY","originY"];function K2(i,e,t,s){G2(i.x,e,q7,t?t.x:void 0,s?s.x:void 0),G2(i.y,e,W7,t?t.y:void 0,s?s.y:void 0)}function J2(i){return i.translate===0&&i.scale===1}function zQ(i){return J2(i.x)&&J2(i.y)}function e5(i,e){return i.min===e.min&&i.max===e.max}function U7(i,e){return e5(i.x,e.x)&&e5(i.y,e.y)}function t5(i,e){return Math.round(i.min)===Math.round(e.min)&&Math.round(i.max)===Math.round(e.max)}function NQ(i,e){return t5(i.x,e.x)&&t5(i.y,e.y)}function i5(i){return es(i.x)/es(i.y)}function s5(i,e){return i.translate===e.translate&&i.scale===e.scale&&i.originPoint===e.originPoint}function Zr(i){return[i("x"),i("y")]}function Y7(i,e,t){let s="";const r=i.x.translate/e.x,n=i.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((r||n||o)&&(s=`translate3d(${r}px, ${n}px, ${o}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:u,rotate:d,rotateX:m,rotateY:g,skewX:_,skewY:y}=t;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),m&&(s+=`rotateX(${m}deg) `),g&&(s+=`rotateY(${g}deg) `),_&&(s+=`skewX(${_}deg) `),y&&(s+=`skewY(${y}deg) `)}const l=i.x.scale*e.x,c=i.y.scale*e.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const XQ=["TopLeft","TopRight","BottomLeft","BottomRight"],H7=XQ.length,r5=i=>typeof i=="string"?parseFloat(i):i,n5=i=>typeof i=="number"||xe.test(i);function F7(i,e,t,s,r,n){r?(i.opacity=kt(0,t.opacity??1,G7(s)),i.opacityExit=kt(e.opacity??1,0,K7(s))):n&&(i.opacity=kt(e.opacity??1,t.opacity??1,s));for(let o=0;o<H7;o++){const l=`border${XQ[o]}Radius`;let c=o5(e,l),u=o5(t,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||n5(c)===n5(u)?(i[l]=Math.max(kt(r5(c),r5(u),s),0),(Gr.test(u)||Gr.test(c))&&(i[l]+="%")):i[l]=u}(e.rotate||t.rotate)&&(i.rotate=kt(e.rotate||0,t.rotate||0,s))}function o5(i,e){return i[e]!==void 0?i[e]:i.borderRadius}const G7=VQ(0,.5,QP),K7=VQ(.5,.95,ar);function VQ(i,e,t){return s=>s<i?0:s>e?1:t(Pu(i,e,s))}function J7(i,e,t){const s=Ii(i)?i:mh(i);return s.start(Mb("",s,e,t)),s.animation}function $u(i,e,t,s={passive:!0}){return i.addEventListener(e,t,s),()=>i.removeEventListener(e,t)}const eX=(i,e)=>i.depth-e.depth;class tX{constructor(){this.children=[],this.isDirty=!1}add(e){pb(this.children,e),this.isDirty=!0}remove(e){cm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(eX),this.isDirty=!1,this.children.forEach(e)}}function iX(i,e){const t=Ji.now(),s=({timestamp:r})=>{const n=r-t;n>=e&&(Zo(s),i(n-e))};return pt.setup(s,!0),()=>Zo(s)}function Xp(i){return Ii(i)?i.get():i}class sX{constructor(){this.members=[]}add(e){pb(this.members,e);for(let t=this.members.length-1;t>=0;t--){const s=this.members[t];if(s===e||s===this.lead||s===this.prevLead)continue;const r=s.instance;r&&r.isConnected===!1&&s.isPresent!==!1&&!s.snapshot&&cm(this.members,s)}e.scheduleRender()}remove(e){if(cm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(r=>e===r);if(t===0)return!1;let s;for(let r=t;r>=0;r--){const n=this.members[r],o=n.instance;if(n.isPresent!==!1&&(!o||o.isConnected!==!1)){s=n;break}}return s?(this.promote(s),!0):!1}promote(e,t){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();const r=s.options.layoutDependency,n=e.options.layoutDependency;if(!(r!==void 0&&n!==void 0&&r===n)){const c=s.instance;c&&c.isConnected===!1&&!s.snapshot||(e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:l}=e.options;l===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Vp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},e_=["","X","Y","Z"],rX=1e3;let nX=0;function t_(i,e,t,s){const{latestValues:r}=e;r[i]&&(t[i]=r[i],e.setStaticValue(i,0),s&&(s[i]=0))}function ZQ(i){if(i.hasCheckedOptimisedAppear=!0,i.root===i)return;const{visualElement:e}=i.options;if(!e)return;const t=lQ(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:n}=i.options;window.MotionCancelOptimisedAnimation(t,"transform",pt,!(r||n))}const{parent:s}=i;s&&!s.hasCheckedOptimisedAppear&&ZQ(s)}function jQ({attachResizeListener:i,defaultParent:e,measureScroll:t,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(o={},l=e==null?void 0:e()){this.id=nX++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lX),this.nodes.forEach(fX),this.nodes.forEach(dX),this.nodes.forEach(hX)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new tX)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new gb),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=$b(o)&&!a7(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),i){let d,m=0;const g=()=>this.root.updateBlockedByResize=!1;pt.read(()=>{m=window.innerWidth}),i(o,()=>{const _=window.innerWidth;_!==m&&(m=_,this.root.updateBlockedByResize=!0,d&&d(),d=iX(g,250),Vp.hasAnimatedSinceResize&&(Vp.hasAnimatedSinceResize=!1,this.nodes.forEach(h5)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:m,hasRelativeLayoutChanged:g,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||_X,{onLayoutAnimationStart:b,onLayoutAnimationComplete:x}=u.getProps(),w=!this.targetLayout||!NQ(this.targetLayout,_),k=!m&&g;if(this.options.layoutRoot||this.resumeFrom||k||m&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...Ab(y,"layout"),onPlay:b,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(d,k)}else m||h5(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Zo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pX),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZQ(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const m=this.path[d];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(a5);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(l5);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(uX),this.nodes.forEach(oX),this.nodes.forEach(aX)):this.nodes.forEach(l5),this.clearAllSnapshots();const l=Ji.now();Pi.delta=tn(0,1e3/60,l-Pi.timestamp),Pi.timestamp=l,Pi.isProcessing=!0,W0.update.process(Pi),W0.preRender.process(Pi),W0.render.process(Pi),Pi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Rb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cX),this.sharedNodes.forEach(mX)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!es(this.snapshot.measuredBox.x)&&!es(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ii(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!zQ(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||xa(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),vX(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return ii();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(yX))){const{scroll:d}=this.root;d&&(Gl(l.x,d.offset.x),Gl(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=ii();if(mr(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:m,options:g}=d;d!==this.root&&m&&g.layoutScroll&&(m.wasRoot&&mr(l,o),Gl(l.x,m.offset.x),Gl(l.y,m.offset.y))}return l}applyTransform(o,l=!1){const c=ii();mr(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Kl(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),xa(d.latestValues)&&Kl(c,d.latestValues)}return xa(this.latestValues)&&Kl(c,this.latestValues),c}removeTransform(o){const l=ii();mr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!xa(u.latestValues))continue;d1(u.latestValues)&&u.updateSnapshot();const d=ii(),m=u.measurePageBox();mr(d,m),K2(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return xa(this.latestValues)&&K2(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var _;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(_=this.parent)!=null&&_.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:m}=this.options;if(!this.layout||!(d||m))return;this.resolvedRelativeTargetAt=Pi.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ii(),this.targetWithTransforms=ii()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j7(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):mr(this.target,this.layout.layoutBox),kQ(this.target,this.targetDelta)):mr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||d1(this.parent.latestValues)||CQ(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ii(),this.relativeTargetOrigin=ii(),gm(this.relativeTargetOrigin,l,c),mr(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Pi.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;mr(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,g=this.treeScale.y;_7(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ii());const{target:_}=o;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(W2(this.prevProjectionDelta.x,this.projectionDelta.x),W2(this.prevProjectionDelta.y,this.projectionDelta.y)),vu(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==g||!s5(this.projectionDelta.x,this.prevProjectionDelta.x)||!s5(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fl(),this.projectionDelta=Fl(),this.projectionDeltaWithTransform=Fl()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},m=Fl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=ii(),_=c?c.source:void 0,y=this.layout?this.layout.source:void 0,b=_!==y,x=this.getStack(),w=!x||x.members.length<=1,k=!!(b&&!w&&this.options.crossfade===!0&&!this.path.some(OX));this.animationProgress=0;let C;this.mixTargetDelta=A=>{const P=A/1e3;c5(m.x,o.x,P),c5(m.y,o.y,P),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gm(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gX(this.relativeTarget,this.relativeTargetOrigin,g,P),C&&U7(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=ii()),mr(C,this.relativeTarget)),b&&(this.animationValues=d,F7(d,u,this.latestValues,P,k,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Zo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pt.update(()=>{Vp.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mh(0)),this.motionValue.jump(0,!1),this.currentAnimation=J7(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(rX),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&IQ(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ii();const m=es(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+m;const g=es(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+g}mr(l,c),Kl(l,d),vu(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new sX),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&t_("z",o,u,this.animationValues);for(let d=0;d<e_.length;d++)t_(`rotate${e_[d]}`,o,u,this.animationValues),t_(`skew${e_[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Xp(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Xp(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!xa(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let m=Y7(this.projectionDeltaWithTransform,this.treeScale,d);c&&(m=c(d,m)),o.transform=m;const{x:g,y:_}=this.projectionDelta;o.transformOrigin=`${g.origin*100}% ${_.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const y in m1){if(d[y]===void 0)continue;const{correct:b,applyTo:x,isCSSVariable:w}=m1[y],k=m==="none"?d[y]:b(d[y],u);if(x){const C=x.length;for(let A=0;A<C;A++)o[x[A]]=k}else w?this.options.visualElement.renderState.vars[y]=k:o[y]=k}this.options.layoutId&&(o.pointerEvents=u===this?Xp(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(a5),this.root.sharedNodes.clear()}}}function oX(i){i.updateLayout()}function aX(i){var t;const e=((t=i.resumeFrom)==null?void 0:t.snapshot)||i.snapshot;if(i.isLead()&&i.layout&&e&&i.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=i.layout,{animationType:n}=i.options,o=e.source!==i.layout.source;n==="size"?Zr(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],_=es(g);g.min=s[m].min,g.max=g.min+_}):IQ(n,e.layoutBox,s)&&Zr(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],_=es(s[m]);g.max=g.min+_,i.relativeTarget&&!i.currentAnimation&&(i.isProjectionDirty=!0,i.relativeTarget[m].max=i.relativeTarget[m].min+_)});const l=Fl();vu(l,s,e.layoutBox);const c=Fl();o?vu(c,i.applyTransform(r,!0),e.measuredBox):vu(c,s,e.layoutBox);const u=!zQ(l);let d=!1;if(!i.resumeFrom){const m=i.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:g,layout:_}=m;if(g&&_){const y=ii();gm(y,e.layoutBox,g.layoutBox);const b=ii();gm(b,s,_.layoutBox),NQ(y,b)||(d=!0),m.options.layoutRoot&&(i.relativeTarget=b,i.relativeTargetOrigin=y,i.relativeParent=m)}}}i.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(i.isLead()){const{onExitComplete:s}=i.options;s&&s()}i.options.transition=void 0}function lX(i){i.parent&&(i.isProjecting()||(i.isProjectionDirty=i.parent.isProjectionDirty),i.isSharedProjectionDirty||(i.isSharedProjectionDirty=!!(i.isProjectionDirty||i.parent.isProjectionDirty||i.parent.isSharedProjectionDirty)),i.isTransformDirty||(i.isTransformDirty=i.parent.isTransformDirty))}function hX(i){i.isProjectionDirty=i.isSharedProjectionDirty=i.isTransformDirty=!1}function cX(i){i.clearSnapshot()}function a5(i){i.clearMeasurements()}function l5(i){i.isLayoutDirty=!1}function uX(i){const{visualElement:e}=i.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),i.resetTransform()}function h5(i){i.finishAnimation(),i.targetDelta=i.relativeTarget=i.target=void 0,i.isProjectionDirty=!0}function fX(i){i.resolveTargetDelta()}function dX(i){i.calcProjection()}function pX(i){i.resetSkewAndRotation()}function mX(i){i.removeLeadSnapshot()}function c5(i,e,t){i.translate=kt(e.translate,0,t),i.scale=kt(e.scale,1,t),i.origin=e.origin,i.originPoint=e.originPoint}function u5(i,e,t,s){i.min=kt(e.min,t.min,s),i.max=kt(e.max,t.max,s)}function gX(i,e,t,s){u5(i.x,e.x,t.x,s),u5(i.y,e.y,t.y,s)}function OX(i){return i.animationValues&&i.animationValues.opacityExit!==void 0}const _X={duration:.45,ease:[.4,0,.1,1]},f5=i=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(i),d5=f5("applewebkit/")&&!f5("chrome/")?Math.round:ar;function p5(i){i.min=d5(i.min),i.max=d5(i.max)}function vX(i){p5(i.x),p5(i.y)}function IQ(i,e,t){return i==="position"||i==="preserve-aspect"&&!Z7(i5(e),i5(t),.2)}function yX(i){var e;return i!==i.root&&((e=i.scroll)==null?void 0:e.wasRoot)}const bX=jQ({attachResizeListener:(i,e)=>$u(i,"resize",e),measureScroll:()=>{var i,e;return{x:document.documentElement.scrollLeft||((i=document.body)==null?void 0:i.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),i_={current:void 0},qQ=jQ({measureScroll:i=>({x:i.scrollLeft,y:i.scrollTop}),defaultParent:()=>{if(!i_.current){const i=new bX({});i.mount(window),i.setOptions({layoutScroll:!0}),i_.current=i}return i_.current},resetTransform:(i,e)=>{i.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:i=>window.getComputedStyle(i).position==="fixed"}),WQ=Y.createContext({transformPagePoint:i=>i,isStatic:!1,reducedMotion:"never"});function SX(i=!0){const e=Y.useContext(db);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=Y.useId();Y.useEffect(()=>{if(i)return r(n)},[i]);const o=Y.useCallback(()=>i&&s&&s(n),[n,s,i]);return!t&&s?[!1,o]:[!0]}const UQ=Y.createContext({strict:!1}),m5={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let g5=!1;function xX(){if(g5)return;const i={};for(const e in m5)i[e]={isEnabled:t=>m5[e].some(s=>!!t[s])};SQ(i),g5=!0}function YQ(){return xX(),p7()}function wX(i){const e=YQ();for(const t in i)e[t]={...e[t],...i[t]};SQ(e)}const CX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Om(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||CX.has(i)}let HQ=i=>!Om(i);function kX(i){typeof i=="function"&&(HQ=e=>e.startsWith("on")?!Om(e):i(e))}try{kX(require("@emotion/is-prop-valid").default)}catch{}function TX(i,e,t){const s={};for(const r in i)r==="values"&&typeof i.values=="object"||(HQ(r)||t===!0&&Om(r)||!e&&!Om(r)||i.draggable&&r.startsWith("onDrag"))&&(s[r]=i[r]);return s}const og=Y.createContext({});function AX(i,e){if(ng(i)){const{initial:t,animate:s}=i;return{initial:t===!1||Lu(t)?t:void 0,animate:Lu(s)?s:void 0}}return i.inherit!==!1?e:{}}function MX(i){const{initial:e,animate:t}=AX(i,Y.useContext(og));return Y.useMemo(()=>({initial:e,animate:t}),[O5(e),O5(t)])}function O5(i){return Array.isArray(i)?i.join(" "):i}const Xb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function FQ(i,e,t){for(const s in e)!Ii(e[s])&&!MQ(s,t)&&(i[s]=e[s])}function EX({transformTemplate:i},e){return Y.useMemo(()=>{const t=Xb();return zb(t,e,i),Object.assign({},t.vars,t.style)},[e])}function PX(i,e){const t=i.style||{},s={};return FQ(s,t,i),Object.assign(s,EX(i,e)),s}function QX(i,e){const t={},s=PX(i,e);return i.drag&&i.dragListener!==!1&&(t.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(t.tabIndex=0),t.style=s,t}const GQ=()=>({...Xb(),attrs:{}});function RX(i,e,t,s){const r=Y.useMemo(()=>{const n=GQ();return EQ(n,e,QQ(s),i.transformTemplate,i.style),{...n.attrs,style:{...n.style}}},[e]);if(i.style){const n={};FQ(n,i.style,i),r.style={...n,...r.style}}return r}const LX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vb(i){return typeof i!="string"||i.includes("-")?!1:!!(LX.indexOf(i)>-1||/[A-Z]/u.test(i))}function $X(i,e,t,{latestValues:s},r,n=!1,o){const c=(o??Vb(i)?RX:QX)(e,s,r,i),u=TX(e,typeof i=="string",n),d=i!==Y.Fragment?{...u,...c,ref:t}:{},{children:m}=e,g=Y.useMemo(()=>Ii(m)?m.get():m,[m]);return Y.createElement(i,{...d,children:g})}function BX({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:DX(t,s,r,i),renderState:e()}}function DX(i,e,t,s){const r={},n=s(i,{});for(const g in n)r[g]=Xp(n[g]);let{initial:o,animate:l}=i;const c=ng(i),u=yQ(i);e&&u&&!c&&i.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=t?t.initial===!1:!1;d=d||o===!1;const m=d?l:o;if(m&&typeof m!="boolean"&&!rg(m)){const g=Array.isArray(m)?m:[m];for(let _=0;_<g.length;_++){const y=Eb(i,g[_]);if(y){const{transitionEnd:b,transition:x,...w}=y;for(const k in w){let C=w[k];if(Array.isArray(C)){const A=d?C.length-1:0;C=C[A]}C!==null&&(r[k]=C)}for(const k in b)r[k]=b[k]}}}return r}const KQ=i=>(e,t)=>{const s=Y.useContext(og),r=Y.useContext(db),n=()=>BX(i,e,s,r);return t?n():Nz(n)},zX=KQ({scrapeMotionValuesFromProps:Nb,createRenderState:Xb}),NX=KQ({scrapeMotionValuesFromProps:RQ,createRenderState:GQ}),XX=Symbol.for("motionComponentSymbol");function VX(i,e,t){const s=Y.useRef(t);Y.useInsertionEffect(()=>{s.current=t});const r=Y.useRef(null);return Y.useCallback(n=>{var l;n&&((l=i.onMount)==null||l.call(i,n)),e&&(n?e.mount(n):e.unmount());const o=s.current;if(typeof o=="function")if(n){const c=o(n);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):o(n);else o&&(o.current=n)},[e])}const JQ=Y.createContext({});function Il(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function ZX(i,e,t,s,r,n){var C,A;const{visualElement:o}=Y.useContext(og),l=Y.useContext(UQ),c=Y.useContext(db),u=Y.useContext(WQ),d=u.reducedMotion,m=u.skipAnimations,g=Y.useRef(null),_=Y.useRef(!1);s=s||l.renderer,!g.current&&s&&(g.current=s(i,{visualState:e,parent:o,props:t,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:m,isSVG:n}),_.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const y=g.current,b=Y.useContext(JQ);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&jX(g.current,t,r,b);const x=Y.useRef(!1);Y.useInsertionEffect(()=>{y&&x.current&&y.update(t,c)});const w=t[aQ],k=Y.useRef(!!w&&!((C=window.MotionHandoffIsComplete)!=null&&C.call(window,w))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,w)));return Xz(()=>{_.current=!0,y&&(x.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),k.current&&y.animationState&&y.animationState.animateChanges())}),Y.useEffect(()=>{y&&(!k.current&&y.animationState&&y.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var P;(P=window.MotionHandoffMarkAsComplete)==null||P.call(window,w)}),k.current=!1),y.enteringChildren=void 0)}),y}function jX(i,e,t,s){const{layoutId:r,layout:n,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;i.projection=new t(i.latestValues,e["data-framer-portal-id"]?void 0:eR(i.parent)),i.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!o||l&&Il(l),visualElement:i,animationType:typeof n=="string"?n:"both",initialPromotionConfig:s,crossfade:d,layoutScroll:c,layoutRoot:u})}function eR(i){if(i)return i.options.allowProjection!==!1?i.projection:eR(i.parent)}function s_(i,{forwardMotionProps:e=!1,type:t}={},s,r){s&&wX(s);const n=t?t==="svg":Vb(i),o=n?NX:zX;function l(u,d){let m;const g={...Y.useContext(WQ),...u,layoutId:IX(u)},{isStatic:_}=g,y=MX(u),b=o(u,_);if(!_&&yP){qX();const x=WX(g);m=x.MeasureLayout,y.visualElement=ZX(i,b,g,r,x.ProjectionNode,n)}return M.jsxs(og.Provider,{value:y,children:[m&&y.visualElement?M.jsx(m,{visualElement:y.visualElement,...g}):null,$X(i,u,VX(b,y.visualElement,d),b,_,e,n)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const c=Y.forwardRef(l);return c[XX]=i,c}function IX({layoutId:i}){const e=Y.useContext(vP).id;return e&&i!==void 0?e+"-"+i:i}function qX(i,e){Y.useContext(UQ).strict}function WX(i){const e=YQ(),{drag:t,layout:s}=e;if(!t&&!s)return{};const r={...t,...s};return{MeasureLayout:t!=null&&t.isEnabled(i)||s!=null&&s.isEnabled(i)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function UX(i,e){if(typeof Proxy>"u")return s_;const t=new Map,s=(n,o)=>s_(n,o,i,e),r=(n,o)=>s(n,o);return new Proxy(r,{get:(n,o)=>o==="create"?s:(t.has(o)||t.set(o,s_(o,void 0,i,e)),t.get(o))})}const YX=(i,e)=>e.isSVG??Vb(i)?new P7(e):new C7(e,{allowProjection:i!==Y.Fragment});class HX extends Fo{constructor(e){super(e),e.animationState||(e.animationState=B7(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();rg(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let FX=0;class GX extends Fo{constructor(){super(...arguments),this.id=FX++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const KX={animation:{Feature:HX},exit:{Feature:GX}};function gf(i){return{point:{x:i.pageX,y:i.pageY}}}const JX=i=>e=>Lb(e)&&i(e,gf(e));function yu(i,e,t,s){return $u(i,e,JX(t),s)}const tR=({current:i})=>i?i.ownerDocument.defaultView:null,_5=(i,e)=>Math.abs(i-e);function eV(i,e){const t=_5(i.x,e.x),s=_5(i.y,e.y);return Math.sqrt(t**2+s**2)}const v5=new Set(["auto","scroll"]);class iR{constructor(e,t,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:n=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=n_(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,b=eV(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!b)return;const{point:x}=_,{timestamp:w}=Pi;this.history.push({...x,timestamp:w});const{onStart:k,onMove:C}=this.handlers;y||(k&&k(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,_)},this.handlePointerMove=(_,y)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=r_(y,this.transformPagePoint),pt.update(this.updatePoint,!0)},this.handlePointerUp=(_,y)=>{this.end();const{onEnd:b,onSessionEnd:x,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=n_(_.type==="pointercancel"?this.lastMoveEventInfo:r_(y,this.transformPagePoint),this.history);this.startEvent&&b&&b(_,k),x&&x(_,k)},!Lb(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const c=gf(e),u=r_(c,this.transformPagePoint),{point:d}=u,{timestamp:m}=Pi;this.history=[{...d,timestamp:m}];const{onSessionStart:g}=t;g&&g(e,n_(u,this.history)),this.removeListeners=df(yu(this.contextWindow,"pointermove",this.handlePointerMove),yu(this.contextWindow,"pointerup",this.handlePointerUp),yu(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(e){let t=e.parentElement;for(;t;){const s=getComputedStyle(t);(v5.has(s.overflowX)||v5.has(s.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},n={x:r.x-t.x,y:r.y-t.y};n.x===0&&n.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=n.x,this.lastMoveEventInfo.point.y+=n.y):this.history.length>0&&(this.history[0].x-=n.x,this.history[0].y-=n.y),this.scrollPositions.set(e,r),pt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Zo(this.updatePoint)}}function r_(i,e){return e?{point:e(i.point)}:i}function y5(i,e){return{x:i.x-e.x,y:i.y-e.y}}function n_({point:i},e){return{point:i,delta:y5(i,sR(e)),offset:y5(i,tV(e)),velocity:iV(e,.1)}}function tV(i){return i[0]}function sR(i){return i[i.length-1]}function iV(i,e){if(i.length<2)return{x:0,y:0};let t=i.length-1,s=null;const r=sR(i);for(;t>=0&&(s=i[t],!(r.timestamp-s.timestamp>br(e)));)t--;if(!s)return{x:0,y:0};s===i[0]&&i.length>2&&r.timestamp-s.timestamp>br(e)*2&&(s=i[1]);const n=tr(r.timestamp-s.timestamp);if(n===0)return{x:0,y:0};const o={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function sV(i,{min:e,max:t},s){return e!==void 0&&i<e?i=s?kt(e,i,s.min):Math.max(i,e):t!==void 0&&i>t&&(i=s?kt(t,i,s.max):Math.min(i,t)),i}function b5(i,e,t){return{min:e!==void 0?i.min+e:void 0,max:t!==void 0?i.max+t-(i.max-i.min):void 0}}function rV(i,{top:e,left:t,bottom:s,right:r}){return{x:b5(i.x,t,r),y:b5(i.y,e,s)}}function S5(i,e){let t=e.min-i.min,s=e.max-i.max;return e.max-e.min<i.max-i.min&&([t,s]=[s,t]),{min:t,max:s}}function nV(i,e){return{x:S5(i.x,e.x),y:S5(i.y,e.y)}}function oV(i,e){let t=.5;const s=es(i),r=es(e);return r>s?t=Pu(e.min,e.max-s,i.min):s>r&&(t=Pu(i.min,i.max-r,e.min)),tn(0,1,t)}function aV(i,e){const t={};return e.min!==void 0&&(t.min=e.min-i.min),e.max!==void 0&&(t.max=e.max-i.min),t}const g1=.35;function lV(i=g1){return i===!1?i=0:i===!0&&(i=g1),{x:x5(i,"left","right"),y:x5(i,"top","bottom")}}function x5(i,e,t){return{min:w5(i,e),max:w5(i,t)}}function w5(i,e){return typeof i=="number"?i:i[e]||0}const hV=new WeakMap;class cV{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ii(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const n=m=>{t&&this.snapToCursor(gf(m).point),this.stopAnimation()},o=(m,g)=>{const{drag:_,dragPropagation:y,onDragStart:b}=this.getProps();if(_&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=IN(_),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Zr(w=>{let k=this.getAxisMotionValue(w).get()||0;if(Gr.test(k)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[w];A&&(k=es(A)*(parseFloat(k)/100))}}this.originPoint[w]=k}),b&&pt.update(()=>b(m,g),!1,!0),l1(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g;const{dragPropagation:_,dragDirectionLock:y,onDirectionLock:b,onDrag:x}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:w}=g;if(y&&this.currentDirection===null){this.currentDirection=fV(w),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",g.point,w),this.updateAxis("y",g.point,w),this.visualElement.render(),x&&pt.update(()=>x(m,g),!1,!0)},c=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g,this.stop(m,g),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new iR(e,{onSessionStart:n,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:tR(this.visualElement),element:this.visualElement.current})}stop(e,t){const s=e||this.latestPointerEvent,r=t||this.latestPanInfo,n=this.isDragging;if(this.cancel(),!n||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&pt.postRender(()=>l(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){const{drag:r}=this.getProps();if(!s||!Gd(e,r,this.currentDirection))return;const n=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=sV(o,this.constraints[e],this.elastic[e])),n.set(o)}resolveConstraints(){var n;const{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)==null?void 0:n.layout,r=this.constraints;e&&Il(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=rV(s.layoutBox,e):this.constraints=!1,this.elastic=lV(t),r!==this.constraints&&!Il(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&Zr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=aV(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Il(e))return!1;const s=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const n=v7(s,r.root,this.visualElement.getTransformPagePoint());let o=nV(r.layout.layoutBox,n);if(t){const l=t(g7(o));this.hasMutatedConstraints=!!l,l&&(o=wQ(l))}return o}startAnimation(e){const{drag:t,dragMomentum:s,dragElastic:r,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Zr(d=>{if(!Gd(d,t,this.currentDirection))return;let m=c&&c[d]||{};o&&(m={min:0,max:0});const g=r?200:1e6,_=r?40:1e7,y={type:"inertia",velocity:s?e[d]:0,bounceStiffness:g,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...n,...m};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,t){const s=this.getAxisMotionValue(e);return l1(this.visualElement,e),s.start(Mb(e,s,0,t,this.visualElement,!1))}stopAnimation(){Zr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[t];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){Zr(t=>{const{drag:s}=this.getProps();if(!Gd(t,s,this.currentDirection))return;const{projection:r}=this.visualElement,n=this.getAxisMotionValue(t);if(r&&r.layout){const{min:o,max:l}=r.layout.layoutBox[t],c=n.get()||0;n.set(e[t]-kt(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!Il(t)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Zr(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();r[o]=oV({min:c,max:c},this.constraints[o])}});const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),Zr(o=>{if(!Gd(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(kt(c,u,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;hV.set(this.visualElement,this);const e=this.visualElement.current,t=yu(e,"pointerdown",u=>{const{drag:d,dragListener:m=!0}=this.getProps(),g=u.target,_=g!==e&&FN(g);d&&m&&!_&&this.start(u)});let s;const r=()=>{const{dragConstraints:u}=this.getProps();Il(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),s||(s=uV(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:n}=this.visualElement,o=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),pt.read(r);const l=$u(window,"resize",()=>this.scalePositionWithinConstraints()),c=n.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Zr(m=>{const g=this.getAxisMotionValue(m);g&&(this.originPoint[m]+=u[m].translate,g.set(g.get()+u[m].translate))}),this.visualElement.render())}));return()=>{l(),t(),o(),c&&c(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:n=!1,dragElastic:o=g1,dragMomentum:l=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:n,dragElastic:o,dragMomentum:l}}}function C5(i){let e=!0;return()=>{if(e){e=!1;return}i()}}function uV(i,e,t){const s=L2(i,C5(t)),r=L2(e,C5(t));return()=>{s(),r()}}function Gd(i,e,t){return(e===!0||e===i)&&(t===null||t===i)}function fV(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class dV extends Fo{constructor(e){super(e),this.removeGroupControls=ar,this.removeListeners=ar,this.controls=new cV(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ar}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const o_=i=>(e,t)=>{i&&pt.update(()=>i(e,t),!1,!0)};class pV extends Fo{constructor(){super(...arguments),this.removePointerDownListener=ar}onPointerDown(e){this.session=new iR(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tR(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:o_(e),onStart:o_(t),onMove:o_(s),onEnd:(n,o)=>{delete this.session,r&&pt.postRender(()=>r(n,o))}}}mount(){this.removePointerDownListener=yu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let a_=!1;class mV extends Y.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:n}=e;n&&(t.group&&t.group.add(n),s&&s.register&&r&&s.register(n),a_&&n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Vp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:s,drag:r,isPresent:n}=this.props,{projection:o}=s;return o&&(o.isPresent=n,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),a_=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==n?o.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?o.promote():o.relegate()||pt.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Rb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;a_=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rR(i){const[e,t]=SX(),s=Y.useContext(vP);return M.jsx(mV,{...i,layoutGroup:s,switchLayoutGroup:Y.useContext(JQ),isPresent:e,safeToRemove:t})}const gV={pan:{Feature:pV},drag:{Feature:dV,ProjectionNode:qQ,MeasureLayout:rR}};function k5(i,e,t){const{props:s}=i;i.animationState&&s.whileHover&&i.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,n=s[r];n&&pt.postRender(()=>n(e,gf(e)))}class OV extends Fo{mount(){const{current:e}=this.node;e&&(this.unmount=WN(e,(t,s)=>(k5(this.node,s,"Start"),r=>k5(this.node,r,"End"))))}unmount(){}}class _V extends Fo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=df($u(this.node.current,"focus",()=>this.onFocus()),$u(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function T5(i,e,t){const{props:s}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&s.whileTap&&i.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),n=s[r];n&&pt.postRender(()=>n(e,gf(e)))}class vV extends Fo{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=KN(e,(r,n)=>(T5(this.node,n,"Start"),(o,{success:l})=>T5(this.node,o,l?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const O1=new WeakMap,l_=new WeakMap,yV=i=>{const e=O1.get(i.target);e&&e(i)},bV=i=>{i.forEach(yV)};function SV({root:i,...e}){const t=i||document;l_.has(t)||l_.set(t,{});const s=l_.get(t),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(bV,{root:i,...e})),s[r]}function xV(i,e,t){const s=SV(e);return O1.set(i,t),s.observe(i),()=>{O1.delete(i),s.unobserve(i)}}const wV={some:0,all:1};class CV extends Fo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:s,amount:r="some",once:n}=e,o={root:t?t.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:wV[r]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,n&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:m}=this.node.getProps(),g=u?d:m;g&&g(c)};return xV(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(kV(e,t))&&this.startObserver()}unmount(){}}function kV({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const TV={inView:{Feature:CV},tap:{Feature:vV},focus:{Feature:_V},hover:{Feature:OV}},AV={layout:{ProjectionNode:qQ,MeasureLayout:rR}},MV={...KX,...TV,...gV,...AV},nR=UX(MV,YX);function EV({roadmap:i,state:e,todos:t}){var m;const{connected:s}=ff(),r=(i==null?void 0:i.progress_percent)??0,n=(i==null?void 0:i.current_phase)??(e==null?void 0:e.currentPhase)??"--",o=((m=i==null?void 0:i.phases.find(g=>g.number===i.current_phase))==null?void 0:m.name)??"",l=(e==null?void 0:e.blockers.filter(g=>!g.includes("RESOLVED")).length)??0,c=(t==null?void 0:t.pending.length)??0,u=(i==null?void 0:i.completed_phases)??0,d=(i==null?void 0:i.phase_count)??0;return M.jsxs("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${s?"bg-success":"bg-danger"}`,title:s?"Connected":"Disconnected"}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Milestone Progress"}),M.jsxs("span",{className:"ml-auto font-mono text-xs text-muted-foreground",children:[u,"/",d," phases"]})]}),M.jsx("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-muted",children:M.jsx(nR.div,{className:"h-full rounded-sm bg-accent",initial:{width:0},animate:{width:`${r}%`},transition:{duration:.6,ease:"easeOut"}})}),M.jsxs("div",{className:"flex items-center gap-8",children:[M.jsxs("div",{className:"flex items-baseline gap-1.5",children:[M.jsxs("span",{className:"font-mono text-2xl font-bold tabular-nums text-foreground",children:[r,"%"]}),M.jsx("span",{className:"text-xs text-muted-foreground",children:"complete"})]}),M.jsxs("div",{className:"flex items-baseline gap-2 border-l border-border pl-8",children:[M.jsx("span",{className:"font-mono text-sm font-semibold text-accent",children:n}),M.jsx("span",{className:"text-sm text-foreground",children:o})]}),M.jsxs("div",{className:"ml-auto flex items-center gap-6",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Blockers"}),M.jsx("span",{className:`inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ${l>0?"bg-danger/20 text-danger shadow-[0_0_8px_rgba(239,68,68,0.3)]":"bg-muted text-muted-foreground"}`,children:l})]}),M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Todos"}),M.jsx("span",{className:`inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ${c>0?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"}`,children:c})]})]})]})]})}function PV({status:i}){switch(i){case"complete":return M.jsx("svg",{className:"h-4 w-4 text-success",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M3 8.5l3.5 3.5L13 4"})});case"partial":return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-accent bg-transparent"});case"planned":case"researched":case"discussed":return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-muted-foreground bg-transparent"});default:return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted"})}}function QV(i){switch(i){case"complete":return"bg-success";case"partial":return"bg-accent";default:return"bg-muted-foreground"}}function RV({phaseName:i,phaseNumber:e,completedPlans:t,totalPlans:s,status:r,roadmapComplete:n,isCurrent:o,onClick:l,onToggleComplete:c}){const u=s>0?Math.round(t/s*100):0;return M.jsxs("button",{type:"button",onClick:()=>l(e),className:`group flex w-full flex-col gap-2 rounded-sm px-4 py-3 text-left transition-colors ${o?"border-l-4 border-l-accent bg-card-hover":"border-l-4 border-l-transparent hover:bg-card-hover"}`,children:[M.jsxs("div",{className:"flex items-center gap-3",children:[c?M.jsx("input",{type:"checkbox",checked:n,onChange:d=>{d.stopPropagation(),c(e,d.target.checked)},onClick:d=>d.stopPropagation(),className:"h-3.5 w-3.5 shrink-0 cursor-pointer accent-accent",title:n?"Mark incomplete":"Mark complete"}):M.jsx(PV,{status:r}),M.jsx("span",{className:`font-mono text-sm font-semibold ${o?"text-accent":"text-muted-foreground"}`,children:e}),M.jsx("span",{className:"truncate text-sm text-foreground",children:i}),M.jsxs("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[t,"/",s]})]}),M.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-sm bg-muted",children:M.jsx(nR.div,{className:`h-full rounded-sm ${QV(r)}`,initial:{width:0},animate:{width:`${u}%`},transition:{duration:.5,ease:"easeOut"}})})]})}function LV({phases:i,currentPhase:e,onPhaseClick:t,onToggleComplete:s}){return M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Phases"}),M.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:i.length})]}),M.jsx("div",{className:"flex flex-col gap-1",children:i.length===0?M.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 py-10 text-center",children:[M.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:"No project initialized yet."}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Run"," ",M.jsx("code",{className:"rounded-sm bg-muted px-1.5 py-0.5 text-accent",children:"/maxsim:new-project"})," ","in Claude Code to get started."]})]}):i.map(r=>M.jsx(RV,{phaseNumber:r.number,phaseName:r.name,completedPlans:r.summaryCount,totalPlans:r.planCount,status:r.diskStatus,roadmapComplete:r.roadmapComplete,isCurrent:r.number===e,onClick:t,onToggleComplete:s},r.number))})]})}function oR(i){var e,t,s="";if(typeof i=="string"||typeof i=="number")s+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=oR(i[e]))&&(s&&(s+=" "),s+=t)}else for(t in i)i[t]&&(s&&(s+=" "),s+=t);return s}function $V(){for(var i,e,t=0,s="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=oR(i))&&(s&&(s+=" "),s+=e);return s}const BV=(i,e)=>{const t=new Array(i.length+e.length);for(let s=0;s<i.length;s++)t[s]=i[s];for(let s=0;s<e.length;s++)t[i.length+s]=e[s];return t},DV=(i,e)=>({classGroupId:i,validator:e}),aR=(i=new Map,e=null,t)=>({nextPart:i,validators:e,classGroupId:t}),_m="-",A5=[],zV="arbitrary..",NV=i=>{const e=VV(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:s}=i;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return XV(o);const l=o.split(_m),c=l[0]===""&&l.length>1?1:0;return lR(l,c,e)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=s[o],u=t[o];return c?u?BV(u,c):c:u||A5}return t[o]||A5}}},lR=(i,e,t)=>{if(i.length-e===0)return t.classGroupId;const r=i[e],n=t.nextPart.get(r);if(n){const u=lR(i,e+1,n);if(u)return u}const o=t.validators;if(o===null)return;const l=e===0?i.join(_m):i.slice(e).join(_m),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(l))return d.classGroupId}},XV=i=>i.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=i.slice(1,-1),t=e.indexOf(":"),s=e.slice(0,t);return s?zV+s:void 0})(),VV=i=>{const{theme:e,classGroups:t}=i;return ZV(t,e)},ZV=(i,e)=>{const t=aR();for(const s in i){const r=i[s];Zb(r,t,s,e)}return t},Zb=(i,e,t,s)=>{const r=i.length;for(let n=0;n<r;n++){const o=i[n];jV(o,e,t,s)}},jV=(i,e,t,s)=>{if(typeof i=="string"){IV(i,e,t);return}if(typeof i=="function"){qV(i,e,t,s);return}WV(i,e,t,s)},IV=(i,e,t)=>{const s=i===""?e:hR(e,i);s.classGroupId=t},qV=(i,e,t,s)=>{if(UV(i)){Zb(i(s),e,t,s);return}e.validators===null&&(e.validators=[]),e.validators.push(DV(t,i))},WV=(i,e,t,s)=>{const r=Object.entries(i),n=r.length;for(let o=0;o<n;o++){const[l,c]=r[o];Zb(c,hR(e,l),t,s)}},hR=(i,e)=>{let t=i;const s=e.split(_m),r=s.length;for(let n=0;n<r;n++){const o=s[n];let l=t.nextPart.get(o);l||(l=aR(),t.nextPart.set(o,l)),t=l}return t},UV=i=>"isThemeGetter"in i&&i.isThemeGetter===!0,YV=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),s=Object.create(null);const r=(n,o)=>{t[n]=o,e++,e>i&&(e=0,s=t,t=Object.create(null))};return{get(n){let o=t[n];if(o!==void 0)return o;if((o=s[n])!==void 0)return r(n,o),o},set(n,o){n in t?t[n]=o:r(n,o)}}},_1="!",M5=":",HV=[],E5=(i,e,t,s,r)=>({modifiers:i,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:s,isExternal:r}),FV=i=>{const{prefix:e,experimentalParseClassName:t}=i;let s=r=>{const n=[];let o=0,l=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const x=r[b];if(o===0&&l===0){if(x===M5){n.push(r.slice(c,b)),c=b+1;continue}if(x==="/"){u=b;continue}}x==="["?o++:x==="]"?o--:x==="("?l++:x===")"&&l--}const m=n.length===0?r:r.slice(c);let g=m,_=!1;m.endsWith(_1)?(g=m.slice(0,-1),_=!0):m.startsWith(_1)&&(g=m.slice(1),_=!0);const y=u&&u>c?u-c:void 0;return E5(n,_,g,y)};if(e){const r=e+M5,n=s;s=o=>o.startsWith(r)?n(o.slice(r.length)):E5(HV,!1,o,void 0,!0)}if(t){const r=s;s=n=>t({className:n,parseClassName:r})}return s},GV=i=>{const e=new Map;return i.orderSensitiveModifiers.forEach((t,s)=>{e.set(t,1e6+s)}),t=>{const s=[];let r=[];for(let n=0;n<t.length;n++){const o=t[n],l=o[0]==="[",c=e.has(o);l||c?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(o)):r.push(o)}return r.length>0&&(r.sort(),s.push(...r)),s}},KV=i=>({cache:YV(i.cacheSize),parseClassName:FV(i),sortModifiers:GV(i),...NV(i)}),JV=/\s+/,eZ=(i,e)=>{const{parseClassName:t,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:n}=e,o=[],l=i.trim().split(JV);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:m,modifiers:g,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:b}=t(d);if(m){c=d+(c.length>0?" "+c:c);continue}let x=!!b,w=s(x?y.substring(0,b):y);if(!w){if(!x){c=d+(c.length>0?" "+c:c);continue}if(w=s(y),!w){c=d+(c.length>0?" "+c:c);continue}x=!1}const k=g.length===0?"":g.length===1?g[0]:n(g).join(":"),C=_?k+_1:k,A=C+w;if(o.indexOf(A)>-1)continue;o.push(A);const P=r(w,x);for(let E=0;E<P.length;++E){const $=P[E];o.push(C+$)}c=d+(c.length>0?" "+c:c)}return c},tZ=(...i)=>{let e=0,t,s,r="";for(;e<i.length;)(t=i[e++])&&(s=cR(t))&&(r&&(r+=" "),r+=s);return r},cR=i=>{if(typeof i=="string")return i;let e,t="";for(let s=0;s<i.length;s++)i[s]&&(e=cR(i[s]))&&(t&&(t+=" "),t+=e);return t},iZ=(i,...e)=>{let t,s,r,n;const o=c=>{const u=e.reduce((d,m)=>m(d),i());return t=KV(u),s=t.cache.get,r=t.cache.set,n=l,l(c)},l=c=>{const u=s(c);if(u)return u;const d=eZ(c,t);return r(c,d),d};return n=o,(...c)=>n(tZ(...c))},sZ=[],Jt=i=>{const e=t=>t[i]||sZ;return e.isThemeGetter=!0,e},uR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rZ=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,aZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bo=i=>rZ.test(i),Ne=i=>!!i&&!Number.isNaN(Number(i)),So=i=>!!i&&Number.isInteger(Number(i)),h_=i=>i.endsWith("%")&&Ne(i.slice(0,-1)),Tn=i=>nZ.test(i),dR=()=>!0,cZ=i=>oZ.test(i)&&!aZ.test(i),jb=()=>!1,uZ=i=>lZ.test(i),fZ=i=>hZ.test(i),dZ=i=>!Se(i)&&!we(i),pZ=i=>Go(i,gR,jb),Se=i=>uR.test(i),_a=i=>Go(i,OR,cZ),P5=i=>Go(i,SZ,Ne),mZ=i=>Go(i,vR,dR),gZ=i=>Go(i,_R,jb),Q5=i=>Go(i,pR,jb),OZ=i=>Go(i,mR,fZ),Kd=i=>Go(i,yR,uZ),we=i=>fR.test(i),Nc=i=>Ha(i,OR),_Z=i=>Ha(i,_R),R5=i=>Ha(i,pR),vZ=i=>Ha(i,gR),yZ=i=>Ha(i,mR),Jd=i=>Ha(i,yR,!0),bZ=i=>Ha(i,vR,!0),Go=(i,e,t)=>{const s=uR.exec(i);return s?s[1]?e(s[1]):t(s[2]):!1},Ha=(i,e,t=!1)=>{const s=fR.exec(i);return s?s[1]?e(s[1]):t:!1},pR=i=>i==="position"||i==="percentage",mR=i=>i==="image"||i==="url",gR=i=>i==="length"||i==="size"||i==="bg-size",OR=i=>i==="length",SZ=i=>i==="number",_R=i=>i==="family-name",vR=i=>i==="number"||i==="weight",yR=i=>i==="shadow",xZ=()=>{const i=Jt("color"),e=Jt("font"),t=Jt("text"),s=Jt("font-weight"),r=Jt("tracking"),n=Jt("leading"),o=Jt("breakpoint"),l=Jt("container"),c=Jt("spacing"),u=Jt("radius"),d=Jt("shadow"),m=Jt("inset-shadow"),g=Jt("text-shadow"),_=Jt("drop-shadow"),y=Jt("blur"),b=Jt("perspective"),x=Jt("aspect"),w=Jt("ease"),k=Jt("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...A(),we,Se],E=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],z=()=>[we,Se,c],I=()=>[bo,"full","auto",...z()],se=()=>[So,"none","subgrid",we,Se],F=()=>["auto",{span:["full",So,we,Se]},So,we,Se],R=()=>[So,"auto",we,Se],L=()=>["auto","min","max","fr",we,Se],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...z()],X=()=>[bo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],W=()=>[bo,"screen","full","dvw","lvw","svw","min","max","fit",...z()],U=()=>[bo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],q=()=>[i,we,Se],D=()=>[...A(),R5,Q5,{position:[we,Se]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",vZ,pZ,{size:[we,Se]}],ce=()=>[h_,Nc,_a],he=()=>["","none","full",u,we,Se],de=()=>["",Ne,Nc,_a],ge=()=>["solid","dashed","dotted","double"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[Ne,h_,R5,Q5],mt=()=>["","none",y,we,Se],Ft=()=>["none",Ne,we,Se],Gt=()=>["none",Ne,we,Se],oi=()=>[Ne,we,Se],Pe=()=>[bo,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tn],breakpoint:[Tn],color:[dR],container:[Tn],"drop-shadow":[Tn],ease:["in","out","in-out"],font:[dZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tn],shadow:[Tn],spacing:["px",Ne],text:[Tn],"text-shadow":[Tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bo,Se,we,x]}],container:["container"],columns:[{columns:[Ne,Se,we,l]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[So,"auto",we,Se]}],basis:[{basis:[bo,"full","auto",l,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,bo,"auto","initial","none",Se]}],grow:[{grow:["",Ne,we,Se]}],shrink:[{shrink:["",Ne,we,Se]}],order:[{order:[So,"first","last","none",we,Se]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mbs:[{mbs:Q()}],mbe:[{mbe:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[l,"screen",...X()]}],"min-w":[{"min-w":[l,"screen","none",...X()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",t,Nc,_a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,bZ,mZ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",h_,Se]}],"font-family":[{font:[_Z,gZ,e]}],"font-features":[{"font-features":[Se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,we,Se]}],"line-clamp":[{"line-clamp":[Ne,"none",we,P5]}],leading:[{leading:[n,...z()]}],"list-image":[{"list-image":["none",we,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",we,_a]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Ne,"auto",we,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},So,we,Se],radial:["",we,Se],conic:[So,we,Se]},yZ,OZ]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:he()}],"rounded-s":[{"rounded-s":he()}],"rounded-e":[{"rounded-e":he()}],"rounded-t":[{"rounded-t":he()}],"rounded-r":[{"rounded-r":he()}],"rounded-b":[{"rounded-b":he()}],"rounded-l":[{"rounded-l":he()}],"rounded-ss":[{"rounded-ss":he()}],"rounded-se":[{"rounded-se":he()}],"rounded-ee":[{"rounded-ee":he()}],"rounded-es":[{"rounded-es":he()}],"rounded-tl":[{"rounded-tl":he()}],"rounded-tr":[{"rounded-tr":he()}],"rounded-br":[{"rounded-br":he()}],"rounded-bl":[{"rounded-bl":he()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,we,Se]}],"outline-w":[{outline:["",Ne,Nc,_a]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",d,Jd,Kd]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",m,Jd,Kd]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Ne,_a]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",g,Jd,Kd]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Ne,we,Se]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ae()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[we,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,Se]}],filter:[{filter:["","none",we,Se]}],blur:[{blur:mt()}],brightness:[{brightness:[Ne,we,Se]}],contrast:[{contrast:[Ne,we,Se]}],"drop-shadow":[{"drop-shadow":["","none",_,Jd,Kd]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Ne,we,Se]}],"hue-rotate":[{"hue-rotate":[Ne,we,Se]}],invert:[{invert:["",Ne,we,Se]}],saturate:[{saturate:[Ne,we,Se]}],sepia:[{sepia:["",Ne,we,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",we,Se]}],"backdrop-blur":[{"backdrop-blur":mt()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,we,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,we,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,we,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,we,Se]}],"backdrop-invert":[{"backdrop-invert":["",Ne,we,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,we,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,we,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,we,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",we,Se]}],ease:[{ease:["linear","initial",w,we,Se]}],delay:[{delay:[Ne,we,Se]}],animate:[{animate:["none",k,we,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,we,Se]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Ft()}],"rotate-x":[{"rotate-x":Ft()}],"rotate-y":[{"rotate-y":Ft()}],"rotate-z":[{"rotate-z":Ft()}],scale:[{scale:Gt()}],"scale-x":[{"scale-x":Gt()}],"scale-y":[{"scale-y":Gt()}],"scale-z":[{"scale-z":Gt()}],"scale-3d":["scale-3d"],skew:[{skew:oi()}],"skew-x":[{"skew-x":oi()}],"skew-y":[{"skew-y":oi()}],transform:[{transform:[we,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,Se]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Ne,Nc,_a,P5]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wZ=iZ(xZ);function dt(...i){return wZ($V(i))}function CZ(i){const[e,t]=Y.useState(null),[s,r]=Y.useState(!1),[n,o]=Y.useState(null),{lastChange:l}=ff(),c=Y.useCallback(async()=>{if(!i){t(null),r(!1),o(null);return}r(!0),o(null);try{const u=await fetch(`/api/phase/${encodeURIComponent(i)}`);if(!u.ok){const m=await u.json().catch(()=>({}));throw new Error(m.error||`Failed to fetch phase ${i} (${u.status})`)}const d=await u.json();t(d)}catch(u){o(u instanceof Error?u.message:"Unknown error")}finally{r(!1)}},[i]);return Y.useEffect(()=>{c()},[c]),Y.useEffect(()=>{l>0&&c()},[l,c]),{plans:(e==null?void 0:e.plans)??[],context:(e==null?void 0:e.context)??null,research:(e==null?void 0:e.research)??null,loading:s,error:n,refetch:c}}function kZ({tasks:i,planPath:e,planContent:t,onContentChange:s}){const r=Y.useCallback(async n=>{const o=i[n];if(!o)return;let l=t;const c=o.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`<name>\\s*${c}\\s*</name>`).exec(l);if(d){const m=l.slice(d.index),g=m.match(/<done>([\s\S]*?)<\/done>/);if(g){const _=g[1],y=d.index+m.indexOf(g[0]),b=y+g[0].length;let x;o.completed?x=_.replace(/^\s*\[x\]\s*/,""):x=`[x] ${_.trim()}`,l=l.slice(0,y)+`<done>${x}</done>`+l.slice(b)}}if(l!==t){s(l);try{const g=e.replace(/^\.planning[\\/]/,"").split(/[\\/]/);await fetch(`/api/plan/${g.join("/")}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})})}catch(m){console.error("[task-list] Failed to write checkbox change:",m)}}},[i,e,t,s]);return i.length===0?M.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No tasks defined"}):M.jsx("div",{className:"space-y-1",children:i.map((n,o)=>M.jsxs("div",{className:dt("flex items-start gap-2 py-1 px-2 rounded-md transition-colors","hover:bg-muted/50",n.completed&&"opacity-60"),children:[M.jsx("button",{type:"button",onClick:()=>r(o),className:dt("mt-0.5 flex-shrink-0 w-4 h-4 rounded-sm border transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50",n.completed?"bg-success border-success text-background":"border-muted-foreground hover:border-accent"),"aria-label":`Toggle ${n.name}`,children:n.completed&&M.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M3 8l3 3 7-7"})})}),M.jsxs("div",{className:"flex-1 min-w-0",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:dt("text-sm font-sans",n.completed&&"line-through text-muted-foreground"),children:n.name}),M.jsx("span",{className:dt("text-xs px-1.5 py-0.5 rounded-sm font-mono",n.type.startsWith("checkpoint")?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"),children:n.type})]}),n.files.length>0&&M.jsx("div",{className:"mt-0.5",children:n.files.map((l,c)=>M.jsx("span",{className:"text-xs font-mono text-muted-foreground mr-2",children:l},c))})]})]},o))})}function TZ({plan:i,onEdit:e}){const[t,s]=Y.useState(i.content),r=i.frontmatter,n=r.plan??"?",o=r.wave,l=r.autonomous,c=r.depends_on??[],u=r.files_modified??[];let d="";const m=i.content.match(/<objective>([\s\S]*?)<\/objective>/);if(m){const y=m[1].trim().split(`
|
|
49
|
+
`).replace(U6,"")}function wk(a,h){return h=xk(h),xk(a)===h}function rt(a,h,f,p,O,v){switch(f){case"children":typeof p=="string"?h==="body"||h==="textarea"&&p===""||al(a,p):(typeof p=="number"||typeof p=="bigint")&&h!=="body"&&al(a,""+p);break;case"className":zf(a,"class",p);break;case"tabIndex":zf(a,"tabindex",p);break;case"dir":case"role":case"viewBox":case"width":case"height":zf(a,f,p);break;case"style":wx(a,p,v);break;case"data":if(h!=="object"){zf(a,"data",p);break}case"src":case"href":if(p===""&&(h!=="a"||f!=="href")){a.removeAttribute(f);break}if(p==null||typeof p=="function"||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(f);break}p=Xf(""+p),a.setAttribute(f,p);break;case"action":case"formAction":if(typeof p=="function"){a.setAttribute(f,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(f==="formAction"?(h!=="input"&&rt(a,h,"name",O.name,O,null),rt(a,h,"formEncType",O.formEncType,O,null),rt(a,h,"formMethod",O.formMethod,O,null),rt(a,h,"formTarget",O.formTarget,O,null)):(rt(a,h,"encType",O.encType,O,null),rt(a,h,"method",O.method,O,null),rt(a,h,"target",O.target,O,null)));if(p==null||typeof p=="symbol"||typeof p=="boolean"){a.removeAttribute(f);break}p=Xf(""+p),a.setAttribute(f,p);break;case"onClick":p!=null&&(a.onclick=cn);break;case"onScroll":p!=null&&Ze("scroll",a);break;case"onScrollEnd":p!=null&&Ze("scrollend",a);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(s(61));if(f=p.__html,f!=null){if(O.children!=null)throw Error(s(60));a.innerHTML=f}}break;case"multiple":a.multiple=p&&typeof p!="function"&&typeof p!="symbol";break;case"muted":a.muted=p&&typeof p!="function"&&typeof p!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(p==null||typeof p=="function"||typeof p=="boolean"||typeof p=="symbol"){a.removeAttribute("xlink:href");break}f=Xf(""+p),a.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",f);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,""+p):a.removeAttribute(f);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":p&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,""):a.removeAttribute(f);break;case"capture":case"download":p===!0?a.setAttribute(f,""):p!==!1&&p!=null&&typeof p!="function"&&typeof p!="symbol"?a.setAttribute(f,p):a.removeAttribute(f);break;case"cols":case"rows":case"size":case"span":p!=null&&typeof p!="function"&&typeof p!="symbol"&&!isNaN(p)&&1<=p?a.setAttribute(f,p):a.removeAttribute(f);break;case"rowSpan":case"start":p==null||typeof p=="function"||typeof p=="symbol"||isNaN(p)?a.removeAttribute(f):a.setAttribute(f,p);break;case"popover":Ze("beforetoggle",a),Ze("toggle",a),Df(a,"popover",p);break;case"xlinkActuate":hn(a,"http://www.w3.org/1999/xlink","xlink:actuate",p);break;case"xlinkArcrole":hn(a,"http://www.w3.org/1999/xlink","xlink:arcrole",p);break;case"xlinkRole":hn(a,"http://www.w3.org/1999/xlink","xlink:role",p);break;case"xlinkShow":hn(a,"http://www.w3.org/1999/xlink","xlink:show",p);break;case"xlinkTitle":hn(a,"http://www.w3.org/1999/xlink","xlink:title",p);break;case"xlinkType":hn(a,"http://www.w3.org/1999/xlink","xlink:type",p);break;case"xmlBase":hn(a,"http://www.w3.org/XML/1998/namespace","xml:base",p);break;case"xmlLang":hn(a,"http://www.w3.org/XML/1998/namespace","xml:lang",p);break;case"xmlSpace":hn(a,"http://www.w3.org/XML/1998/namespace","xml:space",p);break;case"is":Df(a,"is",p);break;case"innerText":case"textContent":break;default:(!(2<f.length)||f[0]!=="o"&&f[0]!=="O"||f[1]!=="n"&&f[1]!=="N")&&(f=b4.get(f)||f,Df(a,f,p))}}function S0(a,h,f,p,O,v){switch(f){case"style":wx(a,p,v);break;case"dangerouslySetInnerHTML":if(p!=null){if(typeof p!="object"||!("__html"in p))throw Error(s(61));if(f=p.__html,f!=null){if(O.children!=null)throw Error(s(60));a.innerHTML=f}}break;case"children":typeof p=="string"?al(a,p):(typeof p=="number"||typeof p=="bigint")&&al(a,""+p);break;case"onScroll":p!=null&&Ze("scroll",a);break;case"onScrollEnd":p!=null&&Ze("scrollend",a);break;case"onClick":p!=null&&(a.onclick=cn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!mx.hasOwnProperty(f))e:{if(f[0]==="o"&&f[1]==="n"&&(O=f.endsWith("Capture"),h=f.slice(2,O?f.length-7:void 0),v=a[rs]||null,v=v!=null?v[f]:null,typeof v=="function"&&a.removeEventListener(h,v,O),typeof p=="function")){typeof v!="function"&&v!==null&&(f in a?a[f]=null:a.hasAttribute(f)&&a.removeAttribute(f)),a.addEventListener(h,p,O);break e}f in a?a[f]=p:p===!0?a.setAttribute(f,""):Df(a,f,p)}}}function Ai(a,h,f){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ze("error",a),Ze("load",a);var p=!1,O=!1,v;for(v in f)if(f.hasOwnProperty(v)){var S=f[v];if(S!=null)switch(v){case"src":p=!0;break;case"srcSet":O=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,h));default:rt(a,h,v,S,f,null)}}O&&rt(a,h,"srcSet",f.srcSet,f,null),p&&rt(a,h,"src",f.src,f,null);return;case"input":Ze("invalid",a);var T=v=S=O=null,V=null,J=null;for(p in f)if(f.hasOwnProperty(p)){var re=f[p];if(re!=null)switch(p){case"name":O=re;break;case"type":S=re;break;case"checked":V=re;break;case"defaultChecked":J=re;break;case"value":v=re;break;case"defaultValue":T=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(s(137,h));break;default:rt(a,h,p,re,f,null)}}yx(a,v,T,V,J,S,O,!1);return;case"select":Ze("invalid",a),p=S=v=null;for(O in f)if(f.hasOwnProperty(O)&&(T=f[O],T!=null))switch(O){case"value":v=T;break;case"defaultValue":S=T;break;case"multiple":p=T;default:rt(a,h,O,T,f,null)}h=v,f=S,a.multiple=!!p,h!=null?ol(a,!!p,h,!1):f!=null&&ol(a,!!p,f,!0);return;case"textarea":Ze("invalid",a),v=O=p=null;for(S in f)if(f.hasOwnProperty(S)&&(T=f[S],T!=null))switch(S){case"value":p=T;break;case"defaultValue":O=T;break;case"children":v=T;break;case"dangerouslySetInnerHTML":if(T!=null)throw Error(s(91));break;default:rt(a,h,S,T,f,null)}Sx(a,p,O,v);return;case"option":for(V in f)if(f.hasOwnProperty(V)&&(p=f[V],p!=null))switch(V){case"selected":a.selected=p&&typeof p!="function"&&typeof p!="symbol";break;default:rt(a,h,V,p,f,null)}return;case"dialog":Ze("beforetoggle",a),Ze("toggle",a),Ze("cancel",a),Ze("close",a);break;case"iframe":case"object":Ze("load",a);break;case"video":case"audio":for(p=0;p<Tc.length;p++)Ze(Tc[p],a);break;case"image":Ze("error",a),Ze("load",a);break;case"details":Ze("toggle",a);break;case"embed":case"source":case"link":Ze("error",a),Ze("load",a);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in f)if(f.hasOwnProperty(J)&&(p=f[J],p!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,h));default:rt(a,h,J,p,f,null)}return;default:if(Bg(h)){for(re in f)f.hasOwnProperty(re)&&(p=f[re],p!==void 0&&S0(a,h,re,p,f,void 0));return}}for(T in f)f.hasOwnProperty(T)&&(p=f[T],p!=null&&rt(a,h,T,p,f,null))}function Y6(a,h,f,p){switch(h){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var O=null,v=null,S=null,T=null,V=null,J=null,re=null;for(te in f){var ae=f[te];if(f.hasOwnProperty(te)&&ae!=null)switch(te){case"checked":break;case"value":break;case"defaultValue":V=ae;default:p.hasOwnProperty(te)||rt(a,h,te,null,p,ae)}}for(var ee in p){var te=p[ee];if(ae=f[ee],p.hasOwnProperty(ee)&&(te!=null||ae!=null))switch(ee){case"type":v=te;break;case"name":O=te;break;case"checked":J=te;break;case"defaultChecked":re=te;break;case"value":S=te;break;case"defaultValue":T=te;break;case"children":case"dangerouslySetInnerHTML":if(te!=null)throw Error(s(137,h));break;default:te!==ae&&rt(a,h,ee,te,p,ae)}}Lg(a,S,T,V,J,re,v,O);return;case"select":te=S=T=ee=null;for(v in f)if(V=f[v],f.hasOwnProperty(v)&&V!=null)switch(v){case"value":break;case"multiple":te=V;default:p.hasOwnProperty(v)||rt(a,h,v,null,p,V)}for(O in p)if(v=p[O],V=f[O],p.hasOwnProperty(O)&&(v!=null||V!=null))switch(O){case"value":ee=v;break;case"defaultValue":T=v;break;case"multiple":S=v;default:v!==V&&rt(a,h,O,v,p,V)}h=T,f=S,p=te,ee!=null?ol(a,!!f,ee,!1):!!p!=!!f&&(h!=null?ol(a,!!f,h,!0):ol(a,!!f,f?[]:"",!1));return;case"textarea":te=ee=null;for(T in f)if(O=f[T],f.hasOwnProperty(T)&&O!=null&&!p.hasOwnProperty(T))switch(T){case"value":break;case"children":break;default:rt(a,h,T,null,p,O)}for(S in p)if(O=p[S],v=f[S],p.hasOwnProperty(S)&&(O!=null||v!=null))switch(S){case"value":ee=O;break;case"defaultValue":te=O;break;case"children":break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(s(91));break;default:O!==v&&rt(a,h,S,O,p,v)}bx(a,ee,te);return;case"option":for(var be in f)if(ee=f[be],f.hasOwnProperty(be)&&ee!=null&&!p.hasOwnProperty(be))switch(be){case"selected":a.selected=!1;break;default:rt(a,h,be,null,p,ee)}for(V in p)if(ee=p[V],te=f[V],p.hasOwnProperty(V)&&ee!==te&&(ee!=null||te!=null))switch(V){case"selected":a.selected=ee&&typeof ee!="function"&&typeof ee!="symbol";break;default:rt(a,h,V,ee,p,te)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ee in f)ee=f[Ee],f.hasOwnProperty(Ee)&&ee!=null&&!p.hasOwnProperty(Ee)&&rt(a,h,Ee,null,p,ee);for(J in p)if(ee=p[J],te=f[J],p.hasOwnProperty(J)&&ee!==te&&(ee!=null||te!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(ee!=null)throw Error(s(137,h));break;default:rt(a,h,J,ee,p,te)}return;default:if(Bg(h)){for(var nt in f)ee=f[nt],f.hasOwnProperty(nt)&&ee!==void 0&&!p.hasOwnProperty(nt)&&S0(a,h,nt,void 0,p,ee);for(re in p)ee=p[re],te=f[re],!p.hasOwnProperty(re)||ee===te||ee===void 0&&te===void 0||S0(a,h,re,ee,p,te);return}}for(var H in f)ee=f[H],f.hasOwnProperty(H)&&ee!=null&&!p.hasOwnProperty(H)&&rt(a,h,H,null,p,ee);for(ae in p)ee=p[ae],te=f[ae],!p.hasOwnProperty(ae)||ee===te||ee==null&&te==null||rt(a,h,ae,ee,p,te)}function Ck(a){switch(a){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function H6(){if(typeof performance.getEntriesByType=="function"){for(var a=0,h=0,f=performance.getEntriesByType("resource"),p=0;p<f.length;p++){var O=f[p],v=O.transferSize,S=O.initiatorType,T=O.duration;if(v&&T&&Ck(S)){for(S=0,T=O.responseEnd,p+=1;p<f.length;p++){var V=f[p],J=V.startTime;if(J>T)break;var re=V.transferSize,ae=V.initiatorType;re&&Ck(ae)&&(V=V.responseEnd,S+=re*(V<T?1:(T-J)/(V-J)))}if(--p,h+=8*(v+S)/(O.duration/1e3),a++,10<a)break}}if(0<a)return h/a/1e6}return navigator.connection&&(a=navigator.connection.downlink,typeof a=="number")?a:5}var x0=null,w0=null;function $d(a){return a.nodeType===9?a:a.ownerDocument}function kk(a){switch(a){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Tk(a,h){if(a===0)switch(h){case"svg":return 1;case"math":return 2;default:return 0}return a===1&&h==="foreignObject"?0:a}function C0(a,h){return a==="textarea"||a==="noscript"||typeof h.children=="string"||typeof h.children=="number"||typeof h.children=="bigint"||typeof h.dangerouslySetInnerHTML=="object"&&h.dangerouslySetInnerHTML!==null&&h.dangerouslySetInnerHTML.__html!=null}var k0=null;function F6(){var a=window.event;return a&&a.type==="popstate"?a===k0?!1:(k0=a,!0):(k0=null,!1)}var Ak=typeof setTimeout=="function"?setTimeout:void 0,G6=typeof clearTimeout=="function"?clearTimeout:void 0,Mk=typeof Promise=="function"?Promise:void 0,K6=typeof queueMicrotask=="function"?queueMicrotask:typeof Mk<"u"?function(a){return Mk.resolve(null).then(a).catch(J6)}:Ak;function J6(a){setTimeout(function(){throw a})}function mo(a){return a==="head"}function Ek(a,h){var f=h,p=0;do{var O=f.nextSibling;if(a.removeChild(f),O&&O.nodeType===8)if(f=O.data,f==="/$"||f==="/&"){if(p===0){a.removeChild(O),zl(h);return}p--}else if(f==="$"||f==="$?"||f==="$~"||f==="$!"||f==="&")p++;else if(f==="html")Mc(a.ownerDocument.documentElement);else if(f==="head"){f=a.ownerDocument.head,Mc(f);for(var v=f.firstChild;v;){var S=v.nextSibling,T=v.nodeName;v[Uh]||T==="SCRIPT"||T==="STYLE"||T==="LINK"&&v.rel.toLowerCase()==="stylesheet"||f.removeChild(v),v=S}}else f==="body"&&Mc(a.ownerDocument.body);f=O}while(f);zl(h)}function Pk(a,h){var f=a;a=0;do{var p=f.nextSibling;if(f.nodeType===1?h?(f._stashedDisplay=f.style.display,f.style.display="none"):(f.style.display=f._stashedDisplay||"",f.getAttribute("style")===""&&f.removeAttribute("style")):f.nodeType===3&&(h?(f._stashedText=f.nodeValue,f.nodeValue=""):f.nodeValue=f._stashedText||""),p&&p.nodeType===8)if(f=p.data,f==="/$"){if(a===0)break;a--}else f!=="$"&&f!=="$?"&&f!=="$~"&&f!=="$!"||a++;f=p}while(f)}function T0(a){var h=a.firstChild;for(h&&h.nodeType===10&&(h=h.nextSibling);h;){var f=h;switch(h=h.nextSibling,f.nodeName){case"HTML":case"HEAD":case"BODY":T0(f),Qg(f);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(f.rel.toLowerCase()==="stylesheet")continue}a.removeChild(f)}}function ez(a,h,f,p){for(;a.nodeType===1;){var O=f;if(a.nodeName.toLowerCase()!==h.toLowerCase()){if(!p&&(a.nodeName!=="INPUT"||a.type!=="hidden"))break}else if(p){if(!a[Uh])switch(h){case"meta":if(!a.hasAttribute("itemprop"))break;return a;case"link":if(v=a.getAttribute("rel"),v==="stylesheet"&&a.hasAttribute("data-precedence"))break;if(v!==O.rel||a.getAttribute("href")!==(O.href==null||O.href===""?null:O.href)||a.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin)||a.getAttribute("title")!==(O.title==null?null:O.title))break;return a;case"style":if(a.hasAttribute("data-precedence"))break;return a;case"script":if(v=a.getAttribute("src"),(v!==(O.src==null?null:O.src)||a.getAttribute("type")!==(O.type==null?null:O.type)||a.getAttribute("crossorigin")!==(O.crossOrigin==null?null:O.crossOrigin))&&v&&a.hasAttribute("async")&&!a.hasAttribute("itemprop"))break;return a;default:return a}}else if(h==="input"&&a.type==="hidden"){var v=O.name==null?null:""+O.name;if(O.type==="hidden"&&a.getAttribute("name")===v)return a}else return a;if(a=Us(a.nextSibling),a===null)break}return null}function tz(a,h,f){if(h==="")return null;for(;a.nodeType!==3;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!f||(a=Us(a.nextSibling),a===null))return null;return a}function Qk(a,h){for(;a.nodeType!==8;)if((a.nodeType!==1||a.nodeName!=="INPUT"||a.type!=="hidden")&&!h||(a=Us(a.nextSibling),a===null))return null;return a}function A0(a){return a.data==="$?"||a.data==="$~"}function M0(a){return a.data==="$!"||a.data==="$?"&&a.ownerDocument.readyState!=="loading"}function iz(a,h){var f=a.ownerDocument;if(a.data==="$~")a._reactRetry=h;else if(a.data!=="$?"||f.readyState!=="loading")h();else{var p=function(){h(),f.removeEventListener("DOMContentLoaded",p)};f.addEventListener("DOMContentLoaded",p),a._reactRetry=p}}function Us(a){for(;a!=null;a=a.nextSibling){var h=a.nodeType;if(h===1||h===3)break;if(h===8){if(h=a.data,h==="$"||h==="$!"||h==="$?"||h==="$~"||h==="&"||h==="F!"||h==="F")break;if(h==="/$"||h==="/&")return null}}return a}var E0=null;function Rk(a){a=a.nextSibling;for(var h=0;a;){if(a.nodeType===8){var f=a.data;if(f==="/$"||f==="/&"){if(h===0)return Us(a.nextSibling);h--}else f!=="$"&&f!=="$!"&&f!=="$?"&&f!=="$~"&&f!=="&"||h++}a=a.nextSibling}return null}function Lk(a){a=a.previousSibling;for(var h=0;a;){if(a.nodeType===8){var f=a.data;if(f==="$"||f==="$!"||f==="$?"||f==="$~"||f==="&"){if(h===0)return a;h--}else f!=="/$"&&f!=="/&"||h++}a=a.previousSibling}return null}function $k(a,h,f){switch(h=$d(f),a){case"html":if(a=h.documentElement,!a)throw Error(s(452));return a;case"head":if(a=h.head,!a)throw Error(s(453));return a;case"body":if(a=h.body,!a)throw Error(s(454));return a;default:throw Error(s(451))}}function Mc(a){for(var h=a.attributes;h.length;)a.removeAttributeNode(h[0]);Qg(a)}var Ys=new Map,Bk=new Set;function Bd(a){return typeof a.getRootNode=="function"?a.getRootNode():a.nodeType===9?a:a.ownerDocument}var kn=X.d;X.d={f:sz,r:rz,D:nz,C:oz,L:az,m:lz,X:cz,S:hz,M:uz};function sz(){var a=kn.f(),h=Td();return a||h}function rz(a){var h=sl(a);h!==null&&h.tag===5&&h.type==="form"?Jw(h):kn.r(a)}var $l=typeof document>"u"?null:document;function Dk(a,h,f){var p=$l;if(p&&typeof h=="string"&&h){var O=Xs(h);O='link[rel="'+a+'"][href="'+O+'"]',typeof f=="string"&&(O+='[crossorigin="'+f+'"]'),Bk.has(O)||(Bk.add(O),a={rel:a,crossOrigin:f,href:h},p.querySelector(O)===null&&(h=p.createElement("link"),Ai(h,"link",a),ai(h),p.head.appendChild(h)))}}function nz(a){kn.D(a),Dk("dns-prefetch",a,null)}function oz(a,h){kn.C(a,h),Dk("preconnect",a,h)}function az(a,h,f){kn.L(a,h,f);var p=$l;if(p&&a&&h){var O='link[rel="preload"][as="'+Xs(h)+'"]';h==="image"&&f&&f.imageSrcSet?(O+='[imagesrcset="'+Xs(f.imageSrcSet)+'"]',typeof f.imageSizes=="string"&&(O+='[imagesizes="'+Xs(f.imageSizes)+'"]')):O+='[href="'+Xs(a)+'"]';var v=O;switch(h){case"style":v=Bl(a);break;case"script":v=Dl(a)}Ys.has(v)||(a=m({rel:"preload",href:h==="image"&&f&&f.imageSrcSet?void 0:a,as:h},f),Ys.set(v,a),p.querySelector(O)!==null||h==="style"&&p.querySelector(Ec(v))||h==="script"&&p.querySelector(Pc(v))||(h=p.createElement("link"),Ai(h,"link",a),ai(h),p.head.appendChild(h)))}}function lz(a,h){kn.m(a,h);var f=$l;if(f&&a){var p=h&&typeof h.as=="string"?h.as:"script",O='link[rel="modulepreload"][as="'+Xs(p)+'"][href="'+Xs(a)+'"]',v=O;switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Dl(a)}if(!Ys.has(v)&&(a=m({rel:"modulepreload",href:a},h),Ys.set(v,a),f.querySelector(O)===null)){switch(p){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(f.querySelector(Pc(v)))return}p=f.createElement("link"),Ai(p,"link",a),ai(p),f.head.appendChild(p)}}}function hz(a,h,f){kn.S(a,h,f);var p=$l;if(p&&a){var O=rl(p).hoistableStyles,v=Bl(a);h=h||"default";var S=O.get(v);if(!S){var T={loading:0,preload:null};if(S=p.querySelector(Ec(v)))T.loading=5;else{a=m({rel:"stylesheet",href:a,"data-precedence":h},f),(f=Ys.get(v))&&P0(a,f);var V=S=p.createElement("link");ai(V),Ai(V,"link",a),V._p=new Promise(function(J,re){V.onload=J,V.onerror=re}),V.addEventListener("load",function(){T.loading|=1}),V.addEventListener("error",function(){T.loading|=2}),T.loading|=4,Dd(S,h,p)}S={type:"stylesheet",instance:S,count:1,state:T},O.set(v,S)}}}function cz(a,h){kn.X(a,h);var f=$l;if(f&&a){var p=rl(f).hoistableScripts,O=Dl(a),v=p.get(O);v||(v=f.querySelector(Pc(O)),v||(a=m({src:a,async:!0},h),(h=Ys.get(O))&&Q0(a,h),v=f.createElement("script"),ai(v),Ai(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},p.set(O,v))}}function uz(a,h){kn.M(a,h);var f=$l;if(f&&a){var p=rl(f).hoistableScripts,O=Dl(a),v=p.get(O);v||(v=f.querySelector(Pc(O)),v||(a=m({src:a,async:!0,type:"module"},h),(h=Ys.get(O))&&Q0(a,h),v=f.createElement("script"),ai(v),Ai(v,"link",a),f.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},p.set(O,v))}}function zk(a,h,f,p){var O=(O=de.current)?Bd(O):null;if(!O)throw Error(s(446));switch(a){case"meta":case"title":return null;case"style":return typeof f.precedence=="string"&&typeof f.href=="string"?(h=Bl(f.href),f=rl(O).hoistableStyles,p=f.get(h),p||(p={type:"style",instance:null,count:0,state:null},f.set(h,p)),p):{type:"void",instance:null,count:0,state:null};case"link":if(f.rel==="stylesheet"&&typeof f.href=="string"&&typeof f.precedence=="string"){a=Bl(f.href);var v=rl(O).hoistableStyles,S=v.get(a);if(S||(O=O.ownerDocument||O,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(a,S),(v=O.querySelector(Ec(a)))&&!v._p&&(S.instance=v,S.state.loading=5),Ys.has(a)||(f={rel:"preload",as:"style",href:f.href,crossOrigin:f.crossOrigin,integrity:f.integrity,media:f.media,hrefLang:f.hrefLang,referrerPolicy:f.referrerPolicy},Ys.set(a,f),v||fz(O,a,f,S.state))),h&&p===null)throw Error(s(528,""));return S}if(h&&p!==null)throw Error(s(529,""));return null;case"script":return h=f.async,f=f.src,typeof f=="string"&&h&&typeof h!="function"&&typeof h!="symbol"?(h=Dl(f),f=rl(O).hoistableScripts,p=f.get(h),p||(p={type:"script",instance:null,count:0,state:null},f.set(h,p)),p):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,a))}}function Bl(a){return'href="'+Xs(a)+'"'}function Ec(a){return'link[rel="stylesheet"]['+a+"]"}function Nk(a){return m({},a,{"data-precedence":a.precedence,precedence:null})}function fz(a,h,f,p){a.querySelector('link[rel="preload"][as="style"]['+h+"]")?p.loading=1:(h=a.createElement("link"),p.preload=h,h.addEventListener("load",function(){return p.loading|=1}),h.addEventListener("error",function(){return p.loading|=2}),Ai(h,"link",f),ai(h),a.head.appendChild(h))}function Dl(a){return'[src="'+Xs(a)+'"]'}function Pc(a){return"script[async]"+a}function Xk(a,h,f){if(h.count++,h.instance===null)switch(h.type){case"style":var p=a.querySelector('style[data-href~="'+Xs(f.href)+'"]');if(p)return h.instance=p,ai(p),p;var O=m({},f,{"data-href":f.href,"data-precedence":f.precedence,href:null,precedence:null});return p=(a.ownerDocument||a).createElement("style"),ai(p),Ai(p,"style",O),Dd(p,f.precedence,a),h.instance=p;case"stylesheet":O=Bl(f.href);var v=a.querySelector(Ec(O));if(v)return h.state.loading|=4,h.instance=v,ai(v),v;p=Nk(f),(O=Ys.get(O))&&P0(p,O),v=(a.ownerDocument||a).createElement("link"),ai(v);var S=v;return S._p=new Promise(function(T,V){S.onload=T,S.onerror=V}),Ai(v,"link",p),h.state.loading|=4,Dd(v,f.precedence,a),h.instance=v;case"script":return v=Dl(f.src),(O=a.querySelector(Pc(v)))?(h.instance=O,ai(O),O):(p=f,(O=Ys.get(v))&&(p=m({},f),Q0(p,O)),a=a.ownerDocument||a,O=a.createElement("script"),ai(O),Ai(O,"link",p),a.head.appendChild(O),h.instance=O);case"void":return null;default:throw Error(s(443,h.type))}else h.type==="stylesheet"&&(h.state.loading&4)===0&&(p=h.instance,h.state.loading|=4,Dd(p,f.precedence,a));return h.instance}function Dd(a,h,f){for(var p=f.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),O=p.length?p[p.length-1]:null,v=O,S=0;S<p.length;S++){var T=p[S];if(T.dataset.precedence===h)v=T;else if(v!==O)break}v?v.parentNode.insertBefore(a,v.nextSibling):(h=f.nodeType===9?f.head:f,h.insertBefore(a,h.firstChild))}function P0(a,h){a.crossOrigin==null&&(a.crossOrigin=h.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=h.referrerPolicy),a.title==null&&(a.title=h.title)}function Q0(a,h){a.crossOrigin==null&&(a.crossOrigin=h.crossOrigin),a.referrerPolicy==null&&(a.referrerPolicy=h.referrerPolicy),a.integrity==null&&(a.integrity=h.integrity)}var zd=null;function Vk(a,h,f){if(zd===null){var p=new Map,O=zd=new Map;O.set(f,p)}else O=zd,p=O.get(f),p||(p=new Map,O.set(f,p));if(p.has(a))return p;for(p.set(a,null),f=f.getElementsByTagName(a),O=0;O<f.length;O++){var v=f[O];if(!(v[Uh]||v[wi]||a==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var S=v.getAttribute(h)||"";S=a+S;var T=p.get(S);T?T.push(v):p.set(S,[v])}}return p}function Zk(a,h,f){a=a.ownerDocument||a,a.head.insertBefore(f,h==="title"?a.querySelector("head > title"):null)}function dz(a,h,f){if(f===1||h.itemProp!=null)return!1;switch(a){case"meta":case"title":return!0;case"style":if(typeof h.precedence!="string"||typeof h.href!="string"||h.href==="")break;return!0;case"link":if(typeof h.rel!="string"||typeof h.href!="string"||h.href===""||h.onLoad||h.onError)break;switch(h.rel){case"stylesheet":return a=h.disabled,typeof h.precedence=="string"&&a==null;default:return!0}case"script":if(h.async&&typeof h.async!="function"&&typeof h.async!="symbol"&&!h.onLoad&&!h.onError&&h.src&&typeof h.src=="string")return!0}return!1}function jk(a){return!(a.type==="stylesheet"&&(a.state.loading&3)===0)}function pz(a,h,f,p){if(f.type==="stylesheet"&&(typeof p.media!="string"||matchMedia(p.media).matches!==!1)&&(f.state.loading&4)===0){if(f.instance===null){var O=Bl(p.href),v=h.querySelector(Ec(O));if(v){h=v._p,h!==null&&typeof h=="object"&&typeof h.then=="function"&&(a.count++,a=Nd.bind(a),h.then(a,a)),f.state.loading|=4,f.instance=v,ai(v);return}v=h.ownerDocument||h,p=Nk(p),(O=Ys.get(O))&&P0(p,O),v=v.createElement("link"),ai(v);var S=v;S._p=new Promise(function(T,V){S.onload=T,S.onerror=V}),Ai(v,"link",p),f.instance=v}a.stylesheets===null&&(a.stylesheets=new Map),a.stylesheets.set(f,h),(h=f.state.preload)&&(f.state.loading&3)===0&&(a.count++,f=Nd.bind(a),h.addEventListener("load",f),h.addEventListener("error",f))}}var R0=0;function mz(a,h){return a.stylesheets&&a.count===0&&Vd(a,a.stylesheets),0<a.count||0<a.imgCount?function(f){var p=setTimeout(function(){if(a.stylesheets&&Vd(a,a.stylesheets),a.unsuspend){var v=a.unsuspend;a.unsuspend=null,v()}},6e4+h);0<a.imgBytes&&R0===0&&(R0=62500*H6());var O=setTimeout(function(){if(a.waitingForImages=!1,a.count===0&&(a.stylesheets&&Vd(a,a.stylesheets),a.unsuspend)){var v=a.unsuspend;a.unsuspend=null,v()}},(a.imgBytes>R0?50:800)+h);return a.unsuspend=f,function(){a.unsuspend=null,clearTimeout(p),clearTimeout(O)}}:null}function Nd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Vd(this,this.stylesheets);else if(this.unsuspend){var a=this.unsuspend;this.unsuspend=null,a()}}}var Xd=null;function Vd(a,h){a.stylesheets=null,a.unsuspend!==null&&(a.count++,Xd=new Map,h.forEach(gz,a),Xd=null,Nd.call(a))}function gz(a,h){if(!(h.state.loading&4)){var f=Xd.get(a);if(f)var p=f.get(null);else{f=new Map,Xd.set(a,f);for(var O=a.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<O.length;v++){var S=O[v];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(f.set(S.dataset.precedence,S),p=S)}p&&f.set(null,p)}O=h.instance,S=O.getAttribute("data-precedence"),v=f.get(S)||p,v===p&&f.set(null,O),f.set(S,O),this.count++,p=Nd.bind(this),O.addEventListener("load",p),O.addEventListener("error",p),v?v.parentNode.insertBefore(O,v.nextSibling):(a=a.nodeType===9?a.head:a,a.insertBefore(O,a.firstChild)),h.state.loading|=4}}var Qc={$$typeof:C,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function Oz(a,h,f,p,O,v,S,T,V){this.tag=1,this.containerInfo=a,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ag(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ag(0),this.hiddenUpdates=Ag(null),this.identifierPrefix=p,this.onUncaughtError=O,this.onCaughtError=v,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=V,this.incompleteTransitions=new Map}function Ik(a,h,f,p,O,v,S,T,V,J,re,ae){return a=new Oz(a,h,f,S,V,J,re,ae,T),h=1,v===!0&&(h|=24),v=xs(3,null,null,h),a.current=v,v.stateNode=a,h=fO(),h.refCount++,a.pooledCache=h,h.refCount++,v.memoizedState={element:p,isDehydrated:f,cache:h},gO(v),a}function qk(a){return a?(a=pl,a):pl}function Wk(a,h,f,p,O,v){O=qk(O),p.context===null?p.context=O:p.pendingContext=O,p=so(h),p.payload={element:f},v=v===void 0?null:v,v!==null&&(p.callback=v),f=ro(a,p,h),f!==null&&(cs(f,a,h),cc(f,a,h))}function Uk(a,h){if(a=a.memoizedState,a!==null&&a.dehydrated!==null){var f=a.retryLane;a.retryLane=f!==0&&f<h?f:h}}function L0(a,h){Uk(a,h),(a=a.alternate)&&Uk(a,h)}function Yk(a){if(a.tag===13||a.tag===31){var h=ra(a,67108864);h!==null&&cs(h,a,67108864),L0(a,67108864)}}function Hk(a){if(a.tag===13||a.tag===31){var h=As();h=Mg(h);var f=ra(a,h);f!==null&&cs(f,a,h),L0(a,h)}}var Zd=!0;function _z(a,h,f,p){var O=Q.T;Q.T=null;var v=X.p;try{X.p=2,$0(a,h,f,p)}finally{X.p=v,Q.T=O}}function vz(a,h,f,p){var O=Q.T;Q.T=null;var v=X.p;try{X.p=8,$0(a,h,f,p)}finally{X.p=v,Q.T=O}}function $0(a,h,f,p){if(Zd){var O=B0(p);if(O===null)b0(a,h,p,jd,f),Gk(a,p);else if(bz(O,a,h,f,p))p.stopPropagation();else if(Gk(a,p),h&4&&-1<yz.indexOf(a)){for(;O!==null;){var v=sl(O);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var S=Jo(v.pendingLanes);if(S!==0){var T=v;for(T.pendingLanes|=2,T.entangledLanes|=2;S;){var V=1<<31-bs(S);T.entanglements[1]|=V,S&=~V}Qr(v),(Ge&6)===0&&(Cd=vs()+500,kc(0))}}break;case 31:case 13:T=ra(v,2),T!==null&&cs(T,v,2),Td(),L0(v,2)}if(v=B0(p),v===null&&b0(a,h,p,jd,f),v===O)break;O=v}O!==null&&p.stopPropagation()}else b0(a,h,p,null,f)}}function B0(a){return a=zg(a),D0(a)}var jd=null;function D0(a){if(jd=null,a=il(a),a!==null){var h=n(a);if(h===null)a=null;else{var f=h.tag;if(f===13){if(a=o(h),a!==null)return a;a=null}else if(f===31){if(a=l(h),a!==null)return a;a=null}else if(f===3){if(h.stateNode.current.memoizedState.isDehydrated)return h.tag===3?h.stateNode.containerInfo:null;a=null}else h!==a&&(a=null)}}return jd=a,null}function Fk(a){switch(a){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(n4()){case rx:return 2;case nx:return 8;case Qf:case o4:return 32;case ox:return 268435456;default:return 32}default:return 32}}var z0=!1,go=null,Oo=null,_o=null,Rc=new Map,Lc=new Map,vo=[],yz="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Gk(a,h){switch(a){case"focusin":case"focusout":go=null;break;case"dragenter":case"dragleave":Oo=null;break;case"mouseover":case"mouseout":_o=null;break;case"pointerover":case"pointerout":Rc.delete(h.pointerId);break;case"gotpointercapture":case"lostpointercapture":Lc.delete(h.pointerId)}}function $c(a,h,f,p,O,v){return a===null||a.nativeEvent!==v?(a={blockedOn:h,domEventName:f,eventSystemFlags:p,nativeEvent:v,targetContainers:[O]},h!==null&&(h=sl(h),h!==null&&Yk(h)),a):(a.eventSystemFlags|=p,h=a.targetContainers,O!==null&&h.indexOf(O)===-1&&h.push(O),a)}function bz(a,h,f,p,O){switch(h){case"focusin":return go=$c(go,a,h,f,p,O),!0;case"dragenter":return Oo=$c(Oo,a,h,f,p,O),!0;case"mouseover":return _o=$c(_o,a,h,f,p,O),!0;case"pointerover":var v=O.pointerId;return Rc.set(v,$c(Rc.get(v)||null,a,h,f,p,O)),!0;case"gotpointercapture":return v=O.pointerId,Lc.set(v,$c(Lc.get(v)||null,a,h,f,p,O)),!0}return!1}function Kk(a){var h=il(a.target);if(h!==null){var f=n(h);if(f!==null){if(h=f.tag,h===13){if(h=o(f),h!==null){a.blockedOn=h,fx(a.priority,function(){Hk(f)});return}}else if(h===31){if(h=l(f),h!==null){a.blockedOn=h,fx(a.priority,function(){Hk(f)});return}}else if(h===3&&f.stateNode.current.memoizedState.isDehydrated){a.blockedOn=f.tag===3?f.stateNode.containerInfo:null;return}}}a.blockedOn=null}function Id(a){if(a.blockedOn!==null)return!1;for(var h=a.targetContainers;0<h.length;){var f=B0(a.nativeEvent);if(f===null){f=a.nativeEvent;var p=new f.constructor(f.type,f);Dg=p,f.target.dispatchEvent(p),Dg=null}else return h=sl(f),h!==null&&Yk(h),a.blockedOn=f,!1;h.shift()}return!0}function Jk(a,h,f){Id(a)&&f.delete(h)}function Sz(){z0=!1,go!==null&&Id(go)&&(go=null),Oo!==null&&Id(Oo)&&(Oo=null),_o!==null&&Id(_o)&&(_o=null),Rc.forEach(Jk),Lc.forEach(Jk)}function qd(a,h){a.blockedOn===h&&(a.blockedOn=null,z0||(z0=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,Sz)))}var Wd=null;function e2(a){Wd!==a&&(Wd=a,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){Wd===a&&(Wd=null);for(var h=0;h<a.length;h+=3){var f=a[h],p=a[h+1],O=a[h+2];if(typeof p!="function"){if(D0(p||f)===null)continue;break}var v=sl(f);v!==null&&(a.splice(h,3),h-=3,BO(v,{pending:!0,data:O,method:f.method,action:p},p,O))}}))}function zl(a){function h(V){return qd(V,a)}go!==null&&qd(go,a),Oo!==null&&qd(Oo,a),_o!==null&&qd(_o,a),Rc.forEach(h),Lc.forEach(h);for(var f=0;f<vo.length;f++){var p=vo[f];p.blockedOn===a&&(p.blockedOn=null)}for(;0<vo.length&&(f=vo[0],f.blockedOn===null);)Kk(f),f.blockedOn===null&&vo.shift();if(f=(a.ownerDocument||a).$$reactFormReplay,f!=null)for(p=0;p<f.length;p+=3){var O=f[p],v=f[p+1],S=O[rs]||null;if(typeof v=="function")S||e2(f);else if(S){var T=null;if(v&&v.hasAttribute("formAction")){if(O=v,S=v[rs]||null)T=S.formAction;else if(D0(O)!==null)continue}else T=S.action;typeof T=="function"?f[p+1]=T:(f.splice(p,3),p-=3),e2(f)}}}function t2(){function a(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(S){return O=S})},focusReset:"manual",scroll:"manual"})}function h(){O!==null&&(O(),O=null),p||setTimeout(f,20)}function f(){if(!p&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var p=!1,O=null;return navigation.addEventListener("navigate",a),navigation.addEventListener("navigatesuccess",h),navigation.addEventListener("navigateerror",h),setTimeout(f,100),function(){p=!0,navigation.removeEventListener("navigate",a),navigation.removeEventListener("navigatesuccess",h),navigation.removeEventListener("navigateerror",h),O!==null&&(O(),O=null)}}}function N0(a){this._internalRoot=a}Ud.prototype.render=N0.prototype.render=function(a){var h=this._internalRoot;if(h===null)throw Error(s(409));var f=h.current,p=As();Wk(f,p,a,h,null,null)},Ud.prototype.unmount=N0.prototype.unmount=function(){var a=this._internalRoot;if(a!==null){this._internalRoot=null;var h=a.containerInfo;Wk(a.current,2,null,a,null,null),Td(),h[tl]=null}};function Ud(a){this._internalRoot=a}Ud.prototype.unstable_scheduleHydration=function(a){if(a){var h=ux();a={blockedOn:null,target:a,priority:h};for(var f=0;f<vo.length&&h!==0&&h<vo[f].priority;f++);vo.splice(f,0,a),f===0&&Kk(a)}};var i2=e.version;if(i2!=="19.2.4")throw Error(s(527,i2,"19.2.4"));X.findDOMNode=function(a){var h=a._reactInternals;if(h===void 0)throw typeof a.render=="function"?Error(s(188)):(a=Object.keys(a).join(","),Error(s(268,a)));return a=u(h),a=a!==null?d(a):null,a=a===null?null:a.stateNode,a};var xz={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:Q,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yd=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yd.isDisabled&&Yd.supportsFiber)try{Ih=Yd.inject(xz),ys=Yd}catch{}}return Dc.createRoot=function(a,h){if(!r(a))throw Error(s(299));var f=!1,p="",O=hC,v=cC,S=uC;return h!=null&&(h.unstable_strictMode===!0&&(f=!0),h.identifierPrefix!==void 0&&(p=h.identifierPrefix),h.onUncaughtError!==void 0&&(O=h.onUncaughtError),h.onCaughtError!==void 0&&(v=h.onCaughtError),h.onRecoverableError!==void 0&&(S=h.onRecoverableError)),h=Ik(a,1,!1,null,null,f,p,null,O,v,S,t2),a[tl]=h.current,y0(a),new N0(h)},Dc.hydrateRoot=function(a,h,f){if(!r(a))throw Error(s(299));var p=!1,O="",v=hC,S=cC,T=uC,V=null;return f!=null&&(f.unstable_strictMode===!0&&(p=!0),f.identifierPrefix!==void 0&&(O=f.identifierPrefix),f.onUncaughtError!==void 0&&(v=f.onUncaughtError),f.onCaughtError!==void 0&&(S=f.onCaughtError),f.onRecoverableError!==void 0&&(T=f.onRecoverableError),f.formState!==void 0&&(V=f.formState)),h=Ik(a,1,!0,h,f??null,p,O,V,v,S,T,t2),h.context=qk(null),f=h.current,p=As(),p=Mg(p),O=so(p),O.callback=null,ro(f,O,p),f=p,h.current.lanes=f,Wh(h,f),Qr(h),a[tl]=h.current,y0(a),new Ud(h)},Dc.version="19.2.4",Dc}var f2;function Lz(){if(f2)return Z0.exports;f2=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Z0.exports=Rz(),Z0.exports}var $z=Lz();const _P=Y.createContext({connected:!1,lastChange:0}),d2=2e3,Bz=3e4,Dz=1.5;function zz({children:i}){const[e,t]=Y.useState(!1),[s,r]=Y.useState(0),n=Y.useRef(null),o=Y.useRef(null),l=Y.useRef(d2);return Y.useEffect(()=>{function c(){const d=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/ws`,m=new WebSocket(d);n.current=m,m.onopen=()=>{t(!0),l.current=d2},m.onclose=()=>{t(!1),n.current=null;const g=l.current;l.current=Math.min(g*Dz,Bz),o.current=setTimeout(c,g)},m.onmessage=g=>{try{const _=JSON.parse(g.data);_.type==="file-changes"&&typeof _.timestamp=="number"&&r(_.timestamp)}catch{}},m.onerror=()=>{console.warn("[ws-provider] WebSocket error occurred")}}return c(),()=>{o.current!==null&&(clearTimeout(o.current),o.current=null),n.current&&(n.current.onclose=null,n.current.close(),n.current=null)}},[]),M.jsx(_P.Provider,{value:{connected:e,lastChange:s},children:i})}function ff(){return Y.useContext(_P)}function fb(){const{lastChange:i}=ff(),[e,t]=Y.useState(null),[s,r]=Y.useState(null),[n,o]=Y.useState(null),[l,c]=Y.useState(!0),[u,d]=Y.useState(null),m=Y.useCallback(async()=>{try{d(null);const[g,_,y]=await Promise.all([fetch("/api/roadmap"),fetch("/api/state"),fetch("/api/todos")]);if(!g.ok&&g.status!==404)throw new Error(`Roadmap fetch failed: ${g.status}`);if(!_.ok&&_.status!==404)throw new Error(`State fetch failed: ${_.status}`);if(!y.ok)throw new Error(`Todos fetch failed: ${y.status}`);const b=g.ok?await g.json():null,x=_.ok?await _.json():null,w=y.ok?await y.json():{pending:[],completed:[]};t(b),r(x),o(w)}catch(g){const _=g instanceof Error?g.message:"Failed to fetch dashboard data";d(_),console.error("[use-dashboard-data]",_)}finally{c(!1)}},[]);return Y.useEffect(()=>{m()},[m]),Y.useEffect(()=>{i>0&&m()},[i,m]),{roadmap:e,state:s,todos:n,loading:l,error:u}}const vP=Y.createContext({});function Nz(i){const e=Y.useRef(null);return e.current===null&&(e.current=i()),e.current}const yP=typeof window<"u",Xz=yP?Y.useLayoutEffect:Y.useEffect,db=Y.createContext(null);function pb(i,e){i.indexOf(e)===-1&&i.push(e)}function cm(i,e){const t=i.indexOf(e);t>-1&&i.splice(t,1)}const tn=(i,e,t)=>t>e?e:t<i?i:t;let mb=()=>{};const Zn={},bP=i=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(i);function SP(i){return typeof i=="object"&&i!==null}const xP=i=>/^0[^.\s]+$/u.test(i);function wP(i){let e;return()=>(e===void 0&&(e=i()),e)}const ar=i=>i,Vz=(i,e)=>t=>e(i(t)),df=(...i)=>i.reduce(Vz),Pu=(i,e,t)=>{const s=e-i;return s===0?1:(t-i)/s};class gb{constructor(){this.subscriptions=[]}add(e){return pb(this.subscriptions,e),()=>cm(this.subscriptions,e)}notify(e,t,s){const r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,s);else for(let n=0;n<r;n++){const o=this.subscriptions[n];o&&o(e,t,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const br=i=>i*1e3,tr=i=>i/1e3;function CP(i,e){return e?i*(1e3/e):0}const kP=(i,e,t)=>(((1-3*t+3*e)*i+(3*t-6*e))*i+3*e)*i,Zz=1e-7,jz=12;function Iz(i,e,t,s,r){let n,o,l=0;do o=e+(t-e)/2,n=kP(o,s,r)-i,n>0?t=o:e=o;while(Math.abs(n)>Zz&&++l<jz);return o}function pf(i,e,t,s){if(i===e&&t===s)return ar;const r=n=>Iz(n,0,1,i,t);return n=>n===0||n===1?n:kP(r(n),e,s)}const TP=i=>e=>e<=.5?i(2*e)/2:(2-i(2*(1-e)))/2,AP=i=>e=>1-i(1-e),MP=pf(.33,1.53,.69,.99),Ob=AP(MP),EP=TP(Ob),PP=i=>(i*=2)<1?.5*Ob(i):.5*(2-Math.pow(2,-10*(i-1))),_b=i=>1-Math.sin(Math.acos(i)),QP=AP(_b),RP=TP(_b),qz=pf(.42,0,1,1),Wz=pf(0,0,.58,1),LP=pf(.42,0,.58,1),Uz=i=>Array.isArray(i)&&typeof i[0]!="number",$P=i=>Array.isArray(i)&&typeof i[0]=="number",Yz={linear:ar,easeIn:qz,easeInOut:LP,easeOut:Wz,circIn:_b,circInOut:RP,circOut:QP,backIn:Ob,backInOut:EP,backOut:MP,anticipate:PP},Hz=i=>typeof i=="string",p2=i=>{if($P(i)){mb(i.length===4);const[e,t,s,r]=i;return pf(e,t,s,r)}else if(Hz(i))return Yz[i];return i},Hd=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Fz(i,e){let t=new Set,s=new Set,r=!1,n=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1};function c(d){o.has(d)&&(u.schedule(d),i()),d(l)}const u={schedule:(d,m=!1,g=!1)=>{const y=g&&r?t:s;return m&&o.add(d),y.has(d)||y.add(d),d},cancel:d=>{s.delete(d),o.delete(d)},process:d=>{if(l=d,r){n=!0;return}r=!0,[t,s]=[s,t],t.forEach(c),t.clear(),r=!1,n&&(n=!1,u.process(d))}};return u}const Gz=40;function BP(i,e){let t=!1,s=!0;const r={delta:0,timestamp:0,isProcessing:!1},n=()=>t=!0,o=Hd.reduce((C,A)=>(C[A]=Fz(n),C),{}),{setup:l,read:c,resolveKeyframes:u,preUpdate:d,update:m,preRender:g,render:_,postRender:y}=o,b=()=>{const C=Zn.useManualTiming?r.timestamp:performance.now();t=!1,Zn.useManualTiming||(r.delta=s?1e3/60:Math.max(Math.min(C-r.timestamp,Gz),1)),r.timestamp=C,r.isProcessing=!0,l.process(r),c.process(r),u.process(r),d.process(r),m.process(r),g.process(r),_.process(r),y.process(r),r.isProcessing=!1,t&&e&&(s=!1,i(b))},x=()=>{t=!0,s=!0,r.isProcessing||i(b)};return{schedule:Hd.reduce((C,A)=>{const P=o[A];return C[A]=(E,$=!1,z=!1)=>(t||x(),P.schedule(E,$,z)),C},{}),cancel:C=>{for(let A=0;A<Hd.length;A++)o[Hd[A]].cancel(C)},state:r,steps:o}}const{schedule:pt,cancel:Zo,state:Pi,steps:W0}=BP(typeof requestAnimationFrame<"u"?requestAnimationFrame:ar,!0);let Bp;function Kz(){Bp=void 0}const Ji={now:()=>(Bp===void 0&&Ji.set(Pi.isProcessing||Zn.useManualTiming?Pi.timestamp:performance.now()),Bp),set:i=>{Bp=i,queueMicrotask(Kz)}},DP=i=>e=>typeof e=="string"&&e.startsWith(i),zP=DP("--"),Jz=DP("var(--"),vb=i=>Jz(i)?e8.test(i.split("/*")[0].trim()):!1,e8=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function m2(i){return typeof i!="string"?!1:i.split("/*")[0].includes("var(--")}const Ah={test:i=>typeof i=="number",parse:parseFloat,transform:i=>i},Qu={...Ah,transform:i=>tn(0,1,i)},Fd={...Ah,default:1},Ou=i=>Math.round(i*1e5)/1e5,yb=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function t8(i){return i==null}const i8=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,bb=(i,e)=>t=>!!(typeof t=="string"&&i8.test(t)&&t.startsWith(i)||e&&!t8(t)&&Object.prototype.hasOwnProperty.call(t,e)),NP=(i,e,t)=>s=>{if(typeof s!="string")return s;const[r,n,o,l]=s.match(yb);return{[i]:parseFloat(r),[e]:parseFloat(n),[t]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},s8=i=>tn(0,255,i),U0={...Ah,transform:i=>Math.round(s8(i))},Ea={test:bb("rgb","red"),parse:NP("red","green","blue"),transform:({red:i,green:e,blue:t,alpha:s=1})=>"rgba("+U0.transform(i)+", "+U0.transform(e)+", "+U0.transform(t)+", "+Ou(Qu.transform(s))+")"};function r8(i){let e="",t="",s="",r="";return i.length>5?(e=i.substring(1,3),t=i.substring(3,5),s=i.substring(5,7),r=i.substring(7,9)):(e=i.substring(1,2),t=i.substring(2,3),s=i.substring(3,4),r=i.substring(4,5),e+=e,t+=t,s+=s,r+=r),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(s,16),alpha:r?parseInt(r,16)/255:1}}const Hv={test:bb("#"),parse:r8,transform:Ea.transform},mf=i=>({test:e=>typeof e=="string"&&e.endsWith(i)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${i}`}),Mo=mf("deg"),Gr=mf("%"),xe=mf("px"),n8=mf("vh"),o8=mf("vw"),g2={...Gr,parse:i=>Gr.parse(i)/100,transform:i=>Gr.transform(i*100)},Yl={test:bb("hsl","hue"),parse:NP("hue","saturation","lightness"),transform:({hue:i,saturation:e,lightness:t,alpha:s=1})=>"hsla("+Math.round(i)+", "+Gr.transform(Ou(e))+", "+Gr.transform(Ou(t))+", "+Ou(Qu.transform(s))+")"},qt={test:i=>Ea.test(i)||Hv.test(i)||Yl.test(i),parse:i=>Ea.test(i)?Ea.parse(i):Yl.test(i)?Yl.parse(i):Hv.parse(i),transform:i=>typeof i=="string"?i:i.hasOwnProperty("red")?Ea.transform(i):Yl.transform(i),getAnimatableNone:i=>{const e=qt.parse(i);return e.alpha=0,qt.transform(e)}},a8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function l8(i){var e,t;return isNaN(i)&&typeof i=="string"&&(((e=i.match(yb))==null?void 0:e.length)||0)+(((t=i.match(a8))==null?void 0:t.length)||0)>0}const XP="number",VP="color",h8="var",c8="var(",O2="${}",u8=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ru(i){const e=i.toString(),t=[],s={color:[],number:[],var:[]},r=[];let n=0;const l=e.replace(u8,c=>(qt.test(c)?(s.color.push(n),r.push(VP),t.push(qt.parse(c))):c.startsWith(c8)?(s.var.push(n),r.push(h8),t.push(c)):(s.number.push(n),r.push(XP),t.push(parseFloat(c))),++n,O2)).split(O2);return{values:t,split:l,indexes:s,types:r}}function ZP(i){return Ru(i).values}function jP(i){const{split:e,types:t}=Ru(i),s=e.length;return r=>{let n="";for(let o=0;o<s;o++)if(n+=e[o],r[o]!==void 0){const l=t[o];l===XP?n+=Ou(r[o]):l===VP?n+=qt.transform(r[o]):n+=r[o]}return n}}const f8=i=>typeof i=="number"?0:qt.test(i)?qt.getAnimatableNone(i):i;function d8(i){const e=ZP(i);return jP(i)(e.map(f8))}const Sr={test:l8,parse:ZP,createTransformer:jP,getAnimatableNone:d8};function Y0(i,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?i+(e-i)*6*t:t<1/2?e:t<2/3?i+(e-i)*(2/3-t)*6:i}function p8({hue:i,saturation:e,lightness:t,alpha:s}){i/=360,e/=100,t/=100;let r=0,n=0,o=0;if(!e)r=n=o=t;else{const l=t<.5?t*(1+e):t+e-t*e,c=2*t-l;r=Y0(c,l,i+1/3),n=Y0(c,l,i),o=Y0(c,l,i-1/3)}return{red:Math.round(r*255),green:Math.round(n*255),blue:Math.round(o*255),alpha:s}}function um(i,e){return t=>t>0?e:i}const kt=(i,e,t)=>i+(e-i)*t,H0=(i,e,t)=>{const s=i*i,r=t*(e*e-s)+s;return r<0?0:Math.sqrt(r)},m8=[Hv,Ea,Yl],g8=i=>m8.find(e=>e.test(i));function _2(i){const e=g8(i);if(!e)return!1;let t=e.parse(i);return e===Yl&&(t=p8(t)),t}const v2=(i,e)=>{const t=_2(i),s=_2(e);if(!t||!s)return um(i,e);const r={...t};return n=>(r.red=H0(t.red,s.red,n),r.green=H0(t.green,s.green,n),r.blue=H0(t.blue,s.blue,n),r.alpha=kt(t.alpha,s.alpha,n),Ea.transform(r))},Fv=new Set(["none","hidden"]);function O8(i,e){return Fv.has(i)?t=>t<=0?i:e:t=>t>=1?e:i}function _8(i,e){return t=>kt(i,e,t)}function Sb(i){return typeof i=="number"?_8:typeof i=="string"?vb(i)?um:qt.test(i)?v2:b8:Array.isArray(i)?IP:typeof i=="object"?qt.test(i)?v2:v8:um}function IP(i,e){const t=[...i],s=t.length,r=i.map((n,o)=>Sb(n)(n,e[o]));return n=>{for(let o=0;o<s;o++)t[o]=r[o](n);return t}}function v8(i,e){const t={...i,...e},s={};for(const r in t)i[r]!==void 0&&e[r]!==void 0&&(s[r]=Sb(i[r])(i[r],e[r]));return r=>{for(const n in s)t[n]=s[n](r);return t}}function y8(i,e){const t=[],s={color:0,var:0,number:0};for(let r=0;r<e.values.length;r++){const n=e.types[r],o=i.indexes[n][s[n]],l=i.values[o]??0;t[r]=l,s[n]++}return t}const b8=(i,e)=>{const t=Sr.createTransformer(e),s=Ru(i),r=Ru(e);return s.indexes.var.length===r.indexes.var.length&&s.indexes.color.length===r.indexes.color.length&&s.indexes.number.length>=r.indexes.number.length?Fv.has(i)&&!r.values.length||Fv.has(e)&&!s.values.length?O8(i,e):df(IP(y8(s,r),r.values),t):um(i,e)};function qP(i,e,t){return typeof i=="number"&&typeof e=="number"&&typeof t=="number"?kt(i,e,t):Sb(i)(i,e)}const S8=i=>{const e=({timestamp:t})=>i(t);return{start:(t=!0)=>pt.update(e,t),stop:()=>Zo(e),now:()=>Pi.isProcessing?Pi.timestamp:Ji.now()}},WP=(i,e,t=10)=>{let s="";const r=Math.max(Math.round(e/t),2);for(let n=0;n<r;n++)s+=Math.round(i(n/(r-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},fm=2e4;function xb(i){let e=0;const t=50;let s=i.next(e);for(;!s.done&&e<fm;)e+=t,s=i.next(e);return e>=fm?1/0:e}function x8(i,e=100,t){const s=t({...i,keyframes:[0,e]}),r=Math.min(xb(s),fm);return{type:"keyframes",ease:n=>s.next(r*n).value/e,duration:tr(r)}}const w8=5;function UP(i,e,t){const s=Math.max(e-w8,0);return CP(t-i(s),e-s)}const Et={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},F0=.001;function C8({duration:i=Et.duration,bounce:e=Et.bounce,velocity:t=Et.velocity,mass:s=Et.mass}){let r,n,o=1-e;o=tn(Et.minDamping,Et.maxDamping,o),i=tn(Et.minDuration,Et.maxDuration,tr(i)),o<1?(r=u=>{const d=u*o,m=d*i,g=d-t,_=Gv(u,o),y=Math.exp(-m);return F0-g/_*y},n=u=>{const m=u*o*i,g=m*t+t,_=Math.pow(o,2)*Math.pow(u,2)*i,y=Math.exp(-m),b=Gv(Math.pow(u,2),o);return(-r(u)+F0>0?-1:1)*((g-_)*y)/b}):(r=u=>{const d=Math.exp(-u*i),m=(u-t)*i+1;return-F0+d*m},n=u=>{const d=Math.exp(-u*i),m=(t-u)*(i*i);return d*m});const l=5/i,c=T8(r,n,l);if(i=br(i),isNaN(c))return{stiffness:Et.stiffness,damping:Et.damping,duration:i};{const u=Math.pow(c,2)*s;return{stiffness:u,damping:o*2*Math.sqrt(s*u),duration:i}}}const k8=12;function T8(i,e,t){let s=t;for(let r=1;r<k8;r++)s=s-i(s)/e(s);return s}function Gv(i,e){return i*Math.sqrt(1-e*e)}const A8=["duration","bounce"],M8=["stiffness","damping","mass"];function y2(i,e){return e.some(t=>i[t]!==void 0)}function E8(i){let e={velocity:Et.velocity,stiffness:Et.stiffness,damping:Et.damping,mass:Et.mass,isResolvedFromDuration:!1,...i};if(!y2(i,M8)&&y2(i,A8))if(e.velocity=0,i.visualDuration){const t=i.visualDuration,s=2*Math.PI/(t*1.2),r=s*s,n=2*tn(.05,1,1-(i.bounce||0))*Math.sqrt(r);e={...e,mass:Et.mass,stiffness:r,damping:n}}else{const t=C8({...i,velocity:0});e={...e,...t,mass:Et.mass},e.isResolvedFromDuration=!0}return e}function dm(i=Et.visualDuration,e=Et.bounce){const t=typeof i!="object"?{visualDuration:i,keyframes:[0,1],bounce:e}:i;let{restSpeed:s,restDelta:r}=t;const n=t.keyframes[0],o=t.keyframes[t.keyframes.length-1],l={done:!1,value:n},{stiffness:c,damping:u,mass:d,duration:m,velocity:g,isResolvedFromDuration:_}=E8({...t,velocity:-tr(t.velocity||0)}),y=g||0,b=u/(2*Math.sqrt(c*d)),x=o-n,w=tr(Math.sqrt(c/d)),k=Math.abs(x)<5;s||(s=k?Et.restSpeed.granular:Et.restSpeed.default),r||(r=k?Et.restDelta.granular:Et.restDelta.default);let C;if(b<1){const P=Gv(w,b);C=E=>{const $=Math.exp(-b*w*E);return o-$*((y+b*w*x)/P*Math.sin(P*E)+x*Math.cos(P*E))}}else if(b===1)C=P=>o-Math.exp(-w*P)*(x+(y+w*x)*P);else{const P=w*Math.sqrt(b*b-1);C=E=>{const $=Math.exp(-b*w*E),z=Math.min(P*E,300);return o-$*((y+b*w*x)*Math.sinh(z)+P*x*Math.cosh(z))/P}}const A={calculatedDuration:_&&m||null,next:P=>{const E=C(P);if(_)l.done=P>=m;else{let $=P===0?y:0;b<1&&($=P===0?br(y):UP(C,P,E));const z=Math.abs($)<=s,I=Math.abs(o-E)<=r;l.done=z&&I}return l.value=l.done?o:E,l},toString:()=>{const P=Math.min(xb(A),fm),E=WP($=>A.next(P*$).value,P,30);return P+"ms "+E},toTransition:()=>{}};return A}dm.applyToOptions=i=>{const e=x8(i,100,dm);return i.ease=e.ease,i.duration=br(e.duration),i.type="keyframes",i};function Kv({keyframes:i,velocity:e=0,power:t=.8,timeConstant:s=325,bounceDamping:r=10,bounceStiffness:n=500,modifyTarget:o,min:l,max:c,restDelta:u=.5,restSpeed:d}){const m=i[0],g={done:!1,value:m},_=z=>l!==void 0&&z<l||c!==void 0&&z>c,y=z=>l===void 0?c:c===void 0||Math.abs(l-z)<Math.abs(c-z)?l:c;let b=t*e;const x=m+b,w=o===void 0?x:o(x);w!==x&&(b=w-m);const k=z=>-b*Math.exp(-z/s),C=z=>w+k(z),A=z=>{const I=k(z),se=C(z);g.done=Math.abs(I)<=u,g.value=g.done?w:se};let P,E;const $=z=>{_(g.value)&&(P=z,E=dm({keyframes:[g.value,y(g.value)],velocity:UP(C,z,g.value),damping:r,stiffness:n,restDelta:u,restSpeed:d}))};return $(0),{calculatedDuration:null,next:z=>{let I=!1;return!E&&P===void 0&&(I=!0,A(z),$(z)),P!==void 0&&z>=P?E.next(z-P):(!I&&A(z),g)}}}function P8(i,e,t){const s=[],r=t||Zn.mix||qP,n=i.length-1;for(let o=0;o<n;o++){let l=r(i[o],i[o+1]);if(e){const c=Array.isArray(e)?e[o]||ar:e;l=df(c,l)}s.push(l)}return s}function Q8(i,e,{clamp:t=!0,ease:s,mixer:r}={}){const n=i.length;if(mb(n===e.length),n===1)return()=>e[0];if(n===2&&e[0]===e[1])return()=>e[1];const o=i[0]===i[1];i[0]>i[n-1]&&(i=[...i].reverse(),e=[...e].reverse());const l=P8(e,s,r),c=l.length,u=d=>{if(o&&d<i[0])return e[0];let m=0;if(c>1)for(;m<i.length-2&&!(d<i[m+1]);m++);const g=Pu(i[m],i[m+1],d);return l[m](g)};return t?d=>u(tn(i[0],i[n-1],d)):u}function R8(i,e){const t=i[i.length-1];for(let s=1;s<=e;s++){const r=Pu(0,e,s);i.push(kt(t,1,r))}}function L8(i){const e=[0];return R8(e,i.length-1),e}function $8(i,e){return i.map(t=>t*e)}function B8(i,e){return i.map(()=>e||LP).splice(0,i.length-1)}function _u({duration:i=300,keyframes:e,times:t,ease:s="easeInOut"}){const r=Uz(s)?s.map(p2):p2(s),n={done:!1,value:e[0]},o=$8(t&&t.length===e.length?t:L8(e),i),l=Q8(o,e,{ease:Array.isArray(r)?r:B8(e,r)});return{calculatedDuration:i,next:c=>(n.value=l(c),n.done=c>=i,n)}}const D8=i=>i!==null;function wb(i,{repeat:e,repeatType:t="loop"},s,r=1){const n=i.filter(D8),l=r<0||e&&t!=="loop"&&e%2===1?0:n.length-1;return!l||s===void 0?n[l]:s}const z8={decay:Kv,inertia:Kv,tween:_u,keyframes:_u,spring:dm};function YP(i){typeof i.type=="string"&&(i.type=z8[i.type])}class Cb{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,t){return this.finished.then(e,t)}}const N8=i=>i/100;class kb extends Cb{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var s,r;const{motionValue:t}=this.options;t&&t.updatedAt!==Ji.now()&&this.tick(Ji.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(r=(s=this.options).onStop)==null||r.call(s))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;YP(e);const{type:t=_u,repeat:s=0,repeatDelay:r=0,repeatType:n,velocity:o=0}=e;let{keyframes:l}=e;const c=t||_u;c!==_u&&typeof l[0]!="number"&&(this.mixKeyframes=df(N8,qP(l[0],l[1])),l=[0,100]);const u=c({...e,keyframes:l});n==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=xb(u));const{calculatedDuration:d}=u;this.calculatedDuration=d,this.resolvedDuration=d+r,this.totalDuration=this.resolvedDuration*(s+1)-r,this.generator=u}updateTime(e){const t=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=t}tick(e,t=!1){const{generator:s,totalDuration:r,mixKeyframes:n,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return s.next(0);const{delay:u=0,keyframes:d,repeat:m,repeatType:g,repeatDelay:_,type:y,onUpdate:b,finalKeyframe:x}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-r/this.speed,this.startTime)),t?this.currentTime=e:this.updateTime(e);const w=this.currentTime-u*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?w<0:w>r;this.currentTime=Math.max(w,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=r);let C=this.currentTime,A=s;if(m){const z=Math.min(this.currentTime,r)/l;let I=Math.floor(z),se=z%1;!se&&z>=1&&(se=1),se===1&&I--,I=Math.min(I,m+1),!!(I%2)&&(g==="reverse"?(se=1-se,_&&(se-=_/l)):g==="mirror"&&(A=o)),C=tn(0,1,se)*l}const P=k?{done:!1,value:d[0]}:A.next(C);n&&(P.value=n(P.value));let{done:E}=P;!k&&c!==null&&(E=this.playbackSpeed>=0?this.currentTime>=r:this.currentTime<=0);const $=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&E);return $&&y!==Kv&&(P.value=wb(d,this.options,x,this.speed)),b&&b(P.value),$&&this.finish(),P}then(e,t){return this.finished.then(e,t)}get duration(){return tr(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tr(e)}get time(){return tr(this.currentTime)}set time(e){var t;e=br(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(t=this.driver)==null||t.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Ji.now());const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=tr(this.currentTime))}play(){var r,n;if(this.isStopped)return;const{driver:e=S8,startTime:t}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(n=(r=this.options).onPlay)==null||n.call(r);const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=t??s),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ji.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,t;this.notifyFinished(),this.teardown(),this.state="finished",(t=(e=this.options).onComplete)==null||t.call(e)}cancel(){var e,t;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(t=(e=this.options).onCancel)==null||t.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var t;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(t=this.driver)==null||t.stop(),e.observe(this)}}function X8(i){for(let e=1;e<i.length;e++)i[e]??(i[e]=i[e-1])}const Pa=i=>i*180/Math.PI,Jv=i=>{const e=Pa(Math.atan2(i[1],i[0]));return e1(e)},V8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:i=>(Math.abs(i[0])+Math.abs(i[3]))/2,rotate:Jv,rotateZ:Jv,skewX:i=>Pa(Math.atan(i[1])),skewY:i=>Pa(Math.atan(i[2])),skew:i=>(Math.abs(i[1])+Math.abs(i[2]))/2},e1=i=>(i=i%360,i<0&&(i+=360),i),b2=Jv,S2=i=>Math.sqrt(i[0]*i[0]+i[1]*i[1]),x2=i=>Math.sqrt(i[4]*i[4]+i[5]*i[5]),Z8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:S2,scaleY:x2,scale:i=>(S2(i)+x2(i))/2,rotateX:i=>e1(Pa(Math.atan2(i[6],i[5]))),rotateY:i=>e1(Pa(Math.atan2(-i[2],i[0]))),rotateZ:b2,rotate:b2,skewX:i=>Pa(Math.atan(i[4])),skewY:i=>Pa(Math.atan(i[1])),skew:i=>(Math.abs(i[1])+Math.abs(i[4]))/2};function t1(i){return i.includes("scale")?1:0}function i1(i,e){if(!i||i==="none")return t1(e);const t=i.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,r;if(t)s=Z8,r=t;else{const l=i.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=V8,r=l}if(!r)return t1(e);const n=s[e],o=r[1].split(",").map(I8);return typeof n=="function"?n(o):o[n]}const j8=(i,e)=>{const{transform:t="none"}=getComputedStyle(i);return i1(t,e)};function I8(i){return parseFloat(i.trim())}const Mh=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Eh=new Set(Mh),w2=i=>i===Ah||i===xe,q8=new Set(["x","y","z"]),W8=Mh.filter(i=>!q8.has(i));function U8(i){const e=[];return W8.forEach(t=>{const s=i.getValue(t);s!==void 0&&(e.push([t,s.get()]),s.set(t.startsWith("scale")?1:0))}),e}const Do={width:({x:i},{paddingLeft:e="0",paddingRight:t="0"})=>i.max-i.min-parseFloat(e)-parseFloat(t),height:({y:i},{paddingTop:e="0",paddingBottom:t="0"})=>i.max-i.min-parseFloat(e)-parseFloat(t),top:(i,{top:e})=>parseFloat(e),left:(i,{left:e})=>parseFloat(e),bottom:({y:i},{top:e})=>parseFloat(e)+(i.max-i.min),right:({x:i},{left:e})=>parseFloat(e)+(i.max-i.min),x:(i,{transform:e})=>i1(e,"x"),y:(i,{transform:e})=>i1(e,"y")};Do.translateX=Do.x;Do.translateY=Do.y;const za=new Set;let s1=!1,r1=!1,n1=!1;function HP(){if(r1){const i=Array.from(za).filter(s=>s.needsMeasurement),e=new Set(i.map(s=>s.element)),t=new Map;e.forEach(s=>{const r=U8(s);r.length&&(t.set(s,r),s.render())}),i.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const r=t.get(s);r&&r.forEach(([n,o])=>{var l;(l=s.getValue(n))==null||l.set(o)})}),i.forEach(s=>s.measureEndState()),i.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}r1=!1,s1=!1,za.forEach(i=>i.complete(n1)),za.clear()}function FP(){za.forEach(i=>{i.readKeyframes(),i.needsMeasurement&&(r1=!0)})}function Y8(){n1=!0,FP(),HP(),n1=!1}class Tb{constructor(e,t,s,r,n,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=s,this.motionValue=r,this.element=n,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(za.add(this),s1||(s1=!0,pt.read(FP),pt.resolveKeyframes(HP))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:s,motionValue:r}=this;if(e[0]===null){const n=r==null?void 0:r.get(),o=e[e.length-1];if(n!==void 0)e[0]=n;else if(s&&t){const l=s.readValue(t,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),r&&n===void 0&&r.set(e[0])}X8(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),za.delete(this)}cancel(){this.state==="scheduled"&&(za.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const H8=i=>i.startsWith("--");function F8(i,e,t){H8(e)?i.style.setProperty(e,t):i.style[e]=t}const G8={};function GP(i,e){const t=wP(i);return()=>G8[e]??t()}const K8=GP(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),KP=GP(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),nu=([i,e,t,s])=>`cubic-bezier(${i}, ${e}, ${t}, ${s})`,C2={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:nu([0,.65,.55,1]),circOut:nu([.55,0,1,.45]),backIn:nu([.31,.01,.66,-.59]),backOut:nu([.33,1.53,.69,.99])};function JP(i,e){if(i)return typeof i=="function"?KP()?WP(i,e):"ease-out":$P(i)?nu(i):Array.isArray(i)?i.map(t=>JP(t,e)||C2.easeOut):C2[i]}function J8(i,e,t,{delay:s=0,duration:r=300,repeat:n=0,repeatType:o="loop",ease:l="easeOut",times:c}={},u=void 0){const d={[e]:t};c&&(d.offset=c);const m=JP(l,r);Array.isArray(m)&&(d.easing=m);const g={delay:s,duration:r,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:n+1,direction:o==="reverse"?"alternate":"normal"};return u&&(g.pseudoElement=u),i.animate(d,g)}function eQ(i){return typeof i=="function"&&"applyToOptions"in i}function eN({type:i,...e}){return eQ(i)&&KP()?i.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class tQ extends Cb{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:t,name:s,keyframes:r,pseudoElement:n,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!n,this.allowFlatten=o,this.options=e,mb(typeof e.type!="string");const u=eN(e);this.animation=J8(t,s,r,u,n),u.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!n){const d=wb(r,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(d):F8(t,s,d),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,t;(t=(e=this.animation).finish)==null||t.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,s,r;const e=(t=this.options)==null?void 0:t.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((r=(s=this.animation).commitStyles)==null||r.call(s))}get duration(){var t,s;const e=((s=(t=this.animation.effect)==null?void 0:t.getComputedTiming)==null?void 0:s.call(t).duration)||0;return tr(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+tr(e)}get time(){return tr(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=br(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:t}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&K8()?(this.animation.timeline=e,ar):t(this)}}const iQ={anticipate:PP,backInOut:EP,circInOut:RP};function tN(i){return i in iQ}function iN(i){typeof i.ease=="string"&&tN(i.ease)&&(i.ease=iQ[i.ease])}const G0=10;class sN extends tQ{constructor(e){iN(e),YP(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:t,onUpdate:s,onComplete:r,element:n,...o}=this.options;if(!t)return;if(e!==void 0){t.set(e);return}const l=new kb({...o,autoplay:!1}),c=Math.max(G0,Ji.now()-this.startTime),u=tn(0,G0,c-G0);t.setWithVelocity(l.sample(Math.max(0,c-u)).value,l.sample(c).value,u),l.stop()}}const k2=(i,e)=>e==="zIndex"?!1:!!(typeof i=="number"||Array.isArray(i)||typeof i=="string"&&(Sr.test(i)||i==="0")&&!i.startsWith("url("));function rN(i){const e=i[0];if(i.length===1)return!0;for(let t=0;t<i.length;t++)if(i[t]!==e)return!0}function nN(i,e,t,s){const r=i[0];if(r===null)return!1;if(e==="display"||e==="visibility")return!0;const n=i[i.length-1],o=k2(r,e),l=k2(n,e);return!o||!l?!1:rN(i)||(t==="spring"||eQ(t))&&s}function o1(i){i.duration=0,i.type="keyframes"}const oN=new Set(["opacity","clipPath","filter","transform"]),aN=wP(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function lN(i){var d;const{motionValue:e,name:t,repeatDelay:s,repeatType:r,damping:n,type:o}=i;if(!(((d=e==null?void 0:e.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=e.owner.getProps();return aN()&&t&&oN.has(t)&&(t!=="transform"||!u)&&!c&&!s&&r!=="mirror"&&n!==0&&o!=="inertia"}const hN=40;class cN extends Cb{constructor({autoplay:e=!0,delay:t=0,type:s="keyframes",repeat:r=0,repeatDelay:n=0,repeatType:o="loop",keyframes:l,name:c,motionValue:u,element:d,...m}){var y;super(),this.stop=()=>{var b,x;this._animation&&(this._animation.stop(),(b=this.stopTimeline)==null||b.call(this)),(x=this.keyframeResolver)==null||x.cancel()},this.createdAt=Ji.now();const g={autoplay:e,delay:t,type:s,repeat:r,repeatDelay:n,repeatType:o,name:c,motionValue:u,element:d,...m},_=(d==null?void 0:d.KeyframeResolver)||Tb;this.keyframeResolver=new _(l,(b,x,w)=>this.onKeyframesResolved(b,x,g,!w),c,u,d),(y=this.keyframeResolver)==null||y.scheduleResolve()}onKeyframesResolved(e,t,s,r){var x,w;this.keyframeResolver=void 0;const{name:n,type:o,velocity:l,delay:c,isHandoff:u,onUpdate:d}=s;this.resolvedAt=Ji.now(),nN(e,n,o,l)||((Zn.instantAnimations||!c)&&(d==null||d(wb(e,s,t))),e[0]=e[e.length-1],o1(s),s.repeat=0);const g={startTime:r?this.resolvedAt?this.resolvedAt-this.createdAt>hN?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:t,...s,keyframes:e},_=!u&&lN(g),y=(w=(x=g.motionValue)==null?void 0:x.owner)==null?void 0:w.current,b=_?new sN({...g,element:y}):new kb(g);b.finished.then(()=>{this.notifyFinished()}).catch(ar),this.pendingTimeline&&(this.stopTimeline=b.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=b}get finished(){return this._animation?this.animation.finished:this._finished}then(e,t){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),Y8()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function sQ(i,e,t,s=0,r=1){const n=Array.from(i).sort((u,d)=>u.sortNodePosition(d)).indexOf(e),o=i.size,l=(o-1)*s;return typeof t=="function"?t(n,o):r===1?n*s:l-n*s}const uN=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function fN(i){const e=uN.exec(i);if(!e)return[,];const[,t,s,r]=e;return[`--${t??s}`,r]}function rQ(i,e,t=1){const[s,r]=fN(i);if(!s)return;const n=window.getComputedStyle(e).getPropertyValue(s);if(n){const o=n.trim();return bP(o)?parseFloat(o):o}return vb(r)?rQ(r,e,t+1):r}const dN={type:"spring",stiffness:500,damping:25,restSpeed:10},pN=i=>({type:"spring",stiffness:550,damping:i===0?2*Math.sqrt(550):30,restSpeed:10}),mN={type:"keyframes",duration:.8},gN={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ON=(i,{keyframes:e})=>e.length>2?mN:Eh.has(i)?i.startsWith("scale")?pN(e[1]):dN:gN,_N=i=>i!==null;function vN(i,{repeat:e,repeatType:t="loop"},s){const r=i.filter(_N),n=e&&t!=="loop"&&e%2===1?0:r.length-1;return r[n]}function nQ(i,e){if(i!=null&&i.inherit&&e){const{inherit:t,...s}=i;return{...e,...s}}return i}function Ab(i,e){const t=(i==null?void 0:i[e])??(i==null?void 0:i.default)??i;return t!==i?nQ(t,i):t}function yN({when:i,delay:e,delayChildren:t,staggerChildren:s,staggerDirection:r,repeat:n,repeatType:o,repeatDelay:l,from:c,elapsed:u,...d}){return!!Object.keys(d).length}const Mb=(i,e,t,s={},r,n)=>o=>{const l=Ab(s,i)||{},c=l.delay||s.delay||0;let{elapsed:u=0}=s;u=u-br(c);const d={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-u,onUpdate:g=>{e.set(g),l.onUpdate&&l.onUpdate(g)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:i,motionValue:e,element:n?void 0:r};yN(l)||Object.assign(d,ON(i,d)),d.duration&&(d.duration=br(d.duration)),d.repeatDelay&&(d.repeatDelay=br(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let m=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(o1(d),d.delay===0&&(m=!0)),(Zn.instantAnimations||Zn.skipAnimations||r!=null&&r.shouldSkipAnimations)&&(m=!0,o1(d),d.delay=0),d.allowFlatten=!l.type&&!l.ease,m&&!n&&e.get()!==void 0){const g=vN(d.keyframes,l);if(g!==void 0){pt.update(()=>{d.onUpdate(g),d.onComplete()});return}}return l.isSync?new kb(d):new cN(d)};function T2(i){const e=[{},{}];return i==null||i.values.forEach((t,s)=>{e[0][s]=t.get(),e[1][s]=t.getVelocity()}),e}function Eb(i,e,t,s){if(typeof e=="function"){const[r,n]=T2(s);e=e(t!==void 0?t:i.custom,r,n)}if(typeof e=="string"&&(e=i.variants&&i.variants[e]),typeof e=="function"){const[r,n]=T2(s);e=e(t!==void 0?t:i.custom,r,n)}return e}function nh(i,e,t){const s=i.getProps();return Eb(s,e,t!==void 0?t:s.custom,i)}const oQ=new Set(["width","height","top","left","right","bottom",...Mh]),A2=30,bN=i=>!isNaN(parseFloat(i));class SN{constructor(e,t={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{var n;const r=Ji.now();if(this.updatedAt!==r&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&((n=this.events.change)==null||n.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Ji.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=bN(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new gb);const s=this.events[e].add(t);return e==="change"?()=>{s(),pt.read(()=>{this.events.change.getSize()||this.stop()})}:s}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,t,s){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Ji.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>A2)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,A2);return CP(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,t;(e=this.dependents)==null||e.clear(),(t=this.events.destroy)==null||t.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function mh(i,e){return new SN(i,e)}const a1=i=>Array.isArray(i);function xN(i,e,t){i.hasValue(e)?i.getValue(e).set(t):i.addValue(e,mh(t))}function wN(i){return a1(i)?i[i.length-1]||0:i}function CN(i,e){const t=nh(i,e);let{transitionEnd:s={},transition:r={},...n}=t||{};n={...n,...s};for(const o in n){const l=wN(n[o]);xN(i,o,l)}}const Ii=i=>!!(i&&i.getVelocity);function kN(i){return!!(Ii(i)&&i.add)}function l1(i,e){const t=i.getValue("willChange");if(kN(t))return t.add(e);if(!t&&Zn.WillChange){const s=new Zn.WillChange("auto");i.addValue("willChange",s),s.add(e)}}function Pb(i){return i.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const TN="framerAppearId",aQ="data-"+Pb(TN);function lQ(i){return i.props[aQ]}function AN({protectedKeys:i,needsAnimating:e},t){const s=i.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,s}function hQ(i,e,{delay:t=0,transitionOverride:s,type:r}={}){let{transition:n,transitionEnd:o,...l}=e;const c=i.getDefaultTransition();n=n?nQ(n,c):c;const u=n==null?void 0:n.reduceMotion;s&&(n=s);const d=[],m=r&&i.animationState&&i.animationState.getState()[r];for(const g in l){const _=i.getValue(g,i.latestValues[g]??null),y=l[g];if(y===void 0||m&&AN(m,g))continue;const b={delay:t,...Ab(n||{},g)},x=_.get();if(x!==void 0&&!_.isAnimating&&!Array.isArray(y)&&y===x&&!b.velocity)continue;let w=!1;if(window.MotionHandoffAnimation){const A=lQ(i);if(A){const P=window.MotionHandoffAnimation(A,g,pt);P!==null&&(b.startTime=P,w=!0)}}l1(i,g);const k=u??i.shouldReduceMotion;_.start(Mb(g,_,y,k&&oQ.has(g)?{type:!1}:b,i,w));const C=_.animation;C&&d.push(C)}if(o){const g=()=>pt.update(()=>{o&&CN(i,o)});d.length?Promise.all(d).then(g):g()}return d}function h1(i,e,t={}){var c;const s=nh(i,e,t.type==="exit"?(c=i.presenceContext)==null?void 0:c.custom:void 0);let{transition:r=i.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(r=t.transitionOverride);const n=s?()=>Promise.all(hQ(i,s,t)):()=>Promise.resolve(),o=i.variantChildren&&i.variantChildren.size?(u=0)=>{const{delayChildren:d=0,staggerChildren:m,staggerDirection:g}=r;return MN(i,e,u,d,m,g,t)}:()=>Promise.resolve(),{when:l}=r;if(l){const[u,d]=l==="beforeChildren"?[n,o]:[o,n];return u().then(()=>d())}else return Promise.all([n(),o(t.delay)])}function MN(i,e,t=0,s=0,r=0,n=1,o){const l=[];for(const c of i.variantChildren)c.notify("AnimationStart",e),l.push(h1(c,e,{...o,delay:t+(typeof s=="function"?0:s)+sQ(i.variantChildren,c,s,r,n)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function EN(i,e,t={}){i.notify("AnimationStart",e);let s;if(Array.isArray(e)){const r=e.map(n=>h1(i,n,t));s=Promise.all(r)}else if(typeof e=="string")s=h1(i,e,t);else{const r=typeof e=="function"?nh(i,e,t.custom):e;s=Promise.all(hQ(i,r,t))}return s.then(()=>{i.notify("AnimationComplete",e)})}const PN={test:i=>i==="auto",parse:i=>i},cQ=i=>e=>e.test(i),uQ=[Ah,xe,Gr,Mo,o8,n8,PN],M2=i=>uQ.find(cQ(i));function QN(i){return typeof i=="number"?i===0:i!==null?i==="none"||i==="0"||xP(i):!0}const RN=new Set(["brightness","contrast","saturate","opacity"]);function LN(i){const[e,t]=i.slice(0,-1).split("(");if(e==="drop-shadow")return i;const[s]=t.match(yb)||[];if(!s)return i;const r=t.replace(s,"");let n=RN.has(e)?1:0;return s!==t&&(n*=100),e+"("+n+r+")"}const $N=/\b([a-z-]*)\(.*?\)/gu,c1={...Sr,getAnimatableNone:i=>{const e=i.match($N);return e?e.map(LN).join(" "):i}},u1={...Sr,getAnimatableNone:i=>{const e=Sr.parse(i);return Sr.createTransformer(i)(e.map(s=>typeof s=="number"?0:typeof s=="object"?{...s,alpha:1}:s))}},E2={...Ah,transform:Math.round},BN={rotate:Mo,rotateX:Mo,rotateY:Mo,rotateZ:Mo,scale:Fd,scaleX:Fd,scaleY:Fd,scaleZ:Fd,skew:Mo,skewX:Mo,skewY:Mo,distance:xe,translateX:xe,translateY:xe,translateZ:xe,x:xe,y:xe,z:xe,perspective:xe,transformPerspective:xe,opacity:Qu,originX:g2,originY:g2,originZ:xe},Qb={borderWidth:xe,borderTopWidth:xe,borderRightWidth:xe,borderBottomWidth:xe,borderLeftWidth:xe,borderRadius:xe,borderTopLeftRadius:xe,borderTopRightRadius:xe,borderBottomRightRadius:xe,borderBottomLeftRadius:xe,width:xe,maxWidth:xe,height:xe,maxHeight:xe,top:xe,right:xe,bottom:xe,left:xe,inset:xe,insetBlock:xe,insetBlockStart:xe,insetBlockEnd:xe,insetInline:xe,insetInlineStart:xe,insetInlineEnd:xe,padding:xe,paddingTop:xe,paddingRight:xe,paddingBottom:xe,paddingLeft:xe,paddingBlock:xe,paddingBlockStart:xe,paddingBlockEnd:xe,paddingInline:xe,paddingInlineStart:xe,paddingInlineEnd:xe,margin:xe,marginTop:xe,marginRight:xe,marginBottom:xe,marginLeft:xe,marginBlock:xe,marginBlockStart:xe,marginBlockEnd:xe,marginInline:xe,marginInlineStart:xe,marginInlineEnd:xe,fontSize:xe,backgroundPositionX:xe,backgroundPositionY:xe,...BN,zIndex:E2,fillOpacity:Qu,strokeOpacity:Qu,numOctaves:E2},DN={...Qb,color:qt,backgroundColor:qt,outlineColor:qt,fill:qt,stroke:qt,borderColor:qt,borderTopColor:qt,borderRightColor:qt,borderBottomColor:qt,borderLeftColor:qt,filter:c1,WebkitFilter:c1,mask:u1,WebkitMask:u1},fQ=i=>DN[i],zN=new Set([c1,u1]);function dQ(i,e){let t=fQ(i);return zN.has(t)||(t=Sr),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const NN=new Set(["auto","none","0"]);function XN(i,e,t){let s=0,r;for(;s<i.length&&!r;){const n=i[s];typeof n=="string"&&!NN.has(n)&&Ru(n).values.length&&(r=i[s]),s++}if(r&&t)for(const n of e)i[n]=dQ(t,r)}class VN extends Tb{constructor(e,t,s,r,n){super(e,t,s,r,n,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:s}=this;if(!t||!t.current)return;super.readKeyframes();for(let d=0;d<e.length;d++){let m=e[d];if(typeof m=="string"&&(m=m.trim(),vb(m))){const g=rQ(m,t.current);g!==void 0&&(e[d]=g),d===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!oQ.has(s)||e.length!==2)return;const[r,n]=e,o=M2(r),l=M2(n),c=m2(r),u=m2(n);if(c!==u&&Do[s]){this.needsMeasurement=!0;return}if(o!==l)if(w2(o)&&w2(l))for(let d=0;d<e.length;d++){const m=e[d];typeof m=="string"&&(e[d]=parseFloat(m))}else Do[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,s=[];for(let r=0;r<e.length;r++)(e[r]===null||QN(e[r]))&&s.push(r);s.length&&XN(e,s,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Do[s](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const r=t[t.length-1];r!==void 0&&e.getValue(s,r).jump(r,!1)}measureEndState(){var l;const{element:e,name:t,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const r=e.getValue(t);r&&r.jump(this.measuredOrigin,!1);const n=s.length-1,o=s[n];s[n]=Do[t](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,u])=>{e.getValue(c).set(u)}),this.resolveNoneKeyframes()}}const ZN=new Set(["opacity","clipPath","filter","transform"]);function pQ(i,e,t){if(i==null)return[];if(i instanceof EventTarget)return[i];if(typeof i=="string"){let s=document;const r=(t==null?void 0:t[i])??s.querySelectorAll(i);return r?Array.from(r):[]}return Array.from(i).filter(s=>s!=null)}const mQ=(i,e)=>e&&typeof i=="number"?e.transform(i):i;function jN(i){return SP(i)&&"offsetHeight"in i}const{schedule:Rb}=BP(queueMicrotask,!1),_r={x:!1,y:!1};function gQ(){return _r.x||_r.y}function IN(i){return i==="x"||i==="y"?_r[i]?null:(_r[i]=!0,()=>{_r[i]=!1}):_r.x||_r.y?null:(_r.x=_r.y=!0,()=>{_r.x=_r.y=!1})}function OQ(i,e){const t=pQ(i),s=new AbortController,r={passive:!0,...e,signal:s.signal};return[t,r,()=>s.abort()]}function qN(i){return!(i.pointerType==="touch"||gQ())}function WN(i,e,t={}){const[s,r,n]=OQ(i,t);return s.forEach(o=>{let l=!1,c=!1,u;const d=()=>{o.removeEventListener("pointerleave",y)},m=x=>{u&&(u(x),u=void 0),d()},g=x=>{l=!1,window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",g),c&&(c=!1,m(x))},_=()=>{l=!0,window.addEventListener("pointerup",g,r),window.addEventListener("pointercancel",g,r)},y=x=>{if(x.pointerType!=="touch"){if(l){c=!0;return}m(x)}},b=x=>{if(!qN(x))return;c=!1;const w=e(o,x);typeof w=="function"&&(u=w,o.addEventListener("pointerleave",y,r))};o.addEventListener("pointerenter",b,r),o.addEventListener("pointerdown",_,r)}),n}const _Q=(i,e)=>e?i===e?!0:_Q(i,e.parentElement):!1,Lb=i=>i.pointerType==="mouse"?typeof i.button!="number"||i.button<=0:i.isPrimary!==!1,UN=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function YN(i){return UN.has(i.tagName)||i.isContentEditable===!0}const HN=new Set(["INPUT","SELECT","TEXTAREA"]);function FN(i){return HN.has(i.tagName)||i.isContentEditable===!0}const Dp=new WeakSet;function P2(i){return e=>{e.key==="Enter"&&i(e)}}function K0(i,e){i.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const GN=(i,e)=>{const t=i.currentTarget;if(!t)return;const s=P2(()=>{if(Dp.has(t))return;K0(t,"down");const r=P2(()=>{K0(t,"up")}),n=()=>K0(t,"cancel");t.addEventListener("keyup",r,e),t.addEventListener("blur",n,e)});t.addEventListener("keydown",s,e),t.addEventListener("blur",()=>t.removeEventListener("keydown",s),e)};function Q2(i){return Lb(i)&&!gQ()}const R2=new WeakSet;function KN(i,e,t={}){const[s,r,n]=OQ(i,t),o=l=>{const c=l.currentTarget;if(!Q2(l)||R2.has(l))return;Dp.add(c),t.stopPropagation&&R2.add(l);const u=e(c,l),d=(_,y)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",g),Dp.has(c)&&Dp.delete(c),Q2(_)&&typeof u=="function"&&u(_,{success:y})},m=_=>{d(_,c===window||c===document||t.useGlobalTarget||_Q(c,_.target))},g=_=>{d(_,!1)};window.addEventListener("pointerup",m,r),window.addEventListener("pointercancel",g,r)};return s.forEach(l=>{(t.useGlobalTarget?window:l).addEventListener("pointerdown",o,r),jN(l)&&(l.addEventListener("focus",u=>GN(u,r)),!YN(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),n}function $b(i){return SP(i)&&"ownerSVGElement"in i}const zp=new WeakMap;let Eo;const vQ=(i,e,t)=>(s,r)=>r&&r[0]?r[0][i+"Size"]:$b(s)&&"getBBox"in s?s.getBBox()[e]:s[t],JN=vQ("inline","width","offsetWidth"),e7=vQ("block","height","offsetHeight");function t7({target:i,borderBoxSize:e}){var t;(t=zp.get(i))==null||t.forEach(s=>{s(i,{get width(){return JN(i,e)},get height(){return e7(i,e)}})})}function i7(i){i.forEach(t7)}function s7(){typeof ResizeObserver>"u"||(Eo=new ResizeObserver(i7))}function r7(i,e){Eo||s7();const t=pQ(i);return t.forEach(s=>{let r=zp.get(s);r||(r=new Set,zp.set(s,r)),r.add(e),Eo==null||Eo.observe(s)}),()=>{t.forEach(s=>{const r=zp.get(s);r==null||r.delete(e),r!=null&&r.size||Eo==null||Eo.unobserve(s)})}}const Np=new Set;let Hl;function n7(){Hl=()=>{const i={get width(){return window.innerWidth},get height(){return window.innerHeight}};Np.forEach(e=>e(i))},window.addEventListener("resize",Hl)}function o7(i){return Np.add(i),Hl||n7(),()=>{Np.delete(i),!Np.size&&typeof Hl=="function"&&(window.removeEventListener("resize",Hl),Hl=void 0)}}function L2(i,e){return typeof i=="function"?o7(i):r7(i,e)}function a7(i){return $b(i)&&i.tagName==="svg"}const l7=[...uQ,qt,Sr],h7=i=>l7.find(cQ(i)),$2=()=>({translate:0,scale:1,origin:0,originPoint:0}),Fl=()=>({x:$2(),y:$2()}),B2=()=>({min:0,max:0}),ii=()=>({x:B2(),y:B2()}),c7=new WeakMap;function rg(i){return i!==null&&typeof i=="object"&&typeof i.start=="function"}function Lu(i){return typeof i=="string"||Array.isArray(i)}const Bb=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Db=["initial",...Bb];function ng(i){return rg(i.animate)||Db.some(e=>Lu(i[e]))}function yQ(i){return!!(ng(i)||i.variants)}function u7(i,e,t){for(const s in e){const r=e[s],n=t[s];if(Ii(r))i.addValue(s,r);else if(Ii(n))i.addValue(s,mh(r,{owner:i}));else if(n!==r)if(i.hasValue(s)){const o=i.getValue(s);o.liveStyle===!0?o.jump(r):o.hasAnimated||o.set(r)}else{const o=i.getStaticValue(s);i.addValue(s,mh(o!==void 0?o:r,{owner:i}))}}for(const s in t)e[s]===void 0&&i.removeValue(s);return e}const f1={current:null},bQ={current:!1},f7=typeof window<"u";function d7(){if(bQ.current=!0,!!f7)if(window.matchMedia){const i=window.matchMedia("(prefers-reduced-motion)"),e=()=>f1.current=i.matches;i.addEventListener("change",e),e()}else f1.current=!1}const D2=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let pm={};function SQ(i){pm=i}function p7(){return pm}class m7{scrapeMotionValuesFromProps(e,t,s){return{}}constructor({parent:e,props:t,presenceContext:s,reducedMotionConfig:r,skipAnimations:n,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Tb,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const _=Ji.now();this.renderScheduledAt<_&&(this.renderScheduledAt=_,pt.render(this.render,!1,!0))};const{latestValues:u,renderState:d}=l;this.latestValues=u,this.baseTarget={...u},this.initialValues=t.initial?{...u}:{},this.renderState=d,this.parent=e,this.props=t,this.presenceContext=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.skipAnimationsConfig=n,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=ng(t),this.isVariantNode=yQ(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...g}=this.scrapeMotionValuesFromProps(t,{},this);for(const _ in g){const y=g[_];u[_]!==void 0&&Ii(y)&&y.set(u[_])}}mount(e){var t,s;if(this.hasBeenMounted)for(const r in this.initialValues)(t=this.values.get(r))==null||t.jump(this.initialValues[r]),this.latestValues[r]=this.initialValues[r];this.current=e,c7.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((r,n)=>this.bindToMotionValue(n,r)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(bQ.current||d7(),this.shouldReduceMotion=f1.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(s=this.parent)==null||s.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Zo(this.notifyUpdate),Zo(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const t in this.events)this.events[t].clear();for(const t in this.features){const s=this.features[t];s&&(s.unmount(),s.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,t){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),t.accelerate&&ZN.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:u,duration:d}=t.accelerate,m=new tQ({element:this.current,name:e,keyframes:l,times:c,ease:u,duration:br(d)}),g=o(m);this.valueSubscriptions.set(e,()=>{g(),m.cancel()});return}const s=Eh.has(e);s&&this.onBindTransform&&this.onBindTransform();const r=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&pt.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let n;typeof window<"u"&&window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{r(),n&&n(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in pm){const t=pm[e];if(!t)continue;const{isEnabled:s,Feature:r}=t;if(!this.features[e]&&r&&s(this.props)&&(this.features[e]=new r(this)),this.features[e]){const n=this.features[e];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ii()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let s=0;s<D2.length;s++){const r=D2[s];this.propEventSubscriptions[r]&&(this.propEventSubscriptions[r](),delete this.propEventSubscriptions[r]);const n="on"+r,o=e[n];o&&(this.propEventSubscriptions[r]=this.on(r,o))}this.prevMotionValues=u7(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const s=this.values.get(e);t!==s&&(s&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let s=this.values.get(e);return s===void 0&&t!==void 0&&(s=mh(t===null?void 0:t,{owner:this}),this.addValue(e,s)),s}readValue(e,t){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(bP(s)||xP(s))?s=parseFloat(s):!h7(s)&&Sr.test(t)&&(s=dQ(e,t)),this.setBaseTarget(e,Ii(s)?s.get():s)),Ii(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var n;const{initial:t}=this.props;let s;if(typeof t=="string"||typeof t=="object"){const o=Eb(this.props,t,(n=this.presenceContext)==null?void 0:n.custom);o&&(s=o[e])}if(t&&s!==void 0)return s;const r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Ii(r)?r:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new gb),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}scheduleRenderMicrotask(){Rb.render(this.render)}}class xQ extends m7{constructor(){super(...arguments),this.KeyframeResolver=VN}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){const s=e.style;return s?s[t]:void 0}removeValueFromRenderState(e,{vars:t,style:s}){delete t[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ii(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}class Fo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function wQ({top:i,left:e,right:t,bottom:s}){return{x:{min:e,max:t},y:{min:i,max:s}}}function g7({x:i,y:e}){return{top:e.min,right:i.max,bottom:e.max,left:i.min}}function O7(i,e){if(!e)return i;const t=e({x:i.left,y:i.top}),s=e({x:i.right,y:i.bottom});return{top:t.y,left:t.x,bottom:s.y,right:s.x}}function J0(i){return i===void 0||i===1}function d1({scale:i,scaleX:e,scaleY:t}){return!J0(i)||!J0(e)||!J0(t)}function xa(i){return d1(i)||CQ(i)||i.z||i.rotate||i.rotateX||i.rotateY||i.skewX||i.skewY}function CQ(i){return z2(i.x)||z2(i.y)}function z2(i){return i&&i!=="0%"}function mm(i,e,t){const s=i-t,r=e*s;return t+r}function N2(i,e,t,s,r){return r!==void 0&&(i=mm(i,r,s)),mm(i,t,s)+e}function p1(i,e=0,t=1,s,r){i.min=N2(i.min,e,t,s,r),i.max=N2(i.max,e,t,s,r)}function kQ(i,{x:e,y:t}){p1(i.x,e.translate,e.scale,e.originPoint),p1(i.y,t.translate,t.scale,t.originPoint)}const X2=.999999999999,V2=1.0000000000001;function _7(i,e,t,s=!1){const r=t.length;if(!r)return;e.x=e.y=1;let n,o;for(let l=0;l<r;l++){n=t[l],o=n.projectionDelta;const{visualElement:c}=n.options;c&&c.props.style&&c.props.style.display==="contents"||(s&&n.options.layoutScroll&&n.scroll&&n!==n.root&&Kl(i,{x:-n.scroll.offset.x,y:-n.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,kQ(i,o)),s&&xa(n.latestValues)&&Kl(i,n.latestValues))}e.x<V2&&e.x>X2&&(e.x=1),e.y<V2&&e.y>X2&&(e.y=1)}function Gl(i,e){i.min=i.min+e,i.max=i.max+e}function Z2(i,e,t,s,r=.5){const n=kt(i.min,i.max,r);p1(i,e,t,n,s)}function Kl(i,e){Z2(i.x,e.x,e.scaleX,e.scale,e.originX),Z2(i.y,e.y,e.scaleY,e.scale,e.originY)}function TQ(i,e){return wQ(O7(i.getBoundingClientRect(),e))}function v7(i,e,t){const s=TQ(i,t),{scroll:r}=e;return r&&(Gl(s.x,r.offset.x),Gl(s.y,r.offset.y)),s}const y7={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},b7=Mh.length;function S7(i,e,t){let s="",r=!0;for(let n=0;n<b7;n++){const o=Mh[n],l=i[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const u=parseFloat(l);c=o.startsWith("scale")?u===1:u===0}if(!c||t){const u=mQ(l,Qb[o]);if(!c){r=!1;const d=y7[o]||o;s+=`${d}(${u}) `}t&&(e[o]=u)}}return s=s.trim(),t?s=t(e,r?"":s):r&&(s="none"),s}function zb(i,e,t){const{style:s,vars:r,transformOrigin:n}=i;let o=!1,l=!1;for(const c in e){const u=e[c];if(Eh.has(c)){o=!0;continue}else if(zP(c)){r[c]=u;continue}else{const d=mQ(u,Qb[c]);c.startsWith("origin")?(l=!0,n[c]=d):s[c]=d}}if(e.transform||(o||t?s.transform=S7(e,i.transform,t):s.transform&&(s.transform="none")),l){const{originX:c="50%",originY:u="50%",originZ:d=0}=n;s.transformOrigin=`${c} ${u} ${d}`}}function AQ(i,{style:e,vars:t},s,r){const n=i.style;let o;for(o in e)n[o]=e[o];r==null||r.applyProjectionStyles(n,s);for(o in t)n.setProperty(o,t[o])}function j2(i,e){return e.max===e.min?0:i/(e.max-e.min)*100}const zc={correct:(i,e)=>{if(!e.target)return i;if(typeof i=="string")if(xe.test(i))i=parseFloat(i);else return i;const t=j2(i,e.target.x),s=j2(i,e.target.y);return`${t}% ${s}%`}},x7={correct:(i,{treeScale:e,projectionDelta:t})=>{const s=i,r=Sr.parse(i);if(r.length>5)return s;const n=Sr.createTransformer(i),o=typeof r[0]!="number"?1:0,l=t.x.scale*e.x,c=t.y.scale*e.y;r[0+o]/=l,r[1+o]/=c;const u=kt(l,c,.5);return typeof r[2+o]=="number"&&(r[2+o]/=u),typeof r[3+o]=="number"&&(r[3+o]/=u),n(r)}},m1={borderRadius:{...zc,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:zc,borderTopRightRadius:zc,borderBottomLeftRadius:zc,borderBottomRightRadius:zc,boxShadow:x7};function MQ(i,{layout:e,layoutId:t}){return Eh.has(i)||i.startsWith("origin")||(e||t!==void 0)&&(!!m1[i]||i==="opacity")}function Nb(i,e,t){var o;const s=i.style,r=e==null?void 0:e.style,n={};if(!s)return n;for(const l in s)(Ii(s[l])||r&&Ii(r[l])||MQ(l,i)||((o=t==null?void 0:t.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(n[l]=s[l]);return n}function w7(i){return window.getComputedStyle(i)}class C7 extends xQ{constructor(){super(...arguments),this.type="html",this.renderInstance=AQ}readValueFromInstance(e,t){var s;if(Eh.has(t))return(s=this.projection)!=null&&s.isProjecting?t1(t):j8(e,t);{const r=w7(e),n=(zP(t)?r.getPropertyValue(t):r[t])||0;return typeof n=="string"?n.trim():n}}measureInstanceViewportBox(e,{transformPagePoint:t}){return TQ(e,t)}build(e,t,s){zb(e,t,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,s){return Nb(e,t,s)}}const k7={offset:"stroke-dashoffset",array:"stroke-dasharray"},T7={offset:"strokeDashoffset",array:"strokeDasharray"};function A7(i,e,t=1,s=0,r=!0){i.pathLength=1;const n=r?k7:T7;i[n.offset]=`${-s}`,i[n.array]=`${e} ${t}`}const M7=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function EQ(i,{attrX:e,attrY:t,attrScale:s,pathLength:r,pathSpacing:n=1,pathOffset:o=0,...l},c,u,d){if(zb(i,l,u),c){i.style.viewBox&&(i.attrs.viewBox=i.style.viewBox);return}i.attrs=i.style,i.style={};const{attrs:m,style:g}=i;m.transform&&(g.transform=m.transform,delete m.transform),(g.transform||m.transformOrigin)&&(g.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),g.transform&&(g.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete m.transformBox);for(const _ of M7)m[_]!==void 0&&(g[_]=m[_],delete m[_]);e!==void 0&&(m.x=e),t!==void 0&&(m.y=t),s!==void 0&&(m.scale=s),r!==void 0&&A7(m,r,n,o,!1)}const PQ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),QQ=i=>typeof i=="string"&&i.toLowerCase()==="svg";function E7(i,e,t,s){AQ(i,e,void 0,s);for(const r in e.attrs)i.setAttribute(PQ.has(r)?r:Pb(r),e.attrs[r])}function RQ(i,e,t){const s=Nb(i,e,t);for(const r in i)if(Ii(i[r])||Ii(e[r])){const n=Mh.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;s[n]=i[r]}return s}class P7 extends xQ{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ii}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Eh.has(t)){const s=fQ(t);return s&&s.default||0}return t=PQ.has(t)?t:Pb(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,s){return RQ(e,t,s)}build(e,t,s){EQ(e,t,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,t,s,r){E7(e,t,s,r)}mount(e){this.isSVGTag=QQ(e.tagName),super.mount(e)}}const Q7=Db.length;function LQ(i){if(!i)return;if(!i.isControllingVariants){const t=i.parent?LQ(i.parent)||{}:{};return i.props.initial!==void 0&&(t.initial=i.props.initial),t}const e={};for(let t=0;t<Q7;t++){const s=Db[t],r=i.props[s];(Lu(r)||r===!1)&&(e[s]=r)}return e}function $Q(i,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==i.length)return!1;for(let s=0;s<t;s++)if(e[s]!==i[s])return!1;return!0}const R7=[...Bb].reverse(),L7=Bb.length;function $7(i){return e=>Promise.all(e.map(({animation:t,options:s})=>EN(i,t,s)))}function B7(i){let e=$7(i),t=I2(),s=!0;const r=c=>(u,d)=>{var g;const m=nh(i,d,c==="exit"?(g=i.presenceContext)==null?void 0:g.custom:void 0);if(m){const{transition:_,transitionEnd:y,...b}=m;u={...u,...b,...y}}return u};function n(c){e=c(i)}function o(c){const{props:u}=i,d=LQ(i.parent)||{},m=[],g=new Set;let _={},y=1/0;for(let x=0;x<L7;x++){const w=R7[x],k=t[w],C=u[w]!==void 0?u[w]:d[w],A=Lu(C),P=w===c?k.isActive:null;P===!1&&(y=x);let E=C===d[w]&&C!==u[w]&&A;if(E&&s&&i.manuallyAnimateOnMount&&(E=!1),k.protectedKeys={..._},!k.isActive&&P===null||!C&&!k.prevProp||rg(C)||typeof C=="boolean")continue;if(w==="exit"&&k.isActive&&P!==!0){k.prevResolvedValues&&(_={..._,...k.prevResolvedValues});continue}const $=D7(k.prevProp,C);let z=$||w===c&&k.isActive&&!E&&A||x>y&&A,I=!1;const se=Array.isArray(C)?C:[C];let F=se.reduce(r(w),{});P===!1&&(F={});const{prevResolvedValues:R={}}=k,L={...R,...F},N=X=>{z=!0,g.has(X)&&(I=!0,g.delete(X)),k.needsAnimating[X]=!0;const W=i.getValue(X);W&&(W.liveStyle=!1)};for(const X in L){const W=F[X],U=R[X];if(_.hasOwnProperty(X))continue;let q=!1;a1(W)&&a1(U)?q=!$Q(W,U):q=W!==U,q?W!=null?N(X):g.add(X):W!==void 0&&g.has(X)?N(X):k.protectedKeys[X]=!0}k.prevProp=C,k.prevResolvedValues=F,k.isActive&&(_={..._,...F}),s&&i.blockInitialAnimation&&(z=!1);const Z=E&&$;z&&(!Z||I)&&m.push(...se.map(X=>{const W={type:w};if(typeof X=="string"&&s&&!Z&&i.manuallyAnimateOnMount&&i.parent){const{parent:U}=i,q=nh(U,X);if(U.enteringChildren&&q){const{delayChildren:D}=q.transition||{};W.delay=sQ(U.enteringChildren,i,D)}}return{animation:X,options:W}}))}if(g.size){const x={};if(typeof u.initial!="boolean"){const w=nh(i,Array.isArray(u.initial)?u.initial[0]:u.initial);w&&w.transition&&(x.transition=w.transition)}g.forEach(w=>{const k=i.getBaseTarget(w),C=i.getValue(w);C&&(C.liveStyle=!0),x[w]=k??null}),m.push({animation:x})}let b=!!m.length;return s&&(u.initial===!1||u.initial===u.animate)&&!i.manuallyAnimateOnMount&&(b=!1),s=!1,b?e(m):Promise.resolve()}function l(c,u){var m;if(t[c].isActive===u)return Promise.resolve();(m=i.variantChildren)==null||m.forEach(g=>{var _;return(_=g.animationState)==null?void 0:_.setActive(c,u)}),t[c].isActive=u;const d=o(c);for(const g in t)t[g].protectedKeys={};return d}return{animateChanges:o,setActive:l,setAnimateFunction:n,getState:()=>t,reset:()=>{t=I2()}}}function D7(i,e){return typeof e=="string"?e!==i:Array.isArray(e)?!$Q(e,i):!1}function Oa(i=!1){return{isActive:i,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function I2(){return{animate:Oa(!0),whileInView:Oa(),whileHover:Oa(),whileTap:Oa(),whileDrag:Oa(),whileFocus:Oa(),exit:Oa()}}function q2(i,e){i.min=e.min,i.max=e.max}function mr(i,e){q2(i.x,e.x),q2(i.y,e.y)}function W2(i,e){i.translate=e.translate,i.scale=e.scale,i.originPoint=e.originPoint,i.origin=e.origin}const BQ=1e-4,z7=1-BQ,N7=1+BQ,DQ=.01,X7=0-DQ,V7=0+DQ;function es(i){return i.max-i.min}function Z7(i,e,t){return Math.abs(i-e)<=t}function U2(i,e,t,s=.5){i.origin=s,i.originPoint=kt(e.min,e.max,i.origin),i.scale=es(t)/es(e),i.translate=kt(t.min,t.max,i.origin)-i.originPoint,(i.scale>=z7&&i.scale<=N7||isNaN(i.scale))&&(i.scale=1),(i.translate>=X7&&i.translate<=V7||isNaN(i.translate))&&(i.translate=0)}function vu(i,e,t,s){U2(i.x,e.x,t.x,s?s.originX:void 0),U2(i.y,e.y,t.y,s?s.originY:void 0)}function Y2(i,e,t){i.min=t.min+e.min,i.max=i.min+es(e)}function j7(i,e,t){Y2(i.x,e.x,t.x),Y2(i.y,e.y,t.y)}function H2(i,e,t){i.min=e.min-t.min,i.max=i.min+es(e)}function gm(i,e,t){H2(i.x,e.x,t.x),H2(i.y,e.y,t.y)}function F2(i,e,t,s,r){return i-=e,i=mm(i,1/t,s),r!==void 0&&(i=mm(i,1/r,s)),i}function I7(i,e=0,t=1,s=.5,r,n=i,o=i){if(Gr.test(e)&&(e=parseFloat(e),e=kt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=kt(n.min,n.max,s);i===n&&(l-=e),i.min=F2(i.min,e,t,l,r),i.max=F2(i.max,e,t,l,r)}function G2(i,e,[t,s,r],n,o){I7(i,e[t],e[s],e[r],e.scale,n,o)}const q7=["x","scaleX","originX"],W7=["y","scaleY","originY"];function K2(i,e,t,s){G2(i.x,e,q7,t?t.x:void 0,s?s.x:void 0),G2(i.y,e,W7,t?t.y:void 0,s?s.y:void 0)}function J2(i){return i.translate===0&&i.scale===1}function zQ(i){return J2(i.x)&&J2(i.y)}function e5(i,e){return i.min===e.min&&i.max===e.max}function U7(i,e){return e5(i.x,e.x)&&e5(i.y,e.y)}function t5(i,e){return Math.round(i.min)===Math.round(e.min)&&Math.round(i.max)===Math.round(e.max)}function NQ(i,e){return t5(i.x,e.x)&&t5(i.y,e.y)}function i5(i){return es(i.x)/es(i.y)}function s5(i,e){return i.translate===e.translate&&i.scale===e.scale&&i.originPoint===e.originPoint}function Zr(i){return[i("x"),i("y")]}function Y7(i,e,t){let s="";const r=i.x.translate/e.x,n=i.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((r||n||o)&&(s=`translate3d(${r}px, ${n}px, ${o}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:u,rotate:d,rotateX:m,rotateY:g,skewX:_,skewY:y}=t;u&&(s=`perspective(${u}px) ${s}`),d&&(s+=`rotate(${d}deg) `),m&&(s+=`rotateX(${m}deg) `),g&&(s+=`rotateY(${g}deg) `),_&&(s+=`skewX(${_}deg) `),y&&(s+=`skewY(${y}deg) `)}const l=i.x.scale*e.x,c=i.y.scale*e.y;return(l!==1||c!==1)&&(s+=`scale(${l}, ${c})`),s||"none"}const XQ=["TopLeft","TopRight","BottomLeft","BottomRight"],H7=XQ.length,r5=i=>typeof i=="string"?parseFloat(i):i,n5=i=>typeof i=="number"||xe.test(i);function F7(i,e,t,s,r,n){r?(i.opacity=kt(0,t.opacity??1,G7(s)),i.opacityExit=kt(e.opacity??1,0,K7(s))):n&&(i.opacity=kt(e.opacity??1,t.opacity??1,s));for(let o=0;o<H7;o++){const l=`border${XQ[o]}Radius`;let c=o5(e,l),u=o5(t,l);if(c===void 0&&u===void 0)continue;c||(c=0),u||(u=0),c===0||u===0||n5(c)===n5(u)?(i[l]=Math.max(kt(r5(c),r5(u),s),0),(Gr.test(u)||Gr.test(c))&&(i[l]+="%")):i[l]=u}(e.rotate||t.rotate)&&(i.rotate=kt(e.rotate||0,t.rotate||0,s))}function o5(i,e){return i[e]!==void 0?i[e]:i.borderRadius}const G7=VQ(0,.5,QP),K7=VQ(.5,.95,ar);function VQ(i,e,t){return s=>s<i?0:s>e?1:t(Pu(i,e,s))}function J7(i,e,t){const s=Ii(i)?i:mh(i);return s.start(Mb("",s,e,t)),s.animation}function $u(i,e,t,s={passive:!0}){return i.addEventListener(e,t,s),()=>i.removeEventListener(e,t)}const eX=(i,e)=>i.depth-e.depth;class tX{constructor(){this.children=[],this.isDirty=!1}add(e){pb(this.children,e),this.isDirty=!0}remove(e){cm(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(eX),this.isDirty=!1,this.children.forEach(e)}}function iX(i,e){const t=Ji.now(),s=({timestamp:r})=>{const n=r-t;n>=e&&(Zo(s),i(n-e))};return pt.setup(s,!0),()=>Zo(s)}function Xp(i){return Ii(i)?i.get():i}class sX{constructor(){this.members=[]}add(e){pb(this.members,e);for(let t=this.members.length-1;t>=0;t--){const s=this.members[t];if(s===e||s===this.lead||s===this.prevLead)continue;const r=s.instance;r&&r.isConnected===!1&&s.isPresent!==!1&&!s.snapshot&&cm(this.members,s)}e.scheduleRender()}remove(e){if(cm(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(r=>e===r);if(t===0)return!1;let s;for(let r=t;r>=0;r--){const n=this.members[r],o=n.instance;if(n.isPresent!==!1&&(!o||o.isConnected!==!1)){s=n;break}}return s?(this.promote(s),!0):!1}promote(e,t){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender();const r=s.options.layoutDependency,n=e.options.layoutDependency;if(!(r!==void 0&&n!==void 0&&r===n)){const c=s.instance;c&&c.isConnected===!1&&!s.snapshot||(e.resumeFrom=s,t&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:l}=e.options;l===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:s}=e;t.onExitComplete&&t.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Vp={hasAnimatedSinceResize:!0,hasEverUpdated:!1},e_=["","X","Y","Z"],rX=1e3;let nX=0;function t_(i,e,t,s){const{latestValues:r}=e;r[i]&&(t[i]=r[i],e.setStaticValue(i,0),s&&(s[i]=0))}function ZQ(i){if(i.hasCheckedOptimisedAppear=!0,i.root===i)return;const{visualElement:e}=i.options;if(!e)return;const t=lQ(e);if(window.MotionHasOptimisedAnimation(t,"transform")){const{layout:r,layoutId:n}=i.options;window.MotionCancelOptimisedAnimation(t,"transform",pt,!(r||n))}const{parent:s}=i;s&&!s.hasCheckedOptimisedAppear&&ZQ(s)}function jQ({attachResizeListener:i,defaultParent:e,measureScroll:t,checkIsScrollRoot:s,resetTransform:r}){return class{constructor(o={},l=e==null?void 0:e()){this.id=nX++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lX),this.nodes.forEach(fX),this.nodes.forEach(dX),this.nodes.forEach(hX)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new tX)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new gb),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=$b(o)&&!a7(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),i){let d,m=0;const g=()=>this.root.updateBlockedByResize=!1;pt.read(()=>{m=window.innerWidth}),i(o,()=>{const _=window.innerWidth;_!==m&&(m=_,this.root.updateBlockedByResize=!0,d&&d(),d=iX(g,250),Vp.hasAnimatedSinceResize&&(Vp.hasAnimatedSinceResize=!1,this.nodes.forEach(h5)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:m,hasRelativeLayoutChanged:g,layout:_})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const y=this.options.transition||u.getDefaultTransition()||_X,{onLayoutAnimationStart:b,onLayoutAnimationComplete:x}=u.getProps(),w=!this.targetLayout||!NQ(this.targetLayout,_),k=!m&&g;if(this.options.layoutRoot||this.resumeFrom||k||m&&(w||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...Ab(y,"layout"),onPlay:b,onComplete:x};(u.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(d,k)}else m||h5(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=_})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Zo(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pX),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&ZQ(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const m=this.path[d];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const u=this.getTransformTemplate();this.prevTransformTemplateValue=u?u(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(a5);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(l5);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(uX),this.nodes.forEach(oX),this.nodes.forEach(aX)):this.nodes.forEach(l5),this.clearAllSnapshots();const l=Ji.now();Pi.delta=tn(0,1e3/60,l-Pi.timestamp),Pi.timestamp=l,Pi.isProcessing=!0,W0.update.process(Pi),W0.preRender.process(Pi),W0.render.process(Pi),Pi.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Rb.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(cX),this.sharedNodes.forEach(mX)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,pt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){pt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!es(this.snapshot.measuredBox.x)&&!es(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ii(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=s(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:t(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!r)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!zQ(this.projectionDelta),c=this.getTransformTemplate(),u=c?c(this.latestValues,""):void 0,d=u!==this.prevTransformTemplateValue;o&&this.instance&&(l||xa(this.latestValues)||d)&&(r(this.instance,u),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),vX(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var u;const{visualElement:o}=this.options;if(!o)return ii();const l=o.measureViewportBox();if(!(((u=this.scroll)==null?void 0:u.wasRoot)||this.path.some(yX))){const{scroll:d}=this.root;d&&(Gl(l.x,d.offset.x),Gl(l.y,d.offset.y))}return l}removeElementScroll(o){var c;const l=ii();if(mr(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let u=0;u<this.path.length;u++){const d=this.path[u],{scroll:m,options:g}=d;d!==this.root&&m&&g.layoutScroll&&(m.wasRoot&&mr(l,o),Gl(l.x,m.offset.x),Gl(l.y,m.offset.y))}return l}applyTransform(o,l=!1){const c=ii();mr(c,o);for(let u=0;u<this.path.length;u++){const d=this.path[u];!l&&d.options.layoutScroll&&d.scroll&&d!==d.root&&Kl(c,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),xa(d.latestValues)&&Kl(c,d.latestValues)}return xa(this.latestValues)&&Kl(c,this.latestValues),c}removeTransform(o){const l=ii();mr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!u.instance||!xa(u.latestValues))continue;d1(u.latestValues)&&u.updateSnapshot();const d=ii(),m=u.measurePageBox();mr(d,m),K2(l,u.latestValues,u.snapshot?u.snapshot.layoutBox:void 0,d)}return xa(this.latestValues)&&K2(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Pi.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var _;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(_=this.parent)!=null&&_.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:m}=this.options;if(!this.layout||!(d||m))return;this.resolvedRelativeTargetAt=Pi.timestamp;const g=this.getClosestProjectingParent();g&&this.linkedParentVersion!==g.layoutVersion&&!g.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(g&&g.layout?this.createRelativeTarget(g,this.layout.layoutBox,g.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ii(),this.targetWithTransforms=ii()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),j7(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):mr(this.target,this.layout.layoutBox),kQ(this.target,this.targetDelta)):mr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,g&&!!g.resumingFrom==!!this.resumingFrom&&!g.options.layoutScroll&&g.target&&this.animationProgress!==1?this.createRelativeTarget(g,this.target,g.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||d1(this.parent.latestValues)||CQ(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ii(),this.relativeTargetOrigin=ii(),gm(this.relativeTargetOrigin,l,c),mr(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var y;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(y=this.parent)!=null&&y.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===Pi.timestamp&&(c=!1),c)return;const{layout:u,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||d))return;mr(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,g=this.treeScale.y;_7(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ii());const{target:_}=o;if(!_){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(W2(this.prevProjectionDelta.x,this.projectionDelta.x),W2(this.prevProjectionDelta.y,this.projectionDelta.y)),vu(this.projectionDelta,this.layoutCorrected,_,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==g||!s5(this.projectionDelta.x,this.prevProjectionDelta.x)||!s5(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",_))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Fl(),this.projectionDelta=Fl(),this.projectionDeltaWithTransform=Fl()}setAnimationOrigin(o,l=!1){const c=this.snapshot,u=c?c.latestValues:{},d={...this.latestValues},m=Fl();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const g=ii(),_=c?c.source:void 0,y=this.layout?this.layout.source:void 0,b=_!==y,x=this.getStack(),w=!x||x.members.length<=1,k=!!(b&&!w&&this.options.crossfade===!0&&!this.path.some(OX));this.animationProgress=0;let C;this.mixTargetDelta=A=>{const P=A/1e3;c5(m.x,o.x,P),c5(m.y,o.y,P),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(gm(g,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gX(this.relativeTarget,this.relativeTargetOrigin,g,P),C&&U7(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=ii()),mr(C,this.relativeTarget)),b&&(this.animationValues=d,F7(d,u,this.latestValues,P,k,w)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,u;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(u=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||u.stop(),this.pendingAnimation&&(Zo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=pt.update(()=>{Vp.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=mh(0)),this.motionValue.jump(0,!1),this.currentAnimation=J7(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),o.onUpdate&&o.onUpdate(d)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(rX),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:u,latestValues:d}=o;if(!(!l||!c||!u)){if(this!==o&&this.layout&&u&&IQ(this.options.animationType,this.layout.layoutBox,u.layoutBox)){c=this.target||ii();const m=es(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+m;const g=es(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+g}mr(l,c),Kl(l,d),vu(this.projectionDeltaWithTransform,this.layoutCorrected,l,d)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new sX),this.sharedNodes.get(o).add(l);const u=l.options.initialPromotionConfig;l.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const u=this.getStack();u&&u.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const u={};c.z&&t_("z",o,u,this.animationValues);for(let d=0;d<e_.length;d++)t_(`rotate${e_[d]}`,o,u,this.animationValues),t_(`skew${e_[d]}`,o,u,this.animationValues);o.render();for(const d in u)o.setStaticValue(d,u[d]),this.animationValues&&(this.animationValues[d]=u[d]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Xp(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const u=this.getLead();if(!this.projectionDelta||!this.layout||!u.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Xp(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!xa(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const d=u.animationValues||u.latestValues;this.applyTransformsToTarget();let m=Y7(this.projectionDeltaWithTransform,this.treeScale,d);c&&(m=c(d,m)),o.transform=m;const{x:g,y:_}=this.projectionDelta;o.transformOrigin=`${g.origin*100}% ${_.origin*100}% 0`,u.animationValues?o.opacity=u===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:o.opacity=u===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const y in m1){if(d[y]===void 0)continue;const{correct:b,applyTo:x,isCSSVariable:w}=m1[y],k=m==="none"?d[y]:b(d[y],u);if(x){const C=x.length;for(let A=0;A<C;A++)o[x[A]]=k}else w?this.options.visualElement.renderState.vars[y]=k:o[y]=k}this.options.layoutId&&(o.pointerEvents=u===this?Xp(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(a5),this.root.sharedNodes.clear()}}}function oX(i){i.updateLayout()}function aX(i){var t;const e=((t=i.resumeFrom)==null?void 0:t.snapshot)||i.snapshot;if(i.isLead()&&i.layout&&e&&i.hasListeners("didUpdate")){const{layoutBox:s,measuredBox:r}=i.layout,{animationType:n}=i.options,o=e.source!==i.layout.source;n==="size"?Zr(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],_=es(g);g.min=s[m].min,g.max=g.min+_}):IQ(n,e.layoutBox,s)&&Zr(m=>{const g=o?e.measuredBox[m]:e.layoutBox[m],_=es(s[m]);g.max=g.min+_,i.relativeTarget&&!i.currentAnimation&&(i.isProjectionDirty=!0,i.relativeTarget[m].max=i.relativeTarget[m].min+_)});const l=Fl();vu(l,s,e.layoutBox);const c=Fl();o?vu(c,i.applyTransform(r,!0),e.measuredBox):vu(c,s,e.layoutBox);const u=!zQ(l);let d=!1;if(!i.resumeFrom){const m=i.getClosestProjectingParent();if(m&&!m.resumeFrom){const{snapshot:g,layout:_}=m;if(g&&_){const y=ii();gm(y,e.layoutBox,g.layoutBox);const b=ii();gm(b,s,_.layoutBox),NQ(y,b)||(d=!0),m.options.layoutRoot&&(i.relativeTarget=b,i.relativeTargetOrigin=y,i.relativeParent=m)}}}i.notifyListeners("didUpdate",{layout:s,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:u,hasRelativeLayoutChanged:d})}else if(i.isLead()){const{onExitComplete:s}=i.options;s&&s()}i.options.transition=void 0}function lX(i){i.parent&&(i.isProjecting()||(i.isProjectionDirty=i.parent.isProjectionDirty),i.isSharedProjectionDirty||(i.isSharedProjectionDirty=!!(i.isProjectionDirty||i.parent.isProjectionDirty||i.parent.isSharedProjectionDirty)),i.isTransformDirty||(i.isTransformDirty=i.parent.isTransformDirty))}function hX(i){i.isProjectionDirty=i.isSharedProjectionDirty=i.isTransformDirty=!1}function cX(i){i.clearSnapshot()}function a5(i){i.clearMeasurements()}function l5(i){i.isLayoutDirty=!1}function uX(i){const{visualElement:e}=i.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),i.resetTransform()}function h5(i){i.finishAnimation(),i.targetDelta=i.relativeTarget=i.target=void 0,i.isProjectionDirty=!0}function fX(i){i.resolveTargetDelta()}function dX(i){i.calcProjection()}function pX(i){i.resetSkewAndRotation()}function mX(i){i.removeLeadSnapshot()}function c5(i,e,t){i.translate=kt(e.translate,0,t),i.scale=kt(e.scale,1,t),i.origin=e.origin,i.originPoint=e.originPoint}function u5(i,e,t,s){i.min=kt(e.min,t.min,s),i.max=kt(e.max,t.max,s)}function gX(i,e,t,s){u5(i.x,e.x,t.x,s),u5(i.y,e.y,t.y,s)}function OX(i){return i.animationValues&&i.animationValues.opacityExit!==void 0}const _X={duration:.45,ease:[.4,0,.1,1]},f5=i=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(i),d5=f5("applewebkit/")&&!f5("chrome/")?Math.round:ar;function p5(i){i.min=d5(i.min),i.max=d5(i.max)}function vX(i){p5(i.x),p5(i.y)}function IQ(i,e,t){return i==="position"||i==="preserve-aspect"&&!Z7(i5(e),i5(t),.2)}function yX(i){var e;return i!==i.root&&((e=i.scroll)==null?void 0:e.wasRoot)}const bX=jQ({attachResizeListener:(i,e)=>$u(i,"resize",e),measureScroll:()=>{var i,e;return{x:document.documentElement.scrollLeft||((i=document.body)==null?void 0:i.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),i_={current:void 0},qQ=jQ({measureScroll:i=>({x:i.scrollLeft,y:i.scrollTop}),defaultParent:()=>{if(!i_.current){const i=new bX({});i.mount(window),i.setOptions({layoutScroll:!0}),i_.current=i}return i_.current},resetTransform:(i,e)=>{i.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:i=>window.getComputedStyle(i).position==="fixed"}),WQ=Y.createContext({transformPagePoint:i=>i,isStatic:!1,reducedMotion:"never"});function SX(i=!0){const e=Y.useContext(db);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:s,register:r}=e,n=Y.useId();Y.useEffect(()=>{if(i)return r(n)},[i]);const o=Y.useCallback(()=>i&&s&&s(n),[n,s,i]);return!t&&s?[!1,o]:[!0]}const UQ=Y.createContext({strict:!1}),m5={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let g5=!1;function xX(){if(g5)return;const i={};for(const e in m5)i[e]={isEnabled:t=>m5[e].some(s=>!!t[s])};SQ(i),g5=!0}function YQ(){return xX(),p7()}function wX(i){const e=YQ();for(const t in i)e[t]={...e[t],...i[t]};SQ(e)}const CX=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Om(i){return i.startsWith("while")||i.startsWith("drag")&&i!=="draggable"||i.startsWith("layout")||i.startsWith("onTap")||i.startsWith("onPan")||i.startsWith("onLayout")||CX.has(i)}let HQ=i=>!Om(i);function kX(i){typeof i=="function"&&(HQ=e=>e.startsWith("on")?!Om(e):i(e))}try{kX(require("@emotion/is-prop-valid").default)}catch{}function TX(i,e,t){const s={};for(const r in i)r==="values"&&typeof i.values=="object"||(HQ(r)||t===!0&&Om(r)||!e&&!Om(r)||i.draggable&&r.startsWith("onDrag"))&&(s[r]=i[r]);return s}const og=Y.createContext({});function AX(i,e){if(ng(i)){const{initial:t,animate:s}=i;return{initial:t===!1||Lu(t)?t:void 0,animate:Lu(s)?s:void 0}}return i.inherit!==!1?e:{}}function MX(i){const{initial:e,animate:t}=AX(i,Y.useContext(og));return Y.useMemo(()=>({initial:e,animate:t}),[O5(e),O5(t)])}function O5(i){return Array.isArray(i)?i.join(" "):i}const Xb=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function FQ(i,e,t){for(const s in e)!Ii(e[s])&&!MQ(s,t)&&(i[s]=e[s])}function EX({transformTemplate:i},e){return Y.useMemo(()=>{const t=Xb();return zb(t,e,i),Object.assign({},t.vars,t.style)},[e])}function PX(i,e){const t=i.style||{},s={};return FQ(s,t,i),Object.assign(s,EX(i,e)),s}function QX(i,e){const t={},s=PX(i,e);return i.drag&&i.dragListener!==!1&&(t.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=i.drag===!0?"none":`pan-${i.drag==="x"?"y":"x"}`),i.tabIndex===void 0&&(i.onTap||i.onTapStart||i.whileTap)&&(t.tabIndex=0),t.style=s,t}const GQ=()=>({...Xb(),attrs:{}});function RX(i,e,t,s){const r=Y.useMemo(()=>{const n=GQ();return EQ(n,e,QQ(s),i.transformTemplate,i.style),{...n.attrs,style:{...n.style}}},[e]);if(i.style){const n={};FQ(n,i.style,i),r.style={...n,...r.style}}return r}const LX=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Vb(i){return typeof i!="string"||i.includes("-")?!1:!!(LX.indexOf(i)>-1||/[A-Z]/u.test(i))}function $X(i,e,t,{latestValues:s},r,n=!1,o){const c=(o??Vb(i)?RX:QX)(e,s,r,i),u=TX(e,typeof i=="string",n),d=i!==Y.Fragment?{...u,...c,ref:t}:{},{children:m}=e,g=Y.useMemo(()=>Ii(m)?m.get():m,[m]);return Y.createElement(i,{...d,children:g})}function BX({scrapeMotionValuesFromProps:i,createRenderState:e},t,s,r){return{latestValues:DX(t,s,r,i),renderState:e()}}function DX(i,e,t,s){const r={},n=s(i,{});for(const g in n)r[g]=Xp(n[g]);let{initial:o,animate:l}=i;const c=ng(i),u=yQ(i);e&&u&&!c&&i.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let d=t?t.initial===!1:!1;d=d||o===!1;const m=d?l:o;if(m&&typeof m!="boolean"&&!rg(m)){const g=Array.isArray(m)?m:[m];for(let _=0;_<g.length;_++){const y=Eb(i,g[_]);if(y){const{transitionEnd:b,transition:x,...w}=y;for(const k in w){let C=w[k];if(Array.isArray(C)){const A=d?C.length-1:0;C=C[A]}C!==null&&(r[k]=C)}for(const k in b)r[k]=b[k]}}}return r}const KQ=i=>(e,t)=>{const s=Y.useContext(og),r=Y.useContext(db),n=()=>BX(i,e,s,r);return t?n():Nz(n)},zX=KQ({scrapeMotionValuesFromProps:Nb,createRenderState:Xb}),NX=KQ({scrapeMotionValuesFromProps:RQ,createRenderState:GQ}),XX=Symbol.for("motionComponentSymbol");function VX(i,e,t){const s=Y.useRef(t);Y.useInsertionEffect(()=>{s.current=t});const r=Y.useRef(null);return Y.useCallback(n=>{var l;n&&((l=i.onMount)==null||l.call(i,n)),e&&(n?e.mount(n):e.unmount());const o=s.current;if(typeof o=="function")if(n){const c=o(n);typeof c=="function"&&(r.current=c)}else r.current?(r.current(),r.current=null):o(n);else o&&(o.current=n)},[e])}const JQ=Y.createContext({});function Il(i){return i&&typeof i=="object"&&Object.prototype.hasOwnProperty.call(i,"current")}function ZX(i,e,t,s,r,n){var C,A;const{visualElement:o}=Y.useContext(og),l=Y.useContext(UQ),c=Y.useContext(db),u=Y.useContext(WQ),d=u.reducedMotion,m=u.skipAnimations,g=Y.useRef(null),_=Y.useRef(!1);s=s||l.renderer,!g.current&&s&&(g.current=s(i,{visualState:e,parent:o,props:t,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:d,skipAnimations:m,isSVG:n}),_.current&&g.current&&(g.current.manuallyAnimateOnMount=!0));const y=g.current,b=Y.useContext(JQ);y&&!y.projection&&r&&(y.type==="html"||y.type==="svg")&&jX(g.current,t,r,b);const x=Y.useRef(!1);Y.useInsertionEffect(()=>{y&&x.current&&y.update(t,c)});const w=t[aQ],k=Y.useRef(!!w&&!((C=window.MotionHandoffIsComplete)!=null&&C.call(window,w))&&((A=window.MotionHasOptimisedAnimation)==null?void 0:A.call(window,w)));return Xz(()=>{_.current=!0,y&&(x.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),k.current&&y.animationState&&y.animationState.animateChanges())}),Y.useEffect(()=>{y&&(!k.current&&y.animationState&&y.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{var P;(P=window.MotionHandoffMarkAsComplete)==null||P.call(window,w)}),k.current=!1),y.enteringChildren=void 0)}),y}function jX(i,e,t,s){const{layoutId:r,layout:n,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:u,layoutCrossfade:d}=e;i.projection=new t(i.latestValues,e["data-framer-portal-id"]?void 0:eR(i.parent)),i.projection.setOptions({layoutId:r,layout:n,alwaysMeasureLayout:!!o||l&&Il(l),visualElement:i,animationType:typeof n=="string"?n:"both",initialPromotionConfig:s,crossfade:d,layoutScroll:c,layoutRoot:u})}function eR(i){if(i)return i.options.allowProjection!==!1?i.projection:eR(i.parent)}function s_(i,{forwardMotionProps:e=!1,type:t}={},s,r){s&&wX(s);const n=t?t==="svg":Vb(i),o=n?NX:zX;function l(u,d){let m;const g={...Y.useContext(WQ),...u,layoutId:IX(u)},{isStatic:_}=g,y=MX(u),b=o(u,_);if(!_&&yP){qX();const x=WX(g);m=x.MeasureLayout,y.visualElement=ZX(i,b,g,r,x.ProjectionNode,n)}return M.jsxs(og.Provider,{value:y,children:[m&&y.visualElement?M.jsx(m,{visualElement:y.visualElement,...g}):null,$X(i,u,VX(b,y.visualElement,d),b,_,e,n)]})}l.displayName=`motion.${typeof i=="string"?i:`create(${i.displayName??i.name??""})`}`;const c=Y.forwardRef(l);return c[XX]=i,c}function IX({layoutId:i}){const e=Y.useContext(vP).id;return e&&i!==void 0?e+"-"+i:i}function qX(i,e){Y.useContext(UQ).strict}function WX(i){const e=YQ(),{drag:t,layout:s}=e;if(!t&&!s)return{};const r={...t,...s};return{MeasureLayout:t!=null&&t.isEnabled(i)||s!=null&&s.isEnabled(i)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function UX(i,e){if(typeof Proxy>"u")return s_;const t=new Map,s=(n,o)=>s_(n,o,i,e),r=(n,o)=>s(n,o);return new Proxy(r,{get:(n,o)=>o==="create"?s:(t.has(o)||t.set(o,s_(o,void 0,i,e)),t.get(o))})}const YX=(i,e)=>e.isSVG??Vb(i)?new P7(e):new C7(e,{allowProjection:i!==Y.Fragment});class HX extends Fo{constructor(e){super(e),e.animationState||(e.animationState=B7(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();rg(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let FX=0;class GX extends Fo{constructor(){super(...arguments),this.id=FX++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)return;const r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>{t(this.id)})}mount(){const{register:e,onExitComplete:t}=this.node.presenceContext||{};t&&t(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const KX={animation:{Feature:HX},exit:{Feature:GX}};function gf(i){return{point:{x:i.pageX,y:i.pageY}}}const JX=i=>e=>Lb(e)&&i(e,gf(e));function yu(i,e,t,s){return $u(i,e,JX(t),s)}const tR=({current:i})=>i?i.ownerDocument.defaultView:null,_5=(i,e)=>Math.abs(i-e);function eV(i,e){const t=_5(i.x,e.x),s=_5(i.y,e.y);return Math.sqrt(t**2+s**2)}const v5=new Set(["auto","scroll"]);class iR{constructor(e,t,{transformPagePoint:s,contextWindow:r=window,dragSnapToOrigin:n=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=_=>{this.handleScroll(_.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const _=n_(this.lastMoveEventInfo,this.history),y=this.startEvent!==null,b=eV(_.offset,{x:0,y:0})>=this.distanceThreshold;if(!y&&!b)return;const{point:x}=_,{timestamp:w}=Pi;this.history.push({...x,timestamp:w});const{onStart:k,onMove:C}=this.handlers;y||(k&&k(this.lastMoveEvent,_),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,_)},this.handlePointerMove=(_,y)=>{this.lastMoveEvent=_,this.lastMoveEventInfo=r_(y,this.transformPagePoint),pt.update(this.updatePoint,!0)},this.handlePointerUp=(_,y)=>{this.end();const{onEnd:b,onSessionEnd:x,resumeAnimation:w}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&w&&w(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=n_(_.type==="pointercancel"?this.lastMoveEventInfo:r_(y,this.transformPagePoint),this.history);this.startEvent&&b&&b(_,k),x&&x(_,k)},!Lb(e))return;this.dragSnapToOrigin=n,this.handlers=t,this.transformPagePoint=s,this.distanceThreshold=o,this.contextWindow=r||window;const c=gf(e),u=r_(c,this.transformPagePoint),{point:d}=u,{timestamp:m}=Pi;this.history=[{...d,timestamp:m}];const{onSessionStart:g}=t;g&&g(e,n_(u,this.history)),this.removeListeners=df(yu(this.contextWindow,"pointermove",this.handlePointerMove),yu(this.contextWindow,"pointerup",this.handlePointerUp),yu(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(e){let t=e.parentElement;for(;t;){const s=getComputedStyle(t);(v5.has(s.overflowX)||v5.has(s.overflowY))&&this.scrollPositions.set(t,{x:t.scrollLeft,y:t.scrollTop}),t=t.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const t=this.scrollPositions.get(e);if(!t)return;const s=e===window,r=s?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},n={x:r.x-t.x,y:r.y-t.y};n.x===0&&n.y===0||(s?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=n.x,this.lastMoveEventInfo.point.y+=n.y):this.history.length>0&&(this.history[0].x-=n.x,this.history[0].y-=n.y),this.scrollPositions.set(e,r),pt.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Zo(this.updatePoint)}}function r_(i,e){return e?{point:e(i.point)}:i}function y5(i,e){return{x:i.x-e.x,y:i.y-e.y}}function n_({point:i},e){return{point:i,delta:y5(i,sR(e)),offset:y5(i,tV(e)),velocity:iV(e,.1)}}function tV(i){return i[0]}function sR(i){return i[i.length-1]}function iV(i,e){if(i.length<2)return{x:0,y:0};let t=i.length-1,s=null;const r=sR(i);for(;t>=0&&(s=i[t],!(r.timestamp-s.timestamp>br(e)));)t--;if(!s)return{x:0,y:0};s===i[0]&&i.length>2&&r.timestamp-s.timestamp>br(e)*2&&(s=i[1]);const n=tr(r.timestamp-s.timestamp);if(n===0)return{x:0,y:0};const o={x:(r.x-s.x)/n,y:(r.y-s.y)/n};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function sV(i,{min:e,max:t},s){return e!==void 0&&i<e?i=s?kt(e,i,s.min):Math.max(i,e):t!==void 0&&i>t&&(i=s?kt(t,i,s.max):Math.min(i,t)),i}function b5(i,e,t){return{min:e!==void 0?i.min+e:void 0,max:t!==void 0?i.max+t-(i.max-i.min):void 0}}function rV(i,{top:e,left:t,bottom:s,right:r}){return{x:b5(i.x,t,r),y:b5(i.y,e,s)}}function S5(i,e){let t=e.min-i.min,s=e.max-i.max;return e.max-e.min<i.max-i.min&&([t,s]=[s,t]),{min:t,max:s}}function nV(i,e){return{x:S5(i.x,e.x),y:S5(i.y,e.y)}}function oV(i,e){let t=.5;const s=es(i),r=es(e);return r>s?t=Pu(e.min,e.max-s,i.min):s>r&&(t=Pu(i.min,i.max-r,e.min)),tn(0,1,t)}function aV(i,e){const t={};return e.min!==void 0&&(t.min=e.min-i.min),e.max!==void 0&&(t.max=e.max-i.min),t}const g1=.35;function lV(i=g1){return i===!1?i=0:i===!0&&(i=g1),{x:x5(i,"left","right"),y:x5(i,"top","bottom")}}function x5(i,e,t){return{min:w5(i,e),max:w5(i,t)}}function w5(i,e){return typeof i=="number"?i:i[e]||0}const hV=new WeakMap;class cV{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ii(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:t=!1,distanceThreshold:s}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const n=m=>{t&&this.snapToCursor(gf(m).point),this.stopAnimation()},o=(m,g)=>{const{drag:_,dragPropagation:y,onDragStart:b}=this.getProps();if(_&&!y&&(this.openDragLock&&this.openDragLock(),this.openDragLock=IN(_),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=g,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Zr(w=>{let k=this.getAxisMotionValue(w).get()||0;if(Gr.test(k)){const{projection:C}=this.visualElement;if(C&&C.layout){const A=C.layout.layoutBox[w];A&&(k=es(A)*(parseFloat(k)/100))}}this.originPoint[w]=k}),b&&pt.update(()=>b(m,g),!1,!0),l1(this.visualElement,"transform");const{animationState:x}=this.visualElement;x&&x.setActive("whileDrag",!0)},l=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g;const{dragPropagation:_,dragDirectionLock:y,onDirectionLock:b,onDrag:x}=this.getProps();if(!_&&!this.openDragLock)return;const{offset:w}=g;if(y&&this.currentDirection===null){this.currentDirection=fV(w),this.currentDirection!==null&&b&&b(this.currentDirection);return}this.updateAxis("x",g.point,w),this.updateAxis("y",g.point,w),this.visualElement.render(),x&&pt.update(()=>x(m,g),!1,!0)},c=(m,g)=>{this.latestPointerEvent=m,this.latestPanInfo=g,this.stop(m,g),this.latestPointerEvent=null,this.latestPanInfo=null},u=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:d}=this.getProps();this.panSession=new iR(e,{onSessionStart:n,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:u},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:s,contextWindow:tR(this.visualElement),element:this.visualElement.current})}stop(e,t){const s=e||this.latestPointerEvent,r=t||this.latestPanInfo,n=this.isDragging;if(this.cancel(),!n||!r||!s)return;const{velocity:o}=r;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&pt.postRender(()=>l(s,r))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,t,s){const{drag:r}=this.getProps();if(!s||!Gd(e,r,this.currentDirection))return;const n=this.getAxisMotionValue(e);let o=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(o=sV(o,this.constraints[e],this.elastic[e])),n.set(o)}resolveConstraints(){var n;const{dragConstraints:e,dragElastic:t}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(n=this.visualElement.projection)==null?void 0:n.layout,r=this.constraints;e&&Il(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=rV(s.layoutBox,e):this.constraints=!1,this.elastic=lV(t),r!==this.constraints&&!Il(e)&&s&&this.constraints&&!this.hasMutatedConstraints&&Zr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=aV(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Il(e))return!1;const s=e.current,{projection:r}=this.visualElement;if(!r||!r.layout)return!1;const n=v7(s,r.root,this.visualElement.getTransformPagePoint());let o=nV(r.layout.layoutBox,n);if(t){const l=t(g7(o));this.hasMutatedConstraints=!!l,l&&(o=wQ(l))}return o}startAnimation(e){const{drag:t,dragMomentum:s,dragElastic:r,dragTransition:n,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},u=Zr(d=>{if(!Gd(d,t,this.currentDirection))return;let m=c&&c[d]||{};o&&(m={min:0,max:0});const g=r?200:1e6,_=r?40:1e7,y={type:"inertia",velocity:s?e[d]:0,bounceStiffness:g,bounceDamping:_,timeConstant:750,restDelta:1,restSpeed:10,...n,...m};return this.startAxisValueAnimation(d,y)});return Promise.all(u).then(l)}startAxisValueAnimation(e,t){const s=this.getAxisMotionValue(e);return l1(this.visualElement,e),s.start(Mb(e,s,0,t,this.visualElement,!1))}stopAnimation(){Zr(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),r=s[t];return r||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){Zr(t=>{const{drag:s}=this.getProps();if(!Gd(t,s,this.currentDirection))return;const{projection:r}=this.visualElement,n=this.getAxisMotionValue(t);if(r&&r.layout){const{min:o,max:l}=r.layout.layoutBox[t],c=n.get()||0;n.set(e[t]-kt(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:s}=this.visualElement;if(!Il(t)||!s||!this.constraints)return;this.stopAnimation();const r={x:0,y:0};Zr(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();r[o]=oV({min:c,max:c},this.constraints[o])}});const{transformTemplate:n}=this.visualElement.getProps();this.visualElement.current.style.transform=n?n({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.constraints=!1,this.resolveConstraints(),Zr(o=>{if(!Gd(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:u}=this.constraints[o];l.set(kt(c,u,r[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;hV.set(this.visualElement,this);const e=this.visualElement.current,t=yu(e,"pointerdown",u=>{const{drag:d,dragListener:m=!0}=this.getProps(),g=u.target,_=g!==e&&FN(g);d&&m&&!_&&this.start(u)});let s;const r=()=>{const{dragConstraints:u}=this.getProps();Il(u)&&u.current&&(this.constraints=this.resolveRefConstraints(),s||(s=uV(e,u.current,()=>this.scalePositionWithinConstraints())))},{projection:n}=this.visualElement,o=n.addEventListener("measure",r);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),pt.read(r);const l=$u(window,"resize",()=>this.scalePositionWithinConstraints()),c=n.addEventListener("didUpdate",(({delta:u,hasLayoutChanged:d})=>{this.isDragging&&d&&(Zr(m=>{const g=this.getAxisMotionValue(m);g&&(this.originPoint[m]+=u[m].translate,g.set(g.get()+u[m].translate))}),this.visualElement.render())}));return()=>{l(),t(),o(),c&&c(),s&&s()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:s=!1,dragPropagation:r=!1,dragConstraints:n=!1,dragElastic:o=g1,dragMomentum:l=!0}=e;return{...e,drag:t,dragDirectionLock:s,dragPropagation:r,dragConstraints:n,dragElastic:o,dragMomentum:l}}}function C5(i){let e=!0;return()=>{if(e){e=!1;return}i()}}function uV(i,e,t){const s=L2(i,C5(t)),r=L2(e,C5(t));return()=>{s(),r()}}function Gd(i,e,t){return(e===!0||e===i)&&(t===null||t===i)}function fV(i,e=10){let t=null;return Math.abs(i.y)>e?t="y":Math.abs(i.x)>e&&(t="x"),t}class dV extends Fo{constructor(e){super(e),this.removeGroupControls=ar,this.removeListeners=ar,this.controls=new cV(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ar}update(){const{dragControls:e}=this.node.getProps(),{dragControls:t}=this.node.prevProps||{};e!==t&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const o_=i=>(e,t)=>{i&&pt.update(()=>i(e,t),!1,!0)};class pV extends Fo{constructor(){super(...arguments),this.removePointerDownListener=ar}onPointerDown(e){this.session=new iR(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:tR(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:s,onPanEnd:r}=this.node.getProps();return{onSessionStart:o_(e),onStart:o_(t),onMove:o_(s),onEnd:(n,o)=>{delete this.session,r&&pt.postRender(()=>r(n,o))}}}mount(){this.removePointerDownListener=yu(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let a_=!1;class mV extends Y.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s,layoutId:r}=this.props,{projection:n}=e;n&&(t.group&&t.group.add(n),s&&s.register&&r&&s.register(n),a_&&n.root.didUpdate(),n.addEventListener("animationComplete",()=>{this.safeToRemove()}),n.setOptions({...n.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Vp.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:s,drag:r,isPresent:n}=this.props,{projection:o}=s;return o&&(o.isPresent=n,e.layoutDependency!==t&&o.setOptions({...o.options,layoutDependency:t}),a_=!0,r||e.layoutDependency!==t||t===void 0||e.isPresent!==n?o.willUpdate():this.safeToRemove(),e.isPresent!==n&&(n?o.promote():o.relegate()||pt.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Rb.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:s}=this.props,{projection:r}=e;a_=!0,r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),s&&s.deregister&&s.deregister(r))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function rR(i){const[e,t]=SX(),s=Y.useContext(vP);return M.jsx(mV,{...i,layoutGroup:s,switchLayoutGroup:Y.useContext(JQ),isPresent:e,safeToRemove:t})}const gV={pan:{Feature:pV},drag:{Feature:dV,ProjectionNode:qQ,MeasureLayout:rR}};function k5(i,e,t){const{props:s}=i;i.animationState&&s.whileHover&&i.animationState.setActive("whileHover",t==="Start");const r="onHover"+t,n=s[r];n&&pt.postRender(()=>n(e,gf(e)))}class OV extends Fo{mount(){const{current:e}=this.node;e&&(this.unmount=WN(e,(t,s)=>(k5(this.node,s,"Start"),r=>k5(this.node,r,"End"))))}unmount(){}}class _V extends Fo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=df($u(this.node.current,"focus",()=>this.onFocus()),$u(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function T5(i,e,t){const{props:s}=i;if(i.current instanceof HTMLButtonElement&&i.current.disabled)return;i.animationState&&s.whileTap&&i.animationState.setActive("whileTap",t==="Start");const r="onTap"+(t==="End"?"":t),n=s[r];n&&pt.postRender(()=>n(e,gf(e)))}class vV extends Fo{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:t,propagate:s}=this.node.props;this.unmount=KN(e,(r,n)=>(T5(this.node,n,"Start"),(o,{success:l})=>T5(this.node,o,l?"End":"Cancel")),{useGlobalTarget:t,stopPropagation:(s==null?void 0:s.tap)===!1})}unmount(){}}const O1=new WeakMap,l_=new WeakMap,yV=i=>{const e=O1.get(i.target);e&&e(i)},bV=i=>{i.forEach(yV)};function SV({root:i,...e}){const t=i||document;l_.has(t)||l_.set(t,{});const s=l_.get(t),r=JSON.stringify(e);return s[r]||(s[r]=new IntersectionObserver(bV,{root:i,...e})),s[r]}function xV(i,e,t){const s=SV(e);return O1.set(i,t),s.observe(i),()=>{O1.delete(i),s.unobserve(i)}}const wV={some:0,all:1};class CV extends Fo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:s,amount:r="some",once:n}=e,o={root:t?t.current:void 0,rootMargin:s,threshold:typeof r=="number"?r:wV[r]},l=c=>{const{isIntersecting:u}=c;if(this.isInView===u||(this.isInView=u,n&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:d,onViewportLeave:m}=this.node.getProps(),g=u?d:m;g&&g(c)};return xV(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(kV(e,t))&&this.startObserver()}unmount(){}}function kV({viewport:i={}},{viewport:e={}}={}){return t=>i[t]!==e[t]}const TV={inView:{Feature:CV},tap:{Feature:vV},focus:{Feature:_V},hover:{Feature:OV}},AV={layout:{ProjectionNode:qQ,MeasureLayout:rR}},MV={...KX,...TV,...gV,...AV},nR=UX(MV,YX);function EV({roadmap:i,state:e,todos:t}){var m;const{connected:s}=ff(),r=(i==null?void 0:i.progress_percent)??0,n=(i==null?void 0:i.current_phase)??(e==null?void 0:e.currentPhase)??"--",o=((m=i==null?void 0:i.phases.find(g=>g.number===i.current_phase))==null?void 0:m.name)??"",l=(e==null?void 0:e.blockers.filter(g=>!g.includes("RESOLVED")).length)??0,c=(t==null?void 0:t.pending.length)??0,u=(i==null?void 0:i.completed_phases)??0,d=(i==null?void 0:i.phase_count)??0;return M.jsxs("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${s?"bg-success":"bg-danger"}`,title:s?"Connected":"Disconnected"}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Milestone Progress"}),M.jsxs("span",{className:"ml-auto font-mono text-xs text-muted-foreground",children:[u,"/",d," phases"]})]}),M.jsx("div",{className:"h-2 w-full overflow-hidden rounded-sm bg-muted",children:M.jsx(nR.div,{className:"h-full rounded-sm bg-accent",initial:{width:0},animate:{width:`${r}%`},transition:{duration:.6,ease:"easeOut"}})}),M.jsxs("div",{className:"flex items-center gap-8",children:[M.jsxs("div",{className:"flex items-baseline gap-1.5",children:[M.jsxs("span",{className:"font-mono text-2xl font-bold tabular-nums text-foreground",children:[r,"%"]}),M.jsx("span",{className:"text-xs text-muted-foreground",children:"complete"})]}),M.jsxs("div",{className:"flex items-baseline gap-2 border-l border-border pl-8",children:[M.jsx("span",{className:"font-mono text-sm font-semibold text-accent",children:n}),M.jsx("span",{className:"text-sm text-foreground",children:o})]}),M.jsxs("div",{className:"ml-auto flex items-center gap-6",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Blockers"}),M.jsx("span",{className:`inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ${l>0?"bg-danger/20 text-danger shadow-[0_0_8px_rgba(239,68,68,0.3)]":"bg-muted text-muted-foreground"}`,children:l})]}),M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Todos"}),M.jsx("span",{className:`inline-flex h-6 min-w-6 items-center justify-center rounded-sm px-1.5 font-mono text-xs font-bold ${c>0?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"}`,children:c})]})]})]})]})}function PV({status:i}){switch(i){case"complete":return M.jsx("svg",{className:"h-4 w-4 text-success",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M3 8.5l3.5 3.5L13 4"})});case"partial":return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-accent bg-transparent"});case"planned":case"researched":case"discussed":return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full border-2 border-muted-foreground bg-transparent"});default:return M.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-muted"})}}function QV(i){switch(i){case"complete":return"bg-success";case"partial":return"bg-accent";default:return"bg-muted-foreground"}}function RV({phaseName:i,phaseNumber:e,completedPlans:t,totalPlans:s,status:r,roadmapComplete:n,isCurrent:o,onClick:l,onToggleComplete:c}){const u=s>0?Math.round(t/s*100):0;return M.jsxs("button",{type:"button",onClick:()=>l(e),className:`group flex w-full flex-col gap-2 rounded-sm px-4 py-3 text-left transition-colors ${o?"border-l-4 border-l-accent bg-card-hover":"border-l-4 border-l-transparent hover:bg-card-hover"}`,children:[M.jsxs("div",{className:"flex items-center gap-3",children:[c?M.jsx("input",{type:"checkbox",checked:n,onChange:d=>{d.stopPropagation(),c(e,d.target.checked)},onClick:d=>d.stopPropagation(),className:"h-3.5 w-3.5 shrink-0 cursor-pointer accent-accent",title:n?"Mark incomplete":"Mark complete"}):M.jsx(PV,{status:r}),M.jsx("span",{className:`font-mono text-sm font-semibold ${o?"text-accent":"text-muted-foreground"}`,children:e}),M.jsx("span",{className:"truncate text-sm text-foreground",children:i}),M.jsxs("span",{className:"ml-auto shrink-0 font-mono text-xs text-muted-foreground",children:[t,"/",s]})]}),M.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-sm bg-muted",children:M.jsx(nR.div,{className:`h-full rounded-sm ${QV(r)}`,initial:{width:0},animate:{width:`${u}%`},transition:{duration:.5,ease:"easeOut"}})})]})}function LV({phases:i,currentPhase:e,onPhaseClick:t,onToggleComplete:s}){return M.jsxs("div",{className:"flex flex-col gap-1",children:[M.jsxs("div",{className:"flex items-center justify-between px-4 pb-2",children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-widest text-muted-foreground",children:"Phases"}),M.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:i.length})]}),M.jsx("div",{className:"flex flex-col gap-1",children:i.length===0?M.jsxs("div",{className:"flex flex-col items-center gap-3 px-4 py-10 text-center",children:[M.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:"No project initialized yet."}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Run"," ",M.jsx("code",{className:"rounded-sm bg-muted px-1.5 py-0.5 text-accent",children:"/maxsim:new-project"})," ","in Claude Code to get started."]})]}):i.map(r=>M.jsx(RV,{phaseNumber:r.number,phaseName:r.name,completedPlans:r.summaryCount,totalPlans:r.planCount,status:r.diskStatus,roadmapComplete:r.roadmapComplete,isCurrent:r.number===e,onClick:t,onToggleComplete:s},r.number))})]})}function oR(i){var e,t,s="";if(typeof i=="string"||typeof i=="number")s+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=oR(i[e]))&&(s&&(s+=" "),s+=t)}else for(t in i)i[t]&&(s&&(s+=" "),s+=t);return s}function $V(){for(var i,e,t=0,s="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=oR(i))&&(s&&(s+=" "),s+=e);return s}const BV=(i,e)=>{const t=new Array(i.length+e.length);for(let s=0;s<i.length;s++)t[s]=i[s];for(let s=0;s<e.length;s++)t[i.length+s]=e[s];return t},DV=(i,e)=>({classGroupId:i,validator:e}),aR=(i=new Map,e=null,t)=>({nextPart:i,validators:e,classGroupId:t}),_m="-",A5=[],zV="arbitrary..",NV=i=>{const e=VV(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:s}=i;return{getClassGroupId:o=>{if(o.startsWith("[")&&o.endsWith("]"))return XV(o);const l=o.split(_m),c=l[0]===""&&l.length>1?1:0;return lR(l,c,e)},getConflictingClassGroupIds:(o,l)=>{if(l){const c=s[o],u=t[o];return c?u?BV(u,c):c:u||A5}return t[o]||A5}}},lR=(i,e,t)=>{if(i.length-e===0)return t.classGroupId;const r=i[e],n=t.nextPart.get(r);if(n){const u=lR(i,e+1,n);if(u)return u}const o=t.validators;if(o===null)return;const l=e===0?i.join(_m):i.slice(e).join(_m),c=o.length;for(let u=0;u<c;u++){const d=o[u];if(d.validator(l))return d.classGroupId}},XV=i=>i.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=i.slice(1,-1),t=e.indexOf(":"),s=e.slice(0,t);return s?zV+s:void 0})(),VV=i=>{const{theme:e,classGroups:t}=i;return ZV(t,e)},ZV=(i,e)=>{const t=aR();for(const s in i){const r=i[s];Zb(r,t,s,e)}return t},Zb=(i,e,t,s)=>{const r=i.length;for(let n=0;n<r;n++){const o=i[n];jV(o,e,t,s)}},jV=(i,e,t,s)=>{if(typeof i=="string"){IV(i,e,t);return}if(typeof i=="function"){qV(i,e,t,s);return}WV(i,e,t,s)},IV=(i,e,t)=>{const s=i===""?e:hR(e,i);s.classGroupId=t},qV=(i,e,t,s)=>{if(UV(i)){Zb(i(s),e,t,s);return}e.validators===null&&(e.validators=[]),e.validators.push(DV(t,i))},WV=(i,e,t,s)=>{const r=Object.entries(i),n=r.length;for(let o=0;o<n;o++){const[l,c]=r[o];Zb(c,hR(e,l),t,s)}},hR=(i,e)=>{let t=i;const s=e.split(_m),r=s.length;for(let n=0;n<r;n++){const o=s[n];let l=t.nextPart.get(o);l||(l=aR(),t.nextPart.set(o,l)),t=l}return t},UV=i=>"isThemeGetter"in i&&i.isThemeGetter===!0,YV=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),s=Object.create(null);const r=(n,o)=>{t[n]=o,e++,e>i&&(e=0,s=t,t=Object.create(null))};return{get(n){let o=t[n];if(o!==void 0)return o;if((o=s[n])!==void 0)return r(n,o),o},set(n,o){n in t?t[n]=o:r(n,o)}}},_1="!",M5=":",HV=[],E5=(i,e,t,s,r)=>({modifiers:i,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:s,isExternal:r}),FV=i=>{const{prefix:e,experimentalParseClassName:t}=i;let s=r=>{const n=[];let o=0,l=0,c=0,u;const d=r.length;for(let b=0;b<d;b++){const x=r[b];if(o===0&&l===0){if(x===M5){n.push(r.slice(c,b)),c=b+1;continue}if(x==="/"){u=b;continue}}x==="["?o++:x==="]"?o--:x==="("?l++:x===")"&&l--}const m=n.length===0?r:r.slice(c);let g=m,_=!1;m.endsWith(_1)?(g=m.slice(0,-1),_=!0):m.startsWith(_1)&&(g=m.slice(1),_=!0);const y=u&&u>c?u-c:void 0;return E5(n,_,g,y)};if(e){const r=e+M5,n=s;s=o=>o.startsWith(r)?n(o.slice(r.length)):E5(HV,!1,o,void 0,!0)}if(t){const r=s;s=n=>t({className:n,parseClassName:r})}return s},GV=i=>{const e=new Map;return i.orderSensitiveModifiers.forEach((t,s)=>{e.set(t,1e6+s)}),t=>{const s=[];let r=[];for(let n=0;n<t.length;n++){const o=t[n],l=o[0]==="[",c=e.has(o);l||c?(r.length>0&&(r.sort(),s.push(...r),r=[]),s.push(o)):r.push(o)}return r.length>0&&(r.sort(),s.push(...r)),s}},KV=i=>({cache:YV(i.cacheSize),parseClassName:FV(i),sortModifiers:GV(i),...NV(i)}),JV=/\s+/,eZ=(i,e)=>{const{parseClassName:t,getClassGroupId:s,getConflictingClassGroupIds:r,sortModifiers:n}=e,o=[],l=i.trim().split(JV);let c="";for(let u=l.length-1;u>=0;u-=1){const d=l[u],{isExternal:m,modifiers:g,hasImportantModifier:_,baseClassName:y,maybePostfixModifierPosition:b}=t(d);if(m){c=d+(c.length>0?" "+c:c);continue}let x=!!b,w=s(x?y.substring(0,b):y);if(!w){if(!x){c=d+(c.length>0?" "+c:c);continue}if(w=s(y),!w){c=d+(c.length>0?" "+c:c);continue}x=!1}const k=g.length===0?"":g.length===1?g[0]:n(g).join(":"),C=_?k+_1:k,A=C+w;if(o.indexOf(A)>-1)continue;o.push(A);const P=r(w,x);for(let E=0;E<P.length;++E){const $=P[E];o.push(C+$)}c=d+(c.length>0?" "+c:c)}return c},tZ=(...i)=>{let e=0,t,s,r="";for(;e<i.length;)(t=i[e++])&&(s=cR(t))&&(r&&(r+=" "),r+=s);return r},cR=i=>{if(typeof i=="string")return i;let e,t="";for(let s=0;s<i.length;s++)i[s]&&(e=cR(i[s]))&&(t&&(t+=" "),t+=e);return t},iZ=(i,...e)=>{let t,s,r,n;const o=c=>{const u=e.reduce((d,m)=>m(d),i());return t=KV(u),s=t.cache.get,r=t.cache.set,n=l,l(c)},l=c=>{const u=s(c);if(u)return u;const d=eZ(c,t);return r(c,d),d};return n=o,(...c)=>n(tZ(...c))},sZ=[],Jt=i=>{const e=t=>t[i]||sZ;return e.isThemeGetter=!0,e},uR=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fR=/^\((?:(\w[\w-]*):)?(.+)\)$/i,rZ=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,nZ=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,oZ=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,aZ=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lZ=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,hZ=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,bo=i=>rZ.test(i),Ne=i=>!!i&&!Number.isNaN(Number(i)),So=i=>!!i&&Number.isInteger(Number(i)),h_=i=>i.endsWith("%")&&Ne(i.slice(0,-1)),Tn=i=>nZ.test(i),dR=()=>!0,cZ=i=>oZ.test(i)&&!aZ.test(i),jb=()=>!1,uZ=i=>lZ.test(i),fZ=i=>hZ.test(i),dZ=i=>!Se(i)&&!we(i),pZ=i=>Go(i,gR,jb),Se=i=>uR.test(i),_a=i=>Go(i,OR,cZ),P5=i=>Go(i,SZ,Ne),mZ=i=>Go(i,vR,dR),gZ=i=>Go(i,_R,jb),Q5=i=>Go(i,pR,jb),OZ=i=>Go(i,mR,fZ),Kd=i=>Go(i,yR,uZ),we=i=>fR.test(i),Nc=i=>Ha(i,OR),_Z=i=>Ha(i,_R),R5=i=>Ha(i,pR),vZ=i=>Ha(i,gR),yZ=i=>Ha(i,mR),Jd=i=>Ha(i,yR,!0),bZ=i=>Ha(i,vR,!0),Go=(i,e,t)=>{const s=uR.exec(i);return s?s[1]?e(s[1]):t(s[2]):!1},Ha=(i,e,t=!1)=>{const s=fR.exec(i);return s?s[1]?e(s[1]):t:!1},pR=i=>i==="position"||i==="percentage",mR=i=>i==="image"||i==="url",gR=i=>i==="length"||i==="size"||i==="bg-size",OR=i=>i==="length",SZ=i=>i==="number",_R=i=>i==="family-name",vR=i=>i==="number"||i==="weight",yR=i=>i==="shadow",xZ=()=>{const i=Jt("color"),e=Jt("font"),t=Jt("text"),s=Jt("font-weight"),r=Jt("tracking"),n=Jt("leading"),o=Jt("breakpoint"),l=Jt("container"),c=Jt("spacing"),u=Jt("radius"),d=Jt("shadow"),m=Jt("inset-shadow"),g=Jt("text-shadow"),_=Jt("drop-shadow"),y=Jt("blur"),b=Jt("perspective"),x=Jt("aspect"),w=Jt("ease"),k=Jt("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],P=()=>[...A(),we,Se],E=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],z=()=>[we,Se,c],I=()=>[bo,"full","auto",...z()],se=()=>[So,"none","subgrid",we,Se],F=()=>["auto",{span:["full",So,we,Se]},So,we,Se],R=()=>[So,"auto",we,Se],L=()=>["auto","min","max","fr",we,Se],N=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],Z=()=>["start","end","center","stretch","center-safe","end-safe"],Q=()=>["auto",...z()],X=()=>[bo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...z()],W=()=>[bo,"screen","full","dvw","lvw","svw","min","max","fit",...z()],U=()=>[bo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...z()],q=()=>[i,we,Se],D=()=>[...A(),R5,Q5,{position:[we,Se]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],ie=()=>["auto","cover","contain",vZ,pZ,{size:[we,Se]}],ce=()=>[h_,Nc,_a],he=()=>["","none","full",u,we,Se],de=()=>["",Ne,Nc,_a],ge=()=>["solid","dashed","dotted","double"],Ae=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ye=()=>[Ne,h_,R5,Q5],mt=()=>["","none",y,we,Se],Ft=()=>["none",Ne,we,Se],Gt=()=>["none",Ne,we,Se],oi=()=>[Ne,we,Se],Pe=()=>[bo,"full",...z()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Tn],breakpoint:[Tn],color:[dR],container:[Tn],"drop-shadow":[Tn],ease:["in","out","in-out"],font:[dZ],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Tn],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Tn],shadow:[Tn],spacing:["px",Ne],text:[Tn],"text-shadow":[Tn],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",bo,Se,we,x]}],container:["container"],columns:[{columns:[Ne,Se,we,l]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:P()}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:I()}],"inset-x":[{"inset-x":I()}],"inset-y":[{"inset-y":I()}],start:[{"inset-s":I(),start:I()}],end:[{"inset-e":I(),end:I()}],"inset-bs":[{"inset-bs":I()}],"inset-be":[{"inset-be":I()}],top:[{top:I()}],right:[{right:I()}],bottom:[{bottom:I()}],left:[{left:I()}],visibility:["visible","invisible","collapse"],z:[{z:[So,"auto",we,Se]}],basis:[{basis:[bo,"full","auto",l,...z()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ne,bo,"auto","initial","none",Se]}],grow:[{grow:["",Ne,we,Se]}],shrink:[{shrink:["",Ne,we,Se]}],order:[{order:[So,"first","last","none",we,Se]}],"grid-cols":[{"grid-cols":se()}],"col-start-end":[{col:F()}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":se()}],"row-start-end":[{row:F()}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":L()}],"auto-rows":[{"auto-rows":L()}],gap:[{gap:z()}],"gap-x":[{"gap-x":z()}],"gap-y":[{"gap-y":z()}],"justify-content":[{justify:[...N(),"normal"]}],"justify-items":[{"justify-items":[...Z(),"normal"]}],"justify-self":[{"justify-self":["auto",...Z()]}],"align-content":[{content:["normal",...N()]}],"align-items":[{items:[...Z(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...Z(),{baseline:["","last"]}]}],"place-content":[{"place-content":N()}],"place-items":[{"place-items":[...Z(),"baseline"]}],"place-self":[{"place-self":["auto",...Z()]}],p:[{p:z()}],px:[{px:z()}],py:[{py:z()}],ps:[{ps:z()}],pe:[{pe:z()}],pbs:[{pbs:z()}],pbe:[{pbe:z()}],pt:[{pt:z()}],pr:[{pr:z()}],pb:[{pb:z()}],pl:[{pl:z()}],m:[{m:Q()}],mx:[{mx:Q()}],my:[{my:Q()}],ms:[{ms:Q()}],me:[{me:Q()}],mbs:[{mbs:Q()}],mbe:[{mbe:Q()}],mt:[{mt:Q()}],mr:[{mr:Q()}],mb:[{mb:Q()}],ml:[{ml:Q()}],"space-x":[{"space-x":z()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":z()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...W()]}],"min-inline-size":[{"min-inline":["auto",...W()]}],"max-inline-size":[{"max-inline":["none",...W()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[l,"screen",...X()]}],"min-w":[{"min-w":[l,"screen","none",...X()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[o]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",t,Nc,_a]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,bZ,mZ]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",h_,Se]}],"font-family":[{font:[_Z,gZ,e]}],"font-features":[{"font-features":[Se]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,we,Se]}],"line-clamp":[{"line-clamp":[Ne,"none",we,P5]}],leading:[{leading:[n,...z()]}],"list-image":[{"list-image":["none",we,Se]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",we,Se]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:q()}],"text-color":[{text:q()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ge(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ne,"from-font","auto",we,_a]}],"text-decoration-color":[{decoration:q()}],"underline-offset":[{"underline-offset":[Ne,"auto",we,Se]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:z()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",we,Se]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",we,Se]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:ie()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},So,we,Se],radial:["",we,Se],conic:[So,we,Se]},yZ,OZ]}],"bg-color":[{bg:q()}],"gradient-from-pos":[{from:ce()}],"gradient-via-pos":[{via:ce()}],"gradient-to-pos":[{to:ce()}],"gradient-from":[{from:q()}],"gradient-via":[{via:q()}],"gradient-to":[{to:q()}],rounded:[{rounded:he()}],"rounded-s":[{"rounded-s":he()}],"rounded-e":[{"rounded-e":he()}],"rounded-t":[{"rounded-t":he()}],"rounded-r":[{"rounded-r":he()}],"rounded-b":[{"rounded-b":he()}],"rounded-l":[{"rounded-l":he()}],"rounded-ss":[{"rounded-ss":he()}],"rounded-se":[{"rounded-se":he()}],"rounded-ee":[{"rounded-ee":he()}],"rounded-es":[{"rounded-es":he()}],"rounded-tl":[{"rounded-tl":he()}],"rounded-tr":[{"rounded-tr":he()}],"rounded-br":[{"rounded-br":he()}],"rounded-bl":[{"rounded-bl":he()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ge(),"hidden","none"]}],"divide-style":[{divide:[...ge(),"hidden","none"]}],"border-color":[{border:q()}],"border-color-x":[{"border-x":q()}],"border-color-y":[{"border-y":q()}],"border-color-s":[{"border-s":q()}],"border-color-e":[{"border-e":q()}],"border-color-bs":[{"border-bs":q()}],"border-color-be":[{"border-be":q()}],"border-color-t":[{"border-t":q()}],"border-color-r":[{"border-r":q()}],"border-color-b":[{"border-b":q()}],"border-color-l":[{"border-l":q()}],"divide-color":[{divide:q()}],"outline-style":[{outline:[...ge(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ne,we,Se]}],"outline-w":[{outline:["",Ne,Nc,_a]}],"outline-color":[{outline:q()}],shadow:[{shadow:["","none",d,Jd,Kd]}],"shadow-color":[{shadow:q()}],"inset-shadow":[{"inset-shadow":["none",m,Jd,Kd]}],"inset-shadow-color":[{"inset-shadow":q()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:q()}],"ring-offset-w":[{"ring-offset":[Ne,_a]}],"ring-offset-color":[{"ring-offset":q()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":q()}],"text-shadow":[{"text-shadow":["none",g,Jd,Kd]}],"text-shadow-color":[{"text-shadow":q()}],opacity:[{opacity:[Ne,we,Se]}],"mix-blend":[{"mix-blend":[...Ae(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Ae()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ne]}],"mask-image-linear-from-pos":[{"mask-linear-from":ye()}],"mask-image-linear-to-pos":[{"mask-linear-to":ye()}],"mask-image-linear-from-color":[{"mask-linear-from":q()}],"mask-image-linear-to-color":[{"mask-linear-to":q()}],"mask-image-t-from-pos":[{"mask-t-from":ye()}],"mask-image-t-to-pos":[{"mask-t-to":ye()}],"mask-image-t-from-color":[{"mask-t-from":q()}],"mask-image-t-to-color":[{"mask-t-to":q()}],"mask-image-r-from-pos":[{"mask-r-from":ye()}],"mask-image-r-to-pos":[{"mask-r-to":ye()}],"mask-image-r-from-color":[{"mask-r-from":q()}],"mask-image-r-to-color":[{"mask-r-to":q()}],"mask-image-b-from-pos":[{"mask-b-from":ye()}],"mask-image-b-to-pos":[{"mask-b-to":ye()}],"mask-image-b-from-color":[{"mask-b-from":q()}],"mask-image-b-to-color":[{"mask-b-to":q()}],"mask-image-l-from-pos":[{"mask-l-from":ye()}],"mask-image-l-to-pos":[{"mask-l-to":ye()}],"mask-image-l-from-color":[{"mask-l-from":q()}],"mask-image-l-to-color":[{"mask-l-to":q()}],"mask-image-x-from-pos":[{"mask-x-from":ye()}],"mask-image-x-to-pos":[{"mask-x-to":ye()}],"mask-image-x-from-color":[{"mask-x-from":q()}],"mask-image-x-to-color":[{"mask-x-to":q()}],"mask-image-y-from-pos":[{"mask-y-from":ye()}],"mask-image-y-to-pos":[{"mask-y-to":ye()}],"mask-image-y-from-color":[{"mask-y-from":q()}],"mask-image-y-to-color":[{"mask-y-to":q()}],"mask-image-radial":[{"mask-radial":[we,Se]}],"mask-image-radial-from-pos":[{"mask-radial-from":ye()}],"mask-image-radial-to-pos":[{"mask-radial-to":ye()}],"mask-image-radial-from-color":[{"mask-radial-from":q()}],"mask-image-radial-to-color":[{"mask-radial-to":q()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":A()}],"mask-image-conic-pos":[{"mask-conic":[Ne]}],"mask-image-conic-from-pos":[{"mask-conic-from":ye()}],"mask-image-conic-to-pos":[{"mask-conic-to":ye()}],"mask-image-conic-from-color":[{"mask-conic-from":q()}],"mask-image-conic-to-color":[{"mask-conic-to":q()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:ie()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",we,Se]}],filter:[{filter:["","none",we,Se]}],blur:[{blur:mt()}],brightness:[{brightness:[Ne,we,Se]}],contrast:[{contrast:[Ne,we,Se]}],"drop-shadow":[{"drop-shadow":["","none",_,Jd,Kd]}],"drop-shadow-color":[{"drop-shadow":q()}],grayscale:[{grayscale:["",Ne,we,Se]}],"hue-rotate":[{"hue-rotate":[Ne,we,Se]}],invert:[{invert:["",Ne,we,Se]}],saturate:[{saturate:[Ne,we,Se]}],sepia:[{sepia:["",Ne,we,Se]}],"backdrop-filter":[{"backdrop-filter":["","none",we,Se]}],"backdrop-blur":[{"backdrop-blur":mt()}],"backdrop-brightness":[{"backdrop-brightness":[Ne,we,Se]}],"backdrop-contrast":[{"backdrop-contrast":[Ne,we,Se]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ne,we,Se]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ne,we,Se]}],"backdrop-invert":[{"backdrop-invert":["",Ne,we,Se]}],"backdrop-opacity":[{"backdrop-opacity":[Ne,we,Se]}],"backdrop-saturate":[{"backdrop-saturate":[Ne,we,Se]}],"backdrop-sepia":[{"backdrop-sepia":["",Ne,we,Se]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":z()}],"border-spacing-x":[{"border-spacing-x":z()}],"border-spacing-y":[{"border-spacing-y":z()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",we,Se]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ne,"initial",we,Se]}],ease:[{ease:["linear","initial",w,we,Se]}],delay:[{delay:[Ne,we,Se]}],animate:[{animate:["none",k,we,Se]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[b,we,Se]}],"perspective-origin":[{"perspective-origin":P()}],rotate:[{rotate:Ft()}],"rotate-x":[{"rotate-x":Ft()}],"rotate-y":[{"rotate-y":Ft()}],"rotate-z":[{"rotate-z":Ft()}],scale:[{scale:Gt()}],"scale-x":[{"scale-x":Gt()}],"scale-y":[{"scale-y":Gt()}],"scale-z":[{"scale-z":Gt()}],"scale-3d":["scale-3d"],skew:[{skew:oi()}],"skew-x":[{"skew-x":oi()}],"skew-y":[{"skew-y":oi()}],transform:[{transform:[we,Se,"","none","gpu","cpu"]}],"transform-origin":[{origin:P()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:q()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:q()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",we,Se]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":z()}],"scroll-mx":[{"scroll-mx":z()}],"scroll-my":[{"scroll-my":z()}],"scroll-ms":[{"scroll-ms":z()}],"scroll-me":[{"scroll-me":z()}],"scroll-mbs":[{"scroll-mbs":z()}],"scroll-mbe":[{"scroll-mbe":z()}],"scroll-mt":[{"scroll-mt":z()}],"scroll-mr":[{"scroll-mr":z()}],"scroll-mb":[{"scroll-mb":z()}],"scroll-ml":[{"scroll-ml":z()}],"scroll-p":[{"scroll-p":z()}],"scroll-px":[{"scroll-px":z()}],"scroll-py":[{"scroll-py":z()}],"scroll-ps":[{"scroll-ps":z()}],"scroll-pe":[{"scroll-pe":z()}],"scroll-pbs":[{"scroll-pbs":z()}],"scroll-pbe":[{"scroll-pbe":z()}],"scroll-pt":[{"scroll-pt":z()}],"scroll-pr":[{"scroll-pr":z()}],"scroll-pb":[{"scroll-pb":z()}],"scroll-pl":[{"scroll-pl":z()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",we,Se]}],fill:[{fill:["none",...q()]}],"stroke-w":[{stroke:[Ne,Nc,_a,P5]}],stroke:[{stroke:["none",...q()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},wZ=iZ(xZ);function dt(...i){return wZ($V(i))}function CZ(i){const[e,t]=Y.useState(null),[s,r]=Y.useState(!1),[n,o]=Y.useState(null),{lastChange:l}=ff(),c=Y.useCallback(async()=>{if(!i){t(null),r(!1),o(null);return}r(!0),o(null);try{const u=await fetch(`/api/phase/${encodeURIComponent(i)}`);if(!u.ok){const m=await u.json().catch(()=>({}));throw new Error(m.error||`Failed to fetch phase ${i} (${u.status})`)}const d=await u.json();t(d)}catch(u){o(u instanceof Error?u.message:"Unknown error")}finally{r(!1)}},[i]);return Y.useEffect(()=>{c()},[c]),Y.useEffect(()=>{l>0&&c()},[l,c]),{plans:(e==null?void 0:e.plans)??[],context:(e==null?void 0:e.context)??null,research:(e==null?void 0:e.research)??null,loading:s,error:n,refetch:c}}function kZ({tasks:i,planPath:e,planContent:t,onContentChange:s}){const r=Y.useCallback(async n=>{const o=i[n];if(!o)return;let l=t;const c=o.name.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),d=new RegExp(`<name>\\s*${c}\\s*</name>`).exec(l);if(d){const m=l.slice(d.index),g=m.match(/<done>([\s\S]*?)<\/done>/);if(g){const _=g[1],y=d.index+m.indexOf(g[0]),b=y+g[0].length,x=/^\s*\[x\]/i.test(_);let w;x?w=_.replace(/^\s*\[x\]\s*/i,""):w=`[x] ${_.trim()}`,l=l.slice(0,y)+`<done>${w}</done>`+l.slice(b)}}if(l!==t){s(l);try{const g=e.replace(/^\.planning[\\/]/,"").split(/[\\/]/);await fetch(`/api/plan/${g.join("/")}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:l})})}catch(m){console.error("[task-list] Failed to write checkbox change:",m)}}},[i,e,t,s]);return i.length===0?M.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No tasks defined"}):M.jsx("div",{className:"space-y-1",children:i.map((n,o)=>M.jsxs("div",{className:dt("flex items-start gap-2 py-1 px-2 rounded-md transition-colors","hover:bg-muted/50",n.completed&&"opacity-60"),children:[M.jsx("button",{type:"button",onClick:()=>r(o),className:dt("mt-0.5 flex-shrink-0 w-4 h-4 rounded-sm border transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50",n.completed?"bg-success border-success text-background":"border-muted-foreground hover:border-accent"),"aria-label":`Toggle ${n.name}`,children:n.completed&&M.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M3 8l3 3 7-7"})})}),M.jsxs("div",{className:"flex-1 min-w-0",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:dt("text-sm font-sans",n.completed&&"line-through text-muted-foreground"),children:n.name}),M.jsx("span",{className:dt("text-xs px-1.5 py-0.5 rounded-sm font-mono",n.type.startsWith("checkpoint")?"bg-warning/20 text-warning":"bg-muted text-muted-foreground"),children:n.type})]}),n.files.length>0&&M.jsx("div",{className:"mt-0.5",children:n.files.map((l,c)=>M.jsx("span",{className:"text-xs font-mono text-muted-foreground mr-2",children:l},c))})]})]},o))})}function TZ({plan:i,onEdit:e}){const[t,s]=Y.useState(i.content),r=i.frontmatter,n=r.plan??"?",o=r.wave,l=r.autonomous,c=r.depends_on??[],u=r.files_modified??[];let d="";const m=i.content.match(/<objective>([\s\S]*?)<\/objective>/);if(m){const y=m[1].trim().split(`
|
|
50
50
|
`)[0];d=y.length>120?y.slice(0,117)+"...":y}const g=Y.useCallback(_=>{s(_)},[]);return M.jsxs("div",{className:dt("bg-card border border-border rounded-lg p-4","transition-colors hover:bg-card-hover"),children:[M.jsxs("div",{className:"flex items-center justify-between mb-3",children:[M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsxs("span",{className:"text-lg font-semibold font-mono text-accent",children:["#",String(n).padStart(2,"0")]}),o!==void 0&&M.jsxs("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-accent/20 text-accent-glow font-mono",children:["wave ",o]}),l&&M.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"autonomous"})]}),M.jsx("button",{type:"button",onClick:()=>e(i.path),className:dt("text-xs px-3 py-1 rounded-md font-mono","bg-muted text-muted-foreground","hover:bg-accent/20 hover:text-accent-glow","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:"Edit"})]}),d&&M.jsx("p",{className:"text-sm text-muted-foreground mb-3 leading-relaxed",children:d}),M.jsxs("div",{className:"flex gap-4 mb-3 text-xs text-muted-foreground font-mono",children:[c.length>0&&M.jsxs("span",{children:["depends: ",c.join(", ")]}),u.length>0&&M.jsxs("span",{children:[u.length," file",u.length!==1?"s":""]}),M.jsxs("span",{children:[i.tasks.length," task",i.tasks.length!==1?"s":""]})]}),M.jsx(kZ,{tasks:i.tasks,planPath:i.path,planContent:t,onContentChange:g})]})}function v1(){return v1=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var s in t)({}).hasOwnProperty.call(t,s)&&(i[s]=t[s])}return i},v1.apply(null,arguments)}function AZ(i,e){if(i==null)return{};var t={};for(var s in i)if({}.hasOwnProperty.call(i,s)){if(e.indexOf(s)!==-1)continue;t[s]=i[s]}return t}let y1=[],bR=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?bR:y1).push(t=t+i[e])})();function MZ(i){if(i<768)return!1;for(let e=0,t=y1.length;;){let s=e+t>>1;if(i<y1[s])t=s;else if(i>=bR[s])e=s+1;else return!0;if(e==t)return!1}}function L5(i){return i>=127462&&i<=127487}const $5=8205;function EZ(i,e,t=!0,s=!0){return(t?SR:PZ)(i,e,s)}function SR(i,e,t){if(e==i.length)return e;e&&xR(i.charCodeAt(e))&&wR(i.charCodeAt(e-1))&&e--;let s=c_(i,e);for(e+=B5(s);e<i.length;){let r=c_(i,e);if(s==$5||r==$5||t&&MZ(r))e+=B5(r),s=r;else if(L5(r)){let n=0,o=e-2;for(;o>=0&&L5(c_(i,o));)n++,o-=2;if(n%2==0)break;e+=2}else break}return e}function PZ(i,e,t){for(;e>0;){let s=SR(i,e-2,t);if(s<e)return s;e--}return 0}function c_(i,e){let t=i.charCodeAt(e);if(!wR(t)||e+1==i.length)return t;let s=i.charCodeAt(e+1);return xR(s)?(t-55296<<10)+(s-56320)+65536:t}function xR(i){return i>=56320&&i<57344}function wR(i){return i>=55296&&i<56320}function B5(i){return i<65536?1:2}let Ke=class CR{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,s){[e,t]=gh(this,e,t);let r=[];return this.decompose(0,e,r,2),s.length&&s.decompose(0,s.length,r,3),this.decompose(t,this.length,r,1),jr.from(r,this.length-(t-e)+s.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=gh(this,e,t);let s=[];return this.decompose(e,t,s,0),jr.from(s,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),s=this.length-this.scanIdentical(e,-1),r=new bu(this),n=new bu(e);for(let o=t,l=t;;){if(r.next(o),n.next(o),o=0,r.lineBreak!=n.lineBreak||r.done!=n.done||r.value!=n.value)return!1;if(l+=r.value.length,r.done||l>=s)return!0}}iter(e=1){return new bu(this,e)}iterRange(e,t=this.length){return new kR(this,e,t)}iterLines(e,t){let s;if(e==null)s=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;s=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new TR(s)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?CR.empty:e.length<=32?new zt(e):jr.from(zt.split(e,[]))}};class zt extends Ke{constructor(e,t=QZ(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.text[n],l=r+o.length;if((t?s:l)>=e)return new RZ(r,l,s,o);r=l+1,s++}}decompose(e,t,s,r){let n=e<=0&&t>=this.length?this:new zt(D5(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=s.pop(),l=Zp(n.text,o.text.slice(),0,n.length);if(l.length<=32)s.push(new zt(l,o.length+n.length));else{let c=l.length>>1;s.push(new zt(l.slice(0,c)),new zt(l.slice(c)))}}else s.push(n)}replace(e,t,s){if(!(s instanceof zt))return super.replace(e,t,s);[e,t]=gh(this,e,t);let r=Zp(this.text,Zp(s.text,D5(this.text,0,e)),t),n=this.length+s.length-(t-e);return r.length<=32?new zt(r,n):jr.from(zt.split(r,[]),n)}sliceString(e,t=this.length,s=`
|
|
51
51
|
`){[e,t]=gh(this,e,t);let r="";for(let n=0,o=0;n<=t&&o<this.text.length;o++){let l=this.text[o],c=n+l.length;n>e&&o&&(r+=s),e<c&&t>n&&(r+=l.slice(Math.max(0,e-n),t-n)),n=c+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let s=[],r=-1;for(let n of e)s.push(n),r+=n.length+1,s.length==32&&(t.push(new zt(s,r)),s=[],r=-1);return r>-1&&t.push(new zt(s,r)),t}}class jr extends Ke{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let s of e)this.lines+=s.lines}lineInner(e,t,s,r){for(let n=0;;n++){let o=this.children[n],l=r+o.length,c=s+o.lines-1;if((t?c:l)>=e)return o.lineInner(e,t,s,r);r=l+1,s=c+1}}decompose(e,t,s,r){for(let n=0,o=0;o<=t&&n<this.children.length;n++){let l=this.children[n],c=o+l.length;if(e<=c&&t>=o){let u=r&((o<=e?1:0)|(c>=t?2:0));o>=e&&c<=t&&!u?s.push(l):l.decompose(e-o,t-o,s,u)}o=c+1}}replace(e,t,s){if([e,t]=gh(this,e,t),s.lines<this.lines)for(let r=0,n=0;r<this.children.length;r++){let o=this.children[r],l=n+o.length;if(e>=n&&t<=l){let c=o.replace(e-n,t-n,s),u=this.lines-o.lines+c.lines;if(c.lines<u>>4&&c.lines>u>>6){let d=this.children.slice();return d[r]=c,new jr(d,this.length-(t-e)+s.length)}return super.replace(n,l,c)}n=l+1}return super.replace(e,t,s)}sliceString(e,t=this.length,s=`
|
|
52
52
|
`){[e,t]=gh(this,e,t);let r="";for(let n=0,o=0;n<this.children.length&&o<=t;n++){let l=this.children[n],c=o+l.length;o>e&&n&&(r+=s),e<c&&t>o&&(r+=l.sliceString(e-o,t-o,s)),o=c+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof jr))return 0;let s=0,[r,n,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,n+=t){if(r==o||n==l)return s;let c=this.children[r],u=e.children[n];if(c!=u)return s+c.scanIdentical(u,t);s+=c.length+1}}static from(e,t=e.reduce((s,r)=>s+r.length+1,-1)){let s=0;for(let _ of e)s+=_.lines;if(s<32){let _=[];for(let y of e)y.flatten(_);return new zt(_,t)}let r=Math.max(32,s>>5),n=r<<1,o=r>>1,l=[],c=0,u=-1,d=[];function m(_){let y;if(_.lines>n&&_ instanceof jr)for(let b of _.children)m(b);else _.lines>o&&(c>o||!c)?(g(),l.push(_)):_ instanceof zt&&c&&(y=d[d.length-1])instanceof zt&&_.lines+y.lines<=32?(c+=_.lines,u+=_.length+1,d[d.length-1]=new zt(y.text.concat(_.text),y.length+1+_.length)):(c+_.lines>r&&g(),c+=_.lines,u+=_.length+1,d.push(_))}function g(){c!=0&&(l.push(d.length==1?d[0]:jr.from(d,u)),u=-1,c=d.length=0)}for(let _ of e)m(_);return g(),l.length==1?l[0]:new jr(l,t)}}Ke.empty=new zt([""],0);function QZ(i){let e=-1;for(let t of i)e+=t.length+1;return e}function Zp(i,e,t=0,s=1e9){for(let r=0,n=0,o=!0;n<i.length&&r<=s;n++){let l=i[n],c=r+l.length;c>=t&&(c>s&&(l=l.slice(0,s-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=c+1}return e}function D5(i,e,t){return Zp(i,[""],e,t)}class bu{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof zt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let s=this.nodes.length-1,r=this.nodes[s],n=this.offsets[s],o=n>>1,l=r instanceof zt?r.text.length:r.children.length;if(o==(t>0?l:0)){if(s==0)return this.done=!0,this.value="",this;t>0&&this.offsets[s-1]++,this.nodes.pop(),this.offsets.pop()}else if((n&1)==(t>0?0:1)){if(this.offsets[s]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
@@ -75,7 +75,14 @@ Error generating stack: `+p.message+`
|
|
|
75
75
|
constructor(\${params}) {
|
|
76
76
|
\${}
|
|
77
77
|
}
|
|
78
|
-
}`,{label:"class",detail:"definition",type:"keyword"}),ds('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ds('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],jG=lB.concat([ds("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ds("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ds("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),lM=new HL,hB=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Wc(i){return(e,t)=>{let s=e.node.getChild("VariableDefinition");return s&&t(s,i),!0}}const IG=["FunctionDeclaration"],qG={FunctionDeclaration:Wc("function"),ClassDeclaration:Wc("class"),ClassExpression:()=>!0,EnumDeclaration:Wc("constant"),TypeAliasDeclaration:Wc("type"),NamespaceDeclaration:Wc("namespace"),VariableDefinition(i,e){i.matchContext(IG)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function cB(i,e){let t=lM.get(e);if(t)return t;let s=[],r=!0;function n(o,l){let c=i.sliceString(o.from,o.to);s.push({label:c,type:l})}return e.cursor(et.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=qG[o.name];if(l&&l(o,n)||hB.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of cB(i,o.node))s.push(l);return!1}}),lM.set(e,s),s}const hM=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,uB=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function WG(i){let e=ut(i.state).resolveInner(i.pos,-1);if(uB.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&hM.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent)hB.has(r.name)&&(s=s.concat(cB(i.state.doc,r)));return{options:s,from:t?e.from:i.pos,validFor:hM}}const Jr=yh.define({name:"javascript",parser:ZG.configure({props:[Sf.add({IfStatement:Hp({except:/^\s*({|else\b)/}),TryStatement:Hp({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:_q,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),s=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:s?1:2)*i.unit},Block:Oq({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Hp({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Rh.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":s3,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),fB={test:i=>/^JSX/.test(i.name),facet:dS({commentTokens:{block:{open:"{/*",close:"*/}"}}})},dB=Jr.configure({dialect:"ts"},"typescript"),pB=Jr.configure({dialect:"jsx",props:[pS.add(i=>i.isTop?[fB]:void 0)]}),mB=Jr.configure({dialect:"jsx ts",props:[pS.add(i=>i.isTop?[fB]:void 0)]},"typescript");let gB=i=>({label:i,type:"keyword"});const OB="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(gB),UG=OB.concat(["declare","implements","private","protected","public"].map(gB));function YG(i={}){let e=i.jsx?i.typescript?mB:pB:i.typescript?dB:Jr,t=i.typescript?jG.concat(UG):lB.concat(OB);return new Yu(e,[Jr.data.of({autocomplete:zU(uB,n$(t))}),Jr.data.of({autocomplete:WG}),i.jsx?GG:[]])}function HG(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function cM(i,e,t=i.length){for(let s=e==null?void 0:e.firstChild;s;s=s.nextSibling)if(s.name=="JSXIdentifier"||s.name=="JSXBuiltin"||s.name=="JSXNamespacedName"||s.name=="JSXMemberExpression")return i.sliceString(s.from,Math.min(s.to,t));return""}const FG=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),GG=pe.inputHandler.of((i,e,t,s,r)=>{if((FG?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Jr.isActiveAt(i.state,e,-1))return!1;let n=r(),{state:o}=n,l=o.changeByRange(c=>{var u;let{head:d}=c,m=ut(o).resolveInner(d-1,-1),g;if(m.name=="JSXStartTag"&&(m=m.parent),!(o.doc.sliceString(d-1,d)!=s||m.name=="JSXAttributeValue"&&m.to>d)){if(s==">"&&m.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(s=="/"&&m.name=="JSXStartCloseTag"){let _=m.parent,y=_.parent;if(y&&_.from==d-2&&((g=cM(o.doc,y.firstChild,d))||((u=y.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${g}>`;return{range:ne.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(s==">"){let _=HG(m);if(_&&_.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(g=cM(o.doc,_,d)))return{range:c,changes:{from:d,insert:`</${g}>`}}}}return{range:c}});return l.changes.empty?!1:(i.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Uc=["_blank","_self","_top","_parent"],H_=["ascii","utf-8","utf-16","latin1","latin1"],F_=["get","post","put","delete"],G_=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ps=["true","false"],ke={},KG={a:{attrs:{href:null,ping:null,type:null,media:null,target:Uc,hreflang:null}},abbr:ke,address:ke,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:ke,aside:ke,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:ke,base:{attrs:{href:null,target:Uc}},bdi:ke,bdo:ke,blockquote:{attrs:{cite:null}},body:ke,br:ke,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:G_,formmethod:F_,formnovalidate:["novalidate"],formtarget:Uc,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:ke,center:ke,cite:ke,code:ke,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:ke,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:ke,div:ke,dl:ke,dt:ke,em:ke,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:ke,figure:ke,footer:ke,form:{attrs:{action:null,name:null,"accept-charset":H_,autocomplete:["on","off"],enctype:G_,method:F_,novalidate:["novalidate"],target:Uc}},h1:ke,h2:ke,h3:ke,h4:ke,h5:ke,h6:ke,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:ke,hgroup:ke,hr:ke,html:{attrs:{manifest:null}},i:ke,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:G_,formmethod:F_,formnovalidate:["novalidate"],formtarget:Uc,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:ke,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:ke,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:ke,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:H_,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:ke,noscript:ke,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:ke,param:{attrs:{name:null,value:null}},pre:ke,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:ke,rt:ke,ruby:ke,samp:ke,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:H_}},section:ke,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:ke,source:{attrs:{src:null,type:null,media:null}},span:ke,strong:ke,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:ke,summary:ke,sup:ke,table:ke,tbody:ke,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:ke,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:ke,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:ke,time:{attrs:{datetime:null}},title:ke,tr:ke,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:ke,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:ke},_B={accesskey:null,class:null,contenteditable:Ps,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ps,autocorrect:Ps,autocapitalize:Ps,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ps,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ps,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ps,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ps,"aria-hidden":Ps,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ps,"aria-multiselectable":Ps,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ps,"aria-relevant":null,"aria-required":Ps,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},vB="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(i=>"on"+i);for(let i of vB)_B[i]=null;class of{constructor(e,t){this.tags={...KG,...e},this.globalAttrs={..._B,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}of.default=new of;function Ch(i,e,t=i.length){if(!e)return"";let s=e.firstChild,r=s&&s.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function kh(i,e=!1){for(;i;i=i.parent)if(i.name=="Element")if(e)e=!1;else return i;return null}function yB(i,e,t){let s=t.tags[Ch(i,kh(e))];return(s==null?void 0:s.children)||t.allTags}function VS(i,e){let t=[];for(let s=kh(e);s&&!s.type.isTop;s=kh(s.parent)){let r=Ch(i,s);if(r&&s.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=s.firstChild.to)&&t.push(r)}return t}const bB=/^[:\-\.\w\u00b7-\uffff]*$/;function uM(i,e,t,s,r){let n=/\s*>/.test(i.sliceDoc(r,r+5))?"":">",o=kh(t,t.name=="StartTag"||t.name=="TagName");return{from:s,to:r,options:yB(i.doc,o,e).map(l=>({label:l,type:"type"})).concat(VS(i.doc,t).map((l,c)=>({label:"/"+l,apply:"/"+l+n,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function fM(i,e,t,s){let r=/\s*>/.test(i.sliceDoc(s,s+5))?"":">";return{from:t,to:s,options:VS(i.doc,e).map((n,o)=>({label:n,apply:n+r,type:"type",boost:99-o})),validFor:bB}}function JG(i,e,t,s){let r=[],n=0;for(let o of yB(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of VS(i.doc,t))r.push({label:"</"+o+">",type:"type",boost:99-n++});return{from:s,to:s,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function eK(i,e,t,s,r){let n=kh(t),o=n?e.tags[Ch(i.doc,n)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:s,to:r,options:c.map(u=>({label:u,type:"property"})),validFor:bB}}function tK(i,e,t,s,r){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),l=[],c;if(o){let u=i.sliceDoc(o.from,o.to),d=e.globalAttrs[u];if(!d){let m=kh(t),g=m?e.tags[Ch(i.doc,m)]:null;d=(g==null?void 0:g.attrs)&&g.attrs[u]}if(d){let m=i.sliceDoc(s,r).toLowerCase(),g='"',_='"';/^['"]/.test(m)?(c=m[0]=='"'?/^[^"]*$/:/^[^']*$/,g="",_=i.sliceDoc(r,r+1)==m[0]?"":m[0],m=m.slice(1),s++):c=/^[^\s<>='"]*$/;for(let y of d)l.push({label:y,apply:g+y+_,type:"constant"})}}return{from:s,to:r,options:l,validFor:c}}function SB(i,e){let{state:t,pos:s}=e,r=ut(t).resolveInner(s,-1),n=r.resolve(s);for(let o=s,l;n==r&&(l=r.childBefore(o));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;n=r=l,o=c.from}return r.name=="TagName"?r.parent&&/CloseTag$/.test(r.parent.name)?fM(t,r,r.from,s):uM(t,i,r,r.from,s):r.name=="StartTag"||r.name=="IncompleteTag"?uM(t,i,r,s,s):r.name=="StartCloseTag"||r.name=="IncompleteCloseTag"?fM(t,r,s,s):r.name=="OpenTag"||r.name=="SelfClosingTag"||r.name=="AttributeName"?eK(t,i,r,r.name=="AttributeName"?r.from:s,s):r.name=="Is"||r.name=="AttributeValue"||r.name=="UnquotedAttributeValue"?tK(t,i,r,r.name=="Is"?s:r.from,s):e.explicit&&(n.name=="Element"||n.name=="Text"||n.name=="Document")?JG(t,i,r,s):null}function iK(i){return SB(of.default,i)}function sK(i){let{extraTags:e,extraGlobalAttributes:t}=i,s=t||e?new of(e,t):of.default;return r=>SB(s,r)}const rK=Jr.parser.configure({top:"SingleExpression"}),xB=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:dB.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:pB.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:mB.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(i.type)},parser:rK},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:Jr.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:Fm.parser}],wB=[{name:"style",parser:Fm.parser.configure({top:"Styles"})}].concat(vB.map(i=>({name:i,parser:Jr.parser}))),CB=yh.define({name:"html",parser:MF.configure({props:[Sf.add({Element(i){let e=/^(\s*)(<\/)?/.exec(i.textAfter);return i.node.to<=i.pos+e[0].length?i.continue():i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\s*/.exec(i.textAfter)[0].length<i.node.to)return i.continue();let e=null,t;for(let s=i.node;;){let r=s.lastChild;if(!r||r.name!="Element"||r.to!=s.to)break;e=s=r}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?i.lineIndent(e.from)+i.unit:null}}),Rh.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),g3.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Jp=CB.configure({wrap:tB(xB,wB)});function nK(i={}){let e="",t;i.matchClosingTags===!1&&(e="noMatch"),i.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)&&(t=tB((i.nestedLanguages||[]).concat(xB),(i.nestedAttributes||[]).concat(wB)));let s=t?CB.configure({wrap:t,dialect:e}):e?Jp.configure({dialect:e}):Jp;return new Yu(s,[Jp.data.of({autocomplete:sK(i)}),i.autoCloseTags!==!1?oK:[],YG().support,uG().support])}const dM=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),oK=pe.inputHandler.of((i,e,t,s,r)=>{if(i.composing||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Jp.isActiveAt(i.state,e,-1))return!1;let n=r(),{state:o}=n,l=o.changeByRange(c=>{var u,d,m;let g=o.doc.sliceString(c.from-1,c.to)==s,{head:_}=c,y=ut(o).resolveInner(_,-1),b;if(g&&s==">"&&y.name=="EndTag"){let x=y.parent;if(((d=(u=x.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=Ch(o.doc,x.parent,_))&&!dM.has(b)){let w=_+(o.doc.sliceString(_,_+1)===">"?1:0),k=`</${b}>`;return{range:c,changes:{from:_,to:w,insert:k}}}}else if(g&&s=="/"&&y.name=="IncompleteCloseTag"){let x=y.parent;if(y.from==_-2&&((m=x.lastChild)===null||m===void 0?void 0:m.name)!="CloseTag"&&(b=Ch(o.doc,x,_))&&!dM.has(b)){let w=_+(o.doc.sliceString(_,_+1)===">"?1:0),k=`${b}>`;return{range:ne.cursor(_+k.length,-1),changes:{from:_,to:w,insert:k}}}}return{range:c}});return l.changes.empty?!1:(i.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),kB=dS({commentTokens:{block:{open:"<!--",close:"-->"}}}),TB=new Le,AB=xH.configure({props:[Rh.add(i=>!i.is("Block")||i.is("Document")||by(i)!=null||aK(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),TB.add(by),Sf.add({Document:()=>null}),La.add({Document:kB})]});function by(i){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(i.name);return e?+e[1]:void 0}function aK(i){return i.name=="OrderedList"||i.name=="BulletList"}function lK(i,e){let t=i;for(;;){let s=t.nextSibling,r;if(!s||(r=by(s.type))!=null&&r<=e)break;t=s}return t.to}const hK=i3.of((i,e,t)=>{for(let s=ut(i).resolveInner(t,-1);s&&!(s.from<e);s=s.parent){let r=s.type.prop(TB);if(r==null)continue;let n=lK(s,r);if(n>t)return{from:t,to:n}}return null});function ZS(i){return new rr(kB,i,[],"markdown")}const cK=ZS(AB),uK=AB.configure([LH,BH,$H,DH,{props:[Rh.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]),af=ZS(uK);function fK(i,e){return t=>{if(t&&i){let s=null;if(t=/\S*/.exec(t)[0],typeof i=="function"?s=i(t):s=Qm.matchLanguageName(i,t,!0),s instanceof Qm)return s.support?s.support.language.parser:Uu.getSkippingParser(s.load());if(s)return s.parser}return e?e.parser:null}}class K_{constructor(e,t,s,r,n,o,l){this.node=e,this.from=t,this.to=s,this.spaceBefore=r,this.spaceAfter=n,this.type=o,this.item=l}blank(e,t=!0){let s=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;s.length<e;)s+=" ";return s}else{for(let r=this.to-this.from-s.length-this.spaceAfter.length;r>0;r--)s+=" ";return s+(t?this.spaceAfter:"")}}marker(e,t){let s=this.node.name=="OrderedList"?String(+EB(this.item,e)[2]+t):"";return this.spaceBefore+s+this.type+this.spaceAfter}}function MB(i,e){let t=[],s=[];for(let r=i;r;r=r.parent){if(r.name=="FencedCode")return s;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let n=t[r],o,l=e.lineAt(n.from),c=n.from-l.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(c))))s.push(new K_(n,c,c+o[0].length,"",o[1],">",null));else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),s.push(new K_(n.parent,c,c+d,o[1],u,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let m=o[2];o[3]&&(m+=o[3].replace(/[xX]/," ")),s.push(new K_(n.parent,c,c+d,o[1],u,m,n))}}return s}function EB(i,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function J_(i,e,t,s=0){for(let r=-1,n=i;;){if(n.name=="ListItem"){let l=EB(n,e),c=+l[2];if(r>=0){if(c!=r+1)return;t.push({from:n.from+l[1].length,to:n.from+l[0].length,insert:String(r+2+s)})}r=c}let o=n.nextSibling;if(!o)break;n=o}}function jS(i,e){let t=/^[ \t]*/.exec(i)[0].length;if(!t||e.facet(Qh)!=" ")return i;let s=xr(i,4,t),r="";for(let n=s;n>0;)n>=4?(r+=" ",n-=4):(r+=" ",n--);return r+i.slice(t)}const dK=(i={})=>({state:e,dispatch:t})=>{let s=ut(e),{doc:r}=e,n=null,o=e.changeByRange(l=>{if(!l.empty||!af.isActiveAt(e,l.from,-1)&&!af.isActiveAt(e,l.from,1))return n={range:l};let c=l.from,u=r.lineAt(c),d=MB(s.resolveInner(c,-1),r);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return n={range:l};let m=d[d.length-1];if(m.to-m.spaceAfter.length>c-u.from)return n={range:l};let g=c>=m.to-m.spaceAfter.length&&!/\S/.test(u.text.slice(m.to));if(m.item&&g){let w=m.node.firstChild,k=m.node.getChild("ListItem","ListItem");if(w.to>=c||k&&k.to<c||u.from>0&&!/[^\s>]/.test(r.lineAt(u.from-1).text)||i.nonTightLists===!1){let C=d.length>1?d[d.length-2]:null,A,P="";C&&C.item?(A=u.from+C.from,P=C.marker(r,1)):A=u.from+(C?C.to:0);let E=[{from:A,to:c,insert:P}];return m.node.name=="OrderedList"&&J_(m.item,r,E,-2),C&&C.node.name=="OrderedList"&&J_(C.item,r,E),{range:ne.cursor(A+P.length),changes:E}}else{let C=mM(d,e,u);return{range:ne.cursor(c+C.length+1),changes:{from:u.from,insert:C+e.lineBreak}}}}if(m.node.name=="Blockquote"&&g&&u.from){let w=r.lineAt(u.from-1),k=/>\s*$/.exec(w.text);if(k&&k.index==m.from){let C=e.changes([{from:w.from+k.index,to:w.to},{from:u.from+m.from,to:u.to}]);return{range:l.map(C),changes:C}}}let _=[];m.node.name=="OrderedList"&&J_(m.item,r,_);let y=m.item&&m.item.from<u.from,b="";if(!y||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=m.to)for(let w=0,k=d.length-1;w<=k;w++)b+=w==k&&!y?d[w].marker(r,1):d[w].blank(w<k?xr(u.text,4,d[w+1].from)-b.length:null);let x=c;for(;x>u.from&&/\s/.test(u.text.charAt(x-u.from-1));)x--;return b=jS(b,e),mK(m.node,e.doc)&&(b=mM(d,e,u)+e.lineBreak+b),_.push({from:x,to:c,insert:e.lineBreak+b}),{range:ne.cursor(x+b.length+1),changes:_}});return n?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},pK=dK();function pM(i){return i.name=="QuoteMark"||i.name=="ListMark"}function mK(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return!1;let t=i.firstChild,s=i.getChild("ListItem","ListItem");if(!s)return!1;let r=e.lineAt(t.to),n=e.lineAt(s.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<n.number}function mM(i,e,t){let s="";for(let r=0,n=i.length-2;r<=n;r++)s+=i[r].blank(r<n?xr(t.text,4,i[r+1].from)-s.length:null,r<n);return jS(s,e)}function gK(i,e){let t=i.resolveInner(e,-1),s=e;pM(t)&&(s=t.from,t=t.parent);for(let r;r=t.childBefore(s);)if(pM(r))s=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")t=r.lastChild,s=t.to;else break;return t}const OK=({state:i,dispatch:e})=>{let t=ut(i),s=null,r=i.changeByRange(n=>{let o=n.from,{doc:l}=i;if(n.empty&&af.isActiveAt(i,n.from)){let c=l.lineAt(o),u=MB(gK(t,o),l);if(u.length){let d=u[u.length-1],m=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>m&&!/\S/.test(c.text.slice(m,o-c.from)))return{range:ne.cursor(c.from+m),changes:{from:c.from+m,to:o}};if(o-c.from==m&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let g=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let _=d.blank(xr(c.text,4,d.to)-xr(c.text,4,d.from));return g==c.from&&(_=jS(_,i)),{range:ne.cursor(g+_.length),changes:{from:g,to:c.from+d.to,insert:_}}}if(g<o)return{range:ne.cursor(g),changes:{from:g,to:o}}}}}return s={range:n}});return s?!1:(e(i.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},_K=[{key:"Enter",run:pK},{key:"Backspace",run:OK}],PB=nK({matchClosingTags:!1});function vK(i={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:s=!0,base:{parser:r}=cK,completeHTMLTags:n=!0,pasteURLAsLink:o=!0,htmlTagLanguage:l=PB}=i;if(!(r instanceof bg))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=i.extensions?[i.extensions]:[],u=[l.support,hK],d;o&&u.push(xK),t instanceof Yu?(u.push(t.support),d=t.language):t&&(d=t);let m=e||d?fK(e,d):void 0;c.push(CH({codeParser:m,htmlParser:l.language.parser})),s&&u.push(Wn.high(Fa.of(_K)));let g=ZS(r.configure(c));return n&&u.push(g.data.of({autocomplete:yK})),new Yu(g,u)}function yK(i){let{state:e,pos:t}=i,s=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!s)return null;let r=ut(e).resolveInner(t,-1);for(;r&&!r.type.isTop;){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:t-s[0].length,to:t,options:bK(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let ev=null;function bK(){if(ev)return ev;let i=iK(new wS(We.create({extensions:PB}),0,!0));return ev=i?i.options:[]}const SK=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,xK=pe.domEventHandlers({paste:(i,e)=>{var t;let{main:s}=e.state.selection;if(s.empty)return!1;let r=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!af.isActiveAt(e.state,s.from,1)))return!1;let n=ut(e.state),o=!1;return n.iterate({from:s.from,to:s.to,enter:l=>{(l.from>s.from||SK.test(l.name))&&(o=!0)},leave:l=>{l.to<s.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:s.from,insert:"["},{from:s.to,insert:`](${r})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});function wK({initialContent:i,filePath:e,onSave:t,onClose:s}){const[r,n]=Y.useState(i),[o,l]=Y.useState(!1),[c,u]=Y.useState(!1),d=Y.useRef(r);Y.useEffect(()=>{d.current=r},[r]);const m=Y.useCallback(b=>{n(b),u(b!==i)},[i]),g=Y.useCallback(async()=>{if(!o){l(!0);try{await t(d.current),u(!1)}catch(b){console.error("[plan-editor] Save failed:",b)}finally{l(!1)}}},[t,o]),_=Y.useCallback(()=>{c&&!window.confirm("Unsaved changes -- discard?")||s()},[c,s]),y=Fa.of([{key:"Mod-s",run:()=>(g(),!0)}]);return Y.useEffect(()=>{const b=x=>{(x.ctrlKey||x.metaKey)&&x.key==="s"&&x.preventDefault()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]),M.jsxs("div",{className:"fixed inset-0 z-50 bg-background/95 flex flex-col",children:[M.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:e}),c&&M.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-warning/20 text-warning font-mono",children:"unsaved"})]}),M.jsxs("div",{className:"flex items-center gap-2",children:[c&&M.jsx("button",{type:"button",onClick:g,disabled:o,className:dt("text-xs px-3 py-1.5 rounded-md font-mono","bg-accent text-foreground","hover:bg-accent-glow","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:o?"Saving...":"Save"}),M.jsx("button",{type:"button",onClick:_,className:dt("text-xs px-3 py-1.5 rounded-md font-mono","bg-muted text-muted-foreground","hover:bg-danger/20 hover:text-danger","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:"Close"})]})]}),M.jsx("div",{className:"flex-1 overflow-auto",children:M.jsx(b$,{value:r,onChange:m,theme:y$,extensions:[vK({base:af}),y],height:"calc(100vh - 56px)",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,bracketMatching:!0,indentOnInput:!0}})})]})}function CK({phaseId:i,onBack:e}){const{plans:t,context:s,research:r,loading:n,error:o,refetch:l}=CZ(i),[c,u]=Y.useState(null),[d,m]=Y.useState(""),g=t.length>0?t[0].frontmatter.phase??i:i,_=Y.useCallback(async x=>{try{const k=x.replace(/^\.planning[\\/]/,"").split(/[\\/]/),C=await fetch(`/api/plan/${k.join("/")}`);if(!C.ok){console.error("[phase-detail] Failed to fetch plan for editing");return}const A=await C.json();m(A.content),u(x)}catch(w){console.error("[phase-detail] Error fetching plan:",w)}},[]),y=Y.useCallback(async x=>{if(!c)return;const k=c.replace(/^\.planning[\\/]/,"").split(/[\\/]/);if(!(await fetch(`/api/plan/${k.join("/")}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x})})).ok)throw new Error("Failed to save plan")},[c]),b=Y.useCallback(()=>{u(null),m(""),l()},[l]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("button",{type:"button",onClick:e,className:dt("flex items-center gap-2 text-sm text-muted-foreground","hover:text-foreground transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50 rounded-md px-2 py-1"),children:[M.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M10 3L5 8l5 5"})}),"Back to overview"]}),M.jsxs("div",{children:[M.jsxs("h2",{className:"text-2xl font-semibold tracking-tight",children:[M.jsxs("span",{className:"text-accent font-mono",children:["Phase ",i]}),M.jsx("span",{className:"mx-2 text-muted-foreground",children:"-"}),M.jsx("span",{children:g})]}),M.jsxs("div",{className:"flex gap-2 mt-2",children:[s&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"context available"}),r&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"research available"}),!s&&!r&&!n&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-muted text-muted-foreground font-mono",children:"no context or research"})]})]}),o&&M.jsx("div",{className:"p-4 rounded-lg border border-danger/50 bg-danger/10 text-danger text-sm",children:o}),n&&t.length===0&&M.jsx("div",{className:"space-y-4",children:[1,2,3].map(x=>M.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 animate-pulse",children:[M.jsx("div",{className:"h-6 w-32 bg-muted rounded mb-3"}),M.jsx("div",{className:"h-4 w-3/4 bg-muted rounded mb-2"}),M.jsx("div",{className:"h-4 w-1/2 bg-muted rounded mb-3"}),M.jsxs("div",{className:"space-y-2",children:[M.jsx("div",{className:"h-3 w-full bg-muted rounded"}),M.jsx("div",{className:"h-3 w-5/6 bg-muted rounded"})]})]},x))}),!n&&!o&&t.length===0&&M.jsx("div",{className:"p-8 text-center text-muted-foreground border border-border rounded-lg bg-card",children:M.jsxs("p",{className:"text-sm",children:["No plans yet -- run"," ",M.jsx("code",{className:"font-mono text-accent",children:"/maxsim:plan-phase"})," to create plans"]})}),t.length>0&&M.jsx("div",{className:"space-y-4",children:t.map(x=>M.jsx(TZ,{plan:x,onEdit:_},x.path))}),c&&M.jsx(wK,{initialContent:d,filePath:c,onSave:y,onClose:b})]})}function kK(){const{lastChange:i}=ff(),[e,t]=Y.useState([]),[s,r]=Y.useState([]),[n,o]=Y.useState(!0),[l,c]=Y.useState(null),[u,d]=Y.useState(""),[m,g]=Y.useState(!1),[_,y]=Y.useState(!1),b=Y.useCallback(async()=>{try{c(null);const k=await fetch("/api/todos");if(!k.ok)throw new Error(`Failed to fetch todos: ${k.status}`);const C=await k.json();t(C.pending),r(C.completed)}catch(k){c(k instanceof Error?k.message:"Failed to fetch todos")}finally{o(!1)}},[]);Y.useEffect(()=>{b()},[b]),Y.useEffect(()=>{i>0&&b()},[i,b]);const x=Y.useCallback(async()=>{const k=u.trim();if(k){g(!0);try{if(!(await fetch("/api/todos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:k})})).ok)throw new Error("Failed to create todo");d(""),await b()}catch(C){c(C instanceof Error?C.message:"Failed to create todo")}finally{g(!1)}}},[u,b]),w=Y.useCallback(async(k,C)=>{try{if(!(await fetch("/api/todos",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:k,completed:C})})).ok)throw new Error("Failed to update todo");await b()}catch(A){c(A instanceof Error?A.message:"Failed to update todo")}},[b]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Todos"}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.length," pending"]})]}),M.jsxs("div",{className:"flex gap-2",children:[M.jsx("input",{type:"text",value:u,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&!m&&x()},placeholder:"Add a new todo...",className:"flex-1 rounded-sm border border-border bg-card px-3 py-2 font-mono text-sm text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("button",{type:"button",onClick:x,disabled:m||!u.trim(),className:dt("rounded-sm bg-accent px-4 py-2 font-mono text-xs font-semibold text-foreground transition-colors","hover:bg-accent-glow disabled:opacity-40 disabled:cursor-not-allowed"),children:"Add"})]}),l&&M.jsx("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:l}),n&&M.jsx("div",{className:"space-y-2",children:[1,2,3].map(k=>M.jsxs("div",{className:"flex items-center gap-3 rounded-sm bg-card px-4 py-3",children:[M.jsx("div",{className:"h-4 w-4 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-4 w-48 animate-pulse rounded-sm bg-muted"})]},k))}),!n&&M.jsx("div",{className:"space-y-1",children:e.length===0?M.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No pending todos"}):e.map(k=>M.jsxs("button",{type:"button",onClick:()=>w(k.file,!0),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2.5 text-left transition-colors hover:bg-card-hover",children:[M.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-muted-foreground transition-colors group-hover:border-accent"}),M.jsx("span",{className:"text-sm text-foreground",children:k.text})]},k.file))}),!n&&s.length>0&&M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",_&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Completed (",s.length,")"]})]}),_&&M.jsx("div",{className:"mt-2 space-y-1",children:s.map(k=>M.jsxs("button",{type:"button",onClick:()=>w(k.file,!1),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2 text-left transition-colors hover:bg-card-hover",children:[M.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-success bg-success/20",children:M.jsx("svg",{className:"h-3 w-3 text-success",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M2 6l3 3 5-5"})})}),M.jsx("span",{className:"text-sm text-muted-foreground line-through",children:k.text})]},k.file))})]})]})}function TK({onEntryAdded:i}){const[e,t]=Y.useState(!1),[s,r]=Y.useState("decision"),[n,o]=Y.useState(""),[l,c]=Y.useState(""),[u,d]=Y.useState(!1),[m,g]=Y.useState(null),[_,y]=Y.useState(null),b=Y.useCallback(async()=>{const x=l.trim();if(x){d(!0),g(null),y(null);try{if(s==="decision"){const w=await fetch("/api/state/decision",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phase:n.trim()||void 0,text:x})});if(!w.ok){const k=await w.json().catch(()=>({}));throw new Error(k.error||"Could not add decision")}y("Decision added")}else{const w=await fetch("/api/state/blocker",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:x})});if(!w.ok){const k=await w.json().catch(()=>({}));throw new Error(k.error||"Could not add blocker")}y("Blocker added")}c(""),o(""),i==null||i(),setTimeout(()=>y(null),2e3)}catch(w){g(w instanceof Error?w.message:"Failed to update STATE.md")}finally{d(!1)}}},[s,n,l,i]);return M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",e&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:"Add to STATE.md"})]}),e&&M.jsxs("div",{className:"mt-3 space-y-3",children:[M.jsxs("div",{className:"flex gap-1",children:[M.jsx("button",{type:"button",onClick:()=>r("decision"),className:dt("rounded-sm px-3 py-1 font-mono text-xs transition-colors",s==="decision"?"bg-accent/20 text-accent":"text-muted-foreground hover:text-foreground"),children:"Decision"}),M.jsx("button",{type:"button",onClick:()=>r("blocker"),className:dt("rounded-sm px-3 py-1 font-mono text-xs transition-colors",s==="blocker"?"bg-danger/20 text-danger":"text-muted-foreground hover:text-foreground"),children:"Blocker"})]}),s==="decision"&&M.jsx("input",{type:"text",value:n,onChange:x=>o(x.target.value),placeholder:"Phase (e.g. 13-06)",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("input",{type:"text",value:l,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!u&&b()},placeholder:s==="decision"?"Decision text...":"Blocker description...",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("button",{type:"button",onClick:b,disabled:u||!l.trim(),className:dt("rounded-sm px-3 py-1.5 font-mono text-xs font-semibold transition-colors","disabled:opacity-40 disabled:cursor-not-allowed",s==="decision"?"bg-accent/20 text-accent hover:bg-accent/30":"bg-danger/20 text-danger hover:bg-danger/30"),children:u?"Saving...":`Add ${s==="decision"?"Decision":"Blocker"}`}),m&&M.jsx("p",{className:"text-xs text-danger",children:m}),_&&M.jsx("p",{className:"text-xs text-success",children:_})]})]})}function AK(i){return i.map(e=>({text:e.replace(/~~(.+)~~/,"$1").replace(/\s*RESOLVED.*$/i,"").trim(),resolved:e.includes("RESOLVED")||e.startsWith("~~")&&e.endsWith("~~")}))}function MK(){const{state:i}=fb(),[e,t]=Y.useState(!1),[s,r]=Y.useState(null),[n,o]=Y.useState(null),[l,c]=Y.useState(0),u=AK((i==null?void 0:i.blockers)??[]),d=u.filter(y=>!y.resolved),m=u.filter(y=>y.resolved),g=Y.useCallback(async y=>{r(y),o(null);try{if(!(await fetch("/api/state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:"blockers",value:`~~${y}~~ RESOLVED`})})).ok)throw new Error("Failed to resolve blocker");c(x=>x+1)}catch(b){o(b instanceof Error?b.message:"Failed to resolve blocker")}finally{r(null)}},[]),_=Y.useCallback(()=>{c(y=>y+1)},[]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Blockers"}),M.jsx("span",{className:dt("font-mono text-xs",d.length>0?"text-danger":"text-success"),children:d.length>0?`${d.length} active`:"No active blockers"})]}),n&&M.jsx("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:n}),d.length===0?M.jsx("div",{className:"rounded-sm border border-success/30 bg-success/5 px-4 py-6 text-center",children:M.jsx("p",{className:"text-sm text-success",children:"No active blockers"})}):M.jsx("div",{className:"space-y-2",children:d.map(y=>M.jsxs("div",{className:"flex items-start gap-3 rounded-sm border border-border bg-card px-4 py-3",children:[M.jsx("span",{className:"mt-1 inline-block h-2 w-2 shrink-0 rounded-full bg-danger"}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-sm text-foreground",children:y.text})}),M.jsx("button",{type:"button",onClick:()=>g(y.text),disabled:s===y.text,className:dt("shrink-0 rounded-sm px-3 py-1 font-mono text-xs transition-colors","bg-success/20 text-success hover:bg-success/30","disabled:opacity-40 disabled:cursor-not-allowed"),children:s===y.text?"...":"Resolve"})]},y.text))}),m.length>0&&M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",e&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Resolved (",m.length,")"]})]}),e&&M.jsx("div",{className:"mt-2 space-y-1",children:m.map(y=>M.jsxs("div",{className:"flex items-center gap-3 rounded-sm px-4 py-2",children:[M.jsx("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-muted"}),M.jsx("p",{className:"text-sm text-muted-foreground line-through",children:y.text})]},y.text))})]}),M.jsx(TK,{onEntryAdded:_})]},l)}function EK({sidebar:i,children:e}){return M.jsxs("div",{className:"flex h-screen overflow-hidden",children:[M.jsx("div",{className:"hidden md:flex",children:i}),M.jsx("main",{className:"flex flex-1 flex-col overflow-hidden",children:e})]})}function PK(i){switch(i){case"complete":return"bg-success";case"partial":return"bg-accent";case"planned":case"researched":case"discussed":return"bg-muted-foreground";default:return"bg-muted"}}function QK({activeView:i,activePhaseId:e,onNavigate:t}){const{roadmap:s,state:r,todos:n}=fb(),{connected:o}=ff(),l=((s==null?void 0:s.phases)??[]).map(m=>({number:m.number,name:m.name,goal:m.goal??"",dependsOn:m.depends_on?[m.depends_on]:[],planCount:m.plan_count,summaryCount:m.summary_count,diskStatus:m.disk_status,roadmapComplete:m.roadmap_complete,hasContext:m.has_context,hasResearch:m.has_research})),c=(s==null?void 0:s.current_phase)??null,u=(r==null?void 0:r.blockers.filter(m=>!m.includes("RESOLVED")).length)??0,d=(n==null?void 0:n.pending.length)??0;return M.jsxs("aside",{className:"flex h-full w-64 shrink-0 flex-col border-r border-border bg-card",children:[M.jsx("div",{className:"border-b border-border px-4 py-4",children:M.jsxs("button",{type:"button",onClick:()=>t("overview"),className:"flex flex-col gap-0.5 text-left",children:[M.jsx("span",{className:"font-mono text-lg font-bold tracking-tight text-foreground",children:"MAXSIM"}),M.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"Dashboard"})]})}),M.jsxs("div",{className:"flex-1 overflow-y-auto py-2",children:[M.jsx("div",{className:"px-3 pb-1",children:M.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:"Phases"})}),M.jsx("nav",{className:"flex flex-col gap-0.5 px-1",children:l.map(m=>{const g=i==="phase"&&e===m.number,_=m.number===c;return M.jsxs("button",{type:"button",onClick:()=>t("phase",m.number),className:dt("flex w-full items-center gap-2.5 rounded-sm px-3 py-1.5 text-left text-sm transition-colors",g?"border-l-2 border-l-accent bg-card-hover text-foreground":"border-l-2 border-l-transparent hover:bg-card-hover",_&&!g&&"border-l-accent-glow"),children:[M.jsx("span",{className:dt("inline-block h-2 w-2 shrink-0 rounded-full",PK(m.diskStatus))}),M.jsx("span",{className:dt("font-mono text-xs font-semibold",_||g?"text-accent":"text-muted-foreground"),children:m.number}),M.jsx("span",{className:"truncate text-xs text-foreground",children:m.name})]},m.number)})})]}),M.jsxs("div",{className:"border-t border-border px-1 py-2",children:[M.jsxs("button",{type:"button",onClick:()=>t("todos"),className:dt("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="todos"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Todos"}),d>0&&M.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-warning/20 px-1 font-mono text-[10px] font-bold text-warning",children:d})]}),M.jsxs("button",{type:"button",onClick:()=>t("blockers"),className:dt("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="blockers"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Blockers"}),u>0&&M.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-danger/20 px-1 font-mono text-[10px] font-bold text-danger shadow-[0_0_6px_rgba(239,68,68,0.3)]",children:u})]})]}),M.jsx("div",{className:"border-t border-border px-1 py-2",children:M.jsxs("button",{type:"button",onClick:()=>t("terminal"),className:dt("flex w-full items-center gap-2.5 rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="terminal"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs font-bold",children:">_"}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Terminal"})]})}),M.jsx("div",{className:"border-t border-border px-4 py-3",children:M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:dt("inline-block h-2 w-2 rounded-full",o?"bg-success":"bg-danger")}),M.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:o?"Connected":"Disconnected"})]})})]})}/**
|
|
78
|
+
}`,{label:"class",detail:"definition",type:"keyword"}),ds('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),ds('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],jG=lB.concat([ds("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),ds("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),ds("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),lM=new HL,hB=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Wc(i){return(e,t)=>{let s=e.node.getChild("VariableDefinition");return s&&t(s,i),!0}}const IG=["FunctionDeclaration"],qG={FunctionDeclaration:Wc("function"),ClassDeclaration:Wc("class"),ClassExpression:()=>!0,EnumDeclaration:Wc("constant"),TypeAliasDeclaration:Wc("type"),NamespaceDeclaration:Wc("namespace"),VariableDefinition(i,e){i.matchContext(IG)||e(i,"variable")},TypeDefinition(i,e){e(i,"type")},__proto__:null};function cB(i,e){let t=lM.get(e);if(t)return t;let s=[],r=!0;function n(o,l){let c=i.sliceString(o.from,o.to);s.push({label:c,type:l})}return e.cursor(et.IncludeAnonymous).iterate(o=>{if(r)r=!1;else if(o.name){let l=qG[o.name];if(l&&l(o,n)||hB.has(o.name))return!1}else if(o.to-o.from>8192){for(let l of cB(i,o.node))s.push(l);return!1}}),lM.set(e,s),s}const hM=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,uB=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function WG(i){let e=ut(i.state).resolveInner(i.pos,-1);if(uB.indexOf(e.name)>-1)return null;let t=e.name=="VariableName"||e.to-e.from<20&&hM.test(i.state.sliceDoc(e.from,e.to));if(!t&&!i.explicit)return null;let s=[];for(let r=e;r;r=r.parent)hB.has(r.name)&&(s=s.concat(cB(i.state.doc,r)));return{options:s,from:t?e.from:i.pos,validFor:hM}}const Jr=yh.define({name:"javascript",parser:ZG.configure({props:[Sf.add({IfStatement:Hp({except:/^\s*({|else\b)/}),TryStatement:Hp({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:_q,SwitchBody:i=>{let e=i.textAfter,t=/^\s*\}/.test(e),s=/^\s*(case|default)\b/.test(e);return i.baseIndent+(t?0:s?1:2)*i.unit},Block:Oq({closing:"}"}),ArrowFunction:i=>i.baseIndent+i.unit,"TemplateString BlockComment":()=>null,"Statement Property":Hp({except:/^\s*{/}),JSXElement(i){let e=/^\s*<\//.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},JSXEscape(i){let e=/\s*\}/.test(i.textAfter);return i.lineIndent(i.node.from)+(e?0:i.unit)},"JSXOpenTag JSXSelfClosingTag"(i){return i.column(i.node.from)+i.unit}}),Rh.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":s3,BlockComment(i){return{from:i.from+2,to:i.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),fB={test:i=>/^JSX/.test(i.name),facet:dS({commentTokens:{block:{open:"{/*",close:"*/}"}}})},dB=Jr.configure({dialect:"ts"},"typescript"),pB=Jr.configure({dialect:"jsx",props:[pS.add(i=>i.isTop?[fB]:void 0)]}),mB=Jr.configure({dialect:"jsx ts",props:[pS.add(i=>i.isTop?[fB]:void 0)]},"typescript");let gB=i=>({label:i,type:"keyword"});const OB="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(gB),UG=OB.concat(["declare","implements","private","protected","public"].map(gB));function YG(i={}){let e=i.jsx?i.typescript?mB:pB:i.typescript?dB:Jr,t=i.typescript?jG.concat(UG):lB.concat(OB);return new Yu(e,[Jr.data.of({autocomplete:zU(uB,n$(t))}),Jr.data.of({autocomplete:WG}),i.jsx?GG:[]])}function HG(i){for(;;){if(i.name=="JSXOpenTag"||i.name=="JSXSelfClosingTag"||i.name=="JSXFragmentTag")return i;if(i.name=="JSXEscape"||!i.parent)return null;i=i.parent}}function cM(i,e,t=i.length){for(let s=e==null?void 0:e.firstChild;s;s=s.nextSibling)if(s.name=="JSXIdentifier"||s.name=="JSXBuiltin"||s.name=="JSXNamespacedName"||s.name=="JSXMemberExpression")return i.sliceString(s.from,Math.min(s.to,t));return""}const FG=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),GG=pe.inputHandler.of((i,e,t,s,r)=>{if((FG?i.composing:i.compositionStarted)||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Jr.isActiveAt(i.state,e,-1))return!1;let n=r(),{state:o}=n,l=o.changeByRange(c=>{var u;let{head:d}=c,m=ut(o).resolveInner(d-1,-1),g;if(m.name=="JSXStartTag"&&(m=m.parent),!(o.doc.sliceString(d-1,d)!=s||m.name=="JSXAttributeValue"&&m.to>d)){if(s==">"&&m.name=="JSXFragmentTag")return{range:c,changes:{from:d,insert:"</>"}};if(s=="/"&&m.name=="JSXStartCloseTag"){let _=m.parent,y=_.parent;if(y&&_.from==d-2&&((g=cM(o.doc,y.firstChild,d))||((u=y.firstChild)===null||u===void 0?void 0:u.name)=="JSXFragmentTag")){let b=`${g}>`;return{range:ne.cursor(d+b.length,-1),changes:{from:d,insert:b}}}}else if(s==">"){let _=HG(m);if(_&&_.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(d,d+2))&&(g=cM(o.doc,_,d)))return{range:c,changes:{from:d,insert:`</${g}>`}}}}return{range:c}});return l.changes.empty?!1:(i.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),Uc=["_blank","_self","_top","_parent"],H_=["ascii","utf-8","utf-16","latin1","latin1"],F_=["get","post","put","delete"],G_=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],Ps=["true","false"],ke={},KG={a:{attrs:{href:null,ping:null,type:null,media:null,target:Uc,hreflang:null}},abbr:ke,address:ke,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:ke,aside:ke,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:ke,base:{attrs:{href:null,target:Uc}},bdi:ke,bdo:ke,blockquote:{attrs:{cite:null}},body:ke,br:ke,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:G_,formmethod:F_,formnovalidate:["novalidate"],formtarget:Uc,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:ke,center:ke,cite:ke,code:ke,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:ke,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:ke,div:ke,dl:ke,dt:ke,em:ke,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:ke,figure:ke,footer:ke,form:{attrs:{action:null,name:null,"accept-charset":H_,autocomplete:["on","off"],enctype:G_,method:F_,novalidate:["novalidate"],target:Uc}},h1:ke,h2:ke,h3:ke,h4:ke,h5:ke,h6:ke,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:ke,hgroup:ke,hr:ke,html:{attrs:{manifest:null}},i:ke,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:G_,formmethod:F_,formnovalidate:["novalidate"],formtarget:Uc,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:ke,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:ke,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:ke,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:H_,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:ke,noscript:ke,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:ke,param:{attrs:{name:null,value:null}},pre:ke,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:ke,rt:ke,ruby:ke,samp:ke,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:H_}},section:ke,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:ke,source:{attrs:{src:null,type:null,media:null}},span:ke,strong:ke,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:ke,summary:ke,sup:ke,table:ke,tbody:ke,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:ke,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:ke,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:ke,time:{attrs:{datetime:null}},title:ke,tr:ke,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:ke,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:ke},_B={accesskey:null,class:null,contenteditable:Ps,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:Ps,autocorrect:Ps,autocapitalize:Ps,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":Ps,"aria-autocomplete":["inline","list","both","none"],"aria-busy":Ps,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":Ps,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":Ps,"aria-hidden":Ps,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":Ps,"aria-multiselectable":Ps,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":Ps,"aria-relevant":null,"aria-required":Ps,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},vB="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map(i=>"on"+i);for(let i of vB)_B[i]=null;class of{constructor(e,t){this.tags={...KG,...e},this.globalAttrs={..._B,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}}of.default=new of;function Ch(i,e,t=i.length){if(!e)return"";let s=e.firstChild,r=s&&s.getChild("TagName");return r?i.sliceString(r.from,Math.min(r.to,t)):""}function kh(i,e=!1){for(;i;i=i.parent)if(i.name=="Element")if(e)e=!1;else return i;return null}function yB(i,e,t){let s=t.tags[Ch(i,kh(e))];return(s==null?void 0:s.children)||t.allTags}function VS(i,e){let t=[];for(let s=kh(e);s&&!s.type.isTop;s=kh(s.parent)){let r=Ch(i,s);if(r&&s.lastChild.name=="CloseTag")break;r&&t.indexOf(r)<0&&(e.name=="EndTag"||e.from>=s.firstChild.to)&&t.push(r)}return t}const bB=/^[:\-\.\w\u00b7-\uffff]*$/;function uM(i,e,t,s,r){let n=/\s*>/.test(i.sliceDoc(r,r+5))?"":">",o=kh(t,t.name=="StartTag"||t.name=="TagName");return{from:s,to:r,options:yB(i.doc,o,e).map(l=>({label:l,type:"type"})).concat(VS(i.doc,t).map((l,c)=>({label:"/"+l,apply:"/"+l+n,type:"type",boost:99-c}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function fM(i,e,t,s){let r=/\s*>/.test(i.sliceDoc(s,s+5))?"":">";return{from:t,to:s,options:VS(i.doc,e).map((n,o)=>({label:n,apply:n+r,type:"type",boost:99-o})),validFor:bB}}function JG(i,e,t,s){let r=[],n=0;for(let o of yB(i.doc,t,e))r.push({label:"<"+o,type:"type"});for(let o of VS(i.doc,t))r.push({label:"</"+o+">",type:"type",boost:99-n++});return{from:s,to:s,options:r,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function eK(i,e,t,s,r){let n=kh(t),o=n?e.tags[Ch(i.doc,n)]:null,l=o&&o.attrs?Object.keys(o.attrs):[],c=o&&o.globalAttrs===!1?l:l.length?l.concat(e.globalAttrNames):e.globalAttrNames;return{from:s,to:r,options:c.map(u=>({label:u,type:"property"})),validFor:bB}}function tK(i,e,t,s,r){var n;let o=(n=t.parent)===null||n===void 0?void 0:n.getChild("AttributeName"),l=[],c;if(o){let u=i.sliceDoc(o.from,o.to),d=e.globalAttrs[u];if(!d){let m=kh(t),g=m?e.tags[Ch(i.doc,m)]:null;d=(g==null?void 0:g.attrs)&&g.attrs[u]}if(d){let m=i.sliceDoc(s,r).toLowerCase(),g='"',_='"';/^['"]/.test(m)?(c=m[0]=='"'?/^[^"]*$/:/^[^']*$/,g="",_=i.sliceDoc(r,r+1)==m[0]?"":m[0],m=m.slice(1),s++):c=/^[^\s<>='"]*$/;for(let y of d)l.push({label:y,apply:g+y+_,type:"constant"})}}return{from:s,to:r,options:l,validFor:c}}function SB(i,e){let{state:t,pos:s}=e,r=ut(t).resolveInner(s,-1),n=r.resolve(s);for(let o=s,l;n==r&&(l=r.childBefore(o));){let c=l.lastChild;if(!c||!c.type.isError||c.from<c.to)break;n=r=l,o=c.from}return r.name=="TagName"?r.parent&&/CloseTag$/.test(r.parent.name)?fM(t,r,r.from,s):uM(t,i,r,r.from,s):r.name=="StartTag"||r.name=="IncompleteTag"?uM(t,i,r,s,s):r.name=="StartCloseTag"||r.name=="IncompleteCloseTag"?fM(t,r,s,s):r.name=="OpenTag"||r.name=="SelfClosingTag"||r.name=="AttributeName"?eK(t,i,r,r.name=="AttributeName"?r.from:s,s):r.name=="Is"||r.name=="AttributeValue"||r.name=="UnquotedAttributeValue"?tK(t,i,r,r.name=="Is"?s:r.from,s):e.explicit&&(n.name=="Element"||n.name=="Text"||n.name=="Document")?JG(t,i,r,s):null}function iK(i){return SB(of.default,i)}function sK(i){let{extraTags:e,extraGlobalAttributes:t}=i,s=t||e?new of(e,t):of.default;return r=>SB(s,r)}const rK=Jr.parser.configure({top:"SingleExpression"}),xB=[{tag:"script",attrs:i=>i.type=="text/typescript"||i.lang=="ts",parser:dB.parser},{tag:"script",attrs:i=>i.type=="text/babel"||i.type=="text/jsx",parser:pB.parser},{tag:"script",attrs:i=>i.type=="text/typescript-jsx",parser:mB.parser},{tag:"script",attrs(i){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(i.type)},parser:rK},{tag:"script",attrs(i){return!i.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(i.type)},parser:Jr.parser},{tag:"style",attrs(i){return(!i.lang||i.lang=="css")&&(!i.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(i.type))},parser:Fm.parser}],wB=[{name:"style",parser:Fm.parser.configure({top:"Styles"})}].concat(vB.map(i=>({name:i,parser:Jr.parser}))),CB=yh.define({name:"html",parser:MF.configure({props:[Sf.add({Element(i){let e=/^(\s*)(<\/)?/.exec(i.textAfter);return i.node.to<=i.pos+e[0].length?i.continue():i.lineIndent(i.node.from)+(e[2]?0:i.unit)},"OpenTag CloseTag SelfClosingTag"(i){return i.column(i.node.from)+i.unit},Document(i){if(i.pos+/\s*/.exec(i.textAfter)[0].length<i.node.to)return i.continue();let e=null,t;for(let s=i.node;;){let r=s.lastChild;if(!r||r.name!="Element"||r.to!=s.to)break;e=s=r}return e&&!((t=e.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag"))?i.lineIndent(e.from)+i.unit:null}}),Rh.add({Element(i){let e=i.firstChild,t=i.lastChild;return!e||e.name!="OpenTag"?null:{from:e.to,to:t.name=="CloseTag"?t.from:i.to}}}),g3.add({"OpenTag CloseTag":i=>i.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"<!--",close:"-->"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Jp=CB.configure({wrap:tB(xB,wB)});function nK(i={}){let e="",t;i.matchClosingTags===!1&&(e="noMatch"),i.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(i.nestedLanguages&&i.nestedLanguages.length||i.nestedAttributes&&i.nestedAttributes.length)&&(t=tB((i.nestedLanguages||[]).concat(xB),(i.nestedAttributes||[]).concat(wB)));let s=t?CB.configure({wrap:t,dialect:e}):e?Jp.configure({dialect:e}):Jp;return new Yu(s,[Jp.data.of({autocomplete:sK(i)}),i.autoCloseTags!==!1?oK:[],YG().support,uG().support])}const dM=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" ")),oK=pe.inputHandler.of((i,e,t,s,r)=>{if(i.composing||i.state.readOnly||e!=t||s!=">"&&s!="/"||!Jp.isActiveAt(i.state,e,-1))return!1;let n=r(),{state:o}=n,l=o.changeByRange(c=>{var u,d,m;let g=o.doc.sliceString(c.from-1,c.to)==s,{head:_}=c,y=ut(o).resolveInner(_,-1),b;if(g&&s==">"&&y.name=="EndTag"){let x=y.parent;if(((d=(u=x.parent)===null||u===void 0?void 0:u.lastChild)===null||d===void 0?void 0:d.name)!="CloseTag"&&(b=Ch(o.doc,x.parent,_))&&!dM.has(b)){let w=_+(o.doc.sliceString(_,_+1)===">"?1:0),k=`</${b}>`;return{range:c,changes:{from:_,to:w,insert:k}}}}else if(g&&s=="/"&&y.name=="IncompleteCloseTag"){let x=y.parent;if(y.from==_-2&&((m=x.lastChild)===null||m===void 0?void 0:m.name)!="CloseTag"&&(b=Ch(o.doc,x,_))&&!dM.has(b)){let w=_+(o.doc.sliceString(_,_+1)===">"?1:0),k=`${b}>`;return{range:ne.cursor(_+k.length,-1),changes:{from:_,to:w,insert:k}}}}return{range:c}});return l.changes.empty?!1:(i.dispatch([n,o.update(l,{userEvent:"input.complete",scrollIntoView:!0})]),!0)}),kB=dS({commentTokens:{block:{open:"<!--",close:"-->"}}}),TB=new Le,AB=xH.configure({props:[Rh.add(i=>!i.is("Block")||i.is("Document")||by(i)!=null||aK(i)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),TB.add(by),Sf.add({Document:()=>null}),La.add({Document:kB})]});function by(i){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(i.name);return e?+e[1]:void 0}function aK(i){return i.name=="OrderedList"||i.name=="BulletList"}function lK(i,e){let t=i;for(;;){let s=t.nextSibling,r;if(!s||(r=by(s.type))!=null&&r<=e)break;t=s}return t.to}const hK=i3.of((i,e,t)=>{for(let s=ut(i).resolveInner(t,-1);s&&!(s.from<e);s=s.parent){let r=s.type.prop(TB);if(r==null)continue;let n=lK(s,r);if(n>t)return{from:t,to:n}}return null});function ZS(i){return new rr(kB,i,[],"markdown")}const cK=ZS(AB),uK=AB.configure([LH,BH,$H,DH,{props:[Rh.add({Table:(i,e)=>({from:e.doc.lineAt(i.from).to,to:i.to})})]}]),af=ZS(uK);function fK(i,e){return t=>{if(t&&i){let s=null;if(t=/\S*/.exec(t)[0],typeof i=="function"?s=i(t):s=Qm.matchLanguageName(i,t,!0),s instanceof Qm)return s.support?s.support.language.parser:Uu.getSkippingParser(s.load());if(s)return s.parser}return e?e.parser:null}}class K_{constructor(e,t,s,r,n,o,l){this.node=e,this.from=t,this.to=s,this.spaceBefore=r,this.spaceAfter=n,this.type=o,this.item=l}blank(e,t=!0){let s=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;s.length<e;)s+=" ";return s}else{for(let r=this.to-this.from-s.length-this.spaceAfter.length;r>0;r--)s+=" ";return s+(t?this.spaceAfter:"")}}marker(e,t){let s=this.node.name=="OrderedList"?String(+EB(this.item,e)[2]+t):"";return this.spaceBefore+s+this.type+this.spaceAfter}}function MB(i,e){let t=[],s=[];for(let r=i;r;r=r.parent){if(r.name=="FencedCode")return s;(r.name=="ListItem"||r.name=="Blockquote")&&t.push(r)}for(let r=t.length-1;r>=0;r--){let n=t[r],o,l=e.lineAt(n.from),c=n.from-l.from;if(n.name=="Blockquote"&&(o=/^ *>( ?)/.exec(l.text.slice(c))))s.push(new K_(n,c,c+o[0].length,"",o[1],">",null));else if(n.name=="ListItem"&&n.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(l.text.slice(c)))){let u=o[3],d=o[0].length;u.length>=4&&(u=u.slice(0,u.length-4),d-=4),s.push(new K_(n.parent,c,c+d,o[1],u,o[2],n))}else if(n.name=="ListItem"&&n.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(l.text.slice(c)))){let u=o[4],d=o[0].length;u.length>4&&(u=u.slice(0,u.length-4),d-=4);let m=o[2];o[3]&&(m+=o[3].replace(/[xX]/," ")),s.push(new K_(n.parent,c,c+d,o[1],u,m,n))}}return s}function EB(i,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(i.from,i.from+10))}function J_(i,e,t,s=0){for(let r=-1,n=i;;){if(n.name=="ListItem"){let l=EB(n,e),c=+l[2];if(r>=0){if(c!=r+1)return;t.push({from:n.from+l[1].length,to:n.from+l[0].length,insert:String(r+2+s)})}r=c}let o=n.nextSibling;if(!o)break;n=o}}function jS(i,e){let t=/^[ \t]*/.exec(i)[0].length;if(!t||e.facet(Qh)!=" ")return i;let s=xr(i,4,t),r="";for(let n=s;n>0;)n>=4?(r+=" ",n-=4):(r+=" ",n--);return r+i.slice(t)}const dK=(i={})=>({state:e,dispatch:t})=>{let s=ut(e),{doc:r}=e,n=null,o=e.changeByRange(l=>{if(!l.empty||!af.isActiveAt(e,l.from,-1)&&!af.isActiveAt(e,l.from,1))return n={range:l};let c=l.from,u=r.lineAt(c),d=MB(s.resolveInner(c,-1),r);for(;d.length&&d[d.length-1].from>c-u.from;)d.pop();if(!d.length)return n={range:l};let m=d[d.length-1];if(m.to-m.spaceAfter.length>c-u.from)return n={range:l};let g=c>=m.to-m.spaceAfter.length&&!/\S/.test(u.text.slice(m.to));if(m.item&&g){let w=m.node.firstChild,k=m.node.getChild("ListItem","ListItem");if(w.to>=c||k&&k.to<c||u.from>0&&!/[^\s>]/.test(r.lineAt(u.from-1).text)||i.nonTightLists===!1){let C=d.length>1?d[d.length-2]:null,A,P="";C&&C.item?(A=u.from+C.from,P=C.marker(r,1)):A=u.from+(C?C.to:0);let E=[{from:A,to:c,insert:P}];return m.node.name=="OrderedList"&&J_(m.item,r,E,-2),C&&C.node.name=="OrderedList"&&J_(C.item,r,E),{range:ne.cursor(A+P.length),changes:E}}else{let C=mM(d,e,u);return{range:ne.cursor(c+C.length+1),changes:{from:u.from,insert:C+e.lineBreak}}}}if(m.node.name=="Blockquote"&&g&&u.from){let w=r.lineAt(u.from-1),k=/>\s*$/.exec(w.text);if(k&&k.index==m.from){let C=e.changes([{from:w.from+k.index,to:w.to},{from:u.from+m.from,to:u.to}]);return{range:l.map(C),changes:C}}}let _=[];m.node.name=="OrderedList"&&J_(m.item,r,_);let y=m.item&&m.item.from<u.from,b="";if(!y||/^[\s\d.)\-+*>]*/.exec(u.text)[0].length>=m.to)for(let w=0,k=d.length-1;w<=k;w++)b+=w==k&&!y?d[w].marker(r,1):d[w].blank(w<k?xr(u.text,4,d[w+1].from)-b.length:null);let x=c;for(;x>u.from&&/\s/.test(u.text.charAt(x-u.from-1));)x--;return b=jS(b,e),mK(m.node,e.doc)&&(b=mM(d,e,u)+e.lineBreak+b),_.push({from:x,to:c,insert:e.lineBreak+b}),{range:ne.cursor(x+b.length+1),changes:_}});return n?!1:(t(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},pK=dK();function pM(i){return i.name=="QuoteMark"||i.name=="ListMark"}function mK(i,e){if(i.name!="OrderedList"&&i.name!="BulletList")return!1;let t=i.firstChild,s=i.getChild("ListItem","ListItem");if(!s)return!1;let r=e.lineAt(t.to),n=e.lineAt(s.from),o=/^[\s>]*$/.test(r.text);return r.number+(o?0:1)<n.number}function mM(i,e,t){let s="";for(let r=0,n=i.length-2;r<=n;r++)s+=i[r].blank(r<n?xr(t.text,4,i[r+1].from)-s.length:null,r<n);return jS(s,e)}function gK(i,e){let t=i.resolveInner(e,-1),s=e;pM(t)&&(s=t.from,t=t.parent);for(let r;r=t.childBefore(s);)if(pM(r))s=r.from;else if(r.name=="OrderedList"||r.name=="BulletList")t=r.lastChild,s=t.to;else break;return t}const OK=({state:i,dispatch:e})=>{let t=ut(i),s=null,r=i.changeByRange(n=>{let o=n.from,{doc:l}=i;if(n.empty&&af.isActiveAt(i,n.from)){let c=l.lineAt(o),u=MB(gK(t,o),l);if(u.length){let d=u[u.length-1],m=d.to-d.spaceAfter.length+(d.spaceAfter?1:0);if(o-c.from>m&&!/\S/.test(c.text.slice(m,o-c.from)))return{range:ne.cursor(c.from+m),changes:{from:c.from+m,to:o}};if(o-c.from==m&&(!d.item||c.from<=d.item.from||!/\S/.test(c.text.slice(0,d.to)))){let g=c.from+d.from;if(d.item&&d.node.from<d.item.from&&/\S/.test(c.text.slice(d.from,d.to))){let _=d.blank(xr(c.text,4,d.to)-xr(c.text,4,d.from));return g==c.from&&(_=jS(_,i)),{range:ne.cursor(g+_.length),changes:{from:g,to:c.from+d.to,insert:_}}}if(g<o)return{range:ne.cursor(g),changes:{from:g,to:o}}}}}return s={range:n}});return s?!1:(e(i.update(r,{scrollIntoView:!0,userEvent:"delete"})),!0)},_K=[{key:"Enter",run:pK},{key:"Backspace",run:OK}],PB=nK({matchClosingTags:!1});function vK(i={}){let{codeLanguages:e,defaultCodeLanguage:t,addKeymap:s=!0,base:{parser:r}=cK,completeHTMLTags:n=!0,pasteURLAsLink:o=!0,htmlTagLanguage:l=PB}=i;if(!(r instanceof bg))throw new RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=i.extensions?[i.extensions]:[],u=[l.support,hK],d;o&&u.push(xK),t instanceof Yu?(u.push(t.support),d=t.language):t&&(d=t);let m=e||d?fK(e,d):void 0;c.push(CH({codeParser:m,htmlParser:l.language.parser})),s&&u.push(Wn.high(Fa.of(_K)));let g=ZS(r.configure(c));return n&&u.push(g.data.of({autocomplete:yK})),new Yu(g,u)}function yK(i){let{state:e,pos:t}=i,s=/<[:\-\.\w\u00b7-\uffff]*$/.exec(e.sliceDoc(t-25,t));if(!s)return null;let r=ut(e).resolveInner(t,-1);for(;r&&!r.type.isTop;){if(r.name=="CodeBlock"||r.name=="FencedCode"||r.name=="ProcessingInstructionBlock"||r.name=="CommentBlock"||r.name=="Link"||r.name=="Image")return null;r=r.parent}return{from:t-s[0].length,to:t,options:bK(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}let ev=null;function bK(){if(ev)return ev;let i=iK(new wS(We.create({extensions:PB}),0,!0));return ev=i?i.options:[]}const SK=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,xK=pe.domEventHandlers({paste:(i,e)=>{var t;let{main:s}=e.state.selection;if(s.empty)return!1;let r=(t=i.clipboardData)===null||t===void 0?void 0:t.getData("text/plain");if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r="https://"+r),!af.isActiveAt(e.state,s.from,1)))return!1;let n=ut(e.state),o=!1;return n.iterate({from:s.from,to:s.to,enter:l=>{(l.from>s.from||SK.test(l.name))&&(o=!0)},leave:l=>{l.to<s.to&&(o=!0)}}),o?!1:(e.dispatch({changes:[{from:s.from,insert:"["},{from:s.to,insert:`](${r})`}],userEvent:"input.paste",scrollIntoView:!0}),!0)}});function wK({initialContent:i,filePath:e,onSave:t,onClose:s}){const[r,n]=Y.useState(i),[o,l]=Y.useState(!1),[c,u]=Y.useState(!1),d=Y.useRef(r);Y.useEffect(()=>{d.current=r},[r]);const m=Y.useCallback(b=>{n(b),u(b!==i)},[i]),g=Y.useCallback(async()=>{if(!o){l(!0);try{await t(d.current),u(!1)}catch(b){console.error("[plan-editor] Save failed:",b)}finally{l(!1)}}},[t,o]),_=Y.useCallback(()=>{c&&!window.confirm("Unsaved changes -- discard?")||s()},[c,s]),y=Fa.of([{key:"Mod-s",run:()=>(g(),!0)}]);return Y.useEffect(()=>{const b=x=>{(x.ctrlKey||x.metaKey)&&x.key==="s"&&x.preventDefault()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]),M.jsxs("div",{className:"fixed inset-0 z-50 bg-background/95 flex flex-col",children:[M.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border bg-card",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:e}),c&&M.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded-sm bg-warning/20 text-warning font-mono",children:"unsaved"})]}),M.jsxs("div",{className:"flex items-center gap-2",children:[c&&M.jsx("button",{type:"button",onClick:g,disabled:o,className:dt("text-xs px-3 py-1.5 rounded-md font-mono","bg-accent text-foreground","hover:bg-accent-glow","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:o?"Saving...":"Save"}),M.jsx("button",{type:"button",onClick:_,className:dt("text-xs px-3 py-1.5 rounded-md font-mono","bg-muted text-muted-foreground","hover:bg-danger/20 hover:text-danger","transition-colors focus:outline-none focus:ring-2 focus:ring-accent/50"),children:"Close"})]})]}),M.jsx("div",{className:"flex-1 overflow-auto",children:M.jsx(b$,{value:r,onChange:m,theme:y$,extensions:[vK({base:af}),y],height:"calc(100vh - 56px)",basicSetup:{lineNumbers:!0,foldGutter:!0,highlightActiveLine:!0,bracketMatching:!0,indentOnInput:!0}})})]})}function CK({phaseId:i,onBack:e}){const{plans:t,context:s,research:r,loading:n,error:o,refetch:l}=CZ(i),[c,u]=Y.useState(null),[d,m]=Y.useState(""),g=t.length>0?t[0].frontmatter.phase??i:i,_=Y.useCallback(async x=>{try{const k=x.replace(/^\.planning[\\/]/,"").split(/[\\/]/),C=await fetch(`/api/plan/${k.join("/")}`);if(!C.ok){console.error("[phase-detail] Failed to fetch plan for editing");return}const A=await C.json();m(A.content),u(x)}catch(w){console.error("[phase-detail] Error fetching plan:",w)}},[]),y=Y.useCallback(async x=>{if(!c)return;const k=c.replace(/^\.planning[\\/]/,"").split(/[\\/]/);if(!(await fetch(`/api/plan/${k.join("/")}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:x})})).ok)throw new Error("Failed to save plan")},[c]),b=Y.useCallback(()=>{u(null),m(""),l()},[l]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("button",{type:"button",onClick:e,className:dt("flex items-center gap-2 text-sm text-muted-foreground","hover:text-foreground transition-colors","focus:outline-none focus:ring-2 focus:ring-accent/50 rounded-md px-2 py-1"),children:[M.jsx("svg",{className:"w-4 h-4",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M10 3L5 8l5 5"})}),"Back to overview"]}),M.jsxs("div",{children:[M.jsxs("h2",{className:"text-2xl font-semibold tracking-tight",children:[M.jsxs("span",{className:"text-accent font-mono",children:["Phase ",i]}),M.jsx("span",{className:"mx-2 text-muted-foreground",children:"-"}),M.jsx("span",{children:g})]}),M.jsxs("div",{className:"flex gap-2 mt-2",children:[s&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"context available"}),r&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-success/20 text-success font-mono",children:"research available"}),!s&&!r&&!n&&M.jsx("span",{className:"text-xs px-2 py-0.5 rounded-sm bg-muted text-muted-foreground font-mono",children:"no context or research"})]})]}),o&&M.jsx("div",{className:"p-4 rounded-lg border border-danger/50 bg-danger/10 text-danger text-sm",children:o}),n&&t.length===0&&M.jsx("div",{className:"space-y-4",children:[1,2,3].map(x=>M.jsxs("div",{className:"bg-card border border-border rounded-lg p-4 animate-pulse",children:[M.jsx("div",{className:"h-6 w-32 bg-muted rounded mb-3"}),M.jsx("div",{className:"h-4 w-3/4 bg-muted rounded mb-2"}),M.jsx("div",{className:"h-4 w-1/2 bg-muted rounded mb-3"}),M.jsxs("div",{className:"space-y-2",children:[M.jsx("div",{className:"h-3 w-full bg-muted rounded"}),M.jsx("div",{className:"h-3 w-5/6 bg-muted rounded"})]})]},x))}),!n&&!o&&t.length===0&&M.jsx("div",{className:"p-8 text-center text-muted-foreground border border-border rounded-lg bg-card",children:M.jsxs("p",{className:"text-sm",children:["No plans yet -- run"," ",M.jsx("code",{className:"font-mono text-accent",children:"/maxsim:plan-phase"})," to create plans"]})}),t.length>0&&M.jsx("div",{className:"space-y-4",children:t.map(x=>M.jsx(TZ,{plan:x,onEdit:_},x.path))}),c&&M.jsx(wK,{initialContent:d,filePath:c,onSave:y,onClose:b})]})}function kK(){const{lastChange:i}=ff(),[e,t]=Y.useState([]),[s,r]=Y.useState([]),[n,o]=Y.useState(!0),[l,c]=Y.useState(null),[u,d]=Y.useState(""),[m,g]=Y.useState(!1),[_,y]=Y.useState(!1),b=Y.useCallback(async()=>{try{c(null);const k=await fetch("/api/todos");if(!k.ok)throw new Error(`Failed to fetch todos: ${k.status}`);const C=await k.json();t(C.pending),r(C.completed)}catch(k){c(k instanceof Error?k.message:"Failed to fetch todos")}finally{o(!1)}},[]);Y.useEffect(()=>{b()},[b]),Y.useEffect(()=>{i>0&&b()},[i,b]);const x=Y.useCallback(async()=>{const k=u.trim();if(k){g(!0);try{if(!(await fetch("/api/todos",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:k})})).ok)throw new Error("Failed to create todo");d(""),await b()}catch(C){c(C instanceof Error?C.message:"Failed to create todo")}finally{g(!1)}}},[u,b]),w=Y.useCallback(async(k,C)=>{try{if(!(await fetch("/api/todos",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:k,completed:C})})).ok)throw new Error("Failed to update todo");await b()}catch(A){c(A instanceof Error?A.message:"Failed to update todo")}},[b]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Todos"}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[e.length," pending"]})]}),M.jsxs("div",{className:"flex gap-2",children:[M.jsx("input",{type:"text",value:u,onChange:k=>d(k.target.value),onKeyDown:k=>{k.key==="Enter"&&!m&&x()},placeholder:"Add a new todo...",className:"flex-1 rounded-sm border border-border bg-card px-3 py-2 font-mono text-sm text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("button",{type:"button",onClick:x,disabled:m||!u.trim(),className:dt("rounded-sm bg-accent px-4 py-2 font-mono text-xs font-semibold text-foreground transition-colors","hover:bg-accent-glow disabled:opacity-40 disabled:cursor-not-allowed"),children:"Add"})]}),l&&M.jsx("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:l}),n&&M.jsx("div",{className:"space-y-2",children:[1,2,3].map(k=>M.jsxs("div",{className:"flex items-center gap-3 rounded-sm bg-card px-4 py-3",children:[M.jsx("div",{className:"h-4 w-4 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-4 w-48 animate-pulse rounded-sm bg-muted"})]},k))}),!n&&M.jsx("div",{className:"space-y-1",children:e.length===0?M.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"No pending todos"}):e.map(k=>M.jsxs("button",{type:"button",onClick:()=>w(k.file,!0),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2.5 text-left transition-colors hover:bg-card-hover",children:[M.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-muted-foreground transition-colors group-hover:border-accent"}),M.jsx("span",{className:"text-sm text-foreground",children:k.text})]},k.file))}),!n&&s.length>0&&M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>y(!_),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",_&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Completed (",s.length,")"]})]}),_&&M.jsx("div",{className:"mt-2 space-y-1",children:s.map(k=>M.jsxs("button",{type:"button",onClick:()=>w(k.file,!1),className:"group flex w-full items-center gap-3 rounded-sm px-4 py-2 text-left transition-colors hover:bg-card-hover",children:[M.jsx("span",{className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm border border-success bg-success/20",children:M.jsx("svg",{className:"h-3 w-3 text-success",viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M2 6l3 3 5-5"})})}),M.jsx("span",{className:"text-sm text-muted-foreground line-through",children:k.text})]},k.file))})]})]})}function TK({onEntryAdded:i}){const[e,t]=Y.useState(!1),[s,r]=Y.useState("decision"),[n,o]=Y.useState(""),[l,c]=Y.useState(""),[u,d]=Y.useState(!1),[m,g]=Y.useState(null),[_,y]=Y.useState(null),b=Y.useCallback(async()=>{const x=l.trim();if(x){d(!0),g(null),y(null);try{if(s==="decision"){const w=await fetch("/api/state/decision",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({phase:n.trim()||void 0,text:x})});if(!w.ok){const k=await w.json().catch(()=>({}));throw new Error(k.error||"Could not add decision")}y("Decision added")}else{const w=await fetch("/api/state/blocker",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:x})});if(!w.ok){const k=await w.json().catch(()=>({}));throw new Error(k.error||"Could not add blocker")}y("Blocker added")}c(""),o(""),i==null||i(),setTimeout(()=>y(null),2e3)}catch(w){g(w instanceof Error?w.message:"Failed to update STATE.md")}finally{d(!1)}}},[s,n,l,i]);return M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",e&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide text-muted-foreground",children:"Add to STATE.md"})]}),e&&M.jsxs("div",{className:"mt-3 space-y-3",children:[M.jsxs("div",{className:"flex gap-1",children:[M.jsx("button",{type:"button",onClick:()=>r("decision"),className:dt("rounded-sm px-3 py-1 font-mono text-xs transition-colors",s==="decision"?"bg-accent/20 text-accent":"text-muted-foreground hover:text-foreground"),children:"Decision"}),M.jsx("button",{type:"button",onClick:()=>r("blocker"),className:dt("rounded-sm px-3 py-1 font-mono text-xs transition-colors",s==="blocker"?"bg-danger/20 text-danger":"text-muted-foreground hover:text-foreground"),children:"Blocker"})]}),s==="decision"&&M.jsx("input",{type:"text",value:n,onChange:x=>o(x.target.value),placeholder:"Phase (e.g. 13-06)",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("input",{type:"text",value:l,onChange:x=>c(x.target.value),onKeyDown:x=>{x.key==="Enter"&&!u&&b()},placeholder:s==="decision"?"Decision text...":"Blocker description...",className:"w-full rounded-sm border border-border bg-card px-3 py-1.5 font-mono text-xs text-foreground placeholder:text-muted-foreground focus:border-accent focus:outline-none"}),M.jsx("button",{type:"button",onClick:b,disabled:u||!l.trim(),className:dt("rounded-sm px-3 py-1.5 font-mono text-xs font-semibold transition-colors","disabled:opacity-40 disabled:cursor-not-allowed",s==="decision"?"bg-accent/20 text-accent hover:bg-accent/30":"bg-danger/20 text-danger hover:bg-danger/30"),children:u?"Saving...":`Add ${s==="decision"?"Decision":"Blocker"}`}),m&&M.jsx("p",{className:"text-xs text-danger",children:m}),_&&M.jsx("p",{className:"text-xs text-success",children:_})]})]})}function AK(i){return i.map(e=>({text:e.replace(/~~(.+)~~/,"$1").replace(/\s*RESOLVED.*$/i,"").trim(),resolved:e.includes("RESOLVED")||e.startsWith("~~")&&e.endsWith("~~")}))}function MK(){const{state:i}=fb(),[e,t]=Y.useState(!1),[s,r]=Y.useState(null),[n,o]=Y.useState(null),[l,c]=Y.useState(0),u=AK((i==null?void 0:i.blockers)??[]),d=u.filter(y=>!y.resolved),m=u.filter(y=>y.resolved),g=Y.useCallback(async y=>{r(y),o(null);try{if(!(await fetch("/api/state",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({field:"blockers",value:`~~${y}~~ RESOLVED`})})).ok)throw new Error("Failed to resolve blocker");c(x=>x+1)}catch(b){o(b instanceof Error?b.message:"Failed to resolve blocker")}finally{r(null)}},[]),_=Y.useCallback(()=>{c(y=>y+1)},[]);return M.jsxs("div",{className:"space-y-6",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("h2",{className:"font-mono text-lg font-semibold tracking-tight text-foreground",children:"Blockers"}),M.jsx("span",{className:dt("font-mono text-xs",d.length>0?"text-danger":"text-success"),children:d.length>0?`${d.length} active`:"No active blockers"})]}),n&&M.jsx("div",{className:"rounded-sm border border-danger/50 bg-danger/10 px-3 py-2 text-sm text-danger",children:n}),d.length===0?M.jsx("div",{className:"rounded-sm border border-success/30 bg-success/5 px-4 py-6 text-center",children:M.jsx("p",{className:"text-sm text-success",children:"No active blockers"})}):M.jsx("div",{className:"space-y-2",children:d.map(y=>M.jsxs("div",{className:"flex items-start gap-3 rounded-sm border border-border bg-card px-4 py-3",children:[M.jsx("span",{className:"mt-1 inline-block h-2 w-2 shrink-0 rounded-full bg-danger"}),M.jsx("div",{className:"flex-1",children:M.jsx("p",{className:"text-sm text-foreground",children:y.text})}),M.jsx("button",{type:"button",onClick:()=>g(y.text),disabled:s===y.text,className:dt("shrink-0 rounded-sm px-3 py-1 font-mono text-xs transition-colors","bg-success/20 text-success hover:bg-success/30","disabled:opacity-40 disabled:cursor-not-allowed"),children:s===y.text?"...":"Resolve"})]},y.text))}),m.length>0&&M.jsxs("div",{className:"border-t border-border pt-4",children:[M.jsxs("button",{type:"button",onClick:()=>t(!e),className:"flex w-full items-center gap-2 text-left",children:[M.jsx("svg",{className:dt("h-3 w-3 text-muted-foreground transition-transform",e&&"rotate-90"),viewBox:"0 0 12 12",fill:"currentColor",children:M.jsx("path",{d:"M4 2l5 4-5 4z"})}),M.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:["Resolved (",m.length,")"]})]}),e&&M.jsx("div",{className:"mt-2 space-y-1",children:m.map(y=>M.jsxs("div",{className:"flex items-center gap-3 rounded-sm px-4 py-2",children:[M.jsx("span",{className:"inline-block h-2 w-2 shrink-0 rounded-full bg-muted"}),M.jsx("p",{className:"text-sm text-muted-foreground line-through",children:y.text})]},y.text))})]}),M.jsx(TK,{onEntryAdded:_})]},l)}function EK({sidebar:i,children:e}){return M.jsxs("div",{className:"flex h-screen overflow-hidden",children:[M.jsx("div",{className:"hidden md:flex",children:i}),M.jsx("main",{className:"flex flex-1 flex-col overflow-hidden",children:e})]})}var Nl={},tv,gM;function PK(){return gM||(gM=1,tv=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),tv}var iv={},wo={},OM;function Ga(){if(OM)return wo;OM=1;let i;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return wo.getSymbolSize=function(s){if(!s)throw new Error('"version" cannot be null or undefined');if(s<1||s>40)throw new Error('"version" should be in range from 1 to 40');return s*4+17},wo.getSymbolTotalCodewords=function(s){return e[s]},wo.getBCHDigit=function(t){let s=0;for(;t!==0;)s++,t>>>=1;return s},wo.setToSJISFunction=function(s){if(typeof s!="function")throw new Error('"toSJISFunc" is not a valid function.');i=s},wo.isKanjiModeEnabled=function(){return typeof i<"u"},wo.toSJIS=function(s){return i(s)},wo}var sv={},_M;function IS(){return _M||(_M=1,(function(i){i.L={bit:1},i.M={bit:0},i.Q={bit:3},i.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return i.L;case"m":case"medium":return i.M;case"q":case"quartile":return i.Q;case"h":case"high":return i.H;default:throw new Error("Unknown EC Level: "+t)}}i.isValid=function(s){return s&&typeof s.bit<"u"&&s.bit>=0&&s.bit<4},i.from=function(s,r){if(i.isValid(s))return s;try{return e(s)}catch{return r}}})(sv)),sv}var rv,vM;function QK(){if(vM)return rv;vM=1;function i(){this.buffer=[],this.length=0}return i.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let s=0;s<t;s++)this.putBit((e>>>t-s-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},rv=i,rv}var nv,yM;function RK(){if(yM)return nv;yM=1;function i(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return i.prototype.set=function(e,t,s,r){const n=e*this.size+t;this.data[n]=s,r&&(this.reservedBit[n]=!0)},i.prototype.get=function(e,t){return this.data[e*this.size+t]},i.prototype.xor=function(e,t,s){this.data[e*this.size+t]^=s},i.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},nv=i,nv}var ov={},bM;function LK(){return bM||(bM=1,(function(i){const e=Ga().getSymbolSize;i.getRowColCoords=function(s){if(s===1)return[];const r=Math.floor(s/7)+2,n=e(s),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,l=[n-7];for(let c=1;c<r-1;c++)l[c]=l[c-1]-o;return l.push(6),l.reverse()},i.getPositions=function(s){const r=[],n=i.getRowColCoords(s),o=n.length;for(let l=0;l<o;l++)for(let c=0;c<o;c++)l===0&&c===0||l===0&&c===o-1||l===o-1&&c===0||r.push([n[l],n[c]]);return r}})(ov)),ov}var av={},SM;function $K(){if(SM)return av;SM=1;const i=Ga().getSymbolSize,e=7;return av.getPositions=function(s){const r=i(s);return[[0,0],[r-e,0],[0,r-e]]},av}var lv={},xM;function BK(){return xM||(xM=1,(function(i){i.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};i.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},i.from=function(r){return i.isValid(r)?parseInt(r,10):void 0},i.getPenaltyN1=function(r){const n=r.size;let o=0,l=0,c=0,u=null,d=null;for(let m=0;m<n;m++){l=c=0,u=d=null;for(let g=0;g<n;g++){let _=r.get(m,g);_===u?l++:(l>=5&&(o+=e.N1+(l-5)),u=_,l=1),_=r.get(g,m),_===d?c++:(c>=5&&(o+=e.N1+(c-5)),d=_,c=1)}l>=5&&(o+=e.N1+(l-5)),c>=5&&(o+=e.N1+(c-5))}return o},i.getPenaltyN2=function(r){const n=r.size;let o=0;for(let l=0;l<n-1;l++)for(let c=0;c<n-1;c++){const u=r.get(l,c)+r.get(l,c+1)+r.get(l+1,c)+r.get(l+1,c+1);(u===4||u===0)&&o++}return o*e.N2},i.getPenaltyN3=function(r){const n=r.size;let o=0,l=0,c=0;for(let u=0;u<n;u++){l=c=0;for(let d=0;d<n;d++)l=l<<1&2047|r.get(u,d),d>=10&&(l===1488||l===93)&&o++,c=c<<1&2047|r.get(d,u),d>=10&&(c===1488||c===93)&&o++}return o*e.N3},i.getPenaltyN4=function(r){let n=0;const o=r.data.length;for(let c=0;c<o;c++)n+=r.data[c];return Math.abs(Math.ceil(n*100/o/5)-10)*e.N4};function t(s,r,n){switch(s){case i.Patterns.PATTERN000:return(r+n)%2===0;case i.Patterns.PATTERN001:return r%2===0;case i.Patterns.PATTERN010:return n%3===0;case i.Patterns.PATTERN011:return(r+n)%3===0;case i.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2===0;case i.Patterns.PATTERN101:return r*n%2+r*n%3===0;case i.Patterns.PATTERN110:return(r*n%2+r*n%3)%2===0;case i.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2===0;default:throw new Error("bad maskPattern:"+s)}}i.applyMask=function(r,n){const o=n.size;for(let l=0;l<o;l++)for(let c=0;c<o;c++)n.isReserved(c,l)||n.xor(c,l,t(r,c,l))},i.getBestMask=function(r,n){const o=Object.keys(i.Patterns).length;let l=0,c=1/0;for(let u=0;u<o;u++){n(u),i.applyMask(u,r);const d=i.getPenaltyN1(r)+i.getPenaltyN2(r)+i.getPenaltyN3(r)+i.getPenaltyN4(r);i.applyMask(u,r),d<c&&(c=d,l=u)}return l}})(lv)),lv}var Cp={},wM;function QB(){if(wM)return Cp;wM=1;const i=IS(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],t=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return Cp.getBlocksCount=function(r,n){switch(n){case i.L:return e[(r-1)*4+0];case i.M:return e[(r-1)*4+1];case i.Q:return e[(r-1)*4+2];case i.H:return e[(r-1)*4+3];default:return}},Cp.getTotalCodewordsCount=function(r,n){switch(n){case i.L:return t[(r-1)*4+0];case i.M:return t[(r-1)*4+1];case i.Q:return t[(r-1)*4+2];case i.H:return t[(r-1)*4+3];default:return}},Cp}var hv={},Yc={},CM;function DK(){if(CM)return Yc;CM=1;const i=new Uint8Array(512),e=new Uint8Array(256);return(function(){let s=1;for(let r=0;r<255;r++)i[r]=s,e[s]=r,s<<=1,s&256&&(s^=285);for(let r=255;r<512;r++)i[r]=i[r-255]})(),Yc.log=function(s){if(s<1)throw new Error("log("+s+")");return e[s]},Yc.exp=function(s){return i[s]},Yc.mul=function(s,r){return s===0||r===0?0:i[e[s]+e[r]]},Yc}var kM;function zK(){return kM||(kM=1,(function(i){const e=DK();i.mul=function(s,r){const n=new Uint8Array(s.length+r.length-1);for(let o=0;o<s.length;o++)for(let l=0;l<r.length;l++)n[o+l]^=e.mul(s[o],r[l]);return n},i.mod=function(s,r){let n=new Uint8Array(s);for(;n.length-r.length>=0;){const o=n[0];for(let c=0;c<r.length;c++)n[c]^=e.mul(r[c],o);let l=0;for(;l<n.length&&n[l]===0;)l++;n=n.slice(l)}return n},i.generateECPolynomial=function(s){let r=new Uint8Array([1]);for(let n=0;n<s;n++)r=i.mul(r,new Uint8Array([1,e.exp(n)]));return r}})(hv)),hv}var cv,TM;function NK(){if(TM)return cv;TM=1;const i=zK();function e(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(s){this.degree=s,this.genPoly=i.generateECPolynomial(this.degree)},e.prototype.encode=function(s){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(s.length+this.degree);r.set(s);const n=i.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){const l=new Uint8Array(this.degree);return l.set(n,o),l}return n},cv=e,cv}var uv={},fv={},dv={},AM;function RB(){return AM||(AM=1,dv.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),dv}var Br={},MM;function LB(){if(MM)return Br;MM=1;const i="[0-9]+",e="[A-Z $%*+\\-./:]+";let t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";t=t.replace(/u/g,"\\u");const s="(?:(?![A-Z0-9 $%*+\\-./:]|"+t+`)(?:.|[\r
|
|
79
|
+
]))+`;Br.KANJI=new RegExp(t,"g"),Br.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Br.BYTE=new RegExp(s,"g"),Br.NUMERIC=new RegExp(i,"g"),Br.ALPHANUMERIC=new RegExp(e,"g");const r=new RegExp("^"+t+"$"),n=new RegExp("^"+i+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Br.testKanji=function(c){return r.test(c)},Br.testNumeric=function(c){return n.test(c)},Br.testAlphanumeric=function(c){return o.test(c)},Br}var EM;function Ka(){return EM||(EM=1,(function(i){const e=RB(),t=LB();i.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},i.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},i.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},i.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},i.MIXED={bit:-1},i.getCharCountIndicator=function(n,o){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?n.ccBits[0]:o<27?n.ccBits[1]:n.ccBits[2]},i.getBestModeForData=function(n){return t.testNumeric(n)?i.NUMERIC:t.testAlphanumeric(n)?i.ALPHANUMERIC:t.testKanji(n)?i.KANJI:i.BYTE},i.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},i.isValid=function(n){return n&&n.bit&&n.ccBits};function s(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return i.NUMERIC;case"alphanumeric":return i.ALPHANUMERIC;case"kanji":return i.KANJI;case"byte":return i.BYTE;default:throw new Error("Unknown mode: "+r)}}i.from=function(n,o){if(i.isValid(n))return n;try{return s(n)}catch{return o}}})(fv)),fv}var PM;function XK(){return PM||(PM=1,(function(i){const e=Ga(),t=QB(),s=IS(),r=Ka(),n=RB(),o=7973,l=e.getBCHDigit(o);function c(g,_,y){for(let b=1;b<=40;b++)if(_<=i.getCapacity(b,y,g))return b}function u(g,_){return r.getCharCountIndicator(g,_)+4}function d(g,_){let y=0;return g.forEach(function(b){const x=u(b.mode,_);y+=x+b.getBitsLength()}),y}function m(g,_){for(let y=1;y<=40;y++)if(d(g,y)<=i.getCapacity(y,_,r.MIXED))return y}i.from=function(_,y){return n.isValid(_)?parseInt(_,10):y},i.getCapacity=function(_,y,b){if(!n.isValid(_))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=r.BYTE);const x=e.getSymbolTotalCodewords(_),w=t.getTotalCodewordsCount(_,y),k=(x-w)*8;if(b===r.MIXED)return k;const C=k-u(b,_);switch(b){case r.NUMERIC:return Math.floor(C/10*3);case r.ALPHANUMERIC:return Math.floor(C/11*2);case r.KANJI:return Math.floor(C/13);case r.BYTE:default:return Math.floor(C/8)}},i.getBestVersionForData=function(_,y){let b;const x=s.from(y,s.M);if(Array.isArray(_)){if(_.length>1)return m(_,x);if(_.length===0)return 1;b=_[0]}else b=_;return c(b.mode,b.getLength(),x)},i.getEncodedBits=function(_){if(!n.isValid(_)||_<7)throw new Error("Invalid QR Code version");let y=_<<12;for(;e.getBCHDigit(y)-l>=0;)y^=o<<e.getBCHDigit(y)-l;return _<<12|y}})(uv)),uv}var pv={},QM;function VK(){if(QM)return pv;QM=1;const i=Ga(),e=1335,t=21522,s=i.getBCHDigit(e);return pv.getEncodedBits=function(n,o){const l=n.bit<<3|o;let c=l<<10;for(;i.getBCHDigit(c)-s>=0;)c^=e<<i.getBCHDigit(c)-s;return(l<<10|c)^t},pv}var mv={},gv,RM;function ZK(){if(RM)return gv;RM=1;const i=Ka();function e(t){this.mode=i.NUMERIC,this.data=t.toString()}return e.getBitsLength=function(s){return 10*Math.floor(s/3)+(s%3?s%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(s){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),s.put(o,10);const l=this.data.length-r;l>0&&(n=this.data.substr(r),o=parseInt(n,10),s.put(o,l*3+1))},gv=e,gv}var Ov,LM;function jK(){if(LM)return Ov;LM=1;const i=Ka(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function t(s){this.mode=i.ALPHANUMERIC,this.data=s}return t.getBitsLength=function(r){return 11*Math.floor(r/2)+6*(r%2)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let n;for(n=0;n+2<=this.data.length;n+=2){let o=e.indexOf(this.data[n])*45;o+=e.indexOf(this.data[n+1]),r.put(o,11)}this.data.length%2&&r.put(e.indexOf(this.data[n]),6)},Ov=t,Ov}var _v,$M;function IK(){if($M)return _v;$M=1;const i=Ka();function e(t){this.mode=i.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}return e.getBitsLength=function(s){return s*8},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(t){for(let s=0,r=this.data.length;s<r;s++)t.put(this.data[s],8)},_v=e,_v}var vv,BM;function qK(){if(BM)return vv;BM=1;const i=Ka(),e=Ga();function t(s){this.mode=i.KANJI,this.data=s}return t.getBitsLength=function(r){return r*13},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(s){let r;for(r=0;r<this.data.length;r++){let n=e.toSJIS(this.data[r]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[r]+`
|
|
80
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),s.put(n,13)}},vv=t,vv}var yv={exports:{}},DM;function WK(){return DM||(DM=1,(function(i){var e={single_source_shortest_paths:function(t,s,r){var n={},o={};o[s]=0;var l=e.PriorityQueue.make();l.push(s,0);for(var c,u,d,m,g,_,y,b,x;!l.empty();){c=l.pop(),u=c.value,m=c.cost,g=t[u]||{};for(d in g)g.hasOwnProperty(d)&&(_=g[d],y=m+_,b=o[d],x=typeof o[d]>"u",(x||b>y)&&(o[d]=y,l.push(d,y),n[d]=u))}if(typeof r<"u"&&typeof o[r]>"u"){var w=["Could not find a path from ",s," to ",r,"."].join("");throw new Error(w)}return n},extract_shortest_path_from_predecessor_list:function(t,s){for(var r=[],n=s;n;)r.push(n),t[n],n=t[n];return r.reverse(),r},find_path:function(t,s,r){var n=e.single_source_shortest_paths(t,s,r);return e.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var s=e.PriorityQueue,r={},n;t=t||{};for(n in s)s.hasOwnProperty(n)&&(r[n]=s[n]);return r.queue=[],r.sorter=t.sorter||s.default_sorter,r},default_sorter:function(t,s){return t.cost-s.cost},push:function(t,s){var r={value:t,cost:s};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};i.exports=e})(yv)),yv.exports}var zM;function UK(){return zM||(zM=1,(function(i){const e=Ka(),t=ZK(),s=jK(),r=IK(),n=qK(),o=LB(),l=Ga(),c=WK();function u(w){return unescape(encodeURIComponent(w)).length}function d(w,k,C){const A=[];let P;for(;(P=w.exec(C))!==null;)A.push({data:P[0],index:P.index,mode:k,length:P[0].length});return A}function m(w){const k=d(o.NUMERIC,e.NUMERIC,w),C=d(o.ALPHANUMERIC,e.ALPHANUMERIC,w);let A,P;return l.isKanjiModeEnabled()?(A=d(o.BYTE,e.BYTE,w),P=d(o.KANJI,e.KANJI,w)):(A=d(o.BYTE_KANJI,e.BYTE,w),P=[]),k.concat(C,A,P).sort(function($,z){return $.index-z.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function g(w,k){switch(k){case e.NUMERIC:return t.getBitsLength(w);case e.ALPHANUMERIC:return s.getBitsLength(w);case e.KANJI:return n.getBitsLength(w);case e.BYTE:return r.getBitsLength(w)}}function _(w){return w.reduce(function(k,C){const A=k.length-1>=0?k[k.length-1]:null;return A&&A.mode===C.mode?(k[k.length-1].data+=C.data,k):(k.push(C),k)},[])}function y(w){const k=[];for(let C=0;C<w.length;C++){const A=w[C];switch(A.mode){case e.NUMERIC:k.push([A,{data:A.data,mode:e.ALPHANUMERIC,length:A.length},{data:A.data,mode:e.BYTE,length:A.length}]);break;case e.ALPHANUMERIC:k.push([A,{data:A.data,mode:e.BYTE,length:A.length}]);break;case e.KANJI:k.push([A,{data:A.data,mode:e.BYTE,length:u(A.data)}]);break;case e.BYTE:k.push([{data:A.data,mode:e.BYTE,length:u(A.data)}])}}return k}function b(w,k){const C={},A={start:{}};let P=["start"];for(let E=0;E<w.length;E++){const $=w[E],z=[];for(let I=0;I<$.length;I++){const se=$[I],F=""+E+I;z.push(F),C[F]={node:se,lastCount:0},A[F]={};for(let R=0;R<P.length;R++){const L=P[R];C[L]&&C[L].node.mode===se.mode?(A[L][F]=g(C[L].lastCount+se.length,se.mode)-g(C[L].lastCount,se.mode),C[L].lastCount+=se.length):(C[L]&&(C[L].lastCount=se.length),A[L][F]=g(se.length,se.mode)+4+e.getCharCountIndicator(se.mode,k))}}P=z}for(let E=0;E<P.length;E++)A[P[E]].end=0;return{map:A,table:C}}function x(w,k){let C;const A=e.getBestModeForData(w);if(C=e.from(k,A),C!==e.BYTE&&C.bit<A.bit)throw new Error('"'+w+'" cannot be encoded with mode '+e.toString(C)+`.
|
|
81
|
+
Suggested mode is: `+e.toString(A));switch(C===e.KANJI&&!l.isKanjiModeEnabled()&&(C=e.BYTE),C){case e.NUMERIC:return new t(w);case e.ALPHANUMERIC:return new s(w);case e.KANJI:return new n(w);case e.BYTE:return new r(w)}}i.fromArray=function(k){return k.reduce(function(C,A){return typeof A=="string"?C.push(x(A,null)):A.data&&C.push(x(A.data,A.mode)),C},[])},i.fromString=function(k,C){const A=m(k,l.isKanjiModeEnabled()),P=y(A),E=b(P,C),$=c.find_path(E.map,"start","end"),z=[];for(let I=1;I<$.length-1;I++)z.push(E.table[$[I]].node);return i.fromArray(_(z))},i.rawSplit=function(k){return i.fromArray(m(k,l.isKanjiModeEnabled()))}})(mv)),mv}var NM;function YK(){if(NM)return iv;NM=1;const i=Ga(),e=IS(),t=QK(),s=RK(),r=LK(),n=$K(),o=BK(),l=QB(),c=NK(),u=XK(),d=VK(),m=Ka(),g=UK();function _(E,$){const z=E.size,I=n.getPositions($);for(let se=0;se<I.length;se++){const F=I[se][0],R=I[se][1];for(let L=-1;L<=7;L++)if(!(F+L<=-1||z<=F+L))for(let N=-1;N<=7;N++)R+N<=-1||z<=R+N||(L>=0&&L<=6&&(N===0||N===6)||N>=0&&N<=6&&(L===0||L===6)||L>=2&&L<=4&&N>=2&&N<=4?E.set(F+L,R+N,!0,!0):E.set(F+L,R+N,!1,!0))}}function y(E){const $=E.size;for(let z=8;z<$-8;z++){const I=z%2===0;E.set(z,6,I,!0),E.set(6,z,I,!0)}}function b(E,$){const z=r.getPositions($);for(let I=0;I<z.length;I++){const se=z[I][0],F=z[I][1];for(let R=-2;R<=2;R++)for(let L=-2;L<=2;L++)R===-2||R===2||L===-2||L===2||R===0&&L===0?E.set(se+R,F+L,!0,!0):E.set(se+R,F+L,!1,!0)}}function x(E,$){const z=E.size,I=u.getEncodedBits($);let se,F,R;for(let L=0;L<18;L++)se=Math.floor(L/3),F=L%3+z-8-3,R=(I>>L&1)===1,E.set(se,F,R,!0),E.set(F,se,R,!0)}function w(E,$,z){const I=E.size,se=d.getEncodedBits($,z);let F,R;for(F=0;F<15;F++)R=(se>>F&1)===1,F<6?E.set(F,8,R,!0):F<8?E.set(F+1,8,R,!0):E.set(I-15+F,8,R,!0),F<8?E.set(8,I-F-1,R,!0):F<9?E.set(8,15-F-1+1,R,!0):E.set(8,15-F-1,R,!0);E.set(I-8,8,1,!0)}function k(E,$){const z=E.size;let I=-1,se=z-1,F=7,R=0;for(let L=z-1;L>0;L-=2)for(L===6&&L--;;){for(let N=0;N<2;N++)if(!E.isReserved(se,L-N)){let Z=!1;R<$.length&&(Z=($[R]>>>F&1)===1),E.set(se,L-N,Z),F--,F===-1&&(R++,F=7)}if(se+=I,se<0||z<=se){se-=I,I=-I;break}}}function C(E,$,z){const I=new t;z.forEach(function(N){I.put(N.mode.bit,4),I.put(N.getLength(),m.getCharCountIndicator(N.mode,E)),N.write(I)});const se=i.getSymbolTotalCodewords(E),F=l.getTotalCodewordsCount(E,$),R=(se-F)*8;for(I.getLengthInBits()+4<=R&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const L=(R-I.getLengthInBits())/8;for(let N=0;N<L;N++)I.put(N%2?17:236,8);return A(I,E,$)}function A(E,$,z){const I=i.getSymbolTotalCodewords($),se=l.getTotalCodewordsCount($,z),F=I-se,R=l.getBlocksCount($,z),L=I%R,N=R-L,Z=Math.floor(I/R),Q=Math.floor(F/R),X=Q+1,W=Z-Q,U=new c(W);let q=0;const D=new Array(R),G=new Array(R);let ie=0;const ce=new Uint8Array(E.buffer);for(let ye=0;ye<R;ye++){const mt=ye<N?Q:X;D[ye]=ce.slice(q,q+mt),G[ye]=U.encode(D[ye]),q+=mt,ie=Math.max(ie,mt)}const he=new Uint8Array(I);let de=0,ge,Ae;for(ge=0;ge<ie;ge++)for(Ae=0;Ae<R;Ae++)ge<D[Ae].length&&(he[de++]=D[Ae][ge]);for(ge=0;ge<W;ge++)for(Ae=0;Ae<R;Ae++)he[de++]=G[Ae][ge];return he}function P(E,$,z,I){let se;if(Array.isArray(E))se=g.fromArray(E);else if(typeof E=="string"){let Z=$;if(!Z){const Q=g.rawSplit(E);Z=u.getBestVersionForData(Q,z)}se=g.fromString(E,Z||40)}else throw new Error("Invalid data");const F=u.getBestVersionForData(se,z);if(!F)throw new Error("The amount of data is too big to be stored in a QR Code");if(!$)$=F;else if($<F)throw new Error(`
|
|
82
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
83
|
+
Minimum version required to store current data is: `+F+`.
|
|
84
|
+
`);const R=C($,z,se),L=i.getSymbolSize($),N=new s(L);return _(N,$),y(N),b(N,$),w(N,z,0),$>=7&&x(N,$),k(N,R),isNaN(I)&&(I=o.getBestMask(N,w.bind(null,N,z))),o.applyMask(I,N),w(N,z,I),{modules:N,version:$,errorCorrectionLevel:z,maskPattern:I,segments:se}}return iv.create=function($,z){if(typeof $>"u"||$==="")throw new Error("No input text");let I=e.M,se,F;return typeof z<"u"&&(I=e.from(z.errorCorrectionLevel,e.M),se=u.from(z.version),F=o.from(z.maskPattern),z.toSJISFunc&&i.setToSJISFunction(z.toSJISFunc)),P($,se,I,F)},iv}var bv={},Sv={},XM;function $B(){return XM||(XM=1,(function(i){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let s=t.slice().replace("#","").split("");if(s.length<3||s.length===5||s.length>8)throw new Error("Invalid hex color: "+t);(s.length===3||s.length===4)&&(s=Array.prototype.concat.apply([],s.map(function(n){return[n,n]}))),s.length===6&&s.push("F","F");const r=parseInt(s.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+s.slice(0,6).join("")}}i.getOptions=function(s){s||(s={}),s.color||(s.color={});const r=typeof s.margin>"u"||s.margin===null||s.margin<0?4:s.margin,n=s.width&&s.width>=21?s.width:void 0,o=s.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:e(s.color.dark||"#000000ff"),light:e(s.color.light||"#ffffffff")},type:s.type,rendererOpts:s.rendererOpts||{}}},i.getScale=function(s,r){return r.width&&r.width>=s+r.margin*2?r.width/(s+r.margin*2):r.scale},i.getImageWidth=function(s,r){const n=i.getScale(s,r);return Math.floor((s+r.margin*2)*n)},i.qrToImageData=function(s,r,n){const o=r.modules.size,l=r.modules.data,c=i.getScale(o,n),u=Math.floor((o+n.margin*2)*c),d=n.margin*c,m=[n.color.light,n.color.dark];for(let g=0;g<u;g++)for(let _=0;_<u;_++){let y=(g*u+_)*4,b=n.color.light;if(g>=d&&_>=d&&g<u-d&&_<u-d){const x=Math.floor((g-d)/c),w=Math.floor((_-d)/c);b=m[l[x*o+w]?1:0]}s[y++]=b.r,s[y++]=b.g,s[y++]=b.b,s[y]=b.a}}})(Sv)),Sv}var VM;function HK(){return VM||(VM=1,(function(i){const e=$B();function t(r,n,o){r.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=o,n.width=o,n.style.height=o+"px",n.style.width=o+"px"}function s(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}i.render=function(n,o,l){let c=l,u=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(u=s()),c=e.getOptions(c);const d=e.getImageWidth(n.modules.size,c),m=u.getContext("2d"),g=m.createImageData(d,d);return e.qrToImageData(g.data,n,c),t(m,u,d),m.putImageData(g,0,0),u},i.renderToDataURL=function(n,o,l){let c=l;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const u=i.render(n,o,c),d=c.type||"image/png",m=c.rendererOpts||{};return u.toDataURL(d,m.quality)}})(bv)),bv}var xv={},ZM;function FK(){if(ZM)return xv;ZM=1;const i=$B();function e(r,n){const o=r.a/255,l=n+'="'+r.hex+'"';return o<1?l+" "+n+'-opacity="'+o.toFixed(2).slice(1)+'"':l}function t(r,n,o){let l=r+n;return typeof o<"u"&&(l+=" "+o),l}function s(r,n,o){let l="",c=0,u=!1,d=0;for(let m=0;m<r.length;m++){const g=Math.floor(m%n),_=Math.floor(m/n);!g&&!u&&(u=!0),r[m]?(d++,m>0&&g>0&&r[m-1]||(l+=u?t("M",g+o,.5+_+o):t("m",c,0),c=0,u=!1),g+1<n&&r[m+1]||(l+=t("h",d),d=0)):c++}return l}return xv.render=function(n,o,l){const c=i.getOptions(o),u=n.modules.size,d=n.modules.data,m=u+c.margin*2,g=c.color.light.a?"<path "+e(c.color.light,"fill")+' d="M0 0h'+m+"v"+m+'H0z"/>':"",_="<path "+e(c.color.dark,"stroke")+' d="'+s(d,u,c.margin)+'"/>',y='viewBox="0 0 '+m+" "+m+'"',x='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+y+' shape-rendering="crispEdges">'+g+_+`</svg>
|
|
85
|
+
`;return typeof l=="function"&&l(null,x),x},xv}var jM;function GK(){if(jM)return Nl;jM=1;const i=PK(),e=YK(),t=HK(),s=FK();function r(n,o,l,c,u){const d=[].slice.call(arguments,1),m=d.length,g=typeof d[m-1]=="function";if(!g&&!i())throw new Error("Callback required as last argument");if(g){if(m<2)throw new Error("Too few arguments provided");m===2?(u=l,l=o,o=c=void 0):m===3&&(o.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=o,o=void 0))}else{if(m<1)throw new Error("Too few arguments provided");return m===1?(l=o,o=c=void 0):m===2&&!o.getContext&&(c=l,l=o,o=void 0),new Promise(function(_,y){try{const b=e.create(l,c);_(n(b,o,c))}catch(b){y(b)}})}try{const _=e.create(l,c);u(null,n(_,o,c))}catch(_){u(_)}}return Nl.create=e.create,Nl.toCanvas=r.bind(null,t.render),Nl.toDataURL=r.bind(null,t.renderToDataURL),Nl.toString=r.bind(null,function(n,o,l){return s.render(n,l)}),Nl}var KK=GK();const JK=Cz(KK);function eJ(){const[i,e]=Y.useState(null),[t,s]=Y.useState(!1),[r,n]=Y.useState(null);return Y.useEffect(()=>{fetch("/api/server-info").then(o=>o.json()).then(o=>e(o)).catch(()=>{})},[]),Y.useEffect(()=>{i!=null&&i.networkUrl&&JK.toDataURL(i.networkUrl,{width:192,margin:2}).then(n).catch(()=>{})},[i==null?void 0:i.networkUrl]),!(i!=null&&i.networkEnabled)||!i.networkUrl?null:M.jsxs("div",{className:"relative border-t border-border px-1 py-2",children:[t&&M.jsxs("div",{className:"absolute bottom-full left-2 right-2 mb-2 rounded-lg border border-border bg-card p-3 shadow-xl",children:[M.jsx("p",{className:"mb-0.5 font-mono text-[9px] uppercase tracking-widest text-muted-foreground",children:"Local Network"}),M.jsx("p",{className:"mb-3 font-mono text-[11px] break-all text-foreground",children:i.networkUrl}),r&&M.jsx("img",{src:r,alt:"QR code for local network access",width:192,height:192,className:"w-full rounded-sm"}),M.jsx("p",{className:"mt-2 font-mono text-[9px] text-muted-foreground",children:"Scan to open on another device"})]}),M.jsxs("button",{type:"button",onClick:()=>s(o=>!o),title:t?"Close QR code":"Open dashboard on another device",className:"flex w-full items-center gap-2.5 rounded-sm px-3 py-2 text-left text-sm transition-colors hover:bg-card-hover text-muted-foreground",children:[M.jsx(tJ,{}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Share"})]})]})}function tJ(){return M.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),M.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),M.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),M.jsx("rect",{x:"14",y:"14",width:"3",height:"3"}),M.jsx("line",{x1:"14",y1:"20",x2:"20",y2:"20"}),M.jsx("line",{x1:"20",y1:"14",x2:"20",y2:"17"})]})}function iJ(i){switch(i){case"complete":return"bg-success";case"partial":return"bg-accent";case"planned":case"researched":case"discussed":return"bg-muted-foreground";default:return"bg-muted"}}function sJ({activeView:i,activePhaseId:e,onNavigate:t}){const{roadmap:s,state:r,todos:n}=fb(),{connected:o}=ff(),l=((s==null?void 0:s.phases)??[]).map(m=>({number:m.number,name:m.name,goal:m.goal??"",dependsOn:m.depends_on?[m.depends_on]:[],planCount:m.plan_count,summaryCount:m.summary_count,diskStatus:m.disk_status,roadmapComplete:m.roadmap_complete,hasContext:m.has_context,hasResearch:m.has_research})),c=(s==null?void 0:s.current_phase)??null,u=(r==null?void 0:r.blockers.filter(m=>!m.includes("RESOLVED")).length)??0,d=(n==null?void 0:n.pending.length)??0;return M.jsxs("aside",{className:"flex h-full w-64 shrink-0 flex-col border-r border-border bg-card",children:[M.jsx("div",{className:"border-b border-border px-4 py-4",children:M.jsxs("button",{type:"button",onClick:()=>t("overview"),className:"flex flex-col gap-0.5 text-left",children:[M.jsx("span",{className:"font-mono text-lg font-bold tracking-tight text-foreground",children:"MAXSIM"}),M.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:"Dashboard"})]})}),M.jsxs("div",{className:"flex-1 overflow-y-auto py-2",children:[M.jsx("div",{className:"px-3 pb-1",children:M.jsx("span",{className:"font-mono text-[10px] uppercase tracking-widest text-muted-foreground",children:"Phases"})}),M.jsx("nav",{className:"flex flex-col gap-0.5 px-1",children:l.map(m=>{const g=i==="phase"&&e===m.number,_=m.number===c;return M.jsxs("button",{type:"button",onClick:()=>t("phase",m.number),className:dt("flex w-full items-center gap-2.5 rounded-sm px-3 py-1.5 text-left text-sm transition-colors",g?"border-l-2 border-l-accent bg-card-hover text-foreground":"border-l-2 border-l-transparent hover:bg-card-hover",_&&!g&&"border-l-accent-glow"),children:[M.jsx("span",{className:dt("inline-block h-2 w-2 shrink-0 rounded-full",iJ(m.diskStatus))}),M.jsx("span",{className:dt("font-mono text-xs font-semibold",_||g?"text-accent":"text-muted-foreground"),children:m.number}),M.jsx("span",{className:"truncate text-xs text-foreground",children:m.name})]},m.number)})})]}),M.jsxs("div",{className:"border-t border-border px-1 py-2",children:[M.jsxs("button",{type:"button",onClick:()=>t("todos"),className:dt("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="todos"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Todos"}),d>0&&M.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-warning/20 px-1 font-mono text-[10px] font-bold text-warning",children:d})]}),M.jsxs("button",{type:"button",onClick:()=>t("blockers"),className:dt("flex w-full items-center justify-between rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="blockers"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Blockers"}),u>0&&M.jsx("span",{className:"inline-flex h-5 min-w-5 items-center justify-center rounded-sm bg-danger/20 px-1 font-mono text-[10px] font-bold text-danger shadow-[0_0_6px_rgba(239,68,68,0.3)]",children:u})]})]}),M.jsx("div",{className:"border-t border-border px-1 py-2",children:M.jsxs("button",{type:"button",onClick:()=>t("terminal"),className:dt("flex w-full items-center gap-2.5 rounded-sm px-3 py-2 text-left text-sm transition-colors",i==="terminal"?"bg-card-hover text-foreground":"hover:bg-card-hover text-muted-foreground"),children:[M.jsx("span",{className:"font-mono text-xs font-bold",children:">_"}),M.jsx("span",{className:"font-mono text-xs uppercase tracking-wide",children:"Terminal"})]})}),M.jsx(eJ,{}),M.jsx("div",{className:"border-t border-border px-4 py-3",children:M.jsxs("div",{className:"flex items-center gap-2",children:[M.jsx("span",{className:dt("inline-block h-2 w-2 rounded-full",o?"bg-success":"bg-danger")}),M.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:o?"Connected":"Disconnected"})]})})]})}/**
|
|
79
86
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
80
87
|
* @license MIT
|
|
81
88
|
*
|
|
@@ -86,22 +93,22 @@ Error generating stack: `+p.message+`
|
|
|
86
93
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
87
94
|
* http://bellard.org/jslinux/
|
|
88
95
|
* Copyright (c) 2011 Fabrice Bellard
|
|
89
|
-
*/var
|
|
96
|
+
*/var BB=Object.defineProperty,rJ=Object.getOwnPropertyDescriptor,nJ=(i,e)=>{for(var t in e)BB(i,t,{get:e[t],enumerable:!0})},Lt=(i,e,t,s)=>{for(var r=s>1?void 0:s?rJ(e,t):e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=(s?o(e,t,r):o(r))||r);return s&&r&&BB(e,t,r),r},Oe=(i,e)=>(t,s)=>e(t,s,i),IM="Terminal input",Sy={get:()=>IM,set:i=>IM=i},qM="Too much output to announce, navigate to rows manually to read",xy={get:()=>qM,set:i=>qM=i};function oJ(i){return i.replace(/\r?\n/g,"\r")}function aJ(i,e){return e?"\x1B[200~"+i+"\x1B[201~":i}function lJ(i,e){i.clipboardData&&i.clipboardData.setData("text/plain",e.selectionText),i.preventDefault()}function hJ(i,e,t,s){if(i.stopPropagation(),i.clipboardData){let r=i.clipboardData.getData("text/plain");DB(r,e,t,s)}}function DB(i,e,t,s){i=oJ(i),i=aJ(i,t.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),t.triggerDataEvent(i,!0),e.value=""}function zB(i,e,t){let s=t.getBoundingClientRect(),r=i.clientX-s.left-10,n=i.clientY-s.top-10;e.style.width="20px",e.style.height="20px",e.style.left=`${r}px`,e.style.top=`${n}px`,e.style.zIndex="1000",e.focus()}function WM(i,e,t,s,r){zB(i,e,t),r&&s.rightClickSelect(i),e.value=s.selectionText,e.select()}function $o(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}function Sg(i,e=0,t=i.length){let s="";for(let r=e;r<t;++r){let n=i[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var cJ=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let s=e.length;if(!s)return 0;let r=0,n=0;if(this._interim){let o=e.charCodeAt(n++);56320<=o&&o<=57343?t[r++]=(this._interim-55296)*1024+o-56320+65536:(t[r++]=this._interim,t[r++]=o),this._interim=0}for(let o=n;o<s;++o){let l=e.charCodeAt(o);if(55296<=l&&l<=56319){if(++o>=s)return this._interim=l,r;let c=e.charCodeAt(o);56320<=c&&c<=57343?t[r++]=(l-55296)*1024+c-56320+65536:(t[r++]=l,t[r++]=c);continue}l!==65279&&(t[r++]=l)}return r}},uJ=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let s=e.length;if(!s)return 0;let r=0,n,o,l,c,u=0,d=0;if(this.interim[0]){let _=!1,y=this.interim[0];y&=(y&224)===192?31:(y&240)===224?15:7;let b=0,x;for(;(x=this.interim[++b]&63)&&b<4;)y<<=6,y|=x;let w=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,k=w-b;for(;d<k;){if(d>=s)return 0;if(x=e[d++],(x&192)!==128){d--,_=!0;break}else this.interim[b++]=x,y<<=6,y|=x&63}_||(w===2?y<128?d--:t[r++]=y:w===3?y<2048||y>=55296&&y<=57343||y===65279||(t[r++]=y):y<65536||y>1114111||(t[r++]=y)),this.interim.fill(0)}let m=s-4,g=d;for(;g<s;){for(;g<m&&!((n=e[g])&128)&&!((o=e[g+1])&128)&&!((l=e[g+2])&128)&&!((c=e[g+3])&128);)t[r++]=n,t[r++]=o,t[r++]=l,t[r++]=c,g+=4;if(n=e[g++],n<128)t[r++]=n;else if((n&224)===192){if(g>=s)return this.interim[0]=n,r;if(o=e[g++],(o&192)!==128){g--;continue}if(u=(n&31)<<6|o&63,u<128){g--;continue}t[r++]=u}else if((n&240)===224){if(g>=s)return this.interim[0]=n,r;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[g++],(l&192)!==128){g--;continue}if(u=(n&15)<<12|(o&63)<<6|l&63,u<2048||u>=55296&&u<=57343||u===65279)continue;t[r++]=u}else if((n&248)===240){if(g>=s)return this.interim[0]=n,r;if(o=e[g++],(o&192)!==128){g--;continue}if(g>=s)return this.interim[0]=n,this.interim[1]=o,r;if(l=e[g++],(l&192)!==128){g--;continue}if(g>=s)return this.interim[0]=n,this.interim[1]=o,this.interim[2]=l,r;if(c=e[g++],(c&192)!==128){g--;continue}if(u=(n&7)<<18|(o&63)<<12|(l&63)<<6|c&63,u<65536||u>1114111)continue;t[r++]=u}}return r}},NB="",No=" ",Af=class XB{constructor(){this.fg=0,this.bg=0,this.extended=new Gm}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new XB;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},Gm=class VB{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new VB(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},lr=class ZB extends Af{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new Gm,this.combinedData=""}static fromCharData(e){let t=new ZB;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?$o(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},UM="di$target",wy="di$dependencies",wv=new Map;function fJ(i){return i[wy]||[]}function xi(i){if(wv.has(i))return wv.get(i);let e=function(t,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");dJ(e,t,r)};return e._id=i,wv.set(i,e),e}function dJ(i,e,t){e[UM]===e?e[wy].push({id:i,index:t}):(e[wy]=[{id:i,index:t}],e[UM]=e)}var is=xi("BufferService"),jB=xi("CoreMouseService"),Ja=xi("CoreService"),pJ=xi("CharsetService"),qS=xi("InstantiationService"),IB=xi("LogService"),ss=xi("OptionsService"),qB=xi("OscLinkService"),mJ=xi("UnicodeService"),Mf=xi("DecorationService"),Cy=class{constructor(e,t,s){this._bufferService=e,this._optionsService=t,this._oscLinkService=s}provideLinks(e,t){var m;let s=this._bufferService.buffer.lines.get(e-1);if(!s){t(void 0);return}let r=[],n=this._optionsService.rawOptions.linkHandler,o=new lr,l=s.getTrimmedLength(),c=-1,u=-1,d=!1;for(let g=0;g<l;g++)if(!(u===-1&&!s.hasContent(g))){if(s.loadCell(g,o),o.hasExtendedAttrs()&&o.extended.urlId)if(u===-1){u=g,c=o.extended.urlId;continue}else d=o.extended.urlId!==c;else u!==-1&&(d=!0);if(d||u!==-1&&g===l-1){let _=(m=this._oscLinkService.getLinkData(c))==null?void 0:m.uri;if(_){let y={start:{x:u+1,y:e},end:{x:g+(!d&&g===l-1?1:0),y:e}},b=!1;if(!(n!=null&&n.allowNonHttpProtocols))try{let x=new URL(_);["http:","https:"].includes(x.protocol)||(b=!0)}catch{b=!0}b||r.push({text:_,range:y,activate:(x,w)=>n?n.activate(x,w,y):gJ(x,w),hover:(x,w)=>{var k;return(k=n==null?void 0:n.hover)==null?void 0:k.call(n,x,w,y)},leave:(x,w)=>{var k;return(k=n==null?void 0:n.leave)==null?void 0:k.call(n,x,w,y)}})}d=!1,o.hasExtendedAttrs()&&o.extended.urlId?(u=g,c=o.extended.urlId):(u=-1,c=-1)}}t(r)}};Cy=Lt([Oe(0,is),Oe(1,ss),Oe(2,qB)],Cy);function gJ(i,e){if(confirm(`Do you want to navigate to ${e}?
|
|
90
97
|
|
|
91
|
-
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var xg=xi("CharSizeService"),Un=xi("CoreBrowserService"),
|
|
98
|
+
WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}}var xg=xi("CharSizeService"),Un=xi("CoreBrowserService"),WS=xi("MouseService"),Yn=xi("RenderService"),OJ=xi("SelectionService"),WB=xi("CharacterJoinerService"),Dh=xi("ThemeService"),UB=xi("LinkProviderService"),_J=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?YM.isErrorNoTelemetry(e)?new YM(e.message+`
|
|
92
99
|
|
|
93
100
|
`+e.stack):new Error(e.message+`
|
|
94
101
|
|
|
95
|
-
`+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)}},YK=new UK;function em(i){HK(i)||YK.onUnexpectedError(i)}var ky="Canceled";function HK(i){return i instanceof FK?!0:i instanceof Error&&i.name===ky&&i.message===ky}var FK=class extends Error{constructor(){super(ky),this.name=this.message}};function GK(i){return new Error(`Illegal argument: ${i}`)}var yM=class Ty extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Ty)return e;let t=new Ty;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Ay=class IB extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,IB.prototype)}};function Qs(i,e=0){return i[i.length-(1+e)]}var KK;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(KK||(KK={}));function JK(i,e){let t=this,s=!1,r;return function(){return s||(s=!0,e||(r=i.apply(t,arguments))),r}}var qB;(i=>{function e(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(A){yield A}i.single=r;function n(A){return e(A)?A:r(A)}i.wrap=n;function o(A){return A||t}i.from=o;function*l(A){for(let P=A.length-1;P>=0;P--)yield A[P]}i.reverse=l;function c(A){return!A||A[Symbol.iterator]().next().done===!0}i.isEmpty=c;function u(A){return A[Symbol.iterator]().next().value}i.first=u;function d(A,P){let E=0;for(let $ of A)if(P($,E++))return!0;return!1}i.some=d;function m(A,P){for(let E of A)if(P(E))return E}i.find=m;function*g(A,P){for(let E of A)P(E)&&(yield E)}i.filter=g;function*_(A,P){let E=0;for(let $ of A)yield P($,E++)}i.map=_;function*y(A,P){let E=0;for(let $ of A)yield*P($,E++)}i.flatMap=y;function*b(...A){for(let P of A)yield*P}i.concat=b;function x(A,P,E){let $=E;for(let z of A)$=P($,z);return $}i.reduce=x;function*w(A,P,E=A.length){for(P<0&&(P+=A.length),E<0?E+=A.length:E>A.length&&(E=A.length);P<E;P++)yield A[P]}i.slice=w;function k(A,P=Number.POSITIVE_INFINITY){let E=[];if(P===0)return[E,A];let $=A[Symbol.iterator]();for(let z=0;z<P;z++){let I=$.next();if(I.done)return[E,i.empty()];E.push(I.value)}return[E,{[Symbol.iterator](){return $}}]}i.consume=k;async function C(A){let P=[];for await(let E of A)P.push(E);return Promise.resolve(P)}i.asyncToArray=C})(qB||(qB={}));function Ua(i){if(qB.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function eJ(...i){return xt(()=>Ua(i))}function xt(i){return{dispose:JK(()=>{i()})}}var WB=class UB{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ua(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?UB.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};WB.DISABLE_DISPOSED_WARNING=!1;var Vo=WB,Xe=class{constructor(){this._store=new Vo,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)}};Xe.None=Object.freeze({dispose(){}});var Th=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}},zn=typeof window=="object"?window:globalThis,My=class Ey{constructor(e){this.element=e,this.next=Ey.Undefined,this.prev=Ey.Undefined}};My.Undefined=new My(void 0);var wt=My,bM=class{constructor(){this._first=wt.Undefined,this._last=wt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===wt.Undefined}clear(){let e=this._first;for(;e!==wt.Undefined;){let t=e.next;e.prev=wt.Undefined,e.next=wt.Undefined,e=t}this._first=wt.Undefined,this._last=wt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new wt(e);if(this._first===wt.Undefined)this._first=s,this._last=s;else if(t){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==wt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==wt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==wt.Undefined&&e.next!==wt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===wt.Undefined&&e.next===wt.Undefined?(this._first=wt.Undefined,this._last=wt.Undefined):e.next===wt.Undefined?(this._last=this._last.prev,this._last.next=wt.Undefined):e.prev===wt.Undefined&&(this._first=this._first.next,this._first.prev=wt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==wt.Undefined;)yield e.element,e=e.next}},tJ=globalThis.performance&&typeof globalThis.performance.now=="function",iJ=class YB{static create(e){return new YB(e)}constructor(e){this._now=tJ&&e===!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}},Di;(i=>{i.None=()=>Xe.None;function e(R,L){return m(R,()=>{},0,void 0,!0,void 0,L)}i.defer=e;function t(R){return(L,N=null,Z)=>{let Q=!1,X;return X=R(W=>{if(!Q)return X?X.dispose():Q=!0,L.call(N,W)},null,Z),Q&&X.dispose(),X}}i.once=t;function s(R,L,N){return u((Z,Q=null,X)=>R(W=>Z.call(Q,L(W)),null,X),N)}i.map=s;function r(R,L,N){return u((Z,Q=null,X)=>R(W=>{L(W),Z.call(Q,W)},null,X),N)}i.forEach=r;function n(R,L,N){return u((Z,Q=null,X)=>R(W=>L(W)&&Z.call(Q,W),null,X),N)}i.filter=n;function o(R){return R}i.signal=o;function l(...R){return(L,N=null,Z)=>{let Q=eJ(...R.map(X=>X(W=>L.call(N,W))));return d(Q,Z)}}i.any=l;function c(R,L,N,Z){let Q=N;return s(R,X=>(Q=L(Q,X),Q),Z)}i.reduce=c;function u(R,L){let N,Z={onWillAddFirstListener(){N=R(Q.fire,Q)},onDidRemoveLastListener(){N==null||N.dispose()}},Q=new fe(Z);return L==null||L.add(Q),Q.event}function d(R,L){return L instanceof Array?L.push(R):L&&L.add(R),R}function m(R,L,N=100,Z=!1,Q=!1,X,W){let U,q,D,G=0,ie,ce={leakWarningThreshold:X,onWillAddFirstListener(){U=R(de=>{G++,q=L(q,de),Z&&!D&&(he.fire(q),q=void 0),ie=()=>{let ge=q;q=void 0,D=void 0,(!Z||G>1)&&he.fire(ge),G=0},typeof N=="number"?(clearTimeout(D),D=setTimeout(ie,N)):D===void 0&&(D=0,queueMicrotask(ie))})},onWillRemoveListener(){Q&&G>0&&(ie==null||ie())},onDidRemoveLastListener(){ie=void 0,U.dispose()}},he=new fe(ce);return W==null||W.add(he),he.event}i.debounce=m;function g(R,L=0,N){return i.debounce(R,(Z,Q)=>Z?(Z.push(Q),Z):[Q],L,void 0,!0,void 0,N)}i.accumulate=g;function _(R,L=(Z,Q)=>Z===Q,N){let Z=!0,Q;return n(R,X=>{let W=Z||!L(X,Q);return Z=!1,Q=X,W},N)}i.latch=_;function y(R,L,N){return[i.filter(R,L,N),i.filter(R,Z=>!L(Z),N)]}i.split=y;function b(R,L=!1,N=[],Z){let Q=N.slice(),X=R(q=>{Q?Q.push(q):U.fire(q)});Z&&Z.add(X);let W=()=>{Q==null||Q.forEach(q=>U.fire(q)),Q=null},U=new fe({onWillAddFirstListener(){X||(X=R(q=>U.fire(q)),Z&&Z.add(X))},onDidAddFirstListener(){Q&&(L?setTimeout(W):W())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return Z&&Z.add(U),U.event}i.buffer=b;function x(R,L){return(N,Z,Q)=>{let X=L(new k);return R(function(W){let U=X.evaluate(W);U!==w&&N.call(Z,U)},void 0,Q)}}i.chain=x;let w=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(N=>(L(N),N)),this}filter(L){return this.steps.push(N=>L(N)?N:w),this}reduce(L,N){let Z=N;return this.steps.push(Q=>(Z=L(Z,Q),Z)),this}latch(L=(N,Z)=>N===Z){let N=!0,Z;return this.steps.push(Q=>{let X=N||!L(Q,Z);return N=!1,Z=Q,X?Q:w}),this}evaluate(L){for(let N of this.steps)if(L=N(L),L===w)break;return L}}function C(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.on(L,Z),X=()=>R.removeListener(L,Z),W=new fe({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromNodeEventEmitter=C;function A(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.addEventListener(L,Z),X=()=>R.removeEventListener(L,Z),W=new fe({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromDOMEventEmitter=A;function P(R){return new Promise(L=>t(R)(L))}i.toPromise=P;function E(R){let L=new fe;return R.then(N=>{L.fire(N)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}i.fromPromise=E;function $(R,L){return R(N=>L.fire(N))}i.forward=$;function z(R,L,N){return L(N),R(Z=>L(Z))}i.runAndSubscribe=z;class I{constructor(L,N){this._observable=L,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new fe(Z),N&&N.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,N){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(R,L){return new I(R,L).emitter.event}i.fromObservable=se;function F(R){return(L,N,Z)=>{let Q=0,X=!1,W={beginUpdate(){Q++},endUpdate(){Q--,Q===0&&(R.reportChanges(),X&&(X=!1,L.call(N)))},handlePossibleChange(){},handleChange(){X=!0}};R.addObserver(W),R.reportChanges();let U={dispose(){R.removeObserver(W)}};return Z instanceof Vo?Z.add(U):Array.isArray(Z)&&Z.push(U),U}}i.fromObservableLight=F})(Di||(Di={}));var Py=class Qy{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Qy._idPool++}`,Qy.all.add(this)}start(e){this._stopWatch=new iJ,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Py.all=new Set,Py._idPool=0;var sJ=Py,rJ=-1,HB=class FB{constructor(e,t,s=(FB._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){let s=this.threshold;if(s<=0||t<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let c=new aJ(l,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t<r)&&(e=[s,r],t=r);return e}};HB._idPool=1;var nJ=HB,oJ=class GB{constructor(e){this.value=e}static create(){let e=new Error;return new GB(e.stack??"")}print(){console.warn(this.value.split(`
|
|
102
|
+
`+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)}},vJ=new _J;function em(i){yJ(i)||vJ.onUnexpectedError(i)}var ky="Canceled";function yJ(i){return i instanceof bJ?!0:i instanceof Error&&i.name===ky&&i.message===ky}var bJ=class extends Error{constructor(){super(ky),this.name=this.message}};function SJ(i){return new Error(`Illegal argument: ${i}`)}var YM=class Ty extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Ty)return e;let t=new Ty;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Ay=class YB extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,YB.prototype)}};function Qs(i,e=0){return i[i.length-(1+e)]}var xJ;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(xJ||(xJ={}));function wJ(i,e){let t=this,s=!1,r;return function(){return s||(s=!0,e||(r=i.apply(t,arguments))),r}}var HB;(i=>{function e(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(A){yield A}i.single=r;function n(A){return e(A)?A:r(A)}i.wrap=n;function o(A){return A||t}i.from=o;function*l(A){for(let P=A.length-1;P>=0;P--)yield A[P]}i.reverse=l;function c(A){return!A||A[Symbol.iterator]().next().done===!0}i.isEmpty=c;function u(A){return A[Symbol.iterator]().next().value}i.first=u;function d(A,P){let E=0;for(let $ of A)if(P($,E++))return!0;return!1}i.some=d;function m(A,P){for(let E of A)if(P(E))return E}i.find=m;function*g(A,P){for(let E of A)P(E)&&(yield E)}i.filter=g;function*_(A,P){let E=0;for(let $ of A)yield P($,E++)}i.map=_;function*y(A,P){let E=0;for(let $ of A)yield*P($,E++)}i.flatMap=y;function*b(...A){for(let P of A)yield*P}i.concat=b;function x(A,P,E){let $=E;for(let z of A)$=P($,z);return $}i.reduce=x;function*w(A,P,E=A.length){for(P<0&&(P+=A.length),E<0?E+=A.length:E>A.length&&(E=A.length);P<E;P++)yield A[P]}i.slice=w;function k(A,P=Number.POSITIVE_INFINITY){let E=[];if(P===0)return[E,A];let $=A[Symbol.iterator]();for(let z=0;z<P;z++){let I=$.next();if(I.done)return[E,i.empty()];E.push(I.value)}return[E,{[Symbol.iterator](){return $}}]}i.consume=k;async function C(A){let P=[];for await(let E of A)P.push(E);return Promise.resolve(P)}i.asyncToArray=C})(HB||(HB={}));function Ua(i){if(HB.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function CJ(...i){return xt(()=>Ua(i))}function xt(i){return{dispose:wJ(()=>{i()})}}var FB=class GB{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{Ua(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?GB.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};FB.DISABLE_DISPOSED_WARNING=!1;var Vo=FB,Xe=class{constructor(){this._store=new Vo,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)}};Xe.None=Object.freeze({dispose(){}});var Th=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}},zn=typeof window=="object"?window:globalThis,My=class Ey{constructor(e){this.element=e,this.next=Ey.Undefined,this.prev=Ey.Undefined}};My.Undefined=new My(void 0);var wt=My,HM=class{constructor(){this._first=wt.Undefined,this._last=wt.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===wt.Undefined}clear(){let e=this._first;for(;e!==wt.Undefined;){let t=e.next;e.prev=wt.Undefined,e.next=wt.Undefined,e=t}this._first=wt.Undefined,this._last=wt.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let s=new wt(e);if(this._first===wt.Undefined)this._first=s,this._last=s;else if(t){let n=this._last;this._last=s,s.prev=n,n.next=s}else{let n=this._first;this._first=s,s.next=n,n.prev=s}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(s))}}shift(){if(this._first!==wt.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==wt.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==wt.Undefined&&e.next!==wt.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===wt.Undefined&&e.next===wt.Undefined?(this._first=wt.Undefined,this._last=wt.Undefined):e.next===wt.Undefined?(this._last=this._last.prev,this._last.next=wt.Undefined):e.prev===wt.Undefined&&(this._first=this._first.next,this._first.prev=wt.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==wt.Undefined;)yield e.element,e=e.next}},kJ=globalThis.performance&&typeof globalThis.performance.now=="function",TJ=class KB{static create(e){return new KB(e)}constructor(e){this._now=kJ&&e===!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}},Di;(i=>{i.None=()=>Xe.None;function e(R,L){return m(R,()=>{},0,void 0,!0,void 0,L)}i.defer=e;function t(R){return(L,N=null,Z)=>{let Q=!1,X;return X=R(W=>{if(!Q)return X?X.dispose():Q=!0,L.call(N,W)},null,Z),Q&&X.dispose(),X}}i.once=t;function s(R,L,N){return u((Z,Q=null,X)=>R(W=>Z.call(Q,L(W)),null,X),N)}i.map=s;function r(R,L,N){return u((Z,Q=null,X)=>R(W=>{L(W),Z.call(Q,W)},null,X),N)}i.forEach=r;function n(R,L,N){return u((Z,Q=null,X)=>R(W=>L(W)&&Z.call(Q,W),null,X),N)}i.filter=n;function o(R){return R}i.signal=o;function l(...R){return(L,N=null,Z)=>{let Q=CJ(...R.map(X=>X(W=>L.call(N,W))));return d(Q,Z)}}i.any=l;function c(R,L,N,Z){let Q=N;return s(R,X=>(Q=L(Q,X),Q),Z)}i.reduce=c;function u(R,L){let N,Z={onWillAddFirstListener(){N=R(Q.fire,Q)},onDidRemoveLastListener(){N==null||N.dispose()}},Q=new fe(Z);return L==null||L.add(Q),Q.event}function d(R,L){return L instanceof Array?L.push(R):L&&L.add(R),R}function m(R,L,N=100,Z=!1,Q=!1,X,W){let U,q,D,G=0,ie,ce={leakWarningThreshold:X,onWillAddFirstListener(){U=R(de=>{G++,q=L(q,de),Z&&!D&&(he.fire(q),q=void 0),ie=()=>{let ge=q;q=void 0,D=void 0,(!Z||G>1)&&he.fire(ge),G=0},typeof N=="number"?(clearTimeout(D),D=setTimeout(ie,N)):D===void 0&&(D=0,queueMicrotask(ie))})},onWillRemoveListener(){Q&&G>0&&(ie==null||ie())},onDidRemoveLastListener(){ie=void 0,U.dispose()}},he=new fe(ce);return W==null||W.add(he),he.event}i.debounce=m;function g(R,L=0,N){return i.debounce(R,(Z,Q)=>Z?(Z.push(Q),Z):[Q],L,void 0,!0,void 0,N)}i.accumulate=g;function _(R,L=(Z,Q)=>Z===Q,N){let Z=!0,Q;return n(R,X=>{let W=Z||!L(X,Q);return Z=!1,Q=X,W},N)}i.latch=_;function y(R,L,N){return[i.filter(R,L,N),i.filter(R,Z=>!L(Z),N)]}i.split=y;function b(R,L=!1,N=[],Z){let Q=N.slice(),X=R(q=>{Q?Q.push(q):U.fire(q)});Z&&Z.add(X);let W=()=>{Q==null||Q.forEach(q=>U.fire(q)),Q=null},U=new fe({onWillAddFirstListener(){X||(X=R(q=>U.fire(q)),Z&&Z.add(X))},onDidAddFirstListener(){Q&&(L?setTimeout(W):W())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return Z&&Z.add(U),U.event}i.buffer=b;function x(R,L){return(N,Z,Q)=>{let X=L(new k);return R(function(W){let U=X.evaluate(W);U!==w&&N.call(Z,U)},void 0,Q)}}i.chain=x;let w=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(N=>(L(N),N)),this}filter(L){return this.steps.push(N=>L(N)?N:w),this}reduce(L,N){let Z=N;return this.steps.push(Q=>(Z=L(Z,Q),Z)),this}latch(L=(N,Z)=>N===Z){let N=!0,Z;return this.steps.push(Q=>{let X=N||!L(Q,Z);return N=!1,Z=Q,X?Q:w}),this}evaluate(L){for(let N of this.steps)if(L=N(L),L===w)break;return L}}function C(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.on(L,Z),X=()=>R.removeListener(L,Z),W=new fe({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromNodeEventEmitter=C;function A(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.addEventListener(L,Z),X=()=>R.removeEventListener(L,Z),W=new fe({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromDOMEventEmitter=A;function P(R){return new Promise(L=>t(R)(L))}i.toPromise=P;function E(R){let L=new fe;return R.then(N=>{L.fire(N)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}i.fromPromise=E;function $(R,L){return R(N=>L.fire(N))}i.forward=$;function z(R,L,N){return L(N),R(Z=>L(Z))}i.runAndSubscribe=z;class I{constructor(L,N){this._observable=L,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new fe(Z),N&&N.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,N){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(R,L){return new I(R,L).emitter.event}i.fromObservable=se;function F(R){return(L,N,Z)=>{let Q=0,X=!1,W={beginUpdate(){Q++},endUpdate(){Q--,Q===0&&(R.reportChanges(),X&&(X=!1,L.call(N)))},handlePossibleChange(){},handleChange(){X=!0}};R.addObserver(W),R.reportChanges();let U={dispose(){R.removeObserver(W)}};return Z instanceof Vo?Z.add(U):Array.isArray(Z)&&Z.push(U),U}}i.fromObservableLight=F})(Di||(Di={}));var Py=class Qy{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${Qy._idPool++}`,Qy.all.add(this)}start(e){this._stopWatch=new TJ,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};Py.all=new Set,Py._idPool=0;var AJ=Py,MJ=-1,JB=class eD{constructor(e,t,s=(eD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){let s=this.threshold;if(s<=0||t<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let c=new QJ(l,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t<r)&&(e=[s,r],t=r);return e}};JB._idPool=1;var EJ=JB,PJ=class tD{constructor(e){this.value=e}static create(){let e=new Error;return new tD(e.stack??"")}print(){console.warn(this.value.split(`
|
|
96
103
|
`).slice(2).join(`
|
|
97
|
-
`))}},aJ=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},lJ=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},hJ=0,iv=class{constructor(e){this.value=e,this.id=hJ++}},cJ=2,uJ,fe=class{constructor(e){var t,s,r,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new nJ((e==null?void 0:e.onListenerError)??em,((s=this._options)==null?void 0:s.leakWarningThreshold)??rJ):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new sJ(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||s.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,s)=>{var l,c,u,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new lJ(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||em)(y),Xe.None}if(this._disposed)return Xe.None;t&&(e=e.bind(t));let r=new iv(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=oJ.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof iv?(this._deliveryQueue??(this._deliveryQueue=new fJ),this._listeners=[this._listeners,r]):this._listeners.push(r):((u=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||u.call(c,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let o=xt(()=>{n==null||n(),this._removeListener(r)});return s instanceof Vo?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,c;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*cJ<=t.length){let u=0;for(let d=0;d<t.length;d++)t[d]?t[u++]=t[d]:r&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||em;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof iv)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},fJ=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ry=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new fe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new fe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Ry.INSTANCE=new Ry;var WS=Ry;function dJ(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}WS.INSTANCE.onDidChangeZoomLevel;function pJ(i){return WS.INSTANCE.getZoomFactor(i)}WS.INSTANCE.onDidChangeFullscreen;var zh=typeof navigator=="object"?navigator.userAgent:"",Ly=zh.indexOf("Firefox")>=0,mJ=zh.indexOf("AppleWebKit")>=0,US=zh.indexOf("Chrome")>=0,gJ=!US&&zh.indexOf("Safari")>=0;zh.indexOf("Electron/")>=0;zh.indexOf("Android")>=0;var sv=!1;if(typeof zn.matchMedia=="function"){let i=zn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=zn.matchMedia("(display-mode: fullscreen)");sv=i.matches,dJ(zn,i,({matches:t})=>{sv&&e.matches||(sv=t)})}var ih="en",$y=!1,By=!1,tm=!1,KB=!1,Cp,im=ih,SM=ih,OJ,gr,Xa=globalThis,Ri,fP;typeof Xa.vscode<"u"&&typeof Xa.vscode.process<"u"?Ri=Xa.vscode.process:typeof process<"u"&&typeof((fP=process==null?void 0:process.versions)==null?void 0:fP.node)=="string"&&(Ri=process);var dP,_J=typeof((dP=Ri==null?void 0:Ri.versions)==null?void 0:dP.electron)=="string",vJ=_J&&(Ri==null?void 0:Ri.type)==="renderer",pP;if(typeof Ri=="object"){$y=Ri.platform==="win32",By=Ri.platform==="darwin",tm=Ri.platform==="linux",tm&&Ri.env.SNAP&&Ri.env.SNAP_REVISION,Ri.env.CI||Ri.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Cp=ih,im=ih;let i=Ri.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);Cp=e.userLocale,SM=e.osLocale,im=e.resolvedLanguage||ih,OJ=(pP=e.languagePack)==null?void 0:pP.translationsConfigFile}catch{}KB=!0}else typeof navigator=="object"&&!vJ?(gr=navigator.userAgent,$y=gr.indexOf("Windows")>=0,By=gr.indexOf("Macintosh")>=0,(gr.indexOf("Macintosh")>=0||gr.indexOf("iPad")>=0||gr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tm=gr.indexOf("Linux")>=0,(gr==null?void 0:gr.indexOf("Mobi"))>=0,im=globalThis._VSCODE_NLS_LANGUAGE||ih,Cp=navigator.language.toLowerCase(),SM=Cp):console.error("Unable to resolve platform.");var JB=$y,en=By,yJ=tm,xM=KB,sn=gr,wo=im,bJ;(i=>{function e(){return wo}i.value=e;function t(){return wo.length===2?wo==="en":wo.length>=3?wo[0]==="e"&&wo[1]==="n"&&wo[2]==="-":!1}i.isDefaultVariant=t;function s(){return wo==="en"}i.isDefault=s})(bJ||(bJ={}));var SJ=typeof Xa.postMessage=="function"&&!Xa.importScripts;(()=>{if(SJ){let i=[];Xa.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s<r;s++){let n=i[s];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(s,1),n.callback();return}}});let e=0;return t=>{let s=++e;i.push({id:s,callback:t}),Xa.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var xJ=!!(sn&&sn.indexOf("Chrome")>=0);sn&&sn.indexOf("Firefox")>=0;!xJ&&sn&&sn.indexOf("Safari")>=0;sn&&sn.indexOf("Edg/")>=0;sn&&sn.indexOf("Android")>=0;var Nl=typeof navigator=="object"?navigator:{};xM||document.queryCommandSupported&&document.queryCommandSupported("copy")||Nl&&Nl.clipboard&&Nl.clipboard.writeText,xM||Nl&&Nl.clipboard&&Nl.clipboard.readText;var YS=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}},rv=new YS,wM=new YS,CM=new YS,wJ=new Array(230),eD;(i=>{function e(l){return rv.keyCodeToStr(l)}i.toString=e;function t(l){return rv.strToKeyCode(l)}i.fromString=t;function s(l){return wM.keyCodeToStr(l)}i.toUserSettingsUS=s;function r(l){return CM.keyCodeToStr(l)}i.toUserSettingsGeneral=r;function n(l){return wM.strToKeyCode(l)||CM.strToKeyCode(l)}i.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return rv.keyCodeToStr(l)}i.toElectronAccelerator=o})(eD||(eD={}));var CJ=class tD{constructor(e,t,s,r,n){this.ctrlKey=e,this.shiftKey=t,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof tD&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",t=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${t}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new kJ([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},kJ=class{constructor(i){if(i.length===0)throw GK("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}};function TJ(i){if(i.charCode){let t=String.fromCharCode(i.charCode).toUpperCase();return eD.fromString(t)}let e=i.keyCode;if(e===3)return 7;if(Ly)switch(e){case 59:return 85;case 60:if(yJ)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(en)return 57;break}else if(mJ&&(en&&e===93||!en&&e===92))return 57;return wJ[e]||0}var AJ=en?256:2048,MJ=512,EJ=1024,PJ=en?2048:256,kM=class{constructor(i){var t;this._standardKeyboardEventBrand=!0;let e=i;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(t=e.getModifierState)==null?void 0:t.call(e,"AltGraph"),this.keyCode=TJ(e),this.code=e.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(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=AJ),this.altKey&&(e|=MJ),this.shiftKey&&(e|=EJ),this.metaKey&&(e|=PJ),e|=i,e}_computeKeyCodeChord(){let i=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode),new CJ(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}},TM=new WeakMap;function QJ(i){if(!i.parent||i.parent===i)return null;try{let e=i.location,t=i.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return i.parent}var RJ=class{static getSameOriginWindowChain(i){let e=TM.get(i);if(!e){e=[],TM.set(i,e);let t=i,s;do s=QJ(t),s?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=s;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,s=0,r=this.getSameOriginWindowChain(i);for(let n of r){let o=n.window.deref();if(t+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();t+=l.top,s+=l.left}return{top:t,left:s}}},kp=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 s=RJ.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},AM=class{constructor(e,t=0,s=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let r=!1;if(US){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,c=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*c):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Ly&&!en?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")gJ&&JB?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*c):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Ly&&!en?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},iD=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),LJ;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof $J?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Di.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:iD})})(LJ||(LJ={}));var $J=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?iD:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},HS=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 Ay("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ay("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},BJ=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,s=globalThis){if(this.isDisposed)throw new Ay("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},t);this.disposable=xt(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},DJ;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(DJ||(DJ={}));var MM=class Fs{static fromArray(e){return new Fs(t=>{t.emitMany(e)})}static fromPromise(e){return new Fs(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Fs(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Fs(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new fe,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Di.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var t;return(t=this._onReturn)==null||t.call(this),{done:!0,value:void 0}}}}static map(e,t){return new Fs(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Fs.map(this,e)}static filter(e,t){return new Fs(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Fs.filter(this,e)}static coalesce(e){return Fs.filter(e,t=>!!t)}coalesce(){return Fs.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Fs.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};MM.EMPTY=MM.fromArray([]);var{getWindow:Fr,getWindowId:zJ,onDidRegisterWindow:NJ}=(function(){let i=new Map,e={window:zn,disposables:new Vo};i.set(zn.vscodeWindowId,e);let t=new fe,s=new fe,r=new fe;function n(o,l){return(typeof o=="number"?i.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Xe.None;let l=new Vo,c={window:o,disposables:l.add(new Vo)};return i.set(o.vscodeWindowId,c),l.add(xt(()=>{i.delete(o.vscodeWindowId),s.fire(o)})),l.add(Qe(o,ci.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(c),l},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:zn},getDocument(o){return Fr(o).document}}})(),XJ=class{constructor(e,t,s,r){this._node=e,this._type=t,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Qe(i,e,t,s){return new XJ(i,e,t,s)}var EM=function(i,e,t,s){return Qe(i,e,t,s)},FS,VJ=class extends BJ{constructor(i){super(),this.defaultTarget=i&&Fr(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},PM=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){em(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,s=new Map,r=n=>{t.set(n,!1);let o=i.get(n)??[];for(e.set(n,o),i.set(n,[]),s.set(n,!0);o.length>0;)o.sort(PM.sort),o.shift().execute();s.set(n,!1)};FS=(n,o,l=0)=>{let c=zJ(n),u=new PM(o,l),d=i.get(c);return d||(d=[],i.set(c,d)),d.push(u),t.get(c)||(t.set(c,!0),n.requestAnimationFrame(()=>r(c))),u}})();function ZJ(i){let e=i.getBoundingClientRect(),t=Fr(i);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}var ci={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"},jJ=class{constructor(i){this.domNode=i,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(i){let e=us(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=us(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=us(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=us(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=us(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=us(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=us(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=us(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=us(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=us(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=us(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=us(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=us(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=us(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function us(i){return typeof i=="number"?`${i}px`:i}function Eu(i){return new jJ(i)}var sD=class{constructor(){this._hooks=new Vo,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(t),this._hooks.add(xt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Fr(e)}this._hooks.add(Qe(o,ci.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(Qe(o,ci.POINTER_UP,l=>this.stopMonitoring(!0)))}};function IJ(i,e,t){let s=null,r=null;if(typeof t.value=="function"?(s="value",r=t.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(s="get",r=t.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;t[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Vr;(i=>(i.Tap="-xterm-gesturetap",i.Change="-xterm-gesturechange",i.Start="-xterm-gesturestart",i.End="-xterm-gesturesend",i.Contextmenu="-xterm-gesturecontextmenu"))(Vr||(Vr={}));var uu=class Xi extends Xe{constructor(){super(),this.dispatched=!1,this.targets=new bM,this.ignoreTargets=new bM,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Di.runAndSubscribe(NJ,({window:e,disposables:t})=>{t.add(Qe(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),t.add(Qe(e.document,"touchend",s=>this.onTouchEnd(e,s))),t.add(Qe(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:zn,disposables:this._store}))}static addTarget(e){if(!Xi.isTouchDevice())return Xe.None;Xi.INSTANCE||(Xi.INSTANCE=new Xi);let t=Xi.INSTANCE.targets.push(e);return xt(t)}static ignoreTarget(e){if(!Xi.isTouchDevice())return Xe.None;Xi.INSTANCE||(Xi.INSTANCE=new Xi);let t=Xi.INSTANCE.ignoreTargets.push(e);return xt(t)}static isTouchDevice(){return"ontouchstart"in zn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s<r;s++){let n=e.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:t,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[t],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Vr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<Xi.HOLD_DELAY&&Math.abs(c.initialPageX-Qs(c.rollingPageX))<30&&Math.abs(c.initialPageY-Qs(c.rollingPageY))<30){let d=this.newGestureEvent(Vr.Tap,c.initialTarget);d.pageX=Qs(c.rollingPageX),d.pageY=Qs(c.rollingPageY),this.dispatchEvent(d)}else if(u>=Xi.HOLD_DELAY&&Math.abs(c.initialPageX-Qs(c.rollingPageX))<30&&Math.abs(c.initialPageY-Qs(c.rollingPageY))<30){let d=this.newGestureEvent(Vr.Contextmenu,c.initialTarget);d.pageX=Qs(c.rollingPageX),d.pageY=Qs(c.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=Qs(c.rollingPageX),m=Qs(c.rollingPageY),g=Qs(c.rollingTimestamps)-c.rollingTimestamps[0],_=d-c.rollingPageX[0],y=m-c.rollingPageY[0],b=[...this.targets].filter(x=>c.initialTarget instanceof Node&&x.contains(c.initialTarget));this.inertia(e,b,s,Math.abs(_)/g,_>0?1:-1,d,Math.abs(y)/g,y>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(Vr.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=t,s.tapCount=0,s}dispatchEvent(e){if(e.type===Vr.Tap){let t=new Date().getTime(),s=0;t-this._lastSetTapCountTime>Xi.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=t,e.tapCount=s}else(e.type===Vr.Change||e.type===Vr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let t=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;t.push([r,s])}t.sort((s,r)=>s[0]-r[0]);for(let[s,r]of t)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,s,r,n,o,l,c,u){this.handle=FS(e,()=>{let d=Date.now(),m=d-s,g=0,_=0,y=!0;r+=Xi.SCROLL_FRICTION*m,l+=Xi.SCROLL_FRICTION*m,r>0&&(y=!1,g=n*r*m),l>0&&(y=!1,_=c*l*m);let b=this.newGestureEvent(Vr.Change);b.translationX=g,b.translationY=_,t.forEach(x=>x.dispatchEvent(b)),y||this.inertia(e,t,d,r,n,o+g,l,c,u+_)})}onTouchMove(e){let t=Date.now();for(let s=0,r=e.changedTouches.length;s<r;s++){let n=e.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(Vr.Change,o.initialTarget);l.translationX=n.pageX-Qs(o.rollingPageX),l.translationY=n.pageY-Qs(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};uu.SCROLL_FRICTION=-.005,uu.HOLD_DELAY=700,uu.CLEAR_TAP_COUNT_TIME=400,Lt([IJ],uu,"isTouchDevice",1);var qJ=uu,GS=class extends Xe{onclick(e,t){this._register(Qe(e,ci.CLICK,s=>t(new kp(Fr(e),s))))}onmousedown(e,t){this._register(Qe(e,ci.MOUSE_DOWN,s=>t(new kp(Fr(e),s))))}onmouseover(e,t){this._register(Qe(e,ci.MOUSE_OVER,s=>t(new kp(Fr(e),s))))}onmouseleave(e,t){this._register(Qe(e,ci.MOUSE_LEAVE,s=>t(new kp(Fr(e),s))))}onkeydown(e,t){this._register(Qe(e,ci.KEY_DOWN,s=>t(new kM(s))))}onkeyup(e,t){this._register(Qe(e,ci.KEY_UP,s=>t(new kM(s))))}oninput(e,t){this._register(Qe(e,ci.INPUT,t))}onblur(e,t){this._register(Qe(e,ci.BLUR,t))}onfocus(e,t){this._register(Qe(e,ci.FOCUS,t))}onchange(e,t){this._register(Qe(e,ci.CHANGE,t))}ignoreGesture(e){return qJ.ignoreTarget(e)}},QM=11,WJ=class extends GS{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.style.position="absolute",this.domNode.style.width=QM+"px",this.domNode.style.height=QM+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new sD),this._register(EM(this.bgDomNode,ci.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(EM(this.domNode,ci.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new VJ),this._pointerdownScheduleRepeatTimer=this._register(new HS)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Fr(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}},UJ=class Dy{constructor(e,t,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,t<0&&(t=0),r+t>s&&(r=s-t),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=t,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new Dy(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Dy(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,c=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:c}}},YJ=class extends Xe{constructor(i){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=i.smoothScrollDuration,this._scheduleAtNextAnimationFrame=i.scheduleAtNextAnimationFrame,this._state=new UJ(i.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(i){this._smoothScrollDuration=i}validateScrollPosition(i){return this._state.withScrollPosition(i)}getScrollDimensions(){return this._state}setScrollDimensions(i,e){var s;let t=this._state.withScrollDimensions(i,e);this._setState(t,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(i){let e=this._state.withScrollPosition(i);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(i,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(i);if(this._smoothScrolling){i={scrollLeft:typeof i.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:i.scrollLeft,scrollTop:typeof i.scrollTop>"u"?this._smoothScrolling.to.scrollTop:i.scrollTop};let t=this._state.withScrollPosition(i);if(this._smoothScrolling.to.scrollLeft===t.scrollLeft&&this._smoothScrolling.to.scrollTop===t.scrollTop)return;let s;e?s=new LM(this._smoothScrolling.from,t,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,t,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let t=this._state.withScrollPosition(i);this._smoothScrolling=LM.start(this._state,t,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 i=this._smoothScrolling.tick(),e=this._state.withScrollPosition(i);if(this._setState(e,!0),!!this._smoothScrolling){if(i.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(i,e){let t=this._state;t.equals(i)||(this._state=i,this._onScroll.fire(this._state.createScrollEvent(t,e)))}},RM=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function nv(i,e){let t=e-i;return function(s){return i+t*GJ(s)}}function HJ(i,e,t){return function(s){return s<t?i(s/t):e((s-t)/(1-t))}}var LM=class zy{constructor(e,t,s,r){this.from=e,this.to=t,this.duration=r,this.startTime=s,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(e,t,s){if(Math.abs(e-t)>2.5*s){let r,n;return e<t?(r=e+.75*s,n=t-.75*s):(r=e-.75*s,n=t+.75*s),HJ(nv(e,r),nv(n,t),.33)}return nv(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let s=this.scrollLeft(t),r=this.scrollTop(t);return new RM(s,r,!1)}return new RM(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,s){return zy.start(e,t,s)}static start(e,t,s){s=s+10;let r=Date.now()-10;return new zy(e,t,r,s)}};function FJ(i){return Math.pow(i,3)}function GJ(i){return 1-FJ(1-i)}var KJ=class extends Xe{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new HS)}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":"")))}},JJ=140,rD=class extends GS{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 KJ(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new sD),this._shouldRender=!0,this.domNode=Eu(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(Qe(this.domNode.domNode,ci.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new WJ(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=Eu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Qe(this.slider.domNode,ci.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let n=ZJ(this.domNode.domNode);t=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(JB&&l>JJ){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let c=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},nD=class Ny{constructor(e,t,s,r,n,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ny(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*t),c=r>0&&r>s;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(s*l/r))),d=(l-u)/(r-s),m=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let e=Ny._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,s=this._scrollPosition;return t<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},eee=class extends rD{constructor(e,t,s){let r=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new nD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,n.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}},tee=class extends rD{constructor(i,e,t){let s=i.getScrollDimensions(),r=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new nD(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}},iee=500,$M=50,see=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Xy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,s=1,r=this._rear;do{let n=r===this._front?e:Math.pow(2,-s);if(e-=n,t+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(US){let t=Fr(e.browserEvent),s=pJ(t);this.accept(Date.now(),e.deltaX*s,e.deltaY*s)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,s){let r=null,n=new see(e,t,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=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]=n),n.score=this._computeScore(n,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),t){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),c=Math.max(Math.min(r,o),1),u=Math.max(Math.min(n,l),1),d=Math.max(r,o),m=Math.max(n,l);d%c===0&&m%u===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Xy.INSTANCE=new Xy;var ree=Xy,nee=class extends GS{constructor(i,e,t){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),this.onWillScroll=this._onWillScroll.event,this._options=aee(e),this._scrollable=t,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new tee(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new eee(this._scrollable,this._options,s)),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(i),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Eu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Eu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Eu(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new HS),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ua(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(i){this._verticalScrollbar.delegatePointerDown(i)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(i){this._scrollable.setScrollDimensions(i,!1)}updateClassName(i){this._options.className=i,en&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(i){typeof i.handleMouseWheel<"u"&&(this._options.handleMouseWheel=i.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof i.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=i.mouseWheelScrollSensitivity),typeof i.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=i.fastScrollSensitivity),typeof i.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=i.scrollPredominantAxis),typeof i.horizontal<"u"&&(this._options.horizontal=i.horizontal),typeof i.vertical<"u"&&(this._options.vertical=i.vertical),typeof i.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=i.horizontalScrollbarSize),typeof i.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=i.verticalScrollbarSize),typeof i.scrollByPage<"u"&&(this._options.scrollByPage=i.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(i){this._revealOnScroll=i}delegateScrollFromMouseWheelEvent(i){this._onMouseWheel(new AM(i))}_setListeningToMouseWheel(i){if(this._mouseWheelToDispose.length>0!==i&&(this._mouseWheelToDispose=Ua(this._mouseWheelToDispose),i)){let e=t=>{this._onMouseWheel(new AM(t))};this._mouseWheelToDispose.push(Qe(this._listenOnDomNode,ci.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(i){var r;if((r=i.browserEvent)!=null&&r.defaultPrevented)return;let e=ree.INSTANCE;e.acceptStandardWheelEvent(i);let t=!1;if(i.deltaY||i.deltaX){let n=i.deltaY*this._options.mouseWheelScrollSensitivity,o=i.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!en&&i.browserEvent&&i.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),i.browserEvent&&i.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(n){let d=$M*n,m=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(u,m)}if(o){let d=$M*o,m=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(u,m)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),t=!0)}let s=t;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(i.preventDefault(),i.stopPropagation())}_onDidScroll(i){this._shouldRender=this._horizontalScrollbar.onDidScroll(i)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(i)||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 i=this._scrollable.getCurrentScrollPosition(),e=i.scrollTop>0,t=i.scrollLeft>0,s=t?" left":"",r=e?" top":"",n=t||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(i){this._mouseIsOver=!1,this._hide()}_onMouseOver(i){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(),iee)}},oee=class extends nee{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function aee(i){let e={lazyRender:typeof i.lazyRender<"u"?i.lazyRender:!1,className:typeof i.className<"u"?i.className:"",useShadows:typeof i.useShadows<"u"?i.useShadows:!0,handleMouseWheel:typeof i.handleMouseWheel<"u"?i.handleMouseWheel:!0,flipAxes:typeof i.flipAxes<"u"?i.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof i.consumeMouseWheelIfScrollbarIsNeeded<"u"?i.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof i.alwaysConsumeMouseWheel<"u"?i.alwaysConsumeMouseWheel:!1,scrollYToX:typeof i.scrollYToX<"u"?i.scrollYToX:!1,mouseWheelScrollSensitivity:typeof i.mouseWheelScrollSensitivity<"u"?i.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof i.fastScrollSensitivity<"u"?i.fastScrollSensitivity:5,scrollPredominantAxis:typeof i.scrollPredominantAxis<"u"?i.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof i.mouseWheelSmoothScroll<"u"?i.mouseWheelSmoothScroll:!0,arrowSize:typeof i.arrowSize<"u"?i.arrowSize:11,listenOnDomNode:typeof i.listenOnDomNode<"u"?i.listenOnDomNode:null,horizontal:typeof i.horizontal<"u"?i.horizontal:1,horizontalScrollbarSize:typeof i.horizontalScrollbarSize<"u"?i.horizontalScrollbarSize:10,horizontalSliderSize:typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:0,horizontalHasArrows:typeof i.horizontalHasArrows<"u"?i.horizontalHasArrows:!1,vertical:typeof i.vertical<"u"?i.vertical:1,verticalScrollbarSize:typeof i.verticalScrollbarSize<"u"?i.verticalScrollbarSize:10,verticalHasArrows:typeof i.verticalHasArrows<"u"?i.verticalHasArrows:!1,verticalSliderSize:typeof i.verticalSliderSize<"u"?i.verticalSliderSize:0,scrollByPage:typeof i.scrollByPage<"u"?i.scrollByPage:!1};return e.horizontalSliderSize=typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof i.verticalSliderSize<"u"?i.verticalSliderSize:e.verticalScrollbarSize,en&&(e.className+=" mac"),e}var Vy=class extends Xe{constructor(e,t,s,r,n,o,l,c){super(),this._bufferService=s,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new YJ({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>FS(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new oee(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Di.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(xt(()=>this._styleElement.remove())),this._register(Di.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
98
|
-
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Vy=Lt([Oe(2,is),Oe(3,Un),Oe(4,NB),Oe(5,Dh),Oe(6,ss),Oe(7,Yn)],Vy);var Zy=class extends Xe{constructor(e,t,s,r,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(xt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*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()}};Zy=Lt([Oe(1,is),Oe(2,Un),Oe(3,Mf),Oe(4,Yn)],Zy);var lee=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Br={full:0,left:0,center:0,right:0},Co={full:0,left:0,center:0,right:0},Yc={full:0,left:0,center:0,right:0},Km=class extends Xe{constructor(e,t,s,r,n,o,l,c){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new lee,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(xt(()=>{var m;return(m=this._canvas)==null?void 0:m.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;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);Co.full=this._canvas.width,Co.left=e,Co.center=t,Co.right=e,this._refreshDrawHeightConstants(),Yc.full=1,Yc.left=1,Yc.center=1+Co.left,Yc.right=1+Co.left+Co.center}_refreshDrawHeightConstants(){Br.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);Br.left=t,Br.center=t,Br.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Br.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Br.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Br.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Br.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(Yc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Br[e.position||"full"]/2),Co[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Br[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}))}};Km=Lt([Oe(2,is),Oe(3,Mf),Oe(4,Yn),Oe(5,ss),Oe(6,Dh),Oe(7,Un)],Km);var le;(i=>(i.NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="\x07",i.BS="\b",i.HT=" ",i.LF=`
|
|
99
|
-
`,i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(le||(le={}));var sm;(i=>(i.PAD="",i.HOP="",i.BPH="",i.NBH="",i.IND="",i.NEL="
",i.SSA="",i.ESA="",i.HTS="",i.HTJ="",i.VTS="",i.PLD="",i.PLU="",i.RI="",i.SS2="",i.SS3="",i.DCS="",i.PU1="",i.PU2="",i.STS="",i.CCH="",i.MW="",i.SPA="",i.EPA="",i.SOS="",i.SGCI="",i.SCI="",i.CSI="",i.ST="",i.OSC="",i.PM="",i.APC=""))(sm||(sm={}));var oD;(i=>i.ST=`${le.ESC}\\`)(oD||(oD={}));var jy=class{constructor(e,t,s,r,n,o){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${le.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),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};jy=Lt([Oe(2,is),Oe(3,ss),Oe(4,Ga),Oe(5,Yn)],jy);var ui=0,fi=0,di=0,Pt=0,BM={css:"#00000000",rgba:0},Ut;(i=>{function e(r,n,o,l){return l!==void 0?`#${ya(r)}${ya(n)}${ya(o)}${ya(l)}`:`#${ya(r)}${ya(n)}${ya(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Ut||(Ut={}));var vt;(i=>{function e(c,u){if(Pt=(u.rgba&255)/255,Pt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,m=u.rgba>>16&255,g=u.rgba>>8&255,_=c.rgba>>24&255,y=c.rgba>>16&255,b=c.rgba>>8&255;ui=_+Math.round((d-_)*Pt),fi=y+Math.round((m-y)*Pt),di=b+Math.round((g-b)*Pt);let x=Ut.toCss(ui,fi,di),w=Ut.toRgba(ui,fi,di);return{css:x,rgba:w}}i.blend=e;function t(c){return(c.rgba&255)===255}i.isOpaque=t;function s(c,u,d){let m=rm.ensureContrastRatio(c.rgba,u.rgba,d);if(m)return Ut.toColor(m>>24&255,m>>16&255,m>>8&255)}i.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[ui,fi,di]=rm.toChannels(u),{css:Ut.toCss(ui,fi,di),rgba:u}}i.opaque=r;function n(c,u){return Pt=Math.round(u*255),[ui,fi,di]=rm.toChannels(c.rgba),{css:Ut.toCss(ui,fi,di,Pt),rgba:Ut.toRgba(ui,fi,di,Pt)}}i.opacity=n;function o(c,u){return Pt=c.rgba&255,n(c,Pt*u/255)}i.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}i.toColorRGB=l})(vt||(vt={}));var Ct;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ui=parseInt(r.slice(1,2).repeat(2),16),fi=parseInt(r.slice(2,3).repeat(2),16),di=parseInt(r.slice(3,4).repeat(2),16),Ut.toColor(ui,fi,di);case 5:return ui=parseInt(r.slice(1,2).repeat(2),16),fi=parseInt(r.slice(2,3).repeat(2),16),di=parseInt(r.slice(3,4).repeat(2),16),Pt=parseInt(r.slice(4,5).repeat(2),16),Ut.toColor(ui,fi,di,Pt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ui=parseInt(n[1]),fi=parseInt(n[2]),di=parseInt(n[3]),Pt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ut.toColor(ui,fi,di,Pt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[ui,fi,di,Pt]=e.getImageData(0,0,1,1).data,Pt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ut.toRgba(ui,fi,di,Pt),css:r}}i.toColor=s})(Ct||(Ct={}));var Yi;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,l=r/255,c=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+m*.0722}i.relativeLuminance2=t})(Yi||(Yi={}));var rm;(i=>{function e(o,l){if(Pt=(l&255)/255,Pt===1)return l;let c=l>>24&255,u=l>>16&255,d=l>>8&255,m=o>>24&255,g=o>>16&255,_=o>>8&255;return ui=m+Math.round((c-m)*Pt),fi=g+Math.round((u-g)*Pt),di=_+Math.round((d-_)*Pt),Ut.toRgba(ui,fi,di)}i.blend=e;function t(o,l,c){let u=Yi.relativeLuminance(o>>8),d=Yi.relativeLuminance(l>>8);if(Mn(u,d)<c){if(d<u){let _=s(o,l,c),y=Mn(u,Yi.relativeLuminance(_>>8));if(y<c){let b=r(o,l,c),x=Mn(u,Yi.relativeLuminance(b>>8));return y>x?_:b}return _}let m=r(o,l,c),g=Mn(u,Yi.relativeLuminance(m>>8));if(g<c){let _=s(o,l,c),y=Mn(u,Yi.relativeLuminance(_>>8));return g>y?m:_}return m}}i.ensureContrastRatio=t;function s(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));for(;b<c&&(g>0||_>0||y>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.reduceLuminance=s;function r(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));for(;b<c&&(g<255||_<255||y<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(rm||(rm={}));function ya(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Mn(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}var hee=class extends Af{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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()]}},Jm=class{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new lr}register(i){let e={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(e),e.id}deregister(i){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===i)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(i);if(!e||e.length===0)return[];let t=[],s=e.translateToString(!0),r=0,n=0,o=0,l=e.getFg(0),c=e.getBg(0);for(let u=0;u<e.getTrimmedLength();u++)if(e.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-r>1){let d=this._getJoinedRanges(s,o,n,e,r);for(let m=0;m<d.length;m++)t.push(d[m])}r=u,o=n,l=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||No.length}if(this._bufferService.cols-r>1){let u=this._getJoinedRanges(s,o,n,e,r);for(let d=0;d<u.length;d++)t.push(u[d])}return t}_getJoinedRanges(i,e,t,s,r){let n=i.substring(e,t),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let c=this._characterJoiners[l].handler(n);for(let u=0;u<c.length;u++)Jm._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(i,e,t){let s=0,r=!1,n=0,o=i[s];if(o){for(let l=t;l<this._bufferService.cols;l++){let c=e.getWidth(l),u=e.getString(l).length||No.length;if(c!==0){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=i[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(i,e){let t=!1;for(let s=0;s<i.length;s++){let r=i[s];if(t){if(e[1]<=r[0])return i[s-1][1]=e[1],i;if(e[1]<=r[1])return i[s-1][1]=Math.max(e[1],r[1]),i.splice(s,1),i;i.splice(s,1),s--}else{if(e[1]<=r[0])return i.splice(s,0,e),i;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),i;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),t=!0);continue}}return t?i[i.length-1][1]=e[1]:i.push(e),i}};Jm=Lt([Oe(0,is)],Jm);function cee(i){return 57508<=i&&i<=57558}function uee(i){return 9472<=i&&i<=9631}function fee(i){return cee(i)||uee(i)}function dee(){return{css:{canvas:Tp(),cell:Tp()},device:{canvas:Tp(),cell:Tp(),char:{width:0,height:0,left:0,top:0}}}}function Tp(){return{width:0,height:0}}var Iy=class{constructor(e,t,s,r,n,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new lr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,r,n,o,l,c,u,d,m){let g=[],_=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b=e.getNoBgTrimmedLength();s&&b<o+1&&(b=o+1);let x,w=0,k="",C=0,A=0,P=0,E=0,$=!1,z=0,I=!1,se=0,F=0,R=[],L=d!==-1&&m!==-1;for(let N=0;N<b;N++){e.loadCell(N,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let Q=!1,X=N>=F,W=N,U=this._workCell;if(_.length>0&&N===_[0][0]&&X){let Pe=_.shift(),ln=this._isCellInSelection(Pe[0],t);for(C=Pe[0]+1;C<Pe[1];C++)X&&(X=ln===this._isCellInSelection(C,t));X&&(X=!s||o<Pe[0]||o>=Pe[1]),X?(Q=!0,U=new hee(this._workCell,e.translateToString(!0,Pe[0],Pe[1]),Pe[1]-Pe[0]),W=Pe[1]-1,Z=U.getWidth()):F=Pe[1]}let q=this._isCellInSelection(N,t),D=s&&N===o,G=L&&N>=d&&N<=m,ie=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Pe=>{ie=!0});let ce=U.getChars()||No;if(ce===" "&&(U.isUnderline()||U.isOverline())&&(ce=" "),se=Z*c-u.get(ce,U.isBold(),U.isItalic()),!x)x=this._document.createElement("span");else if(w&&(q&&I||!q&&!I&&U.bg===A)&&(q&&I&&y.selectionForeground||U.fg===P)&&U.extended.ext===E&&G===$&&se===z&&!D&&!Q&&!ie&&X){U.isInvisible()?k+=No:k+=ce,w++;continue}else w&&(x.textContent=k),x=this._document.createElement("span"),w=0,k="";if(A=U.bg,P=U.fg,E=U.extended.ext,$=G,z=se,I=q,Q&&o>=N&&o<=W&&(o=N),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&R.push("xterm-cursor-blink"),R.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline");break}}if(U.isBold()&&R.push("xterm-bold"),U.isItalic()&&R.push("xterm-italic"),U.isDim()&&R.push("xterm-dim"),U.isInvisible()?k=No:k=U.getChars()||No,U.isUnderline()&&(R.push(`xterm-underline-${U.extended.underlineStyle}`),k===" "&&(k=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Af.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let Pe=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&Pe<8&&(Pe+=8),x.style.textDecorationColor=y.ansi[Pe].css}U.isOverline()&&(R.push("xterm-overline"),k===" "&&(k=" ")),U.isStrikethrough()&&R.push("xterm-strikethrough"),G&&(x.style.textDecoration="underline");let he=U.getFgColor(),de=U.getFgColorMode(),ge=U.getBgColor(),Ae=U.getBgColorMode(),ye=!!U.isInverse();if(ye){let Pe=he;he=ge,ge=Pe;let ln=de;de=Ae,Ae=ln}let mt,Ft,Gt=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Pe=>{Pe.options.layer!=="top"&&Gt||(Pe.backgroundColorRGB&&(Ae=50331648,ge=Pe.backgroundColorRGB.rgba>>8&16777215,mt=Pe.backgroundColorRGB),Pe.foregroundColorRGB&&(de=50331648,he=Pe.foregroundColorRGB.rgba>>8&16777215,Ft=Pe.foregroundColorRGB),Gt=Pe.options.layer==="top")}),!Gt&&q&&(mt=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ge=mt.rgba>>8&16777215,Ae=50331648,Gt=!0,y.selectionForeground&&(de=50331648,he=y.selectionForeground.rgba>>8&16777215,Ft=y.selectionForeground)),Gt&&R.push("xterm-decoration-top");let oi;switch(Ae){case 16777216:case 33554432:oi=y.ansi[ge],R.push(`xterm-bg-${ge}`);break;case 50331648:oi=Ut.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(x,`background-color:#${DM((ge>>>0).toString(16),"0",6)}`);break;case 0:default:ye?(oi=y.foreground,R.push("xterm-bg-257")):oi=y.background}switch(mt||U.isDim()&&(mt=vt.multiplyOpacity(oi,.5)),de){case 16777216:case 33554432:U.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(x,oi,y.ansi[he],U,mt,void 0)||R.push(`xterm-fg-${he}`);break;case 50331648:let Pe=Ut.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(x,oi,Pe,U,mt,Ft)||this._addStyle(x,`color:#${DM(he.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,oi,y.foreground,U,mt,Ft)||ye&&R.push("xterm-fg-257")}R.length&&(x.className=R.join(" "),R.length=0),!D&&!Q&&!ie&&X?w++:x.textContent=k,se!==this.defaultSpacing&&(x.style.letterSpacing=`${se}px`),g.push(x),N=W}return x&&w&&(x.textContent=k),g}_applyMinimumContrast(e,t,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||fee(r.getCode()))return!1;let l=this._getContrastCache(r),c;if(!n&&!o&&(c=l.getColor(t.rgba,s.rgba)),c===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);c=vt.ensureContrastRatio(n||t,o||s,u),l.setColor((n||t).rgba,(o||s).rgba,c??null)}return c?(this._addStyle(e,`color:${c.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e<r[0]&&t<=r[1]:e<s[0]&&t>=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t<r[1]||s[1]===r[1]&&t===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&t===r[1]&&e<r[0]||s[1]<r[1]&&t===s[1]&&e>=s[0]}};Iy=Lt([Oe(1,ZB),Oe(2,ss),Oe(3,Un),Oe(4,Ga),Oe(5,Mf),Oe(6,Dh)],Iy);function DM(i,e,t){for(;i.length<t;)i=e+i;return i}var pee=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,r,n,o],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,r){e===this._font&&t===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,s){let r=0;if(!t&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let n=e;t&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;t&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},mee=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,s,r=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=t[1]-n,l=s[1]-n,c=Math.max(o,0),u=Math.min(l,e.rows-1);if(c>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function gee(){return new mee}var ov="xterm-dom-renderer-owner-",Hs="xterm-rows",Ap="xterm-fg-",zM="xterm-bg-",Hc="xterm-focus",Mp="xterm-selection",Oee=1,qy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u,d,m,g,_,y){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=u,this._optionsService=d,this._bufferService=m,this._coreService=g,this._coreBrowserService=_,this._themeService=y,this._terminalClass=Oee++,this._rowElements=[],this._selectionRenderModel=gee(),this.onRequestRedraw=this._register(new fe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Hs),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(Mp),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=dee(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=c.createInstance(Iy,document),this._element.classList.add(ov+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(xt(()=>{this._element.classList.remove(ov+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new pee(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Hs} 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} .${Hs} { 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} .${Hs} .xterm-dim { color: ${vt.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 s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Hs}.${Hc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Hs}.${Hc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Hs}.${Hc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Mp} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Mp} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Mp} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Ap}${o} { color: ${l.css}; }${this._terminalSelector} .${Ap}${o}.xterm-dim { color: ${vt.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${zM}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Ap}257 { color: ${vt.opaque(e.background).css}; }${this._terminalSelector} .${Ap}257.xterm-dim { color: ${vt.multiplyOpacity(vt.opaque(e.background),.5).css}; }${this._terminalSelector} .${zM}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 s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Hc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Hc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(s){let u=e[0]>t[0];c.appendChild(this._createSelectionElement(o,u?t[0]:e[0],u?e[0]:t[0],l-o+1))}else{let u=r===o?e[0]:0,d=o===n?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(o,u,d));let m=l-o-1;if(c.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==l){let g=n===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,g))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,t,s,r=1){let n=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}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 s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=t;u++){let d=u+s.ydisp,m=this._rowElements[u],g=s.lines.get(d);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,d,d===r,l,c,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${ov}${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,s,r,n,o){s<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let c=this._bufferService.buffer,u=c.ybase+c.y,d=Math.min(c.x,n-1),m=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=s;y<=r;++y){let b=y+c.ydisp,x=this._rowElements[y],w=c.lines.get(b);if(!x||!w)break;x.replaceChildren(...this._rowFactory.createRow(w,b,b===u,g,_,d,m,this.dimensions.css.cell.width,this._widthCache,o?y===s?e:0:-1,o?(y===r?t:n)-1:-1))}}};qy=Lt([Oe(7,IS),Oe(8,xg),Oe(9,ss),Oe(10,is),Oe(11,Ga),Oe(12,Un),Oe(13,Dh)],qy);var Wy=class extends Xe{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new fe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new vee(this._optionsService))}catch{this._measureStrategy=this._register(new _ee(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())}};Wy=Lt([Oe(2,ss)],Wy);var aD=class extends Xe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,e){i!==void 0&&i>0&&e!==void 0&&e>0&&(this._result.width=i,this._result.height=e)}},_ee=class extends aD{constructor(i,e,t){super(),this._document=i,this._parentElement=e,this._optionsService=t,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}},vee=class extends aD{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}},yee=class extends Xe{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new bee(this._window)),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new fe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Di.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Qe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Qe(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}},bee=class extends Xe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Th),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Qe(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)}},See=class extends Xe{constructor(){super(),this.linkProviders=[],this._register(xt(()=>this.linkProviders.length=0))}registerLinkProvider(i){return this.linkProviders.push(i),{dispose:()=>{let e=this.linkProviders.indexOf(i);e!==-1&&this.linkProviders.splice(e,1)}}}};function KS(i,e,t){let s=t.getBoundingClientRect(),r=i.getComputedStyle(t),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function xee(i,e,t,s,r,n,o,l,c){if(!n)return;let u=KS(i,e,t);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),s+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var Uy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,r,n){return xee(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let s=KS(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Uy=Lt([Oe(0,Yn),Oe(1,xg)],Uy);var wee=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,s){this._rowCount=s,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=[]}},lD={};LK(lD,{getSafariVersion:()=>kee,isChromeOS:()=>fD,isFirefox:()=>hD,isIpad:()=>Tee,isIphone:()=>Aee,isLegacyEdge:()=>Cee,isLinux:()=>JS,isMac:()=>eg,isNode:()=>wg,isSafari:()=>cD,isWindows:()=>uD});var wg=typeof process<"u"&&"title"in process,Ef=wg?"node":navigator.userAgent,Pf=wg?"node":navigator.platform,hD=Ef.includes("Firefox"),Cee=Ef.includes("Edge"),cD=/^((?!chrome|android).)*safari/i.test(Ef);function kee(){if(!cD)return 0;let i=Ef.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var eg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Pf),Tee=Pf==="iPad",Aee=Pf==="iPhone",uD=["Windows","Win16","Win32","WinCE"].includes(Pf),JS=Pf.indexOf("Linux")>=0,fD=/\bCrOS\b/.test(Ef),dD=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,s=i.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),r=i.timeRemaining(),t*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Mee=class extends dD{_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())}}},Eee=class extends dD{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},tg=!wg&&"requestIdleCallback"in window?Eee:Mee,Pee=class{constructor(){this._queue=new tg}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}},Yy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=c,this._renderer=this._register(new Th),this._pausedResizeTask=new Pee,this._observerDisposable=this._register(new Th),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 fe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new fe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new fe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new wee((d,m)=>this._renderRows(d,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new Qee(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=xt(()=>s.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,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(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 s;return(s=this._renderer.value)==null?void 0:s.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,s){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Yy=Lt([Oe(2,ss),Oe(3,xg),Oe(4,Ga),Oe(5,Mf),Oe(6,is),Oe(7,Un),Oe(8,Dh)],Yy);var Qee=class{constructor(i,e,t){this._coreBrowserService=i,this._coreService=e,this._onTimeout=t,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(i,e){this._isBuffering?(this._start=Math.min(this._start,i),this._end=Math.max(this._end,e)):(this._start=i,this._end=e,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 i={start:this._start,end:this._end};return this._isBuffering=!1,i}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function Ree(i,e,t,s){let r=t.buffer.x,n=t.buffer.y;if(!t.buffer.hasScrollback)return Bee(r,n,i,e,t,s)+Cg(n,e,t,s)+Dee(r,n,i,e,t,s);let o;if(n===e)return o=r>i?"D":"C",hf(Math.abs(r-i),lf(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),c=$ee(n>e?i:r,t)+(l-1)*t.cols+1+Lee(n>e?r:i);return hf(c,lf(o,s))}function Lee(i,e){return i-1}function $ee(i,e){return e.cols-i}function Bee(i,e,t,s,r,n){return Cg(e,s,r,n).length===0?"":hf(mD(i,e,i,e-Ya(e,r),!1,r).length,lf("D",n))}function Cg(i,e,t,s){let r=i-Ya(i,t),n=e-Ya(e,t),o=Math.abs(r-n)-zee(i,e,t);return hf(o,lf(pD(i,e),s))}function Dee(i,e,t,s,r,n){let o;Cg(e,s,r,n).length>0?o=s-Ya(s,r):o=e;let l=s,c=Nee(i,e,t,s,r,n);return hf(mD(i,o,t,l,c==="C",r).length,lf(c,n))}function zee(i,e,t){var o;let s=0,r=i-Ya(i,t),n=e-Ya(e,t);for(let l=0;l<Math.abs(r-n);l++){let c=pD(i,e)==="A"?-1:1;(o=t.buffer.lines.get(r+c*l))!=null&&o.isWrapped&&s++}return s}function Ya(i,e){let t=0,s=e.buffer.lines.get(i),r=s==null?void 0:s.isWrapped;for(;r&&i>=0&&i<e.rows;)t++,s=e.buffer.lines.get(--i),r=s==null?void 0:s.isWrapped;return t}function Nee(i,e,t,s,r,n){let o;return Cg(t,s,r,n).length>0?o=s-Ya(s,r):o=e,i<t&&o<=s||i>=t&&o<s?"C":"D"}function pD(i,e){return i>e?"A":"B"}function mD(i,e,t,s,r,n){let o=i,l=e,c="";for(;(o!==t||l!==s)&&l>=0&&l<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(c+=n.buffer.translateBufferLineToString(l,!1,i,o),o=0,i=0,l++):!r&&o<0&&(c+=n.buffer.translateBufferLineToString(l,!1,0,i+1),o=n.cols-1,i=o,l--);return c+n.buffer.translateBufferLineToString(l,!1,i,o)}function lf(i,e){let t=e?"O":"[";return le.ESC+t+i}function hf(i,e){i=Math.floor(i);let t="";for(let s=0;s<i;s++)t+=e;return t}var Xee=class{constructor(i){this._bufferService=i,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 i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let i=this.selectionStart,e=this.selectionEnd;return!i||!e?!1:i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function NM(i,e){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return e*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}var av=50,Vee=15,Zee=50,jee=500,Iee=" ",qee=new RegExp(Iee,"g"),Hy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=c,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new lr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new fe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new fe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new Xee(this._bufferService),this._activeSelectionMode=0,this._register(xt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let c=s.translateBufferLineToString(l,!0,n,o);r.push(c)}}else{let n=e[1]===t[1]?t[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=t[1]-1;o++){let l=s.lines.get(o),c=s.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=c:r.push(c)}if(e[1]!==t[1]){let o=s.lines.get(t[1]),l=s.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(n=>n.replace(qee," ")).join(uD?`\r
|
|
104
|
+
`))}},QJ=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},RJ=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},LJ=0,Cv=class{constructor(e){this.value=e,this.id=LJ++}},$J=2,BJ,fe=class{constructor(e){var t,s,r,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new EJ((e==null?void 0:e.onListenerError)??em,((s=this._options)==null?void 0:s.leakWarningThreshold)??MJ):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new AJ(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||s.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,s)=>{var l,c,u,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new RJ(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||em)(y),Xe.None}if(this._disposed)return Xe.None;t&&(e=e.bind(t));let r=new Cv(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=PJ.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Cv?(this._deliveryQueue??(this._deliveryQueue=new DJ),this._listeners=[this._listeners,r]):this._listeners.push(r):((u=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||u.call(c,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let o=xt(()=>{n==null||n(),this._removeListener(r)});return s instanceof Vo?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,c;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*$J<=t.length){let u=0;for(let d=0;d<t.length;d++)t[d]?t[u++]=t[d]:r&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||em;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Cv)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},DJ=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,s){this.i=0,this.end=s,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Ry=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new fe,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new fe,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};Ry.INSTANCE=new Ry;var US=Ry;function zJ(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}US.INSTANCE.onDidChangeZoomLevel;function NJ(i){return US.INSTANCE.getZoomFactor(i)}US.INSTANCE.onDidChangeFullscreen;var zh=typeof navigator=="object"?navigator.userAgent:"",Ly=zh.indexOf("Firefox")>=0,XJ=zh.indexOf("AppleWebKit")>=0,YS=zh.indexOf("Chrome")>=0,VJ=!YS&&zh.indexOf("Safari")>=0;zh.indexOf("Electron/")>=0;zh.indexOf("Android")>=0;var kv=!1;if(typeof zn.matchMedia=="function"){let i=zn.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=zn.matchMedia("(display-mode: fullscreen)");kv=i.matches,zJ(zn,i,({matches:t})=>{kv&&e.matches||(kv=t)})}var ih="en",$y=!1,By=!1,tm=!1,iD=!1,kp,im=ih,FM=ih,ZJ,gr,Xa=globalThis,Ri,fP;typeof Xa.vscode<"u"&&typeof Xa.vscode.process<"u"?Ri=Xa.vscode.process:typeof process<"u"&&typeof((fP=process==null?void 0:process.versions)==null?void 0:fP.node)=="string"&&(Ri=process);var dP,jJ=typeof((dP=Ri==null?void 0:Ri.versions)==null?void 0:dP.electron)=="string",IJ=jJ&&(Ri==null?void 0:Ri.type)==="renderer",pP;if(typeof Ri=="object"){$y=Ri.platform==="win32",By=Ri.platform==="darwin",tm=Ri.platform==="linux",tm&&Ri.env.SNAP&&Ri.env.SNAP_REVISION,Ri.env.CI||Ri.env.BUILD_ARTIFACTSTAGINGDIRECTORY,kp=ih,im=ih;let i=Ri.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);kp=e.userLocale,FM=e.osLocale,im=e.resolvedLanguage||ih,ZJ=(pP=e.languagePack)==null?void 0:pP.translationsConfigFile}catch{}iD=!0}else typeof navigator=="object"&&!IJ?(gr=navigator.userAgent,$y=gr.indexOf("Windows")>=0,By=gr.indexOf("Macintosh")>=0,(gr.indexOf("Macintosh")>=0||gr.indexOf("iPad")>=0||gr.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,tm=gr.indexOf("Linux")>=0,(gr==null?void 0:gr.indexOf("Mobi"))>=0,im=globalThis._VSCODE_NLS_LANGUAGE||ih,kp=navigator.language.toLowerCase(),FM=kp):console.error("Unable to resolve platform.");var sD=$y,en=By,qJ=tm,GM=iD,sn=gr,Co=im,WJ;(i=>{function e(){return Co}i.value=e;function t(){return Co.length===2?Co==="en":Co.length>=3?Co[0]==="e"&&Co[1]==="n"&&Co[2]==="-":!1}i.isDefaultVariant=t;function s(){return Co==="en"}i.isDefault=s})(WJ||(WJ={}));var UJ=typeof Xa.postMessage=="function"&&!Xa.importScripts;(()=>{if(UJ){let i=[];Xa.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s<r;s++){let n=i[s];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(s,1),n.callback();return}}});let e=0;return t=>{let s=++e;i.push({id:s,callback:t}),Xa.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var YJ=!!(sn&&sn.indexOf("Chrome")>=0);sn&&sn.indexOf("Firefox")>=0;!YJ&&sn&&sn.indexOf("Safari")>=0;sn&&sn.indexOf("Edg/")>=0;sn&&sn.indexOf("Android")>=0;var Xl=typeof navigator=="object"?navigator:{};GM||document.queryCommandSupported&&document.queryCommandSupported("copy")||Xl&&Xl.clipboard&&Xl.clipboard.writeText,GM||Xl&&Xl.clipboard&&Xl.clipboard.readText;var HS=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}},Tv=new HS,KM=new HS,JM=new HS,HJ=new Array(230),rD;(i=>{function e(l){return Tv.keyCodeToStr(l)}i.toString=e;function t(l){return Tv.strToKeyCode(l)}i.fromString=t;function s(l){return KM.keyCodeToStr(l)}i.toUserSettingsUS=s;function r(l){return JM.keyCodeToStr(l)}i.toUserSettingsGeneral=r;function n(l){return KM.strToKeyCode(l)||JM.strToKeyCode(l)}i.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Tv.keyCodeToStr(l)}i.toElectronAccelerator=o})(rD||(rD={}));var FJ=class nD{constructor(e,t,s,r,n){this.ctrlKey=e,this.shiftKey=t,this.altKey=s,this.metaKey=r,this.keyCode=n}equals(e){return e instanceof nD&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}getHashCode(){let e=this.ctrlKey?"1":"0",t=this.shiftKey?"1":"0",s=this.altKey?"1":"0",r=this.metaKey?"1":"0";return`K${e}${t}${s}${r}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new GJ([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},GJ=class{constructor(i){if(i.length===0)throw SJ("chords");this.chords=i}getHashCode(){let i="";for(let e=0,t=this.chords.length;e<t;e++)e!==0&&(i+=";"),i+=this.chords[e].getHashCode();return i}equals(i){if(i===null||this.chords.length!==i.chords.length)return!1;for(let e=0;e<this.chords.length;e++)if(!this.chords[e].equals(i.chords[e]))return!1;return!0}};function KJ(i){if(i.charCode){let t=String.fromCharCode(i.charCode).toUpperCase();return rD.fromString(t)}let e=i.keyCode;if(e===3)return 7;if(Ly)switch(e){case 59:return 85;case 60:if(qJ)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(en)return 57;break}else if(XJ&&(en&&e===93||!en&&e===92))return 57;return HJ[e]||0}var JJ=en?256:2048,eee=512,tee=1024,iee=en?2048:256,eE=class{constructor(i){var t;this._standardKeyboardEventBrand=!0;let e=i;this.browserEvent=e,this.target=e.target,this.ctrlKey=e.ctrlKey,this.shiftKey=e.shiftKey,this.altKey=e.altKey,this.metaKey=e.metaKey,this.altGraphKey=(t=e.getModifierState)==null?void 0:t.call(e,"AltGraph"),this.keyCode=KJ(e),this.code=e.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(i){return this._asKeybinding===i}_computeKeybinding(){let i=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode);let e=0;return this.ctrlKey&&(e|=JJ),this.altKey&&(e|=eee),this.shiftKey&&(e|=tee),this.metaKey&&(e|=iee),e|=i,e}_computeKeyCodeChord(){let i=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(i=this.keyCode),new FJ(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,i)}},tE=new WeakMap;function see(i){if(!i.parent||i.parent===i)return null;try{let e=i.location,t=i.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return i.parent}var ree=class{static getSameOriginWindowChain(i){let e=tE.get(i);if(!e){e=[],tE.set(i,e);let t=i,s;do s=see(t),s?e.push({window:new WeakRef(t),iframeElement:t.frameElement||null}):e.push({window:new WeakRef(t),iframeElement:null}),t=s;while(t)}return e.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(i,e){if(!e||i===e)return{top:0,left:0};let t=0,s=0,r=this.getSameOriginWindowChain(i);for(let n of r){let o=n.window.deref();if(t+=(o==null?void 0:o.scrollY)??0,s+=(o==null?void 0:o.scrollX)??0,o===e||!n.iframeElement)break;let l=n.iframeElement.getBoundingClientRect();t+=l.top,s+=l.left}return{top:t,left:s}}},Tp=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 s=ree.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=s.left,this.posy-=s.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},iE=class{constructor(e,t=0,s=0){var n;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=s,this.deltaX=t;let r=!1;if(YS){let o=navigator.userAgent.match(/Chrome\/(\d+)/);r=(o?parseInt(o[1]):123)<=122}if(e){let o=e,l=e,c=((n=e.view)==null?void 0:n.devicePixelRatio)||1;if(typeof o.wheelDeltaY<"u")r?this.deltaY=o.wheelDeltaY/(120*c):this.deltaY=o.wheelDeltaY/120;else if(typeof l.VERTICAL_AXIS<"u"&&l.axis===l.VERTICAL_AXIS)this.deltaY=-l.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Ly&&!en?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof o.wheelDeltaX<"u")VJ&&sD?this.deltaX=-(o.wheelDeltaX/120):r?this.deltaX=o.wheelDeltaX/(120*c):this.deltaX=o.wheelDeltaX/120;else if(typeof l.HORIZONTAL_AXIS<"u"&&l.axis===l.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let u=e;u.deltaMode===u.DOM_DELTA_LINE?Ly&&!en?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(r?this.deltaY=e.wheelDelta/(120*c):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},oD=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),nee;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof oee?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Di.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:oD})})(nee||(nee={}));var oee=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?oD:(this._emitter||(this._emitter=new fe),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},FS=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 Ay("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ay("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},aee=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,s=globalThis){if(this.isDisposed)throw new Ay("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=s.setInterval(()=>{e()},t);this.disposable=xt(()=>{s.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},lee;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(lee||(lee={}));var sE=class Fs{static fromArray(e){return new Fs(t=>{t.emitMany(e)})}static fromPromise(e){return new Fs(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Fs(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Fs(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new fe,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Di.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var t;return(t=this._onReturn)==null||t.call(this),{done:!0,value:void 0}}}}static map(e,t){return new Fs(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Fs.map(this,e)}static filter(e,t){return new Fs(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Fs.filter(this,e)}static coalesce(e){return Fs.filter(e,t=>!!t)}coalesce(){return Fs.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Fs.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};sE.EMPTY=sE.fromArray([]);var{getWindow:Fr,getWindowId:hee,onDidRegisterWindow:cee}=(function(){let i=new Map,e={window:zn,disposables:new Vo};i.set(zn.vscodeWindowId,e);let t=new fe,s=new fe,r=new fe;function n(o,l){return(typeof o=="number"?i.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Xe.None;let l=new Vo,c={window:o,disposables:l.add(new Vo)};return i.set(o.vscodeWindowId,c),l.add(xt(()=>{i.delete(o.vscodeWindowId),s.fire(o)})),l.add(Qe(o,ci.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(c),l},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:zn},getDocument(o){return Fr(o).document}}})(),uee=class{constructor(e,t,s,r){this._node=e,this._type=t,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function Qe(i,e,t,s){return new uee(i,e,t,s)}var rE=function(i,e,t,s){return Qe(i,e,t,s)},GS,fee=class extends aee{constructor(i){super(),this.defaultTarget=i&&Fr(i)}cancelAndSet(i,e,t){return super.cancelAndSet(i,e,t??this.defaultTarget)}},nE=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){em(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let i=new Map,e=new Map,t=new Map,s=new Map,r=n=>{t.set(n,!1);let o=i.get(n)??[];for(e.set(n,o),i.set(n,[]),s.set(n,!0);o.length>0;)o.sort(nE.sort),o.shift().execute();s.set(n,!1)};GS=(n,o,l=0)=>{let c=hee(n),u=new nE(o,l),d=i.get(c);return d||(d=[],i.set(c,d)),d.push(u),t.get(c)||(t.set(c,!0),n.requestAnimationFrame(()=>r(c))),u}})();function dee(i){let e=i.getBoundingClientRect(),t=Fr(i);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}var ci={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"},pee=class{constructor(i){this.domNode=i,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(i){let e=us(i);this._maxWidth!==e&&(this._maxWidth=e,this.domNode.style.maxWidth=this._maxWidth)}setWidth(i){let e=us(i);this._width!==e&&(this._width=e,this.domNode.style.width=this._width)}setHeight(i){let e=us(i);this._height!==e&&(this._height=e,this.domNode.style.height=this._height)}setTop(i){let e=us(i);this._top!==e&&(this._top=e,this.domNode.style.top=this._top)}setLeft(i){let e=us(i);this._left!==e&&(this._left=e,this.domNode.style.left=this._left)}setBottom(i){let e=us(i);this._bottom!==e&&(this._bottom=e,this.domNode.style.bottom=this._bottom)}setRight(i){let e=us(i);this._right!==e&&(this._right=e,this.domNode.style.right=this._right)}setPaddingTop(i){let e=us(i);this._paddingTop!==e&&(this._paddingTop=e,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(i){let e=us(i);this._paddingLeft!==e&&(this._paddingLeft=e,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(i){let e=us(i);this._paddingBottom!==e&&(this._paddingBottom=e,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(i){let e=us(i);this._paddingRight!==e&&(this._paddingRight=e,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(i){this._fontFamily!==i&&(this._fontFamily=i,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(i){this._fontWeight!==i&&(this._fontWeight=i,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(i){let e=us(i);this._fontSize!==e&&(this._fontSize=e,this.domNode.style.fontSize=this._fontSize)}setFontStyle(i){this._fontStyle!==i&&(this._fontStyle=i,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(i){this._fontFeatureSettings!==i&&(this._fontFeatureSettings=i,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(i){this._fontVariationSettings!==i&&(this._fontVariationSettings=i,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(i){this._textDecoration!==i&&(this._textDecoration=i,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(i){let e=us(i);this._lineHeight!==e&&(this._lineHeight=e,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(i){let e=us(i);this._letterSpacing!==e&&(this._letterSpacing=e,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(i){this._className!==i&&(this._className=i,this.domNode.className=this._className)}toggleClassName(i,e){this.domNode.classList.toggle(i,e),this._className=this.domNode.className}setDisplay(i){this._display!==i&&(this._display=i,this.domNode.style.display=this._display)}setPosition(i){this._position!==i&&(this._position=i,this.domNode.style.position=this._position)}setVisibility(i){this._visibility!==i&&(this._visibility=i,this.domNode.style.visibility=this._visibility)}setColor(i){this._color!==i&&(this._color=i,this.domNode.style.color=this._color)}setBackgroundColor(i){this._backgroundColor!==i&&(this._backgroundColor=i,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(i){this._layerHint!==i&&(this._layerHint=i,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(i){this._boxShadow!==i&&(this._boxShadow=i,this.domNode.style.boxShadow=i)}setContain(i){this._contain!==i&&(this._contain=i,this.domNode.style.contain=this._contain)}setAttribute(i,e){this.domNode.setAttribute(i,e)}removeAttribute(i){this.domNode.removeAttribute(i)}appendChild(i){this.domNode.appendChild(i.domNode)}removeChild(i){this.domNode.removeChild(i.domNode)}};function us(i){return typeof i=="number"?`${i}px`:i}function Eu(i){return new pee(i)}var aD=class{constructor(){this._hooks=new Vo,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 s=this._onStopCallback;this._onStopCallback=null,e&&s&&s(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,s,r,n){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=n;let o=e;try{e.setPointerCapture(t),this._hooks.add(xt(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{o=Fr(e)}this._hooks.add(Qe(o,ci.POINTER_MOVE,l=>{if(l.buttons!==s){this.stopMonitoring(!0);return}l.preventDefault(),this._pointerMoveCallback(l)})),this._hooks.add(Qe(o,ci.POINTER_UP,l=>this.stopMonitoring(!0)))}};function mee(i,e,t){let s=null,r=null;if(typeof t.value=="function"?(s="value",r=t.value,r.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(s="get",r=t.get),!r)throw new Error("not supported");let n=`$memoize$${e}`;t[s]=function(...o){return this.hasOwnProperty(n)||Object.defineProperty(this,n,{configurable:!1,enumerable:!1,writable:!1,value:r.apply(this,o)}),this[n]}}var Vr;(i=>(i.Tap="-xterm-gesturetap",i.Change="-xterm-gesturechange",i.Start="-xterm-gesturestart",i.End="-xterm-gesturesend",i.Contextmenu="-xterm-gesturecontextmenu"))(Vr||(Vr={}));var uu=class Xi extends Xe{constructor(){super(),this.dispatched=!1,this.targets=new HM,this.ignoreTargets=new HM,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(Di.runAndSubscribe(cee,({window:e,disposables:t})=>{t.add(Qe(e.document,"touchstart",s=>this.onTouchStart(s),{passive:!1})),t.add(Qe(e.document,"touchend",s=>this.onTouchEnd(e,s))),t.add(Qe(e.document,"touchmove",s=>this.onTouchMove(s),{passive:!1}))},{window:zn,disposables:this._store}))}static addTarget(e){if(!Xi.isTouchDevice())return Xe.None;Xi.INSTANCE||(Xi.INSTANCE=new Xi);let t=Xi.INSTANCE.targets.push(e);return xt(t)}static ignoreTarget(e){if(!Xi.isTouchDevice())return Xe.None;Xi.INSTANCE||(Xi.INSTANCE=new Xi);let t=Xi.INSTANCE.ignoreTargets.push(e);return xt(t)}static isTouchDevice(){return"ontouchstart"in zn||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let s=0,r=e.targetTouches.length;s<r;s++){let n=e.targetTouches.item(s);this.activeTouches[n.identifier]={id:n.identifier,initialTarget:n.target,initialTimeStamp:t,initialPageX:n.pageX,initialPageY:n.pageY,rollingTimestamps:[t],rollingPageX:[n.pageX],rollingPageY:[n.pageY]};let o=this.newGestureEvent(Vr.Start,n.target);o.pageX=n.pageX,o.pageY=n.pageY,this.dispatchEvent(o)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){let s=Date.now(),r=Object.keys(this.activeTouches).length;for(let n=0,o=t.changedTouches.length;n<o;n++){let l=t.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(l.identifier))){console.warn("move of an UNKNOWN touch",l);continue}let c=this.activeTouches[l.identifier],u=Date.now()-c.initialTimeStamp;if(u<Xi.HOLD_DELAY&&Math.abs(c.initialPageX-Qs(c.rollingPageX))<30&&Math.abs(c.initialPageY-Qs(c.rollingPageY))<30){let d=this.newGestureEvent(Vr.Tap,c.initialTarget);d.pageX=Qs(c.rollingPageX),d.pageY=Qs(c.rollingPageY),this.dispatchEvent(d)}else if(u>=Xi.HOLD_DELAY&&Math.abs(c.initialPageX-Qs(c.rollingPageX))<30&&Math.abs(c.initialPageY-Qs(c.rollingPageY))<30){let d=this.newGestureEvent(Vr.Contextmenu,c.initialTarget);d.pageX=Qs(c.rollingPageX),d.pageY=Qs(c.rollingPageY),this.dispatchEvent(d)}else if(r===1){let d=Qs(c.rollingPageX),m=Qs(c.rollingPageY),g=Qs(c.rollingTimestamps)-c.rollingTimestamps[0],_=d-c.rollingPageX[0],y=m-c.rollingPageY[0],b=[...this.targets].filter(x=>c.initialTarget instanceof Node&&x.contains(c.initialTarget));this.inertia(e,b,s,Math.abs(_)/g,_>0?1:-1,d,Math.abs(y)/g,y>0?1:-1,m)}this.dispatchEvent(this.newGestureEvent(Vr.End,c.initialTarget)),delete this.activeTouches[l.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){let s=document.createEvent("CustomEvent");return s.initEvent(e,!1,!0),s.initialTarget=t,s.tapCount=0,s}dispatchEvent(e){if(e.type===Vr.Tap){let t=new Date().getTime(),s=0;t-this._lastSetTapCountTime>Xi.CLEAR_TAP_COUNT_TIME?s=1:s=2,this._lastSetTapCountTime=t,e.tapCount=s}else(e.type===Vr.Change||e.type===Vr.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(let s of this.ignoreTargets)if(s.contains(e.initialTarget))return;let t=[];for(let s of this.targets)if(s.contains(e.initialTarget)){let r=0,n=e.initialTarget;for(;n&&n!==s;)r++,n=n.parentElement;t.push([r,s])}t.sort((s,r)=>s[0]-r[0]);for(let[s,r]of t)r.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,s,r,n,o,l,c,u){this.handle=GS(e,()=>{let d=Date.now(),m=d-s,g=0,_=0,y=!0;r+=Xi.SCROLL_FRICTION*m,l+=Xi.SCROLL_FRICTION*m,r>0&&(y=!1,g=n*r*m),l>0&&(y=!1,_=c*l*m);let b=this.newGestureEvent(Vr.Change);b.translationX=g,b.translationY=_,t.forEach(x=>x.dispatchEvent(b)),y||this.inertia(e,t,d,r,n,o+g,l,c,u+_)})}onTouchMove(e){let t=Date.now();for(let s=0,r=e.changedTouches.length;s<r;s++){let n=e.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(n.identifier))){console.warn("end of an UNKNOWN touch",n);continue}let o=this.activeTouches[n.identifier],l=this.newGestureEvent(Vr.Change,o.initialTarget);l.translationX=n.pageX-Qs(o.rollingPageX),l.translationY=n.pageY-Qs(o.rollingPageY),l.pageX=n.pageX,l.pageY=n.pageY,this.dispatchEvent(l),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(n.pageX),o.rollingPageY.push(n.pageY),o.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};uu.SCROLL_FRICTION=-.005,uu.HOLD_DELAY=700,uu.CLEAR_TAP_COUNT_TIME=400,Lt([mee],uu,"isTouchDevice",1);var gee=uu,KS=class extends Xe{onclick(e,t){this._register(Qe(e,ci.CLICK,s=>t(new Tp(Fr(e),s))))}onmousedown(e,t){this._register(Qe(e,ci.MOUSE_DOWN,s=>t(new Tp(Fr(e),s))))}onmouseover(e,t){this._register(Qe(e,ci.MOUSE_OVER,s=>t(new Tp(Fr(e),s))))}onmouseleave(e,t){this._register(Qe(e,ci.MOUSE_LEAVE,s=>t(new Tp(Fr(e),s))))}onkeydown(e,t){this._register(Qe(e,ci.KEY_DOWN,s=>t(new eE(s))))}onkeyup(e,t){this._register(Qe(e,ci.KEY_UP,s=>t(new eE(s))))}oninput(e,t){this._register(Qe(e,ci.INPUT,t))}onblur(e,t){this._register(Qe(e,ci.BLUR,t))}onfocus(e,t){this._register(Qe(e,ci.FOCUS,t))}onchange(e,t){this._register(Qe(e,ci.CHANGE,t))}ignoreGesture(e){return gee.ignoreTarget(e)}},oE=11,Oee=class extends KS{constructor(i){super(),this._onActivate=i.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=i.bgWidth+"px",this.bgDomNode.style.height=i.bgHeight+"px",typeof i.top<"u"&&(this.bgDomNode.style.top="0px"),typeof i.left<"u"&&(this.bgDomNode.style.left="0px"),typeof i.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof i.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=i.className,this.domNode.style.position="absolute",this.domNode.style.width=oE+"px",this.domNode.style.height=oE+"px",typeof i.top<"u"&&(this.domNode.style.top=i.top+"px"),typeof i.left<"u"&&(this.domNode.style.left=i.left+"px"),typeof i.bottom<"u"&&(this.domNode.style.bottom=i.bottom+"px"),typeof i.right<"u"&&(this.domNode.style.right=i.right+"px"),this._pointerMoveMonitor=this._register(new aD),this._register(rE(this.bgDomNode,ci.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register(rE(this.domNode,ci.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new fee),this._pointerdownScheduleRepeatTimer=this._register(new FS)}_arrowPointerDown(i){if(!i.target||!(i.target instanceof Element))return;let e=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,Fr(i))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(e,200),this._pointerMoveMonitor.startMonitoring(i.target,i.pointerId,i.buttons,t=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),i.preventDefault()}},_ee=class Dy{constructor(e,t,s,r,n,o,l){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,s=s|0,r=r|0,n=n|0,o=o|0,l=l|0),this.rawScrollLeft=r,this.rawScrollTop=l,t<0&&(t=0),r+t>s&&(r=s-t),r<0&&(r=0),n<0&&(n=0),l+n>o&&(l=o-n),l<0&&(l=0),this.width=t,this.scrollWidth=s,this.scrollLeft=r,this.height=n,this.scrollHeight=o,this.scrollTop=l}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new Dy(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new Dy(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let s=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,n=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,l=this.scrollHeight!==e.scrollHeight,c=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:s,scrollWidthChanged:r,scrollLeftChanged:n,heightChanged:o,scrollHeightChanged:l,scrollTopChanged:c}}},vee=class extends Xe{constructor(i){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._smoothScrollDuration=i.smoothScrollDuration,this._scheduleAtNextAnimationFrame=i.scheduleAtNextAnimationFrame,this._state=new _ee(i.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(i){this._smoothScrollDuration=i}validateScrollPosition(i){return this._state.withScrollPosition(i)}getScrollDimensions(){return this._state}setScrollDimensions(i,e){var s;let t=this._state.withScrollDimensions(i,e);this._setState(t,!!this._smoothScrolling),(s=this._smoothScrolling)==null||s.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(i){let e=this._state.withScrollPosition(i);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(e,!1)}setScrollPositionSmooth(i,e){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(i);if(this._smoothScrolling){i={scrollLeft:typeof i.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:i.scrollLeft,scrollTop:typeof i.scrollTop>"u"?this._smoothScrolling.to.scrollTop:i.scrollTop};let t=this._state.withScrollPosition(i);if(this._smoothScrolling.to.scrollLeft===t.scrollLeft&&this._smoothScrolling.to.scrollTop===t.scrollTop)return;let s;e?s=new lE(this._smoothScrolling.from,t,this._smoothScrolling.startTime,this._smoothScrolling.duration):s=this._smoothScrolling.combine(this._state,t,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=s}else{let t=this._state.withScrollPosition(i);this._smoothScrolling=lE.start(this._state,t,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 i=this._smoothScrolling.tick(),e=this._state.withScrollPosition(i);if(this._setState(e,!0),!!this._smoothScrolling){if(i.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(i,e){let t=this._state;t.equals(i)||(this._state=i,this._onScroll.fire(this._state.createScrollEvent(t,e)))}},aE=class{constructor(e,t,s){this.scrollLeft=e,this.scrollTop=t,this.isDone=s}};function Av(i,e){let t=e-i;return function(s){return i+t*See(s)}}function yee(i,e,t){return function(s){return s<t?i(s/t):e((s-t)/(1-t))}}var lE=class zy{constructor(e,t,s,r){this.from=e,this.to=t,this.duration=r,this.startTime=s,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(e,t,s){if(Math.abs(e-t)>2.5*s){let r,n;return e<t?(r=e+.75*s,n=t-.75*s):(r=e-.75*s,n=t+.75*s),yee(Av(e,r),Av(n,t),.33)}return Av(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;if(t<1){let s=this.scrollLeft(t),r=this.scrollTop(t);return new aE(s,r,!1)}return new aE(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,s){return zy.start(e,t,s)}static start(e,t,s){s=s+10;let r=Date.now()-10;return new zy(e,t,r,s)}};function bee(i){return Math.pow(i,3)}function See(i){return 1-bee(1-i)}var xee=class extends Xe{constructor(e,t,s){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=s,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new FS)}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":"")))}},wee=140,lD=class extends KS{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 xee(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new aD),this._shouldRender=!0,this.domNode=Eu(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(Qe(this.domNode.domNode,ci.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new Oee(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,s,r){this.slider=Eu(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof s=="number"&&this.slider.setWidth(s),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Qe(this.slider.domNode,ci.POINTER_DOWN,n=>{n.button===0&&(n.preventDefault(),this._sliderPointerDown(n))})),this.onclick(this.slider.domNode,n=>{n.leftButton&&n.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,s=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),n=this._sliderPointerPosition(e);s<=n&&n<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,s;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,s=e.offsetY;else{let n=dee(this.domNode.domNode);t=e.pageX-n.left,s=e.pageY-n.top}let r=this._pointerDownRelativePosition(t,s);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),s=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{let o=this._sliderOrthogonalPointerPosition(n),l=Math.abs(o-s);if(sD&&l>wee){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let c=this._sliderPointerPosition(n)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(c))},()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},hD=class Ny{constructor(e,t,s,r,n,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(s),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=n,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Ny(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t?(this._visibleSize=t,this._refreshComputedValues(),!0):!1}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,s,r,n){let o=Math.max(0,s-e),l=Math.max(0,o-2*t),c=r>0&&r>s;if(!c)return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(l),computedSliderRatio:0,computedSliderPosition:0};let u=Math.round(Math.max(20,Math.floor(s*l/r))),d=(l-u)/(r-s),m=n*d;return{computedAvailableSize:Math.round(o),computedIsNeeded:c,computedSliderSize:Math.round(u),computedSliderRatio:d,computedSliderPosition:Math.round(m)}}_refreshComputedValues(){let e=Ny._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.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(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,s=this._scrollPosition;return t<this._computedSliderPosition?s-=this._visibleSize:s+=this._visibleSize,s}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},Cee=class extends lD{constructor(e,t,s){let r=e.getScrollDimensions(),n=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:s,scrollbarState:new hD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,n.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}},kee=class extends lD{constructor(i,e,t){let s=i.getScrollDimensions(),r=i.getCurrentScrollPosition();if(super({lazyRender:e.lazyRender,host:t,scrollbarState:new hD(e.verticalHasArrows?e.arrowSize:0,e.vertical===2?0:e.verticalScrollbarSize,0,s.height,s.scrollHeight,r.scrollTop),visibility:e.vertical,extraScrollbarClassName:"vertical",scrollable:i,scrollByPage:e.scrollByPage}),e.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((e.verticalScrollbarSize-e.verticalSliderSize)/2),e.verticalSliderSize,void 0)}_updateSlider(i,e){this.slider.setHeight(i),this.slider.setTop(e)}_renderDomNode(i,e){this.domNode.setWidth(e),this.domNode.setHeight(i),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(i){return this._shouldRender=this._onElementScrollSize(i.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(i.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(i.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(i,e){return e}_sliderPointerPosition(i){return i.pageY}_sliderOrthogonalPointerPosition(i){return i.pageX}_updateScrollbarSize(i){this.slider.setWidth(i)}writeScrollPosition(i,e){i.scrollTop=e}updateOptions(i){this.updateScrollbarSize(i.vertical===2?0:i.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(i.vertical),this._scrollByPage=i.scrollByPage}},Tee=500,hE=50,Aee=class{constructor(e,t,s){this.timestamp=e,this.deltaX=t,this.deltaY=s,this.score=0}},Xy=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,s=1,r=this._rear;do{let n=r===this._front?e:Math.pow(2,-s);if(e-=n,t+=this._memory[r].score*n,r===this._front)break;r=(this._capacity+r-1)%this._capacity,s++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(YS){let t=Fr(e.browserEvent),s=NJ(t);this.accept(Date.now(),e.deltaX*s,e.deltaY*s)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,s){let r=null,n=new Aee(e,t,s);this._front===-1&&this._rear===-1?(this._memory[0]=n,this._front=0,this._rear=0):(r=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]=n),n.score=this._computeScore(n,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let s=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(s+=.25),t){let r=Math.abs(e.deltaX),n=Math.abs(e.deltaY),o=Math.abs(t.deltaX),l=Math.abs(t.deltaY),c=Math.max(Math.min(r,o),1),u=Math.max(Math.min(n,l),1),d=Math.max(r,o),m=Math.max(n,l);d%c===0&&m%u===0&&(s-=.5)}return Math.min(Math.max(s,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Xy.INSTANCE=new Xy;var Mee=Xy,Eee=class extends KS{constructor(i,e,t){super(),this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new fe),this.onWillScroll=this._onWillScroll.event,this._options=Qee(e),this._scrollable=t,this._register(this._scrollable.onScroll(r=>{this._onWillScroll.fire(r),this._onDidScroll(r),this._onScroll.fire(r)}));let s={onMouseWheel:r=>this._onMouseWheel(r),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new kee(this._scrollable,this._options,s)),this._horizontalScrollbar=this._register(new Cee(this._scrollable,this._options,s)),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(i),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Eu(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Eu(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Eu(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,r=>this._onMouseOver(r)),this.onmouseleave(this._listenOnDomNode,r=>this._onMouseLeave(r)),this._hideTimeout=this._register(new FS),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Ua(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(i){this._verticalScrollbar.delegatePointerDown(i)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(i){this._scrollable.setScrollDimensions(i,!1)}updateClassName(i){this._options.className=i,en&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(i){typeof i.handleMouseWheel<"u"&&(this._options.handleMouseWheel=i.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof i.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=i.mouseWheelScrollSensitivity),typeof i.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=i.fastScrollSensitivity),typeof i.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=i.scrollPredominantAxis),typeof i.horizontal<"u"&&(this._options.horizontal=i.horizontal),typeof i.vertical<"u"&&(this._options.vertical=i.vertical),typeof i.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=i.horizontalScrollbarSize),typeof i.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=i.verticalScrollbarSize),typeof i.scrollByPage<"u"&&(this._options.scrollByPage=i.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(i){this._revealOnScroll=i}delegateScrollFromMouseWheelEvent(i){this._onMouseWheel(new iE(i))}_setListeningToMouseWheel(i){if(this._mouseWheelToDispose.length>0!==i&&(this._mouseWheelToDispose=Ua(this._mouseWheelToDispose),i)){let e=t=>{this._onMouseWheel(new iE(t))};this._mouseWheelToDispose.push(Qe(this._listenOnDomNode,ci.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(i){var r;if((r=i.browserEvent)!=null&&r.defaultPrevented)return;let e=Mee.INSTANCE;e.acceptStandardWheelEvent(i);let t=!1;if(i.deltaY||i.deltaX){let n=i.deltaY*this._options.mouseWheelScrollSensitivity,o=i.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+n===0?o=n=0:Math.abs(n)>=Math.abs(o)?o=0:n=0),this._options.flipAxes&&([n,o]=[o,n]);let l=!en&&i.browserEvent&&i.browserEvent.shiftKey;(this._options.scrollYToX||l)&&!o&&(o=n,n=0),i.browserEvent&&i.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,n=n*this._options.fastScrollSensitivity);let c=this._scrollable.getFutureScrollPosition(),u={};if(n){let d=hE*n,m=c.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(u,m)}if(o){let d=hE*o,m=c.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(u,m)}u=this._scrollable.validateScrollPosition(u),(c.scrollLeft!==u.scrollLeft||c.scrollTop!==u.scrollTop)&&(this._options.mouseWheelSmoothScroll&&e.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(u):this._scrollable.setScrollPositionNow(u),t=!0)}let s=t;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(i.preventDefault(),i.stopPropagation())}_onDidScroll(i){this._shouldRender=this._horizontalScrollbar.onDidScroll(i)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(i)||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 i=this._scrollable.getCurrentScrollPosition(),e=i.scrollTop>0,t=i.scrollLeft>0,s=t?" left":"",r=e?" top":"",n=t||e?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${s}`),this._topShadowDomNode.setClassName(`shadow${r}`),this._topLeftShadowDomNode.setClassName(`shadow${n}${r}${s}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(i){this._mouseIsOver=!1,this._hide()}_onMouseOver(i){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(),Tee)}},Pee=class extends Eee{constructor(e,t,s){super(e,t,s)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function Qee(i){let e={lazyRender:typeof i.lazyRender<"u"?i.lazyRender:!1,className:typeof i.className<"u"?i.className:"",useShadows:typeof i.useShadows<"u"?i.useShadows:!0,handleMouseWheel:typeof i.handleMouseWheel<"u"?i.handleMouseWheel:!0,flipAxes:typeof i.flipAxes<"u"?i.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof i.consumeMouseWheelIfScrollbarIsNeeded<"u"?i.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof i.alwaysConsumeMouseWheel<"u"?i.alwaysConsumeMouseWheel:!1,scrollYToX:typeof i.scrollYToX<"u"?i.scrollYToX:!1,mouseWheelScrollSensitivity:typeof i.mouseWheelScrollSensitivity<"u"?i.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof i.fastScrollSensitivity<"u"?i.fastScrollSensitivity:5,scrollPredominantAxis:typeof i.scrollPredominantAxis<"u"?i.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof i.mouseWheelSmoothScroll<"u"?i.mouseWheelSmoothScroll:!0,arrowSize:typeof i.arrowSize<"u"?i.arrowSize:11,listenOnDomNode:typeof i.listenOnDomNode<"u"?i.listenOnDomNode:null,horizontal:typeof i.horizontal<"u"?i.horizontal:1,horizontalScrollbarSize:typeof i.horizontalScrollbarSize<"u"?i.horizontalScrollbarSize:10,horizontalSliderSize:typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:0,horizontalHasArrows:typeof i.horizontalHasArrows<"u"?i.horizontalHasArrows:!1,vertical:typeof i.vertical<"u"?i.vertical:1,verticalScrollbarSize:typeof i.verticalScrollbarSize<"u"?i.verticalScrollbarSize:10,verticalHasArrows:typeof i.verticalHasArrows<"u"?i.verticalHasArrows:!1,verticalSliderSize:typeof i.verticalSliderSize<"u"?i.verticalSliderSize:0,scrollByPage:typeof i.scrollByPage<"u"?i.scrollByPage:!1};return e.horizontalSliderSize=typeof i.horizontalSliderSize<"u"?i.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof i.verticalSliderSize<"u"?i.verticalSliderSize:e.verticalScrollbarSize,en&&(e.className+=" mac"),e}var Vy=class extends Xe{constructor(e,t,s,r,n,o,l,c){super(),this._bufferService=s,this._optionsService=l,this._renderService=c,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let u=this._register(new vee({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:d=>GS(r.window,d)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{u.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Pee(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},u)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(n.onProtocolChange(d=>{this._scrollableElement.updateOptions({handleMouseWheel:!(d&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(Di.runAndSubscribe(o.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=o.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(xt(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(xt(()=>this._styleElement.remove())),this._register(Di.runAndSubscribe(o.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${o.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${o.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${o.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
105
|
+
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(d=>this._handleScroll(d)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),s=t-this._bufferService.buffer.ydisp;s!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(s)),this._isHandlingScroll=!1}};Vy=Lt([Oe(2,is),Oe(3,Un),Oe(4,jB),Oe(5,Dh),Oe(6,ss),Oe(7,Yn)],Vy);var Zy=class extends Xe{constructor(e,t,s,r,n){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=s,this._decorationService=r,this._renderService=n,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(o=>this._removeDecoration(o))),this._register(xt(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let s=e.options.x??0;return s&&s>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 s=this._decorationElements.get(e);s||(s=this._createElement(e),e.element=s,this._decorationElements.set(e,s),this._container.appendChild(s),e.onDispose(()=>{this._decorationElements.delete(e),s.remove()})),s.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(s.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,s.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,s.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,s.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(s)}}_refreshXPosition(e,t=e.element){if(!t)return;let s=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=s?`${s*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=s?`${s*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()}};Zy=Lt([Oe(1,is),Oe(2,Un),Oe(3,Mf),Oe(4,Yn)],Zy);var Ree=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,s){return t>=e.startBufferLine-this._linePadding[s||"full"]&&t<=e.endBufferLine+this._linePadding[s||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Dr={full:0,left:0,center:0,right:0},ko={full:0,left:0,center:0,right:0},Hc={full:0,left:0,center:0,right:0},Km=class extends Xe{constructor(e,t,s,r,n,o,l,c){var d;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=s,this._decorationService=r,this._renderService=n,this._optionsService=o,this._themeService=l,this._coreBrowserService=c,this._colorZoneStore=new Ree,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(d=this._viewportElement.parentElement)==null||d.insertBefore(this._canvas,this._viewportElement),this._register(xt(()=>{var m;return(m=this._canvas)==null?void 0:m.remove()}));let u=this._canvas.getContext("2d");if(u)this._ctx=u;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);ko.full=this._canvas.width,ko.left=e,ko.center=t,ko.right=e,this._refreshDrawHeightConstants(),Hc.full=1,Hc.left=1,Hc.center=1+ko.left,Hc.right=1+ko.left+ko.center}_refreshDrawHeightConstants(){Dr.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);Dr.left=t,Dr.center=t,Dr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Dr.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(Hc[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Dr[e.position||"full"]/2),ko[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Dr[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}))}};Km=Lt([Oe(2,is),Oe(3,Mf),Oe(4,Yn),Oe(5,ss),Oe(6,Dh),Oe(7,Un)],Km);var le;(i=>(i.NUL="\0",i.SOH="",i.STX="",i.ETX="",i.EOT="",i.ENQ="",i.ACK="",i.BEL="\x07",i.BS="\b",i.HT=" ",i.LF=`
|
|
106
|
+
`,i.VT="\v",i.FF="\f",i.CR="\r",i.SO="",i.SI="",i.DLE="",i.DC1="",i.DC2="",i.DC3="",i.DC4="",i.NAK="",i.SYN="",i.ETB="",i.CAN="",i.EM="",i.SUB="",i.ESC="\x1B",i.FS="",i.GS="",i.RS="",i.US="",i.SP=" ",i.DEL=""))(le||(le={}));var sm;(i=>(i.PAD="",i.HOP="",i.BPH="",i.NBH="",i.IND="",i.NEL="
",i.SSA="",i.ESA="",i.HTS="",i.HTJ="",i.VTS="",i.PLD="",i.PLU="",i.RI="",i.SS2="",i.SS3="",i.DCS="",i.PU1="",i.PU2="",i.STS="",i.CCH="",i.MW="",i.SPA="",i.EPA="",i.SOS="",i.SGCI="",i.SCI="",i.CSI="",i.ST="",i.OSC="",i.PM="",i.APC=""))(sm||(sm={}));var cD;(i=>i.ST=`${le.ESC}\\`)(cD||(cD={}));var jy=class{constructor(e,t,s,r,n,o){this._textarea=e,this._compositionView=t,this._bufferService=s,this._optionsService=r,this._coreService=n,this._renderService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let s;t.start+=this._dataAlreadySent.length,this._isComposing?s=this._textarea.value.substring(t.start,this._compositionPosition.start):s=this._textarea.value.substring(t.start),s.length>0&&this._coreService.triggerDataEvent(s,!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,s=t.replace(e,"");this._dataAlreadySent=s,t.length>e.length?this._coreService.triggerDataEvent(s,!0):t.length<e.length?this._coreService.triggerDataEvent(`${le.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),s=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,n=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=n+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=s+"px",this._compositionView.style.lineHeight=s+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let o=this._compositionView.getBoundingClientRect();this._textarea.style.left=n+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(o.width,1)+"px",this._textarea.style.height=Math.max(o.height,1)+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};jy=Lt([Oe(2,is),Oe(3,ss),Oe(4,Ja),Oe(5,Yn)],jy);var ui=0,fi=0,di=0,Pt=0,cE={css:"#00000000",rgba:0},Ut;(i=>{function e(r,n,o,l){return l!==void 0?`#${ya(r)}${ya(n)}${ya(o)}${ya(l)}`:`#${ya(r)}${ya(n)}${ya(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Ut||(Ut={}));var vt;(i=>{function e(c,u){if(Pt=(u.rgba&255)/255,Pt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,m=u.rgba>>16&255,g=u.rgba>>8&255,_=c.rgba>>24&255,y=c.rgba>>16&255,b=c.rgba>>8&255;ui=_+Math.round((d-_)*Pt),fi=y+Math.round((m-y)*Pt),di=b+Math.round((g-b)*Pt);let x=Ut.toCss(ui,fi,di),w=Ut.toRgba(ui,fi,di);return{css:x,rgba:w}}i.blend=e;function t(c){return(c.rgba&255)===255}i.isOpaque=t;function s(c,u,d){let m=rm.ensureContrastRatio(c.rgba,u.rgba,d);if(m)return Ut.toColor(m>>24&255,m>>16&255,m>>8&255)}i.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[ui,fi,di]=rm.toChannels(u),{css:Ut.toCss(ui,fi,di),rgba:u}}i.opaque=r;function n(c,u){return Pt=Math.round(u*255),[ui,fi,di]=rm.toChannels(c.rgba),{css:Ut.toCss(ui,fi,di,Pt),rgba:Ut.toRgba(ui,fi,di,Pt)}}i.opacity=n;function o(c,u){return Pt=c.rgba&255,n(c,Pt*u/255)}i.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}i.toColorRGB=l})(vt||(vt={}));var Ct;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return ui=parseInt(r.slice(1,2).repeat(2),16),fi=parseInt(r.slice(2,3).repeat(2),16),di=parseInt(r.slice(3,4).repeat(2),16),Ut.toColor(ui,fi,di);case 5:return ui=parseInt(r.slice(1,2).repeat(2),16),fi=parseInt(r.slice(2,3).repeat(2),16),di=parseInt(r.slice(3,4).repeat(2),16),Pt=parseInt(r.slice(4,5).repeat(2),16),Ut.toColor(ui,fi,di,Pt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return ui=parseInt(n[1]),fi=parseInt(n[2]),di=parseInt(n[3]),Pt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ut.toColor(ui,fi,di,Pt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[ui,fi,di,Pt]=e.getImageData(0,0,1,1).data,Pt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ut.toRgba(ui,fi,di,Pt),css:r}}i.toColor=s})(Ct||(Ct={}));var Yi;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,l=r/255,c=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+m*.0722}i.relativeLuminance2=t})(Yi||(Yi={}));var rm;(i=>{function e(o,l){if(Pt=(l&255)/255,Pt===1)return l;let c=l>>24&255,u=l>>16&255,d=l>>8&255,m=o>>24&255,g=o>>16&255,_=o>>8&255;return ui=m+Math.round((c-m)*Pt),fi=g+Math.round((u-g)*Pt),di=_+Math.round((d-_)*Pt),Ut.toRgba(ui,fi,di)}i.blend=e;function t(o,l,c){let u=Yi.relativeLuminance(o>>8),d=Yi.relativeLuminance(l>>8);if(Mn(u,d)<c){if(d<u){let _=s(o,l,c),y=Mn(u,Yi.relativeLuminance(_>>8));if(y<c){let b=r(o,l,c),x=Mn(u,Yi.relativeLuminance(b>>8));return y>x?_:b}return _}let m=r(o,l,c),g=Mn(u,Yi.relativeLuminance(m>>8));if(g<c){let _=s(o,l,c),y=Mn(u,Yi.relativeLuminance(_>>8));return g>y?m:_}return m}}i.ensureContrastRatio=t;function s(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));for(;b<c&&(g>0||_>0||y>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.reduceLuminance=s;function r(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));for(;b<c&&(g<255||_<255||y<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Mn(Yi.relativeLuminance2(g,_,y),Yi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(rm||(rm={}));function ya(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Mn(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}var Lee=class extends Af{constructor(e,t,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=s}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()]}},Jm=class{constructor(i){this._bufferService=i,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new lr}register(i){let e={id:this._nextCharacterJoinerId++,handler:i};return this._characterJoiners.push(e),e.id}deregister(i){for(let e=0;e<this._characterJoiners.length;e++)if(this._characterJoiners[e].id===i)return this._characterJoiners.splice(e,1),!0;return!1}getJoinedCharacters(i){if(this._characterJoiners.length===0)return[];let e=this._bufferService.buffer.lines.get(i);if(!e||e.length===0)return[];let t=[],s=e.translateToString(!0),r=0,n=0,o=0,l=e.getFg(0),c=e.getBg(0);for(let u=0;u<e.getTrimmedLength();u++)if(e.loadCell(u,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==l||this._workCell.bg!==c){if(u-r>1){let d=this._getJoinedRanges(s,o,n,e,r);for(let m=0;m<d.length;m++)t.push(d[m])}r=u,o=n,l=this._workCell.fg,c=this._workCell.bg}n+=this._workCell.getChars().length||No.length}if(this._bufferService.cols-r>1){let u=this._getJoinedRanges(s,o,n,e,r);for(let d=0;d<u.length;d++)t.push(u[d])}return t}_getJoinedRanges(i,e,t,s,r){let n=i.substring(e,t),o=[];try{o=this._characterJoiners[0].handler(n)}catch(l){console.error(l)}for(let l=1;l<this._characterJoiners.length;l++)try{let c=this._characterJoiners[l].handler(n);for(let u=0;u<c.length;u++)Jm._mergeRanges(o,c[u])}catch(c){console.error(c)}return this._stringRangesToCellRanges(o,s,r),o}_stringRangesToCellRanges(i,e,t){let s=0,r=!1,n=0,o=i[s];if(o){for(let l=t;l<this._bufferService.cols;l++){let c=e.getWidth(l),u=e.getString(l).length||No.length;if(c!==0){if(!r&&o[0]<=n&&(o[0]=l,r=!0),o[1]<=n){if(o[1]=l,o=i[++s],!o)break;o[0]<=n?(o[0]=l,r=!0):r=!1}n+=u}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(i,e){let t=!1;for(let s=0;s<i.length;s++){let r=i[s];if(t){if(e[1]<=r[0])return i[s-1][1]=e[1],i;if(e[1]<=r[1])return i[s-1][1]=Math.max(e[1],r[1]),i.splice(s,1),i;i.splice(s,1),s--}else{if(e[1]<=r[0])return i.splice(s,0,e),i;if(e[1]<=r[1])return r[0]=Math.min(e[0],r[0]),i;e[0]<r[1]&&(r[0]=Math.min(e[0],r[0]),t=!0);continue}}return t?i[i.length-1][1]=e[1]:i.push(e),i}};Jm=Lt([Oe(0,is)],Jm);function $ee(i){return 57508<=i&&i<=57558}function Bee(i){return 9472<=i&&i<=9631}function Dee(i){return $ee(i)||Bee(i)}function zee(){return{css:{canvas:Ap(),cell:Ap()},device:{canvas:Ap(),cell:Ap(),char:{width:0,height:0,left:0,top:0}}}}function Ap(){return{width:0,height:0}}var Iy=class{constructor(e,t,s,r,n,o,l){this._document=e,this._characterJoinerService=t,this._optionsService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._themeService=l,this._workCell=new lr,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,s){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=s}createRow(e,t,s,r,n,o,l,c,u,d,m){let g=[],_=this._characterJoinerService.getJoinedCharacters(t),y=this._themeService.colors,b=e.getNoBgTrimmedLength();s&&b<o+1&&(b=o+1);let x,w=0,k="",C=0,A=0,P=0,E=0,$=!1,z=0,I=!1,se=0,F=0,R=[],L=d!==-1&&m!==-1;for(let N=0;N<b;N++){e.loadCell(N,this._workCell);let Z=this._workCell.getWidth();if(Z===0)continue;let Q=!1,X=N>=F,W=N,U=this._workCell;if(_.length>0&&N===_[0][0]&&X){let Pe=_.shift(),ln=this._isCellInSelection(Pe[0],t);for(C=Pe[0]+1;C<Pe[1];C++)X&&(X=ln===this._isCellInSelection(C,t));X&&(X=!s||o<Pe[0]||o>=Pe[1]),X?(Q=!0,U=new Lee(this._workCell,e.translateToString(!0,Pe[0],Pe[1]),Pe[1]-Pe[0]),W=Pe[1]-1,Z=U.getWidth()):F=Pe[1]}let q=this._isCellInSelection(N,t),D=s&&N===o,G=L&&N>=d&&N<=m,ie=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Pe=>{ie=!0});let ce=U.getChars()||No;if(ce===" "&&(U.isUnderline()||U.isOverline())&&(ce=" "),se=Z*c-u.get(ce,U.isBold(),U.isItalic()),!x)x=this._document.createElement("span");else if(w&&(q&&I||!q&&!I&&U.bg===A)&&(q&&I&&y.selectionForeground||U.fg===P)&&U.extended.ext===E&&G===$&&se===z&&!D&&!Q&&!ie&&X){U.isInvisible()?k+=No:k+=ce,w++;continue}else w&&(x.textContent=k),x=this._document.createElement("span"),w=0,k="";if(A=U.bg,P=U.fg,E=U.extended.ext,$=G,z=se,I=q,Q&&o>=N&&o<=W&&(o=N),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)l&&R.push("xterm-cursor-blink"),R.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(n)switch(n){case"outline":R.push("xterm-cursor-outline");break;case"block":R.push("xterm-cursor-block");break;case"bar":R.push("xterm-cursor-bar");break;case"underline":R.push("xterm-cursor-underline");break}}if(U.isBold()&&R.push("xterm-bold"),U.isItalic()&&R.push("xterm-italic"),U.isDim()&&R.push("xterm-dim"),U.isInvisible()?k=No:k=U.getChars()||No,U.isUnderline()&&(R.push(`xterm-underline-${U.extended.underlineStyle}`),k===" "&&(k=" "),!U.isUnderlineColorDefault()))if(U.isUnderlineColorRGB())x.style.textDecorationColor=`rgb(${Af.toColorRGB(U.getUnderlineColor()).join(",")})`;else{let Pe=U.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&U.isBold()&&Pe<8&&(Pe+=8),x.style.textDecorationColor=y.ansi[Pe].css}U.isOverline()&&(R.push("xterm-overline"),k===" "&&(k=" ")),U.isStrikethrough()&&R.push("xterm-strikethrough"),G&&(x.style.textDecoration="underline");let he=U.getFgColor(),de=U.getFgColorMode(),ge=U.getBgColor(),Ae=U.getBgColorMode(),ye=!!U.isInverse();if(ye){let Pe=he;he=ge,ge=Pe;let ln=de;de=Ae,Ae=ln}let mt,Ft,Gt=!1;this._decorationService.forEachDecorationAtCell(N,t,void 0,Pe=>{Pe.options.layer!=="top"&&Gt||(Pe.backgroundColorRGB&&(Ae=50331648,ge=Pe.backgroundColorRGB.rgba>>8&16777215,mt=Pe.backgroundColorRGB),Pe.foregroundColorRGB&&(de=50331648,he=Pe.foregroundColorRGB.rgba>>8&16777215,Ft=Pe.foregroundColorRGB),Gt=Pe.options.layer==="top")}),!Gt&&q&&(mt=this._coreBrowserService.isFocused?y.selectionBackgroundOpaque:y.selectionInactiveBackgroundOpaque,ge=mt.rgba>>8&16777215,Ae=50331648,Gt=!0,y.selectionForeground&&(de=50331648,he=y.selectionForeground.rgba>>8&16777215,Ft=y.selectionForeground)),Gt&&R.push("xterm-decoration-top");let oi;switch(Ae){case 16777216:case 33554432:oi=y.ansi[ge],R.push(`xterm-bg-${ge}`);break;case 50331648:oi=Ut.toColor(ge>>16,ge>>8&255,ge&255),this._addStyle(x,`background-color:#${uE((ge>>>0).toString(16),"0",6)}`);break;case 0:default:ye?(oi=y.foreground,R.push("xterm-bg-257")):oi=y.background}switch(mt||U.isDim()&&(mt=vt.multiplyOpacity(oi,.5)),de){case 16777216:case 33554432:U.isBold()&&he<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(he+=8),this._applyMinimumContrast(x,oi,y.ansi[he],U,mt,void 0)||R.push(`xterm-fg-${he}`);break;case 50331648:let Pe=Ut.toColor(he>>16&255,he>>8&255,he&255);this._applyMinimumContrast(x,oi,Pe,U,mt,Ft)||this._addStyle(x,`color:#${uE(he.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(x,oi,y.foreground,U,mt,Ft)||ye&&R.push("xterm-fg-257")}R.length&&(x.className=R.join(" "),R.length=0),!D&&!Q&&!ie&&X?w++:x.textContent=k,se!==this.defaultSpacing&&(x.style.letterSpacing=`${se}px`),g.push(x),N=W}return x&&w&&(x.textContent=k),g}_applyMinimumContrast(e,t,s,r,n,o){if(this._optionsService.rawOptions.minimumContrastRatio===1||Dee(r.getCode()))return!1;let l=this._getContrastCache(r),c;if(!n&&!o&&(c=l.getColor(t.rgba,s.rgba)),c===void 0){let u=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);c=vt.ensureContrastRatio(n||t,o||s,u),l.setColor((n||t).rgba,(o||s).rgba,c??null)}return c?(this._addStyle(e,`color:${c.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let s=this._selectionStart,r=this._selectionEnd;return!s||!r?!1:this._columnSelectMode?s[0]<=r[0]?e>=s[0]&&t>=s[1]&&e<r[0]&&t<=r[1]:e<s[0]&&t>=s[1]&&e>=r[0]&&t<=r[1]:t>s[1]&&t<r[1]||s[1]===r[1]&&t===s[1]&&e>=s[0]&&e<r[0]||s[1]<r[1]&&t===r[1]&&e<r[0]||s[1]<r[1]&&t===s[1]&&e>=s[0]}};Iy=Lt([Oe(1,WB),Oe(2,ss),Oe(3,Un),Oe(4,Ja),Oe(5,Mf),Oe(6,Dh)],Iy);function uE(i,e,t){for(;i.length<t;)i=e+i;return i}var Nee=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 s=e.createElement("span");s.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let n=e.createElement("span");n.classList.add("xterm-char-measure-element"),n.style.fontStyle="italic";let o=e.createElement("span");o.classList.add("xterm-char-measure-element"),o.style.fontWeight="bold",o.style.fontStyle="italic",this._measureElements=[s,r,n,o],this._container.appendChild(s),this._container.appendChild(r),this._container.appendChild(n),this._container.appendChild(o),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,s,r){e===this._font&&t===this._fontSize&&s===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=s,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${s}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${s}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,s){let r=0;if(!t&&!s&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let l=this._measure(e,0);return l>0&&(this._flat[r]=l),l}let n=e;t&&(n+="B"),s&&(n+="I");let o=this._holey.get(n);if(o===void 0){let l=0;t&&(l|=1),s&&(l|=2),o=this._measure(e,l),o>0&&this._holey.set(n,o)}return o}_measure(e,t){let s=this._measureElements[t];return s.textContent=e.repeat(32),s.offsetWidth/32}},Xee=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,s,r=!1){if(this.selectionStart=t,this.selectionEnd=s,!t||!s||t[0]===s[0]&&t[1]===s[1]){this.clear();return}let n=e.buffers.active.ydisp,o=t[1]-n,l=s[1]-n,c=Math.max(o,0),u=Math.min(l,e.rows-1);if(c>=e.rows||u<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=o,this.viewportEndRow=l,this.viewportCappedStartRow=c,this.viewportCappedEndRow=u,this.startCol=t[0],this.endCol=s[0]}isCellSelected(e,t,s){return this.hasSelection?(s-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&s>=this.viewportCappedStartRow&&t<this.endCol&&s<=this.viewportCappedEndRow:t<this.startCol&&s>=this.viewportCappedStartRow&&t>=this.endCol&&s<=this.viewportCappedEndRow:s>this.viewportStartRow&&s<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&s===this.viewportStartRow&&t>=this.startCol):!1}};function Vee(){return new Xee}var Mv="xterm-dom-renderer-owner-",Hs="xterm-rows",Mp="xterm-fg-",fE="xterm-bg-",Fc="xterm-focus",Ep="xterm-selection",Zee=1,qy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u,d,m,g,_,y){super(),this._terminal=e,this._document=t,this._element=s,this._screenElement=r,this._viewportElement=n,this._helperContainer=o,this._linkifier2=l,this._charSizeService=u,this._optionsService=d,this._bufferService=m,this._coreService=g,this._coreBrowserService=_,this._themeService=y,this._terminalClass=Zee++,this._rowElements=[],this._selectionRenderModel=Vee(),this.onRequestRedraw=this._register(new fe).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Hs),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(Ep),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=zee(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(b=>this._injectCss(b))),this._injectCss(this._themeService.colors),this._rowFactory=c.createInstance(Iy,document),this._element.classList.add(Mv+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(b=>this._handleLinkHover(b))),this._register(this._linkifier2.onHideLinkUnderline(b=>this._handleLinkLeave(b))),this._register(xt(()=>{this._element.classList.remove(Mv+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new Nee(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 s of this._rowElements)s.style.width=`${this.dimensions.css.canvas.width}px`,s.style.height=`${this.dimensions.css.cell.height}px`,s.style.lineHeight=`${this.dimensions.css.cell.height}px`,s.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Hs} 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} .${Hs} { 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} .${Hs} .xterm-dim { color: ${vt.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 s=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,n=`blink_block_${this._terminalClass}`;t+=`@keyframes ${s} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${n} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Hs}.${Fc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${s} 1s step-end infinite;}${this._terminalSelector} .${Hs}.${Fc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Hs}.${Fc} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Hs} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${Ep} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${Ep} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${Ep} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[o,l]of e.ansi.entries())t+=`${this._terminalSelector} .${Mp}${o} { color: ${l.css}; }${this._terminalSelector} .${Mp}${o}.xterm-dim { color: ${vt.multiplyOpacity(l,.5).css}; }${this._terminalSelector} .${fE}${o} { background-color: ${l.css}; }`;t+=`${this._terminalSelector} .${Mp}257 { color: ${vt.opaque(e.background).css}; }${this._terminalSelector} .${Mp}257.xterm-dim { color: ${vt.multiplyOpacity(vt.opaque(e.background),.5).css}; }${this._terminalSelector} .${fE}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 s=this._rowElements.length;s<=t;s++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Fc),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Fc),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,s){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,s),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,s),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,n=this._selectionRenderModel.viewportEndRow,o=this._selectionRenderModel.viewportCappedStartRow,l=this._selectionRenderModel.viewportCappedEndRow,c=this._document.createDocumentFragment();if(s){let u=e[0]>t[0];c.appendChild(this._createSelectionElement(o,u?t[0]:e[0],u?e[0]:t[0],l-o+1))}else{let u=r===o?e[0]:0,d=o===n?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(o,u,d));let m=l-o-1;if(c.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,m)),o!==l){let g=n===l?t[0]:this._bufferService.cols;c.appendChild(this._createSelectionElement(l,0,g))}}this._selectionContainer.appendChild(c)}_createSelectionElement(e,t,s,r=1){let n=this._document.createElement("div"),o=t*this.dimensions.css.cell.width,l=this.dimensions.css.cell.width*(s-t);return o+l>this.dimensions.css.canvas.width&&(l=this.dimensions.css.canvas.width-o),n.style.height=`${r*this.dimensions.css.cell.height}px`,n.style.top=`${e*this.dimensions.css.cell.height}px`,n.style.left=`${o}px`,n.style.width=`${l}px`,n}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 s=this._bufferService.buffer,r=s.ybase+s.y,n=Math.min(s.x,this._bufferService.cols-1),o=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,l=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,c=this._optionsService.rawOptions.cursorInactiveStyle;for(let u=e;u<=t;u++){let d=u+s.ydisp,m=this._rowElements[u],g=s.lines.get(d);if(!m||!g)break;m.replaceChildren(...this._rowFactory.createRow(g,d,d===r,l,c,n,o,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Mv}${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,s,r,n,o){s<0&&(e=0),r<0&&(t=0);let l=this._bufferService.rows-1;s=Math.max(Math.min(s,l),0),r=Math.max(Math.min(r,l),0),n=Math.min(n,this._bufferService.cols);let c=this._bufferService.buffer,u=c.ybase+c.y,d=Math.min(c.x,n-1),m=this._optionsService.rawOptions.cursorBlink,g=this._optionsService.rawOptions.cursorStyle,_=this._optionsService.rawOptions.cursorInactiveStyle;for(let y=s;y<=r;++y){let b=y+c.ydisp,x=this._rowElements[y],w=c.lines.get(b);if(!x||!w)break;x.replaceChildren(...this._rowFactory.createRow(w,b,b===u,g,_,d,m,this.dimensions.css.cell.width,this._widthCache,o?y===s?e:0:-1,o?(y===r?t:n)-1:-1))}}};qy=Lt([Oe(7,qS),Oe(8,xg),Oe(9,ss),Oe(10,is),Oe(11,Ja),Oe(12,Un),Oe(13,Dh)],qy);var Wy=class extends Xe{constructor(e,t,s){super(),this._optionsService=s,this.width=0,this.height=0,this._onCharSizeChange=this._register(new fe),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new Iee(this._optionsService))}catch{this._measureStrategy=this._register(new jee(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())}};Wy=Lt([Oe(2,ss)],Wy);var uD=class extends Xe{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(i,e){i!==void 0&&i>0&&e!==void 0&&e>0&&(this._result.width=i,this._result.height=e)}},jee=class extends uD{constructor(i,e,t){super(),this._document=i,this._parentElement=e,this._optionsService=t,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}},Iee=class extends uD{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}},qee=class extends Xe{constructor(e,t,s){super(),this._textarea=e,this._window=t,this.mainDocument=s,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new Wee(this._window)),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new fe),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(Di.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Qe(this._textarea,"focus",()=>this._isFocused=!0)),this._register(Qe(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}},Wee=class extends Xe{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Th),this._onDprChange=this._register(new fe),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(xt(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Qe(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)}},Uee=class extends Xe{constructor(){super(),this.linkProviders=[],this._register(xt(()=>this.linkProviders.length=0))}registerLinkProvider(i){return this.linkProviders.push(i),{dispose:()=>{let e=this.linkProviders.indexOf(i);e!==-1&&this.linkProviders.splice(e,1)}}}};function JS(i,e,t){let s=t.getBoundingClientRect(),r=i.getComputedStyle(t),n=parseInt(r.getPropertyValue("padding-left")),o=parseInt(r.getPropertyValue("padding-top"));return[e.clientX-s.left-n,e.clientY-s.top-o]}function Yee(i,e,t,s,r,n,o,l,c){if(!n)return;let u=JS(i,e,t);if(u)return u[0]=Math.ceil((u[0]+(c?o/2:0))/o),u[1]=Math.ceil(u[1]/l),u[0]=Math.min(Math.max(u[0],1),s+(c?1:0)),u[1]=Math.min(Math.max(u[1],1),r),u}var Uy=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,s,r,n){return Yee(window,e,t,s,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,n)}getMouseReportCoords(e,t){let s=JS(window,e,t);if(this._charSizeService.hasValidSize)return s[0]=Math.min(Math.max(s[0],0),this._renderService.dimensions.css.canvas.width-1),s[1]=Math.min(Math.max(s[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(s[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(s[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(s[0]),y:Math.floor(s[1])}}};Uy=Lt([Oe(0,Yn),Oe(1,xg)],Uy);var Hee=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,s){this._rowCount=s,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=[]}},fD={};nJ(fD,{getSafariVersion:()=>Gee,isChromeOS:()=>gD,isFirefox:()=>dD,isIpad:()=>Kee,isIphone:()=>Jee,isLegacyEdge:()=>Fee,isLinux:()=>ex,isMac:()=>eg,isNode:()=>wg,isSafari:()=>pD,isWindows:()=>mD});var wg=typeof process<"u"&&"title"in process,Ef=wg?"node":navigator.userAgent,Pf=wg?"node":navigator.platform,dD=Ef.includes("Firefox"),Fee=Ef.includes("Edge"),pD=/^((?!chrome|android).)*safari/i.test(Ef);function Gee(){if(!pD)return 0;let i=Ef.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}var eg=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(Pf),Kee=Pf==="iPad",Jee=Pf==="iPhone",mD=["Windows","Win16","Win32","WinCE"].includes(Pf),ex=Pf.indexOf("Linux")>=0,gD=/\bCrOS\b/.test(Ef),OD=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,s=i.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),r=i.timeRemaining(),t*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},ete=class extends OD{_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())}}},tte=class extends OD{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},tg=!wg&&"requestIdleCallback"in window?tte:ete,ite=class{constructor(){this._queue=new tg}set(i){this._queue.clear(),this._queue.enqueue(i)}flush(){this._queue.flush()}},Yy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u){super(),this._rowCount=e,this._optionsService=s,this._charSizeService=r,this._coreService=n,this._coreBrowserService=c,this._renderer=this._register(new Th),this._pausedResizeTask=new ite,this._observerDisposable=this._register(new Th),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 fe),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new fe),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new fe),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new Hee((d,m)=>this._renderRows(d,m),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new ste(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(xt(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(l.onResize(()=>this._fullRefresh())),this._register(l.buffers.onBufferActivate(()=>{var d;return(d=this._renderer.value)==null?void 0:d.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(o.onDecorationRegistered(()=>this._fullRefresh())),this._register(o.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(l.cols,l.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(l.buffer.y,l.buffer.y,!0))),this._register(u.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(d=>this._registerIntersectionObserver(d,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let s=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});s.observe(t),this._observerDisposable.value=xt(()=>s.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,s=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),s||(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 s;return(s=this._renderer.value)==null?void 0:s.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,s){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=s,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,s)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};Yy=Lt([Oe(2,ss),Oe(3,xg),Oe(4,Ja),Oe(5,Mf),Oe(6,is),Oe(7,Un),Oe(8,Dh)],Yy);var ste=class{constructor(i,e,t){this._coreBrowserService=i,this._coreService=e,this._onTimeout=t,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(i,e){this._isBuffering?(this._start=Math.min(this._start,i),this._end=Math.max(this._end,e)):(this._start=i,this._end=e,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 i={start:this._start,end:this._end};return this._isBuffering=!1,i}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function rte(i,e,t,s){let r=t.buffer.x,n=t.buffer.y;if(!t.buffer.hasScrollback)return ate(r,n,i,e,t,s)+Cg(n,e,t,s)+lte(r,n,i,e,t,s);let o;if(n===e)return o=r>i?"D":"C",hf(Math.abs(r-i),lf(o,s));o=n>e?"D":"C";let l=Math.abs(n-e),c=ote(n>e?i:r,t)+(l-1)*t.cols+1+nte(n>e?r:i);return hf(c,lf(o,s))}function nte(i,e){return i-1}function ote(i,e){return e.cols-i}function ate(i,e,t,s,r,n){return Cg(e,s,r,n).length===0?"":hf(vD(i,e,i,e-Ya(e,r),!1,r).length,lf("D",n))}function Cg(i,e,t,s){let r=i-Ya(i,t),n=e-Ya(e,t),o=Math.abs(r-n)-hte(i,e,t);return hf(o,lf(_D(i,e),s))}function lte(i,e,t,s,r,n){let o;Cg(e,s,r,n).length>0?o=s-Ya(s,r):o=e;let l=s,c=cte(i,e,t,s,r,n);return hf(vD(i,o,t,l,c==="C",r).length,lf(c,n))}function hte(i,e,t){var o;let s=0,r=i-Ya(i,t),n=e-Ya(e,t);for(let l=0;l<Math.abs(r-n);l++){let c=_D(i,e)==="A"?-1:1;(o=t.buffer.lines.get(r+c*l))!=null&&o.isWrapped&&s++}return s}function Ya(i,e){let t=0,s=e.buffer.lines.get(i),r=s==null?void 0:s.isWrapped;for(;r&&i>=0&&i<e.rows;)t++,s=e.buffer.lines.get(--i),r=s==null?void 0:s.isWrapped;return t}function cte(i,e,t,s,r,n){let o;return Cg(t,s,r,n).length>0?o=s-Ya(s,r):o=e,i<t&&o<=s||i>=t&&o<s?"C":"D"}function _D(i,e){return i>e?"A":"B"}function vD(i,e,t,s,r,n){let o=i,l=e,c="";for(;(o!==t||l!==s)&&l>=0&&l<n.buffer.lines.length;)o+=r?1:-1,r&&o>n.cols-1?(c+=n.buffer.translateBufferLineToString(l,!1,i,o),o=0,i=0,l++):!r&&o<0&&(c+=n.buffer.translateBufferLineToString(l,!1,0,i+1),o=n.cols-1,i=o,l--);return c+n.buffer.translateBufferLineToString(l,!1,i,o)}function lf(i,e){let t=e?"O":"[";return le.ESC+t+i}function hf(i,e){i=Math.floor(i);let t="";for(let s=0;s<i;s++)t+=e;return t}var ute=class{constructor(i){this._bufferService=i,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 i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?i%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)-1]:[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[i,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let i=this.selectionStart[0]+this.selectionStartLength;return i>this._bufferService.cols?[i%this._bufferService.cols,this.selectionStart[1]+Math.floor(i/this._bufferService.cols)]:[Math.max(i,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let i=this.selectionStart,e=this.selectionEnd;return!i||!e?!1:i[1]>e[1]||i[1]===e[1]&&i[0]>e[0]}handleTrim(i){return this.selectionStart&&(this.selectionStart[1]-=i),this.selectionEnd&&(this.selectionEnd[1]-=i),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function dE(i,e){if(i.start.y>i.end.y)throw new Error(`Buffer range end (${i.end.x}, ${i.end.y}) cannot be before start (${i.start.x}, ${i.start.y})`);return e*(i.end.y-i.start.y)+(i.end.x-i.start.x+1)}var Ev=50,fte=15,dte=50,pte=500,mte=" ",gte=new RegExp(mte,"g"),Hy=class extends Xe{constructor(e,t,s,r,n,o,l,c,u){super(),this._element=e,this._screenElement=t,this._linkifier=s,this._bufferService=r,this._coreService=n,this._mouseService=o,this._optionsService=l,this._renderService=c,this._coreBrowserService=u,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new lr,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new fe),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new fe),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new fe),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=d=>this._handleMouseMove(d),this._mouseUpListener=d=>this._handleMouseUp(d),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(d=>this._handleTrim(d)),this._register(this._bufferService.buffers.onBufferActivate(d=>this._handleBufferActivate(d))),this.enable(),this._model=new ute(this._bufferService),this._activeSelectionMode=0,this._register(xt(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(d=>{d.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let s=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let n=e[0]<t[0]?e[0]:t[0],o=e[0]<t[0]?t[0]:e[0];for(let l=e[1];l<=t[1];l++){let c=s.translateBufferLineToString(l,!0,n,o);r.push(c)}}else{let n=e[1]===t[1]?t[0]:void 0;r.push(s.translateBufferLineToString(e[1],!0,e[0],n));for(let o=e[1]+1;o<=t[1]-1;o++){let l=s.lines.get(o),c=s.translateBufferLineToString(o,!0);l!=null&&l.isWrapped?r[r.length-1]+=c:r.push(c)}if(e[1]!==t[1]){let o=s.lines.get(t[1]),l=s.translateBufferLineToString(t[1],!0,0,t[0]);o&&o.isWrapped?r[r.length-1]+=l:r.push(l)}}return r.map(n=>n.replace(gte," ")).join(mD?`\r
|
|
100
107
|
`:`
|
|
101
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),JS&&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),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?!1:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=NM(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=KS(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-av),av),t/=av,t/Math.abs(t)+Math.round(t*(Vee-1)))}shouldForceSelection(e){return eg?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(),Zee)}_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&&!(eg&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<jee&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=Ree(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);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,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&t!==r&&(s+=n-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(o,e[0]),u=c,d=e[0]-c,m=0,g=0,_=0,y=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;u<l.length&&l.charAt(u+1)===" ";)u++}else{let w=e[0],k=e[0];o.getWidth(w)===0&&(m++,w--),o.getWidth(k)===2&&(g++,k++);let C=o.getString(k).length;for(C>1&&(y+=C-1,u+=C-1);w>0&&c>0&&!this._isCharWordSeparator(o.loadCell(w-1,this._workCell));){o.loadCell(w-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,w--):A>1&&(_+=A-1,c-=A-1),c--,w--}for(;k<o.length&&u+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,k++):A>1&&(y+=A-1,u+=A-1),u++,k++}}u++;let b=c+d-m+_,x=Math.min(this._bufferService.cols,u-c+m+g-_-y);if(!(!t&&l.slice(c,u).trim()==="")){if(s&&b===0&&o.getCodePoint(0)!==32){let w=n.lines.get(e[1]-1);if(w&&o.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let C=this._bufferService.cols-k.start;b-=C,x+=C}}}if(r&&b+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let w=n.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(x+=k.length)}}return{start:b,length:x}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=NM(s,this._bufferService.cols)}};Hy=Lt([Oe(3,is),Oe(4,Ga),Oe(5,qS),Oe(6,ss),Oe(7,Yn),Oe(8,Un)],Hy);var XM=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},VM=class{constructor(){this._color=new XM,this._css=new XM}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ei=Object.freeze((()=>{let i=[Ct.toColor("#2e3436"),Ct.toColor("#cc0000"),Ct.toColor("#4e9a06"),Ct.toColor("#c4a000"),Ct.toColor("#3465a4"),Ct.toColor("#75507b"),Ct.toColor("#06989a"),Ct.toColor("#d3d7cf"),Ct.toColor("#555753"),Ct.toColor("#ef2929"),Ct.toColor("#8ae234"),Ct.toColor("#fce94f"),Ct.toColor("#729fcf"),Ct.toColor("#ad7fa8"),Ct.toColor("#34e2e2"),Ct.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let t=0;t<216;t++){let s=e[t/36%6|0],r=e[t/6%6|0],n=e[t%6];i.push({css:Ut.toCss(s,r,n),rgba:Ut.toRgba(s,r,n)})}for(let t=0;t<24;t++){let s=8+t*10;i.push({css:Ut.toCss(s,s,s),rgba:Ut.toRgba(s,s,s)})}return i})()),Ca=Ct.toColor("#ffffff"),fu=Ct.toColor("#000000"),ZM=Ct.toColor("#ffffff"),jM=fu,Fc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Wee=Ca,Fy=class extends Xe{constructor(e){super(),this._optionsService=e,this._contrastCache=new VM,this._halfContrastCache=new VM,this._onChangeColors=this._register(new fe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ca,background:fu,cursor:ZM,cursorAccent:jM,selectionForeground:void 0,selectionBackgroundTransparent:Fc,selectionBackgroundOpaque:vt.blend(fu,Fc),selectionInactiveBackgroundTransparent:Fc,selectionInactiveBackgroundOpaque:vt.blend(fu,Fc),scrollbarSliderBackground:vt.opacity(Ca,.2),scrollbarSliderHoverBackground:vt.opacity(Ca,.4),scrollbarSliderActiveBackground:vt.opacity(Ca,.5),overviewRulerBorder:Ca,ansi:ei.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=ot(e.foreground,Ca),t.background=ot(e.background,fu),t.cursor=vt.blend(t.background,ot(e.cursor,ZM)),t.cursorAccent=vt.blend(t.background,ot(e.cursorAccent,jM)),t.selectionBackgroundTransparent=ot(e.selectionBackground,Fc),t.selectionBackgroundOpaque=vt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ot(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ot(e.selectionForeground,BM):void 0,t.selectionForeground===BM&&(t.selectionForeground=void 0),vt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vt.opacity(t.selectionBackgroundTransparent,.3)),vt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ot(e.scrollbarSliderBackground,vt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ot(e.scrollbarSliderHoverBackground,vt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ot(e.scrollbarSliderActiveBackground,vt.opacity(t.foreground,.5)),t.overviewRulerBorder=ot(e.overviewRulerBorder,Wee),t.ansi=ei.slice(),t.ansi[0]=ot(e.black,ei[0]),t.ansi[1]=ot(e.red,ei[1]),t.ansi[2]=ot(e.green,ei[2]),t.ansi[3]=ot(e.yellow,ei[3]),t.ansi[4]=ot(e.blue,ei[4]),t.ansi[5]=ot(e.magenta,ei[5]),t.ansi[6]=ot(e.cyan,ei[6]),t.ansi[7]=ot(e.white,ei[7]),t.ansi[8]=ot(e.brightBlack,ei[8]),t.ansi[9]=ot(e.brightRed,ei[9]),t.ansi[10]=ot(e.brightGreen,ei[10]),t.ansi[11]=ot(e.brightYellow,ei[11]),t.ansi[12]=ot(e.brightBlue,ei[12]),t.ansi[13]=ot(e.brightMagenta,ei[13]),t.ansi[14]=ot(e.brightCyan,ei[14]),t.ansi[15]=ot(e.brightWhite,ei[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)t.ansi[r+16]=ot(e.extendedAnsi[r],ei[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Fy=Lt([Oe(0,ss)],Fy);function ot(i,e){if(i!==void 0)try{return Ct.toColor(i)}catch{}return e}var Uee=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},Yee=class{constructor(){this._services=new Uee,this._services.set(IS,this)}setService(i,e){this._services.set(i,e)}getService(i){return this._services.get(i)}createInstance(i,...e){let t=VK(i).sort((n,o)=>n.index-o.index),s=[];for(let n of t){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${i.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=t.length>0?t[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${i.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new i(...e,...s)}},Hee={trace:0,debug:1,info:2,warn:3,error:4,off:5},Fee="xterm.js: ",Gy=class extends Xe{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=Hee[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":Fee)+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Gy=Lt([Oe(0,ss)],Gy);var IM=class extends Xe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new fe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new fe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new fe),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 s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];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,...s){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=t-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+t+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ze=3,It=Object.freeze(new Af),Ep=0,lv=2,du=class gD{constructor(e,t,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*ze);let r=t||lr.fromCharData([0,$B,1,0]);for(let n=0;n<e;++n)this.setCell(n,r);this.length=e}get(e){let t=this._data[e*ze+0],s=t&2097151;return[this._data[e*ze+1],t&2097152?this._combined[e]:s?$o(s):"",t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,t){this._data[e*ze+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*ze+0]=e|2097152|t[2]<<22):this._data[e*ze+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*ze+0]>>22}hasWidth(e){return this._data[e*ze+0]&12582912}getFg(e){return this._data[e*ze+1]}getBg(e){return this._data[e*ze+2]}hasContent(e){return this._data[e*ze+0]&4194303}getCodePoint(e){let t=this._data[e*ze+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*ze+0]&2097152}getString(e){let t=this._data[e*ze+0];return t&2097152?this._combined[e]:t&2097151?$o(t&2097151):""}isProtected(e){return this._data[e*ze+2]&536870912}loadCell(e,t){return Ep=e*ze,t.content=this._data[Ep+0],t.fg=this._data[Ep+1],t.bg=this._data[Ep+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*ze+0]=t.content,this._data[e*ze+1]=t.fg,this._data[e*ze+2]=t.bg}setCellFromCodepoint(e,t,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*ze+0]=t|s<<22,this._data[e*ze+1]=r.fg,this._data[e*ze+2]=r.bg}addCodepointToCell(e,t,s){let r=this._data[e*ze+0];r&2097152?this._combined[e]+=$o(t):r&2097151?(this._combined[e]=$o(r&2097151)+$o(t),r&=-2097152,r|=2097152):r=t|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*ze+0]=r}insertCells(e,t,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length-e){let r=new lr;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let n=0;n<t;++n)this.setCell(e+n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,t,s){if(e%=this.length,t<this.length-e){let r=new lr;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let n=this.length-t;n<this.length;++n)this.setCell(n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,t,s,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.setCell(e++,s)}resize(e,t){if(e===this.length)return this._data.length*4*lv<this._data.buffer.byteLength;let s=e*ze;if(e>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let l=parseInt(r[o],10);l>=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*lv<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*lv<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new gD(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*ze+0]&4194303)return e+(this._data[e*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*ze+0]&4194303||this._data[e*ze+2]&50331648)return e+(this._data[e*ze+0]>>22);return 0}copyCellsFrom(e,t,s,r,n){let o=e._data;if(n)for(let c=r-1;c>=0;c--){for(let u=0;u<ze;u++)this._data[(s+c)*ze+u]=o[(t+c)*ze+u];o[(t+c)*ze+2]&268435456&&(this._extendedAttrs[s+c]=e._extendedAttrs[t+c])}else for(let c=0;c<r;c++){for(let u=0;u<ze;u++)this._data[(s+c)*ze+u]=o[(t+c)*ze+u];o[(t+c)*ze+2]&268435456&&(this._extendedAttrs[s+c]=e._extendedAttrs[t+c])}let l=Object.keys(e._combined);for(let c=0;c<l.length;c++){let u=parseInt(l[c],10);u>=t&&(this._combined[u-t+s]=e._combined[u])}}translateToString(e,t,s,r){t=t??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;t<s;){let o=this._data[t*ze+0],l=o&2097151,c=o&2097152?this._combined[t]:l?$o(l):No;if(n+=c,r)for(let u=0;u<c.length;++u)r.push(t);t+=o>>22||1}return r&&r.push(t),n}};function Gee(i,e,t,s,r,n){let o=[];for(let l=0;l<i.length-1;l++){let c=l,u=i.get(++c);if(!u.isWrapped)continue;let d=[i.get(l)];for(;c<i.length&&u.isWrapped;)d.push(u),u=i.get(++c);if(!n&&s>=l&&s<c){l+=d.length-1;continue}let m=0,g=cf(d,m,e),_=1,y=0;for(;_<d.length;){let x=cf(d,_,e),w=x-y,k=t-g,C=Math.min(w,k);d[m].copyCellsFrom(d[_],y,g,C,!1),g+=C,g===t&&(m++,g=0),y+=C,y===x&&(_++,y=0),g===0&&m!==0&&d[m-1].getWidth(t-1)===2&&(d[m].copyCellsFrom(d[m-1],t-1,g++,1,!1),d[m-1].setCell(t-1,r))}d[m].replaceCells(g,t,r);let b=0;for(let x=d.length-1;x>0&&(x>m||d[x].getTrimmedLength()===0);x--)b++;b>0&&(o.push(l+d.length-b),o.push(b)),l+=d.length-1}return o}function Kee(i,e){let t=[],s=0,r=e[s],n=0;for(let o=0;o<i.length;o++)if(r===o){let l=e[++s];i.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,r=e[++s]}else t.push(o);return{layout:t,countRemoved:n}}function Jee(i,e){let t=[];for(let s=0;s<e.length;s++)t.push(i.get(e[s]));for(let s=0;s<t.length;s++)i.set(s,t[s]);i.length=e.length}function ete(i,e,t){let s=[],r=i.map((c,u)=>cf(i,u,e)).reduce((c,u)=>c+u),n=0,o=0,l=0;for(;l<r;){if(r-l<t){s.push(r-l);break}n+=t;let c=cf(i,o,e);n>c&&(n-=c,o++);let u=i[o].getWidth(n-1)===2;u&&n--;let d=u?t-1:t;s.push(d),l+=d}return s}function cf(i,e,t){if(e===i.length-1)return i[e].getTrimmedLength();let s=!i[e].hasContent(t-1)&&i[e].getWidth(t-1)===1,r=i[e+1].getWidth(0)===2;return s&&r?t-1:t}var OD=class _D{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=_D._nextId++,this._onDispose=this.register(new fe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ua(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};OD._nextId=1;var tte=OD,ni={},ka=ni.B;ni[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ni.A={"#":"£"};ni.B=void 0;ni[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ni.C=ni[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ni.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ni.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ni.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ni.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ni.E=ni[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ni.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ni.H=ni[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ni["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var qM=4294967295,WM=class{constructor(i,e,t){this._hasScrollback=i,this._optionsService=e,this._bufferService=t,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=It.clone(),this.savedCharset=ka,this.markers=[],this._nullCell=lr.fromCharData([0,$B,1,0]),this._whitespaceCell=lr.fromCharData([0,No,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new tg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new IM(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Gm),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Gm),this._whitespaceCell}getBlankLine(i,e){return new du(this._bufferService.cols,this.getNullCell(i),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;let e=i+this._optionsService.rawOptions.scrollback;return e>qM?qM:e}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=It);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new IM(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,e){let t=this.getNullCell(It),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<i)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(i,t);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new du(i,t)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new du(i,t)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(i,e),this._cols>i))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(i,t);this._cols=i,this._rows=e,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return i}get _isReflowEnabled(){let i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,e){this._cols!==i&&(i>this._cols?this._reflowLarger(i,e):this._reflowSmaller(i,e))}_reflowLarger(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,s=Gee(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(It),t);if(s.length>0){let r=Kee(this.lines,s);Jee(this.lines,r.layout),this._reflowLargerAdjustViewport(i,e,r.countRemoved)}}_reflowLargerAdjustViewport(i,e,t){let s=this.getNullCell(It),r=t;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new du(i,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-t,0)}_reflowSmaller(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(It),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=i)continue;let c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);if(!t){let C=this.ybase+this.y;if(C>=o&&C<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),d=ete(c,this._cols,i),m=d.length-c.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+m):g=Math.max(0,this.lines.length-this.lines.maxLength+m);let _=[];for(let C=0;C<m;C++){let A=this.getBlankLine(It,!0);_.push(A)}_.length>0&&(r.push({start:o+c.length+n,newLines:_}),n+=_.length),c.push(..._);let y=d.length-1,b=d[y];b===0&&(y--,b=d[y]);let x=c.length-m-1,w=u;for(;x>=0;){let C=Math.min(w,b);if(c[y]===void 0)break;if(c[y].copyCellsFrom(c[x],w-C,b-C,C,!0),b-=C,b===0&&(y--,b=d[y]),w-=C,w===0){x--;let A=Math.max(x,0);w=cf(c,A,this._cols)}}for(let C=0;C<c.length;C++)d[C]<i&&c[C].setCell(d[C],s);let k=m-g;for(;k-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+e-1)}if(r.length>0){let o=[],l=[];for(let b=0;b<this.lines.length;b++)l.push(this.lines.get(b));let c=this.lines.length,u=c-1,d=0,m=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let g=0;for(let b=Math.min(this.lines.maxLength-1,c+n-1);b>=0;b--)if(m&&m.start>u+g){for(let x=m.newLines.length-1;x>=0;x--)this.lines.set(b--,m.newLines[x]);b++,o.push({index:u+1,amount:m.newLines.length}),g+=m.newLines.length,m=r[++d]}else this.lines.set(b,l[u--]);let _=0;for(let b=o.length-1;b>=0;b--)o[b].index+=_,this.lines.onInsertEmitter.fire(o[b]),_+=o[b].amount;let y=Math.max(0,c+n-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(i,e,t=0,s){let r=this.lines.get(i);return r?r.translateToString(e,t,s):""}getWrappedRangeForLine(i){let e=i,t=i;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;t+1<this.lines.length&&this.lines.get(t+1).isWrapped;)t++;return{first:e,last:t}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===i&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose();this.markers.length=0,this._isClearing=!1}addMarker(i){let e=new tte(i);return this.markers.push(e),e.register(this.lines.onTrim(t=>{e.line-=t,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(t=>{e.line>=t.index&&(e.line+=t.amount)})),e.register(this.lines.onDelete(t=>{e.line>=t.index&&e.line<t.index+t.amount&&e.dispose(),e.line>t.index&&(e.line-=t.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}},ite=class extends Xe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new fe),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 WM(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new WM(!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)}},vD=2,yD=1,Ky=class extends Xe{constructor(i){super(),this.isUserScrolling=!1,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,vD),this.rows=Math.max(i.rawOptions.rows||0,yD),this.buffers=this._register(new ite(i,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(i,e){let t=this.cols!==i,s=this.rows!==e;this.cols=i,this.rows=e,this.buffers.resize(i,e),this._onResize.fire({cols:i,rows:e,colsChanged:t,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,e=!1){let t=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==i.fg||s.getBg(0)!==i.bg)&&(s=t.getBlankLine(i,e),this._cachedBlankLine=s),s.isWrapped=e;let r=t.ybase+t.scrollTop,n=t.ybase+t.scrollBottom;if(t.scrollTop===0){let o=t.lines.isFull;n===t.lines.length-1?o?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{let o=n-r+1;t.lines.shiftElements(r+1,o-1,-1),t.lines.set(n,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(i,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let s=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),s!==t.ydisp&&(e||this._onScroll.fire(t.ydisp))}};Ky=Lt([Oe(0,ss)],Ky);var Xl={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:eg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},ste=["normal","bold","100","200","300","400","500","600","700","800","900"],rte=class extends Xe{constructor(e){super(),this._onOptionChange=this._register(new fe),this.onOptionChange=this._onOptionChange.event;let t={...Xl};for(let s in e)if(s in t)try{let r=e[s];t[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(xt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Xl))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,r)=>{if(!(s in Xl))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Xl[e]),!nte(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Xl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=ste.includes(t)?t:Xl[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 nte(i){return i==="block"||i==="underline"||i==="bar"}function pu(i,e=5){if(typeof i!="object")return i;let t=Array.isArray(i)?[]:{};for(let s in i)t[s]=e<=1?i[s]:i[s]&&pu(i[s],e-1);return t}var UM=Object.freeze({insertMode:!1}),YM=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Jy=class extends Xe{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new fe),this.onData=this._onData.event,this._onUserInput=this._register(new fe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new fe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pu(UM),this.decPrivateModes=pu(YM)}reset(){this.modes=pu(UM),this.decPrivateModes=pu(YM)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Jy=Lt([Oe(0,is),Oe(1,XB),Oe(2,ss)],Jy);var HM={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button===4||i.action!==1?!1:(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>!(i.action===32&&i.button===3)},ANY:{events:31,restrict:i=>!0}};function hv(i,e){let t=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(t|=64,t|=i.action):(t|=i.button&3,i.button&4&&(t|=64),i.button&8&&(t|=128),i.action===32?t|=32:i.action===0&&!e&&(t|=3)),t}var cv=String.fromCharCode,FM={DEFAULT:i=>{let e=[hv(i,!1)+32,i.col+32,i.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${cv(e[0])}${cv(e[1])}${cv(e[2])}`},SGR:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${hv(i,!0)};${i.col};${i.row}${e}`},SGR_PIXELS:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${hv(i,!0)};${i.x};${i.y}${e}`}},eb=class extends Xe{constructor(i,e,t){super(),this._bufferService=i,this._coreService=e,this._optionsService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new fe),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(HM))this.addProtocol(s,HM[s]);for(let s of Object.keys(FM))this.addEncoding(s,FM[s]);this.reset()}addProtocol(i,e){this._protocols[i]=e}addEncoding(i,e){this._encodings[i]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(i,e,t){if(i.deltaY===0||i.shiftKey||e===void 0||t===void 0)return 0;let s=e/t,r=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(i.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(i,e){return e.altKey||e.ctrlKey||e.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let e=this._encodings[this._activeEncoding](i);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(i&1),up:!!(i&2),drag:!!(i&4),move:!!(i&8),wheel:!!(i&16)}}_equalEvents(i,e,t){if(t){if(i.x!==e.x||i.y!==e.y)return!1}else if(i.col!==e.col||i.row!==e.row)return!1;return!(i.button!==e.button||i.action!==e.action||i.ctrl!==e.ctrl||i.alt!==e.alt||i.shift!==e.shift)}};eb=Lt([Oe(0,is),Oe(1,Ga),Oe(2,ss)],eb);var uv=[[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]],ote=[[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]],ti;function ate(i,e){let t=0,s=e.length-1,r;if(i<e[0][0]||i>e[s][1])return!1;for(;s>=t;)if(r=t+s>>1,i>e[r][1])t=r+1;else if(i<e[r][0])s=r-1;else return!0;return!1}var lte=class{constructor(){if(this.version="6",!ti){ti=new Uint8Array(65536),ti.fill(1),ti[0]=0,ti.fill(0,1,32),ti.fill(0,127,160),ti.fill(2,4352,4448),ti[9001]=2,ti[9002]=2,ti.fill(2,11904,42192),ti[12351]=1,ti.fill(2,44032,55204),ti.fill(2,63744,64256),ti.fill(2,65040,65050),ti.fill(2,65072,65136),ti.fill(2,65280,65377),ti.fill(2,65504,65511);for(let e=0;e<uv.length;++e)ti.fill(0,uv[e][0],uv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ti[e]:ate(e,ote)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),r=s===0&&t!==0;if(r){let n=Ba.extractWidth(t);n===0?r=!1:n>s&&(s=n)}return Ba.createPropertyValue(0,s,r)}},Ba=class nm{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new fe,this.onChange=this._onChange.event;let e=new lte;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,s=!1){return(e&16777215)<<3|(t&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,s=0,r=e.length;for(let n=0;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return t+this.wcwidth(o);let u=e.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:t+=this.wcwidth(u)}let l=this.charProperties(o,s),c=nm.extractWidth(l);nm.extractShouldJoin(l)&&(c-=nm.extractWidth(s)),t+=c,s=l}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},hte=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 GM(i){var s;let e=(s=i.buffer.lines.get(i.buffer.ybase+i.buffer.y-1))==null?void 0:s.get(i.cols-1),t=i.buffer.lines.get(i.buffer.ybase+i.buffer.y);t&&e&&(t.isWrapped=e[3]!==0&&e[3]!==32)}var Gc=2147483647,cte=256,bD=class tb{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>cte)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let t=new tb;if(!e.length)return t;for(let s=Array.isArray(e[0])?1:0;s<e.length;++s){let r=e[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)t.addSubParam(r[n]);else t.addParam(r)}return t}clone(){let e=new tb(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Gc?Gc:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Gc?Gc:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-t>0?this._subParams.subarray(t,s):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-s>0&&(e[t]=this._subParams.slice(s,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(r*10+e,Gc):e}},Kc=[],ute=class{constructor(){this._state=0,this._active=Kc,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Kc}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=Kc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Kc,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Sg(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-t>0&&this._put(e,t,s)}}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 s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Kc,this._id=-1,this._state=0}}},Rs=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Sg(e,t,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},Jc=[],fte=class{constructor(){this._handlers=Object.create(null),this._active=Jc,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Jc}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=Jc,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||Jc,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Sg(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Jc,this._ident=0}},mu=new bD;mu.addParam(0);var KM=class{constructor(i){this._handler=i,this._data="",this._params=mu,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():mu,this._data="",this._hitLimit=!1}put(i,e,t){this._hitLimit||(this._data+=Sg(i,e,t),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(i){let e=!1;if(this._hitLimit)e=!1;else if(i&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(t=>(this._params=mu,this._data="",this._hitLimit=!1,t));return this._params=mu,this._data="",this._hitLimit=!1,e}},dte=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,r){this.table[t<<8|e]=s<<4|r}addMany(e,t,s,r){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=s<<4|r}},Js=160,pte=(function(){let i=new dte(4095),e=Array.apply(null,Array(256)).map((l,c)=>c),t=(l,c)=>e.slice(l,c),s=t(32,127),r=t(0,24);r.push(25),r.push.apply(r,t(28,32));let n=t(0,14),o;i.setDefault(1,0),i.addMany(s,0,2,0);for(o in n)i.addMany([24,26,153,154],o,3,0),i.addMany(t(128,144),o,3,0),i.addMany(t(144,152),o,3,0),i.add(156,o,0,0),i.add(27,o,11,1),i.add(157,o,4,8),i.addMany([152,158,159],o,0,7),i.add(155,o,11,3),i.add(144,o,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(t(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(t(64,127),3,7,0),i.addMany(t(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(t(48,60),4,8,4),i.addMany(t(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(t(32,64),6,0,6),i.add(127,6,0,6),i.addMany(t(64,127),6,0,0),i.addMany(t(32,48),3,9,5),i.addMany(t(32,48),5,9,5),i.addMany(t(48,64),5,0,6),i.addMany(t(64,127),5,7,0),i.addMany(t(32,48),4,9,5),i.addMany(t(32,48),1,9,2),i.addMany(t(32,48),2,9,2),i.addMany(t(48,127),2,10,0),i.addMany(t(48,80),1,10,0),i.addMany(t(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(t(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(t(28,32),9,0,9),i.addMany(t(32,48),9,9,12),i.addMany(t(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(t(32,128),11,0,11),i.addMany(t(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(t(28,32),10,0,10),i.addMany(t(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(t(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(t(28,32),12,0,12),i.addMany(t(32,48),12,9,12),i.addMany(t(48,64),12,0,11),i.addMany(t(64,127),12,12,13),i.addMany(t(64,127),10,12,13),i.addMany(t(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(Js,0,2,0),i.add(Js,8,5,8),i.add(Js,6,0,6),i.add(Js,11,0,11),i.add(Js,13,13,13),i})(),mte=class extends Xe{constructor(e=pte){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 bD,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(xt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new ute),this._dcsParser=this._register(new fte),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=r,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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,s,r,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,t,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&u>-1){for(;u>=0&&(l=c[u](this._params),l!==!0);u--)if(l instanceof Promise)return this._parseStack.handlerPos=u,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&u>-1){for(;u>=0&&(l=c[u](),l!==!0);u--)if(l instanceof Promise)return this._parseStack.handlerPos=u,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=o;c<t;++c){switch(r=e[c],n=this._transitions.table[this.currentState<<8|(r<160?r:Js)],n>>4){case 2:for(let _=c+1;;++_){if(_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(l=u[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,u,d,n,c),l;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++c<t&&(r=e[c])>47&&r<60);c--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(l=m[g](),l!==!0);g--)if(l instanceof Promise)return this._preserveStack(4,m,g,n,c),l;g<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=c+1;;++_)if(_>=t||(r=e[_])===24||r===26||r===27||r>127&&r<Js){this._dcsParser.put(e,c,_),c=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,n,c),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=c+1;;_++)if(_>=t||(r=e[_])<32||r>127&&r<Js){this._oscParser.put(e,c,_),c=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,n,c),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},gte=/^([\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})$/,Ote=/^[\da-f]+$/;function JM(i){if(!i)return;let e=i.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let t=gte.exec(e);if(t){let s=t[1]?15:t[4]?255:t[7]?4095:65535;return[Math.round(parseInt(t[1]||t[4]||t[7]||t[10],16)/s*255),Math.round(parseInt(t[2]||t[5]||t[8]||t[11],16)/s*255),Math.round(parseInt(t[3]||t[6]||t[9]||t[12],16)/s*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),Ote.exec(e)&&[3,6,9,12].includes(e.length))){let t=e.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(e.slice(t*r,t*r+t),16);s[r]=t===1?n<<4:t===2?n:t===3?n>>4:n>>8}return s}}function fv(i,e){let t=i.toString(16),s=t.length<2?"0"+t:t;switch(e){case 4:return t[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function _te(i,e=16){let[t,s,r]=i;return`rgb:${fv(t,e)}/${fv(s,e)}/${fv(r,e)}`}var vte={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ko=131072,eE=10;function tE(i,e){if(i>24)return e.setWinLines||!1;switch(i){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var iE=5e3,sE=0,yte=class extends Xe{constructor(i,e,t,s,r,n,o,l,c=new mte){super(),this._bufferService=i,this._charsetService=e,this._coreService=t,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new NK,this._utf8Decoder=new XK,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=It.clone(),this._eraseAttrDataInternal=It.clone(),this._onRequestBell=this._register(new fe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new fe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new fe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new fe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new fe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new fe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new fe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new fe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new fe),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 ib(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:d.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,d,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:d,data:m})}),this._parser.setDcsHandlerFallback((u,d,m)=>{d==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:d,payload:m})}),this._parser.setPrintHandler((u,d,m)=>this.print(u,d,m)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(le.BEL,()=>this.bell()),this._parser.setExecuteHandler(le.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(le.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(le.BS,()=>this.backspace()),this._parser.setExecuteHandler(le.HT,()=>this.tab()),this._parser.setExecuteHandler(le.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(le.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(sm.IND,()=>this.index()),this._parser.setExecuteHandler(sm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(sm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Rs(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new Rs(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new Rs(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new Rs(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new Rs(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new Rs(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new Rs(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new Rs(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new Rs(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new Rs(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new Rs(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new Rs(u=>this.restoreCursorColor(u))),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 u in ni)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new KM((u,d)=>this.requestStatusString(u,d)))}getAttrData(){return this._curAttrData}_preserveStack(i,e,t,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=i,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=t,this._parseStack.position=s}_logSlowResolvingAsync(i){this._logService.logLevel<=3&&Promise.race([i,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),iE))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${iE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(i,e){let t,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(t=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(t),t;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,i.length>ko&&(n=this._parseStack.position+ko)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof i=="string"?` "${i}"`:` "${Array.prototype.map.call(i,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof i=="string"?i.split("").map(u=>u.charCodeAt(0)):i),this._parseBuffer.length<i.length&&this._parseBuffer.length<ko&&(this._parseBuffer=new Uint32Array(Math.min(i.length,ko))),o||this._dirtyRowTracker.clearRange(),i.length>ko)for(let u=n;u<i.length;u+=ko){let d=u+ko<i.length?u+ko:i.length,m=typeof i=="string"?this._stringDecoder.decode(i.substring(u,d),this._parseBuffer):this._utf8Decoder.decode(i.subarray(u,d),this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,m))return this._preserveStack(s,r,m,u),this._logSlowResolvingAsync(t),t}else if(!o){let u=typeof i=="string"?this._stringDecoder.decode(i,this._parseBuffer):this._utf8Decoder.decode(i,this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,u))return this._preserveStack(s,r,u,0),this._logSlowResolvingAsync(t),t}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(i,e,t){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&t-e>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let g=this._parser.precedingJoinState;for(let _=e;_<t;++_){if(s=i[_],s<127&&n){let w=n[String.fromCharCode(s)];w&&(s=w.charCodeAt(0))}let y=this._unicodeService.charProperties(s,g);r=Ba.extractWidth(y);let b=Ba.extractShouldJoin(y),x=b?Ba.extractWidth(g):0;if(g=y,o&&this._onA11yChar.fire($o(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-x>l){if(c){let w=m,k=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),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&m instanceof du&&m.copyCellsFrom(w,k,0,x,!1);k<l;)w.setCellFromCodepoint(k++,0,1,d)}else if(this._activeBuffer.x=l-1,r===2)continue}if(b&&this._activeBuffer.x){let w=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-w,s,r);for(let k=r-x;--k>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(u&&(m.insertCells(this._activeBuffer.x,r-x,this._activeBuffer.getNullCell(d)),m.getWidth(l-1)===2&&m.setCellFromCodepoint(l-1,0,1,d)),m.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=g,this._activeBuffer.x<l&&t-e>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(i,e){return i.final==="t"&&!i.prefix&&!i.intermediates?this._parser.registerCsiHandler(i,t=>tE(t.params[0],this._optionsService.rawOptions.windowOptions)?e(t):!0):this._parser.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._parser.registerDcsHandler(i,new KM(e))}registerEscHandler(i,e){return this._parser.registerEscHandler(i,e)}registerOscHandler(i,e){return this._parser.registerOscHandler(i,new Rs(e))}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 i;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&&((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&i.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-i),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(i=this._bufferService.cols-1){this._activeBuffer.x=Math.min(i,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(i,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=i,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=i,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(i,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+i,this._activeBuffer.y+e)}cursorUp(i){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,i.params[0]||1)):this._moveCursor(0,-(i.params[0]||1)),!0}cursorDown(i){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,i.params[0]||1)):this._moveCursor(0,i.params[0]||1),!0}cursorForward(i){return this._moveCursor(i.params[0]||1,0),!0}cursorBackward(i){return this._moveCursor(-(i.params[0]||1),0),!0}cursorNextLine(i){return this.cursorDown(i),this._activeBuffer.x=0,!0}cursorPrecedingLine(i){return this.cursorUp(i),this._activeBuffer.x=0,!0}cursorCharAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(i){return this._setCursor(i.length>=2?(i.params[1]||1)-1:0,(i.params[0]||1)-1),!0}charPosAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(i){return this._moveCursor(i.params[0]||1,0),!0}linePosAbsolute(i){return this._setCursor(this._activeBuffer.x,(i.params[0]||1)-1),!0}vPositionRelative(i){return this._moveCursor(0,i.params[0]||1),!0}hVPosition(i){return this.cursorPosition(i),!0}tabClear(i){let e=i.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(i){let e=i.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(i,e,t,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.replaceCells(e,t,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(i,e=!1){let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);t&&(t.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+i),t.isWrapped=!1)}eraseInDisplay(i,e=!1){var s;this._restrictCursor(this._bufferService.cols);let t;switch(i.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);t<this._bufferService.rows;t++)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(t);break;case 1:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(t=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,t-1);t--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t))!=null&&s.getTrimmedLength()););for(;t>=0;t--)this._bufferService.scroll(this._eraseAttrData())}else{for(t=this._bufferService.rows,this._dirtyRowTracker.markDirty(t-1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(i,e=!1){switch(this._restrictCursor(this._bufferService.cols),i.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(t,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;e--;)this._activeBuffer.lines.splice(t,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(i){let e=i.params[0]||1;for(;e--;)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(i){let e=i.params[0]||1;for(;e--;)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(It));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(i.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(i){let e=this._parser.precedingJoinState;if(!e)return!0;let t=i.params[0]||1,s=Ba.extractWidth(e),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*t),l=0;for(let u=0;u<n.length;){let d=n.codePointAt(u)||0;o[l++]=d,u+=d>65535?2:1}let c=l;for(let u=1;u<t;++u)o.copyWithin(c,0,l),c+=l;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(i){return i.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(le.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(le.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(i){return i.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(le.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(le.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(i.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(le.ESC+"[>83;40003;0c")),!0}_is(i){return(this._optionsService.rawOptions.termName+"").indexOf(i)===0}setMode(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ka),this._charsetService.setgCharset(1,ka),this._charsetService.setgCharset(2,ka),this._charsetService.setgCharset(3,ka);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(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){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(),i.params[e]===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(i,e){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(t={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:u,alt:d}=l,m=this._optionsService.rawOptions,g=(b,x)=>(o.triggerDataEvent(`${le.ESC}[${e?"":"?"}${b};${x}$y`),!0),_=b=>b?1:2,y=i.params[0];return e?y===2?g(y,4):y===4?g(y,_(o.modes.insertMode)):y===12?g(y,3):y===20?g(y,_(m.convertEol)):g(y,0):y===1?g(y,_(s.applicationCursorKeys)):y===3?g(y,m.windowOptions.setWinLines?c===80?2:c===132?1:0:0):y===6?g(y,_(s.origin)):y===7?g(y,_(s.wraparound)):y===8?g(y,3):y===9?g(y,_(r==="X10")):y===12?g(y,_(m.cursorBlink)):y===25?g(y,_(!o.isCursorHidden)):y===45?g(y,_(s.reverseWraparound)):y===66?g(y,_(s.applicationKeypad)):y===67?g(y,4):y===1e3?g(y,_(r==="VT200")):y===1002?g(y,_(r==="DRAG")):y===1003?g(y,_(r==="ANY")):y===1004?g(y,_(s.sendFocus)):y===1005?g(y,4):y===1006?g(y,_(n==="SGR")):y===1015?g(y,4):y===1016?g(y,_(n==="SGR_PIXELS")):y===1048?g(y,1):y===47||y===1047||y===1049?g(y,_(u===d)):y===2004?g(y,_(s.bracketedPasteMode)):y===2026?g(y,_(s.synchronizedOutput)):g(y,0)}_updateAttrColor(i,e,t,s,r){return e===2?(i|=50331648,i&=-16777216,i|=Af.fromColorRGB([t,s,r])):e===5&&(i&=-50331904,i|=33554432|t&255),i}_extractColor(i,e,t){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=i.params[e+n],i.hasSubParams(e+n)){let o=i.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l<o.length&&l+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e<i.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:t.fg=this._updateAttrColor(t.fg,s[1],s[3],s[4],s[5]);break;case 48:t.bg=this._updateAttrColor(t.bg,s[1],s[3],s[4],s[5]);break;case 58:t.extended=t.extended.clone(),t.extended.underlineColor=this._updateAttrColor(t.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(i,e){e.extended=e.extended.clone(),(!~i||i>5)&&(i=1),e.extended.underlineStyle=i,e.fg|=268435456,i===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(i){i.fg=It.fg,i.bg=It.bg,i.extended=i.extended.clone(),i.extended.underlineStyle=0,i.extended.underlineColor&=-67108864,i.updateExtended()}charAttributes(i){if(i.length===1&&i.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=i.length,t,s=this._curAttrData;for(let r=0;r<e;r++)t=i.params[r],t>=30&&t<=37?(s.fg&=-50331904,s.fg|=16777216|t-30):t>=40&&t<=47?(s.bg&=-50331904,s.bg|=16777216|t-40):t>=90&&t<=97?(s.fg&=-50331904,s.fg|=16777216|t-90|8):t>=100&&t<=107?(s.bg&=-50331904,s.bg|=16777216|t-100|8):t===0?this._processSGR0(s):t===1?s.fg|=134217728:t===3?s.bg|=67108864:t===4?(s.fg|=268435456,this._processUnderline(i.hasSubParams(r)?i.getSubParams(r)[0]:1,s)):t===5?s.fg|=536870912:t===7?s.fg|=67108864:t===8?s.fg|=1073741824:t===9?s.fg|=2147483648:t===2?s.bg|=134217728:t===21?this._processUnderline(2,s):t===22?(s.fg&=-134217729,s.bg&=-134217729):t===23?s.bg&=-67108865:t===24?(s.fg&=-268435457,this._processUnderline(0,s)):t===25?s.fg&=-536870913:t===27?s.fg&=-67108865:t===28?s.fg&=-1073741825:t===29?s.fg&=2147483647:t===39?(s.fg&=-67108864,s.fg|=It.fg&16777215):t===49?(s.bg&=-67108864,s.bg|=It.bg&16777215):t===38||t===48||t===58?r+=this._extractColor(i,r,s):t===53?s.bg|=1073741824:t===55?s.bg&=-1073741825:t===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):t===100?(s.fg&=-67108864,s.fg|=It.fg&16777215,s.bg&=-67108864,s.bg|=It.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",t);return!0}deviceStatus(i){switch(i.params[0]){case 5:this._coreService.triggerDataEvent(`${le.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(i){switch(i.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[?${e};${t}R`);break}return!0}softReset(i){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=It.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(i){let e=i.length===0?1:i.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 t=e%2===1;this._coreService.decPrivateModes.cursorBlink=t}return!0}setScrollRegion(i){let e=i.params[0]||1,t;return(i.length<2||(t=i.params[1])>this._bufferService.rows||t===0)&&(t=this._bufferService.rows),t>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(i){if(!tE(i.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=i.length>1?i.params[1]:0;switch(i.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${le.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>eE&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>eE&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(i){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(i){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(i){return this._windowTitle=i,this._onTitleChange.fire(i),!0}setIconName(i){return this._iconName=i,!0}setOrReportIndexedColor(i){let e=[],t=i.split(";");for(;t.length>1;){let s=t.shift(),r=t.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(rE(n))if(r==="?")e.push({type:0,index:n});else{let o=JM(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(i){let e=i.indexOf(";");if(e===-1)return!0;let t=i.slice(0,e).trim(),s=i.slice(e+1);return s?this._createHyperlink(t,s):t.trim()?!1:this._finishHyperlink()}_createHyperlink(i,e){this._getCurrentLinkId()&&this._finishHyperlink();let t=i.split(":"),s,r=t.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=t[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(i,e){let t=i.split(";");for(let s=0;s<t.length&&!(e>=this._specialColors.length);++s,++e)if(t[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=JM(t[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(i){return this._setOrReportSpecialColor(i,0)}setOrReportBgColor(i){return this._setOrReportSpecialColor(i,1)}setOrReportCursorColor(i){return this._setOrReportSpecialColor(i,2)}restoreIndexedColor(i){if(!i)return this._onColor.fire([{type:2}]),!0;let e=[],t=i.split(";");for(let s=0;s<t.length;++s)if(/^\d+$/.exec(t[s])){let r=parseInt(t[s]);rE(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(i){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(i){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(i){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,ka),!0}selectCharset(i){return i.length!==2?(this.selectDefaultCharset(),!0):(i[0]==="/"||this._charsetService.setgCharset(vte[i[0]],ni[i[1]]||ka),!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 i=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,i,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=It.clone(),this._eraseAttrDataInternal=It.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(i){return this._charsetService.setgLevel(i),!0}screenAlignmentPattern(){let i=new lr;i.content=1<<22|69,i.fg=this._curAttrData.fg,i.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let t=this._activeBuffer.ybase+this._activeBuffer.y+e,s=this._activeBuffer.lines.get(t);s&&(s.fill(i),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(i,e){let t=o=>(this._coreService.triggerDataEvent(`${le.ESC}${o}${le.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return t(i==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:i==='"p'?'P1$r61;1"p':i==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:i==="m"?"P1$r0m":i===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(i,e){this._dirtyRowTracker.markRangeDirty(i,e)}},ib=class{constructor(i){this._bufferService=i,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(i){i<this.start?this.start=i:i>this.end&&(this.end=i)}markRangeDirty(i,e){i>e&&(sE=i,i=e,e=sE),i<this.start&&(this.start=i),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ib=Lt([Oe(0,is)],ib);function rE(i){return 0<=i&&i<256}var bte=5e7,nE=12,Ste=50,xte=class extends Xe{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 fe),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 s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>bte)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,t);if(n){let l=c=>performance.now()-s>=nE?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(s,c);n.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=nE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Ste&&(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()}},sb=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let c=t.addMarker(t.ybase+t.y),u={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(u,c)),this._dataByLinkId.set(u.id,u),u.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};sb=Lt([Oe(0,is)],sb);var oE=!1,wte=class extends Xe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Th),this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onData=this._register(new fe),this.onData=this._onData.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new fe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new fe),this._instantiationService=new Yee,this.optionsService=this._register(new rte(e)),this._instantiationService.setService(ss,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ky)),this._instantiationService.setService(is,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Gy)),this._instantiationService.setService(XB,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Jy)),this._instantiationService.setService(Ga,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(eb)),this._instantiationService.setService(NB,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ba)),this._instantiationService.setService(IK,this.unicodeService),this._charsetService=this._instantiationService.createInstance(hte),this._instantiationService.setService(jK,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sb),this._instantiationService.setService(VB,this._oscLinkService),this._inputHandler=this._register(new yte(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Di.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Di.forward(this._bufferService.onResize,this._onResize)),this._register(Di.forward(this.coreService.onData,this._onData)),this._register(Di.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 xte((t,s)=>this._inputHandler.parse(t,s))),this._register(Di.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new fe),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&&!oE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),oE=!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,vD),t=Math.max(t,yD),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(GM.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(GM(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xt(()=>{for(let t of e)t.dispose()})}}},Cte={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 kte(i,e,t,s){var o;let r={type:0,cancel:!1,key:void 0},n=(i.shiftKey?1:0)|(i.altKey?2:0)|(i.ctrlKey?4:0)|(i.metaKey?8:0);switch(i.keyCode){case 0:i.key==="UIKeyInputUpArrow"?e?r.key=le.ESC+"OA":r.key=le.ESC+"[A":i.key==="UIKeyInputLeftArrow"?e?r.key=le.ESC+"OD":r.key=le.ESC+"[D":i.key==="UIKeyInputRightArrow"?e?r.key=le.ESC+"OC":r.key=le.ESC+"[C":i.key==="UIKeyInputDownArrow"&&(e?r.key=le.ESC+"OB":r.key=le.ESC+"[B");break;case 8:r.key=i.ctrlKey?"\b":le.DEL,i.altKey&&(r.key=le.ESC+r.key);break;case 9:if(i.shiftKey){r.key=le.ESC+"[Z";break}r.key=le.HT,r.cancel=!0;break;case 13:r.key=i.altKey?le.ESC+le.CR:le.CR,r.cancel=!0;break;case 27:r.key=le.ESC,i.altKey&&(r.key=le.ESC+le.ESC),r.cancel=!0;break;case 37:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"D":e?r.key=le.ESC+"OD":r.key=le.ESC+"[D";break;case 39:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"C":e?r.key=le.ESC+"OC":r.key=le.ESC+"[C";break;case 38:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"A":e?r.key=le.ESC+"OA":r.key=le.ESC+"[A";break;case 40:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"B":e?r.key=le.ESC+"OB":r.key=le.ESC+"[B";break;case 45:!i.shiftKey&&!i.ctrlKey&&(r.key=le.ESC+"[2~");break;case 46:n?r.key=le.ESC+"[3;"+(n+1)+"~":r.key=le.ESC+"[3~";break;case 36:n?r.key=le.ESC+"[1;"+(n+1)+"H":e?r.key=le.ESC+"OH":r.key=le.ESC+"[H";break;case 35:n?r.key=le.ESC+"[1;"+(n+1)+"F":e?r.key=le.ESC+"OF":r.key=le.ESC+"[F";break;case 33:i.shiftKey?r.type=2:i.ctrlKey?r.key=le.ESC+"[5;"+(n+1)+"~":r.key=le.ESC+"[5~";break;case 34:i.shiftKey?r.type=3:i.ctrlKey?r.key=le.ESC+"[6;"+(n+1)+"~":r.key=le.ESC+"[6~";break;case 112:n?r.key=le.ESC+"[1;"+(n+1)+"P":r.key=le.ESC+"OP";break;case 113:n?r.key=le.ESC+"[1;"+(n+1)+"Q":r.key=le.ESC+"OQ";break;case 114:n?r.key=le.ESC+"[1;"+(n+1)+"R":r.key=le.ESC+"OR";break;case 115:n?r.key=le.ESC+"[1;"+(n+1)+"S":r.key=le.ESC+"OS";break;case 116:n?r.key=le.ESC+"[15;"+(n+1)+"~":r.key=le.ESC+"[15~";break;case 117:n?r.key=le.ESC+"[17;"+(n+1)+"~":r.key=le.ESC+"[17~";break;case 118:n?r.key=le.ESC+"[18;"+(n+1)+"~":r.key=le.ESC+"[18~";break;case 119:n?r.key=le.ESC+"[19;"+(n+1)+"~":r.key=le.ESC+"[19~";break;case 120:n?r.key=le.ESC+"[20;"+(n+1)+"~":r.key=le.ESC+"[20~";break;case 121:n?r.key=le.ESC+"[21;"+(n+1)+"~":r.key=le.ESC+"[21~";break;case 122:n?r.key=le.ESC+"[23;"+(n+1)+"~":r.key=le.ESC+"[23~";break;case 123:n?r.key=le.ESC+"[24;"+(n+1)+"~":r.key=le.ESC+"[24~";break;default:if(i.ctrlKey&&!i.shiftKey&&!i.altKey&&!i.metaKey)i.keyCode>=65&&i.keyCode<=90?r.key=String.fromCharCode(i.keyCode-64):i.keyCode===32?r.key=le.NUL:i.keyCode>=51&&i.keyCode<=55?r.key=String.fromCharCode(i.keyCode-51+27):i.keyCode===56?r.key=le.DEL:i.keyCode===219?r.key=le.ESC:i.keyCode===220?r.key=le.FS:i.keyCode===221&&(r.key=le.GS);else if((!t||s)&&i.altKey&&!i.metaKey){let l=(o=Cte[i.keyCode])==null?void 0:o[i.shiftKey?1:0];if(l)r.key=le.ESC+l;else if(i.keyCode>=65&&i.keyCode<=90){let c=i.ctrlKey?i.keyCode-64:i.keyCode+32,u=String.fromCharCode(c);i.shiftKey&&(u=u.toUpperCase()),r.key=le.ESC+u}else if(i.keyCode===32)r.key=le.ESC+(i.ctrlKey?le.NUL:" ");else if(i.key==="Dead"&&i.code.startsWith("Key")){let c=i.code.slice(3,4);i.shiftKey||(c=c.toLowerCase()),r.key=le.ESC+c,r.cancel=!0}}else t&&!i.altKey&&!i.ctrlKey&&!i.shiftKey&&i.metaKey?i.keyCode===65&&(r.type=1):i.key&&!i.ctrlKey&&!i.altKey&&!i.metaKey&&i.keyCode>=48&&i.key.length===1?r.key=i.key:i.key&&i.ctrlKey&&(i.key==="_"&&(r.key=le.US),i.key==="@"&&(r.key=le.NUL));break}return r}var Dt=0,Tte=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new tg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new tg,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((n,o)=>this._getKey(n)-this._getKey(o)),t=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<r.length;n++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(r[n]=e[t],t++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Dt=this._search(t),Dt===-1)||this._getKey(this._array[Dt])!==t)return!1;do if(this._array[Dt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Dt),!0;while(++Dt<this._array.length&&this._getKey(this._array[Dt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),t=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:s[r++]=this._array[n];this._array=s,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&&(Dt=this._search(e),!(Dt<0||Dt>=this._array.length)&&this._getKey(this._array[Dt])===e))do yield this._array[Dt];while(++Dt<this._array.length&&this._getKey(this._array[Dt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Dt=this._search(e),!(Dt<0||Dt>=this._array.length)&&this._getKey(this._array[Dt])===e))do t(this._array[Dt]);while(++Dt<this._array.length&&this._getKey(this._array[Dt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let r=t+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},dv=0,aE=0,Ate=class extends Xe{constructor(){super(),this._decorations=new Tte(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this._register(new fe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new fe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(i){if(i.marker.isDisposed)return;let e=new Mte(i);if(e){let t=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),t.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,e,t){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),i>=s&&i<r&&(!t||(n.options.layer??"bottom")===t)&&(yield n)}forEachDecorationAtCell(i,e,t,s){this._decorations.forEachByKey(e,r=>{dv=r.options.x??0,aE=dv+(r.options.width??1),i>=dv&&i<aE&&(!t||(r.options.layer??"bottom")===t)&&s(r)})}},Mte=class extends Vo{constructor(i){super(),this.options=i,this.onRenderEmitter=this.add(new fe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new fe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},Ete=1e3,Pte=class{constructor(e,t=Ete){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},lE=20,ig=class extends Xe{constructor(i,e,t,s){super(),this._terminal=i,this._coreBrowserService=t,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new Pte(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
102
|
-
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Qe(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let e=0;e<i;e++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<
|
|
103
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===lE+1&&(this._liveRegion.textContent+=xy.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,e){this._liveRegionDebouncer.refresh(i,e,this._terminal.rows)}_renderRows(i,e){let t=this._terminal.buffer,s=t.lines.length.toString();for(let r=i;r<=e;r++){let n=t.lines.get(t.ydisp+r),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",c=(t.ydisp+r+1).toString(),u=this._rowElements[r];u&&(l.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=l,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",s),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,e){let t=i.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=t.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||i.relatedTarget!==s)return;let o,l;if(e===0?(o=t,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=t,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let i=this._coreBrowserService.mainDocument.getSelection();if(!i)return;if(i.isCollapsed){this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection();return}if(!i.anchorNode||!i.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:i.anchorNode,offset:i.anchorOffset},t={node:i.focusNode,offset:i.focusOffset};if((e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===t.node&&e.offset>t.offset)&&([e,t]=[t,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(t.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(t={node:s,offset:((l=s.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(t.node))return;let r=({node:c,offset:u})=>{let d=c instanceof Text?c.parentNode:c,m=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let _=u<g.length?g[u]:g.slice(-1)[0]+1;return _>=this._terminal.cols&&(++m,_=0),{row:m,column:_}},n=r(e),o=r(t);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i]),this._alignRowWidth(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(i){var r,n;i.style.transform="";let e=i.getBoundingClientRect().width,t=(n=(r=this._rowColumns.get(i))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!t)return;let s=t*this._renderService.dimensions.css.cell.width;i.style.transform=`scaleX(${s/e})`}};ig=Lt([Oe(1,IS),Oe(2,Un),Oe(3,Yn)],ig);var rb=class extends Xe{constructor(i,e,t,s,r){super(),this._element=i,this._mouseService=e,this._renderService=t,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new fe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new fe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xt(()=>{var n;Ua(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Qe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Qe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Qe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Qe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(i){this._lastMouseEvent=i;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=i.composedPath();for(let s=0;s<t.length;s++){let r=t[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized){this._clearCurrentLink(),this._askForLink(i,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,e){var s,r;(!this._activeProviderReplies||!e)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let t=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(r=this._activeProviderReplies)!=null&&r.get(n)&&(t=this._checkLinkProviderResult(n,i,t)):o.provideLinks(i.y,l=>{var u,d;if(this._isMouseOut)return;let c=l==null?void 0:l.map(m=>({link:m}));(u=this._activeProviderReplies)==null||u.set(n,c),t=this._checkLinkProviderResult(n,i,t),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,e){let t=new Set;for(let s=0;s<e.size;s++){let r=e.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],l=o.link.range.start.y<i?0:o.link.range.start.x,c=o.link.range.end.y>i?this._bufferService.cols:o.link.range.end.x;for(let u=l;u<=c;u++){if(t.has(u)){r.splice(n--,1);break}t.add(u)}}}}_checkLinkProviderResult(i,e,t){var n;if(!this._activeProviderReplies)return t;let s=this._activeProviderReplies.get(i),r=!1;for(let o=0;o<i;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(l=>this._linkAtPosition(l.link,e));o&&(t=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(c=>this._linkAtPosition(c.link,e));if(l){t=!0,this._handleNewLink(l);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._mouseDownLink&&Qte(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,e){!this._currentLink||!this._lastMouseEvent||(!i||!e||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ua(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(i){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(i.link,e)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0?!0:i.link.decorations.underline,pointerCursor:i.link.decorations===void 0?!0:i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var t,s;return(s=(t=this._currentLink)==null?void 0:t.state)==null?void 0:s.decorations.pointerCursor},set:t=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>{var t,s;return(s=(t=this._currentLink)==null?void 0:t.state)==null?void 0:s.decorations.underline},set:t=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;let s=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(i,e,t){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(i,e){let t=i.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-s-1,t.end.x,t.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(i,e,t){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(i,e){let t=i.range.start.y*this._bufferService.cols+i.range.start.x,s=i.range.end.y*this._bufferService.cols+i.range.end.x,r=e.y*this._bufferService.cols+e.x;return t<=r&&r<=s}_positionFromMouseEvent(i,e,t){let s=t.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,t,s,r){return{x1:i,y1:e,x2:t,y2:s,cols:this._bufferService.cols,fg:r}}};rb=Lt([Oe(1,qS),Oe(2,Yn),Oe(3,is),Oe(4,jB)],rb);function Qte(i,e){return i.text===e.text&&i.range.start.x===e.range.start.x&&i.range.start.y===e.range.start.y&&i.range.end.x===e.range.end.x&&i.range.end.y===e.range.end.y}var Rte=class extends wte{constructor(e={}){super(e),this._linkifier=this._register(new Th),this.browser=lD,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Th),this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new fe),this.onKey=this._onKey.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new fe),this.onBell=this._onBell.event,this._onFocus=this._register(new fe),this._onBlur=this._register(new fe),this._onA11yCharEmitter=this._register(new fe),this._onA11yTabEmitter=this._register(new fe),this._onWillOpen=this._register(new fe),this._setup(),this._decorationService=this._instantiationService.createInstance(Ate),this._instantiationService.setService(Mf,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(See),this._instantiationService.setService(jB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Cy)),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(Di.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Di.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Di.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Di.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(xt(()=>{var t,s;this._customKeyEventHandler=void 0,(s=(t=this.element)==null?void 0:t.parentNode)==null||s.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 s,r="";switch(t.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+t.index}switch(t.type){case 0:let n=vt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${le.ESC}]${r};${_te(n)}${oD.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Ut.toColor(...t.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=Ut.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(ig,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(le.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(le.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 s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=t.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Qe(this.element,"copy",t=>{this.hasSelection()&&DK(t,this._selectionService)}));let e=t=>zK(t,this.textarea,this.coreService,this.optionsService);this._register(Qe(this.textarea,"paste",e)),this._register(Qe(this.element,"paste",e)),hD?this._register(Qe(this.element,"mousedown",t=>{t.button===2&&_M(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Qe(this.element,"contextmenu",t=>{_M(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),JS&&this._register(Qe(this.element,"auxclick",t=>{t.button===1&&LB(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Qe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Qe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Qe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Qe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Qe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Qe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Qe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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(Qe(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Sy.get()),fD||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(yee,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Un,this._coreBrowserService),this._register(Qe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Qe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wy,this._document,this._helperContainer),this._instantiationService.setService(xg,this._charSizeService),this._themeService=this._instantiationService.createInstance(Fy),this._instantiationService.setService(Dh,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Jm),this._instantiationService.setService(ZB,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Yy,this.rows,this.screenElement)),this._instantiationService.setService(Yn,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(jy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Uy),this._instantiationService.setService(qS,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rb,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(Vy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Hy,this.element,this.screenElement,r)),this._instantiationService.setService(WK,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Di.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Zy,this.screenElement)),this._register(Qe(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ig,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Km,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Km,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(qy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(o){var d,m,g,_,y;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let c,u;switch(o.overrideType||o.type){case"mousemove":u=32,o.buttons===void 0?(c=3,o.button!==void 0&&(c=o.button<3?o.button:3)):c=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":u=0,c=o.button<3?o.button:3;break;case"mousedown":u=1,c=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let b=o.deltaY;if(b===0||e.coreMouseService.consumeWheelEvent(o,(_=(g=(m=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:m.device)==null?void 0:g.cell)==null?void 0:_.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;u=b<0?0:1,c=4;break;default:return!1}return u===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:u,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(t.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Qe(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(Qe(t,"wheel",o=>{var l,c,u,d,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(d=(u=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:u.cell)==null?void 0:d.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(o,!0);let g=le.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var s;(s=this._renderService)==null||s.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){RB(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,s){this._selectionService.setSelection(e,t,s)}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 s;(s=this._selectionService)==null||s.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 s=kte(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===le.ETX||s.key===le.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(Lte(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 s;(s=this._charSizeService)==null||s.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(It));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(le.ESC+"[I"):this.coreService.triggerDataEvent(le.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${le.ESC}[4;${s};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${le.ESC}[6;${n};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function Lte(i){return i.keyCode===16||i.keyCode===17||i.keyCode===18}var $te=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;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)}},Bte=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 lr)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},hE=class{constructor(i,e){this._buffer=i,this.type=e}init(i){return this._buffer=i,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(i){let e=this._buffer.lines.get(i);if(e)return new Bte(e)}getNullCell(){return new lr}},Dte=class extends Xe{constructor(i){super(),this._core=i,this._onBufferChange=this._register(new fe),this.onBufferChange=this._onBufferChange.event,this._normal=new hE(this._core.buffers.normal,"normal"),this._alternate=new hE(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)}},zte=class{constructor(i){this._core=i}registerCsiHandler(i,e){return this._core.registerCsiHandler(i,t=>e(t.toArray()))}addCsiHandler(i,e){return this.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._core.registerDcsHandler(i,(t,s)=>e(t,s.toArray()))}addDcsHandler(i,e){return this.registerDcsHandler(i,e)}registerEscHandler(i,e){return this._core.registerEscHandler(i,e)}addEscHandler(i,e){return this.registerEscHandler(i,e)}registerOscHandler(i,e){return this._core.registerOscHandler(i,e)}addOscHandler(i,e){return this.registerOscHandler(i,e)}},Nte=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}},Xte=["cols","rows"],Dr=0,Vte=class extends Xe{constructor(i){super(),this._core=this._register(new Rte(i)),this._addonManager=this._register(new $te),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],t=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(i){if(Xte.includes(i))throw new Error(`Option "${i}" 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 zte(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new Nte(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 Dte(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let i=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,synchronizedOutputMode:i.synchronizedOutput,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(let e in i)this._publicOptions[e]=i[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,e=!0){this._core.input(i,e)}resize(i,e){this._verifyIntegers(i,e),this._core.resize(i,e)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}attachCustomWheelEventHandler(i){this._core.attachCustomWheelEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){return this._checkProposedApi(),this._verifyPositiveIntegers(i.x??0,i.width??0,i.height??0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,e,t){this._verifyIntegers(i,e,t),this._core.select(i,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,e){this._verifyIntegers(i,e),this._core.selectLines(i,e)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,e){this._core.write(i,e)}writeln(i,e){this._core.write(i),this._core.write(`\r
|
|
104
|
-
`,e)}paste(i){this._core.paste(i)}refresh(i,e){this._verifyIntegers(i,e),this._core.refresh(i,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return{get promptLabel(){return Sy.get()},set promptLabel(i){Sy.set(i)},get tooMuchOutput(){return xy.get()},set tooMuchOutput(i){xy.set(i)}}}_verifyIntegers(...i){for(
|
|
108
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),ex&&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),s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r||!t?!1:this._areCoordsInSelection(t,s,r)}isCellInSelection(e,t){let s=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!s||!r?!1:this._areCoordsInSelection([e,t],s,r)}_areCoordsInSelection(e,t,s){return e[1]>t[1]&&e[1]<s[1]||t[1]===s[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<s[0]||t[1]<s[1]&&e[1]===s[1]&&e[0]<s[0]||t[1]<s[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var n,o;let s=(o=(n=this._linkifier.currentLink)==null?void 0:n.link)==null?void 0:o.range;if(s)return this._model.selectionStart=[s.start.x-1,s.start.y-1],this._model.selectionStartLength=dE(s,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=JS(this._coreBrowserService.window,e,this._screenElement)[1],s=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=s?0:(t>s&&(t-=s),t=Math.min(Math.max(t,-Ev),Ev),t/=Ev,t/Math.abs(t)+Math.round(t*(fte-1)))}shouldForceSelection(e){return eg?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(),dte)}_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&&!(eg&&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 s=this._bufferService.buffer;if(this._model.selectionEnd[1]<s.lines.length){let r=s.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<pte&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let s=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(s&&s[0]!==void 0&&s[1]!==void 0){let r=rte(s[0]-1,s[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,s=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!s){this._oldHasSelection&&this._fireOnSelectionChange(e,t,s);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,s)}_fireOnSelectionChange(e,t,s){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=s,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let s=t;for(let r=0;t>=r;r++){let n=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?s--:n>1&&t!==r&&(s+=n-1)}return s}setSelection(e,t,s){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=s,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,s=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let n=this._bufferService.buffer,o=n.lines.get(e[1]);if(!o)return;let l=n.translateBufferLineToString(e[1],!1),c=this._convertViewportColToCharacterIndex(o,e[0]),u=c,d=e[0]-c,m=0,g=0,_=0,y=0;if(l.charAt(c)===" "){for(;c>0&&l.charAt(c-1)===" ";)c--;for(;u<l.length&&l.charAt(u+1)===" ";)u++}else{let w=e[0],k=e[0];o.getWidth(w)===0&&(m++,w--),o.getWidth(k)===2&&(g++,k++);let C=o.getString(k).length;for(C>1&&(y+=C-1,u+=C-1);w>0&&c>0&&!this._isCharWordSeparator(o.loadCell(w-1,this._workCell));){o.loadCell(w-1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===0?(m++,w--):A>1&&(_+=A-1,c-=A-1),c--,w--}for(;k<o.length&&u+1<l.length&&!this._isCharWordSeparator(o.loadCell(k+1,this._workCell));){o.loadCell(k+1,this._workCell);let A=this._workCell.getChars().length;this._workCell.getWidth()===2?(g++,k++):A>1&&(y+=A-1,u+=A-1),u++,k++}}u++;let b=c+d-m+_,x=Math.min(this._bufferService.cols,u-c+m+g-_-y);if(!(!t&&l.slice(c,u).trim()==="")){if(s&&b===0&&o.getCodePoint(0)!==32){let w=n.lines.get(e[1]-1);if(w&&o.isWrapped&&w.getCodePoint(this._bufferService.cols-1)!==32){let k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){let C=this._bufferService.cols-k.start;b-=C,x+=C}}}if(r&&b+x===this._bufferService.cols&&o.getCodePoint(this._bufferService.cols-1)!==32){let w=n.lines.get(e[1]+1);if(w!=null&&w.isWrapped&&w.getCodePoint(0)!==32){let k=this._getWordAt([0,e[1]+1],!1,!1,!0);k&&(x+=k.length)}}return{start:b,length:x}}}_selectWordAt(e,t){let s=this._getWordAt(e,t);if(s){for(;s.start<0;)s.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[s.start,e[1]],this._model.selectionStartLength=s.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let s=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,s--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,s++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,s]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),s={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=dE(s,this._bufferService.cols)}};Hy=Lt([Oe(3,is),Oe(4,Ja),Oe(5,WS),Oe(6,ss),Oe(7,Yn),Oe(8,Un)],Hy);var pE=class{constructor(){this._data={}}set(e,t,s){this._data[e]||(this._data[e]={}),this._data[e][t]=s}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},mE=class{constructor(){this._color=new pE,this._css=new pE}setCss(e,t,s){this._css.set(e,t,s)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,s){this._color.set(e,t,s)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ei=Object.freeze((()=>{let i=[Ct.toColor("#2e3436"),Ct.toColor("#cc0000"),Ct.toColor("#4e9a06"),Ct.toColor("#c4a000"),Ct.toColor("#3465a4"),Ct.toColor("#75507b"),Ct.toColor("#06989a"),Ct.toColor("#d3d7cf"),Ct.toColor("#555753"),Ct.toColor("#ef2929"),Ct.toColor("#8ae234"),Ct.toColor("#fce94f"),Ct.toColor("#729fcf"),Ct.toColor("#ad7fa8"),Ct.toColor("#34e2e2"),Ct.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let t=0;t<216;t++){let s=e[t/36%6|0],r=e[t/6%6|0],n=e[t%6];i.push({css:Ut.toCss(s,r,n),rgba:Ut.toRgba(s,r,n)})}for(let t=0;t<24;t++){let s=8+t*10;i.push({css:Ut.toCss(s,s,s),rgba:Ut.toRgba(s,s,s)})}return i})()),Ca=Ct.toColor("#ffffff"),fu=Ct.toColor("#000000"),gE=Ct.toColor("#ffffff"),OE=fu,Gc={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},Ote=Ca,Fy=class extends Xe{constructor(e){super(),this._optionsService=e,this._contrastCache=new mE,this._halfContrastCache=new mE,this._onChangeColors=this._register(new fe),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:Ca,background:fu,cursor:gE,cursorAccent:OE,selectionForeground:void 0,selectionBackgroundTransparent:Gc,selectionBackgroundOpaque:vt.blend(fu,Gc),selectionInactiveBackgroundTransparent:Gc,selectionInactiveBackgroundOpaque:vt.blend(fu,Gc),scrollbarSliderBackground:vt.opacity(Ca,.2),scrollbarSliderHoverBackground:vt.opacity(Ca,.4),scrollbarSliderActiveBackground:vt.opacity(Ca,.5),overviewRulerBorder:Ca,ansi:ei.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=ot(e.foreground,Ca),t.background=ot(e.background,fu),t.cursor=vt.blend(t.background,ot(e.cursor,gE)),t.cursorAccent=vt.blend(t.background,ot(e.cursorAccent,OE)),t.selectionBackgroundTransparent=ot(e.selectionBackground,Gc),t.selectionBackgroundOpaque=vt.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=ot(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=vt.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?ot(e.selectionForeground,cE):void 0,t.selectionForeground===cE&&(t.selectionForeground=void 0),vt.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=vt.opacity(t.selectionBackgroundTransparent,.3)),vt.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=vt.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=ot(e.scrollbarSliderBackground,vt.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=ot(e.scrollbarSliderHoverBackground,vt.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=ot(e.scrollbarSliderActiveBackground,vt.opacity(t.foreground,.5)),t.overviewRulerBorder=ot(e.overviewRulerBorder,Ote),t.ansi=ei.slice(),t.ansi[0]=ot(e.black,ei[0]),t.ansi[1]=ot(e.red,ei[1]),t.ansi[2]=ot(e.green,ei[2]),t.ansi[3]=ot(e.yellow,ei[3]),t.ansi[4]=ot(e.blue,ei[4]),t.ansi[5]=ot(e.magenta,ei[5]),t.ansi[6]=ot(e.cyan,ei[6]),t.ansi[7]=ot(e.white,ei[7]),t.ansi[8]=ot(e.brightBlack,ei[8]),t.ansi[9]=ot(e.brightRed,ei[9]),t.ansi[10]=ot(e.brightGreen,ei[10]),t.ansi[11]=ot(e.brightYellow,ei[11]),t.ansi[12]=ot(e.brightBlue,ei[12]),t.ansi[13]=ot(e.brightMagenta,ei[13]),t.ansi[14]=ot(e.brightCyan,ei[14]),t.ansi[15]=ot(e.brightWhite,ei[15]),e.extendedAnsi){let s=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<s;r++)t.ansi[r+16]=ot(e.extendedAnsi[r],ei[r+16])}this._contrastCache.clear(),this._halfContrastCache.clear(),this._updateRestoreColors(),this._onChangeColors.fire(this.colors)}restoreColor(e){this._restoreColor(e),this._onChangeColors.fire(this.colors)}_restoreColor(e){if(e===void 0){for(let t=0;t<this._restoreColors.ansi.length;++t)this._colors.ansi[t]=this._restoreColors.ansi[t];return}switch(e){case 256:this._colors.foreground=this._restoreColors.foreground;break;case 257:this._colors.background=this._restoreColors.background;break;case 258:this._colors.cursor=this._restoreColors.cursor;break;default:this._colors.ansi[e]=this._restoreColors.ansi[e]}}modifyColors(e){e(this._colors),this._onChangeColors.fire(this.colors)}_updateRestoreColors(){this._restoreColors={foreground:this._colors.foreground,background:this._colors.background,cursor:this._colors.cursor,ansi:this._colors.ansi.slice()}}};Fy=Lt([Oe(0,ss)],Fy);function ot(i,e){if(i!==void 0)try{return Ct.toColor(i)}catch{}return e}var _te=class{constructor(...e){this._entries=new Map;for(let[t,s]of e)this.set(t,s)}set(e,t){let s=this._entries.get(e);return this._entries.set(e,t),s}forEach(e){for(let[t,s]of this._entries.entries())e(t,s)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},vte=class{constructor(){this._services=new _te,this._services.set(qS,this)}setService(i,e){this._services.set(i,e)}getService(i){return this._services.get(i)}createInstance(i,...e){let t=fJ(i).sort((n,o)=>n.index-o.index),s=[];for(let n of t){let o=this._services.get(n.id);if(!o)throw new Error(`[createInstance] ${i.name} depends on UNKNOWN service ${n.id._id}.`);s.push(o)}let r=t.length>0?t[0].index:e.length;if(e.length!==r)throw new Error(`[createInstance] First service dependency of ${i.name} at position ${r+1} conflicts with ${e.length} static arguments`);return new i(...e,...s)}},yte={trace:0,debug:1,info:2,warn:3,error:4,off:5},bte="xterm.js: ",Gy=class extends Xe{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=yte[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,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":bte)+t,...s)}trace(e,...t){var s;this._logLevel<=0&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var s;this._logLevel<=1&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var s;this._logLevel<=2&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var s;this._logLevel<=3&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var s;this._logLevel<=4&&this._log(((s=this._optionsService.options.logger)==null?void 0:s.error.bind(this._optionsService.options.logger))??console.error,e,t)}};Gy=Lt([Oe(0,ss)],Gy);var _E=class extends Xe{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new fe),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new fe),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new fe),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 s=0;s<Math.min(e,this.length);s++)t[s]=this._array[this._getCyclicIndex(s)];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,...s){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+s.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<s.length;r++)this._array[this._getCyclicIndex(e+r)]=s[r];if(s.length&&this.onInsertEmitter.fire({index:e,amount:s.length}),this._length+s.length>this._maxLength){let r=this._length+s.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=s.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,s){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+s<0)throw new Error("Cannot shift elements in list beyond index 0");if(s>0){for(let n=t-1;n>=0;n--)this.set(e+n+s,this.get(e+n));let r=e+t+s-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+s,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ze=3,It=Object.freeze(new Af),Pp=0,Pv=2,du=class yD{constructor(e,t,s=!1){this.isWrapped=s,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(e*ze);let r=t||lr.fromCharData([0,NB,1,0]);for(let n=0;n<e;++n)this.setCell(n,r);this.length=e}get(e){let t=this._data[e*ze+0],s=t&2097151;return[this._data[e*ze+1],t&2097152?this._combined[e]:s?$o(s):"",t>>22,t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):s]}set(e,t){this._data[e*ze+1]=t[0],t[1].length>1?(this._combined[e]=t[1],this._data[e*ze+0]=e|2097152|t[2]<<22):this._data[e*ze+0]=t[1].charCodeAt(0)|t[2]<<22}getWidth(e){return this._data[e*ze+0]>>22}hasWidth(e){return this._data[e*ze+0]&12582912}getFg(e){return this._data[e*ze+1]}getBg(e){return this._data[e*ze+2]}hasContent(e){return this._data[e*ze+0]&4194303}getCodePoint(e){let t=this._data[e*ze+0];return t&2097152?this._combined[e].charCodeAt(this._combined[e].length-1):t&2097151}isCombined(e){return this._data[e*ze+0]&2097152}getString(e){let t=this._data[e*ze+0];return t&2097152?this._combined[e]:t&2097151?$o(t&2097151):""}isProtected(e){return this._data[e*ze+2]&536870912}loadCell(e,t){return Pp=e*ze,t.content=this._data[Pp+0],t.fg=this._data[Pp+1],t.bg=this._data[Pp+2],t.content&2097152&&(t.combinedData=this._combined[e]),t.bg&268435456&&(t.extended=this._extendedAttrs[e]),t}setCell(e,t){t.content&2097152&&(this._combined[e]=t.combinedData),t.bg&268435456&&(this._extendedAttrs[e]=t.extended),this._data[e*ze+0]=t.content,this._data[e*ze+1]=t.fg,this._data[e*ze+2]=t.bg}setCellFromCodepoint(e,t,s,r){r.bg&268435456&&(this._extendedAttrs[e]=r.extended),this._data[e*ze+0]=t|s<<22,this._data[e*ze+1]=r.fg,this._data[e*ze+2]=r.bg}addCodepointToCell(e,t,s){let r=this._data[e*ze+0];r&2097152?this._combined[e]+=$o(t):r&2097151?(this._combined[e]=$o(r&2097151)+$o(t),r&=-2097152,r|=2097152):r=t|1<<22,s&&(r&=-12582913,r|=s<<22),this._data[e*ze+0]=r}insertCells(e,t,s){if(e%=this.length,e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length-e){let r=new lr;for(let n=this.length-e-t-1;n>=0;--n)this.setCell(e+t+n,this.loadCell(e+n,r));for(let n=0;n<t;++n)this.setCell(e+n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,s)}deleteCells(e,t,s){if(e%=this.length,t<this.length-e){let r=new lr;for(let n=0;n<this.length-e-t;++n)this.setCell(e+n,this.loadCell(e+t+n,r));for(let n=this.length-t;n<this.length;++n)this.setCell(n,s)}else for(let r=e;r<this.length;++r)this.setCell(r,s);e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),this.getWidth(e)===0&&!this.hasContent(e)&&this.setCellFromCodepoint(e,0,1,s)}replaceCells(e,t,s,r=!1){if(r){for(e&&this.getWidth(e-1)===2&&!this.isProtected(e-1)&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&this.getWidth(t-1)===2&&!this.isProtected(t)&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.isProtected(e)||this.setCell(e,s),e++;return}for(e&&this.getWidth(e-1)===2&&this.setCellFromCodepoint(e-1,0,1,s),t<this.length&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t,0,1,s);e<t&&e<this.length;)this.setCell(e++,s)}resize(e,t){if(e===this.length)return this._data.length*4*Pv<this._data.buffer.byteLength;let s=e*ze;if(e>this.length){if(this._data.buffer.byteLength>=s*4)this._data=new Uint32Array(this._data.buffer,0,s);else{let r=new Uint32Array(s);r.set(this._data),this._data=r}for(let r=this.length;r<e;++r)this.setCell(r,t)}else{this._data=this._data.subarray(0,s);let r=Object.keys(this._combined);for(let o=0;o<r.length;o++){let l=parseInt(r[o],10);l>=e&&delete this._combined[l]}let n=Object.keys(this._extendedAttrs);for(let o=0;o<n.length;o++){let l=parseInt(n[o],10);l>=e&&delete this._extendedAttrs[l]}}return this.length=e,s*4*Pv<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Pv<this._data.buffer.byteLength){let e=new Uint32Array(this._data.length);return e.set(this._data),this._data=e,1}return 0}fill(e,t=!1){if(t){for(let s=0;s<this.length;++s)this.isProtected(s)||this.setCell(s,e);return}this._combined={},this._extendedAttrs={};for(let s=0;s<this.length;++s)this.setCell(s,e)}copyFrom(e){this.length!==e.length?this._data=new Uint32Array(e._data):this._data.set(e._data),this.length=e.length,this._combined={};for(let t in e._combined)this._combined[t]=e._combined[t];this._extendedAttrs={};for(let t in e._extendedAttrs)this._extendedAttrs[t]=e._extendedAttrs[t];this.isWrapped=e.isWrapped}clone(){let e=new yD(0);e._data=new Uint32Array(this._data),e.length=this.length;for(let t in this._combined)e._combined[t]=this._combined[t];for(let t in this._extendedAttrs)e._extendedAttrs[t]=this._extendedAttrs[t];return e.isWrapped=this.isWrapped,e}getTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*ze+0]&4194303)return e+(this._data[e*ze+0]>>22);return 0}getNoBgTrimmedLength(){for(let e=this.length-1;e>=0;--e)if(this._data[e*ze+0]&4194303||this._data[e*ze+2]&50331648)return e+(this._data[e*ze+0]>>22);return 0}copyCellsFrom(e,t,s,r,n){let o=e._data;if(n)for(let c=r-1;c>=0;c--){for(let u=0;u<ze;u++)this._data[(s+c)*ze+u]=o[(t+c)*ze+u];o[(t+c)*ze+2]&268435456&&(this._extendedAttrs[s+c]=e._extendedAttrs[t+c])}else for(let c=0;c<r;c++){for(let u=0;u<ze;u++)this._data[(s+c)*ze+u]=o[(t+c)*ze+u];o[(t+c)*ze+2]&268435456&&(this._extendedAttrs[s+c]=e._extendedAttrs[t+c])}let l=Object.keys(e._combined);for(let c=0;c<l.length;c++){let u=parseInt(l[c],10);u>=t&&(this._combined[u-t+s]=e._combined[u])}}translateToString(e,t,s,r){t=t??0,s=s??this.length,e&&(s=Math.min(s,this.getTrimmedLength())),r&&(r.length=0);let n="";for(;t<s;){let o=this._data[t*ze+0],l=o&2097151,c=o&2097152?this._combined[t]:l?$o(l):No;if(n+=c,r)for(let u=0;u<c.length;++u)r.push(t);t+=o>>22||1}return r&&r.push(t),n}};function Ste(i,e,t,s,r,n){let o=[];for(let l=0;l<i.length-1;l++){let c=l,u=i.get(++c);if(!u.isWrapped)continue;let d=[i.get(l)];for(;c<i.length&&u.isWrapped;)d.push(u),u=i.get(++c);if(!n&&s>=l&&s<c){l+=d.length-1;continue}let m=0,g=cf(d,m,e),_=1,y=0;for(;_<d.length;){let x=cf(d,_,e),w=x-y,k=t-g,C=Math.min(w,k);d[m].copyCellsFrom(d[_],y,g,C,!1),g+=C,g===t&&(m++,g=0),y+=C,y===x&&(_++,y=0),g===0&&m!==0&&d[m-1].getWidth(t-1)===2&&(d[m].copyCellsFrom(d[m-1],t-1,g++,1,!1),d[m-1].setCell(t-1,r))}d[m].replaceCells(g,t,r);let b=0;for(let x=d.length-1;x>0&&(x>m||d[x].getTrimmedLength()===0);x--)b++;b>0&&(o.push(l+d.length-b),o.push(b)),l+=d.length-1}return o}function xte(i,e){let t=[],s=0,r=e[s],n=0;for(let o=0;o<i.length;o++)if(r===o){let l=e[++s];i.onDeleteEmitter.fire({index:o-n,amount:l}),o+=l-1,n+=l,r=e[++s]}else t.push(o);return{layout:t,countRemoved:n}}function wte(i,e){let t=[];for(let s=0;s<e.length;s++)t.push(i.get(e[s]));for(let s=0;s<t.length;s++)i.set(s,t[s]);i.length=e.length}function Cte(i,e,t){let s=[],r=i.map((c,u)=>cf(i,u,e)).reduce((c,u)=>c+u),n=0,o=0,l=0;for(;l<r;){if(r-l<t){s.push(r-l);break}n+=t;let c=cf(i,o,e);n>c&&(n-=c,o++);let u=i[o].getWidth(n-1)===2;u&&n--;let d=u?t-1:t;s.push(d),l+=d}return s}function cf(i,e,t){if(e===i.length-1)return i[e].getTrimmedLength();let s=!i[e].hasContent(t-1)&&i[e].getWidth(t-1)===1,r=i[e+1].getWidth(0)===2;return s&&r?t-1:t}var bD=class SD{constructor(e){this.line=e,this.isDisposed=!1,this._disposables=[],this._id=SD._nextId++,this._onDispose=this.register(new fe),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Ua(this._disposables),this._disposables.length=0)}register(e){return this._disposables.push(e),e}};bD._nextId=1;var kte=bD,ni={},ka=ni.B;ni[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:"≥","{":"π","|":"≠","}":"£","~":"·"};ni.A={"#":"£"};ni.B=void 0;ni[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};ni.C=ni[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ni.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};ni.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};ni.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};ni.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};ni.E=ni[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};ni.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};ni.H=ni[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};ni["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var vE=4294967295,yE=class{constructor(i,e,t){this._hasScrollback=i,this._optionsService=e,this._bufferService=t,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=It.clone(),this.savedCharset=ka,this.markers=[],this._nullCell=lr.fromCharData([0,NB,1,0]),this._whitespaceCell=lr.fromCharData([0,No,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new tg,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new _E(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(i){return i?(this._nullCell.fg=i.fg,this._nullCell.bg=i.bg,this._nullCell.extended=i.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new Gm),this._nullCell}getWhitespaceCell(i){return i?(this._whitespaceCell.fg=i.fg,this._whitespaceCell.bg=i.bg,this._whitespaceCell.extended=i.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new Gm),this._whitespaceCell}getBlankLine(i,e){return new du(this._bufferService.cols,this.getNullCell(i),e)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let i=this.ybase+this.y-this.ydisp;return i>=0&&i<this._rows}_getCorrectBufferLength(i){if(!this._hasScrollback)return i;let e=i+this._optionsService.rawOptions.scrollback;return e>vE?vE:e}fillViewportRows(i){if(this.lines.length===0){i===void 0&&(i=It);let e=this._rows;for(;e--;)this.lines.push(this.getBlankLine(i))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new _E(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(i,e){let t=this.getNullCell(It),s=0,r=this._getCorrectBufferLength(e);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols<i)for(let o=0;o<this.lines.length;o++)s+=+this.lines.get(o).resize(i,t);let n=0;if(this._rows<e)for(let o=this._rows;o<e;o++)this.lines.length<e+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new du(i,t)):this.ybase>0&&this.lines.length<=this.ybase+this.y+n+1?(this.ybase--,n++,this.ydisp>0&&this.ydisp--):this.lines.push(new du(i,t)));else for(let o=this._rows;o>e;o--)this.lines.length>e+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r<this.lines.maxLength){let o=this.lines.length-r;o>0&&(this.lines.trimStart(o),this.ybase=Math.max(this.ybase-o,0),this.ydisp=Math.max(this.ydisp-o,0),this.savedY=Math.max(this.savedY-o,0)),this.lines.maxLength=r}this.x=Math.min(this.x,i-1),this.y=Math.min(this.y,e-1),n&&(this.y+=n),this.savedX=Math.min(this.savedX,i-1),this.scrollTop=0}if(this.scrollBottom=e-1,this._isReflowEnabled&&(this._reflow(i,e),this._cols>i))for(let n=0;n<this.lines.length;n++)s+=+this.lines.get(n).resize(i,t);this._cols=i,this._rows=e,this._memoryCleanupQueue.clear(),s>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let i=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,i=!1);let e=0;for(;this._memoryCleanupPosition<this.lines.length;)if(e+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),e>100)return!0;return i}get _isReflowEnabled(){let i=this._optionsService.rawOptions.windowsPty;return i&&i.buildNumber?this._hasScrollback&&i.backend==="conpty"&&i.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(i,e){this._cols!==i&&(i>this._cols?this._reflowLarger(i,e):this._reflowSmaller(i,e))}_reflowLarger(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,s=Ste(this.lines,this._cols,i,this.ybase+this.y,this.getNullCell(It),t);if(s.length>0){let r=xte(this.lines,s);wte(this.lines,r.layout),this._reflowLargerAdjustViewport(i,e,r.countRemoved)}}_reflowLargerAdjustViewport(i,e,t){let s=this.getNullCell(It),r=t;for(;r-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<e&&this.lines.push(new du(i,s))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-t,0)}_reflowSmaller(i,e){let t=this._optionsService.rawOptions.reflowCursorLine,s=this.getNullCell(It),r=[],n=0;for(let o=this.lines.length-1;o>=0;o--){let l=this.lines.get(o);if(!l||!l.isWrapped&&l.getTrimmedLength()<=i)continue;let c=[l];for(;l.isWrapped&&o>0;)l=this.lines.get(--o),c.unshift(l);if(!t){let C=this.ybase+this.y;if(C>=o&&C<o+c.length)continue}let u=c[c.length-1].getTrimmedLength(),d=Cte(c,this._cols,i),m=d.length-c.length,g;this.ybase===0&&this.y!==this.lines.length-1?g=Math.max(0,this.y-this.lines.maxLength+m):g=Math.max(0,this.lines.length-this.lines.maxLength+m);let _=[];for(let C=0;C<m;C++){let A=this.getBlankLine(It,!0);_.push(A)}_.length>0&&(r.push({start:o+c.length+n,newLines:_}),n+=_.length),c.push(..._);let y=d.length-1,b=d[y];b===0&&(y--,b=d[y]);let x=c.length-m-1,w=u;for(;x>=0;){let C=Math.min(w,b);if(c[y]===void 0)break;if(c[y].copyCellsFrom(c[x],w-C,b-C,C,!0),b-=C,b===0&&(y--,b=d[y]),w-=C,w===0){x--;let A=Math.max(x,0);w=cf(c,A,this._cols)}}for(let C=0;C<c.length;C++)d[C]<i&&c[C].setCell(d[C],s);let k=m-g;for(;k-- >0;)this.ybase===0?this.y<e-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+n)-e&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+m,this.ybase+e-1)}if(r.length>0){let o=[],l=[];for(let b=0;b<this.lines.length;b++)l.push(this.lines.get(b));let c=this.lines.length,u=c-1,d=0,m=r[d];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+n);let g=0;for(let b=Math.min(this.lines.maxLength-1,c+n-1);b>=0;b--)if(m&&m.start>u+g){for(let x=m.newLines.length-1;x>=0;x--)this.lines.set(b--,m.newLines[x]);b++,o.push({index:u+1,amount:m.newLines.length}),g+=m.newLines.length,m=r[++d]}else this.lines.set(b,l[u--]);let _=0;for(let b=o.length-1;b>=0;b--)o[b].index+=_,this.lines.onInsertEmitter.fire(o[b]),_+=o[b].amount;let y=Math.max(0,c+n-this.lines.maxLength);y>0&&this.lines.onTrimEmitter.fire(y)}}translateBufferLineToString(i,e,t=0,s){let r=this.lines.get(i);return r?r.translateToString(e,t,s):""}getWrappedRangeForLine(i){let e=i,t=i;for(;e>0&&this.lines.get(e).isWrapped;)e--;for(;t+1<this.lines.length&&this.lines.get(t+1).isWrapped;)t++;return{first:e,last:t}}setupTabStops(i){for(i!=null?this.tabs[i]||(i=this.prevStop(i)):(this.tabs={},i=0);i<this._cols;i+=this._optionsService.rawOptions.tabStopWidth)this.tabs[i]=!0}prevStop(i){for(i==null&&(i=this.x);!this.tabs[--i]&&i>0;);return i>=this._cols?this._cols-1:i<0?0:i}nextStop(i){for(i==null&&(i=this.x);!this.tabs[++i]&&i<this._cols;);return i>=this._cols?this._cols-1:i<0?0:i}clearMarkers(i){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].line===i&&(this.markers[e].dispose(),this.markers.splice(e--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let i=0;i<this.markers.length;i++)this.markers[i].dispose();this.markers.length=0,this._isClearing=!1}addMarker(i){let e=new kte(i);return this.markers.push(e),e.register(this.lines.onTrim(t=>{e.line-=t,e.line<0&&e.dispose()})),e.register(this.lines.onInsert(t=>{e.line>=t.index&&(e.line+=t.amount)})),e.register(this.lines.onDelete(t=>{e.line>=t.index&&e.line<t.index+t.amount&&e.dispose(),e.line>t.index&&(e.line-=t.amount)})),e.register(e.onDispose(()=>this._removeMarker(e))),e}_removeMarker(i){this._isClearing||this.markers.splice(this.markers.indexOf(i),1)}},Tte=class extends Xe{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new fe),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 yE(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new yE(!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)}},xD=2,wD=1,Ky=class extends Xe{constructor(i){super(),this.isUserScrolling=!1,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this.cols=Math.max(i.rawOptions.cols||0,xD),this.rows=Math.max(i.rawOptions.rows||0,wD),this.buffers=this._register(new Tte(i,this)),this._register(this.buffers.onBufferActivate(e=>{this._onScroll.fire(e.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(i,e){let t=this.cols!==i,s=this.rows!==e;this.cols=i,this.rows=e,this.buffers.resize(i,e),this._onResize.fire({cols:i,rows:e,colsChanged:t,rowsChanged:s})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(i,e=!1){let t=this.buffer,s;s=this._cachedBlankLine,(!s||s.length!==this.cols||s.getFg(0)!==i.fg||s.getBg(0)!==i.bg)&&(s=t.getBlankLine(i,e),this._cachedBlankLine=s),s.isWrapped=e;let r=t.ybase+t.scrollTop,n=t.ybase+t.scrollBottom;if(t.scrollTop===0){let o=t.lines.isFull;n===t.lines.length-1?o?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(n+1,0,s.clone()),o?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{let o=n-r+1;t.lines.shiftElements(r+1,o-1,-1),t.lines.set(n,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(i,e){let t=this.buffer;if(i<0){if(t.ydisp===0)return;this.isUserScrolling=!0}else i+t.ydisp>=t.ybase&&(this.isUserScrolling=!1);let s=t.ydisp;t.ydisp=Math.max(Math.min(t.ydisp+i,t.ybase),0),s!==t.ydisp&&(e||this._onScroll.fire(t.ydisp))}};Ky=Lt([Oe(0,ss)],Ky);var Vl={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:eg,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},Ate=["normal","bold","100","200","300","400","500","600","700","800","900"],Mte=class extends Xe{constructor(e){super(),this._onOptionChange=this._register(new fe),this.onOptionChange=this._onOptionChange.event;let t={...Vl};for(let s in e)if(s in t)try{let r=e[s];t[s]=this._sanitizeAndValidateOption(s,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(xt(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(s=>{s===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(s=>{e.indexOf(s)!==-1&&t()})}_setupOptions(){let e=s=>{if(!(s in Vl))throw new Error(`No option with key "${s}"`);return this.rawOptions[s]},t=(s,r)=>{if(!(s in Vl))throw new Error(`No option with key "${s}"`);r=this._sanitizeAndValidateOption(s,r),this.rawOptions[s]!==r&&(this.rawOptions[s]=r,this._onOptionChange.fire(s))};for(let s in this.rawOptions){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this.options,s,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=Vl[e]),!Ete(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=Vl[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=Ate.includes(t)?t:Vl[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 Ete(i){return i==="block"||i==="underline"||i==="bar"}function pu(i,e=5){if(typeof i!="object")return i;let t=Array.isArray(i)?[]:{};for(let s in i)t[s]=e<=1?i[s]:i[s]&&pu(i[s],e-1);return t}var bE=Object.freeze({insertMode:!1}),SE=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),Jy=class extends Xe{constructor(e,t,s){super(),this._bufferService=e,this._logService=t,this._optionsService=s,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new fe),this.onData=this._onData.event,this._onUserInput=this._register(new fe),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new fe),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=pu(bE),this.decPrivateModes=pu(SE)}reset(){this.modes=pu(bE),this.decPrivateModes=pu(SE)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let s=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&s.ybase!==s.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};Jy=Lt([Oe(0,is),Oe(1,IB),Oe(2,ss)],Jy);var xE={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:i=>i.button===4||i.action!==1?!1:(i.ctrl=!1,i.alt=!1,i.shift=!1,!0)},VT200:{events:19,restrict:i=>i.action!==32},DRAG:{events:23,restrict:i=>!(i.action===32&&i.button===3)},ANY:{events:31,restrict:i=>!0}};function Qv(i,e){let t=(i.ctrl?16:0)|(i.shift?4:0)|(i.alt?8:0);return i.button===4?(t|=64,t|=i.action):(t|=i.button&3,i.button&4&&(t|=64),i.button&8&&(t|=128),i.action===32?t|=32:i.action===0&&!e&&(t|=3)),t}var Rv=String.fromCharCode,wE={DEFAULT:i=>{let e=[Qv(i,!1)+32,i.col+32,i.row+32];return e[0]>255||e[1]>255||e[2]>255?"":`\x1B[M${Rv(e[0])}${Rv(e[1])}${Rv(e[2])}`},SGR:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${Qv(i,!0)};${i.col};${i.row}${e}`},SGR_PIXELS:i=>{let e=i.action===0&&i.button!==4?"m":"M";return`\x1B[<${Qv(i,!0)};${i.x};${i.y}${e}`}},eb=class extends Xe{constructor(i,e,t){super(),this._bufferService=i,this._coreService=e,this._optionsService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new fe),this.onProtocolChange=this._onProtocolChange.event;for(let s of Object.keys(xE))this.addProtocol(s,xE[s]);for(let s of Object.keys(wE))this.addEncoding(s,wE[s]);this.reset()}addProtocol(i,e){this._protocols[i]=e}addEncoding(i,e){this._encodings[i]=e}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(i){if(!this._protocols[i])throw new Error(`unknown protocol "${i}"`);this._activeProtocol=i,this._onProtocolChange.fire(this._protocols[i].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(i){if(!this._encodings[i])throw new Error(`unknown encoding "${i}"`);this._activeEncoding=i}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(i,e,t){if(i.deltaY===0||i.shiftKey||e===void 0||t===void 0)return 0;let s=e/t,r=this._applyScrollModifier(i.deltaY,i);return i.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(r/=s+0,Math.abs(i.deltaY)<50&&(r*=.3),this._wheelPartialScroll+=r,r=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):i.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(r*=this._bufferService.rows),r}_applyScrollModifier(i,e){return e.altKey||e.ctrlKey||e.shiftKey?i*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:i*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(i){if(i.col<0||i.col>=this._bufferService.cols||i.row<0||i.row>=this._bufferService.rows||i.button===4&&i.action===32||i.button===3&&i.action!==32||i.button!==4&&(i.action===2||i.action===3)||(i.col++,i.row++,i.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,i,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(i))return!1;let e=this._encodings[this._activeEncoding](i);return e&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(e):this._coreService.triggerDataEvent(e,!0)),this._lastEvent=i,!0}explainEvents(i){return{down:!!(i&1),up:!!(i&2),drag:!!(i&4),move:!!(i&8),wheel:!!(i&16)}}_equalEvents(i,e,t){if(t){if(i.x!==e.x||i.y!==e.y)return!1}else if(i.col!==e.col||i.row!==e.row)return!1;return!(i.button!==e.button||i.action!==e.action||i.ctrl!==e.ctrl||i.alt!==e.alt||i.shift!==e.shift)}};eb=Lt([Oe(0,is),Oe(1,Ja),Oe(2,ss)],eb);var Lv=[[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]],Pte=[[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]],ti;function Qte(i,e){let t=0,s=e.length-1,r;if(i<e[0][0]||i>e[s][1])return!1;for(;s>=t;)if(r=t+s>>1,i>e[r][1])t=r+1;else if(i<e[r][0])s=r-1;else return!0;return!1}var Rte=class{constructor(){if(this.version="6",!ti){ti=new Uint8Array(65536),ti.fill(1),ti[0]=0,ti.fill(0,1,32),ti.fill(0,127,160),ti.fill(2,4352,4448),ti[9001]=2,ti[9002]=2,ti.fill(2,11904,42192),ti[12351]=1,ti.fill(2,44032,55204),ti.fill(2,63744,64256),ti.fill(2,65040,65050),ti.fill(2,65072,65136),ti.fill(2,65280,65377),ti.fill(2,65504,65511);for(let e=0;e<Lv.length;++e)ti.fill(0,Lv[e][0],Lv[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?ti[e]:Qte(e,Pte)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let s=this.wcwidth(e),r=s===0&&t!==0;if(r){let n=Ba.extractWidth(t);n===0?r=!1:n>s&&(s=n)}return Ba.createPropertyValue(0,s,r)}},Ba=class nm{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new fe,this.onChange=this._onChange.event;let e=new Rte;this.register(e),this._active=e.version,this._activeProvider=e}static extractShouldJoin(e){return(e&1)!==0}static extractWidth(e){return e>>1&3}static extractCharKind(e){return e>>3}static createPropertyValue(e,t,s=!1){return(e&16777215)<<3|(t&3)<<1|(s?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(e){if(!this._providers[e])throw new Error(`unknown Unicode version "${e}"`);this._active=e,this._activeProvider=this._providers[e],this._onChange.fire(e)}register(e){this._providers[e.version]=e}wcwidth(e){return this._activeProvider.wcwidth(e)}getStringCellWidth(e){let t=0,s=0,r=e.length;for(let n=0;n<r;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=r)return t+this.wcwidth(o);let u=e.charCodeAt(n);56320<=u&&u<=57343?o=(o-55296)*1024+u-56320+65536:t+=this.wcwidth(u)}let l=this.charProperties(o,s),c=nm.extractWidth(l);nm.extractShouldJoin(l)&&(c-=nm.extractWidth(s)),t+=c,s=l}return t}charProperties(e,t){return this._activeProvider.charProperties(e,t)}},Lte=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 CE(i){var s;let e=(s=i.buffer.lines.get(i.buffer.ybase+i.buffer.y-1))==null?void 0:s.get(i.cols-1),t=i.buffer.lines.get(i.buffer.ybase+i.buffer.y);t&&e&&(t.isWrapped=e[3]!==0&&e[3]!==32)}var Kc=2147483647,$te=256,CD=class tb{constructor(e=32,t=32){if(this.maxLength=e,this.maxSubParamsLength=t,t>$te)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(e){let t=new tb;if(!e.length)return t;for(let s=Array.isArray(e[0])?1:0;s<e.length;++s){let r=e[s];if(Array.isArray(r))for(let n=0;n<r.length;++n)t.addSubParam(r[n]);else t.addParam(r)}return t}clone(){let e=new tb(this.maxLength,this.maxSubParamsLength);return e.params.set(this.params),e.length=this.length,e._subParams.set(this._subParams),e._subParamsLength=this._subParamsLength,e._subParamsIdx.set(this._subParamsIdx),e._rejectDigits=this._rejectDigits,e._rejectSubDigits=this._rejectSubDigits,e._digitIsSub=this._digitIsSub,e}toArray(){let e=[];for(let t=0;t<this.length;++t){e.push(this.params[t]);let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-s>0&&e.push(Array.prototype.slice.call(this._subParams,s,r))}return e}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(e){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>Kc?Kc:e}addSubParam(e){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>Kc?Kc:e,this._subParamsIdx[this.length-1]++}}hasSubParams(e){return(this._subParamsIdx[e]&255)-(this._subParamsIdx[e]>>8)>0}getSubParams(e){let t=this._subParamsIdx[e]>>8,s=this._subParamsIdx[e]&255;return s-t>0?this._subParams.subarray(t,s):null}getSubParamsAll(){let e={};for(let t=0;t<this.length;++t){let s=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;r-s>0&&(e[t]=this._subParams.slice(s,r))}return e}addDigit(e){let t;if(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let s=this._digitIsSub?this._subParams:this.params,r=s[t-1];s[t-1]=~r?Math.min(r*10+e,Kc):e}},Jc=[],Bte=class{constructor(){this._state=0,this._active=Jc,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 s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=Jc}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=Jc,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||Jc,!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,s){if(!this._active.length)this._handlerFb(this._id,"PUT",Sg(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}start(){this.reset(),this._state=1}put(e,t,s){if(this._state!==3){if(this._state===1)for(;t<s;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&s-t>0&&this._put(e,t,s)}}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 s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].end(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].end(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=Jc,this._id=-1,this._state=0}}},Rs=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,s){this._hitLimit||(this._data+=Sg(e,t,s),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(s=>(this._data="",this._hitLimit=!1,s));return this._data="",this._hitLimit=!1,t}},eu=[],Dte=class{constructor(){this._handlers=Object.create(null),this._active=eu,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=eu}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let s=this._handlers[e];return s.push(t),{dispose:()=>{let r=s.indexOf(t);r!==-1&&s.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=eu,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||eu,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let s=this._active.length-1;s>=0;s--)this._active[s].hook(t)}put(e,t,s){if(!this._active.length)this._handlerFb(this._ident,"PUT",Sg(e,t,s));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,s)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let s=!1,r=this._active.length-1,n=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,s=t,n=this._stack.fallThrough,this._stack.paused=!1),!n&&s===!1){for(;r>=0&&(s=this._active[r].unhook(e),s!==!0);r--)if(s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,s;r--}for(;r>=0;r--)if(s=this._active[r].unhook(!1),s instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,s}this._active=eu,this._ident=0}},mu=new CD;mu.addParam(0);var kE=class{constructor(i){this._handler=i,this._data="",this._params=mu,this._hitLimit=!1}hook(i){this._params=i.length>1||i.params[0]?i.clone():mu,this._data="",this._hitLimit=!1}put(i,e,t){this._hitLimit||(this._data+=Sg(i,e,t),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(i){let e=!1;if(this._hitLimit)e=!1;else if(i&&(e=this._handler(this._data,this._params),e instanceof Promise))return e.then(t=>(this._params=mu,this._data="",this._hitLimit=!1,t));return this._params=mu,this._data="",this._hitLimit=!1,e}},zte=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,s,r){this.table[t<<8|e]=s<<4|r}addMany(e,t,s,r){for(let n=0;n<e.length;n++)this.table[t<<8|e[n]]=s<<4|r}},Js=160,Nte=(function(){let i=new zte(4095),e=Array.apply(null,Array(256)).map((l,c)=>c),t=(l,c)=>e.slice(l,c),s=t(32,127),r=t(0,24);r.push(25),r.push.apply(r,t(28,32));let n=t(0,14),o;i.setDefault(1,0),i.addMany(s,0,2,0);for(o in n)i.addMany([24,26,153,154],o,3,0),i.addMany(t(128,144),o,3,0),i.addMany(t(144,152),o,3,0),i.add(156,o,0,0),i.add(27,o,11,1),i.add(157,o,4,8),i.addMany([152,158,159],o,0,7),i.add(155,o,11,3),i.add(144,o,11,9);return i.addMany(r,0,3,0),i.addMany(r,1,3,1),i.add(127,1,0,1),i.addMany(r,8,0,8),i.addMany(r,3,3,3),i.add(127,3,0,3),i.addMany(r,4,3,4),i.add(127,4,0,4),i.addMany(r,6,3,6),i.addMany(r,5,3,5),i.add(127,5,0,5),i.addMany(r,2,3,2),i.add(127,2,0,2),i.add(93,1,4,8),i.addMany(s,8,5,8),i.add(127,8,5,8),i.addMany([156,27,24,26,7],8,6,0),i.addMany(t(28,32),8,0,8),i.addMany([88,94,95],1,0,7),i.addMany(s,7,0,7),i.addMany(r,7,0,7),i.add(156,7,0,0),i.add(127,7,0,7),i.add(91,1,11,3),i.addMany(t(64,127),3,7,0),i.addMany(t(48,60),3,8,4),i.addMany([60,61,62,63],3,9,4),i.addMany(t(48,60),4,8,4),i.addMany(t(64,127),4,7,0),i.addMany([60,61,62,63],4,0,6),i.addMany(t(32,64),6,0,6),i.add(127,6,0,6),i.addMany(t(64,127),6,0,0),i.addMany(t(32,48),3,9,5),i.addMany(t(32,48),5,9,5),i.addMany(t(48,64),5,0,6),i.addMany(t(64,127),5,7,0),i.addMany(t(32,48),4,9,5),i.addMany(t(32,48),1,9,2),i.addMany(t(32,48),2,9,2),i.addMany(t(48,127),2,10,0),i.addMany(t(48,80),1,10,0),i.addMany(t(81,88),1,10,0),i.addMany([89,90,92],1,10,0),i.addMany(t(96,127),1,10,0),i.add(80,1,11,9),i.addMany(r,9,0,9),i.add(127,9,0,9),i.addMany(t(28,32),9,0,9),i.addMany(t(32,48),9,9,12),i.addMany(t(48,60),9,8,10),i.addMany([60,61,62,63],9,9,10),i.addMany(r,11,0,11),i.addMany(t(32,128),11,0,11),i.addMany(t(28,32),11,0,11),i.addMany(r,10,0,10),i.add(127,10,0,10),i.addMany(t(28,32),10,0,10),i.addMany(t(48,60),10,8,10),i.addMany([60,61,62,63],10,0,11),i.addMany(t(32,48),10,9,12),i.addMany(r,12,0,12),i.add(127,12,0,12),i.addMany(t(28,32),12,0,12),i.addMany(t(32,48),12,9,12),i.addMany(t(48,64),12,0,11),i.addMany(t(64,127),12,12,13),i.addMany(t(64,127),10,12,13),i.addMany(t(64,127),9,12,13),i.addMany(r,13,13,13),i.addMany(s,13,13,13),i.add(127,13,0,13),i.addMany([27,156,24,26],13,14,0),i.add(Js,0,2,0),i.add(Js,8,5,8),i.add(Js,6,0,6),i.add(Js,11,0,11),i.add(Js,13,13,13),i})(),Xte=class extends Xe{constructor(e=Nte){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 CD,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,s,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,s)=>{},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(xt(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new Bte),this._dcsParser=this._register(new Dte),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let s=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(s=e.prefix.charCodeAt(0),s&&60>s||s>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 n=0;n<e.intermediates.length;++n){let o=e.intermediates.charCodeAt(n);if(32>o||o>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");s<<=8,s|=o}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return s<<=8,s|=r,s}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 s=this._identifier(e,[48,126]);this._escHandlers[s]===void 0&&(this._escHandlers[s]=[]);let r=this._escHandlers[s];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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 s=this._identifier(e);this._csiHandlers[s]===void 0&&(this._csiHandlers[s]=[]);let r=this._csiHandlers[s];return r.push(t),{dispose:()=>{let n=r.indexOf(t);n!==-1&&r.splice(n,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,s,r,n){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=s,this._parseStack.transition=r,this._parseStack.chunkPos=n}parse(e,t,s){let r=0,n=0,o=0,l;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,o=this._parseStack.chunkPos+1;else{if(s===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let c=this._parseStack.handlers,u=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(s===!1&&u>-1){for(;u>=0&&(l=c[u](this._params),l!==!0);u--)if(l instanceof Promise)return this._parseStack.handlerPos=u,l}this._parseStack.handlers=[];break;case 4:if(s===!1&&u>-1){for(;u>=0&&(l=c[u](),l!==!0);u--)if(l instanceof Promise)return this._parseStack.handlerPos=u,l}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],l=this._dcsParser.unhook(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(r=e[this._parseStack.chunkPos],l=this._oscParser.end(r!==24&&r!==26,s),l)return l;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,o=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let c=o;c<t;++c){switch(r=e[c],n=this._transitions.table[this.currentState<<8|(r<160?r:Js)],n>>4){case 2:for(let _=c+1;;++_){if(_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}if(++_>=t||(r=e[_])<32||r>126&&r<Js){this._printHandler(e,c,_),c=_-1;break}}break;case 3:this._executeHandlers[r]?this._executeHandlers[r]():this._executeHandlerFb(r),this.precedingJoinState=0;break;case 0:break;case 1:if(this._errorHandler({position:c,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let u=this._csiHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(l=u[d](this._params),l!==!0);d--)if(l instanceof Promise)return this._preserveStack(3,u,d,n,c),l;d<0&&this._csiHandlerFb(this._collect<<8|r,this._params),this.precedingJoinState=0;break;case 8:do switch(r){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(r-48)}while(++c<t&&(r=e[c])>47&&r<60);c--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let m=this._escHandlers[this._collect<<8|r],g=m?m.length-1:-1;for(;g>=0&&(l=m[g](),l!==!0);g--)if(l instanceof Promise)return this._preserveStack(4,m,g,n,c),l;g<0&&this._escHandlerFb(this._collect<<8|r),this.precedingJoinState=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|r,this._params);break;case 13:for(let _=c+1;;++_)if(_>=t||(r=e[_])===24||r===26||r===27||r>127&&r<Js){this._dcsParser.put(e,c,_),c=_-1;break}break;case 14:if(l=this._dcsParser.unhook(r!==24&&r!==26),l)return this._preserveStack(6,[],0,n,c),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let _=c+1;;_++)if(_>=t||(r=e[_])<32||r>127&&r<Js){this._oscParser.put(e,c,_),c=_-1;break}break;case 6:if(l=this._oscParser.end(r!==24&&r!==26),l)return this._preserveStack(5,[],0,n,c),l;r===27&&(n|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=n&15}}},Vte=/^([\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})$/,Zte=/^[\da-f]+$/;function TE(i){if(!i)return;let e=i.toLowerCase();if(e.indexOf("rgb:")===0){e=e.slice(4);let t=Vte.exec(e);if(t){let s=t[1]?15:t[4]?255:t[7]?4095:65535;return[Math.round(parseInt(t[1]||t[4]||t[7]||t[10],16)/s*255),Math.round(parseInt(t[2]||t[5]||t[8]||t[11],16)/s*255),Math.round(parseInt(t[3]||t[6]||t[9]||t[12],16)/s*255)]}}else if(e.indexOf("#")===0&&(e=e.slice(1),Zte.exec(e)&&[3,6,9,12].includes(e.length))){let t=e.length/3,s=[0,0,0];for(let r=0;r<3;++r){let n=parseInt(e.slice(t*r,t*r+t),16);s[r]=t===1?n<<4:t===2?n:t===3?n>>4:n>>8}return s}}function $v(i,e){let t=i.toString(16),s=t.length<2?"0"+t:t;switch(e){case 4:return t[0];case 8:return s;case 12:return(s+s).slice(0,3);default:return s+s}}function jte(i,e=16){let[t,s,r]=i;return`rgb:${$v(t,e)}/${$v(s,e)}/${$v(r,e)}`}var Ite={"(":0,")":1,"*":2,"+":3,"-":1,".":2},To=131072,AE=10;function ME(i,e){if(i>24)return e.setWinLines||!1;switch(i){case 1:return!!e.restoreWin;case 2:return!!e.minimizeWin;case 3:return!!e.setWinPosition;case 4:return!!e.setWinSizePixels;case 5:return!!e.raiseWin;case 6:return!!e.lowerWin;case 7:return!!e.refreshWin;case 8:return!!e.setWinSizeChars;case 9:return!!e.maximizeWin;case 10:return!!e.fullscreenWin;case 11:return!!e.getWinState;case 13:return!!e.getWinPosition;case 14:return!!e.getWinSizePixels;case 15:return!!e.getScreenSizePixels;case 16:return!!e.getCellSizePixels;case 18:return!!e.getWinSizeChars;case 19:return!!e.getScreenSizeChars;case 20:return!!e.getIconTitle;case 21:return!!e.getWinTitle;case 22:return!!e.pushTitle;case 23:return!!e.popTitle;case 24:return!!e.setWinLines}return!1}var EE=5e3,PE=0,qte=class extends Xe{constructor(i,e,t,s,r,n,o,l,c=new Xte){super(),this._bufferService=i,this._charsetService=e,this._coreService=t,this._logService=s,this._optionsService=r,this._oscLinkService=n,this._coreMouseService=o,this._unicodeService=l,this._parser=c,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new cJ,this._utf8Decoder=new uJ,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=It.clone(),this._eraseAttrDataInternal=It.clone(),this._onRequestBell=this._register(new fe),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new fe),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new fe),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new fe),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new fe),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new fe),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new fe),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new fe),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new fe),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new fe),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 ib(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(u=>this._activeBuffer=u.activeBuffer)),this._parser.setCsiHandlerFallback((u,d)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(u),params:d.toArray()})}),this._parser.setEscHandlerFallback(u=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(u)})}),this._parser.setExecuteHandlerFallback(u=>{this._logService.debug("Unknown EXECUTE code: ",{code:u})}),this._parser.setOscHandlerFallback((u,d,m)=>{this._logService.debug("Unknown OSC code: ",{identifier:u,action:d,data:m})}),this._parser.setDcsHandlerFallback((u,d,m)=>{d==="HOOK"&&(m=m.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(u),action:d,payload:m})}),this._parser.setPrintHandler((u,d,m)=>this.print(u,d,m)),this._parser.registerCsiHandler({final:"@"},u=>this.insertChars(u)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},u=>this.scrollLeft(u)),this._parser.registerCsiHandler({final:"A"},u=>this.cursorUp(u)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},u=>this.scrollRight(u)),this._parser.registerCsiHandler({final:"B"},u=>this.cursorDown(u)),this._parser.registerCsiHandler({final:"C"},u=>this.cursorForward(u)),this._parser.registerCsiHandler({final:"D"},u=>this.cursorBackward(u)),this._parser.registerCsiHandler({final:"E"},u=>this.cursorNextLine(u)),this._parser.registerCsiHandler({final:"F"},u=>this.cursorPrecedingLine(u)),this._parser.registerCsiHandler({final:"G"},u=>this.cursorCharAbsolute(u)),this._parser.registerCsiHandler({final:"H"},u=>this.cursorPosition(u)),this._parser.registerCsiHandler({final:"I"},u=>this.cursorForwardTab(u)),this._parser.registerCsiHandler({final:"J"},u=>this.eraseInDisplay(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},u=>this.eraseInDisplay(u,!0)),this._parser.registerCsiHandler({final:"K"},u=>this.eraseInLine(u,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},u=>this.eraseInLine(u,!0)),this._parser.registerCsiHandler({final:"L"},u=>this.insertLines(u)),this._parser.registerCsiHandler({final:"M"},u=>this.deleteLines(u)),this._parser.registerCsiHandler({final:"P"},u=>this.deleteChars(u)),this._parser.registerCsiHandler({final:"S"},u=>this.scrollUp(u)),this._parser.registerCsiHandler({final:"T"},u=>this.scrollDown(u)),this._parser.registerCsiHandler({final:"X"},u=>this.eraseChars(u)),this._parser.registerCsiHandler({final:"Z"},u=>this.cursorBackwardTab(u)),this._parser.registerCsiHandler({final:"`"},u=>this.charPosAbsolute(u)),this._parser.registerCsiHandler({final:"a"},u=>this.hPositionRelative(u)),this._parser.registerCsiHandler({final:"b"},u=>this.repeatPrecedingCharacter(u)),this._parser.registerCsiHandler({final:"c"},u=>this.sendDeviceAttributesPrimary(u)),this._parser.registerCsiHandler({prefix:">",final:"c"},u=>this.sendDeviceAttributesSecondary(u)),this._parser.registerCsiHandler({final:"d"},u=>this.linePosAbsolute(u)),this._parser.registerCsiHandler({final:"e"},u=>this.vPositionRelative(u)),this._parser.registerCsiHandler({final:"f"},u=>this.hVPosition(u)),this._parser.registerCsiHandler({final:"g"},u=>this.tabClear(u)),this._parser.registerCsiHandler({final:"h"},u=>this.setMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"h"},u=>this.setModePrivate(u)),this._parser.registerCsiHandler({final:"l"},u=>this.resetMode(u)),this._parser.registerCsiHandler({prefix:"?",final:"l"},u=>this.resetModePrivate(u)),this._parser.registerCsiHandler({final:"m"},u=>this.charAttributes(u)),this._parser.registerCsiHandler({final:"n"},u=>this.deviceStatus(u)),this._parser.registerCsiHandler({prefix:"?",final:"n"},u=>this.deviceStatusPrivate(u)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},u=>this.softReset(u)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},u=>this.setCursorStyle(u)),this._parser.registerCsiHandler({final:"r"},u=>this.setScrollRegion(u)),this._parser.registerCsiHandler({final:"s"},u=>this.saveCursor(u)),this._parser.registerCsiHandler({final:"t"},u=>this.windowOptions(u)),this._parser.registerCsiHandler({final:"u"},u=>this.restoreCursor(u)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},u=>this.insertColumns(u)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},u=>this.deleteColumns(u)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},u=>this.selectProtected(u)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},u=>this.requestMode(u,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},u=>this.requestMode(u,!1)),this._parser.setExecuteHandler(le.BEL,()=>this.bell()),this._parser.setExecuteHandler(le.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(le.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(le.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(le.BS,()=>this.backspace()),this._parser.setExecuteHandler(le.HT,()=>this.tab()),this._parser.setExecuteHandler(le.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(le.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(sm.IND,()=>this.index()),this._parser.setExecuteHandler(sm.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(sm.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new Rs(u=>(this.setTitle(u),this.setIconName(u),!0))),this._parser.registerOscHandler(1,new Rs(u=>this.setIconName(u))),this._parser.registerOscHandler(2,new Rs(u=>this.setTitle(u))),this._parser.registerOscHandler(4,new Rs(u=>this.setOrReportIndexedColor(u))),this._parser.registerOscHandler(8,new Rs(u=>this.setHyperlink(u))),this._parser.registerOscHandler(10,new Rs(u=>this.setOrReportFgColor(u))),this._parser.registerOscHandler(11,new Rs(u=>this.setOrReportBgColor(u))),this._parser.registerOscHandler(12,new Rs(u=>this.setOrReportCursorColor(u))),this._parser.registerOscHandler(104,new Rs(u=>this.restoreIndexedColor(u))),this._parser.registerOscHandler(110,new Rs(u=>this.restoreFgColor(u))),this._parser.registerOscHandler(111,new Rs(u=>this.restoreBgColor(u))),this._parser.registerOscHandler(112,new Rs(u=>this.restoreCursorColor(u))),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 u in ni)this._parser.registerEscHandler({intermediates:"(",final:u},()=>this.selectCharset("("+u)),this._parser.registerEscHandler({intermediates:")",final:u},()=>this.selectCharset(")"+u)),this._parser.registerEscHandler({intermediates:"*",final:u},()=>this.selectCharset("*"+u)),this._parser.registerEscHandler({intermediates:"+",final:u},()=>this.selectCharset("+"+u)),this._parser.registerEscHandler({intermediates:"-",final:u},()=>this.selectCharset("-"+u)),this._parser.registerEscHandler({intermediates:".",final:u},()=>this.selectCharset("."+u)),this._parser.registerEscHandler({intermediates:"/",final:u},()=>this.selectCharset("/"+u));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(u=>(this._logService.error("Parsing error: ",u),u)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new kE((u,d)=>this.requestStatusString(u,d)))}getAttrData(){return this._curAttrData}_preserveStack(i,e,t,s){this._parseStack.paused=!0,this._parseStack.cursorStartX=i,this._parseStack.cursorStartY=e,this._parseStack.decodedLength=t,this._parseStack.position=s}_logSlowResolvingAsync(i){this._logService.logLevel<=3&&Promise.race([i,new Promise((e,t)=>setTimeout(()=>t("#SLOW_TIMEOUT"),EE))]).catch(e=>{if(e!=="#SLOW_TIMEOUT")throw e;console.warn(`async parser handler taking longer than ${EE} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(i,e){let t,s=this._activeBuffer.x,r=this._activeBuffer.y,n=0,o=this._parseStack.paused;if(o){if(t=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,e))return this._logSlowResolvingAsync(t),t;s=this._parseStack.cursorStartX,r=this._parseStack.cursorStartY,this._parseStack.paused=!1,i.length>To&&(n=this._parseStack.position+To)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof i=="string"?` "${i}"`:` "${Array.prototype.map.call(i,u=>String.fromCharCode(u)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof i=="string"?i.split("").map(u=>u.charCodeAt(0)):i),this._parseBuffer.length<i.length&&this._parseBuffer.length<To&&(this._parseBuffer=new Uint32Array(Math.min(i.length,To))),o||this._dirtyRowTracker.clearRange(),i.length>To)for(let u=n;u<i.length;u+=To){let d=u+To<i.length?u+To:i.length,m=typeof i=="string"?this._stringDecoder.decode(i.substring(u,d),this._parseBuffer):this._utf8Decoder.decode(i.subarray(u,d),this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,m))return this._preserveStack(s,r,m,u),this._logSlowResolvingAsync(t),t}else if(!o){let u=typeof i=="string"?this._stringDecoder.decode(i,this._parseBuffer):this._utf8Decoder.decode(i,this._parseBuffer);if(t=this._parser.parse(this._parseBuffer,u))return this._preserveStack(s,r,u,0),this._logSlowResolvingAsync(t),t}(this._activeBuffer.x!==s||this._activeBuffer.y!==r)&&this._onCursorMove.fire();let l=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),c=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);c<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(c,this._bufferService.rows-1),end:Math.min(l,this._bufferService.rows-1)})}print(i,e,t){let s,r,n=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,l=this._bufferService.cols,c=this._coreService.decPrivateModes.wraparound,u=this._coreService.modes.insertMode,d=this._curAttrData,m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&t-e>0&&m.getWidth(this._activeBuffer.x-1)===2&&m.setCellFromCodepoint(this._activeBuffer.x-1,0,1,d);let g=this._parser.precedingJoinState;for(let _=e;_<t;++_){if(s=i[_],s<127&&n){let w=n[String.fromCharCode(s)];w&&(s=w.charCodeAt(0))}let y=this._unicodeService.charProperties(s,g);r=Ba.extractWidth(y);let b=Ba.extractShouldJoin(y),x=b?Ba.extractWidth(g):0;if(g=y,o&&this._onA11yChar.fire($o(s)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+r-x>l){if(c){let w=m,k=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),m=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),x>0&&m instanceof du&&m.copyCellsFrom(w,k,0,x,!1);k<l;)w.setCellFromCodepoint(k++,0,1,d)}else if(this._activeBuffer.x=l-1,r===2)continue}if(b&&this._activeBuffer.x){let w=m.getWidth(this._activeBuffer.x-1)?1:2;m.addCodepointToCell(this._activeBuffer.x-w,s,r);for(let k=r-x;--k>=0;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,d);continue}if(u&&(m.insertCells(this._activeBuffer.x,r-x,this._activeBuffer.getNullCell(d)),m.getWidth(l-1)===2&&m.setCellFromCodepoint(l-1,0,1,d)),m.setCellFromCodepoint(this._activeBuffer.x++,s,r,d),r>0)for(;--r;)m.setCellFromCodepoint(this._activeBuffer.x++,0,0,d)}this._parser.precedingJoinState=g,this._activeBuffer.x<l&&t-e>0&&m.getWidth(this._activeBuffer.x)===0&&!m.hasContent(this._activeBuffer.x)&&m.setCellFromCodepoint(this._activeBuffer.x,0,1,d),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(i,e){return i.final==="t"&&!i.prefix&&!i.intermediates?this._parser.registerCsiHandler(i,t=>ME(t.params[0],this._optionsService.rawOptions.windowOptions)?e(t):!0):this._parser.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._parser.registerDcsHandler(i,new kE(e))}registerEscHandler(i,e){return this._parser.registerEscHandler(i,e)}registerOscHandler(i,e){return this._parser.registerOscHandler(i,new Rs(e))}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 i;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&&((i=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&i.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);e.hasWidth(this._activeBuffer.x)&&!e.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let i=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-i),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(i=this._bufferService.cols-1){this._activeBuffer.x=Math.min(i,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(i,e){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=i,this._activeBuffer.y=this._activeBuffer.scrollTop+e):(this._activeBuffer.x=i,this._activeBuffer.y=e),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(i,e){this._restrictCursor(),this._setCursor(this._activeBuffer.x+i,this._activeBuffer.y+e)}cursorUp(i){let e=this._activeBuffer.y-this._activeBuffer.scrollTop;return e>=0?this._moveCursor(0,-Math.min(e,i.params[0]||1)):this._moveCursor(0,-(i.params[0]||1)),!0}cursorDown(i){let e=this._activeBuffer.scrollBottom-this._activeBuffer.y;return e>=0?this._moveCursor(0,Math.min(e,i.params[0]||1)):this._moveCursor(0,i.params[0]||1),!0}cursorForward(i){return this._moveCursor(i.params[0]||1,0),!0}cursorBackward(i){return this._moveCursor(-(i.params[0]||1),0),!0}cursorNextLine(i){return this.cursorDown(i),this._activeBuffer.x=0,!0}cursorPrecedingLine(i){return this.cursorUp(i),this._activeBuffer.x=0,!0}cursorCharAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(i){return this._setCursor(i.length>=2?(i.params[1]||1)-1:0,(i.params[0]||1)-1),!0}charPosAbsolute(i){return this._setCursor((i.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(i){return this._moveCursor(i.params[0]||1,0),!0}linePosAbsolute(i){return this._setCursor(this._activeBuffer.x,(i.params[0]||1)-1),!0}vPositionRelative(i){return this._moveCursor(0,i.params[0]||1),!0}hVPosition(i){return this.cursorPosition(i),!0}tabClear(i){let e=i.params[0];return e===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:e===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(i){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=i.params[0]||1;for(;e--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(i){let e=i.params[0];return e===1&&(this._curAttrData.bg|=536870912),(e===2||e===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(i,e,t,s=!1,r=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);n.replaceCells(e,t,this._activeBuffer.getNullCell(this._eraseAttrData()),r),s&&(n.isWrapped=!1)}_resetBufferLine(i,e=!1){let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+i);t&&(t.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),e),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+i),t.isWrapped=!1)}eraseInDisplay(i,e=!1){var s;this._restrictCursor(this._bufferService.cols);let t;switch(i.params[0]){case 0:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);t<this._bufferService.rows;t++)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(t);break;case 1:for(t=this._activeBuffer.y,this._dirtyRowTracker.markDirty(t),this._eraseInBufferLine(t,0,this._activeBuffer.x+1,!0,e),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(t=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,t-1);t--&&!((s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t))!=null&&s.getTrimmedLength()););for(;t>=0;t--)this._bufferService.scroll(this._eraseAttrData())}else{for(t=this._bufferService.rows,this._dirtyRowTracker.markDirty(t-1);t--;)this._resetBufferLine(t,e);this._dirtyRowTracker.markDirty(0)}break;case 3:let r=this._activeBuffer.lines.length-this._bufferService.rows;r>0&&(this._activeBuffer.lines.trimStart(r),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-r,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-r,0),this._onScroll.fire(0));break}return!0}eraseInLine(i,e=!1){switch(this._restrictCursor(this._bufferService.cols),i.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,e);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,e);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,e);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-s+1;for(;e--;)this._activeBuffer.lines.splice(r-1,1),this._activeBuffer.lines.splice(t,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(i){this._restrictCursor();let e=i.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=this._activeBuffer.ybase+this._activeBuffer.y,s;for(s=this._bufferService.rows-1-this._activeBuffer.scrollBottom,s=this._bufferService.rows-1+this._activeBuffer.ybase-s;e--;)this._activeBuffer.lines.splice(t,1),this._activeBuffer.lines.splice(s,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.insertCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.deleteCells(this._activeBuffer.x,i.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(i){let e=i.params[0]||1;for(;e--;)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(i){let e=i.params[0]||1;for(;e--;)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(It));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.deleteCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.insertCells(0,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.insertCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(i){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let e=i.params[0]||1;for(let t=this._activeBuffer.scrollTop;t<=this._activeBuffer.scrollBottom;++t){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+t);s.deleteCells(this._activeBuffer.x,e,this._activeBuffer.getNullCell(this._eraseAttrData())),s.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(i){this._restrictCursor();let e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return e&&(e.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(i.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(i){let e=this._parser.precedingJoinState;if(!e)return!0;let t=i.params[0]||1,s=Ba.extractWidth(e),r=this._activeBuffer.x-s,n=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(r),o=new Uint32Array(n.length*t),l=0;for(let u=0;u<n.length;){let d=n.codePointAt(u)||0;o[l++]=d,u+=d>65535?2:1}let c=l;for(let u=1;u<t;++u)o.copyWithin(c,0,l),c+=l;return this.print(o,0,c),!0}sendDeviceAttributesPrimary(i){return i.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(le.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(le.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(i){return i.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(le.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(le.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(i.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(le.ESC+"[>83;40003;0c")),!0}_is(i){return(this._optionsService.rawOptions.termName+"").indexOf(i)===0}setMode(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,ka),this._charsetService.setgCharset(1,ka),this._charsetService.setgCharset(2,ka),this._charsetService.setgCharset(3,ka);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(i){for(let e=0;e<i.length;e++)switch(i.params[e]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(i){for(let e=0;e<i.length;e++)switch(i.params[e]){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(),i.params[e]===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(i,e){(b=>(b[b.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",b[b.SET=1]="SET",b[b.RESET=2]="RESET",b[b.PERMANENTLY_SET=3]="PERMANENTLY_SET",b[b.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(t={}));let s=this._coreService.decPrivateModes,{activeProtocol:r,activeEncoding:n}=this._coreMouseService,o=this._coreService,{buffers:l,cols:c}=this._bufferService,{active:u,alt:d}=l,m=this._optionsService.rawOptions,g=(b,x)=>(o.triggerDataEvent(`${le.ESC}[${e?"":"?"}${b};${x}$y`),!0),_=b=>b?1:2,y=i.params[0];return e?y===2?g(y,4):y===4?g(y,_(o.modes.insertMode)):y===12?g(y,3):y===20?g(y,_(m.convertEol)):g(y,0):y===1?g(y,_(s.applicationCursorKeys)):y===3?g(y,m.windowOptions.setWinLines?c===80?2:c===132?1:0:0):y===6?g(y,_(s.origin)):y===7?g(y,_(s.wraparound)):y===8?g(y,3):y===9?g(y,_(r==="X10")):y===12?g(y,_(m.cursorBlink)):y===25?g(y,_(!o.isCursorHidden)):y===45?g(y,_(s.reverseWraparound)):y===66?g(y,_(s.applicationKeypad)):y===67?g(y,4):y===1e3?g(y,_(r==="VT200")):y===1002?g(y,_(r==="DRAG")):y===1003?g(y,_(r==="ANY")):y===1004?g(y,_(s.sendFocus)):y===1005?g(y,4):y===1006?g(y,_(n==="SGR")):y===1015?g(y,4):y===1016?g(y,_(n==="SGR_PIXELS")):y===1048?g(y,1):y===47||y===1047||y===1049?g(y,_(u===d)):y===2004?g(y,_(s.bracketedPasteMode)):y===2026?g(y,_(s.synchronizedOutput)):g(y,0)}_updateAttrColor(i,e,t,s,r){return e===2?(i|=50331648,i&=-16777216,i|=Af.fromColorRGB([t,s,r])):e===5&&(i&=-50331904,i|=33554432|t&255),i}_extractColor(i,e,t){let s=[0,0,-1,0,0,0],r=0,n=0;do{if(s[n+r]=i.params[e+n],i.hasSubParams(e+n)){let o=i.getSubParams(e+n),l=0;do s[1]===5&&(r=1),s[n+l+1+r]=o[l];while(++l<o.length&&l+n+1+r<s.length);break}if(s[1]===5&&n+r>=2||s[1]===2&&n+r>=5)break;s[1]&&(r=1)}while(++n+e<i.length&&n+r<s.length);for(let o=2;o<s.length;++o)s[o]===-1&&(s[o]=0);switch(s[0]){case 38:t.fg=this._updateAttrColor(t.fg,s[1],s[3],s[4],s[5]);break;case 48:t.bg=this._updateAttrColor(t.bg,s[1],s[3],s[4],s[5]);break;case 58:t.extended=t.extended.clone(),t.extended.underlineColor=this._updateAttrColor(t.extended.underlineColor,s[1],s[3],s[4],s[5])}return n}_processUnderline(i,e){e.extended=e.extended.clone(),(!~i||i>5)&&(i=1),e.extended.underlineStyle=i,e.fg|=268435456,i===0&&(e.fg&=-268435457),e.updateExtended()}_processSGR0(i){i.fg=It.fg,i.bg=It.bg,i.extended=i.extended.clone(),i.extended.underlineStyle=0,i.extended.underlineColor&=-67108864,i.updateExtended()}charAttributes(i){if(i.length===1&&i.params[0]===0)return this._processSGR0(this._curAttrData),!0;let e=i.length,t,s=this._curAttrData;for(let r=0;r<e;r++)t=i.params[r],t>=30&&t<=37?(s.fg&=-50331904,s.fg|=16777216|t-30):t>=40&&t<=47?(s.bg&=-50331904,s.bg|=16777216|t-40):t>=90&&t<=97?(s.fg&=-50331904,s.fg|=16777216|t-90|8):t>=100&&t<=107?(s.bg&=-50331904,s.bg|=16777216|t-100|8):t===0?this._processSGR0(s):t===1?s.fg|=134217728:t===3?s.bg|=67108864:t===4?(s.fg|=268435456,this._processUnderline(i.hasSubParams(r)?i.getSubParams(r)[0]:1,s)):t===5?s.fg|=536870912:t===7?s.fg|=67108864:t===8?s.fg|=1073741824:t===9?s.fg|=2147483648:t===2?s.bg|=134217728:t===21?this._processUnderline(2,s):t===22?(s.fg&=-134217729,s.bg&=-134217729):t===23?s.bg&=-67108865:t===24?(s.fg&=-268435457,this._processUnderline(0,s)):t===25?s.fg&=-536870913:t===27?s.fg&=-67108865:t===28?s.fg&=-1073741825:t===29?s.fg&=2147483647:t===39?(s.fg&=-67108864,s.fg|=It.fg&16777215):t===49?(s.bg&=-67108864,s.bg|=It.bg&16777215):t===38||t===48||t===58?r+=this._extractColor(i,r,s):t===53?s.bg|=1073741824:t===55?s.bg&=-1073741825:t===59?(s.extended=s.extended.clone(),s.extended.underlineColor=-1,s.updateExtended()):t===100?(s.fg&=-67108864,s.fg|=It.fg&16777215,s.bg&=-67108864,s.bg|=It.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",t);return!0}deviceStatus(i){switch(i.params[0]){case 5:this._coreService.triggerDataEvent(`${le.ESC}[0n`);break;case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[${e};${t}R`);break}return!0}deviceStatusPrivate(i){switch(i.params[0]){case 6:let e=this._activeBuffer.y+1,t=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${le.ESC}[?${e};${t}R`);break}return!0}softReset(i){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=It.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(i){let e=i.length===0?1:i.params[0];if(e===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(e){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 t=e%2===1;this._coreService.decPrivateModes.cursorBlink=t}return!0}setScrollRegion(i){let e=i.params[0]||1,t;return(i.length<2||(t=i.params[1])>this._bufferService.rows||t===0)&&(t=this._bufferService.rows),t>e&&(this._activeBuffer.scrollTop=e-1,this._activeBuffer.scrollBottom=t-1,this._setCursor(0,0)),!0}windowOptions(i){if(!ME(i.params[0],this._optionsService.rawOptions.windowOptions))return!0;let e=i.length>1?i.params[1]:0;switch(i.params[0]){case 14:e!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${le.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(e===0||e===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>AE&&this._windowTitleStack.shift()),(e===0||e===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>AE&&this._iconNameStack.shift());break;case 23:(e===0||e===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(e===0||e===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(i){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(i){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(i){return this._windowTitle=i,this._onTitleChange.fire(i),!0}setIconName(i){return this._iconName=i,!0}setOrReportIndexedColor(i){let e=[],t=i.split(";");for(;t.length>1;){let s=t.shift(),r=t.shift();if(/^\d+$/.exec(s)){let n=parseInt(s);if(QE(n))if(r==="?")e.push({type:0,index:n});else{let o=TE(r);o&&e.push({type:1,index:n,color:o})}}}return e.length&&this._onColor.fire(e),!0}setHyperlink(i){let e=i.indexOf(";");if(e===-1)return!0;let t=i.slice(0,e).trim(),s=i.slice(e+1);return s?this._createHyperlink(t,s):t.trim()?!1:this._finishHyperlink()}_createHyperlink(i,e){this._getCurrentLinkId()&&this._finishHyperlink();let t=i.split(":"),s,r=t.findIndex(n=>n.startsWith("id="));return r!==-1&&(s=t[r].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:s,uri:e}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(i,e){let t=i.split(";");for(let s=0;s<t.length&&!(e>=this._specialColors.length);++s,++e)if(t[s]==="?")this._onColor.fire([{type:0,index:this._specialColors[e]}]);else{let r=TE(t[s]);r&&this._onColor.fire([{type:1,index:this._specialColors[e],color:r}])}return!0}setOrReportFgColor(i){return this._setOrReportSpecialColor(i,0)}setOrReportBgColor(i){return this._setOrReportSpecialColor(i,1)}setOrReportCursorColor(i){return this._setOrReportSpecialColor(i,2)}restoreIndexedColor(i){if(!i)return this._onColor.fire([{type:2}]),!0;let e=[],t=i.split(";");for(let s=0;s<t.length;++s)if(/^\d+$/.exec(t[s])){let r=parseInt(t[s]);QE(r)&&e.push({type:2,index:r})}return e.length&&this._onColor.fire(e),!0}restoreFgColor(i){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(i){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(i){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,ka),!0}selectCharset(i){return i.length!==2?(this.selectDefaultCharset(),!0):(i[0]==="/"||this._charsetService.setgCharset(Ite[i[0]],ni[i[1]]||ka),!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 i=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,i,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=It.clone(),this._eraseAttrDataInternal=It.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(i){return this._charsetService.setgLevel(i),!0}screenAlignmentPattern(){let i=new lr;i.content=1<<22|69,i.fg=this._curAttrData.fg,i.bg=this._curAttrData.bg,this._setCursor(0,0);for(let e=0;e<this._bufferService.rows;++e){let t=this._activeBuffer.ybase+this._activeBuffer.y+e,s=this._activeBuffer.lines.get(t);s&&(s.fill(i),s.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(i,e){let t=o=>(this._coreService.triggerDataEvent(`${le.ESC}${o}${le.ESC}\\`),!0),s=this._bufferService.buffer,r=this._optionsService.rawOptions;return t(i==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:i==='"p'?'P1$r61;1"p':i==="r"?`P1$r${s.scrollTop+1};${s.scrollBottom+1}r`:i==="m"?"P1$r0m":i===" q"?`P1$r${{block:2,underline:4,bar:6}[r.cursorStyle]-(r.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(i,e){this._dirtyRowTracker.markRangeDirty(i,e)}},ib=class{constructor(i){this._bufferService=i,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(i){i<this.start?this.start=i:i>this.end&&(this.end=i)}markRangeDirty(i,e){i>e&&(PE=i,i=e,e=PE),i<this.start&&(this.start=i),e>this.end&&(this.end=e)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};ib=Lt([Oe(0,is)],ib);function QE(i){return 0<=i&&i<256}var Wte=5e7,RE=12,Ute=50,Yte=class extends Xe{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 fe),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 s;for(;s=this._writeBuffer.shift();){this._action(s);let r=this._callbacks.shift();r&&r()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(e,t){if(this._pendingData>Wte)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 s=e||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let r=this._writeBuffer[this._bufferOffset],n=this._action(r,t);if(n){let l=c=>performance.now()-s>=RE?setTimeout(()=>this._innerWrite(0,c)):this._innerWrite(s,c);n.catch(c=>(queueMicrotask(()=>{throw c}),Promise.resolve(!1))).then(l);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=r.length,performance.now()-s>=RE)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>Ute&&(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()}},sb=class{constructor(e){this._bufferService=e,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(e){let t=this._bufferService.buffer;if(e.id===void 0){let c=t.addMarker(t.ybase+t.y),u={data:e,id:this._nextId++,lines:[c]};return c.onDispose(()=>this._removeMarkerFromLink(u,c)),this._dataByLinkId.set(u.id,u),u.id}let s=e,r=this._getEntryIdKey(s),n=this._entriesWithId.get(r);if(n)return this.addLineToLink(n.id,t.ybase+t.y),n.id;let o=t.addMarker(t.ybase+t.y),l={id:this._nextId++,key:this._getEntryIdKey(s),data:s,lines:[o]};return o.onDispose(()=>this._removeMarkerFromLink(l,o)),this._entriesWithId.set(l.key,l),this._dataByLinkId.set(l.id,l),l.id}addLineToLink(e,t){let s=this._dataByLinkId.get(e);if(s&&s.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);s.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(s,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let s=e.lines.indexOf(t);s!==-1&&(e.lines.splice(s,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};sb=Lt([Oe(0,is)],sb);var LE=!1,Hte=class extends Xe{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Th),this._onBinary=this._register(new fe),this.onBinary=this._onBinary.event,this._onData=this._register(new fe),this.onData=this._onData.event,this._onLineFeed=this._register(new fe),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new fe),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new fe),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new fe),this._instantiationService=new vte,this.optionsService=this._register(new Mte(e)),this._instantiationService.setService(ss,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(Ky)),this._instantiationService.setService(is,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(Gy)),this._instantiationService.setService(IB,this._logService),this.coreService=this._register(this._instantiationService.createInstance(Jy)),this._instantiationService.setService(Ja,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(eb)),this._instantiationService.setService(jB,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(Ba)),this._instantiationService.setService(mJ,this.unicodeService),this._charsetService=this._instantiationService.createInstance(Lte),this._instantiationService.setService(pJ,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(sb),this._instantiationService.setService(qB,this._oscLinkService),this._inputHandler=this._register(new qte(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(Di.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(Di.forward(this._bufferService.onResize,this._onResize)),this._register(Di.forward(this.coreService.onData,this._onData)),this._register(Di.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 Yte((t,s)=>this._inputHandler.parse(t,s))),this._register(Di.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new fe),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&&!LE&&(this._logService.warn("writeSync is unreliable and will be removed soon."),LE=!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,xD),t=Math.max(t,wD),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(CE.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(CE(this._bufferService),!1))),this._windowsWrappingHeuristics.value=xt(()=>{for(let t of e)t.dispose()})}}},Fte={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 Gte(i,e,t,s){var o;let r={type:0,cancel:!1,key:void 0},n=(i.shiftKey?1:0)|(i.altKey?2:0)|(i.ctrlKey?4:0)|(i.metaKey?8:0);switch(i.keyCode){case 0:i.key==="UIKeyInputUpArrow"?e?r.key=le.ESC+"OA":r.key=le.ESC+"[A":i.key==="UIKeyInputLeftArrow"?e?r.key=le.ESC+"OD":r.key=le.ESC+"[D":i.key==="UIKeyInputRightArrow"?e?r.key=le.ESC+"OC":r.key=le.ESC+"[C":i.key==="UIKeyInputDownArrow"&&(e?r.key=le.ESC+"OB":r.key=le.ESC+"[B");break;case 8:r.key=i.ctrlKey?"\b":le.DEL,i.altKey&&(r.key=le.ESC+r.key);break;case 9:if(i.shiftKey){r.key=le.ESC+"[Z";break}r.key=le.HT,r.cancel=!0;break;case 13:r.key=i.altKey?le.ESC+le.CR:le.CR,r.cancel=!0;break;case 27:r.key=le.ESC,i.altKey&&(r.key=le.ESC+le.ESC),r.cancel=!0;break;case 37:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"D":e?r.key=le.ESC+"OD":r.key=le.ESC+"[D";break;case 39:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"C":e?r.key=le.ESC+"OC":r.key=le.ESC+"[C";break;case 38:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"A":e?r.key=le.ESC+"OA":r.key=le.ESC+"[A";break;case 40:if(i.metaKey)break;n?r.key=le.ESC+"[1;"+(n+1)+"B":e?r.key=le.ESC+"OB":r.key=le.ESC+"[B";break;case 45:!i.shiftKey&&!i.ctrlKey&&(r.key=le.ESC+"[2~");break;case 46:n?r.key=le.ESC+"[3;"+(n+1)+"~":r.key=le.ESC+"[3~";break;case 36:n?r.key=le.ESC+"[1;"+(n+1)+"H":e?r.key=le.ESC+"OH":r.key=le.ESC+"[H";break;case 35:n?r.key=le.ESC+"[1;"+(n+1)+"F":e?r.key=le.ESC+"OF":r.key=le.ESC+"[F";break;case 33:i.shiftKey?r.type=2:i.ctrlKey?r.key=le.ESC+"[5;"+(n+1)+"~":r.key=le.ESC+"[5~";break;case 34:i.shiftKey?r.type=3:i.ctrlKey?r.key=le.ESC+"[6;"+(n+1)+"~":r.key=le.ESC+"[6~";break;case 112:n?r.key=le.ESC+"[1;"+(n+1)+"P":r.key=le.ESC+"OP";break;case 113:n?r.key=le.ESC+"[1;"+(n+1)+"Q":r.key=le.ESC+"OQ";break;case 114:n?r.key=le.ESC+"[1;"+(n+1)+"R":r.key=le.ESC+"OR";break;case 115:n?r.key=le.ESC+"[1;"+(n+1)+"S":r.key=le.ESC+"OS";break;case 116:n?r.key=le.ESC+"[15;"+(n+1)+"~":r.key=le.ESC+"[15~";break;case 117:n?r.key=le.ESC+"[17;"+(n+1)+"~":r.key=le.ESC+"[17~";break;case 118:n?r.key=le.ESC+"[18;"+(n+1)+"~":r.key=le.ESC+"[18~";break;case 119:n?r.key=le.ESC+"[19;"+(n+1)+"~":r.key=le.ESC+"[19~";break;case 120:n?r.key=le.ESC+"[20;"+(n+1)+"~":r.key=le.ESC+"[20~";break;case 121:n?r.key=le.ESC+"[21;"+(n+1)+"~":r.key=le.ESC+"[21~";break;case 122:n?r.key=le.ESC+"[23;"+(n+1)+"~":r.key=le.ESC+"[23~";break;case 123:n?r.key=le.ESC+"[24;"+(n+1)+"~":r.key=le.ESC+"[24~";break;default:if(i.ctrlKey&&!i.shiftKey&&!i.altKey&&!i.metaKey)i.keyCode>=65&&i.keyCode<=90?r.key=String.fromCharCode(i.keyCode-64):i.keyCode===32?r.key=le.NUL:i.keyCode>=51&&i.keyCode<=55?r.key=String.fromCharCode(i.keyCode-51+27):i.keyCode===56?r.key=le.DEL:i.keyCode===219?r.key=le.ESC:i.keyCode===220?r.key=le.FS:i.keyCode===221&&(r.key=le.GS);else if((!t||s)&&i.altKey&&!i.metaKey){let l=(o=Fte[i.keyCode])==null?void 0:o[i.shiftKey?1:0];if(l)r.key=le.ESC+l;else if(i.keyCode>=65&&i.keyCode<=90){let c=i.ctrlKey?i.keyCode-64:i.keyCode+32,u=String.fromCharCode(c);i.shiftKey&&(u=u.toUpperCase()),r.key=le.ESC+u}else if(i.keyCode===32)r.key=le.ESC+(i.ctrlKey?le.NUL:" ");else if(i.key==="Dead"&&i.code.startsWith("Key")){let c=i.code.slice(3,4);i.shiftKey||(c=c.toLowerCase()),r.key=le.ESC+c,r.cancel=!0}}else t&&!i.altKey&&!i.ctrlKey&&!i.shiftKey&&i.metaKey?i.keyCode===65&&(r.type=1):i.key&&!i.ctrlKey&&!i.altKey&&!i.metaKey&&i.keyCode>=48&&i.key.length===1?r.key=i.key:i.key&&i.ctrlKey&&(i.key==="_"&&(r.key=le.US),i.key==="@"&&(r.key=le.NUL));break}return r}var Dt=0,Kte=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new tg,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new tg,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((n,o)=>this._getKey(n)-this._getKey(o)),t=0,s=0,r=new Array(this._array.length+this._insertedValues.length);for(let n=0;n<r.length;n++)s>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[s])?(r[n]=e[t],t++):r[n]=this._array[s++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(Dt=this._search(t),Dt===-1)||this._getKey(this._array[Dt])!==t)return!1;do if(this._array[Dt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(Dt),!0;while(++Dt<this._array.length&&this._getKey(this._array[Dt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((n,o)=>n-o),t=0,s=new Array(this._array.length-e.length),r=0;for(let n=0;n<this._array.length;n++)e[t]===n?t++:s[r++]=this._array[n];this._array=s,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&&(Dt=this._search(e),!(Dt<0||Dt>=this._array.length)&&this._getKey(this._array[Dt])===e))do yield this._array[Dt];while(++Dt<this._array.length&&this._getKey(this._array[Dt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(Dt=this._search(e),!(Dt<0||Dt>=this._array.length)&&this._getKey(this._array[Dt])===e))do t(this._array[Dt]);while(++Dt<this._array.length&&this._getKey(this._array[Dt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,s=this._array.length-1;for(;s>=t;){let r=t+s>>1,n=this._getKey(this._array[r]);if(n>e)s=r-1;else if(n<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Bv=0,$E=0,Jte=class extends Xe{constructor(){super(),this._decorations=new Kte(i=>i==null?void 0:i.marker.line),this._onDecorationRegistered=this._register(new fe),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new fe),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(xt(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(i){if(i.marker.isDisposed)return;let e=new eie(i);if(e){let t=e.marker.onDispose(()=>e.dispose()),s=e.onDispose(()=>{s.dispose(),e&&(this._decorations.delete(e)&&this._onDecorationRemoved.fire(e),t.dispose())});this._decorations.insert(e),this._onDecorationRegistered.fire(e)}return e}reset(){for(let i of this._decorations.values())i.dispose();this._decorations.clear()}*getDecorationsAtCell(i,e,t){let s=0,r=0;for(let n of this._decorations.getKeyIterator(e))s=n.options.x??0,r=s+(n.options.width??1),i>=s&&i<r&&(!t||(n.options.layer??"bottom")===t)&&(yield n)}forEachDecorationAtCell(i,e,t,s){this._decorations.forEachByKey(e,r=>{Bv=r.options.x??0,$E=Bv+(r.options.width??1),i>=Bv&&i<$E&&(!t||(r.options.layer??"bottom")===t)&&s(r)})}},eie=class extends Vo{constructor(i){super(),this.options=i,this.onRenderEmitter=this.add(new fe),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new fe),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=i.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ct.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ct.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},tie=1e3,iie=class{constructor(e,t=tie){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,s){this._rowCount=s,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let n=r-this._lastRefreshMs,o=this._debounceThresholdMS-n;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},o)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t)}},BE=20,ig=class extends Xe{constructor(i,e,t,s){super(),this._terminal=i,this._coreBrowserService=t,this._renderService=s,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let r=this._coreBrowserService.mainDocument;this._accessibilityContainer=r.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=r.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let n=0;n<this._terminal.rows;n++)this._rowElements[n]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[n]);if(this._topBoundaryFocusListener=n=>this._handleBoundaryFocus(n,0),this._bottomBoundaryFocusListener=n=>this._handleBoundaryFocus(n,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=r.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new iie(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(n=>this._handleResize(n.rows))),this._register(this._terminal.onRender(n=>this._refreshRows(n.start,n.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(n=>this._handleChar(n))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
109
|
+
`))),this._register(this._terminal.onA11yTab(n=>this._handleTab(n))),this._register(this._terminal.onKey(n=>this._handleKey(n.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(Qe(r,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(xt(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(i){for(let e=0;e<i;e++)this._handleChar(" ")}_handleChar(i){this._liveRegionLineCount<BE+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==i&&(this._charsToAnnounce+=i):this._charsToAnnounce+=i,i===`
|
|
110
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===BE+1&&(this._liveRegion.textContent+=xy.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(i){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(i)||this._charsToConsume.push(i)}_refreshRows(i,e){this._liveRegionDebouncer.refresh(i,e,this._terminal.rows)}_renderRows(i,e){let t=this._terminal.buffer,s=t.lines.length.toString();for(let r=i;r<=e;r++){let n=t.lines.get(t.ydisp+r),o=[],l=(n==null?void 0:n.translateToString(!0,void 0,void 0,o))||"",c=(t.ydisp+r+1).toString(),u=this._rowElements[r];u&&(l.length===0?(u.textContent=" ",this._rowColumns.set(u,[0,1])):(u.textContent=l,this._rowColumns.set(u,o)),u.setAttribute("aria-posinset",c),u.setAttribute("aria-setsize",s),this._alignRowWidth(u))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(i,e){let t=i.target,s=this._rowElements[e===0?1:this._rowElements.length-2],r=t.getAttribute("aria-posinset"),n=e===0?"1":`${this._terminal.buffer.lines.length}`;if(r===n||i.relatedTarget!==s)return;let o,l;if(e===0?(o=t,l=this._rowElements.pop(),this._rowContainer.removeChild(l)):(o=this._rowElements.shift(),l=t,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),l.removeEventListener("focus",this._bottomBoundaryFocusListener),e===0){let c=this._createAccessibilityTreeNode();this._rowElements.unshift(c),this._rowContainer.insertAdjacentElement("afterbegin",c)}else{let c=this._createAccessibilityTreeNode();this._rowElements.push(c),this._rowContainer.appendChild(c)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(e===0?-1:1),this._rowElements[e===0?1:this._rowElements.length-2].focus(),i.preventDefault(),i.stopImmediatePropagation()}_handleSelectionChange(){var l;if(this._rowElements.length===0)return;let i=this._coreBrowserService.mainDocument.getSelection();if(!i)return;if(i.isCollapsed){this._rowContainer.contains(i.anchorNode)&&this._terminal.clearSelection();return}if(!i.anchorNode||!i.focusNode){console.error("anchorNode and/or focusNode are null");return}let e={node:i.anchorNode,offset:i.anchorOffset},t={node:i.focusNode,offset:i.focusOffset};if((e.node.compareDocumentPosition(t.node)&Node.DOCUMENT_POSITION_PRECEDING||e.node===t.node&&e.offset>t.offset)&&([e,t]=[t,e]),e.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(e={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(e.node))return;let s=this._rowElements.slice(-1)[0];if(t.node.compareDocumentPosition(s)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(t={node:s,offset:((l=s.textContent)==null?void 0:l.length)??0}),!this._rowContainer.contains(t.node))return;let r=({node:c,offset:u})=>{let d=c instanceof Text?c.parentNode:c,m=parseInt(d==null?void 0:d.getAttribute("aria-posinset"),10)-1;if(isNaN(m))return console.warn("row is invalid. Race condition?"),null;let g=this._rowColumns.get(d);if(!g)return console.warn("columns is null. Race condition?"),null;let _=u<g.length?g[u]:g.slice(-1)[0]+1;return _>=this._terminal.cols&&(++m,_=0),{row:m,column:_}},n=r(e),o=r(t);if(!(!n||!o)){if(n.row>o.row||n.row===o.row&&n.column>=o.column)throw new Error("invalid range");this._terminal.select(n.column,n.row,(o.row-n.row)*this._terminal.cols-n.column+o.column)}}_handleResize(i){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let e=this._rowContainer.children.length;e<this._terminal.rows;e++)this._rowElements[e]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[e]);for(;this._rowElements.length>i;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let i=this._coreBrowserService.mainDocument.createElement("div");return i.setAttribute("role","listitem"),i.tabIndex=-1,this._refreshRowDimensions(i),i}_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 i=0;i<this._terminal.rows;i++)this._refreshRowDimensions(this._rowElements[i]),this._alignRowWidth(this._rowElements[i])}}_refreshRowDimensions(i){i.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(i){var r,n;i.style.transform="";let e=i.getBoundingClientRect().width,t=(n=(r=this._rowColumns.get(i))==null?void 0:r.slice(-1))==null?void 0:n[0];if(!t)return;let s=t*this._renderService.dimensions.css.cell.width;i.style.transform=`scaleX(${s/e})`}};ig=Lt([Oe(1,qS),Oe(2,Un),Oe(3,Yn)],ig);var rb=class extends Xe{constructor(i,e,t,s,r){super(),this._element=i,this._mouseService=e,this._renderService=t,this._bufferService=s,this._linkProviderService=r,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new fe),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new fe),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(xt(()=>{var n;Ua(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(n=this._activeProviderReplies)==null||n.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(Qe(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(Qe(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(Qe(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(Qe(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(i){this._lastMouseEvent=i;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;let t=i.composedPath();for(let s=0;s<t.length;s++){let r=t[s];if(r.classList.contains("xterm"))break;if(r.classList.contains("xterm-hover"))return}(!this._lastBufferCell||e.x!==this._lastBufferCell.x||e.y!==this._lastBufferCell.y)&&(this._handleHover(e),this._lastBufferCell=e)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized){this._clearCurrentLink(),this._askForLink(i,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,e){var s,r;(!this._activeProviderReplies||!e)&&((s=this._activeProviderReplies)==null||s.forEach(n=>{n==null||n.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let t=!1;for(let[n,o]of this._linkProviderService.linkProviders.entries())e?(r=this._activeProviderReplies)!=null&&r.get(n)&&(t=this._checkLinkProviderResult(n,i,t)):o.provideLinks(i.y,l=>{var u,d;if(this._isMouseOut)return;let c=l==null?void 0:l.map(m=>({link:m}));(u=this._activeProviderReplies)==null||u.set(n,c),t=this._checkLinkProviderResult(n,i,t),((d=this._activeProviderReplies)==null?void 0:d.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,e){let t=new Set;for(let s=0;s<e.size;s++){let r=e.get(s);if(r)for(let n=0;n<r.length;n++){let o=r[n],l=o.link.range.start.y<i?0:o.link.range.start.x,c=o.link.range.end.y>i?this._bufferService.cols:o.link.range.end.x;for(let u=l;u<=c;u++){if(t.has(u)){r.splice(n--,1);break}t.add(u)}}}}_checkLinkProviderResult(i,e,t){var n;if(!this._activeProviderReplies)return t;let s=this._activeProviderReplies.get(i),r=!1;for(let o=0;o<i;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(r=!0);if(!r&&s){let o=s.find(l=>this._linkAtPosition(l.link,e));o&&(t=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!t)for(let o=0;o<this._activeProviderReplies.size;o++){let l=(n=this._activeProviderReplies.get(o))==null?void 0:n.find(c=>this._linkAtPosition(c.link,e));if(l){t=!0,this._handleNewLink(l);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;let e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._mouseDownLink&&sie(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,e){!this._currentLink||!this._lastMouseEvent||(!i||!e||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Ua(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(i){if(!this._lastMouseEvent)return;let e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(i.link,e)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0?!0:i.link.decorations.underline,pointerCursor:i.link.decorations===void 0?!0:i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>{var t,s;return(s=(t=this._currentLink)==null?void 0:t.state)==null?void 0:s.decorations.pointerCursor},set:t=>{var s;(s=this._currentLink)!=null&&s.state&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",t))}},underline:{get:()=>{var t,s;return(s=(t=this._currentLink)==null?void 0:t.state)==null?void 0:s.decorations.underline},set:t=>{var s,r,n;(s=this._currentLink)!=null&&s.state&&((n=(r=this._currentLink)==null?void 0:r.state)==null?void 0:n.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,t))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{if(!this._currentLink)return;let s=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp,r=this._bufferService.buffer.ydisp+1+t.end;if(this._currentLink.link.range.start.y>=s&&this._currentLink.link.range.end.y<=r&&(this._clearCurrentLink(s,r),this._lastMouseEvent)){let n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._askForLink(n,!1)}})))}_linkHover(i,e,t){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(t,e.text)}_fireUnderlineEvent(i,e){let t=i.range,s=this._bufferService.buffer.ydisp,r=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-s-1,t.end.x,t.end.y-s-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(r)}_linkLeave(i,e,t){var s;(s=this._currentLink)!=null&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(t,e.text)}_linkAtPosition(i,e){let t=i.range.start.y*this._bufferService.cols+i.range.start.x,s=i.range.end.y*this._bufferService.cols+i.range.end.x,r=e.y*this._bufferService.cols+e.x;return t<=r&&r<=s}_positionFromMouseEvent(i,e,t){let s=t.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,t,s,r){return{x1:i,y1:e,x2:t,y2:s,cols:this._bufferService.cols,fg:r}}};rb=Lt([Oe(1,WS),Oe(2,Yn),Oe(3,is),Oe(4,UB)],rb);function sie(i,e){return i.text===e.text&&i.range.start.x===e.range.start.x&&i.range.start.y===e.range.start.y&&i.range.end.x===e.range.end.x&&i.range.end.y===e.range.end.y}var rie=class extends Hte{constructor(e={}){super(e),this._linkifier=this._register(new Th),this.browser=fD,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Th),this._onCursorMove=this._register(new fe),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new fe),this.onKey=this._onKey.event,this._onRender=this._register(new fe),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new fe),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new fe),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new fe),this.onBell=this._onBell.event,this._onFocus=this._register(new fe),this._onBlur=this._register(new fe),this._onA11yCharEmitter=this._register(new fe),this._onA11yTabEmitter=this._register(new fe),this._onWillOpen=this._register(new fe),this._setup(),this._decorationService=this._instantiationService.createInstance(Jte),this._instantiationService.setService(Mf,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(Uee),this._instantiationService.setService(UB,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Cy)),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(Di.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(Di.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(Di.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(Di.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(xt(()=>{var t,s;this._customKeyEventHandler=void 0,(s=(t=this.element)==null?void 0:t.parentNode)==null||s.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 s,r="";switch(t.index){case 256:s="foreground",r="10";break;case 257:s="background",r="11";break;case 258:s="cursor",r="12";break;default:s="ansi",r="4;"+t.index}switch(t.type){case 0:let n=vt.toColorRGB(s==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[s]);this.coreService.triggerDataEvent(`${le.ESC}]${r};${jte(n)}${cD.ST}`);break;case 1:if(s==="ansi")this._themeService.modifyColors(o=>o.ansi[t.index]=Ut.toColor(...t.color));else{let o=s;this._themeService.modifyColors(l=>l[o]=Ut.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(ig,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(le.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(le.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 s=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,n=t.getWidth(s),o=this._renderService.dimensions.css.cell.width*n,l=this.buffer.y*this._renderService.dimensions.css.cell.height,c=s*this._renderService.dimensions.css.cell.width;this.textarea.style.left=c+"px",this.textarea.style.top=l+"px",this.textarea.style.width=o+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(Qe(this.element,"copy",t=>{this.hasSelection()&&lJ(t,this._selectionService)}));let e=t=>hJ(t,this.textarea,this.coreService,this.optionsService);this._register(Qe(this.textarea,"paste",e)),this._register(Qe(this.element,"paste",e)),dD?this._register(Qe(this.element,"mousedown",t=>{t.button===2&&WM(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(Qe(this.element,"contextmenu",t=>{WM(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),ex&&this._register(Qe(this.element,"auxclick",t=>{t.button===1&&zB(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(Qe(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(Qe(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(Qe(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(Qe(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(Qe(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(Qe(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(Qe(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var n;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"),((n=this.element)==null?void 0:n.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(Qe(this.screenElement,"mousemove",o=>this.updateCursorStyle(o))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let s=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Sy.get()),gD||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",()=>s.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(qee,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Un,this._coreBrowserService),this._register(Qe(this.textarea,"focus",o=>this._handleTextAreaFocus(o))),this._register(Qe(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(Wy,this._document,this._helperContainer),this._instantiationService.setService(xg,this._charSizeService),this._themeService=this._instantiationService.createInstance(Fy),this._instantiationService.setService(Dh,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Jm),this._instantiationService.setService(WB,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(Yy,this.rows,this.screenElement)),this._instantiationService.setService(Yn,this._renderService),this._register(this._renderService.onRenderedViewportChange(o=>this._onRender.fire(o))),this.onResize(o=>this._renderService.resize(o.cols,o.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(jy,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(Uy),this._instantiationService.setService(WS,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(rb,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(Vy,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(o=>{super.scrollLines(o,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(Hy,this.element,this.screenElement,r)),this._instantiationService.setService(OJ,this._selectionService),this._register(this._selectionService.onRequestScrollLines(o=>this.scrollLines(o.amount,o.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(o=>this._renderService.handleSelectionChanged(o.start,o.end,o.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(o=>{this.textarea.value=o,this.textarea.focus(),this.textarea.select()})),this._register(Di.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var o;this._selectionService.refresh(),(o=this._viewport)==null||o.queueSync()})),this._register(this._instantiationService.createInstance(Zy,this.screenElement)),this._register(Qe(this.element,"mousedown",o=>this._selectionService.handleMouseDown(o))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager.value=this._instantiationService.createInstance(ig,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",o=>this._handleScreenReaderModeOptionChange(o))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Km,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",o=>{!this._overviewRulerRenderer&&o&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(Km,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(qy,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function s(o){var d,m,g,_,y;let l=e._mouseService.getMouseReportCoords(o,e.screenElement);if(!l)return!1;let c,u;switch(o.overrideType||o.type){case"mousemove":u=32,o.buttons===void 0?(c=3,o.button!==void 0&&(c=o.button<3?o.button:3)):c=o.buttons&1?0:o.buttons&4?1:o.buttons&2?2:3;break;case"mouseup":u=0,c=o.button<3?o.button:3;break;case"mousedown":u=1,c=o.button<3?o.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(o)===!1)return!1;let b=o.deltaY;if(b===0||e.coreMouseService.consumeWheelEvent(o,(_=(g=(m=(d=e._renderService)==null?void 0:d.dimensions)==null?void 0:m.device)==null?void 0:g.cell)==null?void 0:_.height,(y=e._coreBrowserService)==null?void 0:y.dpr)===0)return!1;u=b<0?0:1,c=4;break;default:return!1}return u===void 0||c===void 0||c>4?!1:e.coreMouseService.triggerMouseEvent({col:l.col,row:l.row,x:l.x,y:l.y,button:c,action:u,ctrl:o.ctrlKey,alt:o.altKey,shift:o.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},n={mouseup:o=>(s(o),o.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(o)),wheel:o=>(s(o),this.cancel(o,!0)),mousedrag:o=>{o.buttons&&s(o)},mousemove:o=>{o.buttons||s(o)}};this._register(this.coreMouseService.onProtocolChange(o=>{o?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(o)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),o&8?r.mousemove||(t.addEventListener("mousemove",n.mousemove),r.mousemove=n.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),o&16?r.wheel||(t.addEventListener("wheel",n.wheel,{passive:!1}),r.wheel=n.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),o&2?r.mouseup||(r.mouseup=n.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),o&4?r.mousedrag||(r.mousedrag=n.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(Qe(t,"mousedown",o=>{if(o.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(o)))return s(o),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(o)})),this._register(Qe(t,"wheel",o=>{var l,c,u,d,m;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(o)===!1)return!1;if(!this.buffer.hasScrollback){if(o.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(o,(d=(u=(c=(l=e._renderService)==null?void 0:l.dimensions)==null?void 0:c.device)==null?void 0:u.cell)==null?void 0:d.height,(m=e._coreBrowserService)==null?void 0:m.dpr)===0)return this.cancel(o,!0);let g=le.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(o.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(g,!0),this.cancel(o,!0)}}},{passive:!1}))}refresh(e,t){var s;(s=this._renderService)==null||s.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){DB(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,s){this._selectionService.setSelection(e,t,s)}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 s;(s=this._selectionService)==null||s.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 s=Gte(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),s.type===3||s.type===2){let r=this.rows-1;return this.scrollLines(s.type===2?-r:r),this.cancel(e,!0)}if(s.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(s.cancel&&this.cancel(e,!0),!s.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((s.key===le.ETX||s.key===le.CR)&&(this.textarea.value=""),this._onKey.fire({key:s.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(s.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let s=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"?s:s&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(nie(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 s;(s=this._charSizeService)==null||s.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(It));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(le.ESC+"[I"):this.coreService.triggerDataEvent(le.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),s=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${le.ESC}[4;${s};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),n=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${le.ESC}[6;${n};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function nie(i){return i.keyCode===16||i.keyCode===17||i.keyCode===18}var oie=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let s={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(s),t.dispose=()=>this._wrappedAddonDispose(s),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let s=0;s<this._addons.length;s++)if(this._addons[s]===e){t=s;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)}},aie=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 lr)}translateToString(e,t,s){return this._line.translateToString(e,t,s)}},DE=class{constructor(i,e){this._buffer=i,this.type=e}init(i){return this._buffer=i,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(i){let e=this._buffer.lines.get(i);if(e)return new aie(e)}getNullCell(){return new lr}},lie=class extends Xe{constructor(i){super(),this._core=i,this._onBufferChange=this._register(new fe),this.onBufferChange=this._onBufferChange.event,this._normal=new DE(this._core.buffers.normal,"normal"),this._alternate=new DE(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)}},hie=class{constructor(i){this._core=i}registerCsiHandler(i,e){return this._core.registerCsiHandler(i,t=>e(t.toArray()))}addCsiHandler(i,e){return this.registerCsiHandler(i,e)}registerDcsHandler(i,e){return this._core.registerDcsHandler(i,(t,s)=>e(t,s.toArray()))}addDcsHandler(i,e){return this.registerDcsHandler(i,e)}registerEscHandler(i,e){return this._core.registerEscHandler(i,e)}addEscHandler(i,e){return this.registerEscHandler(i,e)}registerOscHandler(i,e){return this._core.registerOscHandler(i,e)}addOscHandler(i,e){return this.registerOscHandler(i,e)}},cie=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}},uie=["cols","rows"],zr=0,fie=class extends Xe{constructor(i){super(),this._core=this._register(new rie(i)),this._addonManager=this._register(new oie),this._publicOptions={...this._core.options};let e=s=>this._core.options[s],t=(s,r)=>{this._checkReadonlyOptions(s),this._core.options[s]=r};for(let s in this._core.options){let r={get:e.bind(this,s),set:t.bind(this,s)};Object.defineProperty(this._publicOptions,s,r)}}_checkReadonlyOptions(i){if(uie.includes(i))throw new Error(`Option "${i}" 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 hie(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new cie(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 lie(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let i=this._core.coreService.decPrivateModes,e="none";switch(this._core.coreMouseService.activeProtocol){case"X10":e="x10";break;case"VT200":e="vt200";break;case"DRAG":e="drag";break;case"ANY":e="any";break}return{applicationCursorKeysMode:i.applicationCursorKeys,applicationKeypadMode:i.applicationKeypad,bracketedPasteMode:i.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:e,originMode:i.origin,reverseWraparoundMode:i.reverseWraparound,sendFocusMode:i.sendFocus,synchronizedOutputMode:i.synchronizedOutput,wraparoundMode:i.wraparound}}get options(){return this._publicOptions}set options(i){for(let e in i)this._publicOptions[e]=i[e]}blur(){this._core.blur()}focus(){this._core.focus()}input(i,e=!0){this._core.input(i,e)}resize(i,e){this._verifyIntegers(i,e),this._core.resize(i,e)}open(i){this._core.open(i)}attachCustomKeyEventHandler(i){this._core.attachCustomKeyEventHandler(i)}attachCustomWheelEventHandler(i){this._core.attachCustomWheelEventHandler(i)}registerLinkProvider(i){return this._core.registerLinkProvider(i)}registerCharacterJoiner(i){return this._checkProposedApi(),this._core.registerCharacterJoiner(i)}deregisterCharacterJoiner(i){this._checkProposedApi(),this._core.deregisterCharacterJoiner(i)}registerMarker(i=0){return this._verifyIntegers(i),this._core.registerMarker(i)}registerDecoration(i){return this._checkProposedApi(),this._verifyPositiveIntegers(i.x??0,i.width??0,i.height??0),this._core.registerDecoration(i)}hasSelection(){return this._core.hasSelection()}select(i,e,t){this._verifyIntegers(i,e,t),this._core.select(i,e,t)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(i,e){this._verifyIntegers(i,e),this._core.selectLines(i,e)}dispose(){super.dispose()}scrollLines(i){this._verifyIntegers(i),this._core.scrollLines(i)}scrollPages(i){this._verifyIntegers(i),this._core.scrollPages(i)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(i){this._verifyIntegers(i),this._core.scrollToLine(i)}clear(){this._core.clear()}write(i,e){this._core.write(i,e)}writeln(i,e){this._core.write(i),this._core.write(`\r
|
|
111
|
+
`,e)}paste(i){this._core.paste(i)}refresh(i,e){this._verifyIntegers(i,e),this._core.refresh(i,e)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(i){this._addonManager.loadAddon(this,i)}static get strings(){return{get promptLabel(){return Sy.get()},set promptLabel(i){Sy.set(i)},get tooMuchOutput(){return xy.get()},set tooMuchOutput(i){xy.set(i)}}}_verifyIntegers(...i){for(zr of i)if(zr===1/0||isNaN(zr)||zr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...i){for(zr of i)if(zr&&(zr===1/0||isNaN(zr)||zr%1!==0||zr<0))throw new Error("This API only accepts positive integers")}};/**
|
|
105
112
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
106
113
|
* @license MIT
|
|
107
114
|
*
|
|
@@ -112,7 +119,7 @@ WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){t
|
|
|
112
119
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
113
120
|
* http://bellard.org/jslinux/
|
|
114
121
|
* Copyright (c) 2011 Fabrice Bellard
|
|
115
|
-
*/var
|
|
122
|
+
*/var die=2,pie=1,mie=class{activate(i){this._terminal=i}dispose(){}fit(){let i=this.proposeDimensions();if(!i||!this._terminal||isNaN(i.cols)||isNaN(i.rows))return;let e=this._terminal._core;(this._terminal.rows!==i.rows||this._terminal.cols!==i.cols)&&(e._renderService.clear(),this._terminal.resize(i.cols,i.rows))}proposeDimensions(){var m;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let i=this._terminal._core._renderService.dimensions;if(i.css.cell.width===0||i.css.cell.height===0)return;let e=this._terminal.options.scrollback===0?0:((m=this._terminal.options.overviewRuler)==null?void 0:m.width)||14,t=window.getComputedStyle(this._terminal.element.parentElement),s=parseInt(t.getPropertyValue("height")),r=Math.max(0,parseInt(t.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),o={top:parseInt(n.getPropertyValue("padding-top")),bottom:parseInt(n.getPropertyValue("padding-bottom")),right:parseInt(n.getPropertyValue("padding-right")),left:parseInt(n.getPropertyValue("padding-left"))},l=o.top+o.bottom,c=o.right+o.left,u=s-l,d=r-c-e;return{cols:Math.max(die,Math.floor(d/i.css.cell.width)),rows:Math.max(pie,Math.floor(u/i.css.cell.height))}}};/**
|
|
116
123
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
117
124
|
* @license MIT
|
|
118
125
|
*
|
|
@@ -123,13 +130,13 @@ WARNING: This link could potentially be dangerous`)){let t=window.open();if(t){t
|
|
|
123
130
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
124
131
|
* http://bellard.org/jslinux/
|
|
125
132
|
* Copyright (c) 2011 Fabrice Bellard
|
|
126
|
-
*/var
|
|
133
|
+
*/var gie=(i,e,t,s)=>{for(var r=e,n=i.length-1,o;n>=0;n--)(o=i[n])&&(r=o(r)||r);return r},Oie=(i,e)=>(t,s)=>e(t,s,i),_ie=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(i){setTimeout(()=>{throw i.stack?zE.isErrorNoTelemetry(i)?new zE(i.message+`
|
|
127
134
|
|
|
128
135
|
`+i.stack):new Error(i.message+`
|
|
129
136
|
|
|
130
|
-
`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},Yte=new Ute;function pv(i){Hte(i)||Yte.onUnexpectedError(i)}var nb="Canceled";function Hte(i){return i instanceof Fte?!0:i instanceof Error&&i.name===nb&&i.message===nb}var Fte=class extends Error{constructor(){super(nb),this.name=this.message}},cE=class ob extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ob)return e;let t=new ob;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Gte;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Gte||(Gte={}));function Kte(i,e){let t=this,s=!1,r;return function(){return s||(s=!0,e||(r=i.apply(t,arguments))),r}}var SD;(i=>{function e(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(A){yield A}i.single=r;function n(A){return e(A)?A:r(A)}i.wrap=n;function o(A){return A||t}i.from=o;function*l(A){for(let P=A.length-1;P>=0;P--)yield A[P]}i.reverse=l;function c(A){return!A||A[Symbol.iterator]().next().done===!0}i.isEmpty=c;function u(A){return A[Symbol.iterator]().next().value}i.first=u;function d(A,P){let E=0;for(let $ of A)if(P($,E++))return!0;return!1}i.some=d;function m(A,P){for(let E of A)if(P(E))return E}i.find=m;function*g(A,P){for(let E of A)P(E)&&(yield E)}i.filter=g;function*_(A,P){let E=0;for(let $ of A)yield P($,E++)}i.map=_;function*y(A,P){let E=0;for(let $ of A)yield*P($,E++)}i.flatMap=y;function*b(...A){for(let P of A)yield*P}i.concat=b;function x(A,P,E){let $=E;for(let z of A)$=P($,z);return $}i.reduce=x;function*w(A,P,E=A.length){for(P<0&&(P+=A.length),E<0?E+=A.length:E>A.length&&(E=A.length);P<E;P++)yield A[P]}i.slice=w;function k(A,P=Number.POSITIVE_INFINITY){let E=[];if(P===0)return[E,A];let $=A[Symbol.iterator]();for(let z=0;z<P;z++){let I=$.next();if(I.done)return[E,i.empty()];E.push(I.value)}return[E,{[Symbol.iterator](){return $}}]}i.consume=k;async function C(A){let P=[];for await(let E of A)P.push(E);return Promise.resolve(P)}i.asyncToArray=C})(SD||(SD={}));function xD(i){if(SD.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function wD(...i){return ji(()=>xD(i))}function ji(i){return{dispose:Kte(()=>{i()})}}var CD=class kD{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{xD(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?kD.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};CD.DISABLE_DISPOSED_WARNING=!1;var ph=CD,Cr=class{constructor(){this._store=new ph,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)}};Cr.None=Object.freeze({dispose(){}});var eu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(i){var e;this._isDisposed||i===this._value||((e=this._value)==null||e.dispose(),this._value=i)}clear(){this.value=void 0}dispose(){var i;this._isDisposed=!0,(i=this._value)==null||i.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i}},ex=typeof process<"u"&&"title"in process,kg=ex?"node":navigator.userAgent,Jte=ex?"node":navigator.platform,eie=kg.includes("Firefox"),tie=kg.includes("Edge"),TD=/^((?!chrome|android).)*safari/i.test(kg);function iie(){if(!TD)return 0;let i=kg.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}Jte.indexOf("Linux")>=0;var sie="",pi=0,mi=0,gi=0,Qt=0,Gs={css:"#00000000",rgba:0},Ki;(i=>{function e(r,n,o,l){return l!==void 0?`#${ba(r)}${ba(n)}${ba(o)}${ba(l)}`:`#${ba(r)}${ba(n)}${ba(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Ki||(Ki={}));var gu;(i=>{function e(c,u){if(Qt=(u.rgba&255)/255,Qt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,m=u.rgba>>16&255,g=u.rgba>>8&255,_=c.rgba>>24&255,y=c.rgba>>16&255,b=c.rgba>>8&255;pi=_+Math.round((d-_)*Qt),mi=y+Math.round((m-y)*Qt),gi=b+Math.round((g-b)*Qt);let x=Ki.toCss(pi,mi,gi),w=Ki.toRgba(pi,mi,gi);return{css:x,rgba:w}}i.blend=e;function t(c){return(c.rgba&255)===255}i.isOpaque=t;function s(c,u,d){let m=Va.ensureContrastRatio(c.rgba,u.rgba,d);if(m)return Ki.toColor(m>>24&255,m>>16&255,m>>8&255)}i.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[pi,mi,gi]=Va.toChannels(u),{css:Ki.toCss(pi,mi,gi),rgba:u}}i.opaque=r;function n(c,u){return Qt=Math.round(u*255),[pi,mi,gi]=Va.toChannels(c.rgba),{css:Ki.toCss(pi,mi,gi,Qt),rgba:Ki.toRgba(pi,mi,gi,Qt)}}i.opacity=n;function o(c,u){return Qt=c.rgba&255,n(c,Qt*u/255)}i.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}i.toColorRGB=l})(gu||(gu={}));var rie;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return pi=parseInt(r.slice(1,2).repeat(2),16),mi=parseInt(r.slice(2,3).repeat(2),16),gi=parseInt(r.slice(3,4).repeat(2),16),Ki.toColor(pi,mi,gi);case 5:return pi=parseInt(r.slice(1,2).repeat(2),16),mi=parseInt(r.slice(2,3).repeat(2),16),gi=parseInt(r.slice(3,4).repeat(2),16),Qt=parseInt(r.slice(4,5).repeat(2),16),Ki.toColor(pi,mi,gi,Qt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return pi=parseInt(n[1]),mi=parseInt(n[2]),gi=parseInt(n[3]),Qt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ki.toColor(pi,mi,gi,Qt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[pi,mi,gi,Qt]=e.getImageData(0,0,1,1).data,Qt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ki.toRgba(pi,mi,gi,Qt),css:r}}i.toColor=s})(rie||(rie={}));var Hi;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,l=r/255,c=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+m*.0722}i.relativeLuminance2=t})(Hi||(Hi={}));var Va;(i=>{function e(o,l){if(Qt=(l&255)/255,Qt===1)return l;let c=l>>24&255,u=l>>16&255,d=l>>8&255,m=o>>24&255,g=o>>16&255,_=o>>8&255;return pi=m+Math.round((c-m)*Qt),mi=g+Math.round((u-g)*Qt),gi=_+Math.round((d-_)*Qt),Ki.toRgba(pi,mi,gi)}i.blend=e;function t(o,l,c){let u=Hi.relativeLuminance(o>>8),d=Hi.relativeLuminance(l>>8);if(En(u,d)<c){if(d<u){let _=s(o,l,c),y=En(u,Hi.relativeLuminance(_>>8));if(y<c){let b=r(o,l,c),x=En(u,Hi.relativeLuminance(b>>8));return y>x?_:b}return _}let m=r(o,l,c),g=En(u,Hi.relativeLuminance(m>>8));if(g<c){let _=s(o,l,c),y=En(u,Hi.relativeLuminance(_>>8));return g>y?m:_}return m}}i.ensureContrastRatio=t;function s(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));for(;b<c&&(g>0||_>0||y>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.reduceLuminance=s;function r(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));for(;b<c&&(g<255||_<255||y<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Va||(Va={}));function ba(i){let e=i.toString(16);return e.length<2?"0"+e:e}function En(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function Wt(i){if(!i)throw new Error("value must not be falsy");return i}function tx(i){return 57508<=i&&i<=57558}function nie(i){return 57520<=i&&i<=57527}function oie(i){return 57344<=i&&i<=63743}function aie(i){return 9472<=i&&i<=9631}function lie(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function hie(i,e,t,s){return e===1&&t>Math.ceil(s*1.5)&&i!==void 0&&i>255&&!lie(i)&&!tx(i)&&!oie(i)}function AD(i){return tx(i)||aie(i)}function cie(){return{css:{canvas:Pp(),cell:Pp()},device:{canvas:Pp(),cell:Pp(),char:{width:0,height:0,left:0,top:0}}}}function Pp(){return{width:0,height:0}}function uie(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var Mi=0,hi=0,zr=!1,Pn=!1,Qp=!1,fs,mv=0,fie=class{constructor(i,e,t,s,r,n){this._terminal=i,this._optionService=e,this._selectionRenderModel=t,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(i,e,t,s){if(this.result.bg=i.bg,this.result.fg=i.fg,this.result.ext=i.bg&268435456?i.extended.ext:0,hi=0,Mi=0,Pn=!1,zr=!1,Qp=!1,fs=this._themeService.colors,mv=0,i.getCode()!==0&&i.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));mv=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,t,"bottom",r=>{r.backgroundColorRGB&&(hi=r.backgroundColorRGB.rgba>>8&16777215,Pn=!0),r.foregroundColorRGB&&(Mi=r.foregroundColorRGB.rgba>>8&16777215,zr=!0)}),Qp=this._selectionRenderModel.isCellSelected(this._terminal,e,t),Qp){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:hi=(this.result.fg&16777215)<<8|255;break;case 0:default:hi=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:hi=(this.result.bg&16777215)<<8|255;break}hi=Va.blend(hi,(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else hi=(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Pn=!0,fs.selectionForeground&&(Mi=fs.selectionForeground.rgba>>8&16777215,zr=!0),AD(i.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Mi=(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Mi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Mi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Mi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Mi=(this.result.fg&16777215)<<8|255;break;case 0:default:Mi=this._themeService.colors.foreground.rgba}Mi=Va.blend(Mi,(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}zr=!0}}this._decorationService.forEachDecorationAtCell(e,t,"top",r=>{r.backgroundColorRGB&&(hi=r.backgroundColorRGB.rgba>>8&16777215,Pn=!0),r.foregroundColorRGB&&(Mi=r.foregroundColorRGB.rgba>>8&16777215,zr=!0)}),Pn&&(Qp?hi=i.bg&-16777216&-134217729|hi|50331648:hi=i.bg&-16777216|hi|50331648),zr&&(Mi=i.fg&-16777216&-67108865|Mi|50331648),this.result.fg&67108864&&(Pn&&!zr&&((this.result.bg&50331648)===0?Mi=this.result.fg&-134217728|fs.background.rgba>>8&16777215&16777215|50331648:Mi=this.result.fg&-134217728|this.result.bg&67108863,zr=!0),!Pn&&zr&&((this.result.fg&50331648)===0?hi=this.result.bg&-67108864|fs.foreground.rgba>>8&16777215&16777215|50331648:hi=this.result.bg&-67108864|this.result.fg&67108863,Pn=!0)),fs=void 0,this.result.bg=Pn?hi:this.result.bg,this.result.fg=zr?Mi:this.result.fg,this.result.ext&=536870911,this.result.ext|=mv<<29&3758096384}},die=.5,MD=eie||tie?"bottom":"ideographic",pie={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},mie={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},gie={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╒":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"╔":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╕":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"╗":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"╘":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╚":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"╛":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"╝":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"╞":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"╠":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╡":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╣":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"╤":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"╦":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╧":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╩":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╪":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╬":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},uf={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};uf[""]=uf[""];uf[""]=uf[""];function Oie(i,e,t,s,r,n,o,l){let c=pie[e];if(c)return _ie(i,c,t,s,r,n),!0;let u=mie[e];if(u)return vie(i,u,t,s,r,n),!0;let d=gie[e];if(d)return yie(i,d,t,s,r,n,l),!0;let m=uf[e];return m?(bie(i,m,t,s,r,n,o,l),!0):!1}function _ie(i,e,t,s,r,n){for(let o=0;o<e.length;o++){let l=e[o],c=r/8,u=n/8;i.fillRect(t+l.x*c,s+l.y*u,l.w*c,l.h*u)}}var uE=new Map;function vie(i,e,t,s,r,n){let o=uE.get(e);o||(o=new Map,uE.set(e,o));let l=i.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let c=o.get(l);if(!c){let u=e[0].length,d=e.length,m=i.canvas.ownerDocument.createElement("canvas");m.width=u,m.height=d;let g=Wt(m.getContext("2d")),_=new ImageData(u,d),y,b,x,w;if(l.startsWith("#"))y=parseInt(l.slice(1,3),16),b=parseInt(l.slice(3,5),16),x=parseInt(l.slice(5,7),16),w=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[y,b,x,w]=l.substring(5,l.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let k=0;k<d;k++)for(let C=0;C<u;C++)_.data[(k*u+C)*4]=y,_.data[(k*u+C)*4+1]=b,_.data[(k*u+C)*4+2]=x,_.data[(k*u+C)*4+3]=e[k][C]*(w*255);g.putImageData(_,0,0),c=Wt(i.createPattern(m,null)),o.set(l,c)}i.fillStyle=c,i.fillRect(t,s,r,n)}function yie(i,e,t,s,r,n,o){i.strokeStyle=i.fillStyle;for(let[l,c]of Object.entries(e)){i.beginPath(),i.lineWidth=o*Number.parseInt(l);let u;if(typeof c=="function"){let d=.15/n*r;u=c(.15,d)}else u=c;for(let d of u.split(" ")){let m=d[0],g=ED[m];if(!g){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||g(i,PD(_,r,n,t,s,!0,o))}i.stroke(),i.closePath()}}function bie(i,e,t,s,r,n,o,l){let c=new Path2D;c.rect(t,s,r,n),i.clip(c),i.beginPath();let u=o/12;i.lineWidth=l*u;for(let d of e.d.split(" ")){let m=d[0],g=ED[m];if(!g){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||g(i,PD(_,r,n,t,s,!1,l,(e.leftPadding??0)*(u/2),(e.rightPadding??0)*(u/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function fE(i,e,t=0){return Math.max(Math.min(i,e),t)}var ED={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function PD(i,e,t,s,r,n,o,l=0,c=0){let u=i.map(d=>parseFloat(d)||parseInt(d));if(u.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<u.length;d+=2)u[d]*=e-l*o-c*o,n&&u[d]!==0&&(u[d]=fE(Math.round(u[d]+.5)-.5,e,0)),u[d]+=s+l*o;for(let d=1;d<u.length;d+=2)u[d]*=t,n&&u[d]!==0&&(u[d]=fE(Math.round(u[d]+.5)-.5,t,0)),u[d]+=r;return u}var dE=class{constructor(){this._data={}}set(i,e,t){this._data[i]||(this._data[i]={}),this._data[i][e]=t}get(i,e){return this._data[i]?this._data[i][e]:void 0}clear(){this._data={}}},pE=class{constructor(){this._data=new dE}set(i,e,t,s,r){this._data.get(i,e)||this._data.set(i,e,new dE),this._data.get(i,e).set(t,s,r)}get(i,e,t,s){var r;return(r=this._data.get(i,e))==null?void 0:r.get(t,s)}clear(){this._data.clear()}},QD=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,s=i.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),r=i.timeRemaining(),t*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Sie=class extends QD{_requestCallback(i){return setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){clearTimeout(i)}_createDeadline(i){let e=performance.now()+i;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},xie=class extends QD{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},wie=!ex&&"requestIdleCallback"in window?xie:Sie,sh=class RD{constructor(){this.fg=0,this.bg=0,this.extended=new LD}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new RD;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},LD=class $D{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new $D(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Cie=globalThis.performance&&typeof globalThis.performance.now=="function",kie=class BD{static create(e){return new BD(e)}constructor(e){this._now=Cie&&e===!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}},Nn;(i=>{i.None=()=>Cr.None;function e(R,L){return m(R,()=>{},0,void 0,!0,void 0,L)}i.defer=e;function t(R){return(L,N=null,Z)=>{let Q=!1,X;return X=R(W=>{if(!Q)return X?X.dispose():Q=!0,L.call(N,W)},null,Z),Q&&X.dispose(),X}}i.once=t;function s(R,L,N){return u((Z,Q=null,X)=>R(W=>Z.call(Q,L(W)),null,X),N)}i.map=s;function r(R,L,N){return u((Z,Q=null,X)=>R(W=>{L(W),Z.call(Q,W)},null,X),N)}i.forEach=r;function n(R,L,N){return u((Z,Q=null,X)=>R(W=>L(W)&&Z.call(Q,W),null,X),N)}i.filter=n;function o(R){return R}i.signal=o;function l(...R){return(L,N=null,Z)=>{let Q=wD(...R.map(X=>X(W=>L.call(N,W))));return d(Q,Z)}}i.any=l;function c(R,L,N,Z){let Q=N;return s(R,X=>(Q=L(Q,X),Q),Z)}i.reduce=c;function u(R,L){let N,Z={onWillAddFirstListener(){N=R(Q.fire,Q)},onDidRemoveLastListener(){N==null||N.dispose()}},Q=new yt(Z);return L==null||L.add(Q),Q.event}function d(R,L){return L instanceof Array?L.push(R):L&&L.add(R),R}function m(R,L,N=100,Z=!1,Q=!1,X,W){let U,q,D,G=0,ie,ce={leakWarningThreshold:X,onWillAddFirstListener(){U=R(de=>{G++,q=L(q,de),Z&&!D&&(he.fire(q),q=void 0),ie=()=>{let ge=q;q=void 0,D=void 0,(!Z||G>1)&&he.fire(ge),G=0},typeof N=="number"?(clearTimeout(D),D=setTimeout(ie,N)):D===void 0&&(D=0,queueMicrotask(ie))})},onWillRemoveListener(){Q&&G>0&&(ie==null||ie())},onDidRemoveLastListener(){ie=void 0,U.dispose()}},he=new yt(ce);return W==null||W.add(he),he.event}i.debounce=m;function g(R,L=0,N){return i.debounce(R,(Z,Q)=>Z?(Z.push(Q),Z):[Q],L,void 0,!0,void 0,N)}i.accumulate=g;function _(R,L=(Z,Q)=>Z===Q,N){let Z=!0,Q;return n(R,X=>{let W=Z||!L(X,Q);return Z=!1,Q=X,W},N)}i.latch=_;function y(R,L,N){return[i.filter(R,L,N),i.filter(R,Z=>!L(Z),N)]}i.split=y;function b(R,L=!1,N=[],Z){let Q=N.slice(),X=R(q=>{Q?Q.push(q):U.fire(q)});Z&&Z.add(X);let W=()=>{Q==null||Q.forEach(q=>U.fire(q)),Q=null},U=new yt({onWillAddFirstListener(){X||(X=R(q=>U.fire(q)),Z&&Z.add(X))},onDidAddFirstListener(){Q&&(L?setTimeout(W):W())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return Z&&Z.add(U),U.event}i.buffer=b;function x(R,L){return(N,Z,Q)=>{let X=L(new k);return R(function(W){let U=X.evaluate(W);U!==w&&N.call(Z,U)},void 0,Q)}}i.chain=x;let w=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(N=>(L(N),N)),this}filter(L){return this.steps.push(N=>L(N)?N:w),this}reduce(L,N){let Z=N;return this.steps.push(Q=>(Z=L(Z,Q),Z)),this}latch(L=(N,Z)=>N===Z){let N=!0,Z;return this.steps.push(Q=>{let X=N||!L(Q,Z);return N=!1,Z=Q,X?Q:w}),this}evaluate(L){for(let N of this.steps)if(L=N(L),L===w)break;return L}}function C(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.on(L,Z),X=()=>R.removeListener(L,Z),W=new yt({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromNodeEventEmitter=C;function A(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.addEventListener(L,Z),X=()=>R.removeEventListener(L,Z),W=new yt({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromDOMEventEmitter=A;function P(R){return new Promise(L=>t(R)(L))}i.toPromise=P;function E(R){let L=new yt;return R.then(N=>{L.fire(N)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}i.fromPromise=E;function $(R,L){return R(N=>L.fire(N))}i.forward=$;function z(R,L,N){return L(N),R(Z=>L(Z))}i.runAndSubscribe=z;class I{constructor(L,N){this._observable=L,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new yt(Z),N&&N.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,N){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(R,L){return new I(R,L).emitter.event}i.fromObservable=se;function F(R){return(L,N,Z)=>{let Q=0,X=!1,W={beginUpdate(){Q++},endUpdate(){Q--,Q===0&&(R.reportChanges(),X&&(X=!1,L.call(N)))},handlePossibleChange(){},handleChange(){X=!0}};R.addObserver(W),R.reportChanges();let U={dispose(){R.removeObserver(W)}};return Z instanceof ph?Z.add(U):Array.isArray(Z)&&Z.push(U),U}}i.fromObservableLight=F})(Nn||(Nn={}));var ab=class lb{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${lb._idPool++}`,lb.all.add(this)}start(e){this._stopWatch=new kie,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ab.all=new Set,ab._idPool=0;var Tie=ab,Aie=-1,DD=class zD{constructor(e,t,s=(zD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){let s=this.threshold;if(s<=0||t<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let c=new Pie(l,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t<r)&&(e=[s,r],t=r);return e}};DD._idPool=1;var Mie=DD,Eie=class ND{constructor(e){this.value=e}static create(){let e=new Error;return new ND(e.stack??"")}print(){console.warn(this.value.split(`
|
|
137
|
+
`+i.stack):i},0)}}addListener(i){return this.listeners.push(i),()=>{this._removeListener(i)}}emit(i){this.listeners.forEach(e=>{e(i)})}_removeListener(i){this.listeners.splice(this.listeners.indexOf(i),1)}setUnexpectedErrorHandler(i){this.unexpectedErrorHandler=i}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(i){this.unexpectedErrorHandler(i),this.emit(i)}onUnexpectedExternalError(i){this.unexpectedErrorHandler(i)}},vie=new _ie;function Dv(i){yie(i)||vie.onUnexpectedError(i)}var nb="Canceled";function yie(i){return i instanceof bie?!0:i instanceof Error&&i.name===nb&&i.message===nb}var bie=class extends Error{constructor(){super(nb),this.name=this.message}},zE=class ob extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof ob)return e;let t=new ob;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}},Sie;(i=>{function e(n){return n<0}i.isLessThan=e;function t(n){return n<=0}i.isLessThanOrEqual=t;function s(n){return n>0}i.isGreaterThan=s;function r(n){return n===0}i.isNeitherLessOrGreaterThan=r,i.greaterThan=1,i.lessThan=-1,i.neitherLessOrGreaterThan=0})(Sie||(Sie={}));function xie(i,e){let t=this,s=!1,r;return function(){return s||(s=!0,e||(r=i.apply(t,arguments))),r}}var kD;(i=>{function e(A){return A&&typeof A=="object"&&typeof A[Symbol.iterator]=="function"}i.is=e;let t=Object.freeze([]);function s(){return t}i.empty=s;function*r(A){yield A}i.single=r;function n(A){return e(A)?A:r(A)}i.wrap=n;function o(A){return A||t}i.from=o;function*l(A){for(let P=A.length-1;P>=0;P--)yield A[P]}i.reverse=l;function c(A){return!A||A[Symbol.iterator]().next().done===!0}i.isEmpty=c;function u(A){return A[Symbol.iterator]().next().value}i.first=u;function d(A,P){let E=0;for(let $ of A)if(P($,E++))return!0;return!1}i.some=d;function m(A,P){for(let E of A)if(P(E))return E}i.find=m;function*g(A,P){for(let E of A)P(E)&&(yield E)}i.filter=g;function*_(A,P){let E=0;for(let $ of A)yield P($,E++)}i.map=_;function*y(A,P){let E=0;for(let $ of A)yield*P($,E++)}i.flatMap=y;function*b(...A){for(let P of A)yield*P}i.concat=b;function x(A,P,E){let $=E;for(let z of A)$=P($,z);return $}i.reduce=x;function*w(A,P,E=A.length){for(P<0&&(P+=A.length),E<0?E+=A.length:E>A.length&&(E=A.length);P<E;P++)yield A[P]}i.slice=w;function k(A,P=Number.POSITIVE_INFINITY){let E=[];if(P===0)return[E,A];let $=A[Symbol.iterator]();for(let z=0;z<P;z++){let I=$.next();if(I.done)return[E,i.empty()];E.push(I.value)}return[E,{[Symbol.iterator](){return $}}]}i.consume=k;async function C(A){let P=[];for await(let E of A)P.push(E);return Promise.resolve(P)}i.asyncToArray=C})(kD||(kD={}));function TD(i){if(kD.is(i)){let e=[];for(let t of i)if(t)try{t.dispose()}catch(s){e.push(s)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(i)?[]:i}else if(i)return i.dispose(),i}function AD(...i){return ji(()=>TD(i))}function ji(i){return{dispose:xie(()=>{i()})}}var MD=class ED{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{TD(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?ED.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(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}deleteAndLeak(e){e&&this._toDispose.has(e)&&(this._toDispose.delete(e),void 0)}};MD.DISABLE_DISPOSED_WARNING=!1;var ph=MD,Cr=class{constructor(){this._store=new ph,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)}};Cr.None=Object.freeze({dispose(){}});var tu=class{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(i){var e;this._isDisposed||i===this._value||((e=this._value)==null||e.dispose(),this._value=i)}clear(){this.value=void 0}dispose(){var i;this._isDisposed=!0,(i=this._value)==null||i.dispose(),this._value=void 0}clearAndLeak(){let i=this._value;return this._value=void 0,i}},tx=typeof process<"u"&&"title"in process,kg=tx?"node":navigator.userAgent,wie=tx?"node":navigator.platform,Cie=kg.includes("Firefox"),kie=kg.includes("Edge"),PD=/^((?!chrome|android).)*safari/i.test(kg);function Tie(){if(!PD)return 0;let i=kg.match(/Version\/(\d+)/);return i===null||i.length<2?0:parseInt(i[1])}wie.indexOf("Linux")>=0;var Aie="",pi=0,mi=0,gi=0,Qt=0,Gs={css:"#00000000",rgba:0},Ki;(i=>{function e(r,n,o,l){return l!==void 0?`#${ba(r)}${ba(n)}${ba(o)}${ba(l)}`:`#${ba(r)}${ba(n)}${ba(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Ki||(Ki={}));var gu;(i=>{function e(c,u){if(Qt=(u.rgba&255)/255,Qt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,m=u.rgba>>16&255,g=u.rgba>>8&255,_=c.rgba>>24&255,y=c.rgba>>16&255,b=c.rgba>>8&255;pi=_+Math.round((d-_)*Qt),mi=y+Math.round((m-y)*Qt),gi=b+Math.round((g-b)*Qt);let x=Ki.toCss(pi,mi,gi),w=Ki.toRgba(pi,mi,gi);return{css:x,rgba:w}}i.blend=e;function t(c){return(c.rgba&255)===255}i.isOpaque=t;function s(c,u,d){let m=Va.ensureContrastRatio(c.rgba,u.rgba,d);if(m)return Ki.toColor(m>>24&255,m>>16&255,m>>8&255)}i.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[pi,mi,gi]=Va.toChannels(u),{css:Ki.toCss(pi,mi,gi),rgba:u}}i.opaque=r;function n(c,u){return Qt=Math.round(u*255),[pi,mi,gi]=Va.toChannels(c.rgba),{css:Ki.toCss(pi,mi,gi,Qt),rgba:Ki.toRgba(pi,mi,gi,Qt)}}i.opacity=n;function o(c,u){return Qt=c.rgba&255,n(c,Qt*u/255)}i.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}i.toColorRGB=l})(gu||(gu={}));var Mie;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return pi=parseInt(r.slice(1,2).repeat(2),16),mi=parseInt(r.slice(2,3).repeat(2),16),gi=parseInt(r.slice(3,4).repeat(2),16),Ki.toColor(pi,mi,gi);case 5:return pi=parseInt(r.slice(1,2).repeat(2),16),mi=parseInt(r.slice(2,3).repeat(2),16),gi=parseInt(r.slice(3,4).repeat(2),16),Qt=parseInt(r.slice(4,5).repeat(2),16),Ki.toColor(pi,mi,gi,Qt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return pi=parseInt(n[1]),mi=parseInt(n[2]),gi=parseInt(n[3]),Qt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Ki.toColor(pi,mi,gi,Qt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[pi,mi,gi,Qt]=e.getImageData(0,0,1,1).data,Qt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Ki.toRgba(pi,mi,gi,Qt),css:r}}i.toColor=s})(Mie||(Mie={}));var Hi;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,l=r/255,c=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+m*.0722}i.relativeLuminance2=t})(Hi||(Hi={}));var Va;(i=>{function e(o,l){if(Qt=(l&255)/255,Qt===1)return l;let c=l>>24&255,u=l>>16&255,d=l>>8&255,m=o>>24&255,g=o>>16&255,_=o>>8&255;return pi=m+Math.round((c-m)*Qt),mi=g+Math.round((u-g)*Qt),gi=_+Math.round((d-_)*Qt),Ki.toRgba(pi,mi,gi)}i.blend=e;function t(o,l,c){let u=Hi.relativeLuminance(o>>8),d=Hi.relativeLuminance(l>>8);if(En(u,d)<c){if(d<u){let _=s(o,l,c),y=En(u,Hi.relativeLuminance(_>>8));if(y<c){let b=r(o,l,c),x=En(u,Hi.relativeLuminance(b>>8));return y>x?_:b}return _}let m=r(o,l,c),g=En(u,Hi.relativeLuminance(m>>8));if(g<c){let _=s(o,l,c),y=En(u,Hi.relativeLuminance(_>>8));return g>y?m:_}return m}}i.ensureContrastRatio=t;function s(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));for(;b<c&&(g>0||_>0||y>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.reduceLuminance=s;function r(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));for(;b<c&&(g<255||_<255||y<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=En(Hi.relativeLuminance2(g,_,y),Hi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(Va||(Va={}));function ba(i){let e=i.toString(16);return e.length<2?"0"+e:e}function En(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}function Wt(i){if(!i)throw new Error("value must not be falsy");return i}function ix(i){return 57508<=i&&i<=57558}function Eie(i){return 57520<=i&&i<=57527}function Pie(i){return 57344<=i&&i<=63743}function Qie(i){return 9472<=i&&i<=9631}function Rie(i){return i>=128512&&i<=128591||i>=127744&&i<=128511||i>=128640&&i<=128767||i>=9728&&i<=9983||i>=9984&&i<=10175||i>=65024&&i<=65039||i>=129280&&i<=129535||i>=127462&&i<=127487}function Lie(i,e,t,s){return e===1&&t>Math.ceil(s*1.5)&&i!==void 0&&i>255&&!Rie(i)&&!ix(i)&&!Pie(i)}function QD(i){return ix(i)||Qie(i)}function $ie(){return{css:{canvas:Qp(),cell:Qp()},device:{canvas:Qp(),cell:Qp(),char:{width:0,height:0,left:0,top:0}}}}function Qp(){return{width:0,height:0}}function Bie(i,e,t=0){return(i-(Math.round(e)*2-t))%(Math.round(e)*2)}var Mi=0,hi=0,Nr=!1,Pn=!1,Rp=!1,fs,zv=0,Die=class{constructor(i,e,t,s,r,n){this._terminal=i,this._optionService=e,this._selectionRenderModel=t,this._decorationService=s,this._coreBrowserService=r,this._themeService=n,this.result={fg:0,bg:0,ext:0}}resolve(i,e,t,s){if(this.result.bg=i.bg,this.result.fg=i.fg,this.result.ext=i.bg&268435456?i.extended.ext:0,hi=0,Mi=0,Pn=!1,Nr=!1,Rp=!1,fs=this._themeService.colors,zv=0,i.getCode()!==0&&i.extended.underlineStyle===4){let r=Math.max(1,Math.floor(this._optionService.rawOptions.fontSize*this._coreBrowserService.dpr/15));zv=e*s%(Math.round(r)*2)}if(this._decorationService.forEachDecorationAtCell(e,t,"bottom",r=>{r.backgroundColorRGB&&(hi=r.backgroundColorRGB.rgba>>8&16777215,Pn=!0),r.foregroundColorRGB&&(Mi=r.foregroundColorRGB.rgba>>8&16777215,Nr=!0)}),Rp=this._selectionRenderModel.isCellSelected(this._terminal,e,t),Rp){if(this.result.fg&67108864||(this.result.bg&50331648)!==0){if(this.result.fg&67108864)switch(this.result.fg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:hi=(this.result.fg&16777215)<<8|255;break;case 0:default:hi=this._themeService.colors.foreground.rgba}else switch(this.result.bg&50331648){case 16777216:case 33554432:hi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:hi=(this.result.bg&16777215)<<8|255;break}hi=Va.blend(hi,(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}else hi=(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;if(Pn=!0,fs.selectionForeground&&(Mi=fs.selectionForeground.rgba>>8&16777215,Nr=!0),QD(i.getCode())){if(this.result.fg&67108864&&(this.result.bg&50331648)===0)Mi=(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba>>8&16777215;else{if(this.result.fg&67108864)switch(this.result.bg&50331648){case 16777216:case 33554432:Mi=this._themeService.colors.ansi[this.result.bg&255].rgba;break;case 50331648:Mi=(this.result.bg&16777215)<<8|255;break}else switch(this.result.fg&50331648){case 16777216:case 33554432:Mi=this._themeService.colors.ansi[this.result.fg&255].rgba;break;case 50331648:Mi=(this.result.fg&16777215)<<8|255;break;case 0:default:Mi=this._themeService.colors.foreground.rgba}Mi=Va.blend(Mi,(this._coreBrowserService.isFocused?fs.selectionBackgroundOpaque:fs.selectionInactiveBackgroundOpaque).rgba&4294967040|128)>>8&16777215}Nr=!0}}this._decorationService.forEachDecorationAtCell(e,t,"top",r=>{r.backgroundColorRGB&&(hi=r.backgroundColorRGB.rgba>>8&16777215,Pn=!0),r.foregroundColorRGB&&(Mi=r.foregroundColorRGB.rgba>>8&16777215,Nr=!0)}),Pn&&(Rp?hi=i.bg&-16777216&-134217729|hi|50331648:hi=i.bg&-16777216|hi|50331648),Nr&&(Mi=i.fg&-16777216&-67108865|Mi|50331648),this.result.fg&67108864&&(Pn&&!Nr&&((this.result.bg&50331648)===0?Mi=this.result.fg&-134217728|fs.background.rgba>>8&16777215&16777215|50331648:Mi=this.result.fg&-134217728|this.result.bg&67108863,Nr=!0),!Pn&&Nr&&((this.result.fg&50331648)===0?hi=this.result.bg&-67108864|fs.foreground.rgba>>8&16777215&16777215|50331648:hi=this.result.bg&-67108864|this.result.fg&67108863,Pn=!0)),fs=void 0,this.result.bg=Pn?hi:this.result.bg,this.result.fg=Nr?Mi:this.result.fg,this.result.ext&=536870911,this.result.ext|=zv<<29&3758096384}},zie=.5,RD=Cie||kie?"bottom":"ideographic",Nie={"▀":[{x:0,y:0,w:8,h:4}],"▁":[{x:0,y:7,w:8,h:1}],"▂":[{x:0,y:6,w:8,h:2}],"▃":[{x:0,y:5,w:8,h:3}],"▄":[{x:0,y:4,w:8,h:4}],"▅":[{x:0,y:3,w:8,h:5}],"▆":[{x:0,y:2,w:8,h:6}],"▇":[{x:0,y:1,w:8,h:7}],"█":[{x:0,y:0,w:8,h:8}],"▉":[{x:0,y:0,w:7,h:8}],"▊":[{x:0,y:0,w:6,h:8}],"▋":[{x:0,y:0,w:5,h:8}],"▌":[{x:0,y:0,w:4,h:8}],"▍":[{x:0,y:0,w:3,h:8}],"▎":[{x:0,y:0,w:2,h:8}],"▏":[{x:0,y:0,w:1,h:8}],"▐":[{x:4,y:0,w:4,h:8}],"▔":[{x:0,y:0,w:8,h:1}],"▕":[{x:7,y:0,w:1,h:8}],"▖":[{x:0,y:4,w:4,h:4}],"▗":[{x:4,y:4,w:4,h:4}],"▘":[{x:0,y:0,w:4,h:4}],"▙":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"▚":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"▛":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"▜":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"▝":[{x:4,y:0,w:4,h:4}],"▞":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"▟":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"🭰":[{x:1,y:0,w:1,h:8}],"🭱":[{x:2,y:0,w:1,h:8}],"🭲":[{x:3,y:0,w:1,h:8}],"🭳":[{x:4,y:0,w:1,h:8}],"🭴":[{x:5,y:0,w:1,h:8}],"🭵":[{x:6,y:0,w:1,h:8}],"🭶":[{x:0,y:1,w:8,h:1}],"🭷":[{x:0,y:2,w:8,h:1}],"🭸":[{x:0,y:3,w:8,h:1}],"🭹":[{x:0,y:4,w:8,h:1}],"🭺":[{x:0,y:5,w:8,h:1}],"🭻":[{x:0,y:6,w:8,h:1}],"🭼":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🭽":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭾":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"🭿":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"🮀":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮁":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"🮂":[{x:0,y:0,w:8,h:2}],"🮃":[{x:0,y:0,w:8,h:3}],"🮄":[{x:0,y:0,w:8,h:5}],"🮅":[{x:0,y:0,w:8,h:6}],"🮆":[{x:0,y:0,w:8,h:7}],"🮇":[{x:6,y:0,w:2,h:8}],"🮈":[{x:5,y:0,w:3,h:8}],"🮉":[{x:3,y:0,w:5,h:8}],"🮊":[{x:2,y:0,w:6,h:8}],"🮋":[{x:1,y:0,w:7,h:8}],"🮕":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"🮖":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"🮗":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]},Xie={"░":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"▒":[[1,0],[0,0],[0,1],[0,0]],"▓":[[0,1],[1,1],[1,0],[1,1]]},Vie={"─":{1:"M0,.5 L1,.5"},"━":{3:"M0,.5 L1,.5"},"│":{1:"M.5,0 L.5,1"},"┃":{3:"M.5,0 L.5,1"},"┌":{1:"M0.5,1 L.5,.5 L1,.5"},"┏":{3:"M0.5,1 L.5,.5 L1,.5"},"┐":{1:"M0,.5 L.5,.5 L.5,1"},"┓":{3:"M0,.5 L.5,.5 L.5,1"},"└":{1:"M.5,0 L.5,.5 L1,.5"},"┗":{3:"M.5,0 L.5,.5 L1,.5"},"┘":{1:"M.5,0 L.5,.5 L0,.5"},"┛":{3:"M.5,0 L.5,.5 L0,.5"},"├":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┣":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"┤":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┫":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"┬":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┳":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"┴":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┻":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"┼":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"╋":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"╴":{1:"M.5,.5 L0,.5"},"╸":{3:"M.5,.5 L0,.5"},"╵":{1:"M.5,.5 L.5,0"},"╹":{3:"M.5,.5 L.5,0"},"╶":{1:"M.5,.5 L1,.5"},"╺":{3:"M.5,.5 L1,.5"},"╷":{1:"M.5,.5 L.5,1"},"╻":{3:"M.5,.5 L.5,1"},"═":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"║":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╒":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╓":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"╔":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╕":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"╖":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"╗":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"╘":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"╙":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╚":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"╛":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"╜":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"╝":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"╞":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"╟":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"╠":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╡":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"╢":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╣":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"╤":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"╥":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"╦":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"╧":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╨":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"╩":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╪":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"╫":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"╬":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"╱":{1:"M1,0 L0,1"},"╲":{1:"M0,0 L1,1"},"╳":{1:"M1,0 L0,1 M0,0 L1,1"},"╼":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"╽":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"╾":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"╿":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┍":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┎":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┑":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"┒":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┕":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"┖":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┙":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"┚":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"┝":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"┞":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"┟":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"┠":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"┡":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"┢":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"┥":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"┦":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"┧":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"┨":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"┩":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"┪":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"┭":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┮":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"┯":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"┰":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"┱":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"┲":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"┵":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┶":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┷":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"┸":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"┹":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"┺":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"┽":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"┾":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"┿":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"╀":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"╁":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"╂":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"╃":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"╄":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"╅":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"╆":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"╇":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"╈":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"╉":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"╊":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"╌":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"╍":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"┄":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┅":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"┈":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"┉":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"╎":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"╏":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"┆":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┇":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"┊":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"┋":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"╭":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"╮":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"╯":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"╰":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},uf={"":{d:"M.3,1 L.03,1 L.03,.88 C.03,.82,.06,.78,.11,.73 C.15,.7,.2,.68,.28,.65 L.43,.6 C.49,.58,.53,.56,.56,.53 C.59,.5,.6,.47,.6,.43 L.6,.27 L.4,.27 L.69,.1 L.98,.27 L.78,.27 L.78,.46 C.78,.52,.76,.56,.72,.61 C.68,.66,.63,.67,.56,.7 L.48,.72 C.42,.74,.38,.76,.35,.78 C.32,.8,.31,.84,.31,.88 L.31,1 M.3,.5 L.03,.59 L.03,.09 L.3,.09 L.3,.655",type:0},"":{d:"M.7,.4 L.7,.47 L.2,.47 L.2,.03 L.355,.03 L.355,.4 L.705,.4 M.7,.5 L.86,.5 L.86,.95 L.69,.95 L.44,.66 L.46,.86 L.46,.95 L.3,.95 L.3,.49 L.46,.49 L.71,.78 L.69,.565 L.69,.5",type:0},"":{d:"M.25,.94 C.16,.94,.11,.92,.11,.87 L.11,.53 C.11,.48,.15,.455,.23,.45 L.23,.3 C.23,.25,.26,.22,.31,.19 C.36,.16,.43,.15,.51,.15 C.59,.15,.66,.16,.71,.19 C.77,.22,.79,.26,.79,.3 L.79,.45 C.87,.45,.91,.48,.91,.53 L.91,.87 C.91,.92,.86,.94,.77,.94 L.24,.94 M.53,.2 C.49,.2,.45,.21,.42,.23 C.39,.25,.38,.27,.38,.3 L.38,.45 L.68,.45 L.68,.3 C.68,.27,.67,.25,.64,.23 C.61,.21,.58,.2,.53,.2 M.58,.82 L.58,.66 C.63,.65,.65,.63,.65,.6 C.65,.58,.64,.57,.61,.56 C.58,.55,.56,.54,.52,.54 C.48,.54,.46,.55,.43,.56 C.4,.57,.39,.59,.39,.6 C.39,.63,.41,.64,.46,.66 L.46,.82 L.57,.82",type:0},"":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"":{d:"M.2,1 C.422,1,.8,.826,.78,.5 C.8,.174,0.422,0,.2,0",type:1,rightPadding:1},"":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"":{d:"M.8,1 C0.578,1,0.2,.826,.22,.5 C0.2,0.174,0.578,0,0.8,0",type:1,leftPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L-.5,1.5",type:0},"":{d:"M-.5,-.5 L1.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M1.5,-.5 L-.5,1.5 L1.5,1.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5 L-.5,-.5",type:0},"":{d:"M1.5,-.5 L-.5,1.5",type:1,leftPadding:1,rightPadding:1},"":{d:"M-.5,-.5 L1.5,1.5 L1.5,-.5",type:0}};uf[""]=uf[""];uf[""]=uf[""];function Zie(i,e,t,s,r,n,o,l){let c=Nie[e];if(c)return jie(i,c,t,s,r,n),!0;let u=Xie[e];if(u)return Iie(i,u,t,s,r,n),!0;let d=Vie[e];if(d)return qie(i,d,t,s,r,n,l),!0;let m=uf[e];return m?(Wie(i,m,t,s,r,n,o,l),!0):!1}function jie(i,e,t,s,r,n){for(let o=0;o<e.length;o++){let l=e[o],c=r/8,u=n/8;i.fillRect(t+l.x*c,s+l.y*u,l.w*c,l.h*u)}}var NE=new Map;function Iie(i,e,t,s,r,n){let o=NE.get(e);o||(o=new Map,NE.set(e,o));let l=i.fillStyle;if(typeof l!="string")throw new Error(`Unexpected fillStyle type "${l}"`);let c=o.get(l);if(!c){let u=e[0].length,d=e.length,m=i.canvas.ownerDocument.createElement("canvas");m.width=u,m.height=d;let g=Wt(m.getContext("2d")),_=new ImageData(u,d),y,b,x,w;if(l.startsWith("#"))y=parseInt(l.slice(1,3),16),b=parseInt(l.slice(3,5),16),x=parseInt(l.slice(5,7),16),w=l.length>7&&parseInt(l.slice(7,9),16)||1;else if(l.startsWith("rgba"))[y,b,x,w]=l.substring(5,l.length-1).split(",").map(k=>parseFloat(k));else throw new Error(`Unexpected fillStyle color format "${l}" when drawing pattern glyph`);for(let k=0;k<d;k++)for(let C=0;C<u;C++)_.data[(k*u+C)*4]=y,_.data[(k*u+C)*4+1]=b,_.data[(k*u+C)*4+2]=x,_.data[(k*u+C)*4+3]=e[k][C]*(w*255);g.putImageData(_,0,0),c=Wt(i.createPattern(m,null)),o.set(l,c)}i.fillStyle=c,i.fillRect(t,s,r,n)}function qie(i,e,t,s,r,n,o){i.strokeStyle=i.fillStyle;for(let[l,c]of Object.entries(e)){i.beginPath(),i.lineWidth=o*Number.parseInt(l);let u;if(typeof c=="function"){let d=.15/n*r;u=c(.15,d)}else u=c;for(let d of u.split(" ")){let m=d[0],g=LD[m];if(!g){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||g(i,$D(_,r,n,t,s,!0,o))}i.stroke(),i.closePath()}}function Wie(i,e,t,s,r,n,o,l){let c=new Path2D;c.rect(t,s,r,n),i.clip(c),i.beginPath();let u=o/12;i.lineWidth=l*u;for(let d of e.d.split(" ")){let m=d[0],g=LD[m];if(!g){console.error(`Could not find drawing instructions for "${m}"`);continue}let _=d.substring(1).split(",");!_[0]||!_[1]||g(i,$D(_,r,n,t,s,!1,l,(e.leftPadding??0)*(u/2),(e.rightPadding??0)*(u/2)))}e.type===1?(i.strokeStyle=i.fillStyle,i.stroke()):i.fill(),i.closePath()}function XE(i,e,t=0){return Math.max(Math.min(i,e),t)}var LD={C:(i,e)=>i.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function $D(i,e,t,s,r,n,o,l=0,c=0){let u=i.map(d=>parseFloat(d)||parseInt(d));if(u.length<2)throw new Error("Too few arguments for instruction");for(let d=0;d<u.length;d+=2)u[d]*=e-l*o-c*o,n&&u[d]!==0&&(u[d]=XE(Math.round(u[d]+.5)-.5,e,0)),u[d]+=s+l*o;for(let d=1;d<u.length;d+=2)u[d]*=t,n&&u[d]!==0&&(u[d]=XE(Math.round(u[d]+.5)-.5,t,0)),u[d]+=r;return u}var VE=class{constructor(){this._data={}}set(i,e,t){this._data[i]||(this._data[i]={}),this._data[i][e]=t}get(i,e){return this._data[i]?this._data[i][e]:void 0}clear(){this._data={}}},ZE=class{constructor(){this._data=new VE}set(i,e,t,s,r){this._data.get(i,e)||this._data.set(i,e,new VE),this._data.get(i,e).set(t,s,r)}get(i,e,t,s){var r;return(r=this._data.get(i,e))==null?void 0:r.get(t,s)}clear(){this._data.clear()}},BD=class{constructor(){this._tasks=[],this._i=0}enqueue(i){this._tasks.push(i),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(i){this._idleCallback=void 0;let e=0,t=0,s=i.timeRemaining(),r=0;for(;this._i<this._tasks.length;){if(e=performance.now(),this._tasks[this._i]()||this._i++,e=Math.max(1,performance.now()-e),t=Math.max(e,t),r=i.timeRemaining(),t*1.5>r){s-e<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(s-e))}ms`),this._start();return}s=r}this.clear()}},Uie=class extends BD{_requestCallback(i){return setTimeout(()=>i(this._createDeadline(16)))}_cancelCallback(i){clearTimeout(i)}_createDeadline(i){let e=performance.now()+i;return{timeRemaining:()=>Math.max(0,e-performance.now())}}},Yie=class extends BD{_requestCallback(i){return requestIdleCallback(i)}_cancelCallback(i){cancelIdleCallback(i)}},Hie=!tx&&"requestIdleCallback"in window?Yie:Uie,sh=class DD{constructor(){this.fg=0,this.bg=0,this.extended=new zD}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let e=new DD;return e.fg=this.fg,e.bg=this.bg,e.extended=this.extended.clone(),e}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}},zD=class ND{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new ND(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Fie=globalThis.performance&&typeof globalThis.performance.now=="function",Gie=class XD{static create(e){return new XD(e)}constructor(e){this._now=Fie&&e===!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}},Nn;(i=>{i.None=()=>Cr.None;function e(R,L){return m(R,()=>{},0,void 0,!0,void 0,L)}i.defer=e;function t(R){return(L,N=null,Z)=>{let Q=!1,X;return X=R(W=>{if(!Q)return X?X.dispose():Q=!0,L.call(N,W)},null,Z),Q&&X.dispose(),X}}i.once=t;function s(R,L,N){return u((Z,Q=null,X)=>R(W=>Z.call(Q,L(W)),null,X),N)}i.map=s;function r(R,L,N){return u((Z,Q=null,X)=>R(W=>{L(W),Z.call(Q,W)},null,X),N)}i.forEach=r;function n(R,L,N){return u((Z,Q=null,X)=>R(W=>L(W)&&Z.call(Q,W),null,X),N)}i.filter=n;function o(R){return R}i.signal=o;function l(...R){return(L,N=null,Z)=>{let Q=AD(...R.map(X=>X(W=>L.call(N,W))));return d(Q,Z)}}i.any=l;function c(R,L,N,Z){let Q=N;return s(R,X=>(Q=L(Q,X),Q),Z)}i.reduce=c;function u(R,L){let N,Z={onWillAddFirstListener(){N=R(Q.fire,Q)},onDidRemoveLastListener(){N==null||N.dispose()}},Q=new yt(Z);return L==null||L.add(Q),Q.event}function d(R,L){return L instanceof Array?L.push(R):L&&L.add(R),R}function m(R,L,N=100,Z=!1,Q=!1,X,W){let U,q,D,G=0,ie,ce={leakWarningThreshold:X,onWillAddFirstListener(){U=R(de=>{G++,q=L(q,de),Z&&!D&&(he.fire(q),q=void 0),ie=()=>{let ge=q;q=void 0,D=void 0,(!Z||G>1)&&he.fire(ge),G=0},typeof N=="number"?(clearTimeout(D),D=setTimeout(ie,N)):D===void 0&&(D=0,queueMicrotask(ie))})},onWillRemoveListener(){Q&&G>0&&(ie==null||ie())},onDidRemoveLastListener(){ie=void 0,U.dispose()}},he=new yt(ce);return W==null||W.add(he),he.event}i.debounce=m;function g(R,L=0,N){return i.debounce(R,(Z,Q)=>Z?(Z.push(Q),Z):[Q],L,void 0,!0,void 0,N)}i.accumulate=g;function _(R,L=(Z,Q)=>Z===Q,N){let Z=!0,Q;return n(R,X=>{let W=Z||!L(X,Q);return Z=!1,Q=X,W},N)}i.latch=_;function y(R,L,N){return[i.filter(R,L,N),i.filter(R,Z=>!L(Z),N)]}i.split=y;function b(R,L=!1,N=[],Z){let Q=N.slice(),X=R(q=>{Q?Q.push(q):U.fire(q)});Z&&Z.add(X);let W=()=>{Q==null||Q.forEach(q=>U.fire(q)),Q=null},U=new yt({onWillAddFirstListener(){X||(X=R(q=>U.fire(q)),Z&&Z.add(X))},onDidAddFirstListener(){Q&&(L?setTimeout(W):W())},onDidRemoveLastListener(){X&&X.dispose(),X=null}});return Z&&Z.add(U),U.event}i.buffer=b;function x(R,L){return(N,Z,Q)=>{let X=L(new k);return R(function(W){let U=X.evaluate(W);U!==w&&N.call(Z,U)},void 0,Q)}}i.chain=x;let w=Symbol("HaltChainable");class k{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(N=>(L(N),N)),this}filter(L){return this.steps.push(N=>L(N)?N:w),this}reduce(L,N){let Z=N;return this.steps.push(Q=>(Z=L(Z,Q),Z)),this}latch(L=(N,Z)=>N===Z){let N=!0,Z;return this.steps.push(Q=>{let X=N||!L(Q,Z);return N=!1,Z=Q,X?Q:w}),this}evaluate(L){for(let N of this.steps)if(L=N(L),L===w)break;return L}}function C(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.on(L,Z),X=()=>R.removeListener(L,Z),W=new yt({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromNodeEventEmitter=C;function A(R,L,N=Z=>Z){let Z=(...U)=>W.fire(N(...U)),Q=()=>R.addEventListener(L,Z),X=()=>R.removeEventListener(L,Z),W=new yt({onWillAddFirstListener:Q,onDidRemoveLastListener:X});return W.event}i.fromDOMEventEmitter=A;function P(R){return new Promise(L=>t(R)(L))}i.toPromise=P;function E(R){let L=new yt;return R.then(N=>{L.fire(N)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}i.fromPromise=E;function $(R,L){return R(N=>L.fire(N))}i.forward=$;function z(R,L,N){return L(N),R(Z=>L(Z))}i.runAndSubscribe=z;class I{constructor(L,N){this._observable=L,this._counter=0,this._hasChanged=!1;let Z={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new yt(Z),N&&N.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,N){this._hasChanged=!0}endUpdate(L){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function se(R,L){return new I(R,L).emitter.event}i.fromObservable=se;function F(R){return(L,N,Z)=>{let Q=0,X=!1,W={beginUpdate(){Q++},endUpdate(){Q--,Q===0&&(R.reportChanges(),X&&(X=!1,L.call(N)))},handlePossibleChange(){},handleChange(){X=!0}};R.addObserver(W),R.reportChanges();let U={dispose(){R.removeObserver(W)}};return Z instanceof ph?Z.add(U):Array.isArray(Z)&&Z.push(U),U}}i.fromObservableLight=F})(Nn||(Nn={}));var ab=class lb{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${lb._idPool++}`,lb.all.add(this)}start(e){this._stopWatch=new Gie,this.listenerCount=e}stop(){if(this._stopWatch){let e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};ab.all=new Set,ab._idPool=0;var Kie=ab,Jie=-1,VD=class ZD{constructor(e,t,s=(ZD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=s,this._warnCountdown=0}dispose(){var e;(e=this._stacks)==null||e.clear()}check(e,t){let s=this.threshold;if(s<=0||t<s)return;this._stacks||(this._stacks=new Map);let r=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,r+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=s*.5;let[n,o]=this.getMostFrequentStack(),l=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${o}):`;console.warn(l),console.warn(n);let c=new ise(l,n);this._errorHandler(c)}return()=>{let n=this._stacks.get(e.value)||0;this._stacks.set(e.value,n-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(let[s,r]of this._stacks)(!e||t<r)&&(e=[s,r],t=r);return e}};VD._idPool=1;var ese=VD,tse=class jD{constructor(e){this.value=e}static create(){let e=new Error;return new jD(e.stack??"")}print(){console.warn(this.value.split(`
|
|
131
138
|
`).slice(2).join(`
|
|
132
|
-
`))}},Pie=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},Qie=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},Rie=0,gv=class{constructor(i){this.value=i,this.id=Rie++}},Lie=2,$ie,yt=class{constructor(e){var t,s,r,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new Mie((e==null?void 0:e.onListenerError)??pv,((s=this._options)==null?void 0:s.leakWarningThreshold)??Aie):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Tie(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||s.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,s)=>{var l,c,u,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new Qie(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||pv)(y),Cr.None}if(this._disposed)return Cr.None;t&&(e=e.bind(t));let r=new gv(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=Eie.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof gv?(this._deliveryQueue??(this._deliveryQueue=new Bie),this._listeners=[this._listeners,r]):this._listeners.push(r):((u=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||u.call(c,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let o=ji(()=>{n==null||n(),this._removeListener(r)});return s instanceof ph?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,c;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*Lie<=t.length){let u=0;for(let d=0;d<t.length;d++)t[d]?t[u++]=t[d]:r&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||pv;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof gv)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},Bie=class{constructor(){this.i=-1,this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},mE={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},tu=2,iu,Po=class Ul{constructor(e,t,s){this._document=e,this._config=t,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new pE,this._cacheMapCombined=new pE,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new sh,this._textureSize=512,this._onAddTextureAtlasCanvas=new yt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new yt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=XD(e,this._config.deviceCellWidth*4+tu*2,this._config.deviceCellHeight+tu*2),this._tmpCtx=Wt(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new wie;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let s=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ul.maxAtlasPages&&this._pages.length>=Math.max(4,Ul.maxAtlasPages)){let t=this._pages.filter(u=>u.canvas.width*2<=(Ul.maxTextureSize||4096)).sort((u,d)=>d.canvas.width!==u.canvas.width?d.canvas.width-u.canvas.width:d.percentageUsed-u.percentageUsed),s=-1,r=0;for(let u=0;u<t.length;u++)if(t[u].canvas.width!==r)s=u,r=t[u].canvas.width;else if(u-s===3)break;let n=t.slice(s,s+4),o=n.map(u=>u.glyphs[0].texturePage).sort((u,d)=>u>d?1:-1),l=this.pages.length-n.length,c=this._mergePages(n,l);c.version++;for(let u=o.length-1;u>=0;u--)this._deletePage(o[u]);this.pages.push(c),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(c.canvas)}let e=new Ov(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let s=e[0].canvas.width*2,r=new Ov(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,c=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,c);for(let d of o.glyphs)d.texturePage=t,d.sizeClipSpace.x=d.size.x/s,d.sizeClipSpace.y=d.size.y/s,d.texturePosition.x+=l,d.texturePosition.y+=c,d.texturePositionClipSpace.x=d.texturePosition.x/s,d.texturePositionClipSpace.y=d.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let u=this._activePages.indexOf(o);u!==-1&&this._activePages.splice(u,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let s=this._pages[t];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(e,t,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,s,r,n,o)}getRasterizedGlyph(e,t,s,r,n,o){return this._getFromCacheMap(this._cacheMap,e,t,s,r,n,o)}_getFromCacheMap(e,t,s,r,n,o,l){return iu=e.get(t,s,r,n),iu||(iu=this._drawToCache(t,s,r,n,o,l),e.set(t,s,r,n,iu)),iu}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,s,r){if(this._config.allowTransparency)return Gs;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(t);break;case 50331648:let o=sh.toColorRGB(t);n=Ki.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=gu.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=gu.opaque(n)),n}_getForegroundColor(e,t,s,r,n,o,l,c,u,d){let m=this._getMinimumContrastColor(e,t,s,r,n,o,l,u,c,d);if(m)return m;let g;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&u&&o<8&&(o+=8),g=this._getColorFromAnsiIndex(o);break;case 50331648:let _=sh.toColorRGB(o);g=Ki.toColor(_[0],_[1],_[2]);break;case 0:default:l?g=this._config.colors.background:g=this._config.colors.foreground}return this._config.allowTransparency&&(g=gu.opaque(g)),c&&(g=gu.multiplyOpacity(g,die)),g}_resolveBackgroundRgba(e,t,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,s,r,n,o,l,c,u,d){if(this._config.minimumContrastRatio===1||d)return;let m=this._getContrastCache(u),g=m.getColor(e,r);if(g!==void 0)return g||void 0;let _=this._resolveBackgroundRgba(t,s,l),y=this._resolveForegroundRgba(n,o,l,c),b=Va.ensureContrastRatio(_,y,this._config.minimumContrastRatio/(u?2:1));if(!b){m.setColor(e,r,null);return}let x=Ki.toColor(b>>24&255,b>>16&255,b>>8&255);return m.setColor(e,r,x),x}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+tu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let u=Math.min(this._config.deviceCellHeight+tu*4,this._textureSize);if(this._tmpCanvas.height<u&&(this._tmpCanvas.height=u),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return mE;let d=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),g=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),w=this._workAttributeData.getFgColor(),k=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(m){let q=w;w=C,C=q;let D=k;k=A,A=D}let P=this._getBackgroundColor(A,C,m,g);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let E=d?this._config.fontWeightBold:this._config.fontWeight,$=_?"italic":"";this._tmpCtx.font=`${$} ${E} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=MD;let z=l.length===1&&tx(l.charCodeAt(0)),I=l.length===1&&nie(l.charCodeAt(0)),se=this._getForegroundColor(t,A,C,s,k,w,m,g,d,AD(l.charCodeAt(0)));this._tmpCtx.fillStyle=se.css;let F=I?0:tu*2,R=!1;this._config.customGlyphs!==!1&&(R=Oie(this._tmpCtx,l,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let L=!z,N;if(typeof e=="number"?N=this._unicodeService.wcwidth(e):N=this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=q%2===1?.5:0;if(this._tmpCtx.lineWidth=q,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())L=!1,this._tmpCtx.strokeStyle=`rgb(${sh.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{L=!1;let ge=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ge<8&&(ge+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ge).css}this._tmpCtx.beginPath();let G=F,ie=Math.ceil(F+this._config.deviceCharHeight)-D-(n?q*2:0),ce=ie+q,he=ie+q*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let ge=0;ge<N;ge++){this._tmpCtx.save();let Ae=G+ge*this._config.deviceCellWidth,ye=G+(ge+1)*this._config.deviceCellWidth,mt=Ae+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie),this._tmpCtx.moveTo(Ae,he),this._tmpCtx.lineTo(ye,he);break;case 3:let Ft=q<=1?he:Math.ceil(F+this._config.deviceCharHeight-q/2)-D,Gt=q<=1?ie:Math.ceil(F+this._config.deviceCharHeight+q/2)-D,oi=new Path2D;oi.rect(Ae,ie,this._config.deviceCellWidth,he-ie),this._tmpCtx.clip(oi),this._tmpCtx.moveTo(Ae-this._config.deviceCellWidth/2,ce),this._tmpCtx.bezierCurveTo(Ae-this._config.deviceCellWidth/2,Gt,Ae,Gt,Ae,ce),this._tmpCtx.bezierCurveTo(Ae,Ft,mt,Ft,mt,ce),this._tmpCtx.bezierCurveTo(mt,Gt,ye,Gt,ye,ce),this._tmpCtx.bezierCurveTo(ye,Ft,ye+this._config.deviceCellWidth/2,Ft,ye+this._config.deviceCellWidth/2,ce);break;case 4:let Pe=de===0?0:de>=q?q*2-de:q-de;de>=q||Pe===0?(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae+Pe,ie),this._tmpCtx.lineTo(ye,ie)):(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(Ae+Pe,ie),this._tmpCtx.moveTo(Ae+Pe+q,ie),this._tmpCtx.lineTo(ye,ie)),de=uie(ye-Ae,q,de);break;case 5:let ln=.6,Xh=.3,Vh=ye-Ae,Zh=Math.floor(ln*Vh),el=Math.floor(Xh*Vh),jh=Vh-Zh-el;this._tmpCtx.setLineDash([Zh,el,jh]),this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie);break;case 1:default:this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!R&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ge=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ge&&ge.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ae=new Path2D;Ae.rect(G,ie-Math.ceil(q/2),this._config.deviceCellWidth*N,he-ie+Math.ceil(q/2)),this._tmpCtx.clip(Ae),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(l,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=q%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*N,F+D),this._tmpCtx.stroke()}if(R||this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let q=_v(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),P,se,L);if(q)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight-D),q=_v(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),P,se,L),!!q);D++);}if(b){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*N,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let Z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),Q;if(this._config.allowTransparency?Q=Die(Z):Q=_v(Z,P,se,L),Q)return mE;let X=this._findGlyphBoundingBox(Z,this._workBoundingBox,c,I,R,F),W,U;for(;;){if(this._activePages.length===0){let q=this._createNewPage();W=q,U=q.currentRow,U.height=X.size.y;break}W=this._activePages[this._activePages.length-1],U=W.currentRow;for(let q of this._activePages)X.size.y<=q.currentRow.height&&(W=q,U=q.currentRow);for(let q=this._activePages.length-1;q>=0;q--)for(let D of this._activePages[q].fixedRows)D.height<=U.height&&X.size.y<=D.height&&(W=this._activePages[q],U=D);if(X.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Ov(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),W=this._overflowSizePage,U=this._overflowSizePage.currentRow,U.x+X.size.x>=W.canvas.width&&(U.x=0,U.y+=U.height,U.height=0);break}if(U.y+X.size.y>=W.canvas.height||U.height>X.size.y+2){let q=!1;if(W.currentRow.y+W.currentRow.height+X.size.y>=W.canvas.height){let D;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+X.size.y<G.canvas.height){D=G;break}if(D)W=D;else if(Ul.maxAtlasPages&&this._pages.length>=Ul.maxAtlasPages&&U.y+X.size.y<=W.canvas.height&&U.height>=X.size.y&&U.x+X.size.x<=W.canvas.width)q=!0;else{let G=this._createNewPage();W=G,U=G.currentRow,U.height=X.size.y,q=!0}}q||(W.currentRow.height>0&&W.fixedRows.push(W.currentRow),U={x:0,y:W.currentRow.y+W.currentRow.height,height:X.size.y},W.fixedRows.push(U),W.currentRow={x:0,y:U.y+U.height,height:0})}if(U.x+X.size.x<=W.canvas.width)break;U===W.currentRow?(U.x=0,U.y+=U.height,U.height=0):W.fixedRows.splice(W.fixedRows.indexOf(U),1)}return X.texturePage=this._pages.indexOf(W),X.texturePosition.x=U.x,X.texturePosition.y=U.y,X.texturePositionClipSpace.x=U.x/W.canvas.width,X.texturePositionClipSpace.y=U.y/W.canvas.height,X.sizeClipSpace.x/=W.canvas.width,X.sizeClipSpace.y/=W.canvas.height,U.height=Math.max(U.height,X.size.y),U.x+=X.size.x,W.ctx.putImageData(Z,X.texturePosition.x-this._workBoundingBox.left,X.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,X.size.x,X.size.y),W.addGlyph(X),W.version++,X}_findGlyphBoundingBox(e,t,s,r,n,o){t.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,c=r?this._config.deviceCellWidth:s,u=!1;for(let d=0;d<l;d++){for(let m=0;m<c;m++){let g=d*this._tmpCanvas.width*4+m*4+3;if(e.data[g]!==0){t.top=d,u=!0;break}}if(u)break}t.left=0,u=!1;for(let d=0;d<o+c;d++){for(let m=0;m<l;m++){let g=m*this._tmpCanvas.width*4+d*4+3;if(e.data[g]!==0){t.left=d,u=!0;break}}if(u)break}t.right=c,u=!1;for(let d=o+c-1;d>=o;d--){for(let m=0;m<l;m++){let g=m*this._tmpCanvas.width*4+d*4+3;if(e.data[g]!==0){t.right=d,u=!0;break}}if(u)break}t.bottom=l,u=!1;for(let d=l-1;d>=0;d--){for(let m=0;m<c;m++){let g=d*this._tmpCanvas.width*4+m*4+3;if(e.data[g]!==0){t.bottom=d,u=!0;break}}if(u)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Ov=class{constructor(i,e,t){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],t)for(let s of t)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=XD(i,e,e),this.ctx=Wt(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(i){this._glyphs.push(i),this._usedPixels+=i.size.x*i.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function _v(i,e,t,s){let r=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=t.rgba>>>24,c=t.rgba>>>16&255,u=t.rgba>>>8&255,d=Math.floor((Math.abs(r-l)+Math.abs(n-c)+Math.abs(o-u))/12),m=!0;for(let g=0;g<i.data.length;g+=4)i.data[g]===r&&i.data[g+1]===n&&i.data[g+2]===o||s&&Math.abs(i.data[g]-r)+Math.abs(i.data[g+1]-n)+Math.abs(i.data[g+2]-o)<d?i.data[g+3]=0:m=!1;return m}function Die(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function XD(i,e,t){let s=i.createElement("canvas");return s.width=e,s.height=t,s}function zie(i,e,t,s,r,n,o,l){let c={foreground:n.foreground,background:n.background,cursor:Gs,cursorAccent:Gs,selectionForeground:Gs,selectionBackgroundTransparent:Gs,selectionBackgroundOpaque:Gs,selectionInactiveBackgroundTransparent:Gs,selectionInactiveBackgroundOpaque:Gs,overviewRulerBorder:Gs,scrollbarSliderBackground:Gs,scrollbarSliderHoverBackground:Gs,scrollbarSliderActiveBackground:Gs,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:c}}function gE(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function Nie(i){return(i&50331648)===16777216||(i&50331648)===33554432}var er=[];function VD(i,e,t,s,r,n,o,l,c){let u=zie(s,r,n,o,e,t,l,c);for(let g=0;g<er.length;g++){let _=er[g],y=_.ownedBy.indexOf(i);if(y>=0){if(gE(_.config,u))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),er.splice(g,1)):_.ownedBy.splice(y,1);break}}for(let g=0;g<er.length;g++){let _=er[g];if(gE(_.config,u))return _.ownedBy.push(i),_.atlas}let d=i._core,m={atlas:new Po(document,u,d.unicodeService),config:u,ownedBy:[i]};return er.push(m),m.atlas}function OE(i){for(let e=0;e<er.length;e++){let t=er[e].ownedBy.indexOf(i);if(t!==-1){er[e].ownedBy.length===1?(er[e].atlas.dispose(),er.splice(e,1)):er[e].ownedBy.splice(t,1);break}}}var Rp=600,Xie=class{constructor(i,e){this._renderCallback=i,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(i=Rp){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=Rp-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=Rp-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Rp)},i)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function _E(i,e,t){let s=new e.ResizeObserver(r=>{let n=r.find(c=>c.target===i);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null||s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&t(o,l)});try{s.observe(i,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return ji(()=>s==null?void 0:s.disconnect())}function Vie(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var vE=class ZD extends sh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new LD,this.combinedData=""}static fromCharData(e){let t=new ZD;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Vie(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},jD=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function ID(i,e,t){let s=Wt(i.createProgram());if(i.attachShader(s,Wt(yE(i,i.VERTEX_SHADER,e))),i.attachShader(s,Wt(yE(i,i.FRAGMENT_SHADER,t))),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS))return s;console.error(i.getProgramInfoLog(s)),i.deleteProgram(s)}function yE(i,e,t){let s=Wt(i.createShader(e));if(i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS))return s;console.error(i.getShaderInfoLog(s)),i.deleteShader(s)}function Zie(i,e){let t=Math.min(i.length*2,e),s=new Float32Array(t);for(let r=0;r<i.length;r++)s[r]=i[r];return s}var jie=class{constructor(i){this.texture=i,this.version=-1}},Iie=`#version 300 es
|
|
139
|
+
`))}},ise=class extends Error{constructor(i,e){super(i),this.name="ListenerLeakError",this.stack=e}},sse=class extends Error{constructor(i,e){super(i),this.name="ListenerRefusalError",this.stack=e}},rse=0,Nv=class{constructor(i){this.value=i,this.id=rse++}},nse=2,ose,yt=class{constructor(e){var t,s,r,n;this._size=0,this._options=e,this._leakageMon=(t=this._options)!=null&&t.leakWarningThreshold?new ese((e==null?void 0:e.onListenerError)??Dv,((s=this._options)==null?void 0:s.leakWarningThreshold)??Jie):void 0,this._perfMon=(r=this._options)!=null&&r._profName?new Kie(this._options._profName):void 0,this._deliveryQueue=(n=this._options)==null?void 0:n.deliveryQueue}dispose(){var e,t,s,r;this._disposed||(this._disposed=!0,((e=this._deliveryQueue)==null?void 0:e.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(s=(t=this._options)==null?void 0:t.onDidRemoveLastListener)==null||s.call(t),(r=this._leakageMon)==null||r.dispose())}get event(){return this._event??(this._event=(e,t,s)=>{var l,c,u,d,m;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let g=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(g);let _=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],y=new sse(`${g}. HINT: Stack shows most frequent listener (${_[1]}-times)`,_[0]);return(((l=this._options)==null?void 0:l.onListenerError)||Dv)(y),Cr.None}if(this._disposed)return Cr.None;t&&(e=e.bind(t));let r=new Nv(e),n;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=tse.create(),n=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof Nv?(this._deliveryQueue??(this._deliveryQueue=new ase),this._listeners=[this._listeners,r]):this._listeners.push(r):((u=(c=this._options)==null?void 0:c.onWillAddFirstListener)==null||u.call(c,this),this._listeners=r,(m=(d=this._options)==null?void 0:d.onDidAddFirstListener)==null||m.call(d,this)),this._size++;let o=ji(()=>{n==null||n(),this._removeListener(r)});return s instanceof ph?s.add(o):Array.isArray(s)&&s.push(o),o}),this._event}_removeListener(e){var n,o,l,c;if((o=(n=this._options)==null?void 0:n.onWillRemoveListener)==null||o.call(n,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(c=(l=this._options)==null?void 0:l.onDidRemoveLastListener)==null||c.call(l,this),this._size=0;return}let t=this._listeners,s=t.indexOf(e);if(s===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[s]=void 0;let r=this._deliveryQueue.current===this;if(this._size*nse<=t.length){let u=0;for(let d=0;d<t.length;d++)t[d]?t[u++]=t[d]:r&&(this._deliveryQueue.end--,u<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=u}}_deliver(e,t){var r;if(!e)return;let s=((r=this._options)==null?void 0:r.onListenerError)||Dv;if(!s){e.value(t);return}try{e.value(t)}catch(n){s(n)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){var t,s,r,n;if((t=this._deliveryQueue)!=null&&t.current&&(this._deliverQueue(this._deliveryQueue),(s=this._perfMon)==null||s.stop()),(r=this._perfMon)==null||r.start(this._size),this._listeners)if(this._listeners instanceof Nv)this._deliver(this._listeners,e);else{let o=this._deliveryQueue;o.enqueue(this,e,this._listeners.length),this._deliverQueue(o)}(n=this._perfMon)==null||n.stop()}hasListeners(){return this._size>0}},ase=class{constructor(){this.i=-1,this.end=0}enqueue(i,e,t){this.i=0,this.end=t,this.current=i,this.value=e}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},jE={texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},offset:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},iu=2,su,Po=class Ul{constructor(e,t,s){this._document=e,this._config=t,this._unicodeService=s,this._didWarmUp=!1,this._cacheMap=new ZE,this._cacheMapCombined=new ZE,this._pages=[],this._activePages=[],this._workBoundingBox={top:0,left:0,bottom:0,right:0},this._workAttributeData=new sh,this._textureSize=512,this._onAddTextureAtlasCanvas=new yt,this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=new yt,this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._requestClearModel=!1,this._createNewPage(),this._tmpCanvas=ID(e,this._config.deviceCellWidth*4+iu*2,this._config.deviceCellHeight+iu*2),this._tmpCtx=Wt(this._tmpCanvas.getContext("2d",{alpha:this._config.allowTransparency,willReadFrequently:!0}))}get pages(){return this._pages}dispose(){this._tmpCanvas.remove();for(let e of this.pages)e.canvas.remove();this._onAddTextureAtlasCanvas.dispose()}warmUp(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)}_doWarmUp(){let e=new Hie;for(let t=33;t<126;t++)e.enqueue(()=>{if(!this._cacheMap.get(t,0,0,0)){let s=this._drawToCache(t,0,0,0,!1,void 0);this._cacheMap.set(t,0,0,0,s)}})}beginFrame(){return this._requestClearModel}clearTexture(){if(!(this._pages[0].currentRow.x===0&&this._pages[0].currentRow.y===0)){for(let e of this._pages)e.clear();this._cacheMap.clear(),this._cacheMapCombined.clear(),this._didWarmUp=!1}}_createNewPage(){if(Ul.maxAtlasPages&&this._pages.length>=Math.max(4,Ul.maxAtlasPages)){let t=this._pages.filter(u=>u.canvas.width*2<=(Ul.maxTextureSize||4096)).sort((u,d)=>d.canvas.width!==u.canvas.width?d.canvas.width-u.canvas.width:d.percentageUsed-u.percentageUsed),s=-1,r=0;for(let u=0;u<t.length;u++)if(t[u].canvas.width!==r)s=u,r=t[u].canvas.width;else if(u-s===3)break;let n=t.slice(s,s+4),o=n.map(u=>u.glyphs[0].texturePage).sort((u,d)=>u>d?1:-1),l=this.pages.length-n.length,c=this._mergePages(n,l);c.version++;for(let u=o.length-1;u>=0;u--)this._deletePage(o[u]);this.pages.push(c),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(c.canvas)}let e=new Xv(this._document,this._textureSize);return this._pages.push(e),this._activePages.push(e),this._onAddTextureAtlasCanvas.fire(e.canvas),e}_mergePages(e,t){let s=e[0].canvas.width*2,r=new Xv(this._document,s,e);for(let[n,o]of e.entries()){let l=n*o.canvas.width%s,c=Math.floor(n/2)*o.canvas.height;r.ctx.drawImage(o.canvas,l,c);for(let d of o.glyphs)d.texturePage=t,d.sizeClipSpace.x=d.size.x/s,d.sizeClipSpace.y=d.size.y/s,d.texturePosition.x+=l,d.texturePosition.y+=c,d.texturePositionClipSpace.x=d.texturePosition.x/s,d.texturePositionClipSpace.y=d.texturePosition.y/s;this._onRemoveTextureAtlasCanvas.fire(o.canvas);let u=this._activePages.indexOf(o);u!==-1&&this._activePages.splice(u,1)}return r}_deletePage(e){this._pages.splice(e,1);for(let t=e;t<this._pages.length;t++){let s=this._pages[t];for(let r of s.glyphs)r.texturePage--;s.version++}}getRasterizedGlyphCombinedChar(e,t,s,r,n,o){return this._getFromCacheMap(this._cacheMapCombined,e,t,s,r,n,o)}getRasterizedGlyph(e,t,s,r,n,o){return this._getFromCacheMap(this._cacheMap,e,t,s,r,n,o)}_getFromCacheMap(e,t,s,r,n,o,l){return su=e.get(t,s,r,n),su||(su=this._drawToCache(t,s,r,n,o,l),e.set(t,s,r,n,su)),su}_getColorFromAnsiIndex(e){if(e>=this._config.colors.ansi.length)throw new Error("No color found for idx "+e);return this._config.colors.ansi[e]}_getBackgroundColor(e,t,s,r){if(this._config.allowTransparency)return Gs;let n;switch(e){case 16777216:case 33554432:n=this._getColorFromAnsiIndex(t);break;case 50331648:let o=sh.toColorRGB(t);n=Ki.toColor(o[0],o[1],o[2]);break;case 0:default:s?n=gu.opaque(this._config.colors.foreground):n=this._config.colors.background;break}return this._config.allowTransparency||(n=gu.opaque(n)),n}_getForegroundColor(e,t,s,r,n,o,l,c,u,d){let m=this._getMinimumContrastColor(e,t,s,r,n,o,l,u,c,d);if(m)return m;let g;switch(n){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&u&&o<8&&(o+=8),g=this._getColorFromAnsiIndex(o);break;case 50331648:let _=sh.toColorRGB(o);g=Ki.toColor(_[0],_[1],_[2]);break;case 0:default:l?g=this._config.colors.background:g=this._config.colors.foreground}return this._config.allowTransparency&&(g=gu.opaque(g)),c&&(g=gu.multiplyOpacity(g,zie)),g}_resolveBackgroundRgba(e,t,s){switch(e){case 16777216:case 33554432:return this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(e,t,s,r){switch(e){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._getColorFromAnsiIndex(t).rgba;case 50331648:return t<<8;case 0:default:return s?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(e,t,s,r,n,o,l,c,u,d){if(this._config.minimumContrastRatio===1||d)return;let m=this._getContrastCache(u),g=m.getColor(e,r);if(g!==void 0)return g||void 0;let _=this._resolveBackgroundRgba(t,s,l),y=this._resolveForegroundRgba(n,o,l,c),b=Va.ensureContrastRatio(_,y,this._config.minimumContrastRatio/(u?2:1));if(!b){m.setColor(e,r,null);return}let x=Ki.toColor(b>>24&255,b>>16&255,b>>8&255);return m.setColor(e,r,x),x}_getContrastCache(e){return e?this._config.colors.halfContrastCache:this._config.colors.contrastCache}_drawToCache(e,t,s,r,n,o){let l=typeof e=="number"?String.fromCharCode(e):e;o&&this._tmpCanvas.parentElement!==o&&(this._tmpCanvas.style.display="none",o.append(this._tmpCanvas));let c=Math.min(this._config.deviceCellWidth*Math.max(l.length,2)+iu*2,this._config.deviceMaxTextureSize);this._tmpCanvas.width<c&&(this._tmpCanvas.width=c);let u=Math.min(this._config.deviceCellHeight+iu*4,this._textureSize);if(this._tmpCanvas.height<u&&(this._tmpCanvas.height=u),this._tmpCtx.save(),this._workAttributeData.fg=s,this._workAttributeData.bg=t,this._workAttributeData.extended.ext=r,!!this._workAttributeData.isInvisible())return jE;let d=!!this._workAttributeData.isBold(),m=!!this._workAttributeData.isInverse(),g=!!this._workAttributeData.isDim(),_=!!this._workAttributeData.isItalic(),y=!!this._workAttributeData.isUnderline(),b=!!this._workAttributeData.isStrikethrough(),x=!!this._workAttributeData.isOverline(),w=this._workAttributeData.getFgColor(),k=this._workAttributeData.getFgColorMode(),C=this._workAttributeData.getBgColor(),A=this._workAttributeData.getBgColorMode();if(m){let q=w;w=C,C=q;let D=k;k=A,A=D}let P=this._getBackgroundColor(A,C,m,g);this._tmpCtx.globalCompositeOperation="copy",this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.globalCompositeOperation="source-over";let E=d?this._config.fontWeightBold:this._config.fontWeight,$=_?"italic":"";this._tmpCtx.font=`${$} ${E} ${this._config.fontSize*this._config.devicePixelRatio}px ${this._config.fontFamily}`,this._tmpCtx.textBaseline=RD;let z=l.length===1&&ix(l.charCodeAt(0)),I=l.length===1&&Eie(l.charCodeAt(0)),se=this._getForegroundColor(t,A,C,s,k,w,m,g,d,QD(l.charCodeAt(0)));this._tmpCtx.fillStyle=se.css;let F=I?0:iu*2,R=!1;this._config.customGlyphs!==!1&&(R=Zie(this._tmpCtx,l,F,F,this._config.deviceCellWidth,this._config.deviceCellHeight,this._config.fontSize,this._config.devicePixelRatio));let L=!z,N;if(typeof e=="number"?N=this._unicodeService.wcwidth(e):N=this._unicodeService.getStringCellWidth(e),y){this._tmpCtx.save();let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=q%2===1?.5:0;if(this._tmpCtx.lineWidth=q,this._workAttributeData.isUnderlineColorDefault())this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle;else if(this._workAttributeData.isUnderlineColorRGB())L=!1,this._tmpCtx.strokeStyle=`rgb(${sh.toColorRGB(this._workAttributeData.getUnderlineColor()).join(",")})`;else{L=!1;let ge=this._workAttributeData.getUnderlineColor();this._config.drawBoldTextInBrightColors&&this._workAttributeData.isBold()&&ge<8&&(ge+=8),this._tmpCtx.strokeStyle=this._getColorFromAnsiIndex(ge).css}this._tmpCtx.beginPath();let G=F,ie=Math.ceil(F+this._config.deviceCharHeight)-D-(n?q*2:0),ce=ie+q,he=ie+q*2,de=this._workAttributeData.getUnderlineVariantOffset();for(let ge=0;ge<N;ge++){this._tmpCtx.save();let Ae=G+ge*this._config.deviceCellWidth,ye=G+(ge+1)*this._config.deviceCellWidth,mt=Ae+this._config.deviceCellWidth/2;switch(this._workAttributeData.extended.underlineStyle){case 2:this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie),this._tmpCtx.moveTo(Ae,he),this._tmpCtx.lineTo(ye,he);break;case 3:let Ft=q<=1?he:Math.ceil(F+this._config.deviceCharHeight-q/2)-D,Gt=q<=1?ie:Math.ceil(F+this._config.deviceCharHeight+q/2)-D,oi=new Path2D;oi.rect(Ae,ie,this._config.deviceCellWidth,he-ie),this._tmpCtx.clip(oi),this._tmpCtx.moveTo(Ae-this._config.deviceCellWidth/2,ce),this._tmpCtx.bezierCurveTo(Ae-this._config.deviceCellWidth/2,Gt,Ae,Gt,Ae,ce),this._tmpCtx.bezierCurveTo(Ae,Ft,mt,Ft,mt,ce),this._tmpCtx.bezierCurveTo(mt,Gt,ye,Gt,ye,ce),this._tmpCtx.bezierCurveTo(ye,Ft,ye+this._config.deviceCellWidth/2,Ft,ye+this._config.deviceCellWidth/2,ce);break;case 4:let Pe=de===0?0:de>=q?q*2-de:q-de;de>=q||Pe===0?(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae+Pe,ie),this._tmpCtx.lineTo(ye,ie)):(this._tmpCtx.setLineDash([Math.round(q),Math.round(q)]),this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(Ae+Pe,ie),this._tmpCtx.moveTo(Ae+Pe+q,ie),this._tmpCtx.lineTo(ye,ie)),de=Bie(ye-Ae,q,de);break;case 5:let ln=.6,Xh=.3,Vh=ye-Ae,Zh=Math.floor(ln*Vh),el=Math.floor(Xh*Vh),jh=Vh-Zh-el;this._tmpCtx.setLineDash([Zh,el,jh]),this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie);break;case 1:default:this._tmpCtx.moveTo(Ae,ie),this._tmpCtx.lineTo(ye,ie);break}this._tmpCtx.stroke(),this._tmpCtx.restore()}if(this._tmpCtx.restore(),!R&&this._config.fontSize>=12&&!this._config.allowTransparency&&l!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";let ge=this._tmpCtx.measureText(l);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in ge&&ge.actualBoundingBoxDescent>0){this._tmpCtx.save();let Ae=new Path2D;Ae.rect(G,ie-Math.ceil(q/2),this._config.deviceCellWidth*N,he-ie+Math.ceil(q/2)),this._tmpCtx.clip(Ae),this._tmpCtx.lineWidth=this._config.devicePixelRatio*3,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(l,F,F+this._config.deviceCharHeight),this._tmpCtx.restore()}}}if(x){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/15)),D=q%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*N,F+D),this._tmpCtx.stroke()}if(R||this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight),l==="_"&&!this._config.allowTransparency){let q=Vv(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),P,se,L);if(q)for(let D=1;D<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(l,F,F+this._config.deviceCharHeight-D),q=Vv(this._tmpCtx.getImageData(F,F,this._config.deviceCellWidth,this._config.deviceCellHeight),P,se,L),!!q);D++);}if(b){let q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),D=this._tmpCtx.lineWidth%2===1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(F,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.lineTo(F+this._config.deviceCharWidth*N,F+Math.floor(this._config.deviceCharHeight/2)-D),this._tmpCtx.stroke()}this._tmpCtx.restore();let Z=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height),Q;if(this._config.allowTransparency?Q=lse(Z):Q=Vv(Z,P,se,L),Q)return jE;let X=this._findGlyphBoundingBox(Z,this._workBoundingBox,c,I,R,F),W,U;for(;;){if(this._activePages.length===0){let q=this._createNewPage();W=q,U=q.currentRow,U.height=X.size.y;break}W=this._activePages[this._activePages.length-1],U=W.currentRow;for(let q of this._activePages)X.size.y<=q.currentRow.height&&(W=q,U=q.currentRow);for(let q=this._activePages.length-1;q>=0;q--)for(let D of this._activePages[q].fixedRows)D.height<=U.height&&X.size.y<=D.height&&(W=this._activePages[q],U=D);if(X.size.x>this._textureSize){this._overflowSizePage||(this._overflowSizePage=new Xv(this._document,this._config.deviceMaxTextureSize),this.pages.push(this._overflowSizePage),this._requestClearModel=!0,this._onAddTextureAtlasCanvas.fire(this._overflowSizePage.canvas)),W=this._overflowSizePage,U=this._overflowSizePage.currentRow,U.x+X.size.x>=W.canvas.width&&(U.x=0,U.y+=U.height,U.height=0);break}if(U.y+X.size.y>=W.canvas.height||U.height>X.size.y+2){let q=!1;if(W.currentRow.y+W.currentRow.height+X.size.y>=W.canvas.height){let D;for(let G of this._activePages)if(G.currentRow.y+G.currentRow.height+X.size.y<G.canvas.height){D=G;break}if(D)W=D;else if(Ul.maxAtlasPages&&this._pages.length>=Ul.maxAtlasPages&&U.y+X.size.y<=W.canvas.height&&U.height>=X.size.y&&U.x+X.size.x<=W.canvas.width)q=!0;else{let G=this._createNewPage();W=G,U=G.currentRow,U.height=X.size.y,q=!0}}q||(W.currentRow.height>0&&W.fixedRows.push(W.currentRow),U={x:0,y:W.currentRow.y+W.currentRow.height,height:X.size.y},W.fixedRows.push(U),W.currentRow={x:0,y:U.y+U.height,height:0})}if(U.x+X.size.x<=W.canvas.width)break;U===W.currentRow?(U.x=0,U.y+=U.height,U.height=0):W.fixedRows.splice(W.fixedRows.indexOf(U),1)}return X.texturePage=this._pages.indexOf(W),X.texturePosition.x=U.x,X.texturePosition.y=U.y,X.texturePositionClipSpace.x=U.x/W.canvas.width,X.texturePositionClipSpace.y=U.y/W.canvas.height,X.sizeClipSpace.x/=W.canvas.width,X.sizeClipSpace.y/=W.canvas.height,U.height=Math.max(U.height,X.size.y),U.x+=X.size.x,W.ctx.putImageData(Z,X.texturePosition.x-this._workBoundingBox.left,X.texturePosition.y-this._workBoundingBox.top,this._workBoundingBox.left,this._workBoundingBox.top,X.size.x,X.size.y),W.addGlyph(X),W.version++,X}_findGlyphBoundingBox(e,t,s,r,n,o){t.top=0;let l=r?this._config.deviceCellHeight:this._tmpCanvas.height,c=r?this._config.deviceCellWidth:s,u=!1;for(let d=0;d<l;d++){for(let m=0;m<c;m++){let g=d*this._tmpCanvas.width*4+m*4+3;if(e.data[g]!==0){t.top=d,u=!0;break}}if(u)break}t.left=0,u=!1;for(let d=0;d<o+c;d++){for(let m=0;m<l;m++){let g=m*this._tmpCanvas.width*4+d*4+3;if(e.data[g]!==0){t.left=d,u=!0;break}}if(u)break}t.right=c,u=!1;for(let d=o+c-1;d>=o;d--){for(let m=0;m<l;m++){let g=m*this._tmpCanvas.width*4+d*4+3;if(e.data[g]!==0){t.right=d,u=!0;break}}if(u)break}t.bottom=l,u=!1;for(let d=l-1;d>=0;d--){for(let m=0;m<c;m++){let g=d*this._tmpCanvas.width*4+m*4+3;if(e.data[g]!==0){t.bottom=d,u=!0;break}}if(u)break}return{texturePage:0,texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:t.right-t.left+1,y:t.bottom-t.top+1},sizeClipSpace:{x:t.right-t.left+1,y:t.bottom-t.top+1},offset:{x:-t.left+o+(r||n?Math.floor((this._config.deviceCellWidth-this._config.deviceCharWidth)/2):0),y:-t.top+o+(r||n?this._config.lineHeight===1?0:Math.round((this._config.deviceCellHeight-this._config.deviceCharHeight)/2):0)}}}},Xv=class{constructor(i,e,t){if(this._usedPixels=0,this._glyphs=[],this.version=0,this.currentRow={x:0,y:0,height:0},this.fixedRows=[],t)for(let s of t)this._glyphs.push(...s.glyphs),this._usedPixels+=s._usedPixels;this.canvas=ID(i,e,e),this.ctx=Wt(this.canvas.getContext("2d",{alpha:!0}))}get percentageUsed(){return this._usedPixels/(this.canvas.width*this.canvas.height)}get glyphs(){return this._glyphs}addGlyph(i){this._glyphs.push(i),this._usedPixels+=i.size.x*i.size.y}clear(){this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height),this.currentRow.x=0,this.currentRow.y=0,this.currentRow.height=0,this.fixedRows.length=0,this.version++}};function Vv(i,e,t,s){let r=e.rgba>>>24,n=e.rgba>>>16&255,o=e.rgba>>>8&255,l=t.rgba>>>24,c=t.rgba>>>16&255,u=t.rgba>>>8&255,d=Math.floor((Math.abs(r-l)+Math.abs(n-c)+Math.abs(o-u))/12),m=!0;for(let g=0;g<i.data.length;g+=4)i.data[g]===r&&i.data[g+1]===n&&i.data[g+2]===o||s&&Math.abs(i.data[g]-r)+Math.abs(i.data[g+1]-n)+Math.abs(i.data[g+2]-o)<d?i.data[g+3]=0:m=!1;return m}function lse(i){for(let e=0;e<i.data.length;e+=4)if(i.data[e+3]>0)return!1;return!0}function ID(i,e,t){let s=i.createElement("canvas");return s.width=e,s.height=t,s}function hse(i,e,t,s,r,n,o,l){let c={foreground:n.foreground,background:n.background,cursor:Gs,cursorAccent:Gs,selectionForeground:Gs,selectionBackgroundTransparent:Gs,selectionBackgroundOpaque:Gs,selectionInactiveBackgroundTransparent:Gs,selectionInactiveBackgroundOpaque:Gs,overviewRulerBorder:Gs,scrollbarSliderBackground:Gs,scrollbarSliderHoverBackground:Gs,scrollbarSliderActiveBackground:Gs,ansi:n.ansi.slice(),contrastCache:n.contrastCache,halfContrastCache:n.halfContrastCache};return{customGlyphs:r.customGlyphs,devicePixelRatio:o,deviceMaxTextureSize:l,letterSpacing:r.letterSpacing,lineHeight:r.lineHeight,deviceCellWidth:i,deviceCellHeight:e,deviceCharWidth:t,deviceCharHeight:s,fontFamily:r.fontFamily,fontSize:r.fontSize,fontWeight:r.fontWeight,fontWeightBold:r.fontWeightBold,allowTransparency:r.allowTransparency,drawBoldTextInBrightColors:r.drawBoldTextInBrightColors,minimumContrastRatio:r.minimumContrastRatio,colors:c}}function IE(i,e){for(let t=0;t<i.colors.ansi.length;t++)if(i.colors.ansi[t].rgba!==e.colors.ansi[t].rgba)return!1;return i.devicePixelRatio===e.devicePixelRatio&&i.customGlyphs===e.customGlyphs&&i.lineHeight===e.lineHeight&&i.letterSpacing===e.letterSpacing&&i.fontFamily===e.fontFamily&&i.fontSize===e.fontSize&&i.fontWeight===e.fontWeight&&i.fontWeightBold===e.fontWeightBold&&i.allowTransparency===e.allowTransparency&&i.deviceCharWidth===e.deviceCharWidth&&i.deviceCharHeight===e.deviceCharHeight&&i.drawBoldTextInBrightColors===e.drawBoldTextInBrightColors&&i.minimumContrastRatio===e.minimumContrastRatio&&i.colors.foreground.rgba===e.colors.foreground.rgba&&i.colors.background.rgba===e.colors.background.rgba}function cse(i){return(i&50331648)===16777216||(i&50331648)===33554432}var er=[];function qD(i,e,t,s,r,n,o,l,c){let u=hse(s,r,n,o,e,t,l,c);for(let g=0;g<er.length;g++){let _=er[g],y=_.ownedBy.indexOf(i);if(y>=0){if(IE(_.config,u))return _.atlas;_.ownedBy.length===1?(_.atlas.dispose(),er.splice(g,1)):_.ownedBy.splice(y,1);break}}for(let g=0;g<er.length;g++){let _=er[g];if(IE(_.config,u))return _.ownedBy.push(i),_.atlas}let d=i._core,m={atlas:new Po(document,u,d.unicodeService),config:u,ownedBy:[i]};return er.push(m),m.atlas}function qE(i){for(let e=0;e<er.length;e++){let t=er[e].ownedBy.indexOf(i);if(t!==-1){er[e].ownedBy.length===1?(er[e].atlas.dispose(),er.splice(e,1)):er[e].ownedBy.splice(t,1);break}}}var Lp=600,use=class{constructor(i,e){this._renderCallback=i,this._coreBrowserService=e,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(i=Lp){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){let e=Lp-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,e>0){this._restartInterval(e);return}}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){let e=Lp-(Date.now()-this._animationTimeRestarted);this._animationTimeRestarted=void 0,this._restartInterval(e);return}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},Lp)},i)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()}};function WE(i,e,t){let s=new e.ResizeObserver(r=>{let n=r.find(c=>c.target===i);if(!n)return;if(!("devicePixelContentBoxSize"in n)){s==null||s.disconnect(),s=void 0;return}let o=n.devicePixelContentBoxSize[0].inlineSize,l=n.devicePixelContentBoxSize[0].blockSize;o>0&&l>0&&t(o,l)});try{s.observe(i,{box:["device-pixel-content-box"]})}catch{s.disconnect(),s=void 0}return ji(()=>s==null?void 0:s.disconnect())}function fse(i){return i>65535?(i-=65536,String.fromCharCode((i>>10)+55296)+String.fromCharCode(i%1024+56320)):String.fromCharCode(i)}var UE=class WD extends sh{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new zD,this.combinedData=""}static fromCharData(e){let t=new WD;return t.setFromCharData(e),t}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fse(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let s=e[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},UD=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]);function YD(i,e,t){let s=Wt(i.createProgram());if(i.attachShader(s,Wt(YE(i,i.VERTEX_SHADER,e))),i.attachShader(s,Wt(YE(i,i.FRAGMENT_SHADER,t))),i.linkProgram(s),i.getProgramParameter(s,i.LINK_STATUS))return s;console.error(i.getProgramInfoLog(s)),i.deleteProgram(s)}function YE(i,e,t){let s=Wt(i.createShader(e));if(i.shaderSource(s,t),i.compileShader(s),i.getShaderParameter(s,i.COMPILE_STATUS))return s;console.error(i.getShaderInfoLog(s)),i.deleteShader(s)}function dse(i,e){let t=Math.min(i.length*2,e),s=new Float32Array(t);for(let r=0;r<i.length;r++)s[r]=i[r];return s}var pse=class{constructor(i){this.texture=i,this.version=-1}},mse=`#version 300 es
|
|
133
140
|
layout (location = 0) in vec2 a_unitquad;
|
|
134
141
|
layout (location = 1) in vec2 a_cellpos;
|
|
135
142
|
layout (location = 2) in vec2 a_offset;
|
|
@@ -149,7 +156,7 @@ void main() {
|
|
|
149
156
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
150
157
|
v_texpage = int(a_texpage);
|
|
151
158
|
v_texcoord = a_texcoord + a_unitquad * a_texsize;
|
|
152
|
-
}`;function
|
|
159
|
+
}`;function gse(i){let e="";for(let t=1;t<i;t++)e+=` else if (v_texpage == ${t}) { outColor = texture(u_texture[${t}], v_texcoord); }`;return`#version 300 es
|
|
153
160
|
precision lowp float;
|
|
154
161
|
|
|
155
162
|
in vec2 v_texcoord;
|
|
@@ -163,7 +170,7 @@ void main() {
|
|
|
163
170
|
if (v_texpage == 0) {
|
|
164
171
|
outColor = texture(u_texture[0], v_texcoord);
|
|
165
172
|
} ${e}
|
|
166
|
-
}`}var Qo=11,
|
|
173
|
+
}`}var Qo=11,Zl=Qo*Float32Array.BYTES_PER_ELEMENT,Ose=2,Mt=0,_t,Zv=0,ru=0,_se=class extends Cr{constructor(i,e,t,s){super(),this._terminal=i,this._gl=e,this._dimensions=t,this._optionsService=s,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};let r=this._gl;Po.maxAtlasPages===void 0&&(Po.maxAtlasPages=Math.min(32,Wt(r.getParameter(r.MAX_TEXTURE_IMAGE_UNITS))),Po.maxTextureSize=Wt(r.getParameter(r.MAX_TEXTURE_SIZE))),this._program=Wt(YD(r,mse,gse(Po.maxAtlasPages))),this._register(ji(()=>r.deleteProgram(this._program))),this._projectionLocation=Wt(r.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=Wt(r.getUniformLocation(this._program,"u_resolution")),this._textureLocation=Wt(r.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(ji(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),c=r.createBuffer();this._register(ji(()=>r.deleteBuffer(c))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,c),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=Wt(r.createBuffer()),this._register(ji(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,2,r.FLOAT,!1,Zl,0),r.vertexAttribDivisor(2,1),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,r.FLOAT,!1,Zl,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(3,1),r.enableVertexAttribArray(4),r.vertexAttribPointer(4,1,r.FLOAT,!1,Zl,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(4,1),r.enableVertexAttribArray(5),r.vertexAttribPointer(5,2,r.FLOAT,!1,Zl,5*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(5,1),r.enableVertexAttribArray(6),r.vertexAttribPointer(6,2,r.FLOAT,!1,Zl,7*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(6,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Zl,9*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.useProgram(this._program);let u=new Int32Array(Po.maxAtlasPages);for(let d=0;d<Po.maxAtlasPages;d++)u[d]=d;r.uniform1iv(this._textureLocation,u),r.uniformMatrix4fv(this._projectionLocation,!1,UD),this._atlasTextures=[];for(let d=0;d<Po.maxAtlasPages;d++){let m=new pse(Wt(r.createTexture()));this._register(ji(()=>r.deleteTexture(m.texture))),r.activeTexture(r.TEXTURE0+d),r.bindTexture(r.TEXTURE_2D,m.texture),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,1,1,0,r.RGBA,r.UNSIGNED_BYTE,new Uint8Array([255,0,0,255])),this._atlasTextures[d]=m}r.enable(r.BLEND),r.blendFunc(r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA),this.handleResize()}beginFrame(){return this._atlas?this._atlas.beginFrame():!0}updateCell(i,e,t,s,r,n,o,l,c){this._updateCell(this._vertices.attributes,i,e,t,s,r,n,o,l,c)}_updateCell(i,e,t,s,r,n,o,l,c,u){if(Mt=(t*this._terminal.cols+e)*Qo,s===0||s===void 0){i.fill(0,Mt,Mt+Qo-1-Ose);return}this._atlas&&(l&&l.length>1?_t=this._atlas.getRasterizedGlyphCombinedChar(l,r,n,o,!1,this._terminal.element):_t=this._atlas.getRasterizedGlyph(s,r,n,o,!1,this._terminal.element),Zv=Math.floor((this._dimensions.device.cell.width-this._dimensions.device.char.width)/2),r!==u&&_t.offset.x>Zv?(ru=_t.offset.x-Zv,i[Mt]=-(_t.offset.x-ru)+this._dimensions.device.char.left,i[Mt+1]=-_t.offset.y+this._dimensions.device.char.top,i[Mt+2]=(_t.size.x-ru)/this._dimensions.device.canvas.width,i[Mt+3]=_t.size.y/this._dimensions.device.canvas.height,i[Mt+4]=_t.texturePage,i[Mt+5]=_t.texturePositionClipSpace.x+ru/this._atlas.pages[_t.texturePage].canvas.width,i[Mt+6]=_t.texturePositionClipSpace.y,i[Mt+7]=_t.sizeClipSpace.x-ru/this._atlas.pages[_t.texturePage].canvas.width,i[Mt+8]=_t.sizeClipSpace.y):(i[Mt]=-_t.offset.x+this._dimensions.device.char.left,i[Mt+1]=-_t.offset.y+this._dimensions.device.char.top,i[Mt+2]=_t.size.x/this._dimensions.device.canvas.width,i[Mt+3]=_t.size.y/this._dimensions.device.canvas.height,i[Mt+4]=_t.texturePage,i[Mt+5]=_t.texturePositionClipSpace.x,i[Mt+6]=_t.texturePositionClipSpace.y,i[Mt+7]=_t.sizeClipSpace.x,i[Mt+8]=_t.sizeClipSpace.y),this._optionsService.rawOptions.rescaleOverlappingGlyphs&&Lie(s,c,_t.size.x,this._dimensions.device.cell.width)&&(i[Mt+2]=(this._dimensions.device.cell.width-1)/this._dimensions.device.canvas.width))}clear(){let i=this._terminal,e=i.cols*i.rows*Qo;this._vertices.count!==e?this._vertices.attributes=new Float32Array(e):this._vertices.attributes.fill(0);let t=0;for(;t<this._vertices.attributesBuffers.length;t++)this._vertices.count!==e?this._vertices.attributesBuffers[t]=new Float32Array(e):this._vertices.attributesBuffers[t].fill(0);this._vertices.count=e,t=0;for(let s=0;s<i.rows;s++)for(let r=0;r<i.cols;r++)this._vertices.attributes[t+9]=r/i.cols,this._vertices.attributes[t+10]=s/i.rows,t+=Qo}handleResize(){let i=this._gl;i.useProgram(this._program),i.viewport(0,0,i.canvas.width,i.canvas.height),i.uniform2f(this._resolutionLocation,i.canvas.width,i.canvas.height),this.clear()}render(i){if(!this._atlas)return;let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),this._activeBuffer=(this._activeBuffer+1)%2;let t=this._vertices.attributesBuffers[this._activeBuffer],s=0;for(let r=0;r<i.lineLengths.length;r++){let n=r*this._terminal.cols*Qo,o=this._vertices.attributes.subarray(n,n+i.lineLengths[r]*Qo);t.set(o,s),s+=o.length}e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,t.subarray(0,s),e.STREAM_DRAW);for(let r=0;r<this._atlas.pages.length;r++)this._atlas.pages[r].version!==this._atlasTextures[r].version&&this._bindAtlasPageTexture(e,this._atlas,r);e.drawElementsInstanced(e.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,s/Qo)}setAtlas(i){this._atlas=i;for(let e of this._atlasTextures)e.version=-1}_bindAtlasPageTexture(i,e,t){i.activeTexture(i.TEXTURE0+t),i.bindTexture(i.TEXTURE_2D,this._atlasTextures[t].texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,e.pages[t].canvas),i.generateMipmap(i.TEXTURE_2D),this._atlasTextures[t].version=e.pages[t].version}setDimensions(i){this._dimensions=i}},vse=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(i,e,t,s=!1){if(this.selectionStart=e,this.selectionEnd=t,!e||!t||e[0]===t[0]&&e[1]===t[1]){this.clear();return}let r=i.buffers.active.ydisp,n=e[1]-r,o=t[1]-r,l=Math.max(n,0),c=Math.min(o,i.rows-1);if(l>=i.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=s,this.viewportStartRow=n,this.viewportEndRow=o,this.viewportCappedStartRow=l,this.viewportCappedEndRow=c,this.startCol=e[0],this.endCol=t[0]}isCellSelected(i,e,t){return this.hasSelection?(t-=i.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?e>=this.startCol&&t>=this.viewportCappedStartRow&&e<this.endCol&&t<=this.viewportCappedEndRow:e<this.startCol&&t>=this.viewportCappedStartRow&&e>=this.endCol&&t<=this.viewportCappedEndRow:t>this.viewportStartRow&&t<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&t===this.viewportStartRow&&e>=this.startCol&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&t===this.viewportEndRow&&e<this.endCol||this.viewportStartRow<this.viewportEndRow&&t===this.viewportStartRow&&e>=this.startCol):!1}};function yse(){return new vse}var sg=4,om=1,am=2,jv=3,bse=2147483648,Sse=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection=yse()}resize(i,e){let t=i*e*sg;t!==this.cells.length&&(this.cells=new Uint32Array(t),this.lineLengths=new Uint32Array(e))}clear(){this.cells.fill(0,0),this.lineLengths.fill(0,0)}},xse=`#version 300 es
|
|
167
174
|
layout (location = 0) in vec2 a_position;
|
|
168
175
|
layout (location = 1) in vec2 a_size;
|
|
169
176
|
layout (location = 2) in vec4 a_color;
|
|
@@ -177,7 +184,7 @@ void main() {
|
|
|
177
184
|
vec2 zeroToOne = a_position + (a_unitquad * a_size);
|
|
178
185
|
gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0);
|
|
179
186
|
v_color = a_color;
|
|
180
|
-
}`,
|
|
187
|
+
}`,wse=`#version 300 es
|
|
181
188
|
precision lowp float;
|
|
182
189
|
|
|
183
190
|
in vec4 v_color;
|
|
@@ -186,7 +193,7 @@ out vec4 outColor;
|
|
|
186
193
|
|
|
187
194
|
void main() {
|
|
188
195
|
outColor = v_color;
|
|
189
|
-
}`,$n=8,bv=$n*Float32Array.BYTES_PER_ELEMENT,ese=20*$n,bE=class{constructor(){this.attributes=new Float32Array(ese),this.count=0}},Qn=0,SE=0,xE=0,wE=0,CE=0,kE=0,TE=0,tse=class extends Cr{constructor(i,e,t,s){super(),this._terminal=i,this._gl=e,this._dimensions=t,this._themeService=s,this._vertices=new bE,this._verticesCursor=new bE;let r=this._gl;this._program=Wt(ID(r,Kie,Jie)),this._register(ji(()=>r.deleteProgram(this._program))),this._projectionLocation=Wt(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(ji(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),c=r.createBuffer();this._register(ji(()=>r.deleteBuffer(c))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,c),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=Wt(r.createBuffer()),this._register(ji(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,bv,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,bv,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,bv,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(u=>{this._updateCachedColors(u),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(i){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,jD),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,i.count)}handleResize(){this._updateViewportRectangle()}setDimensions(i){this._dimensions=i}_updateCachedColors(i){this._bgFloat=this._colorToFloat32Array(i.background),this._cursorFloat=this._colorToFloat32Array(i.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(i){let e=this._terminal,t=this._vertices,s=1,r,n,o,l,c,u,d,m,g,_,y;for(r=0;r<e.rows;r++){for(o=-1,l=0,c=0,u=!1,n=0;n<e.cols;n++)d=(r*e.cols+n)*sg,m=i.cells[d+om],g=i.cells[d+am],_=!!(g&67108864),(m!==l||g!==c&&(u||_))&&((l!==0||u&&c!==0)&&(y=s++*$n,this._updateRectangle(t,y,c,l,o,n,r)),o=n,l=m,c=g,u=_);(l!==0||u&&c!==0)&&(y=s++*$n,this._updateRectangle(t,y,c,l,o,e.cols,r))}t.count=s}updateCursor(i){let e=this._verticesCursor,t=i.cursor;if(!t||t.style==="block"){e.count=0;return}let s,r=0;(t.style==="bar"||t.style==="outline")&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.style==="bar"?t.dpr*t.cursorWidth:t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(t.style==="underline"||t.style==="outline")&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,(t.y+1)*this._dimensions.device.cell.height-t.dpr,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat)),t.style==="outline"&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat),s=r++*$n,this._addRectangleFloat(e.attributes,s,(t.x+t.width)*this._dimensions.device.cell.width-t.dpr,t.y*this._dimensions.device.cell.height,t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=r}_updateRectangle(i,e,t,s,r,n,o){if(t&67108864)switch(t&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[t&255].rgba;break;case 50331648:Qn=(t&16777215)<<8;break;case 0:default:Qn=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Qn=(s&16777215)<<8;break;case 0:default:Qn=this._themeService.colors.background.rgba}i.attributes.length<e+4&&(i.attributes=Zie(i.attributes,this._terminal.rows*this._terminal.cols*$n)),SE=r*this._dimensions.device.cell.width,xE=o*this._dimensions.device.cell.height,wE=(Qn>>24&255)/255,CE=(Qn>>16&255)/255,kE=(Qn>>8&255)/255,TE=1,this._addRectangle(i.attributes,e,SE,xE,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,wE,CE,kE,TE)}_addRectangle(i,e,t,s,r,n,o,l,c,u){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=s/this._dimensions.device.canvas.height,i[e+2]=r/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o,i[e+5]=l,i[e+6]=c,i[e+7]=u}_addRectangleFloat(i,e,t,s,r,n,o){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=s/this._dimensions.device.canvas.height,i[e+2]=r/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o[0],i[e+5]=o[1],i[e+6]=o[2],i[e+7]=o[3]}_colorToFloat32Array(i){return new Float32Array([(i.rgba>>24&255)/255,(i.rgba>>16&255)/255,(i.rgba>>8&255)/255,(i.rgba&255)/255])}},ise=class extends Cr{constructor(i,e,t,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${t}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(c=>{this._refreshCharAtlas(i,c),this.reset(i)})),this._register(ji(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Wt(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(i){}handleFocus(i){}handleCursorMove(i){}handleGridChanged(i,e,t){}handleSelectionChanged(i,e,t,s=!1){}_setTransparency(i,e){if(e===this._alpha)return;let t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(i,this._themeService.colors),this.handleGridChanged(i,0,i.rows-1)}_refreshCharAtlas(i,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=VD(i,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(i,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(i,this._themeService.colors)}_fillBottomLineAtCells(i,e,t=1){this._ctx.fillRect(i*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,t*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(i,e,t,s){this._alpha?this._ctx.clearRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(i,e,t,s){this._ctx.font=this._getFont(i,!1,!1),this._ctx.textBaseline=MD,this._clipCell(t,s,e.getWidth()),this._ctx.fillText(e.getChars(),t*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(i,e,t){this._ctx.beginPath(),this._ctx.rect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(i,e,t){let s=e?i.options.fontWeightBold:i.options.fontWeight;return`${t?"italic":""} ${s} ${i.options.fontSize*this._coreBrowserService.dpr}px ${i.options.fontFamily}`}},sse=class extends ise{constructor(i,e,t,s,r,n,o){super(t,i,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(i,e){super.resize(i,e),this._state=void 0}reset(i){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let i=this._state.y2-this._state.y1-1;i>0&&this._clearCells(0,this._state.y1+1,this._state.cols,i),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(i){if(i.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:i.fg!==void 0&&Nie(i.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[i.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,i.y1===i.y2)this._fillBottomLineAtCells(i.x1,i.y1,i.x2-i.x1);else{this._fillBottomLineAtCells(i.x1,i.y1,i.cols-i.x1);for(let e=i.y1+1;e<i.y2;e++)this._fillBottomLineAtCells(0,e,i.cols);this._fillBottomLineAtCells(0,i.y2,i.x2)}this._state=i}_handleHideLinkUnderline(i){this._clearCurrentLink()}},Da=typeof window=="object"?window:globalThis,hb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new yt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new yt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};hb.INSTANCE=new hb;var qD=hb;function rse(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}qD.INSTANCE.onDidChangeZoomLevel;qD.INSTANCE.onDidChangeFullscreen;var Nh=typeof navigator=="object"?navigator.userAgent:"";Nh.indexOf("Firefox")>=0;Nh.indexOf("AppleWebKit")>=0;var nse=Nh.indexOf("Chrome")>=0;!nse&&Nh.indexOf("Safari")>=0;Nh.indexOf("Electron/")>=0;Nh.indexOf("Android")>=0;var Sv=!1;if(typeof Da.matchMedia=="function"){let i=Da.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Da.matchMedia("(display-mode: fullscreen)");Sv=i.matches,rse(Da,i,({matches:t})=>{Sv&&e.matches||(Sv=t)})}var rh="en",xv=!1,WD=!1,Lp,lm=rh,AE=rh,ose,Or,Za=globalThis,Li,mP;typeof Za.vscode<"u"&&typeof Za.vscode.process<"u"?Li=Za.vscode.process:typeof process<"u"&&typeof((mP=process==null?void 0:process.versions)==null?void 0:mP.node)=="string"&&(Li=process);var gP,ase=typeof((gP=Li==null?void 0:Li.versions)==null?void 0:gP.electron)=="string",lse=ase&&(Li==null?void 0:Li.type)==="renderer",OP;if(typeof Li=="object"){Li.platform,Li.platform,xv=Li.platform==="linux",xv&&Li.env.SNAP&&Li.env.SNAP_REVISION,Li.env.CI||Li.env.BUILD_ARTIFACTSTAGINGDIRECTORY,Lp=rh,lm=rh;let i=Li.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);Lp=e.userLocale,AE=e.osLocale,lm=e.resolvedLanguage||rh,ose=(OP=e.languagePack)==null?void 0:OP.translationsConfigFile}catch{}WD=!0}else typeof navigator=="object"&&!lse?(Or=navigator.userAgent,Or.indexOf("Windows")>=0,Or.indexOf("Macintosh")>=0,(Or.indexOf("Macintosh")>=0||Or.indexOf("iPad")>=0||Or.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,xv=Or.indexOf("Linux")>=0,(Or==null?void 0:Or.indexOf("Mobi"))>=0,lm=globalThis._VSCODE_NLS_LANGUAGE||rh,Lp=navigator.language.toLowerCase(),AE=Lp):console.error("Unable to resolve platform.");var ME=WD,rn=Or,To=lm,hse;(i=>{function e(){return To}i.value=e;function t(){return To.length===2?To==="en":To.length>=3?To[0]==="e"&&To[1]==="n"&&To[2]==="-":!1}i.isDefaultVariant=t;function s(){return To==="en"}i.isDefault=s})(hse||(hse={}));var cse=typeof Za.postMessage=="function"&&!Za.importScripts;(()=>{if(cse){let i=[];Za.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s<r;s++){let n=i[s];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(s,1),n.callback();return}}});let e=0;return t=>{let s=++e;i.push({id:s,callback:t}),Za.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var use=!!(rn&&rn.indexOf("Chrome")>=0);rn&&rn.indexOf("Firefox")>=0;!use&&rn&&rn.indexOf("Safari")>=0;rn&&rn.indexOf("Edg/")>=0;rn&&rn.indexOf("Android")>=0;var Zl=typeof navigator=="object"?navigator:{};ME||document.queryCommandSupported&&document.queryCommandSupported("copy")||Zl&&Zl.clipboard&&Zl.clipboard.writeText,ME||Zl&&Zl.clipboard&&Zl.clipboard.readText;var ix=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},wv=new ix,EE=new ix,PE=new ix;new Array(230);var fse;(i=>{function e(l){return wv.keyCodeToStr(l)}i.toString=e;function t(l){return wv.strToKeyCode(l)}i.fromString=t;function s(l){return EE.keyCodeToStr(l)}i.toUserSettingsUS=s;function r(l){return PE.keyCodeToStr(l)}i.toUserSettingsGeneral=r;function n(l){return EE.strToKeyCode(l)||PE.strToKeyCode(l)}i.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return wv.keyCodeToStr(l)}i.toElectronAccelerator=o})(fse||(fse={}));var UD=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),dse;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof pse?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nn.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:UD})})(dse||(dse={}));var pse=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?UD:(this._emitter||(this._emitter=new yt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},mse;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(mse||(mse={}));var QE=class Ks{static fromArray(e){return new Ks(t=>{t.emitMany(e)})}static fromPromise(e){return new Ks(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Ks(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Ks(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new yt,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Nn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var t;return(t=this._onReturn)==null||t.call(this),{done:!0,value:void 0}}}}static map(e,t){return new Ks(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Ks.map(this,e)}static filter(e,t){return new Ks(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Ks.filter(this,e)}static coalesce(e){return Ks.filter(e,t=>!!t)}coalesce(){return Ks.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Ks.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};QE.EMPTY=QE.fromArray([]);var{getWindow:gse}=(function(){let i=new Map,e={window:Da,disposables:new ph};i.set(Da.vscodeWindowId,e);let t=new yt,s=new yt,r=new yt;function n(o,l){return(typeof o=="number"?i.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Cr.None;let l=new ph,c={window:o,disposables:l.add(new ph)};return i.set(o.vscodeWindowId,c),l.add(ji(()=>{i.delete(o.vscodeWindowId),s.fire(o)})),l.add(cb(o,_se.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(c),l},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:Da},getDocument(o){return gse(o).document}}})(),Ose=class{constructor(i,e,t,s){this._node=i,this._type=e,this._handler=t,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function cb(i,e,t,s){return new Ose(i,e,t,s)}var _se={BEFORE_UNLOAD:"beforeunload"},vse=class extends Cr{constructor(i,e,t,s,r,n,o,l,c){super(),this._terminal=i,this._characterJoinerService=e,this._charSizeService=t,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new eu,this._charAtlasDisposable=this._register(new eu),this._observerDisposable=this._register(new eu),this._model=new Gie,this._workCell=new vE,this._workCell2=new vE,this._rectangleRenderer=this._register(new eu),this._glyphRenderer=this._register(new eu),this._onChangeTextureAtlas=this._register(new yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new yt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new yt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let u={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext("webgl2",u),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new fie(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new sse(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=cie(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(cb(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(cb(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,OE(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=_E(this._canvas,this._coreBrowserService.window,(d,m)=>this._setCanvasDevicePixelDimensions(d,m)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=_E(this._canvas,d,(m,g)=>this._setCanvasDevicePixelDimensions(m,g))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ji(()=>{var d;for(let m of this._renderLayers)m.dispose();(d=this._canvas.parentElement)==null||d.removeChild(this._canvas),OE(this._terminal)}))}get textureAtlas(){var i;return(i=this._charAtlas)==null?void 0:i.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(i,e){var t,s,r,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(t=this._rectangleRenderer.value)==null||t.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(r=this._glyphRenderer.value)==null||r.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var i;for(let e of this._renderLayers)e.handleBlur(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.pause(),this._requestRedrawViewport()}handleFocus(){var i;for(let e of this._renderLayers)e.handleFocus(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.resume(),this._requestRedrawViewport()}handleSelectionChanged(i,e,t){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,i,e,t);this._model.selection.update(this._core,i,e,t),this._requestRedrawViewport()}handleCursorMove(){var i;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new tse(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new Uie(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let i=VD(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==i&&(this._onChangeTextureAtlas.fire(i.pages[0].canvas),this._charAtlasDisposable.value=wD(Nn.forward(i.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Nn.forward(i.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=i,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(i){var e;this._model.clear(),i&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var i;(i=this._charAtlas)==null||i.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var i;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(i,e){var t;if(!this._isAttached)if((t=this._core.screenElement)!=null&&t.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,i,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(i,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Xie(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(i,e){let t=this._core,s=this._workCell,r,n,o,l,c,u,d=0,m=!0,g,_,y,b,x,w,k,C,A;i=RE(i,t.rows-1,0),e=RE(e,t.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??t.options.cursorStyle??"block",E=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,$=E-t.buffer.ydisp,z=Math.min(this._terminal.buffer.active.cursorX,t.cols-1),I=-1,se=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(n=i;n<=e;n++)for(o=n+t.buffer.ydisp,l=t.buffer.lines.get(o),this._model.lineLengths[n]=0,y=E===o,d=0,c=this._characterJoinerService.getJoinedCharacters(o),C=0;C<t.cols;C++){if(r=this._cellColorResolver.result.bg,l.loadCell(C,s),C===0&&(r=this._cellColorResolver.result.bg),u=!1,m=C>=d,g=C,c.length>0&&C===c[0][0]&&m){_=c.shift();let R=this._model.selection.isCellSelected(this._terminal,_[0],o);for(k=_[0]+1;k<_[1];k++)m&&(m=R===this._model.selection.isCellSelected(this._terminal,k,o));m&&(m=!y||z<_[0]||z>=_[1]),m?(u=!0,s=new yse(s,l.translateToString(!0,_[0],_[1]),_[1]-_[0]),g=_[1]-1):d=_[1]}if(b=s.getChars(),x=s.getCode(),k=(n*t.cols+C)*sg,this._cellColorResolver.resolve(s,C,o,this.dimensions.device.cell.width),se&&o===E&&(C===z&&(this._model.cursor={x:z,y:$,width:s.getWidth(),style:this._coreBrowserService.isFocused?P:t.options.cursorInactiveStyle,cursorWidth:t.options.cursorWidth,dpr:this._devicePixelRatio},I=z+s.getWidth()-1),C>=z&&C<=I&&(this._coreBrowserService.isFocused&&P==="block"||this._coreBrowserService.isFocused===!1&&t.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),x!==0&&(this._model.lineLengths[n]=C+1),!(this._model.cells[k]===x&&this._model.cells[k+om]===this._cellColorResolver.result.bg&&this._model.cells[k+am]===this._cellColorResolver.result.fg&&this._model.cells[k+yv]===this._cellColorResolver.result.ext)&&(F=!0,b.length>1&&(x|=Fie),this._model.cells[k]=x,this._model.cells[k+om]=this._cellColorResolver.result.bg,this._model.cells[k+am]=this._cellColorResolver.result.fg,this._model.cells[k+yv]=this._cellColorResolver.result.ext,w=s.getWidth(),this._glyphRenderer.value.updateCell(C,n,x,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,b,w,r),u)){for(s=this._workCell,C++;C<=g;C++)A=(n*t.cols+C)*sg,this._glyphRenderer.value.updateCell(C,n,0,0,0,0,sie,0,0),this._model.cells[A]=0,this._model.cells[A+om]=this._cellColorResolver.result.bg,this._model.cells[A+am]=this._cellColorResolver.result.fg,this._model.cells[A+yv]=this._cellColorResolver.result.ext;C--}}F&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(i,e){this._canvas.width===i&&this._canvas.height===e||(this._canvas.width=i,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let i=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:i,end:i})}},yse=class extends sh{constructor(i,e,t){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=e,this._width=t}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function RE(i,e,t=0){return Math.max(Math.min(i,e),t)}var LE="di$target",$E="di$dependencies",Cv=new Map;function an(i){if(Cv.has(i))return Cv.get(i);let e=function(t,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");bse(e,t,r)};return e._id=i,Cv.set(i,e),e}function bse(i,e,t){e[LE]===e?e[$E].push({id:i,index:t}):(e[$E]=[{id:i,index:t}],e[LE]=e)}an("BufferService");an("CoreMouseService");an("CoreService");an("CharsetService");an("InstantiationService");an("LogService");var Sse=an("OptionsService");an("OscLinkService");an("UnicodeService");an("DecorationService");var xse={trace:0,debug:1,info:2,warn:3,error:4,off:5},wse="xterm.js: ",BE=class extends Cr{constructor(i){super(),this._optionsService=i,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=xse[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let e=0;e<i.length;e++)typeof i[e]=="function"&&(i[e]=i[e]())}_log(i,e,t){this._evalLazyOptionalParams(t),i.call(console,(this._optionsService.options.logger?"":wse)+e,...t)}trace(i,...e){var t;this._logLevel<=0&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.trace.bind(this._optionsService.options.logger))??console.log,i,e)}debug(i,...e){var t;this._logLevel<=1&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.debug.bind(this._optionsService.options.logger))??console.log,i,e)}info(i,...e){var t;this._logLevel<=2&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.info.bind(this._optionsService.options.logger))??console.info,i,e)}warn(i,...e){var t;this._logLevel<=3&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.warn.bind(this._optionsService.options.logger))??console.warn,i,e)}error(i,...e){var t;this._logLevel<=4&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.error.bind(this._optionsService.options.logger))??console.error,i,e)}};BE=qte([Wte(0,Sse)],BE);var Cse=class extends Cr{constructor(i){if(TD&&iie()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=i,this._onChangeTextureAtlas=this._register(new yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new yt),this.onContextLoss=this._onContextLoss.event}activate(i){let e=i._core;if(!i.element){this._register(e.onWillOpen(()=>this.activate(i)));return}this._terminal=i;let t=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,c=r._coreBrowserService,u=r._decorationService;r._logService;let d=r._themeService;this._renderer=this._register(new vse(i,o,l,c,t,u,s,d,this._preserveDrawingBuffer)),this._register(Nn.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Nn.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Nn.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Nn.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(ji(()=>{if(this._terminal._core._store._isDisposed)return;let m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(i.cols,i.rows)}))}get textureAtlas(){var i;return(i=this._renderer)==null?void 0:i.textureAtlas}clearTextureAtlas(){var i;(i=this._renderer)==null||i.clearTextureAtlas()}};/**
|
|
196
|
+
}`,$n=8,Iv=$n*Float32Array.BYTES_PER_ELEMENT,Cse=20*$n,HE=class{constructor(){this.attributes=new Float32Array(Cse),this.count=0}},Qn=0,FE=0,GE=0,KE=0,JE=0,eP=0,tP=0,kse=class extends Cr{constructor(i,e,t,s){super(),this._terminal=i,this._gl=e,this._dimensions=t,this._themeService=s,this._vertices=new HE,this._verticesCursor=new HE;let r=this._gl;this._program=Wt(YD(r,xse,wse)),this._register(ji(()=>r.deleteProgram(this._program))),this._projectionLocation=Wt(r.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=r.createVertexArray(),r.bindVertexArray(this._vertexArrayObject);let n=new Float32Array([0,0,1,0,0,1,1,1]),o=r.createBuffer();this._register(ji(()=>r.deleteBuffer(o))),r.bindBuffer(r.ARRAY_BUFFER,o),r.bufferData(r.ARRAY_BUFFER,n,r.STATIC_DRAW),r.enableVertexAttribArray(3),r.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let l=new Uint8Array([0,1,2,3]),c=r.createBuffer();this._register(ji(()=>r.deleteBuffer(c))),r.bindBuffer(r.ELEMENT_ARRAY_BUFFER,c),r.bufferData(r.ELEMENT_ARRAY_BUFFER,l,r.STATIC_DRAW),this._attributesBuffer=Wt(r.createBuffer()),this._register(ji(()=>r.deleteBuffer(this._attributesBuffer))),r.bindBuffer(r.ARRAY_BUFFER,this._attributesBuffer),r.enableVertexAttribArray(0),r.vertexAttribPointer(0,2,r.FLOAT,!1,Iv,0),r.vertexAttribDivisor(0,1),r.enableVertexAttribArray(1),r.vertexAttribPointer(1,2,r.FLOAT,!1,Iv,2*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(1,1),r.enableVertexAttribArray(2),r.vertexAttribPointer(2,4,r.FLOAT,!1,Iv,4*Float32Array.BYTES_PER_ELEMENT),r.vertexAttribDivisor(2,1),this._updateCachedColors(s.colors),this._register(this._themeService.onChangeColors(u=>{this._updateCachedColors(u),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(i){let e=this._gl;e.useProgram(this._program),e.bindVertexArray(this._vertexArrayObject),e.uniformMatrix4fv(this._projectionLocation,!1,UD),e.bindBuffer(e.ARRAY_BUFFER,this._attributesBuffer),e.bufferData(e.ARRAY_BUFFER,i.attributes,e.DYNAMIC_DRAW),e.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,e.UNSIGNED_BYTE,0,i.count)}handleResize(){this._updateViewportRectangle()}setDimensions(i){this._dimensions=i}_updateCachedColors(i){this._bgFloat=this._colorToFloat32Array(i.background),this._cursorFloat=this._colorToFloat32Array(i.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(i){let e=this._terminal,t=this._vertices,s=1,r,n,o,l,c,u,d,m,g,_,y;for(r=0;r<e.rows;r++){for(o=-1,l=0,c=0,u=!1,n=0;n<e.cols;n++)d=(r*e.cols+n)*sg,m=i.cells[d+om],g=i.cells[d+am],_=!!(g&67108864),(m!==l||g!==c&&(u||_))&&((l!==0||u&&c!==0)&&(y=s++*$n,this._updateRectangle(t,y,c,l,o,n,r)),o=n,l=m,c=g,u=_);(l!==0||u&&c!==0)&&(y=s++*$n,this._updateRectangle(t,y,c,l,o,e.cols,r))}t.count=s}updateCursor(i){let e=this._verticesCursor,t=i.cursor;if(!t||t.style==="block"){e.count=0;return}let s,r=0;(t.style==="bar"||t.style==="outline")&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.style==="bar"?t.dpr*t.cursorWidth:t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(t.style==="underline"||t.style==="outline")&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,(t.y+1)*this._dimensions.device.cell.height-t.dpr,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat)),t.style==="outline"&&(s=r++*$n,this._addRectangleFloat(e.attributes,s,t.x*this._dimensions.device.cell.width,t.y*this._dimensions.device.cell.height,t.width*this._dimensions.device.cell.width,t.dpr,this._cursorFloat),s=r++*$n,this._addRectangleFloat(e.attributes,s,(t.x+t.width)*this._dimensions.device.cell.width-t.dpr,t.y*this._dimensions.device.cell.height,t.dpr,this._dimensions.device.cell.height,this._cursorFloat)),e.count=r}_updateRectangle(i,e,t,s,r,n,o){if(t&67108864)switch(t&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[t&255].rgba;break;case 50331648:Qn=(t&16777215)<<8;break;case 0:default:Qn=this._themeService.colors.foreground.rgba}else switch(s&50331648){case 16777216:case 33554432:Qn=this._themeService.colors.ansi[s&255].rgba;break;case 50331648:Qn=(s&16777215)<<8;break;case 0:default:Qn=this._themeService.colors.background.rgba}i.attributes.length<e+4&&(i.attributes=dse(i.attributes,this._terminal.rows*this._terminal.cols*$n)),FE=r*this._dimensions.device.cell.width,GE=o*this._dimensions.device.cell.height,KE=(Qn>>24&255)/255,JE=(Qn>>16&255)/255,eP=(Qn>>8&255)/255,tP=1,this._addRectangle(i.attributes,e,FE,GE,(n-r)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,KE,JE,eP,tP)}_addRectangle(i,e,t,s,r,n,o,l,c,u){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=s/this._dimensions.device.canvas.height,i[e+2]=r/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o,i[e+5]=l,i[e+6]=c,i[e+7]=u}_addRectangleFloat(i,e,t,s,r,n,o){i[e]=t/this._dimensions.device.canvas.width,i[e+1]=s/this._dimensions.device.canvas.height,i[e+2]=r/this._dimensions.device.canvas.width,i[e+3]=n/this._dimensions.device.canvas.height,i[e+4]=o[0],i[e+5]=o[1],i[e+6]=o[2],i[e+7]=o[3]}_colorToFloat32Array(i){return new Float32Array([(i.rgba>>24&255)/255,(i.rgba>>16&255)/255,(i.rgba>>8&255)/255,(i.rgba&255)/255])}},Tse=class extends Cr{constructor(i,e,t,s,r,n,o,l){super(),this._container=e,this._alpha=r,this._coreBrowserService=n,this._optionsService=o,this._themeService=l,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${t}-layer`),this._canvas.style.zIndex=s.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(c=>{this._refreshCharAtlas(i,c),this.reset(i)})),this._register(ji(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=Wt(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(i){}handleFocus(i){}handleCursorMove(i){}handleGridChanged(i,e,t){}handleSelectionChanged(i,e,t,s=!1){}_setTransparency(i,e){if(e===this._alpha)return;let t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(i,this._themeService.colors),this.handleGridChanged(i,0,i.rows-1)}_refreshCharAtlas(i,e){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=qD(i,this._optionsService.rawOptions,e,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(i,e){this._deviceCellWidth=e.device.cell.width,this._deviceCellHeight=e.device.cell.height,this._deviceCharWidth=e.device.char.width,this._deviceCharHeight=e.device.char.height,this._deviceCharLeft=e.device.char.left,this._deviceCharTop=e.device.char.top,this._canvas.width=e.device.canvas.width,this._canvas.height=e.device.canvas.height,this._canvas.style.width=`${e.css.canvas.width}px`,this._canvas.style.height=`${e.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(i,this._themeService.colors)}_fillBottomLineAtCells(i,e,t=1){this._ctx.fillRect(i*this._deviceCellWidth,(e+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,t*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(i,e,t,s){this._alpha?this._ctx.clearRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,s*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,s*this._deviceCellHeight))}_fillCharTrueColor(i,e,t,s){this._ctx.font=this._getFont(i,!1,!1),this._ctx.textBaseline=RD,this._clipCell(t,s,e.getWidth()),this._ctx.fillText(e.getChars(),t*this._deviceCellWidth+this._deviceCharLeft,s*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(i,e,t){this._ctx.beginPath(),this._ctx.rect(i*this._deviceCellWidth,e*this._deviceCellHeight,t*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(i,e,t){let s=e?i.options.fontWeightBold:i.options.fontWeight;return`${t?"italic":""} ${s} ${i.options.fontSize*this._coreBrowserService.dpr}px ${i.options.fontFamily}`}},Ase=class extends Tse{constructor(i,e,t,s,r,n,o){super(t,i,"link",e,!0,r,n,o),this._register(s.onShowLinkUnderline(l=>this._handleShowLinkUnderline(l))),this._register(s.onHideLinkUnderline(l=>this._handleHideLinkUnderline(l)))}resize(i,e){super.resize(i,e),this._state=void 0}reset(i){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let i=this._state.y2-this._state.y1-1;i>0&&this._clearCells(0,this._state.y1+1,this._state.cols,i),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(i){if(i.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:i.fg!==void 0&&cse(i.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[i.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,i.y1===i.y2)this._fillBottomLineAtCells(i.x1,i.y1,i.x2-i.x1);else{this._fillBottomLineAtCells(i.x1,i.y1,i.cols-i.x1);for(let e=i.y1+1;e<i.y2;e++)this._fillBottomLineAtCells(0,e,i.cols);this._fillBottomLineAtCells(0,i.y2,i.x2)}this._state=i}_handleHideLinkUnderline(i){this._clearCurrentLink()}},Da=typeof window=="object"?window:globalThis,hb=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new yt,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new yt,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let s=this.getWindowId(t);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};hb.INSTANCE=new hb;var HD=hb;function Mse(i,e,t){typeof e=="string"&&(e=i.matchMedia(e)),e.addEventListener("change",t)}HD.INSTANCE.onDidChangeZoomLevel;HD.INSTANCE.onDidChangeFullscreen;var Nh=typeof navigator=="object"?navigator.userAgent:"";Nh.indexOf("Firefox")>=0;Nh.indexOf("AppleWebKit")>=0;var Ese=Nh.indexOf("Chrome")>=0;!Ese&&Nh.indexOf("Safari")>=0;Nh.indexOf("Electron/")>=0;Nh.indexOf("Android")>=0;var qv=!1;if(typeof Da.matchMedia=="function"){let i=Da.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=Da.matchMedia("(display-mode: fullscreen)");qv=i.matches,Mse(Da,i,({matches:t})=>{qv&&e.matches||(qv=t)})}var rh="en",Wv=!1,FD=!1,$p,lm=rh,iP=rh,Pse,Or,Za=globalThis,Li,mP;typeof Za.vscode<"u"&&typeof Za.vscode.process<"u"?Li=Za.vscode.process:typeof process<"u"&&typeof((mP=process==null?void 0:process.versions)==null?void 0:mP.node)=="string"&&(Li=process);var gP,Qse=typeof((gP=Li==null?void 0:Li.versions)==null?void 0:gP.electron)=="string",Rse=Qse&&(Li==null?void 0:Li.type)==="renderer",OP;if(typeof Li=="object"){Li.platform,Li.platform,Wv=Li.platform==="linux",Wv&&Li.env.SNAP&&Li.env.SNAP_REVISION,Li.env.CI||Li.env.BUILD_ARTIFACTSTAGINGDIRECTORY,$p=rh,lm=rh;let i=Li.env.VSCODE_NLS_CONFIG;if(i)try{let e=JSON.parse(i);$p=e.userLocale,iP=e.osLocale,lm=e.resolvedLanguage||rh,Pse=(OP=e.languagePack)==null?void 0:OP.translationsConfigFile}catch{}FD=!0}else typeof navigator=="object"&&!Rse?(Or=navigator.userAgent,Or.indexOf("Windows")>=0,Or.indexOf("Macintosh")>=0,(Or.indexOf("Macintosh")>=0||Or.indexOf("iPad")>=0||Or.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Wv=Or.indexOf("Linux")>=0,(Or==null?void 0:Or.indexOf("Mobi"))>=0,lm=globalThis._VSCODE_NLS_LANGUAGE||rh,$p=navigator.language.toLowerCase(),iP=$p):console.error("Unable to resolve platform.");var sP=FD,rn=Or,Ao=lm,Lse;(i=>{function e(){return Ao}i.value=e;function t(){return Ao.length===2?Ao==="en":Ao.length>=3?Ao[0]==="e"&&Ao[1]==="n"&&Ao[2]==="-":!1}i.isDefaultVariant=t;function s(){return Ao==="en"}i.isDefault=s})(Lse||(Lse={}));var $se=typeof Za.postMessage=="function"&&!Za.importScripts;(()=>{if($se){let i=[];Za.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let s=0,r=i.length;s<r;s++){let n=i[s];if(n.id===t.data.vscodeScheduleAsyncWork){i.splice(s,1),n.callback();return}}});let e=0;return t=>{let s=++e;i.push({id:s,callback:t}),Za.postMessage({vscodeScheduleAsyncWork:s},"*")}}return i=>setTimeout(i)})();var Bse=!!(rn&&rn.indexOf("Chrome")>=0);rn&&rn.indexOf("Firefox")>=0;!Bse&&rn&&rn.indexOf("Safari")>=0;rn&&rn.indexOf("Edg/")>=0;rn&&rn.indexOf("Android")>=0;var jl=typeof navigator=="object"?navigator:{};sP||document.queryCommandSupported&&document.queryCommandSupported("copy")||jl&&jl.clipboard&&jl.clipboard.writeText,sP||jl&&jl.clipboard&&jl.clipboard.readText;var sx=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(i,e){this._keyCodeToStr[i]=e,this._strToKeyCode[e.toLowerCase()]=i}keyCodeToStr(i){return this._keyCodeToStr[i]}strToKeyCode(i){return this._strToKeyCode[i.toLowerCase()]||0}},Uv=new sx,rP=new sx,nP=new sx;new Array(230);var Dse;(i=>{function e(l){return Uv.keyCodeToStr(l)}i.toString=e;function t(l){return Uv.strToKeyCode(l)}i.fromString=t;function s(l){return rP.keyCodeToStr(l)}i.toUserSettingsUS=s;function r(l){return nP.keyCodeToStr(l)}i.toUserSettingsGeneral=r;function n(l){return rP.strToKeyCode(l)||nP.strToKeyCode(l)}i.fromUserSettings=n;function o(l){if(l>=98&&l<=113)return null;switch(l){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Uv.keyCodeToStr(l)}i.toElectronAccelerator=o})(Dse||(Dse={}));var GD=Object.freeze(function(i,e){let t=setTimeout(i.bind(e),0);return{dispose(){clearTimeout(t)}}}),zse;(i=>{function e(t){return t===i.None||t===i.Cancelled||t instanceof Nse?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}i.isCancellationToken=e,i.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:Nn.None}),i.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:GD})})(zse||(zse={}));var Nse=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?GD:(this._emitter||(this._emitter=new yt),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Xse;(i=>{async function e(s){let r,n=await Promise.all(s.map(o=>o.then(l=>l,l=>{r||(r=l)})));if(typeof r<"u")throw r;return n}i.settled=e;function t(s){return new Promise(async(r,n)=>{try{await s(r,n)}catch(o){n(o)}})}i.withAsyncBody=t})(Xse||(Xse={}));var oP=class Ks{static fromArray(e){return new Ks(t=>{t.emitMany(e)})}static fromPromise(e){return new Ks(async t=>{t.emitMany(await e)})}static fromPromises(e){return new Ks(async t=>{await Promise.all(e.map(async s=>t.emitOne(await s)))})}static merge(e){return new Ks(async t=>{await Promise.all(e.map(async s=>{for await(let r of s)t.emitOne(r)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new yt,queueMicrotask(async()=>{let s={emitOne:r=>this.emitOne(r),emitMany:r=>this.emitMany(r),reject:r=>this.reject(r)};try{await Promise.resolve(e(s)),this.resolve()}catch(r){this.reject(r)}finally{s.emitOne=void 0,s.emitMany=void 0,s.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await Nn.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var t;return(t=this._onReturn)==null||t.call(this),{done:!0,value:void 0}}}}static map(e,t){return new Ks(async s=>{for await(let r of e)s.emitOne(t(r))})}map(e){return Ks.map(this,e)}static filter(e,t){return new Ks(async s=>{for await(let r of e)t(r)&&s.emitOne(r)})}filter(e){return Ks.filter(this,e)}static coalesce(e){return Ks.filter(e,t=>!!t)}coalesce(){return Ks.coalesce(this)}static async toPromise(e){let t=[];for await(let s of e)t.push(s);return t}toPromise(){return Ks.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};oP.EMPTY=oP.fromArray([]);var{getWindow:Vse}=(function(){let i=new Map,e={window:Da,disposables:new ph};i.set(Da.vscodeWindowId,e);let t=new yt,s=new yt,r=new yt;function n(o,l){return(typeof o=="number"?i.get(o):void 0)??(l?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:r.event,onDidUnregisterWindow:s.event,registerWindow(o){if(i.has(o.vscodeWindowId))return Cr.None;let l=new ph,c={window:o,disposables:l.add(new ph)};return i.set(o.vscodeWindowId,c),l.add(ji(()=>{i.delete(o.vscodeWindowId),s.fire(o)})),l.add(cb(o,jse.BEFORE_UNLOAD,()=>{r.fire(o)})),t.fire(c),l},getWindows(){return i.values()},getWindowsCount(){return i.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return i.has(o)},getWindowById:n,getWindow(o){var u;let l=o;if((u=l==null?void 0:l.ownerDocument)!=null&&u.defaultView)return l.ownerDocument.defaultView.window;let c=o;return c!=null&&c.view?c.view.window:Da},getDocument(o){return Vse(o).document}}})(),Zse=class{constructor(i,e,t,s){this._node=i,this._type=e,this._handler=t,this._options=s||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function cb(i,e,t,s){return new Zse(i,e,t,s)}var jse={BEFORE_UNLOAD:"beforeunload"},Ise=class extends Cr{constructor(i,e,t,s,r,n,o,l,c){super(),this._terminal=i,this._characterJoinerService=e,this._charSizeService=t,this._coreBrowserService=s,this._coreService=r,this._decorationService=n,this._optionsService=o,this._themeService=l,this._cursorBlinkStateManager=new tu,this._charAtlasDisposable=this._register(new tu),this._observerDisposable=this._register(new tu),this._model=new Sse,this._workCell=new UE,this._workCell2=new UE,this._rectangleRenderer=this._register(new tu),this._glyphRenderer=this._register(new tu),this._onChangeTextureAtlas=this._register(new yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new yt),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new yt),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas");let u={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext("webgl2",u),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new Die(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new Ase(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=$ie(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(cb(this._canvas,"webglcontextlost",d=>{console.log("webglcontextlost event received"),d.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(d)},3e3)})),this._register(cb(this._canvas,"webglcontextrestored",d=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,qE(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=WE(this._canvas,this._coreBrowserService.window,(d,m)=>this._setCanvasDevicePixelDimensions(d,m)),this._register(this._coreBrowserService.onWindowChange(d=>{this._observerDisposable.value=WE(this._canvas,d,(m,g)=>this._setCanvasDevicePixelDimensions(m,g))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(ji(()=>{var d;for(let m of this._renderLayers)m.dispose();(d=this._canvas.parentElement)==null||d.removeChild(this._canvas),qE(this._terminal)}))}get textureAtlas(){var i;return(i=this._charAtlas)==null?void 0:i.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(i,e){var t,s,r,n;this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let o of this._renderLayers)o.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,(t=this._rectangleRenderer.value)==null||t.setDimensions(this.dimensions),(s=this._rectangleRenderer.value)==null||s.handleResize(),(r=this._glyphRenderer.value)==null||r.setDimensions(this.dimensions),(n=this._glyphRenderer.value)==null||n.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){var i;for(let e of this._renderLayers)e.handleBlur(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.pause(),this._requestRedrawViewport()}handleFocus(){var i;for(let e of this._renderLayers)e.handleFocus(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.resume(),this._requestRedrawViewport()}handleSelectionChanged(i,e,t){for(let s of this._renderLayers)s.handleSelectionChanged(this._terminal,i,e,t);this._model.selection.update(this._core,i,e,t),this._requestRedrawViewport()}handleCursorMove(){var i;for(let e of this._renderLayers)e.handleCursorMove(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new kse(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new _se(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){var e;if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let i=qD(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==i&&(this._onChangeTextureAtlas.fire(i.pages[0].canvas),this._charAtlasDisposable.value=AD(Nn.forward(i.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),Nn.forward(i.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=i,this._charAtlas.warmUp(),(e=this._glyphRenderer.value)==null||e.setAtlas(this._charAtlas)}_clearModel(i){var e;this._model.clear(),i&&((e=this._glyphRenderer.value)==null||e.clear())}clearTextureAtlas(){var i;(i=this._charAtlas)==null||i.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){var i;this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);(i=this._cursorBlinkStateManager.value)==null||i.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(i,e){var t;if(!this._isAttached)if((t=this._core.screenElement)!=null&&t.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,i,e);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(i,e),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new use(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(i,e){let t=this._core,s=this._workCell,r,n,o,l,c,u,d=0,m=!0,g,_,y,b,x,w,k,C,A;i=aP(i,t.rows-1,0),e=aP(e,t.rows-1,0);let P=this._coreService.decPrivateModes.cursorStyle??t.options.cursorStyle??"block",E=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,$=E-t.buffer.ydisp,z=Math.min(this._terminal.buffer.active.cursorX,t.cols-1),I=-1,se=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let F=!1;for(n=i;n<=e;n++)for(o=n+t.buffer.ydisp,l=t.buffer.lines.get(o),this._model.lineLengths[n]=0,y=E===o,d=0,c=this._characterJoinerService.getJoinedCharacters(o),C=0;C<t.cols;C++){if(r=this._cellColorResolver.result.bg,l.loadCell(C,s),C===0&&(r=this._cellColorResolver.result.bg),u=!1,m=C>=d,g=C,c.length>0&&C===c[0][0]&&m){_=c.shift();let R=this._model.selection.isCellSelected(this._terminal,_[0],o);for(k=_[0]+1;k<_[1];k++)m&&(m=R===this._model.selection.isCellSelected(this._terminal,k,o));m&&(m=!y||z<_[0]||z>=_[1]),m?(u=!0,s=new qse(s,l.translateToString(!0,_[0],_[1]),_[1]-_[0]),g=_[1]-1):d=_[1]}if(b=s.getChars(),x=s.getCode(),k=(n*t.cols+C)*sg,this._cellColorResolver.resolve(s,C,o,this.dimensions.device.cell.width),se&&o===E&&(C===z&&(this._model.cursor={x:z,y:$,width:s.getWidth(),style:this._coreBrowserService.isFocused?P:t.options.cursorInactiveStyle,cursorWidth:t.options.cursorWidth,dpr:this._devicePixelRatio},I=z+s.getWidth()-1),C>=z&&C<=I&&(this._coreBrowserService.isFocused&&P==="block"||this._coreBrowserService.isFocused===!1&&t.options.cursorInactiveStyle==="block")&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),x!==0&&(this._model.lineLengths[n]=C+1),!(this._model.cells[k]===x&&this._model.cells[k+om]===this._cellColorResolver.result.bg&&this._model.cells[k+am]===this._cellColorResolver.result.fg&&this._model.cells[k+jv]===this._cellColorResolver.result.ext)&&(F=!0,b.length>1&&(x|=bse),this._model.cells[k]=x,this._model.cells[k+om]=this._cellColorResolver.result.bg,this._model.cells[k+am]=this._cellColorResolver.result.fg,this._model.cells[k+jv]=this._cellColorResolver.result.ext,w=s.getWidth(),this._glyphRenderer.value.updateCell(C,n,x,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,b,w,r),u)){for(s=this._workCell,C++;C<=g;C++)A=(n*t.cols+C)*sg,this._glyphRenderer.value.updateCell(C,n,0,0,0,0,Aie,0,0),this._model.cells[A]=0,this._model.cells[A+om]=this._cellColorResolver.result.bg,this._model.cells[A+am]=this._cellColorResolver.result.fg,this._model.cells[A+jv]=this._cellColorResolver.result.ext;C--}}F&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(i,e){this._canvas.width===i&&this._canvas.height===e||(this._canvas.width=i,this._canvas.height=e,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let i=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:i,end:i})}},qse=class extends sh{constructor(i,e,t){super(),this.content=0,this.combinedData="",this.fg=i.fg,this.bg=i.bg,this.combinedData=e,this._width=t}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(i){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function aP(i,e,t=0){return Math.max(Math.min(i,e),t)}var lP="di$target",hP="di$dependencies",Yv=new Map;function an(i){if(Yv.has(i))return Yv.get(i);let e=function(t,s,r){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");Wse(e,t,r)};return e._id=i,Yv.set(i,e),e}function Wse(i,e,t){e[lP]===e?e[hP].push({id:i,index:t}):(e[hP]=[{id:i,index:t}],e[lP]=e)}an("BufferService");an("CoreMouseService");an("CoreService");an("CharsetService");an("InstantiationService");an("LogService");var Use=an("OptionsService");an("OscLinkService");an("UnicodeService");an("DecorationService");var Yse={trace:0,debug:1,info:2,warn:3,error:4,off:5},Hse="xterm.js: ",cP=class extends Cr{constructor(i){super(),this._optionsService=i,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=Yse[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(i){for(let e=0;e<i.length;e++)typeof i[e]=="function"&&(i[e]=i[e]())}_log(i,e,t){this._evalLazyOptionalParams(t),i.call(console,(this._optionsService.options.logger?"":Hse)+e,...t)}trace(i,...e){var t;this._logLevel<=0&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.trace.bind(this._optionsService.options.logger))??console.log,i,e)}debug(i,...e){var t;this._logLevel<=1&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.debug.bind(this._optionsService.options.logger))??console.log,i,e)}info(i,...e){var t;this._logLevel<=2&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.info.bind(this._optionsService.options.logger))??console.info,i,e)}warn(i,...e){var t;this._logLevel<=3&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.warn.bind(this._optionsService.options.logger))??console.warn,i,e)}error(i,...e){var t;this._logLevel<=4&&this._log(((t=this._optionsService.options.logger)==null?void 0:t.error.bind(this._optionsService.options.logger))??console.error,i,e)}};cP=gie([Oie(0,Use)],cP);var Fse=class extends Cr{constructor(i){if(PD&&Tie()<16){let e={antialias:!1,depth:!1,preserveDrawingBuffer:!0};if(!document.createElement("canvas").getContext("webgl2",e))throw new Error("Webgl2 is only supported on Safari 16 and above")}super(),this._preserveDrawingBuffer=i,this._onChangeTextureAtlas=this._register(new yt),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new yt),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new yt),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new yt),this.onContextLoss=this._onContextLoss.event}activate(i){let e=i._core;if(!i.element){this._register(e.onWillOpen(()=>this.activate(i)));return}this._terminal=i;let t=e.coreService,s=e.optionsService,r=e,n=r._renderService,o=r._characterJoinerService,l=r._charSizeService,c=r._coreBrowserService,u=r._decorationService;r._logService;let d=r._themeService;this._renderer=this._register(new Ise(i,o,l,c,t,u,s,d,this._preserveDrawingBuffer)),this._register(Nn.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(Nn.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(Nn.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(Nn.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(ji(()=>{if(this._terminal._core._store._isDisposed)return;let m=this._terminal._core._renderService;m.setRenderer(this._terminal._core._createRenderer()),m.handleResize(i.cols,i.rows)}))}get textureAtlas(){var i;return(i=this._renderer)==null?void 0:i.textureAtlas}clearTextureAtlas(){var i;(i=this._renderer)==null||i.clearTextureAtlas()}};/**
|
|
190
197
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
191
198
|
* @license MIT
|
|
192
199
|
*
|
|
@@ -197,13 +204,6 @@ void main() {
|
|
|
197
204
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
198
205
|
* http://bellard.org/jslinux/
|
|
199
206
|
* Copyright (c) 2011 Fabrice Bellard
|
|
200
|
-
*/var Oi=0,_i=0,vi=0,Rt=0,Zi;(i=>{function e(r,n,o,l){return l!==void 0?`#${Sa(r)}${Sa(n)}${Sa(o)}${Sa(l)}`:`#${Sa(r)}${Sa(n)}${Sa(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Zi||(Zi={}));var
|
|
201
|
-
`,this._lastCursorRow=i+1,this._lastCursorCol=0;else{t="";let o=r.getCell(r.length-1,this._thisRowLastChar),l=r.getCell(r.length-2,this._thisRowLastSecondChar),c=n.getCell(0,this._nextRowFirstChar),u=c.getWidth()>1,d=!1;(c.getChars()&&u?this._nullCellCount<=1:this._nullCellCount<=0)&&((o.getChars()||o.getWidth()===0)&&Ln(o,c)&&(d=!0),u&&(l.getChars()||l.getWidth()===0)&&Ln(o,c)&&Ln(l,c)&&(d=!0)),d||(t="-".repeat(this._nullCellCount+1),t+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(t+="\x1B[A",t+=`\x1B[${r.length-this._nullCellCount}C`,t+=`\x1B[${this._nullCellCount}X`,t+=`\x1B[${r.length-this._nullCellCount}D`,t+="\x1B[B"),this._lastContentCursorRow=i+1,this._lastContentCursorCol=0,this._lastCursorRow=i+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=t,this._currentRow="",this._nullCellCount=0}_diffStyle(i,e){let t=[],s=!HD(i,e),r=!Ln(i,e),n=!FD(i,e);if(s||r||n)if(i.isAttributeDefault())e.isAttributeDefault()||t.push(0);else{if(s){let o=i.getFgColor();i.isFgRGB()?t.push(38,2,o>>>16&255,o>>>8&255,o&255):i.isFgPalette()?o>=16?t.push(38,5,o):t.push(o&8?90+(o&7):30+(o&7)):t.push(39)}if(r){let o=i.getBgColor();i.isBgRGB()?t.push(48,2,o>>>16&255,o>>>8&255,o&255):i.isBgPalette()?o>=16?t.push(48,5,o):t.push(o&8?100+(o&7):40+(o&7)):t.push(49)}n&&(i.isInverse()!==e.isInverse()&&t.push(i.isInverse()?7:27),i.isBold()!==e.isBold()&&t.push(i.isBold()?1:22),i.isUnderline()!==e.isUnderline()&&t.push(i.isUnderline()?4:24),i.isOverline()!==e.isOverline()&&t.push(i.isOverline()?53:55),i.isBlink()!==e.isBlink()&&t.push(i.isBlink()?5:25),i.isInvisible()!==e.isInvisible()&&t.push(i.isInvisible()?8:28),i.isItalic()!==e.isItalic()&&t.push(i.isItalic()?3:23),i.isDim()!==e.isDim()&&t.push(i.isDim()?2:22),i.isStrikethrough()!==e.isStrikethrough()&&t.push(i.isStrikethrough()?9:29))}return t}_nextCell(i,e,t,s){if(i.getWidth()===0)return;let r=i.getChars()==="",n=this._diffStyle(i,this._cursorStyle);if(r?!Ln(this._cursorStyle,i):n.length>0){this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=t,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${n.join(";")}m`;let o=this._buffer.getLine(t);o!==void 0&&(o.getCell(s,this._cursorStyle),this._cursorStyleRow=t,this._cursorStyleCol=s)}r?this._nullCellCount+=i.getWidth():(this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=i.getChars(),this._lastContentCursorRow=this._lastCursorRow=t,this._lastContentCursorCol=this._lastCursorCol=s+i.getWidth())}_serializeString(i){let e=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(e=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let t="";for(let n=0;n<e;n++)t+=this._allRows[n],n+1<e&&(t+=this._allRowSeparators[n]);if(!i){let n=this._buffer.baseY+this._buffer.cursorY,o=this._buffer.cursorX,l=n!==this._lastCursorRow||o!==this._lastCursorCol,c=u=>{u>0?t+=`\x1B[${u}C`:u<0&&(t+=`\x1B[${-u}D`)};l&&((u=>{u>0?t+=`\x1B[${u}B`:u<0&&(t+=`\x1B[${-u}A`)})(n-this._lastCursorRow),c(o-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,r=this._diffStyle(s,this._cursorStyle);return r.length>0&&(t+=`\x1B[${r.join(";")}m`),t}},Ese=class{activate(i){this._terminal=i}_serializeBufferByScrollback(i,e,t){let s=e.length,r=t===void 0?s:DE(t+i.rows,0,s);return this._serializeBufferByRange(i,e,{start:s-r,end:s-1},!1)}_serializeBufferByRange(i,e,t,s){return new Mse(e,i).serialize({start:{x:0,y:typeof t.start=="number"?t.start:t.start.line},end:{x:i.cols,y:typeof t.end=="number"?t.end:t.end.line}},s)}_serializeBufferAsHTML(i,e){var l;let t=i.buffer.active,s=new Pse(t,i,e),r=e.onlySelection??!1,n=e.range;if(n)return s.serialize({start:{x:n.startCol,y:(n.startLine,n.startLine)},end:{x:i.cols,y:(n.endLine,n.endLine)}});if(!r){let c=t.length,u=e.scrollback,d=u===void 0?c:DE(u+i.rows,0,c);return s.serialize({start:{x:0,y:c-d},end:{x:i.cols,y:c-1}})}let o=(l=this._terminal)==null?void 0:l.getSelectionPosition();return o!==void 0?s.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}}):""}_serializeModes(i){let e="",t=i.modes;if(t.applicationCursorKeysMode&&(e+="\x1B[?1h"),t.applicationKeypadMode&&(e+="\x1B[?66h"),t.bracketedPasteMode&&(e+="\x1B[?2004h"),t.insertMode&&(e+="\x1B[4h"),t.originMode&&(e+="\x1B[?6h"),t.reverseWraparoundMode&&(e+="\x1B[?45h"),t.sendFocusMode&&(e+="\x1B[?1004h"),t.wraparoundMode===!1&&(e+="\x1B[?7l"),t.mouseTrackingMode!=="none")switch(t.mouseTrackingMode){case"x10":e+="\x1B[?9h";break;case"vt200":e+="\x1B[?1000h";break;case"drag":e+="\x1B[?1002h";break;case"any":e+="\x1B[?1003h";break}return e}serialize(i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let e=i!=null&&i.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,i.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,i==null?void 0:i.scrollback);if(!(i!=null&&i.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let t=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);e+=`\x1B[?1049h\x1B[H${t}`}return i!=null&&i.excludeModes||(e+=this._serializeModes(this._terminal)),e}serializeAsHTML(i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,i||{})}dispose(){}},Pse=class extends YD{constructor(i,e,t){super(i),this._terminal=e,this._options=t,this._currentRow="",this._htmlContent="",e._core._themeService?this._ansiColors=e._core._themeService.colors.ansi:this._ansiColors=Tse}_padStart(i,e,t){return e=e>>0,t=t??" ",i.length>e?i:(e-=i.length,e>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+i)}_beforeSerialize(i,e,t){var o,l;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",r="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((o=this._terminal.options.theme)==null?void 0:o.foreground)??"#ffffff",r=((l=this._terminal.options.theme)==null?void 0:l.background)??"#000000");let n=[];n.push("color: "+s+";"),n.push("background-color: "+r+";"),n.push("font-family: "+this._terminal.options.fontFamily+";"),n.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+n.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(i,e){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(i,e){let t=e?i.getFgColor():i.getBgColor();if(e?i.isFgRGB():i.isBgRGB())return"#"+[t>>16&255,t>>8&255,t&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(e?i.isFgPalette():i.isBgPalette())return this._ansiColors[t].css}_diffStyle(i,e){let t=[],s=!HD(i,e),r=!Ln(i,e),n=!FD(i,e);if(s||r||n){let o=this._getHexColor(i,!0);o&&t.push("color: "+o+";");let l=this._getHexColor(i,!1);return l&&t.push("background-color: "+l+";"),i.isInverse()&&t.push("color: #000000; background-color: #BFBFBF;"),i.isBold()&&t.push("font-weight: bold;"),i.isUnderline()&&i.isOverline()?t.push("text-decoration: overline underline;"):i.isUnderline()?t.push("text-decoration: underline;"):i.isOverline()&&t.push("text-decoration: overline;"),i.isBlink()&&t.push("text-decoration: blink;"),i.isInvisible()&&t.push("visibility: hidden;"),i.isItalic()&&t.push("font-style: italic;"),i.isDim()&&t.push("opacity: 0.5;"),i.isStrikethrough()&&t.push("text-decoration: line-through;"),t}}_nextCell(i,e,t,s){if(i.getWidth()===0)return;let r=i.getChars()==="",n=this._diffStyle(i,e);n&&(this._currentRow+=n.length===0?"</span><span>":"</span><span style='"+n.join(" ")+"'>"),r?this._currentRow+=" ":this._currentRow+=Ase(i.getChars())}_serializeString(){return this._htmlContent}};const Qse=10,Rse=2e3;function Lse(i={}){const{autoSpawn:e=!1,skipPermissions:t=!1}=i,[s,r]=Y.useState(!1),[n,o]=Y.useState(!1),[l,c]=Y.useState(null),[u,d]=Y.useState(null),m=Y.useRef(null),g=Y.useRef(0),_=Y.useRef(null),y=Y.useRef(!0),b=Y.useRef(null),x=Y.useRef(null),w=Y.useRef(e),k=Y.useRef(t);w.current=e,k.current=t;const C=Y.useCallback(z=>{const I=m.current;I&&I.readyState===WebSocket.OPEN&&I.send(JSON.stringify(z))},[]),A=Y.useCallback(z=>{C({type:"spawn",skipPermissions:z})},[C]),P=Y.useCallback(()=>{C({type:"kill"})},[C]),E=Y.useCallback((z,I)=>{C({type:"resize",cols:z,rows:I})},[C]),$=Y.useCallback(z=>{C({type:"input",data:z})},[C]);return Y.useEffect(()=>{y.current=!0;function z(){if(!y.current)return;const se=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`,F=new WebSocket(se);m.current=F,F.onopen=()=>{y.current&&(r(!0),g.current=0,w.current&&F.send(JSON.stringify({type:"spawn",skipPermissions:k.current})))},F.onclose=()=>{y.current&&(r(!1),m.current=null,g.current<Qse&&(g.current++,_.current=setTimeout(z,Rse)))},F.onmessage=R=>{var L,N;if(y.current)try{const Z=JSON.parse(R.data);switch(Z.type){case"output":(L=b.current)==null||L.call(b,Z.data);break;case"scrollback":(N=x.current)==null||N.call(x,Z.data);break;case"status":c({pid:Z.pid,uptime:Z.uptime,cwd:Z.cwd,memoryMB:Z.memoryMB,isActive:Z.isActive,skipPermissions:Z.skipPermissions,alive:Z.alive});break;case"exit":d(Z.code??1);break;case"started":d(null);break;case"unavailable":o(!0);break}}catch{}},F.onerror=()=>{}}return z(),()=>{y.current=!1,_.current!==null&&(clearTimeout(_.current),_.current=null),m.current&&(m.current.onclose=null,m.current.close(),m.current=null)}},[]),{connected:s,unavailable:n,status:l,exitCode:u,send:C,spawn:A,kill:P,resize:E,writeInput:$,onOutput:b,onScrollback:x}}function $se(i){const e=Math.floor(i/60),t=i%60;return`${e}m ${t}s`}function Bse(i){const e=i.replace(/\\/g,"/").split("/").filter(Boolean);return e.length<=2?i:".../"+e.slice(-2).join("/")}function Dse({status:i,connected:e,exitCode:t,skipPermissions:s,onToggleSkipPermissions:r,onStop:n,onRestart:o}){const l=e&&(i==null?void 0:i.alive),c=e?l?"bg-green-500":"bg-yellow-500":"bg-red-500",u=e?l?`Running (PID ${(i==null?void 0:i.pid)??"?"})`:"Stopped":"Disconnected";return M.jsxs("div",{className:"flex items-center justify-between border-t border-border bg-card px-3 py-1.5 font-mono text-xs text-muted-foreground",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:dt("inline-block h-2 w-2 rounded-full",c),title:u}),M.jsx("span",{children:u}),i&&l&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:"text-border",children:"|"}),M.jsx("span",{children:$se(i.uptime)}),M.jsx("span",{className:"text-border",children:"|"}),M.jsx("span",{title:i.cwd,children:Bse(i.cwd)}),M.jsx("span",{className:"text-border",children:"|"}),M.jsxs("span",{children:[i.memoryMB," MB"]})]})]}),M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5",children:[M.jsx("input",{type:"checkbox",checked:s,onChange:r,className:"h-3 w-3 accent-accent"}),M.jsx("span",{children:"Skip Perms"})]}),l&&M.jsx("button",{type:"button",onClick:n,className:"rounded-sm px-2 py-0.5 text-red-400 transition-colors hover:bg-red-500/20",children:"Stop"}),M.jsx("button",{type:"button",onClick:o,className:"rounded-sm px-2 py-0.5 transition-colors hover:bg-accent/20",children:"Restart"})]})]})}const zse=[{label:"Progress",command:"/maxsim:progress"},{label:"New Project",command:"/maxsim:new-project"},{label:"Discuss",command:"/maxsim:discuss-phase N"},{label:"Plan",command:"/maxsim:plan-phase N"},{label:"Execute",command:"/maxsim:execute-phase N"},{label:"Roadmap",command:"/maxsim:roadmap"},{label:"Verify",command:"/maxsim:verify-work"},{label:"Resume",command:"/maxsim:resume-work"}],GD="maxsim-quick-commands",Nse=3e4;function Xse(){try{const i=localStorage.getItem(GD);if(i)return JSON.parse(i)}catch{}return zse}function Vse(i){localStorage.setItem(GD,JSON.stringify(i))}function Zse({onSendCommand:i,isActive:e,isAlive:t,unavailable:s=!1}){const[r,n]=Y.useState(!1),[o,l]=Y.useState(Xse),[c,u]=Y.useState(!1),[d,m]=Y.useState(null),g=Y.useRef(null),_=Y.useCallback(async E=>{if(!E.includes(" N"))return E;const $=g.current;if($&&Date.now()-$.ts<Nse)return E.replace(" N",` ${$.value}`);try{const z=await fetch("/api/state");if(z.ok){const I=await z.json(),se=String(I.currentPhase??"1");return g.current={value:se,ts:Date.now()},E.replace(" N",` ${se}`)}}catch{}return E},[]),y=s||!t,b=Y.useCallback(async E=>{if(y)return;const $=await _(E.command);m({label:E.label,resolved:$})},[y,_]),x=Y.useCallback(()=>{d&&(i(d.resolved+`\r
|
|
202
|
-
`),m(null))},[d,i]),w=Y.useCallback(()=>{m(null)},[]);Y.useEffect(()=>{if(!d)return;const E=$=>{$.key==="Enter"?($.preventDefault(),x()):$.key==="Escape"&&w()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[d,x,w]);const[k,C]=Y.useState([]),A=Y.useCallback(()=>{C([...o]),u(!0)},[o]),P=Y.useCallback(()=>{const E=k.filter($=>$.label.trim()&&$.command.trim());l(E),Vse(E),u(!1)},[k]);return r?M.jsx("div",{className:"absolute bottom-2 right-2 z-20",children:M.jsx("button",{type:"button",onClick:()=>n(!1),className:"rounded-md bg-card/80 p-1.5 text-xs text-muted-foreground shadow-lg backdrop-blur-sm border border-border hover:text-foreground transition-colors",title:"Show quick actions",children:M.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M18 15l-6-6-6 6"})})})}):M.jsxs("div",{className:"absolute bottom-2 right-2 z-20 flex flex-col items-end gap-1",children:[d&&M.jsxs("div",{className:"rounded-lg bg-card border border-border shadow-lg p-2 text-xs mb-1 backdrop-blur-sm",children:[M.jsxs("p",{className:"text-muted-foreground mb-1.5",children:["Send"," ",M.jsx("span",{className:"font-mono text-foreground",children:d.resolved}),"?"]}),M.jsxs("div",{className:"flex gap-1.5",children:[M.jsx("button",{type:"button",onClick:x,className:"rounded-sm bg-accent px-2 py-0.5 text-foreground hover:bg-accent-glow transition-colors",children:"Confirm"}),M.jsx("button",{type:"button",onClick:w,className:"rounded-sm bg-muted px-2 py-0.5 text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}),c&&M.jsxs("div",{className:"rounded-lg bg-card border border-border shadow-lg p-3 text-xs mb-1 backdrop-blur-sm w-72 max-h-64 overflow-y-auto",children:[M.jsx("p",{className:"text-muted-foreground font-medium mb-2",children:"Quick Commands"}),k.map((E,$)=>M.jsxs("div",{className:"flex gap-1 mb-1",children:[M.jsx("input",{className:"flex-[1] rounded-sm border border-border bg-muted px-1.5 py-0.5 text-xs text-foreground",value:E.label,onChange:z=>{const I=[...k];I[$]={...I[$],label:z.target.value},C(I)},placeholder:"Label"}),M.jsx("input",{className:"flex-[2] rounded-sm border border-border bg-muted px-1.5 py-0.5 text-xs font-mono text-foreground",value:E.command,onChange:z=>{const I=[...k];I[$]={...I[$],command:z.target.value},C(I)},placeholder:"Command"}),M.jsx("button",{type:"button",onClick:()=>C(k.filter((z,I)=>I!==$)),className:"text-muted-foreground hover:text-destructive transition-colors px-0.5",title:"Remove",children:"x"})]},$)),M.jsxs("div",{className:"flex justify-between mt-2",children:[M.jsx("button",{type:"button",onClick:()=>C([...k,{label:"",command:""}]),className:"text-muted-foreground hover:text-foreground transition-colors",children:"+ Add"}),M.jsxs("div",{className:"flex gap-1.5",children:[M.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded-sm bg-muted px-2 py-0.5 text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),M.jsx("button",{type:"button",onClick:P,className:"rounded-sm bg-accent px-2 py-0.5 text-foreground hover:bg-accent-glow transition-colors",children:"Save"})]})]})]}),M.jsxs("div",{className:"flex items-center gap-1 rounded-lg bg-card/80 border border-border shadow-lg p-1.5 backdrop-blur-sm",children:[o.map(E=>M.jsx("button",{type:"button",onClick:()=>b(E),disabled:y,className:"rounded-md px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed",title:s?"Terminal unavailable — node-pty not installed":E.command,children:E.label},E.label)),M.jsx("button",{type:"button",onClick:A,className:"rounded-md px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground transition-colors ml-0.5",title:"Settings",children:M.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[M.jsx("circle",{cx:"12",cy:"12",r:"3"}),M.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.32 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]})}),M.jsx("button",{type:"button",onClick:()=>n(!0),className:"rounded-md px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Minimize",children:M.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M6 9l6 6 6-6"})})})]})]})}function jse({onReady:i}){const e=Y.useRef(null),t=Y.useRef(null),s=Y.useRef(null),r=Y.useRef(null),n=Y.useRef(null),[o,l]=Y.useState(!0),{connected:c,unavailable:u,status:d,exitCode:m,writeInput:g,resize:_,spawn:y,kill:b,onOutput:x,onScrollback:w}=Lse({autoSpawn:!0,skipPermissions:o}),k=Y.useCallback($=>{var z;(z=t.current)==null||z.write($)},[]),C=Y.useCallback($=>{var z;(z=t.current)==null||z.write($)},[]);Y.useEffect(()=>(x.current=k,w.current=C,()=>{x.current=null,w.current=null}),[k,C,x,w]),Y.useEffect(()=>{if(!e.current)return;const $=new Vte({cursorBlink:!0,fontSize:14,lineHeight:1.2,theme:{background:"#0a0a0a",foreground:"#e0e0e0",cursor:"#e0e0e0"}}),z=new Ite,I=new Ese;$.loadAddon(z),$.loadAddon(I);try{$.loadAddon(new Cse)}catch{}$.open(e.current),z.fit(),t.current=$,s.current=z;const se=$.onData(R=>{g(R)}),F=new ResizeObserver(()=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.current&&t.current&&(s.current.fit(),_(t.current.cols,t.current.rows))},100)});return F.observe(e.current),r.current=F,i==null||i($),()=>{se.dispose(),F.disconnect(),n.current&&clearTimeout(n.current),$.dispose(),t.current=null,s.current=null,r.current=null}},[]);const A=Y.useCallback(()=>{y(o),setTimeout(()=>{var $;return($=t.current)==null?void 0:$.focus()},100)},[y,o]),P=Y.useCallback(()=>{b()},[b]),E=Y.useCallback(()=>{l($=>!$)},[]);return M.jsxs("div",{className:"flex h-full w-full flex-col",onWheel:$=>$.stopPropagation(),children:[M.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[M.jsx("div",{ref:e,className:"h-full w-full"}),M.jsx(Zse,{onSendCommand:g,isActive:(d==null?void 0:d.isActive)??!1,isAlive:(d==null?void 0:d.alive)??!1,unavailable:u}),u&&M.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-card",children:M.jsxs("div",{className:"max-w-sm text-center",children:[M.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Terminal unavailable"}),M.jsxs("p",{className:"text-sm text-muted-foreground",children:["node-pty is not installed. Run ",M.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"npm install node-pty"})," in the dashboard directory."]})]})}),!c&&m===null&&M.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/60",children:M.jsxs("div",{className:"flex items-center gap-3 font-mono text-sm text-muted-foreground",children:[M.jsxs("svg",{className:"h-5 w-5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[M.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),M.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Reconnecting..."]})}),m!==null&&M.jsxs("div",{className:"absolute inset-x-0 bottom-0 z-10 flex items-center justify-between bg-card/90 px-4 py-2 font-mono text-sm backdrop-blur-sm",children:[M.jsxs("span",{className:"text-muted-foreground",children:["Process exited (code ",m,")"]}),M.jsx("button",{type:"button",onClick:A,className:"rounded-sm bg-accent px-3 py-1 text-xs text-foreground transition-colors hover:bg-accent-glow",children:"Restart"})]})]}),M.jsx(Dse,{status:d,connected:c,exitCode:m,skipPermissions:o,onToggleSkipPermissions:E,onStop:P,onRestart:A})]})}function Ise(){const[i,e]=Y.useState(!1),t=Y.useCallback(()=>e(s=>!s),[]);return{splitMode:i,toggleSplit:t}}function qse({splitMode:i,onToggle:e}){return M.jsx("button",{type:"button",onClick:e,title:i?"Full-height mode":"Split-panel mode",className:"absolute right-3 top-2 z-20 flex h-7 w-7 items-center justify-center rounded-sm border border-border bg-card text-muted-foreground transition-colors hover:bg-card-hover hover:text-foreground",children:i?M.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:M.jsx("rect",{x:"1",y:"1",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5"})}):M.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[M.jsx("rect",{x:"1",y:"1",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),M.jsx("line",{x1:"1",y1:"7",x2:"13",y2:"7",stroke:"currentColor",strokeWidth:"1.5"})]})})}var jl={},kv,zE;function Wse(){return zE||(zE=1,kv=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),kv}var Tv={},Ao={},NE;function Ka(){if(NE)return Ao;NE=1;let i;const e=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Ao.getSymbolSize=function(s){if(!s)throw new Error('"version" cannot be null or undefined');if(s<1||s>40)throw new Error('"version" should be in range from 1 to 40');return s*4+17},Ao.getSymbolTotalCodewords=function(s){return e[s]},Ao.getBCHDigit=function(t){let s=0;for(;t!==0;)s++,t>>>=1;return s},Ao.setToSJISFunction=function(s){if(typeof s!="function")throw new Error('"toSJISFunc" is not a valid function.');i=s},Ao.isKanjiModeEnabled=function(){return typeof i<"u"},Ao.toSJIS=function(s){return i(s)},Ao}var Av={},XE;function sx(){return XE||(XE=1,(function(i){i.L={bit:1},i.M={bit:0},i.Q={bit:3},i.H={bit:2};function e(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return i.L;case"m":case"medium":return i.M;case"q":case"quartile":return i.Q;case"h":case"high":return i.H;default:throw new Error("Unknown EC Level: "+t)}}i.isValid=function(s){return s&&typeof s.bit<"u"&&s.bit>=0&&s.bit<4},i.from=function(s,r){if(i.isValid(s))return s;try{return e(s)}catch{return r}}})(Av)),Av}var Mv,VE;function Use(){if(VE)return Mv;VE=1;function i(){this.buffer=[],this.length=0}return i.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let s=0;s<t;s++)this.putBit((e>>>t-s-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},Mv=i,Mv}var Ev,ZE;function Yse(){if(ZE)return Ev;ZE=1;function i(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return i.prototype.set=function(e,t,s,r){const n=e*this.size+t;this.data[n]=s,r&&(this.reservedBit[n]=!0)},i.prototype.get=function(e,t){return this.data[e*this.size+t]},i.prototype.xor=function(e,t,s){this.data[e*this.size+t]^=s},i.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},Ev=i,Ev}var Pv={},jE;function Hse(){return jE||(jE=1,(function(i){const e=Ka().getSymbolSize;i.getRowColCoords=function(s){if(s===1)return[];const r=Math.floor(s/7)+2,n=e(s),o=n===145?26:Math.ceil((n-13)/(2*r-2))*2,l=[n-7];for(let c=1;c<r-1;c++)l[c]=l[c-1]-o;return l.push(6),l.reverse()},i.getPositions=function(s){const r=[],n=i.getRowColCoords(s),o=n.length;for(let l=0;l<o;l++)for(let c=0;c<o;c++)l===0&&c===0||l===0&&c===o-1||l===o-1&&c===0||r.push([n[l],n[c]]);return r}})(Pv)),Pv}var Qv={},IE;function Fse(){if(IE)return Qv;IE=1;const i=Ka().getSymbolSize,e=7;return Qv.getPositions=function(s){const r=i(s);return[[0,0],[r-e,0],[0,r-e]]},Qv}var Rv={},qE;function Gse(){return qE||(qE=1,(function(i){i.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};i.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},i.from=function(r){return i.isValid(r)?parseInt(r,10):void 0},i.getPenaltyN1=function(r){const n=r.size;let o=0,l=0,c=0,u=null,d=null;for(let m=0;m<n;m++){l=c=0,u=d=null;for(let g=0;g<n;g++){let _=r.get(m,g);_===u?l++:(l>=5&&(o+=e.N1+(l-5)),u=_,l=1),_=r.get(g,m),_===d?c++:(c>=5&&(o+=e.N1+(c-5)),d=_,c=1)}l>=5&&(o+=e.N1+(l-5)),c>=5&&(o+=e.N1+(c-5))}return o},i.getPenaltyN2=function(r){const n=r.size;let o=0;for(let l=0;l<n-1;l++)for(let c=0;c<n-1;c++){const u=r.get(l,c)+r.get(l,c+1)+r.get(l+1,c)+r.get(l+1,c+1);(u===4||u===0)&&o++}return o*e.N2},i.getPenaltyN3=function(r){const n=r.size;let o=0,l=0,c=0;for(let u=0;u<n;u++){l=c=0;for(let d=0;d<n;d++)l=l<<1&2047|r.get(u,d),d>=10&&(l===1488||l===93)&&o++,c=c<<1&2047|r.get(d,u),d>=10&&(c===1488||c===93)&&o++}return o*e.N3},i.getPenaltyN4=function(r){let n=0;const o=r.data.length;for(let c=0;c<o;c++)n+=r.data[c];return Math.abs(Math.ceil(n*100/o/5)-10)*e.N4};function t(s,r,n){switch(s){case i.Patterns.PATTERN000:return(r+n)%2===0;case i.Patterns.PATTERN001:return r%2===0;case i.Patterns.PATTERN010:return n%3===0;case i.Patterns.PATTERN011:return(r+n)%3===0;case i.Patterns.PATTERN100:return(Math.floor(r/2)+Math.floor(n/3))%2===0;case i.Patterns.PATTERN101:return r*n%2+r*n%3===0;case i.Patterns.PATTERN110:return(r*n%2+r*n%3)%2===0;case i.Patterns.PATTERN111:return(r*n%3+(r+n)%2)%2===0;default:throw new Error("bad maskPattern:"+s)}}i.applyMask=function(r,n){const o=n.size;for(let l=0;l<o;l++)for(let c=0;c<o;c++)n.isReserved(c,l)||n.xor(c,l,t(r,c,l))},i.getBestMask=function(r,n){const o=Object.keys(i.Patterns).length;let l=0,c=1/0;for(let u=0;u<o;u++){n(u),i.applyMask(u,r);const d=i.getPenaltyN1(r)+i.getPenaltyN2(r)+i.getPenaltyN3(r)+i.getPenaltyN4(r);i.applyMask(u,r),d<c&&(c=d,l=u)}return l}})(Rv)),Rv}var $p={},WE;function KD(){if(WE)return $p;WE=1;const i=sx(),e=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],t=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return $p.getBlocksCount=function(r,n){switch(n){case i.L:return e[(r-1)*4+0];case i.M:return e[(r-1)*4+1];case i.Q:return e[(r-1)*4+2];case i.H:return e[(r-1)*4+3];default:return}},$p.getTotalCodewordsCount=function(r,n){switch(n){case i.L:return t[(r-1)*4+0];case i.M:return t[(r-1)*4+1];case i.Q:return t[(r-1)*4+2];case i.H:return t[(r-1)*4+3];default:return}},$p}var Lv={},ru={},UE;function Kse(){if(UE)return ru;UE=1;const i=new Uint8Array(512),e=new Uint8Array(256);return(function(){let s=1;for(let r=0;r<255;r++)i[r]=s,e[s]=r,s<<=1,s&256&&(s^=285);for(let r=255;r<512;r++)i[r]=i[r-255]})(),ru.log=function(s){if(s<1)throw new Error("log("+s+")");return e[s]},ru.exp=function(s){return i[s]},ru.mul=function(s,r){return s===0||r===0?0:i[e[s]+e[r]]},ru}var YE;function Jse(){return YE||(YE=1,(function(i){const e=Kse();i.mul=function(s,r){const n=new Uint8Array(s.length+r.length-1);for(let o=0;o<s.length;o++)for(let l=0;l<r.length;l++)n[o+l]^=e.mul(s[o],r[l]);return n},i.mod=function(s,r){let n=new Uint8Array(s);for(;n.length-r.length>=0;){const o=n[0];for(let c=0;c<r.length;c++)n[c]^=e.mul(r[c],o);let l=0;for(;l<n.length&&n[l]===0;)l++;n=n.slice(l)}return n},i.generateECPolynomial=function(s){let r=new Uint8Array([1]);for(let n=0;n<s;n++)r=i.mul(r,new Uint8Array([1,e.exp(n)]));return r}})(Lv)),Lv}var $v,HE;function ere(){if(HE)return $v;HE=1;const i=Jse();function e(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(s){this.degree=s,this.genPoly=i.generateECPolynomial(this.degree)},e.prototype.encode=function(s){if(!this.genPoly)throw new Error("Encoder not initialized");const r=new Uint8Array(s.length+this.degree);r.set(s);const n=i.mod(r,this.genPoly),o=this.degree-n.length;if(o>0){const l=new Uint8Array(this.degree);return l.set(n,o),l}return n},$v=e,$v}var Bv={},Dv={},zv={},FE;function JD(){return FE||(FE=1,zv.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),zv}var Nr={},GE;function e4(){if(GE)return Nr;GE=1;const i="[0-9]+",e="[A-Z $%*+\\-./:]+";let t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";t=t.replace(/u/g,"\\u");const s="(?:(?![A-Z0-9 $%*+\\-./:]|"+t+`)(?:.|[\r
|
|
203
|
-
]))+`;Nr.KANJI=new RegExp(t,"g"),Nr.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),Nr.BYTE=new RegExp(s,"g"),Nr.NUMERIC=new RegExp(i,"g"),Nr.ALPHANUMERIC=new RegExp(e,"g");const r=new RegExp("^"+t+"$"),n=new RegExp("^"+i+"$"),o=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return Nr.testKanji=function(c){return r.test(c)},Nr.testNumeric=function(c){return n.test(c)},Nr.testAlphanumeric=function(c){return o.test(c)},Nr}var KE;function Ja(){return KE||(KE=1,(function(i){const e=JD(),t=e4();i.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},i.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},i.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},i.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},i.MIXED={bit:-1},i.getCharCountIndicator=function(n,o){if(!n.ccBits)throw new Error("Invalid mode: "+n);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?n.ccBits[0]:o<27?n.ccBits[1]:n.ccBits[2]},i.getBestModeForData=function(n){return t.testNumeric(n)?i.NUMERIC:t.testAlphanumeric(n)?i.ALPHANUMERIC:t.testKanji(n)?i.KANJI:i.BYTE},i.toString=function(n){if(n&&n.id)return n.id;throw new Error("Invalid mode")},i.isValid=function(n){return n&&n.bit&&n.ccBits};function s(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return i.NUMERIC;case"alphanumeric":return i.ALPHANUMERIC;case"kanji":return i.KANJI;case"byte":return i.BYTE;default:throw new Error("Unknown mode: "+r)}}i.from=function(n,o){if(i.isValid(n))return n;try{return s(n)}catch{return o}}})(Dv)),Dv}var JE;function tre(){return JE||(JE=1,(function(i){const e=Ka(),t=KD(),s=sx(),r=Ja(),n=JD(),o=7973,l=e.getBCHDigit(o);function c(g,_,y){for(let b=1;b<=40;b++)if(_<=i.getCapacity(b,y,g))return b}function u(g,_){return r.getCharCountIndicator(g,_)+4}function d(g,_){let y=0;return g.forEach(function(b){const x=u(b.mode,_);y+=x+b.getBitsLength()}),y}function m(g,_){for(let y=1;y<=40;y++)if(d(g,y)<=i.getCapacity(y,_,r.MIXED))return y}i.from=function(_,y){return n.isValid(_)?parseInt(_,10):y},i.getCapacity=function(_,y,b){if(!n.isValid(_))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=r.BYTE);const x=e.getSymbolTotalCodewords(_),w=t.getTotalCodewordsCount(_,y),k=(x-w)*8;if(b===r.MIXED)return k;const C=k-u(b,_);switch(b){case r.NUMERIC:return Math.floor(C/10*3);case r.ALPHANUMERIC:return Math.floor(C/11*2);case r.KANJI:return Math.floor(C/13);case r.BYTE:default:return Math.floor(C/8)}},i.getBestVersionForData=function(_,y){let b;const x=s.from(y,s.M);if(Array.isArray(_)){if(_.length>1)return m(_,x);if(_.length===0)return 1;b=_[0]}else b=_;return c(b.mode,b.getLength(),x)},i.getEncodedBits=function(_){if(!n.isValid(_)||_<7)throw new Error("Invalid QR Code version");let y=_<<12;for(;e.getBCHDigit(y)-l>=0;)y^=o<<e.getBCHDigit(y)-l;return _<<12|y}})(Bv)),Bv}var Nv={},eP;function ire(){if(eP)return Nv;eP=1;const i=Ka(),e=1335,t=21522,s=i.getBCHDigit(e);return Nv.getEncodedBits=function(n,o){const l=n.bit<<3|o;let c=l<<10;for(;i.getBCHDigit(c)-s>=0;)c^=e<<i.getBCHDigit(c)-s;return(l<<10|c)^t},Nv}var Xv={},Vv,tP;function sre(){if(tP)return Vv;tP=1;const i=Ja();function e(t){this.mode=i.NUMERIC,this.data=t.toString()}return e.getBitsLength=function(s){return 10*Math.floor(s/3)+(s%3?s%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(s){let r,n,o;for(r=0;r+3<=this.data.length;r+=3)n=this.data.substr(r,3),o=parseInt(n,10),s.put(o,10);const l=this.data.length-r;l>0&&(n=this.data.substr(r),o=parseInt(n,10),s.put(o,l*3+1))},Vv=e,Vv}var Zv,iP;function rre(){if(iP)return Zv;iP=1;const i=Ja(),e=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function t(s){this.mode=i.ALPHANUMERIC,this.data=s}return t.getBitsLength=function(r){return 11*Math.floor(r/2)+6*(r%2)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(r){let n;for(n=0;n+2<=this.data.length;n+=2){let o=e.indexOf(this.data[n])*45;o+=e.indexOf(this.data[n+1]),r.put(o,11)}this.data.length%2&&r.put(e.indexOf(this.data[n]),6)},Zv=t,Zv}var jv,sP;function nre(){if(sP)return jv;sP=1;const i=Ja();function e(t){this.mode=i.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}return e.getBitsLength=function(s){return s*8},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(t){for(let s=0,r=this.data.length;s<r;s++)t.put(this.data[s],8)},jv=e,jv}var Iv,rP;function ore(){if(rP)return Iv;rP=1;const i=Ja(),e=Ka();function t(s){this.mode=i.KANJI,this.data=s}return t.getBitsLength=function(r){return r*13},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(s){let r;for(r=0;r<this.data.length;r++){let n=e.toSJIS(this.data[r]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[r]+`
|
|
204
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),s.put(n,13)}},Iv=t,Iv}var qv={exports:{}},nP;function are(){return nP||(nP=1,(function(i){var e={single_source_shortest_paths:function(t,s,r){var n={},o={};o[s]=0;var l=e.PriorityQueue.make();l.push(s,0);for(var c,u,d,m,g,_,y,b,x;!l.empty();){c=l.pop(),u=c.value,m=c.cost,g=t[u]||{};for(d in g)g.hasOwnProperty(d)&&(_=g[d],y=m+_,b=o[d],x=typeof o[d]>"u",(x||b>y)&&(o[d]=y,l.push(d,y),n[d]=u))}if(typeof r<"u"&&typeof o[r]>"u"){var w=["Could not find a path from ",s," to ",r,"."].join("");throw new Error(w)}return n},extract_shortest_path_from_predecessor_list:function(t,s){for(var r=[],n=s;n;)r.push(n),t[n],n=t[n];return r.reverse(),r},find_path:function(t,s,r){var n=e.single_source_shortest_paths(t,s,r);return e.extract_shortest_path_from_predecessor_list(n,r)},PriorityQueue:{make:function(t){var s=e.PriorityQueue,r={},n;t=t||{};for(n in s)s.hasOwnProperty(n)&&(r[n]=s[n]);return r.queue=[],r.sorter=t.sorter||s.default_sorter,r},default_sorter:function(t,s){return t.cost-s.cost},push:function(t,s){var r={value:t,cost:s};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};i.exports=e})(qv)),qv.exports}var oP;function lre(){return oP||(oP=1,(function(i){const e=Ja(),t=sre(),s=rre(),r=nre(),n=ore(),o=e4(),l=Ka(),c=are();function u(w){return unescape(encodeURIComponent(w)).length}function d(w,k,C){const A=[];let P;for(;(P=w.exec(C))!==null;)A.push({data:P[0],index:P.index,mode:k,length:P[0].length});return A}function m(w){const k=d(o.NUMERIC,e.NUMERIC,w),C=d(o.ALPHANUMERIC,e.ALPHANUMERIC,w);let A,P;return l.isKanjiModeEnabled()?(A=d(o.BYTE,e.BYTE,w),P=d(o.KANJI,e.KANJI,w)):(A=d(o.BYTE_KANJI,e.BYTE,w),P=[]),k.concat(C,A,P).sort(function($,z){return $.index-z.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function g(w,k){switch(k){case e.NUMERIC:return t.getBitsLength(w);case e.ALPHANUMERIC:return s.getBitsLength(w);case e.KANJI:return n.getBitsLength(w);case e.BYTE:return r.getBitsLength(w)}}function _(w){return w.reduce(function(k,C){const A=k.length-1>=0?k[k.length-1]:null;return A&&A.mode===C.mode?(k[k.length-1].data+=C.data,k):(k.push(C),k)},[])}function y(w){const k=[];for(let C=0;C<w.length;C++){const A=w[C];switch(A.mode){case e.NUMERIC:k.push([A,{data:A.data,mode:e.ALPHANUMERIC,length:A.length},{data:A.data,mode:e.BYTE,length:A.length}]);break;case e.ALPHANUMERIC:k.push([A,{data:A.data,mode:e.BYTE,length:A.length}]);break;case e.KANJI:k.push([A,{data:A.data,mode:e.BYTE,length:u(A.data)}]);break;case e.BYTE:k.push([{data:A.data,mode:e.BYTE,length:u(A.data)}])}}return k}function b(w,k){const C={},A={start:{}};let P=["start"];for(let E=0;E<w.length;E++){const $=w[E],z=[];for(let I=0;I<$.length;I++){const se=$[I],F=""+E+I;z.push(F),C[F]={node:se,lastCount:0},A[F]={};for(let R=0;R<P.length;R++){const L=P[R];C[L]&&C[L].node.mode===se.mode?(A[L][F]=g(C[L].lastCount+se.length,se.mode)-g(C[L].lastCount,se.mode),C[L].lastCount+=se.length):(C[L]&&(C[L].lastCount=se.length),A[L][F]=g(se.length,se.mode)+4+e.getCharCountIndicator(se.mode,k))}}P=z}for(let E=0;E<P.length;E++)A[P[E]].end=0;return{map:A,table:C}}function x(w,k){let C;const A=e.getBestModeForData(w);if(C=e.from(k,A),C!==e.BYTE&&C.bit<A.bit)throw new Error('"'+w+'" cannot be encoded with mode '+e.toString(C)+`.
|
|
205
|
-
Suggested mode is: `+e.toString(A));switch(C===e.KANJI&&!l.isKanjiModeEnabled()&&(C=e.BYTE),C){case e.NUMERIC:return new t(w);case e.ALPHANUMERIC:return new s(w);case e.KANJI:return new n(w);case e.BYTE:return new r(w)}}i.fromArray=function(k){return k.reduce(function(C,A){return typeof A=="string"?C.push(x(A,null)):A.data&&C.push(x(A.data,A.mode)),C},[])},i.fromString=function(k,C){const A=m(k,l.isKanjiModeEnabled()),P=y(A),E=b(P,C),$=c.find_path(E.map,"start","end"),z=[];for(let I=1;I<$.length-1;I++)z.push(E.table[$[I]].node);return i.fromArray(_(z))},i.rawSplit=function(k){return i.fromArray(m(k,l.isKanjiModeEnabled()))}})(Xv)),Xv}var aP;function hre(){if(aP)return Tv;aP=1;const i=Ka(),e=sx(),t=Use(),s=Yse(),r=Hse(),n=Fse(),o=Gse(),l=KD(),c=ere(),u=tre(),d=ire(),m=Ja(),g=lre();function _(E,$){const z=E.size,I=n.getPositions($);for(let se=0;se<I.length;se++){const F=I[se][0],R=I[se][1];for(let L=-1;L<=7;L++)if(!(F+L<=-1||z<=F+L))for(let N=-1;N<=7;N++)R+N<=-1||z<=R+N||(L>=0&&L<=6&&(N===0||N===6)||N>=0&&N<=6&&(L===0||L===6)||L>=2&&L<=4&&N>=2&&N<=4?E.set(F+L,R+N,!0,!0):E.set(F+L,R+N,!1,!0))}}function y(E){const $=E.size;for(let z=8;z<$-8;z++){const I=z%2===0;E.set(z,6,I,!0),E.set(6,z,I,!0)}}function b(E,$){const z=r.getPositions($);for(let I=0;I<z.length;I++){const se=z[I][0],F=z[I][1];for(let R=-2;R<=2;R++)for(let L=-2;L<=2;L++)R===-2||R===2||L===-2||L===2||R===0&&L===0?E.set(se+R,F+L,!0,!0):E.set(se+R,F+L,!1,!0)}}function x(E,$){const z=E.size,I=u.getEncodedBits($);let se,F,R;for(let L=0;L<18;L++)se=Math.floor(L/3),F=L%3+z-8-3,R=(I>>L&1)===1,E.set(se,F,R,!0),E.set(F,se,R,!0)}function w(E,$,z){const I=E.size,se=d.getEncodedBits($,z);let F,R;for(F=0;F<15;F++)R=(se>>F&1)===1,F<6?E.set(F,8,R,!0):F<8?E.set(F+1,8,R,!0):E.set(I-15+F,8,R,!0),F<8?E.set(8,I-F-1,R,!0):F<9?E.set(8,15-F-1+1,R,!0):E.set(8,15-F-1,R,!0);E.set(I-8,8,1,!0)}function k(E,$){const z=E.size;let I=-1,se=z-1,F=7,R=0;for(let L=z-1;L>0;L-=2)for(L===6&&L--;;){for(let N=0;N<2;N++)if(!E.isReserved(se,L-N)){let Z=!1;R<$.length&&(Z=($[R]>>>F&1)===1),E.set(se,L-N,Z),F--,F===-1&&(R++,F=7)}if(se+=I,se<0||z<=se){se-=I,I=-I;break}}}function C(E,$,z){const I=new t;z.forEach(function(N){I.put(N.mode.bit,4),I.put(N.getLength(),m.getCharCountIndicator(N.mode,E)),N.write(I)});const se=i.getSymbolTotalCodewords(E),F=l.getTotalCodewordsCount(E,$),R=(se-F)*8;for(I.getLengthInBits()+4<=R&&I.put(0,4);I.getLengthInBits()%8!==0;)I.putBit(0);const L=(R-I.getLengthInBits())/8;for(let N=0;N<L;N++)I.put(N%2?17:236,8);return A(I,E,$)}function A(E,$,z){const I=i.getSymbolTotalCodewords($),se=l.getTotalCodewordsCount($,z),F=I-se,R=l.getBlocksCount($,z),L=I%R,N=R-L,Z=Math.floor(I/R),Q=Math.floor(F/R),X=Q+1,W=Z-Q,U=new c(W);let q=0;const D=new Array(R),G=new Array(R);let ie=0;const ce=new Uint8Array(E.buffer);for(let ye=0;ye<R;ye++){const mt=ye<N?Q:X;D[ye]=ce.slice(q,q+mt),G[ye]=U.encode(D[ye]),q+=mt,ie=Math.max(ie,mt)}const he=new Uint8Array(I);let de=0,ge,Ae;for(ge=0;ge<ie;ge++)for(Ae=0;Ae<R;Ae++)ge<D[Ae].length&&(he[de++]=D[Ae][ge]);for(ge=0;ge<W;ge++)for(Ae=0;Ae<R;Ae++)he[de++]=G[Ae][ge];return he}function P(E,$,z,I){let se;if(Array.isArray(E))se=g.fromArray(E);else if(typeof E=="string"){let Z=$;if(!Z){const Q=g.rawSplit(E);Z=u.getBestVersionForData(Q,z)}se=g.fromString(E,Z||40)}else throw new Error("Invalid data");const F=u.getBestVersionForData(se,z);if(!F)throw new Error("The amount of data is too big to be stored in a QR Code");if(!$)$=F;else if($<F)throw new Error(`
|
|
206
|
-
The chosen QR Code version cannot contain this amount of data.
|
|
207
|
-
Minimum version required to store current data is: `+F+`.
|
|
208
|
-
`);const R=C($,z,se),L=i.getSymbolSize($),N=new s(L);return _(N,$),y(N),b(N,$),w(N,z,0),$>=7&&x(N,$),k(N,R),isNaN(I)&&(I=o.getBestMask(N,w.bind(null,N,z))),o.applyMask(I,N),w(N,z,I),{modules:N,version:$,errorCorrectionLevel:z,maskPattern:I,segments:se}}return Tv.create=function($,z){if(typeof $>"u"||$==="")throw new Error("No input text");let I=e.M,se,F;return typeof z<"u"&&(I=e.from(z.errorCorrectionLevel,e.M),se=u.from(z.version),F=o.from(z.maskPattern),z.toSJISFunc&&i.setToSJISFunction(z.toSJISFunc)),P($,se,I,F)},Tv}var Wv={},Uv={},lP;function t4(){return lP||(lP=1,(function(i){function e(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let s=t.slice().replace("#","").split("");if(s.length<3||s.length===5||s.length>8)throw new Error("Invalid hex color: "+t);(s.length===3||s.length===4)&&(s=Array.prototype.concat.apply([],s.map(function(n){return[n,n]}))),s.length===6&&s.push("F","F");const r=parseInt(s.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+s.slice(0,6).join("")}}i.getOptions=function(s){s||(s={}),s.color||(s.color={});const r=typeof s.margin>"u"||s.margin===null||s.margin<0?4:s.margin,n=s.width&&s.width>=21?s.width:void 0,o=s.scale||4;return{width:n,scale:n?4:o,margin:r,color:{dark:e(s.color.dark||"#000000ff"),light:e(s.color.light||"#ffffffff")},type:s.type,rendererOpts:s.rendererOpts||{}}},i.getScale=function(s,r){return r.width&&r.width>=s+r.margin*2?r.width/(s+r.margin*2):r.scale},i.getImageWidth=function(s,r){const n=i.getScale(s,r);return Math.floor((s+r.margin*2)*n)},i.qrToImageData=function(s,r,n){const o=r.modules.size,l=r.modules.data,c=i.getScale(o,n),u=Math.floor((o+n.margin*2)*c),d=n.margin*c,m=[n.color.light,n.color.dark];for(let g=0;g<u;g++)for(let _=0;_<u;_++){let y=(g*u+_)*4,b=n.color.light;if(g>=d&&_>=d&&g<u-d&&_<u-d){const x=Math.floor((g-d)/c),w=Math.floor((_-d)/c);b=m[l[x*o+w]?1:0]}s[y++]=b.r,s[y++]=b.g,s[y++]=b.b,s[y]=b.a}}})(Uv)),Uv}var hP;function cre(){return hP||(hP=1,(function(i){const e=t4();function t(r,n,o){r.clearRect(0,0,n.width,n.height),n.style||(n.style={}),n.height=o,n.width=o,n.style.height=o+"px",n.style.width=o+"px"}function s(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}i.render=function(n,o,l){let c=l,u=o;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),o||(u=s()),c=e.getOptions(c);const d=e.getImageWidth(n.modules.size,c),m=u.getContext("2d"),g=m.createImageData(d,d);return e.qrToImageData(g.data,n,c),t(m,u,d),m.putImageData(g,0,0),u},i.renderToDataURL=function(n,o,l){let c=l;typeof c>"u"&&(!o||!o.getContext)&&(c=o,o=void 0),c||(c={});const u=i.render(n,o,c),d=c.type||"image/png",m=c.rendererOpts||{};return u.toDataURL(d,m.quality)}})(Wv)),Wv}var Yv={},cP;function ure(){if(cP)return Yv;cP=1;const i=t4();function e(r,n){const o=r.a/255,l=n+'="'+r.hex+'"';return o<1?l+" "+n+'-opacity="'+o.toFixed(2).slice(1)+'"':l}function t(r,n,o){let l=r+n;return typeof o<"u"&&(l+=" "+o),l}function s(r,n,o){let l="",c=0,u=!1,d=0;for(let m=0;m<r.length;m++){const g=Math.floor(m%n),_=Math.floor(m/n);!g&&!u&&(u=!0),r[m]?(d++,m>0&&g>0&&r[m-1]||(l+=u?t("M",g+o,.5+_+o):t("m",c,0),c=0,u=!1),g+1<n&&r[m+1]||(l+=t("h",d),d=0)):c++}return l}return Yv.render=function(n,o,l){const c=i.getOptions(o),u=n.modules.size,d=n.modules.data,m=u+c.margin*2,g=c.color.light.a?"<path "+e(c.color.light,"fill")+' d="M0 0h'+m+"v"+m+'H0z"/>':"",_="<path "+e(c.color.dark,"stroke")+' d="'+s(d,u,c.margin)+'"/>',y='viewBox="0 0 '+m+" "+m+'"',x='<svg xmlns="http://www.w3.org/2000/svg" '+(c.width?'width="'+c.width+'" height="'+c.width+'" ':"")+y+' shape-rendering="crispEdges">'+g+_+`</svg>
|
|
209
|
-
`;return typeof l=="function"&&l(null,x),x},Yv}var uP;function fre(){if(uP)return jl;uP=1;const i=Wse(),e=hre(),t=cre(),s=ure();function r(n,o,l,c,u){const d=[].slice.call(arguments,1),m=d.length,g=typeof d[m-1]=="function";if(!g&&!i())throw new Error("Callback required as last argument");if(g){if(m<2)throw new Error("Too few arguments provided");m===2?(u=l,l=o,o=c=void 0):m===3&&(o.getContext&&typeof u>"u"?(u=c,c=void 0):(u=c,c=l,l=o,o=void 0))}else{if(m<1)throw new Error("Too few arguments provided");return m===1?(l=o,o=c=void 0):m===2&&!o.getContext&&(c=l,l=o,o=void 0),new Promise(function(_,y){try{const b=e.create(l,c);_(n(b,o,c))}catch(b){y(b)}})}try{const _=e.create(l,c);u(null,n(_,o,c))}catch(_){u(_)}}return jl.create=e.create,jl.toCanvas=r.bind(null,t.render),jl.toDataURL=r.bind(null,t.renderToDataURL),jl.toString=r.bind(null,function(n,o,l){return s.render(n,l)}),jl}var dre=fre();const pre=Cz(dre);function mre(){const[i,e]=Y.useState(null),[t,s]=Y.useState(!1),[r,n]=Y.useState(null);return Y.useEffect(()=>{fetch("/api/server-info").then(o=>o.json()).then(o=>e(o)).catch(()=>{})},[]),Y.useEffect(()=>{i!=null&&i.networkUrl&&pre.toDataURL(i.networkUrl,{width:200,margin:2}).then(n).catch(()=>{})},[i==null?void 0:i.networkUrl]),!(i!=null&&i.networkEnabled)||!i.networkUrl?null:M.jsxs("div",{className:"fixed bottom-4 right-4 z-50",children:[t&&M.jsxs("div",{className:"mb-2 rounded-lg border border-border bg-background p-4 shadow-xl",children:[M.jsx("p",{className:"mb-1 font-mono text-[10px] text-muted-foreground",children:"Local Network"}),M.jsx("p",{className:"mb-3 font-mono text-xs text-foreground",children:i.networkUrl}),r&&M.jsx("img",{src:r,alt:"QR code for local network access",width:200,height:200,className:"rounded-sm"})]}),M.jsxs("button",{type:"button",onClick:()=>s(o=>!o),title:t?"Close QR code":"Open on another device",className:"flex items-center gap-1.5 rounded-lg border border-border bg-background px-3 py-2 font-mono text-xs text-foreground shadow-md transition-colors hover:bg-muted",children:[M.jsx(gre,{}),"Share"]})]})}function gre(){return M.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[M.jsx("rect",{x:"3",y:"3",width:"7",height:"7"}),M.jsx("rect",{x:"14",y:"3",width:"7",height:"7"}),M.jsx("rect",{x:"3",y:"14",width:"7",height:"7"}),M.jsx("rect",{x:"14",y:"14",width:"3",height:"3"}),M.jsx("line",{x1:"14",y1:"20",x2:"20",y2:"20"}),M.jsx("line",{x1:"20",y1:"14",x2:"20",y2:"17"})]})}function Ore(){return M.jsxs("div",{className:"flex flex-col gap-6",children:[M.jsxs("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[M.jsx("div",{className:"h-3 w-40 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-2 w-full animate-pulse rounded-sm bg-muted"}),M.jsxs("div",{className:"flex gap-8",children:[M.jsx("div",{className:"h-8 w-20 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-8 w-32 animate-pulse rounded-sm bg-muted"}),M.jsxs("div",{className:"ml-auto flex gap-6",children:[M.jsx("div",{className:"h-6 w-24 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-6 w-20 animate-pulse rounded-sm bg-muted"})]})]})]}),M.jsxs("div",{className:"flex flex-col gap-3",children:[M.jsxs("div",{className:"flex justify-between px-4",children:[M.jsx("div",{className:"h-3 w-16 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-3 w-6 animate-pulse rounded-sm bg-muted"})]}),Array.from({length:6}).map((i,e)=>M.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3",children:[M.jsxs("div",{className:"flex gap-3",children:[M.jsx("div",{className:"h-4 w-4 animate-pulse rounded-full bg-muted"}),M.jsx("div",{className:"h-4 w-8 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-4 w-40 animate-pulse rounded-sm bg-muted"})]}),M.jsx("div",{className:"h-1.5 w-full animate-pulse rounded-sm bg-muted"})]},e))]})]})}function _re({message:i,onRetry:e}){return M.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-4",children:[M.jsx("p",{className:"font-mono text-sm text-danger",children:i}),M.jsx("button",{type:"button",onClick:e,className:"rounded-sm bg-accent px-4 py-2 font-mono text-xs text-foreground transition-colors hover:bg-accent-glow",children:"Retry"})]})}function vre(){const{roadmap:i,state:e,todos:t,loading:s,error:r}=fb(),[n,o]=Y.useState("overview"),[l,c]=Y.useState(null),{splitMode:u,toggleSplit:d}=Ise(),m=Y.useRef({view:"overview",phaseId:null}),g=Y.useCallback((A,P)=>{A!=="terminal"&&(m.current={view:A,phaseId:A==="phase"&&P?P:null}),o(A),A==="phase"&&P&&c(P)},[]),_=Y.useCallback(A=>{o("phase"),c(A)},[]),y=Y.useCallback(()=>{o("overview"),c(null)},[]),b=Y.useCallback(async(A,P)=>{try{const E=await fetch("/api/roadmap",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({phaseNumber:A,checked:P})});E.ok||console.error("[toggle-phase]",await E.text())}catch(E){console.error("[toggle-phase]",E)}},[]),x=((i==null?void 0:i.phases)??[]).map(A=>({number:A.number,name:A.name,goal:A.goal??"",dependsOn:A.depends_on?[A.depends_on]:[],planCount:A.plan_count,summaryCount:A.summary_count,diskStatus:A.disk_status,roadmapComplete:A.roadmap_complete,hasContext:A.has_context,hasResearch:A.has_research})),w=(i==null?void 0:i.current_phase)??null;function k(){if(s)return M.jsx(Ore,{});if(r)return M.jsx(_re,{message:r,onRetry:()=>window.location.reload()});switch(n){case"overview":return M.jsxs("div",{className:"mx-auto flex max-w-4xl flex-col gap-6",children:[M.jsx(EV,{roadmap:i,state:e,todos:t}),M.jsx(LV,{phases:x,currentPhase:w,onPhaseClick:_,onToggleComplete:b})]});case"phase":return l?M.jsx("div",{className:"mx-auto max-w-4xl",children:M.jsx(CK,{phaseId:l,onBack:y})}):null;case"todos":return M.jsx("div",{className:"mx-auto max-w-3xl",children:M.jsx(kK,{})});case"blockers":return M.jsx("div",{className:"mx-auto max-w-3xl",children:M.jsx(MK,{})});case"terminal":return null;default:return null}}const C=n==="terminal";return M.jsxs(EK,{sidebar:M.jsx(QK,{activeView:n,activePhaseId:l,onNavigate:g}),children:[M.jsx("div",{style:{display:C&&!u?"none":"block"},className:C&&u?"h-1/2 min-h-0 overflow-auto border-b border-border p-6":"flex-1 overflow-y-auto p-6",children:k()}),M.jsxs("div",{style:{display:C?"flex":"none"},className:`relative min-h-0 flex-col overflow-hidden ${C&&u?"h-1/2":"flex-1"}`,children:[M.jsx(qse,{splitMode:u,onToggle:d}),M.jsx(jse,{})]}),M.jsx(mre,{})]})}function yre(){return M.jsx(zz,{children:M.jsx(vre,{})})}const i4=document.getElementById("root");if(!i4)throw new Error("Root element not found");$z.createRoot(i4).render(M.jsx(Y.StrictMode,{children:M.jsx(yre,{})}));
|
|
207
|
+
*/var Oi=0,_i=0,vi=0,Rt=0,Zi;(i=>{function e(r,n,o,l){return l!==void 0?`#${Sa(r)}${Sa(n)}${Sa(o)}${Sa(l)}`:`#${Sa(r)}${Sa(n)}${Sa(o)}`}i.toCss=e;function t(r,n,o,l=255){return(r<<24|n<<16|o<<8|l)>>>0}i.toRgba=t;function s(r,n,o,l){return{css:i.toCss(r,n,o,l),rgba:i.toRgba(r,n,o,l)}}i.toColor=s})(Zi||(Zi={}));var Gse;(i=>{function e(c,u){if(Rt=(u.rgba&255)/255,Rt===1)return{css:u.css,rgba:u.rgba};let d=u.rgba>>24&255,m=u.rgba>>16&255,g=u.rgba>>8&255,_=c.rgba>>24&255,y=c.rgba>>16&255,b=c.rgba>>8&255;Oi=_+Math.round((d-_)*Rt),_i=y+Math.round((m-y)*Rt),vi=b+Math.round((g-b)*Rt);let x=Zi.toCss(Oi,_i,vi),w=Zi.toRgba(Oi,_i,vi);return{css:x,rgba:w}}i.blend=e;function t(c){return(c.rgba&255)===255}i.isOpaque=t;function s(c,u,d){let m=hm.ensureContrastRatio(c.rgba,u.rgba,d);if(m)return Zi.toColor(m>>24&255,m>>16&255,m>>8&255)}i.ensureContrastRatio=s;function r(c){let u=(c.rgba|255)>>>0;return[Oi,_i,vi]=hm.toChannels(u),{css:Zi.toCss(Oi,_i,vi),rgba:u}}i.opaque=r;function n(c,u){return Rt=Math.round(u*255),[Oi,_i,vi]=hm.toChannels(c.rgba),{css:Zi.toCss(Oi,_i,vi,Rt),rgba:Zi.toRgba(Oi,_i,vi,Rt)}}i.opacity=n;function o(c,u){return Rt=c.rgba&255,n(c,Rt*u/255)}i.multiplyOpacity=o;function l(c){return[c.rgba>>24&255,c.rgba>>16&255,c.rgba>>8&255]}i.toColorRGB=l})(Gse||(Gse={}));var Ei;(i=>{let e,t;try{let r=document.createElement("canvas");r.width=1,r.height=1;let n=r.getContext("2d",{willReadFrequently:!0});n&&(e=n,e.globalCompositeOperation="copy",t=e.createLinearGradient(0,0,1,1))}catch{}function s(r){if(r.match(/#[\da-f]{3,8}/i))switch(r.length){case 4:return Oi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),Zi.toColor(Oi,_i,vi);case 5:return Oi=parseInt(r.slice(1,2).repeat(2),16),_i=parseInt(r.slice(2,3).repeat(2),16),vi=parseInt(r.slice(3,4).repeat(2),16),Rt=parseInt(r.slice(4,5).repeat(2),16),Zi.toColor(Oi,_i,vi,Rt);case 7:return{css:r,rgba:(parseInt(r.slice(1),16)<<8|255)>>>0};case 9:return{css:r,rgba:parseInt(r.slice(1),16)>>>0}}let n=r.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(n)return Oi=parseInt(n[1]),_i=parseInt(n[2]),vi=parseInt(n[3]),Rt=Math.round((n[5]===void 0?1:parseFloat(n[5]))*255),Zi.toColor(Oi,_i,vi,Rt);if(!e||!t)throw new Error("css.toColor: Unsupported css format");if(e.fillStyle=t,e.fillStyle=r,typeof e.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(e.fillRect(0,0,1,1),[Oi,_i,vi,Rt]=e.getImageData(0,0,1,1).data,Rt!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:Zi.toRgba(Oi,_i,vi,Rt),css:r}}i.toColor=s})(Ei||(Ei={}));var Fi;(i=>{function e(s){return t(s>>16&255,s>>8&255,s&255)}i.relativeLuminance=e;function t(s,r,n){let o=s/255,l=r/255,c=n/255,u=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4),m=c<=.03928?c/12.92:Math.pow((c+.055)/1.055,2.4);return u*.2126+d*.7152+m*.0722}i.relativeLuminance2=t})(Fi||(Fi={}));var hm;(i=>{function e(o,l){if(Rt=(l&255)/255,Rt===1)return l;let c=l>>24&255,u=l>>16&255,d=l>>8&255,m=o>>24&255,g=o>>16&255,_=o>>8&255;return Oi=m+Math.round((c-m)*Rt),_i=g+Math.round((u-g)*Rt),vi=_+Math.round((d-_)*Rt),Zi.toRgba(Oi,_i,vi)}i.blend=e;function t(o,l,c){let u=Fi.relativeLuminance(o>>8),d=Fi.relativeLuminance(l>>8);if(Rn(u,d)<c){if(d<u){let _=s(o,l,c),y=Rn(u,Fi.relativeLuminance(_>>8));if(y<c){let b=r(o,l,c),x=Rn(u,Fi.relativeLuminance(b>>8));return y>x?_:b}return _}let m=r(o,l,c),g=Rn(u,Fi.relativeLuminance(m>>8));if(g<c){let _=s(o,l,c),y=Rn(u,Fi.relativeLuminance(_>>8));return g>y?m:_}return m}}i.ensureContrastRatio=t;function s(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Rn(Fi.relativeLuminance2(g,_,y),Fi.relativeLuminance2(u,d,m));for(;b<c&&(g>0||_>0||y>0);)g-=Math.max(0,Math.ceil(g*.1)),_-=Math.max(0,Math.ceil(_*.1)),y-=Math.max(0,Math.ceil(y*.1)),b=Rn(Fi.relativeLuminance2(g,_,y),Fi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.reduceLuminance=s;function r(o,l,c){let u=o>>24&255,d=o>>16&255,m=o>>8&255,g=l>>24&255,_=l>>16&255,y=l>>8&255,b=Rn(Fi.relativeLuminance2(g,_,y),Fi.relativeLuminance2(u,d,m));for(;b<c&&(g<255||_<255||y<255);)g=Math.min(255,g+Math.ceil((255-g)*.1)),_=Math.min(255,_+Math.ceil((255-_)*.1)),y=Math.min(255,y+Math.ceil((255-y)*.1)),b=Rn(Fi.relativeLuminance2(g,_,y),Fi.relativeLuminance2(u,d,m));return(g<<24|_<<16|y<<8|255)>>>0}i.increaseLuminance=r;function n(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}i.toChannels=n})(hm||(hm={}));function Sa(i){let e=i.toString(16);return e.length<2?"0"+e:e}function Rn(i,e){return i<e?(e+.05)/(i+.05):(i+.05)/(e+.05)}var Kse=Object.freeze((()=>{let i=[Ei.toColor("#2e3436"),Ei.toColor("#cc0000"),Ei.toColor("#4e9a06"),Ei.toColor("#c4a000"),Ei.toColor("#3465a4"),Ei.toColor("#75507b"),Ei.toColor("#06989a"),Ei.toColor("#d3d7cf"),Ei.toColor("#555753"),Ei.toColor("#ef2929"),Ei.toColor("#8ae234"),Ei.toColor("#fce94f"),Ei.toColor("#729fcf"),Ei.toColor("#ad7fa8"),Ei.toColor("#34e2e2"),Ei.toColor("#eeeeec")],e=[0,95,135,175,215,255];for(let t=0;t<216;t++){let s=e[t/36%6|0],r=e[t/6%6|0],n=e[t%6];i.push({css:Zi.toCss(s,r,n),rgba:Zi.toRgba(s,r,n)})}for(let t=0;t<24;t++){let s=8+t*10;i.push({css:Zi.toCss(s,s,s),rgba:Zi.toRgba(s,s,s)})}return i})());function uP(i,e,t){return Math.max(e,Math.min(i,t))}function Jse(i){switch(i){case"&":return"&";case"<":return"<"}return i}var KD=class{constructor(i){this._buffer=i}serialize(i,e){let t=this._buffer.getNullCell(),s=this._buffer.getNullCell(),r=t,n=i.start.y,o=i.end.y,l=i.start.x,c=i.end.x;this._beforeSerialize(o-n,n,o);for(let u=n;u<=o;u++){let d=this._buffer.getLine(u);if(d){let m=u===i.start.y?l:0,g=u===i.end.y?c:d.length;for(let _=m;_<g;_++){let y=d.getCell(_,r===t?s:t);if(!y){console.warn(`Can't get cell at row=${u}, col=${_}`);continue}this._nextCell(y,r,u,_),r=y}}this._rowEnd(u,u===o)}return this._afterSerialize(),this._serializeString(e)}_nextCell(i,e,t,s){}_rowEnd(i,e){}_beforeSerialize(i,e,t){}_afterSerialize(){}_serializeString(i){return""}};function JD(i,e){return i.getFgColorMode()===e.getFgColorMode()&&i.getFgColor()===e.getFgColor()}function Ln(i,e){return i.getBgColorMode()===e.getBgColorMode()&&i.getBgColor()===e.getBgColor()}function e4(i,e){return i.isInverse()===e.isInverse()&&i.isBold()===e.isBold()&&i.isUnderline()===e.isUnderline()&&i.isOverline()===e.isOverline()&&i.isBlink()===e.isBlink()&&i.isInvisible()===e.isInvisible()&&i.isItalic()===e.isItalic()&&i.isDim()===e.isDim()&&i.isStrikethrough()===e.isStrikethrough()}var ere=class extends KD{constructor(i,e){super(i),this._terminal=e,this._rowIndex=0,this._allRows=new Array,this._allRowSeparators=new Array,this._currentRow="",this._nullCellCount=0,this._cursorStyle=this._buffer.getNullCell(),this._cursorStyleRow=0,this._cursorStyleCol=0,this._backgroundCell=this._buffer.getNullCell(),this._firstRow=0,this._lastCursorRow=0,this._lastCursorCol=0,this._lastContentCursorRow=0,this._lastContentCursorCol=0,this._thisRowLastChar=this._buffer.getNullCell(),this._thisRowLastSecondChar=this._buffer.getNullCell(),this._nextRowFirstChar=this._buffer.getNullCell()}_beforeSerialize(i,e,t){this._allRows=new Array(i),this._lastContentCursorRow=e,this._lastCursorRow=e,this._firstRow=e}_rowEnd(i,e){var s;this._nullCellCount>0&&!Ln(this._cursorStyle,this._backgroundCell)&&(this._currentRow+=`\x1B[${this._nullCellCount}X`);let t="";if(!e){i-this._firstRow>=this._terminal.rows&&((s=this._buffer.getLine(this._cursorStyleRow))==null||s.getCell(this._cursorStyleCol,this._backgroundCell));let r=this._buffer.getLine(i),n=this._buffer.getLine(i+1);if(!n.isWrapped)t=`\r
|
|
208
|
+
`,this._lastCursorRow=i+1,this._lastCursorCol=0;else{t="";let o=r.getCell(r.length-1,this._thisRowLastChar),l=r.getCell(r.length-2,this._thisRowLastSecondChar),c=n.getCell(0,this._nextRowFirstChar),u=c.getWidth()>1,d=!1;(c.getChars()&&u?this._nullCellCount<=1:this._nullCellCount<=0)&&((o.getChars()||o.getWidth()===0)&&Ln(o,c)&&(d=!0),u&&(l.getChars()||l.getWidth()===0)&&Ln(o,c)&&Ln(l,c)&&(d=!0)),d||(t="-".repeat(this._nullCellCount+1),t+="\x1B[1D\x1B[1X",this._nullCellCount>0&&(t+="\x1B[A",t+=`\x1B[${r.length-this._nullCellCount}C`,t+=`\x1B[${this._nullCellCount}X`,t+=`\x1B[${r.length-this._nullCellCount}D`,t+="\x1B[B"),this._lastContentCursorRow=i+1,this._lastContentCursorCol=0,this._lastCursorRow=i+1,this._lastCursorCol=0)}}this._allRows[this._rowIndex]=this._currentRow,this._allRowSeparators[this._rowIndex++]=t,this._currentRow="",this._nullCellCount=0}_diffStyle(i,e){let t=[],s=!JD(i,e),r=!Ln(i,e),n=!e4(i,e);if(s||r||n)if(i.isAttributeDefault())e.isAttributeDefault()||t.push(0);else{if(s){let o=i.getFgColor();i.isFgRGB()?t.push(38,2,o>>>16&255,o>>>8&255,o&255):i.isFgPalette()?o>=16?t.push(38,5,o):t.push(o&8?90+(o&7):30+(o&7)):t.push(39)}if(r){let o=i.getBgColor();i.isBgRGB()?t.push(48,2,o>>>16&255,o>>>8&255,o&255):i.isBgPalette()?o>=16?t.push(48,5,o):t.push(o&8?100+(o&7):40+(o&7)):t.push(49)}n&&(i.isInverse()!==e.isInverse()&&t.push(i.isInverse()?7:27),i.isBold()!==e.isBold()&&t.push(i.isBold()?1:22),i.isUnderline()!==e.isUnderline()&&t.push(i.isUnderline()?4:24),i.isOverline()!==e.isOverline()&&t.push(i.isOverline()?53:55),i.isBlink()!==e.isBlink()&&t.push(i.isBlink()?5:25),i.isInvisible()!==e.isInvisible()&&t.push(i.isInvisible()?8:28),i.isItalic()!==e.isItalic()&&t.push(i.isItalic()?3:23),i.isDim()!==e.isDim()&&t.push(i.isDim()?2:22),i.isStrikethrough()!==e.isStrikethrough()&&t.push(i.isStrikethrough()?9:29))}return t}_nextCell(i,e,t,s){if(i.getWidth()===0)return;let r=i.getChars()==="",n=this._diffStyle(i,this._cursorStyle);if(r?!Ln(this._cursorStyle,i):n.length>0){this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)||(this._currentRow+=`\x1B[${this._nullCellCount}X`),this._currentRow+=`\x1B[${this._nullCellCount}C`,this._nullCellCount=0),this._lastContentCursorRow=this._lastCursorRow=t,this._lastContentCursorCol=this._lastCursorCol=s,this._currentRow+=`\x1B[${n.join(";")}m`;let o=this._buffer.getLine(t);o!==void 0&&(o.getCell(s,this._cursorStyle),this._cursorStyleRow=t,this._cursorStyleCol=s)}r?this._nullCellCount+=i.getWidth():(this._nullCellCount>0&&(Ln(this._cursorStyle,this._backgroundCell)?this._currentRow+=`\x1B[${this._nullCellCount}C`:(this._currentRow+=`\x1B[${this._nullCellCount}X`,this._currentRow+=`\x1B[${this._nullCellCount}C`),this._nullCellCount=0),this._currentRow+=i.getChars(),this._lastContentCursorRow=this._lastCursorRow=t,this._lastContentCursorCol=this._lastCursorCol=s+i.getWidth())}_serializeString(i){let e=this._allRows.length;this._buffer.length-this._firstRow<=this._terminal.rows&&(e=this._lastContentCursorRow+1-this._firstRow,this._lastCursorCol=this._lastContentCursorCol,this._lastCursorRow=this._lastContentCursorRow);let t="";for(let n=0;n<e;n++)t+=this._allRows[n],n+1<e&&(t+=this._allRowSeparators[n]);if(!i){let n=this._buffer.baseY+this._buffer.cursorY,o=this._buffer.cursorX,l=n!==this._lastCursorRow||o!==this._lastCursorCol,c=u=>{u>0?t+=`\x1B[${u}C`:u<0&&(t+=`\x1B[${-u}D`)};l&&((u=>{u>0?t+=`\x1B[${u}B`:u<0&&(t+=`\x1B[${-u}A`)})(n-this._lastCursorRow),c(o-this._lastCursorCol))}let s=this._terminal._core._inputHandler._curAttrData,r=this._diffStyle(s,this._cursorStyle);return r.length>0&&(t+=`\x1B[${r.join(";")}m`),t}},tre=class{activate(i){this._terminal=i}_serializeBufferByScrollback(i,e,t){let s=e.length,r=t===void 0?s:uP(t+i.rows,0,s);return this._serializeBufferByRange(i,e,{start:s-r,end:s-1},!1)}_serializeBufferByRange(i,e,t,s){return new ere(e,i).serialize({start:{x:0,y:typeof t.start=="number"?t.start:t.start.line},end:{x:i.cols,y:typeof t.end=="number"?t.end:t.end.line}},s)}_serializeBufferAsHTML(i,e){var l;let t=i.buffer.active,s=new ire(t,i,e),r=e.onlySelection??!1,n=e.range;if(n)return s.serialize({start:{x:n.startCol,y:(n.startLine,n.startLine)},end:{x:i.cols,y:(n.endLine,n.endLine)}});if(!r){let c=t.length,u=e.scrollback,d=u===void 0?c:uP(u+i.rows,0,c);return s.serialize({start:{x:0,y:c-d},end:{x:i.cols,y:c-1}})}let o=(l=this._terminal)==null?void 0:l.getSelectionPosition();return o!==void 0?s.serialize({start:{x:o.start.x,y:o.start.y},end:{x:o.end.x,y:o.end.y}}):""}_serializeModes(i){let e="",t=i.modes;if(t.applicationCursorKeysMode&&(e+="\x1B[?1h"),t.applicationKeypadMode&&(e+="\x1B[?66h"),t.bracketedPasteMode&&(e+="\x1B[?2004h"),t.insertMode&&(e+="\x1B[4h"),t.originMode&&(e+="\x1B[?6h"),t.reverseWraparoundMode&&(e+="\x1B[?45h"),t.sendFocusMode&&(e+="\x1B[?1004h"),t.wraparoundMode===!1&&(e+="\x1B[?7l"),t.mouseTrackingMode!=="none")switch(t.mouseTrackingMode){case"x10":e+="\x1B[?9h";break;case"vt200":e+="\x1B[?1000h";break;case"drag":e+="\x1B[?1002h";break;case"any":e+="\x1B[?1003h";break}return e}serialize(i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");let e=i!=null&&i.range?this._serializeBufferByRange(this._terminal,this._terminal.buffer.normal,i.range,!0):this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.normal,i==null?void 0:i.scrollback);if(!(i!=null&&i.excludeAltBuffer)&&this._terminal.buffer.active.type==="alternate"){let t=this._serializeBufferByScrollback(this._terminal,this._terminal.buffer.alternate,void 0);e+=`\x1B[?1049h\x1B[H${t}`}return i!=null&&i.excludeModes||(e+=this._serializeModes(this._terminal)),e}serializeAsHTML(i){if(!this._terminal)throw new Error("Cannot use addon until it has been loaded");return this._serializeBufferAsHTML(this._terminal,i||{})}dispose(){}},ire=class extends KD{constructor(i,e,t){super(i),this._terminal=e,this._options=t,this._currentRow="",this._htmlContent="",e._core._themeService?this._ansiColors=e._core._themeService.colors.ansi:this._ansiColors=Kse}_padStart(i,e,t){return e=e>>0,t=t??" ",i.length>e?i:(e-=i.length,e>t.length&&(t+=t.repeat(e/t.length)),t.slice(0,e)+i)}_beforeSerialize(i,e,t){var o,l;this._htmlContent+="<html><body><!--StartFragment--><pre>";let s="#000000",r="#ffffff";(this._options.includeGlobalBackground??!1)&&(s=((o=this._terminal.options.theme)==null?void 0:o.foreground)??"#ffffff",r=((l=this._terminal.options.theme)==null?void 0:l.background)??"#000000");let n=[];n.push("color: "+s+";"),n.push("background-color: "+r+";"),n.push("font-family: "+this._terminal.options.fontFamily+";"),n.push("font-size: "+this._terminal.options.fontSize+"px;"),this._htmlContent+="<div style='"+n.join(" ")+"'>"}_afterSerialize(){this._htmlContent+="</div>",this._htmlContent+="</pre><!--EndFragment--></body></html>"}_rowEnd(i,e){this._htmlContent+="<div><span>"+this._currentRow+"</span></div>",this._currentRow=""}_getHexColor(i,e){let t=e?i.getFgColor():i.getBgColor();if(e?i.isFgRGB():i.isBgRGB())return"#"+[t>>16&255,t>>8&255,t&255].map(s=>this._padStart(s.toString(16),2,"0")).join("");if(e?i.isFgPalette():i.isBgPalette())return this._ansiColors[t].css}_diffStyle(i,e){let t=[],s=!JD(i,e),r=!Ln(i,e),n=!e4(i,e);if(s||r||n){let o=this._getHexColor(i,!0);o&&t.push("color: "+o+";");let l=this._getHexColor(i,!1);return l&&t.push("background-color: "+l+";"),i.isInverse()&&t.push("color: #000000; background-color: #BFBFBF;"),i.isBold()&&t.push("font-weight: bold;"),i.isUnderline()&&i.isOverline()?t.push("text-decoration: overline underline;"):i.isUnderline()?t.push("text-decoration: underline;"):i.isOverline()&&t.push("text-decoration: overline;"),i.isBlink()&&t.push("text-decoration: blink;"),i.isInvisible()&&t.push("visibility: hidden;"),i.isItalic()&&t.push("font-style: italic;"),i.isDim()&&t.push("opacity: 0.5;"),i.isStrikethrough()&&t.push("text-decoration: line-through;"),t}}_nextCell(i,e,t,s){if(i.getWidth()===0)return;let r=i.getChars()==="",n=this._diffStyle(i,e);n&&(this._currentRow+=n.length===0?"</span><span>":"</span><span style='"+n.join(" ")+"'>"),r?this._currentRow+=" ":this._currentRow+=Jse(i.getChars())}_serializeString(){return this._htmlContent}};const sre=10,rre=2e3;function nre(i={}){const{autoSpawn:e=!1,skipPermissions:t=!1}=i,[s,r]=Y.useState(!1),[n,o]=Y.useState(!1),[l,c]=Y.useState(null),[u,d]=Y.useState(null),m=Y.useRef(null),g=Y.useRef(0),_=Y.useRef(null),y=Y.useRef(!0),b=Y.useRef(null),x=Y.useRef(null),w=Y.useRef(e),k=Y.useRef(t);w.current=e,k.current=t;const C=Y.useCallback(z=>{const I=m.current;I&&I.readyState===WebSocket.OPEN&&I.send(JSON.stringify(z))},[]),A=Y.useCallback(z=>{C({type:"spawn",skipPermissions:z})},[C]),P=Y.useCallback(()=>{C({type:"kill"})},[C]),E=Y.useCallback((z,I)=>{C({type:"resize",cols:z,rows:I})},[C]),$=Y.useCallback(z=>{C({type:"input",data:z})},[C]);return Y.useEffect(()=>{y.current=!0;function z(){if(!y.current)return;const se=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/ws/terminal`,F=new WebSocket(se);m.current=F,F.onopen=()=>{y.current&&(r(!0),g.current=0,w.current&&F.send(JSON.stringify({type:"spawn",skipPermissions:k.current})))},F.onclose=()=>{y.current&&(r(!1),m.current=null,g.current<sre&&(g.current++,_.current=setTimeout(z,rre)))},F.onmessage=R=>{var L,N;if(y.current)try{const Z=JSON.parse(R.data);switch(Z.type){case"output":(L=b.current)==null||L.call(b,Z.data);break;case"scrollback":(N=x.current)==null||N.call(x,Z.data);break;case"status":c({pid:Z.pid,uptime:Z.uptime,cwd:Z.cwd,memoryMB:Z.memoryMB,isActive:Z.isActive,skipPermissions:Z.skipPermissions,alive:Z.alive});break;case"exit":d(Z.code??1);break;case"started":d(null);break;case"unavailable":o(!0);break}}catch{}},F.onerror=()=>{}}return z(),()=>{y.current=!1,_.current!==null&&(clearTimeout(_.current),_.current=null),m.current&&(m.current.onclose=null,m.current.close(),m.current=null)}},[]),{connected:s,unavailable:n,status:l,exitCode:u,send:C,spawn:A,kill:P,resize:E,writeInput:$,onOutput:b,onScrollback:x}}function ore(i){const e=Math.floor(i/60),t=i%60;return`${e}m ${t}s`}function are(i){const e=i.replace(/\\/g,"/").split("/").filter(Boolean);return e.length<=2?i:".../"+e.slice(-2).join("/")}function lre({status:i,connected:e,exitCode:t,skipPermissions:s,onToggleSkipPermissions:r,onStop:n,onRestart:o}){const l=e&&(i==null?void 0:i.alive),c=e?l?"bg-green-500":"bg-yellow-500":"bg-red-500",u=e?l?`Running (PID ${(i==null?void 0:i.pid)??"?"})`:"Stopped":"Disconnected";return M.jsxs("div",{className:"flex items-center justify-between border-t border-border bg-card px-3 py-1.5 font-mono text-xs text-muted-foreground",children:[M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsx("span",{className:dt("inline-block h-2 w-2 rounded-full",c),title:u}),M.jsx("span",{children:u}),i&&l&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:"text-border",children:"|"}),M.jsx("span",{children:ore(i.uptime)}),M.jsx("span",{className:"text-border",children:"|"}),M.jsx("span",{title:i.cwd,children:are(i.cwd)}),M.jsx("span",{className:"text-border",children:"|"}),M.jsxs("span",{children:[i.memoryMB," MB"]})]})]}),M.jsxs("div",{className:"flex items-center gap-3",children:[M.jsxs("label",{className:"flex cursor-pointer items-center gap-1.5",children:[M.jsx("input",{type:"checkbox",checked:s,onChange:r,className:"h-3 w-3 accent-accent"}),M.jsx("span",{children:"Skip Perms"})]}),l&&M.jsx("button",{type:"button",onClick:n,className:"rounded-sm px-2 py-0.5 text-red-400 transition-colors hover:bg-red-500/20",children:"Stop"}),M.jsx("button",{type:"button",onClick:o,className:"rounded-sm px-2 py-0.5 transition-colors hover:bg-accent/20",children:"Restart"})]})]})}const hre=[{label:"Progress",command:"/maxsim:progress"},{label:"New Project",command:"/maxsim:new-project"},{label:"Discuss",command:"/maxsim:discuss-phase N"},{label:"Plan",command:"/maxsim:plan-phase N"},{label:"Execute",command:"/maxsim:execute-phase N"},{label:"Roadmap",command:"/maxsim:roadmap"},{label:"Verify",command:"/maxsim:verify-work"},{label:"Resume",command:"/maxsim:resume-work"}],t4="maxsim-quick-commands",cre=3e4;function ure(){try{const i=localStorage.getItem(t4);if(i)return JSON.parse(i)}catch{}return hre}function fre(i){localStorage.setItem(t4,JSON.stringify(i))}function dre({onSendCommand:i,isActive:e,isAlive:t,unavailable:s=!1}){const[r,n]=Y.useState(!1),[o,l]=Y.useState(ure),[c,u]=Y.useState(!1),[d,m]=Y.useState(null),g=Y.useRef(null),_=Y.useCallback(async E=>{if(!E.includes(" N"))return E;const $=g.current;if($&&Date.now()-$.ts<cre)return E.replace(" N",` ${$.value}`);try{const z=await fetch("/api/state");if(z.ok){const I=await z.json(),se=String(I.currentPhase??"1");return g.current={value:se,ts:Date.now()},E.replace(" N",` ${se}`)}}catch{}return E},[]),y=s||!t,b=Y.useCallback(async E=>{if(y)return;const $=await _(E.command);m({label:E.label,resolved:$})},[y,_]),x=Y.useCallback(()=>{d&&(i(d.resolved+`\r
|
|
209
|
+
`),m(null))},[d,i]),w=Y.useCallback(()=>{m(null)},[]);Y.useEffect(()=>{if(!d)return;const E=$=>{$.key==="Enter"?($.preventDefault(),x()):$.key==="Escape"&&w()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[d,x,w]);const[k,C]=Y.useState([]),A=Y.useCallback(()=>{C([...o]),u(!0)},[o]),P=Y.useCallback(()=>{const E=k.filter($=>$.label.trim()&&$.command.trim());l(E),fre(E),u(!1)},[k]);return r?M.jsx("div",{className:"absolute bottom-2 right-2 z-20",children:M.jsx("button",{type:"button",onClick:()=>n(!1),className:"rounded-md bg-card/80 p-1.5 text-xs text-muted-foreground shadow-lg backdrop-blur-sm border border-border hover:text-foreground transition-colors",title:"Show quick actions",children:M.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M18 15l-6-6-6 6"})})})}):M.jsxs("div",{className:"absolute bottom-2 right-2 z-20 flex flex-col items-end gap-1",children:[d&&M.jsxs("div",{className:"rounded-lg bg-card border border-border shadow-lg p-2 text-xs mb-1 backdrop-blur-sm",children:[M.jsxs("p",{className:"text-muted-foreground mb-1.5",children:["Send"," ",M.jsx("span",{className:"font-mono text-foreground",children:d.resolved}),"?"]}),M.jsxs("div",{className:"flex gap-1.5",children:[M.jsx("button",{type:"button",onClick:x,className:"rounded-sm bg-accent px-2 py-0.5 text-foreground hover:bg-accent-glow transition-colors",children:"Confirm"}),M.jsx("button",{type:"button",onClick:w,className:"rounded-sm bg-muted px-2 py-0.5 text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"})]})]}),c&&M.jsxs("div",{className:"rounded-lg bg-card border border-border shadow-lg p-3 text-xs mb-1 backdrop-blur-sm w-72 max-h-64 overflow-y-auto",children:[M.jsx("p",{className:"text-muted-foreground font-medium mb-2",children:"Quick Commands"}),k.map((E,$)=>M.jsxs("div",{className:"flex gap-1 mb-1",children:[M.jsx("input",{className:"flex-[1] rounded-sm border border-border bg-muted px-1.5 py-0.5 text-xs text-foreground",value:E.label,onChange:z=>{const I=[...k];I[$]={...I[$],label:z.target.value},C(I)},placeholder:"Label"}),M.jsx("input",{className:"flex-[2] rounded-sm border border-border bg-muted px-1.5 py-0.5 text-xs font-mono text-foreground",value:E.command,onChange:z=>{const I=[...k];I[$]={...I[$],command:z.target.value},C(I)},placeholder:"Command"}),M.jsx("button",{type:"button",onClick:()=>C(k.filter((z,I)=>I!==$)),className:"text-muted-foreground hover:text-destructive transition-colors px-0.5",title:"Remove",children:"x"})]},$)),M.jsxs("div",{className:"flex justify-between mt-2",children:[M.jsx("button",{type:"button",onClick:()=>C([...k,{label:"",command:""}]),className:"text-muted-foreground hover:text-foreground transition-colors",children:"+ Add"}),M.jsxs("div",{className:"flex gap-1.5",children:[M.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded-sm bg-muted px-2 py-0.5 text-muted-foreground hover:text-foreground transition-colors",children:"Cancel"}),M.jsx("button",{type:"button",onClick:P,className:"rounded-sm bg-accent px-2 py-0.5 text-foreground hover:bg-accent-glow transition-colors",children:"Save"})]})]})]}),M.jsxs("div",{className:"flex items-center gap-1 rounded-lg bg-card/80 border border-border shadow-lg p-1.5 backdrop-blur-sm",children:[o.map(E=>M.jsx("button",{type:"button",onClick:()=>b(E),disabled:y,className:"rounded-md px-2 py-0.5 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-40 disabled:cursor-not-allowed",title:s?"Terminal unavailable — node-pty not installed":E.command,children:E.label},E.label)),M.jsx("button",{type:"button",onClick:A,className:"rounded-md px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground transition-colors ml-0.5",title:"Settings",children:M.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[M.jsx("circle",{cx:"12",cy:"12",r:"3"}),M.jsx("path",{d:"M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.32 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"})]})}),M.jsx("button",{type:"button",onClick:()=>n(!0),className:"rounded-md px-1 py-0.5 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Minimize",children:M.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:M.jsx("path",{d:"M6 9l6 6 6-6"})})})]})]})}function pre({onReady:i}){const e=Y.useRef(null),t=Y.useRef(null),s=Y.useRef(null),r=Y.useRef(null),n=Y.useRef(null),[o,l]=Y.useState(!0),{connected:c,unavailable:u,status:d,exitCode:m,writeInput:g,resize:_,spawn:y,kill:b,onOutput:x,onScrollback:w}=nre({autoSpawn:!0,skipPermissions:o}),k=Y.useCallback($=>{var z;(z=t.current)==null||z.write($)},[]),C=Y.useCallback($=>{var z;(z=t.current)==null||z.write($)},[]);Y.useEffect(()=>(x.current=k,w.current=C,()=>{x.current=null,w.current=null}),[k,C,x,w]),Y.useEffect(()=>{if(!e.current)return;const $=new fie({cursorBlink:!0,fontSize:14,lineHeight:1.2,theme:{background:"#0a0a0a",foreground:"#e0e0e0",cursor:"#e0e0e0"}}),z=new mie,I=new tre;$.loadAddon(z),$.loadAddon(I);try{$.loadAddon(new Fse)}catch{}$.open(e.current),z.fit(),t.current=$,s.current=z;const se=$.onData(R=>{g(R)}),F=new ResizeObserver(()=>{n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{s.current&&t.current&&(s.current.fit(),_(t.current.cols,t.current.rows))},100)});return F.observe(e.current),r.current=F,i==null||i($),()=>{se.dispose(),F.disconnect(),n.current&&clearTimeout(n.current),$.dispose(),t.current=null,s.current=null,r.current=null}},[]);const A=Y.useCallback(()=>{y(o),setTimeout(()=>{var $;return($=t.current)==null?void 0:$.focus()},100)},[y,o]),P=Y.useCallback(()=>{b()},[b]),E=Y.useCallback(()=>{l($=>!$)},[]);return M.jsxs("div",{className:"flex h-full w-full flex-col",onWheel:$=>$.stopPropagation(),children:[M.jsxs("div",{className:"relative min-h-0 flex-1 overflow-hidden",children:[M.jsx("div",{ref:e,className:"h-full w-full"}),M.jsx(dre,{onSendCommand:g,isActive:(d==null?void 0:d.isActive)??!1,isAlive:(d==null?void 0:d.alive)??!1,unavailable:u}),u&&M.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center bg-card",children:M.jsxs("div",{className:"max-w-sm text-center",children:[M.jsx("h2",{className:"text-lg font-semibold text-foreground mb-2",children:"Terminal unavailable"}),M.jsxs("p",{className:"text-sm text-muted-foreground",children:["node-pty is not installed. Run ",M.jsx("code",{className:"rounded bg-muted px-1.5 py-0.5 font-mono text-xs",children:"npm install node-pty"})," in the dashboard directory."]})]})}),!c&&m===null&&M.jsx("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-black/60",children:M.jsxs("div",{className:"flex items-center gap-3 font-mono text-sm text-muted-foreground",children:[M.jsxs("svg",{className:"h-5 w-5 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[M.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),M.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]}),"Reconnecting..."]})}),m!==null&&M.jsxs("div",{className:"absolute inset-x-0 bottom-0 z-10 flex items-center justify-between bg-card/90 px-4 py-2 font-mono text-sm backdrop-blur-sm",children:[M.jsxs("span",{className:"text-muted-foreground",children:["Process exited (code ",m,")"]}),M.jsx("button",{type:"button",onClick:A,className:"rounded-sm bg-accent px-3 py-1 text-xs text-foreground transition-colors hover:bg-accent-glow",children:"Restart"})]})]}),M.jsx(lre,{status:d,connected:c,exitCode:m,skipPermissions:o,onToggleSkipPermissions:E,onStop:P,onRestart:A})]})}function mre(){const[i,e]=Y.useState(!1),t=Y.useCallback(()=>e(s=>!s),[]);return{splitMode:i,toggleSplit:t}}function gre({splitMode:i,onToggle:e}){return M.jsx("button",{type:"button",onClick:e,title:i?"Full-height mode":"Split-panel mode",className:"absolute right-3 top-2 z-20 flex h-7 w-7 items-center justify-center rounded-sm border border-border bg-card text-muted-foreground transition-colors hover:bg-card-hover hover:text-foreground",children:i?M.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:M.jsx("rect",{x:"1",y:"1",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5"})}):M.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[M.jsx("rect",{x:"1",y:"1",width:"12",height:"12",rx:"1",stroke:"currentColor",strokeWidth:"1.5"}),M.jsx("line",{x1:"1",y1:"7",x2:"13",y2:"7",stroke:"currentColor",strokeWidth:"1.5"})]})})}function Ore(){return M.jsxs("div",{className:"flex flex-col gap-6",children:[M.jsxs("div",{className:"flex flex-col gap-4 border-b border-border pb-5",children:[M.jsx("div",{className:"h-3 w-40 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-2 w-full animate-pulse rounded-sm bg-muted"}),M.jsxs("div",{className:"flex gap-8",children:[M.jsx("div",{className:"h-8 w-20 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-8 w-32 animate-pulse rounded-sm bg-muted"}),M.jsxs("div",{className:"ml-auto flex gap-6",children:[M.jsx("div",{className:"h-6 w-24 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-6 w-20 animate-pulse rounded-sm bg-muted"})]})]})]}),M.jsxs("div",{className:"flex flex-col gap-3",children:[M.jsxs("div",{className:"flex justify-between px-4",children:[M.jsx("div",{className:"h-3 w-16 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-3 w-6 animate-pulse rounded-sm bg-muted"})]}),Array.from({length:6}).map((i,e)=>M.jsxs("div",{className:"flex flex-col gap-2 px-4 py-3",children:[M.jsxs("div",{className:"flex gap-3",children:[M.jsx("div",{className:"h-4 w-4 animate-pulse rounded-full bg-muted"}),M.jsx("div",{className:"h-4 w-8 animate-pulse rounded-sm bg-muted"}),M.jsx("div",{className:"h-4 w-40 animate-pulse rounded-sm bg-muted"})]}),M.jsx("div",{className:"h-1.5 w-full animate-pulse rounded-sm bg-muted"})]},e))]})]})}function _re({message:i,onRetry:e}){return M.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center gap-4",children:[M.jsx("p",{className:"font-mono text-sm text-danger",children:i}),M.jsx("button",{type:"button",onClick:e,className:"rounded-sm bg-accent px-4 py-2 font-mono text-xs text-foreground transition-colors hover:bg-accent-glow",children:"Retry"})]})}function vre(){const{roadmap:i,state:e,todos:t,loading:s,error:r}=fb(),[n,o]=Y.useState("overview"),[l,c]=Y.useState(null),{splitMode:u,toggleSplit:d}=mre(),m=Y.useRef({view:"overview",phaseId:null}),g=Y.useCallback((A,P)=>{A!=="terminal"&&(m.current={view:A,phaseId:A==="phase"&&P?P:null}),o(A),A==="phase"&&P&&c(P)},[]),_=Y.useCallback(A=>{o("phase"),c(A)},[]),y=Y.useCallback(()=>{o("overview"),c(null)},[]),b=Y.useCallback(async(A,P)=>{try{const E=await fetch("/api/roadmap",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({phaseNumber:A,checked:P})});E.ok||console.error("[toggle-phase]",await E.text())}catch(E){console.error("[toggle-phase]",E)}},[]),x=((i==null?void 0:i.phases)??[]).map(A=>({number:A.number,name:A.name,goal:A.goal??"",dependsOn:A.depends_on?[A.depends_on]:[],planCount:A.plan_count,summaryCount:A.summary_count,diskStatus:A.disk_status,roadmapComplete:A.roadmap_complete,hasContext:A.has_context,hasResearch:A.has_research})),w=(i==null?void 0:i.current_phase)??null;function k(){if(s)return M.jsx(Ore,{});if(r)return M.jsx(_re,{message:r,onRetry:()=>window.location.reload()});switch(n){case"overview":return M.jsxs("div",{className:"mx-auto flex max-w-4xl flex-col gap-6",children:[M.jsx(EV,{roadmap:i,state:e,todos:t}),M.jsx(LV,{phases:x,currentPhase:w,onPhaseClick:_,onToggleComplete:b})]});case"phase":return l?M.jsx("div",{className:"mx-auto max-w-4xl",children:M.jsx(CK,{phaseId:l,onBack:y})}):null;case"todos":return M.jsx("div",{className:"mx-auto max-w-3xl",children:M.jsx(kK,{})});case"blockers":return M.jsx("div",{className:"mx-auto max-w-3xl",children:M.jsx(MK,{})});case"terminal":return null;default:return null}}const C=n==="terminal";return M.jsxs(EK,{sidebar:M.jsx(sJ,{activeView:n,activePhaseId:l,onNavigate:g}),children:[M.jsx("div",{style:{display:C&&!u?"none":"block"},className:C&&u?"h-1/2 min-h-0 overflow-auto border-b border-border p-6":"flex-1 overflow-y-auto p-6",children:k()}),M.jsxs("div",{style:{display:C?"flex":"none"},className:`relative min-h-0 flex-col overflow-hidden ${C&&u?"h-1/2":"flex-1"}`,children:[M.jsx(gre,{splitMode:u,onToggle:d}),M.jsx(pre,{})]})]})}function yre(){return M.jsx(zz,{children:M.jsx(vre,{})})}const i4=document.getElementById("root");if(!i4)throw new Error("Root element not found");$z.createRoot(i4).render(M.jsx(Y.StrictMode,{children:M.jsx(yre,{})}));
|