0){const e=s?i.slice(0,-1).join("\n"):t,o=!!e.match(/\|\s*$/),r=e+(o?"":"|")+`\n|${" --- |".repeat(n)}`;return gk.lexer(r)}}function Fk(e,t){var i;const n=globalThis.MonacoEnvironment;if(null==n?void 0:n.createTrustedTypesPolicy)try{return n.createTrustedTypesPolicy(e,t)}catch(s){return void r(s)}try{return null===(i=window.trustedTypes)||void 0===i?void 0:i.createPolicy(e,t)}catch(s){return void r(s)}}class Bk{constructor(e){this.domNode=e,this._maxWidth="",this._width="",this._height="",this._top="",this._left="",this._bottom="",this._right="",this._paddingLeft="",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){const t=Wk(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=Wk(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=Wk(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=Wk(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=Wk(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=Wk(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=Wk(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){const t=Wk(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}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){const t=Wk(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){const t=Wk(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=Wk(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 Wk(e){return"number"==typeof e?`${e}px`:e}function Vk(e){return new Bk(e)}function Hk(e,t){e instanceof Bk?(e.setFontFamily(t.getMassagedFontFamily()),e.setFontWeight(t.fontWeight),e.setFontSize(t.fontSize),e.setFontFeatureSettings(t.fontFeatureSettings),e.setFontVariationSettings(t.fontVariationSettings),e.setLineHeight(t.lineHeight),e.setLetterSpacing(t.letterSpacing)):(e.style.fontFamily=t.getMassagedFontFamily(),e.style.fontWeight=t.fontWeight,e.style.fontSize=t.fontSize+"px",e.style.fontFeatureSettings=t.fontFeatureSettings,e.style.fontVariationSettings=t.fontVariationSettings,e.style.lineHeight=t.lineHeight+"px",e.style.letterSpacing=t.letterSpacing+"px")}var zk=function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(Mre){o(Mre)}}function a(e){try{l(n.throw(e))}catch(Mre){o(Mre)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};const Uk={getInitialState:()=>IC,tokenizeEncoded:(e,t,i)=>TC(0,i)};function Kk(e,t,i,n,s,o,r){let a="",l=n,h=0,d=!0;for(let c=0,u=t.getCount();c0;)r&&d?(g+=" ",d=!1):(g+=" ",d=!0),e--;break}case 60:g+="<",d=!1;break;case 62:g+=">",d=!1;break;case 38:g+="&",d=!1;break;case 0:g+="",d=!1;break;case 65279:case 8232:case 8233:case 133:g+="\ufffd",d=!1;break;case 13:g+="",d=!1;break;case 32:r&&d?(g+=" ",d=!1):(g+=" ",d=!0);break;default:g+=String.fromCharCode(t),d=!1}}if(a+=`${g}`,u>s||l>=s)break}return a+="
",a}function jk(e,t,i){let n='",n}const qk=Ba("openerService");function $k(e,t){return an.isUri(e)?_o(e.scheme,t):vo(e,t+":")}function Gk(e,...t){return t.some((t=>$k(e,t)))}var Zk,Yk=function(e,t,i,n){var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},Xk=function(e,t){return function(i,n){t(i,n,e)}},Qk=function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(Mre){o(Mre)}}function a(e){try{l(n.throw(e))}catch(Mre){o(Mre)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};let Jk=Zk=class{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i,this._onDidRenderAsync=new U,this.onDidRenderAsync=this._onDidRenderAsync.event}dispose(){this._onDidRenderAsync.dispose()}render(e,t,i){if(!e){return{element:document.createElement("span"),dispose:()=>{}}}const n=new N,s=n.add(vk(e,Object.assign(Object.assign({},this._getRenderOptions(e,n)),t),i));return s.element.classList.add("rendered-markdown"),{element:s.element,dispose:()=>n.dispose()}}_getRenderOptions(e,t){return{codeBlockRenderer:(e,t)=>Qk(this,void 0,void 0,(function*(){var i,n,s;let o;e?o=this._languageService.getLanguageIdByLanguageName(e):this._options.editor&&(o=null===(i=this._options.editor.getModel())||void 0===i?void 0:i.getLanguageId()),o||(o=Ku);const r=yield function(e,t,i){return zk(this,void 0,void 0,(function*(){if(!i)return jk(t,e.languageIdCodec,Uk);const n=yield EC.getOrCreate(i);return jk(t,e.languageIdCodec,n||Uk)}))}(this._languageService,t,o),a=document.createElement("span");if(a.innerHTML=null!==(s=null===(n=Zk._ttpTokenizer)||void 0===n?void 0:n.createHTML(r))&&void 0!==s?s:r,this._options.editor){Hk(a,this._options.editor.getOption(50))}else this._options.codeBlockFontFamily&&(a.style.fontFamily=this._options.codeBlockFontFamily);return void 0!==this._options.codeBlockFontSize&&(a.style.fontSize=this._options.codeBlockFontSize),a})),asyncRenderCallback:()=>this._onDidRenderAsync.fire(),actionHandler:{callback:t=>eD(this._openerService,t,e.isTrusted),disposables:t}}}};function eD(e,t,i){return Qk(this,void 0,void 0,(function*(){try{return yield e.open(t,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:tD(i)})}catch(Mre){return r(Mre),!1}}))}function tD(e){return!0===e||!(!e||!Array.isArray(e.enabledCommands))&&e.enabledCommands}Jk._ttpTokenizer=Fk("tokenizeToString",{createHTML:e=>e}),Jk=Zk=Yk([Xk(1,Lc),Xk(2,qk)],Jk);var iD,nD=function(e,t,i,n){var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},sD=function(e,t){return function(i,n){t(i,n,e)}};let oD=iD=class{static get(e){return e.getContribution(iD.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new I,this._messageListeners=new N,this._mouseOverMessage=!1,this._editor=e,this._visible=iD.MESSAGE_VISIBLE.bindTo(t)}dispose(){var e;null===(e=this._message)||void 0===e||e.dispose(),this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){let i;Ps(Aa(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),this._message=Aa(e)?vk(e,{actionHandler:{callback:t=>eD(this._openerService,t,Aa(e)?e.isTrusted:void 0),disposables:this._messageListeners}}):void 0,this._messageWidget.value=new rD(this._editor,t,"string"==typeof e?e:this._message.element),this._messageListeners.add(B.debounce(this._editor.onDidBlurEditorText,((e,t)=>t),0)((()=>{this._mouseOverMessage||this._messageWidget.value&&qn(Xn(),this._messageWidget.value.getDomNode())||this.closeMessage()}))),this._messageListeners.add(this._editor.onDidChangeCursorPosition((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidDispose((()=>this.closeMessage()))),this._messageListeners.add(this._editor.onDidChangeModel((()=>this.closeMessage()))),this._messageListeners.add(En(this._messageWidget.value.getDomNode(),os.MOUSE_ENTER,(()=>this._mouseOverMessage=!0),!0)),this._messageListeners.add(En(this._messageWidget.value.getDomNode(),os.MOUSE_LEAVE,(()=>this._mouseOverMessage=!1),!0)),this._messageListeners.add(this._editor.onMouseMove((e=>{e.target.position&&(i?i.containsPosition(e.target.position)||this.closeMessage():i=new Rh(t.lineNumber-3,1,e.target.position.lineNumber+3,1))})))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(rD.fadeOut(this._messageWidget.value))}};oD.ID="editor.contrib.messageController",oD.MESSAGE_VISIBLE=new Al("messageVisible",!1,ue(0,"Whether the editor is currently showing an inline message")),oD=iD=nD([sD(1,Ol),sD(2,qk)],oD);Sh(new(vh.bindToContribution(oD.get))({id:"leaveEditorMessage",precondition:oD.MESSAGE_VISIBLE,handler:e=>e.closeMessage(),kbOpts:{weight:130,primary:9}}));class rD{static fadeOut(e){const t=()=>{e.dispose(),clearTimeout(i),e.getDomNode().removeEventListener("animationend",t)},i=setTimeout(t,110);return e.getDomNode().addEventListener("animationend",t),e.getDomNode().classList.add("fadeOut"),{dispose:t}}constructor(e,{lineNumber:t,column:i},n){this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._editor=e,this._editor.revealLinesInCenterIfOutsideViewport(t,t,0),this._position={lineNumber:t,column:i},this._domNode=document.createElement("div"),this._domNode.classList.add("monaco-editor-overlaymessage"),this._domNode.style.marginLeft="-6px";const s=document.createElement("div");s.classList.add("anchor","top"),this._domNode.appendChild(s);const o=document.createElement("div");"string"==typeof n?(o.classList.add("message"),o.textContent=n):(n.classList.add("message"),o.appendChild(n)),this._domNode.appendChild(o);const r=document.createElement("div");r.classList.add("anchor","below"),this._domNode.appendChild(r),this._editor.addContentWidget(this),this._domNode.classList.add("fadeIn")}dispose(){this._editor.removeContentWidget(this)}getId(){return"messageoverlay"}getDomNode(){return this._domNode}getPosition(){return{position:this._position,preference:[1,2],positionAffinity:1}}afterRender(e){this._domNode.classList.toggle("below",2===e)}}Dh(oD.ID,oD,4);const aD={RESOURCES:"ResourceURLs",DOWNLOAD_URL:"DownloadURL",FILES:"Files",TEXT:Lu.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};var lD=function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(Mre){o(Mre)}}function a(e){try{l(n.throw(e))}catch(Mre){o(Mre)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class hD{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}update(e,t,i){var n;return lD(this,void 0,void 0,(function*(){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let s;if(void 0===e||Fr(e)||e instanceof HTMLElement)s=e;else if(Gr(e.markdown)){this._hoverWidget||this.show(ue(0,"Loading..."),t),this._cancellationTokenSource=new jh;const i=this._cancellationTokenSource.token;if(s=yield e.markdown(i),void 0===s&&(s=e.markdownNotSupportedFallback),this.isDisposed||i.isCancellationRequested)return}else s=null!==(n=e.markdown)&&void 0!==n?n:e.markdownNotSupportedFallback;this.show(s,t,i)}))}show(e,t,i){const n=this._hoverWidget;if(this.hasContent(e)){const s=Object.assign({content:e,target:this.target,showPointer:"element"===this.hoverDelegate.placement,hoverPosition:2,skipFadeInAnimation:!this.fadeInAnimation||!!n},i);this._hoverWidget=this.hoverDelegate.showHover(s,t)}null==n||n.dispose()}hasContent(e){return!!e&&(!Aa(e)||!!e.value)}get isDisposed(){var e;return null===(e=this._hoverWidget)||void 0===e?void 0:e.isDisposed}dispose(){var e,t;null===(e=this._hoverWidget)||void 0===e||e.dispose(),null===(t=this._cancellationTokenSource)||void 0===t||t.dispose(!0),this._cancellationTokenSource=void 0}}function dD(e,t,i,n){let s,o;const r=(t,i)=>{var n;const r=void 0!==o;t&&(null==o||o.dispose(),o=void 0),i&&(null==s||s.dispose(),s=void 0),r&&(null===(n=e.onDidHideHover)||void 0===n||n.call(e))},a=(s,r,a)=>new sd((()=>lD(this,void 0,void 0,(function*(){o&&!o.isDisposed||(o=new hD(e,a||t,s>0),yield o.update(i,r,n))}))),s),l=En(t,os.MOUSE_OVER,(()=>{if(s)return;const i=new N;i.add(En(t,os.MOUSE_LEAVE,(e=>r(!1,e.fromElement===t)),!0));i.add(En(t,os.MOUSE_DOWN,(()=>r(!0,!0)),!0));const n={targetElements:[t],dispose:()=>{}};if(void 0===e.placement||"mouse"===e.placement){const e=e=>{n.x=e.x+10,e.target instanceof HTMLElement&&e.target.classList.contains("action-label")&&r(!0,!0)};i.add(En(t,os.MOUSE_MOVE,e,!0))}i.add(a(e.delay,!1,n)),s=i}),!0);return{show:e=>{r(!1,!0),a(0,e)},hide:()=>{r(!0,!0)},update:(e,t)=>lD(this,void 0,void 0,(function*(){i=e,yield null==o?void 0:o.update(i,void 0,t)})),dispose:()=>{l.dispose(),r(!0,!0)}}}class cD{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach((n=>n.splice(e,t,i)))}}function uD(e,t,i){return Math.min(Math.max(e,t),i)}class gD{constructor(){this._n=1,this._val=0}update(e){return this._val=this._val+(e-this._val)/this._n,this._n+=1,this._val}get value(){return this._val}}class pD{constructor(e){this._n=0,this._val=0,this._values=[],this._index=0,this._sum=0,this._values=new Array(e),this._values.fill(0,0,e)}update(e){const t=this._values[this._index];return this._values[this._index]=e,this._index=(this._index+1)%this._values.length,this._sum-=t,this._sum+=e,this._n{try{e.releasePointerCapture(t)}catch(i){}})))}catch(r){o=window}this._hooks.add(En(o,os.POINTER_MOVE,(e=>{e.buttons===i?(e.preventDefault(),this._pointerMoveCallback(e)):this.stopMonitoring(!0)}))),this._hooks.add(En(o,os.POINTER_UP,(e=>this.stopMonitoring(!0))))}}class _D extends E{onclick(e,t){this._register(En(e,os.CLICK,(e=>t(new Nt(e)))))}onmousedown(e,t){this._register(En(e,os.MOUSE_DOWN,(e=>t(new Nt(e)))))}onmouseover(e,t){this._register(En(e,os.MOUSE_OVER,(e=>t(new Nt(e)))))}onmouseleave(e,t){this._register(En(e,os.MOUSE_LEAVE,(e=>t(new Nt(e)))))}onkeydown(e,t){this._register(En(e,os.KEY_DOWN,(e=>t(new St(e)))))}onkeyup(e,t){this._register(En(e,os.KEY_UP,(e=>t(new St(e)))))}oninput(e,t){this._register(En(e,os.INPUT,t))}onblur(e,t){this._register(En(e,os.BLUR,t))}onfocus(e,t){this._register(En(e,os.FOCUS,t))}ignoreGesture(e){return ZL.ignoreTarget(e)}}const vD=11;class bD extends _D{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",void 0!==e.top&&(this.bgDomNode.style.top="0px"),void 0!==e.left&&(this.bgDomNode.style.left="0px"),void 0!==e.bottom&&(this.bgDomNode.style.bottom="0px"),void 0!==e.right&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...ta.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width="11px",this.domNode.style.height="11px",void 0!==e.top&&(this.domNode.style.top=e.top+"px"),void 0!==e.left&&(this.domNode.style.left=e.left+"px"),void 0!==e.bottom&&(this.domNode.style.bottom=e.bottom+"px"),void 0!==e.right&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new fD),this._register(Mn(this.bgDomNode,os.POINTER_DOWN,(e=>this._arrowPointerDown(e)))),this._register(Mn(this.domNode,os.POINTER_DOWN,(e=>this._arrowPointerDown(e)))),this._pointerdownRepeatTimer=this._register(new od),this._pointerdownScheduleRepeatTimer=this._register(new sd)}_arrowPointerDown(e){if(!(e.target&&e.target instanceof Element))return;this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet((()=>{this._pointerdownRepeatTimer.cancelAndSet((()=>this._onActivate()),1e3/24)}),200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(e=>{}),(()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()})),e.preventDefault()}}class CD extends E{constructor(e,t,i){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=i,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new sd)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return 2!==this._visibility&&(3===this._visibility||this._rawShouldBeVisible)}_updateShouldBeVisible(){const 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(){this._isNeeded?this._shouldBeVisible?this._reveal():this._hide(!0):this._hide(!1)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet((()=>{var e;null===(e=this._domNode)||void 0===e||e.setClassName(this._visibleClassName)}),0))}_hide(e){var t;this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,null===(t=this._domNode)||void 0===t||t.setClassName(this._invisibleClassName+(e?" fade":"")))}}class wD extends _D{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 CD(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new fD),this._shouldRender=!0,this.domNode=Vk(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(En(this.domNode.domNode,os.POINTER_DOWN,(e=>this._domNodePointerDown(e))))}_createArrow(e){const t=this._register(new bD(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=Vk(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),"number"==typeof i&&this.slider.setWidth(i),"number"==typeof n&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(En(this.slider.domNode,os.POINTER_DOWN,(e=>{0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}))),this.onclick(this.slider.domNode,(e=>{e.leftButton&&e.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){const t=this.domNode.domNode.getClientRects()[0].top,i=t+this._scrollbarState.getSliderPosition(),n=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),s=this._sliderPointerPosition(e);i<=s&&s<=n?0===e.button&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&"number"==typeof e.offsetX&&"number"==typeof e.offsetY)t=e.offsetX,i=e.offsetY;else{const n=Hn(this.domNode.domNode);t=e.pageX-n.left,i=e.pageY-n.top}const n=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(n):this._scrollbarState.getDesiredScrollPositionFromOffset(n)),0===e.button&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!(e.target&&e.target instanceof Element))return;const t=this._sliderPointerPosition(e),i=this._sliderOrthogonalPointerPosition(e),n=this._scrollbarState.clone();this.slider.toggleClassName("active",!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,(e=>{const s=this._sliderOrthogonalPointerPosition(e),o=Math.abs(s-i);if(Oe&&o>140)return void this._setDesiredScrollPositionNow(n.getScrollPosition());const r=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(r))}),(()=>{this.slider.toggleClassName("active",!1),this._host.onDragEnd()})),this._host.onDragStart()}_setDesiredScrollPositionNow(e){const 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()}}class yD{constructor(e,t,i,n,s,o){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=n,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 yD(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){const t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,n,s){const o=Math.max(0,i-e),r=Math.max(0,o-2*t),a=n>0&&n>i;if(!a)return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(r),computedSliderRatio:0,computedSliderPosition:0};const l=Math.round(Math.max(20,Math.floor(i*r/n))),h=(r-l)/(n-i),d=s*h;return{computedAvailableSize:Math.round(o),computedIsNeeded:a,computedSliderSize:Math.round(l),computedSliderRatio:h,computedSliderPosition:Math.round(d)}}_refreshComputedValues(){const e=yD._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=e.computedAvailableSize,this._computedIsNeeded=e.computedIsNeeded,this._computedSliderSize=e.computedSliderSize,this._computedSliderRatio=e.computedSliderRatio,this._computedSliderPosition=e.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;const t=e-this._arrowSize;let i=this._scrollPosition;return tthis._host.onMouseWheel(new Et(null,1,0))}),this._createArrow({className:"scra",icon:Jr.scrollbarButtonRight,top:i,left:void 0,bottom:void 0,right:e,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Et(null,-1,0))})}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(2===e.horizontal?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(2===e.vertical?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class LD extends wD{constructor(e,t,i){const n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new yD(t.verticalHasArrows?t.arrowSize:0,2===t.vertical?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const e=(t.arrowSize-vD)/2,i=(t.verticalScrollbarSize-vD)/2;this._createArrow({className:"scra",icon:Jr.scrollbarButtonUp,top:e,left:i,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Et(null,0,1))}),this._createArrow({className:"scra",icon:Jr.scrollbarButtonDown,top:void 0,left:i,bottom:e,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Et(null,0,-1))})}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(2===e.vertical?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class kD{constructor(e,t,i,n,s,o,r){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,i|=0,n|=0,s|=0,o|=0,r|=0),this.rawScrollLeft=n,this.rawScrollTop=r,t<0&&(t=0),n+t>i&&(n=i-t),n<0&&(n=0),s<0&&(s=0),r+s>o&&(r=o-s),r<0&&(r=0),this.width=t,this.scrollWidth=i,this.scrollLeft=n,this.height=s,this.scrollHeight=o,this.scrollTop=r}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(e,t){return new kD(this._forceIntegerValues,void 0!==e.width?e.width:this.width,void 0!==e.scrollWidth?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,void 0!==e.height?e.height:this.height,void 0!==e.scrollHeight?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new kD(this._forceIntegerValues,this.width,this.scrollWidth,void 0!==e.scrollLeft?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,void 0!==e.scrollTop?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,o=this.height!==e.height,r=this.scrollHeight!==e.scrollHeight,a=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:i,scrollWidthChanged:n,scrollLeftChanged:s,heightChanged:o,scrollHeightChanged:r,scrollTopChanged:a}}}class DD extends E{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new U),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new kD(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){var i;const n=this._state.withScrollDimensions(e,t);this._setState(n,Boolean(this._smoothScrolling)),null===(i=this._smoothScrolling)||void 0===i||i.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){const t=this._state.withScrollPosition(e);this._smoothScrolling&&(this._smoothScrolling.dispose(),this._smoothScrolling=null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(0===this._smoothScrollDuration)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:void 0===e.scrollLeft?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:void 0===e.scrollTop?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;n=t?new ED(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{const t=this._state.withScrollPosition(e);this._smoothScrolling=ED.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))}hasPendingScrollAnimation(){return Boolean(this._smoothScrolling)}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);return this._setState(t,!0),this._smoothScrolling?e.isDone?(this._smoothScrolling.dispose(),void(this._smoothScrolling=null)):void(this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame((()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())}))):void 0}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class xD{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function ND(e,t){const i=t-e;return function(t){return e+i*(1-function(e){return Math.pow(e,3)}(1-t))}}class ED{constructor(e,t,i,n){this.from=e,this.to=t,this.duration=n,this.startTime=i,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,i){if(Math.abs(e-t)>2.5*i){let r,a;return e0&&Math.abs(e.deltaY)>0)return 1;let t=.5;-1===this._front&&-1===this._rear||this._memory[this._rear];return this._isAlmostInt(e.deltaX)&&this._isAlmostInt(e.deltaY)||(t+=.25),Math.min(Math.max(t,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}}MD.INSTANCE=new MD;class TD extends _D{get options(){return this._options}constructor(e,t,i){super(),this._onScroll=this._register(new U),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new U),e.style.overflow="hidden",this._options=function(e){const t={lazyRender:void 0!==e.lazyRender&&e.lazyRender,className:void 0!==e.className?e.className:"",useShadows:void 0===e.useShadows||e.useShadows,handleMouseWheel:void 0===e.handleMouseWheel||e.handleMouseWheel,flipAxes:void 0!==e.flipAxes&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:void 0!==e.consumeMouseWheelIfScrollbarIsNeeded&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:void 0!==e.alwaysConsumeMouseWheel&&e.alwaysConsumeMouseWheel,scrollYToX:void 0!==e.scrollYToX&&e.scrollYToX,mouseWheelScrollSensitivity:void 0!==e.mouseWheelScrollSensitivity?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:void 0!==e.fastScrollSensitivity?e.fastScrollSensitivity:5,scrollPredominantAxis:void 0===e.scrollPredominantAxis||e.scrollPredominantAxis,mouseWheelSmoothScroll:void 0===e.mouseWheelSmoothScroll||e.mouseWheelSmoothScroll,arrowSize:void 0!==e.arrowSize?e.arrowSize:11,listenOnDomNode:void 0!==e.listenOnDomNode?e.listenOnDomNode:null,horizontal:void 0!==e.horizontal?e.horizontal:1,horizontalScrollbarSize:void 0!==e.horizontalScrollbarSize?e.horizontalScrollbarSize:10,horizontalSliderSize:void 0!==e.horizontalSliderSize?e.horizontalSliderSize:0,horizontalHasArrows:void 0!==e.horizontalHasArrows&&e.horizontalHasArrows,vertical:void 0!==e.vertical?e.vertical:1,verticalScrollbarSize:void 0!==e.verticalScrollbarSize?e.verticalScrollbarSize:10,verticalHasArrows:void 0!==e.verticalHasArrows&&e.verticalHasArrows,verticalSliderSize:void 0!==e.verticalSliderSize?e.verticalSliderSize:0,scrollByPage:void 0!==e.scrollByPage&&e.scrollByPage};t.horizontalSliderSize=void 0!==e.horizontalSliderSize?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=void 0!==e.verticalSliderSize?e.verticalSliderSize:t.verticalScrollbarSize,Pe&&(t.className+=" mac");return t}(t),this._scrollable=i,this._register(this._scrollable.onScroll((e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)})));const n={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new LD(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new SD(this._scrollable,this._options,n)),this._domNode=document.createElement("div"),this._domNode.className="monaco-scrollable-element "+this._options.className,this._domNode.setAttribute("role","presentation"),this._domNode.style.position="relative",this._domNode.style.overflow="hidden",this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=Vk(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=Vk(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=Vk(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,(e=>this._onMouseOver(e))),this.onmouseleave(this._listenOnDomNode,(e=>this._onMouseLeave(e))),this._hideTimeout=this._register(new sd),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=k(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,Pe&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){void 0!==e.handleMouseWheel&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),void 0!==e.mouseWheelScrollSensitivity&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),void 0!==e.fastScrollSensitivity&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),void 0!==e.scrollPredominantAxis&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),void 0!==e.horizontal&&(this._options.horizontal=e.horizontal),void 0!==e.vertical&&(this._options.vertical=e.vertical),void 0!==e.horizontalScrollbarSize&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),void 0!==e.verticalScrollbarSize&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),void 0!==e.scrollByPage&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Et(e))}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=k(this._mouseWheelToDispose),e)){const e=e=>{this._onMouseWheel(new Et(e))};this._mouseWheelToDispose.push(En(this._listenOnDomNode,os.MOUSE_WHEEL,e,{passive:!1}))}}_onMouseWheel(e){var t;if(null===(t=e.browserEvent)||void 0===t?void 0:t.defaultPrevented)return;const i=MD.INSTANCE;i.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let t=e.deltaY*this._options.mouseWheelScrollSensitivity,s=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&s+t===0?s=t=0:Math.abs(t)>=Math.abs(s)?s=0:t=0),this._options.flipAxes&&([t,s]=[s,t]);const o=!Pe&&e.browserEvent&&e.browserEvent.shiftKey;!this._options.scrollYToX&&!o||s||(s=t,t=0),e.browserEvent&&e.browserEvent.altKey&&(s*=this._options.fastScrollSensitivity,t*=this._options.fastScrollSensitivity);const r=this._scrollable.getFutureScrollPosition();let a={};if(t){const e=50*t,i=r.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(a,i)}if(s){const e=50*s,t=r.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(a,t)}if(a=this._scrollable.validateScrollPosition(a),r.scrollLeft!==a.scrollLeft||r.scrollTop!==a.scrollTop){this._options.mouseWheelSmoothScroll&&i.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(a):this._scrollable.setScrollPositionNow(a),n=!0}}let s=n;!s&&this._options.alwaysConsumeMouseWheel&&(s=!0),!s&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(s=!0),s&&(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)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",s=t?" top":"",o=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${o}${s}${n}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){this._mouseIsOver||this._isDragging||(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){this._mouseIsOver||this._isDragging||this._hideTimeout.cancelAndSet((()=>this._hide()),500)}}class RD extends TD{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new DD({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>An(e)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class AD extends TD{constructor(e,t,i){super(e,t,i)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}}class OD extends TD{constructor(e,t){(t=t||{}).mouseWheelSmoothScroll=!1;const i=new DD({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:e=>An(e)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll((e=>{e.scrollTopChanged&&(this._element.scrollTop=e.scrollTop),e.scrollLeftChanged&&(this._element.scrollLeft=e.scrollLeft)}))),this.scanDomNode()}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}scanDomNode(){this.setScrollDimensions({width:this._element.clientWidth,scrollWidth:this._element.scrollWidth,height:this._element.clientHeight,scrollHeight:this._element.scrollHeight}),this.setScrollPosition({scrollLeft:this._element.scrollLeft,scrollTop:this._element.scrollTop})}}var PD;function FD(e,t){const i=[];for(const n of t){if(e.start>=n.range.end)continue;if(e.end=t.end||t.start>=e.end)return{start:0,end:0};const i=Math.max(e.start,t.start),n=Math.min(e.end,t.end);return n-i<=0?{start:0,end:0}:{start:i,end:n}}function i(e){return e.end-e.start<=0}e.intersect=t,e.isEmpty=i,e.intersects=function(e,n){return!i(t(e,n))},e.relativeComplement=function(e,t){const n=[],s={start:e.start,end:Math.min(t.start,e.end)},o={start:Math.max(t.end,e.start),end:e.end};return i(s)||n.push(s),i(o)||n.push(o),n}}(PD||(PD={}));class WD{get paddingTop(){return this._paddingTop}set paddingTop(e){this._size=this._size+e-this._paddingTop,this._paddingTop=e}constructor(e){this.groups=[],this._size=0,this._paddingTop=0,this._paddingTop=null!=e?e:0,this._size=this._paddingTop}splice(e,t,i=[]){const n=i.length-t,s=FD({start:0,end:e},this.groups),o=FD({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map((e=>({range:BD(e.range,n),size:e.size}))),r=i.map(((t,i)=>({range:{start:e+i,end:e+i+1},size:t.size})));this.groups=function(...e){return function(e){const t=[];let i=null;for(const n of e){const e=n.range.start,s=n.range.end,o=n.size;i&&o===i.size?i.range.end=s:(i={range:{start:e,end:s},size:o},t.push(i))}return t}(e.reduce(((e,t)=>e.concat(t)),[]))}(s,r,o),this._size=this._paddingTop+this.groups.reduce(((e,t)=>e+t.size*(t.range.end-t.range.start)),0)}get count(){const e=this.groups.length;return e?this.groups[e-1].range.end:0}get size(){return this._size}indexAt(e){if(e<0)return-1;if(e{for(const i of e){this.getRenderer(t).disposeTemplate(i.templateData),i.templateData=null}})),this.cache.clear(),this.transactionNodesPendingRemoval.clear()}getRenderer(e){const t=this.renderers.get(e);if(!t)throw new Error(`No renderer found for ${e}`);return t}}var HD=function(e,t,i,n){var s,o=arguments.length,r=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r};const zD={CurrentDragAndDropData:void 0},UD={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements:e=>[e],getDragURI:()=>null,onDragStart(){},onDragOver:()=>!1,drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class KD{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class jD{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class qD{constructor(){this.types=[],this.files=[]}update(e){if(e.types&&this.types.splice(0,this.types.length,...e.types),e.files){this.files.splice(0,this.files.length);for(let t=0;ti,(null==e?void 0:e.getPosInSet)?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(e,t)=>t+1,(null==e?void 0:e.getRole)?this.getRole=e.getRole.bind(e):this.getRole=e=>"listitem",(null==e?void 0:e.isChecked)?this.isChecked=e.isChecked.bind(e):this.isChecked=e=>{}}}class GD{get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get horizontalScrolling(){return this._horizontalScrolling}set horizontalScrolling(e){if(e!==this._horizontalScrolling){if(e&&this.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");if(this._horizontalScrolling=e,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this._horizontalScrolling){for(const e of this.items)this.measureItemWidth(e);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:Un(this.domNode)}),this.rowsContainer.style.width=`${Math.max(this.scrollWidth||0,this.renderWidth)}px`}else this.scrollableElementWidthDelayer.cancel(),this.scrollableElement.setScrollDimensions({width:this.renderWidth,scrollWidth:this.renderWidth}),this.rowsContainer.style.width=""}}constructor(e,t,i,n=UD){var s,o,r,a,l,h,d,c,u,g,p,m,f;if(this.virtualDelegate=t,this.domId="list_id_"+ ++GD.InstanceCount,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new Jh(50),this.splicing=!1,this.dragOverAnimationStopDisposable=E.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=E.None,this.onDragLeaveTimeout=E.None,this.disposables=new N,this._onDidChangeContentHeight=new U,this._onDidChangeContentWidth=new U,this._horizontalScrolling=!1,n.horizontalScrolling&&n.supportDynamicHeights)throw new Error("Horizontal scrolling and dynamic heights not supported simultaneously");this.items=[],this.itemId=0,this.rangeMap=new WD(null!==(s=n.paddingTop)&&void 0!==s?s:0);for(const _ of i)this.renderers.set(_.templateId,_);this.cache=this.disposables.add(new VD(this.renderers)),this.lastRenderTop=0,this.lastRenderHeight=0,this.domNode=document.createElement("div"),this.domNode.className="monaco-list",this.domNode.classList.add(this.domId),this.domNode.tabIndex=0,this.domNode.classList.toggle("mouse-support","boolean"!=typeof n.mouseSupport||n.mouseSupport),this._horizontalScrolling=null!==(o=n.horizontalScrolling)&&void 0!==o?o:UD.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=void 0===n.paddingBottom?0:n.paddingBottom,this.accessibilityProvider=new $D(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows";(null!==(r=n.transformOptimization)&&void 0!==r?r:UD.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add(ZL.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new DD({forceIntegerValues:!0,smoothScrollDuration:null!==(a=n.smoothScrolling)&&void 0!==a&&a?125:0,scheduleAtNextAnimationFrame:e=>An(e)})),this.scrollableElement=this.disposables.add(new AD(this.rowsContainer,{alwaysConsumeMouseWheel:null!==(l=n.alwaysConsumeMouseWheel)&&void 0!==l?l:UD.alwaysConsumeMouseWheel,horizontal:1,vertical:null!==(h=n.verticalScrollMode)&&void 0!==h?h:UD.verticalScrollMode,useShadows:null!==(d=n.useShadows)&&void 0!==d?d:UD.useShadows,mouseWheelScrollSensitivity:n.mouseWheelScrollSensitivity,fastScrollSensitivity:n.fastScrollSensitivity,scrollByPage:n.scrollByPage},this.scrollable)),this.domNode.appendChild(this.scrollableElement.getDomNode()),e.appendChild(this.domNode),this.scrollableElement.onScroll(this.onScroll,this,this.disposables),this.disposables.add(En(this.rowsContainer,$L.Change,(e=>this.onTouchChange(e)))),this.disposables.add(En(this.scrollableElement.getDomNode(),"scroll",(e=>e.target.scrollTop=0))),this.disposables.add(En(this.domNode,"dragover",(e=>this.onDragOver(this.toDragEvent(e))))),this.disposables.add(En(this.domNode,"drop",(e=>this.onDrop(this.toDragEvent(e))))),this.disposables.add(En(this.domNode,"dragleave",(e=>this.onDragLeave(this.toDragEvent(e))))),this.disposables.add(En(this.domNode,"dragend",(e=>this.onDragEnd(e)))),this.setRowLineHeight=null!==(c=n.setRowLineHeight)&&void 0!==c?c:UD.setRowLineHeight,this.setRowHeight=null!==(u=n.setRowHeight)&&void 0!==u?u:UD.setRowHeight,this.supportDynamicHeights=null!==(g=n.supportDynamicHeights)&&void 0!==g?g:UD.supportDynamicHeights,this.dnd=null!==(p=n.dnd)&&void 0!==p?p:this.disposables.add(UD.dnd),this.layout(null===(m=n.initialSize)||void 0===m?void 0:m.height,null===(f=n.initialSize)||void 0===f?void 0:f.width)}updateOptions(e){let t;if(void 0!==e.paddingBottom&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),void 0!==e.smoothScrolling&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),void 0!==e.horizontalScrolling&&(this.horizontalScrolling=e.horizontalScrolling),void 0!==e.scrollByPage&&(t=Object.assign(Object.assign({},null!=t?t:{}),{scrollByPage:e.scrollByPage})),void 0!==e.mouseWheelScrollSensitivity&&(t=Object.assign(Object.assign({},null!=t?t:{}),{mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity})),void 0!==e.fastScrollSensitivity&&(t=Object.assign(Object.assign({},null!=t?t:{}),{fastScrollSensitivity:e.fastScrollSensitivity})),t&&this.scrollableElement.updateOptions(t),void 0!==e.paddingTop&&e.paddingTop!==this.rangeMap.paddingTop){const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),i=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(t,Math.max(0,this.lastRenderTop+i),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}splice(e,t,i=[]){if(this.splicing)throw new Error("Can't run recursive splices.");this.splicing=!0;try{return this._splice(e,t,i)}finally{this.splicing=!1,this._onDidChangeContentHeight.fire(this.contentHeight)}}_splice(e,t,i=[]){const n=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),s={start:e,end:e+t},o=PD.intersect(n,s),r=new Map;for(let C=o.end-1;C>=o.start;C--){const e=this.items[C];if(e.dragStartDisposable.dispose(),e.checkedDisposable.dispose(),e.row){let t=r.get(e.templateId);t||(t=[],r.set(e.templateId,t));const i=this.renderers.get(e.templateId);i&&i.disposeElement&&i.disposeElement(e.element,C,e.row.templateData,e.size),t.push(e.row)}e.row=null}const a={start:e+t,end:this.items.length},l=PD.intersect(a,n),h=PD.relativeComplement(a,n),d=i.map((e=>({id:String(this.itemId++),element:e,templateId:this.virtualDelegate.getTemplateId(e),size:this.virtualDelegate.getHeight(e),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(e),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:E.None,checkedDisposable:E.None})));let c;0===e&&t>=this.items.length?(this.rangeMap=new WD(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,d),c=this.items,this.items=d):(this.rangeMap.splice(e,t,d),c=this.items.splice(e,t,...d));const u=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),p=BD(l,u),m=PD.intersect(g,p);for(let C=m.start;CBD(e,u))),v=[{start:e,end:e+i.length},..._].map((e=>PD.intersect(g,e))),b=this.getNextToLastElement(v);for(const C of v)for(let e=C.start;ee.element))}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=An((()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null})))}eventuallyUpdateScrollWidth(){this.horizontalScrolling?this.scrollableElementWidthDelayer.trigger((()=>this.updateScrollWidth())):this.scrollableElementWidthDelayer.cancel()}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)void 0!==t.width&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:0===e?0:e+10}),this._onDidChangeContentWidth.fire(this.scrollWidth)}rerender(){if(this.supportDynamicHeights){for(const e of this.items)e.lastDynamicHeightWidth=void 0;this._rerender(this.lastRenderTop,this.lastRenderHeight)}}get length(){return this.items.length}get renderHeight(){return this.scrollableElement.getScrollDimensions().height}get firstVisibleIndex(){const e=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),t=this.rangeMap.positionAt(e.start),i=this.rangeMap.positionAt(e.start+1);if(-1!==i){if((i-t)/2+t{for(const e of l)for(let t=e.start;tn.row.domNode.setAttribute("aria-checked",String(!!e));e(r.value),n.checkedDisposable=r.onDidChange(e)}!s&&n.row.domNode.parentElement||(t?this.rowsContainer.insertBefore(n.row.domNode,t):this.rowsContainer.appendChild(n.row.domNode)),this.updateItemInDOM(n,e);const a=this.renderers.get(n.templateId);if(!a)throw new Error(`No renderer found for template id ${n.templateId}`);null==a||a.renderElement(n.element,e,n.row.templateData,n.size);const l=this.dnd.getDragURI(n.element);n.dragStartDisposable.dispose(),n.row.domNode.draggable=!!l,l&&(n.dragStartDisposable=En(n.row.domNode,"dragstart",(e=>this.onDragStart(n.element,l,e)))),this.horizontalScrolling&&(this.measureItemWidth(n),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=Un(e.row.domNode);const t=window.getComputedStyle(e.row.domNode);t.paddingLeft&&(e.width+=parseFloat(t.paddingLeft)),t.paddingRight&&(e.width+=parseFloat(t.paddingRight)),e.row.domNode.style.width=""}updateItemInDOM(e,t){e.row.domNode.style.top=`${this.elementTop(t)}px`,this.setRowHeight&&(e.row.domNode.style.height=`${e.size}px`),this.setRowLineHeight&&(e.row.domNode.style.lineHeight=`${e.size}px`),e.row.domNode.setAttribute("data-index",`${t}`),e.row.domNode.setAttribute("data-last-element",t===this.length-1?"true":"false"),e.row.domNode.setAttribute("data-parity",t%2==0?"even":"odd"),e.row.domNode.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(e.element,t,this.length))),e.row.domNode.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(e.element,t))),e.row.domNode.setAttribute("id",this.getElementDomId(t)),e.row.domNode.classList.toggle("drop-target",e.dropTarget)}removeItemFromDOM(e){const t=this.items[e];if(t.dragStartDisposable.dispose(),t.checkedDisposable.dispose(),t.row){const i=this.renderers.get(t.templateId);i&&i.disposeElement&&i.disposeElement(t.element,e,t.row.templateData,t.size),this.cache.release(t.row),t.row=null}this.horizontalScrolling&&this.eventuallyUpdateScrollWidth()}getScrollTop(){return this.scrollableElement.getScrollPosition().scrollTop}setScrollTop(e,t){this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),this.scrollableElement.setScrollPosition({scrollTop:e,reuseAnimation:t})}get scrollTop(){return this.getScrollTop()}set scrollTop(e){this.setScrollTop(e)}get scrollHeight(){return this._scrollHeight+(this.horizontalScrolling?10:0)+this.paddingBottom}get onMouseClick(){return B.map(this.disposables.add(new Ky(this.domNode,"click")).event,(e=>this.toMouseEvent(e)),this.disposables)}get onMouseDblClick(){return B.map(this.disposables.add(new Ky(this.domNode,"dblclick")).event,(e=>this.toMouseEvent(e)),this.disposables)}get onMouseMiddleClick(){return B.filter(B.map(this.disposables.add(new Ky(this.domNode,"auxclick")).event,(e=>this.toMouseEvent(e)),this.disposables),(e=>1===e.browserEvent.button),this.disposables)}get onMouseDown(){return B.map(this.disposables.add(new Ky(this.domNode,"mousedown")).event,(e=>this.toMouseEvent(e)),this.disposables)}get onMouseOver(){return B.map(this.disposables.add(new Ky(this.domNode,"mouseover")).event,(e=>this.toMouseEvent(e)),this.disposables)}get onMouseOut(){return B.map(this.disposables.add(new Ky(this.domNode,"mouseout")).event,(e=>this.toMouseEvent(e)),this.disposables)}get onContextMenu(){return B.any(B.map(this.disposables.add(new Ky(this.domNode,"contextmenu")).event,(e=>this.toMouseEvent(e)),this.disposables),B.map(this.disposables.add(new Ky(this.domNode,$L.Contextmenu)).event,(e=>this.toGestureEvent(e)),this.disposables))}get onTouchStart(){return B.map(this.disposables.add(new Ky(this.domNode,"touchstart")).event,(e=>this.toTouchEvent(e)),this.disposables)}get onTap(){return B.map(this.disposables.add(new Ky(this.rowsContainer,$L.Tap)).event,(e=>this.toGestureEvent(e)),this.disposables)}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=void 0===t?void 0:this.items[t];return{browserEvent:e,index:t,element:i&&i.element}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth),this.supportDynamicHeights&&this._rerender(e.scrollTop,e.height,e.inSmoothScrolling)}catch(t){throw console.error("Got bad scroll event:",e),t}}onTouchChange(e){e.preventDefault(),e.stopPropagation(),this.scrollTop-=e.translationY}onDragStart(e,t,i){var n,s;if(!i.dataTransfer)return;const o=this.dnd.getDragElements(e);if(i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(aD.TEXT,t),i.dataTransfer.setDragImage){let e;this.dnd.getDragLabel&&(e=this.dnd.getDragLabel(o,i)),void 0===e&&(e=String(o.length));const t=fs(".monaco-drag-image");t.textContent=e;const n=(e=>{for(;e&&!e.classList.contains("monaco-workbench");)e=e.parentElement;return e||document.body})(this.domNode);n.appendChild(t),i.dataTransfer.setDragImage(t,-10,-10),setTimeout((()=>n.removeChild(t)),0)}this.domNode.classList.add("dragging"),this.currentDragData=new KD(o),zD.CurrentDragAndDropData=new jD(o),null===(s=(n=this.dnd).onDragStart)||void 0===s||s.call(n,this.currentDragData,i)}onDragOver(e){var t;if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),zD.CurrentDragAndDropData&&"vscode-ui"===zD.CurrentDragAndDropData.getData())return!1;if(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer)return!1;if(!this.currentDragData)if(zD.CurrentDragAndDropData)this.currentDragData=zD.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new qD}const i=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.browserEvent);if(this.canDrop="boolean"==typeof i?i:i.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;let n;if(e.browserEvent.dataTransfer.dropEffect="boolean"!=typeof i&&0===i.effect?"copy":"move",n="boolean"!=typeof i&&i.feedback?i.feedback:void 0===e.index?[-1]:[e.index],n=zd(n).filter((e=>e>=-1&&ee-t)),n=-1===n[0]?[-1]:n,s=this.currentDragFeedback,o=n,Array.isArray(s)&&Array.isArray(o)?Td(s,o):s===o)return!0;var s,o;if(this.currentDragFeedback=n,this.currentDragFeedbackDisposable.dispose(),-1===n[0])this.domNode.classList.add("drop-target"),this.rowsContainer.classList.add("drop-target"),this.currentDragFeedbackDisposable=x((()=>{this.domNode.classList.remove("drop-target"),this.rowsContainer.classList.remove("drop-target")}));else{for(const e of n){const i=this.items[e];i.dropTarget=!0,null===(t=i.row)||void 0===t||t.domNode.classList.add("drop-target")}this.currentDragFeedbackDisposable=x((()=>{var e;for(const t of n){const i=this.items[t];i.dropTarget=!1,null===(e=i.row)||void 0===e||e.domNode.classList.remove("drop-target")}}))}return!0}onDragLeave(e){var t,i;this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=id((()=>this.clearDragOverFeedback()),100,this.disposables),this.currentDragData&&(null===(i=(t=this.dnd).onDragLeave)||void 0===i||i.call(t,this.currentDragData,e.element,e.index,e.browserEvent))}onDrop(e){if(!this.canDrop)return;const t=this.currentDragData;this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,zD.CurrentDragAndDropData=void 0,t&&e.browserEvent.dataTransfer&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.browserEvent))}onDragEnd(e){var t,i;this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,zD.CurrentDragAndDropData=void 0,null===(i=(t=this.dnd).onDragEnd)||void 0===i||i.call(t,e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=E.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const e=Vn(this.domNode).top;this.dragOverAnimationDisposable=function(e){const t=()=>{e(),i=An(t)};let i=An(t);return x((()=>i.dispose()))}(this.animateDragAndDropScrollTop.bind(this,e))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=id((()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}),1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(void 0===this.dragOverMouseY)return;const t=this.dragOverMouseY-e,i=this.renderHeight-35;t<35?this.scrollTop+=Math.max(-14,Math.floor(.3*(t-35))):t>i&&(this.scrollTop+=Math.min(14,Math.floor(.3*(t-i))))}teardownDragAndDropScrollTopAnimation(){this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;i instanceof HTMLElement&&i!==this.rowsContainer&&t.contains(i);){const e=i.getAttribute("data-index");if(e){const t=Number(e);if(!isNaN(t))return t}i=i.parentElement}}getRenderRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}_rerender(e,t,i){const n=this.getRenderRange(e,t);let s,o;e===this.elementTop(n.start)?(s=n.start,o=0):n.end-n.start>1&&(s=n.start+1,o=this.elementTop(s)-e);let r=0;for(;;){const a=this.getRenderRange(e,t);let l=!1;for(let e=a.start;e=0;a--)(s=e[a])&&(r=(o<3?s(r):o>3?s(t,i,r):s(t,i))||r);return o>3&&r&&Object.defineProperty(t,i,r),r},QD=function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(Mre){o(Mre)}}function a(e){try{l(n.throw(e))}catch(Mre){o(Mre)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class JD{constructor(e){this.trait=e,this.renderedElements=[]}get templateId(){return`template:${this.trait.name}`}renderTemplate(e){return e}renderElement(e,t,i){const n=this.renderedElements.findIndex((e=>e.templateData===i));if(n>=0){const e=this.renderedElements[n];this.trait.unrender(i),e.index=t}else{const e={index:t,templateData:i};this.renderedElements.push(e)}this.trait.renderIndex(t,i)}splice(e,t,i){const n=[];for(const s of this.renderedElements)s.index=e+t&&n.push({index:s.index+i-t,templateData:s.templateData});this.renderedElements=n}renderIndexes(e){for(const{index:t,templateData:i}of this.renderedElements)e.indexOf(t)>-1&&this.trait.renderIndex(t,i)}disposeTemplate(e){const t=this.renderedElements.findIndex((t=>t.templateData===e));t<0||this.renderedElements.splice(t,1)}}class ex{get name(){return this._trait}get renderer(){return new JD(this)}constructor(e){this._trait=e,this.length=0,this.indexes=[],this.sortedIndexes=[],this._onChange=new U,this.onChange=this._onChange.event}splice(e,t,i){var n;t=Math.max(0,Math.min(t,this.length-e));const s=i.length-t,o=e+t,r=[];let a=0;for(;a=o;)r.push(this.sortedIndexes[a++]+s);const l=this.length+s;if(this.sortedIndexes.length>0&&0===r.length&&l>0){const t=null!==(n=this.sortedIndexes.find((t=>t>=e)))&&void 0!==n?n:l-1;r.push(Math.min(t,l-1))}this.renderer.splice(e,t,i.length),this._set(r,r),this.length=l}renderIndex(e,t){t.classList.toggle(this._trait,this.contains(e))}unrender(e){e.classList.remove(this._trait)}set(e,t){return this._set(e,[...e].sort(vx),t)}_set(e,t,i){const n=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const o=_x(s,e);return this.renderer.renderIndexes(o),this._onChange.fire({indexes:e,browserEvent:i}),n}get(){return this.indexes}contains(e){return Rd(this.sortedIndexes,e,vx)>=0}dispose(){k(this._onChange)}}XD([qL],ex.prototype,"renderer",null);class tx extends ex{constructor(e){super("selected"),this.setAriaSelected=e}renderIndex(e,t){super.renderIndex(e,t),this.setAriaSelected&&(this.contains(e)?t.setAttribute("aria-selected","true"):t.setAttribute("aria-selected","false"))}}class ix{constructor(e,t,i){this.trait=e,this.view=t,this.identityProvider=i}splice(e,t,i){if(!this.identityProvider)return this.trait.splice(e,t,new Array(i.length).fill(!1));const n=this.trait.get().map((e=>this.identityProvider.getId(this.view.element(e)).toString()));if(0===n.length)return this.trait.splice(e,t,new Array(i.length).fill(!1));const s=new Set(n),o=i.map((e=>s.has(this.identityProvider.getId(e).toString())));this.trait.splice(e,t,o)}}function nx(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function sx(e){return!!e.classList.contains("monaco-editor")||!e.classList.contains("monaco-list")&&(!!e.parentElement&&sx(e.parentElement))}function ox(e){return!!("A"===e.tagName&&e.classList.contains("monaco-button")||"DIV"===e.tagName&&e.classList.contains("monaco-button-dropdown"))||!e.classList.contains("monaco-list")&&(!!e.parentElement&&ox(e.parentElement))}class rx{get onKeyDown(){return B.chain(this.disposables.add(new Ky(this.view.domNode,"keydown")).event,(e=>e.filter((e=>!nx(e.target))).map((e=>new St(e)))))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new N,this.multipleSelectionDisposables=new N,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown((e=>{switch(e.keyCode){case 3:return this.onEnter(e);case 16:return this.onUpArrow(e);case 18:return this.onDownArrow(e);case 11:return this.onPageUpArrow(e);case 12:return this.onPageDownArrow(e);case 9:return this.onEscape(e);case 31:this.multipleSelectionSupport&&(Pe?e.metaKey:e.ctrlKey)&&this.onCtrlA(e)}})))}updateOptions(e){void 0!==e.multipleSelectionSupport&&(this.multipleSelectionSupport=e.multipleSelectionSupport)}onEnter(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(this.list.getFocus(),e.browserEvent)}onUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPrevious(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNext(1,!1,e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageUpArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusPreviousPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onPageDownArrow(e){e.preventDefault(),e.stopPropagation(),this.list.focusNextPage(e.browserEvent);const t=this.list.getFocus()[0];this.list.setAnchor(t),this.list.reveal(t),this.view.domNode.focus()}onCtrlA(e){e.preventDefault(),e.stopPropagation(),this.list.setSelection(Kd(this.list.length),e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus()}onEscape(e){this.list.getSelection().length&&(e.preventDefault(),e.stopPropagation(),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0),this.view.domNode.focus())}dispose(){this.disposables.dispose(),this.multipleSelectionDisposables.dispose()}}XD([qL],rx.prototype,"onKeyDown",null),function(e){e[e.Automatic=0]="Automatic",e[e.Trigger=1]="Trigger"}(ZD||(ZD={})),function(e){e[e.Idle=0]="Idle",e[e.Typing=1]="Typing"}(YD||(YD={}));const ax=new class{mightProducePrintableCharacter(e){return!(e.ctrlKey||e.metaKey||e.altKey)&&(e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30||e.keyCode>=98&&e.keyCode<=107||e.keyCode>=85&&e.keyCode<=95)}};class lx{constructor(e,t,i,n,s){this.list=e,this.view=t,this.keyboardNavigationLabelProvider=i,this.keyboardNavigationEventFilter=n,this.delegate=s,this.enabled=!1,this.state=YD.Idle,this.mode=ZD.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new N,this.disposables=new N,this.updateOptions(e.options)}updateOptions(e){var t,i;null===(t=e.typeNavigationEnabled)||void 0===t||t?this.enable():this.disable(),this.mode=null!==(i=e.typeNavigationMode)&&void 0!==i?i:ZD.Automatic}enable(){if(this.enabled)return;let e=!1;const t=B.chain(this.enabledDisposables.add(new Ky(this.view.domNode,"keydown")).event,(t=>t.filter((e=>!nx(e.target))).filter((()=>this.mode===ZD.Automatic||this.triggered)).map((e=>new St(e))).filter((t=>e||this.keyboardNavigationEventFilter(t))).filter((e=>this.delegate.mightProducePrintableCharacter(e))).forEach((e=>as(e,!0))).map((e=>e.browserEvent.key)))),i=B.debounce(t,(()=>null),800,void 0,void 0,void 0,this.enabledDisposables);B.reduce(B.any(t,i),((e,t)=>null===t?null:(e||"")+t),void 0,this.enabledDisposables)(this.onInput,this,this.enabledDisposables),i(this.onClear,this,this.enabledDisposables),t((()=>e=!0),void 0,this.enabledDisposables),i((()=>e=!1),void 0,this.enabledDisposables),this.enabled=!0,this.triggered=!1}disable(){this.enabled&&(this.enabledDisposables.clear(),this.enabled=!1,this.triggered=!1)}onClear(){var e;const t=this.list.getFocus();if(t.length>0&&t[0]===this.previouslyFocused){const i=null===(e=this.list.options.accessibilityProvider)||void 0===e?void 0:e.getAriaLabel(this.list.element(t[0]));i&&Ps(i)}this.previouslyFocused=-1}onInput(e){if(!e)return this.state=YD.Idle,void(this.triggered=!1);const t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===YD.Idle?1:0;this.state=YD.Typing;for(let s=0;s1&&1===n.length)return this.previouslyFocused=i,this.list.setFocus([t]),void this.list.reveal(t)}}}else if(void 0===r||$o(e,r))return this.previouslyFocused=i,this.list.setFocus([t]),void this.list.reveal(t)}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class hx{constructor(e,t){this.list=e,this.view=t,this.disposables=new N;const i=B.chain(this.disposables.add(new Ky(t.domNode,"keydown")).event,(e=>e.filter((e=>!nx(e.target))).map((e=>new St(e))))),n=B.chain(i,(e=>e.filter((e=>!(2!==e.keyCode||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)))));n(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(0===t.length)return;const i=this.view.domElement(t[0]);if(!i)return;const n=i.querySelector("[tabIndex]");if(!(n&&n instanceof HTMLElement&&-1!==n.tabIndex))return;const s=window.getComputedStyle(n);"hidden"!==s.visibility&&"none"!==s.display&&(e.preventDefault(),e.stopPropagation(),n.focus())}dispose(){this.disposables.dispose()}}function dx(e){return Pe?e.browserEvent.metaKey:e.browserEvent.ctrlKey}function cx(e){return e.browserEvent.shiftKey}const ux={isSelectionSingleChangeEvent:dx,isSelectionRangeChangeEvent:cx};class gx{constructor(e){this.list=e,this.disposables=new N,this._onPointer=new U,this.onPointer=this._onPointer.event,!1!==e.options.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||ux),this.mouseSupport=void 0===e.options.mouseSupport||!!e.options.mouseSupport,this.mouseSupport&&(e.onMouseDown(this.onMouseDown,this,this.disposables),e.onContextMenu(this.onContextMenu,this,this.disposables),e.onMouseDblClick(this.onDoubleClick,this,this.disposables),e.onTouchStart(this.onMouseDown,this,this.disposables),this.disposables.add(ZL.addTarget(e.getHTMLElement()))),B.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){void 0!==e.multipleSelectionSupport&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||ux))}isSelectionSingleChangeEvent(e){return!!this.multipleSelectionController&&this.multipleSelectionController.isSelectionSingleChangeEvent(e)}isSelectionRangeChangeEvent(e){return!!this.multipleSelectionController&&this.multipleSelectionController.isSelectionRangeChangeEvent(e)}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){sx(e.browserEvent.target)||document.activeElement!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(nx(e.browserEvent.target)||sx(e.browserEvent.target))return;const t=void 0===e.index?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport)return;if(nx(e.browserEvent.target)||sx(e.browserEvent.target))return;if(e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=e.index;return void 0===t?(this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),void this.list.setAnchor(void 0)):this.isSelectionChangeEvent(e)?this.changeSelection(e):(this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),(i=e.browserEvent)instanceof MouseEvent&&2===i.button||this.list.setSelection([t],e.browserEvent),void this._onPointer.fire(e));var i}onDoubleClick(e){if(nx(e.browserEvent.target)||sx(e.browserEvent.target))return;if(this.isSelectionChangeEvent(e))return;if(e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=this.list.getFocus();this.list.setSelection(t,e.browserEvent)}changeSelection(e){const t=e.index;let i=this.list.getAnchor();if(this.isSelectionRangeChangeEvent(e)){if(void 0===i){const e=this.list.getFocus()[0];i=null!=e?e:t,this.list.setAnchor(i)}const n=Kd(Math.min(i,t),Math.max(i,t)+1),s=this.list.getSelection(),o=function(e,t){const i=e.indexOf(t);if(-1===i)return[];const n=[];let s=i-1;for(;s>=0&&e[s]===t-(i-s);)n.push(e[s--]);n.reverse(),s=i;for(;s=e.length)i.push(t[s++]);else if(s>=t.length)i.push(e[n++]);else{if(e[n]===t[s]){n++,s++;continue}e[n]e!==t));this.list.setFocus([t]),this.list.setAnchor(t),i.length===n.length?this.list.setSelection([...n,t],e.browserEvent):this.list.setSelection(n,e.browserEvent)}}dispose(){this.disposables.dispose()}}class px{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){var t,i;const n=this.selectorSuffix&&`.${this.selectorSuffix}`,s=[];e.listBackground&&s.push(`.monaco-list${n} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(s.push(`.monaco-list${n}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),s.push(`.monaco-list${n}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&s.push(`.monaco-list${n}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(s.push(`.monaco-list${n}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),s.push(`.monaco-list${n}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&s.push(`.monaco-list${n}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&s.push(`.monaco-list${n}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&s.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${n}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }\n\t\t\t`),e.listFocusAndSelectionForeground&&s.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${n}:focus .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }\n\t\t\t`),e.listInactiveFocusForeground&&(s.push(`.monaco-list${n} .monaco-list-row.focused { color: ${e.listInactiveFocusForeground}; }`),s.push(`.monaco-list${n} .monaco-list-row.focused:hover { color: ${e.listInactiveFocusForeground}; }`)),e.listInactiveSelectionIconForeground&&s.push(`.monaco-list${n} .monaco-list-row.focused .codicon { color: ${e.listInactiveSelectionIconForeground}; }`),e.listInactiveFocusBackground&&(s.push(`.monaco-list${n} .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),s.push(`.monaco-list${n} .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(s.push(`.monaco-list${n} .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),s.push(`.monaco-list${n} .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&s.push(`.monaco-list${n} .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&s.push(`.monaco-list${n}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&s.push(`.monaco-list${n}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`);const o=Ss(e.listFocusAndSelectionOutline,Ss(e.listSelectionOutline,null!==(t=e.listFocusOutline)&&void 0!==t?t:""));o&&s.push(`.monaco-list${n}:focus .monaco-list-row.focused.selected { outline: 1px solid ${o}; outline-offset: -1px;}`),e.listFocusOutline&&s.push(`\n\t\t\t\t.monaco-drag-image,\n\t\t\t\t.monaco-list${n}:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }\n\t\t\t\t.monaco-workbench.context-menu-visible .monaco-list${n}.last-focused .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }\n\t\t\t`);const r=Ss(e.listSelectionOutline,null!==(i=e.listInactiveFocusOutline)&&void 0!==i?i:"");r&&s.push(`.monaco-list${n} .monaco-list-row.focused.selected { outline: 1px dotted ${r}; outline-offset: -1px; }`),e.listSelectionOutline&&s.push(`.monaco-list${n} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listInactiveFocusOutline&&s.push(`.monaco-list${n} .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&s.push(`.monaco-list${n} .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropBackground&&s.push(`\n\t\t\t\t.monaco-list${n}.drop-target,\n\t\t\t\t.monaco-list${n} .monaco-list-rows.drop-target,\n\t\t\t\t.monaco-list${n} .monaco-list-row.drop-target { background-color: ${e.listDropBackground} !important; color: inherit !important; }\n\t\t\t`),e.tableColumnsBorder&&s.push(`\n\t\t\t\t.monaco-table > .monaco-split-view2,\n\t\t\t\t.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,\n\t\t\t\t.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2,\n\t\t\t\t.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {\n\t\t\t\t\tborder-color: ${e.tableColumnsBorder};\n\t\t\t\t}\n\n\t\t\t\t.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2,\n\t\t\t\t.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {\n\t\t\t\t\tborder-color: transparent;\n\t\t\t\t}\n\t\t\t`),e.tableOddRowsBackgroundColor&&s.push(`\n\t\t\t\t.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,\n\t\t\t\t.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,\n\t\t\t\t.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {\n\t\t\t\t\tbackground-color: ${e.tableOddRowsBackgroundColor};\n\t\t\t\t}\n\t\t\t`),this.styleElement.textContent=s.join("\n")}}const mx={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropBackground:"#383B3D",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:lc.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:lc.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:lc.fromHex("#cccccc").transparent(.04).toString(),listBackground:void 0,listFocusForeground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusForeground:void 0,listInactiveFocusBackground:void 0,listHoverForeground:void 0,listFocusOutline:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listHoverOutline:void 0},fx={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI:()=>null,onDragStart(){},onDragOver:()=>!1,drop(){},dispose(){}}};function _x(e,t){const i=[];let n=0,s=0;for(;n=e.length)i.push(t[s++]);else if(s>=t.length)i.push(e[n++]);else{if(e[n]===t[s]){i.push(e[n]),n++,s++;continue}e[n]e-t;class bx{constructor(e,t){this._templateId=e,this.renderers=t}get templateId(){return this._templateId}renderTemplate(e){return this.renderers.map((t=>t.renderTemplate(e)))}renderElement(e,t,i,n){let s=0;for(const o of this.renderers)o.renderElement(e,t,i[s++],n)}disposeElement(e,t,i,n){var s;let o=0;for(const r of this.renderers)null===(s=r.disposeElement)||void 0===s||s.call(r,e,t,i[o],n),o+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class Cx{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return e}renderElement(e,t,i){const n=this.accessibilityProvider.getAriaLabel(e);n?i.setAttribute("aria-label",n):i.removeAttribute("aria-label");const s=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);"number"==typeof s?i.setAttribute("aria-level",`${s}`):i.removeAttribute("aria-level")}disposeTemplate(e){}}class wx{constructor(e,t){this.list=e,this.dnd=t}getDragElements(e){const t=this.list.getSelectedElements();return t.indexOf(e)>-1?t:[e]}getDragURI(e){return this.dnd.getDragURI(e)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e,t)}onDragStart(e,t){var i,n;null===(n=(i=this.dnd).onDragStart)||void 0===n||n.call(i,e,t)}onDragOver(e,t,i,n){return this.dnd.onDragOver(e,t,i,n)}onDragLeave(e,t,i,n){var s,o;null===(o=(s=this.dnd).onDragLeave)||void 0===o||o.call(s,e,t,i,n)}onDragEnd(e){var t,i;null===(i=(t=this.dnd).onDragEnd)||void 0===i||i.call(t,e)}drop(e,t,i,n){this.dnd.drop(e,t,i,n)}dispose(){this.dnd.dispose()}}class yx{get onDidChangeFocus(){return B.map(this.eventBufferer.wrapEvent(this.focus.onChange),(e=>this.toListEvent(e)),this.disposables)}get onDidChangeSelection(){return B.map(this.eventBufferer.wrapEvent(this.selection.onChange),(e=>this.toListEvent(e)),this.disposables)}get domId(){return this.view.domId}get onDidScroll(){return this.view.onDidScroll}get onMouseClick(){return this.view.onMouseClick}get onMouseDblClick(){return this.view.onMouseDblClick}get onMouseMiddleClick(){return this.view.onMouseMiddleClick}get onPointer(){return this.mouseController.onPointer}get onMouseDown(){return this.view.onMouseDown}get onMouseOver(){return this.view.onMouseOver}get onMouseOut(){return this.view.onMouseOut}get onTouchStart(){return this.view.onTouchStart}get onTap(){return this.view.onTap}get onContextMenu(){let e=!1;const t=B.chain(this.disposables.add(new Ky(this.view.domNode,"keydown")).event,(t=>t.map((e=>new St(e))).filter((t=>e=58===t.keyCode||t.shiftKey&&68===t.keyCode)).map((e=>as(e,!0))).filter((()=>!1)))),i=B.chain(this.disposables.add(new Ky(this.view.domNode,"keyup")).event,(t=>t.forEach((()=>e=!1)).map((e=>new St(e))).filter((e=>58===e.keyCode||e.shiftKey&&68===e.keyCode)).map((e=>as(e,!0))).map((({browserEvent:e})=>{const t=this.getFocus(),i=t.length?t[0]:void 0;return{index:i,element:void 0!==i?this.view.element(i):void 0,anchor:void 0!==i?this.view.domElement(i):this.view.domNode,browserEvent:e}})))),n=B.chain(this.view.onContextMenu,(t=>t.filter((t=>!e)).map((({element:e,index:t,browserEvent:i})=>({element:e,index:t,anchor:new Nt(i),browserEvent:i})))));return B.any(t,i,n)}get onKeyDown(){return this.disposables.add(new Ky(this.view.domNode,"keydown")).event}get onDidFocus(){return B.signal(this.disposables.add(new Ky(this.view.domNode,"focus",!0)).event)}constructor(e,t,i,n,s=fx){var o,r,a,l;this.user=e,this._options=s,this.focus=new ex("focused"),this.anchor=new ex("anchor"),this.eventBufferer=new Z,this._ariaLabel="",this.disposables=new N,this._onDidDispose=new U,this.onDidDispose=this._onDidDispose.event;const h=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?null===(o=this._options.accessibilityProvider)||void 0===o?void 0:o.getWidgetRole():"list";this.selection=new tx("listbox"!==h);const d=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(d.push(new Cx(this.accessibilityProvider)),null===(a=(r=this.accessibilityProvider).onDidChangeActiveDescendant)||void 0===a||a.call(r,this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map((e=>new bx(e.templateId,[...d,e])));const c=Object.assign(Object.assign({},s),{dnd:s.dnd&&new wx(this,s.dnd)});if(this.view=this.createListView(t,i,n,c),this.view.domNode.setAttribute("role",h),s.styleController)this.styleController=s.styleController(this.view.domId);else{const e=Jn(this.view.domNode);this.styleController=new px(e,this.view.domId)}if(this.spliceable=new cD([new ix(this.focus,this.view,s.identityProvider),new ix(this.selection,this.view,s.identityProvider),new ix(this.anchor,this.view,s.identityProvider),this.view]),this.disposables.add(this.focus),this.disposables.add(this.selection),this.disposables.add(this.anchor),this.disposables.add(this.view),this.disposables.add(this._onDidDispose),this.disposables.add(new hx(this,this.view)),("boolean"!=typeof s.keyboardSupport||s.keyboardSupport)&&(this.keyboardController=new rx(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const e=s.keyboardNavigationDelegate||ax;this.typeNavigationController=new lx(this,this.view,s.keyboardNavigationLabelProvider,null!==(l=s.keyboardNavigationEventFilter)&&void 0!==l?l:()=>!0,e),this.disposables.add(this.typeNavigationController)}this.mouseController=this.createMouseController(s),this.disposables.add(this.mouseController),this.onDidChangeFocus(this._onFocusChange,this,this.disposables),this.onDidChangeSelection(this._onSelectionChange,this,this.disposables),this.accessibilityProvider&&(this.ariaLabel=this.accessibilityProvider.getWidgetAriaLabel()),!1!==this._options.multipleSelectionSupport&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,n){return new GD(e,t,i,n)}createMouseController(e){return new gx(this)}updateOptions(e={}){var t,i;this._options=Object.assign(Object.assign({},this._options),e),null===(t=this.typeNavigationController)||void 0===t||t.updateOptions(this._options),void 0!==this._options.multipleSelectionController&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),null===(i=this.keyboardController)||void 0===i||i.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new mD(this.user,`Invalid start index: ${e}`);if(t<0)throw new mD(this.user,`Invalid delete count: ${t}`);0===t&&0===i.length||this.eventBufferer.bufferEvents((()=>this.spliceable.splice(e,t,i)))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get scrollTop(){return this.view.getScrollTop()}set scrollTop(e){this.view.setScrollTop(e)}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get firstVisibleIndex(){return this.view.firstVisibleIndex}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.view.domNode.setAttribute("aria-label",e)}domFocus(){this.view.domNode.focus({preventScroll:!0})}layout(e,t){this.view.layout(e,t)}setSelection(e,t){for(const i of e)if(i<0||i>=this.length)throw new mD(this.user,`Invalid index ${i}`);this.selection.set(e,t)}getSelection(){return this.selection.get()}getSelectedElements(){return this.getSelection().map((e=>this.view.element(e)))}setAnchor(e){if(void 0!==e){if(e<0||e>=this.length)throw new mD(this.user,`Invalid index ${e}`);this.anchor.set([e])}else this.anchor.set([])}getAnchor(){return Ud(this.anchor.get(),void 0)}getAnchorElement(){const e=this.getAnchor();return void 0===e?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new mD(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(0===this.length)return;const s=this.focus.get(),o=this.findNextIndex(s.length>0?s[0]+e:0,t,n);o>-1&&this.setFocus([o],i)}focusPrevious(e=1,t=!1,i,n){if(0===this.length)return;const s=this.focus.get(),o=this.findPreviousIndex(s.length>0?s[0]-e:0,t,n);o>-1&&this.setFocus([o],i)}focusNextPage(e,t){return QD(this,void 0,void 0,(function*(){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=0===i?0:i-1;const n=this.getFocus()[0];if(n!==i&&(void 0===n||i>n)){const s=this.findPreviousIndex(i,!1,t);s>-1&&n!==s?this.setFocus([s],e):this.setFocus([i],e)}else{const s=this.view.getScrollTop();let o=s+this.view.renderHeight;i>n&&(o-=this.view.elementHeight(i)),this.view.setScrollTop(o),this.view.getScrollTop()!==s&&(this.setFocus([]),yield td(0),yield this.focusNextPage(e,t))}}))}focusPreviousPage(e,t){return QD(this,void 0,void 0,(function*(){let i;const n=this.view.getScrollTop();i=0===n?this.view.indexAt(n):this.view.indexAfter(n-1);const s=this.getFocus()[0];if(s!==i&&(void 0===s||s>=i)){const n=this.findNextIndex(i,!1,t);n>-1&&s!==n?this.setFocus([n],e):this.setFocus([i],e)}else{const i=n;this.view.setScrollTop(n-this.view.renderHeight),this.view.getScrollTop()!==i&&(this.setFocus([]),yield td(0),yield this.focusPreviousPage(e,t))}}))}focusLast(e,t){if(0===this.length)return;const i=this.findPreviousIndex(this.length-1,!1,t);i>-1&&this.setFocus([i],e)}focusFirst(e,t){this.focusNth(0,e,t)}focusNth(e,t,i){if(0===this.length)return;const n=this.findNextIndex(e,!1,i);n>-1&&this.setFocus([n],t)}findNextIndex(e,t=!1,i){for(let n=0;n=this.length&&!t)return-1;if(e%=this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let n=0;nthis.view.element(e)))}reveal(e,t){if(e<0||e>=this.length)throw new mD(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),n=this.view.elementTop(e),s=this.view.elementHeight(e);if(Vr(t)){const e=s-this.view.renderHeight;this.view.setScrollTop(e*uD(t,0,1)+n)}else{const e=n+s,t=i+this.view.renderHeight;n=t||(n=t&&s>=this.view.renderHeight?this.view.setScrollTop(n):e>=t&&this.view.setScrollTop(e-this.view.renderHeight))}}getHTMLElement(){return this.view.domNode}getElementID(e){return this.view.getElementDomId(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map((e=>this.view.element(e))),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){var e;const t=this.focus.get();if(t.length>0){let i;(null===(e=this.accessibilityProvider)||void 0===e?void 0:e.getActiveDescendantId)&&(i=this.accessibilityProvider.getActiveDescendantId(this.view.element(t[0]))),this.view.domNode.setAttribute("aria-activedescendant",i||this.view.getElementDomId(t[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",0===e.length),this.view.domNode.classList.toggle("selection-single",1===e.length),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}XD([qL],yx.prototype,"onDidChangeFocus",null),XD([qL],yx.prototype,"onDidChangeSelection",null),XD([qL],yx.prototype,"onContextMenu",null),XD([qL],yx.prototype,"onKeyDown",null),XD([qL],yx.prototype,"onDidFocus",null);const Sx=fs,Lx="selectOption.entry.template";class kx{get templateId(){return Lx}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=ds(e,Sx(".option-text")),t.detail=ds(e,Sx(".option-detail")),t.decoratorRight=ds(e,Sx(".option-decorator-right")),t}renderElement(e,t,i){const n=i,s=e.text,o=e.detail,r=e.decoratorRight,a=e.isDisabled;n.text.textContent=s,n.detail.textContent=o||"",n.decoratorRight.innerText=r||"",a?n.root.classList.add("option-disabled"):n.root.classList.remove("option-disabled")}disposeTemplate(e){}}class Dx extends E{constructor(e,t,i,n,s){super(),this.options=[],this._currentSelection=0,this._hasDetails=!1,this._skipLayout=!1,this._sticky=!1,this._isVisible=!1,this.styles=n,this.selectBoxOptions=s||Object.create(null),"number"!=typeof this.selectBoxOptions.minBottomMargin?this.selectBoxOptions.minBottomMargin=Dx.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN:this.selectBoxOptions.minBottomMargin<0&&(this.selectBoxOptions.minBottomMargin=0),this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box monaco-select-box-dropdown-padding","string"==typeof this.selectBoxOptions.ariaLabel&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),"string"==typeof this.selectBoxOptions.ariaDescription&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new U,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}getHeight(){return 22}getTemplateId(){return Lx}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=fs(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=ds(this.selectDropDownContainer,Sx(".select-box-details-pane"));const t=ds(this.selectDropDownContainer,Sx(".select-box-dropdown-container-width-control")),i=ds(t,Sx(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",ds(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Jn(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(En(this.selectDropDownContainer,os.DRAG_START,(e=>{as(e,!0)})))}registerListeners(){let e;this._register(Mn(this.selectElement,"change",(e=>{this.selected=e.target.selectedIndex,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value}),this.options[this.selected]&&this.options[this.selected].text&&(this.selectElement.title=this.options[this.selected].text)}))),this._register(En(this.selectElement,os.CLICK,(e=>{as(e),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()}))),this._register(En(this.selectElement,os.MOUSE_DOWN,(e=>{as(e)}))),this._register(En(this.selectElement,"touchstart",(t=>{e=this._isVisible}))),this._register(En(this.selectElement,"touchend",(t=>{as(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()}))),this._register(En(this.selectElement,os.KEY_DOWN,(e=>{const t=new St(e);let i=!1;Pe?18!==t.keyCode&&16!==t.keyCode&&10!==t.keyCode&&3!==t.keyCode||(i=!0):(18===t.keyCode&&t.altKey||16===t.keyCode&&t.altKey||10===t.keyCode||3===t.keyCode)&&(i=!0),i&&(this.showSelectDropDown(),as(e,!0))})))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){Td(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach(((e,t)=>{this.selectElement.add(this.createOption(e.text,t,e.isDisabled)),"string"==typeof e.description&&(this._hasDetails=!0)}))),void 0!==t&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){var e;null===(e=this.selectList)||void 0===e||e.splice(0,this.selectList.length,this.options)}select(e){e>=0&ðis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.options[this.selected]&&this.options[this.selected].text&&(this.selectElement.title=this.options[this.selected].text)}focus(){this.selectElement&&(this.selectElement.tabIndex=0,this.selectElement.focus())}blur(){this.selectElement&&(this.selectElement.tabIndex=-1,this.selectElement.blur())}setFocusable(e){this.selectElement.tabIndex=e?0:-1}render(e){this.container=e,e.classList.add("select-container"),e.appendChild(this.selectElement),this.styleSelectElement()}initStyleSheet(){const e=[];this.styles.listFocusBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { background-color: ${this.styles.listFocusBackground} !important; }`),this.styles.listFocusForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { color: ${this.styles.listFocusForeground} !important; }`),this.styles.decoratorRightForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.focused) .option-decorator-right { color: ${this.styles.decoratorRightForeground}; }`),this.styles.selectBackground&&this.styles.selectBorder&&this.styles.selectBorder!==this.styles.selectBackground?(e.push(`.monaco-select-box-dropdown-container { border: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectBorder} } `)):this.styles.selectListBorder&&(e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-top { border-top: 1px solid ${this.styles.selectListBorder} } `),e.push(`.monaco-select-box-dropdown-container > .select-box-details-pane.border-bottom { border-bottom: 1px solid ${this.styles.selectListBorder} } `)),this.styles.listHoverForeground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { color: ${this.styles.listHoverForeground} !important; }`),this.styles.listHoverBackground&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { background-color: ${this.styles.listHoverBackground} !important; }`),this.styles.listFocusOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.focused { outline: 1.6px dotted ${this.styles.listFocusOutline} !important; outline-offset: -1.6px !important; }`),this.styles.listHoverOutline&&e.push(`.monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row:not(.option-disabled):not(.focused):hover { outline: 1.6px dashed ${this.styles.listHoverOutline} !important; outline-offset: -1.6px !important; }`),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled.focused { background-color: transparent !important; color: inherit !important; outline: none !important; }"),e.push(".monaco-select-box-dropdown-container > .select-box-dropdown-list-container .monaco-list .monaco-list-row.option-disabled:hover { background-color: transparent !important; color: inherit !important; outline: none !important; }"),this.styleElement.textContent=e.join("\n")}styleSelectElement(){var e,t,i;const n=null!==(e=this.styles.selectBackground)&&void 0!==e?e:"",s=null!==(t=this.styles.selectForeground)&&void 0!==t?t:"",o=null!==(i=this.styles.selectBorder)&&void 0!==i?i:"";this.selectElement.style.backgroundColor=n,this.selectElement.style.color=s,this.selectElement.style.borderColor=o}styleList(){var e,t;const i=null!==(e=this.styles.selectBackground)&&void 0!==e?e:"",n=Ss(this.styles.selectListBackground,i);this.selectDropDownListContainer.style.backgroundColor=n,this.selectionDetailsPane.style.backgroundColor=n;const s=null!==(t=this.styles.focusBorder)&&void 0!==t?t:"";this.selectDropDownContainer.style.outlineColor=s,this.selectDropDownContainer.style.outlineOffset="-1px",this.selectList.style(this.styles)}createOption(e,t,i){const n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!i,n}showSelectDropDown(){this.selectionDetailsPane.innerText="",this.contextViewProvider&&!this._isVisible&&(this.createSelectList(this.selectDropDownContainer),this.setOptionsList(),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e,!0),layout:()=>{this.layoutSelectDropDown()},onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._isVisible=!0,this.hideSelectDropDown(!1),this.contextViewProvider.showContextView({getAnchor:()=>this.selectElement,render:e=>this.renderSelectDropDown(e),layout:()=>this.layoutSelectDropDown(),onHide:()=>{this.selectDropDownContainer.classList.remove("visible"),this.selectElement.classList.remove("synthetic-focus")},anchorPosition:this._dropDownPosition},this.selectBoxOptions.optionsAsChildren?this.container:void 0),this._currentSelection=this.selected,this._isVisible=!0,this.selectElement.setAttribute("aria-expanded","true"))}hideSelectDropDown(e){this.contextViewProvider&&this._isVisible&&(this._isVisible=!1,this.selectElement.setAttribute("aria-expanded","false"),e&&this.selectElement.focus(),this.contextViewProvider.hideContextView())}renderSelectDropDown(e,t){return e.appendChild(this.selectDropDownContainer),this.layoutSelectDropDown(t),{dispose:()=>{try{e.removeChild(this.selectDropDownContainer)}catch(t){}}}}measureMaxDetailsHeight(){let e=0;return this.options.forEach(((t,i)=>{this.updateDetail(i),this.selectionDetailsPane.offsetHeight>e&&(e=this.selectionDetailsPane.offsetHeight)})),e}layoutSelectDropDown(e){if(this._skipLayout)return!1;if(this.selectList){this.selectDropDownContainer.classList.add("visible");const t=Hn(this.selectElement),i=getComputedStyle(this.selectElement),n=parseFloat(i.getPropertyValue("--dropdown-padding-top"))+parseFloat(i.getPropertyValue("--dropdown-padding-bottom")),s=window.innerHeight-t.top-t.height-(this.selectBoxOptions.minBottomMargin||0),o=t.top-Dx.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,r=this.selectElement.offsetWidth,a=this.setWidthControlElement(this.widthControlElement),l=Math.max(a,Math.round(r)).toString()+"px";this.selectDropDownContainer.style.width=l,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let h=this.selectList.contentHeight;this._hasDetails&&void 0===this._cachedMaxDetailsHeight&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const d=this._hasDetails?this._cachedMaxDetailsHeight:0,c=h+n+d,u=Math.floor((s-n-d)/this.getHeight()),g=Math.floor((o-n-d)/this.getHeight());if(e)return!(t.top+t.height>window.innerHeight-22||t.topu&&this.options.length>u?(this._dropDownPosition=1,this.selectDropDownContainer.removeChild(this.selectDropDownListContainer),this.selectDropDownContainer.removeChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectionDetailsPane.classList.remove("border-top"),this.selectionDetailsPane.classList.add("border-bottom")):(this._dropDownPosition=0,this.selectDropDownContainer.removeChild(this.selectDropDownListContainer),this.selectDropDownContainer.removeChild(this.selectionDetailsPane),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(t.top+t.height>window.innerHeight-22||t.tops&&(h=u*this.getHeight())}else c>o&&(h=g*this.getHeight());return this.selectList.layout(h),this.selectList.domFocus(),this.selectList.length>0&&(this.selectList.setFocus([this.selected||0]),this.selectList.reveal(this.selectList.getFocus()[0]||0)),this._hasDetails?(this.selectList.getHTMLElement().style.height=h+n+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=h+n+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=l,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}return!1}setWidthControlElement(e){let t=0;if(e){let i=0,n=0;this.options.forEach(((e,t)=>{const s=e.detail?e.detail.length:0,o=e.decoratorRight?e.decoratorRight.length:0,r=e.text.length+s+o;r>n&&(i=t,n=r)})),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=zn(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=ds(e,Sx(".select-box-dropdown-list-container")),this.listRenderer=new kx,this.selectList=new yx("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:e=>{let t=e.text;return e.detail&&(t+=`. ${e.detail}`),e.decoratorRight&&(t+=`. ${e.decoratorRight}`),e.description&&(t+=`. ${e.description}`),t},getWidgetAriaLabel:()=>ue(0,"Select Box"),getRole:()=>Pe?"":"option",getWidgetRole:()=>"listbox"}}),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new Ky(this.selectDropDownListContainer,"keydown")),i=B.chain(t.event,(e=>e.filter((()=>this.selectList.length>0)).map((e=>new St(e)))));this._register(B.chain(i,(e=>e.filter((e=>3===e.keyCode))))(this.onEnter,this)),this._register(B.chain(i,(e=>e.filter((e=>2===e.keyCode))))(this.onEnter,this)),this._register(B.chain(i,(e=>e.filter((e=>9===e.keyCode))))(this.onEscape,this)),this._register(B.chain(i,(e=>e.filter((e=>16===e.keyCode))))(this.onUpArrow,this)),this._register(B.chain(i,(e=>e.filter((e=>18===e.keyCode))))(this.onDownArrow,this)),this._register(B.chain(i,(e=>e.filter((e=>12===e.keyCode))))(this.onPageDown,this)),this._register(B.chain(i,(e=>e.filter((e=>11===e.keyCode))))(this.onPageUp,this)),this._register(B.chain(i,(e=>e.filter((e=>14===e.keyCode))))(this.onHome,this)),this._register(B.chain(i,(e=>e.filter((e=>13===e.keyCode))))(this.onEnd,this)),this._register(B.chain(i,(e=>e.filter((e=>e.keyCode>=21&&e.keyCode<=56||e.keyCode>=85&&e.keyCode<=113))))(this.onCharacter,this)),this._register(En(this.selectList.getHTMLElement(),os.POINTER_UP,(e=>this.onPointerUp(e)))),this._register(this.selectList.onMouseOver((e=>void 0!==e.index&&this.selectList.setFocus([e.index])))),this._register(this.selectList.onDidChangeFocus((e=>this.onListFocus(e)))),this._register(En(this.selectDropDownContainer,os.FOCUS_OUT,(e=>{this._isVisible&&!qn(e.relatedTarget,this.selectDropDownContainer)&&this.onListBlur()}))),this.selectList.getHTMLElement().setAttribute("aria-label",this.selectBoxOptions.ariaLabel||""),this.selectList.getHTMLElement().setAttribute("aria-expanded","true"),this.styleList()}onPointerUp(e){if(!this.selectList.length)return;as(e);const t=e.target;if(!t)return;if(t.classList.contains("slider"))return;const i=t.closest(".monaco-list-row");if(!i)return;const n=Number(i.getAttribute("data-index")),s=i.classList.contains("option-disabled");n>=0&&n{for(let t=0;tthis.selected+2)this.selected+=2;else{if(t)return;this.selected++}this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onUpArrow(e){if(this.selected>0){as(e,!0);this.options[this.selected-1].isDisabled&&this.selected>1?this.selected-=2:this.selected--,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0])}}onPageUp(e){as(e),this.selectList.focusPreviousPage(),setTimeout((()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected>0&&(this.selected--,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)}),1)}onHome(e){as(e),this.options.length<2||(this.selected=0,this.options[this.selected].isDisabled&&this.selected>1&&this.selected++,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onEnd(e){as(e),this.options.length<2||(this.selected=this.options.length-1,this.options[this.selected].isDisabled&&this.selected>1&&this.selected--,this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selected),this.select(this.selected))}onCharacter(e){const t=gt.toString(e.keyCode);let i=-1;for(let n=0;n{this._register(En(this.selectElement,e,(e=>{this.selectElement.focus()})))})),this._register(Mn(this.selectElement,"click",(e=>{as(e,!0)}))),this._register(Mn(this.selectElement,"change",(e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})}))),this._register(Mn(this.selectElement,"keydown",(e=>{let t=!1;Pe?18!==e.keyCode&&16!==e.keyCode&&10!==e.keyCode||(t=!0):(18===e.keyCode&&e.altKey||10===e.keyCode||3===e.keyCode)&&(t=!0),t&&e.stopPropagation()})))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){this.options&&Td(this.options,e)||(this.options=e,this.selectElement.options.length=0,this.options.forEach(((e,t)=>{this.selectElement.add(this.createOption(e.text,t,e.isDisabled))}))),void 0!==t&&this.select(t)}select(e){0===this.options.length?this.selected=0:e>=0&ðis.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected{this.element&&this.handleActionChangeEvent(e)})))}handleActionChangeEvent(e){void 0!==e.enabled&&this.updateEnabled(),void 0!==e.checked&&this.updateChecked(),void 0!==e.class&&this.updateClass(),void 0!==e.label&&(this.updateLabel(),this.updateTooltip()),void 0!==e.tooltip&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new ja)),this._actionRunner}set actionRunner(e){this._actionRunner=e}isEnabled(){return this._action.enabled}setActionContext(e){this._context=e}render(e){const t=this.element=e;this._register(ZL.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,ne&&this._register(En(e,os.DRAG_START,(e=>{var t;return null===(t=e.dataTransfer)||void 0===t?void 0:t.setData(aD.TEXT,this._action.label)})))),this._register(En(t,$L.Tap,(e=>this.onClick(e,!0)))),this._register(En(t,os.MOUSE_DOWN,(e=>{i||as(e,!0),this._action.enabled&&0===e.button&&t.classList.add("active")}))),Pe&&this._register(En(t,os.CONTEXT_MENU,(e=>{0===e.button&&!0===e.ctrlKey&&this.onClick(e)}))),this._register(En(t,os.CLICK,(e=>{as(e,!0),this.options&&this.options.isMenu||this.onClick(e)}))),this._register(En(t,os.DBLCLICK,(e=>{as(e,!0)}))),[os.MOUSE_UP,os.MOUSE_OUT].forEach((e=>{this._register(En(t,e,(e=>{as(e),t.classList.remove("active")})))}))}onClick(e,t=!1){var i;as(e,!0);const n=jr(this._context)?(null===(i=this.options)||void 0===i?void 0:i.useEventAsContext)?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,n)}focus(){this.element&&(this.element.tabIndex=0,this.element.focus(),this.element.classList.add("focused"))}blur(){this.element&&(this.element.blur(),this.element.tabIndex=-1,this.element.classList.remove("focused"))}setFocusable(e){this.element&&(this.element.tabIndex=e?0:-1)}get trapsArrowNavigation(){return!1}updateEnabled(){}updateLabel(){}getTooltip(){return this.action.tooltip}updateTooltip(){var e;if(!this.element)return;const t=null!==(e=this.getTooltip())&&void 0!==e?e:"";this.updateAriaLabel(),this.options.hoverDelegate?(this.element.title="",this.customHover?this.customHover.update(t):(this.customHover=dD(this.options.hoverDelegate,this.element,t),this._store.add(this.customHover))):this.element.title=t}updateAriaLabel(){var e;if(this.element){const t=null!==(e=this.getTooltip())&&void 0!==e?e:"";this.element.setAttribute("aria-label",t)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class Ix extends Ex{constructor(e,t,i){super(e,t,i),this.options=i,this.options.icon=void 0!==i.icon&&i.icon,this.options.label=void 0===i.label||i.label,this.cssClass=""}render(e){super.render(e),this.element&&(this.label=ds(this.element,fs("a.action-label"))),this.label&&this.label.setAttribute("role",this.getDefaultAriaRole()),this.options.label&&this.options.keybinding&&this.element&&(ds(this.element,fs("span.keybinding")).textContent=this.options.keybinding),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===qa.ID?"presentation":this.options.isMenu?"menuitem":"button"}focus(){this.label&&(this.label.tabIndex=0,this.label.focus())}blur(){this.label&&(this.label.tabIndex=-1)}setFocusable(e){this.label&&(this.label.tabIndex=e?0:-1)}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this.action.label)}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:!this.options.label&&this.action.label&&this.options.icon&&(e=this.action.label,this.options.keybinding&&(e=ue(0,"{0} ({1})",e,this.options.keybinding))),null!=e?e:void 0}updateClass(){var e;this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.action.class,this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):null===(e=this.label)||void 0===e||e.classList.remove("codicon")}updateEnabled(){var e,t;this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),null===(e=this.element)||void 0===e||e.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),null===(t=this.element)||void 0===t||t.classList.add("disabled"))}updateAriaLabel(){var e;if(this.label){const t=null!==(e=this.getTooltip())&&void 0!==e?e:"";this.label.setAttribute("aria-label",t)}}updateChecked(){this.label&&(void 0!==this.action.checked?(this.label.classList.toggle("checked",this.action.checked),this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox")):(this.label.classList.remove("checked"),this.label.setAttribute("aria-checked",""),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class Mx extends Ex{constructor(e,t,i,n,s,o,r){super(e,t),this.selectBox=new Nx(i,n,s,o,r),this.selectBox.setFocusable(!1),this._register(this.selectBox),this.registerListeners()}select(e){this.selectBox.select(e)}registerListeners(){this._register(this.selectBox.onDidSelect((e=>this.runAction(e.selected,e.index))))}runAction(e,t){this.actionRunner.run(this._action,this.getActionContext(e,t))}getActionContext(e,t){return e}setFocusable(e){this.selectBox.setFocusable(e)}focus(){var e;null===(e=this.selectBox)||void 0===e||e.focus()}blur(){var e;null===(e=this.selectBox)||void 0===e||e.blur()}render(e){this.selectBox.render(e)}}var Tx=function(e,t,i,n){return new(i||(i=Promise))((function(s,o){function r(e){try{l(n.next(e))}catch(Mre){o(Mre)}}function a(e){try{l(n.throw(e))}catch(Mre){o(Mre)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}l((n=n.apply(e,t||[])).next())}))};class Rx extends E{constructor(e,t={}){var i,n,s,o,r,a;let l,h;switch(super(),this._actionRunnerDisposables=this._register(new N),this.viewItemDisposables=this._register(new R),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new U),this.onDidBlur=this._onDidBlur.event,this._onDidCancel=this._register(new U({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.onDidCancel=this._onDidCancel.event,this.cancelHasListener=!1,this._onDidRun=this._register(new U),this.onDidRun=this._onDidRun.event,this._onWillRun=this._register(new U),this.onWillRun=this._onWillRun.event,this.options=t,this._context=null!==(i=t.context)&&void 0!==i?i:null,this._orientation=null!==(n=this.options.orientation)&&void 0!==n?n:0,this._triggerKeys={keyDown:null!==(o=null===(s=this.options.triggerKeys)||void 0===s?void 0:s.keyDown)&&void 0!==o&&o,keys:null!==(a=null===(r=this.options.triggerKeys)||void 0===r?void 0:r.keys)&&void 0!==a?a:[3,10]},this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new ja,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun((e=>this._onDidRun.fire(e)))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun((e=>this._onWillRun.fire(e)))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar",!1!==t.animated&&this.domNode.classList.add("animated"),this._orientation){case 0:l=[15],h=[17];break;case 1:l=[16],h=[18],this.domNode.className+=" vertical"}this._register(En(this.domNode,os.KEY_DOWN,(e=>{const t=new St(e);let i=!0;const n="number"==typeof this.focusedItem?this.viewItems[this.focusedItem]:void 0;l&&(t.equals(l[0])||t.equals(l[1]))?i=this.focusPrevious():h&&(t.equals(h[0])||t.equals(h[1]))?i=this.focusNext():t.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():t.equals(14)?i=this.focusFirst():t.equals(13)?i=this.focusLast():t.equals(2)&&n instanceof Ex&&n.trapsArrowNavigation?i=this.focusNext():this.isTriggerKeyEvent(t)?this._triggerKeys.keyDown?this.doTrigger(t):this.triggerKeyDown=!0:i=!1,i&&(t.preventDefault(),t.stopPropagation())}))),this._register(En(this.domNode,os.KEY_UP,(e=>{const t=new St(e);this.isTriggerKeyEvent(t)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(t)),t.preventDefault(),t.stopPropagation()):(t.equals(2)||t.equals(1026))&&this.updateFocusedItem()}))),this.focusTracker=this._register(hs(this.domNode)),this._register(this.focusTracker.onDidBlur((()=>{Xn()!==this.domNode&&qn(Xn(),this.domNode)||(this._onDidBlur.fire(),this.previouslyFocusedItem=this.focusedItem,this.focusedItem=void 0,this.triggerKeyDown=!1)}))),this._register(this.focusTracker.onDidFocus((()=>this.updateFocusedItem()))),this.actionsList=document.createElement("ul"),this.actionsList.className="actions-container",this.options.highlightToggledItems&&this.actionsList.classList.add("highlight-toggled"),this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"),this.options.ariaLabel&&this.actionsList.setAttribute("aria-label",this.options.ariaLabel),this.domNode.appendChild(this.actionsList),e.appendChild(this.domNode)}refreshRole(){this.length()>=2?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const e=this.viewItems.find((e=>e instanceof Ex&&e.isEnabled()));e instanceof Ex&&e.setFocusable(!0)}else this.viewItems.forEach((e=>{e instanceof Ex&&e.setFocusable(!1)}))}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach((i=>{t=t||e.equals(i)})),t}updateFocusedItem(){for(let e=0;et.setActionContext(e)))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun((e=>this._onDidRun.fire(e)))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun((e=>this._onWillRun.fire(e)))),this.viewItems.forEach((t=>t.actionRunner=e))}getContainer(){return this.domNode}getAction(e){var t;if("number"==typeof e)return null===(t=this.viewItems[e])||void 0===t?void 0:t.action;if(e instanceof HTMLElement){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t