@tom2012/cc-web 1.5.37 → 1.5.38
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/README.md +1 -1
- package/frontend/dist/assets/{index-D_eyHtwF.js → index-BTxKTqXV.js} +15 -15
- package/frontend/dist/assets/{index-BJy7DPYK.css → index-DpzQcaS6.css} +1 -1
- package/frontend/dist/assets/{index-CeSIZyhn.js → index-lRhMzYm_.js} +1 -1
- package/frontend/dist/assets/{jszip.min-BEfuE5vH.js → jszip.min-JFbhTBvU.js} +1 -1
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-lRhMzYm_.js","assets/jszip.min-JFbhTBvU.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function JF(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const i in r)if(i!=="default"&&!(i in e)){const s=Object.getOwnPropertyDescriptor(r,i);s&&Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>r[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();var rd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ah(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Jse(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var lR={exports:{}},lh={},cR={exports:{}},we={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react.production.min.js
|
|
@@ -35,10 +35,10 @@ function JF(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&
|
|
|
35
35
|
`+xp+e}var Ep=!1;function kp(e,t){if(!e||Ep)return"";Ep=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(t)if(t=function(){throw Error()},Object.defineProperty(t.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(t,[])}catch(c){var r=c}Reflect.construct(e,[],t)}else{try{t.call()}catch(c){r=c}e.call(t.prototype)}else{try{throw Error()}catch(c){r=c}e()}}catch(c){if(c&&r&&typeof c.stack=="string"){for(var i=c.stack.split(`
|
|
36
36
|
`),s=r.stack.split(`
|
|
37
37
|
`),o=i.length-1,a=s.length-1;1<=o&&0<=a&&i[o]!==s[a];)a--;for(;1<=o&&0<=a;o--,a--)if(i[o]!==s[a]){if(o!==1||a!==1)do if(o--,a--,0>a||i[o]!==s[a]){var l=`
|
|
38
|
-
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ep=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ga(e):""}function TB(e){switch(e.tag){case 5:return Ga(e.type);case 16:return Ga("Lazy");case 13:return Ga("Suspense");case 19:return Ga("SuspenseList");case 0:case 2:case 15:return e=kp(e.type,!1),e;case 11:return e=kp(e.type.render,!1),e;case 1:return e=kp(e.type,!0),e;default:return""}}function ug(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ho:return"Fragment";case uo:return"Portal";case ag:return"Profiler";case Jb:return"StrictMode";case lg:return"Suspense";case cg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ER:return(e.displayName||"Context")+".Consumer";case xR:return(e._context.displayName||"Context")+".Provider";case ey:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ty:return t=e.displayName||null,t!==null?t:ug(e.type)||"Memo";case hi:t=e._payload,e=e._init;try{return ug(e(t))}catch{}}return null}function AB(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ug(t);case 8:return t===Jb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Li(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function CR(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function RB(e){var t=CR(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mc(e){e._valueTracker||(e._valueTracker=RB(e))}function TR(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=CR(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function id(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function dg(e,t){var n=t.checked;return Ye({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function N0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Li(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function AR(e,t){t=t.checked,t!=null&&Qb(e,"checked",t,!1)}function hg(e,t){AR(e,t);var n=Li(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pg(e,t.type,n):t.hasOwnProperty("defaultValue")&&pg(e,t.type,Li(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function I0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pg(e,t,n){(t!=="number"||id(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Wa=Array.isArray;function No(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Li(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function fg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ye({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function O0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(W(92));if(Wa(n)){if(1<n.length)throw Error(W(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Li(n)}}function RR(e,t){var n=Li(t.value),r=Li(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function L0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function NR(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?NR(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Pc,IR=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Pc=Pc||document.createElement("div"),Pc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Pc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var nl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},NB=["Webkit","ms","Moz","O"];Object.keys(nl).forEach(function(e){NB.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nl[t]=nl[e]})});function OR(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||nl.hasOwnProperty(e)&&nl[e]?(""+t).trim():t+"px"}function LR(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=OR(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var IB=Ye({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mg(e,t){if(t){if(IB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function bg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yg=null;function ny(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vg=null,Io=null,Oo=null;function D0(e){if(e=cc(e)){if(typeof vg!="function")throw Error(W(280));var t=e.stateNode;t&&(t=fh(t),vg(e.stateNode,e.type,t))}}function DR(e){Io?Oo?Oo.push(e):Oo=[e]:Io=e}function MR(){if(Io){var e=Io,t=Oo;if(Oo=Io=null,D0(e),t)for(e=0;e<t.length;e++)D0(t[e])}}function PR(e,t){return e(t)}function FR(){}var Cp=!1;function BR(e,t,n){if(Cp)return e(t,n);Cp=!0;try{return PR(e,t,n)}finally{Cp=!1,(Io!==null||Oo!==null)&&(FR(),MR())}}function El(e,t){var n=e.stateNode;if(n===null)return null;var r=fh(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(W(231,t,typeof n));return n}var _g=!1;if(Vr)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){_g=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{_g=!1}function OB(e,t,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var rl=!1,sd=null,od=!1,Sg=null,LB={onError:function(e){rl=!0,sd=e}};function DB(e,t,n,r,i,s,o,a,l){rl=!1,sd=null,OB.apply(LB,arguments)}function MB(e,t,n,r,i,s,o,a,l){if(DB.apply(this,arguments),rl){if(rl){var c=sd;rl=!1,sd=null}else throw Error(W(198));od||(od=!0,Sg=c)}}function Bs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function jR(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function M0(e){if(Bs(e)!==e)throw Error(W(188))}function PB(e){var t=e.alternate;if(!t){if(t=Bs(e),t===null)throw Error(W(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return M0(i),e;if(s===r)return M0(i),t;s=s.sibling}throw Error(W(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function UR(e){return e=PB(e),e!==null?$R(e):null}function $R(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=$R(e);if(t!==null)return t;e=e.sibling}return null}var zR=wn.unstable_scheduleCallback,P0=wn.unstable_cancelCallback,FB=wn.unstable_shouldYield,BB=wn.unstable_requestPaint,tt=wn.unstable_now,jB=wn.unstable_getCurrentPriorityLevel,ry=wn.unstable_ImmediatePriority,HR=wn.unstable_UserBlockingPriority,ad=wn.unstable_NormalPriority,UB=wn.unstable_LowPriority,VR=wn.unstable_IdlePriority,uh=null,_r=null;function $B(e){if(_r&&typeof _r.onCommitFiberRoot=="function")try{_r.onCommitFiberRoot(uh,e,void 0,(e.current.flags&128)===128)}catch{}}var Xn=Math.clz32?Math.clz32:VB,zB=Math.log,HB=Math.LN2;function VB(e){return e>>>=0,e===0?32:31-(zB(e)/HB|0)|0}var Fc=64,Bc=4194304;function qa(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ld(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=qa(a):(s&=o,s!==0&&(r=qa(s)))}else o=n&~i,o!==0?r=qa(o):s!==0&&(r=qa(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Xn(t),i=1<<n,r|=e[n],t&=~i;return r}function GB(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function WB(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Xn(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=GB(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function wg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function GR(){var e=Fc;return Fc<<=1,!(Fc&4194240)&&(Fc=64),e}function Tp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ac(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Xn(t),e[t]=n}function qB(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Xn(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function iy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Xn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Ae=0;function WR(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qR,sy,KR,YR,XR,xg=!1,jc=[],xi=null,Ei=null,ki=null,kl=new Map,Cl=new Map,gi=[],KB="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function F0(e,t){switch(e){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":kl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cl.delete(t.pointerId)}}function Aa(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=cc(t),t!==null&&sy(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function YB(e,t,n,r,i){switch(t){case"focusin":return xi=Aa(xi,e,t,n,r,i),!0;case"dragenter":return Ei=Aa(Ei,e,t,n,r,i),!0;case"mouseover":return ki=Aa(ki,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return kl.set(s,Aa(kl.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Cl.set(s,Aa(Cl.get(s)||null,e,t,n,r,i)),!0}return!1}function ZR(e){var t=cs(e.target);if(t!==null){var n=Bs(t);if(n!==null){if(t=n.tag,t===13){if(t=jR(n),t!==null){e.blockedOn=t,XR(e.priority,function(){KR(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function wu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Eg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yg=r,n.target.dispatchEvent(r),yg=null}else return t=cc(n),t!==null&&sy(t),e.blockedOn=n,!1;t.shift()}return!0}function B0(e,t,n){wu(e)&&n.delete(t)}function XB(){xg=!1,xi!==null&&wu(xi)&&(xi=null),Ei!==null&&wu(Ei)&&(Ei=null),ki!==null&&wu(ki)&&(ki=null),kl.forEach(B0),Cl.forEach(B0)}function Ra(e,t){e.blockedOn===t&&(e.blockedOn=null,xg||(xg=!0,wn.unstable_scheduleCallback(wn.unstable_NormalPriority,XB)))}function Tl(e){function t(i){return Ra(i,e)}if(0<jc.length){Ra(jc[0],e);for(var n=1;n<jc.length;n++){var r=jc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(xi!==null&&Ra(xi,e),Ei!==null&&Ra(Ei,e),ki!==null&&Ra(ki,e),kl.forEach(t),Cl.forEach(t),n=0;n<gi.length;n++)r=gi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<gi.length&&(n=gi[0],n.blockedOn===null);)ZR(n),n.blockedOn===null&&gi.shift()}var Lo=Xr.ReactCurrentBatchConfig,cd=!0;function ZB(e,t,n,r){var i=Ae,s=Lo.transition;Lo.transition=null;try{Ae=1,oy(e,t,n,r)}finally{Ae=i,Lo.transition=s}}function QB(e,t,n,r){var i=Ae,s=Lo.transition;Lo.transition=null;try{Ae=4,oy(e,t,n,r)}finally{Ae=i,Lo.transition=s}}function oy(e,t,n,r){if(cd){var i=Eg(e,t,n,r);if(i===null)Fp(e,t,r,ud,n),F0(e,r);else if(YB(i,e,t,n,r))r.stopPropagation();else if(F0(e,r),t&4&&-1<KB.indexOf(e)){for(;i!==null;){var s=cc(i);if(s!==null&&qR(s),s=Eg(e,t,n,r),s===null&&Fp(e,t,r,ud,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Fp(e,t,r,null,n)}}var ud=null;function Eg(e,t,n,r){if(ud=null,e=ny(r),e=cs(e),e!==null)if(t=Bs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=jR(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ud=e,null}function QR(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jB()){case ry:return 1;case HR:return 4;case ad:case UB:return 16;case VR:return 536870912;default:return 16}default:return 16}}var bi=null,ay=null,xu=null;function JR(){if(xu)return xu;var e,t=ay,n=t.length,r,i="value"in bi?bi.value:bi.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return xu=i.slice(e,1<r?1-r:void 0)}function Eu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Uc(){return!0}function j0(){return!1}function En(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Uc:j0,this.isPropagationStopped=j0,this}return Ye(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Uc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Uc)},persist:function(){},isPersistent:Uc}),t}var na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ly=En(na),lc=Ye({},na,{view:0,detail:0}),JB=En(lc),Ap,Rp,Na,dh=Ye({},lc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cy,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Na&&(Na&&e.type==="mousemove"?(Ap=e.screenX-Na.screenX,Rp=e.screenY-Na.screenY):Rp=Ap=0,Na=e),Ap)},movementY:function(e){return"movementY"in e?e.movementY:Rp}}),U0=En(dh),ej=Ye({},dh,{dataTransfer:0}),tj=En(ej),nj=Ye({},lc,{relatedTarget:0}),Np=En(nj),rj=Ye({},na,{animationName:0,elapsedTime:0,pseudoElement:0}),ij=En(rj),sj=Ye({},na,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),oj=En(sj),aj=Ye({},na,{data:0}),$0=En(aj),lj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cj={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"},uj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dj(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=uj[e])?!!t[e]:!1}function cy(){return dj}var hj=Ye({},lc,{key:function(e){if(e.key){var t=lj[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Eu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cj[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cy,charCode:function(e){return e.type==="keypress"?Eu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Eu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pj=En(hj),fj=Ye({},dh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),z0=En(fj),gj=Ye({},lc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cy}),mj=En(gj),bj=Ye({},na,{propertyName:0,elapsedTime:0,pseudoElement:0}),yj=En(bj),vj=Ye({},dh,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),_j=En(vj),Sj=[9,13,27,32],uy=Vr&&"CompositionEvent"in window,il=null;Vr&&"documentMode"in document&&(il=document.documentMode);var wj=Vr&&"TextEvent"in window&&!il,eN=Vr&&(!uy||il&&8<il&&11>=il),H0=" ",V0=!1;function tN(e,t){switch(e){case"keyup":return Sj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nN(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var po=!1;function xj(e,t){switch(e){case"compositionend":return nN(t);case"keypress":return t.which!==32?null:(V0=!0,H0);case"textInput":return e=t.data,e===H0&&V0?null:e;default:return null}}function Ej(e,t){if(po)return e==="compositionend"||!uy&&tN(e,t)?(e=JR(),xu=ay=bi=null,po=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return eN&&t.locale!=="ko"?null:t.data;default:return null}}var kj={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 G0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!kj[e.type]:t==="textarea"}function rN(e,t,n,r){DR(r),t=dd(t,"onChange"),0<t.length&&(n=new ly("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var sl=null,Al=null;function Cj(e){fN(e,0)}function hh(e){var t=mo(e);if(TR(t))return e}function Tj(e,t){if(e==="change")return t}var iN=!1;if(Vr){var Ip;if(Vr){var Op="oninput"in document;if(!Op){var W0=document.createElement("div");W0.setAttribute("oninput","return;"),Op=typeof W0.oninput=="function"}Ip=Op}else Ip=!1;iN=Ip&&(!document.documentMode||9<document.documentMode)}function q0(){sl&&(sl.detachEvent("onpropertychange",sN),Al=sl=null)}function sN(e){if(e.propertyName==="value"&&hh(Al)){var t=[];rN(t,Al,e,ny(e)),BR(Cj,t)}}function Aj(e,t,n){e==="focusin"?(q0(),sl=t,Al=n,sl.attachEvent("onpropertychange",sN)):e==="focusout"&&q0()}function Rj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return hh(Al)}function Nj(e,t){if(e==="click")return hh(t)}function Ij(e,t){if(e==="input"||e==="change")return hh(t)}function Oj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tr=typeof Object.is=="function"?Object.is:Oj;function Rl(e,t){if(tr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!og.call(t,i)||!tr(e[i],t[i]))return!1}return!0}function K0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Y0(e,t){var n=K0(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=K0(n)}}function oN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oN(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function aN(){for(var e=window,t=id();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=id(e.document)}return t}function dy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Lj(e){var t=aN(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oN(n.ownerDocument.documentElement,n)){if(r!==null&&dy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Y0(n,s);var o=Y0(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Dj=Vr&&"documentMode"in document&&11>=document.documentMode,fo=null,kg=null,ol=null,Cg=!1;function X0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cg||fo==null||fo!==id(r)||(r=fo,"selectionStart"in r&&dy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ol&&Rl(ol,r)||(ol=r,r=dd(kg,"onSelect"),0<r.length&&(t=new ly("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=fo)))}function $c(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var go={animationend:$c("Animation","AnimationEnd"),animationiteration:$c("Animation","AnimationIteration"),animationstart:$c("Animation","AnimationStart"),transitionend:$c("Transition","TransitionEnd")},Lp={},lN={};Vr&&(lN=document.createElement("div").style,"AnimationEvent"in window||(delete go.animationend.animation,delete go.animationiteration.animation,delete go.animationstart.animation),"TransitionEvent"in window||delete go.transitionend.transition);function ph(e){if(Lp[e])return Lp[e];if(!go[e])return e;var t=go[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lN)return Lp[e]=t[n];return e}var cN=ph("animationend"),uN=ph("animationiteration"),dN=ph("animationstart"),hN=ph("transitionend"),pN=new Map,Z0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $i(e,t){pN.set(e,t),Fs(t,[e])}for(var Dp=0;Dp<Z0.length;Dp++){var Mp=Z0[Dp],Mj=Mp.toLowerCase(),Pj=Mp[0].toUpperCase()+Mp.slice(1);$i(Mj,"on"+Pj)}$i(cN,"onAnimationEnd");$i(uN,"onAnimationIteration");$i(dN,"onAnimationStart");$i("dblclick","onDoubleClick");$i("focusin","onFocus");$i("focusout","onBlur");$i(hN,"onTransitionEnd");Uo("onMouseEnter",["mouseout","mouseover"]);Uo("onMouseLeave",["mouseout","mouseover"]);Uo("onPointerEnter",["pointerout","pointerover"]);Uo("onPointerLeave",["pointerout","pointerover"]);Fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ka="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(" "),Fj=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ka));function Q0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,MB(r,t,void 0,e),e.currentTarget=null}function fN(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;Q0(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;Q0(i,a,c),s=l}}}if(od)throw e=Sg,od=!1,Sg=null,e}function Fe(e,t){var n=t[Ig];n===void 0&&(n=t[Ig]=new Set);var r=e+"__bubble";n.has(r)||(gN(t,e,2,!1),n.add(r))}function Pp(e,t,n){var r=0;t&&(r|=4),gN(n,e,r,t)}var zc="_reactListening"+Math.random().toString(36).slice(2);function Nl(e){if(!e[zc]){e[zc]=!0,wR.forEach(function(n){n!=="selectionchange"&&(Fj.has(n)||Pp(n,!1,e),Pp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zc]||(t[zc]=!0,Pp("selectionchange",!1,t))}}function gN(e,t,n,r){switch(QR(t)){case 1:var i=ZB;break;case 4:i=QB;break;default:i=oy}n=i.bind(null,t,n,e),i=void 0,!_g||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Fp(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=cs(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}BR(function(){var c=s,u=ny(n),d=[];e:{var p=pN.get(e);if(p!==void 0){var f=ly,g=e;switch(e){case"keypress":if(Eu(n)===0)break e;case"keydown":case"keyup":f=pj;break;case"focusin":g="focus",f=Np;break;case"focusout":g="blur",f=Np;break;case"beforeblur":case"afterblur":f=Np;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=U0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=tj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=mj;break;case cN:case uN:case dN:f=ij;break;case hN:f=yj;break;case"scroll":f=JB;break;case"wheel":f=_j;break;case"copy":case"cut":case"paste":f=oj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=z0}var m=(t&4)!==0,_=!m&&e==="scroll",b=m?p!==null?p+"Capture":null:p;m=[];for(var v=c,S;v!==null;){S=v;var w=S.stateNode;if(S.tag===5&&w!==null&&(S=w,b!==null&&(w=El(v,b),w!=null&&m.push(Il(v,w,S)))),_)break;v=v.return}0<m.length&&(p=new f(p,g,null,n,u),d.push({event:p,listeners:m}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==yg&&(g=n.relatedTarget||n.fromElement)&&(cs(g)||g[Gr]))break e;if((f||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,f?(g=n.relatedTarget||n.toElement,f=c,g=g?cs(g):null,g!==null&&(_=Bs(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=c),f!==g)){if(m=U0,w="onMouseLeave",b="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=z0,w="onPointerLeave",b="onPointerEnter",v="pointer"),_=f==null?p:mo(f),S=g==null?p:mo(g),p=new m(w,v+"leave",f,n,u),p.target=_,p.relatedTarget=S,w=null,cs(u)===c&&(m=new m(b,v+"enter",g,n,u),m.target=S,m.relatedTarget=_,w=m),_=w,f&&g)t:{for(m=f,b=g,v=0,S=m;S;S=Js(S))v++;for(S=0,w=b;w;w=Js(w))S++;for(;0<v-S;)m=Js(m),v--;for(;0<S-v;)b=Js(b),S--;for(;v--;){if(m===b||b!==null&&m===b.alternate)break t;m=Js(m),b=Js(b)}m=null}else m=null;f!==null&&J0(d,p,f,m,!1),g!==null&&_!==null&&J0(d,_,g,m,!0)}}e:{if(p=c?mo(c):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var k=Tj;else if(G0(p))if(iN)k=Ij;else{k=Rj;var x=Aj}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(k=Nj);if(k&&(k=k(e,c))){rN(d,k,n,u);break e}x&&x(e,p,c),e==="focusout"&&(x=p._wrapperState)&&x.controlled&&p.type==="number"&&pg(p,"number",p.value)}switch(x=c?mo(c):window,e){case"focusin":(G0(x)||x.contentEditable==="true")&&(fo=x,kg=c,ol=null);break;case"focusout":ol=kg=fo=null;break;case"mousedown":Cg=!0;break;case"contextmenu":case"mouseup":case"dragend":Cg=!1,X0(d,n,u);break;case"selectionchange":if(Dj)break;case"keydown":case"keyup":X0(d,n,u)}var E;if(uy)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else po?tN(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(eN&&n.locale!=="ko"&&(po||T!=="onCompositionStart"?T==="onCompositionEnd"&&po&&(E=JR()):(bi=u,ay="value"in bi?bi.value:bi.textContent,po=!0)),x=dd(c,T),0<x.length&&(T=new $0(T,e,null,n,u),d.push({event:T,listeners:x}),E?T.data=E:(E=nN(n),E!==null&&(T.data=E)))),(E=wj?xj(e,n):Ej(e,n))&&(c=dd(c,"onBeforeInput"),0<c.length&&(u=new $0("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=E))}fN(d,t)})}function Il(e,t,n){return{instance:e,listener:t,currentTarget:n}}function dd(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=El(e,n),s!=null&&r.unshift(Il(e,s,i)),s=El(e,t),s!=null&&r.push(Il(e,s,i))),e=e.return}return r}function Js(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function J0(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=El(n,s),l!=null&&o.unshift(Il(n,l,a))):i||(l=El(n,s),l!=null&&o.push(Il(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Bj=/\r\n?/g,jj=/\u0000|\uFFFD/g;function ek(e){return(typeof e=="string"?e:""+e).replace(Bj,`
|
|
38
|
+
`+i[o].replace(" at new "," at ");return e.displayName&&l.includes("<anonymous>")&&(l=l.replace("<anonymous>",e.displayName)),l}while(1<=o&&0<=a);break}}}finally{Ep=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ga(e):""}function TB(e){switch(e.tag){case 5:return Ga(e.type);case 16:return Ga("Lazy");case 13:return Ga("Suspense");case 19:return Ga("SuspenseList");case 0:case 2:case 15:return e=kp(e.type,!1),e;case 11:return e=kp(e.type.render,!1),e;case 1:return e=kp(e.type,!0),e;default:return""}}function ug(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ho:return"Fragment";case uo:return"Portal";case ag:return"Profiler";case Jb:return"StrictMode";case lg:return"Suspense";case cg:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case ER:return(e.displayName||"Context")+".Consumer";case xR:return(e._context.displayName||"Context")+".Provider";case ey:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ty:return t=e.displayName||null,t!==null?t:ug(e.type)||"Memo";case hi:t=e._payload,e=e._init;try{return ug(e(t))}catch{}}return null}function AB(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return ug(t);case 8:return t===Jb?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Li(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function CR(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function RB(e){var t=CR(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,s=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(o){r=""+o,s.call(this,o)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Mc(e){e._valueTracker||(e._valueTracker=RB(e))}function TR(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=CR(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function id(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function dg(e,t){var n=t.checked;return Ye({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function N0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Li(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function AR(e,t){t=t.checked,t!=null&&Qb(e,"checked",t,!1)}function hg(e,t){AR(e,t);var n=Li(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?pg(e,t.type,n):t.hasOwnProperty("defaultValue")&&pg(e,t.type,Li(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function I0(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function pg(e,t,n){(t!=="number"||id(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Wa=Array.isArray;function No(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t["$"+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty("$"+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=""+Li(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function fg(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(W(91));return Ye({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function O0(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(W(92));if(Wa(n)){if(1<n.length)throw Error(W(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:Li(n)}}function RR(e,t){var n=Li(t.value),r=Li(t.defaultValue);n!=null&&(n=""+n,n!==e.value&&(e.value=n),t.defaultValue==null&&e.defaultValue!==n&&(e.defaultValue=n)),r!=null&&(e.defaultValue=""+r)}function L0(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function NR(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function gg(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?NR(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var Pc,IR=function(e){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(t,n,r,i){MSApp.execUnsafeLocalFunction(function(){return e(t,n,r,i)})}:e}(function(e,t){if(e.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in e)e.innerHTML=t;else{for(Pc=Pc||document.createElement("div"),Pc.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=Pc.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function xl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var nl={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},NB=["Webkit","ms","Moz","O"];Object.keys(nl).forEach(function(e){NB.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),nl[t]=nl[e]})});function OR(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||nl.hasOwnProperty(e)&&nl[e]?(""+t).trim():t+"px"}function LR(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=OR(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var IB=Ye({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function mg(e,t){if(t){if(IB[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(W(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(W(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(W(61))}if(t.style!=null&&typeof t.style!="object")throw Error(W(62))}}function bg(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var yg=null;function ny(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var vg=null,Io=null,Oo=null;function D0(e){if(e=cc(e)){if(typeof vg!="function")throw Error(W(280));var t=e.stateNode;t&&(t=fh(t),vg(e.stateNode,e.type,t))}}function DR(e){Io?Oo?Oo.push(e):Oo=[e]:Io=e}function MR(){if(Io){var e=Io,t=Oo;if(Oo=Io=null,D0(e),t)for(e=0;e<t.length;e++)D0(t[e])}}function PR(e,t){return e(t)}function FR(){}var Cp=!1;function BR(e,t,n){if(Cp)return e(t,n);Cp=!0;try{return PR(e,t,n)}finally{Cp=!1,(Io!==null||Oo!==null)&&(FR(),MR())}}function El(e,t){var n=e.stateNode;if(n===null)return null;var r=fh(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(W(231,t,typeof n));return n}var _g=!1;if(Vr)try{var Ta={};Object.defineProperty(Ta,"passive",{get:function(){_g=!0}}),window.addEventListener("test",Ta,Ta),window.removeEventListener("test",Ta,Ta)}catch{_g=!1}function OB(e,t,n,r,i,s,o,a,l){var c=Array.prototype.slice.call(arguments,3);try{t.apply(n,c)}catch(u){this.onError(u)}}var rl=!1,sd=null,od=!1,Sg=null,LB={onError:function(e){rl=!0,sd=e}};function DB(e,t,n,r,i,s,o,a,l){rl=!1,sd=null,OB.apply(LB,arguments)}function MB(e,t,n,r,i,s,o,a,l){if(DB.apply(this,arguments),rl){if(rl){var c=sd;rl=!1,sd=null}else throw Error(W(198));od||(od=!0,Sg=c)}}function Bs(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function jR(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function M0(e){if(Bs(e)!==e)throw Error(W(188))}function PB(e){var t=e.alternate;if(!t){if(t=Bs(e),t===null)throw Error(W(188));return t!==e?null:e}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var s=i.alternate;if(s===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===s.child){for(s=i.child;s;){if(s===n)return M0(i),e;if(s===r)return M0(i),t;s=s.sibling}throw Error(W(188))}if(n.return!==r.return)n=i,r=s;else{for(var o=!1,a=i.child;a;){if(a===n){o=!0,n=i,r=s;break}if(a===r){o=!0,r=i,n=s;break}a=a.sibling}if(!o){for(a=s.child;a;){if(a===n){o=!0,n=s,r=i;break}if(a===r){o=!0,r=s,n=i;break}a=a.sibling}if(!o)throw Error(W(189))}}if(n.alternate!==r)throw Error(W(190))}if(n.tag!==3)throw Error(W(188));return n.stateNode.current===n?e:t}function UR(e){return e=PB(e),e!==null?$R(e):null}function $R(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=$R(e);if(t!==null)return t;e=e.sibling}return null}var zR=wn.unstable_scheduleCallback,P0=wn.unstable_cancelCallback,FB=wn.unstable_shouldYield,BB=wn.unstable_requestPaint,nt=wn.unstable_now,jB=wn.unstable_getCurrentPriorityLevel,ry=wn.unstable_ImmediatePriority,HR=wn.unstable_UserBlockingPriority,ad=wn.unstable_NormalPriority,UB=wn.unstable_LowPriority,VR=wn.unstable_IdlePriority,uh=null,_r=null;function $B(e){if(_r&&typeof _r.onCommitFiberRoot=="function")try{_r.onCommitFiberRoot(uh,e,void 0,(e.current.flags&128)===128)}catch{}}var Xn=Math.clz32?Math.clz32:VB,zB=Math.log,HB=Math.LN2;function VB(e){return e>>>=0,e===0?32:31-(zB(e)/HB|0)|0}var Fc=64,Bc=4194304;function qa(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ld(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,s=e.pingedLanes,o=n&268435455;if(o!==0){var a=o&~i;a!==0?r=qa(a):(s&=o,s!==0&&(r=qa(s)))}else o=n&~i,o!==0?r=qa(o):s!==0&&(r=qa(s));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,s=t&-t,i>=s||i===16&&(s&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0<t;)n=31-Xn(t),i=1<<n,r|=e[n],t&=~i;return r}function GB(e,t){switch(e){case 1:case 2:case 4:return t+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function WB(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,s=e.pendingLanes;0<s;){var o=31-Xn(s),a=1<<o,l=i[o];l===-1?(!(a&n)||a&r)&&(i[o]=GB(a,t)):l<=t&&(e.expiredLanes|=a),s&=~a}}function wg(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function GR(){var e=Fc;return Fc<<=1,!(Fc&4194240)&&(Fc=64),e}function Tp(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ac(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Xn(t),e[t]=n}function qB(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0<n;){var i=31-Xn(n),s=1<<i;t[i]=0,r[i]=-1,e[i]=-1,n&=~s}}function iy(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Xn(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}var Ae=0;function WR(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var qR,sy,KR,YR,XR,xg=!1,jc=[],xi=null,Ei=null,ki=null,kl=new Map,Cl=new Map,gi=[],KB="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function F0(e,t){switch(e){case"focusin":case"focusout":xi=null;break;case"dragenter":case"dragleave":Ei=null;break;case"mouseover":case"mouseout":ki=null;break;case"pointerover":case"pointerout":kl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Cl.delete(t.pointerId)}}function Aa(e,t,n,r,i,s){return e===null||e.nativeEvent!==s?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:s,targetContainers:[i]},t!==null&&(t=cc(t),t!==null&&sy(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function YB(e,t,n,r,i){switch(t){case"focusin":return xi=Aa(xi,e,t,n,r,i),!0;case"dragenter":return Ei=Aa(Ei,e,t,n,r,i),!0;case"mouseover":return ki=Aa(ki,e,t,n,r,i),!0;case"pointerover":var s=i.pointerId;return kl.set(s,Aa(kl.get(s)||null,e,t,n,r,i)),!0;case"gotpointercapture":return s=i.pointerId,Cl.set(s,Aa(Cl.get(s)||null,e,t,n,r,i)),!0}return!1}function ZR(e){var t=cs(e.target);if(t!==null){var n=Bs(t);if(n!==null){if(t=n.tag,t===13){if(t=jR(n),t!==null){e.blockedOn=t,XR(e.priority,function(){KR(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function wu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Eg(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yg=r,n.target.dispatchEvent(r),yg=null}else return t=cc(n),t!==null&&sy(t),e.blockedOn=n,!1;t.shift()}return!0}function B0(e,t,n){wu(e)&&n.delete(t)}function XB(){xg=!1,xi!==null&&wu(xi)&&(xi=null),Ei!==null&&wu(Ei)&&(Ei=null),ki!==null&&wu(ki)&&(ki=null),kl.forEach(B0),Cl.forEach(B0)}function Ra(e,t){e.blockedOn===t&&(e.blockedOn=null,xg||(xg=!0,wn.unstable_scheduleCallback(wn.unstable_NormalPriority,XB)))}function Tl(e){function t(i){return Ra(i,e)}if(0<jc.length){Ra(jc[0],e);for(var n=1;n<jc.length;n++){var r=jc[n];r.blockedOn===e&&(r.blockedOn=null)}}for(xi!==null&&Ra(xi,e),Ei!==null&&Ra(Ei,e),ki!==null&&Ra(ki,e),kl.forEach(t),Cl.forEach(t),n=0;n<gi.length;n++)r=gi[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<gi.length&&(n=gi[0],n.blockedOn===null);)ZR(n),n.blockedOn===null&&gi.shift()}var Lo=Xr.ReactCurrentBatchConfig,cd=!0;function ZB(e,t,n,r){var i=Ae,s=Lo.transition;Lo.transition=null;try{Ae=1,oy(e,t,n,r)}finally{Ae=i,Lo.transition=s}}function QB(e,t,n,r){var i=Ae,s=Lo.transition;Lo.transition=null;try{Ae=4,oy(e,t,n,r)}finally{Ae=i,Lo.transition=s}}function oy(e,t,n,r){if(cd){var i=Eg(e,t,n,r);if(i===null)Fp(e,t,r,ud,n),F0(e,r);else if(YB(i,e,t,n,r))r.stopPropagation();else if(F0(e,r),t&4&&-1<KB.indexOf(e)){for(;i!==null;){var s=cc(i);if(s!==null&&qR(s),s=Eg(e,t,n,r),s===null&&Fp(e,t,r,ud,n),s===i)break;i=s}i!==null&&r.stopPropagation()}else Fp(e,t,r,null,n)}}var ud=null;function Eg(e,t,n,r){if(ud=null,e=ny(r),e=cs(e),e!==null)if(t=Bs(e),t===null)e=null;else if(n=t.tag,n===13){if(e=jR(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null);return ud=e,null}function QR(e){switch(e){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(jB()){case ry:return 1;case HR:return 4;case ad:case UB:return 16;case VR:return 536870912;default:return 16}default:return 16}}var bi=null,ay=null,xu=null;function JR(){if(xu)return xu;var e,t=ay,n=t.length,r,i="value"in bi?bi.value:bi.textContent,s=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[s-r];r++);return xu=i.slice(e,1<r?1-r:void 0)}function Eu(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Uc(){return!0}function j0(){return!1}function En(e){function t(n,r,i,s,o){this._reactName=n,this._targetInst=i,this.type=r,this.nativeEvent=s,this.target=o,this.currentTarget=null;for(var a in e)e.hasOwnProperty(a)&&(n=e[a],this[a]=n?n(s):s[a]);return this.isDefaultPrevented=(s.defaultPrevented!=null?s.defaultPrevented:s.returnValue===!1)?Uc:j0,this.isPropagationStopped=j0,this}return Ye(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Uc)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Uc)},persist:function(){},isPersistent:Uc}),t}var na={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ly=En(na),lc=Ye({},na,{view:0,detail:0}),JB=En(lc),Ap,Rp,Na,dh=Ye({},lc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:cy,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Na&&(Na&&e.type==="mousemove"?(Ap=e.screenX-Na.screenX,Rp=e.screenY-Na.screenY):Rp=Ap=0,Na=e),Ap)},movementY:function(e){return"movementY"in e?e.movementY:Rp}}),U0=En(dh),ej=Ye({},dh,{dataTransfer:0}),tj=En(ej),nj=Ye({},lc,{relatedTarget:0}),Np=En(nj),rj=Ye({},na,{animationName:0,elapsedTime:0,pseudoElement:0}),ij=En(rj),sj=Ye({},na,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),oj=En(sj),aj=Ye({},na,{data:0}),$0=En(aj),lj={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cj={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"},uj={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function dj(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=uj[e])?!!t[e]:!1}function cy(){return dj}var hj=Ye({},lc,{key:function(e){if(e.key){var t=lj[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Eu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?cj[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:cy,charCode:function(e){return e.type==="keypress"?Eu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Eu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),pj=En(hj),fj=Ye({},dh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),z0=En(fj),gj=Ye({},lc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:cy}),mj=En(gj),bj=Ye({},na,{propertyName:0,elapsedTime:0,pseudoElement:0}),yj=En(bj),vj=Ye({},dh,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),_j=En(vj),Sj=[9,13,27,32],uy=Vr&&"CompositionEvent"in window,il=null;Vr&&"documentMode"in document&&(il=document.documentMode);var wj=Vr&&"TextEvent"in window&&!il,eN=Vr&&(!uy||il&&8<il&&11>=il),H0=" ",V0=!1;function tN(e,t){switch(e){case"keyup":return Sj.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nN(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var po=!1;function xj(e,t){switch(e){case"compositionend":return nN(t);case"keypress":return t.which!==32?null:(V0=!0,H0);case"textInput":return e=t.data,e===H0&&V0?null:e;default:return null}}function Ej(e,t){if(po)return e==="compositionend"||!uy&&tN(e,t)?(e=JR(),xu=ay=bi=null,po=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return eN&&t.locale!=="ko"?null:t.data;default:return null}}var kj={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 G0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!kj[e.type]:t==="textarea"}function rN(e,t,n,r){DR(r),t=dd(t,"onChange"),0<t.length&&(n=new ly("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var sl=null,Al=null;function Cj(e){fN(e,0)}function hh(e){var t=mo(e);if(TR(t))return e}function Tj(e,t){if(e==="change")return t}var iN=!1;if(Vr){var Ip;if(Vr){var Op="oninput"in document;if(!Op){var W0=document.createElement("div");W0.setAttribute("oninput","return;"),Op=typeof W0.oninput=="function"}Ip=Op}else Ip=!1;iN=Ip&&(!document.documentMode||9<document.documentMode)}function q0(){sl&&(sl.detachEvent("onpropertychange",sN),Al=sl=null)}function sN(e){if(e.propertyName==="value"&&hh(Al)){var t=[];rN(t,Al,e,ny(e)),BR(Cj,t)}}function Aj(e,t,n){e==="focusin"?(q0(),sl=t,Al=n,sl.attachEvent("onpropertychange",sN)):e==="focusout"&&q0()}function Rj(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return hh(Al)}function Nj(e,t){if(e==="click")return hh(t)}function Ij(e,t){if(e==="input"||e==="change")return hh(t)}function Oj(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var tr=typeof Object.is=="function"?Object.is:Oj;function Rl(e,t){if(tr(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!og.call(t,i)||!tr(e[i],t[i]))return!1}return!0}function K0(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Y0(e,t){var n=K0(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=K0(n)}}function oN(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?oN(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function aN(){for(var e=window,t=id();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=id(e.document)}return t}function dy(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Lj(e){var t=aN(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&oN(n.ownerDocument.documentElement,n)){if(r!==null&&dy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,s=Math.min(r.start,i);r=r.end===void 0?s:Math.min(r.end,i),!e.extend&&s>r&&(i=r,r=s,s=i),i=Y0(n,s);var o=Y0(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),s>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<t.length;n++)e=t[n],e.element.scrollLeft=e.left,e.element.scrollTop=e.top}}var Dj=Vr&&"documentMode"in document&&11>=document.documentMode,fo=null,kg=null,ol=null,Cg=!1;function X0(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Cg||fo==null||fo!==id(r)||(r=fo,"selectionStart"in r&&dy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),ol&&Rl(ol,r)||(ol=r,r=dd(kg,"onSelect"),0<r.length&&(t=new ly("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=fo)))}function $c(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var go={animationend:$c("Animation","AnimationEnd"),animationiteration:$c("Animation","AnimationIteration"),animationstart:$c("Animation","AnimationStart"),transitionend:$c("Transition","TransitionEnd")},Lp={},lN={};Vr&&(lN=document.createElement("div").style,"AnimationEvent"in window||(delete go.animationend.animation,delete go.animationiteration.animation,delete go.animationstart.animation),"TransitionEvent"in window||delete go.transitionend.transition);function ph(e){if(Lp[e])return Lp[e];if(!go[e])return e;var t=go[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in lN)return Lp[e]=t[n];return e}var cN=ph("animationend"),uN=ph("animationiteration"),dN=ph("animationstart"),hN=ph("transitionend"),pN=new Map,Z0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function $i(e,t){pN.set(e,t),Fs(t,[e])}for(var Dp=0;Dp<Z0.length;Dp++){var Mp=Z0[Dp],Mj=Mp.toLowerCase(),Pj=Mp[0].toUpperCase()+Mp.slice(1);$i(Mj,"on"+Pj)}$i(cN,"onAnimationEnd");$i(uN,"onAnimationIteration");$i(dN,"onAnimationStart");$i("dblclick","onDoubleClick");$i("focusin","onFocus");$i("focusout","onBlur");$i(hN,"onTransitionEnd");Uo("onMouseEnter",["mouseout","mouseover"]);Uo("onMouseLeave",["mouseout","mouseover"]);Uo("onPointerEnter",["pointerout","pointerover"]);Uo("onPointerLeave",["pointerout","pointerover"]);Fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Fs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ka="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(" "),Fj=new Set("cancel close invalid load scroll toggle".split(" ").concat(Ka));function Q0(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,MB(r,t,void 0,e),e.currentTarget=null}function fN(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;e:{var s=void 0;if(t)for(var o=r.length-1;0<=o;o--){var a=r[o],l=a.instance,c=a.currentTarget;if(a=a.listener,l!==s&&i.isPropagationStopped())break e;Q0(i,a,c),s=l}else for(o=0;o<r.length;o++){if(a=r[o],l=a.instance,c=a.currentTarget,a=a.listener,l!==s&&i.isPropagationStopped())break e;Q0(i,a,c),s=l}}}if(od)throw e=Sg,od=!1,Sg=null,e}function Fe(e,t){var n=t[Ig];n===void 0&&(n=t[Ig]=new Set);var r=e+"__bubble";n.has(r)||(gN(t,e,2,!1),n.add(r))}function Pp(e,t,n){var r=0;t&&(r|=4),gN(n,e,r,t)}var zc="_reactListening"+Math.random().toString(36).slice(2);function Nl(e){if(!e[zc]){e[zc]=!0,wR.forEach(function(n){n!=="selectionchange"&&(Fj.has(n)||Pp(n,!1,e),Pp(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[zc]||(t[zc]=!0,Pp("selectionchange",!1,t))}}function gN(e,t,n,r){switch(QR(t)){case 1:var i=ZB;break;case 4:i=QB;break;default:i=oy}n=i.bind(null,t,n,e),i=void 0,!_g||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(i=!0),r?i!==void 0?e.addEventListener(t,n,{capture:!0,passive:i}):e.addEventListener(t,n,!0):i!==void 0?e.addEventListener(t,n,{passive:i}):e.addEventListener(t,n,!1)}function Fp(e,t,n,r,i){var s=r;if(!(t&1)&&!(t&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var a=r.stateNode.containerInfo;if(a===i||a.nodeType===8&&a.parentNode===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&(l=o.stateNode.containerInfo,l===i||l.nodeType===8&&l.parentNode===i))return;o=o.return}for(;a!==null;){if(o=cs(a),o===null)return;if(l=o.tag,l===5||l===6){r=s=o;continue e}a=a.parentNode}}r=r.return}BR(function(){var c=s,u=ny(n),d=[];e:{var p=pN.get(e);if(p!==void 0){var f=ly,g=e;switch(e){case"keypress":if(Eu(n)===0)break e;case"keydown":case"keyup":f=pj;break;case"focusin":g="focus",f=Np;break;case"focusout":g="blur",f=Np;break;case"beforeblur":case"afterblur":f=Np;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=U0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=tj;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=mj;break;case cN:case uN:case dN:f=ij;break;case hN:f=yj;break;case"scroll":f=JB;break;case"wheel":f=_j;break;case"copy":case"cut":case"paste":f=oj;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=z0}var m=(t&4)!==0,_=!m&&e==="scroll",b=m?p!==null?p+"Capture":null:p;m=[];for(var v=c,S;v!==null;){S=v;var w=S.stateNode;if(S.tag===5&&w!==null&&(S=w,b!==null&&(w=El(v,b),w!=null&&m.push(Il(v,w,S)))),_)break;v=v.return}0<m.length&&(p=new f(p,g,null,n,u),d.push({event:p,listeners:m}))}}if(!(t&7)){e:{if(p=e==="mouseover"||e==="pointerover",f=e==="mouseout"||e==="pointerout",p&&n!==yg&&(g=n.relatedTarget||n.fromElement)&&(cs(g)||g[Gr]))break e;if((f||p)&&(p=u.window===u?u:(p=u.ownerDocument)?p.defaultView||p.parentWindow:window,f?(g=n.relatedTarget||n.toElement,f=c,g=g?cs(g):null,g!==null&&(_=Bs(g),g!==_||g.tag!==5&&g.tag!==6)&&(g=null)):(f=null,g=c),f!==g)){if(m=U0,w="onMouseLeave",b="onMouseEnter",v="mouse",(e==="pointerout"||e==="pointerover")&&(m=z0,w="onPointerLeave",b="onPointerEnter",v="pointer"),_=f==null?p:mo(f),S=g==null?p:mo(g),p=new m(w,v+"leave",f,n,u),p.target=_,p.relatedTarget=S,w=null,cs(u)===c&&(m=new m(b,v+"enter",g,n,u),m.target=S,m.relatedTarget=_,w=m),_=w,f&&g)t:{for(m=f,b=g,v=0,S=m;S;S=Js(S))v++;for(S=0,w=b;w;w=Js(w))S++;for(;0<v-S;)m=Js(m),v--;for(;0<S-v;)b=Js(b),S--;for(;v--;){if(m===b||b!==null&&m===b.alternate)break t;m=Js(m),b=Js(b)}m=null}else m=null;f!==null&&J0(d,p,f,m,!1),g!==null&&_!==null&&J0(d,_,g,m,!0)}}e:{if(p=c?mo(c):window,f=p.nodeName&&p.nodeName.toLowerCase(),f==="select"||f==="input"&&p.type==="file")var k=Tj;else if(G0(p))if(iN)k=Ij;else{k=Rj;var x=Aj}else(f=p.nodeName)&&f.toLowerCase()==="input"&&(p.type==="checkbox"||p.type==="radio")&&(k=Nj);if(k&&(k=k(e,c))){rN(d,k,n,u);break e}x&&x(e,p,c),e==="focusout"&&(x=p._wrapperState)&&x.controlled&&p.type==="number"&&pg(p,"number",p.value)}switch(x=c?mo(c):window,e){case"focusin":(G0(x)||x.contentEditable==="true")&&(fo=x,kg=c,ol=null);break;case"focusout":ol=kg=fo=null;break;case"mousedown":Cg=!0;break;case"contextmenu":case"mouseup":case"dragend":Cg=!1,X0(d,n,u);break;case"selectionchange":if(Dj)break;case"keydown":case"keyup":X0(d,n,u)}var E;if(uy)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else po?tN(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(eN&&n.locale!=="ko"&&(po||T!=="onCompositionStart"?T==="onCompositionEnd"&&po&&(E=JR()):(bi=u,ay="value"in bi?bi.value:bi.textContent,po=!0)),x=dd(c,T),0<x.length&&(T=new $0(T,e,null,n,u),d.push({event:T,listeners:x}),E?T.data=E:(E=nN(n),E!==null&&(T.data=E)))),(E=wj?xj(e,n):Ej(e,n))&&(c=dd(c,"onBeforeInput"),0<c.length&&(u=new $0("onBeforeInput","beforeinput",null,n,u),d.push({event:u,listeners:c}),u.data=E))}fN(d,t)})}function Il(e,t,n){return{instance:e,listener:t,currentTarget:n}}function dd(e,t){for(var n=t+"Capture",r=[];e!==null;){var i=e,s=i.stateNode;i.tag===5&&s!==null&&(i=s,s=El(e,n),s!=null&&r.unshift(Il(e,s,i)),s=El(e,t),s!=null&&r.push(Il(e,s,i))),e=e.return}return r}function Js(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function J0(e,t,n,r,i){for(var s=t._reactName,o=[];n!==null&&n!==r;){var a=n,l=a.alternate,c=a.stateNode;if(l!==null&&l===r)break;a.tag===5&&c!==null&&(a=c,i?(l=El(n,s),l!=null&&o.unshift(Il(n,l,a))):i||(l=El(n,s),l!=null&&o.push(Il(n,l,a)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Bj=/\r\n?/g,jj=/\u0000|\uFFFD/g;function ek(e){return(typeof e=="string"?e:""+e).replace(Bj,`
|
|
39
39
|
`).replace(jj,"")}function Hc(e,t,n){if(t=ek(t),ek(e)!==t&&n)throw Error(W(425))}function hd(){}var Tg=null,Ag=null;function Rg(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Ng=typeof setTimeout=="function"?setTimeout:void 0,Uj=typeof clearTimeout=="function"?clearTimeout:void 0,tk=typeof Promise=="function"?Promise:void 0,$j=typeof queueMicrotask=="function"?queueMicrotask:typeof tk<"u"?function(e){return tk.resolve(null).then(e).catch(zj)}:Ng;function zj(e){setTimeout(function(){throw e})}function Bp(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(r===0){e.removeChild(i),Tl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=i}while(n);Tl(t)}function Ci(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?")break;if(t==="/$")return null}}return e}function nk(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="$"||n==="$!"||n==="$?"){if(t===0)return e;t--}else n==="/$"&&t++}e=e.previousSibling}return null}var ra=Math.random().toString(36).slice(2),mr="__reactFiber$"+ra,Ol="__reactProps$"+ra,Gr="__reactContainer$"+ra,Ig="__reactEvents$"+ra,Hj="__reactListeners$"+ra,Vj="__reactHandles$"+ra;function cs(e){var t=e[mr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[Gr]||n[mr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=nk(e);e!==null;){if(n=e[mr])return n;e=nk(e)}return t}e=n,n=e.parentNode}return null}function cc(e){return e=e[mr]||e[Gr],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function mo(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(W(33))}function fh(e){return e[Ol]||null}var Og=[],bo=-1;function zi(e){return{current:e}}function Ue(e){0>bo||(e.current=Og[bo],Og[bo]=null,bo--)}function De(e,t){bo++,Og[bo]=e.current,e.current=t}var Di={},jt=zi(Di),an=zi(!1),xs=Di;function $o(e,t){var n=e.type.contextTypes;if(!n)return Di;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},s;for(s in n)i[s]=t[s];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function ln(e){return e=e.childContextTypes,e!=null}function pd(){Ue(an),Ue(jt)}function rk(e,t,n){if(jt.current!==Di)throw Error(W(168));De(jt,t),De(an,n)}function mN(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(W(108,AB(e)||"Unknown",i));return Ye({},n,r)}function fd(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Di,xs=jt.current,De(jt,e),De(an,an.current),!0}function ik(e,t,n){var r=e.stateNode;if(!r)throw Error(W(169));n?(e=mN(e,t,xs),r.__reactInternalMemoizedMergedChildContext=e,Ue(an),Ue(jt),De(jt,e)):Ue(an),De(an,n)}var Fr=null,gh=!1,jp=!1;function bN(e){Fr===null?Fr=[e]:Fr.push(e)}function Gj(e){gh=!0,bN(e)}function Hi(){if(!jp&&Fr!==null){jp=!0;var e=0,t=Ae;try{var n=Fr;for(Ae=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}Fr=null,gh=!1}catch(i){throw Fr!==null&&(Fr=Fr.slice(e+1)),zR(ry,Hi),i}finally{Ae=t,jp=!1}}return null}var yo=[],vo=0,gd=null,md=0,Nn=[],In=0,Es=null,jr=1,Ur="";function ns(e,t){yo[vo++]=md,yo[vo++]=gd,gd=e,md=t}function yN(e,t,n){Nn[In++]=jr,Nn[In++]=Ur,Nn[In++]=Es,Es=e;var r=jr;e=Ur;var i=32-Xn(r)-1;r&=~(1<<i),n+=1;var s=32-Xn(t)+i;if(30<s){var o=i-i%5;s=(r&(1<<o)-1).toString(32),r>>=o,i-=o,jr=1<<32-Xn(t)+i|n<<i|r,Ur=s+e}else jr=1<<s|n<<i|r,Ur=e}function hy(e){e.return!==null&&(ns(e,1),yN(e,1,0))}function py(e){for(;e===gd;)gd=yo[--vo],yo[vo]=null,md=yo[--vo],yo[vo]=null;for(;e===Es;)Es=Nn[--In],Nn[In]=null,Ur=Nn[--In],Nn[In]=null,jr=Nn[--In],Nn[In]=null}var yn=null,bn=null,$e=!1,Yn=null;function vN(e,t){var n=Ln(5,null,null,0);n.elementType="DELETED",n.stateNode=t,n.return=e,t=e.deletions,t===null?(e.deletions=[n],e.flags|=16):t.push(n)}function sk(e,t){switch(e.tag){case 5:var n=e.type;return t=t.nodeType!==1||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t,t!==null?(e.stateNode=t,yn=e,bn=Ci(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,yn=e,bn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Es!==null?{id:jr,overflow:Ur}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=Ln(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,yn=e,bn=null,!0):!1;default:return!1}}function Lg(e){return(e.mode&1)!==0&&(e.flags&128)===0}function Dg(e){if($e){var t=bn;if(t){var n=t;if(!sk(e,t)){if(Lg(e))throw Error(W(418));t=Ci(n.nextSibling);var r=yn;t&&sk(e,t)?vN(r,n):(e.flags=e.flags&-4097|2,$e=!1,yn=e)}}else{if(Lg(e))throw Error(W(418));e.flags=e.flags&-4097|2,$e=!1,yn=e}}}function ok(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;yn=e}function Vc(e){if(e!==yn)return!1;if(!$e)return ok(e),$e=!0,!1;var t;if((t=e.tag!==3)&&!(t=e.tag!==5)&&(t=e.type,t=t!=="head"&&t!=="body"&&!Rg(e.type,e.memoizedProps)),t&&(t=bn)){if(Lg(e))throw _N(),Error(W(418));for(;t;)vN(e,t),t=Ci(t.nextSibling)}if(ok(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(W(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){bn=Ci(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}bn=null}}else bn=yn?Ci(e.stateNode.nextSibling):null;return!0}function _N(){for(var e=bn;e;)e=Ci(e.nextSibling)}function zo(){bn=yn=null,$e=!1}function fy(e){Yn===null?Yn=[e]:Yn.push(e)}var Wj=Xr.ReactCurrentBatchConfig;function Ia(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(W(309));var r=n.stateNode}if(!r)throw Error(W(147,e));var i=r,s=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===s?t.ref:(t=function(o){var a=i.refs;o===null?delete a[s]:a[s]=o},t._stringRef=s,t)}if(typeof e!="string")throw Error(W(284));if(!n._owner)throw Error(W(290,e))}return e}function Gc(e,t){throw e=Object.prototype.toString.call(t),Error(W(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function ak(e){var t=e._init;return t(e._payload)}function SN(e){function t(b,v){if(e){var S=b.deletions;S===null?(b.deletions=[v],b.flags|=16):S.push(v)}}function n(b,v){if(!e)return null;for(;v!==null;)t(b,v),v=v.sibling;return null}function r(b,v){for(b=new Map;v!==null;)v.key!==null?b.set(v.key,v):b.set(v.index,v),v=v.sibling;return b}function i(b,v){return b=Ni(b,v),b.index=0,b.sibling=null,b}function s(b,v,S){return b.index=S,e?(S=b.alternate,S!==null?(S=S.index,S<v?(b.flags|=2,v):S):(b.flags|=2,v)):(b.flags|=1048576,v)}function o(b){return e&&b.alternate===null&&(b.flags|=2),b}function a(b,v,S,w){return v===null||v.tag!==6?(v=Wp(S,b.mode,w),v.return=b,v):(v=i(v,S),v.return=b,v)}function l(b,v,S,w){var k=S.type;return k===ho?u(b,v,S.props.children,w,S.key):v!==null&&(v.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===hi&&ak(k)===v.type)?(w=i(v,S.props),w.ref=Ia(b,v,S),w.return=b,w):(w=Iu(S.type,S.key,S.props,null,b.mode,w),w.ref=Ia(b,v,S),w.return=b,w)}function c(b,v,S,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==S.containerInfo||v.stateNode.implementation!==S.implementation?(v=qp(S,b.mode,w),v.return=b,v):(v=i(v,S.children||[]),v.return=b,v)}function u(b,v,S,w,k){return v===null||v.tag!==7?(v=ms(S,b.mode,w,k),v.return=b,v):(v=i(v,S),v.return=b,v)}function d(b,v,S){if(typeof v=="string"&&v!==""||typeof v=="number")return v=Wp(""+v,b.mode,S),v.return=b,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case Dc:return S=Iu(v.type,v.key,v.props,null,b.mode,S),S.ref=Ia(b,null,v),S.return=b,S;case uo:return v=qp(v,b.mode,S),v.return=b,v;case hi:var w=v._init;return d(b,w(v._payload),S)}if(Wa(v)||Ca(v))return v=ms(v,b.mode,S,null),v.return=b,v;Gc(b,v)}return null}function p(b,v,S,w){var k=v!==null?v.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return k!==null?null:a(b,v,""+S,w);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Dc:return S.key===k?l(b,v,S,w):null;case uo:return S.key===k?c(b,v,S,w):null;case hi:return k=S._init,p(b,v,k(S._payload),w)}if(Wa(S)||Ca(S))return k!==null?null:u(b,v,S,w,null);Gc(b,S)}return null}function f(b,v,S,w,k){if(typeof w=="string"&&w!==""||typeof w=="number")return b=b.get(S)||null,a(v,b,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Dc:return b=b.get(w.key===null?S:w.key)||null,l(v,b,w,k);case uo:return b=b.get(w.key===null?S:w.key)||null,c(v,b,w,k);case hi:var x=w._init;return f(b,v,S,x(w._payload),k)}if(Wa(w)||Ca(w))return b=b.get(S)||null,u(v,b,w,k,null);Gc(v,w)}return null}function g(b,v,S,w){for(var k=null,x=null,E=v,T=v=0,D=null;E!==null&&T<S.length;T++){E.index>T?(D=E,E=null):D=E.sibling;var A=p(b,E,S[T],w);if(A===null){E===null&&(E=D);break}e&&E&&A.alternate===null&&t(b,E),v=s(A,v,T),x===null?k=A:x.sibling=A,x=A,E=D}if(T===S.length)return n(b,E),$e&&ns(b,T),k;if(E===null){for(;T<S.length;T++)E=d(b,S[T],w),E!==null&&(v=s(E,v,T),x===null?k=E:x.sibling=E,x=E);return $e&&ns(b,T),k}for(E=r(b,E);T<S.length;T++)D=f(E,b,T,S[T],w),D!==null&&(e&&D.alternate!==null&&E.delete(D.key===null?T:D.key),v=s(D,v,T),x===null?k=D:x.sibling=D,x=D);return e&&E.forEach(function(R){return t(b,R)}),$e&&ns(b,T),k}function m(b,v,S,w){var k=Ca(S);if(typeof k!="function")throw Error(W(150));if(S=k.call(S),S==null)throw Error(W(151));for(var x=k=null,E=v,T=v=0,D=null,A=S.next();E!==null&&!A.done;T++,A=S.next()){E.index>T?(D=E,E=null):D=E.sibling;var R=p(b,E,A.value,w);if(R===null){E===null&&(E=D);break}e&&E&&R.alternate===null&&t(b,E),v=s(R,v,T),x===null?k=R:x.sibling=R,x=R,E=D}if(A.done)return n(b,E),$e&&ns(b,T),k;if(E===null){for(;!A.done;T++,A=S.next())A=d(b,A.value,w),A!==null&&(v=s(A,v,T),x===null?k=A:x.sibling=A,x=A);return $e&&ns(b,T),k}for(E=r(b,E);!A.done;T++,A=S.next())A=f(E,b,T,A.value,w),A!==null&&(e&&A.alternate!==null&&E.delete(A.key===null?T:A.key),v=s(A,v,T),x===null?k=A:x.sibling=A,x=A);return e&&E.forEach(function(I){return t(b,I)}),$e&&ns(b,T),k}function _(b,v,S,w){if(typeof S=="object"&&S!==null&&S.type===ho&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Dc:e:{for(var k=S.key,x=v;x!==null;){if(x.key===k){if(k=S.type,k===ho){if(x.tag===7){n(b,x.sibling),v=i(x,S.props.children),v.return=b,b=v;break e}}else if(x.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===hi&&ak(k)===x.type){n(b,x.sibling),v=i(x,S.props),v.ref=Ia(b,x,S),v.return=b,b=v;break e}n(b,x);break}else t(b,x);x=x.sibling}S.type===ho?(v=ms(S.props.children,b.mode,w,S.key),v.return=b,b=v):(w=Iu(S.type,S.key,S.props,null,b.mode,w),w.ref=Ia(b,v,S),w.return=b,b=w)}return o(b);case uo:e:{for(x=S.key;v!==null;){if(v.key===x)if(v.tag===4&&v.stateNode.containerInfo===S.containerInfo&&v.stateNode.implementation===S.implementation){n(b,v.sibling),v=i(v,S.children||[]),v.return=b,b=v;break e}else{n(b,v);break}else t(b,v);v=v.sibling}v=qp(S,b.mode,w),v.return=b,b=v}return o(b);case hi:return x=S._init,_(b,v,x(S._payload),w)}if(Wa(S))return g(b,v,S,w);if(Ca(S))return m(b,v,S,w);Gc(b,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,v!==null&&v.tag===6?(n(b,v.sibling),v=i(v,S),v.return=b,b=v):(n(b,v),v=Wp(S,b.mode,w),v.return=b,b=v),o(b)):n(b,v)}return _}var Ho=SN(!0),wN=SN(!1),bd=zi(null),yd=null,_o=null,gy=null;function my(){gy=_o=yd=null}function by(e){var t=bd.current;Ue(bd),e._currentValue=t}function Mg(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Do(e,t){yd=e,gy=_o=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(sn=!0),e.firstContext=null)}function jn(e){var t=e._currentValue;if(gy!==e)if(e={context:e,memoizedValue:t,next:null},_o===null){if(yd===null)throw Error(W(308));_o=e,yd.dependencies={lanes:0,firstContext:e}}else _o=_o.next=e;return t}var us=null;function yy(e){us===null?us=[e]:us.push(e)}function xN(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,yy(t)):(n.next=i.next,i.next=n),t.interleaved=n,Wr(e,r)}function Wr(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var pi=!1;function vy(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function EN(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function zr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Ti(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Te&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Wr(e,n)}return i=r.interleaved,i===null?(t.next=t,yy(r)):(t.next=i.next,i.next=t),r.interleaved=t,Wr(e,n)}function ku(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,iy(e,n)}}function lk(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,s=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};s===null?i=s=o:s=s.next=o,n=n.next}while(n!==null);s===null?i=s=t:s=s.next=t}else i=s=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:s,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function vd(e,t,n,r){var i=e.updateQueue;pi=!1;var s=i.firstBaseUpdate,o=i.lastBaseUpdate,a=i.shared.pending;if(a!==null){i.shared.pending=null;var l=a,c=l.next;l.next=null,o===null?s=c:o.next=c,o=l;var u=e.alternate;u!==null&&(u=u.updateQueue,a=u.lastBaseUpdate,a!==o&&(a===null?u.firstBaseUpdate=c:a.next=c,u.lastBaseUpdate=l))}if(s!==null){var d=i.baseState;o=0,u=c=l=null,a=s;do{var p=a.lane,f=a.eventTime;if((r&p)===p){u!==null&&(u=u.next={eventTime:f,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var g=e,m=a;switch(p=t,f=n,m.tag){case 1:if(g=m.payload,typeof g=="function"){d=g.call(f,d,p);break e}d=g;break e;case 3:g.flags=g.flags&-65537|128;case 0:if(g=m.payload,p=typeof g=="function"?g.call(f,d,p):g,p==null)break e;d=Ye({},d,p);break e;case 2:pi=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,p=i.effects,p===null?i.effects=[a]:p.push(a))}else f={eventTime:f,lane:p,tag:a.tag,payload:a.payload,callback:a.callback,next:null},u===null?(c=u=f,l=d):u=u.next=f,o|=p;if(a=a.next,a===null){if(a=i.shared.pending,a===null)break;p=a,a=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(!0);if(u===null&&(l=d),i.baseState=l,i.firstBaseUpdate=c,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else s===null&&(i.shared.lanes=0);Cs|=o,e.lanes=o,e.memoizedState=d}}function ck(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],i=r.callback;if(i!==null){if(r.callback=null,r=n,typeof i!="function")throw Error(W(191,i));i.call(r)}}}var uc={},Sr=zi(uc),Ll=zi(uc),Dl=zi(uc);function ds(e){if(e===uc)throw Error(W(174));return e}function _y(e,t){switch(De(Dl,t),De(Ll,e),De(Sr,uc),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:gg(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=gg(t,e)}Ue(Sr),De(Sr,t)}function Vo(){Ue(Sr),Ue(Ll),Ue(Dl)}function kN(e){ds(Dl.current);var t=ds(Sr.current),n=gg(t,e.type);t!==n&&(De(Ll,e),De(Sr,n))}function Sy(e){Ll.current===e&&(Ue(Sr),Ue(Ll))}var We=zi(0);function _d(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Up=[];function wy(){for(var e=0;e<Up.length;e++)Up[e]._workInProgressVersionPrimary=null;Up.length=0}var Cu=Xr.ReactCurrentDispatcher,$p=Xr.ReactCurrentBatchConfig,ks=0,qe=null,pt=null,yt=null,Sd=!1,al=!1,Ml=0,qj=0;function Lt(){throw Error(W(321))}function xy(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!tr(e[n],t[n]))return!1;return!0}function Ey(e,t,n,r,i,s){if(ks=s,qe=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Cu.current=e===null||e.memoizedState===null?Zj:Qj,e=n(r,i),al){s=0;do{if(al=!1,Ml=0,25<=s)throw Error(W(301));s+=1,yt=pt=null,t.updateQueue=null,Cu.current=Jj,e=n(r,i)}while(al)}if(Cu.current=wd,t=pt!==null&&pt.next!==null,ks=0,yt=pt=qe=null,Sd=!1,t)throw Error(W(300));return e}function ky(){var e=Ml!==0;return Ml=0,e}function dr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?qe.memoizedState=yt=e:yt=yt.next=e,yt}function Un(){if(pt===null){var e=qe.alternate;e=e!==null?e.memoizedState:null}else e=pt.next;var t=yt===null?qe.memoizedState:yt.next;if(t!==null)yt=t,pt=e;else{if(e===null)throw Error(W(310));pt=e,e={memoizedState:pt.memoizedState,baseState:pt.baseState,baseQueue:pt.baseQueue,queue:pt.queue,next:null},yt===null?qe.memoizedState=yt=e:yt=yt.next=e}return yt}function Pl(e,t){return typeof t=="function"?t(e):t}function zp(e){var t=Un(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=pt,i=r.baseQueue,s=n.pending;if(s!==null){if(i!==null){var o=i.next;i.next=s.next,s.next=o}r.baseQueue=i=s,n.pending=null}if(i!==null){s=i.next,r=r.baseState;var a=o=null,l=null,c=s;do{var u=c.lane;if((ks&u)===u)l!==null&&(l=l.next={lane:0,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),r=c.hasEagerState?c.eagerState:e(r,c.action);else{var d={lane:u,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null};l===null?(a=l=d,o=r):l=l.next=d,qe.lanes|=u,Cs|=u}c=c.next}while(c!==null&&c!==s);l===null?o=r:l.next=a,tr(r,t.memoizedState)||(sn=!0),t.memoizedState=r,t.baseState=o,t.baseQueue=l,n.lastRenderedState=r}if(e=n.interleaved,e!==null){i=e;do s=i.lane,qe.lanes|=s,Cs|=s,i=i.next;while(i!==e)}else i===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Hp(e){var t=Un(),n=t.queue;if(n===null)throw Error(W(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,s=t.memoizedState;if(i!==null){n.pending=null;var o=i=i.next;do s=e(s,o.action),o=o.next;while(o!==i);tr(s,t.memoizedState)||(sn=!0),t.memoizedState=s,t.baseQueue===null&&(t.baseState=s),n.lastRenderedState=s}return[s,r]}function CN(){}function TN(e,t){var n=qe,r=Un(),i=t(),s=!tr(r.memoizedState,i);if(s&&(r.memoizedState=i,sn=!0),r=r.queue,Cy(NN.bind(null,n,r,e),[e]),r.getSnapshot!==t||s||yt!==null&&yt.memoizedState.tag&1){if(n.flags|=2048,Fl(9,RN.bind(null,n,r,i,t),void 0,null),xt===null)throw Error(W(349));ks&30||AN(n,t,i)}return i}function AN(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function RN(e,t,n,r){t.value=n,t.getSnapshot=r,IN(t)&&ON(e)}function NN(e,t,n){return n(function(){IN(t)&&ON(e)})}function IN(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!tr(e,n)}catch{return!0}}function ON(e){var t=Wr(e,1);t!==null&&Zn(t,e,1,-1)}function uk(e){var t=dr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:Pl,lastRenderedState:e},t.queue=e,e=e.dispatch=Xj.bind(null,qe,e),[t.memoizedState,e]}function Fl(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=qe.updateQueue,t===null?(t={lastEffect:null,stores:null},qe.updateQueue=t,t.lastEffect=e.next=e):(n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e)),e}function LN(){return Un().memoizedState}function Tu(e,t,n,r){var i=dr();qe.flags|=e,i.memoizedState=Fl(1|t,n,void 0,r===void 0?null:r)}function mh(e,t,n,r){var i=Un();r=r===void 0?null:r;var s=void 0;if(pt!==null){var o=pt.memoizedState;if(s=o.destroy,r!==null&&xy(r,o.deps)){i.memoizedState=Fl(t,n,s,r);return}}qe.flags|=e,i.memoizedState=Fl(1|t,n,s,r)}function dk(e,t){return Tu(8390656,8,e,t)}function Cy(e,t){return mh(2048,8,e,t)}function DN(e,t){return mh(4,2,e,t)}function MN(e,t){return mh(4,4,e,t)}function PN(e,t){if(typeof t=="function")return e=e(),t(e),function(){t(null)};if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function FN(e,t,n){return n=n!=null?n.concat([e]):null,mh(4,4,PN.bind(null,t,e),n)}function Ty(){}function BN(e,t){var n=Un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xy(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function jN(e,t){var n=Un();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&xy(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function UN(e,t,n){return ks&21?(tr(n,t)||(n=GR(),qe.lanes|=n,Cs|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,sn=!0),e.memoizedState=n)}function Kj(e,t){var n=Ae;Ae=n!==0&&4>n?n:4,e(!0);var r=$p.transition;$p.transition={};try{e(!1),t()}finally{Ae=n,$p.transition=r}}function $N(){return Un().memoizedState}function Yj(e,t,n){var r=Ri(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},zN(e))HN(t,n);else if(n=xN(e,t,n,r),n!==null){var i=Xt();Zn(n,e,r,i),VN(n,t,r)}}function Xj(e,t,n){var r=Ri(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(zN(e))HN(t,i);else{var s=e.alternate;if(e.lanes===0&&(s===null||s.lanes===0)&&(s=t.lastRenderedReducer,s!==null))try{var o=t.lastRenderedState,a=s(o,n);if(i.hasEagerState=!0,i.eagerState=a,tr(a,o)){var l=t.interleaved;l===null?(i.next=i,yy(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=xN(e,t,i,r),n!==null&&(i=Xt(),Zn(n,e,r,i),VN(n,t,r))}}function zN(e){var t=e.alternate;return e===qe||t!==null&&t===qe}function HN(e,t){al=Sd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function VN(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,iy(e,n)}}var wd={readContext:jn,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},Zj={readContext:jn,useCallback:function(e,t){return dr().memoizedState=[e,t===void 0?null:t],e},useContext:jn,useEffect:dk,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Tu(4194308,4,PN.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Tu(4194308,4,e,t)},useInsertionEffect:function(e,t){return Tu(4,2,e,t)},useMemo:function(e,t){var n=dr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=dr();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=Yj.bind(null,qe,e),[r.memoizedState,e]},useRef:function(e){var t=dr();return e={current:e},t.memoizedState=e},useState:uk,useDebugValue:Ty,useDeferredValue:function(e){return dr().memoizedState=e},useTransition:function(){var e=uk(!1),t=e[0];return e=Kj.bind(null,e[1]),dr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=qe,i=dr();if($e){if(n===void 0)throw Error(W(407));n=n()}else{if(n=t(),xt===null)throw Error(W(349));ks&30||AN(r,t,n)}i.memoizedState=n;var s={value:n,getSnapshot:t};return i.queue=s,dk(NN.bind(null,r,s,e),[e]),r.flags|=2048,Fl(9,RN.bind(null,r,s,n,t),void 0,null),n},useId:function(){var e=dr(),t=xt.identifierPrefix;if($e){var n=Ur,r=jr;n=(r&~(1<<32-Xn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ml++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=qj++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},Qj={readContext:jn,useCallback:BN,useContext:jn,useEffect:Cy,useImperativeHandle:FN,useInsertionEffect:DN,useLayoutEffect:MN,useMemo:jN,useReducer:zp,useRef:LN,useState:function(){return zp(Pl)},useDebugValue:Ty,useDeferredValue:function(e){var t=Un();return UN(t,pt.memoizedState,e)},useTransition:function(){var e=zp(Pl)[0],t=Un().memoizedState;return[e,t]},useMutableSource:CN,useSyncExternalStore:TN,useId:$N,unstable_isNewReconciler:!1},Jj={readContext:jn,useCallback:BN,useContext:jn,useEffect:Cy,useImperativeHandle:FN,useInsertionEffect:DN,useLayoutEffect:MN,useMemo:jN,useReducer:Hp,useRef:LN,useState:function(){return Hp(Pl)},useDebugValue:Ty,useDeferredValue:function(e){var t=Un();return pt===null?t.memoizedState=e:UN(t,pt.memoizedState,e)},useTransition:function(){var e=Hp(Pl)[0],t=Un().memoizedState;return[e,t]},useMutableSource:CN,useSyncExternalStore:TN,useId:$N,unstable_isNewReconciler:!1};function qn(e,t){if(e&&e.defaultProps){t=Ye({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}function Pg(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Ye({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var bh={isMounted:function(e){return(e=e._reactInternals)?Bs(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Xt(),i=Ri(e),s=zr(r,i);s.payload=t,n!=null&&(s.callback=n),t=Ti(e,s,i),t!==null&&(Zn(t,e,i,r),ku(t,e,i))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Xt(),i=Ri(e),s=zr(r,i);s.tag=1,s.payload=t,n!=null&&(s.callback=n),t=Ti(e,s,i),t!==null&&(Zn(t,e,i,r),ku(t,e,i))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Xt(),r=Ri(e),i=zr(n,r);i.tag=2,t!=null&&(i.callback=t),t=Ti(e,i,r),t!==null&&(Zn(t,e,r,n),ku(t,e,r))}};function hk(e,t,n,r,i,s,o){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,s,o):t.prototype&&t.prototype.isPureReactComponent?!Rl(n,r)||!Rl(i,s):!0}function GN(e,t,n){var r=!1,i=Di,s=t.contextType;return typeof s=="object"&&s!==null?s=jn(s):(i=ln(t)?xs:jt.current,r=t.contextTypes,s=(r=r!=null)?$o(e,i):Di),t=new t(n,s),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=bh,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),t}function pk(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&bh.enqueueReplaceState(t,t.state,null)}function Fg(e,t,n,r){var i=e.stateNode;i.props=n,i.state=e.memoizedState,i.refs={},vy(e);var s=t.contextType;typeof s=="object"&&s!==null?i.context=jn(s):(s=ln(t)?xs:jt.current,i.context=$o(e,s)),i.state=e.memoizedState,s=t.getDerivedStateFromProps,typeof s=="function"&&(Pg(e,t,s,n),i.state=e.memoizedState),typeof t.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(t=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),t!==i.state&&bh.enqueueReplaceState(i,i.state,null),vd(e,n,i,r),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308)}function Go(e,t){try{var n="",r=t;do n+=TB(r),r=r.return;while(r);var i=n}catch(s){i=`
|
|
40
40
|
Error generating stack: `+s.message+`
|
|
41
|
-
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function Vp(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Bg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var e3=typeof WeakMap=="function"?WeakMap:Map;function WN(e,t,n){n=zr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ed||(Ed=!0,Kg=r),Bg(e,t)},n}function qN(e,t,n){n=zr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Bg(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Bg(e,t),typeof r!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function fk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new e3;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=f3.bind(null,e,t,n),t.then(e,e))}function gk(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function mk(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=zr(-1,1),t.tag=2,Ti(n,t,1))),n.lanes|=1),e)}var t3=Xr.ReactCurrentOwner,sn=!1;function Gt(e,t,n,r){t.child=e===null?wN(t,null,n,r):Ho(t,e.child,n,r)}function bk(e,t,n,r,i){n=n.render;var s=t.ref;return Do(t,i),r=Ey(e,t,n,r,s,i),n=ky(),e!==null&&!sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,qr(e,t,i)):($e&&n&&hy(t),t.flags|=1,Gt(e,t,r,i),t.child)}function yk(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!My(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,KN(e,t,s,r,i)):(e=Iu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Rl,n(o,r)&&e.ref===t.ref)return qr(e,t,i)}return t.flags|=1,e=Ni(s,r),e.ref=t.ref,e.return=t,t.child=e}function KN(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Rl(s,r)&&e.ref===t.ref)if(sn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(sn=!0);else return t.lanes=e.lanes,qr(e,t,i)}return jg(e,t,n,r,i)}function YN(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},De(wo,gn),gn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,De(wo,gn),gn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,De(wo,gn),gn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,De(wo,gn),gn|=r;return Gt(e,t,i,n),t.child}function XN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function jg(e,t,n,r,i){var s=ln(n)?xs:jt.current;return s=$o(t,s),Do(t,i),n=Ey(e,t,n,r,s,i),r=ky(),e!==null&&!sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,qr(e,t,i)):($e&&r&&hy(t),t.flags|=1,Gt(e,t,n,i),t.child)}function vk(e,t,n,r,i){if(ln(n)){var s=!0;fd(t)}else s=!1;if(Do(t,i),t.stateNode===null)Au(e,t),GN(t,n,r),Fg(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=jn(c):(c=ln(n)?xs:jt.current,c=$o(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&pk(t,o,r,c),pi=!1;var p=t.memoizedState;o.state=p,vd(t,r,o,i),l=t.memoizedState,a!==r||p!==l||an.current||pi?(typeof u=="function"&&(Pg(t,n,u,r),l=t.memoizedState),(a=pi||hk(t,n,a,r,p,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,EN(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:qn(t.type,a),o.props=c,d=t.pendingProps,p=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=jn(l):(l=ln(n)?xs:jt.current,l=$o(t,l));var f=n.getDerivedStateFromProps;(u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||p!==l)&&pk(t,o,r,l),pi=!1,p=t.memoizedState,o.state=p,vd(t,r,o,i);var g=t.memoizedState;a!==d||p!==g||an.current||pi?(typeof f=="function"&&(Pg(t,n,f,r),g=t.memoizedState),(c=pi||hk(t,n,c,r,p,g,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Ug(e,t,n,r,s,i)}function Ug(e,t,n,r,i,s){XN(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&ik(t,n,!1),qr(e,t,s);r=t.stateNode,t3.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ho(t,e.child,null,s),t.child=Ho(t,null,a,s)):Gt(e,t,a,s),t.memoizedState=r.state,i&&ik(t,n,!0),t.child}function ZN(e){var t=e.stateNode;t.pendingContext?rk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rk(e,t.context,!1),_y(e,t.containerInfo)}function _k(e,t,n,r,i){return zo(),fy(i),t.flags|=256,Gt(e,t,n,r),t.child}var $g={dehydrated:null,treeContext:null,retryLane:0};function zg(e){return{baseLanes:e,cachePool:null,transitions:null}}function QN(e,t,n){var r=t.pendingProps,i=We.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),De(We,i&1),e===null)return Dg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=_h(o,r,0,null),e=ms(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=zg(n),t.memoizedState=$g,e):Ay(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return n3(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Ni(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Ni(a,s):(s=ms(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?zg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=$g,r}return s=e.child,e=s.sibling,r=Ni(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ay(e,t){return t=_h({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Wc(e,t,n,r){return r!==null&&fy(r),Ho(t,e.child,null,n),e=Ay(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function n3(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=Vp(Error(W(422))),Wc(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=_h({mode:"visible",children:r.children},i,0,null),s=ms(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Ho(t,e.child,null,o),t.child.memoizedState=zg(o),t.memoizedState=$g,s);if(!(t.mode&1))return Wc(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(W(419)),r=Vp(s,r,void 0),Wc(e,t,o,r)}if(a=(o&e.childLanes)!==0,sn||a){if(r=xt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Wr(e,i),Zn(r,e,i,-1))}return Dy(),r=Vp(Error(W(421))),Wc(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=g3.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,bn=Ci(i.nextSibling),yn=t,$e=!0,Yn=null,e!==null&&(Nn[In++]=jr,Nn[In++]=Ur,Nn[In++]=Es,jr=e.id,Ur=e.overflow,Es=t),t=Ay(t,r.children),t.flags|=4096,t)}function Sk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mg(e.return,t,n)}function Gp(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function JN(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Gt(e,t,r.children,n),r=We.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sk(e,n,t);else if(e.tag===19)Sk(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(De(We,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&_d(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Gp(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&_d(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Gp(t,!0,n,null,s);break;case"together":Gp(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Au(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Cs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=Ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function r3(e,t,n){switch(t.tag){case 3:ZN(t),zo();break;case 5:kN(t);break;case 1:ln(t.type)&&fd(t);break;case 4:_y(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;De(bd,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(De(We,We.current&1),t.flags|=128,null):n&t.child.childLanes?QN(e,t,n):(De(We,We.current&1),e=qr(e,t,n),e!==null?e.sibling:null);De(We,We.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return JN(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),De(We,We.current),r)break;return null;case 22:case 23:return t.lanes=0,YN(e,t,n)}return qr(e,t,n)}var eI,Hg,tI,nI;eI=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Hg=function(){};tI=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,ds(Sr.current);var s=null;switch(n){case"input":i=dg(e,i),r=dg(e,r),s=[];break;case"select":i=Ye({},i,{value:void 0}),r=Ye({},r,{value:void 0}),s=[];break;case"textarea":i=fg(e,i),r=fg(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=hd)}mg(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(wl.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(wl.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Fe("scroll",e),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};nI=function(e,t,n,r){n!==r&&(t.flags|=4)};function Oa(e,t){if(!$e)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function i3(e,t,n){var r=t.pendingProps;switch(py(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(t),null;case 1:return ln(t.type)&&pd(),Dt(t),null;case 3:return r=t.stateNode,Vo(),Ue(an),Ue(jt),wy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Vc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Yn!==null&&(Zg(Yn),Yn=null))),Hg(e,t),Dt(t),null;case 5:Sy(t);var i=ds(Dl.current);if(n=t.type,e!==null&&t.stateNode!=null)tI(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(W(166));return Dt(t),null}if(e=ds(Sr.current),Vc(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[mr]=t,r[Ol]=s,e=(t.mode&1)!==0,n){case"dialog":Fe("cancel",r),Fe("close",r);break;case"iframe":case"object":case"embed":Fe("load",r);break;case"video":case"audio":for(i=0;i<Ka.length;i++)Fe(Ka[i],r);break;case"source":Fe("error",r);break;case"img":case"image":case"link":Fe("error",r),Fe("load",r);break;case"details":Fe("toggle",r);break;case"input":N0(r,s),Fe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Fe("invalid",r);break;case"textarea":O0(r,s),Fe("invalid",r)}mg(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Hc(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Hc(r.textContent,a,e),i=["children",""+a]):wl.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Fe("scroll",r)}switch(n){case"input":Mc(r),I0(r,s,!0);break;case"textarea":Mc(r),L0(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=hd)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=NR(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[mr]=t,e[Ol]=r,eI(e,t,!1,!1),t.stateNode=e;e:{switch(o=bg(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ka.length;i++)Fe(Ka[i],e);i=r;break;case"source":Fe("error",e),i=r;break;case"img":case"image":case"link":Fe("error",e),Fe("load",e),i=r;break;case"details":Fe("toggle",e),i=r;break;case"input":N0(e,r),i=dg(e,r),Fe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ye({},r,{value:void 0}),Fe("invalid",e);break;case"textarea":O0(e,r),i=fg(e,r),Fe("invalid",e);break;default:i=r}mg(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?LR(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&IR(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&xl(e,l):typeof l=="number"&&xl(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(wl.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Fe("scroll",e):l!=null&&Qb(e,s,l,o))}switch(n){case"input":Mc(e),I0(e,r,!1);break;case"textarea":Mc(e),L0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Li(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?No(e,!!r.multiple,s,!1):r.defaultValue!=null&&No(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=hd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Dt(t),null;case 6:if(e&&t.stateNode!=null)nI(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(W(166));if(n=ds(Dl.current),ds(Sr.current),Vc(t)){if(r=t.stateNode,n=t.memoizedProps,r[mr]=t,(s=r.nodeValue!==n)&&(e=yn,e!==null))switch(e.tag){case 3:Hc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Hc(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[mr]=t,t.stateNode=r}return Dt(t),null;case 13:if(Ue(We),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($e&&bn!==null&&t.mode&1&&!(t.flags&128))_N(),zo(),t.flags|=98560,s=!1;else if(s=Vc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(W(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(W(317));s[mr]=t}else zo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Dt(t),s=!1}else Yn!==null&&(Zg(Yn),Yn=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||We.current&1?ft===0&&(ft=3):Dy())),t.updateQueue!==null&&(t.flags|=4),Dt(t),null);case 4:return Vo(),Hg(e,t),e===null&&Nl(t.stateNode.containerInfo),Dt(t),null;case 10:return by(t.type._context),Dt(t),null;case 17:return ln(t.type)&&pd(),Dt(t),null;case 19:if(Ue(We),s=t.memoizedState,s===null)return Dt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Oa(s,!1);else{if(ft!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=_d(e),o!==null){for(t.flags|=128,Oa(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return De(We,We.current&1|2),t.child}e=e.sibling}s.tail!==null&&tt()>Wo&&(t.flags|=128,r=!0,Oa(s,!1),t.lanes=4194304)}else{if(!r)if(e=_d(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Oa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$e)return Dt(t),null}else 2*tt()-s.renderingStartTime>Wo&&n!==1073741824&&(t.flags|=128,r=!0,Oa(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=tt(),t.sibling=null,n=We.current,De(We,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return Ly(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?gn&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function s3(e,t){switch(py(t),t.tag){case 1:return ln(t.type)&&pd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vo(),Ue(an),Ue(jt),wy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Sy(t),null;case 13:if(Ue(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));zo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(We),null;case 4:return Vo(),null;case 10:return by(t.type._context),null;case 22:case 23:return Ly(),null;case 24:return null;default:return null}}var qc=!1,Pt=!1,o3=typeof WeakSet=="function"?WeakSet:Set,J=null;function So(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qe(e,t,r)}else n.current=null}function Vg(e,t,n){try{n()}catch(r){Qe(e,t,r)}}var wk=!1;function a3(e,t){if(Tg=cd,e=aN(),dy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var f;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)p=d,d=f;for(;;){if(d===e)break t;if(p===n&&++c===i&&(a=o),p===s&&++u===r&&(l=o),(f=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ag={focusedElem:e,selectionRange:n},cd=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,_=g.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:qn(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(w){Qe(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return g=wk,wk=!1,g}function ll(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Vg(t,n,s)}i=i.next}while(i!==r)}}function yh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rI(e){var t=e.alternate;t!==null&&(e.alternate=null,rI(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mr],delete t[Ol],delete t[Ig],delete t[Hj],delete t[Vj])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function iI(e){return e.tag===5||e.tag===3||e.tag===4}function xk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iI(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=hd));else if(r!==4&&(e=e.child,e!==null))for(Wg(e,t,n),e=e.sibling;e!==null;)Wg(e,t,n),e=e.sibling}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}var kt=null,Kn=!1;function ni(e,t,n){for(n=n.child;n!==null;)sI(e,t,n),n=n.sibling}function sI(e,t,n){if(_r&&typeof _r.onCommitFiberUnmount=="function")try{_r.onCommitFiberUnmount(uh,n)}catch{}switch(n.tag){case 5:Pt||So(n,t);case 6:var r=kt,i=Kn;kt=null,ni(e,t,n),kt=r,Kn=i,kt!==null&&(Kn?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Kn?(e=kt,n=n.stateNode,e.nodeType===8?Bp(e.parentNode,n):e.nodeType===1&&Bp(e,n),Tl(e)):Bp(kt,n.stateNode));break;case 4:r=kt,i=Kn,kt=n.stateNode.containerInfo,Kn=!0,ni(e,t,n),kt=r,Kn=i;break;case 0:case 11:case 14:case 15:if(!Pt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Vg(n,t,o),i=i.next}while(i!==r)}ni(e,t,n);break;case 1:if(!Pt&&(So(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Qe(n,t,a)}ni(e,t,n);break;case 21:ni(e,t,n);break;case 22:n.mode&1?(Pt=(r=Pt)||n.memoizedState!==null,ni(e,t,n),Pt=r):ni(e,t,n);break;default:ni(e,t,n)}}function Ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new o3),t.forEach(function(r){var i=m3.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function zn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:kt=a.stateNode,Kn=!1;break e;case 3:kt=a.stateNode.containerInfo,Kn=!0;break e;case 4:kt=a.stateNode.containerInfo,Kn=!0;break e}a=a.return}if(kt===null)throw Error(W(160));sI(s,o,i),kt=null,Kn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Qe(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)oI(t,e),t=t.sibling}function oI(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(zn(t,e),ar(e),r&4){try{ll(3,e,e.return),yh(3,e)}catch(m){Qe(e,e.return,m)}try{ll(5,e,e.return)}catch(m){Qe(e,e.return,m)}}break;case 1:zn(t,e),ar(e),r&512&&n!==null&&So(n,n.return);break;case 5:if(zn(t,e),ar(e),r&512&&n!==null&&So(n,n.return),e.flags&32){var i=e.stateNode;try{xl(i,"")}catch(m){Qe(e,e.return,m)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&AR(i,s),bg(a,o);var c=bg(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?LR(i,d):u==="dangerouslySetInnerHTML"?IR(i,d):u==="children"?xl(i,d):Qb(i,u,d,c)}switch(a){case"input":hg(i,s);break;case"textarea":RR(i,s);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?No(i,!!s.multiple,f,!1):p!==!!s.multiple&&(s.defaultValue!=null?No(i,!!s.multiple,s.defaultValue,!0):No(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ol]=s}catch(m){Qe(e,e.return,m)}}break;case 6:if(zn(t,e),ar(e),r&4){if(e.stateNode===null)throw Error(W(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(m){Qe(e,e.return,m)}}break;case 3:if(zn(t,e),ar(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Tl(t.containerInfo)}catch(m){Qe(e,e.return,m)}break;case 4:zn(t,e),ar(e);break;case 13:zn(t,e),ar(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Iy=tt())),r&4&&Ek(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Pt=(c=Pt)||u,zn(t,e),Pt=c):zn(t,e),ar(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(J=e,u=e.child;u!==null;){for(d=J=u;J!==null;){switch(p=J,f=p.child,p.tag){case 0:case 11:case 14:case 15:ll(4,p,p.return);break;case 1:So(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){Qe(r,n,m)}}break;case 5:So(p,p.return);break;case 22:if(p.memoizedState!==null){Ck(d);continue}}f!==null?(f.return=p,J=f):Ck(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=OR("display",o))}catch(m){Qe(e,e.return,m)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(m){Qe(e,e.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:zn(t,e),ar(e),r&4&&Ek(e);break;case 21:break;default:zn(t,e),ar(e)}}function ar(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(iI(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(xl(i,""),r.flags&=-33);var s=xk(e);qg(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=xk(e);Wg(e,a,o);break;default:throw Error(W(161))}}catch(l){Qe(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function l3(e,t,n){J=e,aI(e)}function aI(e,t,n){for(var r=(e.mode&1)!==0;J!==null;){var i=J,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||qc;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Pt;a=qc;var c=Pt;if(qc=o,(Pt=l)&&!c)for(J=i;J!==null;)o=J,l=o.child,o.tag===22&&o.memoizedState!==null?Tk(i):l!==null?(l.return=o,J=l):Tk(i);for(;s!==null;)J=s,aI(s),s=s.sibling;J=i,qc=a,Pt=c}kk(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,J=s):kk(e)}}function kk(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Pt||yh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Pt)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:qn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&ck(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ck(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Tl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}Pt||t.flags&512&&Gg(t)}catch(p){Qe(t,t.return,p)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function Ck(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function Tk(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{yh(4,t)}catch(l){Qe(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Qe(t,i,l)}}var s=t.return;try{Gg(t)}catch(l){Qe(t,s,l)}break;case 5:var o=t.return;try{Gg(t)}catch(l){Qe(t,o,l)}}}catch(l){Qe(t,t.return,l)}if(t===e){J=null;break}var a=t.sibling;if(a!==null){a.return=t.return,J=a;break}J=t.return}}var c3=Math.ceil,xd=Xr.ReactCurrentDispatcher,Ry=Xr.ReactCurrentOwner,Mn=Xr.ReactCurrentBatchConfig,Te=0,xt=null,at=null,Nt=0,gn=0,wo=zi(0),ft=0,Bl=null,Cs=0,vh=0,Ny=0,cl=null,rn=null,Iy=0,Wo=1/0,Pr=null,Ed=!1,Kg=null,Ai=null,Kc=!1,yi=null,kd=0,ul=0,Yg=null,Ru=-1,Nu=0;function Xt(){return Te&6?tt():Ru!==-1?Ru:Ru=tt()}function Ri(e){return e.mode&1?Te&2&&Nt!==0?Nt&-Nt:Wj.transition!==null?(Nu===0&&(Nu=GR()),Nu):(e=Ae,e!==0||(e=window.event,e=e===void 0?16:QR(e.type)),e):1}function Zn(e,t,n,r){if(50<ul)throw ul=0,Yg=null,Error(W(185));ac(e,n,r),(!(Te&2)||e!==xt)&&(e===xt&&(!(Te&2)&&(vh|=n),ft===4&&mi(e,Nt)),cn(e,r),n===1&&Te===0&&!(t.mode&1)&&(Wo=tt()+500,gh&&Hi()))}function cn(e,t){var n=e.callbackNode;WB(e,t);var r=ld(e,e===xt?Nt:0);if(r===0)n!==null&&P0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&P0(n),t===1)e.tag===0?Gj(Ak.bind(null,e)):bN(Ak.bind(null,e)),$j(function(){!(Te&6)&&Hi()}),n=null;else{switch(WR(r)){case 1:n=ry;break;case 4:n=HR;break;case 16:n=ad;break;case 536870912:n=VR;break;default:n=ad}n=gI(n,lI.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lI(e,t){if(Ru=-1,Nu=0,Te&6)throw Error(W(327));var n=e.callbackNode;if(Mo()&&e.callbackNode!==n)return null;var r=ld(e,e===xt?Nt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Cd(e,r);else{t=r;var i=Te;Te|=2;var s=uI();(xt!==e||Nt!==t)&&(Pr=null,Wo=tt()+500,gs(e,t));do try{h3();break}catch(a){cI(e,a)}while(!0);my(),xd.current=s,Te=i,at!==null?t=0:(xt=null,Nt=0,t=ft)}if(t!==0){if(t===2&&(i=wg(e),i!==0&&(r=i,t=Xg(e,i))),t===1)throw n=Bl,gs(e,0),mi(e,r),cn(e,tt()),n;if(t===6)mi(e,r);else{if(i=e.current.alternate,!(r&30)&&!u3(i)&&(t=Cd(e,r),t===2&&(s=wg(e),s!==0&&(r=s,t=Xg(e,s))),t===1))throw n=Bl,gs(e,0),mi(e,r),cn(e,tt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(W(345));case 2:rs(e,rn,Pr);break;case 3:if(mi(e,r),(r&130023424)===r&&(t=Iy+500-tt(),10<t)){if(ld(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Xt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Ng(rs.bind(null,e,rn,Pr),t);break}rs(e,rn,Pr);break;case 4:if(mi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Xn(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=tt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*c3(r/1960))-r,10<r){e.timeoutHandle=Ng(rs.bind(null,e,rn,Pr),r);break}rs(e,rn,Pr);break;case 5:rs(e,rn,Pr);break;default:throw Error(W(329))}}}return cn(e,tt()),e.callbackNode===n?lI.bind(null,e):null}function Xg(e,t){var n=cl;return e.current.memoizedState.isDehydrated&&(gs(e,t).flags|=256),e=Cd(e,t),e!==2&&(t=rn,rn=n,t!==null&&Zg(t)),e}function Zg(e){rn===null?rn=e:rn.push.apply(rn,e)}function u3(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!tr(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function mi(e,t){for(t&=~Ny,t&=~vh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Xn(t),r=1<<n;e[n]=-1,t&=~r}}function Ak(e){if(Te&6)throw Error(W(327));Mo();var t=ld(e,0);if(!(t&1))return cn(e,tt()),null;var n=Cd(e,t);if(e.tag!==0&&n===2){var r=wg(e);r!==0&&(t=r,n=Xg(e,r))}if(n===1)throw n=Bl,gs(e,0),mi(e,t),cn(e,tt()),n;if(n===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,rs(e,rn,Pr),cn(e,tt()),null}function Oy(e,t){var n=Te;Te|=1;try{return e(t)}finally{Te=n,Te===0&&(Wo=tt()+500,gh&&Hi())}}function Ts(e){yi!==null&&yi.tag===0&&!(Te&6)&&Mo();var t=Te;Te|=1;var n=Mn.transition,r=Ae;try{if(Mn.transition=null,Ae=1,e)return e()}finally{Ae=r,Mn.transition=n,Te=t,!(Te&6)&&Hi()}}function Ly(){gn=wo.current,Ue(wo)}function gs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Uj(n)),at!==null)for(n=at.return;n!==null;){var r=n;switch(py(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&pd();break;case 3:Vo(),Ue(an),Ue(jt),wy();break;case 5:Sy(r);break;case 4:Vo();break;case 13:Ue(We);break;case 19:Ue(We);break;case 10:by(r.type._context);break;case 22:case 23:Ly()}n=n.return}if(xt=e,at=e=Ni(e.current,null),Nt=gn=t,ft=0,Bl=null,Ny=vh=Cs=0,rn=cl=null,us!==null){for(t=0;t<us.length;t++)if(n=us[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}us=null}return e}function cI(e,t){do{var n=at;try{if(my(),Cu.current=wd,Sd){for(var r=qe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Sd=!1}if(ks=0,yt=pt=qe=null,al=!1,Ml=0,Ry.current=null,n===null||n.return===null){ft=1,Bl=t,at=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=Nt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var f=gk(o);if(f!==null){f.flags&=-257,mk(f,o,a,s,t),f.mode&1&&fk(s,c,t),t=f,l=c;var g=t.updateQueue;if(g===null){var m=new Set;m.add(l),t.updateQueue=m}else g.add(l);break e}else{if(!(t&1)){fk(s,c,t),Dy();break e}l=Error(W(426))}}else if($e&&a.mode&1){var _=gk(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),mk(_,o,a,s,t),fy(Go(l,a));break e}}s=l=Go(l,a),ft!==4&&(ft=2),cl===null?cl=[s]:cl.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var b=WN(s,l,t);lk(s,b);break e;case 1:a=l;var v=s.type,S=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ai===null||!Ai.has(S)))){s.flags|=65536,t&=-t,s.lanes|=t;var w=qN(s,a,t);lk(s,w);break e}}s=s.return}while(s!==null)}hI(n)}catch(k){t=k,at===n&&n!==null&&(at=n=n.return);continue}break}while(!0)}function uI(){var e=xd.current;return xd.current=wd,e===null?wd:e}function Dy(){(ft===0||ft===3||ft===2)&&(ft=4),xt===null||!(Cs&268435455)&&!(vh&268435455)||mi(xt,Nt)}function Cd(e,t){var n=Te;Te|=2;var r=uI();(xt!==e||Nt!==t)&&(Pr=null,gs(e,t));do try{d3();break}catch(i){cI(e,i)}while(!0);if(my(),Te=n,xd.current=r,at!==null)throw Error(W(261));return xt=null,Nt=0,ft}function d3(){for(;at!==null;)dI(at)}function h3(){for(;at!==null&&!FB();)dI(at)}function dI(e){var t=fI(e.alternate,e,gn);e.memoizedProps=e.pendingProps,t===null?hI(e):at=t,Ry.current=null}function hI(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=s3(n,t),n!==null){n.flags&=32767,at=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ft=6,at=null;return}}else if(n=i3(n,t,gn),n!==null){at=n;return}if(t=t.sibling,t!==null){at=t;return}at=t=e}while(t!==null);ft===0&&(ft=5)}function rs(e,t,n){var r=Ae,i=Mn.transition;try{Mn.transition=null,Ae=1,p3(e,t,n,r)}finally{Mn.transition=i,Ae=r}return null}function p3(e,t,n,r){do Mo();while(yi!==null);if(Te&6)throw Error(W(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(qB(e,s),e===xt&&(at=xt=null,Nt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Kc||(Kc=!0,gI(ad,function(){return Mo(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Mn.transition,Mn.transition=null;var o=Ae;Ae=1;var a=Te;Te|=4,Ry.current=null,a3(e,n),oI(n,e),Lj(Ag),cd=!!Tg,Ag=Tg=null,e.current=n,l3(n),BB(),Te=a,Ae=o,Mn.transition=s}else e.current=n;if(Kc&&(Kc=!1,yi=e,kd=i),s=e.pendingLanes,s===0&&(Ai=null),$B(n.stateNode),cn(e,tt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ed)throw Ed=!1,e=Kg,Kg=null,e;return kd&1&&e.tag!==0&&Mo(),s=e.pendingLanes,s&1?e===Yg?ul++:(ul=0,Yg=e):ul=0,Hi(),null}function Mo(){if(yi!==null){var e=WR(kd),t=Mn.transition,n=Ae;try{if(Mn.transition=null,Ae=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,kd=0,Te&6)throw Error(W(331));var i=Te;for(Te|=4,J=e.current;J!==null;){var s=J,o=s.child;if(J.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(J=c;J!==null;){var u=J;switch(u.tag){case 0:case 11:case 15:ll(8,u,s)}var d=u.child;if(d!==null)d.return=u,J=d;else for(;J!==null;){u=J;var p=u.sibling,f=u.return;if(rI(u),u===c){J=null;break}if(p!==null){p.return=f,J=p;break}J=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var _=m.sibling;m.sibling=null,m=_}while(m!==null)}}J=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,J=o;else e:for(;J!==null;){if(s=J,s.flags&2048)switch(s.tag){case 0:case 11:case 15:ll(9,s,s.return)}var b=s.sibling;if(b!==null){b.return=s.return,J=b;break e}J=s.return}}var v=e.current;for(J=v;J!==null;){o=J;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,J=S;else e:for(o=v;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:yh(9,a)}}catch(k){Qe(a,a.return,k)}if(a===o){J=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,J=w;break e}J=a.return}}if(Te=i,Hi(),_r&&typeof _r.onPostCommitFiberRoot=="function")try{_r.onPostCommitFiberRoot(uh,e)}catch{}r=!0}return r}finally{Ae=n,Mn.transition=t}}return!1}function Rk(e,t,n){t=Go(n,t),t=WN(e,t,1),e=Ti(e,t,1),t=Xt(),e!==null&&(ac(e,1,t),cn(e,t))}function Qe(e,t,n){if(e.tag===3)Rk(e,e,n);else for(;t!==null;){if(t.tag===3){Rk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ai===null||!Ai.has(r))){e=Go(n,e),e=qN(t,e,1),t=Ti(t,e,1),e=Xt(),t!==null&&(ac(t,1,e),cn(t,e));break}}t=t.return}}function f3(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Xt(),e.pingedLanes|=e.suspendedLanes&n,xt===e&&(Nt&n)===n&&(ft===4||ft===3&&(Nt&130023424)===Nt&&500>tt()-Iy?gs(e,0):Ny|=n),cn(e,t)}function pI(e,t){t===0&&(e.mode&1?(t=Bc,Bc<<=1,!(Bc&130023424)&&(Bc=4194304)):t=1);var n=Xt();e=Wr(e,t),e!==null&&(ac(e,t,n),cn(e,n))}function g3(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pI(e,n)}function m3(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(t),pI(e,n)}var fI;fI=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||an.current)sn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return sn=!1,r3(e,t,n);sn=!!(e.flags&131072)}else sn=!1,$e&&t.flags&1048576&&yN(t,md,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Au(e,t),e=t.pendingProps;var i=$o(t,jt.current);Do(t,n),i=Ey(null,t,r,e,i,n);var s=ky();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ln(r)?(s=!0,fd(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,vy(t),i.updater=bh,t.stateNode=i,i._reactInternals=t,Fg(t,r,e,n),t=Ug(null,t,r,!0,s,n)):(t.tag=0,$e&&s&&hy(t),Gt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Au(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=y3(r),e=qn(r,e),i){case 0:t=jg(null,t,r,e,n);break e;case 1:t=vk(null,t,r,e,n);break e;case 11:t=bk(null,t,r,e,n);break e;case 14:t=yk(null,t,r,qn(r.type,e),n);break e}throw Error(W(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),jg(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),vk(e,t,r,i,n);case 3:e:{if(ZN(t),e===null)throw Error(W(387));r=t.pendingProps,s=t.memoizedState,i=s.element,EN(e,t),vd(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Go(Error(W(423)),t),t=_k(e,t,r,n,i);break e}else if(r!==i){i=Go(Error(W(424)),t),t=_k(e,t,r,n,i);break e}else for(bn=Ci(t.stateNode.containerInfo.firstChild),yn=t,$e=!0,Yn=null,n=wN(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zo(),r===i){t=qr(e,t,n);break e}Gt(e,t,r,n)}t=t.child}return t;case 5:return kN(t),e===null&&Dg(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Rg(r,i)?o=null:s!==null&&Rg(r,s)&&(t.flags|=32),XN(e,t),Gt(e,t,o,n),t.child;case 6:return e===null&&Dg(t),null;case 13:return QN(e,t,n);case 4:return _y(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ho(t,null,r,n):Gt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),bk(e,t,r,i,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,De(bd,r._currentValue),r._currentValue=o,s!==null)if(tr(s.value,o)){if(s.children===i.children&&!an.current){t=qr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=zr(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Mg(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Mg(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Gt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Do(t,n),i=jn(i),r=r(i),t.flags|=1,Gt(e,t,r,n),t.child;case 14:return r=t.type,i=qn(r,t.pendingProps),i=qn(r.type,i),yk(e,t,r,i,n);case 15:return KN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),Au(e,t),t.tag=1,ln(r)?(e=!0,fd(t)):e=!1,Do(t,n),GN(t,r,i),Fg(t,r,i,n),Ug(null,t,r,!0,e,n);case 19:return JN(e,t,n);case 22:return YN(e,t,n)}throw Error(W(156,t.tag))};function gI(e,t){return zR(e,t)}function b3(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(e,t,n,r){return new b3(e,t,n,r)}function My(e){return e=e.prototype,!(!e||!e.isReactComponent)}function y3(e){if(typeof e=="function")return My(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ey)return 11;if(e===ty)return 14}return 2}function Ni(e,t){var n=e.alternate;return n===null?(n=Ln(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Iu(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")My(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ho:return ms(n.children,i,s,t);case Jb:o=8,i|=8;break;case ag:return e=Ln(12,n,t,i|2),e.elementType=ag,e.lanes=s,e;case lg:return e=Ln(13,n,t,i),e.elementType=lg,e.lanes=s,e;case cg:return e=Ln(19,n,t,i),e.elementType=cg,e.lanes=s,e;case kR:return _h(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xR:o=10;break e;case ER:o=9;break e;case ey:o=11;break e;case ty:o=14;break e;case hi:o=16,r=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=Ln(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function ms(e,t,n,r){return e=Ln(7,e,r,t),e.lanes=n,e}function _h(e,t,n,r){return e=Ln(22,e,r,t),e.elementType=kR,e.lanes=n,e.stateNode={isHidden:!1},e}function Wp(e,t,n){return e=Ln(6,e,null,t),e.lanes=n,e}function qp(e,t,n){return t=Ln(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function v3(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tp(0),this.expirationTimes=Tp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tp(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Py(e,t,n,r,i,s,o,a,l){return e=new v3(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ln(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vy(s),e}function _3(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:uo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function mI(e){if(!e)return Di;e=e._reactInternals;e:{if(Bs(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ln(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var n=e.type;if(ln(n))return mN(e,n,t)}return t}function bI(e,t,n,r,i,s,o,a,l){return e=Py(n,r,!0,e,i,s,o,a,l),e.context=mI(null),n=e.current,r=Xt(),i=Ri(n),s=zr(r,i),s.callback=t??null,Ti(n,s,i),e.current.lanes=i,ac(e,i,r),cn(e,r),e}function Sh(e,t,n,r){var i=t.current,s=Xt(),o=Ri(i);return n=mI(n),t.context===null?t.context=n:t.pendingContext=n,t=zr(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ti(i,t,o),e!==null&&(Zn(e,i,o,s),ku(e,i,o)),o}function Td(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Nk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Fy(e,t){Nk(e,t),(e=e.alternate)&&Nk(e,t)}function S3(){return null}var yI=typeof reportError=="function"?reportError:function(e){console.error(e)};function By(e){this._internalRoot=e}wh.prototype.render=By.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));Sh(e,t,null,null)};wh.prototype.unmount=By.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ts(function(){Sh(null,e,null,null)}),t[Gr]=null}};function wh(e){this._internalRoot=e}wh.prototype.unstable_scheduleHydration=function(e){if(e){var t=YR();e={blockedOn:null,target:e,priority:t};for(var n=0;n<gi.length&&t!==0&&t<gi[n].priority;n++);gi.splice(n,0,e),n===0&&ZR(e)}};function jy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ik(){}function w3(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=Td(o);s.call(c)}}var o=bI(t,r,e,0,null,!1,!1,"",Ik);return e._reactRootContainer=o,e[Gr]=o.current,Nl(e.nodeType===8?e.parentNode:e),Ts(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Td(l);a.call(c)}}var l=Py(e,0,!1,null,null,!1,!1,"",Ik);return e._reactRootContainer=l,e[Gr]=l.current,Nl(e.nodeType===8?e.parentNode:e),Ts(function(){Sh(t,l,n,r)}),l}function Eh(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=Td(o);a.call(l)}}Sh(t,o,e,i)}else o=w3(n,t,e,i,r);return Td(o)}qR=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=qa(t.pendingLanes);n!==0&&(iy(t,n|1),cn(t,tt()),!(Te&6)&&(Wo=tt()+500,Hi()))}break;case 13:Ts(function(){var r=Wr(e,1);if(r!==null){var i=Xt();Zn(r,e,1,i)}}),Fy(e,1)}};sy=function(e){if(e.tag===13){var t=Wr(e,134217728);if(t!==null){var n=Xt();Zn(t,e,134217728,n)}Fy(e,134217728)}};KR=function(e){if(e.tag===13){var t=Ri(e),n=Wr(e,t);if(n!==null){var r=Xt();Zn(n,e,t,r)}Fy(e,t)}};YR=function(){return Ae};XR=function(e,t){var n=Ae;try{return Ae=e,t()}finally{Ae=n}};vg=function(e,t,n){switch(t){case"input":if(hg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=fh(r);if(!i)throw Error(W(90));TR(r),hg(r,i)}}}break;case"textarea":RR(e,n);break;case"select":t=n.value,t!=null&&No(e,!!n.multiple,t,!1)}};PR=Oy;FR=Ts;var x3={usingClientEntryPoint:!1,Events:[cc,mo,fh,DR,MR,Oy]},La={findFiberByHostInstance:cs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},E3={bundleType:La.bundleType,version:La.version,rendererPackageName:La.rendererPackageName,rendererConfig:La.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Xr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=UR(e),e===null?null:e.stateNode},findFiberByHostInstance:La.findFiberByHostInstance||S3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yc.isDisabled&&Yc.supportsFiber)try{uh=Yc.inject(E3),_r=Yc}catch{}}xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=x3;xn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jy(t))throw Error(W(200));return _3(e,t,null,n)};xn.createRoot=function(e,t){if(!jy(e))throw Error(W(299));var n=!1,r="",i=yI;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Py(e,1,!1,null,null,n,!1,r,i),e[Gr]=t.current,Nl(e.nodeType===8?e.parentNode:e),new By(t)};xn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=UR(t),e=e===null?null:e.stateNode,e};xn.flushSync=function(e){return Ts(e)};xn.hydrate=function(e,t,n){if(!xh(t))throw Error(W(200));return Eh(null,e,t,!0,n)};xn.hydrateRoot=function(e,t,n){if(!jy(e))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=yI;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=bI(t,null,e,1,n??null,i,!1,s,o),e[Gr]=t.current,Nl(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new wh(t)};xn.render=function(e,t,n){if(!xh(t))throw Error(W(200));return Eh(null,e,t,!1,n)};xn.unmountComponentAtNode=function(e){if(!xh(e))throw Error(W(40));return e._reactRootContainer?(Ts(function(){Eh(null,null,e,!1,function(){e._reactRootContainer=null,e[Gr]=null})}),!0):!1};xn.unstable_batchedUpdates=Oy;xn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!xh(n))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return Eh(e,t,n,!1,r)};xn.version="18.3.1-next-f1338f8080-20240426";function vI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vI)}catch(e){console.error(e)}}vI(),vR.exports=xn;var ia=vR.exports;const k3=ah(ia);var Ok=ia;sg.createRoot=Ok.createRoot,sg.hydrateRoot=Ok.hydrateRoot;/**
|
|
41
|
+
`+s.stack}return{value:e,source:t,stack:i,digest:null}}function Vp(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Bg(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var e3=typeof WeakMap=="function"?WeakMap:Map;function WN(e,t,n){n=zr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){Ed||(Ed=!0,Kg=r),Bg(e,t)},n}function qN(e,t,n){n=zr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var i=t.value;n.payload=function(){return r(i)},n.callback=function(){Bg(e,t)}}var s=e.stateNode;return s!==null&&typeof s.componentDidCatch=="function"&&(n.callback=function(){Bg(e,t),typeof r!="function"&&(Ai===null?Ai=new Set([this]):Ai.add(this));var o=t.stack;this.componentDidCatch(t.value,{componentStack:o!==null?o:""})}),n}function fk(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new e3;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(i.add(n),e=f3.bind(null,e,t,n),t.then(e,e))}function gk(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function mk(e,t,n,r,i){return e.mode&1?(e.flags|=65536,e.lanes=i,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=zr(-1,1),t.tag=2,Ti(n,t,1))),n.lanes|=1),e)}var t3=Xr.ReactCurrentOwner,sn=!1;function Gt(e,t,n,r){t.child=e===null?wN(t,null,n,r):Ho(t,e.child,n,r)}function bk(e,t,n,r,i){n=n.render;var s=t.ref;return Do(t,i),r=Ey(e,t,n,r,s,i),n=ky(),e!==null&&!sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,qr(e,t,i)):($e&&n&&hy(t),t.flags|=1,Gt(e,t,r,i),t.child)}function yk(e,t,n,r,i){if(e===null){var s=n.type;return typeof s=="function"&&!My(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=s,KN(e,t,s,r,i)):(e=Iu(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(s=e.child,!(e.lanes&i)){var o=s.memoizedProps;if(n=n.compare,n=n!==null?n:Rl,n(o,r)&&e.ref===t.ref)return qr(e,t,i)}return t.flags|=1,e=Ni(s,r),e.ref=t.ref,e.return=t,t.child=e}function KN(e,t,n,r,i){if(e!==null){var s=e.memoizedProps;if(Rl(s,r)&&e.ref===t.ref)if(sn=!1,t.pendingProps=r=s,(e.lanes&i)!==0)e.flags&131072&&(sn=!0);else return t.lanes=e.lanes,qr(e,t,i)}return jg(e,t,n,r,i)}function YN(e,t,n){var r=t.pendingProps,i=r.children,s=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},De(wo,gn),gn|=n;else{if(!(n&1073741824))return e=s!==null?s.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,De(wo,gn),gn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=s!==null?s.baseLanes:n,De(wo,gn),gn|=r}else s!==null?(r=s.baseLanes|n,t.memoizedState=null):r=n,De(wo,gn),gn|=r;return Gt(e,t,i,n),t.child}function XN(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function jg(e,t,n,r,i){var s=ln(n)?xs:jt.current;return s=$o(t,s),Do(t,i),n=Ey(e,t,n,r,s,i),r=ky(),e!==null&&!sn?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~i,qr(e,t,i)):($e&&r&&hy(t),t.flags|=1,Gt(e,t,n,i),t.child)}function vk(e,t,n,r,i){if(ln(n)){var s=!0;fd(t)}else s=!1;if(Do(t,i),t.stateNode===null)Au(e,t),GN(t,n,r),Fg(t,n,r,i),r=!0;else if(e===null){var o=t.stateNode,a=t.memoizedProps;o.props=a;var l=o.context,c=n.contextType;typeof c=="object"&&c!==null?c=jn(c):(c=ln(n)?xs:jt.current,c=$o(t,c));var u=n.getDerivedStateFromProps,d=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";d||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==r||l!==c)&&pk(t,o,r,c),pi=!1;var p=t.memoizedState;o.state=p,vd(t,r,o,i),l=t.memoizedState,a!==r||p!==l||an.current||pi?(typeof u=="function"&&(Pg(t,n,u,r),l=t.memoizedState),(a=pi||hk(t,n,a,r,p,l,c))?(d||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(t.flags|=4194308)):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),o.props=r,o.state=l,o.context=c,r=a):(typeof o.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{o=t.stateNode,EN(e,t),a=t.memoizedProps,c=t.type===t.elementType?a:qn(t.type,a),o.props=c,d=t.pendingProps,p=o.context,l=n.contextType,typeof l=="object"&&l!==null?l=jn(l):(l=ln(n)?xs:jt.current,l=$o(t,l));var f=n.getDerivedStateFromProps;(u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(a!==d||p!==l)&&pk(t,o,r,l),pi=!1,p=t.memoizedState,o.state=p,vd(t,r,o,i);var g=t.memoizedState;a!==d||p!==g||an.current||pi?(typeof f=="function"&&(Pg(t,n,f,r),g=t.memoizedState),(c=pi||hk(t,n,c,r,p,g,l)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,g,l),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,g,l)),typeof o.componentDidUpdate=="function"&&(t.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=g),o.props=r,o.state=g,o.context=l,r=c):(typeof o.componentDidUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&p===e.memoizedState||(t.flags|=1024),r=!1)}return Ug(e,t,n,r,s,i)}function Ug(e,t,n,r,i,s){XN(e,t);var o=(t.flags&128)!==0;if(!r&&!o)return i&&ik(t,n,!1),qr(e,t,s);r=t.stateNode,t3.current=t;var a=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&o?(t.child=Ho(t,e.child,null,s),t.child=Ho(t,null,a,s)):Gt(e,t,a,s),t.memoizedState=r.state,i&&ik(t,n,!0),t.child}function ZN(e){var t=e.stateNode;t.pendingContext?rk(e,t.pendingContext,t.pendingContext!==t.context):t.context&&rk(e,t.context,!1),_y(e,t.containerInfo)}function _k(e,t,n,r,i){return zo(),fy(i),t.flags|=256,Gt(e,t,n,r),t.child}var $g={dehydrated:null,treeContext:null,retryLane:0};function zg(e){return{baseLanes:e,cachePool:null,transitions:null}}function QN(e,t,n){var r=t.pendingProps,i=We.current,s=!1,o=(t.flags&128)!==0,a;if((a=o)||(a=e!==null&&e.memoizedState===null?!1:(i&2)!==0),a?(s=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(i|=1),De(We,i&1),e===null)return Dg(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(o=r.children,e=r.fallback,s?(r=t.mode,s=t.child,o={mode:"hidden",children:o},!(r&1)&&s!==null?(s.childLanes=0,s.pendingProps=o):s=_h(o,r,0,null),e=ms(e,r,n,null),s.return=t,e.return=t,s.sibling=e,t.child=s,t.child.memoizedState=zg(n),t.memoizedState=$g,e):Ay(t,o));if(i=e.memoizedState,i!==null&&(a=i.dehydrated,a!==null))return n3(e,t,o,r,a,i,n);if(s){s=r.fallback,o=t.mode,i=e.child,a=i.sibling;var l={mode:"hidden",children:r.children};return!(o&1)&&t.child!==i?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Ni(i,l),r.subtreeFlags=i.subtreeFlags&14680064),a!==null?s=Ni(a,s):(s=ms(s,o,n,null),s.flags|=2),s.return=t,r.return=t,r.sibling=s,t.child=r,r=s,s=t.child,o=e.child.memoizedState,o=o===null?zg(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},s.memoizedState=o,s.childLanes=e.childLanes&~n,t.memoizedState=$g,r}return s=e.child,e=s.sibling,r=Ni(s,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function Ay(e,t){return t=_h({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function Wc(e,t,n,r){return r!==null&&fy(r),Ho(t,e.child,null,n),e=Ay(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function n3(e,t,n,r,i,s,o){if(n)return t.flags&256?(t.flags&=-257,r=Vp(Error(W(422))),Wc(e,t,o,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(s=r.fallback,i=t.mode,r=_h({mode:"visible",children:r.children},i,0,null),s=ms(s,i,o,null),s.flags|=2,r.return=t,s.return=t,r.sibling=s,t.child=r,t.mode&1&&Ho(t,e.child,null,o),t.child.memoizedState=zg(o),t.memoizedState=$g,s);if(!(t.mode&1))return Wc(e,t,o,null);if(i.data==="$!"){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,s=Error(W(419)),r=Vp(s,r,void 0),Wc(e,t,o,r)}if(a=(o&e.childLanes)!==0,sn||a){if(r=xt,r!==null){switch(o&-o){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(r.suspendedLanes|o)?0:i,i!==0&&i!==s.retryLane&&(s.retryLane=i,Wr(e,i),Zn(r,e,i,-1))}return Dy(),r=Vp(Error(W(421))),Wc(e,t,o,r)}return i.data==="$?"?(t.flags|=128,t.child=e.child,t=g3.bind(null,e),i._reactRetry=t,null):(e=s.treeContext,bn=Ci(i.nextSibling),yn=t,$e=!0,Yn=null,e!==null&&(Nn[In++]=jr,Nn[In++]=Ur,Nn[In++]=Es,jr=e.id,Ur=e.overflow,Es=t),t=Ay(t,r.children),t.flags|=4096,t)}function Sk(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Mg(e.return,t,n)}function Gp(e,t,n,r,i){var s=e.memoizedState;s===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i}:(s.isBackwards=t,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=i)}function JN(e,t,n){var r=t.pendingProps,i=r.revealOrder,s=r.tail;if(Gt(e,t,r.children,n),r=We.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Sk(e,n,t);else if(e.tag===19)Sk(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(De(We,r),!(t.mode&1))t.memoizedState=null;else switch(i){case"forwards":for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&_d(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Gp(t,!1,i,n,s);break;case"backwards":for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&_d(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Gp(t,!0,n,null,s);break;case"together":Gp(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Au(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function qr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Cs|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(W(153));if(t.child!==null){for(e=t.child,n=Ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function r3(e,t,n){switch(t.tag){case 3:ZN(t),zo();break;case 5:kN(t);break;case 1:ln(t.type)&&fd(t);break;case 4:_y(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,i=t.memoizedProps.value;De(bd,r._currentValue),r._currentValue=i;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(De(We,We.current&1),t.flags|=128,null):n&t.child.childLanes?QN(e,t,n):(De(We,We.current&1),e=qr(e,t,n),e!==null?e.sibling:null);De(We,We.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return JN(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),De(We,We.current),r)break;return null;case 22:case 23:return t.lanes=0,YN(e,t,n)}return qr(e,t,n)}var eI,Hg,tI,nI;eI=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Hg=function(){};tI=function(e,t,n,r){var i=e.memoizedProps;if(i!==r){e=t.stateNode,ds(Sr.current);var s=null;switch(n){case"input":i=dg(e,i),r=dg(e,r),s=[];break;case"select":i=Ye({},i,{value:void 0}),r=Ye({},r,{value:void 0}),s=[];break;case"textarea":i=fg(e,i),r=fg(e,r),s=[];break;default:typeof i.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=hd)}mg(n,r);var o;n=null;for(c in i)if(!r.hasOwnProperty(c)&&i.hasOwnProperty(c)&&i[c]!=null)if(c==="style"){var a=i[c];for(o in a)a.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else c!=="dangerouslySetInnerHTML"&&c!=="children"&&c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&c!=="autoFocus"&&(wl.hasOwnProperty(c)?s||(s=[]):(s=s||[]).push(c,null));for(c in r){var l=r[c];if(a=i!=null?i[c]:void 0,r.hasOwnProperty(c)&&l!==a&&(l!=null||a!=null))if(c==="style")if(a){for(o in a)!a.hasOwnProperty(o)||l&&l.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in l)l.hasOwnProperty(o)&&a[o]!==l[o]&&(n||(n={}),n[o]=l[o])}else n||(s||(s=[]),s.push(c,n)),n=l;else c==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(s=s||[]).push(c,l)):c==="children"?typeof l!="string"&&typeof l!="number"||(s=s||[]).push(c,""+l):c!=="suppressContentEditableWarning"&&c!=="suppressHydrationWarning"&&(wl.hasOwnProperty(c)?(l!=null&&c==="onScroll"&&Fe("scroll",e),s||a===l||(s=[])):(s=s||[]).push(c,l))}n&&(s=s||[]).push("style",n);var c=s;(t.updateQueue=c)&&(t.flags|=4)}};nI=function(e,t,n,r){n!==r&&(t.flags|=4)};function Oa(e,t){if(!$e)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&14680064,r|=i.flags&14680064,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function i3(e,t,n){var r=t.pendingProps;switch(py(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Dt(t),null;case 1:return ln(t.type)&&pd(),Dt(t),null;case 3:return r=t.stateNode,Vo(),Ue(an),Ue(jt),wy(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Vc(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Yn!==null&&(Zg(Yn),Yn=null))),Hg(e,t),Dt(t),null;case 5:Sy(t);var i=ds(Dl.current);if(n=t.type,e!==null&&t.stateNode!=null)tI(e,t,n,r,i),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(W(166));return Dt(t),null}if(e=ds(Sr.current),Vc(t)){r=t.stateNode,n=t.type;var s=t.memoizedProps;switch(r[mr]=t,r[Ol]=s,e=(t.mode&1)!==0,n){case"dialog":Fe("cancel",r),Fe("close",r);break;case"iframe":case"object":case"embed":Fe("load",r);break;case"video":case"audio":for(i=0;i<Ka.length;i++)Fe(Ka[i],r);break;case"source":Fe("error",r);break;case"img":case"image":case"link":Fe("error",r),Fe("load",r);break;case"details":Fe("toggle",r);break;case"input":N0(r,s),Fe("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!s.multiple},Fe("invalid",r);break;case"textarea":O0(r,s),Fe("invalid",r)}mg(n,s),i=null;for(var o in s)if(s.hasOwnProperty(o)){var a=s[o];o==="children"?typeof a=="string"?r.textContent!==a&&(s.suppressHydrationWarning!==!0&&Hc(r.textContent,a,e),i=["children",a]):typeof a=="number"&&r.textContent!==""+a&&(s.suppressHydrationWarning!==!0&&Hc(r.textContent,a,e),i=["children",""+a]):wl.hasOwnProperty(o)&&a!=null&&o==="onScroll"&&Fe("scroll",r)}switch(n){case"input":Mc(r),I0(r,s,!0);break;case"textarea":Mc(r),L0(r);break;case"select":case"option":break;default:typeof s.onClick=="function"&&(r.onclick=hd)}r=i,t.updateQueue=r,r!==null&&(t.flags|=4)}else{o=i.nodeType===9?i:i.ownerDocument,e==="http://www.w3.org/1999/xhtml"&&(e=NR(n)),e==="http://www.w3.org/1999/xhtml"?n==="script"?(e=o.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=o.createElement(n,{is:r.is}):(e=o.createElement(n),n==="select"&&(o=e,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):e=o.createElementNS(e,n),e[mr]=t,e[Ol]=r,eI(e,t,!1,!1),t.stateNode=e;e:{switch(o=bg(n,r),n){case"dialog":Fe("cancel",e),Fe("close",e),i=r;break;case"iframe":case"object":case"embed":Fe("load",e),i=r;break;case"video":case"audio":for(i=0;i<Ka.length;i++)Fe(Ka[i],e);i=r;break;case"source":Fe("error",e),i=r;break;case"img":case"image":case"link":Fe("error",e),Fe("load",e),i=r;break;case"details":Fe("toggle",e),i=r;break;case"input":N0(e,r),i=dg(e,r),Fe("invalid",e);break;case"option":i=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},i=Ye({},r,{value:void 0}),Fe("invalid",e);break;case"textarea":O0(e,r),i=fg(e,r),Fe("invalid",e);break;default:i=r}mg(n,i),a=i;for(s in a)if(a.hasOwnProperty(s)){var l=a[s];s==="style"?LR(e,l):s==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,l!=null&&IR(e,l)):s==="children"?typeof l=="string"?(n!=="textarea"||l!=="")&&xl(e,l):typeof l=="number"&&xl(e,""+l):s!=="suppressContentEditableWarning"&&s!=="suppressHydrationWarning"&&s!=="autoFocus"&&(wl.hasOwnProperty(s)?l!=null&&s==="onScroll"&&Fe("scroll",e):l!=null&&Qb(e,s,l,o))}switch(n){case"input":Mc(e),I0(e,r,!1);break;case"textarea":Mc(e),L0(e);break;case"option":r.value!=null&&e.setAttribute("value",""+Li(r.value));break;case"select":e.multiple=!!r.multiple,s=r.value,s!=null?No(e,!!r.multiple,s,!1):r.defaultValue!=null&&No(e,!!r.multiple,r.defaultValue,!0);break;default:typeof i.onClick=="function"&&(e.onclick=hd)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(t.flags|=4)}t.ref!==null&&(t.flags|=512,t.flags|=2097152)}return Dt(t),null;case 6:if(e&&t.stateNode!=null)nI(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(W(166));if(n=ds(Dl.current),ds(Sr.current),Vc(t)){if(r=t.stateNode,n=t.memoizedProps,r[mr]=t,(s=r.nodeValue!==n)&&(e=yn,e!==null))switch(e.tag){case 3:Hc(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&Hc(r.nodeValue,n,(e.mode&1)!==0)}s&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[mr]=t,t.stateNode=r}return Dt(t),null;case 13:if(Ue(We),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if($e&&bn!==null&&t.mode&1&&!(t.flags&128))_N(),zo(),t.flags|=98560,s=!1;else if(s=Vc(t),r!==null&&r.dehydrated!==null){if(e===null){if(!s)throw Error(W(318));if(s=t.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(W(317));s[mr]=t}else zo(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Dt(t),s=!1}else Yn!==null&&(Zg(Yn),Yn=null),s=!0;if(!s)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||We.current&1?ft===0&&(ft=3):Dy())),t.updateQueue!==null&&(t.flags|=4),Dt(t),null);case 4:return Vo(),Hg(e,t),e===null&&Nl(t.stateNode.containerInfo),Dt(t),null;case 10:return by(t.type._context),Dt(t),null;case 17:return ln(t.type)&&pd(),Dt(t),null;case 19:if(Ue(We),s=t.memoizedState,s===null)return Dt(t),null;if(r=(t.flags&128)!==0,o=s.rendering,o===null)if(r)Oa(s,!1);else{if(ft!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=_d(e),o!==null){for(t.flags|=128,Oa(s,!1),r=o.updateQueue,r!==null&&(t.updateQueue=r,t.flags|=4),t.subtreeFlags=0,r=n,n=t.child;n!==null;)s=n,e=r,s.flags&=14680066,o=s.alternate,o===null?(s.childLanes=0,s.lanes=e,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=o.childLanes,s.lanes=o.lanes,s.child=o.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=o.memoizedProps,s.memoizedState=o.memoizedState,s.updateQueue=o.updateQueue,s.type=o.type,e=o.dependencies,s.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),n=n.sibling;return De(We,We.current&1|2),t.child}e=e.sibling}s.tail!==null&&nt()>Wo&&(t.flags|=128,r=!0,Oa(s,!1),t.lanes=4194304)}else{if(!r)if(e=_d(o),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Oa(s,!0),s.tail===null&&s.tailMode==="hidden"&&!o.alternate&&!$e)return Dt(t),null}else 2*nt()-s.renderingStartTime>Wo&&n!==1073741824&&(t.flags|=128,r=!0,Oa(s,!1),t.lanes=4194304);s.isBackwards?(o.sibling=t.child,t.child=o):(n=s.last,n!==null?n.sibling=o:t.child=o,s.last=o)}return s.tail!==null?(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=nt(),t.sibling=null,n=We.current,De(We,r?n&1|2:n&1),t):(Dt(t),null);case 22:case 23:return Ly(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?gn&1073741824&&(Dt(t),t.subtreeFlags&6&&(t.flags|=8192)):Dt(t),null;case 24:return null;case 25:return null}throw Error(W(156,t.tag))}function s3(e,t){switch(py(t),t.tag){case 1:return ln(t.type)&&pd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vo(),Ue(an),Ue(jt),wy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Sy(t),null;case 13:if(Ue(We),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(W(340));zo()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Ue(We),null;case 4:return Vo(),null;case 10:return by(t.type._context),null;case 22:case 23:return Ly(),null;case 24:return null;default:return null}}var qc=!1,Pt=!1,o3=typeof WeakSet=="function"?WeakSet:Set,J=null;function So(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Je(e,t,r)}else n.current=null}function Vg(e,t,n){try{n()}catch(r){Je(e,t,r)}}var wk=!1;function a3(e,t){if(Tg=cd,e=aN(),dy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,s=r.focusNode;r=r.focusOffset;try{n.nodeType,s.nodeType}catch{n=null;break e}var o=0,a=-1,l=-1,c=0,u=0,d=e,p=null;t:for(;;){for(var f;d!==n||i!==0&&d.nodeType!==3||(a=o+i),d!==s||r!==0&&d.nodeType!==3||(l=o+r),d.nodeType===3&&(o+=d.nodeValue.length),(f=d.firstChild)!==null;)p=d,d=f;for(;;){if(d===e)break t;if(p===n&&++c===i&&(a=o),p===s&&++u===r&&(l=o),(f=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=f}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ag={focusedElem:e,selectionRange:n},cd=!1,J=t;J!==null;)if(t=J,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,J=e;else for(;J!==null;){t=J;try{var g=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var m=g.memoizedProps,_=g.memoizedState,b=t.stateNode,v=b.getSnapshotBeforeUpdate(t.elementType===t.type?m:qn(t.type,m),_);b.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(w){Je(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,J=e;break}J=t.return}return g=wk,wk=!1,g}function ll(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var s=i.destroy;i.destroy=void 0,s!==void 0&&Vg(t,n,s)}i=i.next}while(i!==r)}}function yh(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function Gg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function rI(e){var t=e.alternate;t!==null&&(e.alternate=null,rI(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[mr],delete t[Ol],delete t[Ig],delete t[Hj],delete t[Vj])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function iI(e){return e.tag===5||e.tag===3||e.tag===4}function xk(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||iI(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=hd));else if(r!==4&&(e=e.child,e!==null))for(Wg(e,t,n),e=e.sibling;e!==null;)Wg(e,t,n),e=e.sibling}function qg(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(qg(e,t,n),e=e.sibling;e!==null;)qg(e,t,n),e=e.sibling}var kt=null,Kn=!1;function ni(e,t,n){for(n=n.child;n!==null;)sI(e,t,n),n=n.sibling}function sI(e,t,n){if(_r&&typeof _r.onCommitFiberUnmount=="function")try{_r.onCommitFiberUnmount(uh,n)}catch{}switch(n.tag){case 5:Pt||So(n,t);case 6:var r=kt,i=Kn;kt=null,ni(e,t,n),kt=r,Kn=i,kt!==null&&(Kn?(e=kt,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):kt.removeChild(n.stateNode));break;case 18:kt!==null&&(Kn?(e=kt,n=n.stateNode,e.nodeType===8?Bp(e.parentNode,n):e.nodeType===1&&Bp(e,n),Tl(e)):Bp(kt,n.stateNode));break;case 4:r=kt,i=Kn,kt=n.stateNode.containerInfo,Kn=!0,ni(e,t,n),kt=r,Kn=i;break;case 0:case 11:case 14:case 15:if(!Pt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var s=i,o=s.destroy;s=s.tag,o!==void 0&&(s&2||s&4)&&Vg(n,t,o),i=i.next}while(i!==r)}ni(e,t,n);break;case 1:if(!Pt&&(So(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){Je(n,t,a)}ni(e,t,n);break;case 21:ni(e,t,n);break;case 22:n.mode&1?(Pt=(r=Pt)||n.memoizedState!==null,ni(e,t,n),Pt=r):ni(e,t,n);break;default:ni(e,t,n)}}function Ek(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new o3),t.forEach(function(r){var i=m3.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function zn(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];try{var s=e,o=t,a=o;e:for(;a!==null;){switch(a.tag){case 5:kt=a.stateNode,Kn=!1;break e;case 3:kt=a.stateNode.containerInfo,Kn=!0;break e;case 4:kt=a.stateNode.containerInfo,Kn=!0;break e}a=a.return}if(kt===null)throw Error(W(160));sI(s,o,i),kt=null,Kn=!1;var l=i.alternate;l!==null&&(l.return=null),i.return=null}catch(c){Je(i,t,c)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)oI(t,e),t=t.sibling}function oI(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(zn(t,e),ar(e),r&4){try{ll(3,e,e.return),yh(3,e)}catch(m){Je(e,e.return,m)}try{ll(5,e,e.return)}catch(m){Je(e,e.return,m)}}break;case 1:zn(t,e),ar(e),r&512&&n!==null&&So(n,n.return);break;case 5:if(zn(t,e),ar(e),r&512&&n!==null&&So(n,n.return),e.flags&32){var i=e.stateNode;try{xl(i,"")}catch(m){Je(e,e.return,m)}}if(r&4&&(i=e.stateNode,i!=null)){var s=e.memoizedProps,o=n!==null?n.memoizedProps:s,a=e.type,l=e.updateQueue;if(e.updateQueue=null,l!==null)try{a==="input"&&s.type==="radio"&&s.name!=null&&AR(i,s),bg(a,o);var c=bg(a,s);for(o=0;o<l.length;o+=2){var u=l[o],d=l[o+1];u==="style"?LR(i,d):u==="dangerouslySetInnerHTML"?IR(i,d):u==="children"?xl(i,d):Qb(i,u,d,c)}switch(a){case"input":hg(i,s);break;case"textarea":RR(i,s);break;case"select":var p=i._wrapperState.wasMultiple;i._wrapperState.wasMultiple=!!s.multiple;var f=s.value;f!=null?No(i,!!s.multiple,f,!1):p!==!!s.multiple&&(s.defaultValue!=null?No(i,!!s.multiple,s.defaultValue,!0):No(i,!!s.multiple,s.multiple?[]:"",!1))}i[Ol]=s}catch(m){Je(e,e.return,m)}}break;case 6:if(zn(t,e),ar(e),r&4){if(e.stateNode===null)throw Error(W(162));i=e.stateNode,s=e.memoizedProps;try{i.nodeValue=s}catch(m){Je(e,e.return,m)}}break;case 3:if(zn(t,e),ar(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Tl(t.containerInfo)}catch(m){Je(e,e.return,m)}break;case 4:zn(t,e),ar(e);break;case 13:zn(t,e),ar(e),i=e.child,i.flags&8192&&(s=i.memoizedState!==null,i.stateNode.isHidden=s,!s||i.alternate!==null&&i.alternate.memoizedState!==null||(Iy=nt())),r&4&&Ek(e);break;case 22:if(u=n!==null&&n.memoizedState!==null,e.mode&1?(Pt=(c=Pt)||u,zn(t,e),Pt=c):zn(t,e),ar(e),r&8192){if(c=e.memoizedState!==null,(e.stateNode.isHidden=c)&&!u&&e.mode&1)for(J=e,u=e.child;u!==null;){for(d=J=u;J!==null;){switch(p=J,f=p.child,p.tag){case 0:case 11:case 14:case 15:ll(4,p,p.return);break;case 1:So(p,p.return);var g=p.stateNode;if(typeof g.componentWillUnmount=="function"){r=p,n=p.return;try{t=r,g.props=t.memoizedProps,g.state=t.memoizedState,g.componentWillUnmount()}catch(m){Je(r,n,m)}}break;case 5:So(p,p.return);break;case 22:if(p.memoizedState!==null){Ck(d);continue}}f!==null?(f.return=p,J=f):Ck(d)}u=u.sibling}e:for(u=null,d=e;;){if(d.tag===5){if(u===null){u=d;try{i=d.stateNode,c?(s=i.style,typeof s.setProperty=="function"?s.setProperty("display","none","important"):s.display="none"):(a=d.stateNode,l=d.memoizedProps.style,o=l!=null&&l.hasOwnProperty("display")?l.display:null,a.style.display=OR("display",o))}catch(m){Je(e,e.return,m)}}}else if(d.tag===6){if(u===null)try{d.stateNode.nodeValue=c?"":d.memoizedProps}catch(m){Je(e,e.return,m)}}else if((d.tag!==22&&d.tag!==23||d.memoizedState===null||d===e)&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break e;for(;d.sibling===null;){if(d.return===null||d.return===e)break e;u===d&&(u=null),d=d.return}u===d&&(u=null),d.sibling.return=d.return,d=d.sibling}}break;case 19:zn(t,e),ar(e),r&4&&Ek(e);break;case 21:break;default:zn(t,e),ar(e)}}function ar(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(iI(n)){var r=n;break e}n=n.return}throw Error(W(160))}switch(r.tag){case 5:var i=r.stateNode;r.flags&32&&(xl(i,""),r.flags&=-33);var s=xk(e);qg(e,s,i);break;case 3:case 4:var o=r.stateNode.containerInfo,a=xk(e);Wg(e,a,o);break;default:throw Error(W(161))}}catch(l){Je(e,e.return,l)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function l3(e,t,n){J=e,aI(e)}function aI(e,t,n){for(var r=(e.mode&1)!==0;J!==null;){var i=J,s=i.child;if(i.tag===22&&r){var o=i.memoizedState!==null||qc;if(!o){var a=i.alternate,l=a!==null&&a.memoizedState!==null||Pt;a=qc;var c=Pt;if(qc=o,(Pt=l)&&!c)for(J=i;J!==null;)o=J,l=o.child,o.tag===22&&o.memoizedState!==null?Tk(i):l!==null?(l.return=o,J=l):Tk(i);for(;s!==null;)J=s,aI(s),s=s.sibling;J=i,qc=a,Pt=c}kk(e)}else i.subtreeFlags&8772&&s!==null?(s.return=i,J=s):kk(e)}}function kk(e){for(;J!==null;){var t=J;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:Pt||yh(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!Pt)if(n===null)r.componentDidMount();else{var i=t.elementType===t.type?n.memoizedProps:qn(t.type,n.memoizedProps);r.componentDidUpdate(i,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var s=t.updateQueue;s!==null&&ck(t,s,r);break;case 3:var o=t.updateQueue;if(o!==null){if(n=null,t.child!==null)switch(t.child.tag){case 5:n=t.child.stateNode;break;case 1:n=t.child.stateNode}ck(t,o,n)}break;case 5:var a=t.stateNode;if(n===null&&t.flags&4){n=a;var l=t.memoizedProps;switch(t.type){case"button":case"input":case"select":case"textarea":l.autoFocus&&n.focus();break;case"img":l.src&&(n.src=l.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(t.memoizedState===null){var c=t.alternate;if(c!==null){var u=c.memoizedState;if(u!==null){var d=u.dehydrated;d!==null&&Tl(d)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(W(163))}Pt||t.flags&512&&Gg(t)}catch(p){Je(t,t.return,p)}}if(t===e){J=null;break}if(n=t.sibling,n!==null){n.return=t.return,J=n;break}J=t.return}}function Ck(e){for(;J!==null;){var t=J;if(t===e){J=null;break}var n=t.sibling;if(n!==null){n.return=t.return,J=n;break}J=t.return}}function Tk(e){for(;J!==null;){var t=J;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{yh(4,t)}catch(l){Je(t,n,l)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var i=t.return;try{r.componentDidMount()}catch(l){Je(t,i,l)}}var s=t.return;try{Gg(t)}catch(l){Je(t,s,l)}break;case 5:var o=t.return;try{Gg(t)}catch(l){Je(t,o,l)}}}catch(l){Je(t,t.return,l)}if(t===e){J=null;break}var a=t.sibling;if(a!==null){a.return=t.return,J=a;break}J=t.return}}var c3=Math.ceil,xd=Xr.ReactCurrentDispatcher,Ry=Xr.ReactCurrentOwner,Mn=Xr.ReactCurrentBatchConfig,Te=0,xt=null,at=null,Nt=0,gn=0,wo=zi(0),ft=0,Bl=null,Cs=0,vh=0,Ny=0,cl=null,rn=null,Iy=0,Wo=1/0,Pr=null,Ed=!1,Kg=null,Ai=null,Kc=!1,yi=null,kd=0,ul=0,Yg=null,Ru=-1,Nu=0;function Xt(){return Te&6?nt():Ru!==-1?Ru:Ru=nt()}function Ri(e){return e.mode&1?Te&2&&Nt!==0?Nt&-Nt:Wj.transition!==null?(Nu===0&&(Nu=GR()),Nu):(e=Ae,e!==0||(e=window.event,e=e===void 0?16:QR(e.type)),e):1}function Zn(e,t,n,r){if(50<ul)throw ul=0,Yg=null,Error(W(185));ac(e,n,r),(!(Te&2)||e!==xt)&&(e===xt&&(!(Te&2)&&(vh|=n),ft===4&&mi(e,Nt)),cn(e,r),n===1&&Te===0&&!(t.mode&1)&&(Wo=nt()+500,gh&&Hi()))}function cn(e,t){var n=e.callbackNode;WB(e,t);var r=ld(e,e===xt?Nt:0);if(r===0)n!==null&&P0(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&P0(n),t===1)e.tag===0?Gj(Ak.bind(null,e)):bN(Ak.bind(null,e)),$j(function(){!(Te&6)&&Hi()}),n=null;else{switch(WR(r)){case 1:n=ry;break;case 4:n=HR;break;case 16:n=ad;break;case 536870912:n=VR;break;default:n=ad}n=gI(n,lI.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function lI(e,t){if(Ru=-1,Nu=0,Te&6)throw Error(W(327));var n=e.callbackNode;if(Mo()&&e.callbackNode!==n)return null;var r=ld(e,e===xt?Nt:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Cd(e,r);else{t=r;var i=Te;Te|=2;var s=uI();(xt!==e||Nt!==t)&&(Pr=null,Wo=nt()+500,gs(e,t));do try{h3();break}catch(a){cI(e,a)}while(!0);my(),xd.current=s,Te=i,at!==null?t=0:(xt=null,Nt=0,t=ft)}if(t!==0){if(t===2&&(i=wg(e),i!==0&&(r=i,t=Xg(e,i))),t===1)throw n=Bl,gs(e,0),mi(e,r),cn(e,nt()),n;if(t===6)mi(e,r);else{if(i=e.current.alternate,!(r&30)&&!u3(i)&&(t=Cd(e,r),t===2&&(s=wg(e),s!==0&&(r=s,t=Xg(e,s))),t===1))throw n=Bl,gs(e,0),mi(e,r),cn(e,nt()),n;switch(e.finishedWork=i,e.finishedLanes=r,t){case 0:case 1:throw Error(W(345));case 2:rs(e,rn,Pr);break;case 3:if(mi(e,r),(r&130023424)===r&&(t=Iy+500-nt(),10<t)){if(ld(e,0)!==0)break;if(i=e.suspendedLanes,(i&r)!==r){Xt(),e.pingedLanes|=e.suspendedLanes&i;break}e.timeoutHandle=Ng(rs.bind(null,e,rn,Pr),t);break}rs(e,rn,Pr);break;case 4:if(mi(e,r),(r&4194240)===r)break;for(t=e.eventTimes,i=-1;0<r;){var o=31-Xn(r);s=1<<o,o=t[o],o>i&&(i=o),r&=~s}if(r=i,r=nt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*c3(r/1960))-r,10<r){e.timeoutHandle=Ng(rs.bind(null,e,rn,Pr),r);break}rs(e,rn,Pr);break;case 5:rs(e,rn,Pr);break;default:throw Error(W(329))}}}return cn(e,nt()),e.callbackNode===n?lI.bind(null,e):null}function Xg(e,t){var n=cl;return e.current.memoizedState.isDehydrated&&(gs(e,t).flags|=256),e=Cd(e,t),e!==2&&(t=rn,rn=n,t!==null&&Zg(t)),e}function Zg(e){rn===null?rn=e:rn.push.apply(rn,e)}function u3(e){for(var t=e;;){if(t.flags&16384){var n=t.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var i=n[r],s=i.getSnapshot;i=i.value;try{if(!tr(s(),i))return!1}catch{return!1}}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function mi(e,t){for(t&=~Ny,t&=~vh,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Xn(t),r=1<<n;e[n]=-1,t&=~r}}function Ak(e){if(Te&6)throw Error(W(327));Mo();var t=ld(e,0);if(!(t&1))return cn(e,nt()),null;var n=Cd(e,t);if(e.tag!==0&&n===2){var r=wg(e);r!==0&&(t=r,n=Xg(e,r))}if(n===1)throw n=Bl,gs(e,0),mi(e,t),cn(e,nt()),n;if(n===6)throw Error(W(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,rs(e,rn,Pr),cn(e,nt()),null}function Oy(e,t){var n=Te;Te|=1;try{return e(t)}finally{Te=n,Te===0&&(Wo=nt()+500,gh&&Hi())}}function Ts(e){yi!==null&&yi.tag===0&&!(Te&6)&&Mo();var t=Te;Te|=1;var n=Mn.transition,r=Ae;try{if(Mn.transition=null,Ae=1,e)return e()}finally{Ae=r,Mn.transition=n,Te=t,!(Te&6)&&Hi()}}function Ly(){gn=wo.current,Ue(wo)}function gs(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,Uj(n)),at!==null)for(n=at.return;n!==null;){var r=n;switch(py(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&pd();break;case 3:Vo(),Ue(an),Ue(jt),wy();break;case 5:Sy(r);break;case 4:Vo();break;case 13:Ue(We);break;case 19:Ue(We);break;case 10:by(r.type._context);break;case 22:case 23:Ly()}n=n.return}if(xt=e,at=e=Ni(e.current,null),Nt=gn=t,ft=0,Bl=null,Ny=vh=Cs=0,rn=cl=null,us!==null){for(t=0;t<us.length;t++)if(n=us[t],r=n.interleaved,r!==null){n.interleaved=null;var i=r.next,s=n.pending;if(s!==null){var o=s.next;s.next=i,r.next=o}n.pending=r}us=null}return e}function cI(e,t){do{var n=at;try{if(my(),Cu.current=wd,Sd){for(var r=qe.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}Sd=!1}if(ks=0,yt=pt=qe=null,al=!1,Ml=0,Ry.current=null,n===null||n.return===null){ft=1,Bl=t,at=null;break}e:{var s=e,o=n.return,a=n,l=t;if(t=Nt,a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=l,u=a,d=u.tag;if(!(u.mode&1)&&(d===0||d===11||d===15)){var p=u.alternate;p?(u.updateQueue=p.updateQueue,u.memoizedState=p.memoizedState,u.lanes=p.lanes):(u.updateQueue=null,u.memoizedState=null)}var f=gk(o);if(f!==null){f.flags&=-257,mk(f,o,a,s,t),f.mode&1&&fk(s,c,t),t=f,l=c;var g=t.updateQueue;if(g===null){var m=new Set;m.add(l),t.updateQueue=m}else g.add(l);break e}else{if(!(t&1)){fk(s,c,t),Dy();break e}l=Error(W(426))}}else if($e&&a.mode&1){var _=gk(o);if(_!==null){!(_.flags&65536)&&(_.flags|=256),mk(_,o,a,s,t),fy(Go(l,a));break e}}s=l=Go(l,a),ft!==4&&(ft=2),cl===null?cl=[s]:cl.push(s),s=o;do{switch(s.tag){case 3:s.flags|=65536,t&=-t,s.lanes|=t;var b=WN(s,l,t);lk(s,b);break e;case 1:a=l;var v=s.type,S=s.stateNode;if(!(s.flags&128)&&(typeof v.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Ai===null||!Ai.has(S)))){s.flags|=65536,t&=-t,s.lanes|=t;var w=qN(s,a,t);lk(s,w);break e}}s=s.return}while(s!==null)}hI(n)}catch(k){t=k,at===n&&n!==null&&(at=n=n.return);continue}break}while(!0)}function uI(){var e=xd.current;return xd.current=wd,e===null?wd:e}function Dy(){(ft===0||ft===3||ft===2)&&(ft=4),xt===null||!(Cs&268435455)&&!(vh&268435455)||mi(xt,Nt)}function Cd(e,t){var n=Te;Te|=2;var r=uI();(xt!==e||Nt!==t)&&(Pr=null,gs(e,t));do try{d3();break}catch(i){cI(e,i)}while(!0);if(my(),Te=n,xd.current=r,at!==null)throw Error(W(261));return xt=null,Nt=0,ft}function d3(){for(;at!==null;)dI(at)}function h3(){for(;at!==null&&!FB();)dI(at)}function dI(e){var t=fI(e.alternate,e,gn);e.memoizedProps=e.pendingProps,t===null?hI(e):at=t,Ry.current=null}function hI(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=s3(n,t),n!==null){n.flags&=32767,at=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{ft=6,at=null;return}}else if(n=i3(n,t,gn),n!==null){at=n;return}if(t=t.sibling,t!==null){at=t;return}at=t=e}while(t!==null);ft===0&&(ft=5)}function rs(e,t,n){var r=Ae,i=Mn.transition;try{Mn.transition=null,Ae=1,p3(e,t,n,r)}finally{Mn.transition=i,Ae=r}return null}function p3(e,t,n,r){do Mo();while(yi!==null);if(Te&6)throw Error(W(327));n=e.finishedWork;var i=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(W(177));e.callbackNode=null,e.callbackPriority=0;var s=n.lanes|n.childLanes;if(qB(e,s),e===xt&&(at=xt=null,Nt=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Kc||(Kc=!0,gI(ad,function(){return Mo(),null})),s=(n.flags&15990)!==0,n.subtreeFlags&15990||s){s=Mn.transition,Mn.transition=null;var o=Ae;Ae=1;var a=Te;Te|=4,Ry.current=null,a3(e,n),oI(n,e),Lj(Ag),cd=!!Tg,Ag=Tg=null,e.current=n,l3(n),BB(),Te=a,Ae=o,Mn.transition=s}else e.current=n;if(Kc&&(Kc=!1,yi=e,kd=i),s=e.pendingLanes,s===0&&(Ai=null),$B(n.stateNode),cn(e,nt()),t!==null)for(r=e.onRecoverableError,n=0;n<t.length;n++)i=t[n],r(i.value,{componentStack:i.stack,digest:i.digest});if(Ed)throw Ed=!1,e=Kg,Kg=null,e;return kd&1&&e.tag!==0&&Mo(),s=e.pendingLanes,s&1?e===Yg?ul++:(ul=0,Yg=e):ul=0,Hi(),null}function Mo(){if(yi!==null){var e=WR(kd),t=Mn.transition,n=Ae;try{if(Mn.transition=null,Ae=16>e?16:e,yi===null)var r=!1;else{if(e=yi,yi=null,kd=0,Te&6)throw Error(W(331));var i=Te;for(Te|=4,J=e.current;J!==null;){var s=J,o=s.child;if(J.flags&16){var a=s.deletions;if(a!==null){for(var l=0;l<a.length;l++){var c=a[l];for(J=c;J!==null;){var u=J;switch(u.tag){case 0:case 11:case 15:ll(8,u,s)}var d=u.child;if(d!==null)d.return=u,J=d;else for(;J!==null;){u=J;var p=u.sibling,f=u.return;if(rI(u),u===c){J=null;break}if(p!==null){p.return=f,J=p;break}J=f}}}var g=s.alternate;if(g!==null){var m=g.child;if(m!==null){g.child=null;do{var _=m.sibling;m.sibling=null,m=_}while(m!==null)}}J=s}}if(s.subtreeFlags&2064&&o!==null)o.return=s,J=o;else e:for(;J!==null;){if(s=J,s.flags&2048)switch(s.tag){case 0:case 11:case 15:ll(9,s,s.return)}var b=s.sibling;if(b!==null){b.return=s.return,J=b;break e}J=s.return}}var v=e.current;for(J=v;J!==null;){o=J;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,J=S;else e:for(o=v;J!==null;){if(a=J,a.flags&2048)try{switch(a.tag){case 0:case 11:case 15:yh(9,a)}}catch(k){Je(a,a.return,k)}if(a===o){J=null;break e}var w=a.sibling;if(w!==null){w.return=a.return,J=w;break e}J=a.return}}if(Te=i,Hi(),_r&&typeof _r.onPostCommitFiberRoot=="function")try{_r.onPostCommitFiberRoot(uh,e)}catch{}r=!0}return r}finally{Ae=n,Mn.transition=t}}return!1}function Rk(e,t,n){t=Go(n,t),t=WN(e,t,1),e=Ti(e,t,1),t=Xt(),e!==null&&(ac(e,1,t),cn(e,t))}function Je(e,t,n){if(e.tag===3)Rk(e,e,n);else for(;t!==null;){if(t.tag===3){Rk(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ai===null||!Ai.has(r))){e=Go(n,e),e=qN(t,e,1),t=Ti(t,e,1),e=Xt(),t!==null&&(ac(t,1,e),cn(t,e));break}}t=t.return}}function f3(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Xt(),e.pingedLanes|=e.suspendedLanes&n,xt===e&&(Nt&n)===n&&(ft===4||ft===3&&(Nt&130023424)===Nt&&500>nt()-Iy?gs(e,0):Ny|=n),cn(e,t)}function pI(e,t){t===0&&(e.mode&1?(t=Bc,Bc<<=1,!(Bc&130023424)&&(Bc=4194304)):t=1);var n=Xt();e=Wr(e,t),e!==null&&(ac(e,t,n),cn(e,n))}function g3(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),pI(e,n)}function m3(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(W(314))}r!==null&&r.delete(t),pI(e,n)}var fI;fI=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||an.current)sn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return sn=!1,r3(e,t,n);sn=!!(e.flags&131072)}else sn=!1,$e&&t.flags&1048576&&yN(t,md,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Au(e,t),e=t.pendingProps;var i=$o(t,jt.current);Do(t,n),i=Ey(null,t,r,e,i,n);var s=ky();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,ln(r)?(s=!0,fd(t)):s=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,vy(t),i.updater=bh,t.stateNode=i,i._reactInternals=t,Fg(t,r,e,n),t=Ug(null,t,r,!0,s,n)):(t.tag=0,$e&&s&&hy(t),Gt(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Au(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=y3(r),e=qn(r,e),i){case 0:t=jg(null,t,r,e,n);break e;case 1:t=vk(null,t,r,e,n);break e;case 11:t=bk(null,t,r,e,n);break e;case 14:t=yk(null,t,r,qn(r.type,e),n);break e}throw Error(W(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),jg(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),vk(e,t,r,i,n);case 3:e:{if(ZN(t),e===null)throw Error(W(387));r=t.pendingProps,s=t.memoizedState,i=s.element,EN(e,t),vd(t,r,null,n);var o=t.memoizedState;if(r=o.element,s.isDehydrated)if(s={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},t.updateQueue.baseState=s,t.memoizedState=s,t.flags&256){i=Go(Error(W(423)),t),t=_k(e,t,r,n,i);break e}else if(r!==i){i=Go(Error(W(424)),t),t=_k(e,t,r,n,i);break e}else for(bn=Ci(t.stateNode.containerInfo.firstChild),yn=t,$e=!0,Yn=null,n=wN(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(zo(),r===i){t=qr(e,t,n);break e}Gt(e,t,r,n)}t=t.child}return t;case 5:return kN(t),e===null&&Dg(t),r=t.type,i=t.pendingProps,s=e!==null?e.memoizedProps:null,o=i.children,Rg(r,i)?o=null:s!==null&&Rg(r,s)&&(t.flags|=32),XN(e,t),Gt(e,t,o,n),t.child;case 6:return e===null&&Dg(t),null;case 13:return QN(e,t,n);case 4:return _y(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ho(t,null,r,n):Gt(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),bk(e,t,r,i,n);case 7:return Gt(e,t,t.pendingProps,n),t.child;case 8:return Gt(e,t,t.pendingProps.children,n),t.child;case 12:return Gt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,s=t.memoizedProps,o=i.value,De(bd,r._currentValue),r._currentValue=o,s!==null)if(tr(s.value,o)){if(s.children===i.children&&!an.current){t=qr(e,t,n);break e}}else for(s=t.child,s!==null&&(s.return=t);s!==null;){var a=s.dependencies;if(a!==null){o=s.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(s.tag===1){l=zr(-1,n&-n),l.tag=2;var c=s.updateQueue;if(c!==null){c=c.shared;var u=c.pending;u===null?l.next=l:(l.next=u.next,u.next=l),c.pending=l}}s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Mg(s.return,n,t),a.lanes|=n;break}l=l.next}}else if(s.tag===10)o=s.type===t.type?null:s.child;else if(s.tag===18){if(o=s.return,o===null)throw Error(W(341));o.lanes|=n,a=o.alternate,a!==null&&(a.lanes|=n),Mg(o,n,t),o=s.sibling}else o=s.child;if(o!==null)o.return=s;else for(o=s;o!==null;){if(o===t){o=null;break}if(s=o.sibling,s!==null){s.return=o.return,o=s;break}o=o.return}s=o}Gt(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,Do(t,n),i=jn(i),r=r(i),t.flags|=1,Gt(e,t,r,n),t.child;case 14:return r=t.type,i=qn(r,t.pendingProps),i=qn(r.type,i),yk(e,t,r,i,n);case 15:return KN(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:qn(r,i),Au(e,t),t.tag=1,ln(r)?(e=!0,fd(t)):e=!1,Do(t,n),GN(t,r,i),Fg(t,r,i,n),Ug(null,t,r,!0,e,n);case 19:return JN(e,t,n);case 22:return YN(e,t,n)}throw Error(W(156,t.tag))};function gI(e,t){return zR(e,t)}function b3(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ln(e,t,n,r){return new b3(e,t,n,r)}function My(e){return e=e.prototype,!(!e||!e.isReactComponent)}function y3(e){if(typeof e=="function")return My(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ey)return 11;if(e===ty)return 14}return 2}function Ni(e,t){var n=e.alternate;return n===null?(n=Ln(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Iu(e,t,n,r,i,s){var o=2;if(r=e,typeof e=="function")My(e)&&(o=1);else if(typeof e=="string")o=5;else e:switch(e){case ho:return ms(n.children,i,s,t);case Jb:o=8,i|=8;break;case ag:return e=Ln(12,n,t,i|2),e.elementType=ag,e.lanes=s,e;case lg:return e=Ln(13,n,t,i),e.elementType=lg,e.lanes=s,e;case cg:return e=Ln(19,n,t,i),e.elementType=cg,e.lanes=s,e;case kR:return _h(n,i,s,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xR:o=10;break e;case ER:o=9;break e;case ey:o=11;break e;case ty:o=14;break e;case hi:o=16,r=null;break e}throw Error(W(130,e==null?e:typeof e,""))}return t=Ln(o,n,t,i),t.elementType=e,t.type=r,t.lanes=s,t}function ms(e,t,n,r){return e=Ln(7,e,r,t),e.lanes=n,e}function _h(e,t,n,r){return e=Ln(22,e,r,t),e.elementType=kR,e.lanes=n,e.stateNode={isHidden:!1},e}function Wp(e,t,n){return e=Ln(6,e,null,t),e.lanes=n,e}function qp(e,t,n){return t=Ln(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function v3(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Tp(0),this.expirationTimes=Tp(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Tp(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Py(e,t,n,r,i,s,o,a,l){return e=new v3(e,t,n,a,l),t===1?(t=1,s===!0&&(t|=8)):t=0,s=Ln(3,null,null,t),e.current=s,s.stateNode=e,s.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},vy(s),e}function _3(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:uo,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function mI(e){if(!e)return Di;e=e._reactInternals;e:{if(Bs(e)!==e||e.tag!==1)throw Error(W(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if(ln(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(W(171))}if(e.tag===1){var n=e.type;if(ln(n))return mN(e,n,t)}return t}function bI(e,t,n,r,i,s,o,a,l){return e=Py(n,r,!0,e,i,s,o,a,l),e.context=mI(null),n=e.current,r=Xt(),i=Ri(n),s=zr(r,i),s.callback=t??null,Ti(n,s,i),e.current.lanes=i,ac(e,i,r),cn(e,r),e}function Sh(e,t,n,r){var i=t.current,s=Xt(),o=Ri(i);return n=mI(n),t.context===null?t.context=n:t.pendingContext=n,t=zr(s,o),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=Ti(i,t,o),e!==null&&(Zn(e,i,o,s),ku(e,i,o)),o}function Td(e){if(e=e.current,!e.child)return null;switch(e.child.tag){case 5:return e.child.stateNode;default:return e.child.stateNode}}function Nk(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Fy(e,t){Nk(e,t),(e=e.alternate)&&Nk(e,t)}function S3(){return null}var yI=typeof reportError=="function"?reportError:function(e){console.error(e)};function By(e){this._internalRoot=e}wh.prototype.render=By.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(W(409));Sh(e,t,null,null)};wh.prototype.unmount=By.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Ts(function(){Sh(null,e,null,null)}),t[Gr]=null}};function wh(e){this._internalRoot=e}wh.prototype.unstable_scheduleHydration=function(e){if(e){var t=YR();e={blockedOn:null,target:e,priority:t};for(var n=0;n<gi.length&&t!==0&&t<gi[n].priority;n++);gi.splice(n,0,e),n===0&&ZR(e)}};function jy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function xh(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function Ik(){}function w3(e,t,n,r,i){if(i){if(typeof r=="function"){var s=r;r=function(){var c=Td(o);s.call(c)}}var o=bI(t,r,e,0,null,!1,!1,"",Ik);return e._reactRootContainer=o,e[Gr]=o.current,Nl(e.nodeType===8?e.parentNode:e),Ts(),o}for(;i=e.lastChild;)e.removeChild(i);if(typeof r=="function"){var a=r;r=function(){var c=Td(l);a.call(c)}}var l=Py(e,0,!1,null,null,!1,!1,"",Ik);return e._reactRootContainer=l,e[Gr]=l.current,Nl(e.nodeType===8?e.parentNode:e),Ts(function(){Sh(t,l,n,r)}),l}function Eh(e,t,n,r,i){var s=n._reactRootContainer;if(s){var o=s;if(typeof i=="function"){var a=i;i=function(){var l=Td(o);a.call(l)}}Sh(t,o,e,i)}else o=w3(n,t,e,i,r);return Td(o)}qR=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=qa(t.pendingLanes);n!==0&&(iy(t,n|1),cn(t,nt()),!(Te&6)&&(Wo=nt()+500,Hi()))}break;case 13:Ts(function(){var r=Wr(e,1);if(r!==null){var i=Xt();Zn(r,e,1,i)}}),Fy(e,1)}};sy=function(e){if(e.tag===13){var t=Wr(e,134217728);if(t!==null){var n=Xt();Zn(t,e,134217728,n)}Fy(e,134217728)}};KR=function(e){if(e.tag===13){var t=Ri(e),n=Wr(e,t);if(n!==null){var r=Xt();Zn(n,e,t,r)}Fy(e,t)}};YR=function(){return Ae};XR=function(e,t){var n=Ae;try{return Ae=e,t()}finally{Ae=n}};vg=function(e,t,n){switch(t){case"input":if(hg(e,n),t=n.name,n.type==="radio"&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=fh(r);if(!i)throw Error(W(90));TR(r),hg(r,i)}}}break;case"textarea":RR(e,n);break;case"select":t=n.value,t!=null&&No(e,!!n.multiple,t,!1)}};PR=Oy;FR=Ts;var x3={usingClientEntryPoint:!1,Events:[cc,mo,fh,DR,MR,Oy]},La={findFiberByHostInstance:cs,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},E3={bundleType:La.bundleType,version:La.version,rendererPackageName:La.rendererPackageName,rendererConfig:La.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Xr.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=UR(e),e===null?null:e.stateNode},findFiberByHostInstance:La.findFiberByHostInstance||S3,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yc.isDisabled&&Yc.supportsFiber)try{uh=Yc.inject(E3),_r=Yc}catch{}}xn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=x3;xn.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!jy(t))throw Error(W(200));return _3(e,t,null,n)};xn.createRoot=function(e,t){if(!jy(e))throw Error(W(299));var n=!1,r="",i=yI;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(i=t.onRecoverableError)),t=Py(e,1,!1,null,null,n,!1,r,i),e[Gr]=t.current,Nl(e.nodeType===8?e.parentNode:e),new By(t)};xn.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(W(188)):(e=Object.keys(e).join(","),Error(W(268,e)));return e=UR(t),e=e===null?null:e.stateNode,e};xn.flushSync=function(e){return Ts(e)};xn.hydrate=function(e,t,n){if(!xh(t))throw Error(W(200));return Eh(null,e,t,!0,n)};xn.hydrateRoot=function(e,t,n){if(!jy(e))throw Error(W(405));var r=n!=null&&n.hydratedSources||null,i=!1,s="",o=yI;if(n!=null&&(n.unstable_strictMode===!0&&(i=!0),n.identifierPrefix!==void 0&&(s=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),t=bI(t,null,e,1,n??null,i,!1,s,o),e[Gr]=t.current,Nl(e),r)for(e=0;e<r.length;e++)n=r[e],i=n._getVersion,i=i(n._source),t.mutableSourceEagerHydrationData==null?t.mutableSourceEagerHydrationData=[n,i]:t.mutableSourceEagerHydrationData.push(n,i);return new wh(t)};xn.render=function(e,t,n){if(!xh(t))throw Error(W(200));return Eh(null,e,t,!1,n)};xn.unmountComponentAtNode=function(e){if(!xh(e))throw Error(W(40));return e._reactRootContainer?(Ts(function(){Eh(null,null,e,!1,function(){e._reactRootContainer=null,e[Gr]=null})}),!0):!1};xn.unstable_batchedUpdates=Oy;xn.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!xh(n))throw Error(W(200));if(e==null||e._reactInternals===void 0)throw Error(W(38));return Eh(e,t,n,!1,r)};xn.version="18.3.1-next-f1338f8080-20240426";function vI(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(vI)}catch(e){console.error(e)}}vI(),vR.exports=xn;var ia=vR.exports;const k3=ah(ia);var Ok=ia;sg.createRoot=Ok.createRoot,sg.hydrateRoot=Ok.hydrateRoot;/**
|
|
42
42
|
* @remix-run/router v1.23.2
|
|
43
43
|
*
|
|
44
44
|
* Copyright (c) Remix Software Inc.
|
|
@@ -65,7 +65,7 @@ Error generating stack: `+s.message+`
|
|
|
65
65
|
* LICENSE.md file in the root directory of this source tree.
|
|
66
66
|
*
|
|
67
67
|
* @license MIT
|
|
68
|
-
*/const yU="6";try{window.__reactRouterVersion=yU}catch{}const vU="startTransition",jk=ch[vU];function _U(e){let{basename:t,children:n,future:r,window:i}=e,s=y.useRef();s.current==null&&(s.current=C3({window:i,v5Compat:!0}));let o=s.current,[a,l]=y.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},u=y.useCallback(d=>{c&&jk?jk(()=>l(d)):l(d)},[l,c]);return y.useLayoutEffect(()=>o.listen(u),[o,u]),y.useEffect(()=>gU(r),[r]),y.createElement(mU,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}var Uk;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Uk||(Uk={}));var $k;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($k||($k={}));const Hy=y.createContext({});function Vy(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const SU=typeof window<"u",LI=SU?y.useLayoutEffect:y.useEffect,Ch=y.createContext(null);function Gy(e,t){e.indexOf(t)===-1&&e.push(t)}function Ad(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Cr=(e,t,n)=>n>t?t:n<e?e:n;let Wy=()=>{};const Mi={},DI=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function MI(e){return typeof e=="object"&&e!==null}const PI=e=>/^0[^.\s]+$/u.test(e);function FI(e){let t;return()=>(t===void 0&&(t=e()),t)}const Pn=e=>e,wU=(e,t)=>n=>t(e(n)),pc=(...e)=>e.reduce(wU),$l=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class qy{constructor(){this.subscriptions=[]}add(t){return Gy(this.subscriptions,t),()=>Ad(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s<i;s++){const o=this.subscriptions[s];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const vn=e=>e*1e3,Dn=e=>e/1e3;function BI(e,t){return t?e*(1e3/t):0}const jI=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xU=1e-7,EU=12;function kU(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=jI(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>xU&&++a<EU);return o}function fc(e,t,n,r){if(e===t&&n===r)return Pn;const i=s=>kU(s,0,1,e,n);return s=>s===0||s===1?s:jI(i(s),t,r)}const UI=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$I=e=>t=>1-e(1-t),zI=fc(.33,1.53,.69,.99),Ky=$I(zI),HI=UI(Ky),VI=e=>e>=1?1:(e*=2)<1?.5*Ky(e):.5*(2-Math.pow(2,-10*(e-1))),Yy=e=>1-Math.sin(Math.acos(e)),GI=$I(Yy),WI=UI(Yy),CU=fc(.42,0,1,1),TU=fc(0,0,.58,1),qI=fc(.42,0,.58,1),AU=e=>Array.isArray(e)&&typeof e[0]!="number",KI=e=>Array.isArray(e)&&typeof e[0]=="number",RU={linear:Pn,easeIn:CU,easeInOut:qI,easeOut:TU,circIn:Yy,circInOut:WI,circOut:GI,backIn:Ky,backInOut:HI,backOut:zI,anticipate:VI},NU=e=>typeof e=="string",zk=e=>{if(KI(e)){Wy(e.length===4);const[t,n,r,i]=e;return fc(t,n,r,i)}else if(NU(e))return RU[e];return e},Xc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IU(e,t){let n=new Set,r=new Set,i=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,p=!1)=>{const g=p&&i?n:r;return d&&o.add(u),g.add(u),u},cancel:u=>{r.delete(u),o.delete(u)},process:u=>{if(a=u,i){s=!0;return}i=!0;const d=n;n=r,r=d,n.forEach(l),n.clear(),i=!1,s&&(s=!1,c.process(u))}};return c}const OU=40;function YI(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=Xc.reduce((S,w)=>(S[w]=IU(s),S),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:p,render:f,postRender:g}=o,m=()=>{const S=Mi.useManualTiming,w=S?i.timestamp:performance.now();n=!1,S||(i.delta=r?1e3/60:Math.max(Math.min(w-i.timestamp,OU),1)),i.timestamp=w,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),d.process(i),p.process(i),f.process(i),g.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))},_=()=>{n=!0,r=!0,i.isProcessing||e(m)};return{schedule:Xc.reduce((S,w)=>{const k=o[w];return S[w]=(x,E=!1,T=!1)=>(n||_(),k.schedule(x,E,T)),S},{}),cancel:S=>{for(let w=0;w<Xc.length;w++)o[Xc[w]].cancel(S)},state:i,steps:o}}const{schedule:Ie,cancel:Pi,state:Ct,steps:Yp}=YI(typeof requestAnimationFrame<"u"?requestAnimationFrame:Pn,!0);let Ou;function LU(){Ou=void 0}const Kt={now:()=>(Ou===void 0&&Kt.set(Ct.isProcessing||Mi.useManualTiming?Ct.timestamp:performance.now()),Ou),set:e=>{Ou=e,queueMicrotask(LU)}},XI=e=>t=>typeof t=="string"&&t.startsWith(e),ZI=XI("--"),DU=XI("var(--"),Xy=e=>DU(e)?MU.test(e.split("/*")[0].trim()):!1,MU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Hk(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const oa={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zl={...oa,transform:e=>Cr(0,1,e)},Zc={...oa,default:1},dl=e=>Math.round(e*1e5)/1e5,Zy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function PU(e){return e==null}const FU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qy=(e,t)=>n=>!!(typeof n=="string"&&FU.test(n)&&n.startsWith(e)||t&&!PU(n)&&Object.prototype.hasOwnProperty.call(n,t)),QI=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,o,a]=r.match(Zy);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},BU=e=>Cr(0,255,e),Xp={...oa,transform:e=>Math.round(BU(e))},hs={test:Qy("rgb","red"),parse:QI("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Xp.transform(e)+", "+Xp.transform(t)+", "+Xp.transform(n)+", "+dl(zl.transform(r))+")"};function jU(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const em={test:Qy("#"),parse:jU,transform:hs.transform},gc=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ci=gc("deg"),wr=gc("%"),ee=gc("px"),UU=gc("vh"),$U=gc("vw"),Vk={...wr,parse:e=>wr.parse(e)/100,transform:e=>wr.transform(e*100)},xo={test:Qy("hsl","hue"),parse:QI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+wr.transform(dl(t))+", "+wr.transform(dl(n))+", "+dl(zl.transform(r))+")"},st={test:e=>hs.test(e)||em.test(e)||xo.test(e),parse:e=>hs.test(e)?hs.parse(e):xo.test(e)?xo.parse(e):em.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hs.transform(e):xo.transform(e),getAnimatableNone:e=>{const t=st.parse(e);return t.alpha=0,st.transform(t)}},zU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function HU(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Zy))==null?void 0:t.length)||0)+(((n=e.match(zU))==null?void 0:n.length)||0)>0}const JI="number",eO="color",VU="var",GU="var(",Gk="${}",WU=/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 qo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const a=t.replace(WU,l=>(st.test(l)?(r.color.push(s),i.push(eO),n.push(st.parse(l))):l.startsWith(GU)?(r.var.push(s),i.push(VU),n.push(l)):(r.number.push(s),i.push(JI),n.push(parseFloat(l))),++s,Gk)).split(Gk);return{values:n,split:a,indexes:r,types:i}}function qU(e){return qo(e).values}function tO({split:e,types:t}){const n=e.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],r[s]!==void 0){const o=t[s];o===JI?i+=dl(r[s]):o===eO?i+=st.transform(r[s]):i+=r[s]}return i}}function KU(e){return tO(qo(e))}const YU=e=>typeof e=="number"?0:st.test(e)?st.getAnimatableNone(e):e,XU=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:YU(e);function ZU(e){const t=qo(e);return tO(t)(t.values.map((r,i)=>XU(r,t.split[i])))}const Qn={test:HU,parse:qU,createTransformer:KU,getAnimatableNone:ZU};function Zp(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function QU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=Zp(l,a,e+1/3),s=Zp(l,a,e),o=Zp(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function Rd(e,t){return n=>n>0?t:e}const je=(e,t,n)=>e+(t-e)*n,Qp=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},JU=[em,hs,xo],e$=e=>JU.find(t=>t.test(e));function Wk(e){const t=e$(e);if(!t)return!1;let n=t.parse(e);return t===xo&&(n=QU(n)),n}const qk=(e,t)=>{const n=Wk(e),r=Wk(t);if(!n||!r)return Rd(e,t);const i={...n};return s=>(i.red=Qp(n.red,r.red,s),i.green=Qp(n.green,r.green,s),i.blue=Qp(n.blue,r.blue,s),i.alpha=je(n.alpha,r.alpha,s),hs.transform(i))},tm=new Set(["none","hidden"]);function t$(e,t){return tm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function n$(e,t){return n=>je(e,t,n)}function Jy(e){return typeof e=="number"?n$:typeof e=="string"?Xy(e)?Rd:st.test(e)?qk:s$:Array.isArray(e)?nO:typeof e=="object"?st.test(e)?qk:r$:Rd}function nO(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>Jy(s)(s,t[o]));return s=>{for(let o=0;o<r;o++)n[o]=i[o](s);return n}}function r$(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Jy(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function i$(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const s=t.types[i],o=e.indexes[s][r[s]],a=e.values[o]??0;n[i]=a,r[s]++}return n}const s$=(e,t)=>{const n=Qn.createTransformer(t),r=qo(e),i=qo(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tm.has(e)&&!i.values.length||tm.has(t)&&!r.values.length?t$(e,t):pc(nO(i$(r,i),i.values),n):Rd(e,t)};function rO(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?je(e,t,n):Jy(e)(e,t)}const o$=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ie.update(t,n),stop:()=>Pi(t),now:()=>Ct.isProcessing?Ct.timestamp:Kt.now()}},iO=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s<i;s++)r+=Math.round(e(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Nd=2e4;function ev(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Nd;)t+=n,r=e.next(t);return t>=Nd?1/0:t}function a$(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(ev(r),Nd);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Dn(i)}}const Xe={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};function nm(e,t){return e*Math.sqrt(1-t*t)}const l$=12;function c$(e,t,n){let r=n;for(let i=1;i<l$;i++)r=r-e(r)/t(r);return r}const Jp=.001;function u$({duration:e=Xe.duration,bounce:t=Xe.bounce,velocity:n=Xe.velocity,mass:r=Xe.mass}){let i,s,o=1-t;o=Cr(Xe.minDamping,Xe.maxDamping,o),e=Cr(Xe.minDuration,Xe.maxDuration,Dn(e)),o<1?(i=c=>{const u=c*o,d=u*e,p=u-n,f=nm(c,o),g=Math.exp(-d);return Jp-p/f*g},s=c=>{const d=c*o*e,p=d*n+n,f=Math.pow(o,2)*Math.pow(c,2)*e,g=Math.exp(-d),m=nm(Math.pow(c,2),o);return(-i(c)+Jp>0?-1:1)*((p-f)*g)/m}):(i=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-Jp+u*d},s=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=c$(i,s,a);if(e=vn(e),isNaN(l))return{stiffness:Xe.stiffness,damping:Xe.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:e}}}const d$=["duration","bounce"],h$=["stiffness","damping","mass"];function Kk(e,t){return t.some(n=>e[n]!==void 0)}function p$(e){let t={velocity:Xe.velocity,stiffness:Xe.stiffness,damping:Xe.damping,mass:Xe.mass,isResolvedFromDuration:!1,...e};if(!Kk(e,h$)&&Kk(e,d$))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*Cr(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Xe.mass,stiffness:i,damping:s}}else{const n=u$({...e,velocity:0});t={...t,...n,mass:Xe.mass},t.isResolvedFromDuration=!0}return t}function Id(e=Xe.visualDuration,t=Xe.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:c,mass:u,duration:d,velocity:p,isResolvedFromDuration:f}=p$({...n,velocity:-Dn(n.velocity||0)}),g=p||0,m=c/(2*Math.sqrt(l*u)),_=o-s,b=Dn(Math.sqrt(l/u)),v=Math.abs(_)<5;r||(r=v?Xe.restSpeed.granular:Xe.restSpeed.default),i||(i=v?Xe.restDelta.granular:Xe.restDelta.default);let S,w,k,x,E,T;if(m<1)k=nm(b,m),x=(g+m*b*_)/k,S=A=>{const R=Math.exp(-m*b*A);return o-R*(x*Math.sin(k*A)+_*Math.cos(k*A))},E=m*b*x+_*k,T=m*b*_-x*k,w=A=>Math.exp(-m*b*A)*(E*Math.sin(k*A)+T*Math.cos(k*A));else if(m===1){S=R=>o-Math.exp(-b*R)*(_+(g+b*_)*R);const A=g+b*_;w=R=>Math.exp(-b*R)*(b*A*R-g)}else{const A=b*Math.sqrt(m*m-1);S=P=>{const F=Math.exp(-m*b*P),B=Math.min(A*P,300);return o-F*((g+m*b*_)*Math.sinh(B)+A*_*Math.cosh(B))/A};const R=(g+m*b*_)/A,I=m*b*R-_*A,L=m*b*_-R*A;w=P=>{const F=Math.exp(-m*b*P),B=Math.min(A*P,300);return F*(I*Math.sinh(B)+L*Math.cosh(B))}}const D={calculatedDuration:f&&d||null,velocity:A=>vn(w(A)),next:A=>{if(!f&&m<1){const I=Math.exp(-m*b*A),L=Math.sin(k*A),P=Math.cos(k*A),F=o-I*(x*L+_*P),B=vn(I*(E*L+T*P));return a.done=Math.abs(B)<=r&&Math.abs(o-F)<=i,a.value=a.done?o:F,a}const R=S(A);if(f)a.done=A>=d;else{const I=vn(w(A));a.done=Math.abs(I)<=r&&Math.abs(o-R)<=i}return a.value=a.done?o:R,a},toString:()=>{const A=Math.min(ev(D),Nd),R=iO(I=>D.next(A*I).value,A,30);return A+"ms "+R},toTransition:()=>{}};return D}Id.applyToOptions=e=>{const t=a$(e,100,Id);return e.ease=t.ease,e.duration=vn(t.duration),e.type="keyframes",e};const f$=5;function sO(e,t,n){const r=Math.max(t-f$,0);return BI(n-e(r),t-r)}function rm({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],p={done:!1,value:d},f=T=>a!==void 0&&T<a||l!==void 0&&T>l,g=T=>a===void 0?l:l===void 0||Math.abs(a-T)<Math.abs(l-T)?a:l;let m=n*t;const _=d+m,b=o===void 0?_:o(_);b!==_&&(m=b-d);const v=T=>-m*Math.exp(-T/r),S=T=>b+v(T),w=T=>{const D=v(T),A=S(T);p.done=Math.abs(D)<=c,p.value=p.done?b:A};let k,x;const E=T=>{f(p.value)&&(k=T,x=Id({keyframes:[p.value,g(p.value)],velocity:sO(S,T,p.value),damping:i,stiffness:s,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:T=>{let D=!1;return!x&&k===void 0&&(D=!0,w(T),E(T)),k!==void 0&&T>=k?x.next(T-k):(!D&&w(T),p)}}}function g$(e,t,n){const r=[],i=n||Mi.mix||rO,s=e.length-1;for(let o=0;o<s;o++){let a=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||Pn:t;a=pc(l,a)}r.push(a)}return r}function m$(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(Wy(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=g$(t,r,i),l=a.length,c=u=>{if(o&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const p=$l(e[d],e[d+1],u);return a[d](p)};return n?u=>c(Cr(e[0],e[s-1],u)):c}function b$(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=$l(0,t,r);e.push(je(n,1,i))}}function y$(e){const t=[0];return b$(t,e.length-1),t}function v$(e,t){return e.map(n=>n*t)}function _$(e,t){return e.map(()=>t||qI).splice(0,e.length-1)}function hl({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=AU(r)?r.map(zk):zk(r),s={done:!1,value:t[0]},o=v$(n&&n.length===t.length?n:y$(t),e),a=m$(o,t,{ease:Array.isArray(i)?i:_$(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}const S$=e=>e!==null;function Th(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(S$),a=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!a||r===void 0?s[a]:r}const w$={decay:rm,inertia:rm,tween:hl,keyframes:hl,spring:Id};function oO(e){typeof e.type=="string"&&(e.type=w$[e.type])}class tv{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const x$=e=>e/100;class Od extends tv{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==Kt.now()&&this.tick(Kt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;oO(t);const{type:n=hl,repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:a}=t;const l=n||hl;l!==hl&&typeof a[0]!="number"&&(this.mixKeyframes=pc(x$,rO(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});s==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=ev(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:p,repeatDelay:f,type:g,onUpdate:m,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?b<0:b>i;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let S=this.currentTime,w=r;if(d){const T=Math.min(this.currentTime,i)/a;let D=Math.floor(T),A=T%1;!A&&T>=1&&(A=1),A===1&&D--,D=Math.min(D,d+1),!!(D%2)&&(p==="reverse"?(A=1-A,f&&(A-=f/a)):p==="mirror"&&(w=o)),S=Cr(0,1,A)*a}let k;v?(this.delayState.value=u[0],k=this.delayState):k=w.next(S),s&&!v&&(k.value=s(k.value));let{done:x}=k;!v&&l!==null&&(x=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&x);return E&&g!==rm&&(k.value=Th(u,this.options,_,this.speed)),m&&m(k.value),E&&this.finish(),k}then(t,n){return this.finished.then(t,n)}get duration(){return Dn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Dn(t)}get time(){return Dn(this.currentTime)}set time(t){t=vn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return sO(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Kt.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Dn(this.currentTime))}play(){var i,s;if(this.isStopped)return;const{driver:t=o$,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(s=(i=this.options).onPlay)==null||s.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(Kt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function E$(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ps=e=>e*180/Math.PI,im=e=>{const t=ps(Math.atan2(e[1],e[0]));return sm(t)},k$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:im,rotateZ:im,skewX:e=>ps(Math.atan(e[1])),skewY:e=>ps(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},sm=e=>(e=e%360,e<0&&(e+=360),e),Yk=im,Xk=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Zk=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),C$={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xk,scaleY:Zk,scale:e=>(Xk(e)+Zk(e))/2,rotateX:e=>sm(ps(Math.atan2(e[6],e[5]))),rotateY:e=>sm(ps(Math.atan2(-e[2],e[0]))),rotateZ:Yk,rotate:Yk,skewX:e=>ps(Math.atan(e[4])),skewY:e=>ps(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function om(e){return e.includes("scale")?1:0}function am(e,t){if(!e||e==="none")return om(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=C$,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=k$,i=a}if(!i)return om(t);const s=r[t],o=i[1].split(",").map(A$);return typeof s=="function"?s(o):o[s]}const T$=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return am(n,t)};function A$(e){return parseFloat(e.trim())}const aa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],la=new Set(aa),Qk=e=>e===oa||e===ee,R$=new Set(["x","y","z"]),N$=aa.filter(e=>!R$.has(e));function I$(e){const t=[];return N$.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const _i={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>am(t,"x"),y:(e,{transform:t})=>am(t,"y")};_i.translateX=_i.x;_i.translateY=_i.y;const ys=new Set;let lm=!1,cm=!1,um=!1;function aO(){if(cm){const e=Array.from(ys).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=I$(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,o])=>{var a;(a=r.getValue(s))==null||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}cm=!1,lm=!1,ys.forEach(e=>e.complete(um)),ys.clear()}function lO(){ys.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(cm=!0)})}function O$(){um=!0,lO(),aO(),um=!1}class nv{constructor(t,n,r,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ys.add(this),lm||(lm=!0,Ie.read(lO),Ie.resolveKeyframes(aO))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const s=i==null?void 0:i.get(),o=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const a=r.readValue(n,o);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=o),i&&s===void 0&&i.set(t[0])}E$(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ys.delete(this)}cancel(){this.state==="scheduled"&&(ys.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const L$=e=>e.startsWith("--");function cO(e,t,n){L$(t)?e.style.setProperty(t,n):e.style[t]=n}const D$={};function uO(e,t){const n=FI(e);return()=>D$[t]??n()}const M$=uO(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),dO=uO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ya=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ya([0,.65,.55,1]),circOut:Ya([.55,0,1,.45]),backIn:Ya([.31,.01,.66,-.59]),backOut:Ya([.33,1.53,.69,.99])};function hO(e,t){if(e)return typeof e=="function"?dO()?iO(e,t):"ease-out":KI(e)?Ya(e):Array.isArray(e)?e.map(n=>hO(n,t)||Jk.easeOut):Jk[e]}function P$(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=hO(a,i);Array.isArray(d)&&(u.easing=d);const p={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return c&&(p.pseudoElement=c),e.animate(u,p)}function pO(e){return typeof e=="function"&&"applyToOptions"in e}function F$({type:e,...t}){return pO(e)&&dO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class fO extends tv{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=t,Wy(typeof t.type!="string");const c=F$(t);this.animation=P$(n,r,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const u=Th(i,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),cO(n,r,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Dn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Dn(t)}get time(){return Dn(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=vn(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:i}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&M$()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Pn):i(this)}}const gO={anticipate:VI,backInOut:HI,circInOut:WI};function B$(e){return e in gO}function j$(e){typeof e.ease=="string"&&B$(e.ease)&&(e.ease=gO[e.ease])}const ef=10;class U$ extends fO{constructor(t){j$(t),oO(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:s,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new Od({...o,autoplay:!1}),l=Math.max(ef,Kt.now()-this.startTime),c=Cr(0,ef,l-ef),u=a.sample(l).value,{name:d}=this.options;s&&d&&cO(s,d,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const eC=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qn.test(e)||e==="0")&&!e.startsWith("url("));function $$(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function z$(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],o=eC(i,t),a=eC(s,t);return!o||!a?!1:$$(e)||(n==="spring"||pO(n))&&r}function dm(e){e.duration=0,e.type="keyframes"}const mO=new Set(["opacity","clipPath","filter","transform"]),H$=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function V$(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&H$.test(e[t]))return!0;return!1}const G$=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),W$=FI(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function q$(e){var d;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:o,keyframes:a}=e;if(!(((d=t==null?void 0:t.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return W$()&&n&&(mO.has(n)||G$.has(n)&&V$(a))&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&s!==0&&o!=="inertia"}const K$=40;class Y$ extends tv{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){var g;super(),this.stop=()=>{var m,_;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(_=this.keyframeResolver)==null||_.cancel()},this.createdAt=Kt.now();const p={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:o,name:l,motionValue:c,element:u,...d},f=(u==null?void 0:u.KeyframeResolver)||nv;this.keyframeResolver=new f(a,(m,_,b)=>this.onKeyframesResolved(m,_,p,!b),l,c,u),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(t,n,r,i){var b,v;this.keyframeResolver=void 0;const{name:s,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=Kt.now();let d=!0;z$(t,s,o,a)||(d=!1,(Mi.instantAnimations||!l)&&(u==null||u(Th(t,r,n))),t[0]=t[t.length-1],dm(r),r.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>K$?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},g=d&&!c&&q$(f),m=(v=(b=f.motionValue)==null?void 0:b.owner)==null?void 0:v.current;let _;if(g)try{_=new U$({...f,element:m})}catch{_=new Od(f)}else _=new Od(f);_.finished.then(()=>{this.notifyFinished()}).catch(Pn),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),O$()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function bO(e,t,n,r=0,i=1){const s=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),o=e.size,a=(o-1)*r;return typeof n=="function"?n(s,o):i===1?s*r:a-s*r}const X$=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Z$(e){const t=X$.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function yO(e,t,n=1){const[r,i]=Z$(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return DI(o)?parseFloat(o):o}return Xy(i)?yO(i,t,n+1):i}const Q$={type:"spring",stiffness:500,damping:25,restSpeed:10},J$=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ez={type:"keyframes",duration:.8},tz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nz=(e,{keyframes:t})=>t.length>2?ez:la.has(e)?e.startsWith("scale")?J$(t[1]):Q$:tz;function vO(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function rv(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?vO(n,e):n}const rz=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function iz(e){for(const t in e)if(!rz.has(t))return!0;return!1}const iv=(e,t,n,r={},i,s)=>o=>{const a=rv(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-vn(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:p=>{t.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:s?void 0:i};iz(a)||Object.assign(u,nz(e,u)),u.duration&&(u.duration=vn(u.duration)),u.repeatDelay&&(u.repeatDelay=vn(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(dm(u),u.delay===0&&(d=!0)),(Mi.instantAnimations||Mi.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(d=!0,dm(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!s&&t.get()!==void 0){const p=Th(u.keyframes,a);if(p!==void 0){Ie.update(()=>{u.onUpdate(p),u.onComplete()});return}}return a.isSync?new Od(u):new Y$(u)};function tC(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function sv(e,t,n,r){if(typeof t=="function"){const[i,s]=tC(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=tC(r);t=t(n!==void 0?n:e.custom,i,s)}return t}function vs(e,t,n){const r=e.getProps();return sv(r,t,n!==void 0?n:r.custom,e)}const _O=new Set(["width","height","top","left","right","bottom",...aa]),nC=30,sz=e=>!isNaN(parseFloat(e));class oz{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var s;const i=Kt.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Kt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=sz(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new qy);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ie.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Kt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>nC)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,nC);return BI(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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 t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ko(e,t){return new oz(e,t)}const hm=e=>Array.isArray(e);function az(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ko(n))}function lz(e){return hm(e)?e[e.length-1]||0:e}function cz(e,t){const n=vs(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const o in s){const a=lz(s[o]);az(e,o,a)}}const Rt=e=>!!(e&&e.getVelocity);function uz(e){return!!(Rt(e)&&e.add)}function pm(e,t){const n=e.getValue("willChange");if(uz(n))return n.add(t);if(!n&&Mi.WillChange){const r=new Mi.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function ov(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const dz="framerAppearId",SO="data-"+ov(dz);function wO(e){return e.props[SO]}function hz({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function xO(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();s=s?vO(s,l):l;const c=s==null?void 0:s.reduceMotion;r&&(s=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const p in a){const f=e.getValue(p,e.latestValues[p]??null),g=a[p];if(g===void 0||d&&hz(d,p))continue;const m={delay:n,...rv(s||{},p)},_=f.get();if(_!==void 0&&!f.isAnimating()&&!Array.isArray(g)&&g===_&&!m.velocity){Ie.update(()=>f.set(g));continue}let b=!1;if(window.MotionHandoffAnimation){const w=wO(e);if(w){const k=window.MotionHandoffAnimation(w,p,Ie);k!==null&&(m.startTime=k,b=!0)}}pm(e,p);const v=c??e.shouldReduceMotion;f.start(iv(p,f,g,v&&_O.has(p)?{type:!1}:m,e,b));const S=f.animation;S&&u.push(S)}if(o){const p=()=>Ie.update(()=>{o&&cz(e,o)});u.length?Promise.all(u).then(p):p()}return u}function fm(e,t,n={}){var l;const r=vs(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const s=r?()=>Promise.all(xO(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:p}=i;return pz(e,t,c,u,d,p,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,u]=a==="beforeChildren"?[s,o]:[o,s];return c().then(()=>u())}else return Promise.all([s(),o(n.delay)])}function pz(e,t,n=0,r=0,i=0,s=1,o){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(fm(l,t,{...o,delay:n+(typeof r=="function"?0:r)+bO(e.variantChildren,l,r,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function fz(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>fm(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=fm(e,t,n);else{const i=typeof t=="function"?vs(e,t,n.custom):t;r=Promise.all(xO(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const gz={test:e=>e==="auto",parse:e=>e},EO=e=>t=>t.test(e),kO=[oa,ee,wr,ci,$U,UU,gz],rC=e=>kO.find(EO(e));function mz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||PI(e):!0}const bz=new Set(["brightness","contrast","saturate","opacity"]);function yz(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Zy)||[];if(!r)return e;const i=n.replace(r,"");let s=bz.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const vz=/\b([a-z-]*)\(.*?\)/gu,gm={...Qn,getAnimatableNone:e=>{const t=e.match(vz);return t?t.map(yz).join(" "):e}},mm={...Qn,getAnimatableNone:e=>{const t=Qn.parse(e);return Qn.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},iC={...oa,transform:Math.round},_z={rotate:ci,rotateX:ci,rotateY:ci,rotateZ:ci,scale:Zc,scaleX:Zc,scaleY:Zc,scaleZ:Zc,skew:ci,skewX:ci,skewY:ci,distance:ee,translateX:ee,translateY:ee,translateZ:ee,x:ee,y:ee,z:ee,perspective:ee,transformPerspective:ee,opacity:zl,originX:Vk,originY:Vk,originZ:ee},av={borderWidth:ee,borderTopWidth:ee,borderRightWidth:ee,borderBottomWidth:ee,borderLeftWidth:ee,borderRadius:ee,borderTopLeftRadius:ee,borderTopRightRadius:ee,borderBottomRightRadius:ee,borderBottomLeftRadius:ee,width:ee,maxWidth:ee,height:ee,maxHeight:ee,top:ee,right:ee,bottom:ee,left:ee,inset:ee,insetBlock:ee,insetBlockStart:ee,insetBlockEnd:ee,insetInline:ee,insetInlineStart:ee,insetInlineEnd:ee,padding:ee,paddingTop:ee,paddingRight:ee,paddingBottom:ee,paddingLeft:ee,paddingBlock:ee,paddingBlockStart:ee,paddingBlockEnd:ee,paddingInline:ee,paddingInlineStart:ee,paddingInlineEnd:ee,margin:ee,marginTop:ee,marginRight:ee,marginBottom:ee,marginLeft:ee,marginBlock:ee,marginBlockStart:ee,marginBlockEnd:ee,marginInline:ee,marginInlineStart:ee,marginInlineEnd:ee,fontSize:ee,backgroundPositionX:ee,backgroundPositionY:ee,..._z,zIndex:iC,fillOpacity:zl,strokeOpacity:zl,numOctaves:iC},Sz={...av,color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,filter:gm,WebkitFilter:gm,mask:mm,WebkitMask:mm},CO=e=>Sz[e],wz=new Set([gm,mm]);function TO(e,t){let n=CO(e);return wz.has(n)||(n=Qn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const xz=new Set(["auto","none","0"]);function Ez(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!xz.has(s)&&qo(s).values.length&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]=TO(n,i)}class kz extends nv{constructor(t,n,r,i,s){super(t,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),Xy(d))){const p=yO(d,n.current);p!==void 0&&(t[u]=p),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!_O.has(r)||t.length!==2)return;const[i,s]=t,o=rC(i),a=rC(s),l=Hk(i),c=Hk(s);if(l!==c&&_i[r]){this.needsMeasurement=!0;return}if(o!==a)if(Qk(o)&&Qk(a))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else _i[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||mz(t[i]))&&r.push(i);r.length&&Ez(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_i[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){var a;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const s=r.length-1,o=r[s];r[s]=_i[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function AO(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const RO=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Lu(e){return MI(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:lv}=YI(queueMicrotask,!1),Gn={x:!1,y:!1};function NO(){return Gn.x||Gn.y}function Cz(e){return e==="x"||e==="y"?Gn[e]?null:(Gn[e]=!0,()=>{Gn[e]=!1}):Gn.x||Gn.y?null:(Gn.x=Gn.y=!0,()=>{Gn.x=Gn.y=!1})}function IO(e,t){const n=AO(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Tz(e){return!(e.pointerType==="touch"||NO())}function Az(e,t,n={}){const[r,i,s]=IO(e,n);return r.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",g)},d=_=>{c&&(c(_),c=void 0),u()},p=_=>{a=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,d(_))},f=()=>{a=!0,window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",p,i)},g=_=>{if(_.pointerType!=="touch"){if(a){l=!0;return}d(_)}},m=_=>{if(!Tz(_))return;l=!1;const b=t(o,_);typeof b=="function"&&(c=b,o.addEventListener("pointerleave",g,i))};o.addEventListener("pointerenter",m,i),o.addEventListener("pointerdown",f,i)}),s}const OO=(e,t)=>t?e===t?!0:OO(e,t.parentElement):!1,cv=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Rz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Nz(e){return Rz.has(e.tagName)||e.isContentEditable===!0}const Iz=new Set(["INPUT","SELECT","TEXTAREA"]);function Oz(e){return Iz.has(e.tagName)||e.isContentEditable===!0}const Du=new WeakSet;function sC(e){return t=>{t.key==="Enter"&&e(t)}}function tf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Lz=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=sC(()=>{if(Du.has(n))return;tf(n,"down");const i=sC(()=>{tf(n,"up")}),s=()=>tf(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function oC(e){return cv(e)&&!NO()}const aC=new WeakSet;function Dz(e,t,n={}){const[r,i,s]=IO(e,n),o=a=>{const l=a.currentTarget;if(!oC(a)||aC.has(a))return;Du.add(l),n.stopPropagation&&aC.add(a);const c=t(l,a),u=(f,g)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",p),Du.has(l)&&Du.delete(l),oC(f)&&typeof c=="function"&&c(f,{success:g})},d=f=>{u(f,l===window||l===document||n.useGlobalTarget||OO(l,f.target))},p=f=>{u(f,!1)};window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",p,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),Lu(a)&&(a.addEventListener("focus",c=>Lz(c,i)),!Nz(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function uv(e){return MI(e)&&"ownerSVGElement"in e}const Mu=new WeakMap;let ui;const LO=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:uv(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Mz=LO("inline","width","offsetWidth"),Pz=LO("block","height","offsetHeight");function Fz({target:e,borderBoxSize:t}){var n;(n=Mu.get(e))==null||n.forEach(r=>{r(e,{get width(){return Mz(e,t)},get height(){return Pz(e,t)}})})}function Bz(e){e.forEach(Fz)}function jz(){typeof ResizeObserver>"u"||(ui=new ResizeObserver(Bz))}function Uz(e,t){ui||jz();const n=AO(e);return n.forEach(r=>{let i=Mu.get(r);i||(i=new Set,Mu.set(r,i)),i.add(t),ui==null||ui.observe(r)}),()=>{n.forEach(r=>{const i=Mu.get(r);i==null||i.delete(t),i!=null&&i.size||ui==null||ui.unobserve(r)})}}const Pu=new Set;let Eo;function $z(){Eo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Pu.forEach(t=>t(e))},window.addEventListener("resize",Eo)}function zz(e){return Pu.add(e),Eo||$z(),()=>{Pu.delete(e),!Pu.size&&typeof Eo=="function"&&(window.removeEventListener("resize",Eo),Eo=void 0)}}function lC(e,t){return typeof e=="function"?zz(e):Uz(e,t)}function Hz(e){return uv(e)&&e.tagName==="svg"}const Vz=[...kO,st,Qn],Gz=e=>Vz.find(EO(e)),cC=()=>({translate:0,scale:1,origin:0,originPoint:0}),ko=()=>({x:cC(),y:cC()}),uC=()=>({min:0,max:0}),ht=()=>({x:uC(),y:uC()}),Wz=new WeakMap;function Ah(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Hl(e){return typeof e=="string"||Array.isArray(e)}const dv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hv=["initial",...dv];function Rh(e){return Ah(e.animate)||hv.some(t=>Hl(e[t]))}function DO(e){return!!(Rh(e)||e.variants)}function qz(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Rt(i))e.addValue(r,i);else if(Rt(s))e.addValue(r,Ko(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,Ko(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const bm={current:null},MO={current:!1},Kz=typeof window<"u";function Yz(){if(MO.current=!0,!!Kz)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>bm.current=e.matches;e.addEventListener("change",t),t()}else bm.current=!1}const dC=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ld={};function PO(e){Ld=e}function Xz(){return Ld}class Zz{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:o,visualState:a},l={}){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=nv,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 f=Kt.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Ie.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=Rh(n),this.isVariantNode=DO(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in p){const g=p[f];c[f]!==void 0&&Rt(g)&&g.set(c[f])}}mount(t){var n,r;if(this.hasBeenMounted)for(const i in this.initialValues)(n=this.values.get(i))==null||n.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=t,Wz.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,s)=>this.bindToMotionValue(s,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(MO.current||Yz(),this.shouldReduceMotion=bm.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Pi(this.notifyUpdate),Pi(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&mO.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,d=new fO({element:this.current,name:t,keyframes:a,times:l,ease:c,duration:vn(u)}),p=o(d);this.valueSubscriptions.set(t,()=>{p(),d.cancel()});return}const r=la.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ie.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s&&s(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ld){const n=Ld[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ht()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<dC.length;r++){const i=dC[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s="on"+i,o=t[s];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=qz(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ko(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(DI(r)||PI(r))?r=parseFloat(r):!Gz(r)&&Qn.test(n)&&(r=TO(t,n)),this.setBaseTarget(t,Rt(r)?r.get():r)),Rt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var s;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=sv(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Rt(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new qy),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){lv.render(this.render)}}class FO extends Zz{constructor(){super(...arguments),this.KeyframeResolver=kz}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Rt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Gi{constructor(t){this.isMounted=!1,this.node=t}update(){}}function BO({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Qz({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Jz(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function nf(e){return e===void 0||e===1}function ym({scale:e,scaleX:t,scaleY:n}){return!nf(e)||!nf(t)||!nf(n)}function ss(e){return ym(e)||jO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function jO(e){return hC(e.x)||hC(e.y)}function hC(e){return e&&e!=="0%"}function Dd(e,t,n){const r=e-n,i=t*r;return n+i}function pC(e,t,n,r,i){return i!==void 0&&(e=Dd(e,i,r)),Dd(e,n,r)+t}function vm(e,t=0,n=1,r,i){e.min=pC(e.min,t,n,r,i),e.max=pC(e.max,t,n,r,i)}function UO(e,{x:t,y:n}){vm(e.x,t.translate,t.scale,t.originPoint),vm(e.y,n.translate,n.scale,n.originPoint)}const fC=.999999999999,gC=1.0000000000001;function e5(e,t,n,r=!1){var a;const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let l=0;l<i;l++){s=n[l],o=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(fr(e.x,-s.scroll.offset.x),fr(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,UO(e,o)),r&&ss(s.latestValues)&&Fu(e,s.latestValues,(a=s.layout)==null?void 0:a.layoutBox))}t.x<gC&&t.x>fC&&(t.x=1),t.y<gC&&t.y>fC&&(t.y=1)}function fr(e,t){e.min+=t,e.max+=t}function mC(e,t,n,r,i=.5){const s=je(e.min,e.max,i);vm(e,t,n,s,r)}function bC(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Fu(e,t,n){const r=n??e;mC(e.x,bC(t.x,r.x),t.scaleX,t.scale,t.originX),mC(e.y,bC(t.y,r.y),t.scaleY,t.scale,t.originY)}function $O(e,t){return BO(Jz(e.getBoundingClientRect(),t))}function t5(e,t,n){const r=$O(e,n),{scroll:i}=t;return i&&(fr(r.x,i.offset.x),fr(r.y,i.offset.y)),r}const n5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},r5=aa.length;function i5(e,t,n){let r="",i=!0;for(let s=0;s<r5;s++){const o=aa[s],a=e[o];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(o.startsWith("scale")?1:0);else{const c=parseFloat(a);l=o.startsWith("scale")?c===1:c===0}if(!l||n){const c=RO(a,av[o]);if(!l){i=!1;const u=n5[o]||o;r+=`${u}(${c}) `}n&&(t[o]=c)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function pv(e,t,n){const{style:r,vars:i,transformOrigin:s}=e;let o=!1,a=!1;for(const l in t){const c=t[l];if(la.has(l)){o=!0;continue}else if(ZI(l)){i[l]=c;continue}else{const u=RO(c,av[l]);l.startsWith("origin")?(a=!0,s[l]=u):r[l]=u}}if(t.transform||(o||n?r.transform=i5(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;r.transformOrigin=`${l} ${c} ${u}`}}function zO(e,{style:t,vars:n},r,i){const s=e.style;let o;for(o in t)s[o]=t[o];i==null||i.applyProjectionStyles(s,r);for(o in n)s.setProperty(o,n[o])}function yC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Da={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=yC(e,t.target.x),r=yC(e,t.target.y);return`${n}% ${r}%`}},s5={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Qn.parse(e);if(i.length>5)return r;const s=Qn.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const c=je(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}},_m={borderRadius:{...Da,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Da,borderTopRightRadius:Da,borderBottomLeftRadius:Da,borderBottomRightRadius:Da,boxShadow:s5};function HO(e,{layout:t,layoutId:n}){return la.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!_m[e]||e==="opacity")}function fv(e,t,n){var o;const r=e.style,i=t==null?void 0:t.style,s={};if(!r)return s;for(const a in r)(Rt(r[a])||i&&Rt(i[a])||HO(a,e)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function o5(e){return window.getComputedStyle(e)}class a5 extends FO{constructor(){super(...arguments),this.type="html",this.renderInstance=zO}readValueFromInstance(t,n){var r;if(la.has(n))return(r=this.projection)!=null&&r.isProjecting?om(n):T$(t,n);{const i=o5(t),s=(ZI(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $O(t,n)}build(t,n,r){pv(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return fv(t,n,r)}}const l5={offset:"stroke-dashoffset",array:"stroke-dasharray"},c5={offset:"strokeDashoffset",array:"strokeDasharray"};function u5(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?l5:c5;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}const d5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function VO(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:o=0,...a},l,c,u){if(pv(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const f of d5)d[f]!==void 0&&(p[f]=d[f],delete d[f]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&u5(d,i,s,o,!1)}const GO=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"]),WO=e=>typeof e=="string"&&e.toLowerCase()==="svg";function h5(e,t,n,r){zO(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(GO.has(i)?i:ov(i),t.attrs[i])}function qO(e,t,n){const r=fv(e,t,n);for(const i in e)if(Rt(e[i])||Rt(t[i])){const s=aa.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}class p5 extends FO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(la.has(n)){const r=CO(n);return r&&r.default||0}return n=GO.has(n)?n:ov(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return qO(t,n,r)}build(t,n,r){VO(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){h5(t,n,r,i)}mount(t){this.isSVGTag=WO(t.tagName),super.mount(t)}}const f5=hv.length;function KO(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?KO(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<f5;n++){const r=hv[n],i=e.props[r];(Hl(i)||i===!1)&&(t[r]=i)}return t}function YO(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const g5=[...dv].reverse(),m5=dv.length;function b5(e){return t=>Promise.all(t.map(({animation:n,options:r})=>fz(e,n,r)))}function y5(e){let t=b5(e),n=vC(),r=!0,i=!1;const s=c=>(u,d)=>{var f;const p=vs(e,d,c==="exit"?(f=e.presenceContext)==null?void 0:f.custom:void 0);if(p){const{transition:g,transitionEnd:m,..._}=p;u={...u,..._,...m}}return u};function o(c){t=c(e)}function a(c){const{props:u}=e,d=KO(e.parent)||{},p=[],f=new Set;let g={},m=1/0;for(let b=0;b<m5;b++){const v=g5[b],S=n[v],w=u[v]!==void 0?u[v]:d[v],k=Hl(w),x=v===c?S.isActive:null;x===!1&&(m=b);let E=w===d[v]&&w!==u[v]&&k;if(E&&(r||i)&&e.manuallyAnimateOnMount&&(E=!1),S.protectedKeys={...g},!S.isActive&&x===null||!w&&!S.prevProp||Ah(w)||typeof w=="boolean")continue;if(v==="exit"&&S.isActive&&x!==!0){S.prevResolvedValues&&(g={...g,...S.prevResolvedValues});continue}const T=v5(S.prevProp,w);let D=T||v===c&&S.isActive&&!E&&k||b>m&&k,A=!1;const R=Array.isArray(w)?w:[w];let I=R.reduce(s(v),{});x===!1&&(I={});const{prevResolvedValues:L={}}=S,P={...L,...I},F=O=>{D=!0,f.has(O)&&(A=!0,f.delete(O)),S.needsAnimating[O]=!0;const j=e.getValue(O);j&&(j.liveStyle=!1)};for(const O in P){const j=I[O],C=L[O];if(g.hasOwnProperty(O))continue;let z=!1;hm(j)&&hm(C)?z=!YO(j,C):z=j!==C,z?j!=null?F(O):f.add(O):j!==void 0&&f.has(O)?F(O):S.protectedKeys[O]=!0}S.prevProp=w,S.prevResolvedValues=I,S.isActive&&(g={...g,...I}),(r||i)&&e.blockInitialAnimation&&(D=!1);const B=E&&T;D&&(!B||A)&&p.push(...R.map(O=>{const j={type:v};if(typeof O=="string"&&(r||i)&&!B&&e.manuallyAnimateOnMount&&e.parent){const{parent:C}=e,z=vs(C,O);if(C.enteringChildren&&z){const{delayChildren:Z}=z.transition||{};j.delay=bO(C.enteringChildren,e,Z)}}return{animation:O,options:j}}))}if(f.size){const b={};if(typeof u.initial!="boolean"){const v=vs(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(b.transition=v.transition)}f.forEach(v=>{const S=e.getBaseTarget(v),w=e.getValue(v);w&&(w.liveStyle=!0),b[v]=S??null}),p.push({animation:b})}let _=!!p.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,i=!1,_?t(p):Promise.resolve()}function l(c,u){var p;if(n[c].isActive===u)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(f=>{var g;return(g=f.animationState)==null?void 0:g.setActive(c,u)}),n[c].isActive=u;const d=a(c);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=vC(),i=!0}}}function v5(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!YO(t,e):!1}function Qi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vC(){return{animate:Qi(!0),whileInView:Qi(),whileHover:Qi(),whileTap:Qi(),whileDrag:Qi(),whileFocus:Qi(),exit:Qi()}}function Sm(e,t){e.min=t.min,e.max=t.max}function Hn(e,t){Sm(e.x,t.x),Sm(e.y,t.y)}function _C(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const XO=1e-4,_5=1-XO,S5=1+XO,ZO=.01,w5=0-ZO,x5=0+ZO;function Yt(e){return e.max-e.min}function E5(e,t,n){return Math.abs(e-t)<=n}function SC(e,t,n,r=.5){e.origin=r,e.originPoint=je(t.min,t.max,e.origin),e.scale=Yt(n)/Yt(t),e.translate=je(n.min,n.max,e.origin)-e.originPoint,(e.scale>=_5&&e.scale<=S5||isNaN(e.scale))&&(e.scale=1),(e.translate>=w5&&e.translate<=x5||isNaN(e.translate))&&(e.translate=0)}function pl(e,t,n,r){SC(e.x,t.x,n.x,r?r.originX:void 0),SC(e.y,t.y,n.y,r?r.originY:void 0)}function wC(e,t,n,r=0){const i=r?je(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+Yt(t)}function k5(e,t,n,r){wC(e.x,t.x,n.x,r==null?void 0:r.x),wC(e.y,t.y,n.y,r==null?void 0:r.y)}function xC(e,t,n,r=0){const i=r?je(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Yt(t)}function Md(e,t,n,r){xC(e.x,t.x,n.x,r==null?void 0:r.x),xC(e.y,t.y,n.y,r==null?void 0:r.y)}function EC(e,t,n,r,i){return e-=t,e=Dd(e,1/n,r),i!==void 0&&(e=Dd(e,1/i,r)),e}function C5(e,t=0,n=1,r=.5,i,s=e,o=e){if(wr.test(t)&&(t=parseFloat(t),t=je(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=je(s.min,s.max,r);e===s&&(a-=t),e.min=EC(e.min,t,n,a,i),e.max=EC(e.max,t,n,a,i)}function kC(e,t,[n,r,i],s,o){C5(e,t[n],t[r],t[i],t.scale,s,o)}const T5=["x","scaleX","originX"],A5=["y","scaleY","originY"];function CC(e,t,n,r){kC(e.x,t,T5,n?n.x:void 0,r?r.x:void 0),kC(e.y,t,A5,n?n.y:void 0,r?r.y:void 0)}function TC(e){return e.translate===0&&e.scale===1}function QO(e){return TC(e.x)&&TC(e.y)}function AC(e,t){return e.min===t.min&&e.max===t.max}function R5(e,t){return AC(e.x,t.x)&&AC(e.y,t.y)}function RC(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function JO(e,t){return RC(e.x,t.x)&&RC(e.y,t.y)}function NC(e){return Yt(e.x)/Yt(e.y)}function IC(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function hr(e){return[e("x"),e("y")]}function N5(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:p,skewX:f,skewY:g}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),p&&(r+=`rotateY(${p}deg) `),f&&(r+=`skewX(${f}deg) `),g&&(r+=`skewY(${g}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const eL=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],I5=eL.length,OC=e=>typeof e=="string"?parseFloat(e):e,LC=e=>typeof e=="number"||ee.test(e);function O5(e,t,n,r,i,s){i?(e.opacity=je(0,n.opacity??1,L5(r)),e.opacityExit=je(t.opacity??1,0,D5(r))):s&&(e.opacity=je(t.opacity??1,n.opacity??1,r));for(let o=0;o<I5;o++){const a=eL[o];let l=DC(t,a),c=DC(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||LC(l)===LC(c)?(e[a]=Math.max(je(OC(l),OC(c),r),0),(wr.test(c)||wr.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=je(t.rotate||0,n.rotate||0,r))}function DC(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const L5=tL(0,.5,GI),D5=tL(.5,.95,Pn);function tL(e,t,n){return r=>r<e?0:r>t?1:n($l(e,t,r))}function M5(e,t,n){const r=Rt(e)?e:Ko(e);return r.start(iv("",r,t,n)),r.animation}function Vl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const P5=(e,t)=>e.depth-t.depth;class F5{constructor(){this.children=[],this.isDirty=!1}add(t){Gy(this.children,t),this.isDirty=!0}remove(t){Ad(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(P5),this.isDirty=!1,this.children.forEach(t)}}function B5(e,t){const n=Kt.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Pi(r),e(s-t))};return Ie.setup(r,!0),()=>Pi(r)}function Bu(e){return Rt(e)?e.get():e}class j5{constructor(){this.members=[]}add(t){Gy(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Ad(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Ad(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,n){var i;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:o}=t.options;(s===void 0||s!==o)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,i,s,o;(r=(n=t.options).onExitComplete)==null||r.call(n),(o=(i=t.resumingFrom)==null?void 0:(s=i.options).onExitComplete)==null||o.call(s)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const ju={hasAnimatedSinceResize:!0,hasEverUpdated:!1},rf=["","X","Y","Z"],U5=1e3;let $5=0;function sf(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function nL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=wO(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ie,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&nL(r)}function rL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t==null?void 0:t()){this.id=$5++,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(V5),this.nodes.forEach(X5),this.nodes.forEach(Z5),this.nodes.forEach(G5)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new F5)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new qy),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=uv(o)&&!Hz(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const p=()=>this.root.updateBlockedByResize=!1;Ie.read(()=>{d=window.innerWidth}),e(o,()=>{const f=window.innerWidth;f!==d&&(d=f,this.root.updateBlockedByResize=!0,u&&u(),u=B5(p,250),ju.hasAnimatedSinceResize&&(ju.hasAnimatedSinceResize=!1,this.nodes.forEach(FC)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:p,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||n4,{onLayoutAnimationStart:m,onLayoutAnimationComplete:_}=c.getProps(),b=!this.targetLayout||!JO(this.targetLayout,f),v=!d&&p;if(this.options.layoutRoot||this.resumeFrom||v||d&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...rv(g,"layout"),onPlay:m,onComplete:_};(c.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,v)}else d||FC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}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(),Pi(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(Q5),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&&nL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(q5),this.nodes.forEach(MC);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(PC);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(K5),this.nodes.forEach(Y5),this.nodes.forEach(z5),this.nodes.forEach(H5)):this.nodes.forEach(PC),this.clearAllSnapshots();const a=Kt.now();Ct.delta=Cr(0,1e3/60,a-Ct.timestamp),Ct.timestamp=a,Ct.isProcessing=!0,Yp.update.process(Ct),Yp.preRender.process(Ct),Yp.render.process(Ct),Ct.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(W5),this.sharedNodes.forEach(J5)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ie.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ie.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Yt(this.snapshot.measuredBox.x)&&!Yt(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 l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=ht()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!QO(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||ss(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),r4(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return ht();const a=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(i4))){const{scroll:u}=this.root;u&&(fr(a.x,u.offset.x),fr(a.y,u.offset.y))}return a}removeElementScroll(o){var l;const a=ht();if(Hn(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:p}=u;u!==this.root&&d&&p.layoutScroll&&(d.wasRoot&&Hn(a,o),fr(a.x,d.offset.x),fr(a.y,d.offset.y))}return a}applyTransform(o,a=!1,l){var u,d;const c=l||ht();Hn(c,o);for(let p=0;p<this.path.length;p++){const f=this.path[p];!a&&f.options.layoutScroll&&f.scroll&&f!==f.root&&(fr(c.x,-f.scroll.offset.x),fr(c.y,-f.scroll.offset.y)),ss(f.latestValues)&&Fu(c,f.latestValues,(u=f.layout)==null?void 0:u.layoutBox)}return ss(this.latestValues)&&Fu(c,this.latestValues,(d=this.layout)==null?void 0:d.layoutBox),c}removeTransform(o){var l;const a=ht();Hn(a,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!ss(u.latestValues))continue;let d;u.instance&&(ym(u.latestValues)&&u.updateSnapshot(),d=ht(),Hn(d,u.measurePageBox())),CC(a,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,d)}return ss(this.latestValues)&&CC(a,this.latestValues),a}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!==Ct.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var f;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=Ct.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ht(),this.targetWithTransforms=ht()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),k5(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Hn(this.target,this.layout.layoutBox),UO(this.target,this.targetDelta)):Hn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||ym(this.parent.latestValues)||jO(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,a,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Md(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Hn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ct.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Hn(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,p=this.treeScale.y;e5(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ht());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_C(this.prevProjectionDelta.x,this.projectionDelta.x),_C(this.prevProjectionDelta.y,this.projectionDelta.y)),pl(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==p||!IC(this.projectionDelta.x,this.prevProjectionDelta.x)||!IC(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ko(),this.projectionDelta=ko(),this.projectionDeltaWithTransform=ko()}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=ko();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const p=ht(),f=l?l.source:void 0,g=this.layout?this.layout.source:void 0,m=f!==g,_=this.getStack(),b=!_||_.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(t4));this.animationProgress=0;let S;this.mixTargetDelta=w=>{const k=w/1e3;BC(d.x,o.x,k),BC(d.y,o.y,k),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Md(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),e4(this.relativeTarget,this.relativeTargetOrigin,p,k),S&&R5(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=ht()),Hn(S,this.relativeTarget)),m&&(this.animationValues=u,O5(u,c,this.latestValues,k,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,c;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Pi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ie.update(()=>{ju.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ko(0)),this.motionValue.jump(0,!1),this.currentAnimation=M5(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},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(U5),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&iL(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ht();const d=Yt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+d;const p=Yt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}Hn(a,l),Fu(a,u),pl(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new j5),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&sf("z",o,c,this.animationValues);for(let u=0;u<rf.length;u++)sf(`rotate${rf[u]}`,o,c,this.animationValues),sf(`skew${rf[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Bu(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Bu(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!ss(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=N5(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),o.transform=d;const{x:p,y:f}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${f.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const g in _m){if(u[g]===void 0)continue;const{correct:m,applyTo:_,isCSSVariable:b}=_m[g],v=d==="none"?u[g]:m(u[g],c);if(_){const S=_.length;for(let w=0;w<S;w++)o[_[w]]=v}else b?this.options.visualElement.renderState.vars[g]=v:o[g]=v}this.options.layoutId&&(o.pointerEvents=c===this?Bu(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(MC),this.root.sharedNodes.clear()}}}function z5(e){e.updateLayout()}function H5(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,o=t.source!==e.layout.source;if(s==="size")hr(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=Yt(p);p.min=r[d].min,p.max=p.min+f});else if(s==="x"||s==="y"){const d=s==="x"?"y":"x";Sm(o?t.measuredBox[d]:t.layoutBox[d],r[d])}else iL(s,t.layoutBox,r)&&hr(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=Yt(r[d]);p.max=p.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+f)});const a=ko();pl(a,r,t.layoutBox);const l=ko();o?pl(l,e.applyTransform(i,!0),t.measuredBox):pl(l,r,t.layoutBox);const c=!QO(a);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:p,layout:f}=d;if(p&&f){const g=e.options.layoutAnchor||void 0,m=ht();Md(m,t.layoutBox,p.layoutBox,g);const _=ht();Md(_,r,f.layoutBox,g),JO(m,_)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=_,e.relativeTargetOrigin=m,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function V5(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function G5(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function W5(e){e.clearSnapshot()}function MC(e){e.clearMeasurements()}function q5(e){e.isLayoutDirty=!0,e.updateLayout()}function PC(e){e.isLayoutDirty=!1}function K5(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Y5(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function FC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function X5(e){e.resolveTargetDelta()}function Z5(e){e.calcProjection()}function Q5(e){e.resetSkewAndRotation()}function J5(e){e.removeLeadSnapshot()}function BC(e,t,n){e.translate=je(t.translate,0,n),e.scale=je(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function jC(e,t,n,r){e.min=je(t.min,n.min,r),e.max=je(t.max,n.max,r)}function e4(e,t,n,r){jC(e.x,t.x,n.x,r),jC(e.y,t.y,n.y,r)}function t4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const n4={duration:.45,ease:[.4,0,.1,1]},UC=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$C=UC("applewebkit/")&&!UC("chrome/")?Math.round:Pn;function zC(e){e.min=$C(e.min),e.max=$C(e.max)}function r4(e){zC(e.x),zC(e.y)}function iL(e,t,n){return e==="position"||e==="preserve-aspect"&&!E5(NC(t),NC(n),.2)}function i4(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const s4=rL({attachResizeListener:(e,t)=>Vl(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),of={current:void 0},sL=rL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!of.current){const e=new s4({});e.mount(window),e.setOptions({layoutScroll:!0}),of.current=e}return of.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),gv=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function HC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function o4(...e){return t=>{let n=!1;const r=e.map(i=>{const s=HC(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():HC(e[i],null)}}}}function a4(...e){return y.useCallback(o4(...e),e)}class l4 extends y.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Lu(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=Lu(r)&&r.offsetWidth||0,s=Lu(r)&&r.offsetHeight||0,o=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=i-a.width-a.left,a.bottom=s-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function c4({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:s}){var p;const o=y.useId(),a=y.useRef(null),l=y.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=y.useContext(gv),u=((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref),d=a4(a,u);return y.useInsertionEffect(()=>{const{width:f,height:g,top:m,left:_,right:b,bottom:v}=l.current;if(t||s===!1||!a.current||!f||!g)return;const S=n==="left"?`left: ${_}`:`right: ${b}`,w=r==="bottom"?`bottom: ${v}`:`top: ${m}`;a.current.dataset.motionPopId=o;const k=document.createElement("style");c&&(k.nonce=c);const x=i??document.head;return x.appendChild(k),k.sheet&&k.sheet.insertRule(`
|
|
68
|
+
*/const yU="6";try{window.__reactRouterVersion=yU}catch{}const vU="startTransition",jk=ch[vU];function _U(e){let{basename:t,children:n,future:r,window:i}=e,s=y.useRef();s.current==null&&(s.current=C3({window:i,v5Compat:!0}));let o=s.current,[a,l]=y.useState({action:o.action,location:o.location}),{v7_startTransition:c}=r||{},u=y.useCallback(d=>{c&&jk?jk(()=>l(d)):l(d)},[l,c]);return y.useLayoutEffect(()=>o.listen(u),[o,u]),y.useEffect(()=>gU(r),[r]),y.createElement(mU,{basename:t,children:n,location:a.location,navigationType:a.action,navigator:o,future:r})}var Uk;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Uk||(Uk={}));var $k;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})($k||($k={}));const Hy=y.createContext({});function Vy(e){const t=y.useRef(null);return t.current===null&&(t.current=e()),t.current}const SU=typeof window<"u",LI=SU?y.useLayoutEffect:y.useEffect,Ch=y.createContext(null);function Gy(e,t){e.indexOf(t)===-1&&e.push(t)}function Ad(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}const Cr=(e,t,n)=>n>t?t:n<e?e:n;let Wy=()=>{};const Mi={},DI=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function MI(e){return typeof e=="object"&&e!==null}const PI=e=>/^0[^.\s]+$/u.test(e);function FI(e){let t;return()=>(t===void 0&&(t=e()),t)}const Pn=e=>e,wU=(e,t)=>n=>t(e(n)),pc=(...e)=>e.reduce(wU),$l=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r};class qy{constructor(){this.subscriptions=[]}add(t){return Gy(this.subscriptions,t),()=>Ad(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let s=0;s<i;s++){const o=this.subscriptions[s];o&&o(t,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const vn=e=>e*1e3,Dn=e=>e/1e3;function BI(e,t){return t?e*(1e3/t):0}const jI=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,xU=1e-7,EU=12;function kU(e,t,n,r,i){let s,o,a=0;do o=t+(n-t)/2,s=jI(o,r,i)-e,s>0?n=o:t=o;while(Math.abs(s)>xU&&++a<EU);return o}function fc(e,t,n,r){if(e===t&&n===r)return Pn;const i=s=>kU(s,0,1,e,n);return s=>s===0||s===1?s:jI(i(s),t,r)}const UI=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,$I=e=>t=>1-e(1-t),zI=fc(.33,1.53,.69,.99),Ky=$I(zI),HI=UI(Ky),VI=e=>e>=1?1:(e*=2)<1?.5*Ky(e):.5*(2-Math.pow(2,-10*(e-1))),Yy=e=>1-Math.sin(Math.acos(e)),GI=$I(Yy),WI=UI(Yy),CU=fc(.42,0,1,1),TU=fc(0,0,.58,1),qI=fc(.42,0,.58,1),AU=e=>Array.isArray(e)&&typeof e[0]!="number",KI=e=>Array.isArray(e)&&typeof e[0]=="number",RU={linear:Pn,easeIn:CU,easeInOut:qI,easeOut:TU,circIn:Yy,circInOut:WI,circOut:GI,backIn:Ky,backInOut:HI,backOut:zI,anticipate:VI},NU=e=>typeof e=="string",zk=e=>{if(KI(e)){Wy(e.length===4);const[t,n,r,i]=e;return fc(t,n,r,i)}else if(NU(e))return RU[e];return e},Xc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function IU(e,t){let n=new Set,r=new Set,i=!1,s=!1;const o=new WeakSet;let a={delta:0,timestamp:0,isProcessing:!1};function l(u){o.has(u)&&(c.schedule(u),e()),u(a)}const c={schedule:(u,d=!1,p=!1)=>{const g=p&&i?n:r;return d&&o.add(u),g.add(u),u},cancel:u=>{r.delete(u),o.delete(u)},process:u=>{if(a=u,i){s=!0;return}i=!0;const d=n;n=r,r=d,n.forEach(l),n.clear(),i=!1,s&&(s=!1,c.process(u))}};return c}const OU=40;function YI(e,t){let n=!1,r=!0;const i={delta:0,timestamp:0,isProcessing:!1},s=()=>n=!0,o=Xc.reduce((S,w)=>(S[w]=IU(s),S),{}),{setup:a,read:l,resolveKeyframes:c,preUpdate:u,update:d,preRender:p,render:f,postRender:g}=o,m=()=>{const S=Mi.useManualTiming,w=S?i.timestamp:performance.now();n=!1,S||(i.delta=r?1e3/60:Math.max(Math.min(w-i.timestamp,OU),1)),i.timestamp=w,i.isProcessing=!0,a.process(i),l.process(i),c.process(i),u.process(i),d.process(i),p.process(i),f.process(i),g.process(i),i.isProcessing=!1,n&&t&&(r=!1,e(m))},_=()=>{n=!0,r=!0,i.isProcessing||e(m)};return{schedule:Xc.reduce((S,w)=>{const k=o[w];return S[w]=(x,E=!1,T=!1)=>(n||_(),k.schedule(x,E,T)),S},{}),cancel:S=>{for(let w=0;w<Xc.length;w++)o[Xc[w]].cancel(S)},state:i,steps:o}}const{schedule:Ie,cancel:Pi,state:Ct,steps:Yp}=YI(typeof requestAnimationFrame<"u"?requestAnimationFrame:Pn,!0);let Ou;function LU(){Ou=void 0}const Kt={now:()=>(Ou===void 0&&Kt.set(Ct.isProcessing||Mi.useManualTiming?Ct.timestamp:performance.now()),Ou),set:e=>{Ou=e,queueMicrotask(LU)}},XI=e=>t=>typeof t=="string"&&t.startsWith(e),ZI=XI("--"),DU=XI("var(--"),Xy=e=>DU(e)?MU.test(e.split("/*")[0].trim()):!1,MU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function Hk(e){return typeof e!="string"?!1:e.split("/*")[0].includes("var(--")}const oa={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},zl={...oa,transform:e=>Cr(0,1,e)},Zc={...oa,default:1},dl=e=>Math.round(e*1e5)/1e5,Zy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function PU(e){return e==null}const FU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qy=(e,t)=>n=>!!(typeof n=="string"&&FU.test(n)&&n.startsWith(e)||t&&!PU(n)&&Object.prototype.hasOwnProperty.call(n,t)),QI=(e,t,n)=>r=>{if(typeof r!="string")return r;const[i,s,o,a]=r.match(Zy);return{[e]:parseFloat(i),[t]:parseFloat(s),[n]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},BU=e=>Cr(0,255,e),Xp={...oa,transform:e=>Math.round(BU(e))},hs={test:Qy("rgb","red"),parse:QI("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+Xp.transform(e)+", "+Xp.transform(t)+", "+Xp.transform(n)+", "+dl(zl.transform(r))+")"};function jU(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const em={test:Qy("#"),parse:jU,transform:hs.transform},gc=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),ci=gc("deg"),wr=gc("%"),ee=gc("px"),UU=gc("vh"),$U=gc("vw"),Vk={...wr,parse:e=>wr.parse(e)/100,transform:e=>wr.transform(e*100)},xo={test:Qy("hsl","hue"),parse:QI("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+wr.transform(dl(t))+", "+wr.transform(dl(n))+", "+dl(zl.transform(r))+")"},st={test:e=>hs.test(e)||em.test(e)||xo.test(e),parse:e=>hs.test(e)?hs.parse(e):xo.test(e)?xo.parse(e):em.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?hs.transform(e):xo.transform(e),getAnimatableNone:e=>{const t=st.parse(e);return t.alpha=0,st.transform(t)}},zU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function HU(e){var t,n;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Zy))==null?void 0:t.length)||0)+(((n=e.match(zU))==null?void 0:n.length)||0)>0}const JI="number",eO="color",VU="var",GU="var(",Gk="${}",WU=/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 qo(e){const t=e.toString(),n=[],r={color:[],number:[],var:[]},i=[];let s=0;const a=t.replace(WU,l=>(st.test(l)?(r.color.push(s),i.push(eO),n.push(st.parse(l))):l.startsWith(GU)?(r.var.push(s),i.push(VU),n.push(l)):(r.number.push(s),i.push(JI),n.push(parseFloat(l))),++s,Gk)).split(Gk);return{values:n,split:a,indexes:r,types:i}}function qU(e){return qo(e).values}function tO({split:e,types:t}){const n=e.length;return r=>{let i="";for(let s=0;s<n;s++)if(i+=e[s],r[s]!==void 0){const o=t[s];o===JI?i+=dl(r[s]):o===eO?i+=st.transform(r[s]):i+=r[s]}return i}}function KU(e){return tO(qo(e))}const YU=e=>typeof e=="number"?0:st.test(e)?st.getAnimatableNone(e):e,XU=(e,t)=>typeof e=="number"?t!=null&&t.trim().endsWith("/")?e:0:YU(e);function ZU(e){const t=qo(e);return tO(t)(t.values.map((r,i)=>XU(r,t.split[i])))}const Qn={test:HU,parse:qU,createTransformer:KU,getAnimatableNone:ZU};function Zp(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function QU({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,s=0,o=0;if(!t)i=s=o=n;else{const a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;i=Zp(l,a,e+1/3),s=Zp(l,a,e),o=Zp(l,a,e-1/3)}return{red:Math.round(i*255),green:Math.round(s*255),blue:Math.round(o*255),alpha:r}}function Rd(e,t){return n=>n>0?t:e}const je=(e,t,n)=>e+(t-e)*n,Qp=(e,t,n)=>{const r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},JU=[em,hs,xo],e$=e=>JU.find(t=>t.test(e));function Wk(e){const t=e$(e);if(!t)return!1;let n=t.parse(e);return t===xo&&(n=QU(n)),n}const qk=(e,t)=>{const n=Wk(e),r=Wk(t);if(!n||!r)return Rd(e,t);const i={...n};return s=>(i.red=Qp(n.red,r.red,s),i.green=Qp(n.green,r.green,s),i.blue=Qp(n.blue,r.blue,s),i.alpha=je(n.alpha,r.alpha,s),hs.transform(i))},tm=new Set(["none","hidden"]);function t$(e,t){return tm.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}function n$(e,t){return n=>je(e,t,n)}function Jy(e){return typeof e=="number"?n$:typeof e=="string"?Xy(e)?Rd:st.test(e)?qk:s$:Array.isArray(e)?nO:typeof e=="object"?st.test(e)?qk:r$:Rd}function nO(e,t){const n=[...e],r=n.length,i=e.map((s,o)=>Jy(s)(s,t[o]));return s=>{for(let o=0;o<r;o++)n[o]=i[o](s);return n}}function r$(e,t){const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Jy(e[i])(e[i],t[i]));return i=>{for(const s in r)n[s]=r[s](i);return n}}function i$(e,t){const n=[],r={color:0,var:0,number:0};for(let i=0;i<t.values.length;i++){const s=t.types[i],o=e.indexes[s][r[s]],a=e.values[o]??0;n[i]=a,r[s]++}return n}const s$=(e,t)=>{const n=Qn.createTransformer(t),r=qo(e),i=qo(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?tm.has(e)&&!i.values.length||tm.has(t)&&!r.values.length?t$(e,t):pc(nO(i$(r,i),i.values),n):Rd(e,t)};function rO(e,t,n){return typeof e=="number"&&typeof t=="number"&&typeof n=="number"?je(e,t,n):Jy(e)(e,t)}const o$=e=>{const t=({timestamp:n})=>e(n);return{start:(n=!0)=>Ie.update(t,n),stop:()=>Pi(t),now:()=>Ct.isProcessing?Ct.timestamp:Kt.now()}},iO=(e,t,n=10)=>{let r="";const i=Math.max(Math.round(t/n),2);for(let s=0;s<i;s++)r+=Math.round(e(s/(i-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Nd=2e4;function ev(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t<Nd;)t+=n,r=e.next(t);return t>=Nd?1/0:t}function a$(e,t=100,n){const r=n({...e,keyframes:[0,t]}),i=Math.min(ev(r),Nd);return{type:"keyframes",ease:s=>r.next(i*s).value/t,duration:Dn(i)}}const Ze={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};function nm(e,t){return e*Math.sqrt(1-t*t)}const l$=12;function c$(e,t,n){let r=n;for(let i=1;i<l$;i++)r=r-e(r)/t(r);return r}const Jp=.001;function u$({duration:e=Ze.duration,bounce:t=Ze.bounce,velocity:n=Ze.velocity,mass:r=Ze.mass}){let i,s,o=1-t;o=Cr(Ze.minDamping,Ze.maxDamping,o),e=Cr(Ze.minDuration,Ze.maxDuration,Dn(e)),o<1?(i=c=>{const u=c*o,d=u*e,p=u-n,f=nm(c,o),g=Math.exp(-d);return Jp-p/f*g},s=c=>{const d=c*o*e,p=d*n+n,f=Math.pow(o,2)*Math.pow(c,2)*e,g=Math.exp(-d),m=nm(Math.pow(c,2),o);return(-i(c)+Jp>0?-1:1)*((p-f)*g)/m}):(i=c=>{const u=Math.exp(-c*e),d=(c-n)*e+1;return-Jp+u*d},s=c=>{const u=Math.exp(-c*e),d=(n-c)*(e*e);return u*d});const a=5/e,l=c$(i,s,a);if(e=vn(e),isNaN(l))return{stiffness:Ze.stiffness,damping:Ze.damping,duration:e};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:e}}}const d$=["duration","bounce"],h$=["stiffness","damping","mass"];function Kk(e,t){return t.some(n=>e[n]!==void 0)}function p$(e){let t={velocity:Ze.velocity,stiffness:Ze.stiffness,damping:Ze.damping,mass:Ze.mass,isResolvedFromDuration:!1,...e};if(!Kk(e,h$)&&Kk(e,d$))if(t.velocity=0,e.visualDuration){const n=e.visualDuration,r=2*Math.PI/(n*1.2),i=r*r,s=2*Cr(.05,1,1-(e.bounce||0))*Math.sqrt(i);t={...t,mass:Ze.mass,stiffness:i,damping:s}}else{const n=u$({...e,velocity:0});t={...t,...n,mass:Ze.mass},t.isResolvedFromDuration=!0}return t}function Id(e=Ze.visualDuration,t=Ze.bounce){const n=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:r,restDelta:i}=n;const s=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],a={done:!1,value:s},{stiffness:l,damping:c,mass:u,duration:d,velocity:p,isResolvedFromDuration:f}=p$({...n,velocity:-Dn(n.velocity||0)}),g=p||0,m=c/(2*Math.sqrt(l*u)),_=o-s,b=Dn(Math.sqrt(l/u)),v=Math.abs(_)<5;r||(r=v?Ze.restSpeed.granular:Ze.restSpeed.default),i||(i=v?Ze.restDelta.granular:Ze.restDelta.default);let S,w,k,x,E,T;if(m<1)k=nm(b,m),x=(g+m*b*_)/k,S=A=>{const R=Math.exp(-m*b*A);return o-R*(x*Math.sin(k*A)+_*Math.cos(k*A))},E=m*b*x+_*k,T=m*b*_-x*k,w=A=>Math.exp(-m*b*A)*(E*Math.sin(k*A)+T*Math.cos(k*A));else if(m===1){S=R=>o-Math.exp(-b*R)*(_+(g+b*_)*R);const A=g+b*_;w=R=>Math.exp(-b*R)*(b*A*R-g)}else{const A=b*Math.sqrt(m*m-1);S=P=>{const F=Math.exp(-m*b*P),B=Math.min(A*P,300);return o-F*((g+m*b*_)*Math.sinh(B)+A*_*Math.cosh(B))/A};const R=(g+m*b*_)/A,I=m*b*R-_*A,L=m*b*_-R*A;w=P=>{const F=Math.exp(-m*b*P),B=Math.min(A*P,300);return F*(I*Math.sinh(B)+L*Math.cosh(B))}}const D={calculatedDuration:f&&d||null,velocity:A=>vn(w(A)),next:A=>{if(!f&&m<1){const I=Math.exp(-m*b*A),L=Math.sin(k*A),P=Math.cos(k*A),F=o-I*(x*L+_*P),B=vn(I*(E*L+T*P));return a.done=Math.abs(B)<=r&&Math.abs(o-F)<=i,a.value=a.done?o:F,a}const R=S(A);if(f)a.done=A>=d;else{const I=vn(w(A));a.done=Math.abs(I)<=r&&Math.abs(o-R)<=i}return a.value=a.done?o:R,a},toString:()=>{const A=Math.min(ev(D),Nd),R=iO(I=>D.next(A*I).value,A,30);return A+"ms "+R},toTransition:()=>{}};return D}Id.applyToOptions=e=>{const t=a$(e,100,Id);return e.ease=t.ease,e.duration=vn(t.duration),e.type="keyframes",e};const f$=5;function sO(e,t,n){const r=Math.max(t-f$,0);return BI(n-e(r),t-r)}function rm({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const d=e[0],p={done:!1,value:d},f=T=>a!==void 0&&T<a||l!==void 0&&T>l,g=T=>a===void 0?l:l===void 0||Math.abs(a-T)<Math.abs(l-T)?a:l;let m=n*t;const _=d+m,b=o===void 0?_:o(_);b!==_&&(m=b-d);const v=T=>-m*Math.exp(-T/r),S=T=>b+v(T),w=T=>{const D=v(T),A=S(T);p.done=Math.abs(D)<=c,p.value=p.done?b:A};let k,x;const E=T=>{f(p.value)&&(k=T,x=Id({keyframes:[p.value,g(p.value)],velocity:sO(S,T,p.value),damping:i,stiffness:s,restDelta:c,restSpeed:u}))};return E(0),{calculatedDuration:null,next:T=>{let D=!1;return!x&&k===void 0&&(D=!0,w(T),E(T)),k!==void 0&&T>=k?x.next(T-k):(!D&&w(T),p)}}}function g$(e,t,n){const r=[],i=n||Mi.mix||rO,s=e.length-1;for(let o=0;o<s;o++){let a=i(e[o],e[o+1]);if(t){const l=Array.isArray(t)?t[o]||Pn:t;a=pc(l,a)}r.push(a)}return r}function m$(e,t,{clamp:n=!0,ease:r,mixer:i}={}){const s=e.length;if(Wy(s===t.length),s===1)return()=>t[0];if(s===2&&t[0]===t[1])return()=>t[1];const o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=g$(t,r,i),l=a.length,c=u=>{if(o&&u<e[0])return t[0];let d=0;if(l>1)for(;d<e.length-2&&!(u<e[d+1]);d++);const p=$l(e[d],e[d+1],u);return a[d](p)};return n?u=>c(Cr(e[0],e[s-1],u)):c}function b$(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=$l(0,t,r);e.push(je(n,1,i))}}function y$(e){const t=[0];return b$(t,e.length-1),t}function v$(e,t){return e.map(n=>n*t)}function _$(e,t){return e.map(()=>t||qI).splice(0,e.length-1)}function hl({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=AU(r)?r.map(zk):zk(r),s={done:!1,value:t[0]},o=v$(n&&n.length===t.length?n:y$(t),e),a=m$(o,t,{ease:Array.isArray(i)?i:_$(t,i)});return{calculatedDuration:e,next:l=>(s.value=a(l),s.done=l>=e,s)}}const S$=e=>e!==null;function Th(e,{repeat:t,repeatType:n="loop"},r,i=1){const s=e.filter(S$),a=i<0||t&&n!=="loop"&&t%2===1?0:s.length-1;return!a||r===void 0?s[a]:r}const w$={decay:rm,inertia:rm,tween:hl,keyframes:hl,spring:Id};function oO(e){typeof e.type=="string"&&(e.type=w$[e.type])}class tv{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,n){return this.finished.then(t,n)}}const x$=e=>e/100;class Od extends tv{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.delayState={done:!1,value:void 0},this.stop=()=>{var r,i;const{motionValue:n}=this.options;n&&n.updatedAt!==Kt.now()&&this.tick(Kt.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(i=(r=this.options).onStop)==null||i.call(r))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;oO(t);const{type:n=hl,repeat:r=0,repeatDelay:i=0,repeatType:s,velocity:o=0}=t;let{keyframes:a}=t;const l=n||hl;l!==hl&&typeof a[0]!="number"&&(this.mixKeyframes=pc(x$,rO(a[0],a[1])),a=[0,100]);const c=l({...t,keyframes:a});s==="mirror"&&(this.mirroredGenerator=l({...t,keyframes:[...a].reverse(),velocity:-o})),c.calculatedDuration===null&&(c.calculatedDuration=ev(c));const{calculatedDuration:u}=c;this.calculatedDuration=u,this.resolvedDuration=u+i,this.totalDuration=this.resolvedDuration*(r+1)-i,this.generator=c}updateTime(t){const n=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(t,n=!1){const{generator:r,totalDuration:i,mixKeyframes:s,mirroredGenerator:o,resolvedDuration:a,calculatedDuration:l}=this;if(this.startTime===null)return r.next(0);const{delay:c=0,keyframes:u,repeat:d,repeatType:p,repeatDelay:f,type:g,onUpdate:m,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-i/this.speed,this.startTime)),n?this.currentTime=t:this.updateTime(t);const b=this.currentTime-c*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?b<0:b>i;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=i);let S=this.currentTime,w=r;if(d){const T=Math.min(this.currentTime,i)/a;let D=Math.floor(T),A=T%1;!A&&T>=1&&(A=1),A===1&&D--,D=Math.min(D,d+1),!!(D%2)&&(p==="reverse"?(A=1-A,f&&(A-=f/a)):p==="mirror"&&(w=o)),S=Cr(0,1,A)*a}let k;v?(this.delayState.value=u[0],k=this.delayState):k=w.next(S),s&&!v&&(k.value=s(k.value));let{done:x}=k;!v&&l!==null&&(x=this.playbackSpeed>=0?this.currentTime>=i:this.currentTime<=0);const E=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&x);return E&&g!==rm&&(k.value=Th(u,this.options,_,this.speed)),m&&m(k.value),E&&this.finish(),k}then(t,n){return this.finished.then(t,n)}get duration(){return Dn(this.calculatedDuration)}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Dn(t)}get time(){return Dn(this.currentTime)}set time(t){t=vn(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?this.driver.start(!1):(this.startTime=0,this.state="paused",this.holdTime=t,this.tick(t))}getGeneratorVelocity(){const t=this.currentTime;if(t<=0)return this.options.velocity||0;if(this.generator.velocity)return this.generator.velocity(t);const n=this.generator.next(t).value;return sO(r=>this.generator.next(r).value,t,n)}get speed(){return this.playbackSpeed}set speed(t){const n=this.playbackSpeed!==t;n&&this.driver&&this.updateTime(Kt.now()),this.playbackSpeed=t,n&&this.driver&&(this.time=Dn(this.currentTime))}play(){var i,s;if(this.isStopped)return;const{driver:t=o$,startTime:n}=this.options;this.driver||(this.driver=t(o=>this.tick(o))),(s=(i=this.options).onPlay)==null||s.call(i);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),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(Kt.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(t=this.options).onComplete)==null||n.call(t)}cancel(){var t,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(t=this.options).onCancel)==null||n.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),t.observe(this)}}function E$(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const ps=e=>e*180/Math.PI,im=e=>{const t=ps(Math.atan2(e[1],e[0]));return sm(t)},k$={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:im,rotateZ:im,skewX:e=>ps(Math.atan(e[1])),skewY:e=>ps(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},sm=e=>(e=e%360,e<0&&(e+=360),e),Yk=im,Xk=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),Zk=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),C$={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Xk,scaleY:Zk,scale:e=>(Xk(e)+Zk(e))/2,rotateX:e=>sm(ps(Math.atan2(e[6],e[5]))),rotateY:e=>sm(ps(Math.atan2(-e[2],e[0]))),rotateZ:Yk,rotate:Yk,skewX:e=>ps(Math.atan(e[4])),skewY:e=>ps(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function om(e){return e.includes("scale")?1:0}function am(e,t){if(!e||e==="none")return om(t);const n=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,i;if(n)r=C$,i=n;else{const a=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=k$,i=a}if(!i)return om(t);const s=r[t],o=i[1].split(",").map(A$);return typeof s=="function"?s(o):o[s]}const T$=(e,t)=>{const{transform:n="none"}=getComputedStyle(e);return am(n,t)};function A$(e){return parseFloat(e.trim())}const aa=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],la=new Set(aa),Qk=e=>e===oa||e===ee,R$=new Set(["x","y","z"]),N$=aa.filter(e=>!R$.has(e));function I$(e){const t=[];return N$.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t}const _i={width:({x:e},{paddingLeft:t="0",paddingRight:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},height:({y:e},{paddingTop:t="0",paddingBottom:n="0",boxSizing:r})=>{const i=e.max-e.min;return r==="border-box"?i:i-parseFloat(t)-parseFloat(n)},top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>am(t,"x"),y:(e,{transform:t})=>am(t,"y")};_i.translateX=_i.x;_i.translateY=_i.y;const ys=new Set;let lm=!1,cm=!1,um=!1;function aO(){if(cm){const e=Array.from(ys).filter(r=>r.needsMeasurement),t=new Set(e.map(r=>r.element)),n=new Map;t.forEach(r=>{const i=I$(r);i.length&&(n.set(r,i),r.render())}),e.forEach(r=>r.measureInitialState()),t.forEach(r=>{r.render();const i=n.get(r);i&&i.forEach(([s,o])=>{var a;(a=r.getValue(s))==null||a.set(o)})}),e.forEach(r=>r.measureEndState()),e.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}cm=!1,lm=!1,ys.forEach(e=>e.complete(um)),ys.clear()}function lO(){ys.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(cm=!0)})}function O$(){um=!0,lO(),aO(),um=!1}class nv{constructor(t,n,r,i,s,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=n,this.name=r,this.motionValue=i,this.element=s,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(ys.add(this),lm||(lm=!0,Ie.read(lO),Ie.resolveKeyframes(aO))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:n,element:r,motionValue:i}=this;if(t[0]===null){const s=i==null?void 0:i.get(),o=t[t.length-1];if(s!==void 0)t[0]=s;else if(r&&n){const a=r.readValue(n,o);a!=null&&(t[0]=a)}t[0]===void 0&&(t[0]=o),i&&s===void 0&&i.set(t[0])}E$(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),ys.delete(this)}cancel(){this.state==="scheduled"&&(ys.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const L$=e=>e.startsWith("--");function cO(e,t,n){L$(t)?e.style.setProperty(t,n):e.style[t]=n}const D$={};function uO(e,t){const n=FI(e);return()=>D$[t]??n()}const M$=uO(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),dO=uO(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ya=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jk={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ya([0,.65,.55,1]),circOut:Ya([.55,0,1,.45]),backIn:Ya([.31,.01,.66,-.59]),backOut:Ya([.33,1.53,.69,.99])};function hO(e,t){if(e)return typeof e=="function"?dO()?iO(e,t):"ease-out":KI(e)?Ya(e):Array.isArray(e)?e.map(n=>hO(n,t)||Jk.easeOut):Jk[e]}function P$(e,t,n,{delay:r=0,duration:i=300,repeat:s=0,repeatType:o="loop",ease:a="easeOut",times:l}={},c=void 0){const u={[t]:n};l&&(u.offset=l);const d=hO(a,i);Array.isArray(d)&&(u.easing=d);const p={delay:r,duration:i,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:s+1,direction:o==="reverse"?"alternate":"normal"};return c&&(p.pseudoElement=c),e.animate(u,p)}function pO(e){return typeof e=="function"&&"applyToOptions"in e}function F$({type:e,...t}){return pO(e)&&dO()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class fO extends tv{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!t)return;const{element:n,name:r,keyframes:i,pseudoElement:s,allowFlatten:o=!1,finalKeyframe:a,onComplete:l}=t;this.isPseudoElement=!!s,this.allowFlatten=o,this.options=t,Wy(typeof t.type!="string");const c=F$(t);this.animation=P$(n,r,i,c,s),c.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){const u=Th(i,this.options,a,this.speed);this.updateMotionValue&&this.updateMotionValue(u),cO(n,r,u),this.animation.cancel()}l==null||l(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,n;(n=(t=this.animation).finish)==null||n.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,i;const t=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(t!=null&&t.isConnected)&&((i=(r=this.animation).commitStyles)==null||i.call(r))}get duration(){var n,r;const t=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Dn(Number(t))}get iterationDuration(){const{delay:t=0}=this.options||{};return this.duration+Dn(t)}get time(){return Dn(Number(this.animation.currentTime)||0)}set time(t){const n=this.finishedTime!==null;this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=vn(t),n&&this.animation.pause()}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(t){this.manualStartTime=this.animation.startTime=t}attachTimeline({timeline:t,rangeStart:n,rangeEnd:r,observe:i}){var s;return this.allowFlatten&&((s=this.animation.effect)==null||s.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&M$()?(this.animation.timeline=t,n&&(this.animation.rangeStart=n),r&&(this.animation.rangeEnd=r),Pn):i(this)}}const gO={anticipate:VI,backInOut:HI,circInOut:WI};function B$(e){return e in gO}function j$(e){typeof e.ease=="string"&&B$(e.ease)&&(e.ease=gO[e.ease])}const ef=10;class U$ extends fO{constructor(t){j$(t),oO(t),super(t),t.startTime!==void 0&&t.autoplay!==!1&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:n,onUpdate:r,onComplete:i,element:s,...o}=this.options;if(!n)return;if(t!==void 0){n.set(t);return}const a=new Od({...o,autoplay:!1}),l=Math.max(ef,Kt.now()-this.startTime),c=Cr(0,ef,l-ef),u=a.sample(l).value,{name:d}=this.options;s&&d&&cO(s,d,u),n.setWithVelocity(a.sample(Math.max(0,l-c)).value,u,c),a.stop()}}const eC=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Qn.test(e)||e==="0")&&!e.startsWith("url("));function $$(e){const t=e[0];if(e.length===1)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}function z$(e,t,n,r){const i=e[0];if(i===null)return!1;if(t==="display"||t==="visibility")return!0;const s=e[e.length-1],o=eC(i,t),a=eC(s,t);return!o||!a?!1:$$(e)||(n==="spring"||pO(n))&&r}function dm(e){e.duration=0,e.type="keyframes"}const mO=new Set(["opacity","clipPath","filter","transform"]),H$=/^(?:oklch|oklab|lab|lch|color|color-mix|light-dark)\(/;function V$(e){for(let t=0;t<e.length;t++)if(typeof e[t]=="string"&&H$.test(e[t]))return!0;return!1}const G$=new Set(["color","backgroundColor","outlineColor","fill","stroke","borderColor","borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"]),W$=FI(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function q$(e){var d;const{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:o,keyframes:a}=e;if(!(((d=t==null?void 0:t.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:u}=t.owner.getProps();return W$()&&n&&(mO.has(n)||G$.has(n)&&V$(a))&&(n!=="transform"||!u)&&!c&&!r&&i!=="mirror"&&s!==0&&o!=="inertia"}const K$=40;class Y$ extends tv{constructor({autoplay:t=!0,delay:n=0,type:r="keyframes",repeat:i=0,repeatDelay:s=0,repeatType:o="loop",keyframes:a,name:l,motionValue:c,element:u,...d}){var g;super(),this.stop=()=>{var m,_;this._animation&&(this._animation.stop(),(m=this.stopTimeline)==null||m.call(this)),(_=this.keyframeResolver)==null||_.cancel()},this.createdAt=Kt.now();const p={autoplay:t,delay:n,type:r,repeat:i,repeatDelay:s,repeatType:o,name:l,motionValue:c,element:u,...d},f=(u==null?void 0:u.KeyframeResolver)||nv;this.keyframeResolver=new f(a,(m,_,b)=>this.onKeyframesResolved(m,_,p,!b),l,c,u),(g=this.keyframeResolver)==null||g.scheduleResolve()}onKeyframesResolved(t,n,r,i){var b,v;this.keyframeResolver=void 0;const{name:s,type:o,velocity:a,delay:l,isHandoff:c,onUpdate:u}=r;this.resolvedAt=Kt.now();let d=!0;z$(t,s,o,a)||(d=!1,(Mi.instantAnimations||!l)&&(u==null||u(Th(t,r,n))),t[0]=t[t.length-1],dm(r),r.repeat=0);const f={startTime:i?this.resolvedAt?this.resolvedAt-this.createdAt>K$?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:t},g=d&&!c&&q$(f),m=(v=(b=f.motionValue)==null?void 0:b.owner)==null?void 0:v.current;let _;if(g)try{_=new U$({...f,element:m})}catch{_=new Od(f)}else _=new Od(f);_.finished.then(()=>{this.notifyFinished()}).catch(Pn),this.pendingTimeline&&(this.stopTimeline=_.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=_}get finished(){return this._animation?this.animation.finished:this._finished}then(t,n){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),O$()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}function bO(e,t,n,r=0,i=1){const s=Array.from(e).sort((c,u)=>c.sortNodePosition(u)).indexOf(t),o=e.size,a=(o-1)*r;return typeof n=="function"?n(s,o):i===1?s*r:a-s*r}const X$=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Z$(e){const t=X$.exec(e);if(!t)return[,];const[,n,r,i]=t;return[`--${n??r}`,i]}function yO(e,t,n=1){const[r,i]=Z$(e);if(!r)return;const s=window.getComputedStyle(t).getPropertyValue(r);if(s){const o=s.trim();return DI(o)?parseFloat(o):o}return Xy(i)?yO(i,t,n+1):i}const Q$={type:"spring",stiffness:500,damping:25,restSpeed:10},J$=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),ez={type:"keyframes",duration:.8},tz={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},nz=(e,{keyframes:t})=>t.length>2?ez:la.has(e)?e.startsWith("scale")?J$(t[1]):Q$:tz;function vO(e,t){if(e!=null&&e.inherit&&t){const{inherit:n,...r}=e;return{...t,...r}}return e}function rv(e,t){const n=(e==null?void 0:e[t])??(e==null?void 0:e.default)??e;return n!==e?vO(n,e):n}const rz=new Set(["when","delay","delayChildren","staggerChildren","staggerDirection","repeat","repeatType","repeatDelay","from","elapsed"]);function iz(e){for(const t in e)if(!rz.has(t))return!0;return!1}const iv=(e,t,n,r={},i,s)=>o=>{const a=rv(r,e)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-vn(l);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...a,delay:-c,onUpdate:p=>{t.set(p),a.onUpdate&&a.onUpdate(p)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:e,motionValue:t,element:s?void 0:i};iz(a)||Object.assign(u,nz(e,u)),u.duration&&(u.duration=vn(u.duration)),u.repeatDelay&&(u.repeatDelay=vn(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let d=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(dm(u),u.delay===0&&(d=!0)),(Mi.instantAnimations||Mi.skipAnimations||i!=null&&i.shouldSkipAnimations)&&(d=!0,dm(u),u.delay=0),u.allowFlatten=!a.type&&!a.ease,d&&!s&&t.get()!==void 0){const p=Th(u.keyframes,a);if(p!==void 0){Ie.update(()=>{u.onUpdate(p),u.onComplete()});return}}return a.isSync?new Od(u):new Y$(u)};function tC(e){const t=[{},{}];return e==null||e.values.forEach((n,r)=>{t[0][r]=n.get(),t[1][r]=n.getVelocity()}),t}function sv(e,t,n,r){if(typeof t=="function"){const[i,s]=tC(r);t=t(n!==void 0?n:e.custom,i,s)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[i,s]=tC(r);t=t(n!==void 0?n:e.custom,i,s)}return t}function vs(e,t,n){const r=e.getProps();return sv(r,t,n!==void 0?n:r.custom,e)}const _O=new Set(["width","height","top","left","right","bottom",...aa]),nC=30,sz=e=>!isNaN(parseFloat(e));class oz{constructor(t,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var s;const i=Kt.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((s=this.events.change)==null||s.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=n.owner}setCurrent(t){this.current=t,this.updatedAt=Kt.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=sz(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new qy);const r=this.events[t].add(n);return t==="change"?()=>{r(),Ie.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-r}jump(t,n=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Kt.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>nC)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,nC);return BI(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),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 t,n;(t=this.dependents)==null||t.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Ko(e,t){return new oz(e,t)}const hm=e=>Array.isArray(e);function az(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,Ko(n))}function lz(e){return hm(e)?e[e.length-1]||0:e}function cz(e,t){const n=vs(e,t);let{transitionEnd:r={},transition:i={},...s}=n||{};s={...s,...r};for(const o in s){const a=lz(s[o]);az(e,o,a)}}const Rt=e=>!!(e&&e.getVelocity);function uz(e){return!!(Rt(e)&&e.add)}function pm(e,t){const n=e.getValue("willChange");if(uz(n))return n.add(t);if(!n&&Mi.WillChange){const r=new Mi.WillChange("auto");e.addValue("willChange",r),r.add(t)}}function ov(e){return e.replace(/([A-Z])/g,t=>`-${t.toLowerCase()}`)}const dz="framerAppearId",SO="data-"+ov(dz);function wO(e){return e.props[SO]}function hz({protectedKeys:e,needsAnimating:t},n){const r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function xO(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:s,transitionEnd:o,...a}=t;const l=e.getDefaultTransition();s=s?vO(s,l):l;const c=s==null?void 0:s.reduceMotion;r&&(s=r);const u=[],d=i&&e.animationState&&e.animationState.getState()[i];for(const p in a){const f=e.getValue(p,e.latestValues[p]??null),g=a[p];if(g===void 0||d&&hz(d,p))continue;const m={delay:n,...rv(s||{},p)},_=f.get();if(_!==void 0&&!f.isAnimating()&&!Array.isArray(g)&&g===_&&!m.velocity){Ie.update(()=>f.set(g));continue}let b=!1;if(window.MotionHandoffAnimation){const w=wO(e);if(w){const k=window.MotionHandoffAnimation(w,p,Ie);k!==null&&(m.startTime=k,b=!0)}}pm(e,p);const v=c??e.shouldReduceMotion;f.start(iv(p,f,g,v&&_O.has(p)?{type:!1}:m,e,b));const S=f.animation;S&&u.push(S)}if(o){const p=()=>Ie.update(()=>{o&&cz(e,o)});u.length?Promise.all(u).then(p):p()}return u}function fm(e,t,n={}){var l;const r=vs(e,t,n.type==="exit"?(l=e.presenceContext)==null?void 0:l.custom:void 0);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const s=r?()=>Promise.all(xO(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:d,staggerDirection:p}=i;return pz(e,t,c,u,d,p,n)}:()=>Promise.resolve(),{when:a}=i;if(a){const[c,u]=a==="beforeChildren"?[s,o]:[o,s];return c().then(()=>u())}else return Promise.all([s(),o(n.delay)])}function pz(e,t,n=0,r=0,i=0,s=1,o){const a=[];for(const l of e.variantChildren)l.notify("AnimationStart",t),a.push(fm(l,t,{...o,delay:n+(typeof r=="function"?0:r)+bO(e.variantChildren,l,r,i,s)}).then(()=>l.notify("AnimationComplete",t)));return Promise.all(a)}function fz(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(s=>fm(e,s,n));r=Promise.all(i)}else if(typeof t=="string")r=fm(e,t,n);else{const i=typeof t=="function"?vs(e,t,n.custom):t;r=Promise.all(xO(e,i,n))}return r.then(()=>{e.notify("AnimationComplete",t)})}const gz={test:e=>e==="auto",parse:e=>e},EO=e=>t=>t.test(e),kO=[oa,ee,wr,ci,$U,UU,gz],rC=e=>kO.find(EO(e));function mz(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||PI(e):!0}const bz=new Set(["brightness","contrast","saturate","opacity"]);function yz(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(Zy)||[];if(!r)return e;const i=n.replace(r,"");let s=bz.has(t)?1:0;return r!==n&&(s*=100),t+"("+s+i+")"}const vz=/\b([a-z-]*)\(.*?\)/gu,gm={...Qn,getAnimatableNone:e=>{const t=e.match(vz);return t?t.map(yz).join(" "):e}},mm={...Qn,getAnimatableNone:e=>{const t=Qn.parse(e);return Qn.createTransformer(e)(t.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},iC={...oa,transform:Math.round},_z={rotate:ci,rotateX:ci,rotateY:ci,rotateZ:ci,scale:Zc,scaleX:Zc,scaleY:Zc,scaleZ:Zc,skew:ci,skewX:ci,skewY:ci,distance:ee,translateX:ee,translateY:ee,translateZ:ee,x:ee,y:ee,z:ee,perspective:ee,transformPerspective:ee,opacity:zl,originX:Vk,originY:Vk,originZ:ee},av={borderWidth:ee,borderTopWidth:ee,borderRightWidth:ee,borderBottomWidth:ee,borderLeftWidth:ee,borderRadius:ee,borderTopLeftRadius:ee,borderTopRightRadius:ee,borderBottomRightRadius:ee,borderBottomLeftRadius:ee,width:ee,maxWidth:ee,height:ee,maxHeight:ee,top:ee,right:ee,bottom:ee,left:ee,inset:ee,insetBlock:ee,insetBlockStart:ee,insetBlockEnd:ee,insetInline:ee,insetInlineStart:ee,insetInlineEnd:ee,padding:ee,paddingTop:ee,paddingRight:ee,paddingBottom:ee,paddingLeft:ee,paddingBlock:ee,paddingBlockStart:ee,paddingBlockEnd:ee,paddingInline:ee,paddingInlineStart:ee,paddingInlineEnd:ee,margin:ee,marginTop:ee,marginRight:ee,marginBottom:ee,marginLeft:ee,marginBlock:ee,marginBlockStart:ee,marginBlockEnd:ee,marginInline:ee,marginInlineStart:ee,marginInlineEnd:ee,fontSize:ee,backgroundPositionX:ee,backgroundPositionY:ee,..._z,zIndex:iC,fillOpacity:zl,strokeOpacity:zl,numOctaves:iC},Sz={...av,color:st,backgroundColor:st,outlineColor:st,fill:st,stroke:st,borderColor:st,borderTopColor:st,borderRightColor:st,borderBottomColor:st,borderLeftColor:st,filter:gm,WebkitFilter:gm,mask:mm,WebkitMask:mm},CO=e=>Sz[e],wz=new Set([gm,mm]);function TO(e,t){let n=CO(e);return wz.has(n)||(n=Qn),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const xz=new Set(["auto","none","0"]);function Ez(e,t,n){let r=0,i;for(;r<e.length&&!i;){const s=e[r];typeof s=="string"&&!xz.has(s)&&qo(s).values.length&&(i=e[r]),r++}if(i&&n)for(const s of t)e[s]=TO(n,i)}class kz extends nv{constructor(t,n,r,i,s){super(t,n,r,i,s,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let d=t[u];if(typeof d=="string"&&(d=d.trim(),Xy(d))){const p=yO(d,n.current);p!==void 0&&(t[u]=p),u===t.length-1&&(this.finalKeyframe=d)}}if(this.resolveNoneKeyframes(),!_O.has(r)||t.length!==2)return;const[i,s]=t,o=rC(i),a=rC(s),l=Hk(i),c=Hk(s);if(l!==c&&_i[r]){this.needsMeasurement=!0;return}if(o!==a)if(Qk(o)&&Qk(a))for(let u=0;u<t.length;u++){const d=t[u];typeof d=="string"&&(t[u]=parseFloat(d))}else _i[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:n}=this,r=[];for(let i=0;i<t.length;i++)(t[i]===null||mz(t[i]))&&r.push(i);r.length&&Ez(t,r,n)}measureInitialState(){const{element:t,unresolvedKeyframes:n,name:r}=this;if(!t||!t.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_i[r](t.measureViewportBox(),window.getComputedStyle(t.current)),n[0]=this.measuredOrigin;const i=n[n.length-1];i!==void 0&&t.getValue(r,i).jump(i,!1)}measureEndState(){var a;const{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;const i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);const s=r.length-1,o=r[s];r[s]=_i[n](t.measureViewportBox(),window.getComputedStyle(t.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(a=this.removedTransforms)!=null&&a.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function AO(e,t,n){if(e==null)return[];if(e instanceof EventTarget)return[e];if(typeof e=="string"){let r=document;const i=(n==null?void 0:n[e])??r.querySelectorAll(e);return i?Array.from(i):[]}return Array.from(e).filter(r=>r!=null)}const RO=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Lu(e){return MI(e)&&"offsetHeight"in e&&!("ownerSVGElement"in e)}const{schedule:lv}=YI(queueMicrotask,!1),Gn={x:!1,y:!1};function NO(){return Gn.x||Gn.y}function Cz(e){return e==="x"||e==="y"?Gn[e]?null:(Gn[e]=!0,()=>{Gn[e]=!1}):Gn.x||Gn.y?null:(Gn.x=Gn.y=!0,()=>{Gn.x=Gn.y=!1})}function IO(e,t){const n=AO(e),r=new AbortController,i={passive:!0,...t,signal:r.signal};return[n,i,()=>r.abort()]}function Tz(e){return!(e.pointerType==="touch"||NO())}function Az(e,t,n={}){const[r,i,s]=IO(e,n);return r.forEach(o=>{let a=!1,l=!1,c;const u=()=>{o.removeEventListener("pointerleave",g)},d=_=>{c&&(c(_),c=void 0),u()},p=_=>{a=!1,window.removeEventListener("pointerup",p),window.removeEventListener("pointercancel",p),l&&(l=!1,d(_))},f=()=>{a=!0,window.addEventListener("pointerup",p,i),window.addEventListener("pointercancel",p,i)},g=_=>{if(_.pointerType!=="touch"){if(a){l=!0;return}d(_)}},m=_=>{if(!Tz(_))return;l=!1;const b=t(o,_);typeof b=="function"&&(c=b,o.addEventListener("pointerleave",g,i))};o.addEventListener("pointerenter",m,i),o.addEventListener("pointerdown",f,i)}),s}const OO=(e,t)=>t?e===t?!0:OO(e,t.parentElement):!1,cv=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,Rz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Nz(e){return Rz.has(e.tagName)||e.isContentEditable===!0}const Iz=new Set(["INPUT","SELECT","TEXTAREA"]);function Oz(e){return Iz.has(e.tagName)||e.isContentEditable===!0}const Du=new WeakSet;function sC(e){return t=>{t.key==="Enter"&&e(t)}}function tf(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const Lz=(e,t)=>{const n=e.currentTarget;if(!n)return;const r=sC(()=>{if(Du.has(n))return;tf(n,"down");const i=sC(()=>{tf(n,"up")}),s=()=>tf(n,"cancel");n.addEventListener("keyup",i,t),n.addEventListener("blur",s,t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)};function oC(e){return cv(e)&&!NO()}const aC=new WeakSet;function Dz(e,t,n={}){const[r,i,s]=IO(e,n),o=a=>{const l=a.currentTarget;if(!oC(a)||aC.has(a))return;Du.add(l),n.stopPropagation&&aC.add(a);const c=t(l,a),u=(f,g)=>{window.removeEventListener("pointerup",d),window.removeEventListener("pointercancel",p),Du.has(l)&&Du.delete(l),oC(f)&&typeof c=="function"&&c(f,{success:g})},d=f=>{u(f,l===window||l===document||n.useGlobalTarget||OO(l,f.target))},p=f=>{u(f,!1)};window.addEventListener("pointerup",d,i),window.addEventListener("pointercancel",p,i)};return r.forEach(a=>{(n.useGlobalTarget?window:a).addEventListener("pointerdown",o,i),Lu(a)&&(a.addEventListener("focus",c=>Lz(c,i)),!Nz(a)&&!a.hasAttribute("tabindex")&&(a.tabIndex=0))}),s}function uv(e){return MI(e)&&"ownerSVGElement"in e}const Mu=new WeakMap;let ui;const LO=(e,t,n)=>(r,i)=>i&&i[0]?i[0][e+"Size"]:uv(r)&&"getBBox"in r?r.getBBox()[t]:r[n],Mz=LO("inline","width","offsetWidth"),Pz=LO("block","height","offsetHeight");function Fz({target:e,borderBoxSize:t}){var n;(n=Mu.get(e))==null||n.forEach(r=>{r(e,{get width(){return Mz(e,t)},get height(){return Pz(e,t)}})})}function Bz(e){e.forEach(Fz)}function jz(){typeof ResizeObserver>"u"||(ui=new ResizeObserver(Bz))}function Uz(e,t){ui||jz();const n=AO(e);return n.forEach(r=>{let i=Mu.get(r);i||(i=new Set,Mu.set(r,i)),i.add(t),ui==null||ui.observe(r)}),()=>{n.forEach(r=>{const i=Mu.get(r);i==null||i.delete(t),i!=null&&i.size||ui==null||ui.unobserve(r)})}}const Pu=new Set;let Eo;function $z(){Eo=()=>{const e={get width(){return window.innerWidth},get height(){return window.innerHeight}};Pu.forEach(t=>t(e))},window.addEventListener("resize",Eo)}function zz(e){return Pu.add(e),Eo||$z(),()=>{Pu.delete(e),!Pu.size&&typeof Eo=="function"&&(window.removeEventListener("resize",Eo),Eo=void 0)}}function lC(e,t){return typeof e=="function"?zz(e):Uz(e,t)}function Hz(e){return uv(e)&&e.tagName==="svg"}const Vz=[...kO,st,Qn],Gz=e=>Vz.find(EO(e)),cC=()=>({translate:0,scale:1,origin:0,originPoint:0}),ko=()=>({x:cC(),y:cC()}),uC=()=>({min:0,max:0}),ht=()=>({x:uC(),y:uC()}),Wz=new WeakMap;function Ah(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function Hl(e){return typeof e=="string"||Array.isArray(e)}const dv=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],hv=["initial",...dv];function Rh(e){return Ah(e.animate)||hv.some(t=>Hl(e[t]))}function DO(e){return!!(Rh(e)||e.variants)}function qz(e,t,n){for(const r in t){const i=t[r],s=n[r];if(Rt(i))e.addValue(r,i);else if(Rt(s))e.addValue(r,Ko(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){const o=e.getValue(r);o.liveStyle===!0?o.jump(i):o.hasAnimated||o.set(i)}else{const o=e.getStaticValue(r);e.addValue(r,Ko(o!==void 0?o:i,{owner:e}))}}for(const r in n)t[r]===void 0&&e.removeValue(r);return t}const bm={current:null},MO={current:!1},Kz=typeof window<"u";function Yz(){if(MO.current=!0,!!Kz)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>bm.current=e.matches;e.addEventListener("change",t),t()}else bm.current=!1}const dC=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Ld={};function PO(e){Ld=e}function Xz(){return Ld}class Zz{scrapeMotionValuesFromProps(t,n,r){return{}}constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,skipAnimations:s,blockInitialAnimation:o,visualState:a},l={}){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=nv,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 f=Kt.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Ie.render(this.render,!1,!0))};const{latestValues:c,renderState:u}=a;this.latestValues=c,this.baseTarget={...c},this.initialValues=n.initial?{...c}:{},this.renderState=u,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.skipAnimationsConfig=s,this.options=l,this.blockInitialAnimation=!!o,this.isControllingVariants=Rh(n),this.isVariantNode=DO(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...p}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in p){const g=p[f];c[f]!==void 0&&Rt(g)&&g.set(c[f])}}mount(t){var n,r;if(this.hasBeenMounted)for(const i in this.initialValues)(n=this.values.get(i))==null||n.jump(this.initialValues[i]),this.latestValues[i]=this.initialValues[i];this.current=t,Wz.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((i,s)=>this.bindToMotionValue(s,i)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(MO.current||Yz(),this.shouldReduceMotion=bm.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var t;this.projection&&this.projection.unmount(),Pi(this.notifyUpdate),Pi(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,n){if(this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)(),n.accelerate&&mO.has(t)&&this.current instanceof HTMLElement){const{factory:o,keyframes:a,times:l,ease:c,duration:u}=n.accelerate,d=new fO({element:this.current,name:t,keyframes:a,times:l,ease:c,duration:vn(u)}),p=o(d);this.valueSubscriptions.set(t,()=>{p(),d.cancel()});return}const r=la.has(t);r&&this.onBindTransform&&this.onBindTransform();const i=n.on("change",o=>{this.latestValues[t]=o,this.props.onUpdate&&Ie.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let s;typeof window<"u"&&window.MotionCheckAppearSync&&(s=window.MotionCheckAppearSync(this,t,n)),this.valueSubscriptions.set(t,()=>{i(),s&&s(),n.owner&&n.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in Ld){const n=Ld[t];if(!n)continue;const{isEnabled:r,Feature:i}=n;if(!this.features[t]&&i&&r(this.props)&&(this.features[t]=new i(this)),this.features[t]){const s=this.features[t];s.isMounted?s.update():(s.mount(),s.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ht()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<dC.length;r++){const i=dC[r];this.propEventSubscriptions[i]&&(this.propEventSubscriptions[i](),delete this.propEventSubscriptions[i]);const s="on"+i,o=t[s];o&&(this.propEventSubscriptions[i]=this.on(i,o))}this.prevMotionValues=qz(this,this.scrapeMotionValuesFromProps(t,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(t),()=>n.variantChildren.delete(t)}addValue(t,n){const r=this.values.get(t);n!==r&&(r&&this.removeValue(t),this.bindToMotionValue(t,n),this.values.set(t,n),this.latestValues[t]=n.get())}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=Ko(n===null?void 0:n,{owner:this}),this.addValue(t,r)),r}readValue(t,n){let r=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return r!=null&&(typeof r=="string"&&(DI(r)||PI(r))?r=parseFloat(r):!Gz(r)&&Qn.test(n)&&(r=TO(t,n)),this.setBaseTarget(t,Rt(r)?r.get():r)),Rt(r)?r.get():r}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var s;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=sv(this.props,n,(s=this.presenceContext)==null?void 0:s.custom);o&&(r=o[t])}if(n&&r!==void 0)return r;const i=this.getBaseTargetFromProps(this.props,t);return i!==void 0&&!Rt(i)?i:this.initialValues[t]!==void 0&&r===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new qy),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}scheduleRenderMicrotask(){lv.render(this.render)}}class FO extends Zz{constructor(){super(...arguments),this.KeyframeResolver=kz}sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){const r=t.style;return r?r[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;Rt(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Gi{constructor(t){this.isMounted=!1,this.node=t}update(){}}function BO({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Qz({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Jz(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function nf(e){return e===void 0||e===1}function ym({scale:e,scaleX:t,scaleY:n}){return!nf(e)||!nf(t)||!nf(n)}function ss(e){return ym(e)||jO(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function jO(e){return hC(e.x)||hC(e.y)}function hC(e){return e&&e!=="0%"}function Dd(e,t,n){const r=e-n,i=t*r;return n+i}function pC(e,t,n,r,i){return i!==void 0&&(e=Dd(e,i,r)),Dd(e,n,r)+t}function vm(e,t=0,n=1,r,i){e.min=pC(e.min,t,n,r,i),e.max=pC(e.max,t,n,r,i)}function UO(e,{x:t,y:n}){vm(e.x,t.translate,t.scale,t.originPoint),vm(e.y,n.translate,n.scale,n.originPoint)}const fC=.999999999999,gC=1.0000000000001;function e5(e,t,n,r=!1){var a;const i=n.length;if(!i)return;t.x=t.y=1;let s,o;for(let l=0;l<i;l++){s=n[l],o=s.projectionDelta;const{visualElement:c}=s.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&s.options.layoutScroll&&s.scroll&&s!==s.root&&(fr(e.x,-s.scroll.offset.x),fr(e.y,-s.scroll.offset.y)),o&&(t.x*=o.x.scale,t.y*=o.y.scale,UO(e,o)),r&&ss(s.latestValues)&&Fu(e,s.latestValues,(a=s.layout)==null?void 0:a.layoutBox))}t.x<gC&&t.x>fC&&(t.x=1),t.y<gC&&t.y>fC&&(t.y=1)}function fr(e,t){e.min+=t,e.max+=t}function mC(e,t,n,r,i=.5){const s=je(e.min,e.max,i);vm(e,t,n,s,r)}function bC(e,t){return typeof e=="string"?parseFloat(e)/100*(t.max-t.min):e}function Fu(e,t,n){const r=n??e;mC(e.x,bC(t.x,r.x),t.scaleX,t.scale,t.originX),mC(e.y,bC(t.y,r.y),t.scaleY,t.scale,t.originY)}function $O(e,t){return BO(Jz(e.getBoundingClientRect(),t))}function t5(e,t,n){const r=$O(e,n),{scroll:i}=t;return i&&(fr(r.x,i.offset.x),fr(r.y,i.offset.y)),r}const n5={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},r5=aa.length;function i5(e,t,n){let r="",i=!0;for(let s=0;s<r5;s++){const o=aa[s],a=e[o];if(a===void 0)continue;let l=!0;if(typeof a=="number")l=a===(o.startsWith("scale")?1:0);else{const c=parseFloat(a);l=o.startsWith("scale")?c===1:c===0}if(!l||n){const c=RO(a,av[o]);if(!l){i=!1;const u=n5[o]||o;r+=`${u}(${c}) `}n&&(t[o]=c)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}function pv(e,t,n){const{style:r,vars:i,transformOrigin:s}=e;let o=!1,a=!1;for(const l in t){const c=t[l];if(la.has(l)){o=!0;continue}else if(ZI(l)){i[l]=c;continue}else{const u=RO(c,av[l]);l.startsWith("origin")?(a=!0,s[l]=u):r[l]=u}}if(t.transform||(o||n?r.transform=i5(t,e.transform,n):r.transform&&(r.transform="none")),a){const{originX:l="50%",originY:c="50%",originZ:u=0}=s;r.transformOrigin=`${l} ${c} ${u}`}}function zO(e,{style:t,vars:n},r,i){const s=e.style;let o;for(o in t)s[o]=t[o];i==null||i.applyProjectionStyles(s,r);for(o in n)s.setProperty(o,n[o])}function yC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Da={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(ee.test(e))e=parseFloat(e);else return e;const n=yC(e,t.target.x),r=yC(e,t.target.y);return`${n}% ${r}%`}},s5={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=Qn.parse(e);if(i.length>5)return r;const s=Qn.createTransformer(e),o=typeof i[0]!="number"?1:0,a=n.x.scale*t.x,l=n.y.scale*t.y;i[0+o]/=a,i[1+o]/=l;const c=je(a,l,.5);return typeof i[2+o]=="number"&&(i[2+o]/=c),typeof i[3+o]=="number"&&(i[3+o]/=c),s(i)}},_m={borderRadius:{...Da,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Da,borderTopRightRadius:Da,borderBottomLeftRadius:Da,borderBottomRightRadius:Da,boxShadow:s5};function HO(e,{layout:t,layoutId:n}){return la.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!_m[e]||e==="opacity")}function fv(e,t,n){var o;const r=e.style,i=t==null?void 0:t.style,s={};if(!r)return s;for(const a in r)(Rt(r[a])||i&&Rt(i[a])||HO(a,e)||((o=n==null?void 0:n.getValue(a))==null?void 0:o.liveStyle)!==void 0)&&(s[a]=r[a]);return s}function o5(e){return window.getComputedStyle(e)}class a5 extends FO{constructor(){super(...arguments),this.type="html",this.renderInstance=zO}readValueFromInstance(t,n){var r;if(la.has(n))return(r=this.projection)!=null&&r.isProjecting?om(n):T$(t,n);{const i=o5(t),s=(ZI(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(t,{transformPagePoint:n}){return $O(t,n)}build(t,n,r){pv(t,n,r.transformTemplate)}scrapeMotionValuesFromProps(t,n,r){return fv(t,n,r)}}const l5={offset:"stroke-dashoffset",array:"stroke-dasharray"},c5={offset:"strokeDashoffset",array:"strokeDasharray"};function u5(e,t,n=1,r=0,i=!0){e.pathLength=1;const s=i?l5:c5;e[s.offset]=`${-r}`,e[s.array]=`${t} ${n}`}const d5=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function VO(e,{attrX:t,attrY:n,attrScale:r,pathLength:i,pathSpacing:s=1,pathOffset:o=0,...a},l,c,u){if(pv(e,a,c),l){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:d,style:p}=e;d.transform&&(p.transform=d.transform,delete d.transform),(p.transform||d.transformOrigin)&&(p.transformOrigin=d.transformOrigin??"50% 50%",delete d.transformOrigin),p.transform&&(p.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete d.transformBox);for(const f of d5)d[f]!==void 0&&(p[f]=d[f],delete d[f]);t!==void 0&&(d.x=t),n!==void 0&&(d.y=n),r!==void 0&&(d.scale=r),i!==void 0&&u5(d,i,s,o,!1)}const GO=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"]),WO=e=>typeof e=="string"&&e.toLowerCase()==="svg";function h5(e,t,n,r){zO(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(GO.has(i)?i:ov(i),t.attrs[i])}function qO(e,t,n){const r=fv(e,t,n);for(const i in e)if(Rt(e[i])||Rt(t[i])){const s=aa.indexOf(i)!==-1?"attr"+i.charAt(0).toUpperCase()+i.substring(1):i;r[s]=e[i]}return r}class p5 extends FO{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(la.has(n)){const r=CO(n);return r&&r.default||0}return n=GO.has(n)?n:ov(n),t.getAttribute(n)}scrapeMotionValuesFromProps(t,n,r){return qO(t,n,r)}build(t,n,r){VO(t,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(t,n,r,i){h5(t,n,r,i)}mount(t){this.isSVGTag=WO(t.tagName),super.mount(t)}}const f5=hv.length;function KO(e){if(!e)return;if(!e.isControllingVariants){const n=e.parent?KO(e.parent)||{}:{};return e.props.initial!==void 0&&(n.initial=e.props.initial),n}const t={};for(let n=0;n<f5;n++){const r=hv[n],i=e.props[r];(Hl(i)||i===!1)&&(t[r]=i)}return t}function YO(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}const g5=[...dv].reverse(),m5=dv.length;function b5(e){return t=>Promise.all(t.map(({animation:n,options:r})=>fz(e,n,r)))}function y5(e){let t=b5(e),n=vC(),r=!0,i=!1;const s=c=>(u,d)=>{var f;const p=vs(e,d,c==="exit"?(f=e.presenceContext)==null?void 0:f.custom:void 0);if(p){const{transition:g,transitionEnd:m,..._}=p;u={...u,..._,...m}}return u};function o(c){t=c(e)}function a(c){const{props:u}=e,d=KO(e.parent)||{},p=[],f=new Set;let g={},m=1/0;for(let b=0;b<m5;b++){const v=g5[b],S=n[v],w=u[v]!==void 0?u[v]:d[v],k=Hl(w),x=v===c?S.isActive:null;x===!1&&(m=b);let E=w===d[v]&&w!==u[v]&&k;if(E&&(r||i)&&e.manuallyAnimateOnMount&&(E=!1),S.protectedKeys={...g},!S.isActive&&x===null||!w&&!S.prevProp||Ah(w)||typeof w=="boolean")continue;if(v==="exit"&&S.isActive&&x!==!0){S.prevResolvedValues&&(g={...g,...S.prevResolvedValues});continue}const T=v5(S.prevProp,w);let D=T||v===c&&S.isActive&&!E&&k||b>m&&k,A=!1;const R=Array.isArray(w)?w:[w];let I=R.reduce(s(v),{});x===!1&&(I={});const{prevResolvedValues:L={}}=S,P={...L,...I},F=O=>{D=!0,f.has(O)&&(A=!0,f.delete(O)),S.needsAnimating[O]=!0;const j=e.getValue(O);j&&(j.liveStyle=!1)};for(const O in P){const j=I[O],C=L[O];if(g.hasOwnProperty(O))continue;let z=!1;hm(j)&&hm(C)?z=!YO(j,C):z=j!==C,z?j!=null?F(O):f.add(O):j!==void 0&&f.has(O)?F(O):S.protectedKeys[O]=!0}S.prevProp=w,S.prevResolvedValues=I,S.isActive&&(g={...g,...I}),(r||i)&&e.blockInitialAnimation&&(D=!1);const B=E&&T;D&&(!B||A)&&p.push(...R.map(O=>{const j={type:v};if(typeof O=="string"&&(r||i)&&!B&&e.manuallyAnimateOnMount&&e.parent){const{parent:C}=e,z=vs(C,O);if(C.enteringChildren&&z){const{delayChildren:Z}=z.transition||{};j.delay=bO(C.enteringChildren,e,Z)}}return{animation:O,options:j}}))}if(f.size){const b={};if(typeof u.initial!="boolean"){const v=vs(e,Array.isArray(u.initial)?u.initial[0]:u.initial);v&&v.transition&&(b.transition=v.transition)}f.forEach(v=>{const S=e.getBaseTarget(v),w=e.getValue(v);w&&(w.liveStyle=!0),b[v]=S??null}),p.push({animation:b})}let _=!!p.length;return r&&(u.initial===!1||u.initial===u.animate)&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,i=!1,_?t(p):Promise.resolve()}function l(c,u){var p;if(n[c].isActive===u)return Promise.resolve();(p=e.variantChildren)==null||p.forEach(f=>{var g;return(g=f.animationState)==null?void 0:g.setActive(c,u)}),n[c].isActive=u;const d=a(c);for(const f in n)n[f].protectedKeys={};return d}return{animateChanges:a,setActive:l,setAnimateFunction:o,getState:()=>n,reset:()=>{n=vC(),i=!0}}}function v5(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!YO(t,e):!1}function Qi(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function vC(){return{animate:Qi(!0),whileInView:Qi(),whileHover:Qi(),whileTap:Qi(),whileDrag:Qi(),whileFocus:Qi(),exit:Qi()}}function Sm(e,t){e.min=t.min,e.max=t.max}function Hn(e,t){Sm(e.x,t.x),Sm(e.y,t.y)}function _C(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}const XO=1e-4,_5=1-XO,S5=1+XO,ZO=.01,w5=0-ZO,x5=0+ZO;function Yt(e){return e.max-e.min}function E5(e,t,n){return Math.abs(e-t)<=n}function SC(e,t,n,r=.5){e.origin=r,e.originPoint=je(t.min,t.max,e.origin),e.scale=Yt(n)/Yt(t),e.translate=je(n.min,n.max,e.origin)-e.originPoint,(e.scale>=_5&&e.scale<=S5||isNaN(e.scale))&&(e.scale=1),(e.translate>=w5&&e.translate<=x5||isNaN(e.translate))&&(e.translate=0)}function pl(e,t,n,r){SC(e.x,t.x,n.x,r?r.originX:void 0),SC(e.y,t.y,n.y,r?r.originY:void 0)}function wC(e,t,n,r=0){const i=r?je(n.min,n.max,r):n.min;e.min=i+t.min,e.max=e.min+Yt(t)}function k5(e,t,n,r){wC(e.x,t.x,n.x,r==null?void 0:r.x),wC(e.y,t.y,n.y,r==null?void 0:r.y)}function xC(e,t,n,r=0){const i=r?je(n.min,n.max,r):n.min;e.min=t.min-i,e.max=e.min+Yt(t)}function Md(e,t,n,r){xC(e.x,t.x,n.x,r==null?void 0:r.x),xC(e.y,t.y,n.y,r==null?void 0:r.y)}function EC(e,t,n,r,i){return e-=t,e=Dd(e,1/n,r),i!==void 0&&(e=Dd(e,1/i,r)),e}function C5(e,t=0,n=1,r=.5,i,s=e,o=e){if(wr.test(t)&&(t=parseFloat(t),t=je(o.min,o.max,t/100)-o.min),typeof t!="number")return;let a=je(s.min,s.max,r);e===s&&(a-=t),e.min=EC(e.min,t,n,a,i),e.max=EC(e.max,t,n,a,i)}function kC(e,t,[n,r,i],s,o){C5(e,t[n],t[r],t[i],t.scale,s,o)}const T5=["x","scaleX","originX"],A5=["y","scaleY","originY"];function CC(e,t,n,r){kC(e.x,t,T5,n?n.x:void 0,r?r.x:void 0),kC(e.y,t,A5,n?n.y:void 0,r?r.y:void 0)}function TC(e){return e.translate===0&&e.scale===1}function QO(e){return TC(e.x)&&TC(e.y)}function AC(e,t){return e.min===t.min&&e.max===t.max}function R5(e,t){return AC(e.x,t.x)&&AC(e.y,t.y)}function RC(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function JO(e,t){return RC(e.x,t.x)&&RC(e.y,t.y)}function NC(e){return Yt(e.x)/Yt(e.y)}function IC(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}function hr(e){return[e("x"),e("y")]}function N5(e,t,n){let r="";const i=e.x.translate/t.x,s=e.y.translate/t.y,o=(n==null?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{transformPerspective:c,rotate:u,rotateX:d,rotateY:p,skewX:f,skewY:g}=n;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),d&&(r+=`rotateX(${d}deg) `),p&&(r+=`rotateY(${p}deg) `),f&&(r+=`skewX(${f}deg) `),g&&(r+=`skewY(${g}deg) `)}const a=e.x.scale*t.x,l=e.y.scale*t.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const eL=["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"],I5=eL.length,OC=e=>typeof e=="string"?parseFloat(e):e,LC=e=>typeof e=="number"||ee.test(e);function O5(e,t,n,r,i,s){i?(e.opacity=je(0,n.opacity??1,L5(r)),e.opacityExit=je(t.opacity??1,0,D5(r))):s&&(e.opacity=je(t.opacity??1,n.opacity??1,r));for(let o=0;o<I5;o++){const a=eL[o];let l=DC(t,a),c=DC(n,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||LC(l)===LC(c)?(e[a]=Math.max(je(OC(l),OC(c),r),0),(wr.test(c)||wr.test(l))&&(e[a]+="%")):e[a]=c}(t.rotate||n.rotate)&&(e.rotate=je(t.rotate||0,n.rotate||0,r))}function DC(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const L5=tL(0,.5,GI),D5=tL(.5,.95,Pn);function tL(e,t,n){return r=>r<e?0:r>t?1:n($l(e,t,r))}function M5(e,t,n){const r=Rt(e)?e:Ko(e);return r.start(iv("",r,t,n)),r.animation}function Vl(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const P5=(e,t)=>e.depth-t.depth;class F5{constructor(){this.children=[],this.isDirty=!1}add(t){Gy(this.children,t),this.isDirty=!0}remove(t){Ad(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(P5),this.isDirty=!1,this.children.forEach(t)}}function B5(e,t){const n=Kt.now(),r=({timestamp:i})=>{const s=i-n;s>=t&&(Pi(r),e(s-t))};return Ie.setup(r,!0),()=>Pi(r)}function Bu(e){return Rt(e)?e.get():e}class j5{constructor(){this.members=[]}add(t){Gy(this.members,t);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===t||r===this.lead||r===this.prevLead)continue;const i=r.instance;(!i||i.isConnected===!1)&&!r.snapshot&&(Ad(this.members,r),r.unmount())}t.scheduleRender()}remove(t){if(Ad(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){var n;for(let r=this.members.indexOf(t)-1;r>=0;r--){const i=this.members[r];if(i.isPresent!==!1&&((n=i.instance)==null?void 0:n.isConnected)!==!1)return this.promote(i),!0}return!1}promote(t,n){var i;const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.updateSnapshot(),t.scheduleRender();const{layoutDependency:s}=r.options,{layoutDependency:o}=t.options;(s===void 0||s!==o)&&(t.resumeFrom=r,n&&(r.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),(i=t.root)!=null&&i.isUpdating&&(t.isLayoutDirty=!0)),t.options.crossfade===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{var n,r,i,s,o;(r=(n=t.options).onExitComplete)==null||r.call(n),(o=(i=t.resumingFrom)==null?void 0:(s=i.options).onExitComplete)==null||o.call(s)})}scheduleRender(){this.members.forEach(t=>t.instance&&t.scheduleRender(!1))}removeLeadSnapshot(){var t;(t=this.lead)!=null&&t.snapshot&&(this.lead.snapshot=void 0)}}const ju={hasAnimatedSinceResize:!0,hasEverUpdated:!1},rf=["","X","Y","Z"],U5=1e3;let $5=0;function sf(e,t,n,r){const{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function nL(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const n=wO(t);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:i,layoutId:s}=e.options;window.MotionCancelOptimisedAnimation(n,"transform",Ie,!(i||s))}const{parent:r}=e;r&&!r.hasCheckedOptimisedAppear&&nL(r)}function rL({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(o={},a=t==null?void 0:t()){this.id=$5++,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(V5),this.nodes.forEach(X5),this.nodes.forEach(Z5),this.nodes.forEach(G5)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new F5)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new qy),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=uv(o)&&!Hz(o),this.instance=o;const{layoutId:a,layout:l,visualElement:c}=this.options;if(c&&!c.current&&c.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(l||a)&&(this.isLayoutDirty=!0),e){let u,d=0;const p=()=>this.root.updateBlockedByResize=!1;Ie.read(()=>{d=window.innerWidth}),e(o,()=>{const f=window.innerWidth;f!==d&&(d=f,this.root.updateBlockedByResize=!0,u&&u(),u=B5(p,250),ju.hasAnimatedSinceResize&&(ju.hasAnimatedSinceResize=!1,this.nodes.forEach(FC)))})}a&&this.root.registerSharedNode(a,this),this.options.animate!==!1&&c&&(a||l)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:d,hasRelativeLayoutChanged:p,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const g=this.options.transition||c.getDefaultTransition()||n4,{onLayoutAnimationStart:m,onLayoutAnimationComplete:_}=c.getProps(),b=!this.targetLayout||!JO(this.targetLayout,f),v=!d&&p;if(this.options.layoutRoot||this.resumeFrom||v||d&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const S={...rv(g,"layout"),onPlay:m,onComplete:_};(c.shouldReduceMotion||this.options.layoutRoot)&&(S.delay=0,S.type=!1),this.startAnimation(S),this.setAnimationOrigin(u,v)}else d||FC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}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(),Pi(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(Q5),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&&nL(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const d=this.path[u];d.shouldResetTransform=!0,(typeof d.latestValues.x=="string"||typeof d.latestValues.y=="string")&&(d.isLayoutDirty=!0),d.updateScroll("snapshot"),d.options.layoutRoot&&d.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){const l=this.updateBlockedByResize;this.unblockUpdate(),this.updateBlockedByResize=!1,this.clearAllSnapshots(),l&&this.nodes.forEach(q5),this.nodes.forEach(MC);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(PC);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(K5),this.nodes.forEach(Y5),this.nodes.forEach(z5),this.nodes.forEach(H5)):this.nodes.forEach(PC),this.clearAllSnapshots();const a=Kt.now();Ct.delta=Cr(0,1e3/60,a-Ct.timestamp),Ct.timestamp=a,Ct.isProcessing=!0,Yp.update.process(Ct),Yp.preRender.process(Ct),Yp.render.process(Ct),Ct.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,lv.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(W5),this.sharedNodes.forEach(J5)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Ie.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Ie.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Yt(this.snapshot.measuredBox.x)&&!Yt(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 l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected||(this.layoutCorrected=ht()),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&this.instance){const l=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:l,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:l}}}resetTransform(){if(!i)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!QO(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&this.instance&&(a||ss(this.latestValues)||u)&&(i(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),r4(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){var c;const{visualElement:o}=this.options;if(!o)return ht();const a=o.measureViewportBox();if(!(((c=this.scroll)==null?void 0:c.wasRoot)||this.path.some(i4))){const{scroll:u}=this.root;u&&(fr(a.x,u.offset.x),fr(a.y,u.offset.y))}return a}removeElementScroll(o){var l;const a=ht();if(Hn(a,o),(l=this.scroll)!=null&&l.wasRoot)return a;for(let c=0;c<this.path.length;c++){const u=this.path[c],{scroll:d,options:p}=u;u!==this.root&&d&&p.layoutScroll&&(d.wasRoot&&Hn(a,o),fr(a.x,d.offset.x),fr(a.y,d.offset.y))}return a}applyTransform(o,a=!1,l){var u,d;const c=l||ht();Hn(c,o);for(let p=0;p<this.path.length;p++){const f=this.path[p];!a&&f.options.layoutScroll&&f.scroll&&f!==f.root&&(fr(c.x,-f.scroll.offset.x),fr(c.y,-f.scroll.offset.y)),ss(f.latestValues)&&Fu(c,f.latestValues,(u=f.layout)==null?void 0:u.layoutBox)}return ss(this.latestValues)&&Fu(c,this.latestValues,(d=this.layout)==null?void 0:d.layoutBox),c}removeTransform(o){var l;const a=ht();Hn(a,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];if(!ss(u.latestValues))continue;let d;u.instance&&(ym(u.latestValues)&&u.updateSnapshot(),d=ht(),Hn(d,u.measurePageBox())),CC(a,u.latestValues,(l=u.snapshot)==null?void 0:l.layoutBox,d)}return ss(this.latestValues)&&CC(a,this.latestValues),a}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!==Ct.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var f;const a=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=a.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=a.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=a.isSharedProjectionDirty);const l=!!this.resumingFrom||this!==a;if(!(o||l&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:d}=this.options;if(!this.layout||!(u||d))return;this.resolvedRelativeTargetAt=Ct.timestamp;const p=this.getClosestProjectingParent();p&&this.linkedParentVersion!==p.layoutVersion&&!p.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(this.options.layoutAnchor!==!1&&p&&p.layout?this.createRelativeTarget(p,this.layout.layoutBox,p.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ht(),this.targetWithTransforms=ht()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),k5(this.target,this.relativeTarget,this.relativeParent.target,this.options.layoutAnchor||void 0)):this.targetDelta?(this.resumingFrom?this.applyTransform(this.layout.layoutBox,!1,this.target):Hn(this.target,this.layout.layoutBox),UO(this.target,this.targetDelta)):Hn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,this.options.layoutAnchor!==!1&&p&&!!p.resumingFrom==!!this.resumingFrom&&!p.options.layoutScroll&&p.target&&this.animationProgress!==1?this.createRelativeTarget(p,this.target,p.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||ym(this.parent.latestValues)||jO(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,a,l){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),Md(this.relativeTargetOrigin,a,l,this.options.layoutAnchor||void 0),Hn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var g;const o=this.getLead(),a=!!this.resumingFrom||this!==o;let l=!0;if((this.isProjectionDirty||(g=this.parent)!=null&&g.isProjectionDirty)&&(l=!1),a&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(l=!1),this.resolvedRelativeTargetAt===Ct.timestamp&&(l=!1),l)return;const{layout:c,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(c||u))return;Hn(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,p=this.treeScale.y;e5(this.layoutCorrected,this.treeScale,this.path,a),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=ht());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(_C(this.prevProjectionDelta.x,this.projectionDelta.x),_C(this.prevProjectionDelta.y,this.projectionDelta.y)),pl(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==d||this.treeScale.y!==p||!IC(this.projectionDelta.x,this.prevProjectionDelta.x)||!IC(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var a;if((a=this.options.visualElement)==null||a.scheduleRender(),o){const l=this.getStack();l&&l.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=ko(),this.projectionDelta=ko(),this.projectionDeltaWithTransform=ko()}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},d=ko();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const p=ht(),f=l?l.source:void 0,g=this.layout?this.layout.source:void 0,m=f!==g,_=this.getStack(),b=!_||_.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(t4));this.animationProgress=0;let S;this.mixTargetDelta=w=>{const k=w/1e3;BC(d.x,o.x,k),BC(d.y,o.y,k),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Md(p,this.layout.layoutBox,this.relativeParent.layout.layoutBox,this.options.layoutAnchor||void 0),e4(this.relativeTarget,this.relativeTargetOrigin,p,k),S&&R5(this.relativeTarget,S)&&(this.isProjectionDirty=!1),S||(S=ht()),Hn(S,this.relativeTarget)),m&&(this.animationValues=u,O5(u,c,this.latestValues,k,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=k},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var a,l,c;this.notifyListeners("animationStart"),(a=this.currentAnimation)==null||a.stop(),(c=(l=this.resumingFrom)==null?void 0:l.currentAnimation)==null||c.stop(),this.pendingAnimation&&(Pi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Ie.update(()=>{ju.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Ko(0)),this.motionValue.jump(0,!1),this.currentAnimation=M5(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},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(U5),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&iL(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||ht();const d=Yt(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+d;const p=Yt(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+p}Hn(a,l),Fu(a,u),pl(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new j5),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var a;const{layoutId:o}=this.options;return o?((a=this.getStack())==null?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:o}=this.options;return o?(a=this.getStack())==null?void 0:a.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&sf("z",o,c,this.animationValues);for(let u=0;u<rf.length;u++)sf(`rotate${rf[u]}`,o,c,this.animationValues),sf(`skew${rf[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}applyProjectionStyles(o,a){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const l=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=Bu(a==null?void 0:a.pointerEvents)||"",o.transform=l?l(this.latestValues,""):"none";return}const c=this.getLead();if(!this.projectionDelta||!this.layout||!c.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=Bu(a==null?void 0:a.pointerEvents)||""),this.hasProjected&&!ss(this.latestValues)&&(o.transform=l?l({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=c.animationValues||c.latestValues;this.applyTransformsToTarget();let d=N5(this.projectionDeltaWithTransform,this.treeScale,u);l&&(d=l(u,d)),o.transform=d;const{x:p,y:f}=this.projectionDelta;o.transformOrigin=`${p.origin*100}% ${f.origin*100}% 0`,c.animationValues?o.opacity=c===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=c===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const g in _m){if(u[g]===void 0)continue;const{correct:m,applyTo:_,isCSSVariable:b}=_m[g],v=d==="none"?u[g]:m(u[g],c);if(_){const S=_.length;for(let w=0;w<S;w++)o[_[w]]=v}else b?this.options.visualElement.renderState.vars[g]=v:o[g]=v}this.options.layoutId&&(o.pointerEvents=c===this?Bu(a==null?void 0:a.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)==null?void 0:a.stop()}),this.root.nodes.forEach(MC),this.root.sharedNodes.clear()}}}function z5(e){e.updateLayout()}function H5(e){var n;const t=((n=e.resumeFrom)==null?void 0:n.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:s}=e.options,o=t.source!==e.layout.source;if(s==="size")hr(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=Yt(p);p.min=r[d].min,p.max=p.min+f});else if(s==="x"||s==="y"){const d=s==="x"?"y":"x";Sm(o?t.measuredBox[d]:t.layoutBox[d],r[d])}else iL(s,t.layoutBox,r)&&hr(d=>{const p=o?t.measuredBox[d]:t.layoutBox[d],f=Yt(r[d]);p.max=p.min+f,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+f)});const a=ko();pl(a,r,t.layoutBox);const l=ko();o?pl(l,e.applyTransform(i,!0),t.measuredBox):pl(l,r,t.layoutBox);const c=!QO(a);let u=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:p,layout:f}=d;if(p&&f){const g=e.options.layoutAnchor||void 0,m=ht();Md(m,t.layoutBox,p.layoutBox,g);const _=ht();Md(_,r,f.layoutBox,g),JO(m,_)||(u=!0),d.options.layoutRoot&&(e.relativeTarget=_,e.relativeTargetOrigin=m,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeLayoutChanged:u})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function V5(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function G5(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function W5(e){e.clearSnapshot()}function MC(e){e.clearMeasurements()}function q5(e){e.isLayoutDirty=!0,e.updateLayout()}function PC(e){e.isLayoutDirty=!1}function K5(e){e.isAnimationBlocked&&e.layout&&!e.isLayoutDirty&&(e.snapshot=e.layout,e.isLayoutDirty=!0)}function Y5(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function FC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function X5(e){e.resolveTargetDelta()}function Z5(e){e.calcProjection()}function Q5(e){e.resetSkewAndRotation()}function J5(e){e.removeLeadSnapshot()}function BC(e,t,n){e.translate=je(t.translate,0,n),e.scale=je(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function jC(e,t,n,r){e.min=je(t.min,n.min,r),e.max=je(t.max,n.max,r)}function e4(e,t,n,r){jC(e.x,t.x,n.x,r),jC(e.y,t.y,n.y,r)}function t4(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const n4={duration:.45,ease:[.4,0,.1,1]},UC=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),$C=UC("applewebkit/")&&!UC("chrome/")?Math.round:Pn;function zC(e){e.min=$C(e.min),e.max=$C(e.max)}function r4(e){zC(e.x),zC(e.y)}function iL(e,t,n){return e==="position"||e==="preserve-aspect"&&!E5(NC(t),NC(n),.2)}function i4(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const s4=rL({attachResizeListener:(e,t)=>Vl(e,"resize",t),measureScroll:()=>{var e,t;return{x:document.documentElement.scrollLeft||((e=document.body)==null?void 0:e.scrollLeft)||0,y:document.documentElement.scrollTop||((t=document.body)==null?void 0:t.scrollTop)||0}},checkIsScrollRoot:()=>!0}),of={current:void 0},sL=rL({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!of.current){const e=new s4({});e.mount(window),e.setOptions({layoutScroll:!0}),of.current=e}return of.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),gv=y.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function HC(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function o4(...e){return t=>{let n=!1;const r=e.map(i=>{const s=HC(i,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let i=0;i<r.length;i++){const s=r[i];typeof s=="function"?s():HC(e[i],null)}}}}function a4(...e){return y.useCallback(o4(...e),e)}class l4 extends y.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(Lu(n)&&t.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,i=Lu(r)&&r.offsetWidth||0,s=Lu(r)&&r.offsetHeight||0,o=getComputedStyle(n),a=this.props.sizeRef.current;a.height=parseFloat(o.height),a.width=parseFloat(o.width),a.top=n.offsetTop,a.left=n.offsetLeft,a.right=i-a.width-a.left,a.bottom=s-a.height-a.top}return null}componentDidUpdate(){}render(){return this.props.children}}function c4({children:e,isPresent:t,anchorX:n,anchorY:r,root:i,pop:s}){var p;const o=y.useId(),a=y.useRef(null),l=y.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:c}=y.useContext(gv),u=((p=e.props)==null?void 0:p.ref)??(e==null?void 0:e.ref),d=a4(a,u);return y.useInsertionEffect(()=>{const{width:f,height:g,top:m,left:_,right:b,bottom:v}=l.current;if(t||s===!1||!a.current||!f||!g)return;const S=n==="left"?`left: ${_}`:`right: ${b}`,w=r==="bottom"?`bottom: ${v}`:`top: ${m}`;a.current.dataset.motionPopId=o;const k=document.createElement("style");c&&(k.nonce=c);const x=i??document.head;return x.appendChild(k),k.sheet&&k.sheet.insertRule(`
|
|
69
69
|
[data-motion-pop-id="${o}"] {
|
|
70
70
|
position: absolute !important;
|
|
71
71
|
width: ${f}px !important;
|
|
@@ -447,7 +447,7 @@ Error generating stack: `+s.message+`
|
|
|
447
447
|
|
|
448
448
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
449
449
|
|
|
450
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uW="DialogDescriptionWarning",dW=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mD(uW).contentName}}.`;return y.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},hW=rD,pW=oD,bD=aD,yD=lD,vD=uD,_D=hD,fW=fD;const ua=hW,gW=pW,SD=y.forwardRef(({className:e,...t},n)=>h.jsx(bD,{ref:n,className:X("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));SD.displayName=bD.displayName;const Hs=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(gW,{children:[h.jsx(SD,{}),h.jsxs(yD,{ref:r,className:X("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,h.jsxs(fW,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx($s,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hs.displayName=yD.displayName;const Vs=({className:e,...t})=>h.jsx("div",{className:X("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Vs.displayName="DialogHeader";const Gs=({className:e,...t})=>h.jsx("div",{className:X("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Gs.displayName="DialogFooter";const Ws=y.forwardRef(({className:e,...t},n)=>h.jsx(vD,{ref:n,className:X("text-lg font-semibold leading-none tracking-tight",e),...t}));Ws.displayName=vD.displayName;const qs=y.forwardRef(({className:e,...t},n)=>h.jsx(_D,{ref:n,className:X("text-sm text-muted-foreground",e),...t}));qs.displayName=_D.displayName;function mW({project:e,open:t,onOpenChange:n,onUpdated:r}){const[i,s]=y.useState([]),[o,a]=y.useState([]),[l,c]=y.useState(!1),[u,d]=y.useState(null);y.useEffect(()=>{if(!t)return;s(e.shares?[...e.shares]:[]),d(null);let v=!1;return d6().then(S=>{v||a(S)}).catch(()=>{}),()=>{v=!0}},[t,e.id]);const p=new Set(i.map(v=>v.username)),f=o.filter(v=>v!==e.owner&&!p.has(v)),g=v=>{s(S=>[...S,{username:v,permission:"view"}])},m=v=>{s(S=>S.filter(w=>w.username!==v))},_=v=>{s(S=>S.map(w=>w.username===v?{...w,permission:w.permission==="view"?"edit":"view"}:w))},b=async()=>{c(!0),d(null);try{const v=await h6(e.id,i);r(v),n(!1)}catch(v){d(v instanceof Error?v.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(ua,{open:t,onOpenChange:n,children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsxs(Ws,{className:"flex items-center gap-2",children:[h.jsx(Om,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(qs,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[i.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),i.map(v=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:v.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>_(v.username),className:"focus:outline-none",children:h.jsx(gr,{variant:v.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:v.permission==="edit"?"可编辑":"可见"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>m(v.username),children:h.jsx(Ev,{className:"h-3.5 w-3.5"})})]})]},v.username))]}),f.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(v=>h.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>g(v),children:[h.jsx(Yo,{className:"h-3 w-3"}),v]},v))})]}),u&&h.jsx("p",{className:"text-sm text-destructive",children:u}),h.jsxs(Gs,{children:[h.jsx(ne,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ne,{onClick:()=>void b(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function bW(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function yW({status:e}){return h.jsx("span",{className:X("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}function A1({project:e,active:t=!1,statusStack:n=[],onDelete:r,onArchive:i,onUnarchive:s,onUpdated:o}){const a=js(),[l,c]=y.useState(!1),u=!!e._sharedPermission,d=e._sharedPermission==="view",p=b=>{b.stopPropagation(),confirm(`Delete project "${e.name}"? This cannot be undone.`)&&r(e.id)},f=b=>{b.stopPropagation(),i(e.id)},g=b=>{b.stopPropagation(),s(e.id)},m=h.jsx(Ke.div,{whileHover:!e.archived&&!t?{y:-2}:{},transition:{duration:.2},children:h.jsxs(Ih,{className:X("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":t?"border-transparent hover:border-transparent":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!e.archived&&a(`/projects/${e.id}`),children:[h.jsxs(Oh,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(Lh,{className:X("text-base leading-tight",e.archived&&"text-muted-foreground"),children:e.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[e.archived?h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:g,title:"Restore project",children:h.jsx(Q6,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:b=>{b.stopPropagation(),c(!0)},title:"共享设置",children:h.jsx(Om,{className:"h-3.5 w-3.5"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:f,title:"Archive project",children:h.jsx(J6,{className:"h-3.5 w-3.5"})})]}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:p,title:"Delete project",children:h.jsx(Ev,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?h.jsx(gr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(yW,{status:e.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&h.jsx("div",{className:"ml-auto relative h-5 flex items-end overflow-hidden",children:h.jsx(Jn,{initial:!1,children:n.map((b,v)=>{const S=n.length-1-v;return h.jsx(Ke.div,{initial:{opacity:0,y:14,scale:.9},animate:{opacity:S===0?1:S===1?.45:.2,y:-(S*18),scale:1},exit:{opacity:0,y:-20},transition:{duration:.35,ease:"easeOut"},className:"absolute right-0",children:h.jsx(gr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:bW(b.phase,b.detail)})},b.id)})})})]})})]}),h.jsxs(Dh,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Wl,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:e.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gr,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),h.jsx(gr,{variant:e.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:e.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(gr,{variant:"outline",className:"text-xs gap-0.5",children:[d?h.jsx(UL,{className:"h-3 w-3"}):h.jsx(Fh,{className:"h-3 w-3"}),d?"可见":"可编辑"]}),!u&&e.shares&&e.shares.length>0&&h.jsxs(gr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(Om,{className:"h-3 w-3"}),e.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]})]})]})}),_=t&&!e.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:m}):m;return h.jsxs(h.Fragment,{children:[_,!u&&o&&h.jsx(mW,{project:e,open:l,onOpenChange:c,onUpdated:o})]})}function wD({onSelect:e}){const[t,n]=y.useState(""),[r,i]=y.useState(null),[s,o]=y.useState([]),[a,l]=y.useState(!0),[c,u]=y.useState(null),[d,p]=y.useState(!1),[f,g]=y.useState(""),[m,_]=y.useState(null),[b,v]=y.useState(!1),S=y.useRef(null),w=async R=>{l(!0),u(null);try{const I=await PL(R);n(I.path),i(I.parent),o(I.entries)}catch(I){u(I instanceof Error?I.message:"Failed to load directory")}finally{l(!1)}};y.useEffect(()=>{w()},[]),y.useEffect(()=>{d&&setTimeout(()=>{var R;return(R=S.current)==null?void 0:R.focus()},0)},[d]);const k=()=>{g(""),_(null),p(!0)},x=()=>{p(!1),g(""),_(null)},E=async()=>{const R=f.trim();if(R){v(!0),_(null);try{const{path:I}=await D6(t,R);p(!1),g(""),await w(t),w(I)}catch(I){_(I instanceof Error?I.message:"Failed to create folder")}finally{v(!1)}}},T=R=>{R.key==="Enter"?(R.preventDefault(),E()):R.key==="Escape"&&x()},D=t.split("/").filter(Boolean),A=R=>{const I="/"+D.slice(0,R+1).join("/");w(I)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void w(),title:"Home",children:h.jsx(aV,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:D.map((R,I)=>h.jsxs(wt.Fragment,{children:[h.jsx(Ph,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>A(I),children:R})]},I))}),h.jsxs(ne,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:k,disabled:d||a||!!c,title:"New folder",children:[h.jsx(oV,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void w(r),children:[h.jsx(Gl,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),d&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(Rm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:S,className:X("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:f,onChange:R=>{g(R.target.value),_(null)},onKeyDown:T,disabled:b}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void E(),disabled:!f.trim()||b,title:"Create",children:h.jsx(jL,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:x,disabled:b,title:"Cancel",children:h.jsx($s,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),s.length===0&&!d&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),s.map(R=>h.jsxs("button",{className:X("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",R.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{R.type==="dir"&&w(R.path)},disabled:R.type==="file",children:[R.type==="dir"?h.jsx(Rm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(sV,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:R.name})]},R.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ne,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const vW=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"}],R1={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function _W({open:e,onOpenChange:t,onCreated:n}){const[r,i]=y.useState("name"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,u]=y.useState("claude"),[d,p]=y.useState("limited"),[f,g]=y.useState(!1),[m,_]=y.useState(null),b=()=>{i("name"),o(""),l(""),u("claude"),p("limited"),_(null),g(!1)},v=T=>{T||b(),t(T)},S=()=>{if(!s.trim()){_("Please enter a project name");return}_(null),i("folder")},w=T=>{l(T),i("settings")},k=async()=>{g(!0),_(null);try{const T=await p6({name:s.trim(),folderPath:a,permissionMode:d,cliTool:c});n(T),v(!1)}catch(T){_(T instanceof Error?T.message:"Failed to create project")}finally{g(!1)}},x={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},E=["name","folder","settings"];return h.jsx(ua,{open:e,onOpenChange:v,children:h.jsxs(Hs,{className:"sm:max-w-lg",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:x[r]}),h.jsxs(qs,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:E.map((T,D)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===T?"bg-primary":E.indexOf(r)>D?"bg-primary/40":"bg-muted"}`},T))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"project-name",children:"Project Name"}),h.jsx(Fn,{id:"project-name",placeholder:"My Project",value:s,onChange:T=>o(T.target.value),onKeyDown:T=>{T.key==="Enter"&&S()},autoFocus:!0})]}),m&&h.jsx("p",{className:"text-sm text-destructive",children:m})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Working Directory"}),h.jsx(wD,{onSelect:w})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:vW.map(T=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===T.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:T.value,checked:c===T.value,onChange:()=>u(T.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:T.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:T.desc})]})]},T.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:d==="limited",onChange:()=>p("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:R1[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:d==="unlimited",onChange:()=>p("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:R1[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),m&&h.jsx("p",{className:"text-sm text-destructive",children:m})]}),h.jsxs(Gs,{children:[r!=="name"&&h.jsx(ne,{variant:"outline",onClick:()=>i(r==="settings"?"folder":"name"),disabled:f,children:"Back"}),r==="name"&&h.jsx(ne,{onClick:S,children:"Next"}),r==="folder"&&h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ne,{onClick:()=>void k(),disabled:f,children:f?"Creating...":"Create Project"})]})]})})}function SW({open:e,onOpenChange:t,onOpened:n}){const[r,i]=y.useState(""),[s,o]=y.useState(!1),[a,l]=y.useState(null),c=()=>{i(""),l(null),o(!1)},u=p=>{p||c(),t(p)},d=async p=>{i(p),o(!0),l(null);try{const f=await f6(p);n(f),u(!1)}catch(f){l(f instanceof Error?f.message:"Failed to open project"),o(!1)}};return h.jsx(ua,{open:e,onOpenChange:u,children:h.jsxs(Hs,{className:"sm:max-w-lg",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:"Open Existing Project"}),h.jsxs(qs,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Project Folder"}),h.jsx(wD,{onSelect:p=>void d(p)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&s&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(Gs,{children:h.jsx(ne,{variant:"outline",onClick:()=>u(!1),disabled:s,children:"Cancel"})})]})})}function wW(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const N1=5*36e5;function xW(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=N1-t;return n<=0?null:Math.round(e.utilization/(n/N1))}function ou({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",i=wW(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:X("font-medium",r),children:[n,"%"]}),i&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",i,")"]})]})}function xD({className:e}){const[t,n]=y.useState("loading"),[r,i]=y.useState(!1);y.useEffect(()=>{const p=async()=>{try{n(await I6())}catch{n(null)}};p();const f=setInterval(()=>void p(),5*60*1e3);return()=>clearInterval(f)},[]);const s=async()=>{i(!0);try{n(await O6())}catch{n(null)}finally{i(!1)}};if(t==="loading"||!t)return null;const o=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,u=o||a||l||c,d=xW(t.fiveHour);return h.jsxs("div",{className:X("flex items-center gap-1.5 text-xs",e),children:[d!==null&&h.jsxs("span",{className:X("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),u&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(ou,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void s(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx(As,{className:X("h-3 w-3",r&&"animate-spin")})})]})}function EW(){const[e,t]=y.useState([]),[n,r]=y.useState(!1),[i,s]=y.useState(""),[o,a]=y.useState(""),[l,c]=y.useState(""),[u,d]=y.useState(null),[p,f]=y.useState(""),[g,m]=y.useState(""),[_,b]=y.useState(""),v=y.useRef(null),S=y.useRef(null);y.useEffect(()=>{ML().then(t).catch(()=>t([]))},[]),y.useEffect(()=>{n&&setTimeout(()=>{var E;return(E=v.current)==null?void 0:E.focus()},0)},[n]),y.useEffect(()=>{u&&setTimeout(()=>{var E;return(E=S.current)==null?void 0:E.focus()},0)},[u]);const w=async()=>{const E=o.trim();if(E)try{const T=await S6({label:i.trim()||E,command:E,...l?{parentId:l}:{}});t(D=>[...D,T]),s(""),a(""),c(""),r(!1)}catch(T){console.error("[GlobalShortcuts] Failed to add:",T)}},k=async E=>{try{await x6(E),t(T=>T.filter(D=>D.id!==E)),u===E&&d(null)}catch(T){console.error("[GlobalShortcuts] Failed to delete:",T)}},x=async()=>{const E=g.trim();if(!(!E||!u))try{const T=await w6(u,{label:p.trim()||E,command:E,parentId:_||null});t(D=>D.map(A=>A.id===u?T:A)),d(null)}catch(T){console.error("[GlobalShortcuts] Failed to save:",T)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(jd,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(E=>!E),d(null)},className:X("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(Yo,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:v,placeholder:"名称(可选)",value:i,onChange:E=>s(E.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:o,onChange:E=>a(E.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w()),E.key==="Escape"&&(r(!1),s(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:E=>c(E.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(E=>h.jsx("option",{value:E.id,children:E.label},E.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),s(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void w(),disabled:!o.trim(),className:X("text-sm px-3 py-1 rounded transition-colors text-white",o.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(jd,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(E=>u===E.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:S,value:p,onChange:T=>f(T.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:g,onChange:T=>m(T.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),x()),T.key==="Escape"&&d(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:_,onChange:T=>b(T.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(T=>T.id!==E.id).map(T=>h.jsx("option",{value:T.id,children:T.label},T.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void x(),disabled:!g.trim(),className:X("text-xs px-2.5 py-1 rounded transition-colors text-white",g.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},E.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:E.label}),E.parentId&&(()=>{const T=e.find(D=>D.id===E.parentId);return T?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(gl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T.label]})]}):null})(),!E.parentId&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:E.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{d(E.id),f(E.label),m(E.command),b(E.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Fh,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void k(E.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx($s,{className:"h-3.5 w-3.5"})})]})]},E.id))})]})}const ED=y.createContext({theme:"system",resolved:"dark",setTheme:()=>{}}),I1="cc_web_theme";function kW(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function CW(){return y.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>kW())}function TW({children:e}){const[t,n]=y.useState(()=>{try{return localStorage.getItem(I1)||"system"}catch{return"system"}}),r=CW(),i=t==="system"?r:t;y.useEffect(()=>{const o=document.documentElement;o.classList.remove("light","dark"),o.classList.add(i)},[i]);const s=o=>{n(o);try{localStorage.setItem(I1,o)}catch{}};return h.jsx(ED.Provider,{value:{theme:t,resolved:i,setTheme:s},children:e})}function Nv(){return y.useContext(ED)}function kD(){const{theme:e,setTheme:t}=Nv(),n=[{value:"light",icon:kV,label:"浅色"},{value:"dark",icon:pV,label:"深色"},{value:"system",icon:hV,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:i,label:s})=>h.jsx("button",{onClick:()=>t(r),className:X("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:s,children:h.jsx(i,{className:"h-3.5 w-3.5"})},r))})}function AW(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,p]=y.useState(new Set),f=y.useRef(new Map),[g,m]=y.useState(new Map),_=y.useRef(0),[b,v]=y.useState(!!document.fullscreenElement),[S,w]=y.useState(!1),k=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};y.useEffect(()=>{const O=()=>v(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",O),()=>document.removeEventListener("fullscreenchange",O)},[]);const x=async()=>{try{const O=await DL();n(O)}catch(O){o(O instanceof Error?O.message:"Failed to load projects")}finally{i(!1)}};y.useEffect(()=>{x()},[]);const E=y.useCallback(O=>O?`${O.phase}:${O.detail??""}`:"",[]);y.useEffect(()=>{let z=null;const Z=async()=>{if(!document.hidden)try{const $=await _6(),G=Date.now(),ie=new Set,ae=f.current;let ce=!1;for(const[ue,pe]of Object.entries($))if(G-pe.lastActivityAt<2e3){ie.add(ue);const le=ae.get(ue)??[],nt=le[le.length-1],sr=E(pe.semantic),or=nt?E({phase:nt.phase,detail:nt.detail,updatedAt:0}):"";pe.semantic&&sr!==or&&(le.push({id:_.current++,phase:pe.semantic.phase,detail:pe.semantic.detail,ts:G}),ce=!0);const kn=le.filter(Ir=>G-Ir.ts<8e3),Zs=kn.length>3?kn.slice(-3):kn;Zs.length!==le.length&&(ce=!0),ae.set(ue,Zs)}else ae.has(ue)&&ae.get(ue).length>0&&(ae.set(ue,[]),ce=!0);p(ie),ce&&m(new Map(ae))}catch{}},M=()=>{Z(),z=setInterval(()=>void Z(),2e3)},se=()=>{z&&(clearInterval(z),z=null)},be=()=>{document.hidden?se():M()};return M(),document.addEventListener("visibilitychange",be),()=>{se(),document.removeEventListener("visibilitychange",be)}},[E]);const T=()=>{OL(),e("/login")},D=O=>{n(j=>[...j,O])},A=O=>{n(j=>[...j,O])},R=async O=>{try{await g6(O),n(j=>j.filter(C=>C.id!==O))}catch(j){alert(j instanceof Error?j.message:"Failed to delete project")}},I=async O=>{try{const j=await y6(O);n(C=>C.map(z=>z.id===O?j:z))}catch(j){alert(j instanceof Error?j.message:"Failed to archive project")}},L=async O=>{try{const j=await v6(O);n(C=>C.map(z=>z.id===O?j:z))}catch(j){alert(j instanceof Error?j.message:"Failed to restore project")}},P=t.filter(O=>!O.archived),F=t.filter(O=>O.archived),U={onDelete:O=>void R(O),onArchive:O=>void I(O),onUnarchive:O=>void L(O),onUpdated:O=>{n(j=>j.map(C=>C.id===O.id?O:C))}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Nm,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(xD,{}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(xV,{className:"h-4 w-4"})}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(wV,{className:"h-4 w-4"})}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:k,title:b?"Exit fullscreen":"Fullscreen",children:b?h.jsx(xv,{className:"h-4 w-4"}):h.jsx(wv,{className:"h-4 w-4"})}),h.jsx(kD,{}),h.jsxs(ne,{variant:"ghost",size:"sm",onClick:T,children:[h.jsx(cV,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",onClick:()=>u(!0),children:[h.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ne,{onClick:()=>l(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),s&&h.jsx("div",{className:"text-center text-destructive py-12",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(Nm,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ne,{variant:"outline",onClick:()=>u(!0),children:[h.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ne,{onClick:()=>l(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!r&&!s&&P.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map((O,j)=>h.jsx(Ke.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:j*.05,ease:"easeOut"},children:h.jsx(A1,{project:O,active:d.has(O.id),statusStack:g.get(O.id)??[],...U})},O.id))}),!r&&!s&&F.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>w(O=>!O),children:[h.jsx(Ke.span,{animate:{rotate:S?90:0},transition:{duration:.2},children:h.jsx(Ph,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:F.length})]}),h.jsx(Jn,{children:S&&h.jsx(Ke.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:F.map(O=>h.jsx(A1,{project:O,active:!1,...U},O.id))})})})]}),h.jsx(EW,{})]}),h.jsx(_W,{open:a,onOpenChange:l,onCreated:D}),h.jsx(SW,{open:c,onOpenChange:u,onOpened:A})]})}/**
|
|
450
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return y.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},uW="DialogDescriptionWarning",dW=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mD(uW).contentName}}.`;return y.useEffect(()=>{var s;const i=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&i&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},hW=rD,pW=oD,bD=aD,yD=lD,vD=uD,_D=hD,fW=fD;const ua=hW,gW=pW,SD=y.forwardRef(({className:e,...t},n)=>h.jsx(bD,{ref:n,className:X("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));SD.displayName=bD.displayName;const Hs=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(gW,{children:[h.jsx(SD,{}),h.jsxs(yD,{ref:r,className:X("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,h.jsxs(fW,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[h.jsx($s,{className:"h-4 w-4"}),h.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Hs.displayName=yD.displayName;const Vs=({className:e,...t})=>h.jsx("div",{className:X("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Vs.displayName="DialogHeader";const Gs=({className:e,...t})=>h.jsx("div",{className:X("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Gs.displayName="DialogFooter";const Ws=y.forwardRef(({className:e,...t},n)=>h.jsx(vD,{ref:n,className:X("text-lg font-semibold leading-none tracking-tight",e),...t}));Ws.displayName=vD.displayName;const qs=y.forwardRef(({className:e,...t},n)=>h.jsx(_D,{ref:n,className:X("text-sm text-muted-foreground",e),...t}));qs.displayName=_D.displayName;function mW({project:e,open:t,onOpenChange:n,onUpdated:r}){const[i,s]=y.useState([]),[o,a]=y.useState([]),[l,c]=y.useState(!1),[u,d]=y.useState(null);y.useEffect(()=>{if(!t)return;s(e.shares?[...e.shares]:[]),d(null);let v=!1;return d6().then(S=>{v||a(S)}).catch(()=>{}),()=>{v=!0}},[t,e.id]);const p=new Set(i.map(v=>v.username)),f=o.filter(v=>v!==e.owner&&!p.has(v)),g=v=>{s(S=>[...S,{username:v,permission:"view"}])},m=v=>{s(S=>S.filter(w=>w.username!==v))},_=v=>{s(S=>S.map(w=>w.username===v?{...w,permission:w.permission==="view"?"edit":"view"}:w))},b=async()=>{c(!0),d(null);try{const v=await h6(e.id,i);r(v),n(!1)}catch(v){d(v instanceof Error?v.message:"Failed to update shares")}finally{c(!1)}};return h.jsx(ua,{open:t,onOpenChange:n,children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsxs(Ws,{className:"flex items-center gap-2",children:[h.jsx(Om,{className:"h-4 w-4"}),"共享设置"]}),h.jsx(qs,{children:"选择用户并设置权限:可见(只读)或可编辑(读写+终端)"})]}),h.jsxs("div",{className:"space-y-3 max-h-64 overflow-y-auto",children:[i.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"尚未共享给任何用户"}),i.map(v=>h.jsxs("div",{className:"flex items-center justify-between gap-2 px-1",children:[h.jsx("span",{className:"text-sm font-medium",children:v.username}),h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("button",{onClick:()=>_(v.username),className:"focus:outline-none",children:h.jsx(gr,{variant:v.permission==="edit"?"default":"secondary",className:"cursor-pointer text-xs",children:v.permission==="edit"?"可编辑":"可见"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>m(v.username),children:h.jsx(Ev,{className:"h-3.5 w-3.5"})})]})]},v.username))]}),f.length>0&&h.jsxs("div",{className:"border-t pt-3",children:[h.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"添加用户"}),h.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(v=>h.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1",onClick:()=>g(v),children:[h.jsx(Yo,{className:"h-3 w-3"}),v]},v))})]}),u&&h.jsx("p",{className:"text-sm text-destructive",children:u}),h.jsxs(Gs,{children:[h.jsx(ne,{variant:"outline",onClick:()=>n(!1),disabled:l,children:"取消"}),h.jsx(ne,{onClick:()=>void b(),disabled:l,children:l?"保存中...":"保存"})]})]})})}function bW(e,t){switch(e){case"thinking":return"Thinking…";case"tool_use":return t?`${t}`:"Tool…";case"tool_result":return"Reading…";case"text":return"Writing…"}}function yW({status:e}){return h.jsx("span",{className:X("inline-block w-2 h-2 rounded-full",{"bg-green-500":e==="running","bg-zinc-400":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})})}function A1({project:e,active:t=!1,statusStack:n=[],onDelete:r,onArchive:i,onUnarchive:s,onUpdated:o}){const a=js(),[l,c]=y.useState(!1),u=!!e._sharedPermission,d=e._sharedPermission==="view",p=b=>{b.stopPropagation(),confirm(`Delete project "${e.name}"? This cannot be undone.`)&&r(e.id)},f=b=>{b.stopPropagation(),i(e.id)},g=b=>{b.stopPropagation(),s(e.id)},m=h.jsx(Ke.div,{whileHover:!e.archived&&!t?{y:-2}:{},transition:{duration:.2},children:h.jsxs(Ih,{className:X("group cursor-pointer transition-colors relative",e.archived?"opacity-60 hover:opacity-80 hover:border-zinc-400":t?"border-transparent hover:border-transparent bg-transparent shadow-none":"hover:border-zinc-400 hover:shadow-md"),onClick:()=>!e.archived&&a(`/projects/${e.id}`),children:[h.jsxs(Oh,{className:"pb-2",children:[h.jsxs("div",{className:"flex items-start justify-between gap-2",children:[h.jsx(Lh,{className:X("text-base leading-tight",e.archived&&"text-muted-foreground"),children:e.name}),h.jsx("div",{className:"flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:!u&&h.jsxs(h.Fragment,{children:[e.archived?h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:g,title:"Restore project",children:h.jsx(Q6,{className:"h-3.5 w-3.5"})}):h.jsxs(h.Fragment,{children:[h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:b=>{b.stopPropagation(),c(!0)},title:"共享设置",children:h.jsx(Om,{className:"h-3.5 w-3.5"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:f,title:"Archive project",children:h.jsx(J6,{className:"h-3.5 w-3.5"})})]}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:p,title:"Delete project",children:h.jsx(Ev,{className:"h-3.5 w-3.5"})})]})})]}),h.jsx("div",{className:"flex items-center gap-1.5",children:e.archived?h.jsx(gr,{variant:"secondary",className:"text-xs",children:"Archived"}):h.jsxs(h.Fragment,{children:[h.jsx(yW,{status:e.status}),h.jsx("span",{className:"text-xs text-muted-foreground capitalize",children:e.status}),t&&n.length>0&&h.jsx("div",{className:"ml-auto relative h-5 flex items-end overflow-hidden",children:h.jsx(Jn,{initial:!1,children:n.map((b,v)=>{const S=n.length-1-v;return h.jsx(Ke.div,{initial:{opacity:0,y:14,scale:.9},animate:{opacity:S===0?1:S===1?.45:.2,y:-(S*18),scale:1},exit:{opacity:0,y:-20},transition:{duration:.35,ease:"easeOut"},className:"absolute right-0",children:h.jsx(gr,{variant:"outline",className:"text-xs font-normal whitespace-nowrap",children:bW(b.phase,b.detail)})},b.id)})})})]})})]}),h.jsxs(Dh,{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[h.jsx(Wl,{className:"h-3.5 w-3.5 flex-shrink-0"}),h.jsx("span",{className:"truncate font-mono",children:e.folderPath})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gr,{variant:"outline",className:"text-xs font-mono",children:e.cliTool??"claude"}),h.jsx(gr,{variant:e.permissionMode==="unlimited"?"destructive":"secondary",className:"text-xs",children:e.permissionMode==="unlimited"?"Unlimited":"Limited"}),u&&h.jsxs(gr,{variant:"outline",className:"text-xs gap-0.5",children:[d?h.jsx(UL,{className:"h-3 w-3"}):h.jsx(Fh,{className:"h-3 w-3"}),d?"可见":"可编辑"]}),!u&&e.shares&&e.shares.length>0&&h.jsxs(gr,{variant:"outline",className:"text-xs gap-0.5",children:[h.jsx(Om,{className:"h-3 w-3"}),e.shares.length]}),h.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(e.createdAt).toLocaleDateString()})]})]})]})}),_=t&&!e.archived?h.jsx("div",{className:"card-active-glow rounded-lg",children:m}):m;return h.jsxs(h.Fragment,{children:[_,!u&&o&&h.jsx(mW,{project:e,open:l,onOpenChange:c,onUpdated:o})]})}function wD({onSelect:e}){const[t,n]=y.useState(""),[r,i]=y.useState(null),[s,o]=y.useState([]),[a,l]=y.useState(!0),[c,u]=y.useState(null),[d,p]=y.useState(!1),[f,g]=y.useState(""),[m,_]=y.useState(null),[b,v]=y.useState(!1),S=y.useRef(null),w=async R=>{l(!0),u(null);try{const I=await PL(R);n(I.path),i(I.parent),o(I.entries)}catch(I){u(I instanceof Error?I.message:"Failed to load directory")}finally{l(!1)}};y.useEffect(()=>{w()},[]),y.useEffect(()=>{d&&setTimeout(()=>{var R;return(R=S.current)==null?void 0:R.focus()},0)},[d]);const k=()=>{g(""),_(null),p(!0)},x=()=>{p(!1),g(""),_(null)},E=async()=>{const R=f.trim();if(R){v(!0),_(null);try{const{path:I}=await D6(t,R);p(!1),g(""),await w(t),w(I)}catch(I){_(I instanceof Error?I.message:"Failed to create folder")}finally{v(!1)}}},T=R=>{R.key==="Enter"?(R.preventDefault(),E()):R.key==="Escape"&&x()},D=t.split("/").filter(Boolean),A=R=>{const I="/"+D.slice(0,R+1).join("/");w(I)};return h.jsxs("div",{className:"flex flex-col h-64 border rounded-md overflow-hidden",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-2 bg-muted border-b flex-shrink-0",children:[h.jsx(ne,{variant:"ghost",size:"sm",className:"h-6 px-1 flex-shrink-0",onClick:()=>void w(),title:"Home",children:h.jsx(aV,{className:"h-3 w-3"})}),h.jsx("div",{className:"flex items-center gap-1 flex-1 overflow-x-auto min-w-0",children:D.map((R,I)=>h.jsxs(wt.Fragment,{children:[h.jsx(Ph,{className:"h-3 w-3 text-muted-foreground flex-shrink-0"}),h.jsx("button",{className:"text-xs hover:text-foreground text-muted-foreground whitespace-nowrap",onClick:()=>A(I),children:R})]},I))}),h.jsxs(ne,{variant:"ghost",size:"sm",className:"h-6 px-1.5 flex-shrink-0 gap-1 text-xs",onClick:k,disabled:d||a||!!c,title:"New folder",children:[h.jsx(oV,{className:"h-3.5 w-3.5"}),h.jsx("span",{className:"hidden sm:inline",children:"New folder"})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading..."}),c&&h.jsx("div",{className:"flex items-center justify-center h-full text-sm text-destructive px-4 text-center",children:c}),!a&&!c&&h.jsxs("div",{className:"p-1",children:[r&&h.jsxs("button",{className:"flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded hover:bg-accent hover:text-accent-foreground",onClick:()=>void w(r),children:[h.jsx(Gl,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("span",{children:".."})]}),d&&h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1.5",children:[h.jsx(Rm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}),h.jsx("input",{ref:S,className:X("flex-1 text-sm bg-background border rounded px-1.5 py-0.5 outline-none","focus:ring-1 focus:ring-ring",m&&"border-destructive"),placeholder:"Folder name",value:f,onChange:R=>{g(R.target.value),_(null)},onKeyDown:T,disabled:b}),h.jsx("button",{className:"p-1 rounded hover:bg-accent disabled:opacity-50",onClick:()=>void E(),disabled:!f.trim()||b,title:"Create",children:h.jsx(jL,{className:"h-3.5 w-3.5 text-green-600"})}),h.jsx("button",{className:"p-1 rounded hover:bg-accent",onClick:x,disabled:b,title:"Cancel",children:h.jsx($s,{className:"h-3.5 w-3.5 text-muted-foreground"})})]}),m&&h.jsx("p",{className:"px-3 pb-1 text-xs text-destructive",children:m}),s.length===0&&!d&&h.jsx("div",{className:"text-sm text-muted-foreground px-2 py-4 text-center",children:"Empty directory"}),s.map(R=>h.jsxs("button",{className:X("flex items-center gap-2 w-full px-2 py-1.5 text-sm rounded text-left",R.type==="dir"?"hover:bg-accent hover:text-accent-foreground cursor-pointer":"opacity-40 cursor-not-allowed"),onClick:()=>{R.type==="dir"&&w(R.path)},disabled:R.type==="file",children:[R.type==="dir"?h.jsx(Rm,{className:"h-4 w-4 text-blue-500 flex-shrink-0"}):h.jsx(sV,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:"truncate",children:R.name})]},R.path))]})]}),h.jsxs("div",{className:"border-t px-3 py-2 flex items-center justify-between gap-2 flex-shrink-0 bg-background",children:[h.jsx("span",{className:"text-xs text-muted-foreground truncate flex-1",children:t}),h.jsx(ne,{size:"sm",onClick:()=>e(t),disabled:!t,children:"Select this folder"})]})]})}const vW=[{value:"claude",label:"Claude",desc:"Anthropic Claude Code CLI"},{value:"opencode",label:"OpenCode",desc:"OpenCode CLI (sst/opencode)"},{value:"codex",label:"Codex",desc:"OpenAI Codex CLI"},{value:"qwen",label:"Qwen",desc:"Qwen Code CLI (QwenLM)"}],R1={claude:{limited:"claude",unlimited:"claude --dangerously-skip-permissions"},opencode:{limited:"opencode",unlimited:"opencode --dangerously-skip-permissions"},codex:{limited:"codex",unlimited:"codex --ask-for-approval never --sandbox danger-full-access"},qwen:{limited:"qwen-code",unlimited:"qwen-code --yolo"}};function _W({open:e,onOpenChange:t,onCreated:n}){const[r,i]=y.useState("name"),[s,o]=y.useState(""),[a,l]=y.useState(""),[c,u]=y.useState("claude"),[d,p]=y.useState("limited"),[f,g]=y.useState(!1),[m,_]=y.useState(null),b=()=>{i("name"),o(""),l(""),u("claude"),p("limited"),_(null),g(!1)},v=T=>{T||b(),t(T)},S=()=>{if(!s.trim()){_("Please enter a project name");return}_(null),i("folder")},w=T=>{l(T),i("settings")},k=async()=>{g(!0),_(null);try{const T=await p6({name:s.trim(),folderPath:a,permissionMode:d,cliTool:c});n(T),v(!1)}catch(T){_(T instanceof Error?T.message:"Failed to create project")}finally{g(!1)}},x={name:"New Project — Name",folder:"New Project — Select Folder",settings:"New Project — Settings"},E=["name","folder","settings"];return h.jsx(ua,{open:e,onOpenChange:v,children:h.jsxs(Hs,{className:"sm:max-w-lg",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:x[r]}),h.jsxs(qs,{children:[r==="name"&&"Give your project a name.",r==="folder"&&"Choose the working directory for this project.",r==="settings"&&"Choose the AI coding tool and run mode."]})]}),h.jsx("div",{className:"flex gap-2 mb-2",children:E.map((T,D)=>h.jsx("div",{className:`h-1.5 flex-1 rounded-full ${r===T?"bg-primary":E.indexOf(r)>D?"bg-primary/40":"bg-muted"}`},T))}),r==="name"&&h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"project-name",children:"Project Name"}),h.jsx(Fn,{id:"project-name",placeholder:"My Project",value:s,onChange:T=>o(T.target.value),onKeyDown:T=>{T.key==="Enter"&&S()},autoFocus:!0})]}),m&&h.jsx("p",{className:"text-sm text-destructive",children:m})]}),r==="folder"&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Working Directory"}),h.jsx(wD,{onSelect:w})]}),r==="settings"&&h.jsxs("div",{className:"space-y-5",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"AI Coding Tool"}),h.jsx("div",{className:"grid grid-cols-2 gap-2",children:vW.map(T=>h.jsxs("label",{className:`flex items-center gap-2.5 cursor-pointer p-3 rounded-md border transition-colors ${c===T.value?"border-primary bg-primary/5":"hover:bg-accent"}`,children:[h.jsx("input",{type:"radio",name:"cliTool",value:T.value,checked:c===T.value,onChange:()=>u(T.value),className:"accent-primary"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:T.label}),h.jsx("div",{className:"text-xs text-muted-foreground",children:T.desc})]})]},T.value))})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Permission Mode"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"limited",checked:d==="limited",onChange:()=>p("limited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Limited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:R1[c].limited})," — asks for permission before file changes."]})]})]}),h.jsxs("label",{className:"flex items-start gap-3 cursor-pointer p-3 rounded-md border hover:bg-accent transition-colors",children:[h.jsx("input",{type:"radio",name:"permissionMode",value:"unlimited",checked:d==="unlimited",onChange:()=>p("unlimited"),className:"mt-0.5"}),h.jsxs("div",{children:[h.jsx("div",{className:"font-medium text-sm",children:"Unlimited"}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:["Runs ",h.jsx("code",{className:"bg-muted px-1 rounded",children:R1[c].unlimited})," — acts autonomously."]})]})]})]})]}),h.jsxs("div",{className:"text-xs text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Folder:"})," ",h.jsx("span",{className:"font-mono",children:a})]}),m&&h.jsx("p",{className:"text-sm text-destructive",children:m})]}),h.jsxs(Gs,{children:[r!=="name"&&h.jsx(ne,{variant:"outline",onClick:()=>i(r==="settings"?"folder":"name"),disabled:f,children:"Back"}),r==="name"&&h.jsx(ne,{onClick:S,children:"Next"}),r==="folder"&&h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r==="settings"&&h.jsx(ne,{onClick:()=>void k(),disabled:f,children:f?"Creating...":"Create Project"})]})]})})}function SW({open:e,onOpenChange:t,onOpened:n}){const[r,i]=y.useState(""),[s,o]=y.useState(!1),[a,l]=y.useState(null),c=()=>{i(""),l(null),o(!1)},u=p=>{p||c(),t(p)},d=async p=>{i(p),o(!0),l(null);try{const f=await f6(p);n(f),u(!1)}catch(f){l(f instanceof Error?f.message:"Failed to open project"),o(!1)}};return h.jsx(ua,{open:e,onOpenChange:u,children:h.jsxs(Hs,{className:"sm:max-w-lg",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:"Open Existing Project"}),h.jsxs(qs,{children:["Select a folder that contains a ",h.jsx("code",{className:"bg-muted px-1 rounded text-xs",children:".ccweb/"})," configuration. The project's history and settings will be restored."]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Project Folder"}),h.jsx(wD,{onSelect:p=>void d(p)})]}),a&&h.jsx("p",{className:"text-sm text-destructive",children:a}),r&&!a&&s&&h.jsxs("p",{className:"text-sm text-muted-foreground",children:["Opening project from ",r,"..."]}),h.jsx(Gs,{children:h.jsx(ne,{variant:"outline",onClick:()=>u(!1),disabled:s,children:"Cancel"})})]})})}function wW(e){if(!e)return"";const t=new Date(e).getTime()-Date.now();if(t<=0)return"即将重置";const n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4);return n>0?`${n}h${r}m`:`${r}m`}const N1=5*36e5;function xW(e){if(!e||e.utilization===void 0||e.utilization<=0||!e.resetAt)return null;const t=new Date(e.resetAt).getTime()-Date.now();if(t<=0)return null;const n=N1-t;return n<=0?null:Math.round(e.utilization/(n/N1))}function ou({label:e,bucket:t}){if(!t||t.utilization===void 0)return null;const n=t.utilization,r=n<50?"text-green-400":n<80?"text-yellow-400":"text-red-400",i=wW(t.resetAt);return h.jsxs("span",{className:"text-muted-foreground whitespace-nowrap",children:[e," ",h.jsxs("span",{className:X("font-medium",r),children:[n,"%"]}),i&&h.jsxs("span",{className:"text-muted-foreground/70 ml-0.5",children:["(",i,")"]})]})}function xD({className:e}){const[t,n]=y.useState("loading"),[r,i]=y.useState(!1);y.useEffect(()=>{const p=async()=>{try{n(await I6())}catch{n(null)}};p();const f=setInterval(()=>void p(),5*60*1e3);return()=>clearInterval(f)},[]);const s=async()=>{i(!0);try{n(await O6())}catch{n(null)}finally{i(!1)}};if(t==="loading"||!t)return null;const o=!!t.fiveHour,a=!!t.sevenDay,l=!!t.sevenDaySonnet,c=!!t.sevenDayOpus,u=o||a||l||c,d=xW(t.fiveHour);return h.jsxs("div",{className:X("flex items-center gap-1.5 text-xs",e),children:[d!==null&&h.jsxs("span",{className:X("font-medium",d<=100?"text-green-400":"text-orange-400"),title:`5h 使用进度:按当前速率,窗口结束时预计使用 ${d}%`,children:[d,"%"]}),t.planName&&h.jsx("span",{className:"font-medium text-foreground bg-muted border border-border px-2 py-0.5 rounded-full",children:t.planName}),u&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"|"}),h.jsx(ou,{label:"5h",bucket:t.fiveHour}),a&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d",bucket:t.sevenDay})]}),l&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d Sonnet",bucket:t.sevenDaySonnet})]}),c&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"text-muted-foreground/50",children:"·"}),h.jsx(ou,{label:"7d Opus",bucket:t.sevenDayOpus})]})]}),h.jsx("button",{onClick:()=>void s(),className:"text-muted-foreground hover:text-foreground transition-colors",title:"刷新用量信息",children:h.jsx(As,{className:X("h-3 w-3",r&&"animate-spin")})})]})}function EW(){const[e,t]=y.useState([]),[n,r]=y.useState(!1),[i,s]=y.useState(""),[o,a]=y.useState(""),[l,c]=y.useState(""),[u,d]=y.useState(null),[p,f]=y.useState(""),[g,m]=y.useState(""),[_,b]=y.useState(""),v=y.useRef(null),S=y.useRef(null);y.useEffect(()=>{ML().then(t).catch(()=>t([]))},[]),y.useEffect(()=>{n&&setTimeout(()=>{var E;return(E=v.current)==null?void 0:E.focus()},0)},[n]),y.useEffect(()=>{u&&setTimeout(()=>{var E;return(E=S.current)==null?void 0:E.focus()},0)},[u]);const w=async()=>{const E=o.trim();if(E)try{const T=await S6({label:i.trim()||E,command:E,...l?{parentId:l}:{}});t(D=>[...D,T]),s(""),a(""),c(""),r(!1)}catch(T){console.error("[GlobalShortcuts] Failed to add:",T)}},k=async E=>{try{await x6(E),t(T=>T.filter(D=>D.id!==E)),u===E&&d(null)}catch(T){console.error("[GlobalShortcuts] Failed to delete:",T)}},x=async()=>{const E=g.trim();if(!(!E||!u))try{const T=await w6(u,{label:p.trim()||E,command:E,parentId:_||null});t(D=>D.map(A=>A.id===u?T:A)),d(null)}catch(T){console.error("[GlobalShortcuts] Failed to save:",T)}};return h.jsxs("section",{className:"mt-10",children:[h.jsxs("div",{className:"flex items-center justify-between mb-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(jd,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h2",{className:"text-lg font-semibold",children:"全局快捷命令"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"在所有项目的终端中可用"})]}),h.jsxs("button",{onClick:()=>{r(E=>!E),d(null)},className:X("flex items-center gap-1.5 text-sm px-3 py-1.5 rounded-md border transition-colors",n?"border-border text-foreground bg-muted":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[h.jsx(Yo,{className:"h-3.5 w-3.5"}),"新建"]})]}),n&&h.jsxs("div",{className:"mb-4 p-4 rounded-lg border border-border bg-background space-y-3",children:[h.jsx("input",{ref:v,placeholder:"名称(可选)",value:i,onChange:E=>s(E.target.value),className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{placeholder:"命令内容…",value:o,onChange:E=>a(E.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground placeholder:text-muted-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:E=>{E.key==="Enter"&&(E.metaKey||E.ctrlKey)&&(E.preventDefault(),w()),E.key==="Escape"&&(r(!1),s(""),a(""),c(""))}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:l,onChange:E=>c(E.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-3 py-1.5 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.map(E=>h.jsx("option",{value:E.id,children:E.label},E.id))]})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ 保存 · Esc 取消"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx("button",{onClick:()=>{r(!1),s(""),a("")},className:"text-sm px-3 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void w(),disabled:!o.trim(),className:X("text-sm px-3 py-1 rounded transition-colors text-white",o.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]})]}),e.length===0&&!n?h.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-muted-foreground/50 border border-dashed border-border rounded-lg",children:[h.jsx(jd,{className:"h-6 w-6"}),h.jsx("p",{className:"text-sm",children:"还没有全局快捷命令"})]}):h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",children:e.map(E=>u===E.id?h.jsxs("div",{className:"rounded-lg border border-border bg-background p-3 space-y-2",children:[h.jsx("input",{ref:S,value:p,onChange:T=>f(T.target.value),placeholder:"名称(可选)",className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground placeholder:text-muted-foreground outline-none focus:border-border transition-colors"}),h.jsx("textarea",{value:g,onChange:T=>m(T.target.value),rows:3,className:"w-full text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground font-mono outline-none focus:border-border transition-colors resize-none",onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&(T.preventDefault(),x()),T.key==="Escape"&&d(null)}}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(gl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),h.jsxs("select",{value:_,onChange:T=>b(T.target.value),className:"flex-1 text-sm bg-muted border border-border rounded px-2.5 py-1 text-foreground outline-none focus:border-border transition-colors",children:[h.jsx("option",{value:"",children:"无继承"}),e.filter(T=>T.id!==E.id).map(T=>h.jsx("option",{value:T.id,children:T.label},T.id))]})]}),h.jsxs("div",{className:"flex gap-2 justify-end",children:[h.jsx("button",{onClick:()=>d(null),className:"text-xs px-2.5 py-1 rounded bg-secondary hover:bg-accent text-foreground transition-colors",children:"取消"}),h.jsx("button",{onClick:()=>void x(),disabled:!g.trim(),className:X("text-xs px-2.5 py-1 rounded transition-colors text-white",g.trim()?"bg-blue-600 hover:bg-blue-500":"bg-secondary opacity-40 cursor-not-allowed"),children:"保存"})]})]},E.id):h.jsxs("div",{className:"group relative rounded-lg border border-border bg-background hover:border-muted-foreground/30 transition-colors p-3",children:[h.jsx("div",{className:"text-sm font-medium text-foreground truncate pr-14",children:E.label}),E.parentId&&(()=>{const T=e.find(D=>D.id===E.parentId);return T?h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(gl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T.label]})]}):null})(),!E.parentId&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-1 pr-14",children:E.command}),h.jsxs("div",{className:"absolute top-2.5 right-2.5 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{onClick:()=>{d(E.id),f(E.label),m(E.command),b(E.parentId||""),r(!1)},className:"p-1 rounded text-muted-foreground hover:text-blue-400 transition-colors",title:"编辑",children:h.jsx(Fh,{className:"h-3.5 w-3.5"})}),h.jsx("button",{onClick:()=>void k(E.id),className:"p-1 rounded text-muted-foreground hover:text-red-400 transition-colors",title:"删除",children:h.jsx($s,{className:"h-3.5 w-3.5"})})]})]},E.id))})]})}const ED=y.createContext({theme:"system",resolved:"dark",setTheme:()=>{}}),I1="cc_web_theme";function kW(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function CW(){return y.useSyncExternalStore(e=>{const t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>kW())}function TW({children:e}){const[t,n]=y.useState(()=>{try{return localStorage.getItem(I1)||"system"}catch{return"system"}}),r=CW(),i=t==="system"?r:t;y.useEffect(()=>{const o=document.documentElement;o.classList.remove("light","dark"),o.classList.add(i)},[i]);const s=o=>{n(o);try{localStorage.setItem(I1,o)}catch{}};return h.jsx(ED.Provider,{value:{theme:t,resolved:i,setTheme:s},children:e})}function Nv(){return y.useContext(ED)}function kD(){const{theme:e,setTheme:t}=Nv(),n=[{value:"light",icon:kV,label:"浅色"},{value:"dark",icon:pV,label:"深色"},{value:"system",icon:hV,label:"系统"}];return h.jsx("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:n.map(({value:r,icon:i,label:s})=>h.jsx("button",{onClick:()=>t(r),className:X("p-1 rounded-sm transition-colors",e===r?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:s,children:h.jsx(i,{className:"h-3.5 w-3.5"})},r))})}function AW(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(!1),[c,u]=y.useState(!1),[d,p]=y.useState(new Set),f=y.useRef(new Map),[g,m]=y.useState(new Map),_=y.useRef(0),[b,v]=y.useState(!!document.fullscreenElement),[S,w]=y.useState(!1),k=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()};y.useEffect(()=>{const O=()=>v(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",O),()=>document.removeEventListener("fullscreenchange",O)},[]);const x=async()=>{try{const O=await DL();n(O)}catch(O){o(O instanceof Error?O.message:"Failed to load projects")}finally{i(!1)}};y.useEffect(()=>{x()},[]);const E=y.useCallback(O=>O?`${O.phase}:${O.detail??""}`:"",[]);y.useEffect(()=>{let z=null;const Z=async()=>{if(!document.hidden)try{const $=await _6(),G=Date.now(),ie=new Set,ae=f.current;let ce=!1;for(const[ue,pe]of Object.entries($))if(G-pe.lastActivityAt<2e3){ie.add(ue);const le=ae.get(ue)??[],Xe=le[le.length-1],sr=E(pe.semantic),or=Xe?E({phase:Xe.phase,detail:Xe.detail,updatedAt:0}):"";pe.semantic&&(sr!==or?(le.push({id:_.current++,phase:pe.semantic.phase,detail:pe.semantic.detail,ts:G}),ce=!0):Xe&&(Xe.ts=G));const kn=le.filter(Ir=>G-Ir.ts<8e3),Zs=kn.length>3?kn.slice(-3):kn;Zs.length!==le.length&&(ce=!0),ae.set(ue,Zs)}else ae.has(ue)&&ae.get(ue).length>0&&(ae.set(ue,[]),ce=!0);p(ie),ce&&m(new Map(ae))}catch{}},M=()=>{Z(),z=setInterval(()=>void Z(),2e3)},se=()=>{z&&(clearInterval(z),z=null)},be=()=>{document.hidden?se():M()};return M(),document.addEventListener("visibilitychange",be),()=>{se(),document.removeEventListener("visibilitychange",be)}},[E]);const T=()=>{OL(),e("/login")},D=O=>{n(j=>[...j,O])},A=O=>{n(j=>[...j,O])},R=async O=>{try{await g6(O),n(j=>j.filter(C=>C.id!==O))}catch(j){alert(j instanceof Error?j.message:"Failed to delete project")}},I=async O=>{try{const j=await y6(O);n(C=>C.map(z=>z.id===O?j:z))}catch(j){alert(j instanceof Error?j.message:"Failed to archive project")}},L=async O=>{try{const j=await v6(O);n(C=>C.map(z=>z.id===O?j:z))}catch(j){alert(j instanceof Error?j.message:"Failed to restore project")}},P=t.filter(O=>!O.archived),F=t.filter(O=>O.archived),U={onDelete:O=>void R(O),onArchive:O=>void I(O),onUnarchive:O=>void L(O),onUpdated:O=>{n(j=>j.map(C=>C.id===O.id?O:C))}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-6xl mx-auto px-4 h-14 flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Nm,{className:"h-5 w-5"}),h.jsx("span",{className:"font-semibold text-lg",children:"CC Web"})]}),h.jsx(xD,{}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>e("/skillhub"),title:"SkillHub",children:h.jsx(xV,{className:"h-4 w-4"})}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:()=>e("/settings"),title:"设置",children:h.jsx(wV,{className:"h-4 w-4"})}),h.jsx(ne,{variant:"ghost",size:"sm",onClick:k,title:b?"Exit fullscreen":"Fullscreen",children:b?h.jsx(xv,{className:"h-4 w-4"}):h.jsx(wv,{className:"h-4 w-4"})}),h.jsx(kD,{}),h.jsxs(ne,{variant:"ghost",size:"sm",onClick:T,children:[h.jsx(cV,{className:"h-4 w-4 mr-2"}),"Logout"]})]})}),h.jsxs("main",{className:"max-w-6xl mx-auto px-4 py-8",children:[h.jsxs("div",{className:"flex items-center justify-between mb-6",children:[h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Projects"}),h.jsx("p",{className:"text-muted-foreground text-sm mt-1",children:"Each project runs Claude CLI in a dedicated terminal session."})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",onClick:()=>u(!0),children:[h.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ne,{onClick:()=>l(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-12",children:"Loading projects..."}),s&&h.jsx("div",{className:"text-center text-destructive py-12",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center py-20",children:[h.jsx(Nm,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),h.jsx("h2",{className:"text-lg font-semibold mb-2",children:"No projects yet"}),h.jsx("p",{className:"text-muted-foreground text-sm mb-6",children:"Create a new project or open an existing one."}),h.jsxs("div",{className:"flex gap-2 justify-center",children:[h.jsxs(ne,{variant:"outline",onClick:()=>u(!0),children:[h.jsx(Wl,{className:"h-4 w-4 mr-2"}),"Open Project"]}),h.jsxs(ne,{onClick:()=>l(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-2"}),"New Project"]})]})]}),!r&&!s&&P.length>0&&h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:P.map((O,j)=>h.jsx(Ke.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{duration:.3,delay:j*.05,ease:"easeOut"},children:h.jsx(A1,{project:O,active:d.has(O.id),statusStack:g.get(O.id)??[],...U})},O.id))}),!r&&!s&&F.length>0&&h.jsxs("div",{className:"mt-10",children:[h.jsxs("button",{className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors mb-4 group",onClick:()=>w(O=>!O),children:[h.jsx(Ke.span,{animate:{rotate:S?90:0},transition:{duration:.2},children:h.jsx(Ph,{className:"h-4 w-4"})}),h.jsx("span",{className:"font-medium",children:"Archived"}),h.jsx("span",{className:"text-xs bg-muted rounded-full px-2 py-0.5",children:F.length})]}),h.jsx(Jn,{children:S&&h.jsx(Ke.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.25,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:F.map(O=>h.jsx(A1,{project:O,active:!1,...U},O.id))})})})]}),h.jsx(EW,{})]}),h.jsx(_W,{open:a,onOpenChange:l,onCreated:D}),h.jsx(SW,{open:c,onOpenChange:u,onOpened:A})]})}/**
|
|
451
451
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
452
452
|
* @license MIT
|
|
453
453
|
*
|
|
@@ -458,7 +458,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
458
458
|
* Fabrice Bellard's javascript vt100 for jslinux:
|
|
459
459
|
* http://bellard.org/jslinux/
|
|
460
460
|
* Copyright (c) 2011 Fabrice Bellard
|
|
461
|
-
*/var CD=Object.defineProperty,RW=Object.getOwnPropertyDescriptor,NW=(e,t)=>{for(var n in t)CD(e,n,{get:t[n],enumerable:!0})},
|
|
461
|
+
*/var CD=Object.defineProperty,RW=Object.getOwnPropertyDescriptor,NW=(e,t)=>{for(var n in t)CD(e,n,{get:t[n],enumerable:!0})},et=(e,t,n,r)=>{for(var i=r>1?void 0:r?RW(t,n):t,s=e.length-1,o;s>=0;s--)(o=e[s])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&CD(t,n,i),i},Q=(e,t)=>(n,r)=>t(n,r,e),O1="Terminal input",Mm={get:()=>O1,set:e=>O1=e},L1="Too much output to announce, navigate to rows manually to read",Pm={get:()=>L1,set:e=>L1=e};function IW(e){return e.replace(/\r?\n/g,"\r")}function OW(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function LW(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function DW(e,t,n,r){if(e.stopPropagation(),e.clipboardData){let i=e.clipboardData.getData("text/plain");TD(i,t,n,r)}}function TD(e,t,n,r){e=IW(e),e=OW(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=""}function AD(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,s=e.clientY-r.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${i}px`,t.style.top=`${s}px`,t.style.zIndex="1000",t.focus()}function D1(e,t,n,r,i){AD(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function fi(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function Vh(e,t=0,n=e.length){let r="";for(let i=t;i<n;++i){let s=e[i];s>65535?(s-=65536,r+=String.fromCharCode((s>>10)+55296)+String.fromCharCode(s%1024+56320)):r+=String.fromCharCode(s)}return r}var MW=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let s=e.charCodeAt(i++);56320<=s&&s<=57343?t[r++]=(this._interim-55296)*1024+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0}for(let s=i;s<n;++s){let o=e.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=n)return this._interim=o,r;let a=e.charCodeAt(s);56320<=a&&a<=57343?t[r++]=(o-55296)*1024+a-56320+65536:(t[r++]=o,t[r++]=a);continue}o!==65279&&(t[r++]=o)}return r}},PW=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,s,o,a,l=0,c=0;if(this.interim[0]){let p=!1,f=this.interim[0];f&=(f&224)===192?31:(f&240)===224?15:7;let g=0,m;for(;(m=this.interim[++g]&63)&&g<4;)f<<=6,f|=m;let _=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,b=_-g;for(;c<b;){if(c>=n)return 0;if(m=e[c++],(m&192)!==128){c--,p=!0;break}else this.interim[g++]=m,f<<=6,f|=m&63}p||(_===2?f<128?c--:t[r++]=f:_===3?f<2048||f>=55296&&f<=57343||f===65279||(t[r++]=f):f<65536||f>1114111||(t[r++]=f)),this.interim.fill(0)}let u=n-4,d=c;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((s=e[d+1])&128)&&!((o=e[d+2])&128)&&!((a=e[d+3])&128);)t[r++]=i,t[r++]=s,t[r++]=o,t[r++]=a,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)===192){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(l=(i&31)<<6|s&63,l<128){d--;continue}t[r++]=l}else if((i&240)===224){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[d++],(o&192)!==128){d--;continue}if(l=(i&15)<<12|(s&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[r++]=l}else if((i&248)===240){if(d>=n)return this.interim[0]=i,r;if(s=e[d++],(s&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,r;if(o=e[d++],(o&192)!==128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=s,this.interim[2]=o,r;if(a=e[d++],(a&192)!==128){d--;continue}if(l=(i&7)<<18|(s&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[r++]=l}}return r}},RD="",Si=" ",bc=class ND{constructor(){this.fg=0,this.bg=0,this.extended=new $d}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new ND;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},$d=class ID{constructor(t=0,n=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=n}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new ID(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},Bn=class OD extends bc{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new $d,this.combinedData=""}static fromCharData(t){let n=new OD;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?fi(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let n=!1;if(t[1].length>2)n=!0;else if(t[1].length===2){let r=t[1].charCodeAt(0);if(55296<=r&&r<=56319){let i=t[1].charCodeAt(1);56320<=i&&i<=57343?this.content=(r-55296)*1024+i-56320+65536|t[2]<<22:n=!0}else n=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;n&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},M1="di$target",Fm="di$dependencies",Sf=new Map;function FW(e){return e[Fm]||[]}function Et(e){if(Sf.has(e))return Sf.get(e);let t=function(n,r,i){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");BW(t,n,i)};return t._id=e,Sf.set(e,t),t}function BW(e,t,n){t[M1]===t?t[Fm].push({id:e,index:n}):(t[Fm]=[{id:e,index:n}],t[M1]=t)}var Jt=Et("BufferService"),LD=Et("CoreMouseService"),Ks=Et("CoreService"),jW=Et("CharsetService"),Iv=Et("InstantiationService"),DD=Et("LogService"),en=Et("OptionsService"),MD=Et("OscLinkService"),UW=Et("UnicodeService"),yc=Et("DecorationService"),Bm=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){var u;let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,s=new Bn,o=n.getTrimmedLength(),a=-1,l=-1,c=!1;for(let d=0;d<o;d++)if(!(l===-1&&!n.hasContent(d))){if(n.loadCell(d,s),s.hasExtendedAttrs()&&s.extended.urlId)if(l===-1){l=d,a=s.extended.urlId;continue}else c=s.extended.urlId!==a;else l!==-1&&(c=!0);if(c||l!==-1&&d===o-1){let p=(u=this._oscLinkService.getLinkData(a))==null?void 0:u.uri;if(p){let f={start:{x:l+1,y:e},end:{x:d+(!c&&d===o-1?1:0),y:e}},g=!1;if(!(i!=null&&i.allowNonHttpProtocols))try{let m=new URL(p);["http:","https:"].includes(m.protocol)||(g=!0)}catch{g=!0}g||r.push({text:p,range:f,activate:(m,_)=>i?i.activate(m,_,f):$W(m,_),hover:(m,_)=>{var b;return(b=i==null?void 0:i.hover)==null?void 0:b.call(i,m,_,f)},leave:(m,_)=>{var b;return(b=i==null?void 0:i.leave)==null?void 0:b.call(i,m,_,f)}})}c=!1,s.hasExtendedAttrs()&&s.extended.urlId?(l=d,a=s.extended.urlId):(l=-1,a=-1)}}t(r)}};Bm=et([Q(0,Jt),Q(1,en),Q(2,MD)],Bm);function $W(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
462
462
|
|
|
463
463
|
WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Gh=Et("CharSizeService"),Qr=Et("CoreBrowserService"),Ov=Et("MouseService"),Jr=Et("RenderService"),zW=Et("SelectionService"),PD=Et("CharacterJoinerService"),da=Et("ThemeService"),FD=Et("LinkProviderService"),HW=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?P1.isErrorNoTelemetry(e)?new P1(e.message+`
|
|
464
464
|
|
|
@@ -466,13 +466,13 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
466
466
|
|
|
467
467
|
`+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)}},VW=new HW;function Hu(e){GW(e)||VW.onUnexpectedError(e)}var jm="Canceled";function GW(e){return e instanceof WW?!0:e instanceof Error&&e.name===jm&&e.message===jm}var WW=class extends Error{constructor(){super(jm),this.name=this.message}};function qW(e){return new Error(`Illegal argument: ${e}`)}var P1=class Um extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof Um)return t;let n=new Um;return n.message=t.message,n.stack=t.stack,n}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},$m=class BD extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,BD.prototype)}};function hn(e,t=0){return e[e.length-(1+t)]}var KW;(e=>{function t(s){return s<0}e.isLessThan=t;function n(s){return s<=0}e.isLessThanOrEqual=n;function r(s){return s>0}e.isGreaterThan=r;function i(s){return s===0}e.isNeitherLessOrGreaterThan=i,e.greaterThan=1,e.lessThan=-1,e.neitherLessOrGreaterThan=0})(KW||(KW={}));function YW(e,t){let n=this,r=!1,i;return function(){return r||(r=!0,t||(i=e.apply(n,arguments))),i}}var jD;(e=>{function t(w){return w&&typeof w=="object"&&typeof w[Symbol.iterator]=="function"}e.is=t;let n=Object.freeze([]);function r(){return n}e.empty=r;function*i(w){yield w}e.single=i;function s(w){return t(w)?w:i(w)}e.wrap=s;function o(w){return w||n}e.from=o;function*a(w){for(let k=w.length-1;k>=0;k--)yield w[k]}e.reverse=a;function l(w){return!w||w[Symbol.iterator]().next().done===!0}e.isEmpty=l;function c(w){return w[Symbol.iterator]().next().value}e.first=c;function u(w,k){let x=0;for(let E of w)if(k(E,x++))return!0;return!1}e.some=u;function d(w,k){for(let x of w)if(k(x))return x}e.find=d;function*p(w,k){for(let x of w)k(x)&&(yield x)}e.filter=p;function*f(w,k){let x=0;for(let E of w)yield k(E,x++)}e.map=f;function*g(w,k){let x=0;for(let E of w)yield*k(E,x++)}e.flatMap=g;function*m(...w){for(let k of w)yield*k}e.concat=m;function _(w,k,x){let E=x;for(let T of w)E=k(E,T);return E}e.reduce=_;function*b(w,k,x=w.length){for(k<0&&(k+=w.length),x<0?x+=w.length:x>w.length&&(x=w.length);k<x;k++)yield w[k]}e.slice=b;function v(w,k=Number.POSITIVE_INFINITY){let x=[];if(k===0)return[x,w];let E=w[Symbol.iterator]();for(let T=0;T<k;T++){let D=E.next();if(D.done)return[x,e.empty()];x.push(D.value)}return[x,{[Symbol.iterator](){return E}}]}e.consume=v;async function S(w){let k=[];for await(let x of w)k.push(x);return Promise.resolve(k)}e.asyncToArray=S})(jD||(jD={}));function Is(e){if(jD.is(e)){let t=[];for(let n of e)if(n)try{n.dispose()}catch(r){t.push(r)}if(t.length===1)throw t[0];if(t.length>1)throw new AggregateError(t,"Encountered errors while disposing of store");return Array.isArray(e)?[]:e}else if(e)return e.dispose(),e}function XW(...e){return He(()=>Is(e))}function He(e){return{dispose:YW(()=>{e()})}}var UD=class $D{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{Is(this._toDispose)}finally{this._toDispose.clear()}}add(t){if(!t)return t;if(t===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?$D.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(t),t}delete(t){if(t){if(t===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(t),t.dispose()}}deleteAndLeak(t){t&&this._toDispose.has(t)&&(this._toDispose.delete(t),void 0)}};UD.DISABLE_DISPOSED_WARNING=!1;var Ii=UD,_e=class{constructor(){this._store=new Ii,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)}};_e.None=Object.freeze({dispose(){}});var Xo=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}},$r=typeof window=="object"?window:globalThis,zm=class Hm{constructor(t){this.element=t,this.next=Hm.Undefined,this.prev=Hm.Undefined}};zm.Undefined=new zm(void 0);var Ve=zm,F1=class{constructor(){this._first=Ve.Undefined,this._last=Ve.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===Ve.Undefined}clear(){let e=this._first;for(;e!==Ve.Undefined;){let t=e.next;e.prev=Ve.Undefined,e.next=Ve.Undefined,e=t}this._first=Ve.Undefined,this._last=Ve.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let n=new Ve(e);if(this._first===Ve.Undefined)this._first=n,this._last=n;else if(t){let i=this._last;this._last=n,n.prev=i,i.next=n}else{let i=this._first;this._first=n,n.next=i,i.prev=n}this._size+=1;let r=!1;return()=>{r||(r=!0,this._remove(n))}}shift(){if(this._first!==Ve.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==Ve.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==Ve.Undefined&&e.next!==Ve.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===Ve.Undefined&&e.next===Ve.Undefined?(this._first=Ve.Undefined,this._last=Ve.Undefined):e.next===Ve.Undefined?(this._last=this._last.prev,this._last.next=Ve.Undefined):e.prev===Ve.Undefined&&(this._first=this._first.next,this._first.prev=Ve.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==Ve.Undefined;)yield e.element,e=e.next}},ZW=globalThis.performance&&typeof globalThis.performance.now=="function",QW=class zD{static create(t){return new zD(t)}constructor(t){this._now=ZW&&t===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}},At;(e=>{e.None=()=>_e.None;function t(I,L){return d(I,()=>{},0,void 0,!0,void 0,L)}e.defer=t;function n(I){return(L,P=null,F)=>{let B=!1,U;return U=I(O=>{if(!B)return U?U.dispose():B=!0,L.call(P,O)},null,F),B&&U.dispose(),U}}e.once=n;function r(I,L,P){return c((F,B=null,U)=>I(O=>F.call(B,L(O)),null,U),P)}e.map=r;function i(I,L,P){return c((F,B=null,U)=>I(O=>{L(O),F.call(B,O)},null,U),P)}e.forEach=i;function s(I,L,P){return c((F,B=null,U)=>I(O=>L(O)&&F.call(B,O),null,U),P)}e.filter=s;function o(I){return I}e.signal=o;function a(...I){return(L,P=null,F)=>{let B=XW(...I.map(U=>U(O=>L.call(P,O))));return u(B,F)}}e.any=a;function l(I,L,P,F){let B=P;return r(I,U=>(B=L(B,U),B),F)}e.reduce=l;function c(I,L){let P,F={onWillAddFirstListener(){P=I(B.fire,B)},onDidRemoveLastListener(){P==null||P.dispose()}},B=new K(F);return L==null||L.add(B),B.event}function u(I,L){return L instanceof Array?L.push(I):L&&L.add(I),I}function d(I,L,P=100,F=!1,B=!1,U,O){let j,C,z,Z=0,M,se={leakWarningThreshold:U,onWillAddFirstListener(){j=I($=>{Z++,C=L(C,$),F&&!z&&(be.fire(C),C=void 0),M=()=>{let G=C;C=void 0,z=void 0,(!F||Z>1)&&be.fire(G),Z=0},typeof P=="number"?(clearTimeout(z),z=setTimeout(M,P)):z===void 0&&(z=0,queueMicrotask(M))})},onWillRemoveListener(){B&&Z>0&&(M==null||M())},onDidRemoveLastListener(){M=void 0,j.dispose()}},be=new K(se);return O==null||O.add(be),be.event}e.debounce=d;function p(I,L=0,P){return e.debounce(I,(F,B)=>F?(F.push(B),F):[B],L,void 0,!0,void 0,P)}e.accumulate=p;function f(I,L=(F,B)=>F===B,P){let F=!0,B;return s(I,U=>{let O=F||!L(U,B);return F=!1,B=U,O},P)}e.latch=f;function g(I,L,P){return[e.filter(I,L,P),e.filter(I,F=>!L(F),P)]}e.split=g;function m(I,L=!1,P=[],F){let B=P.slice(),U=I(C=>{B?B.push(C):j.fire(C)});F&&F.add(U);let O=()=>{B==null||B.forEach(C=>j.fire(C)),B=null},j=new K({onWillAddFirstListener(){U||(U=I(C=>j.fire(C)),F&&F.add(U))},onDidAddFirstListener(){B&&(L?setTimeout(O):O())},onDidRemoveLastListener(){U&&U.dispose(),U=null}});return F&&F.add(j),j.event}e.buffer=m;function _(I,L){return(P,F,B)=>{let U=L(new v);return I(function(O){let j=U.evaluate(O);j!==b&&P.call(F,j)},void 0,B)}}e.chain=_;let b=Symbol("HaltChainable");class v{constructor(){this.steps=[]}map(L){return this.steps.push(L),this}forEach(L){return this.steps.push(P=>(L(P),P)),this}filter(L){return this.steps.push(P=>L(P)?P:b),this}reduce(L,P){let F=P;return this.steps.push(B=>(F=L(F,B),F)),this}latch(L=(P,F)=>P===F){let P=!0,F;return this.steps.push(B=>{let U=P||!L(B,F);return P=!1,F=B,U?B:b}),this}evaluate(L){for(let P of this.steps)if(L=P(L),L===b)break;return L}}function S(I,L,P=F=>F){let F=(...j)=>O.fire(P(...j)),B=()=>I.on(L,F),U=()=>I.removeListener(L,F),O=new K({onWillAddFirstListener:B,onDidRemoveLastListener:U});return O.event}e.fromNodeEventEmitter=S;function w(I,L,P=F=>F){let F=(...j)=>O.fire(P(...j)),B=()=>I.addEventListener(L,F),U=()=>I.removeEventListener(L,F),O=new K({onWillAddFirstListener:B,onDidRemoveLastListener:U});return O.event}e.fromDOMEventEmitter=w;function k(I){return new Promise(L=>n(I)(L))}e.toPromise=k;function x(I){let L=new K;return I.then(P=>{L.fire(P)},()=>{L.fire(void 0)}).finally(()=>{L.dispose()}),L.event}e.fromPromise=x;function E(I,L){return I(P=>L.fire(P))}e.forward=E;function T(I,L,P){return L(P),I(F=>L(F))}e.runAndSubscribe=T;class D{constructor(L,P){this._observable=L,this._counter=0,this._hasChanged=!1;let F={onWillAddFirstListener:()=>{L.addObserver(this)},onDidRemoveLastListener:()=>{L.removeObserver(this)}};this.emitter=new K(F),P&&P.add(this.emitter)}beginUpdate(L){this._counter++}handlePossibleChange(L){}handleChange(L,P){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 A(I,L){return new D(I,L).emitter.event}e.fromObservable=A;function R(I){return(L,P,F)=>{let B=0,U=!1,O={beginUpdate(){B++},endUpdate(){B--,B===0&&(I.reportChanges(),U&&(U=!1,L.call(P)))},handlePossibleChange(){},handleChange(){U=!0}};I.addObserver(O),I.reportChanges();let j={dispose(){I.removeObserver(O)}};return F instanceof Ii?F.add(j):Array.isArray(F)&&F.push(j),j}}e.fromObservableLight=R})(At||(At={}));var Vm=class Gm{constructor(t){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${t}_${Gm._idPool++}`,Gm.all.add(this)}start(t){this._stopWatch=new QW,this.listenerCount=t}stop(){if(this._stopWatch){let t=this._stopWatch.elapsed();this.durations.push(t),this.elapsedOverall+=t,this.invocationCount+=1,this._stopWatch=void 0}}};Vm.all=new Set,Vm._idPool=0;var JW=Vm,e8=-1,HD=class VD{constructor(t,n,r=(VD._idPool++).toString(16).padStart(3,"0")){this._errorHandler=t,this.threshold=n,this.name=r,this._warnCountdown=0}dispose(){var t;(t=this._stacks)==null||t.clear()}check(t,n){let r=this.threshold;if(r<=0||n<r)return;this._stacks||(this._stacks=new Map);let i=this._stacks.get(t.value)||0;if(this._stacks.set(t.value,i+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=r*.5;let[s,o]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${n} listeners already. MOST frequent listener (${o}):`;console.warn(a),console.warn(s);let l=new r8(a,s);this._errorHandler(l)}return()=>{let s=this._stacks.get(t.value)||0;this._stacks.set(t.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let t,n=0;for(let[r,i]of this._stacks)(!t||n<i)&&(t=[r,i],n=i);return t}};HD._idPool=1;var t8=HD,n8=class GD{constructor(t){this.value=t}static create(){let t=new Error;return new GD(t.stack??"")}print(){console.warn(this.value.split(`
|
|
468
468
|
`).slice(2).join(`
|
|
469
|
-
`))}},r8=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},i8=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},s8=0,wf=class{constructor(e){this.value=e,this.id=s8++}},o8=2,a8,K=class{constructor(t){var n,r,i,s;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new t8((t==null?void 0:t.onListenerError)??Hu,((r=this._options)==null?void 0:r.leakWarningThreshold)??e8):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new JW(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,n,r,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||r.call(n),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,n,r)=>{var a,l,c,u,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new i8(`${p}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Hu)(g),_e.None}if(this._disposed)return _e.None;n&&(t=t.bind(n));let i=new wf(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=n8.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof wf?(this._deliveryQueue??(this._deliveryQueue=new l8),this._listeners=[this._listeners,i]):this._listeners.push(i):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=i,(d=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||d.call(u,this)),this._size++;let o=He(()=>{s==null||s(),this._removeListener(i)});return r instanceof Ii?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(t){var s,o,a,l;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||l.call(a,this),this._size=0;return}let n=this._listeners,r=n.indexOf(t);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*o8<=n.length){let c=0;for(let u=0;u<n.length;u++)n[u]?n[c++]=n[u]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=c}}_deliver(t,n){var i;if(!t)return;let r=((i=this._options)==null?void 0:i.onListenerError)||Hu;if(!r){t.value(n);return}try{t.value(n)}catch(s){r(s)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,r,i,s;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof wf)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},l8=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Wm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new K,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new K,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Wm.INSTANCE=new Wm;var Lv=Wm;function c8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Lv.INSTANCE.onDidChangeZoomLevel;function u8(e){return Lv.INSTANCE.getZoomFactor(e)}Lv.INSTANCE.onDidChangeFullscreen;var ha=typeof navigator=="object"?navigator.userAgent:"",qm=ha.indexOf("Firefox")>=0,d8=ha.indexOf("AppleWebKit")>=0,Dv=ha.indexOf("Chrome")>=0,h8=!Dv&&ha.indexOf("Safari")>=0;ha.indexOf("Electron/")>=0;ha.indexOf("Android")>=0;var xf=!1;if(typeof $r.matchMedia=="function"){let e=$r.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=$r.matchMedia("(display-mode: fullscreen)");xf=e.matches,c8($r,e,({matches:n})=>{xf&&t.matches||(xf=n)})}var Co="en",Km=!1,Ym=!1,Vu=!1,WD=!1,au,Gu=Co,B1=Co,p8,Vn,Ss=globalThis,Tt,sR;typeof Ss.vscode<"u"&&typeof Ss.vscode.process<"u"?Tt=Ss.vscode.process:typeof process<"u"&&typeof((sR=process==null?void 0:process.versions)==null?void 0:sR.node)=="string"&&(Tt=process);var oR,f8=typeof((oR=Tt==null?void 0:Tt.versions)==null?void 0:oR.electron)=="string",g8=f8&&(Tt==null?void 0:Tt.type)==="renderer",aR;if(typeof Tt=="object"){Km=Tt.platform==="win32",Ym=Tt.platform==="darwin",Vu=Tt.platform==="linux",Vu&&Tt.env.SNAP&&Tt.env.SNAP_REVISION,Tt.env.CI||Tt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,au=Co,Gu=Co;let e=Tt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);au=t.userLocale,B1=t.osLocale,Gu=t.resolvedLanguage||Co,p8=(aR=t.languagePack)==null?void 0:aR.translationsConfigFile}catch{}WD=!0}else typeof navigator=="object"&&!g8?(Vn=navigator.userAgent,Km=Vn.indexOf("Windows")>=0,Ym=Vn.indexOf("Macintosh")>=0,(Vn.indexOf("Macintosh")>=0||Vn.indexOf("iPad")>=0||Vn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Vu=Vn.indexOf("Linux")>=0,(Vn==null?void 0:Vn.indexOf("Mobi"))>=0,Gu=globalThis._VSCODE_NLS_LANGUAGE||Co,au=navigator.language.toLowerCase(),B1=au):console.error("Unable to resolve platform.");var qD=Km,xr=Ym,m8=Vu,j1=WD,Tr=Vn,si=Gu,b8;(e=>{function t(){return si}e.value=t;function n(){return si.length===2?si==="en":si.length>=3?si[0]==="e"&&si[1]==="n"&&si[2]==="-":!1}e.isDefaultVariant=n;function r(){return si==="en"}e.isDefault=r})(b8||(b8={}));var y8=typeof Ss.postMessage=="function"&&!Ss.importScripts;(()=>{if(y8){let e=[];Ss.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ss.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var v8=!!(Tr&&Tr.indexOf("Chrome")>=0);Tr&&Tr.indexOf("Firefox")>=0;!v8&&Tr&&Tr.indexOf("Safari")>=0;Tr&&Tr.indexOf("Edg/")>=0;Tr&&Tr.indexOf("Android")>=0;var ro=typeof navigator=="object"?navigator:{};j1||document.queryCommandSupported&&document.queryCommandSupported("copy")||ro&&ro.clipboard&&ro.clipboard.writeText,j1||ro&&ro.clipboard&&ro.clipboard.readText;var Mv=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}},Ef=new Mv,U1=new Mv,$1=new Mv,_8=new Array(230),KD;(e=>{function t(a){return Ef.keyCodeToStr(a)}e.toString=t;function n(a){return Ef.strToKeyCode(a)}e.fromString=n;function r(a){return U1.keyCodeToStr(a)}e.toUserSettingsUS=r;function i(a){return $1.keyCodeToStr(a)}e.toUserSettingsGeneral=i;function s(a){return U1.strToKeyCode(a)||$1.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ef.keyCodeToStr(a)}e.toElectronAccelerator=o})(KD||(KD={}));var S8=class YD{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof YD&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new w8([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},w8=class{constructor(e){if(e.length===0)throw qW("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function x8(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return KD.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(qm)switch(t){case 59:return 85;case 60:if(m8)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(xr)return 57;break}else if(d8&&(xr&&t===93||!xr&&t===92))return 57;return _8[t]||0}var E8=xr?256:2048,k8=512,C8=1024,T8=xr?2048:256,z1=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=x8(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=E8),this.altKey&&(t|=k8),this.shiftKey&&(t|=C8),this.metaKey&&(t|=T8),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new S8(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},H1=new WeakMap;function A8(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var R8=class{static getSameOriginWindowChain(e){let t=H1.get(e);if(!t){t=[],H1.set(e,t);let n=e,r;do r=A8(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},lu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=R8.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},V1=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Dv){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?qm&&!xr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")h8&&qD?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?qm&&!xr?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*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},XD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),N8;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof I8?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:At.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:XD})})(N8||(N8={}));var I8=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?XD:(this._emitter||(this._emitter=new K),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Pv=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 $m("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $m("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},O8=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new $m("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=He(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},L8;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(L8||(L8={}));var G1=class Tn{static fromArray(t){return new Tn(n=>{n.emitMany(t)})}static fromPromise(t){return new Tn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Tn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Tn(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new K,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await At.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Tn(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Tn.map(this,t)}static filter(t,n){return new Tn(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Tn.filter(this,t)}static coalesce(t){return Tn.filter(t,n=>!!n)}coalesce(){return Tn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Tn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};G1.EMPTY=G1.fromArray([]);var{getWindow:yr,getWindowId:D8,onDidRegisterWindow:M8}=function(){let e=new Map,t={window:$r,disposables:new Ii};e.set($r.vscodeWindowId,t);let n=new K,r=new K,i=new K;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return _e.None;let a=new Ii,l={window:o,disposables:a.add(new Ii)};return e.set(o.vscodeWindowId,l),a.add(He(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),a.add(de(o,bt.BEFORE_UNLOAD,()=>{i.fire(o)})),n.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let a=o;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l!=null&&l.view?l.view.window:$r},getDocument(o){return yr(o).document}}}(),P8=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function de(e,t,n,r){return new P8(e,t,n,r)}var W1=function(e,t,n,r){return de(e,t,n,r)},Fv,F8=class extends O8{constructor(e){super(),this.defaultTarget=e&&yr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},q1=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){Hu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(q1.sort),o.shift().execute();r.set(s,!1)};Fv=(s,o,a=0)=>{let l=D8(s),c=new q1(o,a),u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),n.get(l)||(n.set(l,!0),s.requestAnimationFrame(()=>i(l))),c}})();function B8(e){let t=e.getBoundingClientRect(),n=yr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var bt={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"},j8=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=tn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=tn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=tn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=tn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=tn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=tn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=tn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=tn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=tn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=tn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=tn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=tn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=tn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=tn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function tn(e){return typeof e=="number"?`${e}px`:e}function bl(e){return new j8(e)}var ZD=class{constructor(){this._hooks=new Ii,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(He(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=yr(e)}this._hooks.add(de(s,bt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(de(s,bt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function U8(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var ur;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ur||(ur={}));var Xa=class Mt extends _e{constructor(){super(),this.dispatched=!1,this.targets=new F1,this.ignoreTargets=new F1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(At.runAndSubscribe(M8,({window:t,disposables:n})=>{n.add(de(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(de(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(de(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:$r,disposables:this._store}))}static addTarget(t){if(!Mt.isTouchDevice())return _e.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let n=Mt.INSTANCE.targets.push(t);return He(n)}static ignoreTarget(t){if(!Mt.isTouchDevice())return _e.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let n=Mt.INSTANCE.ignoreTargets.push(t);return He(n)}static isTouchDevice(){return"ontouchstart"in $r||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(ur.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let a=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<Mt.HOLD_DELAY&&Math.abs(l.initialPageX-hn(l.rollingPageX))<30&&Math.abs(l.initialPageY-hn(l.rollingPageY))<30){let u=this.newGestureEvent(ur.Tap,l.initialTarget);u.pageX=hn(l.rollingPageX),u.pageY=hn(l.rollingPageY),this.dispatchEvent(u)}else if(c>=Mt.HOLD_DELAY&&Math.abs(l.initialPageX-hn(l.rollingPageX))<30&&Math.abs(l.initialPageY-hn(l.rollingPageY))<30){let u=this.newGestureEvent(ur.Contextmenu,l.initialTarget);u.pageX=hn(l.rollingPageX),u.pageY=hn(l.rollingPageY),this.dispatchEvent(u)}else if(i===1){let u=hn(l.rollingPageX),d=hn(l.rollingPageY),p=hn(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],g=d-l.rollingPageY[0],m=[...this.targets].filter(_=>l.initialTarget instanceof Node&&_.contains(l.initialTarget));this.inertia(t,m,r,Math.abs(f)/p,f>0?1:-1,u,Math.abs(g)/p,g>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ur.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===ur.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Mt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===ur.Change||t.type===ur.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,a,l,c){this.handle=Fv(t,()=>{let u=Date.now(),d=u-r,p=0,f=0,g=!0;i+=Mt.SCROLL_FRICTION*d,a+=Mt.SCROLL_FRICTION*d,i>0&&(g=!1,p=s*i*d),a>0&&(g=!1,f=l*a*d);let m=this.newGestureEvent(ur.Change);m.translationX=p,m.translationY=f,n.forEach(_=>_.dispatchEvent(m)),g||this.inertia(t,n,u,i,s,o+p,a,l,c+f)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(ur.Change,o.initialTarget);a.translationX=s.pageX-hn(o.rollingPageX),a.translationY=s.pageY-hn(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Xa.SCROLL_FRICTION=-.005,Xa.HOLD_DELAY=700,Xa.CLEAR_TAP_COUNT_TIME=400,Je([U8],Xa,"isTouchDevice",1);var $8=Xa,Bv=class extends _e{onclick(e,t){this._register(de(e,bt.CLICK,n=>t(new lu(yr(e),n))))}onmousedown(e,t){this._register(de(e,bt.MOUSE_DOWN,n=>t(new lu(yr(e),n))))}onmouseover(e,t){this._register(de(e,bt.MOUSE_OVER,n=>t(new lu(yr(e),n))))}onmouseleave(e,t){this._register(de(e,bt.MOUSE_LEAVE,n=>t(new lu(yr(e),n))))}onkeydown(e,t){this._register(de(e,bt.KEY_DOWN,n=>t(new z1(n))))}onkeyup(e,t){this._register(de(e,bt.KEY_UP,n=>t(new z1(n))))}oninput(e,t){this._register(de(e,bt.INPUT,t))}onblur(e,t){this._register(de(e,bt.BLUR,t))}onfocus(e,t){this._register(de(e,bt.FOCUS,t))}onchange(e,t){this._register(de(e,bt.CHANGE,t))}ignoreGesture(e){return $8.ignoreTarget(e)}},K1=11,z8=class extends Bv{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=K1+"px",this.domNode.style.height=K1+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ZD),this._register(W1(this.bgDomNode,bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(W1(this.domNode,bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new F8),this._pointerdownScheduleRepeatTimer=this._register(new Pv)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,yr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},H8=class Xm{constructor(t,n,r,i,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=i,this.rawScrollTop=a,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Xm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Xm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},V8=class extends _e{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new H8(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new X1(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=X1.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Y1=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function kf(e,t){let n=t-e;return function(r){return e+n*q8(r)}}function G8(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var X1=class Zm{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),G8(kf(t,i),kf(s,n),.33)}return kf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new Y1(r,i,!1)}return new Y1(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Zm.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Zm(t,n,i,r)}};function W8(e){return Math.pow(e,3)}function q8(e){return 1-W8(1-e)}var K8=class extends _e{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Pv)}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":"")))}},Y8=140,QD=class extends Bv{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 K8(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ZD),this._shouldRender=!0,this.domNode=bl(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(de(this.domNode.domNode,bt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new z8(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=bl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(de(this.slider.domNode,bt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=B8(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-n);if(qD&&o>Y8){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{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()}},JD=class Qm{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Qm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),a=Math.max(0,o-2*n),l=i>0&&i>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/i))),u=(a-c)/(i-r),d=s*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Qm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},X8=class extends QD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new JD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Z8=class extends QD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new JD(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Q8=500,Z1=50,J8=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Jm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Dv){let n=yr(t.browserEvent),r=u8(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new J8(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),l=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,a),1),u=Math.max(i,o),d=Math.max(s,a);u%l===0&&d%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Jm.INSTANCE=new Jm;var e9=Jm,t9=class extends Bv{constructor(e,t,n){super(),this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new K),this.onWillScroll=this._onWillScroll.event,this._options=r9(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Z8(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new X8(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=bl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Pv),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Is(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,xr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new V1(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Is(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new V1(n))};this._mouseWheelToDispose.push(de(this._listenOnDomNode,bt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=e9.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!xr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),c={};if(s){let u=Z1*s,d=l.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let u=Z1*o,d=l.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Q8)}},n9=class extends t9{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function r9(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,xr&&(t.className+=" mac"),t}var eb=class extends _e{constructor(e,t,n,r,i,s,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new V8({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Fv(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new n9(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(At.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(He(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(He(()=>this._styleElement.remove())),this._register(At.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
470
|
-
`)})),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(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};eb=Je([Q(2,Jt),Q(3,Qr),Q(4,LD),Q(5,da),Q(6,en),Q(7,Jr)],eb);var tb=class extends _e{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(He(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};tb=Je([Q(1,Jt),Q(2,Qr),Q(3,yc),Q(4,Jr)],tb);var i9=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},lr={full:0,left:0,center:0,right:0},oi={full:0,left:0,center:0,right:0},Fa={full:0,left:0,center:0,right:0},zd=class extends _e{constructor(e,t,n,r,i,s,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new i9,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(He(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;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);oi.full=this._canvas.width,oi.left=e,oi.center=t,oi.right=e,this._refreshDrawHeightConstants(),Fa.full=1,Fa.left=1,Fa.center=1+oi.left,Fa.right=1+oi.left+oi.center}_refreshDrawHeightConstants(){lr.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);lr.left=t,lr.center=t,lr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.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(Fa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-lr[e.position||"full"]/2),oi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+lr[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}))}};zd=Je([Q(2,Jt),Q(3,yc),Q(4,Jr),Q(5,en),Q(6,da),Q(7,Qr)],zd);var V;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
471
|
-
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(V||(V={}));var Wu;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Wu||(Wu={}));var e2;(e=>e.ST=`${V.ESC}\\`)(e2||(e2={}));var nb=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${V.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};nb=Je([Q(2,Jt),Q(3,en),Q(4,Ks),Q(5,Jr)],nb);var vt=0,_t=0,St=0,Ze=0,Q1={css:"#00000000",rgba:0},ot;(e=>{function t(i,s,o,a){return a!==void 0?`#${Ji(i)}${Ji(s)}${Ji(o)}${Ji(a)}`:`#${Ji(i)}${Ji(s)}${Ji(o)}`}e.toCss=t;function n(i,s,o,a=255){return(i<<24|s<<16|o<<8|a)>>>0}e.toRgba=n;function r(i,s,o,a){return{css:e.toCss(i,s,o,a),rgba:e.toRgba(i,s,o,a)}}e.toColor=r})(ot||(ot={}));var Be;(e=>{function t(l,c){if(Ze=(c.rgba&255)/255,Ze===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,p=c.rgba>>8&255,f=l.rgba>>24&255,g=l.rgba>>16&255,m=l.rgba>>8&255;vt=f+Math.round((u-f)*Ze),_t=g+Math.round((d-g)*Ze),St=m+Math.round((p-m)*Ze);let _=ot.toCss(vt,_t,St),b=ot.toRgba(vt,_t,St);return{css:_,rgba:b}}e.blend=t;function n(l){return(l.rgba&255)===255}e.isOpaque=n;function r(l,c,u){let d=qu.ensureContrastRatio(l.rgba,c.rgba,u);if(d)return ot.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function i(l){let c=(l.rgba|255)>>>0;return[vt,_t,St]=qu.toChannels(c),{css:ot.toCss(vt,_t,St),rgba:c}}e.opaque=i;function s(l,c){return Ze=Math.round(c*255),[vt,_t,St]=qu.toChannels(l.rgba),{css:ot.toCss(vt,_t,St,Ze),rgba:ot.toRgba(vt,_t,St,Ze)}}e.opacity=s;function o(l,c){return Ze=l.rgba&255,s(l,Ze*c/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(Be||(Be={}));var Ge;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return vt=parseInt(i.slice(1,2).repeat(2),16),_t=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),ot.toColor(vt,_t,St);case 5:return vt=parseInt(i.slice(1,2).repeat(2),16),_t=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),Ze=parseInt(i.slice(4,5).repeat(2),16),ot.toColor(vt,_t,St,Ze);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return vt=parseInt(s[1]),_t=parseInt(s[2]),St=parseInt(s[3]),Ze=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),ot.toColor(vt,_t,St,Ze);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[vt,_t,St,Ze]=t.getImageData(0,0,1,1).data,Ze!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ot.toRgba(vt,_t,St,Ze),css:i}}e.toColor=r})(Ge||(Ge={}));var Vt;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/255,a=i/255,l=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=n})(Vt||(Vt={}));var qu;(e=>{function t(o,a){if(Ze=(a&255)/255,Ze===1)return a;let l=a>>24&255,c=a>>16&255,u=a>>8&255,d=o>>24&255,p=o>>16&255,f=o>>8&255;return vt=d+Math.round((l-d)*Ze),_t=p+Math.round((c-p)*Ze),St=f+Math.round((u-f)*Ze),ot.toRgba(vt,_t,St)}e.blend=t;function n(o,a,l){let c=Vt.relativeLuminance(o>>8),u=Vt.relativeLuminance(a>>8);if(Mr(c,u)<l){if(u<c){let f=r(o,a,l),g=Mr(c,Vt.relativeLuminance(f>>8));if(g<l){let m=i(o,a,l),_=Mr(c,Vt.relativeLuminance(m>>8));return g>_?f:m}return f}let d=i(o,a,l),p=Mr(c,Vt.relativeLuminance(d>>8));if(p<l){let f=r(o,a,l),g=Mr(c,Vt.relativeLuminance(f>>8));return p>g?d:f}return d}}e.ensureContrastRatio=n;function r(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,p=a>>24&255,f=a>>16&255,g=a>>8&255,m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));for(;m<l&&(p>0||f>0||g>0);)p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),g-=Math.max(0,Math.ceil(g*.1)),m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));return(p<<24|f<<16|g<<8|255)>>>0}e.reduceLuminance=r;function i(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,p=a>>24&255,f=a>>16&255,g=a>>8&255,m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));for(;m<l&&(p<255||f<255||g<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));return(p<<24|f<<16|g<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(qu||(qu={}));function Ji(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var s9=class extends bc{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hd=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Bn}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-i>1){let u=this._getJoinedRanges(r,o,s,t,i);for(let d=0;d<u.length;d++)n.push(u[d])}i=c,o=s,a=this._workCell.fg,l=this._workCell.bg}s+=this._workCell.getChars().length||Si.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let u=0;u<c.length;u++)n.push(c[u])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(s);for(let c=0;c<l.length;c++)Hd._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let a=n;a<this._bufferService.cols;a++){let l=t.getWidth(a),c=t.getString(a).length||Si.length;if(l!==0){if(!i&&o[0]<=s&&(o[0]=a,i=!0),o[1]<=s){if(o[1]=a,o=e[++r],!o)break;o[0]<=s?(o[0]=a,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Hd=Je([Q(0,Jt)],Hd);function o9(e){return 57508<=e&&e<=57558}function a9(e){return 9472<=e&&e<=9631}function l9(e){return o9(e)||a9(e)}function c9(){return{css:{canvas:cu(),cell:cu()},device:{canvas:cu(),cell:cu(),char:{width:0,height:0,left:0,top:0}}}}function cu(){return{width:0,height:0}}var rb=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Bn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,a,l,c,u){let d=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,g=e.getNoBgTrimmedLength();n&&g<s+1&&(g=s+1);let m,_=0,b="",v=0,S=0,w=0,k=0,x=!1,E=0,T=!1,D=0,A=0,R=[],I=c!==-1&&u!==-1;for(let L=0;L<g;L++){e.loadCell(L,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let F=!1,B=L>=A,U=L,O=this._workCell;if(p.length>0&&L===p[0][0]&&B){let le=p.shift(),nt=this._isCellInSelection(le[0],t);for(v=le[0]+1;v<le[1];v++)B&&(B=nt===this._isCellInSelection(v,t));B&&(B=!n||s<le[0]||s>=le[1]),B?(F=!0,O=new s9(this._workCell,e.translateToString(!0,le[0],le[1]),le[1]-le[0]),U=le[1]-1,P=O.getWidth()):A=le[1]}let j=this._isCellInSelection(L,t),C=n&&L===s,z=I&&L>=c&&L<=u,Z=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,le=>{Z=!0});let M=O.getChars()||Si;if(M===" "&&(O.isUnderline()||O.isOverline())&&(M=" "),D=P*a-l.get(M,O.isBold(),O.isItalic()),!m)m=this._document.createElement("span");else if(_&&(j&&T||!j&&!T&&O.bg===S)&&(j&&T&&f.selectionForeground||O.fg===w)&&O.extended.ext===k&&z===x&&D===E&&!C&&!F&&!Z&&B){O.isInvisible()?b+=Si:b+=M,_++;continue}else _&&(m.textContent=b),m=this._document.createElement("span"),_=0,b="";if(S=O.bg,w=O.fg,k=O.extended.ext,x=z,E=D,T=j,F&&s>=L&&s<=U&&(s=L),!this._coreService.isCursorHidden&&C&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&R.push("xterm-cursor-blink"),R.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){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(O.isBold()&&R.push("xterm-bold"),O.isItalic()&&R.push("xterm-italic"),O.isDim()&&R.push("xterm-dim"),O.isInvisible()?b=Si:b=O.getChars()||Si,O.isUnderline()&&(R.push(`xterm-underline-${O.extended.underlineStyle}`),b===" "&&(b=" "),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${bc.toColorRGB(O.getUnderlineColor()).join(",")})`;else{let le=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&le<8&&(le+=8),m.style.textDecorationColor=f.ansi[le].css}O.isOverline()&&(R.push("xterm-overline"),b===" "&&(b=" ")),O.isStrikethrough()&&R.push("xterm-strikethrough"),z&&(m.style.textDecoration="underline");let se=O.getFgColor(),be=O.getFgColorMode(),$=O.getBgColor(),G=O.getBgColorMode(),ie=!!O.isInverse();if(ie){let le=se;se=$,$=le;let nt=be;be=G,G=nt}let ae,ce,ue=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,le=>{le.options.layer!=="top"&&ue||(le.backgroundColorRGB&&(G=50331648,$=le.backgroundColorRGB.rgba>>8&16777215,ae=le.backgroundColorRGB),le.foregroundColorRGB&&(be=50331648,se=le.foregroundColorRGB.rgba>>8&16777215,ce=le.foregroundColorRGB),ue=le.options.layer==="top")}),!ue&&j&&(ae=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,$=ae.rgba>>8&16777215,G=50331648,ue=!0,f.selectionForeground&&(be=50331648,se=f.selectionForeground.rgba>>8&16777215,ce=f.selectionForeground)),ue&&R.push("xterm-decoration-top");let pe;switch(G){case 16777216:case 33554432:pe=f.ansi[$],R.push(`xterm-bg-${$}`);break;case 50331648:pe=ot.toColor($>>16,$>>8&255,$&255),this._addStyle(m,`background-color:#${J1(($>>>0).toString(16),"0",6)}`);break;case 0:default:ie?(pe=f.foreground,R.push("xterm-bg-257")):pe=f.background}switch(ae||O.isDim()&&(ae=Be.multiplyOpacity(pe,.5)),be){case 16777216:case 33554432:O.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(m,pe,f.ansi[se],O,ae,void 0)||R.push(`xterm-fg-${se}`);break;case 50331648:let le=ot.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(m,pe,le,O,ae,ce)||this._addStyle(m,`color:#${J1(se.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,pe,f.foreground,O,ae,ce)||ie&&R.push("xterm-fg-257")}R.length&&(m.className=R.join(" "),R.length=0),!C&&!F&&!Z&&B?_++:m.textContent=b,D!==this.defaultSpacing&&(m.style.letterSpacing=`${D}px`),d.push(m),L=U}return m&&_&&(m.textContent=b),d}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||l9(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!i&&!s&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=Be.ensureContrastRatio(i||t,s||n,l),o.setColor((i||t).rgba,(s||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};rb=Je([Q(1,PD),Q(2,en),Q(3,Qr),Q(4,Ks),Q(5,yc),Q(6,da)],rb);function J1(e,t,n){for(;e.length<n;)e=t+e;return e}var u9=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},d9=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[1]-i,a=Math.max(s,0),l=Math.min(o,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function h9(){return new d9}var Cf="xterm-dom-renderer-owner-",Cn="xterm-rows",uu="xterm-fg-",eT="xterm-bg-",Ba="xterm-focus",du="xterm-selection",p9=1,ib=class extends _e{constructor(e,t,n,r,i,s,o,a,l,c,u,d,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=p,this._themeService=f,this._terminalClass=p9++,this._rowElements=[],this._selectionRenderModel=h9(),this.onRequestRedraw=this._register(new K).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Cn),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(du),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=c9(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(rb,document),this._element.classList.add(Cf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(He(()=>{this._element.classList.remove(Cf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new u9(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Cn} 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} .${Cn} { 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} .${Cn} .xterm-dim { color: ${Be.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${du} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${du} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${du} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${uu}${s} { color: ${o.css}; }${this._terminalSelector} .${uu}${s}.xterm-dim { color: ${Be.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${eT}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${uu}257 { color: ${Be.opaque(e.background).css}; }${this._terminalSelector} .${uu}257.xterm-dim { color: ${Be.multiplyOpacity(Be.opaque(e.background),.5).css}; }${this._terminalSelector} .${eT}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ba),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ba),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let l=e[0]>t[0];a.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],o-s+1))}else{let l=r===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));let u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){let d=i===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+n.ydisp,u=this._rowElements[l],d=n.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===r,o,a,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Cf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let g=f+a.ydisp,m=this._rowElements[f],_=a.lines.get(g);if(!m||!_)break;m.replaceChildren(...this._rowFactory.createRow(_,g,g===l,d,p,c,u,this.dimensions.css.cell.width,this._widthCache,s?f===n?e:0:-1,s?(f===r?t:i)-1:-1))}}};ib=Je([Q(7,Iv),Q(8,Gh),Q(9,en),Q(10,Jt),Q(11,Ks),Q(12,Qr),Q(13,da)],ib);var sb=class extends _e{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new K),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new g9(this._optionsService))}catch{this._measureStrategy=this._register(new f9(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())}};sb=Je([Q(2,en)],sb);var t2=class extends _e{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},f9=class extends t2{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},g9=class extends t2{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}},m9=class extends _e{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new b9(this._window)),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new K),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(At.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(de(this._textarea,"focus",()=>this._isFocused=!0)),this._register(de(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}},b9=class extends _e{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Xo),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(He(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=de(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)}},y9=class extends _e{constructor(){super(),this.linkProviders=[],this._register(He(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function jv(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function v9(e,t,n,r,i,s,o,a,l){if(!s)return;let c=jv(e,t,n);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var ob=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return v9(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=jv(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ob=Je([Q(0,Jr),Q(1,Gh)],ob);var _9=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},n2={};NW(n2,{getSafariVersion:()=>w9,isChromeOS:()=>o2,isFirefox:()=>r2,isIpad:()=>x9,isIphone:()=>E9,isLegacyEdge:()=>S9,isLinux:()=>Uv,isMac:()=>Vd,isNode:()=>Wh,isSafari:()=>i2,isWindows:()=>s2});var Wh=typeof process<"u"&&"title"in process,vc=Wh?"node":navigator.userAgent,_c=Wh?"node":navigator.platform,r2=vc.includes("Firefox"),S9=vc.includes("Edge"),i2=/^((?!chrome|android).)*safari/i.test(vc);function w9(){if(!i2)return 0;let e=vc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Vd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_c),x9=_c==="iPad",E9=_c==="iPhone",s2=["Windows","Win16","Win32","WinCE"].includes(_c),Uv=_c.indexOf("Linux")>=0,o2=/\bCrOS\b/.test(vc),a2=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},k9=class extends a2{_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())}}},C9=class extends a2{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Gd=!Wh&&"requestIdleCallback"in window?C9:k9,T9=class{constructor(){this._queue=new Gd}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ab=class extends _e{constructor(e,t,n,r,i,s,o,a,l){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=a,this._renderer=this._register(new Xo),this._pausedResizeTask=new T9,this._observerDisposable=this._register(new Xo),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 K),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new K),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new K),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _9((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new A9(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(He(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=He(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};ab=Je([Q(2,en),Q(3,Gh),Q(4,Ks),Q(5,yc),Q(6,Jt),Q(7,Qr),Q(8,da)],ab);var A9=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function R9(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return O9(i,s,e,t,n,r)+qh(s,t,n,r)+L9(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",Kl(Math.abs(i-e),ql(o,r));o=s>t?"D":"C";let a=Math.abs(s-t),l=I9(s>t?e:i,n)+(a-1)*n.cols+1+N9(s>t?i:e);return Kl(l,ql(o,r))}function N9(e,t){return e-1}function I9(e,t){return t.cols-e}function O9(e,t,n,r,i,s){return qh(t,r,i,s).length===0?"":Kl(c2(e,t,e,t-Os(t,i),!1,i).length,ql("D",s))}function qh(e,t,n,r){let i=e-Os(e,n),s=t-Os(t,n),o=Math.abs(i-s)-D9(e,t,n);return Kl(o,ql(l2(e,t),r))}function L9(e,t,n,r,i,s){let o;qh(t,r,i,s).length>0?o=r-Os(r,i):o=t;let a=r,l=M9(e,t,n,r,i,s);return Kl(c2(e,o,n,a,l==="C",i).length,ql(l,s))}function D9(e,t,n){var o;let r=0,i=e-Os(e,n),s=t-Os(t,n);for(let a=0;a<Math.abs(i-s);a++){let l=l2(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+l*a))!=null&&o.isWrapped&&r++}return r}function Os(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function M9(e,t,n,r,i,s){let o;return qh(n,r,i,s).length>0?o=r-Os(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function l2(e,t){return e>t?"A":"B"}function c2(e,t,n,r,i,s){let o=e,a=t,l="";for(;(o!==n||a!==r)&&a>=0&&a<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function ql(e,t){let n=t?"O":"[";return V.ESC+n+e}function Kl(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var P9=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function tT(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Tf=50,F9=15,B9=50,j9=500,U9=" ",$9=new RegExp(U9,"g"),lb=class extends _e{constructor(e,t,n,r,i,s,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Bn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new K),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new K),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new P9(this._bufferService),this._activeSelectionMode=0,this._register(He(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,i,s);r.push(a)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),a=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace($9," ")).join(s2?`\r
|
|
469
|
+
`))}},r8=class extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}},i8=class extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}},s8=0,wf=class{constructor(e){this.value=e,this.id=s8++}},o8=2,a8,K=class{constructor(t){var n,r,i,s;this._size=0,this._options=t,this._leakageMon=(n=this._options)!=null&&n.leakWarningThreshold?new t8((t==null?void 0:t.onListenerError)??Hu,((r=this._options)==null?void 0:r.leakWarningThreshold)??e8):void 0,this._perfMon=(i=this._options)!=null&&i._profName?new JW(this._options._profName):void 0,this._deliveryQueue=(s=this._options)==null?void 0:s.deliveryQueue}dispose(){var t,n,r,i;this._disposed||(this._disposed=!0,((t=this._deliveryQueue)==null?void 0:t.current)===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),(r=(n=this._options)==null?void 0:n.onDidRemoveLastListener)==null||r.call(n),(i=this._leakageMon)==null||i.dispose())}get event(){return this._event??(this._event=(t,n,r)=>{var a,l,c,u,d;if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let p=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(p);let f=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],g=new i8(`${p}. HINT: Stack shows most frequent listener (${f[1]}-times)`,f[0]);return(((a=this._options)==null?void 0:a.onListenerError)||Hu)(g),_e.None}if(this._disposed)return _e.None;n&&(t=t.bind(n));let i=new wf(t),s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(i.stack=n8.create(),s=this._leakageMon.check(i.stack,this._size+1)),this._listeners?this._listeners instanceof wf?(this._deliveryQueue??(this._deliveryQueue=new l8),this._listeners=[this._listeners,i]):this._listeners.push(i):((c=(l=this._options)==null?void 0:l.onWillAddFirstListener)==null||c.call(l,this),this._listeners=i,(d=(u=this._options)==null?void 0:u.onDidAddFirstListener)==null||d.call(u,this)),this._size++;let o=He(()=>{s==null||s(),this._removeListener(i)});return r instanceof Ii?r.add(o):Array.isArray(r)&&r.push(o),o}),this._event}_removeListener(t){var s,o,a,l;if((o=(s=this._options)==null?void 0:s.onWillRemoveListener)==null||o.call(s,this),!this._listeners)return;if(this._size===1){this._listeners=void 0,(l=(a=this._options)==null?void 0:a.onDidRemoveLastListener)==null||l.call(a,this),this._size=0;return}let n=this._listeners,r=n.indexOf(t);if(r===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,n[r]=void 0;let i=this._deliveryQueue.current===this;if(this._size*o8<=n.length){let c=0;for(let u=0;u<n.length;u++)n[u]?n[c++]=n[u]:i&&(this._deliveryQueue.end--,c<this._deliveryQueue.i&&this._deliveryQueue.i--);n.length=c}}_deliver(t,n){var i;if(!t)return;let r=((i=this._options)==null?void 0:i.onListenerError)||Hu;if(!r){t.value(n);return}try{t.value(n)}catch(s){r(s)}}_deliverQueue(t){let n=t.current._listeners;for(;t.i<t.end;)this._deliver(n[t.i++],t.value);t.reset()}fire(t){var n,r,i,s;if((n=this._deliveryQueue)!=null&&n.current&&(this._deliverQueue(this._deliveryQueue),(r=this._perfMon)==null||r.stop()),(i=this._perfMon)==null||i.start(this._size),this._listeners)if(this._listeners instanceof wf)this._deliver(this._listeners,t);else{let o=this._deliveryQueue;o.enqueue(this,t,this._listeners.length),this._deliverQueue(o)}(s=this._perfMon)==null||s.stop()}hasListeners(){return this._size>0}},l8=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},Wm=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new K,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new K,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(t){return this.mapWindowIdToZoomLevel.get(this.getWindowId(t))??0}setZoomLevel(t,n){if(this.getZoomLevel(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToZoomLevel.set(r,t),this._onDidChangeZoomLevel.fire(r)}getZoomFactor(t){return this.mapWindowIdToZoomFactor.get(this.getWindowId(t))??1}setZoomFactor(t,n){this.mapWindowIdToZoomFactor.set(this.getWindowId(n),t)}setFullscreen(t,n){if(this.isFullscreen(n)===t)return;let r=this.getWindowId(n);this.mapWindowIdToFullScreen.set(r,t),this._onDidChangeFullscreen.fire(r)}isFullscreen(t){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(t))}getWindowId(t){return t.vscodeWindowId}};Wm.INSTANCE=new Wm;var Lv=Wm;function c8(e,t,n){typeof t=="string"&&(t=e.matchMedia(t)),t.addEventListener("change",n)}Lv.INSTANCE.onDidChangeZoomLevel;function u8(e){return Lv.INSTANCE.getZoomFactor(e)}Lv.INSTANCE.onDidChangeFullscreen;var ha=typeof navigator=="object"?navigator.userAgent:"",qm=ha.indexOf("Firefox")>=0,d8=ha.indexOf("AppleWebKit")>=0,Dv=ha.indexOf("Chrome")>=0,h8=!Dv&&ha.indexOf("Safari")>=0;ha.indexOf("Electron/")>=0;ha.indexOf("Android")>=0;var xf=!1;if(typeof $r.matchMedia=="function"){let e=$r.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),t=$r.matchMedia("(display-mode: fullscreen)");xf=e.matches,c8($r,e,({matches:n})=>{xf&&t.matches||(xf=n)})}var Co="en",Km=!1,Ym=!1,Vu=!1,WD=!1,au,Gu=Co,B1=Co,p8,Vn,Ss=globalThis,Tt,sR;typeof Ss.vscode<"u"&&typeof Ss.vscode.process<"u"?Tt=Ss.vscode.process:typeof process<"u"&&typeof((sR=process==null?void 0:process.versions)==null?void 0:sR.node)=="string"&&(Tt=process);var oR,f8=typeof((oR=Tt==null?void 0:Tt.versions)==null?void 0:oR.electron)=="string",g8=f8&&(Tt==null?void 0:Tt.type)==="renderer",aR;if(typeof Tt=="object"){Km=Tt.platform==="win32",Ym=Tt.platform==="darwin",Vu=Tt.platform==="linux",Vu&&Tt.env.SNAP&&Tt.env.SNAP_REVISION,Tt.env.CI||Tt.env.BUILD_ARTIFACTSTAGINGDIRECTORY,au=Co,Gu=Co;let e=Tt.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);au=t.userLocale,B1=t.osLocale,Gu=t.resolvedLanguage||Co,p8=(aR=t.languagePack)==null?void 0:aR.translationsConfigFile}catch{}WD=!0}else typeof navigator=="object"&&!g8?(Vn=navigator.userAgent,Km=Vn.indexOf("Windows")>=0,Ym=Vn.indexOf("Macintosh")>=0,(Vn.indexOf("Macintosh")>=0||Vn.indexOf("iPad")>=0||Vn.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Vu=Vn.indexOf("Linux")>=0,(Vn==null?void 0:Vn.indexOf("Mobi"))>=0,Gu=globalThis._VSCODE_NLS_LANGUAGE||Co,au=navigator.language.toLowerCase(),B1=au):console.error("Unable to resolve platform.");var qD=Km,xr=Ym,m8=Vu,j1=WD,Tr=Vn,si=Gu,b8;(e=>{function t(){return si}e.value=t;function n(){return si.length===2?si==="en":si.length>=3?si[0]==="e"&&si[1]==="n"&&si[2]==="-":!1}e.isDefaultVariant=n;function r(){return si==="en"}e.isDefault=r})(b8||(b8={}));var y8=typeof Ss.postMessage=="function"&&!Ss.importScripts;(()=>{if(y8){let e=[];Ss.addEventListener("message",n=>{if(n.data&&n.data.vscodeScheduleAsyncWork)for(let r=0,i=e.length;r<i;r++){let s=e[r];if(s.id===n.data.vscodeScheduleAsyncWork){e.splice(r,1),s.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Ss.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})();var v8=!!(Tr&&Tr.indexOf("Chrome")>=0);Tr&&Tr.indexOf("Firefox")>=0;!v8&&Tr&&Tr.indexOf("Safari")>=0;Tr&&Tr.indexOf("Edg/")>=0;Tr&&Tr.indexOf("Android")>=0;var ro=typeof navigator=="object"?navigator:{};j1||document.queryCommandSupported&&document.queryCommandSupported("copy")||ro&&ro.clipboard&&ro.clipboard.writeText,j1||ro&&ro.clipboard&&ro.clipboard.readText;var Mv=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}},Ef=new Mv,U1=new Mv,$1=new Mv,_8=new Array(230),KD;(e=>{function t(a){return Ef.keyCodeToStr(a)}e.toString=t;function n(a){return Ef.strToKeyCode(a)}e.fromString=n;function r(a){return U1.keyCodeToStr(a)}e.toUserSettingsUS=r;function i(a){return $1.keyCodeToStr(a)}e.toUserSettingsGeneral=i;function s(a){return U1.strToKeyCode(a)||$1.strToKeyCode(a)}e.fromUserSettings=s;function o(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return Ef.keyCodeToStr(a)}e.toElectronAccelerator=o})(KD||(KD={}));var S8=class YD{constructor(t,n,r,i,s){this.ctrlKey=t,this.shiftKey=n,this.altKey=r,this.metaKey=i,this.keyCode=s}equals(t){return t instanceof YD&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){let t=this.ctrlKey?"1":"0",n=this.shiftKey?"1":"0",r=this.altKey?"1":"0",i=this.metaKey?"1":"0";return`K${t}${n}${r}${i}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new w8([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},w8=class{constructor(e){if(e.length===0)throw qW("chords");this.chords=e}getHashCode(){let e="";for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=";"),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function x8(e){if(e.charCode){let n=String.fromCharCode(e.charCode).toUpperCase();return KD.fromString(n)}let t=e.keyCode;if(t===3)return 7;if(qm)switch(t){case 59:return 85;case 60:if(m8)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(xr)return 57;break}else if(d8&&(xr&&t===93||!xr&&t===92))return 57;return _8[t]||0}var E8=xr?256:2048,k8=512,C8=1024,T8=xr?2048:256,z1=class{constructor(e){var n;this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=(n=t.getModifierState)==null?void 0:n.call(t,"AltGraph"),this.keyCode=x8(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=E8),this.altKey&&(t|=k8),this.shiftKey&&(t|=C8),this.metaKey&&(t|=T8),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new S8(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},H1=new WeakMap;function A8(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!=="null"&&n.origin!=="null"&&t.origin!==n.origin)return null}catch{return null}return e.parent}var R8=class{static getSameOriginWindowChain(e){let t=H1.get(e);if(!t){t=[],H1.set(e,t);let n=e,r;do r=A8(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let s of i){let o=s.window.deref();if(n+=(o==null?void 0:o.scrollY)??0,r+=(o==null?void 0:o.scrollX)??0,o===t||!s.iframeElement)break;let a=s.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},lu=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=R8.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},V1=class{constructor(e,t=0,n=0){var i;this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(Dv){let s=navigator.userAgent.match(/Chrome\/(\d+)/);r=(s?parseInt(s[1]):123)<=122}if(e){let s=e,o=e,a=((i=e.view)==null?void 0:i.devicePixelRatio)||1;if(typeof s.wheelDeltaY<"u")r?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof o.VERTICAL_AXIS<"u"&&o.axis===o.VERTICAL_AXIS)this.deltaY=-o.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?qm&&!xr?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")h8&&qD?this.deltaX=-(s.wheelDeltaX/120):r?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof o.HORIZONTAL_AXIS<"u"&&o.axis===o.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){let l=e;l.deltaMode===l.DOM_DELTA_LINE?qm&&!xr?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*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){var e;(e=this.browserEvent)==null||e.preventDefault()}stopPropagation(){var e;(e=this.browserEvent)==null||e.stopPropagation()}},XD=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),N8;(e=>{function t(n){return n===e.None||n===e.Cancelled||n instanceof I8?!0:!n||typeof n!="object"?!1:typeof n.isCancellationRequested=="boolean"&&typeof n.onCancellationRequested=="function"}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:At.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:XD})})(N8||(N8={}));var I8=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?XD:(this._emitter||(this._emitter=new K),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}},Pv=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 $m("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $m("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},O8=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){var e;(e=this.disposable)==null||e.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new $m("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=He(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}},L8;(e=>{async function t(r){let i,s=await Promise.all(r.map(o=>o.then(a=>a,a=>{i||(i=a)})));if(typeof i<"u")throw i;return s}e.settled=t;function n(r){return new Promise(async(i,s)=>{try{await r(i,s)}catch(o){s(o)}})}e.withAsyncBody=n})(L8||(L8={}));var G1=class Tn{static fromArray(t){return new Tn(n=>{n.emitMany(t)})}static fromPromise(t){return new Tn(async n=>{n.emitMany(await t)})}static fromPromises(t){return new Tn(async n=>{await Promise.all(t.map(async r=>n.emitOne(await r)))})}static merge(t){return new Tn(async n=>{await Promise.all(t.map(async r=>{for await(let i of r)n.emitOne(i)}))})}constructor(t,n){this._state=0,this._results=[],this._error=null,this._onReturn=n,this._onStateChanged=new K,queueMicrotask(async()=>{let r={emitOne:i=>this.emitOne(i),emitMany:i=>this.emitMany(i),reject:i=>this.reject(i)};try{await Promise.resolve(t(r)),this.resolve()}catch(i){this.reject(i)}finally{r.emitOne=void 0,r.emitMany=void 0,r.reject=void 0}})}[Symbol.asyncIterator](){let t=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(t<this._results.length)return{done:!1,value:this._results[t++]};if(this._state===1)return{done:!0,value:void 0};await At.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>{var n;return(n=this._onReturn)==null||n.call(this),{done:!0,value:void 0}}}}static map(t,n){return new Tn(async r=>{for await(let i of t)r.emitOne(n(i))})}map(t){return Tn.map(this,t)}static filter(t,n){return new Tn(async r=>{for await(let i of t)n(i)&&r.emitOne(i)})}filter(t){return Tn.filter(this,t)}static coalesce(t){return Tn.filter(t,n=>!!n)}coalesce(){return Tn.coalesce(this)}static async toPromise(t){let n=[];for await(let r of t)n.push(r);return n}toPromise(){return Tn.toPromise(this)}emitOne(t){this._state===0&&(this._results.push(t),this._onStateChanged.fire())}emitMany(t){this._state===0&&(this._results=this._results.concat(t),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(t){this._state===0&&(this._state=2,this._error=t,this._onStateChanged.fire())}};G1.EMPTY=G1.fromArray([]);var{getWindow:yr,getWindowId:D8,onDidRegisterWindow:M8}=function(){let e=new Map,t={window:$r,disposables:new Ii};e.set($r.vscodeWindowId,t);let n=new K,r=new K,i=new K;function s(o,a){return(typeof o=="number"?e.get(o):void 0)??(a?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(o){if(e.has(o.vscodeWindowId))return _e.None;let a=new Ii,l={window:o,disposables:a.add(new Ii)};return e.set(o.vscodeWindowId,l),a.add(He(()=>{e.delete(o.vscodeWindowId),r.fire(o)})),a.add(de(o,bt.BEFORE_UNLOAD,()=>{i.fire(o)})),n.fire(l),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(o){return o.vscodeWindowId},hasWindow(o){return e.has(o)},getWindowById:s,getWindow(o){var c;let a=o;if((c=a==null?void 0:a.ownerDocument)!=null&&c.defaultView)return a.ownerDocument.defaultView.window;let l=o;return l!=null&&l.view?l.view.window:$r},getDocument(o){return yr(o).document}}}(),P8=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}};function de(e,t,n,r){return new P8(e,t,n,r)}var W1=function(e,t,n,r){return de(e,t,n,r)},Fv,F8=class extends O8{constructor(e){super(),this.defaultTarget=e&&yr(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},q1=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){Hu(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=s=>{n.set(s,!1);let o=e.get(s)??[];for(t.set(s,o),e.set(s,[]),r.set(s,!0);o.length>0;)o.sort(q1.sort),o.shift().execute();r.set(s,!1)};Fv=(s,o,a=0)=>{let l=D8(s),c=new q1(o,a),u=e.get(l);return u||(u=[],e.set(l,u)),u.push(c),n.get(l)||(n.set(l,!0),s.requestAnimationFrame(()=>i(l))),c}})();function B8(e){let t=e.getBoundingClientRect(),n=yr(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}var bt={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"},j8=class{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingTop="",this._paddingLeft="",this._paddingBottom="",this._paddingRight="",this._fontFamily="",this._fontWeight="",this._fontSize="",this._fontStyle="",this._fontFeatureSettings="",this._fontVariationSettings="",this._textDecoration="",this._lineHeight="",this._letterSpacing="",this._className="",this._display="",this._position="",this._visibility="",this._color="",this._backgroundColor="",this._layerHint=!1,this._contain="none",this._boxShadow=""}setMaxWidth(e){let t=tn(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=tn(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=tn(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=tn(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=tn(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=tn(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=tn(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=tn(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=tn(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=tn(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=tn(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=tn(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=tn(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=tn(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?"translate3d(0px, 0px, 0px)":"")}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function tn(e){return typeof e=="number"?`${e}px`:e}function bl(e){return new j8(e)}var ZD=class{constructor(){this._hooks=new Ii,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let s=e;try{e.setPointerCapture(t),this._hooks.add(He(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{s=yr(e)}this._hooks.add(de(s,bt.POINTER_MOVE,o=>{if(o.buttons!==n){this.stopMonitoring(!0);return}o.preventDefault(),this._pointerMoveCallback(o)})),this._hooks.add(de(s,bt.POINTER_UP,o=>this.stopMonitoring(!0)))}};function U8(e,t,n){let r=null,i=null;if(typeof n.value=="function"?(r="value",i=n.value,i.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof n.get=="function"&&(r="get",i=n.get),!i)throw new Error("not supported");let s=`$memoize$${t}`;n[r]=function(...o){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,o)}),this[s]}}var ur;(e=>(e.Tap="-xterm-gesturetap",e.Change="-xterm-gesturechange",e.Start="-xterm-gesturestart",e.End="-xterm-gesturesend",e.Contextmenu="-xterm-gesturecontextmenu"))(ur||(ur={}));var Xa=class Mt extends _e{constructor(){super(),this.dispatched=!1,this.targets=new F1,this.ignoreTargets=new F1,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(At.runAndSubscribe(M8,({window:t,disposables:n})=>{n.add(de(t.document,"touchstart",r=>this.onTouchStart(r),{passive:!1})),n.add(de(t.document,"touchend",r=>this.onTouchEnd(t,r))),n.add(de(t.document,"touchmove",r=>this.onTouchMove(r),{passive:!1}))},{window:$r,disposables:this._store}))}static addTarget(t){if(!Mt.isTouchDevice())return _e.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let n=Mt.INSTANCE.targets.push(t);return He(n)}static ignoreTarget(t){if(!Mt.isTouchDevice())return _e.None;Mt.INSTANCE||(Mt.INSTANCE=new Mt);let n=Mt.INSTANCE.ignoreTargets.push(t);return He(n)}static isTouchDevice(){return"ontouchstart"in $r||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(t){let n=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let r=0,i=t.targetTouches.length;r<i;r++){let s=t.targetTouches.item(r);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:n,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[n],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};let o=this.newGestureEvent(ur.Start,s.target);o.pageX=s.pageX,o.pageY=s.pageY,this.dispatchEvent(o)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let s=0,o=n.changedTouches.length;s<o;s++){let a=n.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}let l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<Mt.HOLD_DELAY&&Math.abs(l.initialPageX-hn(l.rollingPageX))<30&&Math.abs(l.initialPageY-hn(l.rollingPageY))<30){let u=this.newGestureEvent(ur.Tap,l.initialTarget);u.pageX=hn(l.rollingPageX),u.pageY=hn(l.rollingPageY),this.dispatchEvent(u)}else if(c>=Mt.HOLD_DELAY&&Math.abs(l.initialPageX-hn(l.rollingPageX))<30&&Math.abs(l.initialPageY-hn(l.rollingPageY))<30){let u=this.newGestureEvent(ur.Contextmenu,l.initialTarget);u.pageX=hn(l.rollingPageX),u.pageY=hn(l.rollingPageY),this.dispatchEvent(u)}else if(i===1){let u=hn(l.rollingPageX),d=hn(l.rollingPageY),p=hn(l.rollingTimestamps)-l.rollingTimestamps[0],f=u-l.rollingPageX[0],g=d-l.rollingPageY[0],m=[...this.targets].filter(_=>l.initialTarget instanceof Node&&_.contains(l.initialTarget));this.inertia(t,m,r,Math.abs(f)/p,f>0?1:-1,u,Math.abs(g)/p,g>0?1:-1,d)}this.dispatchEvent(this.newGestureEvent(ur.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(n.preventDefault(),n.stopPropagation(),this.dispatched=!1)}newGestureEvent(t,n){let r=document.createEvent("CustomEvent");return r.initEvent(t,!1,!0),r.initialTarget=n,r.tapCount=0,r}dispatchEvent(t){if(t.type===ur.Tap){let n=new Date().getTime(),r=0;n-this._lastSetTapCountTime>Mt.CLEAR_TAP_COUNT_TIME?r=1:r=2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===ur.Change||t.type===ur.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let r of this.ignoreTargets)if(r.contains(t.initialTarget))return;let n=[];for(let r of this.targets)if(r.contains(t.initialTarget)){let i=0,s=t.initialTarget;for(;s&&s!==r;)i++,s=s.parentElement;n.push([i,r])}n.sort((r,i)=>r[0]-i[0]);for(let[r,i]of n)i.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,s,o,a,l,c){this.handle=Fv(t,()=>{let u=Date.now(),d=u-r,p=0,f=0,g=!0;i+=Mt.SCROLL_FRICTION*d,a+=Mt.SCROLL_FRICTION*d,i>0&&(g=!1,p=s*i*d),a>0&&(g=!1,f=l*a*d);let m=this.newGestureEvent(ur.Change);m.translationX=p,m.translationY=f,n.forEach(_=>_.dispatchEvent(m)),g||this.inertia(t,n,u,i,s,o+p,a,l,c+f)})}onTouchMove(t){let n=Date.now();for(let r=0,i=t.changedTouches.length;r<i;r++){let s=t.changedTouches.item(r);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}let o=this.activeTouches[s.identifier],a=this.newGestureEvent(ur.Change,o.initialTarget);a.translationX=s.pageX-hn(o.rollingPageX),a.translationY=s.pageY-hn(o.rollingPageY),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),o.rollingPageX.length>3&&(o.rollingPageX.shift(),o.rollingPageY.shift(),o.rollingTimestamps.shift()),o.rollingPageX.push(s.pageX),o.rollingPageY.push(s.pageY),o.rollingTimestamps.push(n)}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}};Xa.SCROLL_FRICTION=-.005,Xa.HOLD_DELAY=700,Xa.CLEAR_TAP_COUNT_TIME=400,et([U8],Xa,"isTouchDevice",1);var $8=Xa,Bv=class extends _e{onclick(e,t){this._register(de(e,bt.CLICK,n=>t(new lu(yr(e),n))))}onmousedown(e,t){this._register(de(e,bt.MOUSE_DOWN,n=>t(new lu(yr(e),n))))}onmouseover(e,t){this._register(de(e,bt.MOUSE_OVER,n=>t(new lu(yr(e),n))))}onmouseleave(e,t){this._register(de(e,bt.MOUSE_LEAVE,n=>t(new lu(yr(e),n))))}onkeydown(e,t){this._register(de(e,bt.KEY_DOWN,n=>t(new z1(n))))}onkeyup(e,t){this._register(de(e,bt.KEY_UP,n=>t(new z1(n))))}oninput(e,t){this._register(de(e,bt.INPUT,t))}onblur(e,t){this._register(de(e,bt.BLUR,t))}onfocus(e,t){this._register(de(e,bt.FOCUS,t))}onchange(e,t){this._register(de(e,bt.CHANGE,t))}ignoreGesture(e){return $8.ignoreTarget(e)}},K1=11,z8=class extends Bv{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.style.position="absolute",this.domNode.style.width=K1+"px",this.domNode.style.height=K1+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new ZD),this._register(W1(this.bgDomNode,bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(W1(this.domNode,bt.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new F8),this._pointerdownScheduleRepeatTimer=this._register(new Pv)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,yr(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}},H8=class Xm{constructor(t,n,r,i,s,o,a){this._forceIntegerValues=t,this._scrollStateBrand=void 0,this._forceIntegerValues&&(n=n|0,r=r|0,i=i|0,s=s|0,o=o|0,a=a|0),this.rawScrollLeft=i,this.rawScrollTop=a,n<0&&(n=0),i+n>r&&(i=r-n),i<0&&(i=0),s<0&&(s=0),a+s>o&&(a=o-s),a<0&&(a=0),this.width=n,this.scrollWidth=r,this.scrollLeft=i,this.height=s,this.scrollHeight=o,this.scrollTop=a}equals(t){return this.rawScrollLeft===t.rawScrollLeft&&this.rawScrollTop===t.rawScrollTop&&this.width===t.width&&this.scrollWidth===t.scrollWidth&&this.scrollLeft===t.scrollLeft&&this.height===t.height&&this.scrollHeight===t.scrollHeight&&this.scrollTop===t.scrollTop}withScrollDimensions(t,n){return new Xm(this._forceIntegerValues,typeof t.width<"u"?t.width:this.width,typeof t.scrollWidth<"u"?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<"u"?t.height:this.height,typeof t.scrollHeight<"u"?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new Xm(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<"u"?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<"u"?t.scrollTop:this.rawScrollTop)}createScrollEvent(t,n){let r=this.width!==t.width,i=this.scrollWidth!==t.scrollWidth,s=this.scrollLeft!==t.scrollLeft,o=this.height!==t.height,a=this.scrollHeight!==t.scrollHeight,l=this.scrollTop!==t.scrollTop;return{inSmoothScrolling:n,oldWidth:t.width,oldScrollWidth:t.scrollWidth,oldScrollLeft:t.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:t.height,oldScrollHeight:t.scrollHeight,oldScrollTop:t.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:r,scrollWidthChanged:i,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:a,scrollTopChanged:l}}},V8=class extends _e{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new H8(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var r;let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),(r=this._smoothScrolling)==null||r.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;t?r=new X1(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):r=this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let n=this._state.withScrollPosition(e);this._smoothScrolling=X1.start(this._state,n,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},Y1=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function kf(e,t){let n=t-e;return function(r){return e+n*q8(r)}}function G8(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var X1=class Zm{constructor(t,n,r,i){this.from=t,this.to=n,this.duration=i,this.startTime=r,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(t,n,r){if(Math.abs(t-n)>2.5*r){let i,s;return t<n?(i=t+.75*r,s=n-.75*r):(i=t-.75*r,s=n+.75*r),G8(kf(t,i),kf(s,n),.33)}return kf(t,n)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(t){this.to=t.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(t){let n=(t-this.startTime)/this.duration;if(n<1){let r=this.scrollLeft(n),i=this.scrollTop(n);return new Y1(r,i,!1)}return new Y1(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return Zm.start(t,n,r)}static start(t,n,r){r=r+10;let i=Date.now()-10;return new Zm(t,n,i,r)}};function W8(e){return Math.pow(e,3)}function q8(e){return 1-W8(1-e)}var K8=class extends _e{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new Pv)}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":"")))}},Y8=140,QD=class extends Bv{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 K8(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new ZD),this._shouldRender=!0,this.domNode=bl(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(de(this.domNode.domNode,bt.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){let t=this._register(new z8(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=bl(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof n=="number"&&this.slider.setWidth(n),typeof r=="number"&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(de(this.slider.domNode,bt.POINTER_DOWN,i=>{i.button===0&&(i.preventDefault(),this._sliderPointerDown(i))})),this.onclick(this.slider.domNode,i=>{i.leftButton&&i.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,n=e.offsetY;else{let i=B8(this.domNode.domNode);t=e.pageX-i.left,n=e.pageY-i.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{let s=this._sliderOrthogonalPointerPosition(i),o=Math.abs(s-n);if(qD&&o>Y8){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let a=this._sliderPointerPosition(i)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(a))},()=>{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()}},JD=class Qm{constructor(t,n,r,i,s,o){this._scrollbarSize=Math.round(n),this._oppositeScrollbarSize=Math.round(r),this._arrowSize=Math.round(t),this._visibleSize=i,this._scrollSize=s,this._scrollPosition=o,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new Qm(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(t){let n=Math.round(t);return this._visibleSize!==n?(this._visibleSize=n,this._refreshComputedValues(),!0):!1}setScrollSize(t){let n=Math.round(t);return this._scrollSize!==n?(this._scrollSize=n,this._refreshComputedValues(),!0):!1}setScrollPosition(t){let n=Math.round(t);return this._scrollPosition!==n?(this._scrollPosition=n,this._refreshComputedValues(),!0):!1}setScrollbarSize(t){this._scrollbarSize=Math.round(t)}setOppositeScrollbarSize(t){this._oppositeScrollbarSize=Math.round(t)}static _computeValues(t,n,r,i,s){let o=Math.max(0,r-t),a=Math.max(0,o-2*n),l=i>0&&i>r;if(!l)return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(r*a/i))),u=(a-c)/(i-r),d=s*u;return{computedAvailableSize:Math.round(o),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:u,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){let t=Qm._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize-this._computedSliderSize/2;return Math.round(n/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(t){if(!this._computedIsNeeded)return 0;let n=t-this._arrowSize,r=this._scrollPosition;return n<this._computedSliderPosition?r-=this._visibleSize:r+=this._visibleSize,r}getDesiredScrollPositionFromDelta(t){if(!this._computedIsNeeded)return 0;let n=this._computedSliderPosition+t;return Math.round(n/this._computedSliderRatio)}},X8=class extends QD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new JD(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Z8=class extends QD{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new JD(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw new Error("horizontalHasArrows is not supported in xterm.js");this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},Q8=500,Z1=50,J8=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Jm=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let t=1,n=0,r=1,i=this._rear;do{let s=i===this._front?t:Math.pow(2,-r);if(t-=s,n+=this._memory[i].score*s,i===this._front)break;i=(this._capacity+i-1)%this._capacity,r++}while(!0);return n<=.5}acceptStandardWheelEvent(t){if(Dv){let n=yr(t.browserEvent),r=u8(n);this.accept(Date.now(),t.deltaX*r,t.deltaY*r)}else this.accept(Date.now(),t.deltaX,t.deltaY)}accept(t,n,r){let i=null,s=new J8(t,n,r);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(i=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,i)}_computeScore(t,n){if(Math.abs(t.deltaX)>0&&Math.abs(t.deltaY)>0)return 1;let r=.5;if((!this._isAlmostInt(t.deltaX)||!this._isAlmostInt(t.deltaY))&&(r+=.25),n){let i=Math.abs(t.deltaX),s=Math.abs(t.deltaY),o=Math.abs(n.deltaX),a=Math.abs(n.deltaY),l=Math.max(Math.min(i,o),1),c=Math.max(Math.min(s,a),1),u=Math.max(i,o),d=Math.max(s,a);u%l===0&&d%c===0&&(r-=.5)}return Math.min(Math.max(r,0),1)}_isAlmostInt(t){return Math.abs(Math.round(t)-t)<.01}};Jm.INSTANCE=new Jm;var e9=Jm,t9=class extends Bv{constructor(e,t,n){super(),this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new K),this.onWillScroll=this._onWillScroll.event,this._options=r9(t),this._scrollable=n,this._register(this._scrollable.onScroll(i=>{this._onWillScroll.fire(i),this._onDidScroll(i),this._onScroll.fire(i)}));let r={onMouseWheel:i=>this._onMouseWheel(i),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Z8(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new X8(this._scrollable,this._options,r)),this._domNode=document.createElement("div"),this._domNode.className="xterm-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=bl(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=bl(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=bl(document.createElement("div")),this._topLeftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,i=>this._onMouseOver(i)),this.onmouseleave(this._listenOnDomNode,i=>this._onMouseLeave(i)),this._hideTimeout=this._register(new Pv),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=Is(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,xr&&(this._options.className+=" mac"),this._domNode.className="xterm-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new V1(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=Is(this._mouseWheelToDispose),e)){let t=n=>{this._onMouseWheel(new V1(n))};this._mouseWheelToDispose.push(de(this._listenOnDomNode,bt.MOUSE_WHEEL,t,{passive:!1}))}}_onMouseWheel(e){var i;if((i=e.browserEvent)!=null&&i.defaultPrevented)return;let t=e9.INSTANCE;t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,o=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&o+s===0?o=s=0:Math.abs(s)>=Math.abs(o)?o=0:s=0),this._options.flipAxes&&([s,o]=[o,s]);let a=!xr&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!o&&(o=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(o=o*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);let l=this._scrollable.getFutureScrollPosition(),c={};if(s){let u=Z1*s,d=l.scrollTop-(u<0?Math.floor(u):Math.ceil(u));this._verticalScrollbar.writeScrollPosition(c,d)}if(o){let u=Z1*o,d=l.scrollLeft-(u<0?Math.floor(u):Math.ceil(u));this._horizontalScrollbar.writeScrollPosition(c,d)}c=this._scrollable.validateScrollPosition(c),(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?" left":"",i=t?" top":"",s=n||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${s}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),Q8)}},n9=class extends t9{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function r9(e){let t={lazyRender:typeof e.lazyRender<"u"?e.lazyRender:!1,className:typeof e.className<"u"?e.className:"",useShadows:typeof e.useShadows<"u"?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<"u"?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<"u"?e.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<"u"?e.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<"u"?e.alwaysConsumeMouseWheel:!1,scrollYToX:typeof e.scrollYToX<"u"?e.scrollYToX:!1,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<"u"?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<"u"?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<"u"?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<"u"?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<"u"?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<"u"?e.listenOnDomNode:null,horizontal:typeof e.horizontal<"u"?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<"u"?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<"u"?e.horizontalHasArrows:!1,vertical:typeof e.vertical<"u"?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<"u"?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<"u"?e.verticalHasArrows:!1,verticalSliderSize:typeof e.verticalSliderSize<"u"?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<"u"?e.scrollByPage:!1};return t.horizontalSliderSize=typeof e.horizontalSliderSize<"u"?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<"u"?e.verticalSliderSize:t.verticalScrollbarSize,xr&&(t.className+=" mac"),t}var eb=class extends _e{constructor(e,t,n,r,i,s,o,a){super(),this._bufferService=n,this._optionsService=o,this._renderService=a,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let l=this._register(new V8({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:c=>Fv(r.window,c)}));this._register(this._optionsService.onSpecificOptionChange("smoothScrollDuration",()=>{l.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new n9(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},l)),this._register(this._optionsService.onMultipleOptionChange(["scrollSensitivity","fastScrollSensitivity","overviewRuler"],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(c=>{this._scrollableElement.updateOptions({handleMouseWheel:!(c&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(At.runAndSubscribe(s.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=s.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(He(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement("style"),t.appendChild(this._styleElement),this._register(He(()=>this._styleElement.remove())),this._register(At.runAndSubscribe(s.onChangeColors,()=>{this._styleElement.textContent=[".xterm .xterm-scrollable-element > .scrollbar > .slider {",` background: ${s.colors.scrollbarSliderBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider:hover {",` background: ${s.colors.scrollbarSliderHoverBackground.css};`,"}",".xterm .xterm-scrollable-element > .scrollbar > .slider.active {",` background: ${s.colors.scrollbarSliderActiveBackground.css};`,"}"].join(`
|
|
470
|
+
`)})),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(c=>this._handleScroll(c)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){var e;return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:((e=this._optionsService.rawOptions.overviewRuler)==null?void 0:e.width)||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};eb=et([Q(2,Jt),Q(3,Qr),Q(4,LD),Q(5,da),Q(6,en),Q(7,Jr)],eb);var tb=class extends _e{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(s=>this._removeDecoration(s))),this._register(He(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var r;let t=this._coreBrowserService.mainDocument.createElement("div");t.classList.add("xterm-decoration"),t.classList.toggle("xterm-decoration-top-layer",((r=e==null?void 0:e.options)==null?void 0:r.layer)==="top"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?"none":"block",this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||"left")==="right"?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:"":t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:""}_removeDecoration(e){var t;(t=this._decorationElements.get(e))==null||t.remove(),this._decorationElements.delete(e),e.dispose()}};tb=et([Q(1,Jt),Q(2,Qr),Q(3,yc),Q(4,Jr)],tb);var i9=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||"full"]&&t<=e.endBufferLine+this._linePadding[n||"full"]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},lr={full:0,left:0,center:0,right:0},oi={full:0,left:0,center:0,right:0},Fa={full:0,left:0,center:0,right:0},zd=class extends _e{constructor(e,t,n,r,i,s,o,a){var c;super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=s,this._themeService=o,this._coreBrowserService=a,this._colorZoneStore=new i9,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(),(c=this._viewportElement.parentElement)==null||c.insertBefore(this._canvas,this._viewportElement),this._register(He(()=>{var u;return(u=this._canvas)==null?void 0:u.remove()}));let l=this._canvas.getContext("2d");if(l)this._ctx=l;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);oi.full=this._canvas.width,oi.left=e,oi.center=t,oi.right=e,this._refreshDrawHeightConstants(),Fa.full=1,Fa.left=1,Fa.center=1+oi.left,Fa.right=1+oi.left+oi.center}_refreshDrawHeightConstants(){lr.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);lr.left=t,lr.center=t,lr.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*lr.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(Fa[e.position||"full"],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-lr[e.position||"full"]/2),oi[e.position||"full"],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+lr[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}))}};zd=et([Q(2,Jt),Q(3,yc),Q(4,Jr),Q(5,en),Q(6,da),Q(7,Qr)],zd);var V;(e=>(e.NUL="\0",e.SOH="",e.STX="",e.ETX="",e.EOT="",e.ENQ="",e.ACK="",e.BEL="\x07",e.BS="\b",e.HT=" ",e.LF=`
|
|
471
|
+
`,e.VT="\v",e.FF="\f",e.CR="\r",e.SO="",e.SI="",e.DLE="",e.DC1="",e.DC2="",e.DC3="",e.DC4="",e.NAK="",e.SYN="",e.ETB="",e.CAN="",e.EM="",e.SUB="",e.ESC="\x1B",e.FS="",e.GS="",e.RS="",e.US="",e.SP=" ",e.DEL=""))(V||(V={}));var Wu;(e=>(e.PAD="",e.HOP="",e.BPH="",e.NBH="",e.IND="",e.NEL="
",e.SSA="",e.ESA="",e.HTS="",e.HTJ="",e.VTS="",e.PLD="",e.PLU="",e.RI="",e.SS2="",e.SS3="",e.DCS="",e.PU1="",e.PU2="",e.STS="",e.CCH="",e.MW="",e.SPA="",e.EPA="",e.SOS="",e.SGCI="",e.SCI="",e.CSI="",e.ST="",e.OSC="",e.PM="",e.APC=""))(Wu||(Wu={}));var e2;(e=>e.ST=`${V.ESC}\\`)(e2||(e2={}));var nb=class{constructor(e,t,n,r,i,s){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=s,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode===229?(this._handleAnyTextareaChanges(),!1):!0}_finalizeComposition(e){if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){let t={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let n;t.start+=this._dataAlreadySent.length,this._isComposing?n=this._textarea.value.substring(t.start,this._compositionPosition.start):n=this._textarea.value.substring(t.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;let t=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(t,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,"");this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${V.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let t=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),n=this._renderService.dimensions.css.cell.height,r=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,i=t*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+"px";let s=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=Math.max(s.width,1)+"px",this._textarea.style.height=Math.max(s.height,1)+"px",this._textarea.style.lineHeight=s.height+"px"}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};nb=et([Q(2,Jt),Q(3,en),Q(4,Ks),Q(5,Jr)],nb);var vt=0,_t=0,St=0,Qe=0,Q1={css:"#00000000",rgba:0},ot;(e=>{function t(i,s,o,a){return a!==void 0?`#${Ji(i)}${Ji(s)}${Ji(o)}${Ji(a)}`:`#${Ji(i)}${Ji(s)}${Ji(o)}`}e.toCss=t;function n(i,s,o,a=255){return(i<<24|s<<16|o<<8|a)>>>0}e.toRgba=n;function r(i,s,o,a){return{css:e.toCss(i,s,o,a),rgba:e.toRgba(i,s,o,a)}}e.toColor=r})(ot||(ot={}));var Be;(e=>{function t(l,c){if(Qe=(c.rgba&255)/255,Qe===1)return{css:c.css,rgba:c.rgba};let u=c.rgba>>24&255,d=c.rgba>>16&255,p=c.rgba>>8&255,f=l.rgba>>24&255,g=l.rgba>>16&255,m=l.rgba>>8&255;vt=f+Math.round((u-f)*Qe),_t=g+Math.round((d-g)*Qe),St=m+Math.round((p-m)*Qe);let _=ot.toCss(vt,_t,St),b=ot.toRgba(vt,_t,St);return{css:_,rgba:b}}e.blend=t;function n(l){return(l.rgba&255)===255}e.isOpaque=n;function r(l,c,u){let d=qu.ensureContrastRatio(l.rgba,c.rgba,u);if(d)return ot.toColor(d>>24&255,d>>16&255,d>>8&255)}e.ensureContrastRatio=r;function i(l){let c=(l.rgba|255)>>>0;return[vt,_t,St]=qu.toChannels(c),{css:ot.toCss(vt,_t,St),rgba:c}}e.opaque=i;function s(l,c){return Qe=Math.round(c*255),[vt,_t,St]=qu.toChannels(l.rgba),{css:ot.toCss(vt,_t,St,Qe),rgba:ot.toRgba(vt,_t,St,Qe)}}e.opacity=s;function o(l,c){return Qe=l.rgba&255,s(l,Qe*c/255)}e.multiplyOpacity=o;function a(l){return[l.rgba>>24&255,l.rgba>>16&255,l.rgba>>8&255]}e.toColorRGB=a})(Be||(Be={}));var Ge;(e=>{let t,n;try{let i=document.createElement("canvas");i.width=1,i.height=1;let s=i.getContext("2d",{willReadFrequently:!0});s&&(t=s,t.globalCompositeOperation="copy",n=t.createLinearGradient(0,0,1,1))}catch{}function r(i){if(i.match(/#[\da-f]{3,8}/i))switch(i.length){case 4:return vt=parseInt(i.slice(1,2).repeat(2),16),_t=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),ot.toColor(vt,_t,St);case 5:return vt=parseInt(i.slice(1,2).repeat(2),16),_t=parseInt(i.slice(2,3).repeat(2),16),St=parseInt(i.slice(3,4).repeat(2),16),Qe=parseInt(i.slice(4,5).repeat(2),16),ot.toColor(vt,_t,St,Qe);case 7:return{css:i,rgba:(parseInt(i.slice(1),16)<<8|255)>>>0};case 9:return{css:i,rgba:parseInt(i.slice(1),16)>>>0}}let s=i.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(s)return vt=parseInt(s[1]),_t=parseInt(s[2]),St=parseInt(s[3]),Qe=Math.round((s[5]===void 0?1:parseFloat(s[5]))*255),ot.toColor(vt,_t,St,Qe);if(!t||!n)throw new Error("css.toColor: Unsupported css format");if(t.fillStyle=n,t.fillStyle=i,typeof t.fillStyle!="string")throw new Error("css.toColor: Unsupported css format");if(t.fillRect(0,0,1,1),[vt,_t,St,Qe]=t.getImageData(0,0,1,1).data,Qe!==255)throw new Error("css.toColor: Unsupported css format");return{rgba:ot.toRgba(vt,_t,St,Qe),css:i}}e.toColor=r})(Ge||(Ge={}));var Vt;(e=>{function t(r){return n(r>>16&255,r>>8&255,r&255)}e.relativeLuminance=t;function n(r,i,s){let o=r/255,a=i/255,l=s/255,c=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),u=a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4),d=l<=.03928?l/12.92:Math.pow((l+.055)/1.055,2.4);return c*.2126+u*.7152+d*.0722}e.relativeLuminance2=n})(Vt||(Vt={}));var qu;(e=>{function t(o,a){if(Qe=(a&255)/255,Qe===1)return a;let l=a>>24&255,c=a>>16&255,u=a>>8&255,d=o>>24&255,p=o>>16&255,f=o>>8&255;return vt=d+Math.round((l-d)*Qe),_t=p+Math.round((c-p)*Qe),St=f+Math.round((u-f)*Qe),ot.toRgba(vt,_t,St)}e.blend=t;function n(o,a,l){let c=Vt.relativeLuminance(o>>8),u=Vt.relativeLuminance(a>>8);if(Mr(c,u)<l){if(u<c){let f=r(o,a,l),g=Mr(c,Vt.relativeLuminance(f>>8));if(g<l){let m=i(o,a,l),_=Mr(c,Vt.relativeLuminance(m>>8));return g>_?f:m}return f}let d=i(o,a,l),p=Mr(c,Vt.relativeLuminance(d>>8));if(p<l){let f=r(o,a,l),g=Mr(c,Vt.relativeLuminance(f>>8));return p>g?d:f}return d}}e.ensureContrastRatio=n;function r(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,p=a>>24&255,f=a>>16&255,g=a>>8&255,m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));for(;m<l&&(p>0||f>0||g>0);)p-=Math.max(0,Math.ceil(p*.1)),f-=Math.max(0,Math.ceil(f*.1)),g-=Math.max(0,Math.ceil(g*.1)),m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));return(p<<24|f<<16|g<<8|255)>>>0}e.reduceLuminance=r;function i(o,a,l){let c=o>>24&255,u=o>>16&255,d=o>>8&255,p=a>>24&255,f=a>>16&255,g=a>>8&255,m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));for(;m<l&&(p<255||f<255||g<255);)p=Math.min(255,p+Math.ceil((255-p)*.1)),f=Math.min(255,f+Math.ceil((255-f)*.1)),g=Math.min(255,g+Math.ceil((255-g)*.1)),m=Mr(Vt.relativeLuminance2(p,f,g),Vt.relativeLuminance2(c,u,d));return(p<<24|f<<16|g<<8|255)>>>0}e.increaseLuminance=i;function s(o){return[o>>24&255,o>>16&255,o>>8&255,o&255]}e.toChannels=s})(qu||(qu={}));function Ji(e){let t=e.toString(16);return t.length<2?"0"+t:t}function Mr(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var s9=class extends bc{constructor(e,t,n){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Hd=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new Bn}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,s=0,o=0,a=t.getFg(0),l=t.getBg(0);for(let c=0;c<t.getTrimmedLength();c++)if(t.loadCell(c,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==a||this._workCell.bg!==l){if(c-i>1){let u=this._getJoinedRanges(r,o,s,t,i);for(let d=0;d<u.length;d++)n.push(u[d])}i=c,o=s,a=this._workCell.fg,l=this._workCell.bg}s+=this._workCell.getChars().length||Si.length}if(this._bufferService.cols-i>1){let c=this._getJoinedRanges(r,o,s,t,i);for(let u=0;u<c.length;u++)n.push(c[u])}return n}_getJoinedRanges(e,t,n,r,i){let s=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(s)}catch(a){console.error(a)}for(let a=1;a<this._characterJoiners.length;a++)try{let l=this._characterJoiners[a].handler(s);for(let c=0;c<l.length;c++)Hd._mergeRanges(o,l[c])}catch(l){console.error(l)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,s=0,o=e[r];if(o){for(let a=n;a<this._bufferService.cols;a++){let l=t.getWidth(a),c=t.getString(a).length||Si.length;if(l!==0){if(!i&&o[0]<=s&&(o[0]=a,i=!0),o[1]<=s){if(o[1]=a,o=e[++r],!o)break;o[0]<=s?(o[0]=a,i=!0):i=!1}s+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};Hd=et([Q(0,Jt)],Hd);function o9(e){return 57508<=e&&e<=57558}function a9(e){return 9472<=e&&e<=9631}function l9(e){return o9(e)||a9(e)}function c9(){return{css:{canvas:cu(),cell:cu()},device:{canvas:cu(),cell:cu(),char:{width:0,height:0,left:0,top:0}}}}function cu(){return{width:0,height:0}}var rb=class{constructor(e,t,n,r,i,s,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=s,this._themeService=o,this._workCell=new Bn,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,s,o,a,l,c,u){let d=[],p=this._characterJoinerService.getJoinedCharacters(t),f=this._themeService.colors,g=e.getNoBgTrimmedLength();n&&g<s+1&&(g=s+1);let m,_=0,b="",v=0,S=0,w=0,k=0,x=!1,E=0,T=!1,D=0,A=0,R=[],I=c!==-1&&u!==-1;for(let L=0;L<g;L++){e.loadCell(L,this._workCell);let P=this._workCell.getWidth();if(P===0)continue;let F=!1,B=L>=A,U=L,O=this._workCell;if(p.length>0&&L===p[0][0]&&B){let le=p.shift(),Xe=this._isCellInSelection(le[0],t);for(v=le[0]+1;v<le[1];v++)B&&(B=Xe===this._isCellInSelection(v,t));B&&(B=!n||s<le[0]||s>=le[1]),B?(F=!0,O=new s9(this._workCell,e.translateToString(!0,le[0],le[1]),le[1]-le[0]),U=le[1]-1,P=O.getWidth()):A=le[1]}let j=this._isCellInSelection(L,t),C=n&&L===s,z=I&&L>=c&&L<=u,Z=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,le=>{Z=!0});let M=O.getChars()||Si;if(M===" "&&(O.isUnderline()||O.isOverline())&&(M=" "),D=P*a-l.get(M,O.isBold(),O.isItalic()),!m)m=this._document.createElement("span");else if(_&&(j&&T||!j&&!T&&O.bg===S)&&(j&&T&&f.selectionForeground||O.fg===w)&&O.extended.ext===k&&z===x&&D===E&&!C&&!F&&!Z&&B){O.isInvisible()?b+=Si:b+=M,_++;continue}else _&&(m.textContent=b),m=this._document.createElement("span"),_=0,b="";if(S=O.bg,w=O.fg,k=O.extended.ext,x=z,E=D,T=j,F&&s>=L&&s<=U&&(s=L),!this._coreService.isCursorHidden&&C&&this._coreService.isCursorInitialized){if(R.push("xterm-cursor"),this._coreBrowserService.isFocused)o&&R.push("xterm-cursor-blink"),R.push(r==="bar"?"xterm-cursor-bar":r==="underline"?"xterm-cursor-underline":"xterm-cursor-block");else if(i)switch(i){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(O.isBold()&&R.push("xterm-bold"),O.isItalic()&&R.push("xterm-italic"),O.isDim()&&R.push("xterm-dim"),O.isInvisible()?b=Si:b=O.getChars()||Si,O.isUnderline()&&(R.push(`xterm-underline-${O.extended.underlineStyle}`),b===" "&&(b=" "),!O.isUnderlineColorDefault()))if(O.isUnderlineColorRGB())m.style.textDecorationColor=`rgb(${bc.toColorRGB(O.getUnderlineColor()).join(",")})`;else{let le=O.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&O.isBold()&&le<8&&(le+=8),m.style.textDecorationColor=f.ansi[le].css}O.isOverline()&&(R.push("xterm-overline"),b===" "&&(b=" ")),O.isStrikethrough()&&R.push("xterm-strikethrough"),z&&(m.style.textDecoration="underline");let se=O.getFgColor(),be=O.getFgColorMode(),$=O.getBgColor(),G=O.getBgColorMode(),ie=!!O.isInverse();if(ie){let le=se;se=$,$=le;let Xe=be;be=G,G=Xe}let ae,ce,ue=!1;this._decorationService.forEachDecorationAtCell(L,t,void 0,le=>{le.options.layer!=="top"&&ue||(le.backgroundColorRGB&&(G=50331648,$=le.backgroundColorRGB.rgba>>8&16777215,ae=le.backgroundColorRGB),le.foregroundColorRGB&&(be=50331648,se=le.foregroundColorRGB.rgba>>8&16777215,ce=le.foregroundColorRGB),ue=le.options.layer==="top")}),!ue&&j&&(ae=this._coreBrowserService.isFocused?f.selectionBackgroundOpaque:f.selectionInactiveBackgroundOpaque,$=ae.rgba>>8&16777215,G=50331648,ue=!0,f.selectionForeground&&(be=50331648,se=f.selectionForeground.rgba>>8&16777215,ce=f.selectionForeground)),ue&&R.push("xterm-decoration-top");let pe;switch(G){case 16777216:case 33554432:pe=f.ansi[$],R.push(`xterm-bg-${$}`);break;case 50331648:pe=ot.toColor($>>16,$>>8&255,$&255),this._addStyle(m,`background-color:#${J1(($>>>0).toString(16),"0",6)}`);break;case 0:default:ie?(pe=f.foreground,R.push("xterm-bg-257")):pe=f.background}switch(ae||O.isDim()&&(ae=Be.multiplyOpacity(pe,.5)),be){case 16777216:case 33554432:O.isBold()&&se<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(se+=8),this._applyMinimumContrast(m,pe,f.ansi[se],O,ae,void 0)||R.push(`xterm-fg-${se}`);break;case 50331648:let le=ot.toColor(se>>16&255,se>>8&255,se&255);this._applyMinimumContrast(m,pe,le,O,ae,ce)||this._addStyle(m,`color:#${J1(se.toString(16),"0",6)}`);break;case 0:default:this._applyMinimumContrast(m,pe,f.foreground,O,ae,ce)||ie&&R.push("xterm-fg-257")}R.length&&(m.className=R.join(" "),R.length=0),!C&&!F&&!Z&&B?_++:m.textContent=b,D!==this.defaultSpacing&&(m.style.letterSpacing=`${D}px`),d.push(m),L=U}return m&&_&&(m.textContent=b),d}_applyMinimumContrast(e,t,n,r,i,s){if(this._optionsService.rawOptions.minimumContrastRatio===1||l9(r.getCode()))return!1;let o=this._getContrastCache(r),a;if(!i&&!s&&(a=o.getColor(t.rgba,n.rgba)),a===void 0){let l=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);a=Be.ensureContrastRatio(i||t,s||n,l),o.setColor((i||t).rgba,(s||n).rgba,a??null)}return a?(this._addStyle(e,`color:${a.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute("style",`${e.getAttribute("style")||""}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};rb=et([Q(1,PD),Q(2,en),Q(3,Qr),Q(4,Ks),Q(5,yc),Q(6,da)],rb);function J1(e,t,n){for(;e.length<n;)e=t+e;return e}var u9=class{constructor(e,t){this._flat=new Float32Array(256),this._font="",this._fontSize=0,this._weight="normal",this._weightBold="bold",this._measureElements=[],this._container=e.createElement("div"),this._container.classList.add("xterm-width-cache-measure-container"),this._container.setAttribute("aria-hidden","true"),this._container.style.whiteSpace="pre",this._container.style.fontKerning="none";let n=e.createElement("span");n.classList.add("xterm-char-measure-element");let r=e.createElement("span");r.classList.add("xterm-char-measure-element"),r.style.fontWeight="bold";let i=e.createElement("span");i.classList.add("xterm-char-measure-element"),i.style.fontStyle="italic";let s=e.createElement("span");s.classList.add("xterm-char-measure-element"),s.style.fontWeight="bold",s.style.fontStyle="italic",this._measureElements=[n,r,i,s],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(s),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let o=this._measure(e,0);return o>0&&(this._flat[r]=o),o}let i=e;t&&(i+="B"),n&&(i+="I");let s=this._holey.get(i);if(s===void 0){let o=0;t&&(o|=1),n&&(o|=2),s=this._measure(e,o),s>0&&this._holey.set(i,s)}return s}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},d9=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,s=t[1]-i,o=n[1]-i,a=Math.max(s,0),l=Math.min(o,e.rows-1);if(a>=e.rows||l<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=s,this.viewportEndRow=o,this.viewportCappedStartRow=a,this.viewportCappedEndRow=l,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function h9(){return new d9}var Cf="xterm-dom-renderer-owner-",Cn="xterm-rows",uu="xterm-fg-",eT="xterm-bg-",Ba="xterm-focus",du="xterm-selection",p9=1,ib=class extends _e{constructor(e,t,n,r,i,s,o,a,l,c,u,d,p,f){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=s,this._linkifier2=o,this._charSizeService=l,this._optionsService=c,this._bufferService=u,this._coreService=d,this._coreBrowserService=p,this._themeService=f,this._terminalClass=p9++,this._rowElements=[],this._selectionRenderModel=h9(),this.onRequestRedraw=this._register(new K).event,this._rowContainer=this._document.createElement("div"),this._rowContainer.classList.add(Cn),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(du),this._selectionContainer.setAttribute("aria-hidden","true"),this.dimensions=c9(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(g=>this._injectCss(g))),this._injectCss(this._themeService.colors),this._rowFactory=a.createInstance(rb,document),this._element.classList.add(Cf+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(g=>this._handleLinkHover(g))),this._register(this._linkifier2.onHideLinkUnderline(g=>this._handleLinkLeave(g))),this._register(He(()=>{this._element.classList.remove(Cf+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new u9(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let n of this._rowElements)n.style.width=`${this.dimensions.css.canvas.width}px`,n.style.height=`${this.dimensions.css.cell.height}px`,n.style.lineHeight=`${this.dimensions.css.cell.height}px`,n.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${Cn} 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} .${Cn} { 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} .${Cn} .xterm-dim { color: ${Be.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${Cn}.${Ba} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${Cn} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${du} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${du} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${du} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[s,o]of e.ansi.entries())t+=`${this._terminalSelector} .${uu}${s} { color: ${o.css}; }${this._terminalSelector} .${uu}${s}.xterm-dim { color: ${Be.multiplyOpacity(o,.5).css}; }${this._terminalSelector} .${eT}${s} { background-color: ${o.css}; }`;t+=`${this._terminalSelector} .${uu}257 { color: ${Be.opaque(e.background).css}; }${this._terminalSelector} .${uu}257.xterm-dim { color: ${Be.multiplyOpacity(Be.opaque(e.background),.5).css}; }${this._terminalSelector} .${eT}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get("W",!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let n=this._rowElements.length;n<=t;n++){let r=this._document.createElement("div");this._rowContainer.appendChild(r),this._rowElements.push(r)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(Ba),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(Ba),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,s=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,a=this._document.createDocumentFragment();if(n){let l=e[0]>t[0];a.appendChild(this._createSelectionElement(s,l?t[0]:e[0],l?e[0]:t[0],o-s+1))}else{let l=r===s?e[0]:0,c=s===i?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(s,l,c));let u=o-s-1;if(a.appendChild(this._createSelectionElement(s+1,0,this._bufferService.cols,u)),s!==o){let d=i===o?t[0]:this._bufferService.cols;a.appendChild(this._createSelectionElement(o,0,d))}}this._selectionContainer.appendChild(a)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement("div"),s=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return s+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-s),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${s}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),s=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,a=this._optionsService.rawOptions.cursorInactiveStyle;for(let l=e;l<=t;l++){let c=l+n.ydisp,u=this._rowElements[l],d=n.lines.get(c);if(!u||!d)break;u.replaceChildren(...this._rowFactory.createRow(d,c,c===r,o,a,i,s,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${Cf}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,s){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let a=this._bufferService.buffer,l=a.ybase+a.y,c=Math.min(a.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,p=this._optionsService.rawOptions.cursorInactiveStyle;for(let f=n;f<=r;++f){let g=f+a.ydisp,m=this._rowElements[f],_=a.lines.get(g);if(!m||!_)break;m.replaceChildren(...this._rowFactory.createRow(_,g,g===l,d,p,c,u,this.dimensions.css.cell.width,this._widthCache,s?f===n?e:0:-1,s?(f===r?t:i)-1:-1))}}};ib=et([Q(7,Iv),Q(8,Gh),Q(9,en),Q(10,Jt),Q(11,Ks),Q(12,Qr),Q(13,da)],ib);var sb=class extends _e{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new K),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new g9(this._optionsService))}catch{this._measureStrategy=this._register(new f9(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())}};sb=et([Q(2,en)],sb);var t2=class extends _e{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},f9=class extends t2{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W".repeat(32),this._measureElement.setAttribute("aria-hidden","true"),this._measureElement.style.whiteSpace="pre",this._measureElement.style.fontKerning="none",this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},g9=class extends t2{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}},m9=class extends _e{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new b9(this._window)),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new K),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(r=>this._screenDprMonitor.setWindow(r))),this._register(At.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(de(this._textarea,"focus",()=>this._isFocused=!0)),this._register(de(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}},b9=class extends _e{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new Xo),this._onDprChange=this._register(new K),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(He(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=de(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)}},y9=class extends _e{constructor(){super(),this.linkProviders=[],this._register(He(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function jv(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),s=parseInt(i.getPropertyValue("padding-left")),o=parseInt(i.getPropertyValue("padding-top"));return[t.clientX-r.left-s,t.clientY-r.top-o]}function v9(e,t,n,r,i,s,o,a,l){if(!s)return;let c=jv(e,t,n);if(c)return c[0]=Math.ceil((c[0]+(l?o/2:0))/o),c[1]=Math.ceil(c[1]/a),c[0]=Math.min(Math.max(c[0],1),r+(l?1:0)),c[1]=Math.min(Math.max(c[1],1),i),c}var ob=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return v9(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=jv(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};ob=et([Q(0,Jr),Q(1,Gh)],ob);var _9=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t,!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},n2={};NW(n2,{getSafariVersion:()=>w9,isChromeOS:()=>o2,isFirefox:()=>r2,isIpad:()=>x9,isIphone:()=>E9,isLegacyEdge:()=>S9,isLinux:()=>Uv,isMac:()=>Vd,isNode:()=>Wh,isSafari:()=>i2,isWindows:()=>s2});var Wh=typeof process<"u"&&"title"in process,vc=Wh?"node":navigator.userAgent,_c=Wh?"node":navigator.platform,r2=vc.includes("Firefox"),S9=vc.includes("Edge"),i2=/^((?!chrome|android).)*safari/i.test(vc);function w9(){if(!i2)return 0;let e=vc.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var Vd=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(_c),x9=_c==="iPad",E9=_c==="iPhone",s2=["Windows","Win16","Win32","WinCE"].includes(_c),Uv=_c.indexOf("Linux")>=0,o2=/\bCrOS\b/.test(vc),a2=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},k9=class extends a2{_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())}}},C9=class extends a2{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},Gd=!Wh&&"requestIdleCallback"in window?C9:k9,T9=class{constructor(){this._queue=new Gd}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},ab=class extends _e{constructor(e,t,n,r,i,s,o,a,l){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=a,this._renderer=this._register(new Xo),this._pausedResizeTask=new T9,this._observerDisposable=this._register(new Xo),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 K),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new K),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new K),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new _9((c,u)=>this._renderRows(c,u),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new A9(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(He(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>{var c;return(c=this._renderer.value)==null?void 0:c.clear()})),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(s.onDecorationRegistered(()=>this._fullRefresh())),this._register(s.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange(["customGlyphs","drawBoldTextInBrightColors","letterSpacing","lineHeight","fontFamily","fontSize","fontWeight","fontWeightBold","minimumContrastRatio","rescaleOverlappingGlyphs"],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange(["cursorBlink","cursorStyle"],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(l.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(c=>this._registerIntersectionObserver(c,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if("IntersectionObserver"in e){let n=new e.IntersectionObserver(r=>this._handleIntersectionChange(r[r.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=He(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(t=>this.refreshRows(t.start,t.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var e,t;this._renderer.value&&((t=(e=this._renderer.value).clearTextureAtlas)==null||t.call(e),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>{var n;return(n=this._renderer.value)==null?void 0:n.handleResize(e,t)}):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){var e;(e=this._renderer.value)==null||e.handleCharSizeChanged()}handleBlur(){var e;(e=this._renderer.value)==null||e.handleBlur()}handleFocus(){var e;(e=this._renderer.value)==null||e.handleFocus()}handleSelectionChanged(e,t,n){var r;this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,(r=this._renderer.value)==null||r.handleSelectionChanged(e,t,n)}handleCursorMove(){var e;(e=this._renderer.value)==null||e.handleCursorMove()}clear(){var e;(e=this._renderer.value)==null||e.clear()}};ab=et([Q(2,en),Q(3,Gh),Q(4,Ks),Q(5,yc),Q(6,Jt),Q(7,Qr),Q(8,da)],ab);var A9=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function R9(e,t,n,r){let i=n.buffer.x,s=n.buffer.y;if(!n.buffer.hasScrollback)return O9(i,s,e,t,n,r)+qh(s,t,n,r)+L9(i,s,e,t,n,r);let o;if(s===t)return o=i>e?"D":"C",Kl(Math.abs(i-e),ql(o,r));o=s>t?"D":"C";let a=Math.abs(s-t),l=I9(s>t?e:i,n)+(a-1)*n.cols+1+N9(s>t?i:e);return Kl(l,ql(o,r))}function N9(e,t){return e-1}function I9(e,t){return t.cols-e}function O9(e,t,n,r,i,s){return qh(t,r,i,s).length===0?"":Kl(c2(e,t,e,t-Os(t,i),!1,i).length,ql("D",s))}function qh(e,t,n,r){let i=e-Os(e,n),s=t-Os(t,n),o=Math.abs(i-s)-D9(e,t,n);return Kl(o,ql(l2(e,t),r))}function L9(e,t,n,r,i,s){let o;qh(t,r,i,s).length>0?o=r-Os(r,i):o=t;let a=r,l=M9(e,t,n,r,i,s);return Kl(c2(e,o,n,a,l==="C",i).length,ql(l,s))}function D9(e,t,n){var o;let r=0,i=e-Os(e,n),s=t-Os(t,n);for(let a=0;a<Math.abs(i-s);a++){let l=l2(e,t)==="A"?-1:1;(o=n.buffer.lines.get(i+l*a))!=null&&o.isWrapped&&r++}return r}function Os(e,t){let n=0,r=t.buffer.lines.get(e),i=r==null?void 0:r.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r==null?void 0:r.isWrapped;return n}function M9(e,t,n,r,i,s){let o;return qh(n,r,i,s).length>0?o=r-Os(r,i):o=t,e<n&&o<=r||e>=n&&o<r?"C":"D"}function l2(e,t){return e>t?"A":"B"}function c2(e,t,n,r,i,s){let o=e,a=t,l="";for(;(o!==n||a!==r)&&a>=0&&a<s.buffer.lines.length;)o+=i?1:-1,i&&o>s.cols-1?(l+=s.buffer.translateBufferLineToString(a,!1,e,o),o=0,e=0,a++):!i&&o<0&&(l+=s.buffer.translateBufferLineToString(a,!1,0,e+1),o=s.cols-1,e=o,a--);return l+s.buffer.translateBufferLineToString(a,!1,e,o)}function ql(e,t){let n=t?"O":"[";return V.ESC+n+e}function Kl(e,t){e=Math.floor(e);let n="";for(let r=0;r<e;r++)n+=t;return n}var P9=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function tT(e,t){if(e.start.y>e.end.y)throw new Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var Tf=50,F9=15,B9=50,j9=500,U9=" ",$9=new RegExp(U9,"g"),lb=class extends _e{constructor(e,t,n,r,i,s,o,a,l){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=s,this._optionsService=o,this._renderService=a,this._coreBrowserService=l,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new Bn,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new K),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new K),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new K),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=c=>this._handleMouseMove(c),this._mouseUpListener=c=>this._handleMouseUp(c),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(c=>this._handleTrim(c)),this._register(this._bufferService.buffers.onBufferActivate(c=>this._handleBufferActivate(c))),this.enable(),this._model=new P9(this._bufferService),this._activeSelectionMode=0,this._register(He(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(c=>{c.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return"";let i=e[0]<t[0]?e[0]:t[0],s=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let a=n.translateBufferLineToString(o,!0,i,s);r.push(a)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let s=e[1]+1;s<=t[1]-1;s++){let o=n.lines.get(s),a=n.translateBufferLineToString(s,!0);o!=null&&o.isWrapped?r[r.length-1]+=a:r.push(a)}if(e[1]!==t[1]){let s=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]);s&&s.isWrapped?r[r.length-1]+=o:r.push(o)}}return r.map(i=>i.replace($9," ")).join(s2?`\r
|
|
472
472
|
`:`
|
|
473
|
-
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Uv&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=tT(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=jv(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Tf),Tf),t/=Tf,t/Math.abs(t)+Math.round(t*(F9-1)))}shouldForceSelection(e){return Vd?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(),B9)}_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&&!(Vd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<j9&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=R9(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),l=a,c=e[0]-a,u=0,d=0,p=0,f=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let _=e[0],b=e[0];s.getWidth(_)===0&&(u++,_--),s.getWidth(b)===2&&(d++,b++);let v=s.getString(b).length;for(v>1&&(f+=v-1,l+=v-1);_>0&&a>0&&!this._isCharWordSeparator(s.loadCell(_-1,this._workCell));){s.loadCell(_-1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,_--):S>1&&(p+=S-1,a-=S-1),a--,_--}for(;b<s.length&&l+1<o.length&&!this._isCharWordSeparator(s.loadCell(b+1,this._workCell));){s.loadCell(b+1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,b++):S>1&&(f+=S-1,l+=S-1),l++,b++}}l++;let g=a+c-u+p,m=Math.min(this._bufferService.cols,l-a+u+d-p-f);if(!(!t&&o.slice(a,l).trim()==="")){if(n&&g===0&&s.getCodePoint(0)!==32){let _=i.lines.get(e[1]-1);if(_&&s.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let b=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(b){let v=this._bufferService.cols-b.start;g-=v,m+=v}}}if(r&&g+m===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let _=i.lines.get(e[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let b=this._getWordAt([0,e[1]+1],!1,!1,!0);b&&(m+=b.length)}}return{start:g,length:m}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=tT(n,this._bufferService.cols)}};lb=Je([Q(3,Jt),Q(4,Ks),Q(5,Ov),Q(6,en),Q(7,Jr),Q(8,Qr)],lb);var nT=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},rT=class{constructor(){this._color=new nT,this._css=new nT}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ut=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:ot.toCss(r,i,s),rgba:ot.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:ot.toCss(r,r,r),rgba:ot.toRgba(r,r,r)})}return e})()),os=Ge.toColor("#ffffff"),Za=Ge.toColor("#000000"),iT=Ge.toColor("#ffffff"),sT=Za,ja={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},z9=os,cb=class extends _e{constructor(e){super(),this._optionsService=e,this._contrastCache=new rT,this._halfContrastCache=new rT,this._onChangeColors=this._register(new K),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:os,background:Za,cursor:iT,cursorAccent:sT,selectionForeground:void 0,selectionBackgroundTransparent:ja,selectionBackgroundOpaque:Be.blend(Za,ja),selectionInactiveBackgroundTransparent:ja,selectionInactiveBackgroundOpaque:Be.blend(Za,ja),scrollbarSliderBackground:Be.opacity(os,.2),scrollbarSliderHoverBackground:Be.opacity(os,.4),scrollbarSliderActiveBackground:Be.opacity(os,.5),overviewRulerBorder:os,ansi:ut.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Re(e.foreground,os),t.background=Re(e.background,Za),t.cursor=Be.blend(t.background,Re(e.cursor,iT)),t.cursorAccent=Be.blend(t.background,Re(e.cursorAccent,sT)),t.selectionBackgroundTransparent=Re(e.selectionBackground,ja),t.selectionBackgroundOpaque=Be.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Re(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Be.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Re(e.selectionForeground,Q1):void 0,t.selectionForeground===Q1&&(t.selectionForeground=void 0),Be.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Be.opacity(t.selectionBackgroundTransparent,.3)),Be.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Be.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Re(e.scrollbarSliderBackground,Be.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Re(e.scrollbarSliderHoverBackground,Be.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Re(e.scrollbarSliderActiveBackground,Be.opacity(t.foreground,.5)),t.overviewRulerBorder=Re(e.overviewRulerBorder,z9),t.ansi=ut.slice(),t.ansi[0]=Re(e.black,ut[0]),t.ansi[1]=Re(e.red,ut[1]),t.ansi[2]=Re(e.green,ut[2]),t.ansi[3]=Re(e.yellow,ut[3]),t.ansi[4]=Re(e.blue,ut[4]),t.ansi[5]=Re(e.magenta,ut[5]),t.ansi[6]=Re(e.cyan,ut[6]),t.ansi[7]=Re(e.white,ut[7]),t.ansi[8]=Re(e.brightBlack,ut[8]),t.ansi[9]=Re(e.brightRed,ut[9]),t.ansi[10]=Re(e.brightGreen,ut[10]),t.ansi[11]=Re(e.brightYellow,ut[11]),t.ansi[12]=Re(e.brightBlue,ut[12]),t.ansi[13]=Re(e.brightMagenta,ut[13]),t.ansi[14]=Re(e.brightCyan,ut[14]),t.ansi[15]=Re(e.brightWhite,ut[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Re(e.extendedAnsi[r],ut[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()}}};cb=Je([Q(0,en)],cb);function Re(e,t){if(e!==void 0)try{return Ge.toColor(e)}catch{}return t}var H9=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},V9=class{constructor(){this._services=new H9,this._services.set(Iv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=FW(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},G9={trace:0,debug:1,info:2,warn:3,error:4,off:5},W9="xterm.js: ",ub=class extends _e{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=G9[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":W9)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};ub=Je([Q(0,en)],ub);var oT=class extends _e{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new K),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new K),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new K),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ve=3,it=Object.freeze(new bc),hu=0,Af=2,Qa=class u2{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ve);let i=n||Bn.fromCharData([0,RD,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*ve+0],r=n&2097151;return[this._data[t*ve+1],n&2097152?this._combined[t]:r?fi(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ve+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ve+0]=t|2097152|n[2]<<22):this._data[t*ve+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ve+0]>>22}hasWidth(t){return this._data[t*ve+0]&12582912}getFg(t){return this._data[t*ve+1]}getBg(t){return this._data[t*ve+2]}hasContent(t){return this._data[t*ve+0]&4194303}getCodePoint(t){let n=this._data[t*ve+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ve+0]&2097152}getString(t){let n=this._data[t*ve+0];return n&2097152?this._combined[t]:n&2097151?fi(n&2097151):""}isProtected(t){return this._data[t*ve+2]&536870912}loadCell(t,n){return hu=t*ve,n.content=this._data[hu+0],n.fg=this._data[hu+1],n.bg=this._data[hu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ve+0]=n.content,this._data[t*ve+1]=n.fg,this._data[t*ve+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ve+0]=n|r<<22,this._data[t*ve+1]=i.fg,this._data[t*ve+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*ve+0];i&2097152?this._combined[t]+=fi(n):i&2097151?(this._combined[t]=fi(i&2097151)+fi(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*ve+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Bn;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Bn;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Af<this._data.buffer.byteLength;let r=t*ve;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,r*4*Af<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Af<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new u2(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ve+0]&4194303)return t+(this._data[t*ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ve+0]&4194303||this._data[t*ve+2]&50331648)return t+(this._data[t*ve+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let l=i-1;l>=0;l--){for(let c=0;c<ve;c++)this._data[(r+l)*ve+c]=o[(n+l)*ve+c];o[(n+l)*ve+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}else for(let l=0;l<i;l++){for(let c=0;c<ve;c++)this._data[(r+l)*ve+c]=o[(n+l)*ve+c];o[(n+l)*ve+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}let a=Object.keys(t._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*ve+0],a=o&2097151,l=o&2097152?this._combined[n]:a?fi(a):Si;if(s+=l,i)for(let c=0;c<l.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function q9(e,t,n,r,i,s){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let u=[e.get(a)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(!s&&r>=a&&r<l){a+=u.length-1;continue}let d=0,p=Yl(u,d,t),f=1,g=0;for(;f<u.length;){let _=Yl(u,f,t),b=_-g,v=n-p,S=Math.min(b,v);u[d].copyCellsFrom(u[f],g,p,S,!1),p+=S,p===n&&(d++,p=0),g+=S,g===_&&(f++,g=0),p===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,p++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(p,n,i);let m=0;for(let _=u.length-1;_>0&&(_>d||u[_].getTrimmedLength()===0);_--)m++;m>0&&(o.push(a+u.length-m),o.push(m)),a+=u.length-1}return o}function K9(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let a=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function Y9(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function X9(e,t,n){let r=[],i=e.map((l,c)=>Yl(e,c,t)).reduce((l,c)=>l+c),s=0,o=0,a=0;for(;a<i;){if(i-a<n){r.push(i-a);break}s+=n;let l=Yl(e,o,t);s>l&&(s-=l,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let u=c?n-1:n;r.push(u),a+=u}return r}function Yl(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var d2=class h2{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=h2._nextId++,this._onDispose=this.register(new K),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Is(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};d2._nextId=1;var Z9=d2,gt={},as=gt.B;gt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};gt.A={"#":"£"};gt.B=void 0;gt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gt.C=gt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gt.E=gt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gt.H=gt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var aT=4294967295,lT=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=it.clone(),this.savedCharset=as,this.markers=[],this._nullCell=Bn.fromCharData([0,RD,1,0]),this._whitespaceCell=Bn.fromCharData([0,Si,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Gd,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oT(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new $d),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new $d),this._whitespaceCell}getBlankLine(e,t){return new Qa(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>aT?aT:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=it);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new oT(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(it),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Qa(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Qa(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=q9(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(it),n);if(r.length>0){let i=K9(this.lines,r);Y9(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(it),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Qa(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(it),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!n){let S=this.ybase+this.y;if(S>=o&&S<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),u=X9(l,this._cols,e),d=u.length-l.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+d):p=Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let S=0;S<d;S++){let w=this.getBlankLine(it,!0);f.push(w)}f.length>0&&(i.push({start:o+l.length+s,newLines:f}),s+=f.length),l.push(...f);let g=u.length-1,m=u[g];m===0&&(g--,m=u[g]);let _=l.length-d-1,b=c;for(;_>=0;){let S=Math.min(b,m);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[_],b-S,m-S,S,!0),m-=S,m===0&&(g--,m=u[g]),b-=S,b===0){_--;let w=Math.max(_,0);b=Yl(l,w,this._cols)}}for(let S=0;S<l.length;S++)u[S]<e&&l[S].setCell(u[S],r);let v=d-p;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let o=[],a=[];for(let m=0;m<this.lines.length;m++)a.push(this.lines.get(m));let l=this.lines.length,c=l-1,u=0,d=i[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let p=0;for(let m=Math.min(this.lines.maxLength-1,l+s-1);m>=0;m--)if(d&&d.start>c+p){for(let _=d.newLines.length-1;_>=0;_--)this.lines.set(m--,d.newLines[_]);m++,o.push({index:c+1,amount:d.newLines.length}),p+=d.newLines.length,d=i[++u]}else this.lines.set(m,a[c--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let g=Math.max(0,l+s-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Z9(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Q9=class extends _e{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new K),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 lT(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lT(!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)}},p2=2,f2=1,db=class extends _e{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p2),this.rows=Math.max(e.rawOptions.rows||0,f2),this.buffers=this._register(new Q9(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};db=Je([Q(0,en)],db);var io={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:Vd,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},J9=["normal","bold","100","200","300","400","500","600","700","800","900"],e7=class extends _e{constructor(e){super(),this._onOptionChange=this._register(new K),this.onOptionChange=this._onOptionChange.event;let t={...io};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(He(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in io))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in io))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=io[e]),!t7(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=io[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=J9.includes(t)?t:io[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 t7(e){return e==="block"||e==="underline"||e==="bar"}function Ja(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Ja(e[r],t-1);return n}var cT=Object.freeze({insertMode:!1}),uT=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hb=class extends _e{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new K),this.onData=this._onData.event,this._onUserInput=this._register(new K),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new K),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ja(cT),this.decPrivateModes=Ja(uT)}reset(){this.modes=Ja(cT),this.decPrivateModes=Ja(uT)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};hb=Je([Q(0,Jt),Q(1,DD),Q(2,en)],hb);var dT={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Rf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Nf=String.fromCharCode,hT={DEFAULT:e=>{let t=[Rf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Nf(t[0])}${Nf(t[1])}${Nf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rf(e,!0)};${e.x};${e.y}${t}`}},pb=class extends _e{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new K),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(dT))this.addProtocol(r,dT[r]);for(let r of Object.keys(hT))this.addEncoding(r,hT[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};pb=Je([Q(0,Jt),Q(1,Ks),Q(2,en)],pb);var If=[[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]],n7=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],dt;function r7(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var i7=class{constructor(){if(this.version="6",!dt){dt=new Uint8Array(65536),dt.fill(1),dt[0]=0,dt.fill(0,1,32),dt.fill(0,127,160),dt.fill(2,4352,4448),dt[9001]=2,dt[9002]=2,dt.fill(2,11904,42192),dt[12351]=1,dt.fill(2,44032,55204),dt.fill(2,63744,64256),dt.fill(2,65040,65050),dt.fill(2,65072,65136),dt.fill(2,65280,65377),dt.fill(2,65504,65511);for(let e=0;e<If.length;++e)dt.fill(0,If[e][0],If[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:r7(e,n7)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=fs.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return fs.createPropertyValue(0,n,r)}},fs=class Ku{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new K,this.onChange=this._onChange.event;let t=new i7;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Ku.extractWidth(a);Ku.extractShouldJoin(a)&&(l-=Ku.extractWidth(r)),n+=l,r=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},s7=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 pT(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ua=2147483647,o7=256,g2=class fb{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>o7)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new fb;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new fb(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ua?Ua:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ua?Ua:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Ua):t}},$a=[],a7=class{constructor(){this._state=0,this._active=$a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$a}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=$a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$a,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Vh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=$a,this._id=-1,this._state=0}}},pn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Vh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},za=[],l7=class{constructor(){this._handlers=Object.create(null),this._active=za,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=za}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=za,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||za,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Vh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=za,this._ident=0}},el=new g2;el.addParam(0);var fT=class{constructor(e){this._handler=e,this._data="",this._params=el,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():el,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Vh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=el,this._data="",this._hitLimit=!1,n));return this._params=el,this._data="",this._hitLimit=!1,t}},c7=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},An=160,u7=function(){let e=new c7(4095),t=Array.apply(null,Array(256)).map((a,l)=>l),n=(a,l)=>t.slice(a,l),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(An,0,2,0),e.add(An,8,5,8),e.add(An,6,0,6),e.add(An,11,0,11),e.add(An,13,13,13),e}(),d7=class extends _e{constructor(e=u7){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 g2,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(He(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new a7),this._dcsParser=this._register(new l7),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;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],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(r=e[a],i=this._transitions.table[this.currentState<<8|(r<160?r:An)],i>>4){case 2:for(let p=a+1;;++p){if(p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-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:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,l,c,i,a),o;c<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(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let u=this._escHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,i,a),o;d<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 p=a+1;;++p)if(p>=t||(r=e[p])===24||r===26||r===27||r>127&&r<An){this._dcsParser.put(e,a,p),a=p-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=a+1;;p++)if(p>=t||(r=e[p])<32||r>127&&r<An){this._oscParser.put(e,a,p),a=p-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},h7=/^([\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})$/,p7=/^[\da-f]+$/;function gT(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=h7.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),p7.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function Of(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function f7(e,t=16){let[n,r,i]=e;return`rgb:${Of(n,t)}/${Of(r,t)}/${Of(i,t)}`}var g7={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ai=131072,mT=10;function bT(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var yT=5e3,vT=0,m7=class extends _e{constructor(e,t,n,r,i,s,o,a,l=new d7){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new MW,this._utf8Decoder=new PW,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=it.clone(),this._eraseAttrDataInternal=it.clone(),this._onRequestBell=this._register(new K),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new K),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new K),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new K),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new K),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new K),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new K),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new K),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new K),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 gb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Wu.IND,()=>this.index()),this._parser.setExecuteHandler(Wu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Wu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pn(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new pn(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new pn(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new pn(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new pn(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new pn(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new pn(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new pn(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new pn(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new pn(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new pn(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new pn(c=>this.restoreCursorColor(c))),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 c in gt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new fT((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),yT))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${yT} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ai&&(s=this._parseStack.position+ai)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ai&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ai))),o||this._dirtyRowTracker.clearRange(),e.length>ai)for(let c=s;c<e.length;c+=ai){let u=c+ai<e.length?c+ai:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,i,d,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&s){let b=s[String.fromCharCode(r)];b&&(r=b.charCodeAt(0))}let g=this._unicodeService.charProperties(r,p);i=fs.extractWidth(g);let m=fs.extractShouldJoin(g),_=m?fs.extractWidth(p):0;if(p=g,o&&this._onA11yChar.fire(fi(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-_>a){if(l){let b=d,v=this._activeBuffer.x-_;for(this._activeBuffer.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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&d instanceof Qa&&d.copyCellsFrom(b,v,0,_,!1);v<a;)b.setCellFromCodepoint(v++,0,1,u)}else if(this._activeBuffer.x=a-1,i===2)continue}if(m&&this._activeBuffer.x){let b=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-b,r,i);for(let v=i-_;--v>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,i-_,this._activeBuffer.getNullCell(u)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=p,this._activeBuffer.x<a&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>bT(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new fT(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new pn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(it));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=fs.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),a=0;for(let c=0;c<s.length;){let u=s.codePointAt(c)||0;o[a++]=u,c+=u>65535?2:1}let l=a;for(let c=1;c<n;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,as),this._charsetService.setgCharset(1,as),this._charsetService.setgCharset(2,as),this._charsetService.setgCharset(3,as);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:u}=a,d=this._optionsService.rawOptions,p=(m,_)=>(o.triggerDataEvent(`${V.ESC}[${t?"":"?"}${m};${_}$y`),!0),f=m=>m?1:2,g=e.params[0];return t?g===2?p(g,4):g===4?p(g,f(o.modes.insertMode)):g===12?p(g,3):g===20?p(g,f(d.convertEol)):p(g,0):g===1?p(g,f(r.applicationCursorKeys)):g===3?p(g,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):g===6?p(g,f(r.origin)):g===7?p(g,f(r.wraparound)):g===8?p(g,3):g===9?p(g,f(i==="X10")):g===12?p(g,f(d.cursorBlink)):g===25?p(g,f(!o.isCursorHidden)):g===45?p(g,f(r.reverseWraparound)):g===66?p(g,f(r.applicationKeypad)):g===67?p(g,4):g===1e3?p(g,f(i==="VT200")):g===1002?p(g,f(i==="DRAG")):g===1003?p(g,f(i==="ANY")):g===1004?p(g,f(r.sendFocus)):g===1005?p(g,4):g===1006?p(g,f(s==="SGR")):g===1015?p(g,4):g===1016?p(g,f(s==="SGR_PIXELS")):g===1048?p(g,1):g===47||g===1047||g===1049?p(g,f(c===u)):g===2004?p(g,f(r.bracketedPasteMode)):g===2026?p(g,f(r.synchronizedOutput)):p(g,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=bc.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do r[1]===5&&(i=1),r[s+a+1+i]=o[a];while(++a<o.length&&a+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=it.fg,e.bg=it.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=it.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=it.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=it.fg&16777215,r.bg&=-67108864,r.bg|=it.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!bT(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>mT&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>mT&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(_T(s))if(i==="?")t.push({type:0,index:s});else{let o=gT(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=gT(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);_T(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,as),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(g7[e[0]],gt[e[1]]||as),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=it.clone(),this._eraseAttrDataInternal=it.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Bn;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${V.ESC}${o}${V.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},gb=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(vT=e,e=t,t=vT),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};gb=Je([Q(0,Jt)],gb);function _T(e){return 0<=e&&e<256}var b7=5e7,ST=12,y7=50,v7=class extends _e{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,n){if(n!==void 0&&this._syncCalls>n){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,n){if(this._pendingData>b7)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+=t.length,this._writeBuffer.push(t),this._callbacks.push(n),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(n)}_innerWrite(t=0,n=!0){let r=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,n);if(s){let a=l=>performance.now()-r>=ST?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(a);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=ST)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>y7&&(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()}},mb=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 a=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mb=Je([Q(0,Jt)],mb);var wT=!1,_7=class extends _e{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Xo),this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onData=this._register(new K),this.onData=this._onData.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new K),this._instantiationService=new V9,this.optionsService=this._register(new e7(e)),this._instantiationService.setService(en,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(db)),this._instantiationService.setService(Jt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ub)),this._instantiationService.setService(DD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hb)),this._instantiationService.setService(Ks,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(pb)),this._instantiationService.setService(LD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fs)),this._instantiationService.setService(UW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s7),this._instantiationService.setService(jW,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mb),this._instantiationService.setService(MD,this._oscLinkService),this._inputHandler=this._register(new m7(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(At.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(At.forward(this._bufferService.onResize,this._onResize)),this._register(At.forward(this.coreService.onData,this._onData)),this._register(At.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 v7((t,n)=>this._inputHandler.parse(t,n))),this._register(At.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new K),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&&!wT&&(this._logService.warn("writeSync is unreliable and will be removed soon."),wT=!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,p2),t=Math.max(t,f2),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(pT.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(pT(this._bufferService),!1))),this._windowsWrappingHeuristics.value=He(()=>{for(let t of e)t.dispose()})}}},S7={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 w7(e,t,n,r){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=V.ESC+"OA":i.key=V.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=V.ESC+"OD":i.key=V.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=V.ESC+"OC":i.key=V.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=V.ESC+"OB":i.key=V.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":V.DEL,e.altKey&&(i.key=V.ESC+i.key);break;case 9:if(e.shiftKey){i.key=V.ESC+"[Z";break}i.key=V.HT,i.cancel=!0;break;case 13:i.key=e.altKey?V.ESC+V.CR:V.CR,i.cancel=!0;break;case 27:i.key=V.ESC,e.altKey&&(i.key=V.ESC+V.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"D":t?i.key=V.ESC+"OD":i.key=V.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"C":t?i.key=V.ESC+"OC":i.key=V.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"A":t?i.key=V.ESC+"OA":i.key=V.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"B":t?i.key=V.ESC+"OB":i.key=V.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=V.ESC+"[2~");break;case 46:s?i.key=V.ESC+"[3;"+(s+1)+"~":i.key=V.ESC+"[3~";break;case 36:s?i.key=V.ESC+"[1;"+(s+1)+"H":t?i.key=V.ESC+"OH":i.key=V.ESC+"[H";break;case 35:s?i.key=V.ESC+"[1;"+(s+1)+"F":t?i.key=V.ESC+"OF":i.key=V.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=V.ESC+"[5;"+(s+1)+"~":i.key=V.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=V.ESC+"[6;"+(s+1)+"~":i.key=V.ESC+"[6~";break;case 112:s?i.key=V.ESC+"[1;"+(s+1)+"P":i.key=V.ESC+"OP";break;case 113:s?i.key=V.ESC+"[1;"+(s+1)+"Q":i.key=V.ESC+"OQ";break;case 114:s?i.key=V.ESC+"[1;"+(s+1)+"R":i.key=V.ESC+"OR";break;case 115:s?i.key=V.ESC+"[1;"+(s+1)+"S":i.key=V.ESC+"OS";break;case 116:s?i.key=V.ESC+"[15;"+(s+1)+"~":i.key=V.ESC+"[15~";break;case 117:s?i.key=V.ESC+"[17;"+(s+1)+"~":i.key=V.ESC+"[17~";break;case 118:s?i.key=V.ESC+"[18;"+(s+1)+"~":i.key=V.ESC+"[18~";break;case 119:s?i.key=V.ESC+"[19;"+(s+1)+"~":i.key=V.ESC+"[19~";break;case 120:s?i.key=V.ESC+"[20;"+(s+1)+"~":i.key=V.ESC+"[20~";break;case 121:s?i.key=V.ESC+"[21;"+(s+1)+"~":i.key=V.ESC+"[21~";break;case 122:s?i.key=V.ESC+"[23;"+(s+1)+"~":i.key=V.ESC+"[23~";break;case 123:s?i.key=V.ESC+"[24;"+(s+1)+"~":i.key=V.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=V.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=V.DEL:e.keyCode===219?i.key=V.ESC:e.keyCode===220?i.key=V.FS:e.keyCode===221&&(i.key=V.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let a=(o=S7[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)i.key=V.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let l=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(l);e.shiftKey&&(c=c.toUpperCase()),i.key=V.ESC+c}else if(e.keyCode===32)i.key=V.ESC+(e.ctrlKey?V.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let l=e.code.slice(3,4);e.shiftKey||(l=l.toLowerCase()),i.key=V.ESC+l,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=V.US),e.key==="@"&&(i.key=V.NUL));break}return i}var et=0,x7=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Gd,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Gd,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(et=this._search(t),et===-1)||this._getKey(this._array[et])!==t)return!1;do if(this._array[et]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(et),!0;while(++et<this._array.length&&this._getKey(this._array[et])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(et=this._search(e),!(et<0||et>=this._array.length)&&this._getKey(this._array[et])===e))do yield this._array[et];while(++et<this._array.length&&this._getKey(this._array[et])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(et=this._search(e),!(et<0||et>=this._array.length)&&this._getKey(this._array[et])===e))do t(this._array[et]);while(++et<this._array.length&&this._getKey(this._array[et])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Lf=0,xT=0,E7=class extends _e{constructor(){super(),this._decorations=new x7(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new K),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new K),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(He(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new k7(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Lf=i.options.x??0,xT=Lf+(i.options.width??1),e>=Lf&&e<xT&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},k7=class extends Ii{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new K),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new K),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},C7=1e3,T7=class{constructor(e,t=C7){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_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)}},ET=20,Wd=class extends _e{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new T7(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
473
|
+
`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(e){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),Uv&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(e){let t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r||!t?!1:this._areCoordsInSelection(t,n,r)}isCellInSelection(e,t){let n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!n||!r?!1:this._areCoordsInSelection([e,t],n,r)}_areCoordsInSelection(e,t,n){return e[1]>t[1]&&e[1]<n[1]||t[1]===n[1]&&e[1]===t[1]&&e[0]>=t[0]&&e[0]<n[0]||t[1]<n[1]&&e[1]===n[1]&&e[0]<n[0]||t[1]<n[1]&&e[1]===t[1]&&e[0]>=t[0]}_selectWordAtCursor(e,t){var i,s;let n=(s=(i=this._linkifier.currentLink)==null?void 0:i.link)==null?void 0:s.range;if(n)return this._model.selectionStart=[n.start.x-1,n.start.y-1],this._model.selectionStartLength=tT(n,this._bufferService.cols),this._model.selectionEnd=void 0,!0;let r=this._getMouseBufferCoords(e);return r?(this._selectWordAt(r,t),this._model.selectionEnd=void 0,!0):!1}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()}_handleTrim(e){this._model.handleTrim(e)&&this.refresh()}_getMouseBufferCoords(e){let t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t}_getMouseEventScrollAmount(e){let t=jv(this._coreBrowserService.window,e,this._screenElement)[1],n=this._renderService.dimensions.css.canvas.height;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-Tf),Tf),t/=Tf,t/Math.abs(t)+Math.round(t*(F9-1)))}shouldForceSelection(e){return Vd?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(),B9)}_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&&!(Vd&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_handleMouseMove(e){if(e.stopImmediatePropagation(),!this._model.selectionStart)return;let t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),!this._model.selectionEnd){this.refresh(!0);return}this._activeSelectionMode===2?this._model.selectionEnd[1]<this._model.selectionStart[1]?this._model.selectionEnd[0]=0:this._model.selectionEnd[0]=this._bufferService.cols:this._activeSelectionMode===1&&this._selectToWordAt(this._model.selectionEnd),this._dragScrollAmount=this._getMouseEventScrollAmount(e),this._activeSelectionMode!==3&&(this._dragScrollAmount>0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));let n=this._bufferService.buffer;if(this._model.selectionEnd[1]<n.lines.length){let r=n.lines.get(this._model.selectionEnd[1]);r&&r.hasWidth(this._model.selectionEnd[0])===0&&this._model.selectionEnd[0]<this._bufferService.cols&&this._model.selectionEnd[0]++}(!t||t[0]!==this._model.selectionEnd[0]||t[1]!==this._model.selectionEnd[1])&&this.refresh(!0)}_dragScroll(){if(!(!this._model.selectionEnd||!this._model.selectionStart)&&this._dragScrollAmount){this._onRequestScrollLines.fire({amount:this._dragScrollAmount,suppressScrollEvent:!1});let e=this._bufferService.buffer;this._dragScrollAmount>0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}}_handleMouseUp(e){let t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<j9&&e.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){let n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&n[0]!==void 0&&n[1]!==void 0){let r=R9(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!!e&&!!t&&(e[0]!==t[0]||e[1]!==t[1]);if(!n){this._oldHasSelection&&this._fireOnSelectionChange(e,t,n);return}!e||!t||(!this._oldSelectionStart||!this._oldSelectionEnd||e[0]!==this._oldSelectionStart[0]||e[1]!==this._oldSelectionStart[1]||t[0]!==this._oldSelectionEnd[0]||t[1]!==this._oldSelectionEnd[1])&&this._fireOnSelectionChange(e,t,n)}_fireOnSelectionChange(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()}_handleBufferActivate(e){this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(t=>this._handleTrim(t))}_convertViewportColToCharacterIndex(e,t){let n=t;for(let r=0;t>=r;r++){let i=e.loadCell(r,this._workCell).getChars().length;this._workCell.getWidth()===0?n--:i>1&&t!==r&&(n+=i-1)}return n}setSelection(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(e,t,n=!0,r=!0){if(e[0]>=this._bufferService.cols)return;let i=this._bufferService.buffer,s=i.lines.get(e[1]);if(!s)return;let o=i.translateBufferLineToString(e[1],!1),a=this._convertViewportColToCharacterIndex(s,e[0]),l=a,c=e[0]-a,u=0,d=0,p=0,f=0;if(o.charAt(a)===" "){for(;a>0&&o.charAt(a-1)===" ";)a--;for(;l<o.length&&o.charAt(l+1)===" ";)l++}else{let _=e[0],b=e[0];s.getWidth(_)===0&&(u++,_--),s.getWidth(b)===2&&(d++,b++);let v=s.getString(b).length;for(v>1&&(f+=v-1,l+=v-1);_>0&&a>0&&!this._isCharWordSeparator(s.loadCell(_-1,this._workCell));){s.loadCell(_-1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===0?(u++,_--):S>1&&(p+=S-1,a-=S-1),a--,_--}for(;b<s.length&&l+1<o.length&&!this._isCharWordSeparator(s.loadCell(b+1,this._workCell));){s.loadCell(b+1,this._workCell);let S=this._workCell.getChars().length;this._workCell.getWidth()===2?(d++,b++):S>1&&(f+=S-1,l+=S-1),l++,b++}}l++;let g=a+c-u+p,m=Math.min(this._bufferService.cols,l-a+u+d-p-f);if(!(!t&&o.slice(a,l).trim()==="")){if(n&&g===0&&s.getCodePoint(0)!==32){let _=i.lines.get(e[1]-1);if(_&&s.isWrapped&&_.getCodePoint(this._bufferService.cols-1)!==32){let b=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(b){let v=this._bufferService.cols-b.start;g-=v,m+=v}}}if(r&&g+m===this._bufferService.cols&&s.getCodePoint(this._bufferService.cols-1)!==32){let _=i.lines.get(e[1]+1);if(_!=null&&_.isWrapped&&_.getCodePoint(0)!==32){let b=this._getWordAt([0,e[1]+1],!1,!1,!0);b&&(m+=b.length)}}return{start:g,length:m}}}_selectWordAt(e,t){let n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}}_selectToWordAt(e){let t=this._getWordAt(e,!0);if(t){let n=e[1];for(;t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}}_isCharWordSeparator(e){return e.getWidth()===0?!1:this._optionsService.rawOptions.wordSeparator.indexOf(e.getChars())>=0}_selectLineAt(e){let t=this._bufferService.buffer.getWrappedRangeForLine(e),n={start:{x:0,y:t.first},end:{x:this._bufferService.cols-1,y:t.last}};this._model.selectionStart=[0,t.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=tT(n,this._bufferService.cols)}};lb=et([Q(3,Jt),Q(4,Ks),Q(5,Ov),Q(6,en),Q(7,Jr),Q(8,Qr)],lb);var nT=class{constructor(){this._data={}}set(e,t,n){this._data[e]||(this._data[e]={}),this._data[e][t]=n}get(e,t){return this._data[e]?this._data[e][t]:void 0}clear(){this._data={}}},rT=class{constructor(){this._color=new nT,this._css=new nT}setCss(e,t,n){this._css.set(e,t,n)}getCss(e,t){return this._css.get(e,t)}setColor(e,t,n){this._color.set(e,t,n)}getColor(e,t){return this._color.get(e,t)}clear(){this._color.clear(),this._css.clear()}},ut=Object.freeze((()=>{let e=[Ge.toColor("#2e3436"),Ge.toColor("#cc0000"),Ge.toColor("#4e9a06"),Ge.toColor("#c4a000"),Ge.toColor("#3465a4"),Ge.toColor("#75507b"),Ge.toColor("#06989a"),Ge.toColor("#d3d7cf"),Ge.toColor("#555753"),Ge.toColor("#ef2929"),Ge.toColor("#8ae234"),Ge.toColor("#fce94f"),Ge.toColor("#729fcf"),Ge.toColor("#ad7fa8"),Ge.toColor("#34e2e2"),Ge.toColor("#eeeeec")],t=[0,95,135,175,215,255];for(let n=0;n<216;n++){let r=t[n/36%6|0],i=t[n/6%6|0],s=t[n%6];e.push({css:ot.toCss(r,i,s),rgba:ot.toRgba(r,i,s)})}for(let n=0;n<24;n++){let r=8+n*10;e.push({css:ot.toCss(r,r,r),rgba:ot.toRgba(r,r,r)})}return e})()),os=Ge.toColor("#ffffff"),Za=Ge.toColor("#000000"),iT=Ge.toColor("#ffffff"),sT=Za,ja={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117},z9=os,cb=class extends _e{constructor(e){super(),this._optionsService=e,this._contrastCache=new rT,this._halfContrastCache=new rT,this._onChangeColors=this._register(new K),this.onChangeColors=this._onChangeColors.event,this._colors={foreground:os,background:Za,cursor:iT,cursorAccent:sT,selectionForeground:void 0,selectionBackgroundTransparent:ja,selectionBackgroundOpaque:Be.blend(Za,ja),selectionInactiveBackgroundTransparent:ja,selectionInactiveBackgroundOpaque:Be.blend(Za,ja),scrollbarSliderBackground:Be.opacity(os,.2),scrollbarSliderHoverBackground:Be.opacity(os,.4),scrollbarSliderActiveBackground:Be.opacity(os,.5),overviewRulerBorder:os,ansi:ut.slice(),contrastCache:this._contrastCache,halfContrastCache:this._halfContrastCache},this._updateRestoreColors(),this._setTheme(this._optionsService.rawOptions.theme),this._register(this._optionsService.onSpecificOptionChange("minimumContrastRatio",()=>this._contrastCache.clear())),this._register(this._optionsService.onSpecificOptionChange("theme",()=>this._setTheme(this._optionsService.rawOptions.theme)))}get colors(){return this._colors}_setTheme(e={}){let t=this._colors;if(t.foreground=Re(e.foreground,os),t.background=Re(e.background,Za),t.cursor=Be.blend(t.background,Re(e.cursor,iT)),t.cursorAccent=Be.blend(t.background,Re(e.cursorAccent,sT)),t.selectionBackgroundTransparent=Re(e.selectionBackground,ja),t.selectionBackgroundOpaque=Be.blend(t.background,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundTransparent=Re(e.selectionInactiveBackground,t.selectionBackgroundTransparent),t.selectionInactiveBackgroundOpaque=Be.blend(t.background,t.selectionInactiveBackgroundTransparent),t.selectionForeground=e.selectionForeground?Re(e.selectionForeground,Q1):void 0,t.selectionForeground===Q1&&(t.selectionForeground=void 0),Be.isOpaque(t.selectionBackgroundTransparent)&&(t.selectionBackgroundTransparent=Be.opacity(t.selectionBackgroundTransparent,.3)),Be.isOpaque(t.selectionInactiveBackgroundTransparent)&&(t.selectionInactiveBackgroundTransparent=Be.opacity(t.selectionInactiveBackgroundTransparent,.3)),t.scrollbarSliderBackground=Re(e.scrollbarSliderBackground,Be.opacity(t.foreground,.2)),t.scrollbarSliderHoverBackground=Re(e.scrollbarSliderHoverBackground,Be.opacity(t.foreground,.4)),t.scrollbarSliderActiveBackground=Re(e.scrollbarSliderActiveBackground,Be.opacity(t.foreground,.5)),t.overviewRulerBorder=Re(e.overviewRulerBorder,z9),t.ansi=ut.slice(),t.ansi[0]=Re(e.black,ut[0]),t.ansi[1]=Re(e.red,ut[1]),t.ansi[2]=Re(e.green,ut[2]),t.ansi[3]=Re(e.yellow,ut[3]),t.ansi[4]=Re(e.blue,ut[4]),t.ansi[5]=Re(e.magenta,ut[5]),t.ansi[6]=Re(e.cyan,ut[6]),t.ansi[7]=Re(e.white,ut[7]),t.ansi[8]=Re(e.brightBlack,ut[8]),t.ansi[9]=Re(e.brightRed,ut[9]),t.ansi[10]=Re(e.brightGreen,ut[10]),t.ansi[11]=Re(e.brightYellow,ut[11]),t.ansi[12]=Re(e.brightBlue,ut[12]),t.ansi[13]=Re(e.brightMagenta,ut[13]),t.ansi[14]=Re(e.brightCyan,ut[14]),t.ansi[15]=Re(e.brightWhite,ut[15]),e.extendedAnsi){let n=Math.min(t.ansi.length-16,e.extendedAnsi.length);for(let r=0;r<n;r++)t.ansi[r+16]=Re(e.extendedAnsi[r],ut[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()}}};cb=et([Q(0,en)],cb);function Re(e,t){if(e!==void 0)try{return Ge.toColor(e)}catch{}return t}var H9=class{constructor(...e){this._entries=new Map;for(let[t,n]of e)this.set(t,n)}set(e,t){let n=this._entries.get(e);return this._entries.set(e,t),n}forEach(e){for(let[t,n]of this._entries.entries())e(t,n)}has(e){return this._entries.has(e)}get(e){return this._entries.get(e)}},V9=class{constructor(){this._services=new H9,this._services.set(Iv,this)}setService(e,t){this._services.set(e,t)}getService(e){return this._services.get(e)}createInstance(e,...t){let n=FW(e).sort((s,o)=>s.index-o.index),r=[];for(let s of n){let o=this._services.get(s.id);if(!o)throw new Error(`[createInstance] ${e.name} depends on UNKNOWN service ${s.id._id}.`);r.push(o)}let i=n.length>0?n[0].index:t.length;if(t.length!==i)throw new Error(`[createInstance] First service dependency of ${e.name} at position ${i+1} conflicts with ${t.length} static arguments`);return new e(...t,...r)}},G9={trace:0,debug:1,info:2,warn:3,error:4,off:5},W9="xterm.js: ",ub=class extends _e{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=G9[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]=="function"&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?"":W9)+t,...n)}trace(e,...t){var n;this._logLevel<=0&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.trace.bind(this._optionsService.options.logger))??console.log,e,t)}debug(e,...t){var n;this._logLevel<=1&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.debug.bind(this._optionsService.options.logger))??console.log,e,t)}info(e,...t){var n;this._logLevel<=2&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.info.bind(this._optionsService.options.logger))??console.info,e,t)}warn(e,...t){var n;this._logLevel<=3&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.warn.bind(this._optionsService.options.logger))??console.warn,e,t)}error(e,...t){var n;this._logLevel<=4&&this._log(((n=this._optionsService.options.logger)==null?void 0:n.error.bind(this._optionsService.options.logger))??console.error,e,t)}};ub=et([Q(0,en)],ub);var oT=class extends _e{constructor(e){super(),this._maxLength=e,this.onDeleteEmitter=this._register(new K),this.onDelete=this.onDeleteEmitter.event,this.onInsertEmitter=this._register(new K),this.onInsert=this.onInsertEmitter.event,this.onTrimEmitter=this._register(new K),this.onTrim=this.onTrimEmitter.event,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get maxLength(){return this._maxLength}set maxLength(e){if(this._maxLength===e)return;let t=new Array(e);for(let n=0;n<Math.min(e,this.length);n++)t[n]=this._array[this._getCyclicIndex(n)];this._array=t,this._maxLength=e,this._startIndex=0}get length(){return this._length}set length(e){if(e>this._length)for(let t=this._length;t<e;t++)this._array[t]=void 0;this._length=e}get(e){return this._array[this._getCyclicIndex(e)]}set(e,t){this._array[this._getCyclicIndex(e)]=t}push(e){this._array[this._getCyclicIndex(this._length)]=e,this._length===this._maxLength?(this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1)):this._length++}recycle(){if(this._length!==this._maxLength)throw new Error("Can only recycle when the buffer is full");return this._startIndex=++this._startIndex%this._maxLength,this.onTrimEmitter.fire(1),this._array[this._getCyclicIndex(this._length-1)]}get isFull(){return this._length===this._maxLength}pop(){return this._array[this._getCyclicIndex(this._length---1)]}splice(e,t,...n){if(t){for(let r=e;r<this._length-t;r++)this._array[this._getCyclicIndex(r)]=this._array[this._getCyclicIndex(r+t)];this._length-=t,this.onDeleteEmitter.fire({index:e,amount:t})}for(let r=this._length-1;r>=e;r--)this._array[this._getCyclicIndex(r+n.length)]=this._array[this._getCyclicIndex(r)];for(let r=0;r<n.length;r++)this._array[this._getCyclicIndex(e+r)]=n[r];if(n.length&&this.onInsertEmitter.fire({index:e,amount:n.length}),this._length+n.length>this._maxLength){let r=this._length+n.length-this._maxLength;this._startIndex+=r,this._length=this._maxLength,this.onTrimEmitter.fire(r)}else this._length+=n.length}trimStart(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)}shiftElements(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(let i=t-1;i>=0;i--)this.set(e+i+n,this.get(e+i));let r=e+t+n-this._length;if(r>0)for(this._length+=r;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let r=0;r<t;r++)this.set(e+r+n,this.get(e+r))}}_getCyclicIndex(e){return(this._startIndex+e)%this._maxLength}},ve=3,it=Object.freeze(new bc),hu=0,Af=2,Qa=class u2{constructor(t,n,r=!1){this.isWrapped=r,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(t*ve);let i=n||Bn.fromCharData([0,RD,1,0]);for(let s=0;s<t;++s)this.setCell(s,i);this.length=t}get(t){let n=this._data[t*ve+0],r=n&2097151;return[this._data[t*ve+1],n&2097152?this._combined[t]:r?fi(r):"",n>>22,n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):r]}set(t,n){this._data[t*ve+1]=n[0],n[1].length>1?(this._combined[t]=n[1],this._data[t*ve+0]=t|2097152|n[2]<<22):this._data[t*ve+0]=n[1].charCodeAt(0)|n[2]<<22}getWidth(t){return this._data[t*ve+0]>>22}hasWidth(t){return this._data[t*ve+0]&12582912}getFg(t){return this._data[t*ve+1]}getBg(t){return this._data[t*ve+2]}hasContent(t){return this._data[t*ve+0]&4194303}getCodePoint(t){let n=this._data[t*ve+0];return n&2097152?this._combined[t].charCodeAt(this._combined[t].length-1):n&2097151}isCombined(t){return this._data[t*ve+0]&2097152}getString(t){let n=this._data[t*ve+0];return n&2097152?this._combined[t]:n&2097151?fi(n&2097151):""}isProtected(t){return this._data[t*ve+2]&536870912}loadCell(t,n){return hu=t*ve,n.content=this._data[hu+0],n.fg=this._data[hu+1],n.bg=this._data[hu+2],n.content&2097152&&(n.combinedData=this._combined[t]),n.bg&268435456&&(n.extended=this._extendedAttrs[t]),n}setCell(t,n){n.content&2097152&&(this._combined[t]=n.combinedData),n.bg&268435456&&(this._extendedAttrs[t]=n.extended),this._data[t*ve+0]=n.content,this._data[t*ve+1]=n.fg,this._data[t*ve+2]=n.bg}setCellFromCodepoint(t,n,r,i){i.bg&268435456&&(this._extendedAttrs[t]=i.extended),this._data[t*ve+0]=n|r<<22,this._data[t*ve+1]=i.fg,this._data[t*ve+2]=i.bg}addCodepointToCell(t,n,r){let i=this._data[t*ve+0];i&2097152?this._combined[t]+=fi(n):i&2097151?(this._combined[t]=fi(i&2097151)+fi(n),i&=-2097152,i|=2097152):i=n|1<<22,r&&(i&=-12582913,i|=r<<22),this._data[t*ve+0]=i}insertCells(t,n,r){if(t%=this.length,t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length-t){let i=new Bn;for(let s=this.length-t-n-1;s>=0;--s)this.setCell(t+n+s,this.loadCell(t+s,i));for(let s=0;s<n;++s)this.setCell(t+s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);this.getWidth(this.length-1)===2&&this.setCellFromCodepoint(this.length-1,0,1,r)}deleteCells(t,n,r){if(t%=this.length,n<this.length-t){let i=new Bn;for(let s=0;s<this.length-t-n;++s)this.setCell(t+s,this.loadCell(t+n+s,i));for(let s=this.length-n;s<this.length;++s)this.setCell(s,r)}else for(let i=t;i<this.length;++i)this.setCell(i,r);t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),this.getWidth(t)===0&&!this.hasContent(t)&&this.setCellFromCodepoint(t,0,1,r)}replaceCells(t,n,r,i=!1){if(i){for(t&&this.getWidth(t-1)===2&&!this.isProtected(t-1)&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&!this.isProtected(n)&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.isProtected(t)||this.setCell(t,r),t++;return}for(t&&this.getWidth(t-1)===2&&this.setCellFromCodepoint(t-1,0,1,r),n<this.length&&this.getWidth(n-1)===2&&this.setCellFromCodepoint(n,0,1,r);t<n&&t<this.length;)this.setCell(t++,r)}resize(t,n){if(t===this.length)return this._data.length*4*Af<this._data.buffer.byteLength;let r=t*ve;if(t>this.length){if(this._data.buffer.byteLength>=r*4)this._data=new Uint32Array(this._data.buffer,0,r);else{let i=new Uint32Array(r);i.set(this._data),this._data=i}for(let i=this.length;i<t;++i)this.setCell(i,n)}else{this._data=this._data.subarray(0,r);let i=Object.keys(this._combined);for(let o=0;o<i.length;o++){let a=parseInt(i[o],10);a>=t&&delete this._combined[a]}let s=Object.keys(this._extendedAttrs);for(let o=0;o<s.length;o++){let a=parseInt(s[o],10);a>=t&&delete this._extendedAttrs[a]}}return this.length=t,r*4*Af<this._data.buffer.byteLength}cleanupMemory(){if(this._data.length*4*Af<this._data.buffer.byteLength){let t=new Uint32Array(this._data.length);return t.set(this._data),this._data=t,1}return 0}fill(t,n=!1){if(n){for(let r=0;r<this.length;++r)this.isProtected(r)||this.setCell(r,t);return}this._combined={},this._extendedAttrs={};for(let r=0;r<this.length;++r)this.setCell(r,t)}copyFrom(t){this.length!==t.length?this._data=new Uint32Array(t._data):this._data.set(t._data),this.length=t.length,this._combined={};for(let n in t._combined)this._combined[n]=t._combined[n];this._extendedAttrs={};for(let n in t._extendedAttrs)this._extendedAttrs[n]=t._extendedAttrs[n];this.isWrapped=t.isWrapped}clone(){let t=new u2(0);t._data=new Uint32Array(this._data),t.length=this.length;for(let n in this._combined)t._combined[n]=this._combined[n];for(let n in this._extendedAttrs)t._extendedAttrs[n]=this._extendedAttrs[n];return t.isWrapped=this.isWrapped,t}getTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ve+0]&4194303)return t+(this._data[t*ve+0]>>22);return 0}getNoBgTrimmedLength(){for(let t=this.length-1;t>=0;--t)if(this._data[t*ve+0]&4194303||this._data[t*ve+2]&50331648)return t+(this._data[t*ve+0]>>22);return 0}copyCellsFrom(t,n,r,i,s){let o=t._data;if(s)for(let l=i-1;l>=0;l--){for(let c=0;c<ve;c++)this._data[(r+l)*ve+c]=o[(n+l)*ve+c];o[(n+l)*ve+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}else for(let l=0;l<i;l++){for(let c=0;c<ve;c++)this._data[(r+l)*ve+c]=o[(n+l)*ve+c];o[(n+l)*ve+2]&268435456&&(this._extendedAttrs[r+l]=t._extendedAttrs[n+l])}let a=Object.keys(t._combined);for(let l=0;l<a.length;l++){let c=parseInt(a[l],10);c>=n&&(this._combined[c-n+r]=t._combined[c])}}translateToString(t,n,r,i){n=n??0,r=r??this.length,t&&(r=Math.min(r,this.getTrimmedLength())),i&&(i.length=0);let s="";for(;n<r;){let o=this._data[n*ve+0],a=o&2097151,l=o&2097152?this._combined[n]:a?fi(a):Si;if(s+=l,i)for(let c=0;c<l.length;++c)i.push(n);n+=o>>22||1}return i&&i.push(n),s}};function q9(e,t,n,r,i,s){let o=[];for(let a=0;a<e.length-1;a++){let l=a,c=e.get(++l);if(!c.isWrapped)continue;let u=[e.get(a)];for(;l<e.length&&c.isWrapped;)u.push(c),c=e.get(++l);if(!s&&r>=a&&r<l){a+=u.length-1;continue}let d=0,p=Yl(u,d,t),f=1,g=0;for(;f<u.length;){let _=Yl(u,f,t),b=_-g,v=n-p,S=Math.min(b,v);u[d].copyCellsFrom(u[f],g,p,S,!1),p+=S,p===n&&(d++,p=0),g+=S,g===_&&(f++,g=0),p===0&&d!==0&&u[d-1].getWidth(n-1)===2&&(u[d].copyCellsFrom(u[d-1],n-1,p++,1,!1),u[d-1].setCell(n-1,i))}u[d].replaceCells(p,n,i);let m=0;for(let _=u.length-1;_>0&&(_>d||u[_].getTrimmedLength()===0);_--)m++;m>0&&(o.push(a+u.length-m),o.push(m)),a+=u.length-1}return o}function K9(e,t){let n=[],r=0,i=t[r],s=0;for(let o=0;o<e.length;o++)if(i===o){let a=t[++r];e.onDeleteEmitter.fire({index:o-s,amount:a}),o+=a-1,s+=a,i=t[++r]}else n.push(o);return{layout:n,countRemoved:s}}function Y9(e,t){let n=[];for(let r=0;r<t.length;r++)n.push(e.get(t[r]));for(let r=0;r<n.length;r++)e.set(r,n[r]);e.length=t.length}function X9(e,t,n){let r=[],i=e.map((l,c)=>Yl(e,c,t)).reduce((l,c)=>l+c),s=0,o=0,a=0;for(;a<i;){if(i-a<n){r.push(i-a);break}s+=n;let l=Yl(e,o,t);s>l&&(s-=l,o++);let c=e[o].getWidth(s-1)===2;c&&s--;let u=c?n-1:n;r.push(u),a+=u}return r}function Yl(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();let r=!e[t].hasContent(n-1)&&e[t].getWidth(n-1)===1,i=e[t+1].getWidth(0)===2;return r&&i?n-1:n}var d2=class h2{constructor(t){this.line=t,this.isDisposed=!1,this._disposables=[],this._id=h2._nextId++,this._onDispose=this.register(new K),this.onDispose=this._onDispose.event}get id(){return this._id}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),Is(this._disposables),this._disposables.length=0)}register(t){return this._disposables.push(t),t}};d2._nextId=1;var Z9=d2,gt={},as=gt.B;gt[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:"≥","{":"π","|":"≠","}":"£","~":"·"};gt.A={"#":"£"};gt.B=void 0;gt[4]={"#":"£","@":"¾","[":"ij","\\":"½","]":"|","{":"¨","|":"f","}":"¼","~":"´"};gt.C=gt[5]={"[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt.R={"#":"£","@":"à","[":"°","\\":"ç","]":"§","{":"é","|":"ù","}":"è","~":"¨"};gt.Q={"@":"à","[":"â","\\":"ç","]":"ê","^":"î","`":"ô","{":"é","|":"ù","}":"è","~":"û"};gt.K={"@":"§","[":"Ä","\\":"Ö","]":"Ü","{":"ä","|":"ö","}":"ü","~":"ß"};gt.Y={"#":"£","@":"§","[":"°","\\":"ç","]":"é","`":"ù","{":"à","|":"ò","}":"è","~":"ì"};gt.E=gt[6]={"@":"Ä","[":"Æ","\\":"Ø","]":"Å","^":"Ü","`":"ä","{":"æ","|":"ø","}":"å","~":"ü"};gt.Z={"#":"£","@":"§","[":"¡","\\":"Ñ","]":"¿","{":"°","|":"ñ","}":"ç"};gt.H=gt[7]={"@":"É","[":"Ä","\\":"Ö","]":"Å","^":"Ü","`":"é","{":"ä","|":"ö","}":"å","~":"ü"};gt["="]={"#":"ù","@":"à","[":"é","\\":"ç","]":"ê","^":"î",_:"è","`":"ô","{":"ä","|":"ö","}":"ü","~":"û"};var aT=4294967295,lT=class{constructor(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.tabs={},this.savedY=0,this.savedX=0,this.savedCurAttrData=it.clone(),this.savedCharset=as,this.markers=[],this._nullCell=Bn.fromCharData([0,RD,1,0]),this._whitespaceCell=Bn.fromCharData([0,Si,1,32]),this._isClearing=!1,this._memoryCleanupQueue=new Gd,this._memoryCleanupPosition=0,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new oT(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new $d),this._nullCell}getWhitespaceCell(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new $d),this._whitespaceCell}getBlankLine(e,t){return new Qa(this._bufferService.cols,this.getNullCell(e),t)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){let e=this.ybase+this.y-this.ydisp;return e>=0&&e<this._rows}_getCorrectBufferLength(e){if(!this._hasScrollback)return e;let t=e+this._optionsService.rawOptions.scrollback;return t>aT?aT:t}fillViewportRows(e){if(this.lines.length===0){e===void 0&&(e=it);let t=this._rows;for(;t--;)this.lines.push(this.getBlankLine(e))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new oT(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(e,t){let n=this.getNullCell(it),r=0,i=this._getCorrectBufferLength(t);if(i>this.lines.maxLength&&(this.lines.maxLength=i),this.lines.length>0){if(this._cols<e)for(let o=0;o<this.lines.length;o++)r+=+this.lines.get(o).resize(e,n);let s=0;if(this._rows<t)for(let o=this._rows;o<t;o++)this.lines.length<t+this.ybase&&(this._optionsService.rawOptions.windowsMode||this._optionsService.rawOptions.windowsPty.backend!==void 0||this._optionsService.rawOptions.windowsPty.buildNumber!==void 0?this.lines.push(new Qa(e,n)):this.ybase>0&&this.lines.length<=this.ybase+this.y+s+1?(this.ybase--,s++,this.ydisp>0&&this.ydisp--):this.lines.push(new Qa(e,n)));else for(let o=this._rows;o>t;o--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(i<this.lines.maxLength){let o=this.lines.length-i;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=i}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),s&&(this.y+=s),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(let s=0;s<this.lines.length;s++)r+=+this.lines.get(s).resize(e,n);this._cols=e,this._rows=t,this._memoryCleanupQueue.clear(),r>.1*this.lines.length&&(this._memoryCleanupPosition=0,this._memoryCleanupQueue.enqueue(()=>this._batchedMemoryCleanup()))}_batchedMemoryCleanup(){let e=!0;this._memoryCleanupPosition>=this.lines.length&&(this._memoryCleanupPosition=0,e=!1);let t=0;for(;this._memoryCleanupPosition<this.lines.length;)if(t+=this.lines.get(this._memoryCleanupPosition++).cleanupMemory(),t>100)return!0;return e}get _isReflowEnabled(){let e=this._optionsService.rawOptions.windowsPty;return e&&e.buildNumber?this._hasScrollback&&e.backend==="conpty"&&e.buildNumber>=21376:this._hasScrollback&&!this._optionsService.rawOptions.windowsMode}_reflow(e,t){this._cols!==e&&(e>this._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))}_reflowLarger(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=q9(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(it),n);if(r.length>0){let i=K9(this.lines,r);Y9(this.lines,i.layout),this._reflowLargerAdjustViewport(e,t,i.countRemoved)}}_reflowLargerAdjustViewport(e,t,n){let r=this.getNullCell(it),i=n;for(;i-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length<t&&this.lines.push(new Qa(e,r))):(this.ydisp===this.ybase&&this.ydisp--,this.ybase--);this.savedY=Math.max(this.savedY-n,0)}_reflowSmaller(e,t){let n=this._optionsService.rawOptions.reflowCursorLine,r=this.getNullCell(it),i=[],s=0;for(let o=this.lines.length-1;o>=0;o--){let a=this.lines.get(o);if(!a||!a.isWrapped&&a.getTrimmedLength()<=e)continue;let l=[a];for(;a.isWrapped&&o>0;)a=this.lines.get(--o),l.unshift(a);if(!n){let S=this.ybase+this.y;if(S>=o&&S<o+l.length)continue}let c=l[l.length-1].getTrimmedLength(),u=X9(l,this._cols,e),d=u.length-l.length,p;this.ybase===0&&this.y!==this.lines.length-1?p=Math.max(0,this.y-this.lines.maxLength+d):p=Math.max(0,this.lines.length-this.lines.maxLength+d);let f=[];for(let S=0;S<d;S++){let w=this.getBlankLine(it,!0);f.push(w)}f.length>0&&(i.push({start:o+l.length+s,newLines:f}),s+=f.length),l.push(...f);let g=u.length-1,m=u[g];m===0&&(g--,m=u[g]);let _=l.length-d-1,b=c;for(;_>=0;){let S=Math.min(b,m);if(l[g]===void 0)break;if(l[g].copyCellsFrom(l[_],b-S,m-S,S,!0),m-=S,m===0&&(g--,m=u[g]),b-=S,b===0){_--;let w=Math.max(_,0);b=Yl(l,w,this._cols)}}for(let S=0;S<l.length;S++)u[S]<e&&l[S].setCell(u[S],r);let v=d-p;for(;v-- >0;)this.ybase===0?this.y<t-1?(this.y++,this.lines.pop()):(this.ybase++,this.ydisp++):this.ybase<Math.min(this.lines.maxLength,this.lines.length+s)-t&&(this.ybase===this.ydisp&&this.ydisp++,this.ybase++);this.savedY=Math.min(this.savedY+d,this.ybase+t-1)}if(i.length>0){let o=[],a=[];for(let m=0;m<this.lines.length;m++)a.push(this.lines.get(m));let l=this.lines.length,c=l-1,u=0,d=i[u];this.lines.length=Math.min(this.lines.maxLength,this.lines.length+s);let p=0;for(let m=Math.min(this.lines.maxLength-1,l+s-1);m>=0;m--)if(d&&d.start>c+p){for(let _=d.newLines.length-1;_>=0;_--)this.lines.set(m--,d.newLines[_]);m++,o.push({index:c+1,amount:d.newLines.length}),p+=d.newLines.length,d=i[++u]}else this.lines.set(m,a[c--]);let f=0;for(let m=o.length-1;m>=0;m--)o[m].index+=f,this.lines.onInsertEmitter.fire(o[m]),f+=o[m].amount;let g=Math.max(0,l+s-this.lines.maxLength);g>0&&this.lines.onTrimEmitter.fire(g)}}translateBufferLineToString(e,t,n=0,r){let i=this.lines.get(e);return i?i.translateToString(t,n,r):""}getWrappedRangeForLine(e){let t=e,n=e;for(;t>0&&this.lines.get(t).isWrapped;)t--;for(;n+1<this.lines.length&&this.lines.get(n+1).isWrapped;)n++;return{first:t,last:n}}setupTabStops(e){for(e!=null?this.tabs[e]||(e=this.prevStop(e)):(this.tabs={},e=0);e<this._cols;e+=this._optionsService.rawOptions.tabStopWidth)this.tabs[e]=!0}prevStop(e){for(e==null&&(e=this.x);!this.tabs[--e]&&e>0;);return e>=this._cols?this._cols-1:e<0?0:e}nextStop(e){for(e==null&&(e=this.x);!this.tabs[++e]&&e<this._cols;);return e>=this._cols?this._cols-1:e<0?0:e}clearMarkers(e){this._isClearing=!0;for(let t=0;t<this.markers.length;t++)this.markers[t].line===e&&(this.markers[t].dispose(),this.markers.splice(t--,1));this._isClearing=!1}clearAllMarkers(){this._isClearing=!0;for(let e=0;e<this.markers.length;e++)this.markers[e].dispose();this.markers.length=0,this._isClearing=!1}addMarker(e){let t=new Z9(e);return this.markers.push(t),t.register(this.lines.onTrim(n=>{t.line-=n,t.line<0&&t.dispose()})),t.register(this.lines.onInsert(n=>{t.line>=n.index&&(t.line+=n.amount)})),t.register(this.lines.onDelete(n=>{t.line>=n.index&&t.line<n.index+n.amount&&t.dispose(),t.line>n.index&&(t.line-=n.amount)})),t.register(t.onDispose(()=>this._removeMarker(t))),t}_removeMarker(e){this._isClearing||this.markers.splice(this.markers.indexOf(e),1)}},Q9=class extends _e{constructor(e,t){super(),this._optionsService=e,this._bufferService=t,this._onBufferActivate=this._register(new K),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 lT(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new lT(!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)}},p2=2,f2=1,db=class extends _e{constructor(e){super(),this.isUserScrolling=!1,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this.cols=Math.max(e.rawOptions.cols||0,p2),this.rows=Math.max(e.rawOptions.rows||0,f2),this.buffers=this._register(new Q9(e,this)),this._register(this.buffers.onBufferActivate(t=>{this._onScroll.fire(t.activeBuffer.ydisp)}))}get buffer(){return this.buffers.active}resize(e,t){let n=this.cols!==e,r=this.rows!==t;this.cols=e,this.rows=t,this.buffers.resize(e,t),this._onResize.fire({cols:e,rows:t,colsChanged:n,rowsChanged:r})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,t=!1){let n=this.buffer,r;r=this._cachedBlankLine,(!r||r.length!==this.cols||r.getFg(0)!==e.fg||r.getBg(0)!==e.bg)&&(r=n.getBlankLine(e,t),this._cachedBlankLine=r),r.isWrapped=t;let i=n.ybase+n.scrollTop,s=n.ybase+n.scrollBottom;if(n.scrollTop===0){let o=n.lines.isFull;s===n.lines.length-1?o?n.lines.recycle().copyFrom(r):n.lines.push(r.clone()):n.lines.splice(s+1,0,r.clone()),o?this.isUserScrolling&&(n.ydisp=Math.max(n.ydisp-1,0)):(n.ybase++,this.isUserScrolling||n.ydisp++)}else{let o=s-i+1;n.lines.shiftElements(i+1,o-1,-1),n.lines.set(s,r.clone())}this.isUserScrolling||(n.ydisp=n.ybase),this._onScroll.fire(n.ydisp)}scrollLines(e,t){let n=this.buffer;if(e<0){if(n.ydisp===0)return;this.isUserScrolling=!0}else e+n.ydisp>=n.ybase&&(this.isUserScrolling=!1);let r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))}};db=et([Q(0,en)],db);var io={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:Vd,windowOptions:{},windowsMode:!1,windowsPty:{},wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRuler:{}},J9=["normal","bold","100","200","300","400","500","600","700","800","900"],e7=class extends _e{constructor(e){super(),this._onOptionChange=this._register(new K),this.onOptionChange=this._onOptionChange.event;let t={...io};for(let n in e)if(n in t)try{let r=e[n];t[n]=this._sanitizeAndValidateOption(n,r)}catch(r){console.error(r)}this.rawOptions=t,this.options={...t},this._setupOptions(),this._register(He(()=>{this.rawOptions.linkHandler=null,this.rawOptions.documentOverride=null}))}onSpecificOptionChange(e,t){return this.onOptionChange(n=>{n===e&&t(this.rawOptions[e])})}onMultipleOptionChange(e,t){return this.onOptionChange(n=>{e.indexOf(n)!==-1&&t()})}_setupOptions(){let e=n=>{if(!(n in io))throw new Error(`No option with key "${n}"`);return this.rawOptions[n]},t=(n,r)=>{if(!(n in io))throw new Error(`No option with key "${n}"`);r=this._sanitizeAndValidateOption(n,r),this.rawOptions[n]!==r&&(this.rawOptions[n]=r,this._onOptionChange.fire(n))};for(let n in this.rawOptions){let r={get:e.bind(this,n),set:t.bind(this,n)};Object.defineProperty(this.options,n,r)}}_sanitizeAndValidateOption(e,t){switch(e){case"cursorStyle":if(t||(t=io[e]),!t7(t))throw new Error(`"${t}" is not a valid value for ${e}`);break;case"wordSeparator":t||(t=io[e]);break;case"fontWeight":case"fontWeightBold":if(typeof t=="number"&&1<=t&&t<=1e3)break;t=J9.includes(t)?t:io[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 t7(e){return e==="block"||e==="underline"||e==="bar"}function Ja(e,t=5){if(typeof e!="object")return e;let n=Array.isArray(e)?[]:{};for(let r in e)n[r]=t<=1?e[r]:e[r]&&Ja(e[r],t-1);return n}var cT=Object.freeze({insertMode:!1}),uT=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,cursorBlink:void 0,cursorStyle:void 0,origin:!1,reverseWraparound:!1,sendFocus:!1,synchronizedOutput:!1,wraparound:!0}),hb=class extends _e{constructor(e,t,n){super(),this._bufferService=e,this._logService=t,this._optionsService=n,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this._register(new K),this.onData=this._onData.event,this._onUserInput=this._register(new K),this.onUserInput=this._onUserInput.event,this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onRequestScrollToBottom=this._register(new K),this.onRequestScrollToBottom=this._onRequestScrollToBottom.event,this.modes=Ja(cT),this.decPrivateModes=Ja(uT)}reset(){this.modes=Ja(cT),this.decPrivateModes=Ja(uT)}triggerDataEvent(e,t=!1){if(this._optionsService.rawOptions.disableStdin)return;let n=this._bufferService.buffer;t&&this._optionsService.rawOptions.scrollOnUserInput&&n.ybase!==n.ydisp&&this._onRequestScrollToBottom.fire(),t&&this._onUserInput.fire(),this._logService.debug(`sending data "${e}"`),this._logService.trace("sending data (codes)",()=>e.split("").map(r=>r.charCodeAt(0))),this._onData.fire(e)}triggerBinaryEvent(e){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${e}"`),this._logService.trace("sending binary (codes)",()=>e.split("").map(t=>t.charCodeAt(0))),this._onBinary.fire(e))}};hb=et([Q(0,Jt),Q(1,DD),Q(2,en)],hb);var dT={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:e=>e.button===4||e.action!==1?!1:(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)},VT200:{events:19,restrict:e=>e.action!==32},DRAG:{events:23,restrict:e=>!(e.action===32&&e.button===3)},ANY:{events:31,restrict:e=>!0}};function Rf(e,t){let n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return e.button===4?(n|=64,n|=e.action):(n|=e.button&3,e.button&4&&(n|=64),e.button&8&&(n|=128),e.action===32?n|=32:e.action===0&&!t&&(n|=3)),n}var Nf=String.fromCharCode,hT={DEFAULT:e=>{let t=[Rf(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":`\x1B[M${Nf(t[0])}${Nf(t[1])}${Nf(t[2])}`},SGR:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rf(e,!0)};${e.col};${e.row}${t}`},SGR_PIXELS:e=>{let t=e.action===0&&e.button!==4?"m":"M";return`\x1B[<${Rf(e,!0)};${e.x};${e.y}${t}`}},pb=class extends _e{constructor(e,t,n){super(),this._bufferService=e,this._coreService=t,this._optionsService=n,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._lastEvent=null,this._wheelPartialScroll=0,this._onProtocolChange=this._register(new K),this.onProtocolChange=this._onProtocolChange.event;for(let r of Object.keys(dT))this.addProtocol(r,dT[r]);for(let r of Object.keys(hT))this.addEncoding(r,hT[r]);this.reset()}addProtocol(e,t){this._protocols[e]=t}addEncoding(e,t){this._encodings[e]=t}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(e){if(!this._protocols[e])throw new Error(`unknown protocol "${e}"`);this._activeProtocol=e,this._onProtocolChange.fire(this._protocols[e].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(e){if(!this._encodings[e])throw new Error(`unknown encoding "${e}"`);this._activeEncoding=e}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null,this._wheelPartialScroll=0}consumeWheelEvent(e,t,n){if(e.deltaY===0||e.shiftKey||t===void 0||n===void 0)return 0;let r=t/n,i=this._applyScrollModifier(e.deltaY,e);return e.deltaMode===WheelEvent.DOM_DELTA_PIXEL?(i/=r+0,Math.abs(e.deltaY)<50&&(i*=.3),this._wheelPartialScroll+=i,i=Math.floor(Math.abs(this._wheelPartialScroll))*(this._wheelPartialScroll>0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(i*=this._bufferService.rows),i}_applyScrollModifier(e,t){return t.altKey||t.ctrlKey||t.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}triggerMouseEvent(e){if(e.col<0||e.col>=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows||e.button===4&&e.action===32||e.button===3&&e.action!==32||e.button!==4&&(e.action===2||e.action===3)||(e.col++,e.row++,e.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,e,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(e))return!1;let t=this._encodings[this._activeEncoding](e);return t&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0}explainEvents(e){return{down:!!(e&1),up:!!(e&2),drag:!!(e&4),move:!!(e&8),wheel:!!(e&16)}}_equalEvents(e,t,n){if(n){if(e.x!==t.x||e.y!==t.y)return!1}else if(e.col!==t.col||e.row!==t.row)return!1;return!(e.button!==t.button||e.action!==t.action||e.ctrl!==t.ctrl||e.alt!==t.alt||e.shift!==t.shift)}};pb=et([Q(0,Jt),Q(1,Ks),Q(2,en)],pb);var If=[[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]],n7=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],dt;function r7(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var i7=class{constructor(){if(this.version="6",!dt){dt=new Uint8Array(65536),dt.fill(1),dt[0]=0,dt.fill(0,1,32),dt.fill(0,127,160),dt.fill(2,4352,4448),dt[9001]=2,dt[9002]=2,dt.fill(2,11904,42192),dt[12351]=1,dt.fill(2,44032,55204),dt.fill(2,63744,64256),dt.fill(2,65040,65050),dt.fill(2,65072,65136),dt.fill(2,65280,65377),dt.fill(2,65504,65511);for(let e=0;e<If.length;++e)dt.fill(0,If[e][0],If[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?dt[e]:r7(e,n7)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let i=fs.extractWidth(t);i===0?r=!1:i>n&&(n=i)}return fs.createPropertyValue(0,n,r)}},fs=class Ku{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new K,this.onChange=this._onChange.event;let t=new i7;this.register(t),this._active=t.version,this._activeProvider=t}static extractShouldJoin(t){return(t&1)!==0}static extractWidth(t){return t>>1&3}static extractCharKind(t){return t>>3}static createPropertyValue(t,n,r=!1){return(t&16777215)<<3|(n&3)<<1|(r?1:0)}dispose(){this._onChange.dispose()}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(t){if(!this._providers[t])throw new Error(`unknown Unicode version "${t}"`);this._active=t,this._activeProvider=this._providers[t],this._onChange.fire(t)}register(t){this._providers[t.version]=t}wcwidth(t){return this._activeProvider.wcwidth(t)}getStringCellWidth(t){let n=0,r=0,i=t.length;for(let s=0;s<i;++s){let o=t.charCodeAt(s);if(55296<=o&&o<=56319){if(++s>=i)return n+this.wcwidth(o);let c=t.charCodeAt(s);56320<=c&&c<=57343?o=(o-55296)*1024+c-56320+65536:n+=this.wcwidth(c)}let a=this.charProperties(o,r),l=Ku.extractWidth(a);Ku.extractShouldJoin(a)&&(l-=Ku.extractWidth(r)),n+=l,r=a}return n}charProperties(t,n){return this._activeProvider.charProperties(t,n)}},s7=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 pT(e){var r;let t=(r=e.buffer.lines.get(e.buffer.ybase+e.buffer.y-1))==null?void 0:r.get(e.cols-1),n=e.buffer.lines.get(e.buffer.ybase+e.buffer.y);n&&t&&(n.isWrapped=t[3]!==0&&t[3]!==32)}var Ua=2147483647,o7=256,g2=class fb{constructor(t=32,n=32){if(this.maxLength=t,this.maxSubParamsLength=n,n>o7)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(t),this.length=0,this._subParams=new Int32Array(n),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(t),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(t){let n=new fb;if(!t.length)return n;for(let r=Array.isArray(t[0])?1:0;r<t.length;++r){let i=t[r];if(Array.isArray(i))for(let s=0;s<i.length;++s)n.addSubParam(i[s]);else n.addParam(i)}return n}clone(){let t=new fb(this.maxLength,this.maxSubParamsLength);return t.params.set(this.params),t.length=this.length,t._subParams.set(this._subParams),t._subParamsLength=this._subParamsLength,t._subParamsIdx.set(this._subParamsIdx),t._rejectDigits=this._rejectDigits,t._rejectSubDigits=this._rejectSubDigits,t._digitIsSub=this._digitIsSub,t}toArray(){let t=[];for(let n=0;n<this.length;++n){t.push(this.params[n]);let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&t.push(Array.prototype.slice.call(this._subParams,r,i))}return t}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(t){if(this._digitIsSub=!1,this.length>=this.maxLength){this._rejectDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=t>Ua?Ua:t}addSubParam(t){if(this._digitIsSub=!0,!!this.length){if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength){this._rejectSubDigits=!0;return}if(t<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=t>Ua?Ua:t,this._subParamsIdx[this.length-1]++}}hasSubParams(t){return(this._subParamsIdx[t]&255)-(this._subParamsIdx[t]>>8)>0}getSubParams(t){let n=this._subParamsIdx[t]>>8,r=this._subParamsIdx[t]&255;return r-n>0?this._subParams.subarray(n,r):null}getSubParamsAll(){let t={};for(let n=0;n<this.length;++n){let r=this._subParamsIdx[n]>>8,i=this._subParamsIdx[n]&255;i-r>0&&(t[n]=this._subParams.slice(r,i))}return t}addDigit(t){let n;if(this._rejectDigits||!(n=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;let r=this._digitIsSub?this._subParams:this.params,i=r[n-1];r[n-1]=~i?Math.min(i*10+t,Ua):t}},$a=[],a7=class{constructor(){this._state=0,this._active=$a,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=$a}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=$a,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||$a,!this._active.length)this._handlerFb(this._id,"START");else for(let e=this._active.length-1;e>=0;e--)this._active[e].start()}_put(e,t,n){if(!this._active.length)this._handlerFb(this._id,"PUT",Vh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}start(){this.reset(),this._state=1}put(e,t,n){if(this._state!==3){if(this._state===1)for(;t<n;){let r=e[t++];if(r===59){this._state=2,this._start();break}if(r<48||57<r){this._state=3;return}this._id===-1&&(this._id=0),this._id=this._id*10+r-48}this._state===2&&n-t>0&&this._put(e,t,n)}}end(e,t=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),!this._active.length)this._handlerFb(this._id,"END",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].end(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].end(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=$a,this._id=-1,this._state=0}}},pn=class{constructor(e){this._handler=e,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Vh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}end(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data),t instanceof Promise))return t.then(n=>(this._data="",this._hitLimit=!1,n));return this._data="",this._hitLimit=!1,t}},za=[],l7=class{constructor(){this._handlers=Object.create(null),this._active=za,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=za}registerHandler(e,t){this._handlers[e]===void 0&&(this._handlers[e]=[]);let n=this._handlers[e];return n.push(t),{dispose:()=>{let r=n.indexOf(t);r!==-1&&n.splice(r,1)}}}clearHandler(e){this._handlers[e]&&delete this._handlers[e]}setHandlerFallback(e){this._handlerFb=e}reset(){if(this._active.length)for(let e=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;e>=0;--e)this._active[e].unhook(!1);this._stack.paused=!1,this._active=za,this._ident=0}hook(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||za,!this._active.length)this._handlerFb(this._ident,"HOOK",t);else for(let n=this._active.length-1;n>=0;n--)this._active[n].hook(t)}put(e,t,n){if(!this._active.length)this._handlerFb(this._ident,"PUT",Vh(e,t,n));else for(let r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n)}unhook(e,t=!0){if(!this._active.length)this._handlerFb(this._ident,"UNHOOK",e);else{let n=!1,r=this._active.length-1,i=!1;if(this._stack.paused&&(r=this._stack.loopPosition-1,n=t,i=this._stack.fallThrough,this._stack.paused=!1),!i&&n===!1){for(;r>=0&&(n=this._active[r].unhook(e),n!==!0);r--)if(n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!1,n;r--}for(;r>=0;r--)if(n=this._active[r].unhook(!1),n instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=r,this._stack.fallThrough=!0,n}this._active=za,this._ident=0}},el=new g2;el.addParam(0);var fT=class{constructor(e){this._handler=e,this._data="",this._params=el,this._hitLimit=!1}hook(e){this._params=e.length>1||e.params[0]?e.clone():el,this._data="",this._hitLimit=!1}put(e,t,n){this._hitLimit||(this._data+=Vh(e,t,n),this._data.length>1e7&&(this._data="",this._hitLimit=!0))}unhook(e){let t=!1;if(this._hitLimit)t=!1;else if(e&&(t=this._handler(this._data,this._params),t instanceof Promise))return t.then(n=>(this._params=el,this._data="",this._hitLimit=!1,n));return this._params=el,this._data="",this._hitLimit=!1,t}},c7=class{constructor(e){this.table=new Uint8Array(e)}setDefault(e,t){this.table.fill(e<<4|t)}add(e,t,n,r){this.table[t<<8|e]=n<<4|r}addMany(e,t,n,r){for(let i=0;i<e.length;i++)this.table[t<<8|e[i]]=n<<4|r}},An=160,u7=function(){let e=new c7(4095),t=Array.apply(null,Array(256)).map((a,l)=>l),n=(a,l)=>t.slice(a,l),r=n(32,127),i=n(0,24);i.push(25),i.push.apply(i,n(28,32));let s=n(0,14),o;e.setDefault(1,0),e.addMany(r,0,2,0);for(o in s)e.addMany([24,26,153,154],o,3,0),e.addMany(n(128,144),o,3,0),e.addMany(n(144,152),o,3,0),e.add(156,o,0,0),e.add(27,o,11,1),e.add(157,o,4,8),e.addMany([152,158,159],o,0,7),e.add(155,o,11,3),e.add(144,o,11,9);return e.addMany(i,0,3,0),e.addMany(i,1,3,1),e.add(127,1,0,1),e.addMany(i,8,0,8),e.addMany(i,3,3,3),e.add(127,3,0,3),e.addMany(i,4,3,4),e.add(127,4,0,4),e.addMany(i,6,3,6),e.addMany(i,5,3,5),e.add(127,5,0,5),e.addMany(i,2,3,2),e.add(127,2,0,2),e.add(93,1,4,8),e.addMany(r,8,5,8),e.add(127,8,5,8),e.addMany([156,27,24,26,7],8,6,0),e.addMany(n(28,32),8,0,8),e.addMany([88,94,95],1,0,7),e.addMany(r,7,0,7),e.addMany(i,7,0,7),e.add(156,7,0,0),e.add(127,7,0,7),e.add(91,1,11,3),e.addMany(n(64,127),3,7,0),e.addMany(n(48,60),3,8,4),e.addMany([60,61,62,63],3,9,4),e.addMany(n(48,60),4,8,4),e.addMany(n(64,127),4,7,0),e.addMany([60,61,62,63],4,0,6),e.addMany(n(32,64),6,0,6),e.add(127,6,0,6),e.addMany(n(64,127),6,0,0),e.addMany(n(32,48),3,9,5),e.addMany(n(32,48),5,9,5),e.addMany(n(48,64),5,0,6),e.addMany(n(64,127),5,7,0),e.addMany(n(32,48),4,9,5),e.addMany(n(32,48),1,9,2),e.addMany(n(32,48),2,9,2),e.addMany(n(48,127),2,10,0),e.addMany(n(48,80),1,10,0),e.addMany(n(81,88),1,10,0),e.addMany([89,90,92],1,10,0),e.addMany(n(96,127),1,10,0),e.add(80,1,11,9),e.addMany(i,9,0,9),e.add(127,9,0,9),e.addMany(n(28,32),9,0,9),e.addMany(n(32,48),9,9,12),e.addMany(n(48,60),9,8,10),e.addMany([60,61,62,63],9,9,10),e.addMany(i,11,0,11),e.addMany(n(32,128),11,0,11),e.addMany(n(28,32),11,0,11),e.addMany(i,10,0,10),e.add(127,10,0,10),e.addMany(n(28,32),10,0,10),e.addMany(n(48,60),10,8,10),e.addMany([60,61,62,63],10,0,11),e.addMany(n(32,48),10,9,12),e.addMany(i,12,0,12),e.add(127,12,0,12),e.addMany(n(28,32),12,0,12),e.addMany(n(32,48),12,9,12),e.addMany(n(48,64),12,0,11),e.addMany(n(64,127),12,12,13),e.addMany(n(64,127),10,12,13),e.addMany(n(64,127),9,12,13),e.addMany(i,13,13,13),e.addMany(r,13,13,13),e.add(127,13,0,13),e.addMany([27,156,24,26],13,14,0),e.add(An,0,2,0),e.add(An,8,5,8),e.add(An,6,0,6),e.add(An,11,0,11),e.add(An,13,13,13),e}(),d7=class extends _e{constructor(e=u7){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 g2,this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._printHandlerFb=(t,n,r)=>{},this._executeHandlerFb=t=>{},this._csiHandlerFb=(t,n)=>{},this._escHandlerFb=t=>{},this._errorHandlerFb=t=>t,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._register(He(()=>{this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null)})),this._oscParser=this._register(new a7),this._dcsParser=this._register(new l7),this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(e,t=[64,126]){let n=0;if(e.prefix){if(e.prefix.length>1)throw new Error("only one byte as prefix supported");if(n=e.prefix.charCodeAt(0),n&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let i=0;i<e.intermediates.length;++i){let s=e.intermediates.charCodeAt(i);if(32>s||s>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=s}}if(e.final.length!==1)throw new Error("final must be a single byte");let r=e.final.charCodeAt(0);if(t[0]>r||r>t[1])throw new Error(`final must be in range ${t[0]} .. ${t[1]}`);return n<<=8,n|=r,n}identToString(e){let t=[];for(;e;)t.push(String.fromCharCode(e&255)),e>>=8;return t.reverse().join("")}setPrintHandler(e){this._printHandler=e}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(e,t){let n=this._identifier(e,[48,126]);this._escHandlers[n]===void 0&&(this._escHandlers[n]=[]);let r=this._escHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearEscHandler(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]}setEscHandlerFallback(e){this._escHandlerFb=e}setExecuteHandler(e,t){this._executeHandlers[e.charCodeAt(0)]=t}clearExecuteHandler(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]}setExecuteHandlerFallback(e){this._executeHandlerFb=e}registerCsiHandler(e,t){let n=this._identifier(e);this._csiHandlers[n]===void 0&&(this._csiHandlers[n]=[]);let r=this._csiHandlers[n];return r.push(t),{dispose:()=>{let i=r.indexOf(t);i!==-1&&r.splice(i,1)}}}clearCsiHandler(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]}setCsiHandlerFallback(e){this._csiHandlerFb=e}registerDcsHandler(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)}clearDcsHandler(e){this._dcsParser.clearHandler(this._identifier(e))}setDcsHandlerFallback(e){this._dcsParser.setHandlerFallback(e)}registerOscHandler(e,t){return this._oscParser.registerHandler(e,t)}clearOscHandler(e){this._oscParser.clearHandler(e)}setOscHandlerFallback(e){this._oscParser.setHandlerFallback(e)}setErrorHandler(e){this._errorHandler=e}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(e,t,n,r,i){this._parseStack.state=e,this._parseStack.handlers=t,this._parseStack.handlerPos=n,this._parseStack.transition=r,this._parseStack.chunkPos=i}parse(e,t,n){let r=0,i=0,s=0,o;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,s=this._parseStack.chunkPos+1;else{if(n===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");let a=this._parseStack.handlers,l=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](this._params),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 4:if(n===!1&&l>-1){for(;l>=0&&(o=a[l](),o!==!0);l--)if(o instanceof Promise)return this._parseStack.handlerPos=l,o}this._parseStack.handlers=[];break;case 6:if(r=e[this._parseStack.chunkPos],o=this._dcsParser.unhook(r!==24&&r!==26,n),o)return o;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],o=this._oscParser.end(r!==24&&r!==26,n),o)return o;r===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break}this._parseStack.state=0,s=this._parseStack.chunkPos+1,this.precedingJoinState=0,this.currentState=this._parseStack.transition&15}for(let a=s;a<t;++a){switch(r=e[a],i=this._transitions.table[this.currentState<<8|(r<160?r:An)],i>>4){case 2:for(let p=a+1;;++p){if(p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-1;break}if(++p>=t||(r=e[p])<32||r>126&&r<An){this._printHandler(e,a,p),a=p-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:a,code:r,currentState:this.currentState,collect:this._collect,params:this._params,abort:!1}).abort)return;break;case 7:let l=this._csiHandlers[this._collect<<8|r],c=l?l.length-1:-1;for(;c>=0&&(o=l[c](this._params),o!==!0);c--)if(o instanceof Promise)return this._preserveStack(3,l,c,i,a),o;c<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(++a<t&&(r=e[a])>47&&r<60);a--;break;case 9:this._collect<<=8,this._collect|=r;break;case 10:let u=this._escHandlers[this._collect<<8|r],d=u?u.length-1:-1;for(;d>=0&&(o=u[d](),o!==!0);d--)if(o instanceof Promise)return this._preserveStack(4,u,d,i,a),o;d<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 p=a+1;;++p)if(p>=t||(r=e[p])===24||r===26||r===27||r>127&&r<An){this._dcsParser.put(e,a,p),a=p-1;break}break;case 14:if(o=this._dcsParser.unhook(r!==24&&r!==26),o)return this._preserveStack(6,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break;case 4:this._oscParser.start();break;case 5:for(let p=a+1;;p++)if(p>=t||(r=e[p])<32||r>127&&r<An){this._oscParser.put(e,a,p),a=p-1;break}break;case 6:if(o=this._oscParser.end(r!==24&&r!==26),o)return this._preserveStack(5,[],0,i,a),o;r===27&&(i|=1),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingJoinState=0;break}this.currentState=i&15}}},h7=/^([\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})$/,p7=/^[\da-f]+$/;function gT(e){if(!e)return;let t=e.toLowerCase();if(t.indexOf("rgb:")===0){t=t.slice(4);let n=h7.exec(t);if(n){let r=n[1]?15:n[4]?255:n[7]?4095:65535;return[Math.round(parseInt(n[1]||n[4]||n[7]||n[10],16)/r*255),Math.round(parseInt(n[2]||n[5]||n[8]||n[11],16)/r*255),Math.round(parseInt(n[3]||n[6]||n[9]||n[12],16)/r*255)]}}else if(t.indexOf("#")===0&&(t=t.slice(1),p7.exec(t)&&[3,6,9,12].includes(t.length))){let n=t.length/3,r=[0,0,0];for(let i=0;i<3;++i){let s=parseInt(t.slice(n*i,n*i+n),16);r[i]=n===1?s<<4:n===2?s:n===3?s>>4:s>>8}return r}}function Of(e,t){let n=e.toString(16),r=n.length<2?"0"+n:n;switch(t){case 4:return n[0];case 8:return r;case 12:return(r+r).slice(0,3);default:return r+r}}function f7(e,t=16){let[n,r,i]=e;return`rgb:${Of(n,t)}/${Of(r,t)}/${Of(i,t)}`}var g7={"(":0,")":1,"*":2,"+":3,"-":1,".":2},ai=131072,mT=10;function bT(e,t){if(e>24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}var yT=5e3,vT=0,m7=class extends _e{constructor(e,t,n,r,i,s,o,a,l=new d7){super(),this._bufferService=e,this._charsetService=t,this._coreService=n,this._logService=r,this._optionsService=i,this._oscLinkService=s,this._coreMouseService=o,this._unicodeService=a,this._parser=l,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new MW,this._utf8Decoder=new PW,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=it.clone(),this._eraseAttrDataInternal=it.clone(),this._onRequestBell=this._register(new K),this.onRequestBell=this._onRequestBell.event,this._onRequestRefreshRows=this._register(new K),this.onRequestRefreshRows=this._onRequestRefreshRows.event,this._onRequestReset=this._register(new K),this.onRequestReset=this._onRequestReset.event,this._onRequestSendFocus=this._register(new K),this.onRequestSendFocus=this._onRequestSendFocus.event,this._onRequestSyncScrollBar=this._register(new K),this.onRequestSyncScrollBar=this._onRequestSyncScrollBar.event,this._onRequestWindowsOptionsReport=this._register(new K),this.onRequestWindowsOptionsReport=this._onRequestWindowsOptionsReport.event,this._onA11yChar=this._register(new K),this.onA11yChar=this._onA11yChar.event,this._onA11yTab=this._register(new K),this.onA11yTab=this._onA11yTab.event,this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onScroll=this._register(new K),this.onScroll=this._onScroll.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onColor=this._register(new K),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 gb(this._bufferService),this._activeBuffer=this._bufferService.buffer,this._register(this._bufferService.buffers.onBufferActivate(c=>this._activeBuffer=c.activeBuffer)),this._parser.setCsiHandlerFallback((c,u)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(c),params:u.toArray()})}),this._parser.setEscHandlerFallback(c=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(c)})}),this._parser.setExecuteHandlerFallback(c=>{this._logService.debug("Unknown EXECUTE code: ",{code:c})}),this._parser.setOscHandlerFallback((c,u,d)=>{this._logService.debug("Unknown OSC code: ",{identifier:c,action:u,data:d})}),this._parser.setDcsHandlerFallback((c,u,d)=>{u==="HOOK"&&(d=d.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(c),action:u,payload:d})}),this._parser.setPrintHandler((c,u,d)=>this.print(c,u,d)),this._parser.registerCsiHandler({final:"@"},c=>this.insertChars(c)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},c=>this.scrollLeft(c)),this._parser.registerCsiHandler({final:"A"},c=>this.cursorUp(c)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},c=>this.scrollRight(c)),this._parser.registerCsiHandler({final:"B"},c=>this.cursorDown(c)),this._parser.registerCsiHandler({final:"C"},c=>this.cursorForward(c)),this._parser.registerCsiHandler({final:"D"},c=>this.cursorBackward(c)),this._parser.registerCsiHandler({final:"E"},c=>this.cursorNextLine(c)),this._parser.registerCsiHandler({final:"F"},c=>this.cursorPrecedingLine(c)),this._parser.registerCsiHandler({final:"G"},c=>this.cursorCharAbsolute(c)),this._parser.registerCsiHandler({final:"H"},c=>this.cursorPosition(c)),this._parser.registerCsiHandler({final:"I"},c=>this.cursorForwardTab(c)),this._parser.registerCsiHandler({final:"J"},c=>this.eraseInDisplay(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},c=>this.eraseInDisplay(c,!0)),this._parser.registerCsiHandler({final:"K"},c=>this.eraseInLine(c,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},c=>this.eraseInLine(c,!0)),this._parser.registerCsiHandler({final:"L"},c=>this.insertLines(c)),this._parser.registerCsiHandler({final:"M"},c=>this.deleteLines(c)),this._parser.registerCsiHandler({final:"P"},c=>this.deleteChars(c)),this._parser.registerCsiHandler({final:"S"},c=>this.scrollUp(c)),this._parser.registerCsiHandler({final:"T"},c=>this.scrollDown(c)),this._parser.registerCsiHandler({final:"X"},c=>this.eraseChars(c)),this._parser.registerCsiHandler({final:"Z"},c=>this.cursorBackwardTab(c)),this._parser.registerCsiHandler({final:"`"},c=>this.charPosAbsolute(c)),this._parser.registerCsiHandler({final:"a"},c=>this.hPositionRelative(c)),this._parser.registerCsiHandler({final:"b"},c=>this.repeatPrecedingCharacter(c)),this._parser.registerCsiHandler({final:"c"},c=>this.sendDeviceAttributesPrimary(c)),this._parser.registerCsiHandler({prefix:">",final:"c"},c=>this.sendDeviceAttributesSecondary(c)),this._parser.registerCsiHandler({final:"d"},c=>this.linePosAbsolute(c)),this._parser.registerCsiHandler({final:"e"},c=>this.vPositionRelative(c)),this._parser.registerCsiHandler({final:"f"},c=>this.hVPosition(c)),this._parser.registerCsiHandler({final:"g"},c=>this.tabClear(c)),this._parser.registerCsiHandler({final:"h"},c=>this.setMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"h"},c=>this.setModePrivate(c)),this._parser.registerCsiHandler({final:"l"},c=>this.resetMode(c)),this._parser.registerCsiHandler({prefix:"?",final:"l"},c=>this.resetModePrivate(c)),this._parser.registerCsiHandler({final:"m"},c=>this.charAttributes(c)),this._parser.registerCsiHandler({final:"n"},c=>this.deviceStatus(c)),this._parser.registerCsiHandler({prefix:"?",final:"n"},c=>this.deviceStatusPrivate(c)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},c=>this.softReset(c)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},c=>this.setCursorStyle(c)),this._parser.registerCsiHandler({final:"r"},c=>this.setScrollRegion(c)),this._parser.registerCsiHandler({final:"s"},c=>this.saveCursor(c)),this._parser.registerCsiHandler({final:"t"},c=>this.windowOptions(c)),this._parser.registerCsiHandler({final:"u"},c=>this.restoreCursor(c)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},c=>this.insertColumns(c)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},c=>this.deleteColumns(c)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},c=>this.selectProtected(c)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},c=>this.requestMode(c,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},c=>this.requestMode(c,!1)),this._parser.setExecuteHandler(V.BEL,()=>this.bell()),this._parser.setExecuteHandler(V.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(V.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(V.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(V.BS,()=>this.backspace()),this._parser.setExecuteHandler(V.HT,()=>this.tab()),this._parser.setExecuteHandler(V.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(V.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(Wu.IND,()=>this.index()),this._parser.setExecuteHandler(Wu.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(Wu.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new pn(c=>(this.setTitle(c),this.setIconName(c),!0))),this._parser.registerOscHandler(1,new pn(c=>this.setIconName(c))),this._parser.registerOscHandler(2,new pn(c=>this.setTitle(c))),this._parser.registerOscHandler(4,new pn(c=>this.setOrReportIndexedColor(c))),this._parser.registerOscHandler(8,new pn(c=>this.setHyperlink(c))),this._parser.registerOscHandler(10,new pn(c=>this.setOrReportFgColor(c))),this._parser.registerOscHandler(11,new pn(c=>this.setOrReportBgColor(c))),this._parser.registerOscHandler(12,new pn(c=>this.setOrReportCursorColor(c))),this._parser.registerOscHandler(104,new pn(c=>this.restoreIndexedColor(c))),this._parser.registerOscHandler(110,new pn(c=>this.restoreFgColor(c))),this._parser.registerOscHandler(111,new pn(c=>this.restoreBgColor(c))),this._parser.registerOscHandler(112,new pn(c=>this.restoreCursorColor(c))),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 c in gt)this._parser.registerEscHandler({intermediates:"(",final:c},()=>this.selectCharset("("+c)),this._parser.registerEscHandler({intermediates:")",final:c},()=>this.selectCharset(")"+c)),this._parser.registerEscHandler({intermediates:"*",final:c},()=>this.selectCharset("*"+c)),this._parser.registerEscHandler({intermediates:"+",final:c},()=>this.selectCharset("+"+c)),this._parser.registerEscHandler({intermediates:"-",final:c},()=>this.selectCharset("-"+c)),this._parser.registerEscHandler({intermediates:".",final:c},()=>this.selectCharset("."+c)),this._parser.registerEscHandler({intermediates:"/",final:c},()=>this.selectCharset("/"+c));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(c=>(this._logService.error("Parsing error: ",c),c)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new fT((c,u)=>this.requestStatusString(c,u)))}getAttrData(){return this._curAttrData}_preserveStack(e,t,n,r){this._parseStack.paused=!0,this._parseStack.cursorStartX=e,this._parseStack.cursorStartY=t,this._parseStack.decodedLength=n,this._parseStack.position=r}_logSlowResolvingAsync(e){this._logService.logLevel<=3&&Promise.race([e,new Promise((t,n)=>setTimeout(()=>n("#SLOW_TIMEOUT"),yT))]).catch(t=>{if(t!=="#SLOW_TIMEOUT")throw t;console.warn(`async parser handler taking longer than ${yT} ms`)})}_getCurrentLinkId(){return this._curAttrData.extended.urlId}parse(e,t){let n,r=this._activeBuffer.x,i=this._activeBuffer.y,s=0,o=this._parseStack.paused;if(o){if(n=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,t))return this._logSlowResolvingAsync(n),n;r=this._parseStack.cursorStartX,i=this._parseStack.cursorStartY,this._parseStack.paused=!1,e.length>ai&&(s=this._parseStack.position+ai)}if(this._logService.logLevel<=1&&this._logService.debug(`parsing data ${typeof e=="string"?` "${e}"`:` "${Array.prototype.map.call(e,c=>String.fromCharCode(c)).join("")}"`}`),this._logService.logLevel===0&&this._logService.trace("parsing data (codes)",typeof e=="string"?e.split("").map(c=>c.charCodeAt(0)):e),this._parseBuffer.length<e.length&&this._parseBuffer.length<ai&&(this._parseBuffer=new Uint32Array(Math.min(e.length,ai))),o||this._dirtyRowTracker.clearRange(),e.length>ai)for(let c=s;c<e.length;c+=ai){let u=c+ai<e.length?c+ai:e.length,d=typeof e=="string"?this._stringDecoder.decode(e.substring(c,u),this._parseBuffer):this._utf8Decoder.decode(e.subarray(c,u),this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,d))return this._preserveStack(r,i,d,c),this._logSlowResolvingAsync(n),n}else if(!o){let c=typeof e=="string"?this._stringDecoder.decode(e,this._parseBuffer):this._utf8Decoder.decode(e,this._parseBuffer);if(n=this._parser.parse(this._parseBuffer,c))return this._preserveStack(r,i,c,0),this._logSlowResolvingAsync(n),n}(this._activeBuffer.x!==r||this._activeBuffer.y!==i)&&this._onCursorMove.fire();let a=this._dirtyRowTracker.end+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp),l=this._dirtyRowTracker.start+(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp);l<this._bufferService.rows&&this._onRequestRefreshRows.fire({start:Math.min(l,this._bufferService.rows-1),end:Math.min(a,this._bufferService.rows-1)})}print(e,t,n){let r,i,s=this._charsetService.charset,o=this._optionsService.rawOptions.screenReaderMode,a=this._bufferService.cols,l=this._coreService.decPrivateModes.wraparound,c=this._coreService.modes.insertMode,u=this._curAttrData,d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._activeBuffer.x&&n-t>0&&d.getWidth(this._activeBuffer.x-1)===2&&d.setCellFromCodepoint(this._activeBuffer.x-1,0,1,u);let p=this._parser.precedingJoinState;for(let f=t;f<n;++f){if(r=e[f],r<127&&s){let b=s[String.fromCharCode(r)];b&&(r=b.charCodeAt(0))}let g=this._unicodeService.charProperties(r,p);i=fs.extractWidth(g);let m=fs.extractShouldJoin(g),_=m?fs.extractWidth(p):0;if(p=g,o&&this._onA11yChar.fire(fi(r)),this._getCurrentLinkId()&&this._oscLinkService.addLineToLink(this._getCurrentLinkId(),this._activeBuffer.ybase+this._activeBuffer.y),this._activeBuffer.x+i-_>a){if(l){let b=d,v=this._activeBuffer.x-_;for(this._activeBuffer.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),d=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y),_>0&&d instanceof Qa&&d.copyCellsFrom(b,v,0,_,!1);v<a;)b.setCellFromCodepoint(v++,0,1,u)}else if(this._activeBuffer.x=a-1,i===2)continue}if(m&&this._activeBuffer.x){let b=d.getWidth(this._activeBuffer.x-1)?1:2;d.addCodepointToCell(this._activeBuffer.x-b,r,i);for(let v=i-_;--v>=0;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u);continue}if(c&&(d.insertCells(this._activeBuffer.x,i-_,this._activeBuffer.getNullCell(u)),d.getWidth(a-1)===2&&d.setCellFromCodepoint(a-1,0,1,u)),d.setCellFromCodepoint(this._activeBuffer.x++,r,i,u),i>0)for(;--i;)d.setCellFromCodepoint(this._activeBuffer.x++,0,0,u)}this._parser.precedingJoinState=p,this._activeBuffer.x<a&&n-t>0&&d.getWidth(this._activeBuffer.x)===0&&!d.hasContent(this._activeBuffer.x)&&d.setCellFromCodepoint(this._activeBuffer.x,0,1,u),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}registerCsiHandler(e,t){return e.final==="t"&&!e.prefix&&!e.intermediates?this._parser.registerCsiHandler(e,n=>bT(n.params[0],this._optionsService.rawOptions.windowOptions)?t(n):!0):this._parser.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._parser.registerDcsHandler(e,new fT(t))}registerEscHandler(e,t){return this._parser.registerEscHandler(e,t)}registerOscHandler(e,t){return this._parser.registerOscHandler(e,new pn(t))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows?this._activeBuffer.y=this._bufferService.rows-1:this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var e;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((e=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))!=null&&e.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);t.hasWidth(this._activeBuffer.x)&&!t.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let e=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-e),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(e=this._bufferService.cols-1){this._activeBuffer.x=Math.min(e,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_setCursor(e,t){this._dirtyRowTracker.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=e,this._activeBuffer.y=this._activeBuffer.scrollTop+t):(this._activeBuffer.x=e,this._activeBuffer.y=t),this._restrictCursor(),this._dirtyRowTracker.markDirty(this._activeBuffer.y)}_moveCursor(e,t){this._restrictCursor(),this._setCursor(this._activeBuffer.x+e,this._activeBuffer.y+t)}cursorUp(e){let t=this._activeBuffer.y-this._activeBuffer.scrollTop;return t>=0?this._moveCursor(0,-Math.min(t,e.params[0]||1)):this._moveCursor(0,-(e.params[0]||1)),!0}cursorDown(e){let t=this._activeBuffer.scrollBottom-this._activeBuffer.y;return t>=0?this._moveCursor(0,Math.min(t,e.params[0]||1)):this._moveCursor(0,e.params[0]||1),!0}cursorForward(e){return this._moveCursor(e.params[0]||1,0),!0}cursorBackward(e){return this._moveCursor(-(e.params[0]||1),0),!0}cursorNextLine(e){return this.cursorDown(e),this._activeBuffer.x=0,!0}cursorPrecedingLine(e){return this.cursorUp(e),this._activeBuffer.x=0,!0}cursorCharAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0}charPosAbsolute(e){return this._setCursor((e.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(e){return this._moveCursor(e.params[0]||1,0),!0}linePosAbsolute(e){return this._setCursor(this._activeBuffer.x,(e.params[0]||1)-1),!0}vPositionRelative(e){return this._moveCursor(0,e.params[0]||1),!0}hVPosition(e){return this.cursorPosition(e),!0}tabClear(e){let t=e.params[0];return t===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:t===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(e){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let t=e.params[0]||1;for(;t--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(e){let t=e.params[0];return t===1&&(this._curAttrData.bg|=536870912),(t===2||t===0)&&(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(e,t,n,r=!1,i=!1){let s=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);s.replaceCells(t,n,this._activeBuffer.getNullCell(this._eraseAttrData()),i),r&&(s.isWrapped=!1)}_resetBufferLine(e,t=!1){let n=this._activeBuffer.lines.get(this._activeBuffer.ybase+e);n&&(n.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),t),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+e),n.isWrapped=!1)}eraseInDisplay(e,t=!1){var r;this._restrictCursor(this._bufferService.cols);let n;switch(e.params[0]){case 0:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);n<this._bufferService.rows;n++)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(n);break;case 1:for(n=this._activeBuffer.y,this._dirtyRowTracker.markDirty(n),this._eraseInBufferLine(n,0,this._activeBuffer.x+1,!0,t),this._activeBuffer.x+1>=this._bufferService.cols&&(this._activeBuffer.lines.get(n+1).isWrapped=!1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0);break;case 2:if(this._optionsService.rawOptions.scrollOnEraseInDisplay){for(n=this._bufferService.rows,this._dirtyRowTracker.markRangeDirty(0,n-1);n--&&!((r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n))!=null&&r.getTrimmedLength()););for(;n>=0;n--)this._bufferService.scroll(this._eraseAttrData())}else{for(n=this._bufferService.rows,this._dirtyRowTracker.markDirty(n-1);n--;)this._resetBufferLine(n,t);this._dirtyRowTracker.markDirty(0)}break;case 3:let i=this._activeBuffer.lines.length-this._bufferService.rows;i>0&&(this._activeBuffer.lines.trimStart(i),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-i,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-i,0),this._onScroll.fire(0));break}return!0}eraseInLine(e,t=!1){switch(this._restrictCursor(this._bufferService.cols),e.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,t);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,t);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,t);break}return this._dirtyRowTracker.markDirty(this._activeBuffer.y),!0}insertLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,i=this._bufferService.rows-1+this._activeBuffer.ybase-r+1;for(;t--;)this._activeBuffer.lines.splice(i-1,1),this._activeBuffer.lines.splice(n,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}deleteLines(e){this._restrictCursor();let t=e.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let n=this._activeBuffer.ybase+this._activeBuffer.y,r;for(r=this._bufferService.rows-1-this._activeBuffer.scrollBottom,r=this._bufferService.rows-1+this._activeBuffer.ybase-r;t--;)this._activeBuffer.lines.splice(n,1),this._activeBuffer.lines.splice(r,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.y,this._activeBuffer.scrollBottom),this._activeBuffer.x=0,!0}insertChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.insertCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}deleteChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.deleteCells(this._activeBuffer.x,e.params[0]||1,this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}scrollUp(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,0,this._activeBuffer.getBlankLine(this._eraseAttrData()));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollDown(e){let t=e.params[0]||1;for(;t--;)this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollBottom,1),this._activeBuffer.lines.splice(this._activeBuffer.ybase+this._activeBuffer.scrollTop,0,this._activeBuffer.getBlankLine(it));return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollLeft(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}scrollRight(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(0,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}insertColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.insertCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}deleteColumns(e){if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.y<this._activeBuffer.scrollTop)return!0;let t=e.params[0]||1;for(let n=this._activeBuffer.scrollTop;n<=this._activeBuffer.scrollBottom;++n){let r=this._activeBuffer.lines.get(this._activeBuffer.ybase+n);r.deleteCells(this._activeBuffer.x,t,this._activeBuffer.getNullCell(this._eraseAttrData())),r.isWrapped=!1}return this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom),!0}eraseChars(e){this._restrictCursor();let t=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);return t&&(t.replaceCells(this._activeBuffer.x,this._activeBuffer.x+(e.params[0]||1),this._activeBuffer.getNullCell(this._eraseAttrData())),this._dirtyRowTracker.markDirty(this._activeBuffer.y)),!0}repeatPrecedingCharacter(e){let t=this._parser.precedingJoinState;if(!t)return!0;let n=e.params[0]||1,r=fs.extractWidth(t),i=this._activeBuffer.x-r,s=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).getString(i),o=new Uint32Array(s.length*n),a=0;for(let c=0;c<s.length;){let u=s.codePointAt(c)||0;o[a++]=u,c+=u>65535?2:1}let l=a;for(let c=1;c<n;++c)o.copyWithin(l,0,a),l+=a;return this.print(o,0,l),!0}sendDeviceAttributesPrimary(e){return e.params[0]>0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(V.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(V.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(V.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(V.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(V.ESC+"[>83;40003;0c")),!0}_is(e){return(this._optionsService.rawOptions.termName+"").indexOf(e)===0}setMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!0;break;case 20:this._optionsService.options.convertEol=!0;break}return!0}setModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!0;break;case 2:this._charsetService.setgCharset(0,as),this._charsetService.setgCharset(1,as),this._charsetService.setgCharset(2,as),this._charsetService.setgCharset(3,as);break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(132,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!0,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!0;break;case 12:this._optionsService.options.cursorBlink=!0;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!0;break;case 66:this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire();break;case 9:this._coreMouseService.activeProtocol="X10";break;case 1e3:this._coreMouseService.activeProtocol="VT200";break;case 1002:this._coreMouseService.activeProtocol="DRAG";break;case 1003:this._coreMouseService.activeProtocol="ANY";break;case 1004:this._coreService.decPrivateModes.sendFocus=!0,this._onRequestSendFocus.fire();break;case 1005:this._logService.debug("DECSET 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="SGR";break;case 1015:this._logService.debug("DECSET 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="SGR_PIXELS";break;case 25:this._coreService.isCursorHidden=!1;break;case 1048:this.saveCursor();break;case 1049:this.saveCursor();case 47:case 1047:this._bufferService.buffers.activateAltBuffer(this._eraseAttrData()),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!0;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!0;break}return!0}resetMode(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 4:this._coreService.modes.insertMode=!1;break;case 20:this._optionsService.options.convertEol=!1;break}return!0}resetModePrivate(e){for(let t=0;t<e.length;t++)switch(e.params[t]){case 1:this._coreService.decPrivateModes.applicationCursorKeys=!1;break;case 3:this._optionsService.rawOptions.windowOptions.setWinLines&&(this._bufferService.resize(80,this._bufferService.rows),this._onRequestReset.fire());break;case 6:this._coreService.decPrivateModes.origin=!1,this._setCursor(0,0);break;case 7:this._coreService.decPrivateModes.wraparound=!1;break;case 12:this._optionsService.options.cursorBlink=!1;break;case 45:this._coreService.decPrivateModes.reverseWraparound=!1;break;case 66:this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire();break;case 9:case 1e3:case 1002:case 1003:this._coreMouseService.activeProtocol="NONE";break;case 1004:this._coreService.decPrivateModes.sendFocus=!1;break;case 1005:this._logService.debug("DECRST 1005 not supported (see #2507)");break;case 1006:this._coreMouseService.activeEncoding="DEFAULT";break;case 1015:this._logService.debug("DECRST 1015 not supported (see #2507)");break;case 1016:this._coreMouseService.activeEncoding="DEFAULT";break;case 25:this._coreService.isCursorHidden=!0;break;case 1048:this.restoreCursor();break;case 1049:case 47:case 1047:this._bufferService.buffers.activateNormalBuffer(),e.params[t]===1049&&this.restoreCursor(),this._coreService.isCursorInitialized=!0,this._onRequestRefreshRows.fire(void 0),this._onRequestSyncScrollBar.fire();break;case 2004:this._coreService.decPrivateModes.bracketedPasteMode=!1;break;case 2026:this._coreService.decPrivateModes.synchronizedOutput=!1,this._onRequestRefreshRows.fire(void 0);break}return!0}requestMode(e,t){(m=>(m[m.NOT_RECOGNIZED=0]="NOT_RECOGNIZED",m[m.SET=1]="SET",m[m.RESET=2]="RESET",m[m.PERMANENTLY_SET=3]="PERMANENTLY_SET",m[m.PERMANENTLY_RESET=4]="PERMANENTLY_RESET"))(void 0||(n={}));let r=this._coreService.decPrivateModes,{activeProtocol:i,activeEncoding:s}=this._coreMouseService,o=this._coreService,{buffers:a,cols:l}=this._bufferService,{active:c,alt:u}=a,d=this._optionsService.rawOptions,p=(m,_)=>(o.triggerDataEvent(`${V.ESC}[${t?"":"?"}${m};${_}$y`),!0),f=m=>m?1:2,g=e.params[0];return t?g===2?p(g,4):g===4?p(g,f(o.modes.insertMode)):g===12?p(g,3):g===20?p(g,f(d.convertEol)):p(g,0):g===1?p(g,f(r.applicationCursorKeys)):g===3?p(g,d.windowOptions.setWinLines?l===80?2:l===132?1:0:0):g===6?p(g,f(r.origin)):g===7?p(g,f(r.wraparound)):g===8?p(g,3):g===9?p(g,f(i==="X10")):g===12?p(g,f(d.cursorBlink)):g===25?p(g,f(!o.isCursorHidden)):g===45?p(g,f(r.reverseWraparound)):g===66?p(g,f(r.applicationKeypad)):g===67?p(g,4):g===1e3?p(g,f(i==="VT200")):g===1002?p(g,f(i==="DRAG")):g===1003?p(g,f(i==="ANY")):g===1004?p(g,f(r.sendFocus)):g===1005?p(g,4):g===1006?p(g,f(s==="SGR")):g===1015?p(g,4):g===1016?p(g,f(s==="SGR_PIXELS")):g===1048?p(g,1):g===47||g===1047||g===1049?p(g,f(c===u)):g===2004?p(g,f(r.bracketedPasteMode)):g===2026?p(g,f(r.synchronizedOutput)):p(g,0)}_updateAttrColor(e,t,n,r,i){return t===2?(e|=50331648,e&=-16777216,e|=bc.fromColorRGB([n,r,i])):t===5&&(e&=-50331904,e|=33554432|n&255),e}_extractColor(e,t,n){let r=[0,0,-1,0,0,0],i=0,s=0;do{if(r[s+i]=e.params[t+s],e.hasSubParams(t+s)){let o=e.getSubParams(t+s),a=0;do r[1]===5&&(i=1),r[s+a+1+i]=o[a];while(++a<o.length&&a+s+1+i<r.length);break}if(r[1]===5&&s+i>=2||r[1]===2&&s+i>=5)break;r[1]&&(i=1)}while(++s+t<e.length&&s+i<r.length);for(let o=2;o<r.length;++o)r[o]===-1&&(r[o]=0);switch(r[0]){case 38:n.fg=this._updateAttrColor(n.fg,r[1],r[3],r[4],r[5]);break;case 48:n.bg=this._updateAttrColor(n.bg,r[1],r[3],r[4],r[5]);break;case 58:n.extended=n.extended.clone(),n.extended.underlineColor=this._updateAttrColor(n.extended.underlineColor,r[1],r[3],r[4],r[5])}return s}_processUnderline(e,t){t.extended=t.extended.clone(),(!~e||e>5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,e===0&&(t.fg&=-268435457),t.updateExtended()}_processSGR0(e){e.fg=it.fg,e.bg=it.bg,e.extended=e.extended.clone(),e.extended.underlineStyle=0,e.extended.underlineColor&=-67108864,e.updateExtended()}charAttributes(e){if(e.length===1&&e.params[0]===0)return this._processSGR0(this._curAttrData),!0;let t=e.length,n,r=this._curAttrData;for(let i=0;i<t;i++)n=e.params[i],n>=30&&n<=37?(r.fg&=-50331904,r.fg|=16777216|n-30):n>=40&&n<=47?(r.bg&=-50331904,r.bg|=16777216|n-40):n>=90&&n<=97?(r.fg&=-50331904,r.fg|=16777216|n-90|8):n>=100&&n<=107?(r.bg&=-50331904,r.bg|=16777216|n-100|8):n===0?this._processSGR0(r):n===1?r.fg|=134217728:n===3?r.bg|=67108864:n===4?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):n===5?r.fg|=536870912:n===7?r.fg|=67108864:n===8?r.fg|=1073741824:n===9?r.fg|=2147483648:n===2?r.bg|=134217728:n===21?this._processUnderline(2,r):n===22?(r.fg&=-134217729,r.bg&=-134217729):n===23?r.bg&=-67108865:n===24?(r.fg&=-268435457,this._processUnderline(0,r)):n===25?r.fg&=-536870913:n===27?r.fg&=-67108865:n===28?r.fg&=-1073741825:n===29?r.fg&=2147483647:n===39?(r.fg&=-67108864,r.fg|=it.fg&16777215):n===49?(r.bg&=-67108864,r.bg|=it.bg&16777215):n===38||n===48||n===58?i+=this._extractColor(e,i,r):n===53?r.bg|=1073741824:n===55?r.bg&=-1073741825:n===59?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):n===100?(r.fg&=-67108864,r.fg|=it.fg&16777215,r.bg&=-67108864,r.bg|=it.bg&16777215):this._logService.debug("Unknown SGR attribute: %d.",n);return!0}deviceStatus(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(`${V.ESC}[0n`);break;case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[${t};${n}R`);break}return!0}deviceStatusPrivate(e){switch(e.params[0]){case 6:let t=this._activeBuffer.y+1,n=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${V.ESC}[?${t};${n}R`);break}return!0}softReset(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=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(e){let t=e.length===0?1:e.params[0];if(t===0)this._coreService.decPrivateModes.cursorStyle=void 0,this._coreService.decPrivateModes.cursorBlink=void 0;else{switch(t){case 1:case 2:this._coreService.decPrivateModes.cursorStyle="block";break;case 3:case 4:this._coreService.decPrivateModes.cursorStyle="underline";break;case 5:case 6:this._coreService.decPrivateModes.cursorStyle="bar";break}let n=t%2===1;this._coreService.decPrivateModes.cursorBlink=n}return!0}setScrollRegion(e){let t=e.params[0]||1,n;return(e.length<2||(n=e.params[1])>this._bufferService.rows||n===0)&&(n=this._bufferService.rows),n>t&&(this._activeBuffer.scrollTop=t-1,this._activeBuffer.scrollBottom=n-1,this._setCursor(0,0)),!0}windowOptions(e){if(!bT(e.params[0],this._optionsService.rawOptions.windowOptions))return!0;let t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:t!==2&&this._onRequestWindowsOptionsReport.fire(0);break;case 16:this._onRequestWindowsOptionsReport.fire(1);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${V.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:(t===0||t===2)&&(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>mT&&this._windowTitleStack.shift()),(t===0||t===1)&&(this._iconNameStack.push(this._iconName),this._iconNameStack.length>mT&&this._iconNameStack.shift());break;case 23:(t===0||t===2)&&this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),(t===0||t===1)&&this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop());break}return!0}saveCursor(e){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(e){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0}setIconName(e){return this._iconName=e,!0}setOrReportIndexedColor(e){let t=[],n=e.split(";");for(;n.length>1;){let r=n.shift(),i=n.shift();if(/^\d+$/.exec(r)){let s=parseInt(r);if(_T(s))if(i==="?")t.push({type:0,index:s});else{let o=gT(i);o&&t.push({type:1,index:s,color:o})}}}return t.length&&this._onColor.fire(t),!0}setHyperlink(e){let t=e.indexOf(";");if(t===-1)return!0;let n=e.slice(0,t).trim(),r=e.slice(t+1);return r?this._createHyperlink(n,r):n.trim()?!1:this._finishHyperlink()}_createHyperlink(e,t){this._getCurrentLinkId()&&this._finishHyperlink();let n=e.split(":"),r,i=n.findIndex(s=>s.startsWith("id="));return i!==-1&&(r=n[i].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=this._oscLinkService.registerLink({id:r,uri:t}),this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),!0}_setOrReportSpecialColor(e,t){let n=e.split(";");for(let r=0;r<n.length&&!(t>=this._specialColors.length);++r,++t)if(n[r]==="?")this._onColor.fire([{type:0,index:this._specialColors[t]}]);else{let i=gT(n[r]);i&&this._onColor.fire([{type:1,index:this._specialColors[t],color:i}])}return!0}setOrReportFgColor(e){return this._setOrReportSpecialColor(e,0)}setOrReportBgColor(e){return this._setOrReportSpecialColor(e,1)}setOrReportCursorColor(e){return this._setOrReportSpecialColor(e,2)}restoreIndexedColor(e){if(!e)return this._onColor.fire([{type:2}]),!0;let t=[],n=e.split(";");for(let r=0;r<n.length;++r)if(/^\d+$/.exec(n[r])){let i=parseInt(n[r]);_T(i)&&t.push({type:2,index:i})}return t.length&&this._onColor.fire(t),!0}restoreFgColor(e){return this._onColor.fire([{type:2,index:256}]),!0}restoreBgColor(e){return this._onColor.fire([{type:2,index:257}]),!0}restoreCursorColor(e){return this._onColor.fire([{type:2,index:258}]),!0}nextLine(){return this._activeBuffer.x=0,this.index(),!0}keypadApplicationMode(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0}keypadNumericMode(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0}selectDefaultCharset(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,as),!0}selectCharset(e){return e.length!==2?(this.selectDefaultCharset(),!0):(e[0]==="/"||this._charsetService.setgCharset(g7[e[0]],gt[e[1]]||as),!0)}index(){return this._restrictCursor(),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){let e=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,e,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowTracker.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=it.clone(),this._eraseAttrDataInternal=it.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=this._curAttrData.bg&67108863,this._eraseAttrDataInternal}setgLevel(e){return this._charsetService.setgLevel(e),!0}screenAlignmentPattern(){let e=new Bn;e.content=1<<22|69,e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg,this._setCursor(0,0);for(let t=0;t<this._bufferService.rows;++t){let n=this._activeBuffer.ybase+this._activeBuffer.y+t,r=this._activeBuffer.lines.get(n);r&&(r.fill(e),r.isWrapped=!1)}return this._dirtyRowTracker.markAllDirty(),this._setCursor(0,0),!0}requestStatusString(e,t){let n=o=>(this._coreService.triggerDataEvent(`${V.ESC}${o}${V.ESC}\\`),!0),r=this._bufferService.buffer,i=this._optionsService.rawOptions;return n(e==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:e==='"p'?'P1$r61;1"p':e==="r"?`P1$r${r.scrollTop+1};${r.scrollBottom+1}r`:e==="m"?"P1$r0m":e===" q"?`P1$r${{block:2,underline:4,bar:6}[i.cursorStyle]-(i.cursorBlink?1:0)} q`:"P0$r")}markRangeDirty(e,t){this._dirtyRowTracker.markRangeDirty(e,t)}},gb=class{constructor(e){this._bufferService=e,this.clearRange()}clearRange(){this.start=this._bufferService.buffer.y,this.end=this._bufferService.buffer.y}markDirty(e){e<this.start?this.start=e:e>this.end&&(this.end=e)}markRangeDirty(e,t){e>t&&(vT=e,e=t,t=vT),e<this.start&&(this.start=e),t>this.end&&(this.end=t)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};gb=et([Q(0,Jt)],gb);function _T(e){return 0<=e&&e<256}var b7=5e7,ST=12,y7=50,v7=class extends _e{constructor(t){super(),this._action=t,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._didUserInput=!1,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event}handleUserInput(){this._didUserInput=!0}writeSync(t,n){if(n!==void 0&&this._syncCalls>n){this._syncCalls=0;return}if(this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;this._isSyncWriting=!0;let r;for(;r=this._writeBuffer.shift();){this._action(r);let i=this._callbacks.shift();i&&i()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(t,n){if(this._pendingData>b7)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+=t.length,this._writeBuffer.push(t),this._callbacks.push(n),this._innerWrite();return}setTimeout(()=>this._innerWrite())}this._pendingData+=t.length,this._writeBuffer.push(t),this._callbacks.push(n)}_innerWrite(t=0,n=!0){let r=t||performance.now();for(;this._writeBuffer.length>this._bufferOffset;){let i=this._writeBuffer[this._bufferOffset],s=this._action(i,n);if(s){let a=l=>performance.now()-r>=ST?setTimeout(()=>this._innerWrite(0,l)):this._innerWrite(r,l);s.catch(l=>(queueMicrotask(()=>{throw l}),Promise.resolve(!1))).then(a);return}let o=this._callbacks[this._bufferOffset];if(o&&o(),this._bufferOffset++,this._pendingData-=i.length,performance.now()-r>=ST)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>y7&&(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()}},mb=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 a=t.addMarker(t.ybase+t.y),l={data:e,id:this._nextId++,lines:[a]};return a.onDispose(()=>this._removeMarkerFromLink(l,a)),this._dataByLinkId.set(l.id,l),l.id}let n=e,r=this._getEntryIdKey(n),i=this._entriesWithId.get(r);if(i)return this.addLineToLink(i.id,t.ybase+t.y),i.id;let s=t.addMarker(t.ybase+t.y),o={id:this._nextId++,key:this._getEntryIdKey(n),data:n,lines:[s]};return s.onDispose(()=>this._removeMarkerFromLink(o,s)),this._entriesWithId.set(o.key,o),this._dataByLinkId.set(o.id,o),o.id}addLineToLink(e,t){let n=this._dataByLinkId.get(e);if(n&&n.lines.every(r=>r.line!==t)){let r=this._bufferService.buffer.addMarker(t);n.lines.push(r),r.onDispose(()=>this._removeMarkerFromLink(n,r))}}getLinkData(e){var t;return(t=this._dataByLinkId.get(e))==null?void 0:t.data}_getEntryIdKey(e){return`${e.id};;${e.uri}`}_removeMarkerFromLink(e,t){let n=e.lines.indexOf(t);n!==-1&&(e.lines.splice(n,1),e.lines.length===0&&(e.data.id!==void 0&&this._entriesWithId.delete(e.key),this._dataByLinkId.delete(e.id)))}};mb=et([Q(0,Jt)],mb);var wT=!1,_7=class extends _e{constructor(e){super(),this._windowsWrappingHeuristics=this._register(new Xo),this._onBinary=this._register(new K),this.onBinary=this._onBinary.event,this._onData=this._register(new K),this.onData=this._onData.event,this._onLineFeed=this._register(new K),this.onLineFeed=this._onLineFeed.event,this._onResize=this._register(new K),this.onResize=this._onResize.event,this._onWriteParsed=this._register(new K),this.onWriteParsed=this._onWriteParsed.event,this._onScroll=this._register(new K),this._instantiationService=new V9,this.optionsService=this._register(new e7(e)),this._instantiationService.setService(en,this.optionsService),this._bufferService=this._register(this._instantiationService.createInstance(db)),this._instantiationService.setService(Jt,this._bufferService),this._logService=this._register(this._instantiationService.createInstance(ub)),this._instantiationService.setService(DD,this._logService),this.coreService=this._register(this._instantiationService.createInstance(hb)),this._instantiationService.setService(Ks,this.coreService),this.coreMouseService=this._register(this._instantiationService.createInstance(pb)),this._instantiationService.setService(LD,this.coreMouseService),this.unicodeService=this._register(this._instantiationService.createInstance(fs)),this._instantiationService.setService(UW,this.unicodeService),this._charsetService=this._instantiationService.createInstance(s7),this._instantiationService.setService(jW,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(mb),this._instantiationService.setService(MD,this._oscLinkService),this._inputHandler=this._register(new m7(this._bufferService,this._charsetService,this.coreService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService)),this._register(At.forward(this._inputHandler.onLineFeed,this._onLineFeed)),this._register(this._inputHandler),this._register(At.forward(this._bufferService.onResize,this._onResize)),this._register(At.forward(this.coreService.onData,this._onData)),this._register(At.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 v7((t,n)=>this._inputHandler.parse(t,n))),this._register(At.forward(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onScroll(){return this._onScrollApi||(this._onScrollApi=this._register(new K),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&&!wT&&(this._logService.warn("writeSync is unreliable and will be removed soon."),wT=!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,p2),t=Math.max(t,f2),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(pT.bind(null,this._bufferService))),e.push(this.registerCsiHandler({final:"H"},()=>(pT(this._bufferService),!1))),this._windowsWrappingHeuristics.value=He(()=>{for(let t of e)t.dispose()})}}},S7={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 w7(e,t,n,r){var o;let i={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:e.key==="UIKeyInputUpArrow"?t?i.key=V.ESC+"OA":i.key=V.ESC+"[A":e.key==="UIKeyInputLeftArrow"?t?i.key=V.ESC+"OD":i.key=V.ESC+"[D":e.key==="UIKeyInputRightArrow"?t?i.key=V.ESC+"OC":i.key=V.ESC+"[C":e.key==="UIKeyInputDownArrow"&&(t?i.key=V.ESC+"OB":i.key=V.ESC+"[B");break;case 8:i.key=e.ctrlKey?"\b":V.DEL,e.altKey&&(i.key=V.ESC+i.key);break;case 9:if(e.shiftKey){i.key=V.ESC+"[Z";break}i.key=V.HT,i.cancel=!0;break;case 13:i.key=e.altKey?V.ESC+V.CR:V.CR,i.cancel=!0;break;case 27:i.key=V.ESC,e.altKey&&(i.key=V.ESC+V.ESC),i.cancel=!0;break;case 37:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"D":t?i.key=V.ESC+"OD":i.key=V.ESC+"[D";break;case 39:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"C":t?i.key=V.ESC+"OC":i.key=V.ESC+"[C";break;case 38:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"A":t?i.key=V.ESC+"OA":i.key=V.ESC+"[A";break;case 40:if(e.metaKey)break;s?i.key=V.ESC+"[1;"+(s+1)+"B":t?i.key=V.ESC+"OB":i.key=V.ESC+"[B";break;case 45:!e.shiftKey&&!e.ctrlKey&&(i.key=V.ESC+"[2~");break;case 46:s?i.key=V.ESC+"[3;"+(s+1)+"~":i.key=V.ESC+"[3~";break;case 36:s?i.key=V.ESC+"[1;"+(s+1)+"H":t?i.key=V.ESC+"OH":i.key=V.ESC+"[H";break;case 35:s?i.key=V.ESC+"[1;"+(s+1)+"F":t?i.key=V.ESC+"OF":i.key=V.ESC+"[F";break;case 33:e.shiftKey?i.type=2:e.ctrlKey?i.key=V.ESC+"[5;"+(s+1)+"~":i.key=V.ESC+"[5~";break;case 34:e.shiftKey?i.type=3:e.ctrlKey?i.key=V.ESC+"[6;"+(s+1)+"~":i.key=V.ESC+"[6~";break;case 112:s?i.key=V.ESC+"[1;"+(s+1)+"P":i.key=V.ESC+"OP";break;case 113:s?i.key=V.ESC+"[1;"+(s+1)+"Q":i.key=V.ESC+"OQ";break;case 114:s?i.key=V.ESC+"[1;"+(s+1)+"R":i.key=V.ESC+"OR";break;case 115:s?i.key=V.ESC+"[1;"+(s+1)+"S":i.key=V.ESC+"OS";break;case 116:s?i.key=V.ESC+"[15;"+(s+1)+"~":i.key=V.ESC+"[15~";break;case 117:s?i.key=V.ESC+"[17;"+(s+1)+"~":i.key=V.ESC+"[17~";break;case 118:s?i.key=V.ESC+"[18;"+(s+1)+"~":i.key=V.ESC+"[18~";break;case 119:s?i.key=V.ESC+"[19;"+(s+1)+"~":i.key=V.ESC+"[19~";break;case 120:s?i.key=V.ESC+"[20;"+(s+1)+"~":i.key=V.ESC+"[20~";break;case 121:s?i.key=V.ESC+"[21;"+(s+1)+"~":i.key=V.ESC+"[21~";break;case 122:s?i.key=V.ESC+"[23;"+(s+1)+"~":i.key=V.ESC+"[23~";break;case 123:s?i.key=V.ESC+"[24;"+(s+1)+"~":i.key=V.ESC+"[24~";break;default:if(e.ctrlKey&&!e.shiftKey&&!e.altKey&&!e.metaKey)e.keyCode>=65&&e.keyCode<=90?i.key=String.fromCharCode(e.keyCode-64):e.keyCode===32?i.key=V.NUL:e.keyCode>=51&&e.keyCode<=55?i.key=String.fromCharCode(e.keyCode-51+27):e.keyCode===56?i.key=V.DEL:e.keyCode===219?i.key=V.ESC:e.keyCode===220?i.key=V.FS:e.keyCode===221&&(i.key=V.GS);else if((!n||r)&&e.altKey&&!e.metaKey){let a=(o=S7[e.keyCode])==null?void 0:o[e.shiftKey?1:0];if(a)i.key=V.ESC+a;else if(e.keyCode>=65&&e.keyCode<=90){let l=e.ctrlKey?e.keyCode-64:e.keyCode+32,c=String.fromCharCode(l);e.shiftKey&&(c=c.toUpperCase()),i.key=V.ESC+c}else if(e.keyCode===32)i.key=V.ESC+(e.ctrlKey?V.NUL:" ");else if(e.key==="Dead"&&e.code.startsWith("Key")){let l=e.code.slice(3,4);e.shiftKey||(l=l.toLowerCase()),i.key=V.ESC+l,i.cancel=!0}}else n&&!e.altKey&&!e.ctrlKey&&!e.shiftKey&&e.metaKey?e.keyCode===65&&(i.type=1):e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&e.key.length===1?i.key=e.key:e.key&&e.ctrlKey&&(e.key==="_"&&(i.key=V.US),e.key==="@"&&(i.key=V.NUL));break}return i}var tt=0,x7=class{constructor(e){this._getKey=e,this._array=[],this._insertedValues=[],this._flushInsertedTask=new Gd,this._isFlushingInserted=!1,this._deletedIndices=[],this._flushDeletedTask=new Gd,this._isFlushingDeleted=!1}clear(){this._array.length=0,this._insertedValues.length=0,this._flushInsertedTask.clear(),this._isFlushingInserted=!1,this._deletedIndices.length=0,this._flushDeletedTask.clear(),this._isFlushingDeleted=!1}insert(e){this._flushCleanupDeleted(),this._insertedValues.length===0&&this._flushInsertedTask.enqueue(()=>this._flushInserted()),this._insertedValues.push(e)}_flushInserted(){let e=this._insertedValues.sort((i,s)=>this._getKey(i)-this._getKey(s)),t=0,n=0,r=new Array(this._array.length+this._insertedValues.length);for(let i=0;i<r.length;i++)n>=this._array.length||this._getKey(e[t])<=this._getKey(this._array[n])?(r[i]=e[t],t++):r[i]=this._array[n++];this._array=r,this._insertedValues.length=0}_flushCleanupInserted(){!this._isFlushingInserted&&this._insertedValues.length>0&&this._flushInsertedTask.flush()}delete(e){if(this._flushCleanupInserted(),this._array.length===0)return!1;let t=this._getKey(e);if(t===void 0||(tt=this._search(t),tt===-1)||this._getKey(this._array[tt])!==t)return!1;do if(this._array[tt]===e)return this._deletedIndices.length===0&&this._flushDeletedTask.enqueue(()=>this._flushDeleted()),this._deletedIndices.push(tt),!0;while(++tt<this._array.length&&this._getKey(this._array[tt])===t);return!1}_flushDeleted(){this._isFlushingDeleted=!0;let e=this._deletedIndices.sort((i,s)=>i-s),t=0,n=new Array(this._array.length-e.length),r=0;for(let i=0;i<this._array.length;i++)e[t]===i?t++:n[r++]=this._array[i];this._array=n,this._deletedIndices.length=0,this._isFlushingDeleted=!1}_flushCleanupDeleted(){!this._isFlushingDeleted&&this._deletedIndices.length>0&&this._flushDeletedTask.flush()}*getKeyIterator(e){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do yield this._array[tt];while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}forEachByKey(e,t){if(this._flushCleanupInserted(),this._flushCleanupDeleted(),this._array.length!==0&&(tt=this._search(e),!(tt<0||tt>=this._array.length)&&this._getKey(this._array[tt])===e))do t(this._array[tt]);while(++tt<this._array.length&&this._getKey(this._array[tt])===e)}values(){return this._flushCleanupInserted(),this._flushCleanupDeleted(),[...this._array].values()}_search(e){let t=0,n=this._array.length-1;for(;n>=t;){let r=t+n>>1,i=this._getKey(this._array[r]);if(i>e)n=r-1;else if(i<e)t=r+1;else{for(;r>0&&this._getKey(this._array[r-1])===e;)r--;return r}}return t}},Lf=0,xT=0,E7=class extends _e{constructor(){super(),this._decorations=new x7(e=>e==null?void 0:e.marker.line),this._onDecorationRegistered=this._register(new K),this.onDecorationRegistered=this._onDecorationRegistered.event,this._onDecorationRemoved=this._register(new K),this.onDecorationRemoved=this._onDecorationRemoved.event,this._register(He(()=>this.reset()))}get decorations(){return this._decorations.values()}registerDecoration(e){if(e.marker.isDisposed)return;let t=new k7(e);if(t){let n=t.marker.onDispose(()=>t.dispose()),r=t.onDispose(()=>{r.dispose(),t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),n.dispose())});this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(let e of this._decorations.values())e.dispose();this._decorations.clear()}*getDecorationsAtCell(e,t,n){let r=0,i=0;for(let s of this._decorations.getKeyIterator(t))r=s.options.x??0,i=r+(s.options.width??1),e>=r&&e<i&&(!n||(s.options.layer??"bottom")===n)&&(yield s)}forEachDecorationAtCell(e,t,n,r){this._decorations.forEachByKey(t,i=>{Lf=i.options.x??0,xT=Lf+(i.options.width??1),e>=Lf&&e<xT&&(!n||(i.options.layer??"bottom")===n)&&r(i)})}},k7=class extends Ii{constructor(e){super(),this.options=e,this.onRenderEmitter=this.add(new K),this.onRender=this.onRenderEmitter.event,this._onDispose=this.add(new K),this.onDispose=this._onDispose.event,this._cachedBg=null,this._cachedFg=null,this.marker=e.marker,this.options.overviewRulerOptions&&!this.options.overviewRulerOptions.position&&(this.options.overviewRulerOptions.position="full")}get backgroundColorRGB(){return this._cachedBg===null&&(this.options.backgroundColor?this._cachedBg=Ge.toColor(this.options.backgroundColor):this._cachedBg=void 0),this._cachedBg}get foregroundColorRGB(){return this._cachedFg===null&&(this.options.foregroundColor?this._cachedFg=Ge.toColor(this.options.foregroundColor):this._cachedFg=void 0),this._cachedFg}dispose(){this._onDispose.fire(),super.dispose()}},C7=1e3,T7=class{constructor(e,t=C7){this._renderCallback=e,this._debounceThresholdMS=t,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(e,t,n){this._rowCount=n,e=e!==void 0?e:0,t=t!==void 0?t:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,e):e,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,t):t;let r=performance.now();if(r-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=r,this._innerRefresh();else if(!this._additionalRefreshRequested){let i=r-this._lastRefreshMs,s=this._debounceThresholdMS-i;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=performance.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},s)}}_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)}},ET=20,Wd=class extends _e{constructor(e,t,n,r){super(),this._terminal=e,this._coreBrowserService=n,this._renderService=r,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="";let i=this._coreBrowserService.mainDocument;this._accessibilityContainer=i.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=i.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let s=0;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);if(this._topBoundaryFocusListener=s=>this._handleBoundaryFocus(s,0),this._bottomBoundaryFocusListener=s=>this._handleBoundaryFocus(s,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=i.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this._register(new T7(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(s=>this._handleResize(s.rows))),this._register(this._terminal.onRender(s=>this._refreshRows(s.start,s.end))),this._register(this._terminal.onScroll(()=>this._refreshRows())),this._register(this._terminal.onA11yChar(s=>this._handleChar(s))),this._register(this._terminal.onLineFeed(()=>this._handleChar(`
|
|
474
474
|
`))),this._register(this._terminal.onA11yTab(s=>this._handleTab(s))),this._register(this._terminal.onKey(s=>this._handleKey(s.key))),this._register(this._terminal.onBlur(()=>this._clearLiveRegion())),this._register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._register(de(i,"selectionchange",()=>this._handleSelectionChange())),this._register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRowsDimensions(),this._refreshRows(),this._register(He(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let t=0;t<e;t++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<ET+1&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
|
|
475
|
-
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ET+1&&(this._liveRegion.textContent+=Pm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",l=(n.ydisp+i+1).toString(),c=this._rowElements[i];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:l,offset:c})=>{let u=l instanceof Text?l.parentNode:l,d=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let p=this._rowColumns.get(u);if(!p)return console.warn("columns is null. Race condition?"),null;let f=c<p.length?p[c]:p.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},s=i(t),o=i(n);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Wd=Je([Q(1,Iv),Q(2,Qr),Q(3,Jr)],Wd);var bb=class extends _e{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new K),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new K),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(He(()=>{var s;Is(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(de(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(de(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(de(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(de(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):o.provideLinks(e.y,a=>{var c,u;if(this._isMouseOut)return;let l=a==null?void 0:a.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(s,l),n=this._checkLinkProviderResult(s,e,n),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let o=i[s],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&r){let o=r.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(l=>this._linkAtPosition(l.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&A7(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Is(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};bb=Je([Q(1,Ov),Q(2,Jr),Q(3,Jt),Q(4,FD)],bb);function A7(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var R7=class extends _7{constructor(e={}){super(e),this._linkifier=this._register(new Xo),this.browser=n2,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Xo),this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new K),this.onKey=this._onKey.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new K),this.onBell=this._onBell.event,this._onFocus=this._register(new K),this._onBlur=this._register(new K),this._onA11yCharEmitter=this._register(new K),this._onA11yTabEmitter=this._register(new K),this._onWillOpen=this._register(new K),this._setup(),this._decorationService=this._instantiationService.createInstance(E7),this._instantiationService.setService(yc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(y9),this._instantiationService.setService(FD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Bm)),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(At.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(At.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(At.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(At.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(He(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=Be.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${V.ESC}]${r};${f7(i)}${e2.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=ot.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=ot.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(Wd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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(V.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(de(this.element,"copy",t=>{this.hasSelection()&&LW(t,this._selectionService)}));let e=t=>DW(t,this.textarea,this.coreService,this.optionsService);this._register(de(this.textarea,"paste",e)),this._register(de(this.element,"paste",e)),r2?this._register(de(this.element,"mousedown",t=>{t.button===2&&D1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(de(this.element,"contextmenu",t=>{D1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Uv&&this._register(de(this.element,"auxclick",t=>{t.button===1&&AD(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(de(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(de(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(de(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(de(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(de(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(de(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(de(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(de(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Mm.get()),o2||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(m9,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Qr,this._coreBrowserService),this._register(de(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(de(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(sb,this._document,this._helperContainer),this._instantiationService.setService(Gh,this._charSizeService),this._themeService=this._instantiationService.createInstance(cb),this._instantiationService.setService(da,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hd),this._instantiationService.setService(PD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ab,this.rows,this.screenElement)),this._instantiationService.setService(Jr,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(nb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ob),this._instantiationService.setService(Ov,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(bb,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(eb,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(lb,this.element,this.screenElement,r)),this._instantiationService.setService(zW,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(At.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(tb,this.screenElement)),this._register(de(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(Wd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zd,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zd,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ib,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,u,d,p,f;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,a=s.button<3?s.button:3;break;case"mousedown":l=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let g=s.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(s,(p=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;l=g<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(de(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(de(t,"wheel",s=>{var o,a,l,c,u;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(l=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:l.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(s,!0);let d=V.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){TD(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=w7(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===V.ETX||n.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(N7(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(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(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function N7(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var I7=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},O7=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 Bn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},kT=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new O7(t)}getNullCell(){return new Bn}},L7=class extends _e{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new K),this.onBufferChange=this._onBufferChange.event,this._normal=new kT(this._core.buffers.normal,"normal"),this._alternate=new kT(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)}},D7=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},M7=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}},P7=["cols","rows"],cr=0,F7=class extends _e{constructor(e){super(),this._core=this._register(new R7(e)),this._addonManager=this._register(new I7),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(P7.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new D7(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new M7(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 L7(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
475
|
+
`&&(this._liveRegionLineCount++,this._liveRegionLineCount===ET+1&&(this._liveRegion.textContent+=Pm.get())))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,t){this._liveRegionDebouncer.refresh(e,t,this._terminal.rows)}_renderRows(e,t){let n=this._terminal.buffer,r=n.lines.length.toString();for(let i=e;i<=t;i++){let s=n.lines.get(n.ydisp+i),o=[],a=(s==null?void 0:s.translateToString(!0,void 0,void 0,o))||"",l=(n.ydisp+i+1).toString(),c=this._rowElements[i];c&&(a.length===0?(c.textContent=" ",this._rowColumns.set(c,[0,1])):(c.textContent=a,this._rowColumns.set(c,o)),c.setAttribute("aria-posinset",l),c.setAttribute("aria-setsize",r),this._alignRowWidth(c))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,t){let n=e.target,r=this._rowElements[t===0?1:this._rowElements.length-2],i=n.getAttribute("aria-posinset"),s=t===0?"1":`${this._terminal.buffer.lines.length}`;if(i===s||e.relatedTarget!==r)return;let o,a;if(t===0?(o=n,a=this._rowElements.pop(),this._rowContainer.removeChild(a)):(o=this._rowElements.shift(),a=n,this._rowContainer.removeChild(o)),o.removeEventListener("focus",this._topBoundaryFocusListener),a.removeEventListener("focus",this._bottomBoundaryFocusListener),t===0){let l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{let l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(t===0?-1:1),this._rowElements[t===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){var a;if(this._rowElements.length===0)return;let e=this._coreBrowserService.mainDocument.getSelection();if(!e)return;if(e.isCollapsed){this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection();return}if(!e.anchorNode||!e.focusNode){console.error("anchorNode and/or focusNode are null");return}let t={node:e.anchorNode,offset:e.anchorOffset},n={node:e.focusNode,offset:e.focusOffset};if((t.node.compareDocumentPosition(n.node)&Node.DOCUMENT_POSITION_PRECEDING||t.node===n.node&&t.offset>n.offset)&&([t,n]=[n,t]),t.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(t={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(t.node))return;let r=this._rowElements.slice(-1)[0];if(n.node.compareDocumentPosition(r)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(n={node:r,offset:((a=r.textContent)==null?void 0:a.length)??0}),!this._rowContainer.contains(n.node))return;let i=({node:l,offset:c})=>{let u=l instanceof Text?l.parentNode:l,d=parseInt(u==null?void 0:u.getAttribute("aria-posinset"),10)-1;if(isNaN(d))return console.warn("row is invalid. Race condition?"),null;let p=this._rowColumns.get(u);if(!p)return console.warn("columns is null. Race condition?"),null;let f=c<p.length?p[c]:p.slice(-1)[0]+1;return f>=this._terminal.cols&&(++d,f=0),{row:d,column:f}},s=i(t),o=i(n);if(!(!s||!o)){if(s.row>o.row||s.row===o.row&&s.column>=o.column)throw new Error("invalid range");this._terminal.select(s.column,s.row,(o.row-s.row)*this._terminal.cols-s.column+o.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let t=this._rowContainer.children.length;t<this._terminal.rows;t++)this._rowElements[t]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[t]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){let e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){Object.assign(this._accessibilityContainer.style,{width:`${this._renderService.dimensions.css.canvas.width}px`,fontSize:`${this._terminal.options.fontSize}px`}),this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e]),this._alignRowWidth(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}_alignRowWidth(e){var i,s;e.style.transform="";let t=e.getBoundingClientRect().width,n=(s=(i=this._rowColumns.get(e))==null?void 0:i.slice(-1))==null?void 0:s[0];if(!n)return;let r=n*this._renderService.dimensions.css.cell.width;e.style.transform=`scaleX(${r/t})`}};Wd=et([Q(1,Iv),Q(2,Qr),Q(3,Jr)],Wd);var bb=class extends _e{constructor(e,t,n,r,i){super(),this._element=e,this._mouseService=t,this._renderService=n,this._bufferService=r,this._linkProviderService=i,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this._register(new K),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this._register(new K),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this._register(He(()=>{var s;Is(this._linkCacheDisposables),this._linkCacheDisposables.length=0,this._lastMouseEvent=void 0,(s=this._activeProviderReplies)==null||s.clear()})),this._register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this._register(de(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this._register(de(this._element,"mousemove",this._handleMouseMove.bind(this))),this._register(de(this._element,"mousedown",this._handleMouseDown.bind(this))),this._register(de(this._element,"mouseup",this._handleMouseUp.bind(this)))}get currentLink(){return this._currentLink}_handleMouseMove(e){this._lastMouseEvent=e;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!t)return;this._isMouseOut=!1;let n=e.composedPath();for(let r=0;r<n.length;r++){let i=n[r];if(i.classList.contains("xterm"))break;if(i.classList.contains("xterm-hover"))return}(!this._lastBufferCell||t.x!==this._lastBufferCell.x||t.y!==this._lastBufferCell.y)&&(this._handleHover(t),this._lastBufferCell=t)}_handleHover(e){if(this._activeLine!==e.y||this._wasResized){this._clearCurrentLink(),this._askForLink(e,!1),this._wasResized=!1;return}this._currentLink&&this._linkAtPosition(this._currentLink.link,e)||(this._clearCurrentLink(),this._askForLink(e,!0))}_askForLink(e,t){var r,i;(!this._activeProviderReplies||!t)&&((r=this._activeProviderReplies)==null||r.forEach(s=>{s==null||s.forEach(o=>{o.link.dispose&&o.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let n=!1;for(let[s,o]of this._linkProviderService.linkProviders.entries())t?(i=this._activeProviderReplies)!=null&&i.get(s)&&(n=this._checkLinkProviderResult(s,e,n)):o.provideLinks(e.y,a=>{var c,u;if(this._isMouseOut)return;let l=a==null?void 0:a.map(d=>({link:d}));(c=this._activeProviderReplies)==null||c.set(s,l),n=this._checkLinkProviderResult(s,e,n),((u=this._activeProviderReplies)==null?void 0:u.size)===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,t){let n=new Set;for(let r=0;r<t.size;r++){let i=t.get(r);if(i)for(let s=0;s<i.length;s++){let o=i[s],a=o.link.range.start.y<e?0:o.link.range.start.x,l=o.link.range.end.y>e?this._bufferService.cols:o.link.range.end.x;for(let c=a;c<=l;c++){if(n.has(c)){i.splice(s--,1);break}n.add(c)}}}}_checkLinkProviderResult(e,t,n){var s;if(!this._activeProviderReplies)return n;let r=this._activeProviderReplies.get(e),i=!1;for(let o=0;o<e;o++)(!this._activeProviderReplies.has(o)||this._activeProviderReplies.get(o))&&(i=!0);if(!i&&r){let o=r.find(a=>this._linkAtPosition(a.link,t));o&&(n=!0,this._handleNewLink(o))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!n)for(let o=0;o<this._activeProviderReplies.size;o++){let a=(s=this._activeProviderReplies.get(o))==null?void 0:s.find(l=>this._linkAtPosition(l.link,t));if(a){n=!0,this._handleNewLink(a);break}}return n}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._currentLink)return;let t=this._positionFromMouseEvent(e,this._element,this._mouseService);t&&this._mouseDownLink&&A7(this._mouseDownLink.link,this._currentLink.link)&&this._linkAtPosition(this._currentLink.link,t)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,t){!this._currentLink||!this._lastMouseEvent||(!e||!t||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,Is(this._linkCacheDisposables),this._linkCacheDisposables.length=0)}_handleNewLink(e){if(!this._lastMouseEvent)return;let t=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);t&&this._linkAtPosition(e.link,t)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0?!0:e.link.decorations.underline,pointerCursor:e.link.decorations===void 0?!0:e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.pointerCursor},set:n=>{var r;(r=this._currentLink)!=null&&r.state&&this._currentLink.state.decorations.pointerCursor!==n&&(this._currentLink.state.decorations.pointerCursor=n,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",n))}},underline:{get:()=>{var n,r;return(r=(n=this._currentLink)==null?void 0:n.state)==null?void 0:r.decorations.underline},set:n=>{var r,i,s;(r=this._currentLink)!=null&&r.state&&((s=(i=this._currentLink)==null?void 0:i.state)==null?void 0:s.decorations.underline)!==n&&(this._currentLink.state.decorations.underline=n,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,n))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(n=>{if(!this._currentLink)return;let r=n.start===0?0:n.start+1+this._bufferService.buffer.ydisp,i=this._bufferService.buffer.ydisp+1+n.end;if(this._currentLink.link.range.start.y>=r&&this._currentLink.link.range.end.y<=i&&(this._clearCurrentLink(r,i),this._lastMouseEvent)){let s=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);s&&this._askForLink(s,!1)}})))}_linkHover(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)}_fireUnderlineEvent(e,t){let n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)}_linkLeave(e,t,n){var r;(r=this._currentLink)!=null&&r.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)}_linkAtPosition(e,t){let n=e.range.start.y*this._bufferService.cols+e.range.start.x,r=e.range.end.y*this._bufferService.cols+e.range.end.x,i=t.y*this._bufferService.cols+t.x;return n<=i&&i<=r}_positionFromMouseEvent(e,t,n){let r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}}};bb=et([Q(1,Ov),Q(2,Jr),Q(3,Jt),Q(4,FD)],bb);function A7(e,t){return e.text===t.text&&e.range.start.x===t.range.start.x&&e.range.start.y===t.range.start.y&&e.range.end.x===t.range.end.x&&e.range.end.y===t.range.end.y}var R7=class extends _7{constructor(e={}){super(e),this._linkifier=this._register(new Xo),this.browser=n2,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._accessibilityManager=this._register(new Xo),this._onCursorMove=this._register(new K),this.onCursorMove=this._onCursorMove.event,this._onKey=this._register(new K),this.onKey=this._onKey.event,this._onRender=this._register(new K),this.onRender=this._onRender.event,this._onSelectionChange=this._register(new K),this.onSelectionChange=this._onSelectionChange.event,this._onTitleChange=this._register(new K),this.onTitleChange=this._onTitleChange.event,this._onBell=this._register(new K),this.onBell=this._onBell.event,this._onFocus=this._register(new K),this._onBlur=this._register(new K),this._onA11yCharEmitter=this._register(new K),this._onA11yTabEmitter=this._register(new K),this._onWillOpen=this._register(new K),this._setup(),this._decorationService=this._instantiationService.createInstance(E7),this._instantiationService.setService(yc,this._decorationService),this._linkProviderService=this._instantiationService.createInstance(y9),this._instantiationService.setService(FD,this._linkProviderService),this._linkProviderService.registerLinkProvider(this._instantiationService.createInstance(Bm)),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(At.forward(this._inputHandler.onCursorMove,this._onCursorMove)),this._register(At.forward(this._inputHandler.onTitleChange,this._onTitleChange)),this._register(At.forward(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this._register(At.forward(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this._register(this._bufferService.onResize(t=>this._afterResize(t.cols,t.rows))),this._register(He(()=>{var t,n;this._customKeyEventHandler=void 0,(n=(t=this.element)==null?void 0:t.parentNode)==null||n.removeChild(this.element)}))}get linkifier(){return this._linkifier.value}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}get onWillOpen(){return this._onWillOpen.event}_handleColorEvent(e){if(this._themeService)for(let t of e){let n,r="";switch(t.index){case 256:n="foreground",r="10";break;case 257:n="background",r="11";break;case 258:n="cursor",r="12";break;default:n="ansi",r="4;"+t.index}switch(t.type){case 0:let i=Be.toColorRGB(n==="ansi"?this._themeService.colors.ansi[t.index]:this._themeService.colors[n]);this.coreService.triggerDataEvent(`${V.ESC}]${r};${f7(i)}${e2.ST}`);break;case 1:if(n==="ansi")this._themeService.modifyColors(s=>s.ansi[t.index]=ot.toColor(...t.color));else{let s=n;this._themeService.modifyColors(o=>o[s]=ot.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(Wd,this)):this._accessibilityManager.clear()}_handleTextAreaFocus(e){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(V.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(V.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;let e=this.buffer.ybase+this.buffer.y,t=this.buffer.lines.get(e);if(!t)return;let n=Math.min(this.buffer.x,this.cols-1),r=this._renderService.dimensions.css.cell.height,i=t.getWidth(n),s=this._renderService.dimensions.css.cell.width*i,o=this.buffer.y*this._renderService.dimensions.css.cell.height,a=n*this._renderService.dimensions.css.cell.width;this.textarea.style.left=a+"px",this.textarea.style.top=o+"px",this.textarea.style.width=s+"px",this.textarea.style.height=r+"px",this.textarea.style.lineHeight=r+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this._register(de(this.element,"copy",t=>{this.hasSelection()&&LW(t,this._selectionService)}));let e=t=>DW(t,this.textarea,this.coreService,this.optionsService);this._register(de(this.textarea,"paste",e)),this._register(de(this.element,"paste",e)),r2?this._register(de(this.element,"mousedown",t=>{t.button===2&&D1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this._register(de(this.element,"contextmenu",t=>{D1(t,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),Uv&&this._register(de(this.element,"auxclick",t=>{t.button===1&&AD(t,this.textarea,this.screenElement)}))}_bindKeys(){this._register(de(this.textarea,"keyup",e=>this._keyUp(e),!0)),this._register(de(this.textarea,"keydown",e=>this._keyDown(e),!0)),this._register(de(this.textarea,"keypress",e=>this._keyPress(e),!0)),this._register(de(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this._register(de(this.textarea,"compositionupdate",e=>this._compositionHelper.compositionupdate(e))),this._register(de(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this._register(de(this.textarea,"input",e=>this._inputEvent(e),!0)),this._register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(e){var i;if(!e)throw new Error("Terminal requires a parent element.");if(e.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),((i=this.element)==null?void 0:i.ownerDocument.defaultView)&&this._coreBrowserService){this.element.ownerDocument.defaultView!==this._coreBrowserService.window&&(this._coreBrowserService.window=this.element.ownerDocument.defaultView);return}this._document=e.ownerDocument,this.options.documentOverride&&this.options.documentOverride instanceof Document&&(this._document=this.optionsService.rawOptions.documentOverride),this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),e.appendChild(this.element);let t=this._document.createDocumentFragment();this._viewportElement=this._document.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),t.appendChild(this._viewportElement),this.screenElement=this._document.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._register(de(this.screenElement,"mousemove",s=>this.updateCursorStyle(s))),this._helperContainer=this._document.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),t.appendChild(this.screenElement);let n=this.textarea=this._document.createElement("textarea");this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",Mm.get()),o2||this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this._register(this.optionsService.onSpecificOptionChange("disableStdin",()=>n.readOnly=this.optionsService.rawOptions.disableStdin)),this.textarea.readOnly=this.optionsService.rawOptions.disableStdin,this._coreBrowserService=this._register(this._instantiationService.createInstance(m9,this.textarea,e.ownerDocument.defaultView??window,this._document??typeof window<"u"?window.document:null)),this._instantiationService.setService(Qr,this._coreBrowserService),this._register(de(this.textarea,"focus",s=>this._handleTextAreaFocus(s))),this._register(de(this.textarea,"blur",()=>this._handleTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._charSizeService=this._instantiationService.createInstance(sb,this._document,this._helperContainer),this._instantiationService.setService(Gh,this._charSizeService),this._themeService=this._instantiationService.createInstance(cb),this._instantiationService.setService(da,this._themeService),this._characterJoinerService=this._instantiationService.createInstance(Hd),this._instantiationService.setService(PD,this._characterJoinerService),this._renderService=this._register(this._instantiationService.createInstance(ab,this.rows,this.screenElement)),this._instantiationService.setService(Jr,this._renderService),this._register(this._renderService.onRenderedViewportChange(s=>this._onRender.fire(s))),this.onResize(s=>this._renderService.resize(s.cols,s.rows)),this._compositionView=this._document.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(nb,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this._mouseService=this._instantiationService.createInstance(ob),this._instantiationService.setService(Ov,this._mouseService);let r=this._linkifier.value=this._register(this._instantiationService.createInstance(bb,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(eb,this.element,this.screenElement)),this._register(this._viewport.onRequestScrollLines(s=>{super.scrollLines(s,!1),this.refresh(0,this.rows-1)})),this._selectionService=this._register(this._instantiationService.createInstance(lb,this.element,this.screenElement,r)),this._instantiationService.setService(zW,this._selectionService),this._register(this._selectionService.onRequestScrollLines(s=>this.scrollLines(s.amount,s.suppressScrollEvent))),this._register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this._register(this._selectionService.onRequestRedraw(s=>this._renderService.handleSelectionChanged(s.start,s.end,s.columnSelectMode))),this._register(this._selectionService.onLinuxMouseSelection(s=>{this.textarea.value=s,this.textarea.focus(),this.textarea.select()})),this._register(At.any(this._onScroll.event,this._inputHandler.onScroll)(()=>{var s;this._selectionService.refresh(),(s=this._viewport)==null||s.queueSync()})),this._register(this._instantiationService.createInstance(tb,this.screenElement)),this._register(de(this.element,"mousedown",s=>this._selectionService.handleMouseDown(s))),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(Wd,this)),this._register(this.optionsService.onSpecificOptionChange("screenReaderMode",s=>this._handleScreenReaderModeOptionChange(s))),this.options.overviewRuler.width&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zd,this._viewportElement,this.screenElement))),this.optionsService.onSpecificOptionChange("overviewRuler",s=>{!this._overviewRulerRenderer&&s&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this._register(this._instantiationService.createInstance(zd,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(ib,this,this._document,this.element,this.screenElement,this._viewportElement,this._helperContainer,this.linkifier)}bindMouse(){let e=this,t=this.element;function n(s){var c,u,d,p,f;let o=e._mouseService.getMouseReportCoords(s,e.screenElement);if(!o)return!1;let a,l;switch(s.overrideType||s.type){case"mousemove":l=32,s.buttons===void 0?(a=3,s.button!==void 0&&(a=s.button<3?s.button:3)):a=s.buttons&1?0:s.buttons&4?1:s.buttons&2?2:3;break;case"mouseup":l=0,a=s.button<3?s.button:3;break;case"mousedown":l=1,a=s.button<3?s.button:3;break;case"wheel":if(e._customWheelEventHandler&&e._customWheelEventHandler(s)===!1)return!1;let g=s.deltaY;if(g===0||e.coreMouseService.consumeWheelEvent(s,(p=(d=(u=(c=e._renderService)==null?void 0:c.dimensions)==null?void 0:u.device)==null?void 0:d.cell)==null?void 0:p.height,(f=e._coreBrowserService)==null?void 0:f.dpr)===0)return!1;l=g<0?0:1,a=4;break;default:return!1}return l===void 0||a===void 0||a>4?!1:e.coreMouseService.triggerMouseEvent({col:o.col,row:o.row,x:o.x,y:o.y,button:a,action:l,ctrl:s.ctrlKey,alt:s.altKey,shift:s.shiftKey})}let r={mouseup:null,wheel:null,mousedrag:null,mousemove:null},i={mouseup:s=>(n(s),s.buttons||(this._document.removeEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.removeEventListener("mousemove",r.mousedrag)),this.cancel(s)),wheel:s=>(n(s),this.cancel(s,!0)),mousedrag:s=>{s.buttons&&n(s)},mousemove:s=>{s.buttons||n(s)}};this._register(this.coreMouseService.onProtocolChange(s=>{s?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(s)),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()),s&8?r.mousemove||(t.addEventListener("mousemove",i.mousemove),r.mousemove=i.mousemove):(t.removeEventListener("mousemove",r.mousemove),r.mousemove=null),s&16?r.wheel||(t.addEventListener("wheel",i.wheel,{passive:!1}),r.wheel=i.wheel):(t.removeEventListener("wheel",r.wheel),r.wheel=null),s&2?r.mouseup||(r.mouseup=i.mouseup):(this._document.removeEventListener("mouseup",r.mouseup),r.mouseup=null),s&4?r.mousedrag||(r.mousedrag=i.mousedrag):(this._document.removeEventListener("mousemove",r.mousedrag),r.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this._register(de(t,"mousedown",s=>{if(s.preventDefault(),this.focus(),!(!this.coreMouseService.areMouseEventsActive||this._selectionService.shouldForceSelection(s)))return n(s),r.mouseup&&this._document.addEventListener("mouseup",r.mouseup),r.mousedrag&&this._document.addEventListener("mousemove",r.mousedrag),this.cancel(s)})),this._register(de(t,"wheel",s=>{var o,a,l,c,u;if(!r.wheel){if(this._customWheelEventHandler&&this._customWheelEventHandler(s)===!1)return!1;if(!this.buffer.hasScrollback){if(s.deltaY===0)return!1;if(e.coreMouseService.consumeWheelEvent(s,(c=(l=(a=(o=e._renderService)==null?void 0:o.dimensions)==null?void 0:a.device)==null?void 0:l.cell)==null?void 0:c.height,(u=e._coreBrowserService)==null?void 0:u.dpr)===0)return this.cancel(s,!0);let d=V.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(s.deltaY<0?"A":"B");return this.coreService.triggerDataEvent(d,!0),this.cancel(s,!0)}}},{passive:!1}))}refresh(e,t){var n;(n=this._renderService)==null||n.refreshRows(e,t)}updateCursorStyle(e){var t;(t=this._selectionService)!=null&&t.shouldColumnSelect(e)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(e,t){this._viewport?this._viewport.scrollLines(e):super.scrollLines(e,t),this.refresh(0,this.rows-1)}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this._bufferService.buffer.ydisp)}scrollToBottom(e){e&&this._viewport?this._viewport.scrollToLine(this.buffer.ybase,!0):this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)}scrollToLine(e){let t=e-this._bufferService.buffer.ydisp;t!==0&&this.scrollLines(t)}paste(e){TD(e,this.textarea,this.coreService,this.optionsService)}attachCustomKeyEventHandler(e){this._customKeyEventHandler=e}attachCustomWheelEventHandler(e){this._customWheelEventHandler=e}registerLinkProvider(e){return this._linkProviderService.registerLinkProvider(e)}registerCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");let t=this._characterJoinerService.register(e);return this.refresh(0,this.rows-1),t}deregisterCharacterJoiner(e){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(e)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}registerMarker(e){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+e)}registerDecoration(e){return this._decorationService.registerDecoration(e)}hasSelection(){return this._selectionService?this._selectionService.hasSelection:!1}select(e,t,n){this._selectionService.setSelection(e,t,n)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(!(!this._selectionService||!this._selectionService.hasSelection))return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var e;(e=this._selectionService)==null||e.clearSelection()}selectAll(){var e;(e=this._selectionService)==null||e.selectAll()}selectLines(e,t){var n;(n=this._selectionService)==null||n.selectLines(e,t)}_keyDown(e){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;let t=this.browser.isMac&&this.options.macOptionIsMeta&&e.altKey;if(!t&&!this._compositionHelper.keydown(e))return this.options.scrollOnUserInput&&this.buffer.ybase!==this.buffer.ydisp&&this.scrollToBottom(!0),!1;!t&&(e.key==="Dead"||e.key==="AltGraph")&&(this._unprocessedDeadKey=!0);let n=w7(e,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(e),n.type===3||n.type===2){let r=this.rows-1;return this.scrollLines(n.type===2?-r:r),this.cancel(e,!0)}if(n.type===1&&this.selectAll(),this._isThirdLevelShift(this.browser,e)||(n.cancel&&this.cancel(e,!0),!n.key)||e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.key.length===1&&e.key.charCodeAt(0)>=65&&e.key.charCodeAt(0)<=90)return!0;if(this._unprocessedDeadKey)return this._unprocessedDeadKey=!1,!0;if((n.key===V.ETX||n.key===V.CR)&&(this.textarea.value=""),this._onKey.fire({key:n.key,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(n.key,!0),!this.optionsService.rawOptions.screenReaderMode||e.altKey||e.ctrlKey)return this.cancel(e,!0);this._keyDownHandled=!0}_isThirdLevelShift(e,t){let n=e.isMac&&!this.options.macOptionIsMeta&&t.altKey&&!t.ctrlKey&&!t.metaKey||e.isWindows&&t.altKey&&t.ctrlKey&&!t.metaKey||e.isWindows&&t.getModifierState("AltGraph");return t.type==="keypress"?n:n&&(!t.keyCode||t.keyCode>47)}_keyUp(e){this._keyDownSeen=!1,!(this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)&&(N7(e)||this.focus(),this.updateCursorStyle(e),this._keyPressHandled=!1)}_keyPress(e){let t;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(e)===!1)return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(e.which===null||e.which===void 0)t=e.keyCode;else if(e.which!==0&&e.charCode!==0)t=e.which;else return!1;return!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)?!1:(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this.coreService.triggerDataEvent(t,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,!0)}_inputEvent(e){if(e.data&&e.inputType==="insertText"&&(!e.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;let t=e.data;return this.coreService.triggerDataEvent(t,!0),this.cancel(e),!0}return!1}resize(e,t){if(e===this.cols&&t===this.rows){this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure();return}super.resize(e,t)}_afterResize(e,t){var n;(n=this._charSizeService)==null||n.measure()}clear(){if(!(this.buffer.ybase===0&&this.buffer.y===0)){this.buffer.clearAllMarkers(),this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(let e=1;e<this.rows;e++)this.buffer.lines.push(this.buffer.getBlankLine(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(V.ESC+"[I"):this.coreService.triggerDataEvent(V.ESC+"[O")}_reportWindowsOptions(e){if(this._renderService)switch(e){case 0:let t=this._renderService.dimensions.css.canvas.width.toFixed(0),n=this._renderService.dimensions.css.canvas.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[4;${n};${t}t`);break;case 1:let r=this._renderService.dimensions.css.cell.width.toFixed(0),i=this._renderService.dimensions.css.cell.height.toFixed(0);this.coreService.triggerDataEvent(`${V.ESC}[6;${i};${r}t`);break}}cancel(e,t){if(!(!this.options.cancelEvents&&!t))return e.preventDefault(),e.stopPropagation(),!1}};function N7(e){return e.keyCode===16||e.keyCode===17||e.keyCode===18}var I7=class{constructor(){this._addons=[]}dispose(){for(let e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()}loadAddon(e,t){let n={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(n),t.dispose=()=>this._wrappedAddonDispose(n),t.activate(e)}_wrappedAddonDispose(e){if(e.isDisposed)return;let t=-1;for(let n=0;n<this._addons.length;n++)if(this._addons[n]===e){t=n;break}if(t===-1)throw new Error("Could not dispose an addon that has not been loaded");e.isDisposed=!0,e.dispose.apply(e.instance),this._addons.splice(t,1)}},O7=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 Bn)}translateToString(e,t,n){return this._line.translateToString(e,t,n)}},kT=class{constructor(e,t){this._buffer=e,this.type=t}init(e){return this._buffer=e,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(e){let t=this._buffer.lines.get(e);if(t)return new O7(t)}getNullCell(){return new Bn}},L7=class extends _e{constructor(e){super(),this._core=e,this._onBufferChange=this._register(new K),this.onBufferChange=this._onBufferChange.event,this._normal=new kT(this._core.buffers.normal,"normal"),this._alternate=new kT(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)}},D7=class{constructor(e){this._core=e}registerCsiHandler(e,t){return this._core.registerCsiHandler(e,n=>t(n.toArray()))}addCsiHandler(e,t){return this.registerCsiHandler(e,t)}registerDcsHandler(e,t){return this._core.registerDcsHandler(e,(n,r)=>t(n,r.toArray()))}addDcsHandler(e,t){return this.registerDcsHandler(e,t)}registerEscHandler(e,t){return this._core.registerEscHandler(e,t)}addEscHandler(e,t){return this.registerEscHandler(e,t)}registerOscHandler(e,t){return this._core.registerOscHandler(e,t)}addOscHandler(e,t){return this.registerOscHandler(e,t)}},M7=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}},P7=["cols","rows"],cr=0,F7=class extends _e{constructor(e){super(),this._core=this._register(new R7(e)),this._addonManager=this._register(new I7),this._publicOptions={...this._core.options};let t=r=>this._core.options[r],n=(r,i)=>{this._checkReadonlyOptions(r),this._core.options[r]=i};for(let r in this._core.options){let i={get:t.bind(this,r),set:n.bind(this,r)};Object.defineProperty(this._publicOptions,r,i)}}_checkReadonlyOptions(e){if(P7.includes(e))throw new Error(`Option "${e}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._parser||(this._parser=new D7(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new M7(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 L7(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let e=this._core.coreService.decPrivateModes,t="none";switch(this._core.coreMouseService.activeProtocol){case"X10":t="x10";break;case"VT200":t="vt200";break;case"DRAG":t="drag";break;case"ANY":t="any";break}return{applicationCursorKeysMode:e.applicationCursorKeys,applicationKeypadMode:e.applicationKeypad,bracketedPasteMode:e.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:t,originMode:e.origin,reverseWraparoundMode:e.reverseWraparound,sendFocusMode:e.sendFocus,synchronizedOutputMode:e.synchronizedOutput,wraparoundMode:e.wraparound}}get options(){return this._publicOptions}set options(e){for(let t in e)this._publicOptions[t]=e[t]}blur(){this._core.blur()}focus(){this._core.focus()}input(e,t=!0){this._core.input(e,t)}resize(e,t){this._verifyIntegers(e,t),this._core.resize(e,t)}open(e){this._core.open(e)}attachCustomKeyEventHandler(e){this._core.attachCustomKeyEventHandler(e)}attachCustomWheelEventHandler(e){this._core.attachCustomWheelEventHandler(e)}registerLinkProvider(e){return this._core.registerLinkProvider(e)}registerCharacterJoiner(e){return this._checkProposedApi(),this._core.registerCharacterJoiner(e)}deregisterCharacterJoiner(e){this._checkProposedApi(),this._core.deregisterCharacterJoiner(e)}registerMarker(e=0){return this._verifyIntegers(e),this._core.registerMarker(e)}registerDecoration(e){return this._checkProposedApi(),this._verifyPositiveIntegers(e.x??0,e.width??0,e.height??0),this._core.registerDecoration(e)}hasSelection(){return this._core.hasSelection()}select(e,t,n){this._verifyIntegers(e,t,n),this._core.select(e,t,n)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(e,t){this._verifyIntegers(e,t),this._core.selectLines(e,t)}dispose(){super.dispose()}scrollLines(e){this._verifyIntegers(e),this._core.scrollLines(e)}scrollPages(e){this._verifyIntegers(e),this._core.scrollPages(e)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(e){this._verifyIntegers(e),this._core.scrollToLine(e)}clear(){this._core.clear()}write(e,t){this._core.write(e,t)}writeln(e,t){this._core.write(e),this._core.write(`\r
|
|
476
476
|
`,t)}paste(e){this._core.paste(e)}refresh(e,t){this._verifyIntegers(e,t),this._core.refresh(e,t)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(e){this._addonManager.loadAddon(this,e)}static get strings(){return{get promptLabel(){return Mm.get()},set promptLabel(e){Mm.set(e)},get tooMuchOutput(){return Pm.get()},set tooMuchOutput(e){Pm.set(e)}}}_verifyIntegers(...e){for(cr of e)if(cr===1/0||isNaN(cr)||cr%1!==0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...e){for(cr of e)if(cr&&(cr===1/0||isNaN(cr)||cr%1!==0||cr<0))throw new Error("This API only accepts positive integers")}};/**
|
|
477
477
|
* Copyright (c) 2014-2024 The xterm.js authors. All rights reserved.
|
|
478
478
|
* @license MIT
|
|
@@ -487,7 +487,7 @@ WARNING: This link could potentially be dangerous`)){let n=window.open();if(n){t
|
|
|
487
487
|
*/var B7=2,j7=1,U7=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){var d;if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:((d=this._terminal.options.overviewRuler)==null?void 0:d.width)||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue("height")),i=Math.max(0,parseInt(n.getPropertyValue("width"))),s=window.getComputedStyle(this._terminal.element),o={top:parseInt(s.getPropertyValue("padding-top")),bottom:parseInt(s.getPropertyValue("padding-bottom")),right:parseInt(s.getPropertyValue("padding-right")),left:parseInt(s.getPropertyValue("padding-left"))},a=o.top+o.bottom,l=o.right+o.left,c=r-a,u=i-l-t;return{cols:Math.max(B7,Math.floor(u/e.css.cell.width)),rows:Math.max(j7,Math.floor(c/e.css.cell.height))}}};const CT={background:"#09090b",foreground:"#e4e4e7",cursor:"#a1a1aa",cursorAccent:"#09090b",selectionBackground:"#3f3f46",black:"#18181b",brightBlack:"#3f3f46",red:"#ef4444",brightRed:"#f87171",green:"#22c55e",brightGreen:"#4ade80",yellow:"#eab308",brightYellow:"#facc15",blue:"#3b82f6",brightBlue:"#60a5fa",magenta:"#a855f7",brightMagenta:"#c084fc",cyan:"#06b6d4",brightCyan:"#22d3ee",white:"#e4e4e7",brightWhite:"#f4f4f5"},TT={background:"#ffffff",foreground:"#1c1c1c",cursor:"#6b7280",cursorAccent:"#ffffff",selectionBackground:"#d1d5db",black:"#1c1c1c",brightBlack:"#6b7280",red:"#dc2626",brightRed:"#ef4444",green:"#16a34a",brightGreen:"#22c55e",yellow:"#ca8a04",brightYellow:"#eab308",blue:"#2563eb",brightBlue:"#3b82f6",magenta:"#9333ea",brightMagenta:"#a855f7",cyan:"#0891b2",brightCyan:"#06b6d4",white:"#e5e7eb",brightWhite:"#f9fafb"},m2=y.forwardRef(({onInput:e,onResize:t,onReady:n},r)=>{const i=y.useRef(null),s=y.useRef(null),o=y.useRef(null),a=y.useRef(e),l=y.useRef(t),c=y.useRef(n),u=y.useRef(!1),d=y.useRef(null);a.current=e,l.current=t,c.current=n;const{resolved:p}=Nv();return y.useImperativeHandle(r,()=>({write:f=>{var g;(g=s.current)==null||g.write(f)}})),y.useEffect(()=>{if(!i.current)return;const f=new F7({theme:p==="dark"?CT:TT,fontFamily:'"JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace',fontSize:13,lineHeight:1.5,cursorBlink:!0,convertEol:!1,scrollback:5e3,allowProposedApi:!0}),g=new U7;f.loadAddon(g),f.open(i.current),requestAnimationFrame(()=>{var v;g.fit();const{cols:_,rows:b}=f;u.current||(u.current=!0,(v=c.current)==null||v.call(c,_,b)),l.current(_,b)}),s.current=f,o.current=g,d.current=p,f.onData(_=>{a.current(_)});const m=new ResizeObserver(()=>{requestAnimationFrame(()=>{!i.current||i.current.offsetParent===null||(g.fit(),l.current(f.cols,f.rows))})});return m.observe(i.current),()=>{m.disconnect(),f.dispose(),s.current=null,o.current=null}},[]),y.useEffect(()=>{const f=s.current;if(!f||d.current===p)return;d.current=p,f.options.theme=p==="dark"?CT:TT;const g=p==="dark"?"dark":"light";a.current(`/theme ${g}\r`)},[p]),h.jsx("div",{ref:i,className:"h-full w-full bg-background",style:{overflow:"hidden",padding:"4px"}})});m2.displayName="WebTerminal";function AT(e){const t=[],n=String(e||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&t.push(o),i=r+1,r=n.indexOf(",",i)}return t}function $7(e,t){const n={};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const z7=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,H7=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,V7={};function RT(e,t){return(V7.jsx?H7:z7).test(e)}const G7=/[ \t\n\f\r]/g;function W7(e){return typeof e=="object"?e.type==="text"?NT(e.value):!1:NT(e)}function NT(e){return e.replace(G7,"")===""}class Sc{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}Sc.prototype.normal={};Sc.prototype.property={};Sc.prototype.space=void 0;function b2(e,t){const n={},r={};for(const i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Sc(n,r,t)}function Xl(e){return e.toLowerCase()}class un{constructor(t,n){this.attribute=n,this.property=t}}un.prototype.attribute="";un.prototype.booleanish=!1;un.prototype.boolean=!1;un.prototype.commaOrSpaceSeparated=!1;un.prototype.commaSeparated=!1;un.prototype.defined=!1;un.prototype.mustUseProperty=!1;un.prototype.number=!1;un.prototype.overloadedBoolean=!1;un.prototype.property="";un.prototype.spaceSeparated=!1;un.prototype.space=void 0;let q7=0;const me=Ys(),rt=Ys(),yb=Ys(),q=Ys(),Le=Ys(),Bo=Ys(),fn=Ys();function Ys(){return 2**++q7}const vb=Object.freeze(Object.defineProperty({__proto__:null,boolean:me,booleanish:rt,commaOrSpaceSeparated:fn,commaSeparated:Bo,number:q,overloadedBoolean:yb,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),Df=Object.keys(vb);class $v extends un{constructor(t,n,r,i){let s=-1;if(super(t,n),IT(this,"space",i),typeof r=="number")for(;++s<Df.length;){const o=Df[s];IT(this,Df[s],(r&vb[o])===vb[o])}}}$v.prototype.defined=!0;function IT(e,t,n){n&&(e[t]=n)}function pa(e){const t={},n={};for(const[r,i]of Object.entries(e.properties)){const s=new $v(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Xl(r)]=r,n[Xl(s.attribute)]=r}return new Sc(t,n,e.space)}const y2=pa({properties:{ariaActiveDescendant:null,ariaAtomic:rt,ariaAutoComplete:null,ariaBusy:rt,ariaChecked:rt,ariaColCount:q,ariaColIndex:q,ariaColSpan:q,ariaControls:Le,ariaCurrent:null,ariaDescribedBy:Le,ariaDetails:null,ariaDisabled:rt,ariaDropEffect:Le,ariaErrorMessage:null,ariaExpanded:rt,ariaFlowTo:Le,ariaGrabbed:rt,ariaHasPopup:null,ariaHidden:rt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Le,ariaLevel:q,ariaLive:null,ariaModal:rt,ariaMultiLine:rt,ariaMultiSelectable:rt,ariaOrientation:null,ariaOwns:Le,ariaPlaceholder:null,ariaPosInSet:q,ariaPressed:rt,ariaReadOnly:rt,ariaRelevant:null,ariaRequired:rt,ariaRoleDescription:Le,ariaRowCount:q,ariaRowIndex:q,ariaRowSpan:q,ariaSelected:rt,ariaSetSize:q,ariaSort:null,ariaValueMax:q,ariaValueMin:q,ariaValueNow:q,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function v2(e,t){return t in e?e[t]:t}function _2(e,t){return v2(e,t.toLowerCase())}const K7=pa({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Bo,acceptCharset:Le,accessKey:Le,action:null,allow:null,allowFullScreen:me,allowPaymentRequest:me,allowUserMedia:me,alt:null,as:null,async:me,autoCapitalize:null,autoComplete:Le,autoFocus:me,autoPlay:me,blocking:Le,capture:null,charSet:null,checked:me,cite:null,className:Le,cols:q,colSpan:null,content:null,contentEditable:rt,controls:me,controlsList:Le,coords:q|Bo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:me,defer:me,dir:null,dirName:null,disabled:me,download:yb,draggable:rt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:me,formTarget:null,headers:Le,height:q,hidden:yb,high:q,href:null,hrefLang:null,htmlFor:Le,httpEquiv:Le,id:null,imageSizes:null,imageSrcSet:null,inert:me,inputMode:null,integrity:null,is:null,isMap:me,itemId:null,itemProp:Le,itemRef:Le,itemScope:me,itemType:Le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:me,low:q,manifest:null,max:null,maxLength:q,media:null,method:null,min:null,minLength:q,multiple:me,muted:me,name:null,nonce:null,noModule:me,noValidate:me,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:me,optimum:q,pattern:null,ping:Le,placeholder:null,playsInline:me,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:me,referrerPolicy:null,rel:Le,required:me,reversed:me,rows:q,rowSpan:q,sandbox:Le,scope:null,scoped:me,seamless:me,selected:me,shadowRootClonable:me,shadowRootDelegatesFocus:me,shadowRootMode:null,shape:null,size:q,sizes:null,slot:null,span:q,spellCheck:rt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:q,step:null,style:null,tabIndex:q,target:null,title:null,translate:null,type:null,typeMustMatch:me,useMap:null,value:rt,width:q,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Le,axis:null,background:null,bgColor:null,border:q,borderColor:null,bottomMargin:q,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:me,declare:me,event:null,face:null,frame:null,frameBorder:null,hSpace:q,leftMargin:q,link:null,longDesc:null,lowSrc:null,marginHeight:q,marginWidth:q,noResize:me,noHref:me,noShade:me,noWrap:me,object:null,profile:null,prompt:null,rev:null,rightMargin:q,rules:null,scheme:null,scrolling:rt,standby:null,summary:null,text:null,topMargin:q,valueType:null,version:null,vAlign:null,vLink:null,vSpace:q,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:me,disableRemotePlayback:me,prefix:null,property:null,results:q,security:null,unselectable:null},space:"html",transform:_2}),Y7=pa({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:fn,accentHeight:q,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:q,amplitude:q,arabicForm:null,ascent:q,attributeName:null,attributeType:null,azimuth:q,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:q,by:null,calcMode:null,capHeight:q,className:Le,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:q,diffuseConstant:q,direction:null,display:null,dur:null,divisor:q,dominantBaseline:null,download:me,dx:null,dy:null,edgeMode:null,editable:null,elevation:q,enableBackground:null,end:null,event:null,exponent:q,externalResourcesRequired:null,fill:null,fillOpacity:q,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Bo,g2:Bo,glyphName:Bo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:q,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:q,horizOriginX:q,horizOriginY:q,id:null,ideographic:q,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:q,k:q,k1:q,k2:q,k3:q,k4:q,kernelMatrix:fn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:q,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:q,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:q,overlineThickness:q,paintOrder:null,panose1:null,path:null,pathLength:q,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:q,pointsAtY:q,pointsAtZ:q,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:fn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:fn,rev:fn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:fn,requiredFeatures:fn,requiredFonts:fn,requiredFormats:fn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:q,specularExponent:q,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:q,strikethroughThickness:q,string:null,stroke:null,strokeDashArray:fn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:q,strokeOpacity:q,strokeWidth:null,style:null,surfaceScale:q,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:fn,tabIndex:q,tableValues:null,target:null,targetX:q,targetY:q,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:fn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:q,underlineThickness:q,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:q,values:null,vAlphabetic:q,vMathematical:q,vectorEffect:null,vHanging:q,vIdeographic:q,version:null,vertAdvY:q,vertOriginX:q,vertOriginY:q,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:q,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:v2}),S2=pa({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),w2=pa({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:_2}),x2=pa({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),X7={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},Z7=/[A-Z]/g,OT=/-[a-z]/g,Q7=/^data[-\w.:]+$/i;function E2(e,t){const n=Xl(t);let r=t,i=un;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&Q7.test(t)){if(t.charAt(4)==="-"){const s=t.slice(5).replace(OT,eq);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=t.slice(4);if(!OT.test(s)){let o=s.replace(Z7,J7);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=$v}return new i(r,t)}function J7(e){return"-"+e.toLowerCase()}function eq(e){return e.charAt(1).toUpperCase()}const k2=b2([y2,K7,S2,w2,x2],"html"),Kh=b2([y2,Y7,S2,w2,x2],"svg");function LT(e){const t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function tq(e){return e.join(" ").trim()}var zv={},DT=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,nq=/\n/g,rq=/^\s*/,iq=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,sq=/^:\s*/,oq=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,aq=/^[;\s]*/,lq=/^\s+|\s+$/g,cq=`
|
|
488
488
|
`,MT="/",PT="*",ls="",uq="comment",dq="declaration";function hq(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(g){var m=g.match(nq);m&&(n+=m.length);var _=g.lastIndexOf(cq);r=~_?g.length-_:r+g.length}function s(){var g={line:n,column:r};return function(m){return m.position=new o(g),c(),m}}function o(g){this.start=g,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function a(g){var m=new Error(t.source+":"+n+":"+r+": "+g);if(m.reason=g,m.filename=t.source,m.line=n,m.column=r,m.source=e,!t.silent)throw m}function l(g){var m=g.exec(e);if(m){var _=m[0];return i(_),e=e.slice(_.length),m}}function c(){l(rq)}function u(g){var m;for(g=g||[];m=d();)m!==!1&&g.push(m);return g}function d(){var g=s();if(!(MT!=e.charAt(0)||PT!=e.charAt(1))){for(var m=2;ls!=e.charAt(m)&&(PT!=e.charAt(m)||MT!=e.charAt(m+1));)++m;if(m+=2,ls===e.charAt(m-1))return a("End of comment missing");var _=e.slice(2,m-2);return r+=2,i(_),e=e.slice(m),r+=2,g({type:uq,comment:_})}}function p(){var g=s(),m=l(iq);if(m){if(d(),!l(sq))return a("property missing ':'");var _=l(oq),b=g({type:dq,property:FT(m[0].replace(DT,ls)),value:_?FT(_[0].replace(DT,ls)):ls});return l(aq),b}}function f(){var g=[];u(g);for(var m;m=p();)m!==!1&&(g.push(m),u(g));return g}return c(),f()}function FT(e){return e?e.replace(lq,ls):ls}var pq=hq,fq=rd&&rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(zv,"__esModule",{value:!0});zv.default=mq;const gq=fq(pq);function mq(e,t){let n=null;if(!e||typeof e!="string")return n;const r=(0,gq.default)(e),i=typeof t=="function";return r.forEach(s=>{if(s.type!=="declaration")return;const{property:o,value:a}=s;i?t(o,a,s):a&&(n=n||{},n[o]=a)}),n}var Yh={};Object.defineProperty(Yh,"__esModule",{value:!0});Yh.camelCase=void 0;var bq=/^--[a-zA-Z0-9_-]+$/,yq=/-([a-z])/g,vq=/^[^-]+$/,_q=/^-(webkit|moz|ms|o|khtml)-/,Sq=/^-(ms)-/,wq=function(e){return!e||vq.test(e)||bq.test(e)},xq=function(e,t){return t.toUpperCase()},BT=function(e,t){return"".concat(t,"-")},Eq=function(e,t){return t===void 0&&(t={}),wq(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(Sq,BT):e=e.replace(_q,BT),e.replace(yq,xq))};Yh.camelCase=Eq;var kq=rd&&rd.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Cq=kq(zv),Tq=Yh;function _b(e,t){var n={};return!e||typeof e!="string"||(0,Cq.default)(e,function(r,i){r&&i&&(n[(0,Tq.camelCase)(r,t)]=i)}),n}_b.default=_b;var Aq=_b;const Rq=ah(Aq),C2=T2("end"),Hv=T2("start");function T2(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function Nq(e){const t=Hv(e),n=C2(e);if(t&&n)return{start:t,end:n}}function yl(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?jT(e.position):"start"in e||"end"in e?jT(e):"line"in e||"column"in e?Sb(e):""}function Sb(e){return UT(e&&e.line)+":"+UT(e&&e.column)}function jT(e){return Sb(e&&e.start)+"-"+Sb(e&&e.end)}function UT(e){return e&&typeof e=="number"?e:1}class $t extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof t=="string"?i=t:!s.cause&&t&&(o=!0,i=t.message,s.cause=t),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=yl(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}$t.prototype.file="";$t.prototype.name="";$t.prototype.reason="";$t.prototype.message="";$t.prototype.stack="";$t.prototype.column=void 0;$t.prototype.line=void 0;$t.prototype.ancestors=void 0;$t.prototype.cause=void 0;$t.prototype.fatal=void 0;$t.prototype.place=void 0;$t.prototype.ruleId=void 0;$t.prototype.source=void 0;const Vv={}.hasOwnProperty,Iq=new Map,Oq=/[A-Z]/g,Lq=new Set(["table","tbody","thead","tfoot","tr"]),Dq=new Set(["td","th"]),A2="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function Mq(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=Hq(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=zq(n,t.jsx,t.jsxs)}const i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?Kh:k2,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},s=R2(i,e,void 0);return s&&typeof s!="string"?s:i.create(e,i.Fragment,{children:s||void 0},void 0)}function R2(e,t,n){if(t.type==="element")return Pq(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return Fq(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return jq(e,t,n);if(t.type==="mdxjsEsm")return Bq(e,t);if(t.type==="root")return Uq(e,t,n);if(t.type==="text")return $q(e,t)}function Pq(e,t,n){const r=e.schema;let i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=Kh,e.schema=i),e.ancestors.push(t);const s=I2(e,t.tagName,!1),o=Vq(e,t);let a=Wv(e,t);return Lq.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!W7(l):!0})),N2(e,o,s,t),Gv(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Fq(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Zl(e,t.position)}function Bq(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Zl(e,t.position)}function jq(e,t,n){const r=e.schema;let i=r;t.name==="svg"&&r.space==="html"&&(i=Kh,e.schema=i),e.ancestors.push(t);const s=t.name===null?e.Fragment:I2(e,t.name,!0),o=Gq(e,t),a=Wv(e,t);return N2(e,o,s,t),Gv(o,a),e.ancestors.pop(),e.schema=r,e.create(t,s,o,n)}function Uq(e,t,n){const r={};return Gv(r,Wv(e,t)),e.create(t,e.Fragment,r,n)}function $q(e,t){return t.value}function N2(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Gv(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function zq(e,t,n){return r;function r(i,s,o,a){const c=Array.isArray(o.children)?n:t;return a?c(s,o,a):c(s,o)}}function Hq(e,t){return n;function n(r,i,s,o){const a=Array.isArray(s.children),l=Hv(r);return t(i,s,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function Vq(e,t){const n={};let r,i;for(i in t.properties)if(i!=="children"&&Vv.call(t.properties,i)){const s=Wq(e,i,t.properties[i]);if(s){const[o,a]=s;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&Dq.has(t.tagName)?r=a:n[o]=a}}if(r){const s=n.style||(n.style={});s[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function Gq(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const s=r.data.estree.body[0];s.type;const o=s.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Zl(e,t.position);else{const i=r.name;let s;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,s=e.evaluater.evaluateExpression(a.expression)}else Zl(e,t.position);else s=r.value===null?!0:r.value;n[i]=s}return n}function Wv(e,t){const n=[];let r=-1;const i=e.passKeys?new Map:Iq;for(;++r<t.children.length;){const s=t.children[r];let o;if(e.passKeys){const l=s.type==="element"?s.tagName:s.type==="mdxJsxFlowElement"||s.type==="mdxJsxTextElement"?s.name:void 0;if(l){const c=i.get(l)||0;o=l+"-"+c,i.set(l,c+1)}}const a=R2(e,s,o);a!==void 0&&n.push(a)}return n}function Wq(e,t,n){const r=E2(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?$7(n):tq(n)),r.property==="style"){let i=typeof n=="object"?n:qq(e,String(n));return e.stylePropertyNameCase==="css"&&(i=Kq(i)),["style",i]}return[e.elementAttributeNameCase==="react"&&r.space?X7[r.property]||r.property:r.attribute,n]}}function qq(e,t){try{return Rq(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,i=new $t("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw i.file=e.filePath||void 0,i.url=A2+"#cannot-parse-style-attribute",i}}function I2(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const i=t.split(".");let s=-1,o;for(;++s<i.length;){const a=RT(i[s])?{type:"Identifier",name:i[s]}:{type:"Literal",value:i[s]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(s&&a.type==="Literal"),optional:!1}:a}r=o}else r=RT(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const i=r.value;return Vv.call(e.components,i)?e.components[i]:i}if(e.evaluater)return e.evaluater.evaluateExpression(r);Zl(e)}function Zl(e,t){const n=new $t("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=A2+"#cannot-handle-mdx-estrees-without-createevaluater",n}function Kq(e){const t={};let n;for(n in e)Vv.call(e,n)&&(t[Yq(n)]=e[n]);return t}function Yq(e){let t=e.replace(Oq,Xq);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function Xq(e){return"-"+e.toLowerCase()}const Mf={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},Zq={};function qv(e,t){const n=Zq,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return O2(e,r,i)}function O2(e,t,n){if(Qq(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return $T(e.children,t,n)}return Array.isArray(e)?$T(e,t,n):""}function $T(e,t,n){const r=[];let i=-1;for(;++i<e.length;)r[i]=O2(e[i],t,n);return r.join("")}function Qq(e){return!!(e&&typeof e=="object")}const zT=document.createElement("i");function Ql(e){const t="&"+e+";";zT.innerHTML=t;const n=zT.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function _n(e,t,n,r){const i=e.length;let s=0,o;if(t<0?t=-t>i?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(t,0),e.splice(...o),s+=1e4,t+=1e4}function On(e,t){return e.length>0?(_n(e,e.length,0,t),e):t}const HT={}.hasOwnProperty;function L2(e){const t={};let n=-1;for(;++n<e.length;)Jq(t,e[n]);return t}function Jq(e,t){let n;for(n in t){const i=(HT.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n];let o;if(s)for(o in s){HT.call(i,o)||(i[o]=[]);const a=s[o];eK(i[o],Array.isArray(a)?a:a?[a]:[])}}}function eK(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);_n(e,0,0,r)}function D2(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function er(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Wt=qi(/[A-Za-z]/),Ft=qi(/[\dA-Za-z]/),tK=qi(/[#-'*+\--9=?A-Z^-~]/);function qd(e){return e!==null&&(e<32||e===127)}const wb=qi(/\d/),nK=qi(/[\dA-Fa-f]/),rK=qi(/[!-/:-@[-`{-~]/);function oe(e){return e!==null&&e<-2}function Oe(e){return e!==null&&(e<0||e===32)}function Se(e){return e===-2||e===-1||e===32}const Xh=qi(new RegExp("\\p{P}|\\p{S}","u")),Ls=qi(/\s/);function qi(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function fa(e){const t=[];let n=-1,r=0,i=0;for(;++n<e.length;){const s=e.charCodeAt(n);let o="";if(s===37&&Ft(e.charCodeAt(n+1))&&Ft(e.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=e.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function Ce(e,t,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Se(l)?(e.enter(n),a(l)):t(l)}function a(l){return Se(l)&&s++<i?(e.consume(l),a):(e.exit(n),t(l))}}const iK={tokenize:sK};function sK(e){const t=e.attempt(this.parser.constructs.contentInitial,r,i);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ce(e,t,"linePrefix")}function i(a){return e.enter("paragraph"),s(a)}function s(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return oe(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),o)}}const oK={tokenize:aK},VT={tokenize:lK};function aK(e){const t=this,n=[];let r=0,i,s,o;return a;function a(S){if(r<n.length){const w=n[r];return t.containerState=w[1],e.attempt(w[0].continuation,l,c)(S)}return c(S)}function l(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,i&&v();const w=t.events.length;let k=w,x;for(;k--;)if(t.events[k][0]==="exit"&&t.events[k][1].type==="chunkFlow"){x=t.events[k][1].end;break}b(r);let E=w;for(;E<t.events.length;)t.events[E][1].end={...x},E++;return _n(t.events,k+1,0,t.events.slice(w)),t.events.length=E,c(S)}return a(S)}function c(S){if(r===n.length){if(!i)return p(S);if(i.currentConstruct&&i.currentConstruct.concrete)return g(S);t.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(VT,u,d)(S)}function u(S){return i&&v(),b(r),p(S)}function d(S){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,g(S)}function p(S){return t.containerState={},e.attempt(VT,f,g)(S)}function f(S){return r++,n.push([t.currentConstruct,t.containerState]),p(S)}function g(S){if(S===null){i&&v(),b(0),e.consume(S);return}return i=i||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),m(S)}function m(S){if(S===null){_(e.exit("chunkFlow"),!0),b(0),e.consume(S);return}return oe(S)?(e.consume(S),_(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(S),m)}function _(S,w){const k=t.sliceStream(S);if(w&&k.push(null),S.previous=s,s&&(s.next=S),s=S,i.defineSkip(S.start),i.write(k),t.parser.lazy[S.start.line]){let x=i.events.length;for(;x--;)if(i.events[x][1].start.offset<o&&(!i.events[x][1].end||i.events[x][1].end.offset>o))return;const E=t.events.length;let T=E,D,A;for(;T--;)if(t.events[T][0]==="exit"&&t.events[T][1].type==="chunkFlow"){if(D){A=t.events[T][1].end;break}D=!0}for(b(r),x=E;x<t.events.length;)t.events[x][1].end={...A},x++;_n(t.events,T+1,0,t.events.slice(E)),t.events.length=x}}function b(S){let w=n.length;for(;w-- >S;){const k=n[w];t.containerState=k[1],k[0].exit.call(t,e)}n.length=S}function v(){i.write([null]),s=void 0,i=void 0,t.containerState._closeFlow=void 0}}function lK(e,t,n){return Ce(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Zo(e){if(e===null||Oe(e)||Ls(e))return 1;if(Xh(e))return 2}function Zh(e,t,n){const r=[];let i=-1;for(;++i<e.length;){const s=e[i].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}const xb={name:"attention",resolveAll:cK,tokenize:uK};function cK(e,t){let n=-1,r,i,s,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},p={...e[n][1].start};GT(d,-l),GT(p,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=On(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=On(c,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",s,t]]),c=On(c,Zh(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=On(c,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=On(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,_n(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function uK(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=Zo(r);let s;return o;function o(l){return s=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===s)return e.consume(l),a;const c=e.exit("attentionSequence"),u=Zo(l),d=!u||u===2&&i||n.includes(l),p=!i||i===2&&u||n.includes(r);return c._open=!!(s===42?d:d&&(i||!p)),c._close=!!(s===42?p:p&&(u||!d)),t(l)}}function GT(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const dK={name:"autolink",tokenize:hK};function hK(e,t,n){let r=0;return i;function i(f){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(f){return Wt(f)?(e.consume(f),o):f===64?n(f):c(f)}function o(f){return f===43||f===45||f===46||Ft(f)?(r=1,a(f)):c(f)}function a(f){return f===58?(e.consume(f),r=0,l):(f===43||f===45||f===46||Ft(f))&&r++<32?(e.consume(f),a):(r=0,c(f))}function l(f){return f===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):f===null||f===32||f===60||qd(f)?n(f):(e.consume(f),l)}function c(f){return f===64?(e.consume(f),u):tK(f)?(e.consume(f),c):n(f)}function u(f){return Ft(f)?d(f):n(f)}function d(f){return f===46?(e.consume(f),r=0,u):f===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(f),e.exit("autolinkMarker"),e.exit("autolink"),t):p(f)}function p(f){if((f===45||Ft(f))&&r++<63){const g=f===45?p:d;return e.consume(f),g}return n(f)}}const wc={partial:!0,tokenize:pK};function pK(e,t,n){return r;function r(s){return Se(s)?Ce(e,i,"linePrefix")(s):i(s)}function i(s){return s===null||oe(s)?t(s):n(s)}}const M2={continuation:{tokenize:gK},exit:mK,name:"blockQuote",tokenize:fK};function fK(e,t,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Se(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function gK(e,t,n){const r=this;return i;function i(o){return Se(o)?Ce(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return e.attempt(M2,t,n)(o)}}function mK(e){e.exit("blockQuote")}const P2={name:"characterEscape",tokenize:bK};function bK(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),i}function i(s){return rK(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}const F2={name:"characterReference",tokenize:yK};function yK(e,t,n){const r=this;let i=0,s,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),s=31,o=Ft,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,o=nK,u):(e.enter("characterReferenceValue"),s=7,o=wb,u(d))}function u(d){if(d===59&&i){const p=e.exit("characterReferenceValue");return o===Ft&&!Ql(r.sliceSerialize(p))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&i++<s?(e.consume(d),u):n(d)}}const WT={partial:!0,tokenize:_K},qT={concrete:!0,name:"codeFenced",tokenize:vK};function vK(e,t,n){const r=this,i={partial:!0,tokenize:k};let s=0,o=0,a;return l;function l(x){return c(x)}function c(x){const E=r.events[r.events.length-1];return s=E&&E[1].type==="linePrefix"?E[2].sliceSerialize(E[1],!0).length:0,a=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(x)}function u(x){return x===a?(o++,e.consume(x),u):o<3?n(x):(e.exit("codeFencedFenceSequence"),Se(x)?Ce(e,d,"whitespace")(x):d(x))}function d(x){return x===null||oe(x)?(e.exit("codeFencedFence"),r.interrupt?t(x):e.check(WT,m,w)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||oe(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(x)):Se(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ce(e,f,"whitespace")(x)):x===96&&x===a?n(x):(e.consume(x),p)}function f(x){return x===null||oe(x)?d(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),g(x))}function g(x){return x===null||oe(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(x)):x===96&&x===a?n(x):(e.consume(x),g)}function m(x){return e.attempt(i,w,_)(x)}function _(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),b}function b(x){return s>0&&Se(x)?Ce(e,v,"linePrefix",s+1)(x):v(x)}function v(x){return x===null||oe(x)?e.check(WT,m,w)(x):(e.enter("codeFlowValue"),S(x))}function S(x){return x===null||oe(x)?(e.exit("codeFlowValue"),v(x)):(e.consume(x),S)}function w(x){return e.exit("codeFenced"),t(x)}function k(x,E,T){let D=0;return A;function A(F){return x.enter("lineEnding"),x.consume(F),x.exit("lineEnding"),R}function R(F){return x.enter("codeFencedFence"),Se(F)?Ce(x,I,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):I(F)}function I(F){return F===a?(x.enter("codeFencedFenceSequence"),L(F)):T(F)}function L(F){return F===a?(D++,x.consume(F),L):D>=o?(x.exit("codeFencedFenceSequence"),Se(F)?Ce(x,P,"whitespace")(F):P(F)):T(F)}function P(F){return F===null||oe(F)?(x.exit("codeFencedFence"),E(F)):T(F)}}}function _K(e,t,n){const r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Pf={name:"codeIndented",tokenize:wK},SK={partial:!0,tokenize:xK};function wK(e,t,n){const r=this;return i;function i(c){return e.enter("codeIndented"),Ce(e,s,"linePrefix",5)(c)}function s(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):oe(c)?e.attempt(SK,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||oe(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function xK(e,t,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):Ce(e,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):oe(o)?i(o):n(o)}}const EK={name:"codeText",previous:CK,resolve:kK,tokenize:TK};function kK(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="codeTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function CK(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function TK(e,t,n){let r=0,i,s;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(s=e.enter("codeTextSequence"),i=0,u(d)):oe(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||oe(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),i++,u):i===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(s.type="codeTextData",c(d))}}class AK{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const i=n||0;this.setCursor(Math.trunc(t));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Ha(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Ha(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Ha(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Ha(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Ha(this.left,n.reverse())}}}function Ha(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function B2(e){const t={};let n=-1,r,i,s,o,a,l,c;const u=new AK(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,RK(u,n)),n=t[n],c=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=u.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(u.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...u.get(i)[1].start},a=u.slice(i,n),a.unshift(r),u.splice(i,n-i+1,a))}}return _n(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function RK(e,t){const n=e.get(t)[1],r=e.get(t)[2];let i=t-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,p=-1,f=n,g=0,m=0;const _=[m];for(;f;){for(;e.get(++i)[1]!==f;);s.push(i),f._tokenizer||(u=r.sliceStream(f),f.next||u.push(null),d&&o.defineSkip(f.start),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),f._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=f,f=f.next}for(f=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(m=p+1,_.push(m),f._tokenizer=void 0,f.previous=void 0,f=f.next);for(o.events=[],f?(f._tokenizer=void 0,f.previous=void 0):_.pop(),p=_.length;p--;){const b=a.slice(_[p],_[p+1]),v=s.pop();l.push([v,v+b.length-1]),e.splice(v,2,b)}for(l.reverse(),p=-1;++p<l.length;)c[g+l[p][0]]=g+l[p][1],g+=l[p][1]-l[p][0]-1;return c}const NK={resolve:OK,tokenize:LK},IK={partial:!0,tokenize:DK};function OK(e){return B2(e),e}function LK(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):oe(a)?e.check(IK,o,s)(a):(e.consume(a),i)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function DK(e,t,n){const r=this;return i;function i(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ce(e,s,"linePrefix")}function s(o){if(o===null||oe(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function j2(e,t,n,r,i,s,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(b){return b===60?(e.enter(r),e.enter(i),e.enter(s),e.consume(b),e.exit(s),p):b===null||b===32||b===41||qd(b)?n(b):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),m(b))}function p(b){return b===62?(e.enter(s),e.consume(b),e.exit(s),e.exit(i),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),f(b))}function f(b){return b===62?(e.exit("chunkString"),e.exit(a),p(b)):b===null||b===60||oe(b)?n(b):(e.consume(b),b===92?g:f)}function g(b){return b===60||b===62||b===92?(e.consume(b),f):f(b)}function m(b){return!u&&(b===null||b===41||Oe(b))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(b)):u<c&&b===40?(e.consume(b),u++,m):b===41?(e.consume(b),u--,m):b===null||b===32||b===40||qd(b)?n(b):(e.consume(b),b===92?_:m)}function _(b){return b===40||b===41||b===92?(e.consume(b),m):m(b)}}function U2(e,t,n,r,i,s){const o=this;let a=0,l;return c;function c(f){return e.enter(r),e.enter(i),e.consume(f),e.exit(i),e.enter(s),u}function u(f){return a>999||f===null||f===91||f===93&&!l||f===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(f):f===93?(e.exit(s),e.enter(i),e.consume(f),e.exit(i),e.exit(r),t):oe(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(f))}function d(f){return f===null||f===91||f===93||oe(f)||a++>999?(e.exit("chunkString"),u(f)):(e.consume(f),l||(l=!Se(f)),f===92?p:d)}function p(f){return f===91||f===92||f===93?(e.consume(f),a++,d):d(f)}}function $2(e,t,n,r,i,s){let o;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(i),e.consume(p),e.exit(i),o=p===40?41:p,l):n(p)}function l(p){return p===o?(e.enter(i),e.consume(p),e.exit(i),e.exit(r),t):(e.enter(s),c(p))}function c(p){return p===o?(e.exit(s),l(o)):p===null?n(p):oe(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),Ce(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(p))}function u(p){return p===o||p===null||oe(p)?(e.exit("chunkString"),c(p)):(e.consume(p),p===92?d:u)}function d(p){return p===o||p===92?(e.consume(p),u):u(p)}}function vl(e,t){let n;return r;function r(i){return oe(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):Se(i)?Ce(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}const MK={name:"definition",tokenize:FK},PK={partial:!0,tokenize:BK};function FK(e,t,n){const r=this;let i;return s;function s(f){return e.enter("definition"),o(f)}function o(f){return U2.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(f)}function a(f){return i=er(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),f===58?(e.enter("definitionMarker"),e.consume(f),e.exit("definitionMarker"),l):n(f)}function l(f){return Oe(f)?vl(e,c)(f):c(f)}function c(f){return j2(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(f)}function u(f){return e.attempt(PK,d,d)(f)}function d(f){return Se(f)?Ce(e,p,"whitespace")(f):p(f)}function p(f){return f===null||oe(f)?(e.exit("definition"),r.parser.defined.push(i),t(f)):n(f)}}function BK(e,t,n){return r;function r(a){return Oe(a)?vl(e,i)(a):n(a)}function i(a){return $2(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Se(a)?Ce(e,o,"whitespace")(a):o(a)}function o(a){return a===null||oe(a)?t(a):n(a)}}const jK={name:"hardBreakEscape",tokenize:UK};function UK(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),i}function i(s){return oe(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}const $K={name:"headingAtx",resolve:zK,tokenize:HK};function zK(e,t){let n=e.length-2,r=3,i,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},_n(e,r,n-r+1,[["enter",i,t],["enter",s,t],["exit",s,t],["exit",i,t]])),e}function HK(e,t,n){let r=0;return i;function i(u){return e.enter("atxHeading"),s(u)}function s(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||Oe(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||oe(u)?(e.exit("atxHeading"),t(u)):Se(u)?Ce(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||Oe(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const VK=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],KT=["pre","script","style","textarea"],GK={concrete:!0,name:"htmlFlow",resolveTo:KK,tokenize:YK},WK={partial:!0,tokenize:ZK},qK={partial:!0,tokenize:XK};function KK(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function YK(e,t,n){const r=this;let i,s,o,a,l;return c;function c(M){return u(M)}function u(M){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(M),d}function d(M){return M===33?(e.consume(M),p):M===47?(e.consume(M),s=!0,m):M===63?(e.consume(M),i=3,r.interrupt?t:C):Wt(M)?(e.consume(M),o=String.fromCharCode(M),_):n(M)}function p(M){return M===45?(e.consume(M),i=2,f):M===91?(e.consume(M),i=5,a=0,g):Wt(M)?(e.consume(M),i=4,r.interrupt?t:C):n(M)}function f(M){return M===45?(e.consume(M),r.interrupt?t:C):n(M)}function g(M){const se="CDATA[";return M===se.charCodeAt(a++)?(e.consume(M),a===se.length?r.interrupt?t:I:g):n(M)}function m(M){return Wt(M)?(e.consume(M),o=String.fromCharCode(M),_):n(M)}function _(M){if(M===null||M===47||M===62||Oe(M)){const se=M===47,be=o.toLowerCase();return!se&&!s&&KT.includes(be)?(i=1,r.interrupt?t(M):I(M)):VK.includes(o.toLowerCase())?(i=6,se?(e.consume(M),b):r.interrupt?t(M):I(M)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(M):s?v(M):S(M))}return M===45||Ft(M)?(e.consume(M),o+=String.fromCharCode(M),_):n(M)}function b(M){return M===62?(e.consume(M),r.interrupt?t:I):n(M)}function v(M){return Se(M)?(e.consume(M),v):A(M)}function S(M){return M===47?(e.consume(M),A):M===58||M===95||Wt(M)?(e.consume(M),w):Se(M)?(e.consume(M),S):A(M)}function w(M){return M===45||M===46||M===58||M===95||Ft(M)?(e.consume(M),w):k(M)}function k(M){return M===61?(e.consume(M),x):Se(M)?(e.consume(M),k):S(M)}function x(M){return M===null||M===60||M===61||M===62||M===96?n(M):M===34||M===39?(e.consume(M),l=M,E):Se(M)?(e.consume(M),x):T(M)}function E(M){return M===l?(e.consume(M),l=null,D):M===null||oe(M)?n(M):(e.consume(M),E)}function T(M){return M===null||M===34||M===39||M===47||M===60||M===61||M===62||M===96||Oe(M)?k(M):(e.consume(M),T)}function D(M){return M===47||M===62||Se(M)?S(M):n(M)}function A(M){return M===62?(e.consume(M),R):n(M)}function R(M){return M===null||oe(M)?I(M):Se(M)?(e.consume(M),R):n(M)}function I(M){return M===45&&i===2?(e.consume(M),B):M===60&&i===1?(e.consume(M),U):M===62&&i===4?(e.consume(M),z):M===63&&i===3?(e.consume(M),C):M===93&&i===5?(e.consume(M),j):oe(M)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(WK,Z,L)(M)):M===null||oe(M)?(e.exit("htmlFlowData"),L(M)):(e.consume(M),I)}function L(M){return e.check(qK,P,Z)(M)}function P(M){return e.enter("lineEnding"),e.consume(M),e.exit("lineEnding"),F}function F(M){return M===null||oe(M)?L(M):(e.enter("htmlFlowData"),I(M))}function B(M){return M===45?(e.consume(M),C):I(M)}function U(M){return M===47?(e.consume(M),o="",O):I(M)}function O(M){if(M===62){const se=o.toLowerCase();return KT.includes(se)?(e.consume(M),z):I(M)}return Wt(M)&&o.length<8?(e.consume(M),o+=String.fromCharCode(M),O):I(M)}function j(M){return M===93?(e.consume(M),C):I(M)}function C(M){return M===62?(e.consume(M),z):M===45&&i===2?(e.consume(M),C):I(M)}function z(M){return M===null||oe(M)?(e.exit("htmlFlowData"),Z(M)):(e.consume(M),z)}function Z(M){return e.exit("htmlFlow"),t(M)}}function XK(e,t,n){const r=this;return i;function i(o){return oe(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function ZK(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(wc,t,n)}}const QK={name:"htmlText",tokenize:JK};function JK(e,t,n){const r=this;let i,s,o;return a;function a(C){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(C),l}function l(C){return C===33?(e.consume(C),c):C===47?(e.consume(C),k):C===63?(e.consume(C),S):Wt(C)?(e.consume(C),T):n(C)}function c(C){return C===45?(e.consume(C),u):C===91?(e.consume(C),s=0,g):Wt(C)?(e.consume(C),v):n(C)}function u(C){return C===45?(e.consume(C),f):n(C)}function d(C){return C===null?n(C):C===45?(e.consume(C),p):oe(C)?(o=d,U(C)):(e.consume(C),d)}function p(C){return C===45?(e.consume(C),f):d(C)}function f(C){return C===62?B(C):C===45?p(C):d(C)}function g(C){const z="CDATA[";return C===z.charCodeAt(s++)?(e.consume(C),s===z.length?m:g):n(C)}function m(C){return C===null?n(C):C===93?(e.consume(C),_):oe(C)?(o=m,U(C)):(e.consume(C),m)}function _(C){return C===93?(e.consume(C),b):m(C)}function b(C){return C===62?B(C):C===93?(e.consume(C),b):m(C)}function v(C){return C===null||C===62?B(C):oe(C)?(o=v,U(C)):(e.consume(C),v)}function S(C){return C===null?n(C):C===63?(e.consume(C),w):oe(C)?(o=S,U(C)):(e.consume(C),S)}function w(C){return C===62?B(C):S(C)}function k(C){return Wt(C)?(e.consume(C),x):n(C)}function x(C){return C===45||Ft(C)?(e.consume(C),x):E(C)}function E(C){return oe(C)?(o=E,U(C)):Se(C)?(e.consume(C),E):B(C)}function T(C){return C===45||Ft(C)?(e.consume(C),T):C===47||C===62||Oe(C)?D(C):n(C)}function D(C){return C===47?(e.consume(C),B):C===58||C===95||Wt(C)?(e.consume(C),A):oe(C)?(o=D,U(C)):Se(C)?(e.consume(C),D):B(C)}function A(C){return C===45||C===46||C===58||C===95||Ft(C)?(e.consume(C),A):R(C)}function R(C){return C===61?(e.consume(C),I):oe(C)?(o=R,U(C)):Se(C)?(e.consume(C),R):D(C)}function I(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(e.consume(C),i=C,L):oe(C)?(o=I,U(C)):Se(C)?(e.consume(C),I):(e.consume(C),P)}function L(C){return C===i?(e.consume(C),i=void 0,F):C===null?n(C):oe(C)?(o=L,U(C)):(e.consume(C),L)}function P(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Oe(C)?D(C):(e.consume(C),P)}function F(C){return C===47||C===62||Oe(C)?D(C):n(C)}function B(C){return C===62?(e.consume(C),e.exit("htmlTextData"),e.exit("htmlText"),t):n(C)}function U(C){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(C),e.exit("lineEnding"),O}function O(C){return Se(C)?Ce(e,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):j(C)}function j(C){return e.enter("htmlTextData"),o(C)}}const Kv={name:"labelEnd",resolveAll:rY,resolveTo:iY,tokenize:sY},eY={tokenize:oY},tY={tokenize:aY},nY={tokenize:lY};function rY(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",t+=i}}return e.length!==n.length&&_n(e,0,e.length,n),e}function iY(e,t){let n=e.length,r=0,i,s,o,a;for(;n--;)if(i=e[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;e[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[s][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=On(a,e.slice(s+1,s+r+3)),a=On(a,[["enter",u,t]]),a=On(a,Zh(t.parser.constructs.insideSpan.null,e.slice(s+r+4,o-3),t)),a=On(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=On(a,e.slice(o+1)),a=On(a,[["exit",l,t]]),_n(e,s,e.length,a),e}function sY(e,t,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(p){return s?s._inactive?d(p):(o=r.parser.defined.includes(er(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),l):n(p)}function l(p){return p===40?e.attempt(eY,u,o?u:d)(p):p===91?e.attempt(tY,u,o?c:d)(p):o?u(p):d(p)}function c(p){return e.attempt(nY,u,d)(p)}function u(p){return t(p)}function d(p){return s._balanced=!0,n(p)}}function oY(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),i}function i(d){return Oe(d)?vl(e,s)(d):s(d)}function s(d){return d===41?u(d):j2(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Oe(d)?vl(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?$2(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return Oe(d)?vl(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function aY(e,t,n){const r=this;return i;function i(a){return U2.call(r,e,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(er(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function lY(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),i}function i(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}const cY={name:"labelStartImage",resolveAll:Kv.resolveAll,tokenize:uY};function uY(e,t,n){const r=this;return i;function i(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const dY={name:"labelStartLink",resolveAll:Kv.resolveAll,tokenize:hY};function hY(e,t,n){const r=this;return i;function i(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const Ff={name:"lineEnding",tokenize:pY};function pY(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ce(e,t,"linePrefix")}}const Yu={name:"thematicBreak",tokenize:fY};function fY(e,t,n){let r=0,i;return s;function s(c){return e.enter("thematicBreak"),o(c)}function o(c){return i=c,a(c)}function a(c){return c===i?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||oe(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===i?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Se(c)?Ce(e,a,"whitespace")(c):a(c))}}const nn={continuation:{tokenize:yY},exit:_Y,name:"list",tokenize:bY},gY={partial:!0,tokenize:SY},mY={partial:!0,tokenize:vY};function bY(e,t,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(f){const g=r.containerState.type||(f===42||f===43||f===45?"listUnordered":"listOrdered");if(g==="listUnordered"?!r.containerState.marker||f===r.containerState.marker:wb(f)){if(r.containerState.type||(r.containerState.type=g,e.enter(g,{_container:!0})),g==="listUnordered")return e.enter("listItemPrefix"),f===42||f===45?e.check(Yu,n,c)(f):c(f);if(!r.interrupt||f===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(f)}return n(f)}function l(f){return wb(f)&&++o<10?(e.consume(f),l):(!r.interrupt||o<2)&&(r.containerState.marker?f===r.containerState.marker:f===41||f===46)?(e.exit("listItemValue"),c(f)):n(f)}function c(f){return e.enter("listItemMarker"),e.consume(f),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||f,e.check(wc,r.interrupt?n:u,e.attempt(gY,p,d))}function u(f){return r.containerState.initialBlankLine=!0,s++,p(f)}function d(f){return Se(f)?(e.enter("listItemPrefixWhitespace"),e.consume(f),e.exit("listItemPrefixWhitespace"),p):n(f)}function p(f){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(f)}}function yY(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(wc,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ce(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Se(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(mY,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ce(e,e.attempt(nn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function vY(e,t,n){const r=this;return Ce(e,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(s):n(s)}}function _Y(e){e.exit(this.containerState.type)}function SY(e,t,n){const r=this;return Ce(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Se(s)&&o&&o[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}const YT={name:"setextUnderline",resolveTo:wY,tokenize:xY};function wY(e,t){let n=e.length,r,i,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",s?(e.splice(i,0,["enter",o,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function xY(e,t,n){const r=this;let i;return s;function s(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),i=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===i?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Se(c)?Ce(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||oe(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const EY={tokenize:kY};function kY(e){const t=this,n=e.attempt(wc,r,e.attempt(this.parser.constructs.flowInitial,i,Ce(e,e.attempt(this.parser.constructs.flow,i,e.attempt(NK,i)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const CY={resolveAll:H2()},TY=z2("string"),AY=z2("text");function z2(e){return{resolveAll:H2(e==="text"?RY:void 0),tokenize:t};function t(n){const r=this,i=this.parser.constructs[e],s=n.attempt(i,o,a);return o;function o(u){return c(u)?s(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),s(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=i[u];let p=-1;if(d)for(;++p<d.length;){const f=d[p];if(!f.previous||f.previous.call(r,r.previous))return!0}return!1}}}function H2(e){return t;function t(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return e?e(n,r):n}}function RY(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],i=t.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const c=i[s];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const NY={42:nn,43:nn,45:nn,48:nn,49:nn,50:nn,51:nn,52:nn,53:nn,54:nn,55:nn,56:nn,57:nn,62:M2},IY={91:MK},OY={[-2]:Pf,[-1]:Pf,32:Pf},LY={35:$K,42:Yu,45:[YT,Yu],60:GK,61:YT,95:Yu,96:qT,126:qT},DY={38:F2,92:P2},MY={[-5]:Ff,[-4]:Ff,[-3]:Ff,33:cY,38:F2,42:xb,60:[dK,QK],91:dY,92:[jK,P2],93:Kv,95:xb,96:EK},PY={null:[xb,CY]},FY={null:[42,95]},BY={null:[]},jY=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:FY,contentInitial:IY,disable:BY,document:NY,flow:LY,flowInitial:OY,insideSpan:PY,string:DY,text:MY},Symbol.toStringTag,{value:"Module"}));function UY(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:E(k),check:E(x),consume:v,enter:S,exit:w,interrupt:E(x,{interrupt:!0})},c={code:null,containerState:{},defineSkip:m,events:[],now:g,parser:e,previous:null,sliceSerialize:p,sliceStream:f,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&s.push(t),c;function d(R){return o=On(o,R),_(),o[o.length-1]!==null?[]:(T(t,0),c.events=Zh(s,c.events,c),c.events)}function p(R,I){return zY(f(R),I)}function f(R){return $Y(o,R)}function g(){const{_bufferIndex:R,_index:I,line:L,column:P,offset:F}=r;return{_bufferIndex:R,_index:I,line:L,column:P,offset:F}}function m(R){i[R.line]=R.column,A()}function _(){let R;for(;r._index<o.length;){const I=o[r._index];if(typeof I=="string")for(R=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===R&&r._bufferIndex<I.length;)b(I.charCodeAt(r._bufferIndex));else b(I)}}function b(R){u=u(R)}function v(R){oe(R)?(r.line++,r.column=1,r.offset+=R===-3?2:1,A()):R!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=R}function S(R,I){const L=I||{};return L.type=R,L.start=g(),c.events.push(["enter",L,c]),a.push(L),L}function w(R){const I=a.pop();return I.end=g(),c.events.push(["exit",I,c]),I}function k(R,I){T(R,I.from)}function x(R,I){I.restore()}function E(R,I){return L;function L(P,F,B){let U,O,j,C;return Array.isArray(P)?Z(P):"tokenize"in P?Z([P]):z(P);function z($){return G;function G(ie){const ae=ie!==null&&$[ie],ce=ie!==null&&$.null,ue=[...Array.isArray(ae)?ae:ae?[ae]:[],...Array.isArray(ce)?ce:ce?[ce]:[]];return Z(ue)(ie)}}function Z($){return U=$,O=0,$.length===0?B:M($[O])}function M($){return G;function G(ie){return C=D(),j=$,$.partial||(c.currentConstruct=$),$.name&&c.parser.constructs.disable.null.includes($.name)?be():$.tokenize.call(I?Object.assign(Object.create(c),I):c,l,se,be)(ie)}}function se($){return R(j,C),F}function be($){return C.restore(),++O<U.length?M(U[O]):B}}}function T(R,I){R.resolveAll&&!s.includes(R)&&s.push(R),R.resolve&&_n(c.events,I,c.events.length-I,R.resolve(c.events.slice(I),c)),R.resolveTo&&(c.events=R.resolveTo(c.events,c))}function D(){const R=g(),I=c.previous,L=c.currentConstruct,P=c.events.length,F=Array.from(a);return{from:P,restore:B};function B(){r=R,c.previous=I,c.currentConstruct=L,c.events.length=P,a=F,A()}}function A(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function $Y(e,t){const n=t.start._index,r=t.start._bufferIndex,i=t.end._index,s=t.end._bufferIndex;let o;if(n===i)o=[e[n].slice(r,s)];else{if(o=e.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(e[i].slice(0,s))}return o}function zY(e,t){let n=-1;const r=[];let i;for(;++n<e.length;){const s=e[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
|
|
489
489
|
`;break}case-3:{o=`\r
|
|
490
|
-
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function HY(e){const r={constructs:L2([jY,...(e||{}).extensions||[]]),content:i(iK),defined:[],document:i(oK),flow:i(EY),lazy:{},string:i(TY),text:i(AY)};return r;function i(s){return o;function o(a){return UY(r,s,a)}}}function VY(e){for(;!B2(e););return e}const XT=/[\0\t\n\r]/g;function GY(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(XT.lastIndex=d,c=XT.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){t=s.slice(d);break}if(f===10&&d===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<p&&(l.push(s.slice(d,p)),e+=p-d),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const WY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qY(e){return e.replace(WY,KY)}function KY(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return D2(n.slice(s?2:1),s?16:10)}return Ql(n)||e}const V2={}.hasOwnProperty;function YY(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XY(n)(VY(HY(n).document().write(GY()(e,t,!0))))}function XY(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ir),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(sr),blockQuote:s(ce),characterEscape:D,characterReference:D,codeFenced:s(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ue,o),codeText:s(pe,o),codeTextData:D,data:D,codeFlowValue:D,definition:s(le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(nt),hardBreakEscape:s(or),hardBreakTrailing:s(or),htmlFlow:s(kn,o),htmlFlowData:D,htmlText:s(kn,o),htmlTextData:D,image:s(Zs),label:o,link:s(Ir),listItem:s(KF),listItemValue:p,listOrdered:s(x0,d),listUnordered:s(x0),paragraph:s(YF),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(sr),strong:s(XF),thematicBreak:s(QF)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:ae,autolinkProtocol:ie,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:$,characterReference:G,codeFenced:l(_),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:l(b),codeText:l(F),codeTextData:A,data:A,definition:l(),definitionDestinationString:w,definitionLabelString:v,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(L),htmlFlowData:A,htmlText:l(P),htmlTextData:A,image:l(U),label:j,labelText:O,lineEnding:R,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:C,resourceTitleString:z,resource:Z,setextHeading:l(T),setextHeadingLineSequence:E,setextHeadingText:x,strong:l(),thematicBreak:l()}};G2(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let Y={type:"root",children:[]};const fe={stack:[Y],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},ke=[];let Ne=-1;for(;++Ne<H.length;)if(H[Ne][1].type==="listOrdered"||H[Ne][1].type==="listUnordered")if(H[Ne][0]==="enter")ke.push(Ne);else{const $n=ke.pop();Ne=i(H,$n,Ne)}for(Ne=-1;++Ne<H.length;){const $n=t[H[Ne][0]];V2.call($n,H[Ne][1].type)&&$n[H[Ne][1].type].call(Object.assign({sliceSerialize:H[Ne][2].sliceSerialize},fe),H[Ne][1])}if(fe.tokenStack.length>0){const $n=fe.tokenStack[fe.tokenStack.length-1];($n[1]||ZT).call(fe,void 0,$n[0])}for(Y.position={start:li(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:li(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)Y=t.transforms[Ne](Y)||Y;return Y}function i(H,Y,fe){let ke=Y-1,Ne=-1,$n=!1,Zi,Or,Ea,ka;for(;++ke<=fe;){const dn=H[ke];switch(dn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dn[0]==="enter"?Ne++:Ne--,ka=void 0;break}case"lineEndingBlank":{dn[0]==="enter"&&(Zi&&!ka&&!Ne&&!Ea&&(Ea=ke),ka=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ka=void 0}if(!Ne&&dn[0]==="enter"&&dn[1].type==="listItemPrefix"||Ne===-1&&dn[0]==="exit"&&(dn[1].type==="listUnordered"||dn[1].type==="listOrdered")){if(Zi){let Qs=ke;for(Or=void 0;Qs--;){const Lr=H[Qs];if(Lr[1].type==="lineEnding"||Lr[1].type==="lineEndingBlank"){if(Lr[0]==="exit")continue;Or&&(H[Or][1].type="lineEndingBlank",$n=!0),Lr[1].type="lineEnding",Or=Qs}else if(!(Lr[1].type==="linePrefix"||Lr[1].type==="blockQuotePrefix"||Lr[1].type==="blockQuotePrefixWhitespace"||Lr[1].type==="blockQuoteMarker"||Lr[1].type==="listItemIndent"))break}Ea&&(!Or||Ea<Or)&&(Zi._spread=!0),Zi.end=Object.assign({},Or?H[Or][1].start:dn[1].end),H.splice(Or||ke,0,["exit",Zi,dn[2]]),ke++,fe++}if(dn[1].type==="listItemPrefix"){const Qs={type:"listItem",_spread:!1,start:Object.assign({},dn[1].start),end:void 0};Zi=Qs,H.splice(ke,0,["enter",Qs,dn[2]]),ke++,fe++,Ea=void 0,ka=!0}}}return H[Y][1]._spread=$n,fe}function s(H,Y){return fe;function fe(ke){a.call(this,H(ke),ke),Y&&Y.call(this,ke)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,Y,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([Y,fe||void 0]),H.position={start:li(Y.start),end:void 0}}function l(H){return Y;function Y(fe){H&&H.call(this,fe),c.call(this,fe)}}function c(H,Y){const fe=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==H.type&&(Y?Y.call(this,H,ke[0]):(ke[1]||ZT).call(this,H,ke[0]));else throw new Error("Cannot close `"+H.type+"` ("+yl({start:H.start,end:H.end})+"): it’s not open");fe.position.end=li(H.end)}function u(){return qv(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function f(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=H}function g(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=H}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/(\r?\n|\r)$/g,"")}function v(H){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=er(this.sliceSerialize(H)).toLowerCase()}function S(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function w(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function k(H){const Y=this.stack[this.stack.length-1];if(!Y.depth){const fe=this.sliceSerialize(H).length;Y.depth=fe}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function E(H){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function D(H){const fe=this.stack[this.stack.length-1].children;let ke=fe[fe.length-1];(!ke||ke.type!=="text")&&(ke=ZF(),ke.position={start:li(H.start),end:void 0},fe.push(ke)),this.stack.push(ke)}function A(H){const Y=this.stack.pop();Y.value+=this.sliceSerialize(H),Y.position.end=li(H.end)}function R(H){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=Y.children[Y.children.length-1];fe.position.end=li(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(D.call(this,H),A.call(this,H))}function I(){this.data.atHardBreak=!0}function L(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function P(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function F(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function B(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function U(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function O(H){const Y=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=qY(Y),fe.identifier=er(Y).toLowerCase()}function j(){const H=this.stack[this.stack.length-1],Y=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ke=H.children;fe.children=ke}else fe.alt=Y}function C(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function z(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function se(H){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=er(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function be(H){this.data.characterReferenceType=H.type}function $(H){const Y=this.sliceSerialize(H),fe=this.data.characterReferenceType;let ke;fe?(ke=D2(Y,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Ql(Y);const Ne=this.stack[this.stack.length-1];Ne.value+=ke}function G(H){const Y=this.stack.pop();Y.position.end=li(H.end)}function ie(H){A.call(this,H);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(H)}function ae(H){A.call(this,H);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(H)}function ce(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function nt(){return{type:"emphasis",children:[]}}function sr(){return{type:"heading",depth:0,children:[]}}function or(){return{type:"break"}}function kn(){return{type:"html",value:""}}function Zs(){return{type:"image",title:null,url:"",alt:null}}function Ir(){return{type:"link",title:null,url:"",children:[]}}function x0(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function KF(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function YF(){return{type:"paragraph",children:[]}}function XF(){return{type:"strong",children:[]}}function ZF(){return{type:"text",value:""}}function QF(){return{type:"thematicBreak"}}}function li(e){return{line:e.line,column:e.column,offset:e.offset}}function G2(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?G2(e,r):ZY(e,r)}}function ZY(e,t){let n;for(n in t)if(V2.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ZT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yl({start:t.start,end:t.end})+") is still open")}function QY(e){const t=this;t.parser=n;function n(r){return YY(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JY(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function eX(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
490
|
+
`;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function HY(e){const r={constructs:L2([jY,...(e||{}).extensions||[]]),content:i(iK),defined:[],document:i(oK),flow:i(EY),lazy:{},string:i(TY),text:i(AY)};return r;function i(s){return o;function o(a){return UY(r,s,a)}}}function VY(e){for(;!B2(e););return e}const XT=/[\0\t\n\r]/g;function GY(){let e=1,t="",n=!0,r;return i;function i(s,o,a){const l=[];let c,u,d,p,f;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,t="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(XT.lastIndex=d,c=XT.exec(s),p=c&&c.index!==void 0?c.index:s.length,f=s.charCodeAt(p),!c){t=s.slice(d);break}if(f===10&&d===p&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<p&&(l.push(s.slice(d,p)),e+=p-d),f){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=p+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const WY=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qY(e){return e.replace(WY,KY)}function KY(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return D2(n.slice(s?2:1),s?16:10)}return Ql(n)||e}const V2={}.hasOwnProperty;function YY(e,t,n){return t&&typeof t=="object"&&(n=t,t=void 0),XY(n)(VY(HY(n).document().write(GY()(e,t,!0))))}function XY(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Ir),autolinkProtocol:D,autolinkEmail:D,atxHeading:s(sr),blockQuote:s(ce),characterEscape:D,characterReference:D,codeFenced:s(ue),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(ue,o),codeText:s(pe,o),codeTextData:D,data:D,codeFlowValue:D,definition:s(le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(Xe),hardBreakEscape:s(or),hardBreakTrailing:s(or),htmlFlow:s(kn,o),htmlFlowData:D,htmlText:s(kn,o),htmlTextData:D,image:s(Zs),label:o,link:s(Ir),listItem:s(KF),listItemValue:p,listOrdered:s(x0,d),listUnordered:s(x0),paragraph:s(YF),reference:M,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(sr),strong:s(XF),thematicBreak:s(QF)},exit:{atxHeading:l(),atxHeadingSequence:k,autolink:l(),autolinkEmail:ae,autolinkProtocol:ie,blockQuote:l(),characterEscapeValue:A,characterReferenceMarkerHexadecimal:be,characterReferenceMarkerNumeric:be,characterReferenceValue:$,characterReference:G,codeFenced:l(_),codeFencedFence:m,codeFencedFenceInfo:f,codeFencedFenceMeta:g,codeFlowValue:A,codeIndented:l(b),codeText:l(F),codeTextData:A,data:A,definition:l(),definitionDestinationString:w,definitionLabelString:v,definitionTitleString:S,emphasis:l(),hardBreakEscape:l(I),hardBreakTrailing:l(I),htmlFlow:l(L),htmlFlowData:A,htmlText:l(P),htmlTextData:A,image:l(U),label:j,labelText:O,lineEnding:R,link:l(B),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:se,resourceDestinationString:C,resourceTitleString:z,resource:Z,setextHeading:l(T),setextHeadingLineSequence:E,setextHeadingText:x,strong:l(),thematicBreak:l()}};G2(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(H){let Y={type:"root",children:[]};const fe={stack:[Y],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},ke=[];let Ne=-1;for(;++Ne<H.length;)if(H[Ne][1].type==="listOrdered"||H[Ne][1].type==="listUnordered")if(H[Ne][0]==="enter")ke.push(Ne);else{const $n=ke.pop();Ne=i(H,$n,Ne)}for(Ne=-1;++Ne<H.length;){const $n=t[H[Ne][0]];V2.call($n,H[Ne][1].type)&&$n[H[Ne][1].type].call(Object.assign({sliceSerialize:H[Ne][2].sliceSerialize},fe),H[Ne][1])}if(fe.tokenStack.length>0){const $n=fe.tokenStack[fe.tokenStack.length-1];($n[1]||ZT).call(fe,void 0,$n[0])}for(Y.position={start:li(H.length>0?H[0][1].start:{line:1,column:1,offset:0}),end:li(H.length>0?H[H.length-2][1].end:{line:1,column:1,offset:0})},Ne=-1;++Ne<t.transforms.length;)Y=t.transforms[Ne](Y)||Y;return Y}function i(H,Y,fe){let ke=Y-1,Ne=-1,$n=!1,Zi,Or,Ea,ka;for(;++ke<=fe;){const dn=H[ke];switch(dn[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{dn[0]==="enter"?Ne++:Ne--,ka=void 0;break}case"lineEndingBlank":{dn[0]==="enter"&&(Zi&&!ka&&!Ne&&!Ea&&(Ea=ke),ka=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:ka=void 0}if(!Ne&&dn[0]==="enter"&&dn[1].type==="listItemPrefix"||Ne===-1&&dn[0]==="exit"&&(dn[1].type==="listUnordered"||dn[1].type==="listOrdered")){if(Zi){let Qs=ke;for(Or=void 0;Qs--;){const Lr=H[Qs];if(Lr[1].type==="lineEnding"||Lr[1].type==="lineEndingBlank"){if(Lr[0]==="exit")continue;Or&&(H[Or][1].type="lineEndingBlank",$n=!0),Lr[1].type="lineEnding",Or=Qs}else if(!(Lr[1].type==="linePrefix"||Lr[1].type==="blockQuotePrefix"||Lr[1].type==="blockQuotePrefixWhitespace"||Lr[1].type==="blockQuoteMarker"||Lr[1].type==="listItemIndent"))break}Ea&&(!Or||Ea<Or)&&(Zi._spread=!0),Zi.end=Object.assign({},Or?H[Or][1].start:dn[1].end),H.splice(Or||ke,0,["exit",Zi,dn[2]]),ke++,fe++}if(dn[1].type==="listItemPrefix"){const Qs={type:"listItem",_spread:!1,start:Object.assign({},dn[1].start),end:void 0};Zi=Qs,H.splice(ke,0,["enter",Qs,dn[2]]),ke++,fe++,Ea=void 0,ka=!0}}}return H[Y][1]._spread=$n,fe}function s(H,Y){return fe;function fe(ke){a.call(this,H(ke),ke),Y&&Y.call(this,ke)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(H,Y,fe){this.stack[this.stack.length-1].children.push(H),this.stack.push(H),this.tokenStack.push([Y,fe||void 0]),H.position={start:li(Y.start),end:void 0}}function l(H){return Y;function Y(fe){H&&H.call(this,fe),c.call(this,fe)}}function c(H,Y){const fe=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==H.type&&(Y?Y.call(this,H,ke[0]):(ke[1]||ZT).call(this,H,ke[0]));else throw new Error("Cannot close `"+H.type+"` ("+yl({start:H.start,end:H.end})+"): it’s not open");fe.position.end=li(H.end)}function u(){return qv(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function p(H){if(this.data.expectingFirstListItemValue){const Y=this.stack[this.stack.length-2];Y.start=Number.parseInt(this.sliceSerialize(H),10),this.data.expectingFirstListItemValue=void 0}}function f(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.lang=H}function g(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.meta=H}function m(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function _(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function b(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H.replace(/(\r?\n|\r)$/g,"")}function v(H){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=er(this.sliceSerialize(H)).toLowerCase()}function S(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function w(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function k(H){const Y=this.stack[this.stack.length-1];if(!Y.depth){const fe=this.sliceSerialize(H).length;Y.depth=fe}}function x(){this.data.setextHeadingSlurpLineEnding=!0}function E(H){const Y=this.stack[this.stack.length-1];Y.depth=this.sliceSerialize(H).codePointAt(0)===61?1:2}function T(){this.data.setextHeadingSlurpLineEnding=void 0}function D(H){const fe=this.stack[this.stack.length-1].children;let ke=fe[fe.length-1];(!ke||ke.type!=="text")&&(ke=ZF(),ke.position={start:li(H.start),end:void 0},fe.push(ke)),this.stack.push(ke)}function A(H){const Y=this.stack.pop();Y.value+=this.sliceSerialize(H),Y.position.end=li(H.end)}function R(H){const Y=this.stack[this.stack.length-1];if(this.data.atHardBreak){const fe=Y.children[Y.children.length-1];fe.position.end=li(H.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type)&&(D.call(this,H),A.call(this,H))}function I(){this.data.atHardBreak=!0}function L(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function P(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function F(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.value=H}function B(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function U(){const H=this.stack[this.stack.length-1];if(this.data.inReference){const Y=this.data.referenceType||"shortcut";H.type+="Reference",H.referenceType=Y,delete H.url,delete H.title}else delete H.identifier,delete H.label;this.data.referenceType=void 0}function O(H){const Y=this.sliceSerialize(H),fe=this.stack[this.stack.length-2];fe.label=qY(Y),fe.identifier=er(Y).toLowerCase()}function j(){const H=this.stack[this.stack.length-1],Y=this.resume(),fe=this.stack[this.stack.length-1];if(this.data.inReference=!0,fe.type==="link"){const ke=H.children;fe.children=ke}else fe.alt=Y}function C(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.url=H}function z(){const H=this.resume(),Y=this.stack[this.stack.length-1];Y.title=H}function Z(){this.data.inReference=void 0}function M(){this.data.referenceType="collapsed"}function se(H){const Y=this.resume(),fe=this.stack[this.stack.length-1];fe.label=Y,fe.identifier=er(this.sliceSerialize(H)).toLowerCase(),this.data.referenceType="full"}function be(H){this.data.characterReferenceType=H.type}function $(H){const Y=this.sliceSerialize(H),fe=this.data.characterReferenceType;let ke;fe?(ke=D2(Y,fe==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Ql(Y);const Ne=this.stack[this.stack.length-1];Ne.value+=ke}function G(H){const Y=this.stack.pop();Y.position.end=li(H.end)}function ie(H){A.call(this,H);const Y=this.stack[this.stack.length-1];Y.url=this.sliceSerialize(H)}function ae(H){A.call(this,H);const Y=this.stack[this.stack.length-1];Y.url="mailto:"+this.sliceSerialize(H)}function ce(){return{type:"blockquote",children:[]}}function ue(){return{type:"code",lang:null,meta:null,value:""}}function pe(){return{type:"inlineCode",value:""}}function le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Xe(){return{type:"emphasis",children:[]}}function sr(){return{type:"heading",depth:0,children:[]}}function or(){return{type:"break"}}function kn(){return{type:"html",value:""}}function Zs(){return{type:"image",title:null,url:"",alt:null}}function Ir(){return{type:"link",title:null,url:"",children:[]}}function x0(H){return{type:"list",ordered:H.type==="listOrdered",start:null,spread:H._spread,children:[]}}function KF(H){return{type:"listItem",spread:H._spread,checked:null,children:[]}}function YF(){return{type:"paragraph",children:[]}}function XF(){return{type:"strong",children:[]}}function ZF(){return{type:"text",value:""}}function QF(){return{type:"thematicBreak"}}}function li(e){return{line:e.line,column:e.column,offset:e.offset}}function G2(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?G2(e,r):ZY(e,r)}}function ZY(e,t){let n;for(n in t)if(V2.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function ZT(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+yl({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+yl({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+yl({start:t.start,end:t.end})+") is still open")}function QY(e){const t=this;t.parser=n;function n(r){return YY(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function JY(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function eX(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
|
|
491
491
|
`}]}function tX(e,t){const n=t.value?t.value+`
|
|
492
492
|
`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function nX(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function rX(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iX(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=fa(r.toLowerCase()),s=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=s+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function sX(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function oX(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function W2(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const i=e.all(t),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function aX(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return W2(e,t);const i={src:fa(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,s),e.applyData(t,s)}function lX(e,t){const n={src:fa(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function cX(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function uX(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return W2(e,t);const i={href:fa(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,s),e.applyData(t,s)}function dX(e,t){const n={href:fa(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function hX(e,t,n){const r=e.all(t),i=n?pX(n):q2(t),s={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(i||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
|
|
493
493
|
`}),u.type==="element"&&u.tagName==="p"&&!i?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
|
|
@@ -536,7 +536,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
536
536
|
`,l+1)):l===0?s&&(e.result+=" "):e.result+=qt.repeat(`
|
|
537
537
|
`,l):e.result+=qt.repeat(`
|
|
538
538
|
`,s?1+l:l),s=!0,o=!0,l=0,n=e.position;!Er(d)&&d!==0;)d=e.input.charCodeAt(++e.position);Oi(e,n,e.position,!1)}return!0}function UA(e,t){var n,r=e.tag,i=e.anchor,s=[],o,a=!1,l;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=s),l=e.input.charCodeAt(e.position);l!==0&&(e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,re(e,"tab characters must not be used in indentation")),!(l!==45||(o=e.input.charCodeAt(e.position+1),!on(o))));){if(a=!0,e.position++,lt(e,!0,-1)&&e.lineIndent<=t){s.push(null),l=e.input.charCodeAt(e.position);continue}if(n=e.line,Qo(e,t,zM,!1,!0),s.push(e.result),lt(e,!0,-1),l=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&l!==0)re(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break}return a?(e.tag=r,e.anchor=i,e.kind="sequence",e.result=s,!0):!1}function one(e,t,n){var r,i,s,o,a,l,c=e.tag,u=e.anchor,d={},p=Object.create(null),f=null,g=null,m=null,_=!1,b=!1,v;if(e.firstTabInLine!==-1)return!1;for(e.anchor!==null&&(e.anchorMap[e.anchor]=d),v=e.input.charCodeAt(e.position);v!==0;){if(!_&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,re(e,"tab characters must not be used in indentation")),r=e.input.charCodeAt(e.position+1),s=e.line,(v===63||v===58)&&on(r))v===63?(_&&(Ro(e,d,p,f,g,null,o,a,l),f=g=m=null),b=!0,_=!0,i=!0):_?(_=!1,i=!0):re(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,v=r;else{if(o=e.line,a=e.lineStart,l=e.position,!Qo(e,n,$M,!1,!0))break;if(e.line===s){for(v=e.input.charCodeAt(e.position);ws(v);)v=e.input.charCodeAt(++e.position);if(v===58)v=e.input.charCodeAt(++e.position),on(v)||re(e,"a whitespace character is expected after the key-value separator within a block mapping"),_&&(Ro(e,d,p,f,g,null,o,a,l),f=g=m=null),b=!0,_=!1,i=!1,f=e.tag,g=e.result;else if(b)re(e,"can not read an implicit mapping pair; a colon is missed");else return e.tag=c,e.anchor=u,!0}else if(b)re(e,"can not read a block mapping entry; a multiline key may not be an implicit key");else return e.tag=c,e.anchor=u,!0}if((e.line===s||e.lineIndent>t)&&(_&&(o=e.line,a=e.lineStart,l=e.position),Qo(e,t,Qd,!0,i)&&(_?g=e.result:m=e.result),_||(Ro(e,d,p,f,g,m,o,a,l),f=g=m=null),lt(e,!0,-1),v=e.input.charCodeAt(e.position)),(e.line===s||e.lineIndent>t)&&v!==0)re(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return _&&Ro(e,d,p,f,g,null,o,a,l),b&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=d),b}function ane(e){var t,n=!1,r=!1,i,s,o;if(o=e.input.charCodeAt(e.position),o!==33)return!1;if(e.tag!==null&&re(e,"duplication of a tag property"),o=e.input.charCodeAt(++e.position),o===60?(n=!0,o=e.input.charCodeAt(++e.position)):o===33?(r=!0,i="!!",o=e.input.charCodeAt(++e.position)):i="!",t=e.position,n){do o=e.input.charCodeAt(++e.position);while(o!==0&&o!==62);e.position<e.length?(s=e.input.slice(t,e.position),o=e.input.charCodeAt(++e.position)):re(e,"unexpected end of the stream within a verbatim tag")}else{for(;o!==0&&!on(o);)o===33&&(r?re(e,"tag suffix cannot contain exclamation marks"):(i=e.input.slice(t-1,e.position+1),HM.test(i)||re(e,"named tag handle cannot contain such characters"),r=!0,t=e.position+1)),o=e.input.charCodeAt(++e.position);s=e.input.slice(t,e.position),Yte.test(s)&&re(e,"tag suffix cannot contain flow indicator characters")}s&&!VM.test(s)&&re(e,"tag name cannot contain such characters: "+s);try{s=decodeURIComponent(s)}catch{re(e,"tag name is malformed: "+s)}return n?e.tag=s:Bi.call(e.tagMap,i)?e.tag=e.tagMap[i]+s:i==="!"?e.tag="!"+s:i==="!!"?e.tag="tag:yaml.org,2002:"+s:re(e,'undeclared tag handle "'+i+'"'),!0}function lne(e){var t,n;if(n=e.input.charCodeAt(e.position),n!==38)return!1;for(e.anchor!==null&&re(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;n!==0&&!on(n)&&!Ao(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&re(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function cne(e){var t,n,r;if(r=e.input.charCodeAt(e.position),r!==42)return!1;for(r=e.input.charCodeAt(++e.position),t=e.position;r!==0&&!on(r)&&!Ao(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&re(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Bi.call(e.anchorMap,n)||re(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],lt(e,!0,-1),!0}function Qo(e,t,n,r,i){var s,o,a,l=1,c=!1,u=!1,d,p,f,g,m,_;if(e.listener!==null&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,s=o=a=Qd===n||zM===n,r&<(e,!0,-1)&&(c=!0,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)),l===1)for(;ane(e)||lne(e);)lt(e,!0,-1)?(c=!0,a=s,e.lineIndent>t?l=1:e.lineIndent===t?l=0:e.lineIndent<t&&(l=-1)):a=!1;if(a&&(a=c||i),(l===1||Qd===n)&&(Zd===n||$M===n?m=t:m=t+1,_=e.position-e.lineStart,l===1?a&&(UA(e,_)||one(e,_,m))||ine(e,m)?u=!0:(o&&sne(e,m)||nne(e,m)||rne(e,m)?u=!0:cne(e)?(u=!0,(e.tag!==null||e.anchor!==null)&&re(e,"alias node should not have any properties")):tne(e,m,Zd===n)&&(u=!0,e.tag===null&&(e.tag="?")),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):l===0&&(u=a&&UA(e,_))),e.tag===null)e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);else if(e.tag==="?"){for(e.result!==null&&e.kind!=="scalar"&&re(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),d=0,p=e.implicitTypes.length;d<p;d+=1)if(g=e.implicitTypes[d],g.resolve(e.result)){e.result=g.construct(e.result),e.tag=g.tag,e.anchor!==null&&(e.anchorMap[e.anchor]=e.result);break}}else if(e.tag!=="!"){if(Bi.call(e.typeMap[e.kind||"fallback"],e.tag))g=e.typeMap[e.kind||"fallback"][e.tag];else for(g=null,f=e.typeMap.multi[e.kind||"fallback"],d=0,p=f.length;d<p;d+=1)if(e.tag.slice(0,f[d].tag.length)===f[d].tag){g=f[d];break}g||re(e,"unknown tag !<"+e.tag+">"),e.result!==null&&g.kind!==e.kind&&re(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+g.kind+'", not "'+e.kind+'"'),g.resolve(e.result,e.tag)?(e.result=g.construct(e.result,e.tag),e.anchor!==null&&(e.anchorMap[e.anchor]=e.result)):re(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return e.listener!==null&&e.listener("close",e),e.tag!==null||e.anchor!==null||u}function une(e){var t=e.position,n,r,i,s=!1,o;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);(o=e.input.charCodeAt(e.position))!==0&&(lt(e,!0,-1),o=e.input.charCodeAt(e.position),!(e.lineIndent>0||o!==37));){for(s=!0,o=e.input.charCodeAt(++e.position),n=e.position;o!==0&&!on(o);)o=e.input.charCodeAt(++e.position);for(r=e.input.slice(n,e.position),i=[],r.length<1&&re(e,"directive name must not be less than one character in length");o!==0;){for(;ws(o);)o=e.input.charCodeAt(++e.position);if(o===35){do o=e.input.charCodeAt(++e.position);while(o!==0&&!Er(o));break}if(Er(o))break;for(n=e.position;o!==0&&!on(o);)o=e.input.charCodeAt(++e.position);i.push(e.input.slice(n,e.position))}o!==0&&o0(e),Bi.call(BA,r)?BA[r](e,r,i):Jd(e,'unknown document directive "'+r+'"')}if(lt(e,!0,-1),e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45?(e.position+=3,lt(e,!0,-1)):s&&re(e,"directives end mark is expected"),Qo(e,e.lineIndent-1,Qd,!1,!0),lt(e,!0,-1),e.checkLineBreaks&&Kte.test(e.input.slice(t,e.position))&&Jd(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&up(e)){e.input.charCodeAt(e.position)===46&&(e.position+=3,lt(e,!0,-1));return}if(e.position<e.length-1)re(e,"end of the stream or a document separator is expected");else return}function dne(e,t){e=String(e),t=t||{},e.length!==0&&(e.charCodeAt(e.length-1)!==10&&e.charCodeAt(e.length-1)!==13&&(e+=`
|
|
539
|
-
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new ene(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,re(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)une(n);return n.documents}function hne(e,t){var n=dne(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Br("expected a single document in the stream, but found more")}}var pne=hne,fne={load:pne},gne=fne.load;function $A(e){var _;const t=e.pages||[],n=e.relations||[];if(t.length===0)return{nodes:[],edges:[]};const r=new Map,i=new Map;for(const b of t)r.set(b.id,[]),i.set(b.id,0);for(const b of n)(_=r.get(b.from))==null||_.push(b.to),i.set(b.to,(i.get(b.to)||0)+1);const s=new Map,o=[];for(const b of t)(i.get(b.id)||0)===0&&(o.push(b.id),s.set(b.id,0));let a=0;for(;o.length>0;){const b=o.shift(),v=s.get(b)||0;for(const S of r.get(b)||[]){const w=v+1;w>(s.get(S)||0)&&(s.set(S,w),w>a&&(a=w));const k=(i.get(S)||1)-1;i.set(S,k),k<=0&&o.push(S)}}for(const b of t)s.has(b.id)||s.set(b.id,a+1);const l=new Map;for(const b of t){const v=s.get(b.id)||0;l.has(v)||l.set(v,[]),l.get(v).push(b.id)}const c=160,u=50,d=60,p=80,f=[],g=new Map(t.map(b=>[b.id,b]));for(const[b,v]of l){const w=-(v.length*c+(v.length-1)*d)/2;v.forEach((k,x)=>{const E=g.get(k);f.push({id:k,title:(E==null?void 0:E.title)||k,x:w+x*(c+d)+c/2,y:b*(u+p),layer:b})})}const m=n.map(b=>({from:b.from,to:b.to,label:b.label}));return{nodes:f,edges:m}}const zA=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function mne({folderPath:e}){const[t,n]=y.useState(null),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(1),[c,u]=y.useState({x:0,y:0}),[d,p]=y.useState(!1),[f,g]=y.useState({x:0,y:0}),m=y.useRef(null),_=y.useRef(null),b=`${e}/.notebook/graph.yaml`,v=y.useCallback(async()=>{i(!0),o(null);try{const R=await FL(b);if(!R.content){o("graph.yaml is empty"),n(null);return}const I=gne(R.content);n(I),l(1),u({x:0,y:0})}catch{o("Cannot read .notebook/graph.yaml"),n(null)}finally{i(!1)}},[b]);y.useEffect(()=>{v()},[v]);const S=y.useCallback(R=>{R.preventDefault();const I=R.deltaY>0?-.1:.1;l(L=>Math.max(.2,Math.min(3,L+I)))},[]),w=y.useCallback(R=>{R.button===0&&(p(!0),g({x:R.clientX-c.x,y:R.clientY-c.y}))},[c]),k=y.useCallback(R=>{d&&u({x:R.clientX-f.x,y:R.clientY-f.y})},[d,f]),x=y.useCallback(()=>{p(!1)},[]),E=y.useCallback(()=>{if(!t||!_.current)return;const{nodes:R}=$A(t);if(R.length===0)return;const I=Math.min(...R.map(z=>z.x))-100,L=Math.max(...R.map(z=>z.x))+100,P=Math.min(...R.map(z=>z.y))-40,F=Math.max(...R.map(z=>z.y))+60,B=L-I,U=F-P,O=_.current.clientWidth,j=_.current.clientHeight,C=Math.min(O/B,j/U,1.5)*.9;l(C),u({x:O/2-(I+L)/2*C,y:j/2-(P+F)/2*C})},[t]),{nodes:T,edges:D}=y.useMemo(()=>t?$A(t):{nodes:[],edges:[]},[t]),A=y.useMemo(()=>new Map(T.map(R=>[R.id,R])),[T]);return y.useEffect(()=>{t&&!r&&setTimeout(E,50)},[t,r,E]),r?h.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:h.jsx(ml,{className:"h-5 w-5 animate-spin"})}):s||!t?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[h.jsx("p",{children:s||"No graph data"}),h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>void v(),children:[h.jsx(As,{className:"h-3 w-3 mr-1"})," Retry"]})]}):h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[h.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[T.length," pages, ",D.length," relations"]}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(R=>Math.min(3,R+.2)),children:h.jsx(HL,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(R=>Math.max(.2,R-.2)),children:h.jsx(VL,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:E,children:h.jsx(uV,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>void v(),children:h.jsx(As,{className:"h-3 w-3"})})]}),h.jsx("div",{ref:_,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:S,onMouseDown:w,onMouseMove:k,onMouseUp:x,onMouseLeave:x,children:h.jsxs("svg",{ref:m,width:"100%",height:"100%",style:{userSelect:"none"},children:[h.jsx("defs",{children:h.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:h.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),h.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${a})`,children:[D.map((R,I)=>{const L=A.get(R.from),P=A.get(R.to);if(!L||!P)return null;const F=L.y+20,B=P.y-20,U=(F+B)/2;return h.jsxs("g",{children:[h.jsx("path",{d:`M ${L.x} ${F} C ${L.x} ${U}, ${P.x} ${U}, ${P.x} ${B}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),R.label&&h.jsx("text",{x:(L.x+P.x)/2,y:U-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:R.label})]},`edge-${I}`)}),T.map(R=>{const I=zA[R.layer%zA.length],L=140,P=36;return h.jsxs("g",{transform:`translate(${R.x-L/2}, ${R.y-P/2})`,children:[h.jsx("rect",{width:L,height:P,rx:8,fill:I,fillOpacity:.15,stroke:I,strokeWidth:1.5}),h.jsx("text",{x:L/2,y:P/2+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:R.title.length>14?R.title.slice(0,13)+"…":R.title})]},R.id)})]})]})})]})}async function l0(e){let t=_v(e);const n=Zr();n&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(n)}`);const r=await fetch(t);if(!r.ok)throw new Error(`Failed to fetch file: ${r.status}`);return r.arrayBuffer()}function bne({filePath:e,zoom:t}){const[n,r]=y.useState(""),[i,s]=y.useState(null),[o,a]=y.useState(!0);return y.useEffect(()=>{let l=!1;return a(!0),s(null),(async()=>{try{const c=await i_(()=>import("./index-
|
|
539
|
+
`),e.charCodeAt(0)===65279&&(e=e.slice(1)));var n=new ene(e,t),r=e.indexOf("\0");for(r!==-1&&(n.position=r,re(n,"null byte is not allowed in input")),n.input+="\0";n.input.charCodeAt(n.position)===32;)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)une(n);return n.documents}function hne(e,t){var n=dne(e,t);if(n.length!==0){if(n.length===1)return n[0];throw new Br("expected a single document in the stream, but found more")}}var pne=hne,fne={load:pne},gne=fne.load;function $A(e){var _;const t=e.pages||[],n=e.relations||[];if(t.length===0)return{nodes:[],edges:[]};const r=new Map,i=new Map;for(const b of t)r.set(b.id,[]),i.set(b.id,0);for(const b of n)(_=r.get(b.from))==null||_.push(b.to),i.set(b.to,(i.get(b.to)||0)+1);const s=new Map,o=[];for(const b of t)(i.get(b.id)||0)===0&&(o.push(b.id),s.set(b.id,0));let a=0;for(;o.length>0;){const b=o.shift(),v=s.get(b)||0;for(const S of r.get(b)||[]){const w=v+1;w>(s.get(S)||0)&&(s.set(S,w),w>a&&(a=w));const k=(i.get(S)||1)-1;i.set(S,k),k<=0&&o.push(S)}}for(const b of t)s.has(b.id)||s.set(b.id,a+1);const l=new Map;for(const b of t){const v=s.get(b.id)||0;l.has(v)||l.set(v,[]),l.get(v).push(b.id)}const c=160,u=50,d=60,p=80,f=[],g=new Map(t.map(b=>[b.id,b]));for(const[b,v]of l){const w=-(v.length*c+(v.length-1)*d)/2;v.forEach((k,x)=>{const E=g.get(k);f.push({id:k,title:(E==null?void 0:E.title)||k,x:w+x*(c+d)+c/2,y:b*(u+p),layer:b})})}const m=n.map(b=>({from:b.from,to:b.to,label:b.label}));return{nodes:f,edges:m}}const zA=["#3b82f6","#8b5cf6","#ec4899","#f59e0b","#10b981","#06b6d4","#f97316","#6366f1"];function mne({folderPath:e}){const[t,n]=y.useState(null),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(1),[c,u]=y.useState({x:0,y:0}),[d,p]=y.useState(!1),[f,g]=y.useState({x:0,y:0}),m=y.useRef(null),_=y.useRef(null),b=`${e}/.notebook/graph.yaml`,v=y.useCallback(async()=>{i(!0),o(null);try{const R=await FL(b);if(!R.content){o("graph.yaml is empty"),n(null);return}const I=gne(R.content);n(I),l(1),u({x:0,y:0})}catch{o("Cannot read .notebook/graph.yaml"),n(null)}finally{i(!1)}},[b]);y.useEffect(()=>{v()},[v]);const S=y.useCallback(R=>{R.preventDefault();const I=R.deltaY>0?-.1:.1;l(L=>Math.max(.2,Math.min(3,L+I)))},[]),w=y.useCallback(R=>{R.button===0&&(p(!0),g({x:R.clientX-c.x,y:R.clientY-c.y}))},[c]),k=y.useCallback(R=>{d&&u({x:R.clientX-f.x,y:R.clientY-f.y})},[d,f]),x=y.useCallback(()=>{p(!1)},[]),E=y.useCallback(()=>{if(!t||!_.current)return;const{nodes:R}=$A(t);if(R.length===0)return;const I=Math.min(...R.map(z=>z.x))-100,L=Math.max(...R.map(z=>z.x))+100,P=Math.min(...R.map(z=>z.y))-40,F=Math.max(...R.map(z=>z.y))+60,B=L-I,U=F-P,O=_.current.clientWidth,j=_.current.clientHeight,C=Math.min(O/B,j/U,1.5)*.9;l(C),u({x:O/2-(I+L)/2*C,y:j/2-(P+F)/2*C})},[t]),{nodes:T,edges:D}=y.useMemo(()=>t?$A(t):{nodes:[],edges:[]},[t]),A=y.useMemo(()=>new Map(T.map(R=>[R.id,R])),[T]);return y.useEffect(()=>{t&&!r&&setTimeout(E,50)},[t,r,E]),r?h.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:h.jsx(ml,{className:"h-5 w-5 animate-spin"})}):s||!t?h.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-2 text-muted-foreground text-sm px-4 text-center",children:[h.jsx("p",{children:s||"No graph data"}),h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>void v(),children:[h.jsx(As,{className:"h-3 w-3 mr-1"})," Retry"]})]}):h.jsxs("div",{className:"flex flex-col h-full",children:[h.jsxs("div",{className:"flex items-center gap-1 px-2 py-1 border-b shrink-0",children:[h.jsxs("span",{className:"text-xs text-muted-foreground mr-auto",children:[T.length," pages, ",D.length," relations"]}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(R=>Math.min(3,R+.2)),children:h.jsx(HL,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>l(R=>Math.max(.2,R-.2)),children:h.jsx(VL,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:E,children:h.jsx(uV,{className:"h-3 w-3"})}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>void v(),children:h.jsx(As,{className:"h-3 w-3"})})]}),h.jsx("div",{ref:_,className:"flex-1 overflow-hidden cursor-grab active:cursor-grabbing bg-muted/30",onWheel:S,onMouseDown:w,onMouseMove:k,onMouseUp:x,onMouseLeave:x,children:h.jsxs("svg",{ref:m,width:"100%",height:"100%",style:{userSelect:"none"},children:[h.jsx("defs",{children:h.jsx("marker",{id:"arrowhead",viewBox:"0 0 10 7",refX:"10",refY:"3.5",markerWidth:"8",markerHeight:"6",orient:"auto",children:h.jsx("polygon",{points:"0 0, 10 3.5, 0 7",className:"fill-muted-foreground/60"})})}),h.jsxs("g",{transform:`translate(${c.x}, ${c.y}) scale(${a})`,children:[D.map((R,I)=>{const L=A.get(R.from),P=A.get(R.to);if(!L||!P)return null;const F=L.y+20,B=P.y-20,U=(F+B)/2;return h.jsxs("g",{children:[h.jsx("path",{d:`M ${L.x} ${F} C ${L.x} ${U}, ${P.x} ${U}, ${P.x} ${B}`,fill:"none",className:"stroke-muted-foreground/40",strokeWidth:1.5,markerEnd:"url(#arrowhead)"}),R.label&&h.jsx("text",{x:(L.x+P.x)/2,y:U-4,textAnchor:"middle",className:"fill-muted-foreground/60",fontSize:9,children:R.label})]},`edge-${I}`)}),T.map(R=>{const I=zA[R.layer%zA.length],L=140,P=36;return h.jsxs("g",{transform:`translate(${R.x-L/2}, ${R.y-P/2})`,children:[h.jsx("rect",{width:L,height:P,rx:8,fill:I,fillOpacity:.15,stroke:I,strokeWidth:1.5}),h.jsx("text",{x:L/2,y:P/2+1,textAnchor:"middle",dominantBaseline:"middle",className:"fill-foreground",fontSize:11,fontWeight:500,children:R.title.length>14?R.title.slice(0,13)+"…":R.title})]},R.id)})]})]})})]})}async function l0(e){let t=_v(e);const n=Zr();n&&(t+=`${t.includes("?")?"&":"?"}token=${encodeURIComponent(n)}`);const r=await fetch(t);if(!r.ok)throw new Error(`Failed to fetch file: ${r.status}`);return r.arrayBuffer()}function bne({filePath:e,zoom:t}){const[n,r]=y.useState(""),[i,s]=y.useState(null),[o,a]=y.useState(!0);return y.useEffect(()=>{let l=!1;return a(!0),s(null),(async()=>{try{const c=await i_(()=>import("./index-lRhMzYm_.js").then(p=>p.i),__vite__mapDeps([0,1])),u=await l0(e),d=await c.convertToHtml({arrayBuffer:u});l||r(d.value)}catch(c){l||s(c instanceof Error?c.message:"Failed to render docx")}finally{l||a(!1)}})(),()=>{l=!0}},[e]),o?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Word 文档中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):h.jsx("div",{className:"p-6 prose dark:prose-invert max-w-none",style:{fontSize:`${12*t/100}px`},dangerouslySetInnerHTML:{__html:n}})}function yne({filePath:e,zoom:t}){var u;const[n,r]=y.useState([]),[i,s]=y.useState(0),[o,a]=y.useState(null),[l,c]=y.useState(!0);return y.useEffect(()=>{let d=!1;return c(!0),a(null),(async()=>{try{const p=await i_(()=>import("./xlsx-D_0l8YDs.js"),[]),f=await l0(e),g=p.read(f,{type:"array"}),m=g.SheetNames.map(_=>({name:_,html:p.utils.sheet_to_html(g.Sheets[_],{editable:!1})}));d||(r(m),s(0))}catch(p){d||a(p instanceof Error?p.message:"Failed to render xlsx")}finally{d||c(!1)}})(),()=>{d=!0}},[e]),l?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 Excel 文件中..."}):o?h.jsx("p",{className:"text-sm text-destructive p-4",children:o}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsxs("div",{className:"flex flex-col h-full",children:[n.length>1&&h.jsx("div",{className:"flex gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30 flex-shrink-0 overflow-x-auto",children:n.map((d,p)=>h.jsx("button",{onClick:()=>s(p),className:`px-3 py-1 text-xs rounded-t transition-colors whitespace-nowrap ${p===i?"bg-background text-foreground border border-b-0 border-border":"text-muted-foreground hover:text-foreground"}`,children:d.name},p))}),h.jsx("div",{className:"flex-1 overflow-auto p-2 xlsx-preview",style:{fontSize:`${12*t/100}px`},dangerouslySetInnerHTML:{__html:((u=n[i])==null?void 0:u.html)??""}}),h.jsx("style",{children:`
|
|
540
540
|
.xlsx-preview table { border-collapse: collapse; width: auto; min-width: 100%; }
|
|
541
541
|
.xlsx-preview td, .xlsx-preview th {
|
|
542
542
|
border: 1px solid hsl(var(--border));
|
|
@@ -547,8 +547,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
547
547
|
}
|
|
548
548
|
.xlsx-preview th { background: hsl(var(--muted)); font-weight: 600; }
|
|
549
549
|
.xlsx-preview tr:hover td { background: hsl(var(--accent) / 0.3); }
|
|
550
|
-
`})]})}async function vne(e){const{default:t}=await i_(async()=>{const{default:s}=await import("./jszip.min-BEfuE5vH.js").then(o=>o.j);return{default:s}},[]),n=await t.loadAsync(e),r=[],i=Object.keys(n.files).filter(s=>/^ppt\/slides\/slide\d+\.xml$/i.test(s)).sort((s,o)=>{var c,u;const a=parseInt(((c=s.match(/slide(\d+)/))==null?void 0:c[1])??"0"),l=parseInt(((u=o.match(/slide(\d+)/))==null?void 0:u[1])??"0");return a-l});for(let s=0;s<i.length;s++){const o=await n.file(i[s]).async("text"),a=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let c;for(;(c=l.exec(o))!==null;){const u=c[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();u&&a.push(u)}r.push({index:s+1,texts:a})}return r}function _ne({filePath:e,zoom:t}){const[n,r]=y.useState([]),[i,s]=y.useState(null),[o,a]=y.useState(!0);return y.useEffect(()=>{let l=!1;return a(!0),s(null),(async()=>{try{const c=await l0(e),u=await vne(c);l||r(u)}catch(c){l||s(c instanceof Error?c.message:"Failed to render pptx")}finally{l||a(!1)}})(),()=>{l=!0}},[e]),o?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsx("div",{className:"p-4 space-y-4",style:{fontSize:`${12*t/100}px`},children:n.map(l=>h.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[h.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",l.index]}),l.texts.length>0?h.jsx("div",{className:"space-y-1.5",children:l.texts.map((c,u)=>h.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:c},u))}):h.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},l.index))})}const Sne=new Set(["docx","xlsx","xls","pptx"]);function wne({filePath:e,ext:t,zoom:n}){return t==="docx"?h.jsx(bne,{filePath:e,zoom:n}):t==="xlsx"||t==="xls"?h.jsx(yne,{filePath:e,zoom:n}):t==="pptx"?h.jsx(_ne,{filePath:e,zoom:n}):null}const YM={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function xne(e){const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"dockerfile";if(n==="makefile")return"makefile";const r=t.lastIndexOf(".");return r>=0?t.slice(r+1).toLowerCase():""}const Ene=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function kne(e){return e==="md"||e==="html"||e==="htm"||e in YM}function HA(e){return e==="md"?"Markdown":e==="html"||e==="htm"?"HTML":"高亮"}const co=[50,75,100,125,150,200,250,300],nc=100,Pb="cc_file_zoom";function Cne(e){try{const n=JSON.parse(localStorage.getItem(Pb)||"{}")[e];return co.includes(n)?n:nc}catch{return nc}}function Tne(e,t){try{const n=JSON.parse(localStorage.getItem(Pb)||"{}");t===nc?delete n[e]:n[e]=t,localStorage.setItem(Pb,JSON.stringify(n))}catch{}}function Ane({filePath:e,onClose:t}){const n=e.endsWith("/.notebook/graph.yaml"),r=n?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[i,s]=y.useState(null),[o,a]=y.useState(null),[l,c]=y.useState(()=>n?"graph":"rendered"),[u,d]=y.useState(!1),[p,f]=y.useState(nc),[g,m]=y.useState(""),[_,b]=y.useState(!1),[v,S]=y.useState(!1),w=y.useRef(null),{resolved:k}=Nv(),x=e.split("/").pop()??e,E=y.useMemo(()=>xne(e),[e]),T=Ene.has(E),D=Sne.has(E),A=kne(E),R=YM[E]||E,I=y.useMemo(()=>{if(!T)return"";const $=_v(e),G=Zr();return G?`${$}&token=${encodeURIComponent(G)}`:$},[e,T]);y.useEffect(()=>{if(s(null),a(null),f(Cne(e)),S(!1),T||D){s({path:e,binary:!1,tooLarge:!1,size:0,content:null}),c("rendered");return}c(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),FL(e).then($=>{s($),m($.content??"")}).catch($=>a($ instanceof Error?$.message:"Failed to load file"))},[e,T,D]);const L=$=>{if($.target===$.currentTarget){if(v&&!confirm("有未保存的修改,确定关闭?"))return;t()}};y.useEffect(()=>{const $=G=>{if(G.key==="Escape"){if(v&&!confirm("有未保存的修改,确定关闭?"))return;t()}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,v]);const P=y.useCallback(async()=>{b(!0);try{await M6(e,g),s($=>$&&{...$,content:g,size:new Blob([g]).size}),S(!1)}catch($){alert($ instanceof Error?$.message:"保存失败")}finally{b(!1)}},[e,g]);y.useEffect(()=>{const $=G=>{(G.metaKey||G.ctrlKey)&&G.key==="s"&&l==="edit"&&(G.preventDefault(),P())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[l,P]);const F=()=>{m((i==null?void 0:i.content)??""),S(!1),c("edit"),setTimeout(()=>{var $;return($=w.current)==null?void 0:$.focus()},0)},B=()=>{v&&!confirm("有未保存的修改,确定退出编辑?")||(c(n?"graph":A?"rendered":"plain"),S(!1))},U=$=>{f($),Tne(e,$)},O=()=>{const $=co.find(G=>G>p);$&&U($)},j=()=>{const $=[...co].reverse().find(G=>G<p);$&&U($)},C=()=>U(nc),z=(i==null?void 0:i.content)??"",Z=k==="dark"?Cee:Tee,M=12*(p/100),se=i&&!i.binary&&!i.tooLarge,be=y.useMemo(()=>{var ae,ce;if(E!=="md")return null;const $=l==="edit"?g:z;if(!$)return 0;const G=((ae=$.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))==null?void 0:ae.length)??0,ie=((ce=$.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))==null?void 0:ce.length)??0;return G+ie},[E,z,g,l]);return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:L,children:h.jsxs("div",{className:X("relative flex flex-col bg-background border border-border shadow-2xl transition-all duration-200",u?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-lg"),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[h.jsx(Uu,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[x,v&&h.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),be!==null&&h.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs",children:[be.toLocaleString()," 字"]})]}),se&&!T&&!D&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[A&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{onClick:()=>l==="edit"?B():c("plain"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="plain"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[h.jsx(rV,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():c("rendered"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="rendered"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:HA(E),children:[h.jsx(UL,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:HA(E)})]})]}),n&&h.jsxs("button",{onClick:()=>l==="edit"?B():c("graph"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="graph"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[h.jsx(gV,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():F(),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[h.jsx(Fh,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),l==="edit"&&h.jsxs("button",{onClick:()=>void P(),disabled:_||!v,className:X("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",v?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[h.jsx($L,{className:"h-3 w-3"}),_?"保存中...":"保存"]}),(se||T)&&l!=="edit"&&l!=="graph"&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[h.jsx("button",{onClick:j,disabled:p<=co[0],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:h.jsx(VL,{className:"h-3 w-3"})}),h.jsxs("button",{onClick:C,className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[p,"%"]}),h.jsx("button",{onClick:O,disabled:p>=co[co.length-1],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:h.jsx(HL,{className:"h-3 w-3"})})]}),h.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>d($=>!$),title:u?"退出全屏":"全屏",children:u?h.jsx(xv,{className:"h-3.5 w-3.5"}):h.jsx(wv,{className:"h-3.5 w-3.5"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{v&&!confirm("有未保存的修改,确定关闭?")||t()},children:h.jsx($s,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:X("flex-1 min-h-0",l==="graph"?"overflow-hidden":"overflow-auto"),children:[l==="graph"&&h.jsx(mne,{folderPath:r}),l!=="graph"&&!i&&!o&&h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),l!=="graph"&&o&&h.jsx("p",{className:"text-sm text-red-400 p-4",children:o}),l!=="graph"&&T&&i&&h.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:h.jsx("img",{src:I,alt:x,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${p/100})`,transformOrigin:"center center"},draggable:!1})}),l!=="graph"&&D&&i&&h.jsx(wne,{filePath:e,ext:E,zoom:p}),l!=="graph"&&!T&&!D&&i&&i.binary&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Uu,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024).toFixed(1)," KB"]})]}),l!=="graph"&&!D&&i&&i.tooLarge&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Uu,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"File too large to preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024/1024).toFixed(2)," MB (limit 1 MB)"]})]}),l!=="graph"&&se&&z!==null&&h.jsxs(h.Fragment,{children:[l==="edit"&&h.jsx("textarea",{ref:w,value:g,onChange:$=>{m($.target.value),S(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${M}px`,minHeight:"100%"},spellCheck:!1}),l!=="edit"&&h.jsxs("div",{className:"p-4",style:{fontSize:`${M}px`},children:[l==="plain"&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:z}),l==="rendered"&&E==="md"&&h.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:h.jsx(tM,{remarkPlugins:[kM],components:{code({className:$,children:G,...ie}){const ae=/language-(\w+)/.exec($||"");return!ae&&!$?h.jsx("code",{className:$,...ie,children:G}):h.jsx(Db,{style:Z,language:(ae==null?void 0:ae[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(G).replace(/\n$/,"")})}},children:z})}),l==="rendered"&&(E==="html"||E==="htm")&&h.jsx("iframe",{srcDoc:z,className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:x,style:{minHeight:"60vh",transform:`scale(${p/100})`,transformOrigin:"top left",width:`${1e4/p}%`,height:`${1e4/p}%`}}),l==="rendered"&&E!=="md"&&E!=="html"&&E!=="htm"&&R&&h.jsx(Db,{style:Z,language:R,showLineNumbers:!0,lineNumberStyle:{color:k==="dark"?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:z}),l==="rendered"&&!A&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:z})]})]})]})]})})}const Rne=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function Nne(e){const t=e.lastIndexOf(".");return t>=0&&Rne.has(e.slice(t+1).toLowerCase())}function Ine({projectPath:e}){const[t,n]=y.useState(new Map),[r,i]=y.useState(new Set([e])),[s,o]=y.useState(new Set),[a,l]=y.useState(null),[c,u]=y.useState(null),[d,p]=y.useState(!1),[f,g]=y.useState(!1),m=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{if(!c)return;const R=()=>u(null);return window.addEventListener("click",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("click",R),window.removeEventListener("scroll",R,!0)}},[c]);const b=(R,I)=>{let L=_v(R);const P=Zr();P&&(L+=`${L.includes("?")?"&":"?"}token=${encodeURIComponent(P)}`);const F=document.createElement("a");F.href=L,F.download=I,F.click()},v=async R=>{if(R.length!==0){p(!0);try{await L6(e,R),w(e)}catch(I){console.error("[FileTree] Upload failed:",I)}finally{p(!1)}}},S=R=>{R.preventDefault(),g(!1);const I=Array.from(R.dataTransfer.files);I.length>0&&v(I)},w=y.useCallback(async R=>{o(I=>{if(I.has(R))return I;const L=new Set(I);return L.add(R),L});try{const I=await PL(R);n(L=>new Map(L).set(R,I.entries))}catch(I){console.error("[FileTree] Failed to load:",R,I),n(L=>new Map(L).set(R,[]))}finally{o(I=>{const L=new Set(I);return L.delete(R),L})}},[]);y.useEffect(()=>{n(new Map),i(new Set([e])),o(new Set),w(e)},[e,w]);const k=y.useCallback(R=>{i(I=>{const L=new Set(I);return L.has(R)?L.delete(R):(L.add(R),t.has(R)||w(R)),L})},[t,w]),x=y.useCallback(()=>{n(new Map),i(new Set([e])),o(new Set),w(e)},[e,w]),E=(R,I)=>R.map(L=>{const P=r.has(L.path),F=s.has(L.path),B=t.get(L.path),U=L.name.startsWith(".");return h.jsxs("div",{children:[h.jsxs("div",{className:X("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted",U&&"opacity-50"),style:{paddingLeft:`${I*14+6}px`,paddingRight:"6px"},onClick:()=>L.type==="dir"?k(L.path):l(L.path),onContextMenu:O=>{L.type==="file"&&(O.preventDefault(),u({x:O.clientX,y:O.clientY,filePath:L.path,fileName:L.name}))},children:[h.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:L.type==="dir"&&(F?h.jsx(As,{className:"h-2.5 w-2.5 animate-spin"}):P?h.jsx(Mh,{className:"h-2.5 w-2.5"}):h.jsx(Ph,{className:"h-2.5 w-2.5"}))}),L.type==="dir"?P?h.jsx(Wl,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):h.jsx(Rm,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):Nne(L.name)?h.jsx(lV,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):h.jsx(Uu,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:X("text-xs truncate leading-none",L.type==="dir"?"text-foreground":"text-muted-foreground"),title:L.path,children:L.name})]}),h.jsx(Jn,{initial:!1,children:L.type==="dir"&&P&&h.jsxs(Ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"overflow-hidden",children:[!B&&!F&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(I+1)*14+6+16}px`},children:"—"}),(B==null?void 0:B.length)===0&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(I+1)*14+6+16}px`},children:"empty"}),B&&B.length>0&&E(B,I+1)]})})]},L.path)}),T=t.get(e),D=s.has(e),A=e.split("/").filter(Boolean).pop()??e;return h.jsxs(h.Fragment,{children:[a&&h.jsx(Ane,{filePath:a,onClose:()=>l(null)}),c&&h.jsx("div",{ref:m,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:c.x,top:c.y},onClick:R=>R.stopPropagation(),children:h.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{b(c.filePath,c.fileName),u(null)},children:[h.jsx(Bd,{className:"h-3.5 w-3.5"}),"下载"]})}),h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),h.jsxs("div",{className:"flex items-center gap-0.5",children:[h.jsx("input",{ref:_,type:"file",multiple:!0,className:"hidden",onChange:R=>{const I=Array.from(R.target.files??[]);I.length>0&&v(I),R.target.value=""}}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var R;return(R=_.current)==null?void 0:R.click()},disabled:d,title:"上传文件",children:h.jsx(Im,{className:X("h-3 w-3",d&&"animate-pulse")})}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:x,title:"Refresh file tree",children:h.jsx(As,{className:X("h-3 w-3",D&&"animate-spin")})})]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[h.jsx(Wl,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:A})]}),h.jsxs("div",{className:X("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",f&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:R=>{R.preventDefault(),g(!0)},onDragEnter:R=>{R.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:S,children:[d&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),f&&!d&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),D&&!T?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):!T||T.length===0?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"}):E(T,0)]})]})]})}function One({open:e,onOpenChange:t,initialLabel:n,initialCommand:r,title:i,onSave:s}){const[o,a]=y.useState(n),[l,c]=y.useState(r);y.useEffect(()=>{e&&(a(n),c(r))},[e,n,r]);const u=()=>{const d=l.trim();d&&(s(o.trim()||d,d),t(!1))};return h.jsx(ua,{open:e,onOpenChange:t,children:h.jsxs(Hs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:i}),h.jsx(qs,{children:"Write the command that will be sent to Claude when this shortcut is triggered."})]}),h.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"shortcut-label",children:"Label"}),h.jsx(Fn,{id:"shortcut-label",placeholder:"Give it a name (optional)",value:o,onChange:d=>a(d.target.value),className:"text-base",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[h.jsx(ze,{htmlFor:"shortcut-command",children:"Command"}),h.jsx("textarea",{id:"shortcut-command",placeholder:"Enter the command to send to Claude...",value:l,onChange:d=>c(d.target.value),className:X("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:d=>{d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),u())}})]})]}),h.jsxs(Gs,{className:"flex items-center justify-between sm:justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),h.jsx(ne,{onClick:u,disabled:!l.trim(),children:"Save"})]})]})]})})}function Lne({open:e,onOpenChange:t,label:n,command:r}){const[i,s]=y.useState(""),[o,a]=y.useState(()=>localStorage.getItem("ccweb_skillhub_author")||""),[l,c]=y.useState(""),[u,d]=y.useState(!1),[p,f]=y.useState(!1);y.useEffect(()=>{if(e){s(""),c(""),f(!1);const m=localStorage.getItem("ccweb_skillhub_author");m&&a(m)}},[e]);const g=async()=>{if(!u){d(!0);try{localStorage.setItem("ccweb_skillhub_author",o),await R6({label:n,command:r,description:i.trim(),author:o.trim()||"anonymous",tags:l.split(",").map(m=>m.trim()).filter(Boolean)}),f(!0)}catch(m){alert(m instanceof Error?m.message:"Failed to submit")}finally{d(!1)}}};return h.jsx(ua,{open:e,onOpenChange:t,children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:"分享到 SkillHub"}),h.jsxs(qs,{children:["将「",n,"」分享给社区,审核通过后将出现在 SkillHub 中。"]})]}),p?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"提交成功!等待审核后将出现在 SkillHub 中。"}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-desc",children:"描述"}),h.jsx("textarea",{id:"share-desc",placeholder:"简要描述这个命令的用途...",value:i,onChange:m=>s(m.target.value),className:X("w-full rounded-md border border-input bg-background px-3 py-2","text-sm min-h-[80px] resize-none","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2")})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-author",children:"作者"}),h.jsx(Fn,{id:"share-author",placeholder:"你的名字",value:o,onChange:m=>a(m.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-tags",children:"标签(逗号分隔)"}),h.jsx(Fn,{id:"share-tags",placeholder:"代码审查, 中文, 测试",value:l,onChange:m=>c(m.target.value)})]})]}),h.jsx(Gs,{children:p?h.jsx(ne,{onClick:()=>t(!1),children:"关闭"}):h.jsxs(h.Fragment,{children:[h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"取消"}),h.jsx(ne,{onClick:g,disabled:u,children:u?"提交中...":"提交"})]})})]})})}function Dne({projectId:e,onSend:t}){const[n,r]=y.useState([]),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(null),[u,d]=y.useState(!1),[p,f]=y.useState(""),[g,m]=y.useState("");y.useEffect(()=>{E6(e).then(r).catch(()=>r([]))},[e]),y.useEffect(()=>{ML().then(s).catch(()=>s([]))},[]);const _=y.useCallback(E=>{const T=[],D=new Set;let A=E;const R=[];for(;A&&!D.has(A.id);)D.add(A.id),R.unshift(A),A=A.parentId?i.find(I=>I.id===A.parentId):void 0;for(const I of R)T.push(I.command);return T},[i]),b=y.useCallback(E=>{_(E).forEach((D,A)=>{setTimeout(()=>t(D+"\r"),A*500)})},[_,t]),v=()=>{c(null),a(!0)},S=(E,T)=>{T.stopPropagation(),c(E),a(!0)},w=async(E,T)=>{try{if(l){const D=await C6(e,l.id,{label:E,command:T});r(A=>A.map(R=>R.id===D.id?D:R))}else{const D=await k6(e,{label:E,command:T});r(A=>[...A,D])}}catch(D){console.error("Failed to save shortcut:",D)}c(null)},k=(E,T,D)=>{D.stopPropagation(),f(E),m(T),d(!0)},x=async(E,T)=>{T.stopPropagation();try{await T6(e,E),r(D=>D.filter(A=>A.id!==E))}catch(D){console.error("Failed to delete shortcut:",D)}};return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Shortcuts"}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:v,title:"New shortcut",children:h.jsx(Yo,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[i.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1 pb-0.5",children:[h.jsx(jd,{className:"h-3 w-3 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"全局"})]}),i.map(E=>{var D;const T=E.parentId?(D=i.find(A=>A.id===E.parentId))==null?void 0:D.label:void 0;return h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>b(E),title:T?`继承自「${T}」`:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-6 leading-snug",children:E.label}),T&&h.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[h.jsx(gl,{className:"h-2.5 w-2.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T]})]}),!T&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug",children:E.command}),h.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:A=>k(E.label,E.command,A),title:"分享到 SkillHub",children:h.jsx(g1,{className:"h-3 w-3"})})})]},E.id)}),n.length>0&&h.jsx("div",{className:"flex items-center gap-1.5 px-1 pt-2 pb-0.5",children:h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"项目"})})]}),n.length===0&&i.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(jd,{className:"h-5 w-5"}),h.jsxs("p",{className:"text-xs text-center leading-relaxed",children:["No shortcuts yet.",h.jsx("br",{}),"Click ",h.jsx("strong",{className:"text-muted-foreground",children:"+"})," to add one."]})]}),n.map(E=>h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>t(E.command+"\r"),title:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-10 leading-snug",children:E.label}),E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug pr-10",children:E.command}),h.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:T=>k(E.label,E.command,T),title:"分享到 SkillHub",children:h.jsx(g1,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-blue-400 transition-colors",onClick:T=>S(E,T),title:"Edit shortcut",children:h.jsx(Fh,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-red-400 transition-colors",onClick:T=>x(E.id,T),title:"Delete shortcut",children:h.jsx($s,{className:"h-3 w-3"})})]})]},E.id))]}),h.jsx(One,{open:o,onOpenChange:a,initialLabel:(l==null?void 0:l.label)??"",initialCommand:(l==null?void 0:l.command)??"",title:l?"Edit Shortcut":"New Shortcut",onSave:w}),h.jsx(Lne,{open:u,onOpenChange:d,label:p,command:g})]})}function XM(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function ZM(e){return`这是我们上一次的聊天记录,请你回忆:
|
|
550
|
+
`})]})}async function vne(e){const{default:t}=await i_(async()=>{const{default:s}=await import("./jszip.min-JFbhTBvU.js").then(o=>o.j);return{default:s}},[]),n=await t.loadAsync(e),r=[],i=Object.keys(n.files).filter(s=>/^ppt\/slides\/slide\d+\.xml$/i.test(s)).sort((s,o)=>{var c,u;const a=parseInt(((c=s.match(/slide(\d+)/))==null?void 0:c[1])??"0"),l=parseInt(((u=o.match(/slide(\d+)/))==null?void 0:u[1])??"0");return a-l});for(let s=0;s<i.length;s++){const o=await n.file(i[s]).async("text"),a=[],l=/<a:t[^>]*>([\s\S]*?)<\/a:t>/g;let c;for(;(c=l.exec(o))!==null;){const u=c[1].replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').trim();u&&a.push(u)}r.push({index:s+1,texts:a})}return r}function _ne({filePath:e,zoom:t}){const[n,r]=y.useState([]),[i,s]=y.useState(null),[o,a]=y.useState(!0);return y.useEffect(()=>{let l=!1;return a(!0),s(null),(async()=>{try{const c=await l0(e),u=await vne(c);l||r(u)}catch(c){l||s(c instanceof Error?c.message:"Failed to render pptx")}finally{l||a(!1)}})(),()=>{l=!0}},[e]),o?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"加载 PPT 文件中..."}):i?h.jsx("p",{className:"text-sm text-destructive p-4",children:i}):n.length===0?h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"空文件"}):h.jsx("div",{className:"p-4 space-y-4",style:{fontSize:`${12*t/100}px`},children:n.map(l=>h.jsxs("div",{className:"border border-border rounded-lg p-5 bg-muted/20",children:[h.jsxs("div",{className:"text-xs text-muted-foreground mb-2 font-medium",children:["Slide ",l.index]}),l.texts.length>0?h.jsx("div",{className:"space-y-1.5",children:l.texts.map((c,u)=>h.jsx("p",{className:"text-foreground leading-relaxed",style:{fontSize:"inherit"},children:c},u))}):h.jsx("p",{className:"text-muted-foreground text-sm italic",children:"(无文本内容)"})]},l.index))})}const Sne=new Set(["docx","xlsx","xls","pptx"]);function wne({filePath:e,ext:t,zoom:n}){return t==="docx"?h.jsx(bne,{filePath:e,zoom:n}):t==="xlsx"||t==="xls"?h.jsx(yne,{filePath:e,zoom:n}):t==="pptx"?h.jsx(_ne,{filePath:e,zoom:n}):null}const YM={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",c:"c",cpp:"cpp",h:"c",cs:"csharp",php:"php",sh:"bash",bash:"bash",zsh:"bash",yaml:"yaml",yml:"yaml",json:"json",toml:"toml",html:"html",htm:"html",xml:"xml",svg:"xml",css:"css",scss:"scss",less:"less",sql:"sql",graphql:"graphql",gql:"graphql",dockerfile:"docker",makefile:"makefile",r:"r",lua:"lua",dart:"dart",zig:"zig"};function xne(e){const t=e.split("/").pop()??"",n=t.toLowerCase();if(n==="dockerfile")return"dockerfile";if(n==="makefile")return"makefile";const r=t.lastIndexOf(".");return r>=0?t.slice(r+1).toLowerCase():""}const Ene=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function kne(e){return e==="md"||e==="html"||e==="htm"||e in YM}function HA(e){return e==="md"?"Markdown":e==="html"||e==="htm"?"HTML":"高亮"}const co=[50,75,100,125,150,200,250,300],nc=100,Pb="cc_file_zoom";function Cne(e){try{const n=JSON.parse(localStorage.getItem(Pb)||"{}")[e];return co.includes(n)?n:nc}catch{return nc}}function Tne(e,t){try{const n=JSON.parse(localStorage.getItem(Pb)||"{}");t===nc?delete n[e]:n[e]=t,localStorage.setItem(Pb,JSON.stringify(n))}catch{}}function Ane({filePath:e,onClose:t}){const n=e.endsWith("/.notebook/graph.yaml"),r=n?e.replace(/\/.notebook\/graph\.yaml$/,""):"",[i,s]=y.useState(null),[o,a]=y.useState(null),[l,c]=y.useState(()=>n?"graph":"rendered"),[u,d]=y.useState(!1),[p,f]=y.useState(nc),[g,m]=y.useState(""),[_,b]=y.useState(!1),[v,S]=y.useState(!1),w=y.useRef(null),{resolved:k}=Nv(),x=e.split("/").pop()??e,E=y.useMemo(()=>xne(e),[e]),T=Ene.has(E),D=Sne.has(E),A=kne(E),R=YM[E]||E,I=y.useMemo(()=>{if(!T)return"";const $=_v(e),G=Zr();return G?`${$}&token=${encodeURIComponent(G)}`:$},[e,T]);y.useEffect(()=>{if(s(null),a(null),f(Cne(e)),S(!1),T||D){s({path:e,binary:!1,tooLarge:!1,size:0,content:null}),c("rendered");return}c(e.endsWith("/.notebook/graph.yaml")?"graph":"rendered"),FL(e).then($=>{s($),m($.content??"")}).catch($=>a($ instanceof Error?$.message:"Failed to load file"))},[e,T,D]);const L=$=>{if($.target===$.currentTarget){if(v&&!confirm("有未保存的修改,确定关闭?"))return;t()}};y.useEffect(()=>{const $=G=>{if(G.key==="Escape"){if(v&&!confirm("有未保存的修改,确定关闭?"))return;t()}};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,v]);const P=y.useCallback(async()=>{b(!0);try{await M6(e,g),s($=>$&&{...$,content:g,size:new Blob([g]).size}),S(!1)}catch($){alert($ instanceof Error?$.message:"保存失败")}finally{b(!1)}},[e,g]);y.useEffect(()=>{const $=G=>{(G.metaKey||G.ctrlKey)&&G.key==="s"&&l==="edit"&&(G.preventDefault(),P())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[l,P]);const F=()=>{m((i==null?void 0:i.content)??""),S(!1),c("edit"),setTimeout(()=>{var $;return($=w.current)==null?void 0:$.focus()},0)},B=()=>{v&&!confirm("有未保存的修改,确定退出编辑?")||(c(n?"graph":A?"rendered":"plain"),S(!1))},U=$=>{f($),Tne(e,$)},O=()=>{const $=co.find(G=>G>p);$&&U($)},j=()=>{const $=[...co].reverse().find(G=>G<p);$&&U($)},C=()=>U(nc),z=(i==null?void 0:i.content)??"",Z=k==="dark"?Cee:Tee,M=12*(p/100),se=i&&!i.binary&&!i.tooLarge,be=y.useMemo(()=>{var ae,ce;if(E!=="md")return null;const $=l==="edit"?g:z;if(!$)return 0;const G=((ae=$.match(/[\u4e00-\u9fff\u3400-\u4dbf]/g))==null?void 0:ae.length)??0,ie=((ce=$.replace(/[\u4e00-\u9fff\u3400-\u4dbf]/g," ").match(/[a-zA-Z0-9]+/g))==null?void 0:ce.length)??0;return G+ie},[E,z,g,l]);return h.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:L,children:h.jsxs("div",{className:X("relative flex flex-col bg-background border border-border shadow-2xl transition-all duration-200",u?"w-screen h-screen rounded-none":"w-[72vw] max-w-4xl h-[80vh] rounded-lg"),children:[h.jsxs("div",{className:"flex items-center gap-2 px-4 h-10 border-b border-border flex-shrink-0",children:[h.jsx(Uu,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsxs("span",{className:"flex-1 text-sm text-foreground font-medium truncate",title:e,children:[x,v&&h.jsx("span",{className:"text-muted-foreground ml-1",children:"*"}),be!==null&&h.jsxs("span",{className:"text-muted-foreground font-normal ml-2 text-xs",children:[be.toLocaleString()," 字"]})]}),se&&!T&&!D&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5",children:[A&&h.jsxs(h.Fragment,{children:[h.jsxs("button",{onClick:()=>l==="edit"?B():c("plain"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="plain"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"纯文本",children:[h.jsx(rV,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"源码"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():c("rendered"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="rendered"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:HA(E),children:[h.jsx(UL,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:HA(E)})]})]}),n&&h.jsxs("button",{onClick:()=>l==="edit"?B():c("graph"),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="graph"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"图谱",children:[h.jsx(gV,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"图谱"})]}),h.jsxs("button",{onClick:()=>l==="edit"?B():F(),className:X("p-1 rounded-sm transition-colors flex items-center gap-1 text-xs",l==="edit"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),title:"编辑",children:[h.jsx(Fh,{className:"h-3 w-3"}),h.jsx("span",{className:"hidden sm:inline",children:"编辑"})]})]}),l==="edit"&&h.jsxs("button",{onClick:()=>void P(),disabled:_||!v,className:X("flex items-center gap-1 text-xs px-2 py-1 rounded transition-colors",v?"bg-blue-600 hover:bg-blue-500 text-white":"bg-muted text-muted-foreground"),title:"保存 (⌘S)",children:[h.jsx($L,{className:"h-3 w-3"}),_?"保存中...":"保存"]}),(se||T)&&l!=="edit"&&l!=="graph"&&h.jsxs("div",{className:"flex items-center rounded-md border border-border bg-muted/50 p-0.5 gap-0.5",children:[h.jsx("button",{onClick:j,disabled:p<=co[0],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"缩小",children:h.jsx(VL,{className:"h-3 w-3"})}),h.jsxs("button",{onClick:C,className:"px-1 text-xs text-muted-foreground hover:text-foreground transition-colors min-w-[36px] text-center",title:"重置缩放",children:[p,"%"]}),h.jsx("button",{onClick:O,disabled:p>=co[co.length-1],className:"p-1 rounded-sm text-muted-foreground hover:text-foreground transition-colors disabled:opacity-30",title:"放大",children:h.jsx(HL,{className:"h-3 w-3"})})]}),h.jsx("button",{className:"p-1 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>d($=>!$),title:u?"退出全屏":"全屏",children:u?h.jsx(xv,{className:"h-3.5 w-3.5"}):h.jsx(wv,{className:"h-3.5 w-3.5"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:()=>{v&&!confirm("有未保存的修改,确定关闭?")||t()},children:h.jsx($s,{className:"h-4 w-4"})})]}),h.jsxs("div",{className:X("flex-1 min-h-0",l==="graph"?"overflow-hidden":"overflow-auto"),children:[l==="graph"&&h.jsx(mne,{folderPath:r}),l!=="graph"&&!i&&!o&&h.jsx("p",{className:"text-sm text-muted-foreground p-4",children:"Loading…"}),l!=="graph"&&o&&h.jsx("p",{className:"text-sm text-red-400 p-4",children:o}),l!=="graph"&&T&&i&&h.jsx("div",{className:"flex items-center justify-center p-4 h-full",children:h.jsx("img",{src:I,alt:x,className:"max-w-full max-h-full object-contain rounded",style:{transform:`scale(${p/100})`,transformOrigin:"center center"},draggable:!1})}),l!=="graph"&&D&&i&&h.jsx(wne,{filePath:e,ext:E,zoom:p}),l!=="graph"&&!T&&!D&&i&&i.binary&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Uu,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"Binary file — cannot preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024).toFixed(1)," KB"]})]}),l!=="graph"&&!D&&i&&i.tooLarge&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-muted-foreground p-4",children:[h.jsx(Uu,{className:"h-8 w-8"}),h.jsx("p",{className:"text-sm",children:"File too large to preview"}),h.jsxs("p",{className:"text-xs text-muted-foreground",children:[(i.size/1024/1024).toFixed(2)," MB (limit 1 MB)"]})]}),l!=="graph"&&se&&z!==null&&h.jsxs(h.Fragment,{children:[l==="edit"&&h.jsx("textarea",{ref:w,value:g,onChange:$=>{m($.target.value),S(!0)},className:"w-full h-full bg-transparent text-foreground font-mono outline-none resize-none p-4 leading-relaxed",style:{fontSize:`${M}px`,minHeight:"100%"},spellCheck:!1}),l!=="edit"&&h.jsxs("div",{className:"p-4",style:{fontSize:`${M}px`},children:[l==="plain"&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:z}),l==="rendered"&&E==="md"&&h.jsx("div",{className:"prose dark:prose-invert max-w-none prose-pre:bg-muted prose-pre:border prose-pre:border-border prose-code:text-foreground",style:{fontSize:"inherit"},children:h.jsx(tM,{remarkPlugins:[kM],components:{code({className:$,children:G,...ie}){const ae=/language-(\w+)/.exec($||"");return!ae&&!$?h.jsx("code",{className:$,...ie,children:G}):h.jsx(Db,{style:Z,language:(ae==null?void 0:ae[1])||"text",PreTag:"div",customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0},children:String(G).replace(/\n$/,"")})}},children:z})}),l==="rendered"&&(E==="html"||E==="htm")&&h.jsx("iframe",{srcDoc:z,className:"w-full h-full border-0 rounded bg-white",sandbox:"",title:x,style:{minHeight:"60vh",transform:`scale(${p/100})`,transformOrigin:"top left",width:`${1e4/p}%`,height:`${1e4/p}%`}}),l==="rendered"&&E!=="md"&&E!=="html"&&E!=="htm"&&R&&h.jsx(Db,{style:Z,language:R,showLineNumbers:!0,lineNumberStyle:{color:k==="dark"?"#555":"#aaa",fontSize:"inherit"},customStyle:{fontSize:"inherit",borderRadius:"6px",margin:0,background:"transparent"},children:z}),l==="rendered"&&!A&&h.jsx("pre",{className:"font-mono text-foreground whitespace-pre-wrap break-words leading-relaxed",style:{fontSize:"inherit"},children:z})]})]})]})]})})}const Rne=new Set(["png","jpg","jpeg","gif","webp","svg","bmp","ico","avif","tiff","tif"]);function Nne(e){const t=e.lastIndexOf(".");return t>=0&&Rne.has(e.slice(t+1).toLowerCase())}function Ine({projectPath:e}){const[t,n]=y.useState(new Map),[r,i]=y.useState(new Set([e])),[s,o]=y.useState(new Set),[a,l]=y.useState(null),[c,u]=y.useState(null),[d,p]=y.useState(!1),[f,g]=y.useState(!1),m=y.useRef(null),_=y.useRef(null);y.useEffect(()=>{if(!c)return;const R=()=>u(null);return window.addEventListener("click",R),window.addEventListener("scroll",R,!0),()=>{window.removeEventListener("click",R),window.removeEventListener("scroll",R,!0)}},[c]);const b=(R,I)=>{let L=_v(R);const P=Zr();P&&(L+=`${L.includes("?")?"&":"?"}token=${encodeURIComponent(P)}`);const F=document.createElement("a");F.href=L,F.download=I,F.click()},v=async R=>{if(R.length!==0){p(!0);try{await L6(e,R),w(e)}catch(I){console.error("[FileTree] Upload failed:",I)}finally{p(!1)}}},S=R=>{R.preventDefault(),g(!1);const I=Array.from(R.dataTransfer.files);I.length>0&&v(I)},w=y.useCallback(async R=>{o(I=>{if(I.has(R))return I;const L=new Set(I);return L.add(R),L});try{const I=await PL(R);n(L=>new Map(L).set(R,I.entries))}catch(I){console.error("[FileTree] Failed to load:",R,I),n(L=>new Map(L).set(R,[]))}finally{o(I=>{const L=new Set(I);return L.delete(R),L})}},[]);y.useEffect(()=>{n(new Map),i(new Set([e])),o(new Set),w(e)},[e,w]);const k=y.useCallback(R=>{i(I=>{const L=new Set(I);return L.has(R)?L.delete(R):(L.add(R),t.has(R)||w(R)),L})},[t,w]),x=y.useCallback(()=>{n(new Map),i(new Set([e])),o(new Set),w(e)},[e,w]),E=(R,I)=>R.map(L=>{const P=r.has(L.path),F=s.has(L.path),B=t.get(L.path),U=L.name.startsWith(".");return h.jsxs("div",{children:[h.jsxs("div",{className:X("flex items-center gap-1 py-[3px] rounded cursor-pointer","hover:bg-muted",U&&"opacity-50"),style:{paddingLeft:`${I*14+6}px`,paddingRight:"6px"},onClick:()=>L.type==="dir"?k(L.path):l(L.path),onContextMenu:O=>{L.type==="file"&&(O.preventDefault(),u({x:O.clientX,y:O.clientY,filePath:L.path,fileName:L.name}))},children:[h.jsx("span",{className:"w-3 flex-shrink-0 text-muted-foreground",children:L.type==="dir"&&(F?h.jsx(As,{className:"h-2.5 w-2.5 animate-spin"}):P?h.jsx(Mh,{className:"h-2.5 w-2.5"}):h.jsx(Ph,{className:"h-2.5 w-2.5"}))}),L.type==="dir"?P?h.jsx(Wl,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):h.jsx(Rm,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}):Nne(L.name)?h.jsx(lV,{className:"h-3.5 w-3.5 text-green-400 flex-shrink-0"}):h.jsx(Uu,{className:"h-3.5 w-3.5 text-muted-foreground flex-shrink-0"}),h.jsx("span",{className:X("text-xs truncate leading-none",L.type==="dir"?"text-foreground":"text-muted-foreground"),title:L.path,children:L.name})]}),h.jsx(Jn,{initial:!1,children:L.type==="dir"&&P&&h.jsxs(Ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.15,ease:"easeInOut"},className:"overflow-hidden",children:[!B&&!F&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(I+1)*14+6+16}px`},children:"—"}),(B==null?void 0:B.length)===0&&h.jsx("div",{className:"text-xs text-muted-foreground/50 py-0.5",style:{paddingLeft:`${(I+1)*14+6+16}px`},children:"empty"}),B&&B.length>0&&E(B,I+1)]})})]},L.path)}),T=t.get(e),D=s.has(e),A=e.split("/").filter(Boolean).pop()??e;return h.jsxs(h.Fragment,{children:[a&&h.jsx(Ane,{filePath:a,onClose:()=>l(null)}),c&&h.jsx("div",{ref:m,className:"fixed z-50 min-w-[140px] bg-popover border border-border rounded-md shadow-md py-1",style:{left:c.x,top:c.y},onClick:R=>R.stopPropagation(),children:h.jsxs("button",{className:"flex items-center gap-2 w-full px-3 py-1.5 text-xs hover:bg-accent hover:text-accent-foreground text-left",onClick:()=>{b(c.filePath,c.fileName),u(null)},children:[h.jsx(Bd,{className:"h-3.5 w-3.5"}),"下载"]})}),h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Files"}),h.jsxs("div",{className:"flex items-center gap-0.5",children:[h.jsx("input",{ref:_,type:"file",multiple:!0,className:"hidden",onChange:R=>{const I=Array.from(R.target.files??[]);I.length>0&&v(I),R.target.value=""}}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:()=>{var R;return(R=_.current)==null?void 0:R.click()},disabled:d,title:"上传文件",children:h.jsx(Im,{className:X("h-3 w-3",d&&"animate-pulse")})}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground p-0.5 rounded transition-colors",onClick:x,title:"Refresh file tree",children:h.jsx(As,{className:X("h-3 w-3",D&&"animate-spin")})})]})]}),h.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 border-b border-border flex-shrink-0",children:[h.jsx(Wl,{className:"h-3.5 w-3.5 text-blue-400 flex-shrink-0"}),h.jsx("span",{className:"text-xs text-foreground font-medium truncate",title:e,children:A})]}),h.jsxs("div",{className:X("flex-1 overflow-y-auto py-1 min-h-0 transition-colors",f&&"bg-accent/30 ring-1 ring-inset ring-accent"),onDragOver:R=>{R.preventDefault(),g(!0)},onDragEnter:R=>{R.preventDefault(),g(!0)},onDragLeave:()=>g(!1),onDrop:S,children:[d&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"上传中..."}),f&&!d&&h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-1",children:"松开以上传文件"}),D&&!T?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Loading…"}):!T||T.length===0?h.jsx("div",{className:"text-xs text-muted-foreground px-4 py-3",children:"Empty folder"}):E(T,0)]})]})]})}function One({open:e,onOpenChange:t,initialLabel:n,initialCommand:r,title:i,onSave:s}){const[o,a]=y.useState(n),[l,c]=y.useState(r);y.useEffect(()=>{e&&(a(n),c(r))},[e,n,r]);const u=()=>{const d=l.trim();d&&(s(o.trim()||d,d),t(!1))};return h.jsx(ua,{open:e,onOpenChange:t,children:h.jsxs(Hs,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:i}),h.jsx(qs,{children:"Write the command that will be sent to Claude when this shortcut is triggered."})]}),h.jsxs("div",{className:"space-y-4 flex-1 min-h-0 flex flex-col",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"shortcut-label",children:"Label"}),h.jsx(Fn,{id:"shortcut-label",placeholder:"Give it a name (optional)",value:o,onChange:d=>a(d.target.value),className:"text-base",autoFocus:!0})]}),h.jsxs("div",{className:"space-y-2 flex-1 flex flex-col min-h-0",children:[h.jsx(ze,{htmlFor:"shortcut-command",children:"Command"}),h.jsx("textarea",{id:"shortcut-command",placeholder:"Enter the command to send to Claude...",value:l,onChange:d=>c(d.target.value),className:X("flex-1 min-h-[200px] w-full rounded-md border border-input bg-background px-4 py-3","text-base leading-relaxed font-mono","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","resize-none"),onKeyDown:d=>{d.key==="Enter"&&(d.metaKey||d.ctrlKey)&&(d.preventDefault(),u())}})]})]}),h.jsxs(Gs,{className:"flex items-center justify-between sm:justify-between",children:[h.jsx("span",{className:"text-xs text-muted-foreground",children:"⌘↩ to save"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),h.jsx(ne,{onClick:u,disabled:!l.trim(),children:"Save"})]})]})]})})}function Lne({open:e,onOpenChange:t,label:n,command:r}){const[i,s]=y.useState(""),[o,a]=y.useState(()=>localStorage.getItem("ccweb_skillhub_author")||""),[l,c]=y.useState(""),[u,d]=y.useState(!1),[p,f]=y.useState(!1);y.useEffect(()=>{if(e){s(""),c(""),f(!1);const m=localStorage.getItem("ccweb_skillhub_author");m&&a(m)}},[e]);const g=async()=>{if(!u){d(!0);try{localStorage.setItem("ccweb_skillhub_author",o),await R6({label:n,command:r,description:i.trim(),author:o.trim()||"anonymous",tags:l.split(",").map(m=>m.trim()).filter(Boolean)}),f(!0)}catch(m){alert(m instanceof Error?m.message:"Failed to submit")}finally{d(!1)}}};return h.jsx(ua,{open:e,onOpenChange:t,children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsx(Ws,{children:"分享到 SkillHub"}),h.jsxs(qs,{children:["将「",n,"」分享给社区,审核通过后将出现在 SkillHub 中。"]})]}),p?h.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"提交成功!等待审核后将出现在 SkillHub 中。"}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-desc",children:"描述"}),h.jsx("textarea",{id:"share-desc",placeholder:"简要描述这个命令的用途...",value:i,onChange:m=>s(m.target.value),className:X("w-full rounded-md border border-input bg-background px-3 py-2","text-sm min-h-[80px] resize-none","ring-offset-background placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2")})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-author",children:"作者"}),h.jsx(Fn,{id:"share-author",placeholder:"你的名字",value:o,onChange:m=>a(m.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{htmlFor:"share-tags",children:"标签(逗号分隔)"}),h.jsx(Fn,{id:"share-tags",placeholder:"代码审查, 中文, 测试",value:l,onChange:m=>c(m.target.value)})]})]}),h.jsx(Gs,{children:p?h.jsx(ne,{onClick:()=>t(!1),children:"关闭"}):h.jsxs(h.Fragment,{children:[h.jsx(ne,{variant:"outline",onClick:()=>t(!1),children:"取消"}),h.jsx(ne,{onClick:g,disabled:u,children:u?"提交中...":"提交"})]})})]})})}function Dne({projectId:e,onSend:t}){const[n,r]=y.useState([]),[i,s]=y.useState([]),[o,a]=y.useState(!1),[l,c]=y.useState(null),[u,d]=y.useState(!1),[p,f]=y.useState(""),[g,m]=y.useState("");y.useEffect(()=>{E6(e).then(r).catch(()=>r([]))},[e]),y.useEffect(()=>{ML().then(s).catch(()=>s([]))},[]);const _=y.useCallback(E=>{const T=[],D=new Set;let A=E;const R=[];for(;A&&!D.has(A.id);)D.add(A.id),R.unshift(A),A=A.parentId?i.find(I=>I.id===A.parentId):void 0;for(const I of R)T.push(I.command);return T},[i]),b=y.useCallback(E=>{_(E).forEach((D,A)=>{setTimeout(()=>t(D+"\r"),A*500)})},[_,t]),v=()=>{c(null),a(!0)},S=(E,T)=>{T.stopPropagation(),c(E),a(!0)},w=async(E,T)=>{try{if(l){const D=await C6(e,l.id,{label:E,command:T});r(A=>A.map(R=>R.id===D.id?D:R))}else{const D=await k6(e,{label:E,command:T});r(A=>[...A,D])}}catch(D){console.error("Failed to save shortcut:",D)}c(null)},k=(E,T,D)=>{D.stopPropagation(),f(E),m(T),d(!0)},x=async(E,T)=>{T.stopPropagation();try{await T6(e,E),r(D=>D.filter(A=>A.id!==E))}catch(D){console.error("Failed to delete shortcut:",D)}};return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground select-none",children:[h.jsxs("div",{className:"flex items-center justify-between px-3 h-9 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Shortcuts"}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-foreground transition-colors",onClick:v,title:"New shortcut",children:h.jsx(Yo,{className:"h-3.5 w-3.5"})})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[i.length>0&&h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex items-center gap-1.5 px-1 pt-1 pb-0.5",children:[h.jsx(jd,{className:"h-3 w-3 text-muted-foreground"}),h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"全局"})]}),i.map(E=>{var D;const T=E.parentId?(D=i.find(A=>A.id===E.parentId))==null?void 0:D.label:void 0;return h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>b(E),title:T?`继承自「${T}」`:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-6 leading-snug",children:E.label}),T&&h.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[h.jsx(gl,{className:"h-2.5 w-2.5 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground truncate",children:["继承: ",T]})]}),!T&&E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug",children:E.command}),h.jsx("div",{className:"absolute top-1.5 right-1.5 opacity-0 group-hover:opacity-100 transition-opacity",children:h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:A=>k(E.label,E.command,A),title:"分享到 SkillHub",children:h.jsx(g1,{className:"h-3 w-3"})})})]},E.id)}),n.length>0&&h.jsx("div",{className:"flex items-center gap-1.5 px-1 pt-2 pb-0.5",children:h.jsx("span",{className:"text-xs text-muted-foreground uppercase tracking-wider",children:"项目"})})]}),n.length===0&&i.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(jd,{className:"h-5 w-5"}),h.jsxs("p",{className:"text-xs text-center leading-relaxed",children:["No shortcuts yet.",h.jsx("br",{}),"Click ",h.jsx("strong",{className:"text-muted-foreground",children:"+"})," to add one."]})]}),n.map(E=>h.jsxs("div",{className:X("group relative rounded px-3 py-2 cursor-pointer","bg-muted hover:bg-accent","border border-transparent hover:border-muted-foreground/30","transition-colors"),onClick:()=>t(E.command+"\r"),title:"Click to send",children:[h.jsx("div",{className:"text-xs font-medium text-foreground truncate pr-10 leading-snug",children:E.label}),E.label!==E.command&&h.jsx("div",{className:"text-xs text-muted-foreground font-mono truncate mt-0.5 leading-snug pr-10",children:E.command}),h.jsxs("div",{className:"absolute top-1.5 right-1.5 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:[h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-green-400 transition-colors",onClick:T=>k(E.label,E.command,T),title:"分享到 SkillHub",children:h.jsx(g1,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-blue-400 transition-colors",onClick:T=>S(E,T),title:"Edit shortcut",children:h.jsx(Fh,{className:"h-3 w-3"})}),h.jsx("button",{className:"p-0.5 rounded text-muted-foreground hover:text-red-400 transition-colors",onClick:T=>x(E.id,T),title:"Delete shortcut",children:h.jsx($s,{className:"h-3 w-3"})})]})]},E.id))]}),h.jsx(One,{open:o,onOpenChange:a,initialLabel:(l==null?void 0:l.label)??"",initialCommand:(l==null?void 0:l.command)??"",title:l?"Edit Shortcut":"New Shortcut",onSave:w}),h.jsx(Lne,{open:u,onOpenChange:d,label:p,command:g})]})}function XM(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function ZM(e){return`这是我们上一次的聊天记录,请你回忆:
|
|
551
551
|
|
|
552
552
|
${e.messages.map(n=>`[${n.role==="user"?"User":"Assistant"}]: ${n.content}`).join(`
|
|
553
553
|
|
|
554
|
-
`)}`}function Mne({session:e,onClose:t,onRecall:n}){return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),h.jsxs(Ke.div,{initial:{opacity:0,scale:.95,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:8},transition:{duration:.2,ease:"easeOut"},className:"relative z-10 w-[600px] max-w-[90vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-lg shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-sm font-medium text-foreground",children:XM(e.startedAt)}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white transition-colors",onClick:()=>{n(ZM(e)),t()},children:[h.jsx(Sv,{className:"h-3 w-3"}),"回忆"]}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground transition-colors p-0.5",onClick:t,children:h.jsx($s,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:[e.messages.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),e.messages.map((r,i)=>h.jsxs("div",{className:X("flex gap-2.5",r.role==="user"?"flex-row-reverse":"flex-row"),children:[h.jsx("div",{className:X("flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",r.role==="user"?"bg-blue-600/20":"bg-muted"),children:r.role==="user"?h.jsx(zL,{className:"h-3 w-3 text-blue-400"}):h.jsx(BL,{className:"h-3 w-3 text-muted-foreground"})}),h.jsx("div",{className:X("max-w-[85%] text-xs rounded-lg px-3 py-2 whitespace-pre-wrap break-words",r.role==="user"?"bg-blue-600/20 text-blue-100 dark:text-blue-100 border border-blue-500/20":"bg-muted text-foreground border border-border"),children:r.content})]},i))]})]})]})}function Pne({projectId:e,onSend:t}){var u;const[n,r]=y.useState([]),[i,s]=y.useState(null),o=n.filter(d=>d.messageCount>0),a=(u=o.find(d=>!d.isCurrent))==null?void 0:u.id;y.useEffect(()=>{let d=null;const p=()=>{document.hidden||c1(e).then(r).catch(()=>{})};c1(e).then(r).catch(()=>r([]));const f=()=>{d=setInterval(p,5e3)},g=()=>{d&&(clearInterval(d),d=null)},m=()=>{document.hidden?g():f()};return f(),document.addEventListener("visibilitychange",m),()=>{g(),document.removeEventListener("visibilitychange",m)}},[e]);const l=async d=>{try{s(await u1(e,d))}catch{}},c=d=>{t(d+"\r")};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[o.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(BL,{className:"h-5 w-5"}),h.jsx("p",{className:"text-xs text-center",children:"暂无历史记录"})]}),o.map(d=>{const p=d.isCurrent,f=!d.isCurrent&&d.id===a;return h.jsxs("div",{className:X("group rounded border bg-muted hover:border-muted-foreground/30 transition-colors",p?"border-blue-500/50":"border-border"),children:[h.jsxs("button",{className:"w-full text-left px-3 pt-2 pb-1",onClick:()=>void l(d.id),children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground",children:XM(d.startedAt)}),p&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-blue-500/20 text-blue-400 border border-blue-500/30 leading-none",children:"当前"}),f&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground border border-border leading-none",children:"最近"})]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[d.messageCount," 条消息"]})]}),h.jsx("div",{className:"px-3 pb-2 flex justify-end",children:h.jsxs("button",{className:"flex items-center gap-1 text-[10px] px-2 py-0.5 rounded bg-secondary hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:async g=>{g.stopPropagation();try{const m=await u1(e,d.id);c(ZM(m))}catch{}},children:[h.jsx(Sv,{className:"h-2.5 w-2.5"}),"回忆"]})})]},d.id)})]}),i&&h.jsx(Mne,{session:i,onClose:()=>s(null),onRecall:c})]})}const Fne={shortcuts:"快捷命令",history:"历史记录"};function Bne({projectId:e,onSend:t}){const[n,r]=y.useState("shortcuts");return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[h.jsx("div",{className:"flex border-b border-border flex-shrink-0",children:["shortcuts","history"].map(i=>h.jsx("button",{onClick:()=>r(i),className:X("flex-1 text-xs py-2 font-medium transition-colors",n===i?"text-foreground border-b-2 border-blue-500 -mb-px bg-muted/50":"text-muted-foreground hover:text-foreground"),children:Fne[i]},i))}),h.jsxs(Jn,{mode:"wait",children:[n==="shortcuts"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(Dne,{projectId:e,onSend:t})},"shortcuts"),n==="history"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(Pne,{projectId:e,onSend:t})},"history")]})]})}const jne=new Set(["preset:wind","preset:rain","preset:stream"]),Une=new Set(["preset:singing-bowl","preset:water-drops","preset:keyboard"]);function $ne(e){return e.playMode!=="auto"?e.playMode:jne.has(e.source)?"loop":Une.has(e.source)?"interval":"loop"}function zne({projectId:e,config:t,isActive:n}){const r=y.useRef(null),i=y.useRef(null),s=y.useRef(null),o=y.useRef(null),a=y.useRef(null),l=y.useRef(null),c=y.useRef(!1),u=y.useCallback(()=>{if(a.current&&(clearTimeout(a.current),a.current=null),l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.pause(),r.current.src=""),o.current){try{o.current.disconnect()}catch{}o.current=null}if(s.current){try{s.current.disconnect()}catch{}s.current=null}if(i.current){try{i.current.close()}catch{}i.current=null}r.current=null,c.current=!1},[]),d=y.useCallback(g=>{if(!r.current||r.current.src!==g){if(o.current){try{o.current.disconnect()}catch{}o.current=null}r.current&&r.current.pause();const m=new Audio(g);m.crossOrigin="anonymous",r.current=m}if(i.current||(i.current=new AudioContext),!s.current){const m=i.current.createGain();m.gain.value=0,m.connect(i.current.destination),s.current=m}if(!o.current){const m=i.current.createMediaElementSource(r.current);m.connect(s.current),o.current=m}return{audio:r.current,ctx:i.current,gain:s.current}},[]),p=y.useCallback(g=>{const m=p1(g.source,e),_=Math.max(0,Math.min(1,g.volume)),b=$ne(g),{audio:v,ctx:S,gain:w}=d(m);S.resume().then(()=>{if(a.current&&(clearTimeout(a.current),a.current=null),l.current&&(clearTimeout(l.current),l.current=null),b==="loop")v.loop=!0,v.currentTime=0,v.play().catch(()=>{}),c.current=!0,w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(_,S.currentTime+.5);else{v.loop=!1;const k=()=>{if(!c.current)return;v.currentTime=0,v.play().catch(()=>{}),w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(_,S.currentTime+.5);const x=()=>{if(!c.current)return;const[E,T]=g.intervalRange,D=(E+Math.random()*(T-E))*1e3;l.current=setTimeout(k,D)};v.onended=x};c.current=!0,k()}}).catch(()=>{})},[e,d]),f=y.useCallback(()=>{if(!r.current||!i.current||!s.current){c.current=!1;return}c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.onended=null);const g=i.current,m=s.current,_=r.current;m.gain.cancelScheduledValues(g.currentTime),m.gain.setValueAtTime(m.gain.value,g.currentTime),m.gain.linearRampToValueAtTime(0,g.currentTime+1),a.current=setTimeout(()=>{a.current=null,_&&_.pause()},1100)},[]);return y.useEffect(()=>{!t||!t.enabled||(n?p(t):f())},[n,t,p,f]),y.useEffect(()=>()=>{u()},[u]),y.useEffect(()=>{if(!t){u();return}if(r.current){const g=p1(t.source,e);if(r.current.src!==g){if(f(),o.current){try{o.current.disconnect()}catch{}o.current=null}r.current.pause(),r.current=null,n&&p(t)}}},[t==null?void 0:t.source,e]),null}function QM(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function JM(e){const[t,n]=y.useState(void 0);return Ut(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var dp="Switch",[Hne]=Wi(dp),[Vne,Gne]=Hne(dp),eP=y.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,f]=y.useState(null),g=Me(t,S=>f(S)),m=y.useRef(!1),_=p?u||!!p.closest("form"):!0,[b,v]=Rs({prop:i,defaultProp:s??!1,onChange:c,caller:dp});return h.jsxs(Vne,{scope:n,checked:b,disabled:a,children:[h.jsx(xe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":iP(b),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:g,onClick:ye(e.onClick,S=>{v(w=>!w),_&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),_&&h.jsx(rP,{control:p,bubbles:!m.current,name:r,value:l,checked:b,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});eP.displayName=dp;var tP="SwitchThumb",nP=y.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Gne(tP,n);return h.jsx(xe.span,{"data-state":iP(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});nP.displayName=tP;var Wne="SwitchBubbleInput",rP=y.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},s)=>{const o=y.useRef(null),a=Me(o,s),l=QM(n),c=JM(t);return y.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&f){const g=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(g)}},[l,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});rP.displayName=Wne;function iP(e){return e?"checked":"unchecked"}var sP=eP,qne=nP;const c0=y.forwardRef(({className:e,...t},n)=>h.jsx(sP,{className:X("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:h.jsx(qne,{className:X("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));c0.displayName=sP.displayName;function VA(e,[t,n]){return Math.min(n,Math.max(t,e))}function GA(e){const t=Kne(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(Xne);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function Kne(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=Qne(i),a=Zne(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yne=Symbol("radix.slottable");function Xne(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yne}function Zne(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Qne(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function oP(e){const t=e+"CollectionProvider",[n,r]=Wi(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:_,children:b}=m,v=wt.useRef(null),S=wt.useRef(new Map).current;return h.jsx(i,{scope:_,itemMap:S,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=GA(a),c=wt.forwardRef((m,_)=>{const{scope:b,children:v}=m,S=s(a,b),w=Me(_,S.collectionRef);return h.jsx(l,{ref:w,children:v})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=GA(u),f=wt.forwardRef((m,_)=>{const{scope:b,children:v,...S}=m,w=wt.useRef(null),k=Me(_,w),x=s(u,b);return wt.useEffect(()=>(x.itemMap.set(w,{ref:w,...S}),()=>void x.itemMap.delete(w))),h.jsx(p,{[d]:"",ref:k,children:v})});f.displayName=u;function g(m){const _=s(e+"CollectionConsumer",m);return wt.useCallback(()=>{const v=_.collectionRef.current;if(!v)return[];const S=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((x,E)=>S.indexOf(x.ref.current)-S.indexOf(E.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},g,r]}var Jne=y.createContext(void 0);function u0(e){const t=y.useContext(Jne);return e||t||"ltr"}const ere=["top","right","bottom","left"],ji=Math.min,mn=Math.max,eh=Math.round,yu=Math.floor,kr=e=>({x:e,y:e}),tre={left:"right",right:"left",bottom:"top",top:"bottom"};function Fb(e,t,n){return mn(e,ji(t,n))}function Kr(e,t){return typeof e=="function"?e(t):e}function Yr(e){return e.split("-")[0]}function Sa(e){return e.split("-")[1]}function d0(e){return e==="x"?"y":"x"}function h0(e){return e==="y"?"height":"width"}function vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function p0(e){return d0(vr(e))}function nre(e,t,n){n===void 0&&(n=!1);const r=Sa(e),i=p0(e),s=h0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=th(o)),[o,th(o)]}function rre(e){const t=th(e);return[Bb(e),t,Bb(t)]}function Bb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const WA=["left","right"],qA=["right","left"],ire=["top","bottom"],sre=["bottom","top"];function ore(e,t,n){switch(e){case"top":case"bottom":return n?t?qA:WA:t?WA:qA;case"left":case"right":return t?ire:sre;default:return[]}}function are(e,t,n,r){const i=Sa(e);let s=ore(Yr(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Bb)))),s}function th(e){const t=Yr(e);return tre[t]+e.slice(t.length)}function lre(e){return{top:0,right:0,bottom:0,left:0,...e}}function aP(e){return typeof e!="number"?lre(e):{top:e,right:e,bottom:e,left:e}}function nh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function KA(e,t,n){let{reference:r,floating:i}=e;const s=vr(t),o=p0(t),a=h0(o),l=Yr(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Sa(t)){case"start":f[o]-=p*(n&&c?-1:1);break;case"end":f[o]+=p*(n&&c?-1:1);break}return f}async function cre(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Kr(t,e),g=aP(f),_=a[p?d==="floating"?"reference":"floating":d],b=nh(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(_)))==null||n?_:_.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},k=nh(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:S,strategy:l}):v);return{top:(b.top-k.top+g.top)/w.y,bottom:(k.bottom-b.bottom+g.bottom)/w.y,left:(b.left-k.left+g.left)/w.x,right:(k.right-b.right+g.right)/w.x}}const ure=50,dre=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:cre},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=KA(c,r,l),p=r,f=0;const g={};for(let m=0;m<s.length;m++){const _=s[m];if(!_)continue;const{name:b,fn:v}=_,{x:S,y:w,data:k,reset:x}=await v({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=S??u,d=w??d,g[b]={...g[b],...k},x&&f<ure&&(f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=KA(c,p,l)),m=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:g}},hre=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Kr(e,t)||{};if(c==null)return{};const d=aP(u),p={x:n,y:r},f=p0(i),g=h0(f),m=await o.getDimensions(c),_=f==="y",b=_?"top":"left",v=_?"bottom":"right",S=_?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[f]-p[f]-s.floating[g],k=p[f]-s.reference[f],x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let E=x?x[S]:0;(!E||!await(o.isElement==null?void 0:o.isElement(x)))&&(E=a.floating[S]||s.floating[g]);const T=w/2-k/2,D=E/2-m[g]/2-1,A=ji(d[b],D),R=ji(d[v],D),I=A,L=E-m[g]-R,P=E/2-m[g]/2+T,F=Fb(I,P,L),B=!l.arrow&&Sa(i)!=null&&P!==F&&s.reference[g]/2-(P<I?A:R)-m[g]/2<0,U=B?P<I?P-I:P-L:0;return{[f]:p[f]+U,data:{[f]:F,centerOffset:P-F-U,...B&&{alignmentOffset:U}},reset:B}}}),pre=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,..._}=Kr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Yr(i),v=vr(a),S=Yr(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(S||!m?[th(a)]:rre(a)),x=g!=="none";!p&&x&&k.push(...are(a,m,g,w));const E=[a,...k],T=await l.detectOverflow(t,_),D=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&D.push(T[b]),d){const P=nre(i,o,w);D.push(T[P[0]],T[P[1]])}if(A=[...A,{placement:i,overflows:D}],!D.every(P=>P<=0)){var R,I;const P=(((R=s.flip)==null?void 0:R.index)||0)+1,F=E[P];if(F&&(!(d==="alignment"?v!==vr(F):!1)||A.every(O=>vr(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:P,overflows:A},reset:{placement:F}};let B=(I=A.filter(U=>U.overflows[0]<=0).sort((U,O)=>U.overflows[1]-O.overflows[1])[0])==null?void 0:I.placement;if(!B)switch(f){case"bestFit":{var L;const U=(L=A.filter(O=>{if(x){const j=vr(O.placement);return j===v||j==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(j=>j>0).reduce((j,C)=>j+C,0)]).sort((O,j)=>O[1]-j[1])[0])==null?void 0:L[0];U&&(B=U);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function YA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function XA(e){return ere.some(t=>e[t]>=0)}const fre=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Kr(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=YA(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:XA(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=YA(o,n.floating);return{data:{escapedOffsets:a,escaped:XA(a)}}}default:return{}}}}},lP=new Set(["left","top"]);async function gre(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Yr(n),a=Sa(n),l=vr(n)==="y",c=lP.has(o)?-1:1,u=s&&l?-1:1,d=Kr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}const mre=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await gre(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},bre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:S}=b;return{x:v,y:S}}},...c}=Kr(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),p=vr(Yr(i)),f=d0(p);let g=u[f],m=u[p];if(o){const b=f==="y"?"top":"left",v=f==="y"?"bottom":"right",S=g+d[b],w=g-d[v];g=Fb(S,g,w)}if(a){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",S=m+d[b],w=m-d[v];m=Fb(S,m,w)}const _=l.fn({...t,[f]:g,[p]:m});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[f]:o,[p]:a}}}}}},yre=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Kr(e,t),u={x:n,y:r},d=vr(i),p=d0(d);let f=u[p],g=u[d];const m=Kr(a,t),_=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const S=p==="y"?"height":"width",w=s.reference[p]-s.floating[S]+_.mainAxis,k=s.reference[p]+s.reference[S]-_.mainAxis;f<w?f=w:f>k&&(f=k)}if(c){var b,v;const S=p==="y"?"width":"height",w=lP.has(Yr(i)),k=s.reference[d]-s.floating[S]+(w&&((b=o.offset)==null?void 0:b[d])||0)+(w?0:_.crossAxis),x=s.reference[d]+s.reference[S]+(w?0:((v=o.offset)==null?void 0:v[d])||0)-(w?_.crossAxis:0);g<k?g=k:g>x&&(g=x)}return{[p]:f,[d]:g}}}},vre=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=Kr(e,t),u=await o.detectOverflow(t,c),d=Yr(i),p=Sa(i),f=vr(i)==="y",{width:g,height:m}=s.floating;let _,b;d==="top"||d==="bottom"?(_=d,b=p===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,_=p==="end"?"top":"bottom");const v=m-u.top-u.bottom,S=g-u.left-u.right,w=ji(m-u[_],v),k=ji(g-u[b],S),x=!t.middlewareData.shift;let E=w,T=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),x&&!p){const A=mn(u.left,0),R=mn(u.right,0),I=mn(u.top,0),L=mn(u.bottom,0);f?T=g-2*(A!==0||R!==0?A+R:mn(u.left,u.right)):E=m-2*(I!==0||L!==0?I+L:mn(u.top,u.bottom))}await l({...t,availableWidth:T,availableHeight:E});const D=await o.getDimensions(a.floating);return g!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function hp(){return typeof window<"u"}function wa(e){return cP(e)?(e.nodeName||"").toLowerCase():"#document"}function Sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nr(e){var t;return(t=(cP(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cP(e){return hp()?e instanceof Node||e instanceof Sn(e).Node:!1}function nr(e){return hp()?e instanceof Element||e instanceof Sn(e).Element:!1}function ti(e){return hp()?e instanceof HTMLElement||e instanceof Sn(e).HTMLElement:!1}function ZA(e){return!hp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Nc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=rr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function _re(e){return/^(table|td|th)$/.test(wa(e))}function pp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Sre=/transform|translate|scale|rotate|perspective|filter/,wre=/paint|layout|strict|content/,ts=e=>!!e&&e!=="none";let Jf;function f0(e){const t=nr(e)?rr(e):e;return ts(t.transform)||ts(t.translate)||ts(t.scale)||ts(t.rotate)||ts(t.perspective)||!g0()&&(ts(t.backdropFilter)||ts(t.filter))||Sre.test(t.willChange||"")||wre.test(t.contain||"")}function xre(e){let t=Ui(e);for(;ti(t)&&!Jo(t);){if(f0(t))return t;if(pp(t))return null;t=Ui(t)}return null}function g0(){return Jf==null&&(Jf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Jf}function Jo(e){return/^(html|body|#document)$/.test(wa(e))}function rr(e){return Sn(e).getComputedStyle(e)}function fp(e){return nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ui(e){if(wa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ZA(e)&&e.host||Nr(e);return ZA(t)?t.host:t}function uP(e){const t=Ui(e);return Jo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ti(t)&&Nc(t)?t:uP(t)}function rc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=uP(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Sn(i);if(s){const a=jb(o);return t.concat(o,o.visualViewport||[],Nc(i)?i:[],a&&n?rc(a):[])}else return t.concat(i,rc(i,[],n))}function jb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dP(e){const t=rr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ti(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=eh(n)!==s||eh(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function m0(e){return nr(e)?e:e.contextElement}function jo(e){const t=m0(e);if(!ti(t))return kr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=dP(t);let o=(s?eh(n.width):n.width)/r,a=(s?eh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ere=kr(0);function hP(e){const t=Sn(e);return!g0()||!t.visualViewport?Ere:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kre(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sn(e)?!1:t}function Ds(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=m0(e);let o=kr(1);t&&(r?nr(r)&&(o=jo(r)):o=jo(e));const a=kre(s,n,r)?hP(s):kr(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const p=Sn(s),f=r&&nr(r)?Sn(r):r;let g=p,m=jb(g);for(;m&&r&&f!==g;){const _=jo(m),b=m.getBoundingClientRect(),v=rr(m),S=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*_.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*_.y;l*=_.x,c*=_.y,u*=_.x,d*=_.y,l+=S,c+=w,g=Sn(m),m=jb(g)}}return nh({width:u,height:d,x:l,y:c})}function gp(e,t){const n=fp(e).scrollLeft;return t?t.left+n:Ds(Nr(e)).left+n}function pP(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gp(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Cre(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Nr(r),a=t?pp(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=kr(1);const u=kr(0),d=ti(r);if((d||!d&&!s)&&((wa(r)!=="body"||Nc(o))&&(l=fp(r)),d)){const f=Ds(r);c=jo(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const p=o&&!d&&!s?pP(o,l):kr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function Tre(e){return Array.from(e.getClientRects())}function Are(e){const t=Nr(e),n=fp(e),r=e.ownerDocument.body,i=mn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=mn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+gp(e);const a=-n.scrollTop;return rr(r).direction==="rtl"&&(o+=mn(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const QA=25;function Rre(e,t){const n=Sn(e),r=Nr(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=g0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=gp(r);if(c<=0){const u=r.ownerDocument,d=u.body,p=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-f);g<=QA&&(s-=g)}else c<=QA&&(s+=c);return{width:s,height:o,x:a,y:l}}function Nre(e,t){const n=Ds(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ti(e)?jo(e):kr(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function JA(e,t,n){let r;if(t==="viewport")r=Rre(e,n);else if(t==="document")r=Are(Nr(e));else if(nr(t))r=Nre(t,n);else{const i=hP(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return nh(r)}function fP(e,t){const n=Ui(e);return n===t||!nr(n)||Jo(n)?!1:rr(n).position==="fixed"||fP(n,t)}function Ire(e,t){const n=t.get(e);if(n)return n;let r=rc(e,[],!1).filter(a=>nr(a)&&wa(a)!=="body"),i=null;const s=rr(e).position==="fixed";let o=s?Ui(e):e;for(;nr(o)&&!Jo(o);){const a=rr(o),l=f0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Nc(o)&&!l&&fP(e,o))?r=r.filter(u=>u!==o):i=a,o=Ui(o)}return t.set(e,r),r}function Ore(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?pp(t)?[]:Ire(t,this._c):[].concat(n),r],a=JA(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let p=1;p<o.length;p++){const f=JA(t,o[p],i);l=mn(f.top,l),c=ji(f.right,c),u=ji(f.bottom,u),d=mn(f.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function Lre(e){const{width:t,height:n}=dP(e);return{width:t,height:n}}function Dre(e,t,n){const r=ti(t),i=Nr(t),s=n==="fixed",o=Ds(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=kr(0);function c(){l.x=gp(i)}if(r||!r&&!s)if((wa(t)!=="body"||Nc(i))&&(a=fp(t)),r){const f=Ds(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?pP(i,a):kr(0),d=o.left+a.scrollLeft-l.x-u.x,p=o.top+a.scrollTop-l.y-u.y;return{x:d,y:p,width:o.width,height:o.height}}function eg(e){return rr(e).position==="static"}function eR(e,t){if(!ti(e)||rr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nr(e)===n&&(n=n.ownerDocument.body),n}function gP(e,t){const n=Sn(e);if(pp(e))return n;if(!ti(e)){let i=Ui(e);for(;i&&!Jo(i);){if(nr(i)&&!eg(i))return i;i=Ui(i)}return n}let r=eR(e,t);for(;r&&_re(r)&&eg(r);)r=eR(r,t);return r&&Jo(r)&&eg(r)&&!f0(r)?n:r||xre(e)||n}const Mre=async function(e){const t=this.getOffsetParent||gP,n=this.getDimensions,r=await n(e.floating);return{reference:Dre(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pre(e){return rr(e).direction==="rtl"}const Fre={convertOffsetParentRelativeRectToViewportRelativeRect:Cre,getDocumentElement:Nr,getClippingRect:Ore,getOffsetParent:gP,getElementRects:Mre,getClientRects:Tre,getDimensions:Lre,getScale:jo,isElement:nr,isRTL:Pre};function mP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bre(e,t){let n=null,r;const i=Nr(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(a||t(),!p||!f)return;const g=yu(d),m=yu(i.clientWidth-(u+p)),_=yu(i.clientHeight-(d+f)),b=yu(u),S={rootMargin:-g+"px "+-m+"px "+-_+"px "+-b+"px",threshold:mn(0,ji(1,l))||1};let w=!0;function k(x){const E=x[0].intersectionRatio;if(E!==l){if(!w)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!mP(c,e.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(k,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,S)}n.observe(e)}return o(!0),s}function jre(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=m0(e),u=i||s?[...c?rc(c):[],...t?rc(t):[]]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const d=c&&a?Bre(c,n):null;let p=-1,f=null;o&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=f)==null||S.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let g,m=l?Ds(e):null;l&&_();function _(){const b=Ds(e);m&&!mP(m,b)&&n(),m=b,g=requestAnimationFrame(_)}return n(),()=>{var b;u.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const Ure=mre,$re=bre,zre=pre,Hre=vre,Vre=fre,tR=hre,Gre=yre,Wre=(e,t,n)=>{const r=new Map,i={platform:Fre,...n},s={...i.platform,_c:r};return dre(e,t,{...i,platform:s})};var qre=typeof document<"u",Kre=function(){},Ju=qre?y.useLayoutEffect:Kre;function rh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!rh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!rh(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function bP(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nR(e,t){const n=bP(e);return Math.round(t*n)/n}function tg(e){const t=y.useRef(e);return Ju(()=>{t.current=e}),t}function Yre(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=y.useState(r);rh(p,r)||f(r);const[g,m]=y.useState(null),[_,b]=y.useState(null),v=y.useCallback(O=>{O!==x.current&&(x.current=O,m(O))},[]),S=y.useCallback(O=>{O!==E.current&&(E.current=O,b(O))},[]),w=s||g,k=o||_,x=y.useRef(null),E=y.useRef(null),T=y.useRef(u),D=l!=null,A=tg(l),R=tg(i),I=tg(c),L=y.useCallback(()=>{if(!x.current||!E.current)return;const O={placement:t,strategy:n,middleware:p};R.current&&(O.platform=R.current),Wre(x.current,E.current,O).then(j=>{const C={...j,isPositioned:I.current!==!1};P.current&&!rh(T.current,C)&&(T.current=C,ia.flushSync(()=>{d(C)}))})},[p,t,n,R,I]);Ju(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[c]);const P=y.useRef(!1);Ju(()=>(P.current=!0,()=>{P.current=!1}),[]),Ju(()=>{if(w&&(x.current=w),k&&(E.current=k),w&&k){if(A.current)return A.current(w,k,L);L()}},[w,k,L,A,D]);const F=y.useMemo(()=>({reference:x,floating:E,setReference:v,setFloating:S}),[v,S]),B=y.useMemo(()=>({reference:w,floating:k}),[w,k]),U=y.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const j=nR(B.floating,u.x),C=nR(B.floating,u.y);return a?{...O,transform:"translate("+j+"px, "+C+"px)",...bP(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:C}},[n,a,B.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:L,refs:F,elements:B,floatingStyles:U}),[u,L,F,B,U])}const Xre=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?tR({element:r.current,padding:i}).fn(n):{}:r?tR({element:r,padding:i}).fn(n):{}}}},Zre=(e,t)=>{const n=Ure(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qre=(e,t)=>{const n=$re(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jre=(e,t)=>({fn:Gre(e).fn,options:[e,t]}),eie=(e,t)=>{const n=zre(e);return{name:n.name,fn:n.fn,options:[e,t]}},tie=(e,t)=>{const n=Hre(e);return{name:n.name,fn:n.fn,options:[e,t]}},nie=(e,t)=>{const n=Vre(e);return{name:n.name,fn:n.fn,options:[e,t]}},rie=(e,t)=>{const n=Xre(e);return{name:n.name,fn:n.fn,options:[e,t]}};var iie="Arrow",yP=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(xe.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});yP.displayName=iie;var sie=yP,b0="Popper",[vP,mp]=Wi(b0),[oie,_P]=vP(b0),SP=e=>{const{__scopePopper:t,children:n}=e,[r,i]=y.useState(null);return h.jsx(oie,{scope:t,anchor:r,onAnchorChange:i,children:n})};SP.displayName=b0;var wP="PopperAnchor",xP=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=_P(wP,n),o=y.useRef(null),a=Me(t,o),l=y.useRef(null);return y.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(xe.div,{...i,ref:a})});xP.displayName=wP;var y0="PopperContent",[aie,lie]=vP(y0),EP=y.forwardRef((e,t)=>{var G,ie,ae,ce,ue,pe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,_=_P(y0,n),[b,v]=y.useState(null),S=Me(t,le=>v(le)),[w,k]=y.useState(null),x=JM(w),E=(x==null?void 0:x.width)??0,T=(x==null?void 0:x.height)??0,D=r+(s!=="center"?"-"+s:""),A=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},R=Array.isArray(c)?c:[c],I=R.length>0,L={padding:A,boundary:R.filter(uie),altBoundary:I},{refs:P,floatingStyles:F,placement:B,isPositioned:U,middlewareData:O}=Yre({strategy:"fixed",placement:D,whileElementsMounted:(...le)=>jre(...le,{animationFrame:f==="always"}),elements:{reference:_.anchor},middleware:[Zre({mainAxis:i+T,alignmentAxis:o}),l&&Qre({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Jre():void 0,...L}),l&&eie({...L}),tie({...L,apply:({elements:le,rects:nt,availableWidth:sr,availableHeight:or})=>{const{width:kn,height:Zs}=nt.reference,Ir=le.floating.style;Ir.setProperty("--radix-popper-available-width",`${sr}px`),Ir.setProperty("--radix-popper-available-height",`${or}px`),Ir.setProperty("--radix-popper-anchor-width",`${kn}px`),Ir.setProperty("--radix-popper-anchor-height",`${Zs}px`)}}),w&&rie({element:w,padding:a}),die({arrowWidth:E,arrowHeight:T}),p&&nie({strategy:"referenceHidden",...L})]}),[j,C]=TP(B),z=Fi(g);Ut(()=>{U&&(z==null||z())},[U,z]);const Z=(G=O.arrow)==null?void 0:G.x,M=(ie=O.arrow)==null?void 0:ie.y,se=((ae=O.arrow)==null?void 0:ae.centerOffset)!==0,[be,$]=y.useState();return Ut(()=>{b&&$(window.getComputedStyle(b).zIndex)},[b]),h.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:U?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(ce=O.transformOrigin)==null?void 0:ce.x,(ue=O.transformOrigin)==null?void 0:ue.y].join(" "),...((pe=O.hide)==null?void 0:pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(aie,{scope:n,placedSide:j,onArrowChange:k,arrowX:Z,arrowY:M,shouldHideArrow:se,children:h.jsx(xe.div,{"data-side":j,"data-align":C,...m,ref:S,style:{...m.style,animation:U?void 0:"none"}})})})});EP.displayName=y0;var kP="PopperArrow",cie={top:"bottom",right:"left",bottom:"top",left:"right"},CP=y.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=lie(kP,r),o=cie[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(sie,{...i,ref:n,style:{...i.style,display:"block"}})})});CP.displayName=kP;function uie(e){return e!==null}var die=e=>({name:"transformOrigin",options:e,fn(t){var _,b,v;const{placement:n,rects:r,middlewareData:i}=t,o=((_=i.arrow)==null?void 0:_.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=TP(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(((b=i.arrow)==null?void 0:b.x)??0)+a/2,f=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=o?d:`${p}px`,m=`${-l}px`):c==="top"?(g=o?d:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=o?d:`${f}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=o?d:`${f}px`),{data:{x:g,y:m}}}});function TP(e){const[t,n="center"]=e.split("-");return[t,n]}var AP=SP,v0=xP,RP=EP,NP=CP;function hie(e){const t=pie(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(gie);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function pie(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=bie(i),a=mie(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fie=Symbol("radix.slottable");function gie(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fie}function mie(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function bie(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IP=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yie="VisuallyHidden",vie=y.forwardRef((e,t)=>h.jsx(xe.span,{...e,ref:t,style:{...IP,...e.style}}));vie.displayName=yie;var _ie=[" ","Enter","ArrowUp","ArrowDown"],Sie=[" ","Enter"],Ms="Select",[bp,yp,wie]=oP(Ms),[xa]=Wi(Ms,[wie,mp]),vp=mp(),[xie,Ki]=xa(Ms),[Eie,kie]=xa(Ms),OP=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:f,form:g}=e,m=vp(t),[_,b]=y.useState(null),[v,S]=y.useState(null),[w,k]=y.useState(!1),x=u0(c),[E,T]=Rs({prop:r,defaultProp:i??!1,onChange:s,caller:Ms}),[D,A]=Rs({prop:o,defaultProp:a,onChange:l,caller:Ms}),R=y.useRef(null),I=_?g||!!_.closest("form"):!0,[L,P]=y.useState(new Set),F=Array.from(L).map(B=>B.props.value).join(";");return h.jsx(AP,{...m,children:h.jsxs(xie,{required:f,scope:t,trigger:_,onTriggerChange:b,valueNode:v,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:k,contentId:Hr(),value:D,onValueChange:A,open:E,onOpenChange:T,dir:x,triggerPointerDownPosRef:R,disabled:p,children:[h.jsx(bp.Provider,{scope:t,children:h.jsx(Eie,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(B=>{P(U=>new Set(U).add(B))},[]),onNativeOptionRemove:y.useCallback(B=>{P(U=>{const O=new Set(U);return O.delete(B),O})},[]),children:n})}),I?h.jsxs(rF,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:B=>A(B.target.value),disabled:p,form:g,children:[D===void 0?h.jsx("option",{value:""}):null,Array.from(L)]},F):null]})})};OP.displayName=Ms;var LP="SelectTrigger",DP=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=vp(n),o=Ki(LP,n),a=o.disabled||r,l=Me(t,o.onTriggerChange),c=yp(n),u=y.useRef("touch"),[d,p,f]=sF(m=>{const _=c().filter(S=>!S.disabled),b=_.find(S=>S.value===o.value),v=oF(_,m,b);v!==void 0&&o.onValueChange(v.value)}),g=m=>{a||(o.onOpenChange(!0),f()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(v0,{asChild:!0,...s,children:h.jsx(xe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":iF(o.value)?"":void 0,...i,ref:l,onClick:ye(i.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&g(m)}),onPointerDown:ye(i.onPointerDown,m=>{u.current=m.pointerType;const _=m.target;_.hasPointerCapture(m.pointerId)&&_.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ye(i.onKeyDown,m=>{const _=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(_&&m.key===" ")&&_ie.includes(m.key)&&(g(),m.preventDefault())})})})});DP.displayName=LP;var MP="SelectValue",PP=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=e,l=Ki(MP,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=Me(t,l.onValueNodeChange);return Ut(()=>{c(u)},[c,u]),h.jsx(xe.span,{...a,ref:d,style:{pointerEvents:"none"},children:iF(l.value)?h.jsx(h.Fragment,{children:o}):s})});PP.displayName=MP;var Cie="SelectIcon",FP=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return h.jsx(xe.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});FP.displayName=Cie;var Tie="SelectPortal",BP=e=>h.jsx(Uh,{asChild:!0,...e});BP.displayName=Tie;var Ps="SelectContent",jP=y.forwardRef((e,t)=>{const n=Ki(Ps,e.__scopeSelect),[r,i]=y.useState();if(Ut(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ia.createPortal(h.jsx(UP,{scope:e.__scopeSelect,children:h.jsx(bp.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),s):null}return h.jsx($P,{...e,ref:t})});jP.displayName=Ps;var Wn=10,[UP,Yi]=xa(Ps),Aie="SelectContentImpl",Rie=hie("SelectContent.RemoveScroll"),$P=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:_,...b}=e,v=Ki(Ps,n),[S,w]=y.useState(null),[k,x]=y.useState(null),E=Me(t,G=>w(G)),[T,D]=y.useState(null),[A,R]=y.useState(null),I=yp(n),[L,P]=y.useState(!1),F=y.useRef(!1);y.useEffect(()=>{if(S)return Cv(S)},[S]),kv();const B=y.useCallback(G=>{const[ie,...ae]=I().map(pe=>pe.ref.current),[ce]=ae.slice(-1),ue=document.activeElement;for(const pe of G)if(pe===ue||(pe==null||pe.scrollIntoView({block:"nearest"}),pe===ie&&k&&(k.scrollTop=0),pe===ce&&k&&(k.scrollTop=k.scrollHeight),pe==null||pe.focus(),document.activeElement!==ue))return},[I,k]),U=y.useCallback(()=>B([T,S]),[B,T,S]);y.useEffect(()=>{L&&U()},[L,U]);const{onOpenChange:O,triggerPointerDownPosRef:j}=v;y.useEffect(()=>{if(S){let G={x:0,y:0};const ie=ce=>{var ue,pe;G={x:Math.abs(Math.round(ce.pageX)-(((ue=j.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((pe=j.current)==null?void 0:pe.y)??0))}},ae=ce=>{G.x<=10&&G.y<=10?ce.preventDefault():S.contains(ce.target)||O(!1),document.removeEventListener("pointermove",ie),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[S,O,j]),y.useEffect(()=>{const G=()=>O(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[O]);const[C,z]=sF(G=>{const ie=I().filter(ue=>!ue.disabled),ae=ie.find(ue=>ue.ref.current===document.activeElement),ce=oF(ie,G,ae);ce&&setTimeout(()=>ce.ref.current.focus())}),Z=y.useCallback((G,ie,ae)=>{const ce=!F.current&&!ae;(v.value!==void 0&&v.value===ie||ce)&&(D(G),ce&&(F.current=!0))},[v.value]),M=y.useCallback(()=>S==null?void 0:S.focus(),[S]),se=y.useCallback((G,ie,ae)=>{const ce=!F.current&&!ae;(v.value!==void 0&&v.value===ie||ce)&&R(G)},[v.value]),be=r==="popper"?Ub:zP,$=be===Ub?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:_}:{};return h.jsx(UP,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:Z,selectedItem:T,onItemLeave:M,itemTextRefCallback:se,focusSelectedItem:U,selectedItemText:A,position:r,isPositioned:L,searchRef:C,children:h.jsx(zh,{as:Rie,allowPinchZoom:!0,children:h.jsx(jh,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ye(i,G=>{var ie;(ie=v.trigger)==null||ie.focus({preventScroll:!0}),G.preventDefault()}),children:h.jsx(Bh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:h.jsx(be,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...b,...$,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ye(b.onKeyDown,G=>{const ie=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!ie&&G.key.length===1&&z(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let ce=I().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(G.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ue=G.target,pe=ce.indexOf(ue);ce=ce.slice(pe+1)}setTimeout(()=>B(ce)),G.preventDefault()}})})})})})})});$P.displayName=Aie;var Nie="SelectItemAlignedPosition",zP=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=Ki(Ps,n),o=Yi(Ps,n),[a,l]=y.useState(null),[c,u]=y.useState(null),d=Me(t,E=>u(E)),p=yp(n),f=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:_,selectedItemText:b,focusSelectedItem:v}=o,S=y.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&m&&_&&b){const E=s.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(s.dir!=="rtl"){const ue=A.left-T.left,pe=D.left-ue,le=E.left-pe,nt=E.width+le,sr=Math.max(nt,T.width),or=window.innerWidth-Wn,kn=VA(pe,[Wn,Math.max(Wn,or-sr)]);a.style.minWidth=nt+"px",a.style.left=kn+"px"}else{const ue=T.right-A.right,pe=window.innerWidth-D.right-ue,le=window.innerWidth-E.right-pe,nt=E.width+le,sr=Math.max(nt,T.width),or=window.innerWidth-Wn,kn=VA(pe,[Wn,Math.max(Wn,or-sr)]);a.style.minWidth=nt+"px",a.style.right=kn+"px"}const R=p(),I=window.innerHeight-Wn*2,L=m.scrollHeight,P=window.getComputedStyle(c),F=parseInt(P.borderTopWidth,10),B=parseInt(P.paddingTop,10),U=parseInt(P.borderBottomWidth,10),O=parseInt(P.paddingBottom,10),j=F+B+L+O+U,C=Math.min(_.offsetHeight*5,j),z=window.getComputedStyle(m),Z=parseInt(z.paddingTop,10),M=parseInt(z.paddingBottom,10),se=E.top+E.height/2-Wn,be=I-se,$=_.offsetHeight/2,G=_.offsetTop+$,ie=F+B+G,ae=j-ie;if(ie<=se){const ue=R.length>0&&_===R[R.length-1].ref.current;a.style.bottom="0px";const pe=c.clientHeight-m.offsetTop-m.offsetHeight,le=Math.max(be,$+(ue?M:0)+pe+U),nt=ie+le;a.style.height=nt+"px"}else{const ue=R.length>0&&_===R[0].ref.current;a.style.top="0px";const le=Math.max(se,F+m.offsetTop+(ue?Z:0)+$)+ae;a.style.height=le+"px",m.scrollTop=ie-se+m.offsetTop}a.style.margin=`${Wn}px 0`,a.style.minHeight=C+"px",a.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,a,c,m,_,b,s.dir,r]);Ut(()=>S(),[S]);const[w,k]=y.useState();Ut(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=y.useCallback(E=>{E&&g.current===!0&&(S(),v==null||v(),g.current=!1)},[S,v]);return h.jsx(Oie,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:x,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:h.jsx(xe.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});zP.displayName=Nie;var Iie="SelectPopperPosition",Ub=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Wn,...s}=e,o=vp(n);return h.jsx(RP,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ub.displayName=Iie;var[Oie,_0]=xa(Ps,{}),$b="SelectViewport",HP=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=Yi($b,n),o=_0($b,n),a=Me(t,s.onViewportChange),l=y.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(bp.Slot,{scope:n,children:h.jsx(xe.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ye(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=o;if(p!=null&&p.current&&d){const f=Math.abs(l.current-u.scrollTop);if(f>0){const g=window.innerHeight-Wn*2,m=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),b=Math.max(m,_);if(b<g){const v=b+f,S=Math.min(g,v),w=v-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});HP.displayName=$b;var VP="SelectGroup",[Lie,Die]=xa(VP),GP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Hr();return h.jsx(Lie,{scope:n,id:i,children:h.jsx(xe.div,{role:"group","aria-labelledby":i,...r,ref:t})})});GP.displayName=VP;var WP="SelectLabel",qP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Die(WP,n);return h.jsx(xe.div,{id:i.id,...r,ref:t})});qP.displayName=WP;var ih="SelectItem",[Mie,KP]=xa(ih),YP=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,a=Ki(ih,n),l=Yi(ih,n),c=a.value===r,[u,d]=y.useState(s??""),[p,f]=y.useState(!1),g=Me(t,v=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,v,r,i)}),m=Hr(),_=y.useRef("touch"),b=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(Mie,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:y.useCallback(v=>{d(S=>S||((v==null?void 0:v.textContent)??"").trim())},[]),children:h.jsx(bp.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:h.jsx(xe.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:ye(o.onFocus,()=>f(!0)),onBlur:ye(o.onBlur,()=>f(!1)),onClick:ye(o.onClick,()=>{_.current!=="mouse"&&b()}),onPointerUp:ye(o.onPointerUp,()=>{_.current==="mouse"&&b()}),onPointerDown:ye(o.onPointerDown,v=>{_.current=v.pointerType}),onPointerMove:ye(o.onPointerMove,v=>{var S;_.current=v.pointerType,i?(S=l.onItemLeave)==null||S.call(l):_.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(o.onPointerLeave,v=>{var S;v.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ye(o.onKeyDown,v=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(Sie.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});YP.displayName=ih;var tl="SelectItemText",XP=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=Ki(tl,n),a=Yi(tl,n),l=KP(tl,n),c=kie(tl,n),[u,d]=y.useState(null),p=Me(t,b=>d(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),f=u==null?void 0:u.textContent,g=y.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:_}=c;return Ut(()=>(m(g),()=>_(g)),[m,_,g]),h.jsxs(h.Fragment,{children:[h.jsx(xe.span,{id:l.textId,...s,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ia.createPortal(s.children,o.valueNode):null]})});XP.displayName=tl;var ZP="SelectItemIndicator",QP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return KP(ZP,n).isSelected?h.jsx(xe.span,{"aria-hidden":!0,...r,ref:t}):null});QP.displayName=ZP;var zb="SelectScrollUpButton",JP=y.forwardRef((e,t)=>{const n=Yi(zb,e.__scopeSelect),r=_0(zb,e.__scopeSelect),[i,s]=y.useState(!1),o=Me(t,r.onScrollButtonChange);return Ut(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?h.jsx(tF,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});JP.displayName=zb;var Hb="SelectScrollDownButton",eF=y.forwardRef((e,t)=>{const n=Yi(Hb,e.__scopeSelect),r=_0(Hb,e.__scopeSelect),[i,s]=y.useState(!1),o=Me(t,r.onScrollButtonChange);return Ut(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?h.jsx(tF,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});eF.displayName=Hb;var tF=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Yi("SelectScrollButton",n),o=y.useRef(null),a=yp(n),l=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),Ut(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),h.jsx(xe.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ye(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ye(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ye(i.onPointerLeave,()=>{l()})})}),Pie="SelectSeparator",nF=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(xe.div,{"aria-hidden":!0,...r,ref:t})});nF.displayName=Pie;var Vb="SelectArrow",Fie=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=vp(n),s=Ki(Vb,n),o=Yi(Vb,n);return s.open&&o.position==="popper"?h.jsx(NP,{...i,...r,ref:t}):null});Fie.displayName=Vb;var Bie="SelectBubbleInput",rF=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=y.useRef(null),s=Me(r,i),o=QM(t);return y.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[o,t]),h.jsx(xe.select,{...n,style:{...IP,...n.style},ref:s,defaultValue:t})});rF.displayName=Bie;function iF(e){return e===""||e===void 0}function sF(e){const t=Fi(e),n=y.useRef(""),r=y.useRef(0),i=y.useCallback(o=>{const a=n.current+o;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function oF(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=jie(e,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function jie(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uie=OP,aF=DP,$ie=PP,zie=FP,Hie=BP,lF=jP,Vie=HP,Gie=GP,cF=qP,uF=YP,Wie=XP,qie=QP,dF=JP,hF=eF,pF=nF;const sh=Uie,ng=Gie,oh=$ie,ic=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(aF,{ref:r,className:X("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(zie,{asChild:!0,children:h.jsx(Mh,{className:"h-4 w-4 opacity-50"})})]}));ic.displayName=aF.displayName;const fF=y.forwardRef(({className:e,...t},n)=>h.jsx(dF,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(tV,{className:"h-4 w-4"})}));fF.displayName=dF.displayName;const gF=y.forwardRef(({className:e,...t},n)=>h.jsx(hF,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Mh,{className:"h-4 w-4"})}));gF.displayName=hF.displayName;const sc=y.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Hie,{children:h.jsxs(lF,{ref:i,className:X("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(fF,{}),h.jsx(Vie,{className:X("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(gF,{})]})}));sc.displayName=lF.displayName;const ed=y.forwardRef(({className:e,...t},n)=>h.jsx(cF,{ref:n,className:X("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ed.displayName=cF.displayName;const Rn=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(uF,{ref:r,className:X("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(qie,{children:h.jsx(jL,{className:"h-4 w-4"})})}),h.jsx(Wie,{children:t})]}));Rn.displayName=uF.displayName;const Kie=y.forwardRef(({className:e,...t},n)=>h.jsx(pF,{ref:n,className:X("-mx-1 my-1 h-px bg-muted",e),...t}));Kie.displayName=pF.displayName;function Yie(e){const t=Xie(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(Qie);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function Xie(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=ese(i),a=Jie(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zie=Symbol("radix.slottable");function Qie(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zie}function Jie(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function ese(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _p="Popover",[mF]=Wi(_p,[mp]),Ic=mp(),[tse,Xi]=mF(_p),bF=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=Ic(t),l=y.useRef(null),[c,u]=y.useState(!1),[d,p]=Rs({prop:r,defaultProp:i??!1,onChange:s,caller:_p});return h.jsx(AP,{...a,children:h.jsx(tse,{scope:t,contentId:Hr(),triggerRef:l,open:d,onOpenChange:p,onOpenToggle:y.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})};bF.displayName=_p;var yF="PopoverAnchor",nse=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(yF,n),s=Ic(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return y.useEffect(()=>(o(),()=>a()),[o,a]),h.jsx(v0,{...s,...r,ref:t})});nse.displayName=yF;var vF="PopoverTrigger",_F=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(vF,n),s=Ic(n),o=Me(t,i.triggerRef),a=h.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":kF(i.open),...r,ref:o,onClick:ye(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:h.jsx(v0,{asChild:!0,...s,children:a})});_F.displayName=vF;var S0="PopoverPortal",[rse,ise]=mF(S0,{forceMount:void 0}),SF=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Xi(S0,t);return h.jsx(rse,{scope:t,forceMount:n,children:h.jsx(zs,{present:n||s.open,children:h.jsx(Uh,{asChild:!0,container:i,children:r})})})};SF.displayName=S0;var ea="PopoverContent",wF=y.forwardRef((e,t)=>{const n=ise(ea,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Xi(ea,e.__scopePopover);return h.jsx(zs,{present:r||s.open,children:s.modal?h.jsx(ose,{...i,ref:t}):h.jsx(ase,{...i,ref:t})})});wF.displayName=ea;var sse=Yie("PopoverContent.RemoveScroll"),ose=y.forwardRef((e,t)=>{const n=Xi(ea,e.__scopePopover),r=y.useRef(null),i=Me(t,r),s=y.useRef(!1);return y.useEffect(()=>{const o=r.current;if(o)return Cv(o)},[]),h.jsx(zh,{as:sse,allowPinchZoom:!0,children:h.jsx(xF,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ye(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),ase=y.forwardRef((e,t)=>{const n=Xi(ea,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return h.jsx(xF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),xF=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,p=Xi(ea,n),f=Ic(n);return kv(),h.jsx(jh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Bh,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:h.jsx(RP,{"data-state":kF(p.open),role:"dialog",id:p.contentId,...f,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),EF="PopoverClose",lse=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(EF,n);return h.jsx(xe.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>i.onOpenChange(!1))})});lse.displayName=EF;var cse="PopoverArrow",use=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ic(n);return h.jsx(NP,{...i,...r,ref:t})});use.displayName=cse;function kF(e){return e?"open":"closed"}var dse=bF,hse=_F,pse=SF,CF=wF;const fse=dse,gse=hse,TF=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(pse,{children:h.jsx(CF,{ref:i,align:t,sideOffset:n,className:X("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));TF.displayName=CF.displayName;function mse({projectId:e,config:t,onChange:n}){var k;const[r,i]=y.useState([]),[s,o]=y.useState([]),[a,l]=y.useState(null),[c,u]=y.useState(!1),d=y.useRef(null);y.useEffect(()=>{V6().then(i).catch(console.error),pf(e).then(o).catch(console.error)},[e]);const p=x=>{n({...t,...x})},f=async x=>{if(x.startsWith("preset:")){const E=x.replace("preset:",""),T=r.find(D=>D.id===E);if(T&&!T.downloaded){l(E);try{await G6(E),i(A=>A.map(R=>R.id===E?{...R,downloaded:!0}:R));const D=await pf(e);o(D)}catch(D){console.error("Failed to download preset:",D),l(null);return}l(null)}}p({source:x})},g=async x=>{const E=d.current;E&&(E.dataset.scope=x,E.click())},m=async x=>{var D;const E=(D=x.target.files)==null?void 0:D[0];if(!E)return;const T=x.target.dataset.scope||"global";u(!0);try{const{name:A}=await W6(E,T,e),R=await pf(e);o(R),p({source:`${T==="project"?"project":"global"}:${A}`})}catch(A){console.error("Upload failed:",A)}finally{u(!1),x.target.value=""}},_=s.filter(x=>x.source.startsWith("preset:")),b=s.filter(x=>x.source.startsWith("global:")),v=s.filter(x=>x.source.startsWith("project:")),S=r.filter(x=>!x.downloaded&&!_.some(E=>E.source===`preset:${x.id}`)),w=t.playMode==="interval"||t.playMode==="auto"&&((k=r.find(x=>`preset:${x.id}`===t.source))==null?void 0:k.type)==="strike";return h.jsxs(fse,{children:[h.jsx(gse,{asChild:!0,children:h.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",children:h.jsx(fV,{className:`h-4 w-4 ${t.enabled?"text-primary":""}`})})}),h.jsx(TF,{className:"w-[300px]",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(ze,{className:"text-sm font-medium",children:"背景音效"}),h.jsx(c0,{checked:t.enabled,onCheckedChange:x=>p({enabled:x})})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"音源"}),h.jsxs(sh,{value:t.source,onValueChange:f,children:[h.jsx(ic,{className:"h-8 text-xs",children:h.jsx(oh,{placeholder:"选择音源"})}),h.jsxs(sc,{children:[(_.length>0||S.length>0)&&h.jsxs(ng,{children:[h.jsx(ed,{children:"预设音效"}),_.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source)),S.map(x=>h.jsx(Rn,{value:`preset:${x.id}`,className:"text-xs",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[x.name,a===x.id?h.jsx(ml,{className:"h-3 w-3 animate-spin"}):h.jsx(Bd,{className:"h-3 w-3 text-muted-foreground"})]})},`preset:${x.id}`))]}),b.length>0&&h.jsxs(ng,{children:[h.jsx(ed,{children:"全局自定义"}),b.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source))]}),v.length>0&&h.jsxs(ng,{children:[h.jsx(ed,{children:"项目自定义"}),v.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source))]})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"播放模式"}),h.jsxs(sh,{value:t.playMode,onValueChange:x=>p({playMode:x}),children:[h.jsx(ic,{className:"h-8 text-xs",children:h.jsx(oh,{})}),h.jsxs(sc,{children:[h.jsx(Rn,{value:"auto",className:"text-xs",children:"自动"}),h.jsx(Rn,{value:"loop",className:"text-xs",children:"循环"}),h.jsx(Rn,{value:"interval",className:"text-xs",children:"随机间隔"})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs(ze,{className:"text-xs text-muted-foreground",children:["音量: ",Math.round(t.volume*100),"%"]}),h.jsx("input",{type:"range",min:0,max:100,value:Math.round(t.volume*100),onChange:x=>p({volume:Number(x.target.value)/100}),className:"w-full h-1.5 accent-primary cursor-pointer"})]}),w&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"间隔范围(秒)"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"number",min:1,value:t.intervalRange[0],onChange:x=>p({intervalRange:[Number(x.target.value),t.intervalRange[1]]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"~"}),h.jsx("input",{type:"number",min:1,value:t.intervalRange[1],onChange:x=>p({intervalRange:[t.intervalRange[0],Number(x.target.value)]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"})]})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("global"),children:[c?h.jsx(ml,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(Im,{className:"h-3 w-3 mr-1"}),"上传全局"]}),h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("project"),children:[c?h.jsx(ml,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(Im,{className:"h-3 w-3 mr-1"}),"上传项目"]})]}),h.jsx("input",{ref:d,type:"file",accept:"audio/*",className:"hidden",onChange:m})]})})]})}const bse=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,yse=5,vse=3e3;function _se(e,t){const n=y.useRef(null),r=y.useRef(0),i=y.useRef(!0),s=y.useRef(t);s.current=t;const o=y.useRef(!1),a=y.useCallback(f=>{var g;((g=n.current)==null?void 0:g.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(f))},[]),l=y.useCallback((f,g)=>{var m;((m=n.current)==null?void 0:m.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:f,rows:g})),o.current=!1):o.current=!0},[]),c=y.useCallback(f=>{a({type:"terminal_input",data:f})},[a]),u=y.useCallback((f,g)=>{a({type:"terminal_resize",cols:f,rows:g})},[a]),d=y.useCallback(()=>{a({type:"chat_subscribe"})},[a]),p=y.useCallback(()=>{if(!i.current)return;const f=Zr();if(!f){window.location.href="/login";return}const g=new WebSocket(`${bse}/ws/projects/${e}`);n.current=g,g.onopen=()=>{r.current=0,g.send(JSON.stringify({type:"auth",token:f}))},g.onmessage=m=>{var b,v,S,w,k,x,E,T;let _;try{_=JSON.parse(m.data)}catch{return}switch(_.type){case"connected":o.current=!1,(v=(b=s.current).onConnected)==null||v.call(b);break;case"terminal_data":(w=(S=s.current).onTerminalData)==null||w.call(S,_.data);break;case"status":(x=(k=s.current).onStatus)==null||x.call(k,_.status);break;case"chat_message":{const D=_;(T=(E=s.current).onChatMessage)==null||T.call(E,D);break}case"error":console.error("[WS] Server error:",_.message);break}},g.onclose=()=>{n.current=null,i.current&&r.current<yse&&(r.current++,setTimeout(p,vse))},g.onerror=m=>{console.error("[WS] WebSocket error:",m)}},[e]);return y.useEffect(()=>(i.current=!0,p(),()=>{var f;i.current=!1,(f=n.current)==null||f.close(),n.current=null}),[p]),{subscribeTerminal:l,sendTerminalInput:c,sendTerminalResize:u,subscribeChatMessages:d}}function rg({icon:e,label:t,content:n}){const[r,i]=y.useState(!1);return h.jsxs("div",{className:"border border-border rounded mt-1.5",children:[h.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(s=>!s),children:[h.jsx(Ph,{className:X("h-3 w-3 transition-transform",r&&"rotate-90")}),h.jsx(e,{className:"h-3 w-3"}),h.jsx("span",{className:"truncate",children:t})]}),h.jsx(Jn,{children:r&&h.jsx(Ke.pre,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})})]})}function Sse({blocks:e}){return h.jsx(h.Fragment,{children:e.map((t,n)=>t.type==="text"?h.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:h.jsx(tM,{remarkPlugins:[kM],children:t.content})},n):t.type==="thinking"?h.jsx(rg,{icon:Sv,label:"Thinking...",content:t.content},n):t.type==="tool_use"?h.jsx(rg,{icon:AV,label:t.content.split("(")[0],content:t.content},n):t.type==="tool_result"?h.jsx(rg,{icon:iV,label:"Result",content:t.content},n):null)})}function wse({messages:e,onSend:t,readOnly:n}){const[r,i]=y.useState(""),s=y.useRef(null),o=y.useRef(null);y.useEffect(()=>{var u;(u=s.current)==null||u.scrollIntoView({behavior:"smooth"})},[e.length]);const a=()=>{const u=r.trim();u&&(t(u+"\r"),i(""),o.current&&(o.current.style.height="auto"))},l=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),a())},c=u=>{u.style.height="auto",u.style.height=Math.min(u.scrollHeight,120)+"px"};return h.jsxs("div",{className:"flex flex-col h-full bg-background",children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[e.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"等待对话..."}),e.map((u,d)=>h.jsx(Ke.div,{initial:{opacity:0,y:10,x:u.role==="user"?12:-12},animate:{opacity:1,y:0,x:0},transition:{duration:.25,ease:"easeOut"},className:X("flex",u.role==="user"?"justify-end":"justify-start"),children:h.jsxs("div",{className:X("max-w-[85%] rounded-lg px-3 py-2 text-sm",u.role==="user"?"bg-blue-100 text-blue-900 dark:bg-blue-600 dark:text-white":"bg-muted"),children:[h.jsx(Sse,{blocks:u.blocks}),h.jsx("div",{className:"text-[10px] opacity-50 mt-1",children:new Date(u.timestamp).toLocaleTimeString()})]})},d)),h.jsx("div",{ref:s})]}),!n&&h.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end flex-shrink-0",children:[h.jsx("textarea",{ref:o,value:r,onChange:u=>{i(u.target.value),c(u.target)},onKeyDown:l,placeholder:"输入消息...",rows:1,className:"flex-1 resize-none bg-muted rounded-md px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring",style:{maxHeight:"120px"}}),h.jsx(Ke.button,{onClick:a,disabled:!r.trim(),whileTap:{scale:.93},className:"p-2 rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex-shrink-0",children:h.jsx(_V,{className:"h-4 w-4"})})]})]})}function xse({status:e}){const t={running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"};return h.jsxs("span",{className:X("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",t[e]),children:[h.jsx("span",{className:X("w-1.5 h-1.5 rounded-full",{"bg-green-500":e==="running","bg-muted-foreground":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function Ese(){const{id:e}=tU(),t=js(),[n,r]=y.useState(null),[i,s]=y.useState(!0),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[u,d]=y.useState({enabled:!1,source:"preset:rain",playMode:"auto",volume:.5,intervalRange:[3,8]}),[p,f]=y.useState(!1),g=y.useRef(null),[m,_]=y.useState(()=>{try{return localStorage.getItem(`cc_viewmode_${e}`)==="chat"?"chat":"terminal"}catch{return"terminal"}}),[b,v]=y.useState([]),S=async()=>{if(e){c(!0);try{await j6(e)}catch($){alert($ instanceof Error?$.message:"备份失败")}finally{c(!1)}}},[w,k]=y.useState(()=>{try{return localStorage.getItem("cc_panel_filetree")!=="false"}catch{return!0}}),[x,E]=y.useState(()=>{try{return localStorage.getItem("cc_panel_shortcuts")!=="false"}catch{return!0}}),T=()=>k($=>(localStorage.setItem("cc_panel_filetree",String(!$)),!$)),D=()=>E($=>(localStorage.setItem("cc_panel_shortcuts",String(!$)),!$)),[A,R]=y.useState(!1);y.useEffect(()=>{const $=()=>R(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$),()=>document.removeEventListener("fullscreenchange",$)},[]);const I=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},L=y.useRef(null),P=y.useRef(null),F=y.useRef(null),B=y.useRef(null),U=y.useCallback($=>{var G;(G=L.current)==null||G.write($),f(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>f(!1),3e3)},[]),O=y.useCallback(()=>{var G;const $=P.current;$&&F.current&&F.current($.cols,$.rows),(G=B.current)==null||G.call(B)},[]),{subscribeTerminal:j,sendTerminalInput:C,sendTerminalResize:z,subscribeChatMessages:Z}=_se(e??"",{onTerminalData:U,onStatus:$=>r(G=>G&&{...G,status:$}),onConnected:()=>{v([]),O()},onChatMessage:$=>{v(G=>[...G,$])}});y.useEffect(()=>{F.current=j},[j]),y.useEffect(()=>{B.current=Z},[Z]);const M=y.useCallback(($,G)=>{P.current={cols:$,rows:G},O()},[O]);y.useEffect(()=>{if(!e)return;(async()=>{try{const ie=(await DL()).find(ae=>ae.id===e)??null;r(ie),ie!=null&&ie.sound&&d(ie.sound)}catch(G){console.error("Failed to load project:",G)}finally{s(!1)}})()},[e]);const se=async()=>{if(n){a(!0);try{r(await m6(n.id))}catch($){console.error($)}finally{a(!1)}}},be=async()=>{if(n){a(!0);try{r(await b6(n.id))}catch($){console.error($)}finally{a(!1)}}};return i?h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})}):!n||!e?h.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background",children:[h.jsx("p",{className:"text-muted-foreground",children:"Project not found."}),h.jsxs(ne,{variant:"outline",onClick:()=>t("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-2"}),"Back to Dashboard"]})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[h.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:h.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>t("/"),children:h.jsx(Gl,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",w?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:T,title:"Toggle file tree",children:h.jsx(mV,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",x?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:D,title:"Toggle right panel",children:h.jsx(bV,{className:"h-4 w-4"})}),h.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-1",children:[h.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:n.name}),h.jsx(xse,{status:n.status}),h.jsx(gr,{variant:"outline",className:"text-xs",children:n.permissionMode==="unlimited"?"Unlimited":"Limited"}),h.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:n.folderPath})]}),h.jsx(xD,{className:"mr-2"}),h.jsx(kD,{}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:I,title:A?"退出全屏":"全屏",children:A?h.jsx(xv,{className:"h-3.5 w-3.5"}):h.jsx(wv,{className:"h-3.5 w-3.5"})}),e&&h.jsx(mse,{projectId:e,config:u,onChange:$=>{d($),q6(e,$)}}),h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void S(),disabled:l,title:"备份到云盘",children:[l?h.jsx(ml,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):h.jsx(TV,{className:"h-3.5 w-3.5 mr-1.5"}),"备份"]}),n.status==="running"||n.status==="restarting"?h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void se(),disabled:o,children:[h.jsx(EV,{className:"h-3.5 w-3.5 mr-1.5"}),"Stop"]}):h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void be(),disabled:o,children:[h.jsx(yV,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})}),h.jsxs("div",{className:"flex-1 overflow-hidden flex min-h-0",children:[h.jsx(Jn,{initial:!1,children:w&&h.jsx(Ke.div,{initial:{width:0,opacity:0},animate:{width:224,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"flex-shrink-0 border-r border-border overflow-hidden",children:h.jsx(Ine,{projectPath:n.folderPath})})}),h.jsxs("div",{className:"flex-1 overflow-hidden min-w-0 flex flex-col",children:[h.jsxs("div",{className:"flex items-center border-b border-border bg-muted/30 px-2 h-8 flex-shrink-0",children:[h.jsxs("button",{onClick:()=>{_("terminal");try{localStorage.setItem(`cc_viewmode_${e}`,"terminal")}catch{}},className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="terminal"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(Nm,{className:"h-3 w-3"}),"终端"]}),h.jsxs("button",{onClick:()=>{_("chat");try{localStorage.setItem(`cc_viewmode_${e}`,"chat")}catch{}},className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="chat"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(dV,{className:"h-3 w-3"}),"对话"]})]}),h.jsx("div",{className:X("flex-1 min-h-0",m!=="terminal"&&"hidden"),children:h.jsx(m2,{ref:L,onInput:C,onResize:($,G)=>{P.current={cols:$,rows:G},z($,G)},onReady:M})}),h.jsx(Jn,{children:m==="chat"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(wse,{messages:b,onSend:C,readOnly:(n==null?void 0:n._sharedPermission)==="view"})})})]}),h.jsx(Jn,{initial:!1,children:x&&h.jsx(Ke.div,{initial:{width:0,opacity:0},animate:{width:208,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"flex-shrink-0 border-l border-border overflow-hidden",children:h.jsx(Bne,{projectId:e,onSend:C})})})]}),e&&h.jsx(zne,{projectId:e,config:u,isActive:p})]})}var ig="rovingFocusGroup.onEntryFocus",kse={bubbles:!1,cancelable:!0},Oc="RovingFocusGroup",[Gb,AF,Cse]=oP(Oc),[Tse,RF]=Wi(Oc,[Cse]),[Ase,Rse]=Tse(Oc),NF=y.forwardRef((e,t)=>h.jsx(Gb.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Gb.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Nse,{...e,ref:t})})}));NF.displayName=Oc;var Nse=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=y.useRef(null),f=Me(t,p),g=u0(s),[m,_]=Rs({prop:o,defaultProp:a??null,onChange:l,caller:Oc}),[b,v]=y.useState(!1),S=Fi(c),w=AF(n),k=y.useRef(!1),[x,E]=y.useState(0);return y.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(ig,S),()=>T.removeEventListener(ig,S)},[S]),h.jsx(Ase,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:y.useCallback(T=>_(T),[_]),onItemShiftTab:y.useCallback(()=>v(!0),[]),onFocusableItemAdd:y.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:y.useCallback(()=>E(T=>T-1),[]),children:h.jsx(xe.div,{tabIndex:b||x===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{k.current=!0}),onFocus:ye(e.onFocus,T=>{const D=!k.current;if(T.target===T.currentTarget&&D&&!b){const A=new CustomEvent(ig,kse);if(T.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=w().filter(B=>B.focusable),I=R.find(B=>B.active),L=R.find(B=>B.id===m),F=[I,L,...R].filter(Boolean).map(B=>B.ref.current);LF(F,u)}}k.current=!1}),onBlur:ye(e.onBlur,()=>v(!1))})})}),IF="RovingFocusGroupItem",OF=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=Hr(),c=s||l,u=Rse(IF,n),d=u.currentTabStopId===c,p=AF(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),h.jsx(Gb.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(xe.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:ye(e.onMouseDown,_=>{r?u.onItemFocus(c):_.preventDefault()}),onFocus:ye(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ye(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const b=Lse(_,u.orientation,u.dir);if(b!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let S=p().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();const w=S.indexOf(_.currentTarget);S=u.loop?Dse(S,w+1):S.slice(w+1)}setTimeout(()=>LF(S))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:m!=null}):o})})});OF.displayName=IF;var Ise={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ose(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lse(e,t,n){const r=Ose(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ise[r]}function LF(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Dse(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Mse=NF,Pse=OF,Sp="Tabs",[Fse]=Wi(Sp,[RF]),DF=RF(),[Bse,w0]=Fse(Sp),MF=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=u0(a),[d,p]=Rs({prop:r,onChange:i,defaultProp:s??"",caller:Sp});return h.jsx(Bse,{scope:n,baseId:Hr(),value:d,onValueChange:p,orientation:o,dir:u,activationMode:l,children:h.jsx(xe.div,{dir:u,"data-orientation":o,...c,ref:t})})});MF.displayName=Sp;var PF="TabsList",FF=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,s=w0(PF,n),o=DF(n);return h.jsx(Mse,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:h.jsx(xe.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});FF.displayName=PF;var BF="TabsTrigger",jF=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=e,o=w0(BF,n),a=DF(n),l=zF(o.baseId,r),c=HF(o.baseId,r),u=r===o.value;return h.jsx(Pse,{asChild:!0,...a,focusable:!i,active:u,children:h.jsx(xe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:t,onMouseDown:ye(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?o.onValueChange(r):d.preventDefault()}),onKeyDown:ye(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!i&&d&&o.onValueChange(r)})})})});jF.displayName=BF;var UF="TabsContent",$F=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...o}=e,a=w0(UF,n),l=zF(a.baseId,r),c=HF(a.baseId,r),u=r===a.value,d=y.useRef(u);return y.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(zs,{present:i||u,children:({present:p})=>h.jsx(xe.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&s})})});$F.displayName=UF;function zF(e,t){return`${e}-trigger-${t}`}function HF(e,t){return`${e}-content-${t}`}var jse=MF,VF=FF,GF=jF,WF=$F;const Use=jse,qF=y.forwardRef(({className:e,...t},n)=>h.jsx(VF,{ref:n,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));qF.displayName=VF.displayName;const td=y.forwardRef(({className:e,...t},n)=>h.jsx(GF,{ref:n,className:X("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));td.displayName=GF.displayName;const nd=y.forwardRef(({className:e,...t},n)=>h.jsx(WF,{ref:n,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));nd.displayName=WF.displayName;const rR={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function $se({open:e,onOpenChange:t,onAdded:n}){const[r,i]=y.useState([]),[s,o]=y.useState(!1),[a,l]=y.useState(null),[c,u]=y.useState(""),[d,p]=y.useState(""),[f,g]=y.useState(""),[m,_]=y.useState(""),[b,v]=y.useState(!1),[S,w]=y.useState(null);y.useEffect(()=>{e&&P6().then(D=>i(D.available)).catch(()=>i([]))},[e]);const k=()=>{o(!1),l(null),u(""),p(""),g(""),_(""),v(!1),w(null)},x=async D=>{l(D),w(null);try{const{id:A}=await d1({type:D,label:rR[D]||D}),{url:R}=await Tm(A);window.open(R,"_blank"),k(),t(!1),n()}catch(A){w(A instanceof Error?A.message:"添加失败"),l(null)}},E=async()=>{if(!c||!d||!f||!m){w("请填写所有字段");return}v(!0),w(null);try{const{id:D}=await d1({type:c,label:d,clientId:f,clientSecret:m}),{url:A}=await Tm(D);window.open(A,"_blank"),k(),t(!1),n()}catch(D){w(D instanceof Error?D.message:"添加失败")}finally{v(!1)}},T=r.length>0;return h.jsx(ua,{open:e,onOpenChange:D=>{t(D),D||k()},children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsxs(Ws,{className:"flex items-center gap-2",children:[h.jsx(Am,{className:"h-5 w-5"}),"添加云盘账号"]}),h.jsx(qs,{children:s?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"云盘类型"}),h.jsxs(sh,{value:c,onValueChange:u,children:[h.jsx(ic,{children:h.jsx(oh,{placeholder:"选择云盘类型"})}),h.jsxs(sc,{children:[h.jsx(Rn,{value:"google-drive",children:"Google Drive"}),h.jsx(Rn,{value:"onedrive",children:"OneDrive"}),h.jsx(Rn,{value:"dropbox",children:"Dropbox"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"显示名称"}),h.jsx(Fn,{placeholder:"例如:我的 Google Drive",value:d,onChange:D=>p(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Client ID"}),h.jsx(Fn,{placeholder:"OAuth Client ID",value:f,onChange:D=>g(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Client Secret"}),h.jsx(Fn,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:D=>_(D.target.value)})]}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S})]}),h.jsxs(Gs,{children:[h.jsx(ne,{variant:"outline",onClick:()=>{o(!1),w(null)},children:"返回"}),h.jsx(ne,{onClick:E,disabled:b,children:b?"添加中...":"添加并授权"})]})]}):h.jsxs("div",{className:"space-y-3 py-2",children:[T?h.jsx(h.Fragment,{children:r.map(D=>h.jsx(ne,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void x(D),disabled:a!==null,children:a===D?"连接中...":`连接 ${rR[D]||D}`},D))}):h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S}),h.jsx("div",{className:"pt-2 border-t border-border",children:h.jsxs("button",{onClick:()=>{o(!0),w(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(SV,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const zse={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function Hse({type:e}){switch(e){case"google-drive":return h.jsx(f1,{className:"h-5 w-5 text-blue-500"});case"onedrive":return h.jsx(Am,{className:"h-5 w-5 text-sky-500"});case"dropbox":return h.jsx(f1,{className:"h-5 w-5 text-indigo-500"});default:return h.jsx(Am,{className:"h-5 w-5"})}}function Vse({provider:e,onDelete:t,onReauth:n}){var o;const[r,i]=y.useState(!1),s=()=>{r?(t(e.id),i(!1)):(i(!0),setTimeout(()=>i(!1),3e3))};return h.jsxs(Ih,{children:[h.jsx(Oh,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Hse,{type:e.type}),h.jsxs("div",{children:[h.jsx(Lh,{className:"text-base",children:e.label}),h.jsx("p",{className:"text-sm text-muted-foreground",children:zse[e.type]||e.type})]})]}),h.jsx(gr,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),h.jsxs(Dh,{children:[e.authorized&&((o=e.tokens)==null?void 0:o.expiry)&&h.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[h.jsx(As,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),h.jsxs(ne,{variant:r?"destructive":"outline",size:"sm",onClick:s,children:[h.jsx(Ev,{className:"h-3.5 w-3.5 mr-1"}),r?"确认删除?":"删除"]})]})]})]})}const Gse={success:{label:"成功",icon:eV,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:RV,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Z6,className:"bg-yellow-600 hover:bg-yellow-700"}};function Wse(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;const i=Math.floor(r/60),s=r%60;return`${i}分${s}秒`}function qse(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Kse({history:e}){const t=e.slice(0,20);return t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[h.jsx(nV,{className:"h-10 w-10 mb-3 opacity-50"}),h.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b",children:[h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),h.jsx("tbody",{children:t.map(n=>{const r=Gse[n.status],i=r.icon;return h.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:qse(n.startTime)}),h.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),h.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),h.jsxs("td",{className:"py-2.5 px-2",children:[h.jsxs(gr,{className:r.className,children:[h.jsx(i,{className:"h-3 w-3 mr-1"}),r.label]}),n.error&&h.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),h.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Wse(n.startTime,n.endTime)})]},n.id)})})]})})}const iR=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Yse=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Xse(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(!1),[a,l]=y.useState({enabled:!1,intervalMinutes:60}),[c,u]=y.useState(!0),[d,p]=y.useState([]),[f,g]=y.useState(!0),[m,_]=y.useState(""),[b,v]=y.useState(!1),[S,w]=y.useState(!1),[k,x]=y.useState([]),[E,T]=y.useState(!0),D=async()=>{try{const C=await F6();n(C)}catch{}finally{i(!1)}},A=async()=>{try{const C=await U6();l(C)}catch{}finally{u(!1)}},R=async()=>{try{const C=await $6();p(C.length>0?C:iR)}catch{p(iR)}finally{g(!1)}},I=async()=>{try{const C=await H6();x(C)}catch{}finally{T(!1)}};y.useEffect(()=>{D(),A(),R(),I()},[]);const L=async C=>{try{await B6(C),n(z=>z.filter(Z=>Z.id!==C))}catch{}},P=async C=>{try{const{url:z}=await Tm(C);window.open(z,"_blank")}catch{}},F=async C=>{const z={...a,enabled:C};l(z);try{await h1({enabled:C})}catch{l(a)}},B=async C=>{const z=parseInt(C,10),Z={...a,intervalMinutes:z};l(Z);try{await h1({intervalMinutes:z})}catch{l(a)}},U=()=>{const C=m.trim();!C||d.includes(C)||(p(z=>[...z,C]),_(""),v(!0))},O=C=>{p(z=>z.filter(Z=>Z!==C)),v(!0)},j=async()=>{w(!0);try{await z6(d),v(!1)}catch{}finally{w(!1)}};return h.jsx("div",{className:"min-h-screen bg-background",children:h.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),h.jsxs(Use,{defaultValue:"providers",children:[h.jsxs(qF,{className:"mb-4",children:[h.jsx(td,{value:"providers",children:"云盘账号"}),h.jsx(td,{value:"strategy",children:"备份策略"}),h.jsx(td,{value:"history",children:"备份记录"})]}),h.jsxs(nd,{value:"providers",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(ne,{onClick:()=>o(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),r?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):h.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>h.jsx(Vse,{provider:C,onDelete:L,onReauth:P},C.id))})]}),h.jsx($se,{open:s,onOpenChange:o,onAdded:()=>void D()})]}),h.jsx(nd,{value:"strategy",children:h.jsxs("div",{className:"space-y-8",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),f?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"flex flex-wrap gap-2",children:h.jsx(Jn,{children:d.map(C=>h.jsxs(Ke.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,h.jsx("button",{onClick:()=>O(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:h.jsx($s,{className:"h-3 w-3"})})]},C))})}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Fn,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>_(C.target.value),onKeyDown:C=>{C.key==="Enter"&&U()},className:"max-w-xs"}),h.jsx(ne,{variant:"outline",size:"sm",onClick:U,children:"添加"})]}),b&&h.jsxs(ne,{onClick:j,disabled:S,children:[h.jsx($L,{className:"h-4 w-4 mr-1"}),S?"保存中...":"保存"]})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),c?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(c0,{checked:a.enabled,onCheckedChange:F}),h.jsx(ze,{children:a.enabled?"已开启":"已关闭"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"备份间隔"}),h.jsxs(sh,{value:String(a.intervalMinutes),onValueChange:B,children:[h.jsx(ic,{className:"w-48",children:h.jsx(oh,{})}),h.jsx(sc,{children:Yse.map(C=>h.jsx(Rn,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),h.jsx(nd,{value:"history",children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>{T(!0),I()},children:[h.jsx(As,{className:"h-4 w-4 mr-1"}),"刷新"]})}),E?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):h.jsx(Kse,{history:k})]})})]})]})})}function Zse(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(""),[c,u]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(null),[m,_]=y.useState(new Set);y.useEffect(()=>{A6().then(n).catch(k=>o(k instanceof Error?k.message:"Failed to load SkillHub")).finally(()=>i(!1))},[]);const b=y.useMemo(()=>{const k=new Set;return t.forEach(x=>{var E;return(E=x.tags)==null?void 0:E.forEach(T=>k.add(T))}),Array.from(k).sort()},[t]),v=y.useMemo(()=>t.some(k=>!k.tags||k.tags.length===0),[t]),S=y.useMemo(()=>{let k=t;if(c==="__untagged__"?k=k.filter(x=>!x.tags||x.tags.length===0):c&&(k=k.filter(x=>{var E;return(E=x.tags)==null?void 0:E.includes(c)})),a.trim()){const x=a.toLowerCase();k=k.filter(E=>{var T;return E.label.toLowerCase().includes(x)||E.description.toLowerCase().includes(x)||E.command.toLowerCase().includes(x)||E.author.toLowerCase().includes(x)||((T=E.tags)==null?void 0:T.some(D=>D.toLowerCase().includes(x)))})}return k},[t,a,c]),w=async(k,x)=>{if(x.stopPropagation(),!(f||m.has(k.id))){g(k.id);try{await N6(k.id),_(E=>new Set(E).add(k.id)),n(E=>E.map(T=>T.id===k.id?{...T,downloads:(T.downloads||0)+1}:T))}catch(E){alert(E instanceof Error?E.message:"Download failed")}finally{g(null)}}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"relative w-64",children:[h.jsx(vV,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(Fn,{placeholder:"搜索命令...",value:a,onChange:k=>l(k.target.value),className:"pl-8 h-9"})]})]})}),h.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[b.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(null),children:"全部"}),b.map(k=>h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===k?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(c===k?null:k),children:k},k)),v&&h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(c==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),s&&h.jsx("div",{className:"text-center text-destructive py-20",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[h.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),h.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!r&&!s&&t.length>0&&S.length===0&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),h.jsx("div",{className:"space-y-3",children:S.map((k,x)=>{var R;const E=d===k.id,T=m.has(k.id),D=f===k.id,A=k.parentId?t.find(I=>I.id===k.parentId):void 0;return h.jsxs(Ke.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:x*.03,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>p(E?null:k.id),children:[h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-medium text-sm truncate",children:k.label}),(R=k.tags)==null?void 0:R.map(I=>h.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[h.jsx(CV,{className:"h-2.5 w-2.5"}),I]},I))]}),A&&h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(gl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",A.label]})]}),k.description&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:k.description}),h.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(zL,{className:"h-3 w-3"}),k.author]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(Bd,{className:"h-3 w-3"}),k.downloads||0]}),h.jsx("span",{children:k.createdAt})]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsxs(ne,{size:"sm",variant:T?"outline":"default",disabled:D||T,onClick:I=>w(k,I),title:A?`将同时下载继承的「${A.label}」`:void 0,children:[h.jsx(Bd,{className:"h-3.5 w-3.5 mr-1"}),T?"已下载":D?"下载中...":"下载"]}),h.jsx(Ke.span,{animate:{rotate:E?180:0},transition:{duration:.2},children:h.jsx(Mh,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Jn,{children:E&&h.jsx(Ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"mt-3 pt-3 border-t",children:h.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:k.command})})})})]},k.id)})})]})]})}function vu({children:e}){const[t,n]=y.useState(!1),[r,i]=y.useState(!1);return y.useEffect(()=>{if(Zr()){i(!0),n(!0);return}Cm()?LL().then(o=>{km(o),i(!0)}).catch(()=>{i(!1)}).finally(()=>n(!0)):n(!0)},[]),t?r?h.jsx(h.Fragment,{children:e}):h.jsx(OI,{to:"/login",replace:!0}):null}function Qse(){return h.jsx(TW,{children:h.jsx(_U,{children:h.jsxs(bU,{children:[h.jsx(is,{path:"/login",element:h.jsx(K6,{})}),h.jsx(is,{path:"/",element:h.jsx(vu,{children:h.jsx(AW,{})})}),h.jsx(is,{path:"/projects/:id",element:h.jsx(vu,{children:h.jsx(Ese,{})})}),h.jsx(is,{path:"/settings",element:h.jsx(vu,{children:h.jsx(Xse,{})})}),h.jsx(is,{path:"/skillhub",element:h.jsx(vu,{children:h.jsx(Zse,{})})}),h.jsx(is,{path:"*",element:h.jsx(OI,{to:"/",replace:!0})})]})})})}sg.createRoot(document.getElementById("root")).render(h.jsx(wt.StrictMode,{children:h.jsx(Qse,{})}));export{ah as a,rd as c,Jse as g};
|
|
554
|
+
`)}`}function Mne({session:e,onClose:t,onRecall:n}){return h.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",children:[h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:t}),h.jsxs(Ke.div,{initial:{opacity:0,scale:.95,y:8},animate:{opacity:1,scale:1,y:0},exit:{opacity:0,scale:.95,y:8},transition:{duration:.2,ease:"easeOut"},className:"relative z-10 w-[600px] max-w-[90vw] max-h-[80vh] flex flex-col bg-background border border-border rounded-lg shadow-2xl",children:[h.jsxs("div",{className:"flex items-center justify-between px-4 h-11 border-b border-border flex-shrink-0",children:[h.jsx("span",{className:"text-sm font-medium text-foreground",children:XM(e.startedAt)}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("button",{className:"flex items-center gap-1.5 text-xs px-2.5 py-1 rounded bg-blue-600 hover:bg-blue-500 text-white transition-colors",onClick:()=>{n(ZM(e)),t()},children:[h.jsx(Sv,{className:"h-3 w-3"}),"回忆"]}),h.jsx("button",{className:"text-muted-foreground hover:text-foreground transition-colors p-0.5",onClick:t,children:h.jsx($s,{className:"h-4 w-4"})})]})]}),h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-4 min-h-0",children:[e.messages.length===0&&h.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"本次会话暂无记录"}),e.messages.map((r,i)=>h.jsxs("div",{className:X("flex gap-2.5",r.role==="user"?"flex-row-reverse":"flex-row"),children:[h.jsx("div",{className:X("flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center mt-0.5",r.role==="user"?"bg-blue-600/20":"bg-muted"),children:r.role==="user"?h.jsx(zL,{className:"h-3 w-3 text-blue-400"}):h.jsx(BL,{className:"h-3 w-3 text-muted-foreground"})}),h.jsx("div",{className:X("max-w-[85%] text-xs rounded-lg px-3 py-2 whitespace-pre-wrap break-words",r.role==="user"?"bg-blue-600/20 text-blue-100 dark:text-blue-100 border border-blue-500/20":"bg-muted text-foreground border border-border"),children:r.content})]},i))]})]})]})}function Pne({projectId:e,onSend:t}){var u;const[n,r]=y.useState([]),[i,s]=y.useState(null),o=n.filter(d=>d.messageCount>0),a=(u=o.find(d=>!d.isCurrent))==null?void 0:u.id;y.useEffect(()=>{let d=null;const p=()=>{document.hidden||c1(e).then(r).catch(()=>{})};c1(e).then(r).catch(()=>r([]));const f=()=>{d=setInterval(p,5e3)},g=()=>{d&&(clearInterval(d),d=null)},m=()=>{document.hidden?g():f()};return f(),document.addEventListener("visibilitychange",m),()=>{g(),document.removeEventListener("visibilitychange",m)}},[e]);const l=async d=>{try{s(await u1(e,d))}catch{}},c=d=>{t(d+"\r")};return h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-1.5 min-h-0",children:[o.length===0&&h.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 text-muted-foreground/50",children:[h.jsx(BL,{className:"h-5 w-5"}),h.jsx("p",{className:"text-xs text-center",children:"暂无历史记录"})]}),o.map(d=>{const p=d.isCurrent,f=!d.isCurrent&&d.id===a;return h.jsxs("div",{className:X("group rounded border bg-muted hover:border-muted-foreground/30 transition-colors",p?"border-blue-500/50":"border-border"),children:[h.jsxs("button",{className:"w-full text-left px-3 pt-2 pb-1",onClick:()=>void l(d.id),children:[h.jsxs("div",{className:"flex items-center gap-1.5",children:[h.jsx("span",{className:"text-xs font-medium text-foreground",children:XM(d.startedAt)}),p&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-blue-500/20 text-blue-400 border border-blue-500/30 leading-none",children:"当前"}),f&&h.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-muted text-muted-foreground border border-border leading-none",children:"最近"})]}),h.jsxs("div",{className:"text-[10px] text-muted-foreground mt-0.5",children:[d.messageCount," 条消息"]})]}),h.jsx("div",{className:"px-3 pb-2 flex justify-end",children:h.jsxs("button",{className:"flex items-center gap-1 text-[10px] px-2 py-0.5 rounded bg-secondary hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",onClick:async g=>{g.stopPropagation();try{const m=await u1(e,d.id);c(ZM(m))}catch{}},children:[h.jsx(Sv,{className:"h-2.5 w-2.5"}),"回忆"]})})]},d.id)})]}),i&&h.jsx(Mne,{session:i,onClose:()=>s(null),onRecall:c})]})}const Fne={shortcuts:"快捷命令",history:"历史记录"};function Bne({projectId:e,onSend:t}){const[n,r]=y.useState("shortcuts");return h.jsxs("div",{className:"h-full flex flex-col bg-background text-foreground",children:[h.jsx("div",{className:"flex border-b border-border flex-shrink-0",children:["shortcuts","history"].map(i=>h.jsx("button",{onClick:()=>r(i),className:X("flex-1 text-xs py-2 font-medium transition-colors",n===i?"text-foreground border-b-2 border-blue-500 -mb-px bg-muted/50":"text-muted-foreground hover:text-foreground"),children:Fne[i]},i))}),h.jsxs(Jn,{mode:"wait",children:[n==="shortcuts"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(Dne,{projectId:e,onSend:t})},"shortcuts"),n==="history"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(Pne,{projectId:e,onSend:t})},"history")]})]})}const jne=new Set(["preset:wind","preset:rain","preset:stream"]),Une=new Set(["preset:singing-bowl","preset:water-drops","preset:keyboard"]);function $ne(e){return e.playMode!=="auto"?e.playMode:jne.has(e.source)?"loop":Une.has(e.source)?"interval":"loop"}function zne({projectId:e,config:t,isActive:n}){const r=y.useRef(null),i=y.useRef(null),s=y.useRef(null),o=y.useRef(null),a=y.useRef(null),l=y.useRef(null),c=y.useRef(!1),u=y.useCallback(()=>{if(a.current&&(clearTimeout(a.current),a.current=null),l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.pause(),r.current.src=""),o.current){try{o.current.disconnect()}catch{}o.current=null}if(s.current){try{s.current.disconnect()}catch{}s.current=null}if(i.current){try{i.current.close()}catch{}i.current=null}r.current=null,c.current=!1},[]),d=y.useCallback(g=>{if(!r.current||r.current.src!==g){if(o.current){try{o.current.disconnect()}catch{}o.current=null}r.current&&r.current.pause();const m=new Audio(g);m.crossOrigin="anonymous",r.current=m}if(i.current||(i.current=new AudioContext),!s.current){const m=i.current.createGain();m.gain.value=0,m.connect(i.current.destination),s.current=m}if(!o.current){const m=i.current.createMediaElementSource(r.current);m.connect(s.current),o.current=m}return{audio:r.current,ctx:i.current,gain:s.current}},[]),p=y.useCallback(g=>{const m=p1(g.source,e),_=Math.max(0,Math.min(1,g.volume)),b=$ne(g),{audio:v,ctx:S,gain:w}=d(m);S.resume().then(()=>{if(a.current&&(clearTimeout(a.current),a.current=null),l.current&&(clearTimeout(l.current),l.current=null),b==="loop")v.loop=!0,v.currentTime=0,v.play().catch(()=>{}),c.current=!0,w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(_,S.currentTime+.5);else{v.loop=!1;const k=()=>{if(!c.current)return;v.currentTime=0,v.play().catch(()=>{}),w.gain.cancelScheduledValues(S.currentTime),w.gain.setValueAtTime(w.gain.value,S.currentTime),w.gain.linearRampToValueAtTime(_,S.currentTime+.5);const x=()=>{if(!c.current)return;const[E,T]=g.intervalRange,D=(E+Math.random()*(T-E))*1e3;l.current=setTimeout(k,D)};v.onended=x};c.current=!0,k()}}).catch(()=>{})},[e,d]),f=y.useCallback(()=>{if(!r.current||!i.current||!s.current){c.current=!1;return}c.current=!1,l.current&&(clearTimeout(l.current),l.current=null),r.current&&(r.current.onended=null);const g=i.current,m=s.current,_=r.current;m.gain.cancelScheduledValues(g.currentTime),m.gain.setValueAtTime(m.gain.value,g.currentTime),m.gain.linearRampToValueAtTime(0,g.currentTime+1),a.current=setTimeout(()=>{a.current=null,_&&_.pause()},1100)},[]);return y.useEffect(()=>{!t||!t.enabled||(n?p(t):f())},[n,t,p,f]),y.useEffect(()=>()=>{u()},[u]),y.useEffect(()=>{if(!t){u();return}if(r.current){const g=p1(t.source,e);if(r.current.src!==g){if(f(),o.current){try{o.current.disconnect()}catch{}o.current=null}r.current.pause(),r.current=null,n&&p(t)}}},[t==null?void 0:t.source,e]),null}function QM(e){const t=y.useRef({value:e,previous:e});return y.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function JM(e){const[t,n]=y.useState(void 0);return Ut(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;const s=i[0];let o,a;if("borderBoxSize"in s){const l=s.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=e.offsetWidth,a=e.offsetHeight;n({width:o,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var dp="Switch",[Hne]=Wi(dp),[Vne,Gne]=Hne(dp),eP=y.forwardRef((e,t)=>{const{__scopeSwitch:n,name:r,checked:i,defaultChecked:s,required:o,disabled:a,value:l="on",onCheckedChange:c,form:u,...d}=e,[p,f]=y.useState(null),g=Me(t,S=>f(S)),m=y.useRef(!1),_=p?u||!!p.closest("form"):!0,[b,v]=Rs({prop:i,defaultProp:s??!1,onChange:c,caller:dp});return h.jsxs(Vne,{scope:n,checked:b,disabled:a,children:[h.jsx(xe.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":iP(b),"data-disabled":a?"":void 0,disabled:a,value:l,...d,ref:g,onClick:ye(e.onClick,S=>{v(w=>!w),_&&(m.current=S.isPropagationStopped(),m.current||S.stopPropagation())})}),_&&h.jsx(rP,{control:p,bubbles:!m.current,name:r,value:l,checked:b,required:o,disabled:a,form:u,style:{transform:"translateX(-100%)"}})]})});eP.displayName=dp;var tP="SwitchThumb",nP=y.forwardRef((e,t)=>{const{__scopeSwitch:n,...r}=e,i=Gne(tP,n);return h.jsx(xe.span,{"data-state":iP(i.checked),"data-disabled":i.disabled?"":void 0,...r,ref:t})});nP.displayName=tP;var Wne="SwitchBubbleInput",rP=y.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},s)=>{const o=y.useRef(null),a=Me(o,s),l=QM(n),c=JM(t);return y.useEffect(()=>{const u=o.current;if(!u)return;const d=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(d,"checked").set;if(l!==n&&f){const g=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(g)}},[l,n,r]),h.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:a,style:{...i.style,...c,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});rP.displayName=Wne;function iP(e){return e?"checked":"unchecked"}var sP=eP,qne=nP;const c0=y.forwardRef(({className:e,...t},n)=>h.jsx(sP,{className:X("peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:n,children:h.jsx(qne,{className:X("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));c0.displayName=sP.displayName;function VA(e,[t,n]){return Math.min(n,Math.max(t,e))}function GA(e){const t=Kne(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(Xne);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function Kne(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=Qne(i),a=Zne(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yne=Symbol("radix.slottable");function Xne(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yne}function Zne(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function Qne(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function oP(e){const t=e+"CollectionProvider",[n,r]=Wi(t),[i,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=m=>{const{scope:_,children:b}=m,v=wt.useRef(null),S=wt.useRef(new Map).current;return h.jsx(i,{scope:_,itemMap:S,collectionRef:v,children:b})};o.displayName=t;const a=e+"CollectionSlot",l=GA(a),c=wt.forwardRef((m,_)=>{const{scope:b,children:v}=m,S=s(a,b),w=Me(_,S.collectionRef);return h.jsx(l,{ref:w,children:v})});c.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",p=GA(u),f=wt.forwardRef((m,_)=>{const{scope:b,children:v,...S}=m,w=wt.useRef(null),k=Me(_,w),x=s(u,b);return wt.useEffect(()=>(x.itemMap.set(w,{ref:w,...S}),()=>void x.itemMap.delete(w))),h.jsx(p,{[d]:"",ref:k,children:v})});f.displayName=u;function g(m){const _=s(e+"CollectionConsumer",m);return wt.useCallback(()=>{const v=_.collectionRef.current;if(!v)return[];const S=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(_.itemMap.values()).sort((x,E)=>S.indexOf(x.ref.current)-S.indexOf(E.ref.current))},[_.collectionRef,_.itemMap])}return[{Provider:o,Slot:c,ItemSlot:f},g,r]}var Jne=y.createContext(void 0);function u0(e){const t=y.useContext(Jne);return e||t||"ltr"}const ere=["top","right","bottom","left"],ji=Math.min,mn=Math.max,eh=Math.round,yu=Math.floor,kr=e=>({x:e,y:e}),tre={left:"right",right:"left",bottom:"top",top:"bottom"};function Fb(e,t,n){return mn(e,ji(t,n))}function Kr(e,t){return typeof e=="function"?e(t):e}function Yr(e){return e.split("-")[0]}function Sa(e){return e.split("-")[1]}function d0(e){return e==="x"?"y":"x"}function h0(e){return e==="y"?"height":"width"}function vr(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function p0(e){return d0(vr(e))}function nre(e,t,n){n===void 0&&(n=!1);const r=Sa(e),i=p0(e),s=h0(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(o=th(o)),[o,th(o)]}function rre(e){const t=th(e);return[Bb(e),t,Bb(t)]}function Bb(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const WA=["left","right"],qA=["right","left"],ire=["top","bottom"],sre=["bottom","top"];function ore(e,t,n){switch(e){case"top":case"bottom":return n?t?qA:WA:t?WA:qA;case"left":case"right":return t?ire:sre;default:return[]}}function are(e,t,n,r){const i=Sa(e);let s=ore(Yr(e),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),t&&(s=s.concat(s.map(Bb)))),s}function th(e){const t=Yr(e);return tre[t]+e.slice(t.length)}function lre(e){return{top:0,right:0,bottom:0,left:0,...e}}function aP(e){return typeof e!="number"?lre(e):{top:e,right:e,bottom:e,left:e}}function nh(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function KA(e,t,n){let{reference:r,floating:i}=e;const s=vr(t),o=p0(t),a=h0(o),l=Yr(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,p=r[a]/2-i[a]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Sa(t)){case"start":f[o]-=p*(n&&c?-1:1);break;case"end":f[o]+=p*(n&&c?-1:1);break}return f}async function cre(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=Kr(t,e),g=aP(f),_=a[p?d==="floating"?"reference":"floating":d],b=nh(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(_)))==null||n?_:_.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),w=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},k=nh(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:S,strategy:l}):v);return{top:(b.top-k.top+g.top)/w.y,bottom:(k.bottom-b.bottom+g.bottom)/w.y,left:(b.left-k.left+g.left)/w.x,right:(k.right-b.right+g.right)/w.x}}const ure=50,dre=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:cre},l=await(o.isRTL==null?void 0:o.isRTL(t));let c=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=KA(c,r,l),p=r,f=0;const g={};for(let m=0;m<s.length;m++){const _=s[m];if(!_)continue;const{name:b,fn:v}=_,{x:S,y:w,data:k,reset:x}=await v({x:u,y:d,initialPlacement:r,placement:p,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:e,floating:t}});u=S??u,d=w??d,g[b]={...g[b],...k},x&&f<ure&&(f++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=KA(c,p,l)),m=-1)}return{x:u,y:d,placement:p,strategy:i,middlewareData:g}},hre=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:o,elements:a,middlewareData:l}=t,{element:c,padding:u=0}=Kr(e,t)||{};if(c==null)return{};const d=aP(u),p={x:n,y:r},f=p0(i),g=h0(f),m=await o.getDimensions(c),_=f==="y",b=_?"top":"left",v=_?"bottom":"right",S=_?"clientHeight":"clientWidth",w=s.reference[g]+s.reference[f]-p[f]-s.floating[g],k=p[f]-s.reference[f],x=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let E=x?x[S]:0;(!E||!await(o.isElement==null?void 0:o.isElement(x)))&&(E=a.floating[S]||s.floating[g]);const T=w/2-k/2,D=E/2-m[g]/2-1,A=ji(d[b],D),R=ji(d[v],D),I=A,L=E-m[g]-R,P=E/2-m[g]/2+T,F=Fb(I,P,L),B=!l.arrow&&Sa(i)!=null&&P!==F&&s.reference[g]/2-(P<I?A:R)-m[g]/2<0,U=B?P<I?P-I:P-L:0;return{[f]:p[f]+U,data:{[f]:F,centerOffset:P-F-U,...B&&{alignmentOffset:U}},reset:B}}}),pre=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0,..._}=Kr(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Yr(i),v=vr(a),S=Yr(a)===a,w=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=p||(S||!m?[th(a)]:rre(a)),x=g!=="none";!p&&x&&k.push(...are(a,m,g,w));const E=[a,...k],T=await l.detectOverflow(t,_),D=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&D.push(T[b]),d){const P=nre(i,o,w);D.push(T[P[0]],T[P[1]])}if(A=[...A,{placement:i,overflows:D}],!D.every(P=>P<=0)){var R,I;const P=(((R=s.flip)==null?void 0:R.index)||0)+1,F=E[P];if(F&&(!(d==="alignment"?v!==vr(F):!1)||A.every(O=>vr(O.placement)===v?O.overflows[0]>0:!0)))return{data:{index:P,overflows:A},reset:{placement:F}};let B=(I=A.filter(U=>U.overflows[0]<=0).sort((U,O)=>U.overflows[1]-O.overflows[1])[0])==null?void 0:I.placement;if(!B)switch(f){case"bestFit":{var L;const U=(L=A.filter(O=>{if(x){const j=vr(O.placement);return j===v||j==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(j=>j>0).reduce((j,C)=>j+C,0)]).sort((O,j)=>O[1]-j[1])[0])==null?void 0:L[0];U&&(B=U);break}case"initialPlacement":B=a;break}if(i!==B)return{reset:{placement:B}}}return{}}}};function YA(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function XA(e){return ere.some(t=>e[t]>=0)}const fre=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:i="referenceHidden",...s}=Kr(e,t);switch(i){case"referenceHidden":{const o=await r.detectOverflow(t,{...s,elementContext:"reference"}),a=YA(o,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:XA(a)}}}case"escaped":{const o=await r.detectOverflow(t,{...s,altBoundary:!0}),a=YA(o,n.floating);return{data:{escapedOffsets:a,escaped:XA(a)}}}default:return{}}}}},lP=new Set(["left","top"]);async function gre(e,t){const{placement:n,platform:r,elements:i}=e,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Yr(n),a=Sa(n),l=vr(n)==="y",c=lP.has(o)?-1:1,u=s&&l?-1:1,d=Kr(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:g}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof g=="number"&&(f=a==="end"?g*-1:g),l?{x:f*u,y:p*c}:{x:p*c,y:f*u}}const mre=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=t,l=await gre(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},bre=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i,platform:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:b=>{let{x:v,y:S}=b;return{x:v,y:S}}},...c}=Kr(e,t),u={x:n,y:r},d=await s.detectOverflow(t,c),p=vr(Yr(i)),f=d0(p);let g=u[f],m=u[p];if(o){const b=f==="y"?"top":"left",v=f==="y"?"bottom":"right",S=g+d[b],w=g-d[v];g=Fb(S,g,w)}if(a){const b=p==="y"?"top":"left",v=p==="y"?"bottom":"right",S=m+d[b],w=m-d[v];m=Fb(S,m,w)}const _=l.fn({...t,[f]:g,[p]:m});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[f]:o,[p]:a}}}}}},yre=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:o}=t,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Kr(e,t),u={x:n,y:r},d=vr(i),p=d0(d);let f=u[p],g=u[d];const m=Kr(a,t),_=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const S=p==="y"?"height":"width",w=s.reference[p]-s.floating[S]+_.mainAxis,k=s.reference[p]+s.reference[S]-_.mainAxis;f<w?f=w:f>k&&(f=k)}if(c){var b,v;const S=p==="y"?"width":"height",w=lP.has(Yr(i)),k=s.reference[d]-s.floating[S]+(w&&((b=o.offset)==null?void 0:b[d])||0)+(w?0:_.crossAxis),x=s.reference[d]+s.reference[S]+(w?0:((v=o.offset)==null?void 0:v[d])||0)-(w?_.crossAxis:0);g<k?g=k:g>x&&(g=x)}return{[p]:f,[d]:g}}}},vre=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:i,rects:s,platform:o,elements:a}=t,{apply:l=()=>{},...c}=Kr(e,t),u=await o.detectOverflow(t,c),d=Yr(i),p=Sa(i),f=vr(i)==="y",{width:g,height:m}=s.floating;let _,b;d==="top"||d==="bottom"?(_=d,b=p===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=d,_=p==="end"?"top":"bottom");const v=m-u.top-u.bottom,S=g-u.left-u.right,w=ji(m-u[_],v),k=ji(g-u[b],S),x=!t.middlewareData.shift;let E=w,T=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(T=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(E=v),x&&!p){const A=mn(u.left,0),R=mn(u.right,0),I=mn(u.top,0),L=mn(u.bottom,0);f?T=g-2*(A!==0||R!==0?A+R:mn(u.left,u.right)):E=m-2*(I!==0||L!==0?I+L:mn(u.top,u.bottom))}await l({...t,availableWidth:T,availableHeight:E});const D=await o.getDimensions(a.floating);return g!==D.width||m!==D.height?{reset:{rects:!0}}:{}}}};function hp(){return typeof window<"u"}function wa(e){return cP(e)?(e.nodeName||"").toLowerCase():"#document"}function Sn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Nr(e){var t;return(t=(cP(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cP(e){return hp()?e instanceof Node||e instanceof Sn(e).Node:!1}function nr(e){return hp()?e instanceof Element||e instanceof Sn(e).Element:!1}function ti(e){return hp()?e instanceof HTMLElement||e instanceof Sn(e).HTMLElement:!1}function ZA(e){return!hp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sn(e).ShadowRoot}function Nc(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=rr(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!=="inline"&&i!=="contents"}function _re(e){return/^(table|td|th)$/.test(wa(e))}function pp(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Sre=/transform|translate|scale|rotate|perspective|filter/,wre=/paint|layout|strict|content/,ts=e=>!!e&&e!=="none";let Jf;function f0(e){const t=nr(e)?rr(e):e;return ts(t.transform)||ts(t.translate)||ts(t.scale)||ts(t.rotate)||ts(t.perspective)||!g0()&&(ts(t.backdropFilter)||ts(t.filter))||Sre.test(t.willChange||"")||wre.test(t.contain||"")}function xre(e){let t=Ui(e);for(;ti(t)&&!Jo(t);){if(f0(t))return t;if(pp(t))return null;t=Ui(t)}return null}function g0(){return Jf==null&&(Jf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Jf}function Jo(e){return/^(html|body|#document)$/.test(wa(e))}function rr(e){return Sn(e).getComputedStyle(e)}function fp(e){return nr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ui(e){if(wa(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ZA(e)&&e.host||Nr(e);return ZA(t)?t.host:t}function uP(e){const t=Ui(e);return Jo(t)?e.ownerDocument?e.ownerDocument.body:e.body:ti(t)&&Nc(t)?t:uP(t)}function rc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=uP(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),o=Sn(i);if(s){const a=jb(o);return t.concat(o,o.visualViewport||[],Nc(i)?i:[],a&&n?rc(a):[])}else return t.concat(i,rc(i,[],n))}function jb(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dP(e){const t=rr(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=ti(e),s=i?e.offsetWidth:n,o=i?e.offsetHeight:r,a=eh(n)!==s||eh(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function m0(e){return nr(e)?e:e.contextElement}function jo(e){const t=m0(e);if(!ti(t))return kr(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=dP(t);let o=(s?eh(n.width):n.width)/r,a=(s?eh(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Ere=kr(0);function hP(e){const t=Sn(e);return!g0()||!t.visualViewport?Ere:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function kre(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Sn(e)?!1:t}function Ds(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=m0(e);let o=kr(1);t&&(r?nr(r)&&(o=jo(r)):o=jo(e));const a=kre(s,n,r)?hP(s):kr(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(s){const p=Sn(s),f=r&&nr(r)?Sn(r):r;let g=p,m=jb(g);for(;m&&r&&f!==g;){const _=jo(m),b=m.getBoundingClientRect(),v=rr(m),S=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*_.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*_.y;l*=_.x,c*=_.y,u*=_.x,d*=_.y,l+=S,c+=w,g=Sn(m),m=jb(g)}}return nh({width:u,height:d,x:l,y:c})}function gp(e,t){const n=fp(e).scrollLeft;return t?t.left+n:Ds(Nr(e)).left+n}function pP(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-gp(e,n),i=n.top+t.scrollTop;return{x:r,y:i}}function Cre(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",o=Nr(r),a=t?pp(t.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},c=kr(1);const u=kr(0),d=ti(r);if((d||!d&&!s)&&((wa(r)!=="body"||Nc(o))&&(l=fp(r)),d)){const f=Ds(r);c=jo(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const p=o&&!d&&!s?pP(o,l):kr(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+p.x,y:n.y*c.y-l.scrollTop*c.y+u.y+p.y}}function Tre(e){return Array.from(e.getClientRects())}function Are(e){const t=Nr(e),n=fp(e),r=e.ownerDocument.body,i=mn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=mn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+gp(e);const a=-n.scrollTop;return rr(r).direction==="rtl"&&(o+=mn(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const QA=25;function Rre(e,t){const n=Sn(e),r=Nr(e),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const u=g0();(!u||u&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const c=gp(r);if(c<=0){const u=r.ownerDocument,d=u.body,p=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,g=Math.abs(r.clientWidth-d.clientWidth-f);g<=QA&&(s-=g)}else c<=QA&&(s+=c);return{width:s,height:o,x:a,y:l}}function Nre(e,t){const n=Ds(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=ti(e)?jo(e):kr(1),o=e.clientWidth*s.x,a=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:o,height:a,x:l,y:c}}function JA(e,t,n){let r;if(t==="viewport")r=Rre(e,n);else if(t==="document")r=Are(Nr(e));else if(nr(t))r=Nre(t,n);else{const i=hP(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return nh(r)}function fP(e,t){const n=Ui(e);return n===t||!nr(n)||Jo(n)?!1:rr(n).position==="fixed"||fP(n,t)}function Ire(e,t){const n=t.get(e);if(n)return n;let r=rc(e,[],!1).filter(a=>nr(a)&&wa(a)!=="body"),i=null;const s=rr(e).position==="fixed";let o=s?Ui(e):e;for(;nr(o)&&!Jo(o);){const a=rr(o),l=f0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||Nc(o)&&!l&&fP(e,o))?r=r.filter(u=>u!==o):i=a,o=Ui(o)}return t.set(e,r),r}function Ore(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const o=[...n==="clippingAncestors"?pp(t)?[]:Ire(t,this._c):[].concat(n),r],a=JA(t,o[0],i);let l=a.top,c=a.right,u=a.bottom,d=a.left;for(let p=1;p<o.length;p++){const f=JA(t,o[p],i);l=mn(f.top,l),c=ji(f.right,c),u=ji(f.bottom,u),d=mn(f.left,d)}return{width:c-d,height:u-l,x:d,y:l}}function Lre(e){const{width:t,height:n}=dP(e);return{width:t,height:n}}function Dre(e,t,n){const r=ti(t),i=Nr(t),s=n==="fixed",o=Ds(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const l=kr(0);function c(){l.x=gp(i)}if(r||!r&&!s)if((wa(t)!=="body"||Nc(i))&&(a=fp(t)),r){const f=Ds(t,!0,s,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&c();s&&!r&&i&&c();const u=i&&!r&&!s?pP(i,a):kr(0),d=o.left+a.scrollLeft-l.x-u.x,p=o.top+a.scrollTop-l.y-u.y;return{x:d,y:p,width:o.width,height:o.height}}function eg(e){return rr(e).position==="static"}function eR(e,t){if(!ti(e)||rr(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Nr(e)===n&&(n=n.ownerDocument.body),n}function gP(e,t){const n=Sn(e);if(pp(e))return n;if(!ti(e)){let i=Ui(e);for(;i&&!Jo(i);){if(nr(i)&&!eg(i))return i;i=Ui(i)}return n}let r=eR(e,t);for(;r&&_re(r)&&eg(r);)r=eR(r,t);return r&&Jo(r)&&eg(r)&&!f0(r)?n:r||xre(e)||n}const Mre=async function(e){const t=this.getOffsetParent||gP,n=this.getDimensions,r=await n(e.floating);return{reference:Dre(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Pre(e){return rr(e).direction==="rtl"}const Fre={convertOffsetParentRelativeRectToViewportRelativeRect:Cre,getDocumentElement:Nr,getClippingRect:Ore,getOffsetParent:gP,getElementRects:Mre,getClientRects:Tre,getDimensions:Lre,getScale:jo,isElement:nr,isRTL:Pre};function mP(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bre(e,t){let n=null,r;const i=Nr(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const c=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=c;if(a||t(),!p||!f)return;const g=yu(d),m=yu(i.clientWidth-(u+p)),_=yu(i.clientHeight-(d+f)),b=yu(u),S={rootMargin:-g+"px "+-m+"px "+-_+"px "+-b+"px",threshold:mn(0,ji(1,l))||1};let w=!0;function k(x){const E=x[0].intersectionRatio;if(E!==l){if(!w)return o();E?o(!1,E):r=setTimeout(()=>{o(!1,1e-7)},1e3)}E===1&&!mP(c,e.getBoundingClientRect())&&o(),w=!1}try{n=new IntersectionObserver(k,{...S,root:i.ownerDocument})}catch{n=new IntersectionObserver(k,S)}n.observe(e)}return o(!0),s}function jre(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=m0(e),u=i||s?[...c?rc(c):[],...t?rc(t):[]]:[];u.forEach(b=>{i&&b.addEventListener("scroll",n,{passive:!0}),s&&b.addEventListener("resize",n)});const d=c&&a?Bre(c,n):null;let p=-1,f=null;o&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var S;(S=f)==null||S.observe(t)})),n()}),c&&!l&&f.observe(c),t&&f.observe(t));let g,m=l?Ds(e):null;l&&_();function _(){const b=Ds(e);m&&!mP(m,b)&&n(),m=b,g=requestAnimationFrame(_)}return n(),()=>{var b;u.forEach(v=>{i&&v.removeEventListener("scroll",n),s&&v.removeEventListener("resize",n)}),d==null||d(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(g)}}const Ure=mre,$re=bre,zre=pre,Hre=vre,Vre=fre,tR=hre,Gre=yre,Wre=(e,t,n)=>{const r=new Map,i={platform:Fre,...n},s={...i.platform,_c:r};return dre(e,t,{...i,platform:s})};var qre=typeof document<"u",Kre=function(){},Ju=qre?y.useLayoutEffect:Kre;function rh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!rh(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&e.$$typeof)&&!rh(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function bP(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function nR(e,t){const n=bP(e);return Math.round(t*n)/n}function tg(e){const t=y.useRef(e);return Ju(()=>{t.current=e}),t}function Yre(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=e,[u,d]=y.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=y.useState(r);rh(p,r)||f(r);const[g,m]=y.useState(null),[_,b]=y.useState(null),v=y.useCallback(O=>{O!==x.current&&(x.current=O,m(O))},[]),S=y.useCallback(O=>{O!==E.current&&(E.current=O,b(O))},[]),w=s||g,k=o||_,x=y.useRef(null),E=y.useRef(null),T=y.useRef(u),D=l!=null,A=tg(l),R=tg(i),I=tg(c),L=y.useCallback(()=>{if(!x.current||!E.current)return;const O={placement:t,strategy:n,middleware:p};R.current&&(O.platform=R.current),Wre(x.current,E.current,O).then(j=>{const C={...j,isPositioned:I.current!==!1};P.current&&!rh(T.current,C)&&(T.current=C,ia.flushSync(()=>{d(C)}))})},[p,t,n,R,I]);Ju(()=>{c===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(O=>({...O,isPositioned:!1})))},[c]);const P=y.useRef(!1);Ju(()=>(P.current=!0,()=>{P.current=!1}),[]),Ju(()=>{if(w&&(x.current=w),k&&(E.current=k),w&&k){if(A.current)return A.current(w,k,L);L()}},[w,k,L,A,D]);const F=y.useMemo(()=>({reference:x,floating:E,setReference:v,setFloating:S}),[v,S]),B=y.useMemo(()=>({reference:w,floating:k}),[w,k]),U=y.useMemo(()=>{const O={position:n,left:0,top:0};if(!B.floating)return O;const j=nR(B.floating,u.x),C=nR(B.floating,u.y);return a?{...O,transform:"translate("+j+"px, "+C+"px)",...bP(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:C}},[n,a,B.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:L,refs:F,elements:B,floatingStyles:U}),[u,L,F,B,U])}const Xre=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:i}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?tR({element:r.current,padding:i}).fn(n):{}:r?tR({element:r,padding:i}).fn(n):{}}}},Zre=(e,t)=>{const n=Ure(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qre=(e,t)=>{const n=$re(e);return{name:n.name,fn:n.fn,options:[e,t]}},Jre=(e,t)=>({fn:Gre(e).fn,options:[e,t]}),eie=(e,t)=>{const n=zre(e);return{name:n.name,fn:n.fn,options:[e,t]}},tie=(e,t)=>{const n=Hre(e);return{name:n.name,fn:n.fn,options:[e,t]}},nie=(e,t)=>{const n=Vre(e);return{name:n.name,fn:n.fn,options:[e,t]}},rie=(e,t)=>{const n=Xre(e);return{name:n.name,fn:n.fn,options:[e,t]}};var iie="Arrow",yP=y.forwardRef((e,t)=>{const{children:n,width:r=10,height:i=5,...s}=e;return h.jsx(xe.svg,{...s,ref:t,width:r,height:i,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:h.jsx("polygon",{points:"0,0 30,0 15,10"})})});yP.displayName=iie;var sie=yP,b0="Popper",[vP,mp]=Wi(b0),[oie,_P]=vP(b0),SP=e=>{const{__scopePopper:t,children:n}=e,[r,i]=y.useState(null);return h.jsx(oie,{scope:t,anchor:r,onAnchorChange:i,children:n})};SP.displayName=b0;var wP="PopperAnchor",xP=y.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...i}=e,s=_P(wP,n),o=y.useRef(null),a=Me(t,o),l=y.useRef(null);return y.useEffect(()=>{const c=l.current;l.current=(r==null?void 0:r.current)||o.current,c!==l.current&&s.onAnchorChange(l.current)}),r?null:h.jsx(xe.div,{...i,ref:a})});xP.displayName=wP;var y0="PopperContent",[aie,lie]=vP(y0),EP=y.forwardRef((e,t)=>{var G,ie,ae,ce,ue,pe;const{__scopePopper:n,side:r="bottom",sideOffset:i=0,align:s="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:d="partial",hideWhenDetached:p=!1,updatePositionStrategy:f="optimized",onPlaced:g,...m}=e,_=_P(y0,n),[b,v]=y.useState(null),S=Me(t,le=>v(le)),[w,k]=y.useState(null),x=JM(w),E=(x==null?void 0:x.width)??0,T=(x==null?void 0:x.height)??0,D=r+(s!=="center"?"-"+s:""),A=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},R=Array.isArray(c)?c:[c],I=R.length>0,L={padding:A,boundary:R.filter(uie),altBoundary:I},{refs:P,floatingStyles:F,placement:B,isPositioned:U,middlewareData:O}=Yre({strategy:"fixed",placement:D,whileElementsMounted:(...le)=>jre(...le,{animationFrame:f==="always"}),elements:{reference:_.anchor},middleware:[Zre({mainAxis:i+T,alignmentAxis:o}),l&&Qre({mainAxis:!0,crossAxis:!1,limiter:d==="partial"?Jre():void 0,...L}),l&&eie({...L}),tie({...L,apply:({elements:le,rects:Xe,availableWidth:sr,availableHeight:or})=>{const{width:kn,height:Zs}=Xe.reference,Ir=le.floating.style;Ir.setProperty("--radix-popper-available-width",`${sr}px`),Ir.setProperty("--radix-popper-available-height",`${or}px`),Ir.setProperty("--radix-popper-anchor-width",`${kn}px`),Ir.setProperty("--radix-popper-anchor-height",`${Zs}px`)}}),w&&rie({element:w,padding:a}),die({arrowWidth:E,arrowHeight:T}),p&&nie({strategy:"referenceHidden",...L})]}),[j,C]=TP(B),z=Fi(g);Ut(()=>{U&&(z==null||z())},[U,z]);const Z=(G=O.arrow)==null?void 0:G.x,M=(ie=O.arrow)==null?void 0:ie.y,se=((ae=O.arrow)==null?void 0:ae.centerOffset)!==0,[be,$]=y.useState();return Ut(()=>{b&&$(window.getComputedStyle(b).zIndex)},[b]),h.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:U?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:be,"--radix-popper-transform-origin":[(ce=O.transformOrigin)==null?void 0:ce.x,(ue=O.transformOrigin)==null?void 0:ue.y].join(" "),...((pe=O.hide)==null?void 0:pe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:h.jsx(aie,{scope:n,placedSide:j,onArrowChange:k,arrowX:Z,arrowY:M,shouldHideArrow:se,children:h.jsx(xe.div,{"data-side":j,"data-align":C,...m,ref:S,style:{...m.style,animation:U?void 0:"none"}})})})});EP.displayName=y0;var kP="PopperArrow",cie={top:"bottom",right:"left",bottom:"top",left:"right"},CP=y.forwardRef(function(t,n){const{__scopePopper:r,...i}=t,s=lie(kP,r),o=cie[s.placedSide];return h.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:h.jsx(sie,{...i,ref:n,style:{...i.style,display:"block"}})})});CP.displayName=kP;function uie(e){return e!==null}var die=e=>({name:"transformOrigin",options:e,fn(t){var _,b,v;const{placement:n,rects:r,middlewareData:i}=t,o=((_=i.arrow)==null?void 0:_.centerOffset)!==0,a=o?0:e.arrowWidth,l=o?0:e.arrowHeight,[c,u]=TP(n),d={start:"0%",center:"50%",end:"100%"}[u],p=(((b=i.arrow)==null?void 0:b.x)??0)+a/2,f=(((v=i.arrow)==null?void 0:v.y)??0)+l/2;let g="",m="";return c==="bottom"?(g=o?d:`${p}px`,m=`${-l}px`):c==="top"?(g=o?d:`${p}px`,m=`${r.floating.height+l}px`):c==="right"?(g=`${-l}px`,m=o?d:`${f}px`):c==="left"&&(g=`${r.floating.width+l}px`,m=o?d:`${f}px`),{data:{x:g,y:m}}}});function TP(e){const[t,n="center"]=e.split("-");return[t,n]}var AP=SP,v0=xP,RP=EP,NP=CP;function hie(e){const t=pie(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(gie);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function pie(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=bie(i),a=mie(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fie=Symbol("radix.slottable");function gie(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===fie}function mie(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function bie(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var IP=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yie="VisuallyHidden",vie=y.forwardRef((e,t)=>h.jsx(xe.span,{...e,ref:t,style:{...IP,...e.style}}));vie.displayName=yie;var _ie=[" ","Enter","ArrowUp","ArrowDown"],Sie=[" ","Enter"],Ms="Select",[bp,yp,wie]=oP(Ms),[xa]=Wi(Ms,[wie,mp]),vp=mp(),[xie,Ki]=xa(Ms),[Eie,kie]=xa(Ms),OP=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:s,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:p,required:f,form:g}=e,m=vp(t),[_,b]=y.useState(null),[v,S]=y.useState(null),[w,k]=y.useState(!1),x=u0(c),[E,T]=Rs({prop:r,defaultProp:i??!1,onChange:s,caller:Ms}),[D,A]=Rs({prop:o,defaultProp:a,onChange:l,caller:Ms}),R=y.useRef(null),I=_?g||!!_.closest("form"):!0,[L,P]=y.useState(new Set),F=Array.from(L).map(B=>B.props.value).join(";");return h.jsx(AP,{...m,children:h.jsxs(xie,{required:f,scope:t,trigger:_,onTriggerChange:b,valueNode:v,onValueNodeChange:S,valueNodeHasChildren:w,onValueNodeHasChildrenChange:k,contentId:Hr(),value:D,onValueChange:A,open:E,onOpenChange:T,dir:x,triggerPointerDownPosRef:R,disabled:p,children:[h.jsx(bp.Provider,{scope:t,children:h.jsx(Eie,{scope:e.__scopeSelect,onNativeOptionAdd:y.useCallback(B=>{P(U=>new Set(U).add(B))},[]),onNativeOptionRemove:y.useCallback(B=>{P(U=>{const O=new Set(U);return O.delete(B),O})},[]),children:n})}),I?h.jsxs(rF,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:d,value:D,onChange:B=>A(B.target.value),disabled:p,form:g,children:[D===void 0?h.jsx("option",{value:""}):null,Array.from(L)]},F):null]})})};OP.displayName=Ms;var LP="SelectTrigger",DP=y.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...i}=e,s=vp(n),o=Ki(LP,n),a=o.disabled||r,l=Me(t,o.onTriggerChange),c=yp(n),u=y.useRef("touch"),[d,p,f]=sF(m=>{const _=c().filter(S=>!S.disabled),b=_.find(S=>S.value===o.value),v=oF(_,m,b);v!==void 0&&o.onValueChange(v.value)}),g=m=>{a||(o.onOpenChange(!0),f()),m&&(o.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return h.jsx(v0,{asChild:!0,...s,children:h.jsx(xe.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":iF(o.value)?"":void 0,...i,ref:l,onClick:ye(i.onClick,m=>{m.currentTarget.focus(),u.current!=="mouse"&&g(m)}),onPointerDown:ye(i.onPointerDown,m=>{u.current=m.pointerType;const _=m.target;_.hasPointerCapture(m.pointerId)&&_.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(g(m),m.preventDefault())}),onKeyDown:ye(i.onKeyDown,m=>{const _=d.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(_&&m.key===" ")&&_ie.includes(m.key)&&(g(),m.preventDefault())})})})});DP.displayName=LP;var MP="SelectValue",PP=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,children:s,placeholder:o="",...a}=e,l=Ki(MP,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,d=Me(t,l.onValueNodeChange);return Ut(()=>{c(u)},[c,u]),h.jsx(xe.span,{...a,ref:d,style:{pointerEvents:"none"},children:iF(l.value)?h.jsx(h.Fragment,{children:o}):s})});PP.displayName=MP;var Cie="SelectIcon",FP=y.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...i}=e;return h.jsx(xe.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});FP.displayName=Cie;var Tie="SelectPortal",BP=e=>h.jsx(Uh,{asChild:!0,...e});BP.displayName=Tie;var Ps="SelectContent",jP=y.forwardRef((e,t)=>{const n=Ki(Ps,e.__scopeSelect),[r,i]=y.useState();if(Ut(()=>{i(new DocumentFragment)},[]),!n.open){const s=r;return s?ia.createPortal(h.jsx(UP,{scope:e.__scopeSelect,children:h.jsx(bp.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),s):null}return h.jsx($P,{...e,ref:t})});jP.displayName=Ps;var Wn=10,[UP,Yi]=xa(Ps),Aie="SelectContentImpl",Rie=hie("SelectContent.RemoveScroll"),$P=y.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:_,...b}=e,v=Ki(Ps,n),[S,w]=y.useState(null),[k,x]=y.useState(null),E=Me(t,G=>w(G)),[T,D]=y.useState(null),[A,R]=y.useState(null),I=yp(n),[L,P]=y.useState(!1),F=y.useRef(!1);y.useEffect(()=>{if(S)return Cv(S)},[S]),kv();const B=y.useCallback(G=>{const[ie,...ae]=I().map(pe=>pe.ref.current),[ce]=ae.slice(-1),ue=document.activeElement;for(const pe of G)if(pe===ue||(pe==null||pe.scrollIntoView({block:"nearest"}),pe===ie&&k&&(k.scrollTop=0),pe===ce&&k&&(k.scrollTop=k.scrollHeight),pe==null||pe.focus(),document.activeElement!==ue))return},[I,k]),U=y.useCallback(()=>B([T,S]),[B,T,S]);y.useEffect(()=>{L&&U()},[L,U]);const{onOpenChange:O,triggerPointerDownPosRef:j}=v;y.useEffect(()=>{if(S){let G={x:0,y:0};const ie=ce=>{var ue,pe;G={x:Math.abs(Math.round(ce.pageX)-(((ue=j.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(ce.pageY)-(((pe=j.current)==null?void 0:pe.y)??0))}},ae=ce=>{G.x<=10&&G.y<=10?ce.preventDefault():S.contains(ce.target)||O(!1),document.removeEventListener("pointermove",ie),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",ae,{capture:!0})}}},[S,O,j]),y.useEffect(()=>{const G=()=>O(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[O]);const[C,z]=sF(G=>{const ie=I().filter(ue=>!ue.disabled),ae=ie.find(ue=>ue.ref.current===document.activeElement),ce=oF(ie,G,ae);ce&&setTimeout(()=>ce.ref.current.focus())}),Z=y.useCallback((G,ie,ae)=>{const ce=!F.current&&!ae;(v.value!==void 0&&v.value===ie||ce)&&(D(G),ce&&(F.current=!0))},[v.value]),M=y.useCallback(()=>S==null?void 0:S.focus(),[S]),se=y.useCallback((G,ie,ae)=>{const ce=!F.current&&!ae;(v.value!==void 0&&v.value===ie||ce)&&R(G)},[v.value]),be=r==="popper"?Ub:zP,$=be===Ub?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:p,collisionPadding:f,sticky:g,hideWhenDetached:m,avoidCollisions:_}:{};return h.jsx(UP,{scope:n,content:S,viewport:k,onViewportChange:x,itemRefCallback:Z,selectedItem:T,onItemLeave:M,itemTextRefCallback:se,focusSelectedItem:U,selectedItemText:A,position:r,isPositioned:L,searchRef:C,children:h.jsx(zh,{as:Rie,allowPinchZoom:!0,children:h.jsx(jh,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:ye(i,G=>{var ie;(ie=v.trigger)==null||ie.focus({preventScroll:!0}),G.preventDefault()}),children:h.jsx(Bh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:o,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:h.jsx(be,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...b,...$,onPlaced:()=>P(!0),ref:E,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:ye(b.onKeyDown,G=>{const ie=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!ie&&G.key.length===1&&z(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let ce=I().filter(ue=>!ue.disabled).map(ue=>ue.ref.current);if(["ArrowUp","End"].includes(G.key)&&(ce=ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const ue=G.target,pe=ce.indexOf(ue);ce=ce.slice(pe+1)}setTimeout(()=>B(ce)),G.preventDefault()}})})})})})})});$P.displayName=Aie;var Nie="SelectItemAlignedPosition",zP=y.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...i}=e,s=Ki(Ps,n),o=Yi(Ps,n),[a,l]=y.useState(null),[c,u]=y.useState(null),d=Me(t,E=>u(E)),p=yp(n),f=y.useRef(!1),g=y.useRef(!0),{viewport:m,selectedItem:_,selectedItemText:b,focusSelectedItem:v}=o,S=y.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&m&&_&&b){const E=s.trigger.getBoundingClientRect(),T=c.getBoundingClientRect(),D=s.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(s.dir!=="rtl"){const ue=A.left-T.left,pe=D.left-ue,le=E.left-pe,Xe=E.width+le,sr=Math.max(Xe,T.width),or=window.innerWidth-Wn,kn=VA(pe,[Wn,Math.max(Wn,or-sr)]);a.style.minWidth=Xe+"px",a.style.left=kn+"px"}else{const ue=T.right-A.right,pe=window.innerWidth-D.right-ue,le=window.innerWidth-E.right-pe,Xe=E.width+le,sr=Math.max(Xe,T.width),or=window.innerWidth-Wn,kn=VA(pe,[Wn,Math.max(Wn,or-sr)]);a.style.minWidth=Xe+"px",a.style.right=kn+"px"}const R=p(),I=window.innerHeight-Wn*2,L=m.scrollHeight,P=window.getComputedStyle(c),F=parseInt(P.borderTopWidth,10),B=parseInt(P.paddingTop,10),U=parseInt(P.borderBottomWidth,10),O=parseInt(P.paddingBottom,10),j=F+B+L+O+U,C=Math.min(_.offsetHeight*5,j),z=window.getComputedStyle(m),Z=parseInt(z.paddingTop,10),M=parseInt(z.paddingBottom,10),se=E.top+E.height/2-Wn,be=I-se,$=_.offsetHeight/2,G=_.offsetTop+$,ie=F+B+G,ae=j-ie;if(ie<=se){const ue=R.length>0&&_===R[R.length-1].ref.current;a.style.bottom="0px";const pe=c.clientHeight-m.offsetTop-m.offsetHeight,le=Math.max(be,$+(ue?M:0)+pe+U),Xe=ie+le;a.style.height=Xe+"px"}else{const ue=R.length>0&&_===R[0].ref.current;a.style.top="0px";const le=Math.max(se,F+m.offsetTop+(ue?Z:0)+$)+ae;a.style.height=le+"px",m.scrollTop=ie-se+m.offsetTop}a.style.margin=`${Wn}px 0`,a.style.minHeight=C+"px",a.style.maxHeight=I+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[p,s.trigger,s.valueNode,a,c,m,_,b,s.dir,r]);Ut(()=>S(),[S]);const[w,k]=y.useState();Ut(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const x=y.useCallback(E=>{E&&g.current===!0&&(S(),v==null||v(),g.current=!1)},[S,v]);return h.jsx(Oie,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:f,onScrollButtonChange:x,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:w},children:h.jsx(xe.div,{...i,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});zP.displayName=Nie;var Iie="SelectPopperPosition",Ub=y.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:i=Wn,...s}=e,o=vp(n);return h.jsx(RP,{...o,...s,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Ub.displayName=Iie;var[Oie,_0]=xa(Ps,{}),$b="SelectViewport",HP=y.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...i}=e,s=Yi($b,n),o=_0($b,n),a=Me(t,s.onViewportChange),l=y.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(bp.Slot,{scope:n,children:h.jsx(xe.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:ye(i.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:p}=o;if(p!=null&&p.current&&d){const f=Math.abs(l.current-u.scrollTop);if(f>0){const g=window.innerHeight-Wn*2,m=parseFloat(d.style.minHeight),_=parseFloat(d.style.height),b=Math.max(m,_);if(b<g){const v=b+f,S=Math.min(g,v),w=v-S;d.style.height=S+"px",d.style.bottom==="0px"&&(u.scrollTop=w>0?w:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});HP.displayName=$b;var VP="SelectGroup",[Lie,Die]=xa(VP),GP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Hr();return h.jsx(Lie,{scope:n,id:i,children:h.jsx(xe.div,{role:"group","aria-labelledby":i,...r,ref:t})})});GP.displayName=VP;var WP="SelectLabel",qP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=Die(WP,n);return h.jsx(xe.div,{id:i.id,...r,ref:t})});qP.displayName=WP;var ih="SelectItem",[Mie,KP]=xa(ih),YP=y.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:i=!1,textValue:s,...o}=e,a=Ki(ih,n),l=Yi(ih,n),c=a.value===r,[u,d]=y.useState(s??""),[p,f]=y.useState(!1),g=Me(t,v=>{var S;return(S=l.itemRefCallback)==null?void 0:S.call(l,v,r,i)}),m=Hr(),_=y.useRef("touch"),b=()=>{i||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(Mie,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:y.useCallback(v=>{d(S=>S||((v==null?void 0:v.textContent)??"").trim())},[]),children:h.jsx(bp.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:h.jsx(xe.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":c&&p,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:g,onFocus:ye(o.onFocus,()=>f(!0)),onBlur:ye(o.onBlur,()=>f(!1)),onClick:ye(o.onClick,()=>{_.current!=="mouse"&&b()}),onPointerUp:ye(o.onPointerUp,()=>{_.current==="mouse"&&b()}),onPointerDown:ye(o.onPointerDown,v=>{_.current=v.pointerType}),onPointerMove:ye(o.onPointerMove,v=>{var S;_.current=v.pointerType,i?(S=l.onItemLeave)==null||S.call(l):_.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ye(o.onPointerLeave,v=>{var S;v.currentTarget===document.activeElement&&((S=l.onItemLeave)==null||S.call(l))}),onKeyDown:ye(o.onKeyDown,v=>{var w;((w=l.searchRef)==null?void 0:w.current)!==""&&v.key===" "||(Sie.includes(v.key)&&b(),v.key===" "&&v.preventDefault())})})})})});YP.displayName=ih;var tl="SelectItemText",XP=y.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:i,...s}=e,o=Ki(tl,n),a=Yi(tl,n),l=KP(tl,n),c=kie(tl,n),[u,d]=y.useState(null),p=Me(t,b=>d(b),l.onItemTextChange,b=>{var v;return(v=a.itemTextRefCallback)==null?void 0:v.call(a,b,l.value,l.disabled)}),f=u==null?void 0:u.textContent,g=y.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:f},l.value),[l.disabled,l.value,f]),{onNativeOptionAdd:m,onNativeOptionRemove:_}=c;return Ut(()=>(m(g),()=>_(g)),[m,_,g]),h.jsxs(h.Fragment,{children:[h.jsx(xe.span,{id:l.textId,...s,ref:p}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?ia.createPortal(s.children,o.valueNode):null]})});XP.displayName=tl;var ZP="SelectItemIndicator",QP=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return KP(ZP,n).isSelected?h.jsx(xe.span,{"aria-hidden":!0,...r,ref:t}):null});QP.displayName=ZP;var zb="SelectScrollUpButton",JP=y.forwardRef((e,t)=>{const n=Yi(zb,e.__scopeSelect),r=_0(zb,e.__scopeSelect),[i,s]=y.useState(!1),o=Me(t,r.onScrollButtonChange);return Ut(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?h.jsx(tF,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});JP.displayName=zb;var Hb="SelectScrollDownButton",eF=y.forwardRef((e,t)=>{const n=Yi(Hb,e.__scopeSelect),r=_0(Hb,e.__scopeSelect),[i,s]=y.useState(!1),o=Me(t,r.onScrollButtonChange);return Ut(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),i?h.jsx(tF,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});eF.displayName=Hb;var tF=y.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...i}=e,s=Yi("SelectScrollButton",n),o=y.useRef(null),a=yp(n),l=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>l(),[l]),Ut(()=>{var u;const c=a().find(d=>d.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),h.jsx(xe.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:ye(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:ye(i.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:ye(i.onPointerLeave,()=>{l()})})}),Pie="SelectSeparator",nF=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(xe.div,{"aria-hidden":!0,...r,ref:t})});nF.displayName=Pie;var Vb="SelectArrow",Fie=y.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,i=vp(n),s=Ki(Vb,n),o=Yi(Vb,n);return s.open&&o.position==="popper"?h.jsx(NP,{...i,...r,ref:t}):null});Fie.displayName=Vb;var Bie="SelectBubbleInput",rF=y.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const i=y.useRef(null),s=Me(r,i),o=QM(t);return y.useEffect(()=>{const a=i.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[o,t]),h.jsx(xe.select,{...n,style:{...IP,...n.style},ref:s,defaultValue:t})});rF.displayName=Bie;function iF(e){return e===""||e===void 0}function sF(e){const t=Fi(e),n=y.useRef(""),r=y.useRef(0),i=y.useCallback(o=>{const a=n.current+o;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,s]}function oF(e,t,n){const i=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let o=jie(e,Math.max(s,0));i.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(i.toLowerCase()));return l!==n?l:void 0}function jie(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Uie=OP,aF=DP,$ie=PP,zie=FP,Hie=BP,lF=jP,Vie=HP,Gie=GP,cF=qP,uF=YP,Wie=XP,qie=QP,dF=JP,hF=eF,pF=nF;const sh=Uie,ng=Gie,oh=$ie,ic=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(aF,{ref:r,className:X("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(zie,{asChild:!0,children:h.jsx(Mh,{className:"h-4 w-4 opacity-50"})})]}));ic.displayName=aF.displayName;const fF=y.forwardRef(({className:e,...t},n)=>h.jsx(dF,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(tV,{className:"h-4 w-4"})}));fF.displayName=dF.displayName;const gF=y.forwardRef(({className:e,...t},n)=>h.jsx(hF,{ref:n,className:X("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Mh,{className:"h-4 w-4"})}));gF.displayName=hF.displayName;const sc=y.forwardRef(({className:e,children:t,position:n="popper",...r},i)=>h.jsx(Hie,{children:h.jsxs(lF,{ref:i,className:X("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx(fF,{}),h.jsx(Vie,{className:X("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(gF,{})]})}));sc.displayName=lF.displayName;const ed=y.forwardRef(({className:e,...t},n)=>h.jsx(cF,{ref:n,className:X("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));ed.displayName=cF.displayName;const Rn=y.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(uF,{ref:r,className:X("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(qie,{children:h.jsx(jL,{className:"h-4 w-4"})})}),h.jsx(Wie,{children:t})]}));Rn.displayName=uF.displayName;const Kie=y.forwardRef(({className:e,...t},n)=>h.jsx(pF,{ref:n,className:X("-mx-1 my-1 h-px bg-muted",e),...t}));Kie.displayName=pF.displayName;function Yie(e){const t=Xie(e),n=y.forwardRef((r,i)=>{const{children:s,...o}=r,a=y.Children.toArray(s),l=a.find(Qie);if(l){const c=l.props.children,u=a.map(d=>d===l?y.Children.count(c)>1?y.Children.only(null):y.isValidElement(c)?c.props.children:null:d);return h.jsx(t,{...o,ref:i,children:y.isValidElement(c)?y.cloneElement(c,void 0,u):null})}return h.jsx(t,{...o,ref:i,children:s})});return n.displayName=`${e}.Slot`,n}function Xie(e){const t=y.forwardRef((n,r)=>{const{children:i,...s}=n;if(y.isValidElement(i)){const o=ese(i),a=Jie(s,i.props);return i.type!==y.Fragment&&(a.ref=r?Us(r,o):o),y.cloneElement(i,a)}return y.Children.count(i)>1?y.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zie=Symbol("radix.slottable");function Qie(e){return y.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zie}function Jie(e,t){const n={...t};for(const r in t){const i=e[r],s=t[r];/^on[A-Z]/.test(r)?i&&s?n[r]=(...a)=>{const l=s(...a);return i(...a),l}:i&&(n[r]=i):r==="style"?n[r]={...i,...s}:r==="className"&&(n[r]=[i,s].filter(Boolean).join(" "))}return{...e,...n}}function ese(e){var r,i;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(i=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:i.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _p="Popover",[mF]=Wi(_p,[mp]),Ic=mp(),[tse,Xi]=mF(_p),bF=e=>{const{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:s,modal:o=!1}=e,a=Ic(t),l=y.useRef(null),[c,u]=y.useState(!1),[d,p]=Rs({prop:r,defaultProp:i??!1,onChange:s,caller:_p});return h.jsx(AP,{...a,children:h.jsx(tse,{scope:t,contentId:Hr(),triggerRef:l,open:d,onOpenChange:p,onOpenToggle:y.useCallback(()=>p(f=>!f),[p]),hasCustomAnchor:c,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})};bF.displayName=_p;var yF="PopoverAnchor",nse=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(yF,n),s=Ic(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=i;return y.useEffect(()=>(o(),()=>a()),[o,a]),h.jsx(v0,{...s,...r,ref:t})});nse.displayName=yF;var vF="PopoverTrigger",_F=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(vF,n),s=Ic(n),o=Me(t,i.triggerRef),a=h.jsx(xe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.contentId,"data-state":kF(i.open),...r,ref:o,onClick:ye(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?a:h.jsx(v0,{asChild:!0,...s,children:a})});_F.displayName=vF;var S0="PopoverPortal",[rse,ise]=mF(S0,{forceMount:void 0}),SF=e=>{const{__scopePopover:t,forceMount:n,children:r,container:i}=e,s=Xi(S0,t);return h.jsx(rse,{scope:t,forceMount:n,children:h.jsx(zs,{present:n||s.open,children:h.jsx(Uh,{asChild:!0,container:i,children:r})})})};SF.displayName=S0;var ea="PopoverContent",wF=y.forwardRef((e,t)=>{const n=ise(ea,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,s=Xi(ea,e.__scopePopover);return h.jsx(zs,{present:r||s.open,children:s.modal?h.jsx(ose,{...i,ref:t}):h.jsx(ase,{...i,ref:t})})});wF.displayName=ea;var sse=Yie("PopoverContent.RemoveScroll"),ose=y.forwardRef((e,t)=>{const n=Xi(ea,e.__scopePopover),r=y.useRef(null),i=Me(t,r),s=y.useRef(!1);return y.useEffect(()=>{const o=r.current;if(o)return Cv(o)},[]),h.jsx(zh,{as:sse,allowPinchZoom:!0,children:h.jsx(xF,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ye(e.onCloseAutoFocus,o=>{var a;o.preventDefault(),s.current||(a=n.triggerRef.current)==null||a.focus()}),onPointerDownOutside:ye(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;s.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:ye(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),ase=y.forwardRef((e,t)=>{const n=Xi(ea,e.__scopePopover),r=y.useRef(!1),i=y.useRef(!1);return h.jsx(xF,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var o,a;(o=e.onCloseAutoFocus)==null||o.call(e,s),s.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),s.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:s=>{var l,c;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(r.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));const o=s.target;((c=n.triggerRef.current)==null?void 0:c.contains(o))&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})}),xF=y.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...d}=e,p=Xi(ea,n),f=Ic(n);return kv(),h.jsx(jh,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:s,children:h.jsx(Bh,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>p.onOpenChange(!1),children:h.jsx(RP,{"data-state":kF(p.open),role:"dialog",id:p.contentId,...f,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),EF="PopoverClose",lse=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Xi(EF,n);return h.jsx(xe.button,{type:"button",...r,ref:t,onClick:ye(e.onClick,()=>i.onOpenChange(!1))})});lse.displayName=EF;var cse="PopoverArrow",use=y.forwardRef((e,t)=>{const{__scopePopover:n,...r}=e,i=Ic(n);return h.jsx(NP,{...i,...r,ref:t})});use.displayName=cse;function kF(e){return e?"open":"closed"}var dse=bF,hse=_F,pse=SF,CF=wF;const fse=dse,gse=hse,TF=y.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},i)=>h.jsx(pse,{children:h.jsx(CF,{ref:i,align:t,sideOffset:n,className:X("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r})}));TF.displayName=CF.displayName;function mse({projectId:e,config:t,onChange:n}){var k;const[r,i]=y.useState([]),[s,o]=y.useState([]),[a,l]=y.useState(null),[c,u]=y.useState(!1),d=y.useRef(null);y.useEffect(()=>{V6().then(i).catch(console.error),pf(e).then(o).catch(console.error)},[e]);const p=x=>{n({...t,...x})},f=async x=>{if(x.startsWith("preset:")){const E=x.replace("preset:",""),T=r.find(D=>D.id===E);if(T&&!T.downloaded){l(E);try{await G6(E),i(A=>A.map(R=>R.id===E?{...R,downloaded:!0}:R));const D=await pf(e);o(D)}catch(D){console.error("Failed to download preset:",D),l(null);return}l(null)}}p({source:x})},g=async x=>{const E=d.current;E&&(E.dataset.scope=x,E.click())},m=async x=>{var D;const E=(D=x.target.files)==null?void 0:D[0];if(!E)return;const T=x.target.dataset.scope||"global";u(!0);try{const{name:A}=await W6(E,T,e),R=await pf(e);o(R),p({source:`${T==="project"?"project":"global"}:${A}`})}catch(A){console.error("Upload failed:",A)}finally{u(!1),x.target.value=""}},_=s.filter(x=>x.source.startsWith("preset:")),b=s.filter(x=>x.source.startsWith("global:")),v=s.filter(x=>x.source.startsWith("project:")),S=r.filter(x=>!x.downloaded&&!_.some(E=>E.source===`preset:${x.id}`)),w=t.playMode==="interval"||t.playMode==="auto"&&((k=r.find(x=>`preset:${x.id}`===t.source))==null?void 0:k.type)==="strike";return h.jsxs(fse,{children:[h.jsx(gse,{asChild:!0,children:h.jsx(ne,{variant:"ghost",size:"icon",className:"h-8 w-8",children:h.jsx(fV,{className:`h-4 w-4 ${t.enabled?"text-primary":""}`})})}),h.jsx(TF,{className:"w-[300px]",children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(ze,{className:"text-sm font-medium",children:"背景音效"}),h.jsx(c0,{checked:t.enabled,onCheckedChange:x=>p({enabled:x})})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"音源"}),h.jsxs(sh,{value:t.source,onValueChange:f,children:[h.jsx(ic,{className:"h-8 text-xs",children:h.jsx(oh,{placeholder:"选择音源"})}),h.jsxs(sc,{children:[(_.length>0||S.length>0)&&h.jsxs(ng,{children:[h.jsx(ed,{children:"预设音效"}),_.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source)),S.map(x=>h.jsx(Rn,{value:`preset:${x.id}`,className:"text-xs",children:h.jsxs("span",{className:"flex items-center gap-1.5",children:[x.name,a===x.id?h.jsx(ml,{className:"h-3 w-3 animate-spin"}):h.jsx(Bd,{className:"h-3 w-3 text-muted-foreground"})]})},`preset:${x.id}`))]}),b.length>0&&h.jsxs(ng,{children:[h.jsx(ed,{children:"全局自定义"}),b.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source))]}),v.length>0&&h.jsxs(ng,{children:[h.jsx(ed,{children:"项目自定义"}),v.map(x=>h.jsx(Rn,{value:x.source,className:"text-xs",children:x.name},x.source))]})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"播放模式"}),h.jsxs(sh,{value:t.playMode,onValueChange:x=>p({playMode:x}),children:[h.jsx(ic,{className:"h-8 text-xs",children:h.jsx(oh,{})}),h.jsxs(sc,{children:[h.jsx(Rn,{value:"auto",className:"text-xs",children:"自动"}),h.jsx(Rn,{value:"loop",className:"text-xs",children:"循环"}),h.jsx(Rn,{value:"interval",className:"text-xs",children:"随机间隔"})]})]})]}),h.jsxs("div",{className:"space-y-1.5",children:[h.jsxs(ze,{className:"text-xs text-muted-foreground",children:["音量: ",Math.round(t.volume*100),"%"]}),h.jsx("input",{type:"range",min:0,max:100,value:Math.round(t.volume*100),onChange:x=>p({volume:Number(x.target.value)/100}),className:"w-full h-1.5 accent-primary cursor-pointer"})]}),w&&h.jsxs("div",{className:"space-y-1.5",children:[h.jsx(ze,{className:"text-xs text-muted-foreground",children:"间隔范围(秒)"}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("input",{type:"number",min:1,value:t.intervalRange[0],onChange:x=>p({intervalRange:[Number(x.target.value),t.intervalRange[1]]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"}),h.jsx("span",{className:"text-xs text-muted-foreground",children:"~"}),h.jsx("input",{type:"number",min:1,value:t.intervalRange[1],onChange:x=>p({intervalRange:[t.intervalRange[0],Number(x.target.value)]}),className:"w-20 h-8 rounded-md border bg-background px-2 text-xs"})]})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("global"),children:[c?h.jsx(ml,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(Im,{className:"h-3 w-3 mr-1"}),"上传全局"]}),h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1 h-7 text-xs",disabled:c,onClick:()=>g("project"),children:[c?h.jsx(ml,{className:"h-3 w-3 mr-1 animate-spin"}):h.jsx(Im,{className:"h-3 w-3 mr-1"}),"上传项目"]})]}),h.jsx("input",{ref:d,type:"file",accept:"audio/*",className:"hidden",onChange:m})]})})]})}const bse=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}`,yse=5,vse=3e3;function _se(e,t){const n=y.useRef(null),r=y.useRef(0),i=y.useRef(!0),s=y.useRef(t);s.current=t;const o=y.useRef(!1),a=y.useCallback(f=>{var g;((g=n.current)==null?void 0:g.readyState)===WebSocket.OPEN&&n.current.send(JSON.stringify(f))},[]),l=y.useCallback((f,g)=>{var m;((m=n.current)==null?void 0:m.readyState)===WebSocket.OPEN?(n.current.send(JSON.stringify({type:"terminal_subscribe",cols:f,rows:g})),o.current=!1):o.current=!0},[]),c=y.useCallback(f=>{a({type:"terminal_input",data:f})},[a]),u=y.useCallback((f,g)=>{a({type:"terminal_resize",cols:f,rows:g})},[a]),d=y.useCallback(()=>{a({type:"chat_subscribe"})},[a]),p=y.useCallback(()=>{if(!i.current)return;const f=Zr();if(!f){window.location.href="/login";return}const g=new WebSocket(`${bse}/ws/projects/${e}`);n.current=g,g.onopen=()=>{r.current=0,g.send(JSON.stringify({type:"auth",token:f}))},g.onmessage=m=>{var b,v,S,w,k,x,E,T;let _;try{_=JSON.parse(m.data)}catch{return}switch(_.type){case"connected":o.current=!1,(v=(b=s.current).onConnected)==null||v.call(b);break;case"terminal_data":(w=(S=s.current).onTerminalData)==null||w.call(S,_.data);break;case"status":(x=(k=s.current).onStatus)==null||x.call(k,_.status);break;case"chat_message":{const D=_;(T=(E=s.current).onChatMessage)==null||T.call(E,D);break}case"error":console.error("[WS] Server error:",_.message);break}},g.onclose=()=>{n.current=null,i.current&&r.current<yse&&(r.current++,setTimeout(p,vse))},g.onerror=m=>{console.error("[WS] WebSocket error:",m)}},[e]);return y.useEffect(()=>(i.current=!0,p(),()=>{var f;i.current=!1,(f=n.current)==null||f.close(),n.current=null}),[p]),{subscribeTerminal:l,sendTerminalInput:c,sendTerminalResize:u,subscribeChatMessages:d}}function rg({icon:e,label:t,content:n}){const[r,i]=y.useState(!1);return h.jsxs("div",{className:"border border-border rounded mt-1.5",children:[h.jsxs("button",{className:"flex items-center gap-1.5 w-full px-2.5 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(s=>!s),children:[h.jsx(Ph,{className:X("h-3 w-3 transition-transform",r&&"rotate-90")}),h.jsx(e,{className:"h-3 w-3"}),h.jsx("span",{className:"truncate",children:t})]}),h.jsx(Jn,{children:r&&h.jsx(Ke.pre,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"px-3 pb-2 text-xs text-muted-foreground whitespace-pre-wrap break-words max-h-40 overflow-auto",children:n})})]})}function Sse({blocks:e}){return h.jsx(h.Fragment,{children:e.map((t,n)=>t.type==="text"?h.jsx("div",{className:"prose dark:prose-invert prose-sm max-w-none",children:h.jsx(tM,{remarkPlugins:[kM],children:t.content})},n):t.type==="thinking"?h.jsx(rg,{icon:Sv,label:"Thinking...",content:t.content},n):t.type==="tool_use"?h.jsx(rg,{icon:AV,label:t.content.split("(")[0],content:t.content},n):t.type==="tool_result"?h.jsx(rg,{icon:iV,label:"Result",content:t.content},n):null)})}function wse({messages:e,onSend:t,readOnly:n}){const[r,i]=y.useState(""),s=y.useRef(null),o=y.useRef(null);y.useEffect(()=>{var u;(u=s.current)==null||u.scrollIntoView({behavior:"smooth"})},[e.length]);const a=()=>{const u=r.trim();u&&(t(u+"\r"),i(""),o.current&&(o.current.style.height="auto"))},l=u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),a())},c=u=>{u.style.height="auto",u.style.height=Math.min(u.scrollHeight,120)+"px"};return h.jsxs("div",{className:"flex flex-col h-full bg-background",children:[h.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3 min-h-0",children:[e.length===0&&h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"等待对话..."}),e.map((u,d)=>h.jsx(Ke.div,{initial:{opacity:0,y:10,x:u.role==="user"?12:-12},animate:{opacity:1,y:0,x:0},transition:{duration:.25,ease:"easeOut"},className:X("flex",u.role==="user"?"justify-end":"justify-start"),children:h.jsxs("div",{className:X("max-w-[85%] rounded-lg px-3 py-2 text-sm",u.role==="user"?"bg-blue-100 text-blue-900 dark:bg-blue-600 dark:text-white":"bg-muted"),children:[h.jsx(Sse,{blocks:u.blocks}),h.jsx("div",{className:"text-[10px] opacity-50 mt-1",children:new Date(u.timestamp).toLocaleTimeString()})]})},d)),h.jsx("div",{ref:s})]}),!n&&h.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end flex-shrink-0",children:[h.jsx("textarea",{ref:o,value:r,onChange:u=>{i(u.target.value),c(u.target)},onKeyDown:l,placeholder:"输入消息...",rows:1,className:"flex-1 resize-none bg-muted rounded-md px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring",style:{maxHeight:"120px"}}),h.jsx(Ke.button,{onClick:a,disabled:!r.trim(),whileTap:{scale:.93},className:"p-2 rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50 transition-colors flex-shrink-0",children:h.jsx(_V,{className:"h-4 w-4"})})]})]})}function xse({status:e}){const t={running:"bg-green-500/10 text-green-600 border-green-500/20",stopped:"bg-muted text-muted-foreground border-border",restarting:"bg-yellow-500/10 text-yellow-600 border-yellow-500/20"};return h.jsxs("span",{className:X("inline-flex items-center gap-1.5 text-xs font-medium px-2.5 py-1 rounded-full border",t[e]),children:[h.jsx("span",{className:X("w-1.5 h-1.5 rounded-full",{"bg-green-500":e==="running","bg-muted-foreground":e==="stopped","bg-yellow-400 animate-pulse":e==="restarting"})}),e.charAt(0).toUpperCase()+e.slice(1)]})}function Ese(){const{id:e}=tU(),t=js(),[n,r]=y.useState(null),[i,s]=y.useState(!0),[o,a]=y.useState(!1),[l,c]=y.useState(!1),[u,d]=y.useState({enabled:!1,source:"preset:rain",playMode:"auto",volume:.5,intervalRange:[3,8]}),[p,f]=y.useState(!1),g=y.useRef(null),[m,_]=y.useState(()=>{try{return localStorage.getItem(`cc_viewmode_${e}`)==="chat"?"chat":"terminal"}catch{return"terminal"}}),[b,v]=y.useState([]),S=async()=>{if(e){c(!0);try{await j6(e)}catch($){alert($ instanceof Error?$.message:"备份失败")}finally{c(!1)}}},[w,k]=y.useState(()=>{try{return localStorage.getItem("cc_panel_filetree")!=="false"}catch{return!0}}),[x,E]=y.useState(()=>{try{return localStorage.getItem("cc_panel_shortcuts")!=="false"}catch{return!0}}),T=()=>k($=>(localStorage.setItem("cc_panel_filetree",String(!$)),!$)),D=()=>E($=>(localStorage.setItem("cc_panel_shortcuts",String(!$)),!$)),[A,R]=y.useState(!1);y.useEffect(()=>{const $=()=>R(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$),()=>document.removeEventListener("fullscreenchange",$)},[]);const I=()=>{document.fullscreenElement?document.exitFullscreen():document.documentElement.requestFullscreen()},L=y.useRef(null),P=y.useRef(null),F=y.useRef(null),B=y.useRef(null),U=y.useCallback($=>{var G;(G=L.current)==null||G.write($),f(!0),g.current&&clearTimeout(g.current),g.current=setTimeout(()=>f(!1),3e3)},[]),O=y.useCallback(()=>{var G;const $=P.current;$&&F.current&&F.current($.cols,$.rows),(G=B.current)==null||G.call(B)},[]),{subscribeTerminal:j,sendTerminalInput:C,sendTerminalResize:z,subscribeChatMessages:Z}=_se(e??"",{onTerminalData:U,onStatus:$=>r(G=>G&&{...G,status:$}),onConnected:()=>{v([]),O()},onChatMessage:$=>{v(G=>[...G,$])}});y.useEffect(()=>{F.current=j},[j]),y.useEffect(()=>{B.current=Z},[Z]);const M=y.useCallback(($,G)=>{P.current={cols:$,rows:G},O()},[O]);y.useEffect(()=>{if(!e)return;(async()=>{try{const ie=(await DL()).find(ae=>ae.id===e)??null;r(ie),ie!=null&&ie.sound&&d(ie.sound)}catch(G){console.error("Failed to load project:",G)}finally{s(!1)}})()},[e]);const se=async()=>{if(n){a(!0);try{r(await m6(n.id))}catch($){console.error($)}finally{a(!1)}}},be=async()=>{if(n){a(!0);try{r(await b6(n.id))}catch($){console.error($)}finally{a(!1)}}};return i?h.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background",children:h.jsx("span",{className:"text-muted-foreground text-sm",children:"Loading…"})}):!n||!e?h.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 bg-background",children:[h.jsx("p",{className:"text-muted-foreground",children:"Project not found."}),h.jsxs(ne,{variant:"outline",onClick:()=>t("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-2"}),"Back to Dashboard"]})]}):h.jsxs("div",{className:"h-screen flex flex-col bg-background",children:[h.jsx("header",{className:"border-b border-border flex-shrink-0 bg-muted/50",children:h.jsxs("div",{className:"px-3 h-12 flex items-center gap-2",children:[h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>t("/"),children:h.jsx(Gl,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",w?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:T,title:"Toggle file tree",children:h.jsx(mV,{className:"h-4 w-4"})}),h.jsx("button",{className:X("p-1 rounded transition-colors",x?"text-foreground bg-muted":"text-muted-foreground hover:text-foreground hover:bg-muted"),onClick:D,title:"Toggle right panel",children:h.jsx(bV,{className:"h-4 w-4"})}),h.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2 ml-1",children:[h.jsx("h1",{className:"font-semibold text-foreground truncate text-sm",children:n.name}),h.jsx(xse,{status:n.status}),h.jsx(gr,{variant:"outline",className:"text-xs",children:n.permissionMode==="unlimited"?"Unlimited":"Limited"}),h.jsx("span",{className:"text-xs text-muted-foreground font-mono truncate hidden lg:block",children:n.folderPath})]}),h.jsx(xD,{className:"mr-2"}),h.jsx(kD,{}),h.jsx(ne,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:I,title:A?"退出全屏":"全屏",children:A?h.jsx(xv,{className:"h-3.5 w-3.5"}):h.jsx(wv,{className:"h-3.5 w-3.5"})}),e&&h.jsx(mse,{projectId:e,config:u,onChange:$=>{d($),q6(e,$)}}),h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void S(),disabled:l,title:"备份到云盘",children:[l?h.jsx(ml,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}):h.jsx(TV,{className:"h-3.5 w-3.5 mr-1.5"}),"备份"]}),n.status==="running"||n.status==="restarting"?h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void se(),disabled:o,children:[h.jsx(EV,{className:"h-3.5 w-3.5 mr-1.5"}),"Stop"]}):h.jsxs(ne,{variant:"outline",size:"sm",className:"flex-shrink-0",onClick:()=>void be(),disabled:o,children:[h.jsx(yV,{className:"h-3.5 w-3.5 mr-1.5"}),"Start"]})]})}),h.jsxs("div",{className:"flex-1 overflow-hidden flex min-h-0",children:[h.jsx(Jn,{initial:!1,children:w&&h.jsx(Ke.div,{initial:{width:0,opacity:0},animate:{width:224,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"flex-shrink-0 border-r border-border overflow-hidden",children:h.jsx(Ine,{projectPath:n.folderPath})})}),h.jsxs("div",{className:"flex-1 overflow-hidden min-w-0 flex flex-col",children:[h.jsxs("div",{className:"flex items-center border-b border-border bg-muted/30 px-2 h-8 flex-shrink-0",children:[h.jsxs("button",{onClick:()=>{_("terminal");try{localStorage.setItem(`cc_viewmode_${e}`,"terminal")}catch{}},className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="terminal"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(Nm,{className:"h-3 w-3"}),"终端"]}),h.jsxs("button",{onClick:()=>{_("chat");try{localStorage.setItem(`cc_viewmode_${e}`,"chat")}catch{}},className:X("flex items-center gap-1.5 px-3 py-1 text-xs rounded-t transition-colors",m==="chat"?"bg-background text-foreground border border-b-0 border-border -mb-px":"text-muted-foreground hover:text-foreground"),children:[h.jsx(dV,{className:"h-3 w-3"}),"对话"]})]}),h.jsx("div",{className:X("flex-1 min-h-0",m!=="terminal"&&"hidden"),children:h.jsx(m2,{ref:L,onInput:C,onResize:($,G)=>{P.current={cols:$,rows:G},z($,G)},onReady:M})}),h.jsx(Jn,{children:m==="chat"&&h.jsx(Ke.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},className:"flex-1 min-h-0",children:h.jsx(wse,{messages:b,onSend:C,readOnly:(n==null?void 0:n._sharedPermission)==="view"})})})]}),h.jsx(Jn,{initial:!1,children:x&&h.jsx(Ke.div,{initial:{width:0,opacity:0},animate:{width:208,opacity:1},exit:{width:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"flex-shrink-0 border-l border-border overflow-hidden",children:h.jsx(Bne,{projectId:e,onSend:C})})})]}),e&&h.jsx(zne,{projectId:e,config:u,isActive:p})]})}var ig="rovingFocusGroup.onEntryFocus",kse={bubbles:!1,cancelable:!0},Oc="RovingFocusGroup",[Gb,AF,Cse]=oP(Oc),[Tse,RF]=Wi(Oc,[Cse]),[Ase,Rse]=Tse(Oc),NF=y.forwardRef((e,t)=>h.jsx(Gb.Provider,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Gb.Slot,{scope:e.__scopeRovingFocusGroup,children:h.jsx(Nse,{...e,ref:t})})}));NF.displayName=Oc;var Nse=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:s,currentTabStopId:o,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:c,preventScrollOnEntryFocus:u=!1,...d}=e,p=y.useRef(null),f=Me(t,p),g=u0(s),[m,_]=Rs({prop:o,defaultProp:a??null,onChange:l,caller:Oc}),[b,v]=y.useState(!1),S=Fi(c),w=AF(n),k=y.useRef(!1),[x,E]=y.useState(0);return y.useEffect(()=>{const T=p.current;if(T)return T.addEventListener(ig,S),()=>T.removeEventListener(ig,S)},[S]),h.jsx(Ase,{scope:n,orientation:r,dir:g,loop:i,currentTabStopId:m,onItemFocus:y.useCallback(T=>_(T),[_]),onItemShiftTab:y.useCallback(()=>v(!0),[]),onFocusableItemAdd:y.useCallback(()=>E(T=>T+1),[]),onFocusableItemRemove:y.useCallback(()=>E(T=>T-1),[]),children:h.jsx(xe.div,{tabIndex:b||x===0?-1:0,"data-orientation":r,...d,ref:f,style:{outline:"none",...e.style},onMouseDown:ye(e.onMouseDown,()=>{k.current=!0}),onFocus:ye(e.onFocus,T=>{const D=!k.current;if(T.target===T.currentTarget&&D&&!b){const A=new CustomEvent(ig,kse);if(T.currentTarget.dispatchEvent(A),!A.defaultPrevented){const R=w().filter(B=>B.focusable),I=R.find(B=>B.active),L=R.find(B=>B.id===m),F=[I,L,...R].filter(Boolean).map(B=>B.ref.current);LF(F,u)}}k.current=!1}),onBlur:ye(e.onBlur,()=>v(!1))})})}),IF="RovingFocusGroupItem",OF=y.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:s,children:o,...a}=e,l=Hr(),c=s||l,u=Rse(IF,n),d=u.currentTabStopId===c,p=AF(n),{onFocusableItemAdd:f,onFocusableItemRemove:g,currentTabStopId:m}=u;return y.useEffect(()=>{if(r)return f(),()=>g()},[r,f,g]),h.jsx(Gb.ItemSlot,{scope:n,id:c,focusable:r,active:i,children:h.jsx(xe.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:t,onMouseDown:ye(e.onMouseDown,_=>{r?u.onItemFocus(c):_.preventDefault()}),onFocus:ye(e.onFocus,()=>u.onItemFocus(c)),onKeyDown:ye(e.onKeyDown,_=>{if(_.key==="Tab"&&_.shiftKey){u.onItemShiftTab();return}if(_.target!==_.currentTarget)return;const b=Lse(_,u.orientation,u.dir);if(b!==void 0){if(_.metaKey||_.ctrlKey||_.altKey||_.shiftKey)return;_.preventDefault();let S=p().filter(w=>w.focusable).map(w=>w.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();const w=S.indexOf(_.currentTarget);S=u.loop?Dse(S,w+1):S.slice(w+1)}setTimeout(()=>LF(S))}}),children:typeof o=="function"?o({isCurrentTabStop:d,hasTabStop:m!=null}):o})})});OF.displayName=IF;var Ise={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Ose(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lse(e,t,n){const r=Ose(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ise[r]}function LF(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Dse(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Mse=NF,Pse=OF,Sp="Tabs",[Fse]=Wi(Sp,[RF]),DF=RF(),[Bse,w0]=Fse(Sp),MF=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:i,defaultValue:s,orientation:o="horizontal",dir:a,activationMode:l="automatic",...c}=e,u=u0(a),[d,p]=Rs({prop:r,onChange:i,defaultProp:s??"",caller:Sp});return h.jsx(Bse,{scope:n,baseId:Hr(),value:d,onValueChange:p,orientation:o,dir:u,activationMode:l,children:h.jsx(xe.div,{dir:u,"data-orientation":o,...c,ref:t})})});MF.displayName=Sp;var PF="TabsList",FF=y.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...i}=e,s=w0(PF,n),o=DF(n);return h.jsx(Mse,{asChild:!0,...o,orientation:s.orientation,dir:s.dir,loop:r,children:h.jsx(xe.div,{role:"tablist","aria-orientation":s.orientation,...i,ref:t})})});FF.displayName=PF;var BF="TabsTrigger",jF=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:i=!1,...s}=e,o=w0(BF,n),a=DF(n),l=zF(o.baseId,r),c=HF(o.baseId,r),u=r===o.value;return h.jsx(Pse,{asChild:!0,...a,focusable:!i,active:u,children:h.jsx(xe.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":c,"data-state":u?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:l,...s,ref:t,onMouseDown:ye(e.onMouseDown,d=>{!i&&d.button===0&&d.ctrlKey===!1?o.onValueChange(r):d.preventDefault()}),onKeyDown:ye(e.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&o.onValueChange(r)}),onFocus:ye(e.onFocus,()=>{const d=o.activationMode!=="manual";!u&&!i&&d&&o.onValueChange(r)})})})});jF.displayName=BF;var UF="TabsContent",$F=y.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:i,children:s,...o}=e,a=w0(UF,n),l=zF(a.baseId,r),c=HF(a.baseId,r),u=r===a.value,d=y.useRef(u);return y.useEffect(()=>{const p=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(p)},[]),h.jsx(zs,{present:i||u,children:({present:p})=>h.jsx(xe.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?"0s":void 0},children:p&&s})})});$F.displayName=UF;function zF(e,t){return`${e}-trigger-${t}`}function HF(e,t){return`${e}-content-${t}`}var jse=MF,VF=FF,GF=jF,WF=$F;const Use=jse,qF=y.forwardRef(({className:e,...t},n)=>h.jsx(VF,{ref:n,className:X("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));qF.displayName=VF.displayName;const td=y.forwardRef(({className:e,...t},n)=>h.jsx(GF,{ref:n,className:X("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",e),...t}));td.displayName=GF.displayName;const nd=y.forwardRef(({className:e,...t},n)=>h.jsx(WF,{ref:n,className:X("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));nd.displayName=WF.displayName;const rR={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function $se({open:e,onOpenChange:t,onAdded:n}){const[r,i]=y.useState([]),[s,o]=y.useState(!1),[a,l]=y.useState(null),[c,u]=y.useState(""),[d,p]=y.useState(""),[f,g]=y.useState(""),[m,_]=y.useState(""),[b,v]=y.useState(!1),[S,w]=y.useState(null);y.useEffect(()=>{e&&P6().then(D=>i(D.available)).catch(()=>i([]))},[e]);const k=()=>{o(!1),l(null),u(""),p(""),g(""),_(""),v(!1),w(null)},x=async D=>{l(D),w(null);try{const{id:A}=await d1({type:D,label:rR[D]||D}),{url:R}=await Tm(A);window.open(R,"_blank"),k(),t(!1),n()}catch(A){w(A instanceof Error?A.message:"添加失败"),l(null)}},E=async()=>{if(!c||!d||!f||!m){w("请填写所有字段");return}v(!0),w(null);try{const{id:D}=await d1({type:c,label:d,clientId:f,clientSecret:m}),{url:A}=await Tm(D);window.open(A,"_blank"),k(),t(!1),n()}catch(D){w(D instanceof Error?D.message:"添加失败")}finally{v(!1)}},T=r.length>0;return h.jsx(ua,{open:e,onOpenChange:D=>{t(D),D||k()},children:h.jsxs(Hs,{className:"sm:max-w-md",children:[h.jsxs(Vs,{children:[h.jsxs(Ws,{className:"flex items-center gap-2",children:[h.jsx(Am,{className:"h-5 w-5"}),"添加云盘账号"]}),h.jsx(qs,{children:s?"手动填写 OAuth 凭据连接云盘":"选择云盘类型,点击后跳转登录授权"})]}),s?h.jsxs(h.Fragment,{children:[h.jsxs("div",{className:"space-y-4 py-2",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"云盘类型"}),h.jsxs(sh,{value:c,onValueChange:u,children:[h.jsx(ic,{children:h.jsx(oh,{placeholder:"选择云盘类型"})}),h.jsxs(sc,{children:[h.jsx(Rn,{value:"google-drive",children:"Google Drive"}),h.jsx(Rn,{value:"onedrive",children:"OneDrive"}),h.jsx(Rn,{value:"dropbox",children:"Dropbox"})]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"显示名称"}),h.jsx(Fn,{placeholder:"例如:我的 Google Drive",value:d,onChange:D=>p(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Client ID"}),h.jsx(Fn,{placeholder:"OAuth Client ID",value:f,onChange:D=>g(D.target.value)})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"Client Secret"}),h.jsx(Fn,{type:"password",placeholder:"OAuth Client Secret",value:m,onChange:D=>_(D.target.value)})]}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S})]}),h.jsxs(Gs,{children:[h.jsx(ne,{variant:"outline",onClick:()=>{o(!1),w(null)},children:"返回"}),h.jsx(ne,{onClick:E,disabled:b,children:b?"添加中...":"添加并授权"})]})]}):h.jsxs("div",{className:"space-y-3 py-2",children:[T?h.jsx(h.Fragment,{children:r.map(D=>h.jsx(ne,{variant:"outline",className:"w-full justify-start gap-3 h-12 text-base",onClick:()=>void x(D),disabled:a!==null,children:a===D?"连接中...":`连接 ${rR[D]||D}`},D))}):h.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"暂无内置 OAuth 凭据,请使用手动模式添加"}),S&&h.jsx("p",{className:"text-sm text-destructive",children:S}),h.jsx("div",{className:"pt-2 border-t border-border",children:h.jsxs("button",{onClick:()=>{o(!0),w(null)},className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[h.jsx(SV,{className:"h-3.5 w-3.5"}),"手动填写 OAuth 凭据"]})})]})]})})}const zse={"google-drive":"Google Drive",onedrive:"OneDrive",dropbox:"Dropbox"};function Hse({type:e}){switch(e){case"google-drive":return h.jsx(f1,{className:"h-5 w-5 text-blue-500"});case"onedrive":return h.jsx(Am,{className:"h-5 w-5 text-sky-500"});case"dropbox":return h.jsx(f1,{className:"h-5 w-5 text-indigo-500"});default:return h.jsx(Am,{className:"h-5 w-5"})}}function Vse({provider:e,onDelete:t,onReauth:n}){var o;const[r,i]=y.useState(!1),s=()=>{r?(t(e.id),i(!1)):(i(!0),setTimeout(()=>i(!1),3e3))};return h.jsxs(Ih,{children:[h.jsx(Oh,{className:"pb-3",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(Hse,{type:e.type}),h.jsxs("div",{children:[h.jsx(Lh,{className:"text-base",children:e.label}),h.jsx("p",{className:"text-sm text-muted-foreground",children:zse[e.type]||e.type})]})]}),h.jsx(gr,{variant:e.authorized?"default":"destructive",className:e.authorized?"bg-green-600 hover:bg-green-700":"",children:e.authorized?"已授权":"未授权"})]})}),h.jsxs(Dh,{children:[e.authorized&&((o=e.tokens)==null?void 0:o.expiry)&&h.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:["授权到期:",new Date(e.tokens.expiry).toLocaleDateString("zh-CN")]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>n(e.id),children:[h.jsx(As,{className:"h-3.5 w-3.5 mr-1"}),"重新授权"]}),h.jsxs(ne,{variant:r?"destructive":"outline",size:"sm",onClick:s,children:[h.jsx(Ev,{className:"h-3.5 w-3.5 mr-1"}),r?"确认删除?":"删除"]})]})]})]})}const Gse={success:{label:"成功",icon:eV,className:"bg-green-600 hover:bg-green-700"},failed:{label:"失败",icon:RV,className:"bg-red-600 hover:bg-red-700"},partial:{label:"部分完成",icon:Z6,className:"bg-yellow-600 hover:bg-yellow-700"}};function Wse(e,t){const n=new Date(t).getTime()-new Date(e).getTime();if(n<1e3)return`${n}ms`;const r=Math.floor(n/1e3);if(r<60)return`${r}秒`;const i=Math.floor(r/60),s=r%60;return`${i}分${s}秒`}function qse(e){return new Date(e).toLocaleString("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}function Kse({history:e}){const t=e.slice(0,20);return t.length===0?h.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[h.jsx(nV,{className:"h-10 w-10 mb-3 opacity-50"}),h.jsx("p",{className:"text-sm",children:"暂无备份记录"})]}):h.jsx("div",{className:"overflow-x-auto",children:h.jsxs("table",{className:"w-full text-sm",children:[h.jsx("thead",{children:h.jsxs("tr",{className:"border-b",children:[h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"时间"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"项目"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"云盘"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"状态"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"文件数"}),h.jsx("th",{className:"text-left py-3 px-2 font-medium text-muted-foreground",children:"耗时"})]})}),h.jsx("tbody",{children:t.map(n=>{const r=Gse[n.status],i=r.icon;return h.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/50",children:[h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:qse(n.startTime)}),h.jsx("td",{className:"py-2.5 px-2",children:n.projectName}),h.jsx("td",{className:"py-2.5 px-2",children:n.providerLabel}),h.jsxs("td",{className:"py-2.5 px-2",children:[h.jsxs(gr,{className:r.className,children:[h.jsx(i,{className:"h-3 w-3 mr-1"}),r.label]}),n.error&&h.jsx("p",{className:"text-xs text-destructive mt-1",children:n.error})]}),h.jsxs("td",{className:"py-2.5 px-2 whitespace-nowrap",children:[n.filesUploaded,"/",n.filesTotal]}),h.jsx("td",{className:"py-2.5 px-2 whitespace-nowrap",children:Wse(n.startTime,n.endTime)})]},n.id)})})]})})}const iR=["node_modules",".git","dist","build","*.log",".DS_Store","*.tmp",".venv","__pycache__",".env"],Yse=[{value:"30",label:"30分钟"},{value:"60",label:"1小时"},{value:"360",label:"6小时"},{value:"720",label:"12小时"},{value:"1440",label:"24小时"}];function Xse(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(!1),[a,l]=y.useState({enabled:!1,intervalMinutes:60}),[c,u]=y.useState(!0),[d,p]=y.useState([]),[f,g]=y.useState(!0),[m,_]=y.useState(""),[b,v]=y.useState(!1),[S,w]=y.useState(!1),[k,x]=y.useState([]),[E,T]=y.useState(!0),D=async()=>{try{const C=await F6();n(C)}catch{}finally{i(!1)}},A=async()=>{try{const C=await U6();l(C)}catch{}finally{u(!1)}},R=async()=>{try{const C=await $6();p(C.length>0?C:iR)}catch{p(iR)}finally{g(!1)}},I=async()=>{try{const C=await H6();x(C)}catch{}finally{T(!1)}};y.useEffect(()=>{D(),A(),R(),I()},[]);const L=async C=>{try{await B6(C),n(z=>z.filter(Z=>Z.id!==C))}catch{}},P=async C=>{try{const{url:z}=await Tm(C);window.open(z,"_blank")}catch{}},F=async C=>{const z={...a,enabled:C};l(z);try{await h1({enabled:C})}catch{l(a)}},B=async C=>{const z=parseInt(C,10),Z={...a,intervalMinutes:z};l(Z);try{await h1({intervalMinutes:z})}catch{l(a)}},U=()=>{const C=m.trim();!C||d.includes(C)||(p(z=>[...z,C]),_(""),v(!0))},O=C=>{p(z=>z.filter(Z=>Z!==C)),v(!0)},j=async()=>{w(!0);try{await z6(d),v(!1)}catch{}finally{w(!1)}};return h.jsx("div",{className:"min-h-screen bg-background",children:h.jsxs("div",{className:"max-w-4xl mx-auto p-6",children:[h.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"text-2xl font-bold",children:"设置"})]}),h.jsxs(Use,{defaultValue:"providers",children:[h.jsxs(qF,{className:"mb-4",children:[h.jsx(td,{value:"providers",children:"云盘账号"}),h.jsx(td,{value:"strategy",children:"备份策略"}),h.jsx(td,{value:"history",children:"备份记录"})]}),h.jsxs(nd,{value:"providers",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(ne,{onClick:()=>o(!0),children:[h.jsx(Yo,{className:"h-4 w-4 mr-1"}),"添加云盘"]})}),r?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):t.length===0?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-12",children:"暂无云盘账号,点击上方按钮添加"}):h.jsx("div",{className:"grid gap-4 sm:grid-cols-2",children:t.map(C=>h.jsx(Vse,{provider:C,onDelete:L,onReauth:P},C.id))})]}),h.jsx($se,{open:s,onOpenChange:o,onAdded:()=>void D()})]}),h.jsx(nd,{value:"strategy",children:h.jsxs("div",{className:"space-y-8",children:[h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"排除规则"}),h.jsx("p",{className:"text-sm text-muted-foreground",children:"匹配这些模式的文件和目录将不会被备份"}),f?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"flex flex-wrap gap-2",children:h.jsx(Jn,{children:d.map(C=>h.jsxs(Ke.span,{layout:!0,initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.2},className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1 text-sm",children:[C,h.jsx("button",{onClick:()=>O(C),className:"ml-0.5 rounded-sm hover:bg-muted-foreground/20 p-0.5",children:h.jsx($s,{className:"h-3 w-3"})})]},C))})}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(Fn,{placeholder:"输入排除模式,例如 *.log",value:m,onChange:C=>_(C.target.value),onKeyDown:C=>{C.key==="Enter"&&U()},className:"max-w-xs"}),h.jsx(ne,{variant:"outline",size:"sm",onClick:U,children:"添加"})]}),b&&h.jsxs(ne,{onClick:j,disabled:S,children:[h.jsx($L,{className:"h-4 w-4 mr-1"}),S?"保存中...":"保存"]})]})]}),h.jsxs("div",{className:"space-y-4",children:[h.jsx("h3",{className:"text-lg font-medium",children:"定时备份"}),c?h.jsx("p",{className:"text-sm text-muted-foreground",children:"加载中..."}):h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx(c0,{checked:a.enabled,onCheckedChange:F}),h.jsx(ze,{children:a.enabled?"已开启":"已关闭"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(ze,{children:"备份间隔"}),h.jsxs(sh,{value:String(a.intervalMinutes),onValueChange:B,children:[h.jsx(ic,{className:"w-48",children:h.jsx(oh,{})}),h.jsx(sc,{children:Yse.map(C=>h.jsx(Rn,{value:C.value,children:C.label},C.value))})]})]})]})]})]})}),h.jsx(nd,{value:"history",children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{className:"flex justify-end",children:h.jsxs(ne,{variant:"outline",size:"sm",onClick:()=>{T(!0),I()},children:[h.jsx(As,{className:"h-4 w-4 mr-1"}),"刷新"]})}),E?h.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"加载中..."}):h.jsx(Kse,{history:k})]})})]})]})})}function Zse(){const e=js(),[t,n]=y.useState([]),[r,i]=y.useState(!0),[s,o]=y.useState(null),[a,l]=y.useState(""),[c,u]=y.useState(null),[d,p]=y.useState(null),[f,g]=y.useState(null),[m,_]=y.useState(new Set);y.useEffect(()=>{A6().then(n).catch(k=>o(k instanceof Error?k.message:"Failed to load SkillHub")).finally(()=>i(!1))},[]);const b=y.useMemo(()=>{const k=new Set;return t.forEach(x=>{var E;return(E=x.tags)==null?void 0:E.forEach(T=>k.add(T))}),Array.from(k).sort()},[t]),v=y.useMemo(()=>t.some(k=>!k.tags||k.tags.length===0),[t]),S=y.useMemo(()=>{let k=t;if(c==="__untagged__"?k=k.filter(x=>!x.tags||x.tags.length===0):c&&(k=k.filter(x=>{var E;return(E=x.tags)==null?void 0:E.includes(c)})),a.trim()){const x=a.toLowerCase();k=k.filter(E=>{var T;return E.label.toLowerCase().includes(x)||E.description.toLowerCase().includes(x)||E.command.toLowerCase().includes(x)||E.author.toLowerCase().includes(x)||((T=E.tags)==null?void 0:T.some(D=>D.toLowerCase().includes(x)))})}return k},[t,a,c]),w=async(k,x)=>{if(x.stopPropagation(),!(f||m.has(k.id))){g(k.id);try{await N6(k.id),_(E=>new Set(E).add(k.id)),n(E=>E.map(T=>T.id===k.id?{...T,downloads:(T.downloads||0)+1}:T))}catch(E){alert(E instanceof Error?E.message:"Download failed")}finally{g(null)}}};return h.jsxs("div",{className:"min-h-screen bg-background",children:[h.jsx("header",{className:"border-b sticky top-0 bg-background z-10",children:h.jsxs("div",{className:"max-w-4xl mx-auto px-4 h-14 flex items-center gap-4",children:[h.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>e("/"),children:[h.jsx(Gl,{className:"h-4 w-4 mr-1"}),"返回"]}),h.jsx("h1",{className:"font-semibold text-lg",children:"SkillHub"}),h.jsx("div",{className:"flex-1"}),h.jsxs("div",{className:"relative w-64",children:[h.jsx(vV,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),h.jsx(Fn,{placeholder:"搜索命令...",value:a,onChange:k=>l(k.target.value),className:"pl-8 h-9"})]})]})}),h.jsxs("main",{className:"max-w-4xl mx-auto px-4 py-6",children:[b.length>0&&h.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===null?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(null),children:"全部"}),b.map(k=>h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c===k?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(c===k?null:k),children:k},k)),v&&h.jsx("button",{className:X("px-3 py-1 rounded-full text-xs font-medium transition-colors",c==="__untagged__"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:()=>u(c==="__untagged__"?null:"__untagged__"),children:"无标签"})]}),r&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"加载中..."}),s&&h.jsx("div",{className:"text-center text-destructive py-20",children:s}),!r&&!s&&t.length===0&&h.jsxs("div",{className:"text-center text-muted-foreground py-20",children:[h.jsx("p",{className:"text-lg mb-2",children:"SkillHub 还没有命令"}),h.jsx("p",{className:"text-sm",children:"在快捷命令面板中点击分享按钮来提交第一个命令吧!"})]}),!r&&!s&&t.length>0&&S.length===0&&h.jsx("div",{className:"text-center text-muted-foreground py-20",children:"没有匹配的命令"}),h.jsx("div",{className:"space-y-3",children:S.map((k,x)=>{var R;const E=d===k.id,T=m.has(k.id),D=f===k.id,A=k.parentId?t.find(I=>I.id===k.parentId):void 0;return h.jsxs(Ke.div,{layout:!0,initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.25,delay:x*.03,ease:"easeOut"},className:"rounded-lg border bg-card p-4 cursor-pointer hover:border-muted-foreground/30 transition-colors",onClick:()=>p(E?null:k.id),children:[h.jsxs("div",{className:"flex items-start justify-between gap-4",children:[h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"font-medium text-sm truncate",children:k.label}),(R=k.tags)==null?void 0:R.map(I=>h.jsxs("span",{className:"inline-flex items-center gap-0.5 px-2 py-0.5 rounded-full text-xs bg-muted text-muted-foreground",children:[h.jsx(CV,{className:"h-2.5 w-2.5"}),I]},I))]}),A&&h.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[h.jsx(gl,{className:"h-3 w-3 text-muted-foreground"}),h.jsxs("span",{className:"text-xs text-muted-foreground",children:["继承: ",A.label]})]}),k.description&&h.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:k.description}),h.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(zL,{className:"h-3 w-3"}),k.author]}),h.jsxs("span",{className:"flex items-center gap-1",children:[h.jsx(Bd,{className:"h-3 w-3"}),k.downloads||0]}),h.jsx("span",{children:k.createdAt})]})]}),h.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[h.jsxs(ne,{size:"sm",variant:T?"outline":"default",disabled:D||T,onClick:I=>w(k,I),title:A?`将同时下载继承的「${A.label}」`:void 0,children:[h.jsx(Bd,{className:"h-3.5 w-3.5 mr-1"}),T?"已下载":D?"下载中...":"下载"]}),h.jsx(Ke.span,{animate:{rotate:E?180:0},transition:{duration:.2},children:h.jsx(Mh,{className:"h-4 w-4 text-muted-foreground"})})]})]}),h.jsx(Jn,{children:E&&h.jsx(Ke.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},transition:{duration:.2,ease:"easeInOut"},className:"overflow-hidden",children:h.jsx("div",{className:"mt-3 pt-3 border-t",children:h.jsx("pre",{className:"text-xs font-mono bg-muted rounded p-3 whitespace-pre-wrap break-words max-h-64 overflow-y-auto",children:k.command})})})})]},k.id)})})]})]})}function vu({children:e}){const[t,n]=y.useState(!1),[r,i]=y.useState(!1);return y.useEffect(()=>{if(Zr()){i(!0),n(!0);return}Cm()?LL().then(o=>{km(o),i(!0)}).catch(()=>{i(!1)}).finally(()=>n(!0)):n(!0)},[]),t?r?h.jsx(h.Fragment,{children:e}):h.jsx(OI,{to:"/login",replace:!0}):null}function Qse(){return h.jsx(TW,{children:h.jsx(_U,{children:h.jsxs(bU,{children:[h.jsx(is,{path:"/login",element:h.jsx(K6,{})}),h.jsx(is,{path:"/",element:h.jsx(vu,{children:h.jsx(AW,{})})}),h.jsx(is,{path:"/projects/:id",element:h.jsx(vu,{children:h.jsx(Ese,{})})}),h.jsx(is,{path:"/settings",element:h.jsx(vu,{children:h.jsx(Xse,{})})}),h.jsx(is,{path:"/skillhub",element:h.jsx(vu,{children:h.jsx(Zse,{})})}),h.jsx(is,{path:"*",element:h.jsx(OI,{to:"/",replace:!0})})]})})})}sg.createRoot(document.getElementById("root")).render(h.jsx(wt.StrictMode,{children:h.jsx(Qse,{})}));export{ah as a,rd as c,Jse as g};
|