dify/web/public/vs/editor.api-i0YVFWkl.js

901 lines
3.5 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

define("vs/editor.api-i0YVFWkl",["exports"],(function(Io){"use strict";var Od,Fd,ac,_C,yp,Lp,Su,tl,yu,xp,yC,kp,zd,Dp,Ep,Np,Tp,ku,Rp,Mp,Pp,Ud,Iu,LC,Du,$d,Eu,kC,Ap,Op,Nu,Tu,Ru,Fp,Wp,Bp,Hp,Vp,jd,zp,Up,$p,jp,qp,Kp,Gp,Pu,Au,Zp,Yp,EC,NC,fc,Xp,Ou,Qp,Jp,il,Fu,em,tm,im,TC,nm,qd,Wu,sm,om,lm,RC,MC,Bu,zu,cm,dm,hm,um,fm,OC,$u,FC,gm,WC,BC,ju,pm,HC,mm,_m,bm,nl,pc,sl,Gd,vm,wm,Sm,ym,Lm;function IB(){return globalThis._VSCODE_NLS_MESSAGES}function VT(){return globalThis._VSCODE_NLS_LANGUAGE}const Ete=VT()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;function qS(o,e){let t;return e.length===0?t=o:t=o.replace(/\{(\d+)\}/g,(i,n)=>{const s=n[0],r=e[s];let a=i;return typeof r=="string"?a=r:(typeof r=="number"||typeof r=="boolean"||r===void 0||r===null)&&(a=String(r)),a}),Ete&&(t=""+t.replace(/[aouei]/g,"$&$&")+""),t}function p(o,e,...t){return qS(typeof o=="number"?DB(o,e):e,t)}function DB(o,e){const t=IB()?.[o];if(typeof t!="string"){if(typeof e=="string")return e;throw new Error(`!!! NLS MISSING: ${o} !!!`)}return t}function H(o,e,...t){let i;typeof o=="number"?i=DB(o,e):i=e;const n=qS(i,t);return{value:n,original:e===i?n:qS(e,t)}}function Nte(o,e){const t=o;typeof t.vscodeWindowId!="number"&&Object.defineProperty(t,"vscodeWindowId",{get:()=>e})}const bt=window,YE=class YE{constructor(){this.mapWindowIdToZoomFactor=new Map}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}getWindowId(e){return e.vscodeWindowId}};YE.INSTANCE=new YE;let zT=YE;function EB(o,e,t){typeof e=="string"&&(e=o.matchMedia(e)),e.addEventListener("change",t)}function UT(o){return zT.INSTANCE.getZoomFactor(o)}const Im=navigator.userAgent,Fs=Im.indexOf("Firefox")>=0,KS=Im.indexOf("AppleWebKit")>=0,GC=Im.indexOf("Chrome")>=0,qu=!GC&&Im.indexOf("Safari")>=0,NB=!GC&&!qu&&KS;Im.indexOf("Electron/")>=0;const TB=Im.indexOf("Android")>=0;let $T=!1;if(typeof bt.matchMedia=="function"){const o=bt.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),e=bt.matchMedia("(display-mode: fullscreen)");$T=o.matches,EB(bt,o,({matches:t})=>{$T&&e.matches||($T=t)})}class Tte{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?Dm.isErrorNoTelemetry(e)?new Dm(e.message+`
`+e.stack):new Error(e.message+`
`+e.stack):e},0)}}emit(e){this.listeners.forEach(t=>{t(e)})}onUnexpectedError(e){this.unexpectedErrorHandler(e),this.emit(e)}onUnexpectedExternalError(e){this.unexpectedErrorHandler(e)}}const jT=new Tte;function GS(o){jT.onUnexpectedError(o)}function Ee(o){Do(o)||jT.onUnexpectedError(o)}function Di(o){Do(o)||jT.onUnexpectedExternalError(o)}function qT(o){if(o instanceof Error){const{name:e,message:t,cause:i}=o,n=o.stacktrace||o.stack;return{$isError:!0,name:e,message:t,stack:n,noTelemetry:Dm.isErrorNoTelemetry(o),cause:i?qT(i):void 0,code:o.code}}return o}const ZS="Canceled";function Do(o){return o instanceof cr?!0:o instanceof Error&&o.name===ZS&&o.message===ZS}class cr extends Error{constructor(){super(ZS),this.name=this.message}}function Rte(){const o=new Error(ZS);return o.name=o.message,o}function dr(o){return o?new Error(`Illegal argument: ${o}`):new Error("Illegal argument")}function YS(o){return o?new Error(`Illegal state: ${o}`):new Error("Illegal state")}class Mte extends Error{constructor(e){super("NotSupported"),e&&(this.message=e)}}class Dm extends Error{constructor(e){super(e),this.name="CodeExpectedError"}static fromError(e){if(e instanceof Dm)return e;const t=new Dm;return t.message=e.message,t.stack=e.stack,t}static isErrorNoTelemetry(e){return e.name==="CodeExpectedError"}}class Ce extends Error{constructor(e){super(e||"An unexpected bug occurred."),Object.setPrototypeOf(this,Ce.prototype)}}function KT(o,e){if(!o)throw new Error(e?`Assertion failed (${e})`:"Assertion Failed")}function ZC(o,e="Unreachable"){throw new Error(e)}function YC(o,e="unexpected state"){if(!o)throw typeof e=="string"?new Ce(`Assertion Failed: ${e}`):e}function RB(o,e="Soft Assertion Failed"){o||Ee(new Ce(e))}function Xd(o){if(!o()){debugger;o(),Ee(new Ce("Assertion Failed"))}}function XC(o,e){let t=0;for(;t<o.length-1;){const i=o[t],n=o[t+1];if(!e(i,n))return!1;t++}return!0}function ji(o){return typeof o=="string"}function nn(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)&&!(o instanceof RegExp)&&!(o instanceof Date)}function Pte(o){const e=Object.getPrototypeOf(Uint8Array);return typeof o=="object"&&o instanceof e}function bc(o){return typeof o=="number"&&!isNaN(o)}function GT(o){return!!o&&typeof o[Symbol.iterator]=="function"}function MB(o){return o===!0||o===!1}function Qn(o){return typeof o>"u"}function sn(o){return!hr(o)}function hr(o){return Qn(o)||o===null}function it(o,e){if(!o)throw new Error(e?`Unexpected type, expected '${e}'`:"Unexpected type")}function Qd(o){return YC(o!=null,"Argument is `undefined` or `null`."),o}function Ku(o){return typeof o=="function"}function Ate(o,e){const t=Math.min(o.length,e.length);for(let i=0;i<t;i++)Ote(o[i],e[i])}function Ote(o,e){if(ji(e)){if(typeof o!==e)throw new Error(`argument does not match constraint: typeof ${e}`)}else if(Ku(e)){try{if(o instanceof e)return}catch{}if(!hr(o)&&o.constructor===e||e.length===1&&e.call(void 0,o)===!0)return;throw new Error("argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function l5e(o){return o}const Gu="en";let QC=!1,JC=!1,e1=!1,PB=!1,ZT=!1,YT=!1,AB=!1,XS,QS=Gu,OB=Gu,Fte,Cc;const vc=globalThis;let Eo;typeof vc.vscode<"u"&&typeof vc.vscode.process<"u"?Eo=vc.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(Eo=process);const Wte=typeof Eo?.versions?.electron=="string"&&Eo?.type==="renderer";if(typeof Eo=="object"){QC=Eo.platform==="win32",JC=Eo.platform==="darwin",e1=Eo.platform==="linux",e1&&Eo.env.SNAP&&Eo.env.SNAP_REVISION,Eo.env.CI||Eo.env.BUILD_ARTIFACTSTAGINGDIRECTORY||Eo.env.GITHUB_WORKSPACE,XS=Gu,QS=Gu;const o=Eo.env.VSCODE_NLS_CONFIG;if(o)try{const e=JSON.parse(o);XS=e.userLocale,OB=e.osLocale,QS=e.resolvedLanguage||Gu,Fte=e.languagePack?.translationsConfigFile}catch{}PB=!0}else typeof navigator=="object"&&!Wte?(Cc=navigator.userAgent,QC=Cc.indexOf("Windows")>=0,JC=Cc.indexOf("Macintosh")>=0,YT=(Cc.indexOf("Macintosh")>=0||Cc.indexOf("iPad")>=0||Cc.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,e1=Cc.indexOf("Linux")>=0,AB=Cc?.indexOf("Mobi")>=0,ZT=!0,QS=VT()||Gu,XS=navigator.language.toLowerCase(),OB=XS):console.error("Unable to resolve platform.");let JS=0;JC?JS=1:QC?JS=3:e1&&(JS=2);const gn=QC,ze=JC,Ws=e1,ma=PB,ol=ZT,Bte=ZT&&typeof vc.importScripts=="function"?vc.origin:void 0,ur=YT,FB=AB,XT=JS,rl=Cc,Hte=QS,Vte=typeof vc.postMessage=="function"&&!vc.importScripts,ey=(()=>{if(Vte){const o=[];vc.addEventListener("message",t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let i=0,n=o.length;i<n;i++){const s=o[i];if(s.id===t.data.vscodeScheduleAsyncWork){o.splice(i,1),s.callback();return}}});let e=0;return t=>{const i=++e;o.push({id:i,callback:t}),vc.postMessage({vscodeScheduleAsyncWork:i},"*")}}return o=>setTimeout(o)})(),so=JC||YT?2:QC?1:3;let WB=!0,BB=!1;function HB(){if(!BB){BB=!0;const o=new Uint8Array(2);o[0]=1,o[1]=2,WB=new Uint16Array(o.buffer)[0]===513}return WB}const QT=!!(rl&&rl.indexOf("Chrome")>=0),zte=!!(rl&&rl.indexOf("Firefox")>=0),Ute=!!(!QT&&rl&&rl.indexOf("Safari")>=0),VB=!!(rl&&rl.indexOf("Edg/")>=0),$te=!!(rl&&rl.indexOf("Android")>=0),t1={clipboard:{writeText:ma||document.queryCommandSupported&&document.queryCommandSupported("copy")||!!(navigator&&navigator.clipboard&&navigator.clipboard.writeText),readText:ma||!!(navigator&&navigator.clipboard&&navigator.clipboard.readText)},pointerEvents:bt.PointerEvent&&("ontouchstart"in bt||navigator.maxTouchPoints>0)};class JT{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}}const ty=new JT,eR=new JT,tR=new JT,zB=new Array(230),jte=Object.create(null),qte=Object.create(null),iR=[];for(let o=0;o<=193;o++)iR[o]=-1;(function(){const e=[[1,0,"None",0,"unknown",0,"VK_UNKNOWN","",""],[1,1,"Hyper",0,"",0,"","",""],[1,2,"Super",0,"",0,"","",""],[1,3,"Fn",0,"",0,"","",""],[1,4,"FnLock",0,"",0,"","",""],[1,5,"Suspend",0,"",0,"","",""],[1,6,"Resume",0,"",0,"","",""],[1,7,"Turbo",0,"",0,"","",""],[1,8,"Sleep",0,"",0,"VK_SLEEP","",""],[1,9,"WakeUp",0,"",0,"","",""],[0,10,"KeyA",31,"A",65,"VK_A","",""],[0,11,"KeyB",32,"B",66,"VK_B","",""],[0,12,"KeyC",33,"C",67,"VK_C","",""],[0,13,"KeyD",34,"D",68,"VK_D","",""],[0,14,"KeyE",35,"E",69,"VK_E","",""],[0,15,"KeyF",36,"F",70,"VK_F","",""],[0,16,"KeyG",37,"G",71,"VK_G","",""],[0,17,"KeyH",38,"H",72,"VK_H","",""],[0,18,"KeyI",39,"I",73,"VK_I","",""],[0,19,"KeyJ",40,"J",74,"VK_J","",""],[0,20,"KeyK",41,"K",75,"VK_K","",""],[0,21,"KeyL",42,"L",76,"VK_L","",""],[0,22,"KeyM",43,"M",77,"VK_M","",""],[0,23,"KeyN",44,"N",78,"VK_N","",""],[0,24,"KeyO",45,"O",79,"VK_O","",""],[0,25,"KeyP",46,"P",80,"VK_P","",""],[0,26,"KeyQ",47,"Q",81,"VK_Q","",""],[0,27,"KeyR",48,"R",82,"VK_R","",""],[0,28,"KeyS",49,"S",83,"VK_S","",""],[0,29,"KeyT",50,"T",84,"VK_T","",""],[0,30,"KeyU",51,"U",85,"VK_U","",""],[0,31,"KeyV",52,"V",86,"VK_V","",""],[0,32,"KeyW",53,"W",87,"VK_W","",""],[0,33,"KeyX",54,"X",88,"VK_X","",""],[0,34,"KeyY",55,"Y",89,"VK_Y","",""],[0,35,"KeyZ",56,"Z",90,"VK_Z","",""],[0,36,"Digit1",22,"1",49,"VK_1","",""],[0,37,"Digit2",23,"2",50,"VK_2","",""],[0,38,"Digit3",24,"3",51,"VK_3","",""],[0,39,"Digit4",25,"4",52,"VK_4","",""],[0,40,"Digit5",26,"5",53,"VK_5","",""],[0,41,"Digit6",27,"6",54,"VK_6","",""],[0,42,"Digit7",28,"7",55,"VK_7","",""],[0,43,"Digit8",29,"8",56,"VK_8","",""],[0,44,"Digit9",30,"9",57,"VK_9","",""],[0,45,"Digit0",21,"0",48,"VK_0","",""],[1,46,"Enter",3,"Enter",13,"VK_RETURN","",""],[1,47,"Escape",9,"Escape",27,"VK_ESCAPE","",""],[1,48,"Backspace",1,"Backspace",8,"VK_BACK","",""],[1,49,"Tab",2,"Tab",9,"VK_TAB","",""],[1,50,"Space",10,"Space",32,"VK_SPACE","",""],[0,51,"Minus",88,"-",189,"VK_OEM_MINUS","-","OEM_MINUS"],[0,52,"Equal",86,"=",187,"VK_OEM_PLUS","=","OEM_PLUS"],[0,53,"BracketLeft",92,"[",219,"VK_OEM_4","[","OEM_4"],[0,54,"BracketRight",94,"]",221,"VK_OEM_6","]","OEM_6"],[0,55,"Backslash",93,"\\",220,"VK_OEM_5","\\","OEM_5"],[0,56,"IntlHash",0,"",0,"","",""],[0,57,"Semicolon",85,";",186,"VK_OEM_1",";","OEM_1"],[0,58,"Quote",95,"'",222,"VK_OEM_7","'","OEM_7"],[0,59,"Backquote",91,"`",192,"VK_OEM_3","`","OEM_3"],[0,60,"Comma",87,",",188,"VK_OEM_COMMA",",","OEM_COMMA"],[0,61,"Period",89,".",190,"VK_OEM_PERIOD",".","OEM_PERIOD"],[0,62,"Slash",90,"/",191,"VK_OEM_2","/","OEM_2"],[1,63,"CapsLock",8,"CapsLock",20,"VK_CAPITAL","",""],[1,64,"F1",59,"F1",112,"VK_F1","",""],[1,65,"F2",60,"F2",113,"VK_F2","",""],[1,66,"F3",61,"F3",114,"VK_F3","",""],[1,67,"F4",62,"F4",115,"VK_F4","",""],[1,68,"F5",63,"F5",116,"VK_F5","",""],[1,69,"F6",64,"F6",117,"VK_F6","",""],[1,70,"F7",65,"F7",118,"VK_F7","",""],[1,71,"F8",66,"F8",119,"VK_F8","",""],[1,72,"F9",67,"F9",120,"VK_F9","",""],[1,73,"F10",68,"F10",121,"VK_F10","",""],[1,74,"F11",69,"F11",122,"VK_F11","",""],[1,75,"F12",70,"F12",123,"VK_F12","",""],[1,76,"PrintScreen",0,"",0,"","",""],[1,77,"ScrollLock",84,"ScrollLock",145,"VK_SCROLL","",""],[1,78,"Pause",7,"PauseBreak",19,"VK_PAUSE","",""],[1,79,"Insert",19,"Insert",45,"VK_INSERT","",""],[1,80,"Home",14,"Home",36,"VK_HOME","",""],[1,81,"PageUp",11,"PageUp",33,"VK_PRIOR","",""],[1,82,"Delete",20,"Delete",46,"VK_DELETE","",""],[1,83,"End",13,"End",35,"VK_END","",""],[1,84,"PageDown",12,"PageDown",34,"VK_NEXT","",""],[1,85,"ArrowRight",17,"RightArrow",39,"VK_RIGHT","Right",""],[1,86,"ArrowLeft",15,"LeftArrow",37,"VK_LEFT","Left",""],[1,87,"ArrowDown",18,"DownArrow",40,"VK_DOWN","Down",""],[1,88,"ArrowUp",16,"UpArrow",38,"VK_UP","Up",""],[1,89,"NumLock",83,"NumLock",144,"VK_NUMLOCK","",""],[1,90,"NumpadDivide",113,"NumPad_Divide",111,"VK_DIVIDE","",""],[1,91,"NumpadMultiply",108,"NumPad_Multiply",106,"VK_MULTIPLY","",""],[1,92,"NumpadSubtract",111,"NumPad_Subtract",109,"VK_SUBTRACT","",""],[1,93,"NumpadAdd",109,"NumPad_Add",107,"VK_ADD","",""],[1,94,"NumpadEnter",3,"",0,"","",""],[1,95,"Numpad1",99,"NumPad1",97,"VK_NUMPAD1","",""],[1,96,"Numpad2",100,"NumPad2",98,"VK_NUMPAD2","",""],[1,97,"Numpad3",101,"NumPad3",99,"VK_NUMPAD3","",""],[1,98,"Numpad4",102,"NumPad4",100,"VK_NUMPAD4","",""],[1,99,"Numpad5",103,"NumPad5",101,"VK_NUMPAD5","",""],[1,100,"Numpad6",104,"NumPad6",102,"VK_NUMPAD6","",""],[1,101,"Numpad7",105,"NumPad7",103,"VK_NUMPAD7","",""],[1,102,"Numpad8",106,"NumPad8",104,"VK_NUMPAD8","",""],[1,103,"Numpad9",107,"NumPad9",105,"VK_NUMPAD9","",""],[1,104,"Numpad0",98,"NumPad0",96,"VK_NUMPAD0","",""],[1,105,"NumpadDecimal",112,"NumPad_Decimal",110,"VK_DECIMAL","",""],[0,106,"IntlBackslash",97,"OEM_102",226,"VK_OEM_102","",""],[1,107,"ContextMenu",58,"ContextMenu",93,"","",""],[1,108,"Power",0,"",0,"","",""],[1,109,"NumpadEqual",0,"",0,"","",""],[1,110,"F13",71,"F13",124,"VK_F13","",""],[1,111,"F14",72,"F14",125,"VK_F14","",""],[1,112,"F15",73,"F15",126,"VK_F15","",""],[1,113,"F16",74,"F16",127,"VK_F16","",""],[1,114,"F17",75,"F17",128,"VK_F17","",""],[1,115,"F18",76,"F18",129,"VK_F18","",""],[1,116,"F19",77,"F19",130,"VK_F19","",""],[1,117,"F20",78,"F20",131,"VK_F20","",""],[1,118,"F21",79,"F21",132,"VK_F21","",""],[1,119,"F22",80,"F22",133,"VK_F22","",""],[1,120,"F23",81,"F23",134,"VK_F23","",""],[1,121,"F24",82,"F24",135,"VK_F24","",""],[1,122,"Open",0,"",0,"","",""],[1,123,"Help",0,"",0,"","",""],[1,124,"Select",0,"",0,"","",""],[1,125,"Again",0,"",0,"","",""],[1,126,"Undo",0,"",0,"","",""],[1,127,"Cut",0,"",0,"","",""],[1,128,"Copy",0,"",0,"","",""],[1,129,"Paste",0,"",0,"","",""],[1,130,"Find",0,"",0,"","",""],[1,131,"AudioVolumeMute",117,"AudioVolumeMute",173,"VK_VOLUME_MUTE","",""],[1,132,"AudioVolumeUp",118,"AudioVolumeUp",175,"VK_VOLUME_UP","",""],[1,133,"AudioVolumeDown",119,"AudioVolumeDown",174,"VK_VOLUME_DOWN","",""],[1,134,"NumpadComma",110,"NumPad_Separator",108,"VK_SEPARATOR","",""],[0,135,"IntlRo",115,"ABNT_C1",193,"VK_ABNT_C1","",""],[1,136,"KanaMode",0,"",0,"","",""],[0,137,"IntlYen",0,"",0,"","",""],[1,138,"Convert",0,"",0,"","",""],[1,139,"NonConvert",0,"",0,"","",""],[1,140,"Lang1",0,"",0,"","",""],[1,141,"Lang2",0,"",0,"","",""],[1,142,"Lang3",0,"",0,"","",""],[1,143,"Lang4",0,"",0,"","",""],[1,144,"Lang5",0,"",0,"","",""],[1,145,"Abort",0,"",0,"","",""],[1,146,"Props",0,"",0,"","",""],[1,147,"NumpadParenLeft",0,"",0,"","",""],[1,148,"NumpadParenRight",0,"",0,"","",""],[1,149,"NumpadBackspace",0,"",0,"","",""],[1,150,"NumpadMemoryStore",0,"",0,"","",""],[1,151,"NumpadMemoryRecall",0,"",0,"","",""],[1,152,"NumpadMemoryClear",0,"",0,"","",""],[1,153,"NumpadMemoryAdd",0,"",0,"","",""],[1,154,"NumpadMemorySubtract",0,"",0,"","",""],[1,155,"NumpadClear",131,"Clear",12,"VK_CLEAR","",""],[1,156,"NumpadClearEntry",0,"",0,"","",""],[1,0,"",5,"Ctrl",17,"VK_CONTROL","",""],[1,0,"",4,"Shift",16,"VK_SHIFT","",""],[1,0,"",6,"Alt",18,"VK_MENU","",""],[1,0,"",57,"Meta",91,"VK_COMMAND","",""],[1,157,"ControlLeft",5,"",0,"VK_LCONTROL","",""],[1,158,"ShiftLeft",4,"",0,"VK_LSHIFT","",""],[1,159,"AltLeft",6,"",0,"VK_LMENU","",""],[1,160,"MetaLeft",57,"",0,"VK_LWIN","",""],[1,161,"ControlRight",5,"",0,"VK_RCONTROL","",""],[1,162,"ShiftRight",4,"",0,"VK_RSHIFT","",""],[1,163,"AltRight",6,"",0,"VK_RMENU","",""],[1,164,"MetaRight",57,"",0,"VK_RWIN","",""],[1,165,"BrightnessUp",0,"",0,"","",""],[1,166,"BrightnessDown",0,"",0,"","",""],[1,167,"MediaPlay",0,"",0,"","",""],[1,168,"MediaRecord",0,"",0,"","",""],[1,169,"MediaFastForward",0,"",0,"","",""],[1,170,"MediaRewind",0,"",0,"","",""],[1,171,"MediaTrackNext",124,"MediaTrackNext",176,"VK_MEDIA_NEXT_TRACK","",""],[1,172,"MediaTrackPrevious",125,"MediaTrackPrevious",177,"VK_MEDIA_PREV_TRACK","",""],[1,173,"MediaStop",126,"MediaStop",178,"VK_MEDIA_STOP","",""],[1,174,"Eject",0,"",0,"","",""],[1,175,"MediaPlayPause",127,"MediaPlayPause",179,"VK_MEDIA_PLAY_PAUSE","",""],[1,176,"MediaSelect",128,"LaunchMediaPlayer",181,"VK_MEDIA_LAUNCH_MEDIA_SELECT","",""],[1,177,"LaunchMail",129,"LaunchMail",180,"VK_MEDIA_LAUNCH_MAIL","",""],[1,178,"LaunchApp2",130,"LaunchApp2",183,"VK_MEDIA_LAUNCH_APP2","",""],[1,179,"LaunchApp1",0,"",0,"VK_MEDIA_LAUNCH_APP1","",""],[1,180,"SelectTask",0,"",0,"","",""],[1,181,"LaunchScreenSaver",0,"",0,"","",""],[1,182,"BrowserSearch",120,"BrowserSearch",170,"VK_BROWSER_SEARCH","",""],[1,183,"BrowserHome",121,"BrowserHome",172,"VK_BROWSER_HOME","",""],[1,184,"BrowserBack",122,"BrowserBack",166,"VK_BROWSER_BACK","",""],[1,185,"BrowserForward",123,"BrowserForward",167,"VK_BROWSER_FORWARD","",""],[1,186,"BrowserStop",0,"",0,"VK_BROWSER_STOP","",""],[1,187,"BrowserRefresh",0,"",0,"VK_BROWSER_REFRESH","",""],[1,188,"BrowserFavorites",0,"",0,"VK_BROWSER_FAVORITES","",""],[1,189,"ZoomToggle",0,"",0,"","",""],[1,190,"MailReply",0,"",0,"","",""],[1,191,"MailForward",0,"",0,"","",""],[1,192,"MailSend",0,"",0,"","",""],[1,0,"",114,"KeyInComposition",229,"","",""],[1,0,"",116,"ABNT_C2",194,"VK_ABNT_C2","",""],[1,0,"",96,"OEM_8",223,"VK_OEM_8","",""],[1,0,"",0,"",0,"VK_KANA","",""],[1,0,"",0,"",0,"VK_HANGUL","",""],[1,0,"",0,"",0,"VK_JUNJA","",""],[1,0,"",0,"",0,"VK_FINAL","",""],[1,0,"",0,"",0,"VK_HANJA","",""],[1,0,"",0,"",0,"VK_KANJI","",""],[1,0,"",0,"",0,"VK_CONVERT","",""],[1,0,"",0,"",0,"VK_NONCONVERT","",""],[1,0,"",0,"",0,"VK_ACCEPT","",""],[1,0,"",0,"",0,"VK_MODECHANGE","",""],[1,0,"",0,"",0,"VK_SELECT","",""],[1,0,"",0,"",0,"VK_PRINT","",""],[1,0,"",0,"",0,"VK_EXECUTE","",""],[1,0,"",0,"",0,"VK_SNAPSHOT","",""],[1,0,"",0,"",0,"VK_HELP","",""],[1,0,"",0,"",0,"VK_APPS","",""],[1,0,"",0,"",0,"VK_PROCESSKEY","",""],[1,0,"",0,"",0,"VK_PACKET","",""],[1,0,"",0,"",0,"VK_DBE_SBCSCHAR","",""],[1,0,"",0,"",0,"VK_DBE_DBCSCHAR","",""],[1,0,"",0,"",0,"VK_ATTN","",""],[1,0,"",0,"",0,"VK_CRSEL","",""],[1,0,"",0,"",0,"VK_EXSEL","",""],[1,0,"",0,"",0,"VK_EREOF","",""],[1,0,"",0,"",0,"VK_PLAY","",""],[1,0,"",0,"",0,"VK_ZOOM","",""],[1,0,"",0,"",0,"VK_NONAME","",""],[1,0,"",0,"",0,"VK_PA1","",""],[1,0,"",0,"",0,"VK_OEM_CLEAR","",""]],t=[],i=[];for(const n of e){const[s,r,a,l,c,d,h,u,f]=n;if(i[r]||(i[r]=!0,jte[a]=r,qte[a.toLowerCase()]=r,s&&(iR[r]=l)),!t[l]){if(t[l]=!0,!c)throw new Error(`String representation missing for key code ${l} around scan code ${a}`);ty.define(l,c),eR.define(l,u||c),tR.define(l,f||u||c)}d&&(zB[d]=l)}})();var wc;(function(o){function e(a){return ty.keyCodeToStr(a)}o.toString=e;function t(a){return ty.strToKeyCode(a)}o.fromString=t;function i(a){return eR.keyCodeToStr(a)}o.toUserSettingsUS=i;function n(a){return tR.keyCodeToStr(a)}o.toUserSettingsGeneral=n;function s(a){return eR.strToKeyCode(a)||tR.strToKeyCode(a)}o.fromUserSettings=s;function r(a){if(a>=98&&a<=113)return null;switch(a){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ty.keyCodeToStr(a)}o.toElectronAccelerator=r})(wc||(wc={}));function Ei(o,e){const t=(e&65535)<<16>>>0;return(o|t)>>>0}function nR(o,e){if(typeof o=="number"){if(o===0)return null;const t=(o&65535)>>>0,i=(o&4294901760)>>>16;return i!==0?new sR([iy(t,e),iy(i,e)]):new sR([iy(t,e)])}else{const t=[];for(let i=0;i<o.length;i++)t.push(iy(o[i],e));return new sR(t)}}function iy(o,e){const t=!!(o&2048),i=!!(o&256),n=e===2?i:t,s=!!(o&1024),r=!!(o&512),a=e===2?t:i,l=o&255;return new Sc(n,s,r,a,l)}class Sc{constructor(e,t,i,n,s){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyCode=s}equals(e){return e instanceof Sc&&this.ctrlKey===e.ctrlKey&&this.shiftKey===e.shiftKey&&this.altKey===e.altKey&&this.metaKey===e.metaKey&&this.keyCode===e.keyCode}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}}class sR{constructor(e){if(e.length===0)throw dr("chords");this.chords=e}}class Kte{constructor(e,t,i,n,s,r){this.ctrlKey=e,this.shiftKey=t,this.altKey=i,this.metaKey=n,this.keyLabel=s,this.keyAriaLabel=r}}class Gte{}function Zte(o){if(o.charCode){const t=String.fromCharCode(o.charCode).toUpperCase();return wc.fromString(t)}const e=o.keyCode;if(e===3)return 7;if(Fs)switch(e){case 59:return 85;case 60:if(Ws)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(ze)return 57;break}else if(KS){if(ze&&e===93)return 57;if(!ze&&e===92)return 57}return zB[e]||0}const Yte=ze?256:2048,Xte=512,Qte=1024,Jte=ze?2048:256;class St{constructor(e){this._standardKeyboardEventBrand=!0;const t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.("AltGraph"),this.keyCode=Zte(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=Yte),this.altKey&&(t|=Xte),this.shiftKey&&(t|=Qte),this.metaKey&&(t|=Jte),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new Sc(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}}const UB=new WeakMap;function eie(o){if(!o.parent||o.parent===o)return null;try{const e=o.location,t=o.parent.location;if(e.origin!=="null"&&t.origin!=="null"&&e.origin!==t.origin)return null}catch{return null}return o.parent}class tie{static getSameOriginWindowChain(e){let t=UB.get(e);if(!t){t=[],UB.set(e,t);let i=e,n;do n=eie(i),n?t.push({window:new WeakRef(i),iframeElement:i.frameElement||null}):t.push({window:new WeakRef(i),iframeElement:null}),i=n;while(i)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let i=0,n=0;const s=this.getSameOriginWindowChain(e);for(const r of s){const a=r.window.deref();if(i+=a?.scrollY??0,n+=a?.scrollX??0,a===t||!r.iframeElement)break;const l=r.iframeElement.getBoundingClientRect();i+=l.top,n+=l.left}return{top:i,left:n}}}class yn{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.defaultPrevented=t.defaultPrevented,this.target=t.target,this.detail=t.detail||1,t.type==="dblclick"&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX=="number"?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);const i=tie.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=i.left,this.posy-=i.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}}class Zu{constructor(e,t=0,i=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=i,this.deltaX=t;let n=!1;if(GC){const s=navigator.userAgent.match(/Chrome\/(\d+)/);n=(s?parseInt(s[1]):123)<=122}if(e){const s=e,r=e,a=e.view?.devicePixelRatio||1;if(typeof s.wheelDeltaY<"u")n?this.deltaY=s.wheelDeltaY/(120*a):this.deltaY=s.wheelDeltaY/120;else if(typeof r.VERTICAL_AXIS<"u"&&r.axis===r.VERTICAL_AXIS)this.deltaY=-r.detail/3;else if(e.type==="wheel"){const l=e;l.deltaMode===l.DOM_DELTA_LINE?Fs&&!ze?this.deltaY=-e.deltaY/3:this.deltaY=-e.deltaY:this.deltaY=-e.deltaY/40}if(typeof s.wheelDeltaX<"u")qu&&gn?this.deltaX=-(s.wheelDeltaX/120):n?this.deltaX=s.wheelDeltaX/(120*a):this.deltaX=s.wheelDeltaX/120;else if(typeof r.HORIZONTAL_AXIS<"u"&&r.axis===r.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type==="wheel"){const l=e;l.deltaMode===l.DOM_DELTA_LINE?Fs&&!ze?this.deltaX=-e.deltaX/3:this.deltaX=-e.deltaX:this.deltaX=-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(n?this.deltaY=e.wheelDelta/(120*a):this.deltaY=e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}}function Yu(o,e){const t=this;let i=!1,n;return function(){return i||(i=!0,n=o.apply(t,arguments)),n}}var Ye;(function(o){function e(x){return!!x&&typeof x=="object"&&typeof x[Symbol.iterator]=="function"}o.is=e;const t=Object.freeze([]);function i(){return t}o.empty=i;function*n(x){yield x}o.single=n;function s(x){return e(x)?x:n(x)}o.wrap=s;function r(x){return x||t}o.from=r;function*a(x){for(let I=x.length-1;I>=0;I--)yield x[I]}o.reverse=a;function l(x){return!x||x[Symbol.iterator]().next().done===!0}o.isEmpty=l;function c(x){return x[Symbol.iterator]().next().value}o.first=c;function d(x,I){let D=0;for(const R of x)if(I(R,D++))return!0;return!1}o.some=d;function h(x,I){let D=0;for(const R of x)if(!I(R,D++))return!1;return!0}o.every=h;function u(x,I){for(const D of x)if(I(D))return D}o.find=u;function*f(x,I){for(const D of x)I(D)&&(yield D)}o.filter=f;function*g(x,I){let D=0;for(const R of x)yield I(R,D++)}o.map=g;function*m(x,I){let D=0;for(const R of x)yield*I(R,D++)}o.flatMap=m;function*_(...x){for(const I of x)GT(I)?yield*I:yield I}o.concat=_;function b(x,I,D){let R=D;for(const F of x)R=I(R,F);return R}o.reduce=b;function C(x){let I=0;for(const D of x)I++;return I}o.length=C;function*w(x,I,D=x.length){for(I<-x.length&&(I=0),I<0&&(I+=x.length),D<0?D+=x.length:D>x.length&&(D=x.length);I<D;I++)yield x[I]}o.slice=w;function v(x,I=Number.POSITIVE_INFINITY){const D=[];if(I===0)return[D,x];const R=x[Symbol.iterator]();for(let F=0;F<I;F++){const O=R.next();if(O.done)return[D,o.empty()];D.push(O.value)}return[D,{[Symbol.iterator](){return R}}]}o.consume=v;async function S(x){const I=[];for await(const D of x)I.push(D);return I}o.asyncToArray=S;async function L(x){let I=[];for await(const D of x)I=I.concat(D);return I}o.asyncToArrayFlat=L})(Ye||(Ye={}));function h5e(o,e){}function u5e(o){return o}function Xu(o){return typeof o=="object"&&o!==null&&typeof o.dispose=="function"&&o.dispose.length===0}function pt(o){if(Ye.is(o)){const e=[];for(const t of o)if(t)try{t.dispose()}catch(i){e.push(i)}if(e.length===1)throw e[0];if(e.length>1)throw new AggregateError(e,"Encountered errors while disposing of store");return Array.isArray(o)?[]:o}else if(o)return o.dispose(),o}function jr(...o){return ue(()=>pt(o))}class iie{constructor(e){this._isDisposed=!1,this._fn=e}dispose(){if(!this._isDisposed){if(!this._fn)throw new Error("Unbound disposable context: Need to use an arrow function to preserve the value of this");this._isDisposed=!0,this._fn()}}}function ue(o){return new iie(o)}const XE=class XE{constructor(){this._toDispose=new Set,this._isDisposed=!1}dispose(){this._isDisposed||(this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{pt(this._toDispose)}finally{this._toDispose.clear()}}add(e){if(!e||e===A.None)return e;if(e===this)throw new Error("Cannot register a disposable on itself!");return this._isDisposed?XE.DISABLE_DISPOSED_WARNING||console.warn(new Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(e),e}delete(e){if(e){if(e===this)throw new Error("Cannot dispose a disposable on itself!");this._toDispose.delete(e),e.dispose()}}};XE.DISABLE_DISPOSED_WARNING=!1;let U=XE;const sB=class sB{constructor(){this._store=new U,this._store}dispose(){this._store.dispose()}_register(e){if(e===this)throw new Error("Cannot register a disposable on itself!");return this._store.add(e)}};sB.None=Object.freeze({dispose(){}});let A=sB;class ct{constructor(){this._isDisposed=!1}get value(){return this._isDisposed?void 0:this._value}set value(e){this._isDisposed||e===this._value||(this._value?.dispose(),this._value=e)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,this._value?.dispose(),this._value=void 0}}class nie{constructor(e){this._disposable=e,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter===0&&this._disposable.dispose(),this}}class sie{constructor(e){this.object=e}dispose(){}}class ny{constructor(){this._store=new Map,this._isDisposed=!1}dispose(){this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{pt(this._store.values())}finally{this._store.clear()}}get(e){return this._store.get(e)}set(e,t,i=!1){this._isDisposed&&console.warn(new Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(e)?.dispose(),this._store.set(e,t)}deleteAndDispose(e){this._store.get(e)?.dispose(),this._store.delete(e)}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}let qi=(Od=class{constructor(e){this.element=e,this.next=Od.Undefined,this.prev=Od.Undefined}},Od.Undefined=new Od(void 0),Od);class Jn{constructor(){this._first=qi.Undefined,this._last=qi.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===qi.Undefined}clear(){let e=this._first;for(;e!==qi.Undefined;){const t=e.next;e.prev=qi.Undefined,e.next=qi.Undefined,e=t}this._first=qi.Undefined,this._last=qi.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){const i=new qi(e);if(this._first===qi.Undefined)this._first=i,this._last=i;else if(t){const s=this._last;this._last=i,i.prev=s,s.next=i}else{const s=this._first;this._first=i,i.next=s,s.prev=i}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(i))}}shift(){if(this._first!==qi.Undefined){const e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==qi.Undefined){const e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==qi.Undefined&&e.next!==qi.Undefined){const t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===qi.Undefined&&e.next===qi.Undefined?(this._first=qi.Undefined,this._last=qi.Undefined):e.next===qi.Undefined?(this._last=this._last.prev,this._last.next=qi.Undefined):e.prev===qi.Undefined&&(this._first=this._first.next,this._first.prev=qi.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==qi.Undefined;)yield e.element,e=e.next}}const oie=globalThis.performance.now.bind(globalThis.performance);class Ki{static create(e){return new Ki(e)}constructor(e){this._now=e===!1?Date.now:oie,this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}var ie;(function(o){o.None=()=>A.None;function e(O,B){return u(O,()=>{},0,void 0,!0,void 0,B)}o.defer=e;function t(O){return(B,V=null,z)=>{let ee=!1,se;return se=O(oe=>{if(!ee)return se?se.dispose():ee=!0,B.call(V,oe)},null,z),ee&&se.dispose(),se}}o.once=t;function i(O,B){return o.once(o.filter(O,B))}o.onceIf=i;function n(O,B,V){return d((z,ee=null,se)=>O(oe=>z.call(ee,B(oe)),null,se),V)}o.map=n;function s(O,B,V){return d((z,ee=null,se)=>O(oe=>{B(oe),z.call(ee,oe)},null,se),V)}o.forEach=s;function r(O,B,V){return d((z,ee=null,se)=>O(oe=>B(oe)&&z.call(ee,oe),null,se),V)}o.filter=r;function a(O){return O}o.signal=a;function l(...O){return(B,V=null,z)=>{const ee=jr(...O.map(se=>se(oe=>B.call(V,oe))));return h(ee,z)}}o.any=l;function c(O,B,V,z){let ee=V;return n(O,se=>(ee=B(ee,se),ee),z)}o.reduce=c;function d(O,B){let V;const z={onWillAddFirstListener(){V=O(ee.fire,ee)},onDidRemoveLastListener(){V?.dispose()}},ee=new P(z);return B?.add(ee),ee.event}function h(O,B){return B instanceof Array?B.push(O):B&&B.add(O),O}function u(O,B,V=100,z=!1,ee=!1,se,oe){let fe,Ie,Ae,tt=0,Ke;const At={leakWarningThreshold:se,onWillAddFirstListener(){fe=O(tn=>{tt++,Ie=B(Ie,tn),z&&!Ae&&(_t.fire(Ie),Ie=void 0),Ke=()=>{const Mi=Ie;Ie=void 0,Ae=void 0,(!z||tt>1)&&_t.fire(Mi),tt=0},typeof V=="number"?(Ae&&clearTimeout(Ae),Ae=setTimeout(Ke,V)):Ae===void 0&&(Ae=null,queueMicrotask(Ke))})},onWillRemoveListener(){ee&&tt>0&&Ke?.()},onDidRemoveLastListener(){Ke=void 0,fe.dispose()}},_t=new P(At);return oe?.add(_t),_t.event}o.debounce=u;function f(O,B=0,V){return o.debounce(O,(z,ee)=>z?(z.push(ee),z):[ee],B,void 0,!0,void 0,V)}o.accumulate=f;function g(O,B=(z,ee)=>z===ee,V){let z=!0,ee;return r(O,se=>{const oe=z||!B(se,ee);return z=!1,ee=se,oe},V)}o.latch=g;function m(O,B,V){return[o.filter(O,B,V),o.filter(O,z=>!B(z),V)]}o.split=m;function _(O,B=!1,V=[],z){let ee=V.slice(),se=O(Ie=>{ee?ee.push(Ie):fe.fire(Ie)});z&&z.add(se);const oe=()=>{ee?.forEach(Ie=>fe.fire(Ie)),ee=null},fe=new P({onWillAddFirstListener(){se||(se=O(Ie=>fe.fire(Ie)),z&&z.add(se))},onDidAddFirstListener(){ee&&(B?setTimeout(oe):oe())},onDidRemoveLastListener(){se&&se.dispose(),se=null}});return z&&z.add(fe),fe.event}o.buffer=_;function b(O,B){return(z,ee,se)=>{const oe=B(new w);return O(function(fe){const Ie=oe.evaluate(fe);Ie!==C&&z.call(ee,Ie)},void 0,se)}}o.chain=b;const C=Symbol("HaltChainable");class w{constructor(){this.steps=[]}map(B){return this.steps.push(B),this}forEach(B){return this.steps.push(V=>(B(V),V)),this}filter(B){return this.steps.push(V=>B(V)?V:C),this}reduce(B,V){let z=V;return this.steps.push(ee=>(z=B(z,ee),z)),this}latch(B=(V,z)=>V===z){let V=!0,z;return this.steps.push(ee=>{const se=V||!B(ee,z);return V=!1,z=ee,se?ee:C}),this}evaluate(B){for(const V of this.steps)if(B=V(B),B===C)break;return B}}function v(O,B,V=z=>z){const z=(...fe)=>oe.fire(V(...fe)),ee=()=>O.on(B,z),se=()=>O.removeListener(B,z),oe=new P({onWillAddFirstListener:ee,onDidRemoveLastListener:se});return oe.event}o.fromNodeEventEmitter=v;function S(O,B,V=z=>z){const z=(...fe)=>oe.fire(V(...fe)),ee=()=>O.addEventListener(B,z),se=()=>O.removeEventListener(B,z),oe=new P({onWillAddFirstListener:ee,onDidRemoveLastListener:se});return oe.event}o.fromDOMEventEmitter=S;function L(O,B){let V;const z=new Promise((ee,se)=>{const oe=t(O)(ee,null,B);V=()=>oe.dispose()});return z.cancel=V,z}o.toPromise=L;function x(O,B){return O(V=>B.fire(V))}o.forward=x;function I(O,B,V){return B(V),O(z=>B(z))}o.runAndSubscribe=I;class D{constructor(B,V){this._observable=B,this._counter=0,this._hasChanged=!1;const z={onWillAddFirstListener:()=>{B.addObserver(this),this._observable.reportChanges()},onDidRemoveLastListener:()=>{B.removeObserver(this)}};this.emitter=new P(z),V&&V.add(this.emitter)}beginUpdate(B){this._counter++}handlePossibleChange(B){}handleChange(B,V){this._hasChanged=!0}endUpdate(B){this._counter--,this._counter===0&&(this._observable.reportChanges(),this._hasChanged&&(this._hasChanged=!1,this.emitter.fire(this._observable.get())))}}function R(O,B){return new D(O,B).emitter.event}o.fromObservable=R;function F(O){return(B,V,z)=>{let ee=0,se=!1;const oe={beginUpdate(){ee++},endUpdate(){ee--,ee===0&&(O.reportChanges(),se&&(se=!1,B.call(V)))},handlePossibleChange(){},handleChange(){se=!0}};O.addObserver(oe),O.reportChanges();const fe={dispose(){O.removeObserver(oe)}};return z instanceof U?z.add(fe):Array.isArray(z)&&z.push(fe),fe}}o.fromObservableLight=F})(ie||(ie={}));const uC=class uC{constructor(e){this.listenerCount=0,this.invocationCount=0,this.elapsedOverall=0,this.durations=[],this.name=`${e}_${uC._idPool++}`,uC.all.add(this)}start(e){this._stopWatch=new Ki,this.listenerCount=e}stop(){if(this._stopWatch){const e=this._stopWatch.elapsed();this.durations.push(e),this.elapsedOverall+=e,this.invocationCount+=1,this._stopWatch=void 0}}};uC.all=new Set,uC._idPool=0;let oR=uC,rie=-1;const QE=class QE{constructor(e,t,i=(QE._idPool++).toString(16).padStart(3,"0")){this._errorHandler=e,this.threshold=t,this.name=i,this._warnCountdown=0}dispose(){this._stacks?.clear()}check(e,t){const i=this.threshold;if(i<=0||t<i)return;this._stacks||(this._stacks=new Map);const n=this._stacks.get(e.value)||0;if(this._stacks.set(e.value,n+1),this._warnCountdown-=1,this._warnCountdown<=0){this._warnCountdown=i*.5;const[s,r]=this.getMostFrequentStack(),a=`[${this.name}] potential listener LEAK detected, having ${t} listeners already. MOST frequent listener (${r}):`;console.warn(a),console.warn(s);const l=new aie(a,s);this._errorHandler(l)}return()=>{const s=this._stacks.get(e.value)||0;this._stacks.set(e.value,s-1)}}getMostFrequentStack(){if(!this._stacks)return;let e,t=0;for(const[i,n]of this._stacks)(!e||t<n)&&(e=[i,n],t=n);return e}};QE._idPool=1;let rR=QE;class aR{static create(){const e=new Error;return new aR(e.stack??"")}constructor(e){this.value=e}print(){console.warn(this.value.split(`
`).slice(2).join(`
`))}}class aie extends Error{constructor(e,t){super(e),this.name="ListenerLeakError",this.stack=t}}class lie extends Error{constructor(e,t){super(e),this.name="ListenerRefusalError",this.stack=t}}class lR{constructor(e){this.value=e}}const cie=2;let P=class{constructor(e){this._size=0,this._options=e,this._leakageMon=this._options?.leakWarningThreshold?new rR(e?.onListenerError??Ee,this._options?.leakWarningThreshold??rie):void 0,this._perfMon=this._options?._profName?new oR(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,i)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){const a=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(a);const l=this._leakageMon.getMostFrequentStack()??["UNKNOWN stack",-1],c=new lie(`${a}. HINT: Stack shows most frequent listener (${l[1]}-times)`,l[0]);return(this._options?.onListenerError||Ee)(c),A.None}if(this._disposed)return A.None;t&&(e=e.bind(t));const n=new lR(e);let s;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(n.stack=aR.create(),s=this._leakageMon.check(n.stack,this._size+1)),this._listeners?this._listeners instanceof lR?(this._deliveryQueue??=new $B,this._listeners=[this._listeners,n]):this._listeners.push(n):(this._options?.onWillAddFirstListener?.(this),this._listeners=n,this._options?.onDidAddFirstListener?.(this)),this._options?.onDidAddListener?.(this),this._size++;const r=ue(()=>{s?.(),this._removeListener(n)});return i instanceof U?i.add(r):Array.isArray(i)&&i.push(r),r},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}const t=this._listeners,i=t.indexOf(e);if(i===-1)throw console.log("disposed?",this._disposed),console.log("size?",this._size),console.log("arr?",JSON.stringify(this._listeners)),new Error("Attempted to dispose unknown listener");this._size--,t[i]=void 0;const n=this._deliveryQueue.current===this;if(this._size*cie<=t.length){let s=0;for(let r=0;r<t.length;r++)t[r]?t[s++]=t[r]:n&&s<this._deliveryQueue.end&&(this._deliveryQueue.end--,s<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=s}}_deliver(e,t){if(!e)return;const i=this._options?.onListenerError||Ee;if(!i){e.value(t);return}try{e.value(t)}catch(n){i(n)}}_deliverQueue(e){const t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners)if(this._listeners instanceof lR)this._deliver(this._listeners,e);else{const t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}this._perfMon?.stop()}hasListeners(){return this._size>0}};const die=()=>new $B;class $B{constructor(){this.i=-1,this.end=0}enqueue(e,t,i){this.i=0,this.end=i,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}}class Qu extends P{constructor(e){super(e),this._isPaused=0,this._eventQueue=new Jn,this._mergeFn=e?.merge}pause(){this._isPaused++}resume(){if(this._isPaused!==0&&--this._isPaused===0)if(this._mergeFn){if(this._eventQueue.size>0){const e=Array.from(this._eventQueue);this._eventQueue.clear(),super.fire(this._mergeFn(e))}}else for(;!this._isPaused&&this._eventQueue.size!==0;)super.fire(this._eventQueue.shift())}fire(e){this._size&&(this._isPaused!==0?this._eventQueue.push(e):super.fire(e))}}class jB extends Qu{constructor(e){super(e),this._delay=e.delay??100}fire(e){this._handle||(this.pause(),this._handle=setTimeout(()=>{this._handle=void 0,this.resume()},this._delay)),super.fire(e)}}class hie extends P{constructor(e){super(e),this._queuedEvents=[],this._mergeFn=e?.merge}fire(e){this.hasListeners()&&(this._queuedEvents.push(e),this._queuedEvents.length===1&&queueMicrotask(()=>{this._mergeFn?super.fire(this._mergeFn(this._queuedEvents)):this._queuedEvents.forEach(t=>super.fire(t)),this._queuedEvents=[]}))}}class uie{constructor(){this.hasListeners=!1,this.events=[],this.emitter=new P({onWillAddFirstListener:()=>this.onFirstListenerAdd(),onDidRemoveLastListener:()=>this.onLastListenerRemove()})}get event(){return this.emitter.event}add(e){const t={event:e,listener:null};return this.events.push(t),this.hasListeners&&this.hook(t),ue(Yu(()=>{this.hasListeners&&this.unhook(t);const n=this.events.indexOf(t);this.events.splice(n,1)}))}onFirstListenerAdd(){this.hasListeners=!0,this.events.forEach(e=>this.hook(e))}onLastListenerRemove(){this.hasListeners=!1,this.events.forEach(e=>this.unhook(e))}hook(e){e.listener=e.event(t=>this.emitter.fire(t))}unhook(e){e.listener?.dispose(),e.listener=null}dispose(){this.emitter.dispose();for(const e of this.events)e.listener?.dispose();this.events=[]}}class i1{constructor(){this.data=[]}wrapEvent(e,t,i){return(n,s,r)=>e(a=>{const l=this.data[this.data.length-1];if(!t){l?l.buffers.push(()=>n.call(s,a)):n.call(s,a);return}const c=l;if(!c){n.call(s,t(i,a));return}c.items??=[],c.items.push(a),c.buffers.length===0&&l.buffers.push(()=>{c.reducedResult??=i?c.items.reduce(t,i):c.items.reduce(t),n.call(s,c.reducedResult)})},void 0,r)}bufferEvents(e){const t={buffers:new Array};this.data.push(t);const i=e();return this.data.pop(),t.buffers.forEach(n=>n()),i}}class n1{constructor(){this.listening=!1,this.inputEvent=ie.None,this.inputEventListener=A.None,this.emitter=new P({onDidAddFirstListener:()=>{this.listening=!0,this.inputEventListener=this.inputEvent(this.emitter.fire,this.emitter)},onDidRemoveLastListener:()=>{this.listening=!1,this.inputEventListener.dispose()}}),this.event=this.emitter.event}set input(e){this.inputEvent=e,this.listening&&(this.inputEventListener.dispose(),this.inputEventListener=e(this.emitter.fire,this.emitter))}dispose(){this.inputEventListener.dispose(),this.emitter.dispose()}}const qB=Object.freeze(function(o,e){const t=setTimeout(o.bind(e),0);return{dispose(){clearTimeout(t)}}});var He;(function(o){function e(t){return t===o.None||t===o.Cancelled||t instanceof sy?!0:!t||typeof t!="object"?!1:typeof t.isCancellationRequested=="boolean"&&typeof t.onCancellationRequested=="function"}o.isCancellationToken=e,o.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ie.None}),o.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:qB})})(He||(He={}));class sy{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?qB:(this._emitter||(this._emitter=new P),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}}let Xt=class{constructor(e){this._token=void 0,this._parentListener=void 0,this._parentListener=e&&e.onCancellationRequested(this.cancel,this)}get token(){return this._token||(this._token=new sy),this._token}cancel(){this._token?this._token instanceof sy&&this._token.cancel():this._token=He.Cancelled}dispose(e=!1){e&&this.cancel(),this._parentListener?.dispose(),this._token?this._token instanceof sy&&this._token.dispose():this._token=He.None}};function cR(o){const e=new Xt;return o.add({dispose(){e.cancel()}}),e.token}const KB=Symbol("MicrotaskDelay");function dR(o){return!!o&&typeof o.then=="function"}function Vi(o){const e=new Xt,t=o(e.token);let i=!1;const n=new Promise((s,r)=>{const a=e.token.onCancellationRequested(()=>{i=!0,a.dispose(),r(new cr)});Promise.resolve(t).then(l=>{a.dispose(),e.dispose(),i?Xu(l)&&l.dispose():s(l)},l=>{a.dispose(),e.dispose(),r(l)})});return new class{cancel(){e.cancel(),e.dispose()}then(s,r){return n.then(s,r)}catch(s){return this.then(void 0,s)}finally(s){return n.finally(s)}}}function Em(o,e,t){return new Promise((i,n)=>{const s=e.onCancellationRequested(()=>{s.dispose(),i(t)});o.then(i,n).finally(()=>s.dispose())})}function fie(o,e){return new Promise((t,i)=>{const n=e.onCancellationRequested(()=>{n.dispose(),i(new cr)});o.then(t,i).finally(()=>n.dispose())})}let gie=class{constructor(){this.isDisposed=!1,this.activePromise=null,this.queuedPromise=null,this.queuedPromiseFactory=null}queue(e){if(this.isDisposed)return Promise.reject(new Error("Throttler is disposed"));if(this.activePromise){if(this.queuedPromiseFactory=e,!this.queuedPromise){const t=()=>{if(this.queuedPromise=null,this.isDisposed)return;const i=this.queue(this.queuedPromiseFactory);return this.queuedPromiseFactory=null,i};this.queuedPromise=new Promise(i=>{this.activePromise.then(t,t).then(i)})}return new Promise((t,i)=>{this.queuedPromise.then(t,i)})}return this.activePromise=e(),new Promise((t,i)=>{this.activePromise.then(n=>{this.activePromise=null,t(n)},n=>{this.activePromise=null,i(n)})})}dispose(){this.isDisposed=!0}};const pie=(o,e)=>{let t=!0;const i=setTimeout(()=>{t=!1,e()},o);return{isTriggered:()=>t,dispose:()=>{clearTimeout(i),t=!1}}},mie=o=>{let e=!0;return queueMicrotask(()=>{e&&(e=!1,o())}),{isTriggered:()=>e,dispose:()=>{e=!1}}};class fr{constructor(e){this.defaultDelay=e,this.deferred=null,this.completionPromise=null,this.doResolve=null,this.doReject=null,this.task=null}trigger(e,t=this.defaultDelay){this.task=e,this.cancelTimeout(),this.completionPromise||(this.completionPromise=new Promise((n,s)=>{this.doResolve=n,this.doReject=s}).then(()=>{if(this.completionPromise=null,this.doResolve=null,this.task){const n=this.task;return this.task=null,n()}}));const i=()=>{this.deferred=null,this.doResolve?.(null)};return this.deferred=t===KB?mie(i):pie(t,i),this.completionPromise}isTriggered(){return!!this.deferred?.isTriggered()}cancel(){this.cancelTimeout(),this.completionPromise&&(this.doReject?.(new cr),this.completionPromise=null)}cancelTimeout(){this.deferred?.dispose(),this.deferred=null}dispose(){this.cancel()}}class GB{constructor(e){this.delayer=new fr(e),this.throttler=new gie}trigger(e,t){return this.delayer.trigger(()=>this.throttler.queue(e),t)}cancel(){this.delayer.cancel()}dispose(){this.delayer.dispose(),this.throttler.dispose()}}function al(o,e){return e?new Promise((t,i)=>{const n=setTimeout(()=>{s.dispose(),t()},o),s=e.onCancellationRequested(()=>{clearTimeout(n),s.dispose(),i(new cr)})}):Vi(t=>al(o,t))}function yc(o,e=0,t){const i=setTimeout(()=>{o(),t&&n.dispose()},e),n=ue(()=>{clearTimeout(i),t?.delete(n)});return t?.add(n),n}function hR(o,e=i=>!!i,t=null){let i=0;const n=o.length,s=()=>{if(i>=n)return Promise.resolve(t);const r=o[i++];return Promise.resolve(r()).then(l=>e(l)?Promise.resolve(l):s())};return s()}let _ie=class{constructor(){this._runningTask=void 0,this._pendingTasks=[]}schedule(e){const t=new Ju;return this._pendingTasks.push({task:e,deferred:t,setUndefinedWhenCleared:!1}),this._runIfNotRunning(),t.p}_runIfNotRunning(){this._runningTask===void 0&&this._processQueue()}async _processQueue(){if(this._pendingTasks.length===0)return;const e=this._pendingTasks.shift();if(e){if(this._runningTask)throw new Ce;this._runningTask=e.task;try{const t=await e.task();e.deferred.complete(t)}catch(t){e.deferred.error(t)}finally{this._runningTask=void 0,this._processQueue()}}}clearPending(){const e=this._pendingTasks;this._pendingTasks=[];for(const t of e)t.setUndefinedWhenCleared?t.deferred.complete(void 0):t.deferred.error(new cr)}};class No{constructor(e,t){this._isDisposed=!1,this._token=void 0,typeof e=="function"&&typeof t=="number"&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==void 0&&(clearTimeout(this._token),this._token=void 0)}cancelAndSet(e,t){if(this._isDisposed)throw new Ce("Calling 'cancelAndSet' on a disposed TimeoutTimer");this.cancel(),this._token=setTimeout(()=>{this._token=void 0,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new Ce("Calling 'setIfNotSet' on a disposed TimeoutTimer");this._token===void 0&&(this._token=setTimeout(()=>{this._token=void 0,e()},t))}}class uR{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,i=globalThis){if(this.isDisposed)throw new Ce("Calling 'cancelAndSet' on a disposed IntervalTimer");this.cancel();const n=i.setInterval(()=>{e()},t);this.disposable=ue(()=>{i.clearInterval(n),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}}class wt{constructor(e,t){this.timeoutToken=void 0,this.runner=e,this.timeout=t,this.timeoutHandler=this.onTimeout.bind(this)}dispose(){this.cancel(),this.runner=null}cancel(){this.isScheduled()&&(clearTimeout(this.timeoutToken),this.timeoutToken=void 0)}schedule(e=this.timeout){this.cancel(),this.timeoutToken=setTimeout(this.timeoutHandler,e)}get delay(){return this.timeout}set delay(e){this.timeout=e}isScheduled(){return this.timeoutToken!==void 0}onTimeout(){this.timeoutToken=void 0,this.runner&&this.doRun()}doRun(){this.runner?.()}}let fR,s1;(function(){const o=globalThis;typeof o.requestIdleCallback!="function"||typeof o.cancelIdleCallback!="function"?s1=(e,t,i)=>{ey(()=>{if(n)return;const s=Date.now()+15;t(Object.freeze({didTimeout:!0,timeRemaining(){return Math.max(0,s-Date.now())}}))});let n=!1;return{dispose(){n||(n=!0)}}}:s1=(e,t,i)=>{const n=e.requestIdleCallback(t,typeof i=="number"?{timeout:i}:void 0);let s=!1;return{dispose(){s||(s=!0,e.cancelIdleCallback(n))}}},fR=(e,t)=>s1(globalThis,e,t)})();class ZB{constructor(e,t){this._didRun=!1,this._executor=()=>{try{this._value=t()}catch(i){this._error=i}finally{this._didRun=!0}},this._handle=s1(e,()=>this._executor())}dispose(){this._handle.dispose()}get value(){if(this._didRun||(this._handle.dispose(),this._executor()),this._error)throw this._error;return this._value}get isInitialized(){return this._didRun}}class bie extends ZB{constructor(e){super(globalThis,e)}}class Ju{get isRejected(){return this.outcome?.outcome===1}get isSettled(){return!!this.outcome}constructor(){this.p=new Promise((e,t)=>{this.completeCallback=e,this.errorCallback=t})}complete(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.completeCallback(e),this.outcome={outcome:0,value:e},t()})}error(e){return this.isSettled?Promise.resolve():new Promise(t=>{this.errorCallback(e),this.outcome={outcome:1,value:e},t()})}cancel(){return this.error(new cr)}}var o1;(function(o){async function e(i){let n;const s=await Promise.all(i.map(r=>r.then(a=>a,a=>{n||(n=a)})));if(typeof n<"u")throw n;return s}o.settled=e;function t(i){return new Promise(async(n,s)=>{try{await i(n,s)}catch(r){s(r)}})}o.withAsyncBody=t})(o1||(o1={}));function Cie(o){const e=new Xt,t=o(e.token);return new wie(e,async i=>{const n=e.token.onCancellationRequested(()=>{n.dispose(),e.dispose(),i.reject(new cr)});try{for await(const s of t){if(e.token.isCancellationRequested)return;i.emitOne(s)}n.dispose(),e.dispose()}catch(s){n.dispose(),e.dispose(),i.reject(s)}})}class vie{constructor(){this._unsatisfiedConsumers=[],this._unconsumedValues=[]}get hasFinalValue(){return!!this._finalValue}produce(e){if(this._ensureNoFinalValue(),this._unsatisfiedConsumers.length>0){const t=this._unsatisfiedConsumers.shift();this._resolveOrRejectDeferred(t,e)}else this._unconsumedValues.push(e)}produceFinal(e){this._ensureNoFinalValue(),this._finalValue=e;for(const t of this._unsatisfiedConsumers)this._resolveOrRejectDeferred(t,e);this._unsatisfiedConsumers.length=0}_ensureNoFinalValue(){if(this._finalValue)throw new Ce("ProducerConsumer: cannot produce after final value has been set")}_resolveOrRejectDeferred(e,t){t.ok?e.complete(t.value):e.error(t.error)}consume(){if(this._unconsumedValues.length>0||this._finalValue){const e=this._unconsumedValues.length>0?this._unconsumedValues.shift():this._finalValue;return e.ok?Promise.resolve(e.value):Promise.reject(e.error)}else{const e=new Ju;return this._unsatisfiedConsumers.push(e),e.p}}}const or=class or{constructor(e,t){this._onReturn=t,this._producerConsumer=new vie,this._iterator={next:()=>this._producerConsumer.consume(),return:()=>(this._onReturn?.(),Promise.resolve({done:!0,value:void 0})),throw:async i=>(this._finishError(i),{done:!0,value:void 0})},queueMicrotask(async()=>{const i=e({emitOne:n=>this._producerConsumer.produce({ok:!0,value:{done:!1,value:n}}),emitMany:n=>{for(const s of n)this._producerConsumer.produce({ok:!0,value:{done:!1,value:s}})},reject:n=>this._finishError(n)});if(!this._producerConsumer.hasFinalValue)try{await i,this._finishOk()}catch(n){this._finishError(n)}})}static fromArray(e){return new or(t=>{t.emitMany(e)})}static fromPromise(e){return new or(async t=>{t.emitMany(await e)})}static fromPromisesResolveOrder(e){return new or(async t=>{await Promise.all(e.map(async i=>t.emitOne(await i)))})}static merge(e){return new or(async t=>{await Promise.all(e.map(async i=>{for await(const n of i)t.emitOne(n)}))})}static map(e,t){return new or(async i=>{for await(const n of e)i.emitOne(t(n))})}map(e){return or.map(this,e)}static coalesce(e){return or.filter(e,t=>!!t)}coalesce(){return or.coalesce(this)}static filter(e,t){return new or(async i=>{for await(const n of e)t(n)&&i.emitOne(n)})}filter(e){return or.filter(this,e)}_finishOk(){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!0,value:{done:!0,value:void 0}})}_finishError(e){this._producerConsumer.hasFinalValue||this._producerConsumer.produceFinal({ok:!1,error:e})}[Symbol.asyncIterator](){return this._iterator}};or.EMPTY=or.fromArray([]);let gr=or;class wie extends gr{constructor(e,t){super(t),this._source=e}cancel(){this._source.cancel()}}function YB(o){return o}class Sie{constructor(e,t){this.lastCache=void 0,this.lastArgKey=void 0,typeof e=="function"?(this._fn=e,this._computeKey=YB):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);return this.lastArgKey!==t&&(this.lastArgKey=t,this.lastCache=this._fn(e)),this.lastCache}}class gR{get cachedValues(){return this._map}constructor(e,t){this._map=new Map,this._map2=new Map,typeof e=="function"?(this._fn=e,this._computeKey=YB):(this._fn=t,this._computeKey=e.getCacheKey)}get(e){const t=this._computeKey(e);if(this._map2.has(t))return this._map2.get(t);const i=this._fn(e);return this._map.set(e,i),this._map2.set(t,i),i}}var ef;(function(o){o[o.Uninitialized=0]="Uninitialized",o[o.Running=1]="Running",o[o.Completed=2]="Completed"})(ef||(ef={}));class Ln{constructor(e){this.executor=e,this._state=ef.Uninitialized}get value(){if(this._state===ef.Uninitialized){this._state=ef.Running;try{this._value=this.executor()}catch(e){this._error=e}finally{this._state=ef.Completed}}else if(this._state===ef.Running)throw new Error("Cannot read the value of a lazy that is being initialized");if(this._error)throw this._error;return this._value}get rawValue(){return this._value}}function XB(o){return!o||typeof o!="string"?!0:o.trim().length===0}const yie=/{(\d+)}/g;function tf(o,...e){return e.length===0?o:o.replace(yie,function(t,i){const n=parseInt(i,10);return isNaN(n)||n<0||n>=e.length?t:e[n]})}function Lie(o){return o.replace(/[<>"'&]/g,e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case"'":return"&apos;";case"&":return"&amp;"}return e})}function qr(o){return o.replace(/[<>&]/g,function(e){switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";default:return e}})}function oo(o){return o.replace(/[\\\{\}\*\+\?\|\^\$\.\[\]\(\)]/g,"\\$&")}function xie(o,e=" "){const t=r1(o,e);return QB(t,e)}function r1(o,e){if(!o||!e)return o;const t=e.length;if(t===0||o.length===0)return o;let i=0;for(;o.indexOf(e,i)===i;)i=i+t;return o.substring(i)}function QB(o,e){if(!o||!e)return o;const t=e.length,i=o.length;if(t===0||i===0)return o;let n=i,s=-1;for(;s=o.lastIndexOf(e,n-1),!(s===-1||s+t!==n);){if(s===0)return"";n=s}return o.substring(0,n)}function kie(o){return o.replace(/[\-\\\{\}\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&").replace(/[\*]/g,".*")}function JB(o,e,t={}){if(!o)throw new Error("Cannot create regex from empty string");e||(o=oo(o)),t.wholeWord&&(/\B/.test(o.charAt(0))||(o="\\b"+o),/\B/.test(o.charAt(o.length-1))||(o=o+"\\b"));let i="";return t.global&&(i+="g"),t.matchCase||(i+="i"),t.multiline&&(i+="m"),t.unicode&&(i+="u"),new RegExp(o,i)}function e6(o){return o.source==="^"||o.source==="^$"||o.source==="$"||o.source==="^\\s*$"?!1:!!(o.exec("")&&o.lastIndex===0)}function ro(o){return o.split(/\r\n|\r|\n/)}function es(o){for(let e=0,t=o.length;e<t;e++){const i=o.charCodeAt(e);if(i!==32&&i!==9)return e}return-1}function It(o,e=0,t=o.length){for(let i=e;i<t;i++){const n=o.charCodeAt(i);if(n!==32&&n!==9)return o.substring(e,i)}return o.substring(e,t)}function Kr(o,e=o.length-1){for(let t=e;t>=0;t--){const i=o.charCodeAt(t);if(i!==32&&i!==9)return t}return-1}function a1(o,e){return o<e?-1:o>e?1:0}function pR(o,e,t=0,i=o.length,n=0,s=e.length){for(;t<i&&n<s;t++,n++){const l=o.charCodeAt(t),c=e.charCodeAt(n);if(l<c)return-1;if(l>c)return 1}const r=i-t,a=s-n;return r<a?-1:r>a?1:0}function mR(o,e){return l1(o,e,0,o.length,0,e.length)}function l1(o,e,t=0,i=o.length,n=0,s=e.length){for(;t<i&&n<s;t++,n++){let l=o.charCodeAt(t),c=e.charCodeAt(n);if(l===c)continue;if(l>=128||c>=128)return pR(o.toLowerCase(),e.toLowerCase(),t,i,n,s);Jd(l)&&(l-=32),Jd(c)&&(c-=32);const d=l-c;if(d!==0)return d}const r=i-t,a=s-n;return r<a?-1:r>a?1:0}function oy(o){return o>=48&&o<=57}function Jd(o){return o>=97&&o<=122}function ll(o){return o>=65&&o<=90}function Nm(o,e){return o.length===e.length&&l1(o,e)===0}function _R(o,e){const t=e.length;return e.length>o.length?!1:l1(o,e,0,t)===0}function Gr(o,e){const t=Math.min(o.length,e.length);let i;for(i=0;i<t;i++)if(o.charCodeAt(i)!==e.charCodeAt(i))return i;return t}function Lc(o,e){const t=Math.min(o.length,e.length);let i;const n=o.length-1,s=e.length-1;for(i=0;i<t;i++)if(o.charCodeAt(n-i)!==e.charCodeAt(s-i))return i;return t}function zi(o){return 55296<=o&&o<=56319}function eh(o){return 56320<=o&&o<=57343}function bR(o,e){return(o-55296<<10)+(e-56320)+65536}function ry(o,e,t){const i=o.charCodeAt(t);if(zi(i)&&t+1<e){const n=o.charCodeAt(t+1);if(eh(n))return bR(i,n)}return i}function Iie(o,e){const t=o.charCodeAt(e-1);if(eh(t)&&e>1){const i=o.charCodeAt(e-2);if(zi(i))return bR(i,t)}return t}class CR{get offset(){return this._offset}constructor(e,t=0){this._str=e,this._len=e.length,this._offset=t}setOffset(e){this._offset=e}prevCodePoint(){const e=Iie(this._str,this._offset);return this._offset-=e>=65536?2:1,e}nextCodePoint(){const e=ry(this._str,this._len,this._offset);return this._offset+=e>=65536?2:1,e}eol(){return this._offset>=this._len}}class ay{get offset(){return this._iterator.offset}constructor(e,t=0){this._iterator=new CR(e,t)}nextGraphemeLength(){const e=ly.getInstance(),t=this._iterator,i=t.offset;let n=e.getGraphemeBreakType(t.nextCodePoint());for(;!t.eol();){const s=t.offset,r=e.getGraphemeBreakType(t.nextCodePoint());if(o6(n,r)){t.setOffset(s);break}n=r}return t.offset-i}prevGraphemeLength(){const e=ly.getInstance(),t=this._iterator,i=t.offset;let n=e.getGraphemeBreakType(t.prevCodePoint());for(;t.offset>0;){const s=t.offset,r=e.getGraphemeBreakType(t.prevCodePoint());if(o6(r,n)){t.setOffset(s);break}n=r}return i-t.offset}eol(){return this._iterator.eol()}}function vR(o,e){return new ay(o,e).nextGraphemeLength()}function t6(o,e){return new ay(o,e).prevGraphemeLength()}function Die(o,e){e>0&&eh(o.charCodeAt(e))&&e--;const t=e+vR(o,e);return[t-t6(o,t),t]}let wR;function Eie(){return/(?:[\u05BE\u05C0\u05C3\u05C6\u05D0-\u05F4\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u0710\u0712-\u072F\u074D-\u07A5\u07B1-\u07EA\u07F4\u07F5\u07FA\u07FE-\u0815\u081A\u0824\u0828\u0830-\u0858\u085E-\u088E\u08A0-\u08C9\u200F\uFB1D\uFB1F-\uFB28\uFB2A-\uFD3D\uFD50-\uFDC7\uFDF0-\uFDFC\uFE70-\uFEFC]|\uD802[\uDC00-\uDD1B\uDD20-\uDE00\uDE10-\uDE35\uDE40-\uDEE4\uDEEB-\uDF35\uDF40-\uDFFF]|\uD803[\uDC00-\uDD23\uDE80-\uDEA9\uDEAD-\uDF45\uDF51-\uDF81\uDF86-\uDFF6]|\uD83A[\uDC00-\uDCCF\uDD00-\uDD43\uDD4B-\uDFFF]|\uD83B[\uDC00-\uDEBB])/}function Tm(o){return wR||(wR=Eie()),wR.test(o)}const Nie=/^[\t\n\r\x20-\x7E]*$/;function c1(o){return Nie.test(o)}const i6=/[\u2028\u2029]/;function n6(o){return i6.test(o)}function th(o){return o>=11904&&o<=55215||o>=63744&&o<=64255||o>=65281&&o<=65374}function SR(o){return o>=127462&&o<=127487||o===8986||o===8987||o===9200||o===9203||o>=9728&&o<=10175||o===11088||o===11093||o>=127744&&o<=128591||o>=128640&&o<=128764||o>=128992&&o<=129008||o>=129280&&o<=129535||o>=129648&&o<=129782}const Tie="\uFEFF";function yR(o){return!!(o&&o.length>0&&o.charCodeAt(0)===65279)}function Rie(o,e=!1){return o?(e&&(o=o.replace(/\\./g,"")),o.toLowerCase()!==o):!1}function s6(o){return o=o%52,o<26?String.fromCharCode(97+o):String.fromCharCode(65+o-26)}function o6(o,e){return o===0?e!==5&&e!==7:o===2&&e===3?!1:o===4||o===2||o===3||e===4||e===2||e===3?!0:!(o===8&&(e===8||e===9||e===11||e===12)||(o===11||o===9)&&(e===9||e===10)||(o===12||o===10)&&e===10||e===5||e===13||e===7||o===1||o===13&&e===14||o===6&&e===6)}const _p=class _p{static getInstance(){return _p._INSTANCE||(_p._INSTANCE=new _p),_p._INSTANCE}constructor(){this._data=Mie()}getGraphemeBreakType(e){if(e<32)return e===10?3:e===13?2:4;if(e<127)return 0;const t=this._data,i=t.length/3;let n=1;for(;n<=i;)if(e<t[3*n])n=2*n;else if(e>t[3*n+1])n=2*n+1;else return t[3*n+2];return 0}};_p._INSTANCE=null;let ly=_p;function Mie(){return JSON.parse("[0,0,0,51229,51255,12,44061,44087,12,127462,127487,6,7083,7085,5,47645,47671,12,54813,54839,12,128678,128678,14,3270,3270,5,9919,9923,14,45853,45879,12,49437,49463,12,53021,53047,12,71216,71218,7,128398,128399,14,129360,129374,14,2519,2519,5,4448,4519,9,9742,9742,14,12336,12336,14,44957,44983,12,46749,46775,12,48541,48567,12,50333,50359,12,52125,52151,12,53917,53943,12,69888,69890,5,73018,73018,5,127990,127990,14,128558,128559,14,128759,128760,14,129653,129655,14,2027,2035,5,2891,2892,7,3761,3761,5,6683,6683,5,8293,8293,4,9825,9826,14,9999,9999,14,43452,43453,5,44509,44535,12,45405,45431,12,46301,46327,12,47197,47223,12,48093,48119,12,48989,49015,12,49885,49911,12,50781,50807,12,51677,51703,12,52573,52599,12,53469,53495,12,54365,54391,12,65279,65279,4,70471,70472,7,72145,72147,7,119173,119179,5,127799,127818,14,128240,128244,14,128512,128512,14,128652,128652,14,128721,128722,14,129292,129292,14,129445,129450,14,129734,129743,14,1476,1477,5,2366,2368,7,2750,2752,7,3076,3076,5,3415,3415,5,4141,4144,5,6109,6109,5,6964,6964,5,7394,7400,5,9197,9198,14,9770,9770,14,9877,9877,14,9968,9969,14,10084,10084,14,43052,43052,5,43713,43713,5,44285,44311,12,44733,44759,12,45181,45207,12,45629,45655,12,46077,46103,12,46525,46551,12,46973,46999,12,47421,47447,12,47869,47895,12,48317,48343,12,48765,48791,12,49213,49239,12,49661,49687,12,50109,50135,12,50557,50583,12,51005,51031,12,51453,51479,12,51901,51927,12,52349,52375,12,52797,52823,12,53245,53271,12,53693,53719,12,54141,54167,12,54589,54615,12,55037,55063,12,69506,69509,5,70191,70193,5,70841,70841,7,71463,71467,5,72330,72342,5,94031,94031,5,123628,123631,5,127763,127765,14,127941,127941,14,128043,128062,14,128302,128317,14,128465,128467,14,128539,128539,14,128640,128640,14,128662,128662,14,128703,128703,14,128745,128745,14,129004,129007,14,129329,129330,14,129402,129402,14,129483,129483,14,129686,129704,14,130048,131069,14,173,173,4,1757,1757,1,2200,2207,5,2434,2435,7,2631,2632,5,2817,2817,5,3008,3008,5,3201,3201,5,3387,3388,5,3542,3542,5,3902,3903,7,4190,4192,5,6002,6003,5,6439,6440,5,6765,6770,7,7019,7027,5,7154,7155,7,8205,8205,13,8505,8505,14,9654,9654,14,9757,9757,14,9792,9792,14,9852,9853,14,9890,9894,14,9937,9937,14,9981,9981,14,10035,10036,14,11035,11036,14,42654,42655,5,43346,43347,7,43587,43587,5,44006,44007,7,44173,44199,12,44397,44423,12,44621,44647,12,44845,44871,12,45069,45095,12,45293,45319,12,45517,45543,12,45741,45767,12,45965,45991,12,46189,46215,12,46413,46439,12,46637,46663,12,46861,46887,12,47085,47111,12,47309,47335,12,47533,47559,12,47757,47783,12,47981,48007,12,48205,48231,12,48429,48455,12,48653,48679,12,48877,48903,12,49101,49127,12,49325,49351,12,49549,49575,12,49773,49799,12,49997,50023,12,50221,50247,12,50445,50471,12,50669,50695,12,50893,50919,12,51117,51143,12,51341,51367,12,51565,51591,12,51789,51815,12,52013,52039,12,52237,52263,12,52461,52487,12,52685,52711,12,52909,52935,12,53133,53159,12,53357,53383,12,53581,53607,12,53805,53831,12,54029,54055,12,54253,54279,12,54477,54503,12,54701,54727,12,54925,54951,12,55149,55175,12,68101,68102,5,69762,69762,7,70067,70069,7,70371,70378,5,70720,70721,7,71087,71087,5,71341,71341,5,71995,71996,5,72249,72249,7,72850,72871,5,73109,73109,5,118576,118598,5,121505,121519,5,127245,127247,14,127568,127569,14,127777,127777,14,127872,127891,14,127956,127967,14,128015,128016,14,128110,128172,14,128259,128259,14,128367,128368,14,128424,128424,14,128488,128488,14,128530,128532,14,128550,128551,14,128566,128566,14,128647,128647,14,128656,128656,14,128667,128673,14,128691,128693,14,128715,128715,14,128728,128732,14,128752,128752,14,128765,128767,14,129096,129103,14,129311,129311,14,129344,129349,14,129394,129394,14,129413,129425,14,129466,129471,14,129511,129535,14,129664,129666,14,129719,129722,14,129760,129767,14,917536,917631,5,13,13,2,1160,1161,5,1564,1564,4,1807,1807,1,2085,2087,5,2307,2307,7,2382,2383,7,2497,2500,5,2563,2563,7,2677,2677,5,2763,2764,7,2879,2879,5,2914,2915,5,3021,3021,5,3142,3144,5,3263,3263,5,3285,3286,5,3398,3400,7,3530,3530,5,3633,3633,5,3864,3865,5,3974,3975,5,4155,4156,7,4229,4230,5,5909,5909,7,6078,6085,7,6277,6278,5,6451,6456,7,6744,6750,5,6846,6846,5,6972,6972,5,7074,7077,5,7146,7148,7,7222,7223,5,7416,7417,5,8234,8238,4,8417,8417,5,9000,9000,14,9203,9203,14,9730,9731,14,9748,9749,14,9762,9763,14,9776,9783,14,9800,9811,14,9831,9831,14,9872,9873,14,9882,9882,14,9900,9903,14,9929,9933,14,9941,9960,14,9974,9974,14,9989,9989,14,10006,10006,14,10062,10062,14,10160,10160,14,11647,11647,5,12953,12953,14,43019,43019,5,43232,43249,5,43443,43443,5,43567,43568,7,43696,43696,5,43765,43765,7,44013,44013,5,44117,44143,12,44229,44255,12,44341,44367,12,44453,44479,12,44565,44591,12,44677,44703,12,44789,44815,12,44901,44927,12,45013,45039,12,45125,45151,12,45237,45263,12,45349,45375,12,45461,45487,12,45573,45599,12,45685,45711,12,45797,45823,12,45909,45935,12,46021,46047,12,46133,46159,12,46245,46271,12,46357,46383,12,46469,46495,12,46581,46607,12,46693,46719,12,46805,46831,12,46917,46943,12,47029,47055,12,47141,47167,12,47253,47279,12,47365,47391,12,47477,47503,12,47589,47615,12,47701,47727,12,47813,47839,12,47925,47951,12,48037,48063,12,48149,48175,12,48261,48287,12,48373,48399,12,48485,48511,12,48597,48623,12,48709,48735,12,48821,48847,12,48933,48959,12,49045,49071,12,49157,49183,12,49269,49295,12,49381,49407,12,49493,49519,12,49605,49631,12,49717,49743,12,49829,49855,12,49941,49967,12,50053,50079,12,50165,50191,12,50277,50303,12,50389,50415,12,50501,50527,12,50613,50639,12,50725,50751,12,50837,50863,12,50949,50975,12,51061,51087,12,51173,51199,12,51285,51311,12,51397,51423,12,51509,51535,12,51621,51647,12,51733,51759,12,51845,51871,12,51957,51983,12,52069,52095,12,52181,52207,12,52293,52319,12,52405,52431,12,52517,52543,12,52629,52655,12,52741,52767,12,52853,52879,12,52965,52991,12,53077,53103,12,53189,53215,12,53301,53327,12,53413,53439,12,53525,53551,12,53637,53663,12,53749,53775,12,53861,53887,12,53973,53999,12,54085,54111,12,54197,54223,12,54309,54335,12,54421,54447,12,54533,54559,12,54645,54671,12,54757,54783,12,54869,54895,12,54981,55007,12,55093,55119,12,55243,55291,10,66045,66045,5,68325,68326,5,69688,69702,5,69817,69818,5,69957,69958,7,70089,70092,5,70198,70199,5,70462,70462,5,70502,70508,5,70750,70750,5,70846,70846,7,71100,71101,5,71230,71230,7,71351,71351,5,71737,71738,5,72000,72000,7,72160,72160,5,72273,72278,5,72752,72758,5,72882,72883,5,73031,73031,5,73461,73462,7,94192,94193,7,119149,119149,7,121403,121452,5,122915,122916,5,126980,126980,14,127358,127359,14,127535,127535,14,127759,127759,14,127771,127771,14,127792,127793,14,127825,127867,14,127897,127899,14,127945,127945,14,127985,127986,14,128000,128007,14,128021,128021,14,128066,128100,14,128184,128235,14,128249,128252,14,128266,128276,14,128335,128335,14,128379,128390,14,128407,128419,14,128444,128444,14,128481,128481,14,128499,128499,14,128526,128526,14,128536,128536,14,128543,128543,14,128556,128556,14,128564,128564,14,128577,128580,14,128643,128645,14,128649,128649,14,128654,128654,14,128660,128660,14,128664,128664,14,128675,128675,14,128686,128689,14,128695,128696,14,128705,128709,14,128717,128719,14,128725,128725,14,128736,128741,14,128747,128748,14,128755,128755,14,128762,128762,14,128981,128991,14,129009,129023,14,129160,129167,14,129296,129304,14,129320,129327,14,129340,129342,14,129356,129356,14,129388,129392,14,129399,129400,14,129404,129407,14,129432,129442,14,129454,129455,14,129473,129474,14,129485,129487,14,129648,129651,14,129659,129660,14,129671,129679,14,129709,129711,14,129728,129730,14,129751,129753,14,129776,129782,14,917505,917505,4,917760,917999,5,10,10,3,127,159,4,768,879,5,1471,1471,5,1536,1541,1,1648,1648,5,1767,1768,5,1840,1866,5,2070,2073,5,2137,2139,5,2274,2274,1,2363,2363,7,2377,2380,7,2402,2403,5,2494,2494,5,2507,2508,7,2558,2558,5,2622,2624,7,2641,2641,5,2691,2691,7,2759,2760,5,2786,2787,5,2876,2876,5,2881,2884,5,2901,2902,5,3006,3006,5,3014,3016,7,3072,3072,5,3134,3136,5,3157,3158,5,3260,3260,5,3266,3266,5,3274,3275,7,3328,3329,5,3391,3392,7,3405,3405,5,3457,3457,5,3536,3537,7,3551,3551,5,3636,3642,5,3764,3772,5,3895,3895,5,3967,3967,7,3993,4028,5,4146,4151,5,4182,4183,7,4226,4226,5,4253,4253,5,4957,4959,5,5940,5940,7,6070,6070,7,6087,6088,7,6158,6158,4,6432,6434,5,6448,6449,7,6679,6680,5,6742,6742,5,6754,6754,5,6783,6783,5,6912,6915,5,6966,6970,5,6978,6978,5,7042,7042,7,7080,7081,5,7143,7143,7,7150,7150,7,7212,7219,5,7380,7392,5,7412,7412,5,8203,8203,4,8232,8232,4,8265,8265,14,8400,8412,5,8421,8432,5,8617,8618,14,9167,9167,14,9200,9200,14,9410,9410,14,9723,9726,14,9733,9733,14,9745,9745,14,9752,9752,14,9760,9760,14,9766,9766,14,9774,9774,14,9786,9786,14,9794,9794,14,9823,9823,14,9828,9828,14,9833,9850,14,9855,9855,14,9875,9875,14,9880,9880,14,9885,9887,14,9896,9897,14,9906,9916,14,9926,9927,14,9935,9935,14,9939,9939,14,9962,9962,14,9972,9972,14,9978,9978,14,9986,9986,14,9997,9997,14,10002,10002,14,10017,10017,14,10055,10055,14,10071,10071,14,10133,10135,14,10548,10549,14,11093,11093,14,12330,12333,5,12441,12442,5,42608,42610,5,43010,43010,5,43045,43046,5,43188,43203,7,43302,43309,5,43392,43394,5,43446,43449,5,43493,43493,5,43571,43572,7,43597,43597,7,43703,43704,5,43756,43757,5,44003,44004,7,44009,44010,7,44033,44059,12,44089,44115,12,44145,44171,12,44201,44227,12,44257,44283,12,44313,44339,12,44369,44395,12,44425,44451,12,44481,44507,12,44537,44563,12,44593,44619,12,44649,44675,12,44705,44731,12,44761,44787,12,44817,44843,12,44873,44899,12,44929,44955,12,44985,45011,12,45041,45067,12,45097,45123,12,45153,45179,12,45209,45235,12,45265,45291,12,45321,45347,12,45377,45403,12,45433,45459,12,45489,45515,12,45545,45571,12,45601,45627,12,45657,45683,12,45713,45739,12,45769,45795,12,45825,45851,12,45881,45907,12,45937,45963,12,45993,46019,12,46049,46075,12,46105,46131,12,46161,46187,12,46217,46243,12,46273,46299,12,46329,46355,12,46385,46411,12,46441,46467,12,46497,46523,12,46553,46579,12,46609,46635,12,46665,46691,12,46721,46747,12,46777,46803,12,46833,46859,12,46889,46915,12,46945,46971,12,47001,47027,12,47057,47083,12,47113,47139,12,47169,47195,12,47225,47251,12,47281,47307,12,47337,47363,12,47393,47419,12,47449,47475,12,47505,47531,12,47561,47587,12,47617,47643,12,47673,47699,12,47729,47755,12,47785,47811,12,47841,47867,12,47897,47923,12,47953,47979,12,48009,48035,12,48065,48091,12,48121,48147,12,48177,48203,12,48233,48259,12,48289,48315,12,48345,48371,12,48401,48427,12,48457,48483,12,48513,48539,12,48569,48595,12,48625,48651,12,48681,48707,12,48737,48763,12,48793,48819,12,48849,48875,12,48905,48931,12,48961,48987,12,49017,49043,12,49073,49099,12,49129,49155,12,49185,49211,12,49241,49267,12,49297,49323,12,49353,49379,12,49409,49435,12,49465,49491,12,49521,49547,12,49577,49603,12,49633,49659,12,49689,49715,12,49745,49771,12,49801,49827,12,49857,49883,12,49913,49939,12,49969,49995,12,50025,50051,12,50081,50107,12,50137,50163,12,50193,50219,12,50249,50275,12,50305,50331,12,50361,50387,12,50417,50443,12,50473,50499,12,50529,50555,12,50585,50611,12,50641,50667,12,50697,50723,12,50753,50779,12,50809,50835,12,50865,50891,12,50921,50947,12,50977,51003,12,51033,51059,12,51089,51115,12,51145,51171,12,51201,51227,12,51257,51283,12,51313,51339,12,51369,51395,12,51425,51451,12,51481,51507,12,51537,51563,12,51593,51619,12,51649,51675,12,51705,51731,12,51761,51787,12,51817,51843,12,51873,51899,12,51929,51955,12,51985,52011,12,52041,52067,12,52097,52123,12,52153,52179,12,52209,52235,12,52265,52291,12,52321,52347,12,52377,52403,12,52433,52459,12,52489,52515,12,52545,52571,12,52601,52627,12,52657,52683,12,52713,52739,12,52769,52795,12,52825,52851,12,52881,52907,12,52937,52963,12,52993,53019,12,53049,53075,12,53105,53131,12,53161,53187,12,53217,53243,12,53273,53299,12,53329,53355,12,53385,53411,12,53441,53467,12,53497,53523,12,53553,53579,12,53609,53635,12,53665,53691,12,53721,53747,12,53777,53803,12,53833,53859,12,53889,53915,12,53945,53971,12,54001,54027,12,54057,54083,12,54113,54139,12,54169,54195,12,54225,54251,12,54281,54307,12,54337,54363,12,54393,54419,12,54449,54475,12,54505,54531,12,54561,54587,12,54617,54643,12,54673,54699,12,54729,54755,12,54785,54811,12,54841,54867,12,54897,54923,12,54953,54979,12,55009,55035,12,55065,55091,12,55121,55147,12,55177,55203,12,65024,65039,5,65520,65528,4,66422,66426,5,68152,68154,5,69291,69292,5,69633,69633,5,69747,69748,5,69811,69814,5,69826,69826,5,69932,69932,7,70016,70017,5,70079,70080,7,70095,70095,5,70196,70196,5,70367,70367,5,70402,70403,7,70464,70464,5,70487,70487,5,70709,70711,7,70725,70725,7,70833,70834,7,70843,70844,7,70849,70849,7,71090,71093,5,71103,71104,5,71227,71228,7,71339,71339,5,71344,71349,5,71458,71461,5,71727,71735,5,71985,71989,7,71998,71998,5,72002,72002,7,72154,72155,5,72193,72202,5,72251,72254,5,72281,72283,5,72344,72345,5,72766,72766,7,72874,72880,5,72885,72886,5,73023,73029,5,73104,73105,5,73111,73111,5,92912,92916,5,94095,94098,5,113824,113827,4,119142,119142,7,119155,119162,4,119362,119364,5,121476,121476,5,122888,122904,5,123184,123190,5,125252,125258,5,127183,127183,14,127340,127343,14,127377,127386,14,127491,127503,14,127548,127551,14,127744,127756,14,127761,127761,14,127769,127769,14,127773,127774,14,127780,127788,14,127796,127797,14,127820,127823,14,127869,127869,14,127894,127895,14,127902,127903,14,127943,127943,14,127947,127950,14,127972,127972,14,127988,127988,14,127992,127994,14,128009,128011,14,128019,128019,14,128023,128041,14,128064,128064,14,128102,128107,14,128174,128181,14,128238,128238,14,128246,128247,14,128254,128254,14,128264,128264,14,128278,128299,14,128329,128330,14,128348,128359,14,128371,128377,14,128392,128393,14,128401,128404,14,128421,128421,14,128433,128434,14,128450,128452,14,128476,128478,14,128483,128483,14,128495,128495,14,128506,128506,14,128519,128520,14,128528,128528,14,128534,128534,14,128538,128538,14,128540,128542,14,128544,128549,14,128552,128555,14,128557,128557,14,128560,128563,14,128565,128565,14,128567,128576,14,128581,128591,14,128641,128642,14,128646,128646,14,128648,128648,14,128650,128651,14,128653,128653,14,128655,128655,14,128657,128659,14,128661,128661,14,128663,128663,14,128665,128666,14,128674,128674,14,128676,128677,14,128679,128685,14,128690,128690,14,128694,128694,14,128697,128702,14,128704,128704,14,128710,128714,14,128716,128716,14,128720,128720,14,128723,128724,14,128726,128727,14,128733,128735,14,128742,128744,14,128746,128746,14,128749,128751,14,128753,128754,14,128756,128758,14,128761,128761,14,128763,128764,14,128884,128895,14,128992,129003,14,129008,129008,14,129036,129039,14,129114,129119,14,129198,129279,14,129293,129295,14,129305,129310,14,129312,129319,14,129328,129328,14,129331,129338,14,129343,129343,14,129351,129355,14,129357,129359,14,129375,129387,14,129393,129393,14,129395,129398,14,129401,129401,14,129403,129403,14,129408,129412,14,129426,129431,14,129443,129444,14,129451,129453,14,129456,129465,14,129472,129472,14,129475,129482,14,129484,129484,14,129488,129510,14,129536,129647,14,129652,129652,14,129656,129658,14,129661,129663,14,129667,129670,14,129680,129685,14,129705,129708,14,129712,129718,14,129723,129727,14,129731,129733,14,129744,129750,14,129754,129759,14,129768,129775,14,129783,129791,14,917504,917504,4,917506,917535,4,917632,917759,4,918000,921599,4,0,9,4,11,12,4,14,31,4,169,169,14,174,174,14,1155,1159,5,1425,1469,5,1473,1474,5,1479,1479,5,1552,1562,5,1611,1631,5,1750,1756,5,1759,1764,5,1770,1773,5,1809,1809,5,1958,1968,5,2045,2045,5,2075,2083,5,2089,2093,5,2192,2193,1,2250,2273,5,2275,2306,5,2362,2362,5,2364,2364,5,2369,2376,5,2381,2381,5,2385,2391,5,2433,2433,5,2492,2492,5,2495,2496,7,2503,2504,7,2509,2509,5,2530,2531,5,2561,2562,5,2620,2620,5,2625,2626,5,2635,2637,5,2672,2673,5,2689,2690,5,2748,2748,5,2753,2757,5,2761,2761,7,2765,2765,5,2810,2815,5,2818,2819,7,2878,2878,5,2880,2880,7,2887,2888,7,2893,2893,5,2903,2903,5,2946,2946,5,3007,3007,7,3009,3010,7,3018,3020,7,3031,3031,5,3073,3075,7,3132,3132,5,3137,3140,7,3146,3149,5,3170,3171,5,3202,3203,7,3262,3262,7,3264,3265,7,3267,3268,7,3271,3272,7,3276,3277,5,3298,3299,5,3330,3331,7,3390,3390,5,3393,3396,5,3402,3404,7,3406,3406,1,3426,3427,5,3458,3459,7,3535,3535,5,3538,3540,5,3544,3550,7,3570,3571,7,3635,3635,7,3655,3662,5,3763,3763,7,3784,3789,5,3893,3893,5,3897,3897,5,3953,3966,5,3968,3972,5,3981,3991,5,4038,4038,5,4145,4145,7,4153,4154,5,4157,4158,5,4184,4185,5,4209,4212,5,4228,4228,7,4237,4237,5,4352,4447,8,4520,4607,10,5906,5908,5,5938,5939,5,5970,5971,5,6068,6069,5,6071,6077,5,6086,6086,5,6089,6099,5,6155,6157,5,6159,6159,5,6313,6313,5,6435,6438,7,6441,6443,7,6450,6450,5,6457,6459,5,6681,6682,7,6741,6741,7,6743,6743,7,6752,6752,5,6757,6764,5,6771,6780,5,6832,6845,5,6847,6862,5,6916,6916,7,6965,6965,5,6971,6971,7,6973,6977,7,6979,6980,7,7040,7041,5,7073,7073,7,7078,7079,7,7082,7082,7,7142,7142,5,7144,7145,5,7149,7149,5,7151,7153,5,7204,7211,7,7220,7221,7,7376,7378,5,7393,7393,7,7405,7405,5,7415,7415,7,7616,7679,5,8204,8204,5,8206,8207,4,8233,8233,4,8252,8252,14,8288,8292,4,8294,8303,4,8413,8416,5,8418,8420,5,8482,8482,14,8596,8601,14,8986,8987,14,9096,9096,14,9193,9196,14,9199,9199,14,9201,9202,14,9208,9210,14,9642,9643,14,9664,9664,14,9728,9729,14,9732,9732,14,9735,9741,14,9743,9744,14,9746,9746,14,9750,9751,14,9753,9756,14,9758,9759,14,9761,9761,14,9764,9765,14,9767,9769,14,9771,9773,14,9775,9775,14,9784,9785,14,9787,9791,14,9793,9793,14,9795,9799,14,9812,9822,14,9824,9824,14,9827,9827,14,9829,9830,14,9832,9832,14,9851,9851,14,9854,9854,14,9856,9861,14,9874,9874,14,9876,9876,14,9878,9879,14,9881,9881,14,9883,9884,14,9888,9889,14,9895,9895,14,9898,9899,14,9904,9905,14,9917,9918,14,9924,9925,14,9928,9928,14,9934,9934,14,9936,9936,14,9938,9938,14,9940,9940,14,9961,9961,14,9963,9967,14,9970,9971,14,9973,9973,14,9975,9977,14,9979,9980,14,9982,9985,14,9987,9988,14,9992,9996,14,9998,9998,14,10000,10001,14,10004,10004,14,10013,10013,14,10024,10024,14,10052,10052,14,10060,10060,14,10067,10069,14,10083,10083,14,10085,10087,14,10145,10145,14,10175,10175,14,11013,11015,14,11088,11088,14,11503,11505,5,11744,11775,5,12334,12335,5,12349,12349,14,12951,12951,14,42607,42607,5,42612,42621,5,42736,42737,5,43014,43014,5,43043,43044,7,43047,43047,7,43136,43137,7,43204,43205,5,43263,43263,5,43335,43345,5,43360,43388,8,43395,43395,7,43444,43445,7,43450,43451,7,43454,43456,7,43561,43566,5,43569,43570,5,43573,43574,5,43596,43596,5,43644,43644,5,43698,43700,5,43710,43711,5,43755,43755,7,43758,43759,7,43766,43766,5,44005,44005,5,44008,44008,5,44012,44012,7,44032,44032,11,44060,44060,11,44088,44088,11,44116,44116,11,44144,44144,11,44172,44172,11,44200,44200,11,44228,44228,11,44256,44256,11,44284,44284,11,44312,44312,11,44340,44340,11,44368,44368,11,44396,44396,11,44424,44424,11,44452,44452,11,44480,44480,11,44508,44508,11,44536,44536,11,44564,44564,11,44592,44592,11,44620,44620,11,44648,44648,11,44676,44676,11,44704,44704,11,44732,44732,11,44760,44760,11,44788,44788,11,44816,44816,11,44844,44844,11,44872,44872,11,44900,44900,11,44928,44928,11,44956,44956,11,44984,44984,11,45012,45012,11,45040,45040,11,45068,45068,11,45096,45096,11,45124,45124,11,45152,45152,11,45180,45180,11,45208,45208,11,45236,45236,11,45264,45264,11,45292,45292,11,45320,45320,11,45348,45348,11,45376,45376,11,45404,45404,11,45432,45432,11,45460,45460,11,45488,45488,11,45516,45516,11,45544,45544,11,45572,45572,11,45600,45600,11,45628,45628,11,45656,45656,11,45684,45684,11,45712,45712,11,45740,45740,11,45768,45768,11,45796,45796,11,45824,45824,11,45852,45852,11,45880,45880,11,45908,45908,11,45936,45936,11,45964,45964,11,45992,45992,11,46020,46020,11,46048,46048,11,46076,46076,11,46104,46104,11,46132,46132,11,46160,46160,11,46188,46188,11,46216,46216,11,46244,46244,11,46272,46272,11,46300,46300,11,46328,46328,11,46356,46356,11,46384,46384,11,46412,46412,11,46440,46440,11,46468,46468,11,46496,46496,11,46524,46524,11,46552,46552,11,46580,46580,11,46608,46608,11,46636,46636,11,46664,46664,11,46692,46692,11,46720,46720,11,46748,46748,11,46776,46776,11,46804,46804,11,46832,46832,11,46860,46860,11,46888,46888,11,46916,46916,11,46944,46944,11,46972,46972,11,47000,47000,11,47028,47028,11,47056,47056,11,47084,47084,11,47112,47112,11,47140,47140,11,47168,47168,11,47196,47196,11,47224,47224,11,47252,47252,11,47280,47280,11,47308,47308,11,47336,47336,11,47364,47364,11,47392,47392,11,47420,47420,11,47448,47448,11,47476,47476,11,47504,47504,11,47532,47532,11,47560,47560,11,47588,47588,11,47616,47616,11,47644,47644,11,47672,47672,11,47700,47700,11,47728,47728,11,47756,47756,11,47784,47784,11,47812,47812,11,47840,47840,11,47868,47868,11,47896,47896,11,47924,47924,11,47952,47952,11,47980,47980,11,48008,48008,11,48036,48036,11,48064,48064,11,48092,48092,11,48120,48120,11,48148,48148,11,48176,48176,11,48204,48204,11,48232,48232,11,48260,48260,11,48288,48288,11,48316,48316,11,48344,48344,11,48372,48372,11,48400,48400,11,48428,48428,11,48456,48456,11,48484,48484,11,48512,48512,11,48540,48540,11,48568,48568,11,48596,48596,11,48624,48624,11,48652,48652,11,48680,48680,11,48708,48708,11,48736,48736,11,48764,48764,11,48792,48792,11,48820,48820,11,48848,48848,11,48876,48876,11,48904,48904,11,48932,48932,11,48960,48960,11,48988,48988,11,49016,49016,11,49044,49044,11,49072,49072,11,49100,49100,11,49128,49128,11,49156,49156,11,49184,49184,11,49212,49212,11,49240,49240,11,49268,49268,11,49296,49296,11,49324,49324,11,49352,49352,11,49380,49380,11,49408,49408,11,49436,49436,11,49464,49464,11,49492,49492,11,49520,49520,11,49548,49548,11,49576,49576,11,49604,49604,11,49632,49632,11,49660,49660,11,49688,49688,11,49716,49716,11,49744,49744,11,49772,49772,11,49800,49800,11,49828,49828,11,49856,49856,11,49884,49884,11,49912,49912,11,49940,49940,11,49968,49968,11,49996,49996,11,50024,50024,11,50052,50052,11,50080,50080,11,50108,50108,11,50136,50136,11,50164,50164,11,50192,50192,11,50220,50220,11,50248,50248,11,50276,50276,11,50304,50304,11,50332,50332,11,50360,50360,11,50388,50388,11,50416,50416,11,50444,50444,11,50472,50472,11,50500,50500,11,50528,50528,11,50556,50556,11,50584,50584,11,50612,50612,11,50640,50640,11,50668,50668,11,50696,50696,11,50724,50724,11,50752,50752,11,50780,50780,11,50808,50808,11,50836,50836,11,50864,50864,11,50892,50892,11,50920,50920,11,50948,50948,11,50976,50976,11,51004,51004,11,51032,51032,11,51060,51060,11,51088,51088,11,51116,51116,11,51144,51144,11,51172,51172,11,51200,51200,11,51228,51228,11,51256,51256,11,51284,51284,11,51312,51312,11,51340,51340,11,51368,51368,11,51396,51396,11,51424,51424,11,51452,51452,11,51480,51480,11,51508,51508,11,51536,51536,11,51564,51564,11,51592,51592,11,51620,51620,11,51648,51648,11,51676,51676,11,51704,51704,11,51732,51732,11,51760,51760,11,51788,51788,11,51816,51816,11,51844,51844,11,51872,51872,11,51900,51900,11,51928,51928,11,51956,51956,11,51984,51984,11,52012,52012,11,52040,52040,11,52068,52068,11,52096,52096,11,52124,52124,11,52152,52152,11,52180,52180,11,52208,52208,11,52236,52236,11,52264,52264,11,52292,52292,11,52320,52320,11,52348,52348,11,52376,52376,11,52404,52404,11,52432,52432,11,52460,52460,11,52488,52488,11,52516,52516,11,52544,52544,11,52572,52572,11,52600,52600,11,52628,52628,11,52656,52656,11,52684,52684,11,52712,52712,11,52740,52740,11,52768,52768,11,52796,52796,11,52824,52824,11,52852,52852,11,52880,52880,11,52908,52908,11,52936,52936,11,52964,52964,11,52992,52992,11,53020,53020,11,53048,53048,11,53076,53076,11,53104,53104,11,53132,53132,11,53160,53160,11,53188,53188,11,53216,53216,11,53244,53244,11,53272,53272,11,53300,53300,11,53328,53328,11,53356,53356,11,53384,53384,11,53412,53412,11,53440,53440,11,53468,53468,11,53496,53496,11,53524,53524,11,53552,53552,11,53580,53580,11,53608,53608,11,53636,53636,11,53664,53664,11,53692,53692,11,53720,53720,11,53748,53748,11,53776,53776,11,53804,53804,11,53832,53832,11,53860,53860,11,53888,53888,11,53916,53916,11,53944,53944,11,53972,53972,11,54000,54000,11,54028,54028,11,54056,54056,11,54084,54084,11,54112,54112,11,54140,54140,11,54168,54168,11,54196,54196,11,54224,54224,11,54252,54252,11,54280,54280,11,54308,54308,11,54336,54336,11,54364,54364,11,54392,54392,11,54420,54420,11,54448,54448,11,54476,54476,11,54504,54504,11,54532,54532,11,54560,54560,11,54588,54588,11,54616,54616,11,54644,54644,11,54672,54672,11,54700,54700,11,54728,54728,11,54756,54756,11,54784,54784,11,54812,54812,11,54840,54840,11,54868,54868,11,54896,54896,11,54924,54924,11,54952,54952,11,54980,54980,11,55008,55008,11,55036,55036,11,55064,55064,11,55092,55092,11,55120,55120,11,55148,55148,11,55176,55176,11,55216,55238,9,64286,64286,5,65056,65071,5,65438,65439,5,65529,65531,4,66272,66272,5,68097,68099,5,68108,68111,5,68159,68159,5,68900,68903,5,69446,69456,5,69632,69632,7,69634,69634,7,69744,69744,5,69759,69761,5,69808,69810,7,69815,69816,7,69821,69821,1,69837,69837,1,69927,69931,5,69933,69940,5,70003,70003,5,70018,70018,7,70070,70078,5,70082,70083,1,70094,70094,7,70188,70190,7,70194,70195,7,70197,70197,7,70206,70206,5,70368,70370,7,70400,70401,5,70459,70460,5,70463,70463,7,70465,70468,7,70475,70477,7,70498,70499,7,70512,70516,5,70712,70719,5,70722,70724,5,70726,70726,5,70832,70832,5,70835,70840,5,70842,70842,5,70845,70845,5,70847,70848,5,70850,70851,5,71088,71089,7,71096,71099,7,71102,71102,7,71132,71133,5,71219,71226,5,71229,71229,5,71231,71232,5,71340,71340,7,71342,71343,7,71350,71350,7,71453,71455,5,71462,71462,7,71724,71726,7,71736,71736,7,71984,71984,5,71991,71992,7,71997,71997,7,71999,71999,1,72001,72001,1,72003,72003,5,72148,72151,5,72156,72159,7,72164,72164,7,72243,72248,5,72250,72250,1,72263,72263,5,72279,72280,7,72324,72329,1,72343,72343,7,72751,72751,7,72760,72765,5,72767,72767,5,72873,72873,7,72881,72881,7,72884,72884,7,73009,73014,5,73020,73021,5,73030,73030,1,73098,73102,7,73107,73108,7,73110,73110,7,73459,73460,5,78896,78904,4,92976,92982,5,94033,94087,7,94180,94180,5,113821,113822,5,118528,118573,5,119141,119141,5,119143,119145,5,119150,119154,5,119163,119170,5,119210,119213,5,121344,121398,5,121461,121461,5,121499,121503,5,122880,122886,5,122907,122913,5,122918,122922,5,123566,123566,5,125136,125142,5,126976,126979,14,126981,127182,14,127184,127231,14,127279,127279,14,127344,127345,14,127374,127374,14,127405,127461,14,127489,127490,14,127514,127514,14,127538,127546,14,127561,127567,14,127570,127743,14,127757,127758,14,127760,127760,14,127762,127762,14,127766,127768,14,127770,127770,14,127772,127772,14,127775,127776,14,127778,127779,14,127789,127791,14,127794,127795,14,127798,127798,14,127819,127819,14,127824,127824,14,127868,127868,14,127870,127871,14,127892,127893,14,127896,127896,14,127900,127901,14,127904,127940,14,127942,127942,14,127944,127944,14,127946,127946,14,127951,127955,14,127968,127971,14,127973,127984,14,127987,127987,14,127989,127989,14,127991,127991,14,127995,127999,5,128008,128008,14,128012,128014,14,128017,128018,14,128020,128020,14,128022,128022,14,128042,128042,14,128063,128063,14,128065,128065,14,128101,128101,14,128108,128109,14,128173,128173,14,128182,128183,14,128236,128237,14,128239,128239,14,128245,128245,14,128248,128248,14,128253,128253,14,128255,128258,14,128260,128263,14,128265,128265,14,128277,128277,14,128300,128301,14,128326,128328,14,128331,128334,14,128336,128347,14,128360,128366,14,128369,128370,14,128378,128378,14,128391,128391,14,128394,128397,14,128400,128400,14,128405,128406,14,128420,128420,14,128422,128423,14,128425,128432,14,128435,128443,14,128445,128449,14,128453,128464,14,128468,128475,14,128479,128480,14,128482,128482,14,128484,128487,14,128489,128494,14,128496,128498,14,128500,128505,14,128507,128511,14,128513,128518,14,128521,128525,14,128527,128527,14,128529,128529,14,128533,128533,14,128535,128535,14,128537,128537,14]")}function Pie(o,e){if(o===0)return 0;const t=Aie(o,e);if(t!==void 0)return t;const i=new CR(e,o);return i.prevCodePoint(),i.offset}function Aie(o,e){const t=new CR(e,o);let i=t.prevCodePoint();for(;Oie(i)||i===65039||i===8419;){if(t.offset===0)return;i=t.prevCodePoint()}if(!SR(i))return;let n=t.offset;return n>0&&t.prevCodePoint()===8205&&(n=t.offset),n}function Oie(o){return 127995<=o&&o<=127999}const r6=" ",rc=class rc{static getInstance(e){return rc.cache.get(Array.from(e))}static getLocales(){return rc._locales.value}constructor(e){this.confusableDictionary=e}isAmbiguous(e){return this.confusableDictionary.has(e)}getPrimaryConfusable(e){return this.confusableDictionary.get(e)}getConfusableCodePoints(){return new Set(this.confusableDictionary.keys())}};rc.ambiguousCharacterData=new Ln(()=>JSON.parse('{"_common":[8232,32,8233,32,5760,32,8192,32,8193,32,8194,32,8195,32,8196,32,8197,32,8198,32,8200,32,8201,32,8202,32,8287,32,8199,32,8239,32,2042,95,65101,95,65102,95,65103,95,8208,45,8209,45,8210,45,65112,45,1748,45,8259,45,727,45,8722,45,10134,45,11450,45,1549,44,1643,44,184,44,42233,44,894,59,2307,58,2691,58,1417,58,1795,58,1796,58,5868,58,65072,58,6147,58,6153,58,8282,58,1475,58,760,58,42889,58,8758,58,720,58,42237,58,451,33,11601,33,660,63,577,63,2429,63,5038,63,42731,63,119149,46,8228,46,1793,46,1794,46,42510,46,68176,46,1632,46,1776,46,42232,46,1373,96,65287,96,8219,96,1523,96,8242,96,1370,96,8175,96,65344,96,900,96,8189,96,8125,96,8127,96,8190,96,697,96,884,96,712,96,714,96,715,96,756,96,699,96,701,96,700,96,702,96,42892,96,1497,96,2036,96,2037,96,5194,96,5836,96,94033,96,94034,96,65339,91,10088,40,10098,40,12308,40,64830,40,65341,93,10089,41,10099,41,12309,41,64831,41,10100,123,119060,123,10101,125,65342,94,8270,42,1645,42,8727,42,66335,42,5941,47,8257,47,8725,47,8260,47,9585,47,10187,47,10744,47,119354,47,12755,47,12339,47,11462,47,20031,47,12035,47,65340,92,65128,92,8726,92,10189,92,10741,92,10745,92,119311,92,119355,92,12756,92,20022,92,12034,92,42872,38,708,94,710,94,5869,43,10133,43,66203,43,8249,60,10094,60,706,60,119350,60,5176,60,5810,60,5120,61,11840,61,12448,61,42239,61,8250,62,10095,62,707,62,119351,62,5171,62,94015,62,8275,126,732,126,8128,126,8764,126,65372,124,65293,45,118002,50,120784,50,120794,50,120804,50,120814,50,120824,50,130034,50,42842,50,423,50,1000,50,42564,50,5311,50,42735,50,119302,51,118003,51,120785,51,120795,51,120805,51,120815,51,120825,51,130035,51,42923,51,540,51,439,51,42858,51,11468,51,1248,51,94011,51,71882,51,118004,52,120786,52,120796,52,120806,52,120816,52,120826,52,130036,52,5070,52,71855,52,118005,53,120787,53,120797,53,120807,53,120817,53,120827,53,130037,53,444,53,71867,53,118006,54,120788,54,120798,54,120808,54,120818,54,120828,54,130038,54,11474,54,5102,54,71893,54,119314,55,118007,55,120789,55,120799,55,120809,55,120819,55,120829,55,130039,55,66770,55,71878,55,2819,56,2538,56,2666,56,125131,56,118008,56,120790,56,120800,56,120810,56,120820,56,120830,56,130040,56,547,56,546,56,66330,56,2663,57,2920,57,2541,57,3437,57,118009,57,120791,57,120801,57,120811,57,120821,57,120831,57,130041,57,42862,57,11466,57,71884,57,71852,57,71894,57,9082,97,65345,97,119834,97,119886,97,119938,97,119990,97,120042,97,120094,97,120146,97,120198,97,120250,97,120302,97,120354,97,120406,97,120458,97,593,97,945,97,120514,97,120572,97,120630,97,120688,97,120746,97,65313,65,117974,65,119808,65,119860,65,119912,65,119964,65,120016,65,120068,65,120120,65,120172,65,120224,65,120276,65,120328,65,120380,65,120432,65,913,65,120488,65,120546,65,120604,65,120662,65,120720,65,5034,65,5573,65,42222,65,94016,65,66208,65,119835,98,119887,98,119939,98,119991,98,120043,98,120095,98,120147,98,120199,98,120251,98,120303,98,120355,98,120407,98,120459,98,388,98,5071,98,5234,98,5551,98,65314,66,8492,66,117975,66,119809,66,119861,66,119913,66,120017,66,120069,66,120121,66,120173,66,120225,66,120277,66,120329,66,120381,66,120433,66,42932,66,914,66,120489,66,120547,66,120605,66,120663,66,120721,66,5108,66,5623,66,42192,66,66178,66,66209,66,66305,66,65347,99,8573,99,119836,99,119888,99,119940,99,119992,99,120044,99,120096,99,120148,99,120200,99,120252,99,120304,99,120356,99,120408,99,120460,99,7428,99,1010,99,11429,99,43951,99,66621,99,128844,67,71913,67,71922,67,65315,67,8557,67,8450,67,8493,67,117976,67,119810,67,119862,67,119914,67,119966,67,120018,67,120174,67,120226,67,120278,67,120330,67,120382,67,120434,67,1017,67,11428,67,5087,67,42202,67,66210,67,66306,67,66581,67,66844,67,8574,100,8518,100,119837,100,119889,100,119941,100,119993,100,120045,100,120097,100,120149,100,120201,100,120253,100,120305,100,120357,100,120409,100,120461,100,1281,100,5095,100,5231,100,42194,100,8558,68,8517,68,117977,68,119811,68,119863,68,119915,68,119967,68,120019,68,120071,68,120123,68,120175,68,120227,68,120279,68,120331,68,120383,68,120435,68,5024,68,5598,68,5610,68,42195,68,8494,101,65349,101,8495,101,8519,101,119838,101,119890,101,119942,101,120046,101,120098,101,120150,101,120202,101,120254,101,120306,101,120358,101,120410,101,120462,101,43826,101,1213,101,8959,69,65317,69,8496,69,117978,69,119812,69,119864,69,119916,69,120020,69,120072,69,120124,69,120176,69,120228,69,120280,69,120332,69,120384,69,120436,69,917,69,120492,69,120550,69,120608,69,120666,69,120724,69,11577,69,5036,69,42224,69,71846,69,71854,69,66182,69,119839,102,119891,102,119943,102,119995,102,120047,102,120099,102,120151,102,120203,102,120255,102,120307,102,120359,102,120411,102,120463,102,43829,102,42905,102,383,102,7837,102,1412,102,119315,70,8497,70,117979,70,119813,70,119865,70,119917,70,120021,70,120073,70,120125,70,120177,70,120229,70,120281,70,120333,70,120385,70,120437,70,42904,70,988,70,120778,70,5556,70,42205,70,71874,70,71842,70,66183,70,66213,70,66853,70,65351,103,8458,103,119840,103,119892,103,119944,103,120048,103,120100,103,120152,103,120204,103,120256,103,120308,103,120360,103,120412,103,120464,103,609,103,7555,103,397,103,1409,103,117980,71,119814,71,119866,71,119918,71,119970,71,120022,71,120074,71,120126,71,120178,71,120230,71,120282,71,120334,71,120386,71,120438,71,1292,71,5056,71,5107,71,42198,71,65352,104,8462,104,119841,104,119945,104,119997,104,120049,104,120101,104,120153,104,120205,104,120257,104,120309,104,120361,104,120413,104,120465,104,1211,104,1392,104,5058,104,65320,72,8459,72,8460,72,8461,72,117981,72,119815,72,119867,72,119919,72,120023,72,120179,72,120231,72,120283,72,120335,72,120387,72,120439,72,919,72,120494,72,120552,72,120610,72,120668,72,120726,72,11406,72,5051,72,5500,72,42215,72,66255,72,731,105,9075,105,65353,105,8560,105,8505,105,8520,105,119842,105,119894,105,119946,105,119998,105,120050,105,120102,105,120154,105,120206,105,120258,105,120310,105,120362,105,120414,105,120466,105,120484,105,618,105,617,105,953,105,8126,105,890,105,120522,105,120580,105,120638,105,120696,105,120754,105,1110,105,42567,105,1231,105,43893,105,5029,105,71875,105,65354,106,8521,106,119843,106,119895,106,119947,106,119999,106,120051,106,120103,106,120155,106,120207,106,120259,106,120311,106,120363,106,120415,106,120467,106,1011,106,1112,106,65322,74,117983,74,119817,74,119869,74,119921,74,119973,74,120025,74,120077,74,120129,74,120181,74,120233,74,120285,74,120337,74,120389,74,120441,74,42930,74,895,74,1032,74,5035,74,5261,74,42201,74,119844,107,119896,107,119948,107,120000,107,120052,107,120104,107,120156,107,120208,107,120260,107,120312,107,120364,107,120416,107,120468,107,8490,75,65323,75,117984,75,119818,75,119870,75,119922,75,119974,75,120026,75,120078,75,120130,75,120182,75,120234,75,120286,75,120338,75,120390,75,120442,75,922,75,120497,75,120555,75,120613,75,120671,75,120729,75,11412,75,5094,75,5845,75,42199,75,66840,75,1472,108,8739,73,9213,73,65512,73,1633,108,1777,73,66336,108,125127,108,118001,108,120783,73,120793,73,120803,73,120813,73,120823,73,130033,73,65321,73,8544,73,8464,73,8465,73,117982,108,119816,73,119868,73,119920,73,120024,73,120128,73,120180,73,120232,73,120284,73,120336,73,120388,73,120440,73,65356,108,8572,73,8467,108,119845,108,119897,108,119949,108,120001,108,120053,108,120105,73,120157,73,120209,73,120261,73,120313,73,120365,73,120417,73,120469,73,448,73,120496,73,120554,73,120612,73,120670,73,120728,73,11410,73,1030,73,1216,73,1493,108,1503,108,1575,108,126464,108,126592,108,65166,108,65165,108,1994,108,11599,73,5825,73,42226,73,93992,73,66186,124,66313,124,119338,76,8556,76,8466,76,117985,76,119819,76,119871,76,119923,76,120027,76,120079,76,120131,76,120183,76,120235,76,120287,76,120339,76,120391,76,120443,76,11472,76,5086,76,5290,76,42209,76,93974,76,71843,76,71858,76,66587,76,66854,76,65325,77,8559,77,8499,77,117986,77,119820,77,119872,77,119924,77,120028,77,120080,77,120132,77,120184,77,120236,77,120288,77,120340,77,120392,77,120444,77,924,77,120499,77,120557,77,120615,77,120673,77,120731,77,1018,77,11416,77,5047,77,5616,77,5846,77,42207,77,66224,77,66321,77,119847,110,119899,110,119951,110,120003,110,120055,110,120107,110,120159,110,120211,110,120263,110,120315,110,120367,110,120419,110,120471,110,1400,110,1404,110,65326,78,8469,78,117987,78,119821,78,119873,78,119925,78,119977,78,120029,78,120081,78,120185,78,120237,78,120289,78,120341,78,120393,78,120445,78,925,78,120500,78,120558,78,120616,78,120674,78,120732,78,11418,78,42208,78,66835,78,3074,111,3202,111,3330,111,3458,111,2406,111,2662,111,2790,111,3046,111,3174,111,3302,111,3430,111,3664,111,3792,111,4160,111,1637,111,1781,111,65359,111,8500,111,119848,111,119900,111,119952,111,120056,111,120108,111,120160,111,120212,111,120264,111,120316,111,120368,111,120420,111,120472,111,7439,111,7441,111,43837,111,959,111,120528,111,120586,111,120644,111,120702,111,120760,111,963,111,120532,111,120590,111,120648,111,120706,111,120764,111,11423,111,4351,111,1413,111,1505,111,1607,111,126500,111,126564,111,126596,111,65259,111,65260,111,65258,111,65257,111,1726,111,64428,111,64429,111,64427,111,64426,111,1729,111,64424,111,64425,111,64423,111,64422,111,1749,111,3360,111,4125,111,66794,111,71880,111,71895,111,66604,111,1984,79,2534,79,2918,79,12295,79,70864,79,71904,79,118000,79,120782,79,120792,79,120802,79,120812,79,120822,79,130032,79,65327,79,117988,79,119822,79,119874,79,119926,79,119978,79,120030,79,120082,79,120134,79,120186,79,120238,79,120290,79,120342,79,120394,79,120446,79,927,79,120502,79,120560,79,120618,79,120676,79,120734,79,11422,79,1365,79,11604,79,4816,79,2848,79,66754,79,42227,79,71861,79,66194,79,66219,79,66564,79,66838,79,9076,112,65360,112,119849,112,119901,112,119953,112,120005,112,120057,112,120109,112,120161,112,120213,112,120265,112,120317,112,120369,112,120421,112,120473,112,961,112,120530,112,120544,112,120588,112,120602,112,120646,112,120660,112,120704,112,120718,112,120762,112,120776,112,11427,112,65328,80,8473,80,117989,80,119823,80,119875,80,119927,80,119979,80,120031,80,120083,80,120187,80,120239,80,120291,80,120343,80,120395,80,120447,80,929,80,120504,80,120562,80,120620,80,120678,80,120736,80,11426,80,5090,80,5229,80,42193,80,66197,80,119850,113,119902,113,119954,113,120006,113,120058,113,120110,113,120162,113,120214,113,120266,113,120318,113,120370,113,120422,113,120474,113,1307,113,1379,113,1382,113,8474,81,117990,81,119824,81,119876,81,119928,81,119980,81,120032,81,120084,81,120188,81,120240,81,120292,81,120344,81,120396,81,120448,81,11605,81,119851,114,119903,114,119955,114,120007,114,120059,114,120111,114,120163,114,120215,114,120267,114,120319,114,120371,114,120423,114,120475,114,43847,114,43848,114,7462,114,11397,114,43905,114,119318,82,8475,82,8476,82,8477,82,117991,82,119825,82,119877,82,119929,82,120033,82,120189,82,120241,82,120293,82,120345,82,120397,82,120449,82,422,82,5025,82,5074,82,66740,82,5511,82,42211,82,94005,82,65363,115,119852,115,119904,115,119956,115,120008,115,120060,115,120112,115,120164,115,120216,115,120268,115,120320,115,120372,115,120424,115,120476,115,42801,115,445,115,1109,115,43946,115,71873,115,66632,115,65331,83,117992,83,119826,83,119878,83,119930,83,119982,83,120034,83,120086,83,120138,83,120190,83,120242,83,120294,83,120346,83,120398,83,120450,83,1029,83,1359,83,5077,83,5082,83,42210,83,94010,83,66198,83,66592,83,119853,116,119905,116,119957,116,120009,116,120061,116,120113,116,120165,116,120217,116,120269,116,120321,116,120373,116,120425,116,120477,116,8868,84,10201,84,128872,84,65332,84,117993,84,119827,84,119879,84,119931,84,119983,84,120035,84,120087,84,120139,84,120191,84,120243,84,120295,84,120347,84,120399,84,120451,84,932,84,120507,84,120565,84,120623,84,120681,84,120739,84,11430,84,5026,84,42196,84,93962,84,71868,84,66199,84,66225,84,66325,84,119854,117,119906,117,119958,117,120010,117,120062,117,120114,117,120166,117,120218,117,120270,117,120322,117,120374,117,120426,117,120478,117,42911,117,7452,117,43854,117,43858,117,651,117,965,117,120534,117,120592,117,120650,117,120708,117,120766,117,1405,117,66806,117,71896,117,8746,85,8899,85,117994,85,119828,85,119880,85,119932,85,119984,85,120036,85,120088,85,120140,85,120192,85,120244,85,120296,85,120348,85,120400,85,120452,85,1357,85,4608,85,66766,85,5196,85,42228,85,94018,85,71864,85,8744,118,8897,118,65366,118,8564,118,119855,118,119907,118,119959,118,120011,118,120063,118,120115,118,120167,118,120219,118,120271,118,120323,118,120375,118,120427,118,120479,118,7456,118,957,118,120526,118,120584,118,120642,118,120700,118,120758,118,1141,118,1496,118,71430,118,43945,118,71872,118,119309,86,1639,86,1783,86,8548,86,117995,86,119829,86,119881,86,119933,86,119985,86,120037,86,120089,86,120141,86,120193,86,120245,86,120297,86,120349,86,120401,86,120453,86,1140,86,11576,86,5081,86,5167,86,42719,86,42214,86,93960,86,71840,86,66845,86,623,119,119856,119,119908,119,119960,119,120012,119,120064,119,120116,119,120168,119,120220,119,120272,119,120324,119,120376,119,120428,119,120480,119,7457,119,1121,119,1309,119,1377,119,71434,119,71438,119,71439,119,43907,119,71910,87,71919,87,117996,87,119830,87,119882,87,119934,87,119986,87,120038,87,120090,87,120142,87,120194,87,120246,87,120298,87,120350,87,120402,87,120454,87,1308,87,5043,87,5076,87,42218,87,5742,120,10539,120,10540,120,10799,120,65368,120,8569,120,119857,120,119909,120,119961,120,120013,120,120065,120,120117,120,120169,120,120221,120,120273,120,120325,120,120377,120,120429,120,120481,120,5441,120,5501,120,5741,88,9587,88,66338,88,71916,88,65336,88,8553,88,117997,88,119831,88,119883,88,119935,88,119987,88,120039,88,120091,88,120143,88,120195,88,120247,88,120299,88,120351,88,120403,88,120455,88,42931,88,935,88,120510,88,120568,88,120626,88,120684,88,120742,88,11436,88,11613,88,5815,88,42219,88,66192,88,66228,88,66327,88,66855,88,611,121,7564,121,65369,121,119858,121,119910,121,119962,121,120014,121,120066,121,120118,121,120170,121,120222,121,120274,121,120326,121,120378,121,120430,121,120482,121,655,121,7935,121,43866,121,947,121,8509,121,120516,121,120574,121,120632,121,120690,121,120748,121,1199,121,4327,121,71900,121,65337,89,117998,89,119832,89,119884,89,119936,89,119988,89,120040,89,120092,89,120144,89,120196,89,120248,89,120300,89,120352,89,120404,89,120456,89,933,89,978,89,120508,89,120566,89,120624,89,120682,89,120740,89,11432,89,1198,89,5033,89,5053,89,42220,89,94019,89,71844,89,66226,89,119859,122,119911,122,119963,122,120015,122,120067,122,120119,122,120171,122,120223,122,120275,122,120327,122,120379,122,120431,122,120483,122,7458,122,43923,122,71876,122,71909,90,66293,90,65338,90,8484,90,8488,90,117999,90,119833,90,119885,90,119937,90,119989,90,120041,90,120197,90,120249,90,120301,90,120353,90,120405,90,120457,90,918,90,120493,90,120551,90,120609,90,120667,90,120725,90,5059,90,42204,90,71849,90,65282,34,65283,35,65284,36,65285,37,65286,38,65290,42,65291,43,65294,46,65295,47,65296,48,65298,50,65299,51,65300,52,65301,53,65302,54,65303,55,65304,56,65305,57,65308,60,65309,61,65310,62,65312,64,65316,68,65318,70,65319,71,65324,76,65329,81,65330,82,65333,85,65334,86,65335,87,65343,95,65346,98,65348,100,65350,102,65355,107,65357,109,65358,110,65361,113,65362,114,65364,116,65365,117,65367,119,65370,122,65371,123,65373,125,119846,109],"_default":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8217,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"cs":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"de":[65374,126,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"es":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"fr":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"it":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ja":[8211,45,8218,44,65281,33,8216,96,8245,96,180,96,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65292,44,65297,49,65307,59],"ko":[8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pl":[65374,126,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"pt-BR":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"qps-ploc":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"ru":[65374,126,8218,44,65306,58,65281,33,8216,96,8245,96,180,96,12494,47,305,105,921,73,1009,112,215,120,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"tr":[160,32,8211,45,65374,126,8218,44,65306,58,65281,33,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65288,40,65289,41,65292,44,65297,49,65307,59,65311,63],"zh-hans":[160,32,65374,126,8218,44,8245,96,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89,65297,49],"zh-hant":[8211,45,65374,126,8218,44,180,96,12494,47,1047,51,1073,54,1072,97,1040,65,1068,98,1042,66,1089,99,1057,67,1077,101,1045,69,1053,72,305,105,1050,75,921,73,1052,77,1086,111,1054,79,1009,112,1088,112,1056,80,1075,114,1058,84,215,120,1093,120,1061,88,1091,121,1059,89]}')),rc.cache=new Sie({getCacheKey:JSON.stringify},e=>{function t(d){const h=new Map;for(let u=0;u<d.length;u+=2)h.set(d[u],d[u+1]);return h}function i(d,h){const u=new Map(d);for(const[f,g]of h)u.set(f,g);return u}function n(d,h){if(!d)return h;const u=new Map;for(const[f,g]of d)h.has(f)&&u.set(f,g);return u}const s=rc.ambiguousCharacterData.value;let r=e.filter(d=>!d.startsWith("_")&&d in s);r.length===0&&(r=["_default"]);let a;for(const d of r){const h=t(s[d]);a=n(a,h)}const l=t(s._common),c=i(l,a);return new rc(c)}),rc._locales=new Ln(()=>Object.keys(rc.ambiguousCharacterData.value).filter(e=>!e.startsWith("_")));let d1=rc;const fC=class fC{static getRawData(){return JSON.parse('{"_common":[11,12,13,127,847,1564,4447,4448,6068,6069,6155,6156,6157,6158,7355,7356,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8204,8205,8206,8207,8234,8235,8236,8237,8238,8239,8287,8288,8289,8290,8291,8292,8293,8294,8295,8296,8297,8298,8299,8300,8301,8302,8303,10240,12644,65024,65025,65026,65027,65028,65029,65030,65031,65032,65033,65034,65035,65036,65037,65038,65039,65279,65440,65520,65521,65522,65523,65524,65525,65526,65527,65528,65532,78844,119155,119156,119157,119158,119159,119160,119161,119162,917504,917505,917506,917507,917508,917509,917510,917511,917512,917513,917514,917515,917516,917517,917518,917519,917520,917521,917522,917523,917524,917525,917526,917527,917528,917529,917530,917531,917532,917533,917534,917535,917536,917537,917538,917539,917540,917541,917542,917543,917544,917545,917546,917547,917548,917549,917550,917551,917552,917553,917554,917555,917556,917557,917558,917559,917560,917561,917562,917563,917564,917565,917566,917567,917568,917569,917570,917571,917572,917573,917574,917575,917576,917577,917578,917579,917580,917581,917582,917583,917584,917585,917586,917587,917588,917589,917590,917591,917592,917593,917594,917595,917596,917597,917598,917599,917600,917601,917602,917603,917604,917605,917606,917607,917608,917609,917610,917611,917612,917613,917614,917615,917616,917617,917618,917619,917620,917621,917622,917623,917624,917625,917626,917627,917628,917629,917630,917631,917760,917761,917762,917763,917764,917765,917766,917767,917768,917769,917770,917771,917772,917773,917774,917775,917776,917777,917778,917779,917780,917781,917782,917783,917784,917785,917786,917787,917788,917789,917790,917791,917792,917793,917794,917795,917796,917797,917798,917799,917800,917801,917802,917803,917804,917805,917806,917807,917808,917809,917810,917811,917812,917813,917814,917815,917816,917817,917818,917819,917820,917821,917822,917823,917824,917825,917826,917827,917828,917829,917830,917831,917832,917833,917834,917835,917836,917837,917838,917839,917840,917841,917842,917843,917844,917845,917846,917847,917848,917849,917850,917851,917852,917853,917854,917855,917856,917857,917858,917859,917860,917861,917862,917863,917864,917865,917866,917867,917868,917869,917870,917871,917872,917873,917874,917875,917876,917877,917878,917879,917880,917881,917882,917883,917884,917885,917886,917887,917888,917889,917890,917891,917892,917893,917894,917895,917896,917897,917898,917899,917900,917901,917902,917903,917904,917905,917906,917907,917908,917909,917910,917911,917912,917913,917914,917915,917916,917917,917918,917919,917920,917921,917922,917923,917924,917925,917926,917927,917928,917929,917930,917931,917932,917933,917934,917935,917936,917937,917938,917939,917940,917941,917942,917943,917944,917945,917946,917947,917948,917949,917950,917951,917952,917953,917954,917955,917956,917957,917958,917959,917960,917961,917962,917963,917964,917965,917966,917967,917968,917969,917970,917971,917972,917973,917974,917975,917976,917977,917978,917979,917980,917981,917982,917983,917984,917985,917986,917987,917988,917989,917990,917991,917992,917993,917994,917995,917996,917997,917998,917999],"cs":[173,8203,12288],"de":[173,8203,12288],"es":[8203,12288],"fr":[173,8203,12288],"it":[160,173,12288],"ja":[173],"ko":[173,12288],"pl":[173,8203,12288],"pt-BR":[173,8203,12288],"qps-ploc":[160,173,8203,12288],"ru":[173,12288],"tr":[160,173,8203,12288],"zh-hans":[160,173,8203,12288],"zh-hant":[173,12288]}')}static getData(){return this._data||(this._data=new Set([...Object.values(fC.getRawData())].flat())),this._data}static isInvisibleCharacter(e){return fC.getData().has(e)}static get codePoints(){return fC.getData()}};fC._data=void 0;let nf=fC,Rm;const LR=globalThis.vscode;if(typeof LR<"u"&&typeof LR.process<"u"){const o=LR.process;Rm={get platform(){return o.platform},get arch(){return o.arch},get env(){return o.env},cwd(){return o.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?Rm={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:Rm={get platform(){return gn?"win32":ze?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};const cy=Rm.cwd,xR=Rm.env,Fie=Rm.platform,Wie=65,Bie=97,Hie=90,Vie=122,sf=46,ts=47,To=92,xc=58,zie=63;class a6 extends Error{constructor(e,t,i){let n;typeof t=="string"&&t.indexOf("not ")===0?(n="must not be",t=t.replace(/^not /,"")):n="must be";const s=e.indexOf(".")!==-1?"property":"argument";let r=`The "${e}" ${s} ${n} of type ${t}`;r+=`. Received type ${typeof i}`,super(r),this.code="ERR_INVALID_ARG_TYPE"}}function Uie(o,e){if(o===null||typeof o!="object")throw new a6(e,"Object",o)}function on(o,e){if(typeof o!="string")throw new a6(e,"string",o)}const ih=Fie==="win32";function Ct(o){return o===ts||o===To}function kR(o){return o===ts}function kc(o){return o>=Wie&&o<=Hie||o>=Bie&&o<=Vie}function dy(o,e,t,i){let n="",s=0,r=-1,a=0,l=0;for(let c=0;c<=o.length;++c){if(c<o.length)l=o.charCodeAt(c);else{if(i(l))break;l=ts}if(i(l)){if(!(r===c-1||a===1))if(a===2){if(n.length<2||s!==2||n.charCodeAt(n.length-1)!==sf||n.charCodeAt(n.length-2)!==sf){if(n.length>2){const d=n.lastIndexOf(t);d===-1?(n="",s=0):(n=n.slice(0,d),s=n.length-1-n.lastIndexOf(t)),r=c,a=0;continue}else if(n.length!==0){n="",s=0,r=c,a=0;continue}}e&&(n+=n.length>0?`${t}..`:"..",s=2)}else n.length>0?n+=`${t}${o.slice(r+1,c)}`:n=o.slice(r+1,c),s=c-r-1;r=c,a=0}else l===sf&&a!==-1?++a:a=-1}return n}function $ie(o){return o?`${o[0]==="."?"":"."}${o}`:""}function l6(o,e){Uie(e,"pathObject");const t=e.dir||e.root,i=e.base||`${e.name||""}${$ie(e.ext)}`;return t?t===e.root?`${t}${i}`:`${t}${o}${i}`:i}const ao={resolve(...o){let e="",t="",i=!1;for(let n=o.length-1;n>=-1;n--){let s;if(n>=0){if(s=o[n],on(s,`paths[${n}]`),s.length===0)continue}else e.length===0?s=cy():(s=xR[`=${e}`]||cy(),(s===void 0||s.slice(0,2).toLowerCase()!==e.toLowerCase()&&s.charCodeAt(2)===To)&&(s=`${e}\\`));const r=s.length;let a=0,l="",c=!1;const d=s.charCodeAt(0);if(r===1)Ct(d)&&(a=1,c=!0);else if(Ct(d))if(c=!0,Ct(s.charCodeAt(1))){let h=2,u=h;for(;h<r&&!Ct(s.charCodeAt(h));)h++;if(h<r&&h!==u){const f=s.slice(u,h);for(u=h;h<r&&Ct(s.charCodeAt(h));)h++;if(h<r&&h!==u){for(u=h;h<r&&!Ct(s.charCodeAt(h));)h++;(h===r||h!==u)&&(l=`\\\\${f}\\${s.slice(u,h)}`,a=h)}}}else a=1;else kc(d)&&s.charCodeAt(1)===xc&&(l=s.slice(0,2),a=2,r>2&&Ct(s.charCodeAt(2))&&(c=!0,a=3));if(l.length>0)if(e.length>0){if(l.toLowerCase()!==e.toLowerCase())continue}else e=l;if(i){if(e.length>0)break}else if(t=`${s.slice(a)}\\${t}`,i=c,c&&e.length>0)break}return t=dy(t,!i,"\\",Ct),i?`${e}\\${t}`:`${e}${t}`||"."},normalize(o){on(o,"path");const e=o.length;if(e===0)return".";let t=0,i,n=!1;const s=o.charCodeAt(0);if(e===1)return kR(s)?"\\":o;if(Ct(s))if(n=!0,Ct(o.charCodeAt(1))){let a=2,l=a;for(;a<e&&!Ct(o.charCodeAt(a));)a++;if(a<e&&a!==l){const c=o.slice(l,a);for(l=a;a<e&&Ct(o.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!Ct(o.charCodeAt(a));)a++;if(a===e)return`\\\\${c}\\${o.slice(l)}\\`;a!==l&&(i=`\\\\${c}\\${o.slice(l,a)}`,t=a)}}}else t=1;else kc(s)&&o.charCodeAt(1)===xc&&(i=o.slice(0,2),t=2,e>2&&Ct(o.charCodeAt(2))&&(n=!0,t=3));let r=t<e?dy(o.slice(t),!n,"\\",Ct):"";if(r.length===0&&!n&&(r="."),r.length>0&&Ct(o.charCodeAt(e-1))&&(r+="\\"),!n&&i===void 0&&o.includes(":")){if(r.length>=2&&kc(r.charCodeAt(0))&&r.charCodeAt(1)===xc)return`.\\${r}`;let a=o.indexOf(":");do if(a===e-1||Ct(o.charCodeAt(a+1)))return`.\\${r}`;while((a=o.indexOf(":",a+1))!==-1)}return i===void 0?n?`\\${r}`:r:n?`${i}\\${r}`:`${i}${r}`},isAbsolute(o){on(o,"path");const e=o.length;if(e===0)return!1;const t=o.charCodeAt(0);return Ct(t)||e>2&&kc(t)&&o.charCodeAt(1)===xc&&Ct(o.charCodeAt(2))},join(...o){if(o.length===0)return".";let e,t;for(let s=0;s<o.length;++s){const r=o[s];on(r,"path"),r.length>0&&(e===void 0?e=t=r:e+=`\\${r}`)}if(e===void 0)return".";let i=!0,n=0;if(typeof t=="string"&&Ct(t.charCodeAt(0))){++n;const s=t.length;s>1&&Ct(t.charCodeAt(1))&&(++n,s>2&&(Ct(t.charCodeAt(2))?++n:i=!1))}if(i){for(;n<e.length&&Ct(e.charCodeAt(n));)n++;n>=2&&(e=`\\${e.slice(n)}`)}return ao.normalize(e)},relative(o,e){if(on(o,"from"),on(e,"to"),o===e)return"";const t=ao.resolve(o),i=ao.resolve(e);if(t===i||(o=t.toLowerCase(),e=i.toLowerCase(),o===e))return"";if(t.length!==o.length||i.length!==e.length){const g=t.split("\\"),m=i.split("\\");g[g.length-1]===""&&g.pop(),m[m.length-1]===""&&m.pop();const _=g.length,b=m.length,C=_<b?_:b;let w;for(w=0;w<C&&g[w].toLowerCase()===m[w].toLowerCase();w++);return w===0?i:w===C?b>C?m.slice(w).join("\\"):_>C?"..\\".repeat(_-1-w)+"..":"":"..\\".repeat(_-w)+m.slice(w).join("\\")}let n=0;for(;n<o.length&&o.charCodeAt(n)===To;)n++;let s=o.length;for(;s-1>n&&o.charCodeAt(s-1)===To;)s--;const r=s-n;let a=0;for(;a<e.length&&e.charCodeAt(a)===To;)a++;let l=e.length;for(;l-1>a&&e.charCodeAt(l-1)===To;)l--;const c=l-a,d=r<c?r:c;let h=-1,u=0;for(;u<d;u++){const g=o.charCodeAt(n+u);if(g!==e.charCodeAt(a+u))break;g===To&&(h=u)}if(u!==d){if(h===-1)return i}else{if(c>d){if(e.charCodeAt(a+u)===To)return i.slice(a+u+1);if(u===2)return i.slice(a+u)}r>d&&(o.charCodeAt(n+u)===To?h=u:u===2&&(h=3)),h===-1&&(h=0)}let f="";for(u=n+h+1;u<=s;++u)(u===s||o.charCodeAt(u)===To)&&(f+=f.length===0?"..":"\\..");return a+=h,f.length>0?`${f}${i.slice(a,l)}`:(i.charCodeAt(a)===To&&++a,i.slice(a,l))},toNamespacedPath(o){if(typeof o!="string"||o.length===0)return o;const e=ao.resolve(o);if(e.length<=2)return o;if(e.charCodeAt(0)===To){if(e.charCodeAt(1)===To){const t=e.charCodeAt(2);if(t!==zie&&t!==sf)return`\\\\?\\UNC\\${e.slice(2)}`}}else if(kc(e.charCodeAt(0))&&e.charCodeAt(1)===xc&&e.charCodeAt(2)===To)return`\\\\?\\${e}`;return e},dirname(o){on(o,"path");const e=o.length;if(e===0)return".";let t=-1,i=0;const n=o.charCodeAt(0);if(e===1)return Ct(n)?o:".";if(Ct(n)){if(t=i=1,Ct(o.charCodeAt(1))){let a=2,l=a;for(;a<e&&!Ct(o.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&Ct(o.charCodeAt(a));)a++;if(a<e&&a!==l){for(l=a;a<e&&!Ct(o.charCodeAt(a));)a++;if(a===e)return o;a!==l&&(t=i=a+1)}}}}else kc(n)&&o.charCodeAt(1)===xc&&(t=e>2&&Ct(o.charCodeAt(2))?3:2,i=t);let s=-1,r=!0;for(let a=e-1;a>=i;--a)if(Ct(o.charCodeAt(a))){if(!r){s=a;break}}else r=!1;if(s===-1){if(t===-1)return".";s=t}return o.slice(0,s)},basename(o,e){e!==void 0&&on(e,"suffix"),on(o,"path");let t=0,i=-1,n=!0,s;if(o.length>=2&&kc(o.charCodeAt(0))&&o.charCodeAt(1)===xc&&(t=2),e!==void 0&&e.length>0&&e.length<=o.length){if(e===o)return"";let r=e.length-1,a=-1;for(s=o.length-1;s>=t;--s){const l=o.charCodeAt(s);if(Ct(l)){if(!n){t=s+1;break}}else a===-1&&(n=!1,a=s+1),r>=0&&(l===e.charCodeAt(r)?--r===-1&&(i=s):(r=-1,i=a))}return t===i?i=a:i===-1&&(i=o.length),o.slice(t,i)}for(s=o.length-1;s>=t;--s)if(Ct(o.charCodeAt(s))){if(!n){t=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":o.slice(t,i)},extname(o){on(o,"path");let e=0,t=-1,i=0,n=-1,s=!0,r=0;o.length>=2&&o.charCodeAt(1)===xc&&kc(o.charCodeAt(0))&&(e=i=2);for(let a=o.length-1;a>=e;--a){const l=o.charCodeAt(a);if(Ct(l)){if(!s){i=a+1;break}continue}n===-1&&(s=!1,n=a+1),l===sf?t===-1?t=a:r!==1&&(r=1):t!==-1&&(r=-1)}return t===-1||n===-1||r===0||r===1&&t===n-1&&t===i+1?"":o.slice(t,n)},format:l6.bind(null,"\\"),parse(o){on(o,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return e;const t=o.length;let i=0,n=o.charCodeAt(0);if(t===1)return Ct(n)?(e.root=e.dir=o,e):(e.base=e.name=o,e);if(Ct(n)){if(i=1,Ct(o.charCodeAt(1))){let h=2,u=h;for(;h<t&&!Ct(o.charCodeAt(h));)h++;if(h<t&&h!==u){for(u=h;h<t&&Ct(o.charCodeAt(h));)h++;if(h<t&&h!==u){for(u=h;h<t&&!Ct(o.charCodeAt(h));)h++;h===t?i=h:h!==u&&(i=h+1)}}}}else if(kc(n)&&o.charCodeAt(1)===xc){if(t<=2)return e.root=e.dir=o,e;if(i=2,Ct(o.charCodeAt(2))){if(t===3)return e.root=e.dir=o,e;i=3}}i>0&&(e.root=o.slice(0,i));let s=-1,r=i,a=-1,l=!0,c=o.length-1,d=0;for(;c>=i;--c){if(n=o.charCodeAt(c),Ct(n)){if(!l){r=c+1;break}continue}a===-1&&(l=!1,a=c+1),n===sf?s===-1?s=c:d!==1&&(d=1):s!==-1&&(d=-1)}return a!==-1&&(s===-1||d===0||d===1&&s===a-1&&s===r+1?e.base=e.name=o.slice(r,a):(e.name=o.slice(r,s),e.base=o.slice(r,a),e.ext=o.slice(s,a))),r>0&&r!==i?e.dir=o.slice(0,r-1):e.dir=e.root,e},sep:"\\",delimiter:";",win32:null,posix:null},jie=(()=>{if(ih){const o=/\\/g;return()=>{const e=cy().replace(o,"/");return e.slice(e.indexOf("/"))}}return()=>cy()})(),Pi={resolve(...o){let e="",t=!1;for(let i=o.length-1;i>=0&&!t;i--){const n=o[i];on(n,`paths[${i}]`),n.length!==0&&(e=`${n}/${e}`,t=n.charCodeAt(0)===ts)}if(!t){const i=jie();e=`${i}/${e}`,t=i.charCodeAt(0)===ts}return e=dy(e,!t,"/",kR),t?`/${e}`:e.length>0?e:"."},normalize(o){if(on(o,"path"),o.length===0)return".";const e=o.charCodeAt(0)===ts,t=o.charCodeAt(o.length-1)===ts;return o=dy(o,!e,"/",kR),o.length===0?e?"/":t?"./":".":(t&&(o+="/"),e?`/${o}`:o)},isAbsolute(o){return on(o,"path"),o.length>0&&o.charCodeAt(0)===ts},join(...o){if(o.length===0)return".";const e=[];for(let t=0;t<o.length;++t){const i=o[t];on(i,"path"),i.length>0&&e.push(i)}return e.length===0?".":Pi.normalize(e.join("/"))},relative(o,e){if(on(o,"from"),on(e,"to"),o===e||(o=Pi.resolve(o),e=Pi.resolve(e),o===e))return"";const t=1,i=o.length,n=i-t,s=1,r=e.length-s,a=n<r?n:r;let l=-1,c=0;for(;c<a;c++){const h=o.charCodeAt(t+c);if(h!==e.charCodeAt(s+c))break;h===ts&&(l=c)}if(c===a)if(r>a){if(e.charCodeAt(s+c)===ts)return e.slice(s+c+1);if(c===0)return e.slice(s+c)}else n>a&&(o.charCodeAt(t+c)===ts?l=c:c===0&&(l=0));let d="";for(c=t+l+1;c<=i;++c)(c===i||o.charCodeAt(c)===ts)&&(d+=d.length===0?"..":"/..");return`${d}${e.slice(s+l)}`},toNamespacedPath(o){return o},dirname(o){if(on(o,"path"),o.length===0)return".";const e=o.charCodeAt(0)===ts;let t=-1,i=!0;for(let n=o.length-1;n>=1;--n)if(o.charCodeAt(n)===ts){if(!i){t=n;break}}else i=!1;return t===-1?e?"/":".":e&&t===1?"//":o.slice(0,t)},basename(o,e){e!==void 0&&on(e,"suffix"),on(o,"path");let t=0,i=-1,n=!0,s;if(e!==void 0&&e.length>0&&e.length<=o.length){if(e===o)return"";let r=e.length-1,a=-1;for(s=o.length-1;s>=0;--s){const l=o.charCodeAt(s);if(l===ts){if(!n){t=s+1;break}}else a===-1&&(n=!1,a=s+1),r>=0&&(l===e.charCodeAt(r)?--r===-1&&(i=s):(r=-1,i=a))}return t===i?i=a:i===-1&&(i=o.length),o.slice(t,i)}for(s=o.length-1;s>=0;--s)if(o.charCodeAt(s)===ts){if(!n){t=s+1;break}}else i===-1&&(n=!1,i=s+1);return i===-1?"":o.slice(t,i)},extname(o){on(o,"path");let e=-1,t=0,i=-1,n=!0,s=0;for(let r=o.length-1;r>=0;--r){const a=o[r];if(a==="/"){if(!n){t=r+1;break}continue}i===-1&&(n=!1,i=r+1),a==="."?e===-1?e=r:s!==1&&(s=1):e!==-1&&(s=-1)}return e===-1||i===-1||s===0||s===1&&e===i-1&&e===t+1?"":o.slice(e,i)},format:l6.bind(null,"/"),parse(o){on(o,"path");const e={root:"",dir:"",base:"",ext:"",name:""};if(o.length===0)return e;const t=o.charCodeAt(0)===ts;let i;t?(e.root="/",i=1):i=0;let n=-1,s=0,r=-1,a=!0,l=o.length-1,c=0;for(;l>=i;--l){const d=o.charCodeAt(l);if(d===ts){if(!a){s=l+1;break}continue}r===-1&&(a=!1,r=l+1),d===sf?n===-1?n=l:c!==1&&(c=1):n!==-1&&(c=-1)}if(r!==-1){const d=s===0&&t?1:s;n===-1||c===0||c===1&&n===r-1&&n===s+1?e.base=e.name=o.slice(d,r):(e.name=o.slice(d,n),e.base=o.slice(d,r),e.ext=o.slice(n,r))}return s>0?e.dir=o.slice(0,s-1):t&&(e.dir="/"),e},sep:"/",delimiter:":",win32:null,posix:null};Pi.win32=ao.win32=ao,Pi.posix=ao.posix=Pi;const c6=ih?ao.normalize:Pi.normalize,qie=ih?ao.resolve:Pi.resolve,Kie=ih?ao.relative:Pi.relative,d6=ih?ao.dirname:Pi.dirname,nh=ih?ao.basename:Pi.basename,Gie=ih?ao.extname:Pi.extname,_a=ih?ao.sep:Pi.sep,Zie=/^\w[\w\d+.-]*$/,Yie=/^\//,Xie=/^\/\//;function Qie(o,e){if(!o.scheme&&e)throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${o.authority}", path: "${o.path}", query: "${o.query}", fragment: "${o.fragment}"}`);if(o.scheme&&!Zie.test(o.scheme))throw new Error("[UriError]: Scheme contains illegal characters.");if(o.path){if(o.authority){if(!Yie.test(o.path))throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character')}else if(Xie.test(o.path))throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")')}}function Jie(o,e){return!o&&!e?"file":o}function ene(o,e){switch(o){case"https":case"http":case"file":e?e[0]!==ba&&(e=ba+e):e=ba;break}return e}const Ni="",ba="/",tne=/^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;class be{static isUri(e){return e instanceof be?!0:!e||typeof e!="object"?!1:typeof e.authority=="string"&&typeof e.fragment=="string"&&typeof e.path=="string"&&typeof e.query=="string"&&typeof e.scheme=="string"&&typeof e.fsPath=="string"&&typeof e.with=="function"&&typeof e.toString=="function"}constructor(e,t,i,n,s,r=!1){typeof e=="object"?(this.scheme=e.scheme||Ni,this.authority=e.authority||Ni,this.path=e.path||Ni,this.query=e.query||Ni,this.fragment=e.fragment||Ni):(this.scheme=Jie(e,r),this.authority=t||Ni,this.path=ene(this.scheme,i||Ni),this.query=n||Ni,this.fragment=s||Ni,Qie(this,r))}get fsPath(){return hy(this,!1)}with(e){if(!e)return this;let{scheme:t,authority:i,path:n,query:s,fragment:r}=e;return t===void 0?t=this.scheme:t===null&&(t=Ni),i===void 0?i=this.authority:i===null&&(i=Ni),n===void 0?n=this.path:n===null&&(n=Ni),s===void 0?s=this.query:s===null&&(s=Ni),r===void 0?r=this.fragment:r===null&&(r=Ni),t===this.scheme&&i===this.authority&&n===this.path&&s===this.query&&r===this.fragment?this:new Mm(t,i,n,s,r)}static parse(e,t=!1){const i=tne.exec(e);return i?new Mm(i[2]||Ni,uy(i[4]||Ni),uy(i[5]||Ni),uy(i[7]||Ni),uy(i[9]||Ni),t):new Mm(Ni,Ni,Ni,Ni,Ni)}static file(e){let t=Ni;if(gn&&(e=e.replace(/\\/g,ba)),e[0]===ba&&e[1]===ba){const i=e.indexOf(ba,2);i===-1?(t=e.substring(2),e=ba):(t=e.substring(2,i),e=e.substring(i)||ba)}return new Mm("file",t,e,Ni,Ni)}static from(e,t){return new Mm(e.scheme,e.authority,e.path,e.query,e.fragment,t)}static joinPath(e,...t){if(!e.path)throw new Error("[UriError]: cannot call joinPath on URI without path");let i;return gn&&e.scheme==="file"?i=be.file(ao.join(hy(e,!0),...t)).path:i=Pi.join(e.path,...t),e.with({path:i})}toString(e=!1){return IR(this,e)}toJSON(){return this}static revive(e){if(e){if(e instanceof be)return e;{const t=new Mm(e);return t._formatted=e.external??null,t._fsPath=e._sep===h6?e.fsPath??null:null,t}}else return e}}const h6=gn?1:void 0;let Mm=class extends be{constructor(){super(...arguments),this._formatted=null,this._fsPath=null}get fsPath(){return this._fsPath||(this._fsPath=hy(this,!1)),this._fsPath}toString(e=!1){return e?IR(this,!0):(this._formatted||(this._formatted=IR(this,!1)),this._formatted)}toJSON(){const e={$mid:1};return this._fsPath&&(e.fsPath=this._fsPath,e._sep=h6),this._formatted&&(e.external=this._formatted),this.path&&(e.path=this.path),this.scheme&&(e.scheme=this.scheme),this.authority&&(e.authority=this.authority),this.query&&(e.query=this.query),this.fragment&&(e.fragment=this.fragment),e}};const u6={58:"%3A",47:"%2F",63:"%3F",35:"%23",91:"%5B",93:"%5D",64:"%40",33:"%21",36:"%24",38:"%26",39:"%27",40:"%28",41:"%29",42:"%2A",43:"%2B",44:"%2C",59:"%3B",61:"%3D",32:"%20"};function f6(o,e,t){let i,n=-1;for(let s=0;s<o.length;s++){const r=o.charCodeAt(s);if(r>=97&&r<=122||r>=65&&r<=90||r>=48&&r<=57||r===45||r===46||r===95||r===126||e&&r===47||t&&r===91||t&&r===93||t&&r===58)n!==-1&&(i+=encodeURIComponent(o.substring(n,s)),n=-1),i!==void 0&&(i+=o.charAt(s));else{i===void 0&&(i=o.substr(0,s));const a=u6[r];a!==void 0?(n!==-1&&(i+=encodeURIComponent(o.substring(n,s)),n=-1),i+=a):n===-1&&(n=s)}}return n!==-1&&(i+=encodeURIComponent(o.substring(n))),i!==void 0?i:o}function ine(o){let e;for(let t=0;t<o.length;t++){const i=o.charCodeAt(t);i===35||i===63?(e===void 0&&(e=o.substr(0,t)),e+=u6[i]):e!==void 0&&(e+=o[t])}return e!==void 0?e:o}function hy(o,e){let t;return o.authority&&o.path.length>1&&o.scheme==="file"?t=`//${o.authority}${o.path}`:o.path.charCodeAt(0)===47&&(o.path.charCodeAt(1)>=65&&o.path.charCodeAt(1)<=90||o.path.charCodeAt(1)>=97&&o.path.charCodeAt(1)<=122)&&o.path.charCodeAt(2)===58?e?t=o.path.substr(1):t=o.path[1].toLowerCase()+o.path.substr(2):t=o.path,gn&&(t=t.replace(/\//g,"\\")),t}function IR(o,e){const t=e?ine:f6;let i="",{scheme:n,authority:s,path:r,query:a,fragment:l}=o;if(n&&(i+=n,i+=":"),(s||n==="file")&&(i+=ba,i+=ba),s){let c=s.indexOf("@");if(c!==-1){const d=s.substr(0,c);s=s.substr(c+1),c=d.lastIndexOf(":"),c===-1?i+=t(d,!1,!1):(i+=t(d.substr(0,c),!1,!1),i+=":",i+=t(d.substr(c+1),!1,!0)),i+="@"}s=s.toLowerCase(),c=s.lastIndexOf(":"),c===-1?i+=t(s,!1,!0):(i+=t(s.substr(0,c),!1,!0),i+=s.substr(c))}if(r){if(r.length>=3&&r.charCodeAt(0)===47&&r.charCodeAt(2)===58){const c=r.charCodeAt(1);c>=65&&c<=90&&(r=`/${String.fromCharCode(c+32)}:${r.substr(3)}`)}else if(r.length>=2&&r.charCodeAt(1)===58){const c=r.charCodeAt(0);c>=65&&c<=90&&(r=`${String.fromCharCode(c+32)}:${r.substr(2)}`)}i+=t(r,!0,!1)}return a&&(i+="?",i+=t(a,!1,!1)),l&&(i+="#",i+=e?l:f6(l,!1,!1)),i}function g6(o){try{return decodeURIComponent(o)}catch{return o.length>3?o.substr(0,3)+g6(o.substr(3)):o}}const p6=/(%[0-9A-Za-z][0-9A-Za-z])+/g;function uy(o){return o.match(p6)?o.replace(p6,e=>g6(e)):o}var we;(function(o){o.inMemory="inmemory",o.vscode="vscode",o.internal="private",o.walkThrough="walkThrough",o.walkThroughSnippet="walkThroughSnippet",o.http="http",o.https="https",o.file="file",o.mailto="mailto",o.untitled="untitled",o.data="data",o.command="command",o.vscodeRemote="vscode-remote",o.vscodeRemoteResource="vscode-remote-resource",o.vscodeManagedRemoteResource="vscode-managed-remote-resource",o.vscodeUserData="vscode-userdata",o.vscodeCustomEditor="vscode-custom-editor",o.vscodeNotebookCell="vscode-notebook-cell",o.vscodeNotebookCellMetadata="vscode-notebook-cell-metadata",o.vscodeNotebookCellMetadataDiff="vscode-notebook-cell-metadata-diff",o.vscodeNotebookCellOutput="vscode-notebook-cell-output",o.vscodeNotebookCellOutputDiff="vscode-notebook-cell-output-diff",o.vscodeNotebookMetadata="vscode-notebook-metadata",o.vscodeInteractiveInput="vscode-interactive-input",o.vscodeSettings="vscode-settings",o.vscodeWorkspaceTrust="vscode-workspace-trust",o.vscodeTerminal="vscode-terminal",o.vscodeChatCodeBlock="vscode-chat-code-block",o.vscodeChatCodeCompareBlock="vscode-chat-code-compare-block",o.vscodeChatEditor="vscode-chat-editor",o.vscodeChatInput="chatSessionInput",o.vscodeChatSession="vscode-chat-session",o.webviewPanel="webview-panel",o.vscodeWebview="vscode-webview",o.extension="extension",o.vscodeFileResource="vscode-file",o.tmp="tmp",o.vsls="vsls",o.vscodeSourceControl="vscode-scm",o.commentsInput="comment",o.codeSetting="code-setting",o.outputChannel="output",o.accessibleView="accessible-view",o.chatEditingSnapshotScheme="chat-editing-snapshot-text-model",o.chatEditingModel="chat-editing-text-model"})(we||(we={}));function fy(o,e){return be.isUri(o)?Nm(o.scheme,e):_R(o,e+":")}function DR(o,...e){return e.some(t=>fy(o,t))}const nne="tkn";class sne{constructor(){this._hosts=Object.create(null),this._ports=Object.create(null),this._connectionTokens=Object.create(null),this._preferredWebSchema="http",this._delegate=null,this._serverRootPath="/"}setPreferredWebSchema(e){this._preferredWebSchema=e}get _remoteResourcesPath(){return Pi.join(this._serverRootPath,we.vscodeRemoteResource)}rewrite(e){if(this._delegate)try{return this._delegate(e)}catch(a){return Ee(a),e}const t=e.authority;let i=this._hosts[t];i&&i.indexOf(":")!==-1&&i.indexOf("[")===-1&&(i=`[${i}]`);const n=this._ports[t],s=this._connectionTokens[t];let r=`path=${encodeURIComponent(e.path)}`;return typeof s=="string"&&(r+=`&${nne}=${encodeURIComponent(s)}`),be.from({scheme:ol?this._preferredWebSchema:we.vscodeRemoteResource,authority:`${i}:${n}`,path:this._remoteResourcesPath,query:r})}}const m6=new sne,one="vscode-app",LS=class LS{uriToBrowserUri(e){return e.scheme===we.vscodeRemote?m6.rewrite(e):e.scheme===we.file&&(ma||Bte===`${we.vscodeFileResource}://${LS.FALLBACK_AUTHORITY}`)?e.with({scheme:we.vscodeFileResource,authority:e.authority||LS.FALLBACK_AUTHORITY,query:null,fragment:null}):e}};LS.FALLBACK_AUTHORITY=one;let ER=LS;const _6=new ER;var NR;(function(o){const e=new Map([["1",{"Cross-Origin-Opener-Policy":"same-origin"}],["2",{"Cross-Origin-Embedder-Policy":"require-corp"}],["3",{"Cross-Origin-Opener-Policy":"same-origin","Cross-Origin-Embedder-Policy":"require-corp"}]]);o.CoopAndCoep=Object.freeze(e.get("3"));const t="vscode-coi";function i(s){let r;typeof s=="string"?r=new URL(s).searchParams:s instanceof URL?r=s.searchParams:be.isUri(s)&&(r=new URL(s.toString(!0)).searchParams);const a=r?.get(t);if(a)return e.get(a)}o.getHeadersFromQuery=i;function n(s,r,a){if(!globalThis.crossOriginIsolated)return;const l=r&&a?"3":a?"2":"1";s instanceof URLSearchParams?s.set(t,l):s[t]=l}o.addSearchParam=n})(NR||(NR={}));const b6=typeof Buffer<"u";new Ln(()=>new Uint8Array(256));let TR;class sh{static wrap(e){return b6&&!Buffer.isBuffer(e)&&(e=Buffer.from(e.buffer,e.byteOffset,e.byteLength)),new sh(e)}constructor(e){this.buffer=e,this.byteLength=this.buffer.byteLength}toString(){return b6?this.buffer.toString():(TR||(TR=new TextDecoder),TR.decode(this.buffer))}}function rne(o,e){return o[e+0]<<0>>>0|o[e+1]<<8>>>0}function ane(o,e,t){o[t+0]=e&255,e=e>>>8,o[t+1]=e&255}function Ca(o,e){return o[e]*2**24+o[e+1]*2**16+o[e+2]*2**8+o[e+3]}function va(o,e,t){o[t+3]=e,e=e>>>8,o[t+2]=e,e=e>>>8,o[t+1]=e,e=e>>>8,o[t]=e}function C6(o,e){return o[e]}function v6(o,e,t){o[t]=e}const w6="0123456789abcdef";function lne({buffer:o}){let e="";for(let t=0;t<o.length;t++){const i=o[t];e+=w6[i>>>4],e+=w6[i&15]}return e}function h1(o){return gy(o,0)}function gy(o,e){switch(typeof o){case"object":return o===null?Ic(349,e):Array.isArray(o)?dne(o,e):hne(o,e);case"string":return RR(o,e);case"boolean":return cne(o,e);case"number":return Ic(o,e);case"undefined":return Ic(937,e);default:return Ic(617,e)}}function Ic(o,e){return(e<<5)-e+o|0}function cne(o,e){return Ic(o?433:863,e)}function RR(o,e){e=Ic(149417,e);for(let t=0,i=o.length;t<i;t++)e=Ic(o.charCodeAt(t),e);return e}function dne(o,e){return e=Ic(104579,e),o.reduce((t,i)=>gy(i,t),e)}function hne(o,e){return e=Ic(181387,e),Object.keys(o).sort().reduce((t,i)=>(t=RR(i,t),gy(o[i],t)),e)}function MR(o,e,t=32){const i=t-e,n=~((1<<i)-1);return(o<<e|(n&o)>>>i)>>>0}function u1(o,e=32){return o instanceof ArrayBuffer?lne(sh.wrap(new Uint8Array(o))):(o>>>0).toString(16).padStart(e/4,"0")}const JE=class JE{constructor(){this._h0=1732584193,this._h1=4023233417,this._h2=2562383102,this._h3=271733878,this._h4=3285377520,this._buff=new Uint8Array(67),this._buffDV=new DataView(this._buff.buffer),this._buffLen=0,this._totalLen=0,this._leftoverHighSurrogate=0,this._finished=!1}update(e){const t=e.length;if(t===0)return;const i=this._buff;let n=this._buffLen,s=this._leftoverHighSurrogate,r,a;for(s!==0?(r=s,a=-1,s=0):(r=e.charCodeAt(0),a=0);;){let l=r;if(zi(r))if(a+1<t){const c=e.charCodeAt(a+1);eh(c)?(a++,l=bR(r,c)):l=65533}else{s=r;break}else eh(r)&&(l=65533);if(n=this._push(i,n,l),a++,a<t)r=e.charCodeAt(a);else break}this._buffLen=n,this._leftoverHighSurrogate=s}_push(e,t,i){return i<128?e[t++]=i:i<2048?(e[t++]=192|(i&1984)>>>6,e[t++]=128|(i&63)>>>0):i<65536?(e[t++]=224|(i&61440)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0):(e[t++]=240|(i&1835008)>>>18,e[t++]=128|(i&258048)>>>12,e[t++]=128|(i&4032)>>>6,e[t++]=128|(i&63)>>>0),t>=64&&(this._step(),t-=64,this._totalLen+=64,e[0]=e[64],e[1]=e[65],e[2]=e[66]),t}digest(){return this._finished||(this._finished=!0,this._leftoverHighSurrogate&&(this._leftoverHighSurrogate=0,this._buffLen=this._push(this._buff,this._buffLen,65533)),this._totalLen+=this._buffLen,this._wrapUp()),u1(this._h0)+u1(this._h1)+u1(this._h2)+u1(this._h3)+u1(this._h4)}_wrapUp(){this._buff[this._buffLen++]=128,this._buff.subarray(this._buffLen).fill(0),this._buffLen>56&&(this._step(),this._buff.fill(0));const e=8*this._totalLen;this._buffDV.setUint32(56,Math.floor(e/4294967296),!1),this._buffDV.setUint32(60,e%4294967296,!1),this._step()}_step(){const e=JE._bigBlock32,t=this._buffDV;for(let h=0;h<64;h+=4)e.setUint32(h,t.getUint32(h,!1),!1);for(let h=64;h<320;h+=4)e.setUint32(h,MR(e.getUint32(h-12,!1)^e.getUint32(h-32,!1)^e.getUint32(h-56,!1)^e.getUint32(h-64,!1),1),!1);let i=this._h0,n=this._h1,s=this._h2,r=this._h3,a=this._h4,l,c,d;for(let h=0;h<80;h++)h<20?(l=n&s|~n&r,c=1518500249):h<40?(l=n^s^r,c=1859775393):h<60?(l=n&s|n&r|s&r,c=2400959708):(l=n^s^r,c=3395469782),d=MR(i,5)+l+a+c+e.getUint32(h*4,!1)&4294967295,a=r,r=s,s=MR(n,30),n=i,i=d;this._h0=this._h0+i&4294967295,this._h1=this._h1+n&4294967295,this._h2=this._h2+s&4294967295,this._h3=this._h3+r&4294967295,this._h4=this._h4+a&4294967295}};JE._bigBlock32=new DataView(new ArrayBuffer(320));let PR=JE;class xn{constructor(e,t,i){this.owner=e,this.debugNameSource=t,this.referenceFn=i}getDebugName(e){return une(e,this)}}const S6=new Map,AR=new WeakMap;function une(o,e){const t=AR.get(o);if(t)return t;const i=fne(o,e);if(i){let n=S6.get(i)??0;n++,S6.set(i,n);const s=n===1?i:`${i}#${n}`;return AR.set(o,s),s}}function fne(o,e){const t=AR.get(o);if(t)return t;const i=e.owner?pne(e.owner)+".":"";let n;const s=e.debugNameSource;if(s!==void 0)if(typeof s=="function"){if(n=s(),n!==void 0)return i+n}else return i+s;const r=e.referenceFn;if(r!==void 0&&(n=OR(r),n!==void 0))return i+n;if(e.owner!==void 0){const a=gne(e.owner,o);if(a!==void 0)return i+a}}function gne(o,e){for(const t in o)if(o[t]===e)return t}const y6=new Map,L6=new WeakMap;function pne(o){const e=L6.get(o);if(e)return e;const t=x6(o)??"Object";let i=y6.get(t)??0;i++,y6.set(t,i);const n=i===1?t:`${t}#${i}`;return L6.set(o,n),n}function x6(o){const e=o.constructor;if(e)return e.name==="Object"?void 0:e.name}function OR(o){const e=o.toString(),i=/\/\*\*\s*@description\s*([^*]*)\*\//.exec(e);return(i?i[1]:void 0)?.trim()}function mne(o){if(o.length===0)throw new Error("Invalid tail call");return[o.slice(0,o.length-1),o[o.length-1]]}function Ut(o,e,t=(i,n)=>i===n){if(o===e)return!0;if(!o||!e||o.length!==e.length)return!1;for(let i=0,n=o.length;i<n;i++)if(!t(o[i],e[i]))return!1;return!0}function _ne(o,e){const t=o.length-1;e<t&&(o[e]=o[t]),o.pop()}function py(o,e,t){return FR(o.length,i=>t(o[i],e))}function FR(o,e){let t=0,i=o-1;for(;t<=i;){const n=(t+i)/2|0,s=e(n);if(s<0)t=n+1;else if(s>0)i=n-1;else return n}return-(t+1)}function WR(o,e,t){if(o=o|0,o>=e.length)throw new TypeError("invalid index");const i=e[Math.floor(e.length*Math.random())],n=[],s=[],r=[];for(const a of e){const l=t(a,i);l<0?n.push(a):l>0?s.push(a):r.push(a)}return o<n.length?WR(o,n,t):o<n.length+r.length?r[0]:WR(o-(n.length+r.length),s,t)}function k6(o,e){const t=[];let i;for(const n of o.slice(0).sort(e))!i||e(i[0],n)!==0?(i=[n],t.push(i)):i.push(n);return t}function*BR(o,e){let t,i;for(const n of o)i!==void 0&&e(i,n)?t.push(n):(t&&(yield t),t=[n]),i=n;t&&(yield t)}function I6(o,e){for(let t=0;t<=o.length;t++)e(t===0?void 0:o[t-1],t===o.length?void 0:o[t])}function bne(o,e){for(let t=0;t<o.length;t++)e(t===0?void 0:o[t-1],o[t],t+1===o.length?void 0:o[t+1])}function wa(o){return o.filter(e=>!!e)}function D6(o){let e=0;for(let t=0;t<o.length;t++)o[t]&&(o[e]=o[t],e+=1);o.length=e}function E6(o){return!Array.isArray(o)||o.length===0}function is(o){return Array.isArray(o)&&o.length>0}function Dc(o,e=t=>t){const t=new Set;return o.filter(i=>{const n=e(i);return t.has(n)?!1:(t.add(n),!0)})}function Bs(o,e){let t=typeof e=="number"?o:0;typeof e=="number"?t=o:(t=0,e=o);const i=[];if(t<=e)for(let n=t;n<e;n++)i.push(n);else for(let n=t;n>e;n--)i.push(n);return i}function my(o,e,t){const i=o.slice(0,e),n=o.slice(e);return i.concat(t,n)}function HR(o,e){const t=o.indexOf(e);t>-1&&(o.splice(t,1),o.unshift(e))}function _y(o,e){const t=o.indexOf(e);t>-1&&(o.splice(t,1),o.push(e))}function VR(o,e){for(const t of e)o.push(t)}function zR(o){return Array.isArray(o)?o:[o]}function Cne(o,e,t){const i=N6(o,e),n=o.length,s=t.length;o.length=n+s;for(let r=n-1;r>=i;r--)o[r+s]=o[r];for(let r=0;r<s;r++)o[r+i]=t[r]}function by(o,e,t,i){const n=N6(o,e);let s=o.splice(n,t);return s===void 0&&(s=[]),Cne(o,n,i),s}function N6(o,e){return e<0?Math.max(e+o.length,0):Math.min(e,o.length)}var oh;(function(o){function e(s){return s<0}o.isLessThan=e;function t(s){return s<=0}o.isLessThanOrEqual=t;function i(s){return s>0}o.isGreaterThan=i;function n(s){return s===0}o.isNeitherLessOrGreaterThan=n,o.greaterThan=1,o.lessThan=-1,o.neitherLessOrGreaterThan=0})(oh||(oh={}));function kn(o,e){return(t,i)=>e(o(t),o(i))}function vne(...o){return(e,t)=>{for(const i of o){const n=i(e,t);if(!oh.isNeitherLessOrGreaterThan(n))return n}return oh.neitherLessOrGreaterThan}}const lo=(o,e)=>o-e,T6=(o,e)=>lo(o?1:0,e?1:0);function R6(o){return(e,t)=>-o(e,t)}function wne(o){return(e,t)=>e===void 0?t===void 0?oh.neitherLessOrGreaterThan:oh.lessThan:t===void 0?oh.greaterThan:o(e,t)}class Ec{constructor(e){this.firstIdx=0,this.items=e,this.lastIdx=this.items.length-1}get length(){return this.lastIdx-this.firstIdx+1}takeWhile(e){let t=this.firstIdx;for(;t<this.items.length&&e(this.items[t]);)t++;const i=t===this.firstIdx?null:this.items.slice(this.firstIdx,t);return this.firstIdx=t,i}takeFromEndWhile(e){let t=this.lastIdx;for(;t>=0&&e(this.items[t]);)t--;const i=t===this.lastIdx?null:this.items.slice(t+1,this.lastIdx+1);return this.lastIdx=t,i}peek(){if(this.length!==0)return this.items[this.firstIdx]}dequeue(){const e=this.items[this.firstIdx];return this.firstIdx++,e}takeCount(e){const t=this.items.slice(this.firstIdx,this.firstIdx+e);return this.firstIdx+=e,t}}const gC=class gC{constructor(e){this.iterate=e}toArray(){const e=[];return this.iterate(t=>(e.push(t),!0)),e}filter(e){return new gC(t=>this.iterate(i=>e(i)?t(i):!0))}map(e){return new gC(t=>this.iterate(i=>t(e(i))))}findLast(e){let t;return this.iterate(i=>(e(i)&&(t=i),!0)),t}findLastMaxBy(e){let t,i=!0;return this.iterate(n=>((i||oh.isGreaterThan(e(n,t)))&&(i=!1,t=n),!0)),t}};gC.empty=new gC(e=>{});let of=gC;class Cy{constructor(e){this._indexMap=e}static createSortPermutation(e,t){const i=Array.from(e.keys()).sort((n,s)=>t(e[n],e[s]));return new Cy(i)}apply(e){return e.map((t,i)=>e[this._indexMap[i]])}inverse(){const e=this._indexMap.slice();for(let t=0;t<this._indexMap.length;t++)e[this._indexMap[t]]=t;return new Cy(e)}}function vy(o){return o.reduce((e,t)=>e+t,0)}const Ro=(o,e)=>o===e;function f1(o=Ro){return(e,t)=>Ut(e,t,o)}function UR(){return(o,e)=>o.equals(e)}function rf(o,e,t){if(t!==void 0){const i=o;return i==null||e===void 0||e===null?e===i:t(i,e)}else{const i=o;return(n,s)=>n==null||s===void 0||s===null?s===n:i(n,s)}}function $R(o,e){if(o===e)return!0;if(Array.isArray(o)&&Array.isArray(e)){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!$R(o[t],e[t]))return!1;return!0}if(o&&typeof o=="object"&&e&&typeof e=="object"&&Object.getPrototypeOf(o)===Object.prototype&&Object.getPrototypeOf(e)===Object.prototype){const t=o,i=e,n=Object.keys(t),s=Object.keys(i),r=new Set(s);if(n.length!==s.length)return!1;for(const a of n)if(!r.has(a)||!$R(t[a],i[a]))return!1;return!0}return!1}function M6(o){const e=new Error("BugIndicatingErrorRecovery: "+o);Ee(e),console.error("recovered from an error that indicates a bug",e)}let af;function Sne(o){af?af instanceof P6?af.loggers.push(o):af=new P6([af,o]):af=o}function Wn(){return af}class P6{constructor(e){this.loggers=e}handleObservableCreated(e,t){for(const i of this.loggers)i.handleObservableCreated(e,t)}handleOnListenerCountChanged(e,t){for(const i of this.loggers)i.handleOnListenerCountChanged(e,t)}handleObservableUpdated(e,t){for(const i of this.loggers)i.handleObservableUpdated(e,t)}handleAutorunCreated(e,t){for(const i of this.loggers)i.handleAutorunCreated(e,t)}handleAutorunDisposed(e){for(const t of this.loggers)t.handleAutorunDisposed(e)}handleAutorunDependencyChanged(e,t,i){for(const n of this.loggers)n.handleAutorunDependencyChanged(e,t,i)}handleAutorunStarted(e){for(const t of this.loggers)t.handleAutorunStarted(e)}handleAutorunFinished(e){for(const t of this.loggers)t.handleAutorunFinished(e)}handleDerivedDependencyChanged(e,t,i){for(const n of this.loggers)n.handleDerivedDependencyChanged(e,t,i)}handleDerivedCleared(e){for(const t of this.loggers)t.handleDerivedCleared(e)}handleBeginTransaction(e){for(const t of this.loggers)t.handleBeginTransaction(e)}handleEndTransaction(e){for(const t of this.loggers)t.handleEndTransaction(e)}}function Dt(o,e){const t=new Pm(o,e);try{o(t)}finally{t.finish()}}let wy;function g1(o){if(wy)o(wy);else{const e=new Pm(o,void 0);wy=e;try{o(e)}finally{e.finish(),wy=void 0}}}async function yne(o,e){const t=new Pm(o,e);try{await o(t)}finally{t.finish()}}function lf(o,e,t){o?e(o):Dt(e,t)}class Pm{constructor(e,t){this._fn=e,this._getDebugName=t,this._updatingObservers=[],Wn()?.handleBeginTransaction(this)}getDebugName(){return this._getDebugName?this._getDebugName():OR(this._fn)}updateObserver(e,t){if(!this._updatingObservers){M6("Transaction already finished!"),Dt(i=>{i.updateObserver(e,t)});return}this._updatingObservers.push({observer:e,observable:t}),e.beginUpdate(t)}finish(){const e=this._updatingObservers;if(!e){M6("transaction.finish() has already been called!");return}for(let t=0;t<e.length;t++){const{observer:i,observable:n}=e[t];i.endUpdate(n)}this._updatingObservers=null,Wn()?.handleEndTransaction(this)}debugGetUpdatingObservers(){return this._updatingObservers}}var Gi;(function(o){let e=!1;function t(){e=!0}o.enable=t;function i(){if(!e)return;const n=Error,s=n.stackTraceLimit;n.stackTraceLimit=3;const r=new Error().stack;return n.stackTraceLimit=s,jR.fromStack(r,2)}o.ofCaller=i})(Gi||(Gi={}));class jR{static fromStack(e,t){const i=e.split(`
`),n=Lne(i[t+1]);if(n)return new jR(n.fileName,n.line,n.column,n.id)}constructor(e,t,i,n){this.fileName=e,this.line=t,this.column=i,this.id=n}}function Lne(o){const e=o.match(/\((.*):(\d+):(\d+)\)/);if(e)return{fileName:e[1],line:parseInt(e[2]),column:parseInt(e[3]),id:o};const t=o.match(/at ([^\(\)]*):(\d+):(\d+)/);if(t)return{fileName:t[1],line:parseInt(t[2]),column:parseInt(t[3]),id:o}}let qR;function xne(o){qR=o}let A6;function kne(o){A6=o}class O6{get TChange(){return null}reportChanges(){this.get()}read(e){return e?e.readObservable(this):this.get()}map(e,t,i=Gi.ofCaller()){const n=t===void 0?void 0:e,s=t===void 0?e:t;return qR({owner:n,debugName:()=>{const r=OR(s);if(r!==void 0)return r;const l=/^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(s.toString());if(l)return`${this.debugName}.${l[2]}`;if(!n)return`${this.debugName} (mapped)`},debugReferenceFn:s},r=>s(this.read(r),r),i)}flatten(){return qR({owner:void 0,debugName:()=>`${this.debugName} (flattened)`},e=>this.read(e).read(e))}recomputeInitiallyAndOnChange(e,t){return e.add(A6(this,t)),this}}class Am extends O6{constructor(e){super(),this._observers=new Set,Wn()?.handleObservableCreated(this,e)}addObserver(e){const t=this._observers.size;this._observers.add(e),t===0&&this.onFirstObserverAdded(),t!==this._observers.size&&Wn()?.handleOnListenerCountChanged(this,this._observers.size)}removeObserver(e){const t=this._observers.delete(e);t&&this._observers.size===0&&this.onLastObserverRemoved(),t&&Wn()?.handleOnListenerCountChanged(this,this._observers.size)}onFirstObserverAdded(){}onLastObserverRemoved(){}debugGetObservers(){return this._observers}}function Le(o,e,t=Gi.ofCaller()){let i;return typeof o=="string"?i=new xn(void 0,o,void 0):i=new xn(o,void 0,void 0),new p1(i,e,Ro,t)}class p1 extends Am{get debugName(){return this._debugNameData.getDebugName(this)??"ObservableValue"}constructor(e,t,i,n){super(n),this._debugNameData=e,this._equalityComparator=i,this._value=t,Wn()?.handleObservableUpdated(this,{hadValue:!1,newValue:t,change:void 0,didChange:!0,oldValue:void 0})}get(){return this._value}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new Pm(()=>{},()=>`Setting ${this.debugName}`));try{const s=this._value;this._setValue(e),Wn()?.handleObservableUpdated(this,{oldValue:s,newValue:e,change:i,didChange:!0,hadValue:!0});for(const r of this._observers)t.updateObserver(r,this),r.handleChange(this,i)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}debugGetState(){return{value:this._value}}debugSetValue(e){this._value=e}}function KR(o,e,t=Gi.ofCaller()){let i;return typeof o=="string"?i=new xn(void 0,o,void 0):i=new xn(o,void 0,void 0),new Ine(i,e,Ro,t)}class Ine extends p1{_setValue(e){this._value!==e&&(this._value&&this._value.dispose(),this._value=e)}dispose(){this._value?.dispose()}}class Dne extends Am{get debugName(){return this._debugNameData.getDebugName(this)??"LazyObservableValue"}constructor(e,t,i,n){super(n),this._debugNameData=e,this._equalityComparator=i,this._isUpToDate=!0,this._deltas=[],this._updateCounter=0,this._value=t}get(){return this._update(),this._value}_update(){if(!this._isUpToDate)if(this._isUpToDate=!0,this._deltas.length>0){for(const e of this._deltas){Wn()?.handleObservableUpdated(this,{change:e,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(const t of this._observers)t.handleChange(this,e)}this._deltas.length=0}else{Wn()?.handleObservableUpdated(this,{change:void 0,didChange:!0,oldValue:"(unknown)",newValue:this._value,hadValue:!0});for(const e of this._observers)e.handleChange(this,void 0)}}_beginUpdate(){if(this._updateCounter++,this._updateCounter===1)for(const e of this._observers)e.beginUpdate(this)}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){this._update();const e=[...this._observers];for(const t of e)t.endUpdate(this)}}addObserver(e){const t=!this._observers.has(e)&&this._updateCounter>0;super.addObserver(e),t&&e.beginUpdate(this)}removeObserver(e){const t=this._observers.has(e)&&this._updateCounter>0;super.removeObserver(e),t&&e.endUpdate(this)}set(e,t,i){if(i===void 0&&this._equalityComparator(this._value,e))return;let n;t||(t=n=new Pm(()=>{},()=>`Setting ${this.debugName}`));try{if(this._isUpToDate=!1,this._setValue(e),i!==void 0&&this._deltas.push(i),t.updateObserver({beginUpdate:()=>this._beginUpdate(),endUpdate:()=>this._endUpdate(),handleChange:(s,r)=>{},handlePossibleChange:s=>{}},this),this._updateCounter>1)for(const s of this._observers)s.handlePossibleChange(this)}finally{n&&n.finish()}}toString(){return`${this.debugName}: ${this._value}`}_setValue(e){this._value=e}}function m1(o,e,t=Gi.ofCaller()){return o.lazy?new Dne(new xn(o.owner,o.debugName,void 0),e,o.equalsFn??Ro,t):new p1(new xn(o.owner,o.debugName,void 0),e,o.equalsFn??Ro,t)}function Ene(o){switch(o){case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}class _1{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,n){this._debugNameData=e,this._runFn=t,this._changeTracker=i,this._state=2,this._updateCount=0,this._disposed=!1,this._dependencies=new Set,this._dependenciesToBeRemoved=new Set,this._isRunning=!1,this._store=void 0,this._delayedStore=void 0,this._changeSummary=this._changeTracker?.createChangeSummary(void 0),Wn()?.handleAutorunCreated(this,n),this._run()}dispose(){if(!this._disposed){this._disposed=!0;for(const e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&this._store.dispose(),this._delayedStore!==void 0&&this._delayedStore.dispose(),Wn()?.handleAutorunDisposed(this)}}_run(){const e=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=e,this._state=3;try{if(!this._disposed){Wn()?.handleAutorunStarted(this);const t=this._changeSummary,i=this._delayedStore;i!==void 0&&(this._delayedStore=void 0);try{this._isRunning=!0,this._changeTracker&&(this._changeTracker.beforeUpdate?.(this,t),this._changeSummary=this._changeTracker.createChangeSummary(t)),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._runFn(this,t)}catch(n){GS(n)}finally{this._isRunning=!1,i!==void 0&&i.dispose()}}}finally{this._disposed||Wn()?.handleAutorunFinished(this);for(const t of this._dependenciesToBeRemoved)t.removeObserver(this);this._dependenciesToBeRemoved.clear()}}toString(){return`Autorun<${this.debugName}>`}beginUpdate(e){this._state===3&&(this._state=1),this._updateCount++}endUpdate(e){try{if(this._updateCount===1)do{if(this._state===1){this._state=3;for(const t of this._dependencies)if(t.reportChanges(),this._state===2)break}this._state!==3&&this._run()}while(this._state!==3)}finally{this._updateCount--}Xd(()=>this._updateCount>=0)}handlePossibleChange(e){this._state===3&&this._isDependency(e)&&(this._state=1)}handleChange(e,t){if(this._isDependency(e)){Wn()?.handleAutorunDependencyChanged(this,e,t);try{(this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:n=>n===e},this._changeSummary):!0)&&(this._state=2)}catch(i){GS(i)}}}_isDependency(e){return this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)}_ensureNoRunning(){if(!this._isRunning)throw new Ce("The reader object cannot be used outside its compute function!")}readObservable(e){if(this._ensureNoRunning(),this._disposed)return e.get();e.addObserver(this);const t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}get store(){if(this._ensureNoRunning(),this._disposed)throw new Ce("Cannot access store after dispose");return this._store===void 0&&(this._store=new U),this._store}debugGetState(){return{isRunning:this._isRunning,updateCount:this._updateCount,dependencies:this._dependencies,state:this._state,stateStr:Ene(this._state)}}debugRerun(){this._isRunning?this._state=2:this._run()}}function Se(o,e=Gi.ofCaller()){return new _1(new xn(void 0,void 0,o),o,void 0,e)}function Sy(o,e,t=Gi.ofCaller()){return new _1(new xn(o.owner,o.debugName,o.debugReferenceFn??e),e,void 0,t)}function Om(o,e,t=Gi.ofCaller()){return new _1(new xn(o.owner,o.debugName,o.debugReferenceFn??e),e,o.changeTracker,t)}function Nne(o,e){const t=new U,i=Om({owner:o.owner,debugName:o.debugName,debugReferenceFn:o.debugReferenceFn??e,changeTracker:o.changeTracker},(n,s)=>{t.clear(),e(n,s,t)});return ue(()=>{i.dispose(),t.dispose()})}function Bn(o){const e=new U,t=Sy({owner:void 0,debugName:void 0,debugReferenceFn:o},i=>{e.clear(),o(i,e)});return ue(()=>{t.dispose(),e.dispose()})}function Tne(o,e){let t;return Sy({debugReferenceFn:e},i=>{const n=o.read(i),s=t;t=n,e({lastValue:s,newValue:n})})}function Rne(o){switch(o){case 0:return"initial";case 1:return"dependenciesMightHaveChanged";case 2:return"stale";case 3:return"upToDate";default:return"<unknown>"}}class pr extends Am{get debugName(){return this._debugNameData.getDebugName(this)??"(anonymous)"}constructor(e,t,i,n=void 0,s,r){super(r),this._debugNameData=e,this._computeFn=t,this._changeTracker=i,this._handleLastObserverRemoved=n,this._equalityComparator=s,this._state=0,this._value=void 0,this._updateCount=0,this._dependencies=new Set,this._dependenciesToBeRemoved=new Set,this._changeSummary=void 0,this._isUpdating=!1,this._isComputing=!1,this._didReportChange=!1,this._isInBeforeUpdate=!1,this._isReaderValid=!1,this._store=void 0,this._delayedStore=void 0,this._removedObserverToCallEndUpdateOn=null,this._changeSummary=this._changeTracker?.createChangeSummary(void 0)}onLastObserverRemoved(){this._state=0,this._value=void 0,Wn()?.handleDerivedCleared(this);for(const e of this._dependencies)e.removeObserver(this);this._dependencies.clear(),this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._delayedStore!==void 0&&(this._delayedStore.dispose(),this._delayedStore=void 0),this._handleLastObserverRemoved?.()}get(){if(this._isComputing,this._observers.size===0){let t;try{this._isReaderValid=!0;let i;this._changeTracker&&(i=this._changeTracker.createChangeSummary(void 0),this._changeTracker.beforeUpdate?.(this,i)),t=this._computeFn(this,i)}finally{this._isReaderValid=!1}return this.onLastObserverRemoved(),t}else{do{if(this._state===1){for(const t of this._dependencies)if(t.reportChanges(),this._state===2)break}this._state===1&&(this._state=3),this._state!==3&&this._recompute()}while(this._state!==3);return this._value}}_recompute(){let e=!1;this._isComputing=!0,this._didReportChange=!1;const t=this._dependenciesToBeRemoved;this._dependenciesToBeRemoved=this._dependencies,this._dependencies=t;try{const i=this._changeSummary;this._isReaderValid=!0,this._changeTracker&&(this._isInBeforeUpdate=!0,this._changeTracker.beforeUpdate?.(this,i),this._isInBeforeUpdate=!1,this._changeSummary=this._changeTracker?.createChangeSummary(i));const n=this._state!==0,s=this._value;this._state=3;const r=this._delayedStore;r!==void 0&&(this._delayedStore=void 0);try{this._store!==void 0&&(this._store.dispose(),this._store=void 0),this._value=this._computeFn(this,i)}finally{this._isReaderValid=!1;for(const a of this._dependenciesToBeRemoved)a.removeObserver(this);this._dependenciesToBeRemoved.clear(),r!==void 0&&r.dispose()}e=this._didReportChange||n&&!this._equalityComparator(s,this._value),Wn()?.handleObservableUpdated(this,{oldValue:s,newValue:this._value,change:void 0,didChange:e,hadValue:n})}catch(i){GS(i)}if(this._isComputing=!1,!this._didReportChange&&e)for(const i of this._observers)i.handleChange(this,void 0);else this._didReportChange=!1}toString(){return`LazyDerived<${this.debugName}>`}beginUpdate(e){if(this._isUpdating)throw new Ce("Cyclic deriveds are not supported yet!");this._updateCount++,this._isUpdating=!0;try{const t=this._updateCount===1;if(this._state===3&&(this._state=1,!t))for(const i of this._observers)i.handlePossibleChange(this);if(t)for(const i of this._observers)i.beginUpdate(this)}finally{this._isUpdating=!1}}endUpdate(e){if(this._updateCount--,this._updateCount===0){const t=[...this._observers];for(const i of t)i.endUpdate(this);if(this._removedObserverToCallEndUpdateOn){const i=[...this._removedObserverToCallEndUpdateOn];this._removedObserverToCallEndUpdateOn=null;for(const n of i)n.endUpdate(this)}}Xd(()=>this._updateCount>=0)}handlePossibleChange(e){if(this._state===3&&this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)){this._state=1;for(const t of this._observers)t.handlePossibleChange(this)}}handleChange(e,t){if(this._dependencies.has(e)&&!this._dependenciesToBeRemoved.has(e)||this._isInBeforeUpdate){Wn()?.handleDerivedDependencyChanged(this,e,t);let i=!1;try{i=this._changeTracker?this._changeTracker.handleChange({changedObservable:e,change:t,didChange:s=>s===e},this._changeSummary):!0}catch(s){GS(s)}const n=this._state===3;if(i&&(this._state===1||n)&&(this._state=2,n))for(const s of this._observers)s.handlePossibleChange(this)}}_ensureReaderValid(){if(!this._isReaderValid)throw new Ce("The reader object cannot be used outside its compute function!")}readObservable(e){this._ensureReaderValid(),e.addObserver(this);const t=e.get();return this._dependencies.add(e),this._dependenciesToBeRemoved.delete(e),t}get store(){return this._ensureReaderValid(),this._store===void 0&&(this._store=new U),this._store}addObserver(e){const t=!this._observers.has(e)&&this._updateCount>0;super.addObserver(e),t&&(this._removedObserverToCallEndUpdateOn&&this._removedObserverToCallEndUpdateOn.has(e)?this._removedObserverToCallEndUpdateOn.delete(e):e.beginUpdate(this))}removeObserver(e){this._observers.has(e)&&this._updateCount>0&&(this._removedObserverToCallEndUpdateOn||(this._removedObserverToCallEndUpdateOn=new Set),this._removedObserverToCallEndUpdateOn.add(e)),super.removeObserver(e)}debugGetState(){return{state:this._state,stateStr:Rne(this._state),updateCount:this._updateCount,isComputing:this._isComputing,dependencies:this._dependencies,value:this._value}}debugSetValue(e){this._value=e}debugRecompute(){this._isComputing?this._state=2:this._recompute()}setValue(e,t,i){this._value=e;const n=this._observers;t.updateObserver(this,this);for(const s of n)s.handleChange(this,i)}}class F6 extends pr{constructor(e,t,i,n=void 0,s,r,a){super(e,t,i,n,s,a),this.set=r}}function j(o,e,t=Gi.ofCaller()){return e!==void 0?new pr(new xn(o,void 0,e),e,void 0,void 0,Ro,t):new pr(new xn(void 0,void 0,o),o,void 0,void 0,Ro,t)}function GR(o,e,t,i=Gi.ofCaller()){return new F6(new xn(o,void 0,e),e,void 0,void 0,Ro,t,i)}function In(o,e,t=Gi.ofCaller()){return new pr(new xn(o.owner,o.debugName,o.debugReferenceFn),e,void 0,o.onLastObserverRemoved,o.equalsFn??Ro,t)}xne(In);function W6(o,e,t=Gi.ofCaller()){return new pr(new xn(o.owner,o.debugName,void 0),e,o.changeTracker,void 0,o.equalityComparer??Ro,t)}function mr(o,e,t=Gi.ofCaller()){let i,n;e===void 0?(i=o,n=void 0):(n=o,i=e);let s;return new pr(new xn(n,void 0,i),r=>{s?s.clear():s=new U;const a=i(r);return a&&s.add(a),a},void 0,()=>{s&&(s.dispose(),s=void 0)},Ro,t)}class Mne{constructor(e){this._value=Le(this,void 0),this.promiseResult=this._value,this.promise=e.then(t=>(Dt(i=>{this._value.set(new B6(t,void 0),i)}),t),t=>{throw Dt(i=>{this._value.set(new B6(void 0,t),i)}),t})}}class B6{constructor(e,t){this.data=e,this.error=t}getDataOrThrow(){if(this.error)throw this.error;return this.data}}function H6(o,e,t,i){return e||(e=n=>n!=null),new Promise((n,s)=>{let r=!0,a=!1;const l=o.map(d=>({isFinished:e(d),error:t?t(d):!1,state:d})),c=Se(d=>{const{isFinished:h,error:u,state:f}=l.read(d);(h||u)&&(r?a=!0:c.dispose(),u?s(u===!0?f:u):n(f))});if(i){const d=i.onCancellationRequested(()=>{c.dispose(),d.dispose(),s(new cr)});if(i.isCancellationRequested){c.dispose(),d.dispose(),s(new cr);return}}r=!1,a&&c.dispose()})}function rt(...o){let e,t,i,n;return o.length===2?[t,i]=o:[e,t,i,n]=o,new Nc(new xn(e,void 0,i),t,i,()=>Nc.globalTransaction,Ro,n??Gi.ofCaller())}function V6(o,e,t,i=Gi.ofCaller()){return new Nc(new xn(o.owner,o.debugName,o.debugReferenceFn??t),e,t,()=>Nc.globalTransaction,o.equalsFn??Ro,i)}class Nc extends Am{constructor(e,t,i,n,s,r){super(r),this._debugNameData=e,this.event=t,this._getValue=i,this._getTransaction=n,this._equalityComparator=s,this._hasValue=!1,this.handleEvent=a=>{const l=this._getValue(a),c=this._value,d=!this._hasValue||!this._equalityComparator(c,l);let h=!1;d&&(this._value=l,this._hasValue&&(h=!0,lf(this._getTransaction(),u=>{Wn()?.handleObservableUpdated(this,{oldValue:c,newValue:l,change:void 0,didChange:d,hadValue:this._hasValue});for(const f of this._observers)u.updateObserver(f,this),f.handleChange(this,void 0)},()=>{const u=this.getDebugName();return"Event fired"+(u?`: ${u}`:"")})),this._hasValue=!0),h||Wn()?.handleObservableUpdated(this,{oldValue:c,newValue:l,change:void 0,didChange:d,hadValue:this._hasValue})}}getDebugName(){return this._debugNameData.getDebugName(this)}get debugName(){const e=this.getDebugName();return"From Event"+(e?`: ${e}`:"")}onFirstObserverAdded(){this._subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this._subscription.dispose(),this._subscription=void 0,this._hasValue=!1,this._value=void 0}get(){return this._subscription?(this._hasValue||this.handleEvent(void 0),this._value):this._getValue(void 0)}debugSetValue(e){this._value=e}debugGetState(){return{value:this._value,hasValue:this._hasValue}}}(function(o){o.Observer=Nc;function e(t,i){let n=!1;Nc.globalTransaction===void 0&&(Nc.globalTransaction=t,n=!0);try{i()}finally{n&&(Nc.globalTransaction=void 0)}}o.batchEventsGlobally=e})(rt||(rt={}));function _r(o,e=Gi.ofCaller()){return typeof o=="string"?new z6(o,void 0,e):new z6(void 0,o,e)}class z6 extends Am{get debugName(){return new xn(this._owner,this._debugName,void 0).getDebugName(this)??"Observable Signal"}toString(){return this.debugName}constructor(e,t,i){super(i),this._debugName=e,this._owner=t}trigger(e,t){if(!e){Dt(i=>{this.trigger(i,t)},()=>`Trigger signal ${this.debugName}`);return}for(const i of this._observers)e.updateObserver(i,this),i.handleChange(this,t)}get(){}}function U6(o,e){let t=!1,i,n;return rt(s=>{const r=Se(a=>{const l=o.read(a);t?(n&&clearTimeout(n),n=setTimeout(()=>{i=l,s()},e)):(t=!0,i=l)});return{dispose(){r.dispose(),t=!1,i=void 0}}},()=>t?i:o.get())}function Fm(o,e){const t=new Pne(!0,e);o.addObserver(t);try{t.beginUpdate(o)}finally{t.endUpdate(o)}return ue(()=>{o.removeObserver(t)})}kne(Fm);class Pne{constructor(e,t){this._forceRecompute=e,this._handleValue=t,this._counter=0}beginUpdate(e){this._counter++}endUpdate(e){this._counter===1&&this._forceRecompute&&(this._handleValue?this._handleValue(e.get()):e.reportChanges()),this._counter--}handlePossibleChange(e){}handleChange(e,t){}}function Tc(o,e){let t;return In({owner:o,debugReferenceFn:e},n=>(t=e(n,t),t))}function ZR(o,e,t,i){let n=new $6(t,i);return In({debugReferenceFn:t,owner:o,onLastObserverRemoved:()=>{n.dispose(),n=new $6(t)}},r=>(n.setItems(e.read(r)),n.getItems()))}let $6=class{constructor(e,t){this._map=e,this._keySelector=t,this._cache=new Map,this._items=[]}dispose(){this._cache.forEach(e=>e.store.dispose()),this._cache.clear()}setItems(e){const t=[],i=new Set(this._cache.keys());for(const n of e){const s=this._keySelector?this._keySelector(n):n;let r=this._cache.get(s);if(r)i.delete(s);else{const a=new U;r={out:this._map(n,a),store:a},this._cache.set(s,r)}t.push(r.out)}for(const n of i)this._cache.get(n).store.dispose(),this._cache.delete(n);this._items=t}getItems(){return this._items}};function Ane(o){return{createChangeSummary:e=>({changes:[]}),handleChange(e,t){for(const i in o)e.didChange(o[i])&&t.changes.push({key:i,change:e.change});return!0},beforeUpdate(e,t){for(const i in o){if(i==="changes")throw new Ce('property name "changes" is reserved for change tracking');t[i]=o[i].read(e)}}}}function One(o){let e;return{createChangeSummary:t=>({changes:[]}),handleChange(t,i){e||(e=o());for(const n in e)t.didChange(e[n])&&i.changes.push({key:n,change:t.change});return!0},beforeUpdate(t,i){e||(e=o());for(const n in e){if(n==="changes")throw new Ce('property name "changes" is reserved for change tracking');i[n]=e[n].read(t)}}}}function Et(o){return new Fne(o)}class Fne extends O6{constructor(e){super(),this.value=e}get debugName(){return this.toString()}get(){return this.value}addObserver(e){}removeObserver(e){}toString(){return`Const: ${this.value}`}}function co(o,e,t=Gi.ofCaller()){return new Wne(typeof o=="string"?o:new xn(o,void 0,void 0),e,t)}class Wne extends Am{constructor(e,t,i){super(i),this.event=t,this.handleEvent=()=>{Dt(n=>{for(const s of this._observers)n.updateObserver(s,this),s.handleChange(this,void 0)},()=>this.debugName)},this.debugName=typeof e=="string"?e:e.getDebugName(this)??"Observable Signal From Event"}onFirstObserverAdded(){this.subscription=this.event(this.handleEvent)}onLastObserverRemoved(){this.subscription.dispose(),this.subscription=void 0}get(){}}function Sa(o,e){let t,i=!0;return Nne({changeTracker:{createChangeSummary:()=>({deltas:[],didChange:!1}),handleChange:(n,s)=>{if(n.didChange(o)){const r=n.change;r!==void 0&&s.deltas.push(r),s.didChange=!0}return!0}}},(n,s)=>{const r=o.read(n),a=t;s.didChange&&(t=r,e(r,a,s.deltas)),i&&(i=!1,t=r)})}function j6(o,e){const t=new U,i=Sa(o,(n,s,r)=>{t.clear(),e(n,s,r,t)});return{dispose(){i.dispose(),t.dispose()}}}function Bne(o,e){return j6(o,(t,i,n,s)=>{e(t,i,n,cR(s))})}function Hne(o,e){return Tc(o,(t,i)=>i??e(t))}function Wm(o,e){switch(typeof o){case"number":return""+o;case"string":return o.length+2<=e?`"${o}"`:`"${o.substr(0,e-7)}"+...`;case"boolean":return o?"true":"false";case"undefined":return"undefined";case"object":return o===null?"null":Array.isArray(o)?Vne(o,e):zne(o,e);case"symbol":return o.toString();case"function":return`[[Function${o.name?" "+o.name:""}]]`;default:return""+o}}function Vne(o,e){let t="[ ",i=!0;for(const n of o){if(i||(t+=", "),t.length-5>e){t+="...";break}i=!1,t+=`${Wm(n,e-t.length)}`}return t+=" ]",t}function zne(o,e){if(typeof o.toString=="function"&&o.toString!==Object.prototype.toString){const s=o.toString();return s.length<=e?s:s.substring(0,e-3)+"..."}const t=x6(o);let i=t?t+"(":"{ ",n=!0;for(const[s,r]of Object.entries(o)){if(n||(i+=", "),i.length-5>e){i+="...";break}n=!1,i+=`${s}: ${Wm(r,e-i.length)}`}return i+=t?")":" }",i}class YR{static createClient(e,t){return new YR(e,t)}constructor(e,t){this._channelFactory=e,this._getHandler=t,this._channel=this._channelFactory({handleNotification:s=>{const r=s,a=this._getHandler().notifications[r[0]];if(!a)throw new Error(`Unknown notification "${r[0]}"!`);a(...r[1])},handleRequest:s=>{const r=s;try{return{type:"result",value:this._getHandler().requests[r[0]](...r[1])}}catch(a){return{type:"error",value:a}}}});const i=new Proxy({},{get:(s,r)=>async(...a)=>{const l=await this._channel.sendRequest([r,a]);if(l.type==="error")throw l.value;return l.value}}),n=new Proxy({},{get:(s,r)=>(...a)=>{this._channel.sendNotification([r,a])}});this.api={notifications:n,requests:i}}}function Une(o,e){const t=globalThis;let i=[],n;const{channel:s,handler:r}=$ne({sendNotification:l=>{n?n.sendNotification(l):i.push(l)}});let a;return(t.$$debugValueEditor_debugChannels??(t.$$debugValueEditor_debugChannels={}))[o]=l=>{a=e(),n=l;for(const c of i)l.sendNotification(c);return i=[],r},YR.createClient(s,()=>{if(!a)throw new Error("Not supported");return a})}function $ne(o){let e;return{channel:i=>(e=i,{sendNotification:n=>{o.sendNotification(n)},sendRequest:n=>{throw new Error("not supported")}}),handler:{handleRequest:i=>i.type==="notification"?e?.handleNotification(i.data):e?.handleRequest(i.data)}}}class jne{constructor(){this._timeout=void 0}throttle(e,t){this._timeout===void 0&&(this._timeout=setTimeout(()=>{this._timeout=void 0,e()},t))}dispose(){this._timeout!==void 0&&clearTimeout(this._timeout)}}function q6(o,e){for(const t in e)o[t]&&typeof o[t]=="object"&&e[t]&&typeof e[t]=="object"?q6(o[t],e[t]):o[t]=e[t]}function K6(o,e){for(const t in e)e[t]===null?delete o[t]:o[t]&&typeof o[t]=="object"&&e[t]&&typeof e[t]=="object"?K6(o[t],e[t]):o[t]=e[t]}const bp=class bp{static getInstance(){return bp._instance===void 0&&(bp._instance=new bp),bp._instance}getTransactionState(){const e=[],t=[...this._activeTransactions];if(t.length===0)return;const i=t.flatMap(s=>s.debugGetUpdatingObservers()??[]).map(s=>s.observer),n=new Set;for(;i.length>0;){const s=i.shift();if(n.has(s))continue;n.add(s);const r=this._getInfo(s,a=>{n.has(a)||i.push(a)});r&&e.push(r)}return{names:t.map(s=>s.getDebugName()??"tx"),affected:e}}_getObservableInfo(e){const t=this._instanceInfos.get(e);if(!t){Ee(new Ce("No info found"));return}return t}_getAutorunInfo(e){const t=this._instanceInfos.get(e);if(!t){Ee(new Ce("No info found"));return}return t}_getInfo(e,t){if(e instanceof pr){const i=[...e.debugGetObservers()];for(const l of i)t(l);const n=this._getObservableInfo(e);if(!n)return;const s=e.debugGetState(),r={name:e.debugName,instanceId:n.instanceId,updateCount:s.updateCount},a=[...n.changedObservables].map(l=>this._instanceInfos.get(l)?.instanceId).filter(sn);if(s.isComputing)return{...r,type:"observable/derived",state:"updating",changedDependencies:a,initialComputation:!1};switch(s.state){case 0:return{...r,type:"observable/derived",state:"noValue"};case 3:return{...r,type:"observable/derived",state:"upToDate"};case 2:return{...r,type:"observable/derived",state:"stale",changedDependencies:a};case 1:return{...r,type:"observable/derived",state:"possiblyStale"}}}else if(e instanceof _1){const i=this._getAutorunInfo(e);if(!i)return;const n={name:e.debugName,instanceId:i.instanceId,updateCount:i.updateCount},s=[...i.changedObservables].map(r=>this._instanceInfos.get(r).instanceId);if(e.debugGetState().isRunning)return{...n,type:"autorun",state:"updating",changedDependencies:s};switch(e.debugGetState().state){case 3:return{...n,type:"autorun",state:"upToDate"};case 2:return{...n,type:"autorun",state:"stale",changedDependencies:s};case 1:return{...n,type:"autorun",state:"possiblyStale"}}}}_formatObservable(e){const t=this._getObservableInfo(e);if(t)return{name:e.debugName,instanceId:t.instanceId}}_formatObserver(e){if(e instanceof pr)return{name:e.toString(),instanceId:this._getObservableInfo(e)?.instanceId};const t=this._getAutorunInfo(e);if(t)return{name:e.toString(),instanceId:t.instanceId}}constructor(){this._declarationId=0,this._instanceId=0,this._declarations=new Map,this._instanceInfos=new WeakMap,this._aliveInstances=new Map,this._activeTransactions=new Set,this._channel=Une("observableDevTools",()=>({notifications:{setDeclarationIdFilter:e=>{},logObservableValue:e=>{console.log("logObservableValue",e)},flushUpdates:()=>{this._flushUpdates()},resetUpdates:()=>{this._pendingChanges=null,this._channel.api.notifications.handleChange(this._fullState,!0)}},requests:{getDeclarations:()=>{const e={};for(const t of this._declarations.values())e[t.id]=t;return{decls:e}},getSummarizedInstances:()=>null,getObservableValueInfo:e=>({observers:[...this._aliveInstances.get(e).debugGetObservers()].map(i=>this._formatObserver(i)).filter(sn)}),getDerivedInfo:e=>{const t=this._aliveInstances.get(e);return{dependencies:[...t.debugGetState().dependencies].map(i=>this._formatObservable(i)).filter(sn),observers:[...t.debugGetObservers()].map(i=>this._formatObserver(i)).filter(sn)}},getAutorunInfo:e=>({dependencies:[...this._aliveInstances.get(e).debugGetState().dependencies].map(i=>this._formatObservable(i)).filter(sn)}),getTransactionState:()=>this.getTransactionState(),setValue:(e,t)=>{const i=this._aliveInstances.get(e);if(i instanceof pr)i.debugSetValue(t);else if(i instanceof p1)i.debugSetValue(t);else if(i instanceof Nc)i.debugSetValue(t);else throw new Ce("Observable is not supported");const n=[...i.debugGetObservers()];for(const s of n)s.beginUpdate(i);for(const s of n)s.handleChange(i,void 0);for(const s of n)s.endUpdate(i)},getValue:e=>{const t=this._aliveInstances.get(e);if(t instanceof pr)return Wm(t.debugGetState().value,200);if(t instanceof p1)return Wm(t.debugGetState().value,200)},logValue:e=>{const t=this._aliveInstances.get(e);if(t&&"get"in t)console.log("Logged Value:",t.get());else throw new Ce("Observable is not supported")},rerun:e=>{const t=this._aliveInstances.get(e);if(t instanceof pr)t.debugRecompute();else if(t instanceof _1)t.debugRerun();else throw new Ce("Observable is not supported")}}})),this._pendingChanges=null,this._changeThrottler=new jne,this._fullState={},this._flushUpdates=()=>{this._pendingChanges!==null&&(this._channel.api.notifications.handleChange(this._pendingChanges,!1),this._pendingChanges=null)},Gi.enable()}_handleChange(e){K6(this._fullState,e),this._pendingChanges===null?this._pendingChanges=e:q6(this._pendingChanges,e),this._changeThrottler.throttle(this._flushUpdates,10)}_getDeclarationId(e,t){if(!t)return-1;let i=this._declarations.get(t.id);return i===void 0&&(i={id:this._declarationId++,type:e,url:t.fileName,line:t.line,column:t.column},this._declarations.set(t.id,i),this._handleChange({decls:{[i.id]:i}})),i.id}handleObservableCreated(e,t){const n={declarationId:this._getDeclarationId("observable/value",t),instanceId:this._instanceId++,listenerCount:0,lastValue:void 0,updateCount:0,changedObservables:new Set};this._instanceInfos.set(e,n)}handleOnListenerCountChanged(e,t){const i=this._getObservableInfo(e);if(i){if(i.listenerCount===0&&t>0){const n=e instanceof pr?"observable/derived":"observable/value";this._aliveInstances.set(i.instanceId,e),this._handleChange({instances:{[i.instanceId]:{instanceId:i.instanceId,declarationId:i.declarationId,formattedValue:i.lastValue,type:n,name:e.debugName}}})}else i.listenerCount>0&&t===0&&(this._handleChange({instances:{[i.instanceId]:null}}),this._aliveInstances.delete(i.instanceId));i.listenerCount=t}}handleObservableUpdated(e,t){if(e instanceof pr){this._handleDerivedRecomputed(e,t);return}const i=this._getObservableInfo(e);i&&t.didChange&&(i.lastValue=Wm(t.newValue,30),i.listenerCount>0&&this._handleChange({instances:{[i.instanceId]:{formattedValue:i.lastValue}}}))}handleAutorunCreated(e,t){const n={declarationId:this._getDeclarationId("autorun",t),instanceId:this._instanceId++,updateCount:0,changedObservables:new Set};this._instanceInfos.set(e,n),this._aliveInstances.set(n.instanceId,e),n&&this._handleChange({instances:{[n.instanceId]:{instanceId:n.instanceId,declarationId:n.declarationId,runCount:0,type:"autorun",name:e.debugName}}})}handleAutorunDisposed(e){const t=this._getAutorunInfo(e);t&&(this._handleChange({instances:{[t.instanceId]:null}}),this._instanceInfos.delete(e),this._aliveInstances.delete(t.instanceId))}handleAutorunDependencyChanged(e,t,i){const n=this._getAutorunInfo(e);n&&n.changedObservables.add(t)}handleAutorunStarted(e){}handleAutorunFinished(e){const t=this._getAutorunInfo(e);t&&(t.changedObservables.clear(),t.updateCount++,this._handleChange({instances:{[t.instanceId]:{runCount:t.updateCount}}}))}handleDerivedDependencyChanged(e,t,i){const n=this._getObservableInfo(e);n&&n.changedObservables.add(t)}_handleDerivedRecomputed(e,t){const i=this._getObservableInfo(e);if(!i)return;const n=Wm(t.newValue,30);i.updateCount++,i.changedObservables.clear(),i.lastValue=n,i.listenerCount>0&&this._handleChange({instances:{[i.instanceId]:{formattedValue:n,recomputationCount:i.updateCount}}})}handleDerivedCleared(e){const t=this._getObservableInfo(e);t&&(t.lastValue=void 0,t.changedObservables.clear(),t.listenerCount>0&&this._handleChange({instances:{[t.instanceId]:{formattedValue:void 0}}}))}handleBeginTransaction(e){this._activeTransactions.add(e)}handleEndTransaction(e){this._activeTransactions.delete(e)}};bp._instance=void 0;let XR=bp;xR&&xR.VSCODE_DEV_DEBUG_OBSERVABLES&&Sne(XR.getInstance());const{getWindow:me,getDocument:qne,getWindows:G6,getWindowsCount:Kne,getWindowId:b1,getWindowById:Z6,onDidRegisterWindow:C1,onWillUnregisterWindow:Gne,onDidUnregisterWindow:Zne}=(function(){const o=new Map;Nte(bt,1);const e={window:bt,disposables:new U};o.set(bt.vscodeWindowId,e);const t=new P,i=new P,n=new P;function s(r,a){return(typeof r=="number"?o.get(r):void 0)??(a?e:void 0)}return{onDidRegisterWindow:t.event,onWillUnregisterWindow:n.event,onDidUnregisterWindow:i.event,registerWindow(r){if(o.has(r.vscodeWindowId))return A.None;const a=new U,l={window:r,disposables:a.add(new U)};return o.set(r.vscodeWindowId,l),a.add(ue(()=>{o.delete(r.vscodeWindowId),i.fire(r)})),a.add(W(r,te.BEFORE_UNLOAD,()=>{n.fire(r)})),t.fire(l),a},getWindows(){return o.values()},getWindowsCount(){return o.size},getWindowId(r){return r.vscodeWindowId},hasWindow(r){return o.has(r)},getWindowById:s,getWindow(r){const a=r;if(a?.ownerDocument?.defaultView)return a.ownerDocument.defaultView.window;const l=r;return l?.view?l.view.window:bt},getDocument(r){return me(r).document}}})();function pn(o){for(;o.firstChild;)o.firstChild.remove()}class Yne{constructor(e,t,i,n){this._node=e,this._type=t,this._handler=i,this._options=n||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}}function W(o,e,t,i){return new Yne(o,e,t,i)}function Y6(o,e){return function(t){return e(new yn(o,t))}}function Xne(o){return function(e){return o(new St(e))}}const Si=function(e,t,i,n){let s=i;return t==="click"||t==="mousedown"||t==="contextmenu"?s=Y6(me(e),i):(t==="keydown"||t==="keypress"||t==="keyup")&&(s=Xne(i)),W(e,t,s,n)},Qne=function(e,t,i){const n=Y6(me(e),t);return X6(e,n,i)};function X6(o,e,t){return W(o,ur&&t1.pointerEvents?te.POINTER_DOWN:te.MOUSE_DOWN,e,t)}function Jne(o,e,t){return W(o,ur&&t1.pointerEvents?te.POINTER_MOVE:te.MOUSE_MOVE,e,t)}function Q6(o,e,t){return W(o,ur&&t1.pointerEvents?te.POINTER_UP:te.MOUSE_UP,e,t)}function v1(o,e,t){return s1(o,e,t)}class QR extends ZB{constructor(e,t){super(e,t)}}let yy,Hs;class Ly extends uR{constructor(e){super(),this.defaultTarget=e&&me(e)}cancelAndSet(e,t,i){return super.cancelAndSet(e,t,i??this.defaultTarget)}}class JR{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){Ee(e)}}static sort(e,t){return t.priority-e.priority}}(function(){const o=new Map,e=new Map,t=new Map,i=new Map,n=s=>{t.set(s,!1);const r=o.get(s)??[];for(e.set(s,r),o.set(s,[]),i.set(s,!0);r.length>0;)r.sort(JR.sort),r.shift().execute();i.set(s,!1)};Hs=(s,r,a=0)=>{const l=b1(s),c=new JR(r,a);let d=o.get(l);return d||(d=[],o.set(l,d)),d.push(c),t.get(l)||(t.set(l,!0),s.requestAnimationFrame(()=>n(l))),c},yy=(s,r,a)=>{const l=b1(s);if(i.get(l)){const c=new JR(r,a);let d=e.get(l);return d||(d=[],e.set(l,d)),d.push(c),c}else return Hs(s,r,a)}})();function xy(o){return me(o).getComputedStyle(o,null)}function rh(o,e,t){const i=me(o),n=i.document;if(o!==n.body)return new dt(o.clientWidth,o.clientHeight);if(ur&&i?.visualViewport)return new dt(i.visualViewport.width,i.visualViewport.height);if(i?.innerWidth&&i.innerHeight)return new dt(i.innerWidth,i.innerHeight);if(n.body&&n.body.clientWidth&&n.body.clientHeight)return new dt(n.body.clientWidth,n.body.clientHeight);if(n.documentElement&&n.documentElement.clientWidth&&n.documentElement.clientHeight)return new dt(n.documentElement.clientWidth,n.documentElement.clientHeight);throw new Error("Unable to figure out browser width and height")}class yi{static convertToPixels(e,t){return parseFloat(t)||0}static getDimension(e,t){const i=xy(e),n=i?i.getPropertyValue(t):"0";return yi.convertToPixels(e,n)}static getBorderLeftWidth(e){return yi.getDimension(e,"border-left-width")}static getBorderRightWidth(e){return yi.getDimension(e,"border-right-width")}static getBorderTopWidth(e){return yi.getDimension(e,"border-top-width")}static getBorderBottomWidth(e){return yi.getDimension(e,"border-bottom-width")}static getPaddingLeft(e){return yi.getDimension(e,"padding-left")}static getPaddingRight(e){return yi.getDimension(e,"padding-right")}static getPaddingTop(e){return yi.getDimension(e,"padding-top")}static getPaddingBottom(e){return yi.getDimension(e,"padding-bottom")}static getMarginLeft(e){return yi.getDimension(e,"margin-left")}static getMarginTop(e){return yi.getDimension(e,"margin-top")}static getMarginRight(e){return yi.getDimension(e,"margin-right")}static getMarginBottom(e){return yi.getDimension(e,"margin-bottom")}}const Cp=class Cp{constructor(e,t){this.width=e,this.height=t}with(e=this.width,t=this.height){return e!==this.width||t!==this.height?new Cp(e,t):this}static is(e){return typeof e=="object"&&typeof e.height=="number"&&typeof e.width=="number"}static lift(e){return e instanceof Cp?e:new Cp(e.width,e.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};Cp.None=new Cp(0,0);let dt=Cp;function J6(o){let e=o.offsetParent,t=o.offsetTop,i=o.offsetLeft;for(;(o=o.parentNode)!==null&&o!==o.ownerDocument.body&&o!==o.ownerDocument.documentElement;){t-=o.scrollTop;const n=tH(o)?null:xy(o);n&&(i-=n.direction!=="rtl"?o.scrollLeft:-o.scrollLeft),o===e&&(i+=yi.getBorderLeftWidth(o),t+=yi.getBorderTopWidth(o),t+=o.offsetTop,i+=o.offsetLeft,e=o.offsetParent)}return{left:i,top:t}}function ese(o,e,t){typeof e=="number"&&(o.style.width=`${e}px`),typeof t=="number"&&(o.style.height=`${t}px`)}function mi(o){const e=o.getBoundingClientRect(),t=me(o);return{left:e.left+t.scrollX,top:e.top+t.scrollY,width:e.width,height:e.height}}function eH(o){let e=o,t=1;do{const i=xy(e).zoom;i!=null&&i!=="1"&&(t*=i),e=e.parentElement}while(e!==null&&e!==e.ownerDocument.documentElement);return t}function ho(o){const e=yi.getMarginLeft(o)+yi.getMarginRight(o);return o.offsetWidth+e}function e2(o){const e=yi.getBorderLeftWidth(o)+yi.getBorderRightWidth(o),t=yi.getPaddingLeft(o)+yi.getPaddingRight(o);return o.offsetWidth-e-t}function tse(o){const e=yi.getBorderTopWidth(o)+yi.getBorderBottomWidth(o),t=yi.getPaddingTop(o)+yi.getPaddingBottom(o);return o.offsetHeight-e-t}function Rc(o){const e=yi.getMarginTop(o)+yi.getMarginBottom(o);return o.offsetHeight+e}function Zi(o,e){return!!e?.contains(o)}function ise(o,e,t){for(;o&&o.nodeType===o.ELEMENT_NODE;){if(o.classList.contains(e))return o;if(t){if(typeof t=="string"){if(o.classList.contains(t))return null}else if(o===t)return null}o=o.parentNode}return null}function t2(o,e,t){return!!ise(o,e,t)}function tH(o){return o&&!!o.host&&!!o.mode}function ky(o){return!!ah(o)}function ah(o){for(;o.parentNode;){if(o===o.ownerDocument?.body)return null;o=o.parentNode}return tH(o)?o:null}function Ui(){let o=w1().activeElement;for(;o?.shadowRoot;)o=o.shadowRoot.activeElement;return o}function Iy(o){return Ui()===o}function iH(o){return Zi(Ui(),o)}function w1(){return Kne()<=1?bt.document:Array.from(G6()).map(({window:e})=>e.document).find(e=>e.hasFocus())??bt.document}function ft(){return w1().defaultView?.window??bt}const nse=new class{constructor(){this.mutationObservers=new Map}observe(o,e,t){let i=this.mutationObservers.get(o);i||(i=new Map,this.mutationObservers.set(o,i));const n=h1(t);let s=i.get(n);if(s)s.users+=1;else{const r=new P,a=new MutationObserver(c=>r.fire(c));a.observe(o,t);const l=s={users:1,observer:a,onDidMutate:r.event};e.add(ue(()=>{l.users-=1,l.users===0&&(r.dispose(),a.disconnect(),i?.delete(n),i?.size===0&&this.mutationObservers.delete(o))})),i.set(n,s)}return s.onDidMutate}};function ai(o){return o instanceof HTMLElement||o instanceof me(o).HTMLElement}function nH(o){return o instanceof HTMLAnchorElement||o instanceof me(o).HTMLAnchorElement}function sH(o){return o instanceof SVGElement||o instanceof me(o).SVGElement}function i2(o){return o instanceof MouseEvent||o instanceof me(o).MouseEvent}function Mc(o){return o instanceof KeyboardEvent||o instanceof me(o).KeyboardEvent}const te={CLICK:"click",AUXCLICK:"auxclick",DBLCLICK:"dblclick",MOUSE_UP:"mouseup",MOUSE_DOWN:"mousedown",MOUSE_OVER:"mouseover",MOUSE_MOVE:"mousemove",MOUSE_OUT:"mouseout",MOUSE_ENTER:"mouseenter",MOUSE_LEAVE:"mouseleave",MOUSE_WHEEL:"wheel",POINTER_UP:"pointerup",POINTER_DOWN:"pointerdown",POINTER_MOVE:"pointermove",POINTER_LEAVE:"pointerleave",CONTEXT_MENU:"contextmenu",KEY_DOWN:"keydown",KEY_UP:"keyup",BEFORE_UNLOAD:"beforeunload",FOCUS:"focus",FOCUS_IN:"focusin",FOCUS_OUT:"focusout",BLUR:"blur",INPUT:"input",DRAG_START:"dragstart",DRAG:"drag",DRAG_ENTER:"dragenter",DRAG_LEAVE:"dragleave",DRAG_OVER:"dragover",DROP:"drop",DRAG_END:"dragend"};function sse(o){const e=o;return!!(e&&typeof e.preventDefault=="function"&&typeof e.stopPropagation=="function")}const st={stop:(o,e)=>(o.preventDefault(),e&&o.stopPropagation(),o)};function ose(o){const e=[];for(let t=0;o&&o.nodeType===o.ELEMENT_NODE;t++)e[t]=o.scrollTop,o=o.parentNode;return e}function rse(o,e){for(let t=0;o&&o.nodeType===o.ELEMENT_NODE;t++)o.scrollTop!==e[t]&&(o.scrollTop=e[t]),o=o.parentNode}let ase=class xB extends A{get onDidFocus(){return this._onDidFocus.event}get onDidBlur(){return this._onDidBlur.event}static hasFocusWithin(e){if(ai(e)){const t=ah(e),i=t?t.activeElement:e.ownerDocument.activeElement;return Zi(i,e)}else{const t=e;return Zi(t.document.activeElement,t.document)}}constructor(e){super(),this._onDidFocus=this._register(new P),this._onDidBlur=this._register(new P);let t=xB.hasFocusWithin(e),i=!1;const n=()=>{i=!1,t||(t=!0,this._onDidFocus.fire())},s=()=>{t&&(i=!0,(ai(e)?me(e):e).setTimeout(()=>{i&&(i=!1,t=!1,this._onDidBlur.fire())},0))};this._refreshStateHandler=()=>{xB.hasFocusWithin(e)!==t&&(t?s():n())},this._register(W(e,te.FOCUS,n,!0)),this._register(W(e,te.BLUR,s,!0)),ai(e)&&(this._register(W(e,te.FOCUS_IN,()=>this._refreshStateHandler())),this._register(W(e,te.FOCUS_OUT,()=>this._refreshStateHandler())))}};function br(o){return new ase(o)}function lse(o,e){return o.after(e),e}function Z(o,...e){if(o.append(...e),e.length===1&&typeof e[0]!="string")return e[0]}function Dy(o,e){return o.insertBefore(e,o.firstChild),e}function Yi(o,...e){o.textContent="",Z(o,...e)}const cse=/([\w\-]+)?(#([\w\-]+))?((\.([\w\-]+))*)/;var S1;(function(o){o.HTML="http://www.w3.org/1999/xhtml",o.SVG="http://www.w3.org/2000/svg"})(S1||(S1={}));function oH(o,e,t,...i){const n=cse.exec(e);if(!n)throw new Error("Bad use of emmet");const s=n[1]||"div";let r;return o!==S1.HTML?r=document.createElementNS(o,s):r=document.createElement(s),n[3]&&(r.id=n[3]),n[4]&&(r.className=n[4].replace(/\./g," ").trim()),t&&Object.entries(t).forEach(([a,l])=>{typeof l>"u"||(/^on\w+$/.test(a)?r[a]=l:a==="selected"?l&&r.setAttribute(a,"true"):r.setAttribute(a,l))}),r.append(...i),r}function Q(o,e,...t){return oH(S1.HTML,o,e,...t)}Q.SVG=function(o,e,...t){return oH(S1.SVG,o,e,...t)};function dse(o,...e){o?uo(...e):gs(...e)}function uo(...o){for(const e of o)e.style.display="",e.removeAttribute("aria-hidden")}function gs(...o){for(const e of o)e.style.display="none",e.setAttribute("aria-hidden","true")}function rH(o,e){const t=o.devicePixelRatio*e;return Math.max(1,Math.floor(t))/o.devicePixelRatio}function aH(o){bt.open(o,"_blank","noopener")}function hse(o,e){const t=()=>{e(),i=Hs(o,t)};let i=Hs(o,t);return ue(()=>i.dispose())}m6.setPreferredWebSchema(/^https:/.test(bt.location.href)?"https":"http");class Pc extends P{constructor(){super(),this._subscriptions=new U,this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1},this._subscriptions.add(ie.runAndSubscribe(C1,({window:e,disposables:t})=>this.registerListeners(e,t),{window:bt,disposables:this._subscriptions}))}registerListeners(e,t){t.add(W(e,"keydown",i=>{if(i.defaultPrevented)return;const n=new St(i);if(!(n.keyCode===6&&i.repeat)){if(i.altKey&&!this._keyStatus.altKey)this._keyStatus.lastKeyPressed="alt";else if(i.ctrlKey&&!this._keyStatus.ctrlKey)this._keyStatus.lastKeyPressed="ctrl";else if(i.metaKey&&!this._keyStatus.metaKey)this._keyStatus.lastKeyPressed="meta";else if(i.shiftKey&&!this._keyStatus.shiftKey)this._keyStatus.lastKeyPressed="shift";else if(n.keyCode!==6)this._keyStatus.lastKeyPressed=void 0;else return;this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyPressed&&(this._keyStatus.event=i,this.fire(this._keyStatus))}},!0)),t.add(W(e,"keyup",i=>{i.defaultPrevented||(!i.altKey&&this._keyStatus.altKey?this._keyStatus.lastKeyReleased="alt":!i.ctrlKey&&this._keyStatus.ctrlKey?this._keyStatus.lastKeyReleased="ctrl":!i.metaKey&&this._keyStatus.metaKey?this._keyStatus.lastKeyReleased="meta":!i.shiftKey&&this._keyStatus.shiftKey?this._keyStatus.lastKeyReleased="shift":this._keyStatus.lastKeyReleased=void 0,this._keyStatus.lastKeyPressed!==this._keyStatus.lastKeyReleased&&(this._keyStatus.lastKeyPressed=void 0),this._keyStatus.altKey=i.altKey,this._keyStatus.ctrlKey=i.ctrlKey,this._keyStatus.metaKey=i.metaKey,this._keyStatus.shiftKey=i.shiftKey,this._keyStatus.lastKeyReleased&&(this._keyStatus.event=i,this.fire(this._keyStatus)))},!0)),t.add(W(e.document.body,"mousedown",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(W(e.document.body,"mouseup",()=>{this._keyStatus.lastKeyPressed=void 0},!0)),t.add(W(e.document.body,"mousemove",i=>{i.buttons&&(this._keyStatus.lastKeyPressed=void 0)},!0)),t.add(W(e,"blur",()=>{this.resetKeyStatus()}))}get keyStatus(){return this._keyStatus}resetKeyStatus(){this.doResetKeyStatus(),this.fire(this._keyStatus)}doResetKeyStatus(){this._keyStatus={altKey:!1,shiftKey:!1,ctrlKey:!1,metaKey:!1}}static getInstance(){return Pc.instance||(Pc.instance=new Pc),Pc.instance}dispose(){super.dispose(),this._subscriptions.dispose()}}class use extends A{constructor(e,t){super(),this.element=e,this.callbacks=t,this.counter=0,this.dragStartTime=0,this.registerListeners()}registerListeners(){this.callbacks.onDragStart&&this._register(W(this.element,te.DRAG_START,e=>{this.callbacks.onDragStart?.(e)})),this.callbacks.onDrag&&this._register(W(this.element,te.DRAG,e=>{this.callbacks.onDrag?.(e)})),this._register(W(this.element,te.DRAG_ENTER,e=>{this.counter++,this.dragStartTime=e.timeStamp,this.callbacks.onDragEnter?.(e)})),this._register(W(this.element,te.DRAG_OVER,e=>{e.preventDefault(),this.callbacks.onDragOver?.(e,e.timeStamp-this.dragStartTime)})),this._register(W(this.element,te.DRAG_LEAVE,e=>{this.counter--,this.counter===0&&(this.dragStartTime=0,this.callbacks.onDragLeave?.(e))})),this._register(W(this.element,te.DRAG_END,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDragEnd?.(e)})),this._register(W(this.element,te.DROP,e=>{this.counter=0,this.dragStartTime=0,this.callbacks.onDrop?.(e)}))}}const fse=/(?<tag>[\w\-]+)?(?:#(?<id>[\w\-]+))?(?<class>(?:\.(?:[\w\-]+))*)(?:@(?<name>(?:[\w\_])+))?/;function Je(o,...e){let t,i;Array.isArray(e[0])?(t={},i=e[0]):(t=e[0]||{},i=e[1]);const n=fse.exec(o);if(!n||!n.groups)throw new Error("Bad use of h");const s=n.groups.tag||"div",r=document.createElement(s);n.groups.id&&(r.id=n.groups.id);const a=[];if(n.groups.class)for(const c of n.groups.class.split("."))c!==""&&a.push(c);if(t.className!==void 0)for(const c of t.className.split("."))c!==""&&a.push(c);a.length>0&&(r.className=a.join(" "));const l={};if(n.groups.name&&(l[n.groups.name]=r),i)for(const c of i)ai(c)?r.appendChild(c):typeof c=="string"?r.append(c):"root"in c&&(Object.assign(l,c),r.appendChild(c.root));for(const[c,d]of Object.entries(t))if(c!=="className")if(c==="style")for(const[h,u]of Object.entries(d))r.style.setProperty(y1(h),typeof u=="number"?u+"px":""+u);else c==="tabIndex"?r.tabIndex=d:r.setAttribute(y1(c),d.toString());return l.root=r,l}function y1(o){return o.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function ya(o){return o.tagName.toLowerCase()==="input"||o.tagName.toLowerCase()==="textarea"||ai(o)&&!!o.editContext}var Pe;(function(o){function e(n=void 0){return(s,r,a)=>{const l=r.class;delete r.class;const c=r.ref;delete r.ref;const d=r.obsRef;return delete r.obsRef,new pse(s,c,d,n,l,r,a)}}function t(n,s=void 0){const r=e(s);return(a,l)=>r(n,a,l)}o.div=t("div"),o.elem=e(void 0),o.svg=t("svg","http://www.w3.org/2000/svg"),o.svgElem=e("http://www.w3.org/2000/svg");function i(){let n;const s=function(r){n=r};return Object.defineProperty(s,"element",{get(){if(!n)throw new Ce("Make sure the ref is set before accessing the element. Maybe wrong initialization order?");return n}}),s}o.ref=i})(Pe||(Pe={}));class n2{constructor(e,t,i,n,s,r,a){this._deriveds=[],this._element=n?document.createElementNS(n,e):document.createElement(e),t&&t(this._element),i&&this._deriveds.push(j(l=>{i(this),l.store.add({dispose:()=>{i(null)}})})),s&&(hH(s)?this._deriveds.push(j(this,l=>{lH(this._element,dH(s,l))})):lH(this._element,dH(s,void 0)));for(const[l,c]of Object.entries(r))if(l==="style")for(const[d,h]of Object.entries(c)){const u=y1(d);cf(h)?this._deriveds.push(In({owner:this,debugName:()=>`set.style.${u}`},f=>{this._element.style.setProperty(u,uH(h.read(f)))})):this._element.style.setProperty(u,uH(h))}else l==="tabIndex"?cf(c)?this._deriveds.push(j(this,d=>{this._element.tabIndex=c.read(d)})):this._element.tabIndex=c:l.startsWith("on")?this._element[l]=c:cf(c)?this._deriveds.push(In({owner:this,debugName:()=>`set.${l}`},d=>{gH(this._element,l,c.read(d))})):gH(this._element,l,c);if(a){let l=function(d,h){return cf(h)?l(d,h.read(d)):Array.isArray(h)?h.flatMap(u=>l(d,u)):h instanceof n2?(d&&h.readEffect(d),[h._element]):h?[h]:[]};const c=j(this,d=>{this._element.replaceChildren(...l(d,a))});this._deriveds.push(c),fH(a)||c.get()}}readEffect(e){for(const t of this._deriveds)t.read(e)}keepUpdated(e){return j(t=>{this.readEffect(t)}).recomputeInitiallyAndOnChange(e),this}toDisposableLiveElement(){const e=new U;return this.keepUpdated(e),new gse(this._element,e)}}function lH(o,e){sH(o)?o.setAttribute("class",e):o.className=e}function cH(o,e,t){if(cf(o)){t(o.read(e));return}if(Array.isArray(o)){for(const i of o)cH(i,e,t);return}t(o)}function dH(o,e){let t="";return cH(o,e,i=>{i&&(t.length===0?t=i:t+=" "+i)}),t}function hH(o){return cf(o)?!0:Array.isArray(o)?o.some(e=>hH(e)):!1}function uH(o){return typeof o=="number"?o+"px":o}function fH(o){return cf(o)?!0:Array.isArray(o)?o.some(e=>fH(e)):!1}class gse{constructor(e,t){this.element=e,this._disposable=t}dispose(){this._disposable.dispose()}}class pse extends n2{constructor(){super(...arguments),this._isHovered=void 0,this._didMouseMoveDuringHover=void 0}get element(){return this._element}get isHovered(){if(!this._isHovered){const e=Le("hovered",!1);this._element.addEventListener("mouseenter",t=>e.set(!0,void 0)),this._element.addEventListener("mouseleave",t=>e.set(!1,void 0)),this._isHovered=e}return this._isHovered}get didMouseMoveDuringHover(){if(!this._didMouseMoveDuringHover){let e=!1;const t=Le("didMouseMoveDuringHover",!1);this._element.addEventListener("mouseenter",i=>{e=!0}),this._element.addEventListener("mousemove",i=>{e&&t.set(!0,void 0)}),this._element.addEventListener("mouseleave",i=>{e=!1,t.set(!1,void 0)}),this._didMouseMoveDuringHover=t}return this._didMouseMoveDuringHover}}function gH(o,e,t){t==null?o.removeAttribute(y1(e)):o.setAttribute(y1(e),String(t))}function cf(o){return!!o&&o.read!==void 0&&o.reportChanges!==void 0}const pH=2e4;let df,Ey,s2,Ny,o2;function mse(o){df=document.createElement("div"),df.className="monaco-aria-container";const e=()=>{const i=document.createElement("div");return i.className="monaco-alert",i.setAttribute("role","alert"),i.setAttribute("aria-atomic","true"),df.appendChild(i),i};Ey=e(),s2=e();const t=()=>{const i=document.createElement("div");return i.className="monaco-status",i.setAttribute("aria-live","polite"),i.setAttribute("aria-atomic","true"),df.appendChild(i),i};Ny=t(),o2=t(),o.appendChild(df)}function ps(o){df&&(Ey.textContent!==o?(pn(s2),Ty(Ey,o)):(pn(Ey),Ty(s2,o)))}function cl(o){df&&(Ny.textContent!==o?(pn(o2),Ty(Ny,o)):(pn(Ny),Ty(o2,o)))}function Ty(o,e){pn(o),e.length>pH&&(e=e.substr(0,pH)),o.textContent=e,o.style.visibility="hidden",o.style.visibility="visible"}var La;(function(o){o.serviceIds=new Map,o.DI_TARGET="$di$target",o.DI_DEPENDENCIES="$di$dependencies";function e(t){return t[o.DI_DEPENDENCIES]||[]}o.getServiceDependencies=e})(La||(La={}));const ge=We("instantiationService");function _se(o,e,t){e[La.DI_TARGET]===e?e[La.DI_DEPENDENCIES].push({id:o,index:t}):(e[La.DI_DEPENDENCIES]=[{id:o,index:t}],e[La.DI_TARGET]=e)}function We(o){if(La.serviceIds.has(o))return La.serviceIds.get(o);const e=function(t,i,n){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");_se(e,t,n)};return e.toString=()=>o,La.serviceIds.set(o,e),e}const et=We("codeEditorService");let M=class km{constructor(e,t){this.lineNumber=e,this.column=t}with(e=this.lineNumber,t=this.column){return e===this.lineNumber&&t===this.column?this:new km(e,t)}delta(e=0,t=0){return this.with(Math.max(1,this.lineNumber+e),Math.max(1,this.column+t))}equals(e){return km.equals(this,e)}static equals(e,t){return!e&&!t?!0:!!e&&!!t&&e.lineNumber===t.lineNumber&&e.column===t.column}isBefore(e){return km.isBefore(this,e)}static isBefore(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<t.column}isBeforeOrEqual(e){return km.isBeforeOrEqual(this,e)}static isBeforeOrEqual(e,t){return e.lineNumber<t.lineNumber?!0:t.lineNumber<e.lineNumber?!1:e.column<=t.column}static compare(e,t){const i=e.lineNumber|0,n=t.lineNumber|0;if(i===n){const s=e.column|0,r=t.column|0;return s-r}return i-n}clone(){return new km(this.lineNumber,this.column)}toString(){return"("+this.lineNumber+","+this.column+")"}static lift(e){return new km(e.lineNumber,e.column)}static isIPosition(e){return e&&typeof e.lineNumber=="number"&&typeof e.column=="number"}toJSON(){return{lineNumber:this.lineNumber,column:this.column}}};const Qt=We("modelService"),ns=We("textModelService");class Mo extends A{get onDidChange(){return this._onDidChange.event}constructor(e,t="",i="",n=!0,s){super(),this._onDidChange=this._register(new P),this._enabled=!0,this._id=e,this._label=t,this._cssClass=i,this._enabled=n,this._actionCallback=s}get id(){return this._id}get label(){return this._label}set label(e){this._setLabel(e)}_setLabel(e){this._label!==e&&(this._label=e,this._onDidChange.fire({label:e}))}get tooltip(){return this._tooltip||""}set tooltip(e){this._setTooltip(e)}_setTooltip(e){this._tooltip!==e&&(this._tooltip=e,this._onDidChange.fire({tooltip:e}))}get class(){return this._cssClass}set class(e){this._setClass(e)}_setClass(e){this._cssClass!==e&&(this._cssClass=e,this._onDidChange.fire({class:e}))}get enabled(){return this._enabled}set enabled(e){this._setEnabled(e)}_setEnabled(e){this._enabled!==e&&(this._enabled=e,this._onDidChange.fire({enabled:e}))}get checked(){return this._checked}set checked(e){this._setChecked(e)}_setChecked(e){this._checked!==e&&(this._checked=e,this._onDidChange.fire({checked:e}))}async run(e,t){this._actionCallback&&await this._actionCallback(e)}}class hf extends A{constructor(){super(...arguments),this._onWillRun=this._register(new P),this._onDidRun=this._register(new P)}get onWillRun(){return this._onWillRun.event}get onDidRun(){return this._onDidRun.event}async run(e,t){if(!e.enabled)return;this._onWillRun.fire({action:e});let i;try{await this.runAction(e,t)}catch(n){i=n}this._onDidRun.fire({action:e,error:i})}async runAction(e,t){await e.run(t)}}const xS=class xS{constructor(){this.id=xS.ID,this.label="",this.tooltip="",this.class="separator",this.enabled=!1,this.checked=!1}static join(...e){let t=[];for(const i of e)i.length&&(t.length?t=[...t,new xS,...i]:t=i);return t}async run(){}};xS.ID="vs.actions.separator";let Xi=xS;class Bm{get actions(){return this._actions}constructor(e,t,i,n){this.tooltip="",this.enabled=!0,this.checked=void 0,this.id=e,this.label=t,this.class=n,this._actions=i}async run(){}}const eN=class eN extends Mo{constructor(){super(eN.ID,p(28,"(empty)"),void 0,!1)}};eN.ID="vs.actions.empty";let r2=eN;function uf(o){return{id:o.id,label:o.label,tooltip:o.tooltip??o.label,class:o.class,enabled:o.enabled??!0,checked:o.checked,run:async(...e)=>o.run(...e)}}const a2=Object.create(null);function y(o,e){if(ji(e)){const t=a2[e];if(t===void 0)throw new Error(`${o} references an unknown codicon: ${e}`);e=t}return a2[o]=e,{id:o}}function mH(){return a2}const bse={add:y("add",6e4),plus:y("plus",6e4),gistNew:y("gist-new",6e4),repoCreate:y("repo-create",6e4),lightbulb:y("lightbulb",60001),lightBulb:y("light-bulb",60001),repo:y("repo",60002),repoDelete:y("repo-delete",60002),gistFork:y("gist-fork",60003),repoForked:y("repo-forked",60003),gitPullRequest:y("git-pull-request",60004),gitPullRequestAbandoned:y("git-pull-request-abandoned",60004),recordKeys:y("record-keys",60005),keyboard:y("keyboard",60005),tag:y("tag",60006),gitPullRequestLabel:y("git-pull-request-label",60006),tagAdd:y("tag-add",60006),tagRemove:y("tag-remove",60006),person:y("person",60007),personFollow:y("person-follow",60007),personOutline:y("person-outline",60007),personFilled:y("person-filled",60007),gitBranch:y("git-branch",60008),gitBranchCreate:y("git-branch-create",60008),gitBranchDelete:y("git-branch-delete",60008),sourceControl:y("source-control",60008),mirror:y("mirror",60009),mirrorPublic:y("mirror-public",60009),star:y("star",60010),starAdd:y("star-add",60010),starDelete:y("star-delete",60010),starEmpty:y("star-empty",60010),comment:y("comment",60011),commentAdd:y("comment-add",60011),alert:y("alert",60012),warning:y("warning",60012),search:y("search",60013),searchSave:y("search-save",60013),logOut:y("log-out",60014),signOut:y("sign-out",60014),logIn:y("log-in",60015),signIn:y("sign-in",60015),eye:y("eye",60016),eyeUnwatch:y("eye-unwatch",60016),eyeWatch:y("eye-watch",60016),circleFilled:y("circle-filled",60017),primitiveDot:y("primitive-dot",60017),closeDirty:y("close-dirty",60017),debugBreakpoint:y("debug-breakpoint",60017),debugBreakpointDisabled:y("debug-breakpoint-disabled",60017),debugHint:y("debug-hint",60017),terminalDecorationSuccess:y("terminal-decoration-success",60017),primitiveSquare:y("primitive-square",60018),edit:y("edit",60019),pencil:y("pencil",60019),info:y("info",60020),issueOpened:y("issue-opened",60020),gistPrivate:y("gist-private",60021),gitForkPrivate:y("git-fork-private",60021),lock:y("lock",60021),mirrorPrivate:y("mirror-private",60021),close:y("close",60022),removeClose:y("remove-close",60022),x:y("x",60022),repoSync:y("repo-sync",60023),sync:y("sync",60023),clone:y("clone",60024),desktopDownload:y("desktop-download",60024),beaker:y("beaker",60025),microscope:y("microscope",60025),vm:y("vm",60026),deviceDesktop:y("device-desktop",60026),file:y("file",60027),fileText:y("file-text",60027),more:y("more",60028),ellipsis:y("ellipsis",60028),kebabHorizontal:y("kebab-horizontal",60028),mailReply:y("mail-reply",60029),reply:y("reply",60029),organization:y("organization",60030),organizationFilled:y("organization-filled",60030),organizationOutline:y("organization-outline",60030),newFile:y("new-file",60031),fileAdd:y("file-add",60031),newFolder:y("new-folder",60032),fileDirectoryCreate:y("file-directory-create",60032),trash:y("trash",60033),trashcan:y("trashcan",60033),history:y("history",60034),clock:y("clock",60034),folder:y("folder",60035),fileDirectory:y("file-directory",60035),symbolFolder:y("symbol-folder",60035),logoGithub:y("logo-github",60036),markGithub:y("mark-github",60036),github:y("github",60036),terminal:y("terminal",60037),console:y("console",60037),repl:y("repl",60037),zap:y("zap",60038),symbolEvent:y("symbol-event",60038),error:y("error",60039),stop:y("stop",60039),variable:y("variable",60040),symbolVariable:y("symbol-variable",60040),array:y("array",60042),symbolArray:y("symbol-array",60042),symbolModule:y("symbol-module",60043),symbolPackage:y("symbol-package",60043),symbolNamespace:y("symbol-namespace",60043),symbolObject:y("symbol-object",60043),symbolMethod:y("symbol-method",60044),symbolFunction:y("symbol-function",60044),symbolConstructor:y("symbol-constructor",60044),symbolBoolean:y("symbol-boolean",60047),symbolNull:y("symbol-null",60047),symbolNumeric:y("symbol-numeric",60048),symbolNumber:y("symbol-number",60048),symbolStructure:y("symbol-structure",60049),symbolStruct:y("symbol-struct",60049),symbolParameter:y("symbol-parameter",60050),symbolTypeParameter:y("symbol-type-parameter",60050),symbolKey:y("symbol-key",60051),symbolText:y("symbol-text",60051),symbolReference:y("symbol-reference",60052),goToFile:y("go-to-file",60052),symbolEnum:y("symbol-enum",60053),symbolValue:y("symbol-value",60053),symbolRuler:y("symbol-ruler",60054),symbolUnit:y("symbol-unit",60054),activateBreakpoints:y("activate-breakpoints",60055),archive:y("archive",60056),arrowBoth:y("arrow-both",60057),arrowDown:y("arrow-down",60058),arrowLeft:y("arrow-left",60059),arrowRight:y("arrow-right",60060),arrowSmallDown:y("arrow-small-down",60061),arrowSmallLeft:y("arrow-small-left",60062),arrowSmallRight:y("arrow-small-right",60063),arrowSmallUp:y("arrow-small-up",60064),arrowUp:y("arrow-up",60065),bell:y("bell",60066),bold:y("bold",60067),book:y("book",60068),bookmark:y("bookmark",60069),debugBreakpointConditionalUnverified:y("debug-breakpoint-conditional-unverified",60070),debugBreakpointConditional:y("debug-breakpoint-conditional",60071),debugBreakpointConditionalDisabled:y("debug-breakpoint-conditional-disabled",60071),debugBreakpointDataUnverified:y("debug-breakpoint-data-unverified",60072),debugBreakpointData:y("debug-breakpoint-data",60073),debugBreakpointDataDisabled:y("debug-breakpoint-data-disabled",60073),debugBreakpointLogUnverified:y("debug-breakpoint-log-unverified",60074),debugBreakpointLog:y("debug-breakpoint-log",60075),debugBreakpointLogDisabled:y("debug-breakpoint-log-disabled",60075),briefcase:y("briefcase",60076),broadcast:y("broadcast",60077),browser:y("browser",60078),bug:y("bug",60079),calendar:y("calendar",60080),caseSensitive:y("case-sensitive",60081),check:y("check",60082),checklist:y("checklist",60083),chevronDown:y("chevron-down",60084),chevronLeft:y("chevron-left",60085),chevronRight:y("chevron-right",60086),chevronUp:y("chevron-up",60087),chromeClose:y("chrome-close",60088),chromeMaximize:y("chrome-maximize",60089),chromeMinimize:y("chrome-minimize",60090),chromeRestore:y("chrome-restore",60091),circleOutline:y("circle-outline",60092),circle:y("circle",60092),debugBreakpointUnverified:y("debug-breakpoint-unverified",60092),terminalDecorationIncomplete:y("terminal-decoration-incomplete",60092),circleSlash:y("circle-slash",60093),circuitBoard:y("circuit-board",60094),clearAll:y("clear-all",60095),clippy:y("clippy",60096),closeAll:y("close-all",60097),cloudDownload:y("cloud-download",60098),cloudUpload:y("cloud-upload",60099),code:y("code",60100),collapseAll:y("collapse-all",60101),colorMode:y("color-mode",60102),commentDiscussion:y("comment-discussion",60103),creditCard:y("credit-card",60105),dash:y("dash",60108),dashboard:y("dashboard",60109),database:y("database",60110),debugContinue:y("debug-continue",60111),debugDisconnect:y("debug-disconnect",60112),debugPause:y("debug-pause",60113),debugRestart:y("debug-restart",60114),debugStart:y("debug-start",60115),debugStepInto:y("debug-step-into",60116),debugStepOut:y("debug-step-out",60117),debugStepOver:y("debug-step-over",60118),debugStop:y("debug-stop",60119),debug:y("debug",60120),deviceCameraVideo:y("device-camera-video",60121),deviceCamera:y("device-camera",60122),deviceMobile:y("device-mobile",60123),diffAdded:y("diff-added",60124),diffIgnored:y("diff-ignored",60125),diffModified:y("diff-modified",60126),diffRemoved:y("diff-removed",60127),diffRenamed:y("diff-renamed",60128),diff:y("diff",60129),diffSidebyside:y("diff-sidebyside",60129),discard:y("discard",60130),editorLayout:y("editor-layout",60131),emptyWindow:y("empty-window",60132),exclude:y("exclude",60133),extensions:y("extensions",60134),eyeClosed:y("eye-closed",60135),fileBinary:y("file-binary",60136),fileCode:y("file-code",60137),fileMedia:y("file-media",60138),filePdf:y("file-pdf",60139),fileSubmodule:y("file-submodule",60140),fileSymlinkDirectory:y("file-symlink-directory",60141),fileSymlinkFile:y("file-symlink-file",60142),fileZip:y("file-zip",60143),files:y("files",60144),filter:y("filter",60145),flame:y("flame",60146),foldDown:y("fold-down",60147),foldUp:y("fold-up",60148),fold:y("fold",60149),folderActive:y("folder-active",60150),folderOpened:y("folder-opened",60151),gear:y("gear",60152),gift:y("gift",60153),gistSecret:y("gist-secret",60154),gist:y("gist",60155),gitCommit:y("git-commit",60156),gitCompare:y("git-compare",60157),compareChanges:y("compare-changes",60157),gitMerge:y("git-merge",60158),githubAction:y("github-action",60159),githubAlt:y("github-alt",60160),globe:y("globe",60161),grabber:y("grabber",60162),graph:y("graph",60163),gripper:y("gripper",60164),heart:y("heart",60165),home:y("home",60166),horizontalRule:y("horizontal-rule",60167),hubot:y("hubot",60168),inbox:y("inbox",60169),issueReopened:y("issue-reopened",60171),issues:y("issues",60172),italic:y("italic",60173),jersey:y("jersey",60174),json:y("json",60175),kebabVertical:y("kebab-vertical",60176),key:y("key",60177),law:y("law",60178),lightbulbAutofix:y("lightbulb-autofix",60179),linkExternal:y("link-external",60180),link:y("link",60181),listOrdered:y("list-ordered",60182),listUnordered:y("list-unordered",60183),liveShare:y("live-share",60184),loading:y("loading",60185),location:y("location",60186),mailRead:y("mail-read",60187),mail:y("mail",60188),markdown:y("markdown",60189),megaphone:y("megaphone",60190),mention:y("mention",60191),milestone:y("milestone",60192),gitPullRequestMilestone:y("git-pull-request-milestone",60192),mortarBoard:y("mortar-board",60193),move:y("move",60194),multipleWindows:y("multiple-windows",60195),mute:y("mute",60196),noNewline:y("no-newline",60197),note:y("note",60198),octoface:y("octoface",60199),openPreview:y("open-preview",60200),package:y("package",60201),paintcan:y("paintcan",60202),pin:y("pin",60203),play:y("play",60204),run:y("run",60204),plug:y("plug",60205),preserveCase:y("preserve-case",60206),preview:y("preview",60207),project:y("project",60208),pulse:y("pulse",60209),question:y("question",60210),quote:y("quote",60211),radioTower:y("radio-tower",60212),reactions:y("reactions",60213),references:y("references",60214),refresh:y("refresh",60215),regex:y("regex",60216),remoteExplorer:y("remote-explorer",60217),remote:y("remote",60218),remove:y("remove",60219),replaceAll:y("replace-all",60220),replace:y("replace",60221),repoClone:y("repo-clone",60222),repoForcePush:y("repo-force-push",60223),repoPull:y("repo-pull",60224),repoPush:y("repo-push",60225),report:y("report",60226),requestChanges:y("request-changes",60227),rocket:y("rocket",60228),rootFolderOpened:y("root-folder-opened",60229),rootFolder:y("root-folder",60230),rss:y("rss",60231),ruby:y("ruby",60232),saveAll:y("save-all",60233),saveAs:y("save-as",60234),save:y("save",60235),screenFull:y("screen-full",60236),screenNormal:y("screen-normal",60237),searchStop:y("search-stop",60238),server:y("server",60240),settingsGear:y("settings-gear",60241),settings:y("settings",60242),shield:y("shield",60243),smiley:y("smiley",60244),sortPrecedence:y("sort-precedence",60245),splitHorizontal:y("split-horizontal",60246),splitVertical:y("split-vertical",60247),squirrel:y("squirrel",60248),starFull:y("star-full",60249),starHalf:y("star-half",60250),symbolClass:y("symbol-class",60251),symbolColor:y("symbol-color",60252),symbolConstant:y("symbol-constant",60253),symbolEnumMember:y("symbol-enum-member",60254),symbolField:y("symbol-field",60255),symbolFile:y("symbol-file",60256),symbolInterface:y("symbol-interface",60257),symbolKeyword:y("symbol-keyword",60258),symbolMisc:y("symbol-misc",60259),symbolOperator:y("symbol-operator",60260),symbolProperty:y("symbol-property",60261),wrench:y("wrench",60261),wrenchSubaction:y("wrench-subaction",60261),symbolSnippet:y("symbol-snippet",60262),tasklist:y("tasklist",60263),telescope:y("telescope",60264),textSize:y("text-size",60265),threeBars:y("three-bars",60266),thumbsdown:y("thumbsdown",60267),thumbsup:y("thumbsup",60268),tools:y("tools",60269),triangleDown:y("triangle-down",60270),triangleLeft:y("triangle-left",60271),triangleRight:y("triangle-right",60272),triangleUp:y("triangle-up",60273),twitter:y("twitter",60274),unfold:y("unfold",60275),unlock:y("unlock",60276),unmute:y("unmute",60277),unverified:y("unverified",60278),verified:y("verified",60279),versions:y("versions",60280),vmActive:y("vm-active",60281),vmOutline:y("vm-outline",60282),vmRunning:y("vm-running",60283),watch:y("watch",60284),whitespace:y("whitespace",60285),wholeWord:y("whole-word",60286),window:y("window",60287),wordWrap:y("word-wrap",60288),zoomIn:y("zoom-in",60289),zoomOut:y("zoom-out",60290),listFilter:y("list-filter",60291),listFlat:y("list-flat",60292),listSelection:y("list-selection",60293),selection:y("selection",60293),listTree:y("list-tree",60294),debugBreakpointFunctionUnverified:y("debug-breakpoint-function-unverified",60295),debugBreakpointFunction:y("debug-breakpoint-function",60296),debugBreakpointFunctionDisabled:y("debug-breakpoint-function-disabled",60296),debugStackframeActive:y("debug-stackframe-active",60297),circleSmallFilled:y("circle-small-filled",60298),debugStackframeDot:y("debug-stackframe-dot",60298),terminalDecorationMark:y("terminal-decoration-mark",60298),debugStackframe:y("debug-stackframe",60299),debugStackframeFocused:y("debug-stackframe-focused",60299),debugBreakpointUnsupported:y("debug-breakpoint-unsupported",60300),symbolString:y("symbol-string",60301),debugReverseContinue:y("debug-reverse-continue",60302),debugStepBack:y("debug-step-back",60303),debugRestartFrame:y("debug-restart-frame",60304),debugAlt:y("debug-alt",60305),callIncoming:y("call-incoming",60306),callOutgoing:y("call-outgoing",60307),menu:y("menu",60308),expandAll:y("expand-all",60309),feedback:y("feedback",60310),gitPullRequestReviewer:y("git-pull-request-reviewer",60310),groupByRefType:y("group-by-ref-type",60311),ungroupByRefType:y("ungroup-by-ref-type",60312),account:y("account",60313),gitPullRequestAssignee:y("git-pull-request-assignee",60313),bellDot:y("bell-dot",60314),debugConsole:y("debug-console",60315),library:y("library",60316),output:y("output",60317),runAll:y("run-all",60318),syncIgnored:y("sync-ignored",60319),pinned:y("pinned",60320),githubInverted:y("github-inverted",60321),serverProcess:y("server-process",60322),serverEnvironment:y("server-environment",60323),pass:y("pass",60324),issueClosed:y("issue-closed",60324),stopCircle:y("stop-circle",60325),playCircle:y("play-circle",60326),record:y("record",60327),debugAltSmall:y("debug-alt-small",60328),vmConnect:y("vm-connect",60329),cloud:y("cloud",60330),merge:y("merge",60331),export:y("export",60332),graphLeft:y("graph-left",60333),magnet:y("magnet",60334),notebook:y("notebook",60335),redo:y("redo",60336),checkAll:y("check-all",60337),pinnedDirty:y("pinned-dirty",60338),passFilled:y("pass-filled",60339),circleLargeFilled:y("circle-large-filled",60340),circleLarge:y("circle-large",60341),circleLargeOutline:y("circle-large-outline",60341),combine:y("combine",60342),gather:y("gather",60342),table:y("table",60343),variableGroup:y("variable-group",60344),typeHierarchy:y("type-hierarchy",60345),typeHierarchySub:y("type-hierarchy-sub",60346),typeHierarchySuper:y("type-hierarchy-super",60347),gitPullRequestCreate:y("git-pull-request-create",60348),runAbove:y("run-above",60349),runBelow:y("run-below",60350),notebookTemplate:y("notebook-template",60351),debugRerun:y("debug-rerun",60352),workspaceTrusted:y("workspace-trusted",60353),workspaceUntrusted:y("workspace-untrusted",60354),workspaceUnknown:y("workspace-unknown",60355),terminalCmd:y("terminal-cmd",60356),terminalDebian:y("terminal-debian",60357),terminalLinux:y("terminal-linux",60358),terminalPowershell:y("terminal-powershell",60359),terminalTmux:y("terminal-tmux",60360),terminalUbuntu:y("terminal-ubuntu",60361),terminalBash:y("terminal-bash",60362),arrowSwap:y("arrow-swap",60363),copy:y("copy",60364),personAdd:y("person-add",60365),filterFilled:y("filter-filled",60366),wand:y("wand",60367),debugLineByLine:y("debug-line-by-line",60368),inspect:y("inspect",60369),layers:y("layers",60370),layersDot:y("layers-dot",60371),layersActive:y("layers-active",60372),compass:y("compass",60373),compassDot:y("compass-dot",60374),compassActive:y("compass-active",60375),azure:y("azure",60376),issueDraft:y("issue-draft",60377),gitPullRequestClosed:y("git-pull-request-closed",60378),gitPullRequestDraft:y("git-pull-request-draft",60379),debugAll:y("debug-all",60380),debugCoverage:y("debug-coverage",60381),runErrors:y("run-errors",60382),folderLibrary:y("folder-library",60383),debugContinueSmall:y("debug-continue-small",60384),beakerStop:y("beaker-stop",60385),graphLine:y("graph-line",60386),graphScatter:y("graph-scatter",60387),pieChart:y("pie-chart",60388),bracket:y("bracket",60175),bracketDot:y("bracket-dot",60389),bracketError:y("bracket-error",60390),lockSmall:y("lock-small",60391),azureDevops:y("azure-devops",60392),verifiedFilled:y("verified-filled",60393),newline:y("newline",60394),layout:y("layout",60395),layoutActivitybarLeft:y("layout-activitybar-left",60396),layoutActivitybarRight:y("layout-activitybar-right",60397),layoutPanelLeft:y("layout-panel-left",60398),layoutPanelCenter:y("layout-panel-center",60399),layoutPanelJustify:y("layout-panel-justify",60400),layoutPanelRight:y("layout-panel-right",60401),layoutPanel:y("layout-panel",60402),layoutSidebarLeft:y("layout-sidebar-left",60403),layoutSidebarRight:y("layout-sidebar-right",60404),layoutStatusbar:y("layout-statusbar",60405),layoutMenubar:y("layout-menubar",60406),layoutCentered:y("layout-centered",60407),target:y("target",60408),indent:y("indent",60409),recordSmall:y("record-small",60410),errorSmall:y("error-small",60411),terminalDecorationError:y("terminal-decoration-error",60411),arrowCircleDown:y("arrow-circle-down",60412),arrowCircleLeft:y("arrow-circle-left",60413),arrowCircleRight:y("arrow-circle-right",60414),arrowCircleUp:y("arrow-circle-up",60415),layoutSidebarRightOff:y("layout-sidebar-right-off",60416),layoutPanelOff:y("layout-panel-off",60417),layoutSidebarLeftOff:y("layout-sidebar-left-off",60418),blank:y("blank",60419),heartFilled:y("heart-filled",60420),map:y("map",60421),mapHorizontal:y("map-horizontal",60421),foldHorizontal:y("fold-horizontal",60421),mapFilled:y("map-filled",60422),mapHorizontalFilled:y("map-horizontal-filled",60422),foldHorizontalFilled:y("fold-horizontal-filled",60422),circleSmall:y("circle-small",60423),bellSlash:y("bell-slash",60424),bellSlashDot:y("bell-slash-dot",60425),commentUnresolved:y("comment-unresolved",60426),gitPullRequestGoToChanges:y("git-pull-request-go-to-changes",60427),gitPullRequestNewChanges:y("git-pull-request-new-changes",60428),searchFuzzy:y("search-fuzzy",60429),commentDraft:y("comment-draft",60430),send:y("send",60431),sparkle:y("sparkle",60432),insert:y("insert",60433),mic:y("mic",60434),thumbsdownFilled:y("thumbsdown-filled",60435),thumbsupFilled:y("thumbsup-filled",60436),coffee:y("coffee",60437),snake:y("snake",60438),game:y("game",60439),vr:y("vr",60440),chip:y("chip",60441),piano:y("piano",60442),music:y("music",60443),micFilled:y("mic-filled",60444),repoFetch:y("repo-fetch",60445),copilot:y("copilot",60446),lightbulbSparkle:y("lightbulb-sparkle",60447),robot:y("robot",60448),sparkleFilled:y("sparkle-filled",60449),diffSingle:y("diff-single",60450),diffMultiple:y("diff-multiple",60451),surroundWith:y("surround-with",60452),share:y("share",60453),gitStash:y("git-stash",60454),gitStashApply:y("git-stash-apply",60455),gitStashPop:y("git-stash-pop",60456),vscode:y("vscode",60457),vscodeInsiders:y("vscode-insiders",60458),codeOss:y("code-oss",60459),runCoverage:y("run-coverage",60460),runAllCoverage:y("run-all-coverage",60461),coverage:y("coverage",60462),githubProject:y("github-project",60463),mapVertical:y("map-vertical",60464),foldVertical:y("fold-vertical",60464),mapVerticalFilled:y("map-vertical-filled",60465),foldVerticalFilled:y("fold-vertical-filled",60465),goToSearch:y("go-to-search",60466),percentage:y("percentage",60467),sortPercentage:y("sort-percentage",60467),attach:y("attach",60468),goToEditingSession:y("go-to-editing-session",60469),editSession:y("edit-session",60470),codeReview:y("code-review",60471),copilotWarning:y("copilot-warning",60472),python:y("python",60473),copilotLarge:y("copilot-large",60474),copilotWarningLarge:y("copilot-warning-large",60475),keyboardTab:y("keyboard-tab",60476),copilotBlocked:y("copilot-blocked",60477),copilotNotConnected:y("copilot-not-connected",60478),flag:y("flag",60479),lightbulbEmpty:y("lightbulb-empty",60480),symbolMethodArrow:y("symbol-method-arrow",60481),copilotUnavailable:y("copilot-unavailable",60482),repoPinned:y("repo-pinned",60483),keyboardTabAbove:y("keyboard-tab-above",60484),keyboardTabBelow:y("keyboard-tab-below",60485),gitPullRequestDone:y("git-pull-request-done",60486),mcp:y("mcp",60487),extensionsLarge:y("extensions-large",60488),layoutPanelDock:y("layout-panel-dock",60489),layoutSidebarLeftDock:y("layout-sidebar-left-dock",60490),layoutSidebarRightDock:y("layout-sidebar-right-dock",60491),copilotInProgress:y("copilot-in-progress",60492),copilotError:y("copilot-error",60493),copilotSuccess:y("copilot-success",60494),chatSparkle:y("chat-sparkle",60495),searchSparkle:y("search-sparkle",60496),editSparkle:y("edit-sparkle",60497),copilotSnooze:y("copilot-snooze",60498),sendToRemoteAgent:y("send-to-remote-agent",60499),commentDiscussionSparkle:y("comment-discussion-sparkle",60500),chatSparkleWarning:y("chat-sparkle-warning",60501),chatSparkleError:y("chat-sparkle-error",60502),collection:y("collection",60503),newCollection:y("new-collection",60504),thinking:y("thinking",60505)},Cse={dialogError:y("dialog-error","error"),dialogWarning:y("dialog-warning","warning"),dialogInfo:y("dialog-info","info"),dialogClose:y("dialog-close","close"),treeItemExpanded:y("tree-item-expanded","chevron-down"),treeFilterOnTypeOn:y("tree-filter-on-type-on","list-filter"),treeFilterOnTypeOff:y("tree-filter-on-type-off","list-selection"),treeFilterClear:y("tree-filter-clear","close"),treeItemLoading:y("tree-item-loading","loading"),menuSelection:y("menu-selection","check"),menuSubmenu:y("menu-submenu","chevron-right"),menuBarMore:y("menubar-more","more"),scrollbarButtonLeft:y("scrollbar-button-left","triangle-left"),scrollbarButtonRight:y("scrollbar-button-right","triangle-right"),scrollbarButtonUp:y("scrollbar-button-up","triangle-up"),scrollbarButtonDown:y("scrollbar-button-down","triangle-down"),toolBarMore:y("toolbar-more","more"),quickInputBack:y("quick-input-back","arrow-left"),dropDownButton:y("drop-down-button",60084),symbolCustomColor:y("symbol-customcolor",60252),exportIcon:y("export",60332),workspaceUnspecified:y("workspace-unspecified",60355),newLine:y("newline",60394),thumbsDownFilled:y("thumbsdown-filled",60435),thumbsUpFilled:y("thumbsup-filled",60436),gitFetch:y("git-fetch",60445),lightbulbSparkleAutofix:y("lightbulb-sparkle-autofix",60447),debugBreakpointPending:y("debug-breakpoint-pending",60377)},Y={...bse,...Cse};var l2;(function(o){function e(t){return!!t&&typeof t=="object"&&typeof t.id=="string"}o.isThemeColor=e})(l2||(l2={}));var ve;(function(o){o.iconNameSegment="[A-Za-z0-9]+",o.iconNameExpression="[A-Za-z0-9-]+",o.iconModifierExpression="~[A-Za-z]+",o.iconNameCharacter="[A-Za-z0-9~-]";const e=new RegExp(`^(${o.iconNameExpression})(${o.iconModifierExpression})?$`);function t(u){const f=e.exec(u.id);if(!f)return t(Y.error);const[,g,m]=f,_=["codicon","codicon-"+g];return m&&_.push("codicon-modifier-"+m.substring(1)),_}o.asClassNameArray=t;function i(u){return t(u).join(" ")}o.asClassName=i;function n(u){return"."+t(u).join(".")}o.asCSSSelector=n;function s(u){return!!u&&typeof u=="object"&&typeof u.id=="string"&&(typeof u.color>"u"||l2.isThemeColor(u.color))}o.isThemeIcon=s;const r=new RegExp(`^\\$\\((${o.iconNameExpression}(?:${o.iconModifierExpression})?)\\)$`);function a(u){const f=r.exec(u);if(!f)return;const[,g]=f;return{id:g}}o.fromString=a;function l(u){return{id:u}}o.fromId=l;function c(u,f){let g=u.id;const m=g.lastIndexOf("~");return m!==-1&&(g=g.substring(0,m)),f&&(g=`${g}~${f}`),{id:g}}o.modify=c;function d(u){const f=u.id.lastIndexOf("~");if(f!==-1)return u.id.substring(f+1)}o.getModifier=d;function h(u,f){return u.id===f.id&&u.color?.id===f.color?.id}o.isEqual=h})(ve||(ve={}));const Tt=We("commandService"),Xe=new class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new P,this.onDidRegisterCommand=this._onDidRegisterCommand.event}registerCommand(o,e){if(!o)throw new Error("invalid command");if(typeof o=="string"){if(!e)throw new Error("invalid command");return this.registerCommand({id:o,handler:e})}if(o.metadata&&Array.isArray(o.metadata.args)){const r=[];for(const l of o.metadata.args)r.push(l.constraint);const a=o.handler;o.handler=function(l,...c){return Ate(c,r),a(l,...c)}}const{id:t}=o;let i=this._commands.get(t);i||(i=new Jn,this._commands.set(t,i));const n=i.unshift(o),s=ue(()=>{n(),this._commands.get(t)?.isEmpty()&&this._commands.delete(t)});return this._onDidRegisterCommand.fire(t),s}registerCommandAlias(o,e){return Xe.registerCommand(o,(t,...i)=>t.get(Tt).executeCommand(e,...i))}getCommand(o){const e=this._commands.get(o);if(!(!e||e.isEmpty()))return Ye.first(e)}getCommands(){const o=new Map;for(const e of this._commands.keys()){const t=this.getCommand(e);t&&o.set(e,t)}return o}};Xe.registerCommand("noop",()=>{});function c2(...o){switch(o.length){case 1:return p(1678,"Did you mean {0}?",o[0]);case 2:return p(1679,"Did you mean {0} or {1}?",o[0],o[1]);case 3:return p(1680,"Did you mean {0}, {1} or {2}?",o[0],o[1],o[2]);default:return}}const vse=p(1681,"Did you forget to open or close the quote?"),wse=p(1682,"Did you forget to escape the '/' (slash) character? Put two backslashes before it to escape, e.g., '\\\\/'.");let L1=(Fd=class{constructor(){this._input="",this._start=0,this._current=0,this._tokens=[],this._errors=[],this.stringRe=/[a-zA-Z0-9_<>\-\./\\:\*\?\+\[\]\^,#@;"%\$\p{L}-]+/uy}static getLexeme(e){switch(e.type){case 0:return"(";case 1:return")";case 2:return"!";case 3:return e.isTripleEq?"===":"==";case 4:return e.isTripleEq?"!==":"!=";case 5:return"<";case 6:return"<=";case 7:return">=";case 8:return">=";case 9:return"=~";case 10:return e.lexeme;case 11:return"true";case 12:return"false";case 13:return"in";case 14:return"not";case 15:return"&&";case 16:return"||";case 17:return e.lexeme;case 18:return e.lexeme;case 19:return e.lexeme;case 20:return"EOF";default:throw YS(`unhandled token type: ${JSON.stringify(e)}; have you forgotten to add a case?`)}}reset(e){return this._input=e,this._start=0,this._current=0,this._tokens=[],this._errors=[],this}scan(){for(;!this._isAtEnd();)switch(this._start=this._current,this._advance()){case 40:this._addToken(0);break;case 41:this._addToken(1);break;case 33:if(this._match(61)){const t=this._match(61);this._tokens.push({type:4,offset:this._start,isTripleEq:t})}else this._addToken(2);break;case 39:this._quotedString();break;case 47:this._regex();break;case 61:if(this._match(61)){const t=this._match(61);this._tokens.push({type:3,offset:this._start,isTripleEq:t})}else this._match(126)?this._addToken(9):this._error(c2("==","=~"));break;case 60:this._addToken(this._match(61)?6:5);break;case 62:this._addToken(this._match(61)?8:7);break;case 38:this._match(38)?this._addToken(15):this._error(c2("&&"));break;case 124:this._match(124)?this._addToken(16):this._error(c2("||"));break;case 32:case 13:case 9:case 10:case 160:break;default:this._string()}return this._start=this._current,this._addToken(20),Array.from(this._tokens)}_match(e){return this._isAtEnd()||this._input.charCodeAt(this._current)!==e?!1:(this._current++,!0)}_advance(){return this._input.charCodeAt(this._current++)}_peek(){return this._isAtEnd()?0:this._input.charCodeAt(this._current)}_addToken(e){this._tokens.push({type:e,offset:this._start})}_error(e){const t=this._start,i=this._input.substring(this._start,this._current),n={type:19,offset:this._start,lexeme:i};this._errors.push({offset:t,lexeme:i,additionalInfo:e}),this._tokens.push(n)}_string(){this.stringRe.lastIndex=this._start;const e=this.stringRe.exec(this._input);if(e){this._current=this._start+e[0].length;const t=this._input.substring(this._start,this._current),i=Fd._keywords.get(t);i?this._addToken(i):this._tokens.push({type:17,lexeme:t,offset:this._start})}}_quotedString(){for(;this._peek()!==39&&!this._isAtEnd();)this._advance();if(this._isAtEnd()){this._error(vse);return}this._advance(),this._tokens.push({type:18,lexeme:this._input.substring(this._start+1,this._current-1),offset:this._start+1})}_regex(){let e=this._current,t=!1,i=!1;for(;;){if(e>=this._input.length){this._current=e,this._error(wse);return}const s=this._input.charCodeAt(e);if(t)t=!1;else if(s===47&&!i){e++;break}else s===91?i=!0:s===92?t=!0:s===93&&(i=!1);e++}for(;e<this._input.length&&Fd._regexFlags.has(this._input.charCodeAt(e));)e++;this._current=e;const n=this._input.substring(this._start,this._current);this._tokens.push({type:10,lexeme:n,offset:this._start})}_isAtEnd(){return this._current>=this._input.length}},Fd._regexFlags=new Set(["i","g","s","m","y","u"].map(e=>e.charCodeAt(0))),Fd._keywords=new Map([["not",14],["in",13],["false",12],["true",11]]),Fd);const Hn=new Map;Hn.set("false",!1),Hn.set("true",!0),Hn.set("isMac",ze),Hn.set("isLinux",Ws),Hn.set("isWindows",gn),Hn.set("isWeb",ol),Hn.set("isMacNative",ze&&!ol),Hn.set("isEdge",VB),Hn.set("isFirefox",zte),Hn.set("isChrome",QT),Hn.set("isSafari",Ute);const Sse=Object.prototype.hasOwnProperty,yse={regexParsingWithErrorRecovery:!0},Lse=p(1660,"Empty context key expression"),xse=p(1661,"Did you forget to write an expression? You can also put 'false' or 'true' to always evaluate to false or true, respectively."),kse=p(1662,"'in' after 'not'."),_H=p(1663,"closing parenthesis ')'"),Ise=p(1664,"Unexpected token"),Dse=p(1665,"Did you forget to put && or || before the token?"),Ese=p(1666,"Unexpected end of expression"),Nse=p(1667,"Did you forget to put a context key?");let Tse=(ac=class{constructor(e=yse){this._config=e,this._scanner=new L1,this._tokens=[],this._current=0,this._parsingErrors=[],this._flagsGYRe=/g|y/g}parse(e){if(e===""){this._parsingErrors.push({message:Lse,offset:0,lexeme:"",additionalInfo:xse});return}this._tokens=this._scanner.reset(e).scan(),this._current=0,this._parsingErrors=[];try{const t=this._expr();if(!this._isAtEnd()){const i=this._peek(),n=i.type===17?Dse:void 0;throw this._parsingErrors.push({message:Ise,offset:i.offset,lexeme:L1.getLexeme(i),additionalInfo:n}),ac._parseError}return t}catch(t){if(t!==ac._parseError)throw t;return}}_expr(){return this._or()}_or(){const e=[this._and()];for(;this._matchOne(16);){const t=this._and();e.push(t)}return e.length===1?e[0]:K.or(...e)}_and(){const e=[this._term()];for(;this._matchOne(15);){const t=this._term();e.push(t)}return e.length===1?e[0]:K.and(...e)}_term(){if(this._matchOne(2)){const e=this._peek();switch(e.type){case 11:return this._advance(),ms.INSTANCE;case 12:return this._advance(),Vs.INSTANCE;case 0:{this._advance();const t=this._expr();return this._consume(1,_H),t?.negate()}case 17:return this._advance(),gf.create(e.lexeme);default:throw this._errExpectedButGot("KEY | true | false | '(' expression ')'",e)}}return this._primary()}_primary(){const e=this._peek();switch(e.type){case 11:return this._advance(),K.true();case 12:return this._advance(),K.false();case 0:{this._advance();const t=this._expr();return this._consume(1,_H),t}case 17:{const t=e.lexeme;if(this._advance(),this._matchOne(9)){const n=this._peek();if(!this._config.regexParsingWithErrorRecovery){if(this._advance(),n.type!==10)throw this._errExpectedButGot("REGEX",n);const s=n.lexeme,r=s.lastIndexOf("/"),a=r===s.length-1?void 0:this._removeFlagsGY(s.substring(r+1));let l;try{l=new RegExp(s.substring(1,r),a)}catch{throw this._errExpectedButGot("REGEX",n)}return k1.create(t,l)}switch(n.type){case 10:case 19:{const s=[n.lexeme];this._advance();let r=this._peek(),a=0;for(let u=0;u<n.lexeme.length;u++)n.lexeme.charCodeAt(u)===40?a++:n.lexeme.charCodeAt(u)===41&&a--;for(;!this._isAtEnd()&&r.type!==15&&r.type!==16;){switch(r.type){case 0:a++;break;case 1:a--;break;case 10:case 18:for(let u=0;u<r.lexeme.length;u++)r.lexeme.charCodeAt(u)===40?a++:n.lexeme.charCodeAt(u)===41&&a--}if(a<0)break;s.push(L1.getLexeme(r)),this._advance(),r=this._peek()}const l=s.join(""),c=l.lastIndexOf("/"),d=c===l.length-1?void 0:this._removeFlagsGY(l.substring(c+1));let h;try{h=new RegExp(l.substring(1,c),d)}catch{throw this._errExpectedButGot("REGEX",n)}return K.regex(t,h)}case 18:{const s=n.lexeme;this._advance();let r=null;if(!XB(s)){const a=s.indexOf("/"),l=s.lastIndexOf("/");if(a!==l&&a>=0){const c=s.slice(a+1,l),d=s[l+1]==="i"?"i":"";try{r=new RegExp(c,d)}catch{throw this._errExpectedButGot("REGEX",n)}}}if(r===null)throw this._errExpectedButGot("REGEX",n);return k1.create(t,r)}default:throw this._errExpectedButGot("REGEX",this._peek())}}if(this._matchOne(14)){this._consume(13,kse);const n=this._value();return K.notIn(t,n)}switch(this._peek().type){case 3:{this._advance();const n=this._value();if(this._previous().type===18)return K.equals(t,n);switch(n){case"true":return K.has(t);case"false":return K.not(t);default:return K.equals(t,n)}}case 4:{this._advance();const n=this._value();if(this._previous().type===18)return K.notEquals(t,n);switch(n){case"true":return K.not(t);case"false":return K.has(t);default:return K.notEquals(t,n)}}case 5:return this._advance(),Wy.create(t,this._value());case 6:return this._advance(),By.create(t,this._value());case 7:return this._advance(),Oy.create(t,this._value());case 8:return this._advance(),Fy.create(t,this._value());case 13:return this._advance(),K.in(t,this._value());default:return K.has(t)}}case 20:throw this._parsingErrors.push({message:Ese,offset:e.offset,lexeme:"",additionalInfo:Nse}),ac._parseError;default:throw this._errExpectedButGot(`true | false | KEY
| KEY '=~' REGEX
| KEY ('==' | '!=' | '<' | '<=' | '>' | '>=' | 'in' | 'not' 'in') value`,this._peek())}}_value(){const e=this._peek();switch(e.type){case 17:case 18:return this._advance(),e.lexeme;case 11:return this._advance(),"true";case 12:return this._advance(),"false";case 13:return this._advance(),"in";default:return""}}_removeFlagsGY(e){return e.replaceAll(this._flagsGYRe,"")}_previous(){return this._tokens[this._current-1]}_matchOne(e){return this._check(e)?(this._advance(),!0):!1}_advance(){return this._isAtEnd()||this._current++,this._previous()}_consume(e,t){if(this._check(e))return this._advance();throw this._errExpectedButGot(t,this._peek())}_errExpectedButGot(e,t,i){const n=p(1668,`Expected: {0}
Received: '{1}'.`,e,L1.getLexeme(t)),s=t.offset,r=L1.getLexeme(t);return this._parsingErrors.push({message:n,offset:s,lexeme:r,additionalInfo:i}),ac._parseError}_check(e){return this._peek().type===e}_peek(){return this._tokens[this._current]}_isAtEnd(){return this._peek().type===20}},ac._parseError=new Error,ac);const oB=class oB{static false(){return ms.INSTANCE}static true(){return Vs.INSTANCE}static has(e){return ff.create(e)}static equals(e,t){return Hm.create(e,t)}static notEquals(e,t){return Py.create(e,t)}static regex(e,t){return k1.create(e,t)}static in(e,t){return Ry.create(e,t)}static notIn(e,t){return My.create(e,t)}static not(e){return gf.create(e)}static and(...e){return pf.create(e,null,!0)}static or(...e){return Ac.create(e,null,!0)}static deserialize(e){return e==null?void 0:this._parser.parse(e)}};oB._parser=new Tse({regexParsingWithErrorRecovery:!1});let K=oB;function Rse(o,e){const t=o?o.substituteConstants():void 0,i=e?e.substituteConstants():void 0;return!t&&!i?!0:!t||!i?!1:t.equals(i)}function x1(o,e){return o.cmp(e)}const tN=class tN{constructor(){this.type=0}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!1}serialize(){return"false"}keys(){return[]}negate(){return Vs.INSTANCE}};tN.INSTANCE=new tN;let ms=tN;const iN=class iN{constructor(){this.type=1}cmp(e){return this.type-e.type}equals(e){return e.type===this.type}substituteConstants(){return this}evaluate(e){return!0}serialize(){return"true"}keys(){return[]}negate(){return ms.INSTANCE}};iN.INSTANCE=new iN;let Vs=iN;class ff{static create(e,t=null){const i=Hn.get(e);return typeof i=="boolean"?i?Vs.INSTANCE:ms.INSTANCE:new ff(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=2}cmp(e){return e.type!==this.type?this.type-e.type:CH(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Hn.get(this.key);return typeof e=="boolean"?e?Vs.INSTANCE:ms.INSTANCE:this}evaluate(e){return!!e.getValue(this.key)}serialize(){return this.key}keys(){return[this.key]}negate(){return this.negated||(this.negated=gf.create(this.key,this)),this.negated}}class Hm{static create(e,t,i=null){if(typeof t=="boolean")return t?ff.create(e,i):gf.create(e,i);const n=Hn.get(e);return typeof n=="boolean"?t===(n?"true":"false")?Vs.INSTANCE:ms.INSTANCE:new Hm(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=4}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Hn.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?Vs.INSTANCE:ms.INSTANCE}return this}evaluate(e){return e.getValue(this.key)==this.value}serialize(){return`${this.key} == '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Py.create(this.key,this.value,this)),this.negated}}class Ry{static create(e,t){return new Ry(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=10,this.negated=null}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.valueKey,e.key,e.valueKey)}equals(e){return e.type===this.type?this.key===e.key&&this.valueKey===e.valueKey:!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.valueKey),i=e.getValue(this.key);return Array.isArray(t)?t.includes(i):typeof i=="string"&&typeof t=="object"&&t!==null?Sse.call(t,i):!1}serialize(){return`${this.key} in '${this.valueKey}'`}keys(){return[this.key,this.valueKey]}negate(){return this.negated||(this.negated=My.create(this.key,this.valueKey)),this.negated}}class My{static create(e,t){return new My(e,t)}constructor(e,t){this.key=e,this.valueKey=t,this.type=11,this._negated=Ry.create(e,t)}cmp(e){return e.type!==this.type?this.type-e.type:this._negated.cmp(e._negated)}equals(e){return e.type===this.type?this._negated.equals(e._negated):!1}substituteConstants(){return this}evaluate(e){return!this._negated.evaluate(e)}serialize(){return`${this.key} not in '${this.valueKey}'`}keys(){return this._negated.keys()}negate(){return this._negated}}class Py{static create(e,t,i=null){if(typeof t=="boolean")return t?gf.create(e,i):ff.create(e,i);const n=Hn.get(e);return typeof n=="boolean"?t===(n?"true":"false")?ms.INSTANCE:Vs.INSTANCE:new Py(e,t,i)}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=5}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){const e=Hn.get(this.key);if(typeof e=="boolean"){const t=e?"true":"false";return this.value===t?ms.INSTANCE:Vs.INSTANCE}return this}evaluate(e){return e.getValue(this.key)!=this.value}serialize(){return`${this.key} != '${this.value}'`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Hm.create(this.key,this.value,this)),this.negated}}class gf{static create(e,t=null){const i=Hn.get(e);return typeof i=="boolean"?i?ms.INSTANCE:Vs.INSTANCE:new gf(e,t)}constructor(e,t){this.key=e,this.negated=t,this.type=3}cmp(e){return e.type!==this.type?this.type-e.type:CH(this.key,e.key)}equals(e){return e.type===this.type?this.key===e.key:!1}substituteConstants(){const e=Hn.get(this.key);return typeof e=="boolean"?e?ms.INSTANCE:Vs.INSTANCE:this}evaluate(e){return!e.getValue(this.key)}serialize(){return`!${this.key}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=ff.create(this.key,this)),this.negated}}function Ay(o,e){if(typeof o=="string"){const t=parseFloat(o);isNaN(t)||(o=t)}return typeof o=="string"||typeof o=="number"?e(o):ms.INSTANCE}class Oy{static create(e,t,i=null){return Ay(t,n=>new Oy(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=12}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>this.value}serialize(){return`${this.key} > ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=By.create(this.key,this.value,this)),this.negated}}class Fy{static create(e,t,i=null){return Ay(t,n=>new Fy(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=13}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))>=this.value}serialize(){return`${this.key} >= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Wy.create(this.key,this.value,this)),this.negated}}class Wy{static create(e,t,i=null){return Ay(t,n=>new Wy(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=14}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<this.value}serialize(){return`${this.key} < ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Fy.create(this.key,this.value,this)),this.negated}}class By{static create(e,t,i=null){return Ay(t,n=>new By(e,n,i))}constructor(e,t,i){this.key=e,this.value=t,this.negated=i,this.type=15}cmp(e){return e.type!==this.type?this.type-e.type:mf(this.key,this.value,e.key,e.value)}equals(e){return e.type===this.type?this.key===e.key&&this.value===e.value:!1}substituteConstants(){return this}evaluate(e){return typeof this.value=="string"?!1:parseFloat(e.getValue(this.key))<=this.value}serialize(){return`${this.key} <= ${this.value}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=Oy.create(this.key,this.value,this)),this.negated}}class k1{static create(e,t){return new k1(e,t)}constructor(e,t){this.key=e,this.regexp=t,this.type=7,this.negated=null}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.key<e.key)return-1;if(this.key>e.key)return 1;const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return t<i?-1:t>i?1:0}equals(e){if(e.type===this.type){const t=this.regexp?this.regexp.source:"",i=e.regexp?e.regexp.source:"";return this.key===e.key&&t===i}return!1}substituteConstants(){return this}evaluate(e){const t=e.getValue(this.key);return this.regexp?this.regexp.test(t):!1}serialize(){const e=this.regexp?`/${this.regexp.source}/${this.regexp.flags}`:"/invalid/";return`${this.key} =~ ${e}`}keys(){return[this.key]}negate(){return this.negated||(this.negated=d2.create(this)),this.negated}}class d2{static create(e){return new d2(e)}constructor(e){this._actual=e,this.type=8}cmp(e){return e.type!==this.type?this.type-e.type:this._actual.cmp(e._actual)}equals(e){return e.type===this.type?this._actual.equals(e._actual):!1}substituteConstants(){return this}evaluate(e){return!this._actual.evaluate(e)}serialize(){return`!(${this._actual.serialize()})`}keys(){return this._actual.keys()}negate(){return this._actual}}function bH(o){let e=null;for(let t=0,i=o.length;t<i;t++){const n=o[t].substituteConstants();if(o[t]!==n&&e===null){e=[];for(let s=0;s<t;s++)e[s]=o[s]}e!==null&&(e[t]=n)}return e===null?o:e}class pf{static create(e,t,i){return pf._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=6}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const n=x1(this.expr[t],e.expr[t]);if(n!==0)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=bH(this.expr);return e===this.expr?this:pf.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].evaluate(e))return!1;return!0}static _normalizeArr(e,t,i){const n=[];let s=!1;for(const r of e)if(r){if(r.type===1){s=!0;continue}if(r.type===0)return ms.INSTANCE;if(r.type===6){n.push(...r.expr);continue}n.push(r)}if(n.length===0&&s)return Vs.INSTANCE;if(n.length!==0){if(n.length===1)return n[0];n.sort(x1);for(let r=1;r<n.length;r++)n[r-1].equals(n[r])&&(n.splice(r,1),r--);if(n.length===1)return n[0];for(;n.length>1;){const r=n[n.length-1];if(r.type!==9)break;n.pop();const a=n.pop(),l=n.length===0,c=Ac.create(r.expr.map(d=>pf.create([d,a],null,i)),null,l);c&&(n.push(c),n.sort(x1))}if(n.length===1)return n[0];if(i){for(let r=0;r<n.length;r++)for(let a=r+1;a<n.length;a++)if(n[r].negate().equals(n[a]))return ms.INSTANCE;if(n.length===1)return n[0]}return new pf(n,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" && ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());this.negated=Ac.create(e,this,!0)}return this.negated}}class Ac{static create(e,t,i){return Ac._normalizeArr(e,t,i)}constructor(e,t){this.expr=e,this.negated=t,this.type=9}cmp(e){if(e.type!==this.type)return this.type-e.type;if(this.expr.length<e.expr.length)return-1;if(this.expr.length>e.expr.length)return 1;for(let t=0,i=this.expr.length;t<i;t++){const n=x1(this.expr[t],e.expr[t]);if(n!==0)return n}return 0}equals(e){if(e.type===this.type){if(this.expr.length!==e.expr.length)return!1;for(let t=0,i=this.expr.length;t<i;t++)if(!this.expr[t].equals(e.expr[t]))return!1;return!0}return!1}substituteConstants(){const e=bH(this.expr);return e===this.expr?this:Ac.create(e,this.negated,!1)}evaluate(e){for(let t=0,i=this.expr.length;t<i;t++)if(this.expr[t].evaluate(e))return!0;return!1}static _normalizeArr(e,t,i){let n=[],s=!1;if(e){for(let r=0,a=e.length;r<a;r++){const l=e[r];if(l){if(l.type===0){s=!0;continue}if(l.type===1)return Vs.INSTANCE;if(l.type===9){n=n.concat(l.expr);continue}n.push(l)}}if(n.length===0&&s)return ms.INSTANCE;n.sort(x1)}if(n.length!==0){if(n.length===1)return n[0];for(let r=1;r<n.length;r++)n[r-1].equals(n[r])&&(n.splice(r,1),r--);if(n.length===1)return n[0];if(i){for(let r=0;r<n.length;r++)for(let a=r+1;a<n.length;a++)if(n[r].negate().equals(n[a]))return Vs.INSTANCE;if(n.length===1)return n[0]}return new Ac(n,t)}}serialize(){return this.expr.map(e=>e.serialize()).join(" || ")}keys(){const e=[];for(const t of this.expr)e.push(...t.keys());return e}negate(){if(!this.negated){const e=[];for(const t of this.expr)e.push(t.negate());for(;e.length>1;){const t=e.shift(),i=e.shift(),n=[];for(const s of wH(t))for(const r of wH(i))n.push(pf.create([s,r],null,!1));e.unshift(Ac.create(n,null,!1))}this.negated=Ac.create(e,this,!0)}return this.negated}}const pC=class pC extends ff{static all(){return pC._info.values()}constructor(e,t,i){super(e,null),this._defaultValue=t,typeof i=="object"?pC._info.push({...i,key:e}):i!==!0&&pC._info.push({key:e,description:i,type:t!=null?typeof t:void 0})}bindTo(e){return e.createKey(this.key,this._defaultValue)}getValue(e){return e.getContextKeyValue(this.key)}toNegated(){return this.negate()}isEqualTo(e){return Hm.create(this.key,e)}};pC._info=[];let ae=pC;const xe=We("contextKeyService");function CH(o,e){return o<e?-1:o>e?1:0}function mf(o,e,t,i){return o<t?-1:o>t?1:e<i?-1:e>i?1:0}function h2(o,e){if(o.type===0||e.type===1)return!0;if(o.type===9)return e.type===9?vH(o.expr,e.expr):!1;if(e.type===9){for(const t of e.expr)if(h2(o,t))return!0;return!1}if(o.type===6){if(e.type===6)return vH(e.expr,o.expr);for(const t of o.expr)if(h2(t,e))return!0;return!1}return o.equals(e)}function vH(o,e){let t=0,i=0;for(;t<o.length&&i<e.length;){const n=o[t].cmp(e[i]);if(n<0)return!1;n===0&&t++,i++}return t===o.length}function wH(o){return o.type===9?o.expr:[o]}class Mse{constructor(){this.data=new Map}add(e,t){KT(ji(e)),KT(nn(t)),KT(!this.data.has(e),"There is already an extension with this id"),this.data.set(e,t)}as(e){return this.data.get(e)||null}dispose(){this.data.forEach(e=>{Ku(e.dispose)&&e.dispose()}),this.data.clear()}}const ei=new Mse;class u2{constructor(){this._coreKeybindings=new Jn,this._extensionKeybindings=[],this._cachedMergedKeybindings=null}static bindToCurrentPlatform(e){if(so===1){if(e&&e.win)return e.win}else if(so===2){if(e&&e.mac)return e.mac}else if(e&&e.linux)return e.linux;return e}registerKeybindingRule(e){const t=u2.bindToCurrentPlatform(e),i=new U;if(t&&t.primary){const n=nR(t.primary,so);n&&i.add(this._registerDefaultKeybinding(n,e.id,e.args,e.weight,0,e.when))}if(t&&Array.isArray(t.secondary))for(let n=0,s=t.secondary.length;n<s;n++){const r=t.secondary[n],a=nR(r,so);a&&i.add(this._registerDefaultKeybinding(a,e.id,e.args,e.weight,-n-1,e.when))}return i}registerCommandAndKeybindingRule(e){return jr(this.registerKeybindingRule(e),Xe.registerCommand(e))}_registerDefaultKeybinding(e,t,i,n,s,r){const a=this._coreKeybindings.push({keybinding:e,command:t,commandArgs:i,when:r,weight1:n,weight2:s,extensionId:null,isBuiltinExtension:!1});return this._cachedMergedKeybindings=null,ue(()=>{a(),this._cachedMergedKeybindings=null})}getDefaultKeybindings(){return this._cachedMergedKeybindings||(this._cachedMergedKeybindings=Array.from(this._coreKeybindings).concat(this._extensionKeybindings),this._cachedMergedKeybindings.sort(Ase)),this._cachedMergedKeybindings.slice(0)}}const rn=new u2,Pse={EditorModes:"platform.keybindingsRegistry"};ei.add(Pse.EditorModes,rn);function Ase(o,e){if(o.weight1!==e.weight1)return o.weight1-e.weight1;if(o.command&&e.command){if(o.command<e.command)return-1;if(o.command>e.command)return 1}return o.weight2-e.weight2}var Ose=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},SH=function(o,e){return function(t,i){e(t,i,o)}},Hy;function Vm(o){return o.command!==void 0}function Fse(o){return o.submenu!==void 0}const E=class E{constructor(e){if(E._instances.has(e))throw new TypeError(`MenuId with identifier '${e}' already exists. Use MenuId.for(ident) or a unique identifier`);E._instances.set(e,this),this.id=e}};E._instances=new Map,E.CommandPalette=new E("CommandPalette"),E.DebugBreakpointsContext=new E("DebugBreakpointsContext"),E.DebugCallStackContext=new E("DebugCallStackContext"),E.DebugConsoleContext=new E("DebugConsoleContext"),E.DebugVariablesContext=new E("DebugVariablesContext"),E.NotebookVariablesContext=new E("NotebookVariablesContext"),E.DebugHoverContext=new E("DebugHoverContext"),E.DebugWatchContext=new E("DebugWatchContext"),E.DebugToolBar=new E("DebugToolBar"),E.DebugToolBarStop=new E("DebugToolBarStop"),E.DebugDisassemblyContext=new E("DebugDisassemblyContext"),E.DebugCallStackToolbar=new E("DebugCallStackToolbar"),E.DebugCreateConfiguration=new E("DebugCreateConfiguration"),E.EditorContext=new E("EditorContext"),E.SimpleEditorContext=new E("SimpleEditorContext"),E.EditorContent=new E("EditorContent"),E.EditorLineNumberContext=new E("EditorLineNumberContext"),E.EditorContextCopy=new E("EditorContextCopy"),E.EditorContextPeek=new E("EditorContextPeek"),E.EditorContextShare=new E("EditorContextShare"),E.EditorTitle=new E("EditorTitle"),E.CompactWindowEditorTitle=new E("CompactWindowEditorTitle"),E.EditorTitleRun=new E("EditorTitleRun"),E.EditorTitleContext=new E("EditorTitleContext"),E.EditorTitleContextShare=new E("EditorTitleContextShare"),E.EmptyEditorGroup=new E("EmptyEditorGroup"),E.EmptyEditorGroupContext=new E("EmptyEditorGroupContext"),E.EditorTabsBarContext=new E("EditorTabsBarContext"),E.EditorTabsBarShowTabsSubmenu=new E("EditorTabsBarShowTabsSubmenu"),E.EditorTabsBarShowTabsZenModeSubmenu=new E("EditorTabsBarShowTabsZenModeSubmenu"),E.EditorActionsPositionSubmenu=new E("EditorActionsPositionSubmenu"),E.EditorSplitMoveSubmenu=new E("EditorSplitMoveSubmenu"),E.ExplorerContext=new E("ExplorerContext"),E.ExplorerContextShare=new E("ExplorerContextShare"),E.ExtensionContext=new E("ExtensionContext"),E.ExtensionEditorContextMenu=new E("ExtensionEditorContextMenu"),E.GlobalActivity=new E("GlobalActivity"),E.CommandCenter=new E("CommandCenter"),E.CommandCenterCenter=new E("CommandCenterCenter"),E.LayoutControlMenuSubmenu=new E("LayoutControlMenuSubmenu"),E.LayoutControlMenu=new E("LayoutControlMenu"),E.MenubarMainMenu=new E("MenubarMainMenu"),E.MenubarAppearanceMenu=new E("MenubarAppearanceMenu"),E.MenubarDebugMenu=new E("MenubarDebugMenu"),E.MenubarEditMenu=new E("MenubarEditMenu"),E.MenubarCopy=new E("MenubarCopy"),E.MenubarFileMenu=new E("MenubarFileMenu"),E.MenubarGoMenu=new E("MenubarGoMenu"),E.MenubarHelpMenu=new E("MenubarHelpMenu"),E.MenubarLayoutMenu=new E("MenubarLayoutMenu"),E.MenubarNewBreakpointMenu=new E("MenubarNewBreakpointMenu"),E.PanelAlignmentMenu=new E("PanelAlignmentMenu"),E.PanelPositionMenu=new E("PanelPositionMenu"),E.ActivityBarPositionMenu=new E("ActivityBarPositionMenu"),E.MenubarPreferencesMenu=new E("MenubarPreferencesMenu"),E.MenubarRecentMenu=new E("MenubarRecentMenu"),E.MenubarSelectionMenu=new E("MenubarSelectionMenu"),E.MenubarShare=new E("MenubarShare"),E.MenubarSwitchEditorMenu=new E("MenubarSwitchEditorMenu"),E.MenubarSwitchGroupMenu=new E("MenubarSwitchGroupMenu"),E.MenubarTerminalMenu=new E("MenubarTerminalMenu"),E.MenubarTerminalSuggestStatusMenu=new E("MenubarTerminalSuggestStatusMenu"),E.MenubarViewMenu=new E("MenubarViewMenu"),E.MenubarHomeMenu=new E("MenubarHomeMenu"),E.OpenEditorsContext=new E("OpenEditorsContext"),E.OpenEditorsContextShare=new E("OpenEditorsContextShare"),E.ProblemsPanelContext=new E("ProblemsPanelContext"),E.SCMInputBox=new E("SCMInputBox"),E.SCMChangeContext=new E("SCMChangeContext"),E.SCMResourceContext=new E("SCMResourceContext"),E.SCMResourceContextShare=new E("SCMResourceContextShare"),E.SCMResourceFolderContext=new E("SCMResourceFolderContext"),E.SCMResourceGroupContext=new E("SCMResourceGroupContext"),E.SCMSourceControl=new E("SCMSourceControl"),E.SCMSourceControlInline=new E("SCMSourceControlInline"),E.SCMSourceControlTitle=new E("SCMSourceControlTitle"),E.SCMHistoryTitle=new E("SCMHistoryTitle"),E.SCMHistoryItemContext=new E("SCMHistoryItemContext"),E.SCMHistoryItemChangeContext=new E("SCMHistoryItemChangeContext"),E.SCMHistoryItemHover=new E("SCMHistoryItemHover"),E.SCMHistoryItemRefContext=new E("SCMHistoryItemRefContext"),E.SCMQuickDiffDecorations=new E("SCMQuickDiffDecorations"),E.SCMTitle=new E("SCMTitle"),E.SearchContext=new E("SearchContext"),E.SearchActionMenu=new E("SearchActionContext"),E.StatusBarWindowIndicatorMenu=new E("StatusBarWindowIndicatorMenu"),E.StatusBarRemoteIndicatorMenu=new E("StatusBarRemoteIndicatorMenu"),E.StickyScrollContext=new E("StickyScrollContext"),E.TestItem=new E("TestItem"),E.TestItemGutter=new E("TestItemGutter"),E.TestProfilesContext=new E("TestProfilesContext"),E.TestMessageContext=new E("TestMessageContext"),E.TestMessageContent=new E("TestMessageContent"),E.TestPeekElement=new E("TestPeekElement"),E.TestPeekTitle=new E("TestPeekTitle"),E.TestCallStack=new E("TestCallStack"),E.TestCoverageFilterItem=new E("TestCoverageFilterItem"),E.TouchBarContext=new E("TouchBarContext"),E.TitleBar=new E("TitleBar"),E.TitleBarContext=new E("TitleBarContext"),E.TitleBarTitleContext=new E("TitleBarTitleContext"),E.TunnelContext=new E("TunnelContext"),E.TunnelPrivacy=new E("TunnelPrivacy"),E.TunnelProtocol=new E("TunnelProtocol"),E.TunnelPortInline=new E("TunnelInline"),E.TunnelTitle=new E("TunnelTitle"),E.TunnelLocalAddressInline=new E("TunnelLocalAddressInline"),E.TunnelOriginInline=new E("TunnelOriginInline"),E.ViewItemContext=new E("ViewItemContext"),E.ViewContainerTitle=new E("ViewContainerTitle"),E.ViewContainerTitleContext=new E("ViewContainerTitleContext"),E.ViewTitle=new E("ViewTitle"),E.ViewTitleContext=new E("ViewTitleContext"),E.CommentEditorActions=new E("CommentEditorActions"),E.CommentThreadTitle=new E("CommentThreadTitle"),E.CommentThreadActions=new E("CommentThreadActions"),E.CommentThreadAdditionalActions=new E("CommentThreadAdditionalActions"),E.CommentThreadTitleContext=new E("CommentThreadTitleContext"),E.CommentThreadCommentContext=new E("CommentThreadCommentContext"),E.CommentTitle=new E("CommentTitle"),E.CommentActions=new E("CommentActions"),E.CommentsViewThreadActions=new E("CommentsViewThreadActions"),E.InteractiveToolbar=new E("InteractiveToolbar"),E.InteractiveCellTitle=new E("InteractiveCellTitle"),E.InteractiveCellDelete=new E("InteractiveCellDelete"),E.InteractiveCellExecute=new E("InteractiveCellExecute"),E.InteractiveInputExecute=new E("InteractiveInputExecute"),E.InteractiveInputConfig=new E("InteractiveInputConfig"),E.ReplInputExecute=new E("ReplInputExecute"),E.IssueReporter=new E("IssueReporter"),E.NotebookToolbar=new E("NotebookToolbar"),E.NotebookToolbarContext=new E("NotebookToolbarContext"),E.NotebookStickyScrollContext=new E("NotebookStickyScrollContext"),E.NotebookCellTitle=new E("NotebookCellTitle"),E.NotebookCellDelete=new E("NotebookCellDelete"),E.NotebookCellInsert=new E("NotebookCellInsert"),E.NotebookCellBetween=new E("NotebookCellBetween"),E.NotebookCellListTop=new E("NotebookCellTop"),E.NotebookCellExecute=new E("NotebookCellExecute"),E.NotebookCellExecuteGoTo=new E("NotebookCellExecuteGoTo"),E.NotebookCellExecutePrimary=new E("NotebookCellExecutePrimary"),E.NotebookDiffCellInputTitle=new E("NotebookDiffCellInputTitle"),E.NotebookDiffDocumentMetadata=new E("NotebookDiffDocumentMetadata"),E.NotebookDiffCellMetadataTitle=new E("NotebookDiffCellMetadataTitle"),E.NotebookDiffCellOutputsTitle=new E("NotebookDiffCellOutputsTitle"),E.NotebookOutputToolbar=new E("NotebookOutputToolbar"),E.NotebookOutlineFilter=new E("NotebookOutlineFilter"),E.NotebookOutlineActionMenu=new E("NotebookOutlineActionMenu"),E.NotebookEditorLayoutConfigure=new E("NotebookEditorLayoutConfigure"),E.NotebookKernelSource=new E("NotebookKernelSource"),E.BulkEditTitle=new E("BulkEditTitle"),E.BulkEditContext=new E("BulkEditContext"),E.TimelineItemContext=new E("TimelineItemContext"),E.TimelineTitle=new E("TimelineTitle"),E.TimelineTitleContext=new E("TimelineTitleContext"),E.TimelineFilterSubMenu=new E("TimelineFilterSubMenu"),E.AccountsContext=new E("AccountsContext"),E.SidebarTitle=new E("SidebarTitle"),E.PanelTitle=new E("PanelTitle"),E.AuxiliaryBarTitle=new E("AuxiliaryBarTitle"),E.TerminalInstanceContext=new E("TerminalInstanceContext"),E.TerminalEditorInstanceContext=new E("TerminalEditorInstanceContext"),E.TerminalNewDropdownContext=new E("TerminalNewDropdownContext"),E.TerminalTabContext=new E("TerminalTabContext"),E.TerminalTabEmptyAreaContext=new E("TerminalTabEmptyAreaContext"),E.TerminalStickyScrollContext=new E("TerminalStickyScrollContext"),E.WebviewContext=new E("WebviewContext"),E.InlineCompletionsActions=new E("InlineCompletionsActions"),E.InlineEditsActions=new E("InlineEditsActions"),E.NewFile=new E("NewFile"),E.MergeInput1Toolbar=new E("MergeToolbar1Toolbar"),E.MergeInput2Toolbar=new E("MergeToolbar2Toolbar"),E.MergeBaseToolbar=new E("MergeBaseToolbar"),E.MergeInputResultToolbar=new E("MergeToolbarResultToolbar"),E.InlineSuggestionToolbar=new E("InlineSuggestionToolbar"),E.InlineEditToolbar=new E("InlineEditToolbar"),E.ChatContext=new E("ChatContext"),E.ChatCodeBlock=new E("ChatCodeblock"),E.ChatCompareBlock=new E("ChatCompareBlock"),E.ChatMessageTitle=new E("ChatMessageTitle"),E.ChatHistory=new E("ChatHistory"),E.ChatWelcomeHistoryContext=new E("ChatWelcomeHistoryContext"),E.ChatMessageFooter=new E("ChatMessageFooter"),E.ChatExecute=new E("ChatExecute"),E.ChatExecuteSecondary=new E("ChatExecuteSecondary"),E.ChatInput=new E("ChatInput"),E.ChatInputSide=new E("ChatInputSide"),E.ChatModePicker=new E("ChatModePicker"),E.ChatEditingWidgetToolbar=new E("ChatEditingWidgetToolbar"),E.ChatEditingEditorContent=new E("ChatEditingEditorContent"),E.ChatEditingEditorHunk=new E("ChatEditingEditorHunk"),E.ChatEditingDeletedNotebookCell=new E("ChatEditingDeletedNotebookCell"),E.ChatInputAttachmentToolbar=new E("ChatInputAttachmentToolbar"),E.ChatEditingWidgetModifiedFilesToolbar=new E("ChatEditingWidgetModifiedFilesToolbar"),E.ChatInputResourceAttachmentContext=new E("ChatInputResourceAttachmentContext"),E.ChatInputSymbolAttachmentContext=new E("ChatInputSymbolAttachmentContext"),E.ChatInlineResourceAnchorContext=new E("ChatInlineResourceAnchorContext"),E.ChatInlineSymbolAnchorContext=new E("ChatInlineSymbolAnchorContext"),E.ChatMessageCheckpoint=new E("ChatMessageCheckpoint"),E.ChatMessageRestoreCheckpoint=new E("ChatMessageRestoreCheckpoint"),E.ChatEditingCodeBlockContext=new E("ChatEditingCodeBlockContext"),E.ChatTitleBarMenu=new E("ChatTitleBarMenu"),E.ChatAttachmentsContext=new E("ChatAttachmentsContext"),E.ChatToolOutputResourceToolbar=new E("ChatToolOutputResourceToolbar"),E.ChatTextEditorMenu=new E("ChatTextEditorMenu"),E.ChatToolOutputResourceContext=new E("ChatToolOutputResourceContext"),E.ChatMultiDiffContext=new E("ChatMultiDiffContext"),E.ChatSessionsMenu=new E("ChatSessionsMenu"),E.ChatConfirmationMenu=new E("ChatConfirmationMenu"),E.AccessibleView=new E("AccessibleView"),E.MultiDiffEditorFileToolbar=new E("MultiDiffEditorFileToolbar"),E.DiffEditorHunkToolbar=new E("DiffEditorHunkToolbar"),E.DiffEditorSelectionToolbar=new E("DiffEditorSelectionToolbar");let de=E;const Cr=We("menuService"),kS=class kS{static for(e){let t=this._all.get(e);return t||(t=new kS(e),this._all.set(e,t)),t}static merge(e){const t=new Set;for(const i of e)i instanceof kS&&t.add(i.id);return t}constructor(e){this.id=e,this.has=t=>t===e}};kS._all=new Map;let _f=kS;const an=new class{constructor(){this._commands=new Map,this._menuItems=new Map,this._onDidChangeMenu=new hie({merge:_f.merge}),this.onDidChangeMenu=this._onDidChangeMenu.event}addCommand(o){return this._commands.set(o.id,o),this._onDidChangeMenu.fire(_f.for(de.CommandPalette)),ue(()=>{this._commands.delete(o.id)&&this._onDidChangeMenu.fire(_f.for(de.CommandPalette))})}getCommand(o){return this._commands.get(o)}getCommands(){const o=new Map;return this._commands.forEach((e,t)=>o.set(t,e)),o}appendMenuItem(o,e){let t=this._menuItems.get(o);t||(t=new Jn,this._menuItems.set(o,t));const i=t.push(e);return this._onDidChangeMenu.fire(_f.for(o)),ue(()=>{i(),this._onDidChangeMenu.fire(_f.for(o))})}appendMenuItems(o){const e=new U;for(const{id:t,item:i}of o)e.add(this.appendMenuItem(t,i));return e}getMenuItems(o){let e;return this._menuItems.has(o)?e=[...this._menuItems.get(o)]:e=[],o===de.CommandPalette&&this._appendImplicitItems(e),e}_appendImplicitItems(o){const e=new Set;for(const t of o)Vm(t)&&(e.add(t.command.id),t.alt&&e.add(t.alt.id));this._commands.forEach((t,i)=>{e.has(i)||o.push({command:t})})}};class bf extends Bm{constructor(e,t,i){super(`submenuitem.${e.submenu.id}`,typeof e.title=="string"?e.title:e.title.value,i,"submenu"),this.item=e,this.hideActions=t}}let Po=Hy=class{static label(e,t){return t?.renderShortTitle&&e.shortTitle?typeof e.shortTitle=="string"?e.shortTitle:e.shortTitle.value:typeof e.title=="string"?e.title:e.title.value}constructor(e,t,i,n,s,r,a){this.hideActions=n,this.menuKeybinding=s,this._commandService=a,this.id=e.id,this.label=Hy.label(e,i),this.tooltip=(typeof e.tooltip=="string"?e.tooltip:e.tooltip?.value)??"",this.enabled=!e.precondition||r.contextMatchesRules(e.precondition),this.checked=void 0;let l;if(e.toggled){const c=e.toggled.condition?e.toggled:{condition:e.toggled};this.checked=r.contextMatchesRules(c.condition),this.checked&&c.tooltip&&(this.tooltip=typeof c.tooltip=="string"?c.tooltip:c.tooltip.value),this.checked&&ve.isThemeIcon(c.icon)&&(l=c.icon),this.checked&&c.title&&(this.label=typeof c.title=="string"?c.title:c.title.value)}l||(l=ve.isThemeIcon(e.icon)?e.icon:void 0),this.item=e,this.alt=t?new Hy(t,void 0,i,n,void 0,r,a):void 0,this._options=i,this.class=l&&ve.asClassName(l)}run(...e){let t=[];return this._options?.arg&&(t=[...t,this._options.arg]),this._options?.shouldForwardArgs&&(t=[...t,...e]),this._commandService.executeCommand(this.id,...t)}};Po=Hy=Ose([SH(5,xe),SH(6,Tt)],Po);class ln{constructor(e){this.desc=e}}function mt(o){const e=[],t=new o,{f1:i,menu:n,keybinding:s,...r}=t.desc;if(Xe.getCommand(r.id))throw new Error(`Cannot register two commands with the same id: ${r.id}`);if(e.push(Xe.registerCommand({id:r.id,handler:(a,...l)=>t.run(a,...l),metadata:r.metadata??{description:t.desc.title}})),Array.isArray(n))for(const a of n)e.push(an.appendMenuItem(a.id,{command:{...r,precondition:a.precondition===null?void 0:r.precondition},...a}));else n&&e.push(an.appendMenuItem(n.id,{command:{...r,precondition:n.precondition===null?void 0:r.precondition},...n}));if(i&&(e.push(an.appendMenuItem(de.CommandPalette,{command:r,when:r.precondition})),e.push(an.addCommand(r))),Array.isArray(s))for(const a of s)e.push(rn.registerKeybindingRule({...a,id:r.id,when:r.precondition?K.and(r.precondition,a.when):a.when}));else s&&e.push(rn.registerKeybindingRule({...s,id:r.id,when:r.precondition?K.and(r.precondition,s.when):s.when}));return{dispose(){pt(e)}}}const Vn=We("telemetryService");var yH,LH,xH;class Wse{constructor(e,t){this.uri=e,this.value=t}}function Bse(o){return Array.isArray(o)}const vp=class vp{constructor(e,t){if(this[yH]="ResourceMap",e instanceof vp)this.map=new Map(e.map),this.toKey=t??vp.defaultToKey;else if(Bse(e)){this.map=new Map,this.toKey=t??vp.defaultToKey;for(const[i,n]of e)this.set(i,n)}else this.map=new Map,this.toKey=e??vp.defaultToKey}set(e,t){return this.map.set(this.toKey(e),new Wse(e,t)),this}get(e){return this.map.get(this.toKey(e))?.value}has(e){return this.map.has(this.toKey(e))}get size(){return this.map.size}clear(){this.map.clear()}delete(e){return this.map.delete(this.toKey(e))}forEach(e,t){typeof t<"u"&&(e=e.bind(t));for(const[i,n]of this.map)e(n.value,n.uri,this)}*values(){for(const e of this.map.values())yield e.value}*keys(){for(const e of this.map.values())yield e.uri}*entries(){for(const e of this.map.values())yield[e.uri,e.value]}*[(yH=Symbol.toStringTag,Symbol.iterator)](){for(const[,e]of this.map)yield[e.uri,e.value]}};vp.defaultToKey=e=>e.toString();let Li=vp;class Hse{constructor(e,t){this[LH]="ResourceSet",!e||typeof e=="function"?this._map=new Li(e):(this._map=new Li(t),e.forEach(this.add,this))}get size(){return this._map.size}add(e){return this._map.set(e,e),this}clear(){this._map.clear()}delete(e){return this._map.delete(e)}forEach(e,t){this._map.forEach((i,n)=>e.call(t,n,n,this))}has(e){return this._map.has(e)}entries(){return this._map.entries()}keys(){return this._map.keys()}values(){return this._map.keys()}[(LH=Symbol.toStringTag,Symbol.iterator)](){return this.keys()}}class Vse{constructor(){this[xH]="LinkedMap",this._map=new Map,this._head=void 0,this._tail=void 0,this._size=0,this._state=0}clear(){this._map.clear(),this._head=void 0,this._tail=void 0,this._size=0,this._state++}isEmpty(){return!this._head&&!this._tail}get size(){return this._size}get first(){return this._head?.value}get last(){return this._tail?.value}has(e){return this._map.has(e)}get(e,t=0){const i=this._map.get(e);if(i)return t!==0&&this.touch(i,t),i.value}set(e,t,i=0){let n=this._map.get(e);if(n)n.value=t,i!==0&&this.touch(n,i);else{switch(n={key:e,value:t,next:void 0,previous:void 0},i){case 0:this.addItemLast(n);break;case 1:this.addItemFirst(n);break;case 2:this.addItemLast(n);break;default:this.addItemLast(n);break}this._map.set(e,n),this._size++}return this}delete(e){return!!this.remove(e)}remove(e){const t=this._map.get(e);if(t)return this._map.delete(e),this.removeItem(t),this._size--,t.value}shift(){if(!this._head&&!this._tail)return;if(!this._head||!this._tail)throw new Error("Invalid list");const e=this._head;return this._map.delete(e.key),this.removeItem(e),this._size--,e.value}forEach(e,t){const i=this._state;let n=this._head;for(;n;){if(t?e.bind(t)(n.value,n.key,this):e(n.value,n.key,this),this._state!==i)throw new Error("LinkedMap got modified during iteration.");n=n.next}}keys(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.key,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return n}values(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:i.value,done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return n}entries(){const e=this,t=this._state;let i=this._head;const n={[Symbol.iterator](){return n},next(){if(e._state!==t)throw new Error("LinkedMap got modified during iteration.");if(i){const s={value:[i.key,i.value],done:!1};return i=i.next,s}else return{value:void 0,done:!0}}};return n}[(xH=Symbol.toStringTag,Symbol.iterator)](){return this.entries()}trimOld(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._head,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.next,i--;this._head=t,this._size=i,t&&(t.previous=void 0),this._state++}trimNew(e){if(e>=this.size)return;if(e===0){this.clear();return}let t=this._tail,i=this.size;for(;t&&i>e;)this._map.delete(t.key),t=t.previous,i--;this._tail=t,this._size=i,t&&(t.next=void 0),this._state++}addItemFirst(e){if(!this._head&&!this._tail)this._tail=e;else if(this._head)e.next=this._head,this._head.previous=e;else throw new Error("Invalid list");this._head=e,this._state++}addItemLast(e){if(!this._head&&!this._tail)this._head=e;else if(this._tail)e.previous=this._tail,this._tail.next=e;else throw new Error("Invalid list");this._tail=e,this._state++}removeItem(e){if(e===this._head&&e===this._tail)this._head=void 0,this._tail=void 0;else if(e===this._head){if(!e.next)throw new Error("Invalid list");e.next.previous=void 0,this._head=e.next}else if(e===this._tail){if(!e.previous)throw new Error("Invalid list");e.previous.next=void 0,this._tail=e.previous}else{const t=e.next,i=e.previous;if(!t||!i)throw new Error("Invalid list");t.previous=i,i.next=t}e.next=void 0,e.previous=void 0,this._state++}touch(e,t){if(!this._head||!this._tail)throw new Error("Invalid list");if(!(t!==1&&t!==2)){if(t===1){if(e===this._head)return;const i=e.next,n=e.previous;e===this._tail?(n.next=void 0,this._tail=n):(i.previous=n,n.next=i),e.previous=void 0,e.next=this._head,this._head.previous=e,this._head=e,this._state++}else if(t===2){if(e===this._tail)return;const i=e.next,n=e.previous;e===this._head?(i.previous=void 0,this._head=i):(i.previous=n,n.next=i),e.next=void 0,e.previous=this._tail,this._tail.next=e,this._tail=e,this._state++}}}toJSON(){const e=[];return this.forEach((t,i)=>{e.push([i,t])}),e}fromJSON(e){this.clear();for(const[t,i]of e)this.set(t,i)}}class zse extends Vse{constructor(e,t=1){super(),this._limit=e,this._ratio=Math.min(Math.max(0,t),1)}get limit(){return this._limit}set limit(e){this._limit=e,this.checkTrim()}get(e,t=2){return super.get(e,t)}peek(e){return super.get(e,0)}set(e,t){return super.set(e,t,2),this}checkTrim(){this.size>this._limit&&this.trim(Math.round(this._limit*this._ratio))}}class dl extends zse{constructor(e,t=1){super(e,t)}trim(e){this.trimOld(e)}set(e,t){return super.set(e,t),this.checkTrim(),this}}class Use{constructor(e){if(this._m1=new Map,this._m2=new Map,e)for(const[t,i]of e)this.set(t,i)}clear(){this._m1.clear(),this._m2.clear()}set(e,t){this._m1.set(e,t),this._m2.set(t,e)}get(e){return this._m1.get(e)}getKey(e){return this._m2.get(e)}delete(e){const t=this._m1.get(e);return t===void 0?!1:(this._m1.delete(e),this._m2.delete(t),!0)}keys(){return this._m1.keys()}values(){return this._m1.values()}}class kH{constructor(){this.map=new Map}add(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}delete(e,t){const i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}forEach(e,t){const i=this.map.get(e);i&&i.forEach(t)}}class Vy{constructor(){this._data=new Map}set(e,...t){let i=this._data;for(let n=0;n<t.length-1;n++)i.has(t[n])||i.set(t[n],new Map),i=i.get(t[n]);i.set(t[t.length-1],e)}get(...e){let t=this._data;for(let i=0;i<e.length-1;i++){if(!t.has(e[i]))return;t=t.get(e[i])}return t.get(e[e.length-1])}clear(){this._data.clear()}toString(){const e=(t,i)=>{let n="";for(const[s,r]of t)n+=`${" ".repeat(i)}${s}: `,r instanceof Map?n+=`
`+e(r,i+1):n+=`${r}
`;return n};return e(this._data,0)}}function lh(o){return o===47||o===92}function IH(o){return o.replace(/[\\/]/g,Pi.sep)}function $se(o){return o.indexOf("/")===-1&&(o=IH(o)),/^[a-zA-Z]:(\/|$)/.test(o)&&(o="/"+o),o}function DH(o,e=Pi.sep){if(!o)return"";const t=o.length,i=o.charCodeAt(0);if(lh(i)){if(lh(o.charCodeAt(1))&&!lh(o.charCodeAt(2))){let s=3;const r=s;for(;s<t&&!lh(o.charCodeAt(s));s++);if(r!==s&&!lh(o.charCodeAt(s+1))){for(s+=1;s<t;s++)if(lh(o.charCodeAt(s)))return o.slice(0,s+1).replace(/[\\/]/g,e)}}return e}else if(EH(i)&&o.charCodeAt(1)===58)return lh(o.charCodeAt(2))?o.slice(0,2)+e:o.slice(0,2);let n=o.indexOf("://");if(n!==-1){for(n+=3;n<t;n++)if(lh(o.charCodeAt(n)))return o.slice(0,n+1)}return""}function f2(o,e,t,i=_a){if(o===e)return!0;if(!o||!e||e.length>o.length)return!1;if(t){if(!_R(o,e))return!1;if(e.length===o.length)return!0;let s=e.length;return e.charAt(e.length-1)===i&&s--,o.charAt(s)===i}return e.charAt(e.length-1)!==i&&(e+=i),o.indexOf(e)===0}function EH(o){return o>=65&&o<=90||o>=97&&o<=122}function jse(o,e=gn){return e?EH(o.charCodeAt(0))&&o.charCodeAt(1)===58:!1}function hl(o){return hy(o,!0)}class qse{constructor(e){this._ignorePathCasing=e}compare(e,t,i=!1){return e===t?0:a1(this.getComparisonKey(e,i),this.getComparisonKey(t,i))}isEqual(e,t,i=!1){return e===t?!0:!e||!t?!1:this.getComparisonKey(e,i)===this.getComparisonKey(t,i)}getComparisonKey(e,t=!1){return e.with({path:this._ignorePathCasing(e)?e.path.toLowerCase():void 0,fragment:t?null:void 0}).toString()}isEqualOrParent(e,t,i=!1){if(e.scheme===t.scheme){if(e.scheme===we.file)return f2(hl(e),hl(t),this._ignorePathCasing(e))&&e.query===t.query&&(i||e.fragment===t.fragment);if(RH(e.authority,t.authority))return f2(e.path,t.path,this._ignorePathCasing(e),"/")&&e.query===t.query&&(i||e.fragment===t.fragment)}return!1}joinPath(e,...t){return be.joinPath(e,...t)}basenameOrAuthority(e){return vr(e)||e.authority}basename(e){return Pi.basename(e.path)}extname(e){return Pi.extname(e.path)}dirname(e){if(e.path.length===0)return e;let t;return e.scheme===we.file?t=be.file(d6(hl(e))).path:(t=Pi.dirname(e.path),e.authority&&t.length&&t.charCodeAt(0)!==47&&(console.error(`dirname("${e.toString})) resulted in a relative path`),t="/")),e.with({path:t})}normalizePath(e){if(!e.path.length)return e;let t;return e.scheme===we.file?t=be.file(c6(hl(e))).path:t=Pi.normalize(e.path),e.with({path:t})}relativePath(e,t){if(e.scheme!==t.scheme||!RH(e.authority,t.authority))return;if(e.scheme===we.file){const s=Kie(hl(e),hl(t));return gn?IH(s):s}let i=e.path||"/";const n=t.path||"/";if(this._ignorePathCasing(e)){let s=0;for(const r=Math.min(i.length,n.length);s<r&&!(i.charCodeAt(s)!==n.charCodeAt(s)&&i.charAt(s).toLowerCase()!==n.charAt(s).toLowerCase());s++);i=n.substr(0,s)+i.substr(s)}return Pi.relative(i,n)}resolvePath(e,t){if(e.scheme===we.file){const i=be.file(qie(hl(e),t));return e.with({authority:i.authority,path:i.path})}return t=$se(t),e.with({path:Pi.resolve(e.path,t)})}isAbsolutePath(e){return!!e.path&&e.path[0]==="/"}isEqualAuthority(e,t){return e===t||e!==void 0&&t!==void 0&&Nm(e,t)}hasTrailingPathSeparator(e,t=_a){if(e.scheme===we.file){const i=hl(e);return i.length>DH(i).length&&i[i.length-1]===t}else{const i=e.path;return i.length>1&&i.charCodeAt(i.length-1)===47&&!/^[a-zA-Z]:(\/$|\\$)/.test(e.fsPath)}}removeTrailingPathSeparator(e,t=_a){return MH(e,t)?e.with({path:e.path.substr(0,e.path.length-1)}):e}addTrailingPathSeparator(e,t=_a){let i=!1;if(e.scheme===we.file){const n=hl(e);i=n!==void 0&&n.length===DH(n).length&&n[n.length-1]===t}else{t="/";const n=e.path;i=n.length===1&&n.charCodeAt(n.length-1)===47}return!i&&!MH(e,t)?e.with({path:e.path+"/"}):e}}const $t=new qse(()=>!1),ch=$t.isEqual.bind($t);$t.isEqualOrParent.bind($t),$t.getComparisonKey.bind($t);const Kse=$t.basenameOrAuthority.bind($t),vr=$t.basename.bind($t),Gse=$t.extname.bind($t),zy=$t.dirname.bind($t),NH=$t.joinPath.bind($t),Zse=$t.normalizePath.bind($t),Yse=$t.relativePath.bind($t),TH=$t.resolvePath.bind($t);$t.isAbsolutePath.bind($t);const RH=$t.isEqualAuthority.bind($t),MH=$t.hasTrailingPathSeparator.bind($t);$t.removeTrailingPathSeparator.bind($t),$t.addTrailingPathSeparator.bind($t);var dh;(function(o){o.META_DATA_LABEL="label",o.META_DATA_DESCRIPTION="description",o.META_DATA_SIZE="size",o.META_DATA_MIME="mime";function e(t){const i=new Map;t.path.substring(t.path.indexOf(";")+1,t.path.lastIndexOf(";")).split(";").forEach(r=>{const[a,l]=r.split(":");a&&l&&i.set(a,l)});const s=t.path.substring(0,t.path.indexOf(";"));return s&&i.set(o.META_DATA_MIME,s),i}o.parseMetaData=e})(dh||(dh={}));const Rt=We("logService"),PH=We("loggerService");var Qi;(function(o){o[o.Off=0]="Off",o[o.Trace=1]="Trace",o[o.Debug=2]="Debug",o[o.Info=3]="Info",o[o.Warning=4]="Warning",o[o.Error=5]="Error"})(Qi||(Qi={}));const AH=Qi.Info;function OH(o,e){return o!==Qi.Off&&o<=e}class FH extends A{constructor(){super(...arguments),this.level=AH,this._onDidChangeLogLevel=this._register(new P)}get onDidChangeLogLevel(){return this._onDidChangeLogLevel.event}setLevel(e){this.level!==e&&(this.level=e,this._onDidChangeLogLevel.fire(this.level))}getLevel(){return this.level}checkLogLevel(e){return OH(this.level,e)}canLog(e){return this._store.isDisposed?!1:this.checkLogLevel(e)}}class Xse extends FH{constructor(e=AH,t=!0){super(),this.useColors=t,this.setLevel(e)}trace(e,...t){this.canLog(Qi.Trace)&&(this.useColors?console.log("%cTRACE","color: #888",e,...t):console.log(e,...t))}debug(e,...t){this.canLog(Qi.Debug)&&(this.useColors?console.log("%cDEBUG","background: #eee; color: #888",e,...t):console.log(e,...t))}info(e,...t){this.canLog(Qi.Info)&&(this.useColors?console.log("%c INFO","color: #33f",e,...t):console.log(e,...t))}warn(e,...t){this.canLog(Qi.Warning)&&(this.useColors?console.warn("%c WARN","color: #993",e,...t):console.log(e,...t))}error(e,...t){this.canLog(Qi.Error)&&(this.useColors?console.error("%c ERR","color: #f33",e,...t):console.error(e,...t))}}class Qse extends FH{constructor(e){super(),this.loggers=e,e.length&&this.setLevel(e[0].getLevel())}setLevel(e){for(const t of this.loggers)t.setLevel(e);super.setLevel(e)}trace(e,...t){for(const i of this.loggers)i.trace(e,...t)}debug(e,...t){for(const i of this.loggers)i.debug(e,...t)}info(e,...t){for(const i of this.loggers)i.info(e,...t)}warn(e,...t){for(const i of this.loggers)i.warn(e,...t)}error(e,...t){for(const i of this.loggers)i.error(e,...t)}dispose(){for(const e of this.loggers)e.dispose();super.dispose()}}class Jse extends A{constructor(e,t,i){if(super(),this.logLevel=e,this.logsHome=t,this._loggers=new Li,this._onDidChangeLoggers=this._register(new P),this._onDidChangeVisibility=this._register(new P),i)for(const n of i)this._loggers.set(n.resource,{logger:void 0,info:n})}getLoggerEntry(e){return ji(e)?[...this._loggers.values()].find(t=>t.info.id===e):this._loggers.get(e)}createLogger(e,t){const i=this.toResource(e),n=ji(e)?e:t?.id??h1(i.toString()).toString(16);let s=this._loggers.get(i)?.logger;const r=t?.logLevel==="always"?Qi.Trace:t?.logLevel;s||(s=this.doCreateLogger(i,r??this.getLogLevel(i)??this.logLevel,{...t,id:n}));const a={logger:s,info:{resource:i,id:n,logLevel:r,name:t?.name,hidden:t?.hidden,group:t?.group,extensionId:t?.extensionId,when:t?.when}};return this.registerLogger(a.info),this._loggers.set(i,a),s}toResource(e){return ji(e)?NH(this.logsHome,`${e}.log`):e}setVisibility(e,t){const i=this.getLoggerEntry(e);i&&t!==!i.info.hidden&&(i.info.hidden=!t,this._loggers.set(i.info.resource,i),this._onDidChangeVisibility.fire([i.info.resource,t]))}getLogLevel(e){let t;return e&&(t=this._loggers.get(e)?.info.logLevel),t??this.logLevel}registerLogger(e){const t=this._loggers.get(e.resource);t?t.info.hidden!==e.hidden&&this.setVisibility(e.resource,!e.hidden):(this._loggers.set(e.resource,{info:e,logger:void 0}),this._onDidChangeLoggers.fire({added:[e],removed:[]}))}dispose(){this._loggers.forEach(e=>e.logger?.dispose()),this._loggers.clear(),super.dispose()}}class eoe{constructor(){this.onDidChangeLogLevel=new P().event}setLevel(e){}getLevel(){return Qi.Info}trace(e,...t){}debug(e,...t){}info(e,...t){}warn(e,...t){}error(e,...t){}dispose(){}}class toe extends Jse{constructor(){super(Qi.Off,be.parse("log:///log"))}doCreateLogger(e,t,i){return new eoe}}function ioe(o){switch(o){case Qi.Trace:return"trace";case Qi.Debug:return"debug";case Qi.Info:return"info";case Qi.Warning:return"warn";case Qi.Error:return"error";case Qi.Off:return"off"}}new ae("logLevel",ioe(Qi.Info));let Uy=class{constructor(e){this.id=e.id,this.precondition=e.precondition,this._kbOpts=e.kbOpts,this._menuOpts=e.menuOpts,this.metadata=e.metadata}register(){if(Array.isArray(this._menuOpts)?this._menuOpts.forEach(this._registerMenuItem,this):this._menuOpts&&this._registerMenuItem(this._menuOpts),this._kbOpts){const e=Array.isArray(this._kbOpts)?this._kbOpts:[this._kbOpts];for(const t of e){let i=t.kbExpr;this.precondition&&(i?i=K.and(i,this.precondition):i=this.precondition);const n={id:this.id,weight:t.weight,args:t.args,when:i,primary:t.primary,secondary:t.secondary,win:t.win,linux:t.linux,mac:t.mac};rn.registerKeybindingRule(n)}}Xe.registerCommand({id:this.id,handler:(e,t)=>this.runCommand(e,t),metadata:this.metadata})}_registerMenuItem(e){an.appendMenuItem(e.menuId,{group:e.group,command:{id:this.id,title:e.title,icon:e.icon,precondition:this.precondition},when:e.when,order:e.order})}};class zm extends Uy{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t,i,n){return this._implementations.push({priority:e,name:t,implementation:i,when:n}),this._implementations.sort((s,r)=>r.priority-s.priority),{dispose:()=>{for(let s=0;s<this._implementations.length;s++)if(this._implementations[s].implementation===i){this._implementations.splice(s,1);return}}}}runCommand(e,t){const i=e.get(Rt),n=e.get(xe);i.trace(`Executing Command '${this.id}' which has ${this._implementations.length} bound.`);for(const s of this._implementations){if(s.when){const a=n.getContext(Ui());if(!s.when.evaluate(a))continue}const r=s.implementation(e,t);if(r)return i.trace(`Command '${this.id}' was handled by '${s.name}'.`),typeof r=="boolean"?void 0:r}i.trace(`The Command '${this.id}' was not handled by any implementation.`)}}class WH extends Uy{constructor(e,t){super(t),this.command=e}runCommand(e,t){return this.command.runCommand(e,t)}}class Bi extends Uy{static bindToContribution(e){return class extends Bi{constructor(i){super(i),this._callback=i.handler}runEditorCommand(i,n,s){const r=e(n);r&&this._callback(r,s)}}}static runEditorCommand(e,t,i,n){const s=e.get(et),r=s.getFocusedCodeEditor()||s.getActiveCodeEditor();if(r)return r.invokeWithinContext(a=>{if(a.get(xe).contextMatchesRules(i??void 0))return n(a,r,t)})}runCommand(e,t){return Bi.runEditorCommand(e,t,this.precondition,(i,n,s)=>this.runEditorCommand(i,n,s))}}class le extends Bi{static convertOptions(e){let t;Array.isArray(e.menuOpts)?t=e.menuOpts:e.menuOpts?t=[e.menuOpts]:t=[];function i(n){return n.menuId||(n.menuId=de.EditorContext),n.title||(n.title=typeof e.label=="string"?e.label:e.label.value),n.when=K.and(e.precondition,n.when),n}return Array.isArray(e.contextMenuOpts)?t.push(...e.contextMenuOpts.map(i)):e.contextMenuOpts&&t.push(i(e.contextMenuOpts)),e.menuOpts=t,e}constructor(e){super(le.convertOptions(e)),typeof e.label=="string"?(this.label=e.label,this.alias=e.alias??e.label):(this.label=e.label.value,this.alias=e.alias??e.label.original)}runEditorCommand(e,t,i){return this.reportTelemetry(e,t),this.run(e,t,i||{})}reportTelemetry(e,t){e.get(Vn).publicLog2("editorActionInvoked",{name:this.label,id:this.id})}}class BH extends le{constructor(){super(...arguments),this._implementations=[]}addImplementation(e,t){return this._implementations.push([e,t]),this._implementations.sort((i,n)=>n[0]-i[0]),{dispose:()=>{for(let i=0;i<this._implementations.length;i++)if(this._implementations[i][1]===t){this._implementations.splice(i,1);return}}}}run(e,t,i){for(const n of this._implementations){const s=n[1](e,t,i);if(s)return typeof s=="boolean"?void 0:s}}}class Zr extends ln{run(e,...t){const i=e.get(et),n=i.getFocusedCodeEditor()||i.getActiveCodeEditor();if(n)return n.invokeWithinContext(s=>{const r=s.get(xe),a=s.get(Rt);if(!r.contextMatchesRules(this.desc.precondition??void 0)){a.debug("[EditorAction2] NOT running command because its precondition is FALSE",this.desc.id,this.desc.precondition?.serialize());return}return this.runEditorCommand(s,n,...t)})}}function zs(o,e){Xe.registerCommand(o,function(t,...i){const n=t.get(ge),[s,r]=i;it(be.isUri(s)),it(M.isIPosition(r));const a=t.get(Qt).getModel(s);if(a){const l=M.lift(r);return n.invokeFunction(e,a,l,...i.slice(2))}return t.get(ns).createModelReference(s).then(l=>new Promise((c,d)=>{try{const h=n.invokeFunction(e,l.object.textEditorModel,M.lift(r),i.slice(2));c(h)}catch(h){d(h)}}).finally(()=>{l.dispose()}))})}function re(o){return wr.INSTANCE.registerEditorCommand(o),o}function ne(o){const e=new o;return wr.INSTANCE.registerEditorAction(e),e}function HH(o){return wr.INSTANCE.registerEditorAction(o),o}function noe(o){wr.INSTANCE.registerEditorAction(o)}function Qe(o,e,t){wr.INSTANCE.registerEditorContribution(o,e,t)}var Um;(function(o){function e(r){return wr.INSTANCE.getEditorCommand(r)}o.getEditorCommand=e;function t(){return wr.INSTANCE.getEditorActions()}o.getEditorActions=t;function i(){return wr.INSTANCE.getEditorContributions()}o.getEditorContributions=i;function n(r){return wr.INSTANCE.getEditorContributions().filter(a=>r.indexOf(a.id)>=0)}o.getSomeEditorContributions=n;function s(){return wr.INSTANCE.getDiffEditorContributions()}o.getDiffEditorContributions=s})(Um||(Um={}));const soe={EditorCommonContributions:"editor.contributions"},nN=class nN{constructor(){this.editorContributions=[],this.diffEditorContributions=[],this.editorActions=[],this.editorCommands=Object.create(null)}registerEditorContribution(e,t,i){this.editorContributions.push({id:e,ctor:t,instantiation:i})}getEditorContributions(){return this.editorContributions.slice(0)}getDiffEditorContributions(){return this.diffEditorContributions.slice(0)}registerEditorAction(e){e.register(),this.editorActions.push(e)}getEditorActions(){return this.editorActions}registerEditorCommand(e){e.register(),this.editorCommands[e.id]=e}getEditorCommand(e){return this.editorCommands[e]||null}};nN.INSTANCE=new nN;let wr=nN;ei.add(soe.EditorCommonContributions,wr.INSTANCE);function I1(o){return o.register(),o}const VH=I1(new zm({id:"undo",precondition:void 0,kbOpts:{weight:0,primary:2104},menuOpts:[{menuId:de.MenubarEditMenu,group:"1_do",title:p(64,"&&Undo"),order:1},{menuId:de.CommandPalette,group:"",title:p(65,"Undo"),order:1},{menuId:de.SimpleEditorContext,group:"1_do",title:p(66,"Undo"),order:1}]}));I1(new WH(VH,{id:"default:undo",precondition:void 0}));const zH=I1(new zm({id:"redo",precondition:void 0,kbOpts:{weight:0,primary:2103,secondary:[3128],mac:{primary:3128}},menuOpts:[{menuId:de.MenubarEditMenu,group:"1_do",title:p(67,"&&Redo"),order:2},{menuId:de.CommandPalette,group:"",title:p(68,"Redo"),order:1},{menuId:de.SimpleEditorContext,group:"1_do",title:p(69,"Redo"),order:2}]}));I1(new WH(zH,{id:"default:redo",precondition:void 0}));const ooe=I1(new zm({id:"editor.action.selectAll",precondition:void 0,kbOpts:{weight:0,kbExpr:null,primary:2079},menuOpts:[{menuId:de.MenubarSelectionMenu,group:"1_basic",title:p(70,"&&Select All"),order:1},{menuId:de.CommandPalette,group:"",title:p(71,"Select All"),order:1},{menuId:de.SimpleEditorContext,group:"9_select",title:p(72,"Select All"),order:1}]}));let k=class Sn{constructor(e,t,i,n){e>i||e===i&&t>n?(this.startLineNumber=i,this.startColumn=n,this.endLineNumber=e,this.endColumn=t):(this.startLineNumber=e,this.startColumn=t,this.endLineNumber=i,this.endColumn=n)}isEmpty(){return Sn.isEmpty(this)}static isEmpty(e){return e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn}containsPosition(e){return Sn.containsPosition(this,e)}static containsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<e.startColumn||t.lineNumber===e.endLineNumber&&t.column>e.endColumn)}static strictContainsPosition(e,t){return!(t.lineNumber<e.startLineNumber||t.lineNumber>e.endLineNumber||t.lineNumber===e.startLineNumber&&t.column<=e.startColumn||t.lineNumber===e.endLineNumber&&t.column>=e.endColumn)}containsRange(e){return Sn.containsRange(this,e)}static containsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>e.endColumn)}strictContainsRange(e){return Sn.strictContainsRange(this,e)}static strictContainsRange(e,t){return!(t.startLineNumber<e.startLineNumber||t.endLineNumber<e.startLineNumber||t.startLineNumber>e.endLineNumber||t.endLineNumber>e.endLineNumber||t.startLineNumber===e.startLineNumber&&t.startColumn<=e.startColumn||t.endLineNumber===e.endLineNumber&&t.endColumn>=e.endColumn)}plusRange(e){return Sn.plusRange(this,e)}static plusRange(e,t){let i,n,s,r;return t.startLineNumber<e.startLineNumber?(i=t.startLineNumber,n=t.startColumn):t.startLineNumber===e.startLineNumber?(i=t.startLineNumber,n=Math.min(t.startColumn,e.startColumn)):(i=e.startLineNumber,n=e.startColumn),t.endLineNumber>e.endLineNumber?(s=t.endLineNumber,r=t.endColumn):t.endLineNumber===e.endLineNumber?(s=t.endLineNumber,r=Math.max(t.endColumn,e.endColumn)):(s=e.endLineNumber,r=e.endColumn),new Sn(i,n,s,r)}intersectRanges(e){return Sn.intersectRanges(this,e)}static intersectRanges(e,t){let i=e.startLineNumber,n=e.startColumn,s=e.endLineNumber,r=e.endColumn;const a=t.startLineNumber,l=t.startColumn,c=t.endLineNumber,d=t.endColumn;return i<a?(i=a,n=l):i===a&&(n=Math.max(n,l)),s>c?(s=c,r=d):s===c&&(r=Math.min(r,d)),i>s||i===s&&n>r?null:new Sn(i,n,s,r)}equalsRange(e){return Sn.equalsRange(this,e)}static equalsRange(e,t){return!e&&!t?!0:!!e&&!!t&&e.startLineNumber===t.startLineNumber&&e.startColumn===t.startColumn&&e.endLineNumber===t.endLineNumber&&e.endColumn===t.endColumn}getEndPosition(){return Sn.getEndPosition(this)}static getEndPosition(e){return new M(e.endLineNumber,e.endColumn)}getStartPosition(){return Sn.getStartPosition(this)}static getStartPosition(e){return new M(e.startLineNumber,e.startColumn)}toString(){return"["+this.startLineNumber+","+this.startColumn+" -> "+this.endLineNumber+","+this.endColumn+"]"}setEndPosition(e,t){return new Sn(this.startLineNumber,this.startColumn,e,t)}setStartPosition(e,t){return new Sn(e,t,this.endLineNumber,this.endColumn)}collapseToStart(){return Sn.collapseToStart(this)}static collapseToStart(e){return new Sn(e.startLineNumber,e.startColumn,e.startLineNumber,e.startColumn)}collapseToEnd(){return Sn.collapseToEnd(this)}static collapseToEnd(e){return new Sn(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn)}delta(e){return new Sn(this.startLineNumber+e,this.startColumn,this.endLineNumber+e,this.endColumn)}isSingleLine(){return this.startLineNumber===this.endLineNumber}static fromPositions(e,t=e){return new Sn(e.lineNumber,e.column,t.lineNumber,t.column)}static lift(e){return e?new Sn(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):null}static isIRange(e){return e&&typeof e.startLineNumber=="number"&&typeof e.startColumn=="number"&&typeof e.endLineNumber=="number"&&typeof e.endColumn=="number"}static areIntersectingOrTouching(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn)}static areIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber||e.endLineNumber===t.startLineNumber&&e.endColumn<=t.startColumn||t.endLineNumber<e.startLineNumber||t.endLineNumber===e.startLineNumber&&t.endColumn<=e.startColumn)}static areOnlyIntersecting(e,t){return!(e.endLineNumber<t.startLineNumber-1||e.endLineNumber===t.startLineNumber&&e.endColumn<t.startColumn-1||t.endLineNumber<e.startLineNumber-1||t.endLineNumber===e.startLineNumber&&t.endColumn<e.startColumn-1)}static compareRangesUsingStarts(e,t){if(e&&t){const s=e.startLineNumber|0,r=t.startLineNumber|0;if(s===r){const a=e.startColumn|0,l=t.startColumn|0;if(a===l){const c=e.endLineNumber|0,d=t.endLineNumber|0;if(c===d){const h=e.endColumn|0,u=t.endColumn|0;return h-u}return c-d}return a-l}return s-r}return(e?1:0)-(t?1:0)}static compareRangesUsingEnds(e,t){return e.endLineNumber===t.endLineNumber?e.endColumn===t.endColumn?e.startLineNumber===t.startLineNumber?e.startColumn-t.startColumn:e.startLineNumber-t.startLineNumber:e.endColumn-t.endColumn:e.endLineNumber-t.endLineNumber}static spansMultipleLines(e){return e.endLineNumber>e.startLineNumber}toJSON(){return this}},ce=class pa extends k{constructor(e,t,i,n){super(e,t,i,n),this.selectionStartLineNumber=e,this.selectionStartColumn=t,this.positionLineNumber=i,this.positionColumn=n}toString(){return"["+this.selectionStartLineNumber+","+this.selectionStartColumn+" -> "+this.positionLineNumber+","+this.positionColumn+"]"}equalsSelection(e){return pa.selectionsEqual(this,e)}static selectionsEqual(e,t){return e.selectionStartLineNumber===t.selectionStartLineNumber&&e.selectionStartColumn===t.selectionStartColumn&&e.positionLineNumber===t.positionLineNumber&&e.positionColumn===t.positionColumn}getDirection(){return this.selectionStartLineNumber===this.startLineNumber&&this.selectionStartColumn===this.startColumn?0:1}setEndPosition(e,t){return this.getDirection()===0?new pa(this.startLineNumber,this.startColumn,e,t):new pa(e,t,this.startLineNumber,this.startColumn)}getPosition(){return new M(this.positionLineNumber,this.positionColumn)}getSelectionStart(){return new M(this.selectionStartLineNumber,this.selectionStartColumn)}setStartPosition(e,t){return this.getDirection()===0?new pa(e,t,this.endLineNumber,this.endColumn):new pa(this.endLineNumber,this.endColumn,e,t)}static fromPositions(e,t=e){return new pa(e.lineNumber,e.column,t.lineNumber,t.column)}static fromRange(e,t){return t===0?new pa(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn):new pa(e.endLineNumber,e.endColumn,e.startLineNumber,e.startColumn)}static liftSelection(e){return new pa(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn)}static selectionsArrEqual(e,t){if(e&&!t||!e&&t)return!1;if(!e&&!t)return!0;if(e.length!==t.length)return!1;for(let i=0,n=e.length;i<n;i++)if(!this.selectionsEqual(e[i],t[i]))return!1;return!0}static isISelection(e){return e&&typeof e.selectionStartLineNumber=="number"&&typeof e.selectionStartColumn=="number"&&typeof e.positionLineNumber=="number"&&typeof e.positionColumn=="number"}static createWithDirection(e,t,i,n,s){return s===0?new pa(e,t,i,n):new pa(i,n,e,t)}};function Cf(o,e){const t=o.getCount(),i=o.findTokenIndexAtOffset(e),n=o.getLanguageId(i);let s=i;for(;s+1<t&&o.getLanguageId(s+1)===n;)s++;let r=i;for(;r>0&&o.getLanguageId(r-1)===n;)r--;return new roe(o,n,r,s+1,o.getStartOffset(r),o.getEndOffset(s))}class roe{constructor(e,t,i,n,s,r){this._scopedLineTokensBrand=void 0,this._actual=e,this.languageId=t,this._firstTokenIndex=i,this._lastTokenIndex=n,this.firstCharOffset=s,this._lastCharOffset=r,this.languageIdCodec=e.languageIdCodec}getLineContent(){return this._actual.getLineContent().substring(this.firstCharOffset,this._lastCharOffset)}getLineLength(){return this._lastCharOffset-this.firstCharOffset}getActualLineContentBefore(e){return this._actual.getLineContent().substring(0,this.firstCharOffset+e)}getTokenCount(){return this._lastTokenIndex-this._firstTokenIndex}findTokenIndexAtOffset(e){return this._actual.findTokenIndexAtOffset(e+this.firstCharOffset)-this._firstTokenIndex}getStandardTokenType(e){return this._actual.getStandardTokenType(e+this._firstTokenIndex)}toIViewLineTokens(){return this._actual.sliceAndInflate(this.firstCharOffset,this._lastCharOffset,0)}}function ul(o){return(o&3)!==0}class ti{static _nextVisibleColumn(e,t,i){return e===9?ti.nextRenderTabStop(t,i):th(e)||SR(e)?t+2:t+1}static visibleColumnFromColumn(e,t,i){const n=Math.min(t-1,e.length),s=e.substring(0,n),r=new ay(s);let a=0;for(;!r.eol();){const l=ry(s,n,r.offset);r.nextGraphemeLength(),a=this._nextVisibleColumn(l,a,i)}return a}static columnFromVisibleColumn(e,t,i){if(t<=0)return 1;const n=e.length,s=new ay(e);let r=0,a=1;for(;!s.eol();){const l=ry(e,n,s.offset);s.nextGraphemeLength();const c=this._nextVisibleColumn(l,r,i),d=s.offset+1;if(c>=t){const h=t-r;return c-t<h?d:a}r=c,a=d}return n+1}static nextRenderTabStop(e,t){return e+t-e%t}static nextIndentTabStop(e,t){return ti.nextRenderTabStop(e,t)}static prevRenderTabStop(e,t){return Math.max(0,e-1-(e-1)%t)}static prevIndentTabStop(e,t){return ti.prevRenderTabStop(e,t)}}function aoe(o,e,t){let i=0;for(let s=0;s<o.length;s++)o.charAt(s)===" "?i=ti.nextIndentTabStop(i,e):i++;let n="";if(!t){const s=Math.floor(i/e);i=i%e;for(let r=0;r<s;r++)n+=" "}for(let s=0;s<i;s++)n+=" ";return n}function g2(o,e,t){let i=es(o);return i===-1&&(i=o.length),aoe(o.substring(0,i),e,t)+o.substring(i)}class loe{constructor(){this._inputMode="insert",this._onDidChangeInputMode=new P,this.onDidChangeInputMode=this._onDidChangeInputMode.event}getInputMode(){return this._inputMode}}const p2=new loe,coe=()=>!0,doe=()=>!1,hoe=o=>o===" "||o===" ";class $m{static shouldRecreate(e){return e.hasChanged(165)||e.hasChanged(148)||e.hasChanged(45)||e.hasChanged(85)||e.hasChanged(88)||e.hasChanged(89)||e.hasChanged(10)||e.hasChanged(11)||e.hasChanged(15)||e.hasChanged(13)||e.hasChanged(14)||e.hasChanged(20)||e.hasChanged(145)||e.hasChanged(141)||e.hasChanged(59)||e.hasChanged(104)||e.hasChanged(147)||e.hasChanged(93)}constructor(e,t,i,n){this.languageConfigurationService=n,this._cursorMoveConfigurationBrand=void 0,this._languageId=e;const s=i.options,r=s.get(165),a=s.get(59);this.readOnly=s.get(104),this.tabSize=t.tabSize,this.indentSize=t.indentSize,this.insertSpaces=t.insertSpaces,this.stickyTabStops=s.get(132),this.lineHeight=a.lineHeight,this.typicalHalfwidthCharacterWidth=a.typicalHalfwidthCharacterWidth,this.pageSize=Math.max(1,Math.floor(r.height/this.lineHeight)-2),this.useTabStops=s.get(145),this.trimWhitespaceOnDelete=s.get(141),this.wordSeparators=s.get(148),this.emptySelectionClipboard=s.get(45),this.copyWithSyntaxHighlighting=s.get(31),this.multiCursorMergeOverlapping=s.get(85),this.multiCursorPaste=s.get(88),this.multiCursorLimit=s.get(89),this.autoClosingBrackets=s.get(10),this.autoClosingComments=s.get(11),this.autoClosingQuotes=s.get(15),this.autoClosingDelete=s.get(13),this.autoClosingOvertype=s.get(14),this.autoSurround=s.get(20),this.autoIndent=s.get(16),this.wordSegmenterLocales=s.get(147),this.overtypeOnPaste=s.get(93),this.surroundingPairs={},this._electricChars=null,this.shouldAutoCloseBefore={quote:this._getShouldAutoClose(e,this.autoClosingQuotes,!0),comment:this._getShouldAutoClose(e,this.autoClosingComments,!1),bracket:this._getShouldAutoClose(e,this.autoClosingBrackets,!1)},this.autoClosingPairs=this.languageConfigurationService.getLanguageConfiguration(e).getAutoClosingPairs();const l=this.languageConfigurationService.getLanguageConfiguration(e).getSurroundingPairs();if(l)for(const d of l)this.surroundingPairs[d.open]=d.close;const c=this.languageConfigurationService.getLanguageConfiguration(e).comments;this.blockCommentStartToken=c?.blockCommentStartToken??null}get electricChars(){if(!this._electricChars){this._electricChars={};const e=this.languageConfigurationService.getLanguageConfiguration(this._languageId).electricCharacter?.getElectricCharacters();if(e)for(const t of e)this._electricChars[t]=!0}return this._electricChars}get inputMode(){return p2.getInputMode()}onElectricCharacter(e,t,i){const n=Cf(t,i-1),s=this.languageConfigurationService.getLanguageConfiguration(n.languageId).electricCharacter;return s?s.onElectricCharacter(e,n,i-n.firstCharOffset):null}normalizeIndentation(e){return g2(e,this.indentSize,this.insertSpaces)}_getShouldAutoClose(e,t,i){switch(t){case"beforeWhitespace":return hoe;case"languageDefined":return this._getLanguageDefinedShouldAutoClose(e,i);case"always":return coe;case"never":return doe}}_getLanguageDefinedShouldAutoClose(e,t){const i=this.languageConfigurationService.getLanguageConfiguration(e).getAutoCloseBeforeSet(t);return n=>i.indexOf(n)!==-1}visibleColumnFromColumn(e,t){return ti.visibleColumnFromColumn(e.getLineContent(t.lineNumber),t.column,this.tabSize)}columnFromVisibleColumn(e,t,i){const n=ti.columnFromVisibleColumn(e.getLineContent(t),i,this.tabSize),s=e.getLineMinColumn(t);if(n<s)return s;const r=e.getLineMaxColumn(t);return n>r?r:n}}let nt=class Dte{static fromModelState(e){return new uoe(e)}static fromViewState(e){return new foe(e)}static fromModelSelection(e){const t=ce.liftSelection(e),i=new mn(k.fromPositions(t.getSelectionStart()),0,0,t.getPosition(),0);return Dte.fromModelState(i)}static fromModelSelections(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this.fromModelSelection(e[i]);return t}constructor(e,t){this._cursorStateBrand=void 0,this.modelState=e,this.viewState=t}equals(e){return this.viewState.equals(e.viewState)&&this.modelState.equals(e.modelState)}};class uoe{constructor(e){this.modelState=e,this.viewState=null}}class foe{constructor(e){this.modelState=null,this.viewState=e}}class mn{constructor(e,t,i,n,s){this.selectionStart=e,this.selectionStartKind=t,this.selectionStartLeftoverVisibleColumns=i,this.position=n,this.leftoverVisibleColumns=s,this._singleCursorStateBrand=void 0,this.selection=mn._computeSelection(this.selectionStart,this.position)}equals(e){return this.selectionStartLeftoverVisibleColumns===e.selectionStartLeftoverVisibleColumns&&this.leftoverVisibleColumns===e.leftoverVisibleColumns&&this.selectionStartKind===e.selectionStartKind&&this.position.equals(e.position)&&this.selectionStart.equalsRange(e.selectionStart)}hasSelection(){return!this.selection.isEmpty()||!this.selectionStart.isEmpty()}move(e,t,i,n){return e?new mn(this.selectionStart,this.selectionStartKind,this.selectionStartLeftoverVisibleColumns,new M(t,i),n):new mn(new k(t,i,t,i),0,n,new M(t,i),n)}static _computeSelection(e,t){return e.isEmpty()||!t.isBeforeOrEqual(e.getStartPosition())?ce.fromPositions(e.getStartPosition(),t):ce.fromPositions(e.getEndPosition(),t)}}class _s{constructor(e,t,i){this._editOperationResultBrand=void 0,this.type=e,this.commands=t,this.shouldPushStackElementBefore=i.shouldPushStackElementBefore,this.shouldPushStackElementAfter=i.shouldPushStackElementAfter}}function hh(o){return o==="'"||o==='"'||o==="`"}class vf{static columnSelect(e,t,i,n,s,r){const a=Math.abs(s-i)+1,l=i>s,c=n>r,d=n<r,h=[];for(let u=0;u<a;u++){const f=i+(l?-u:u),g=e.columnFromVisibleColumn(t,f,n),m=e.columnFromVisibleColumn(t,f,r),_=e.visibleColumnFromColumn(t,new M(f,g)),b=e.visibleColumnFromColumn(t,new M(f,m));d&&(_>r||b<n)||c&&(b>n||_<r)||h.push(new mn(new k(f,g,f,g),0,0,new M(f,m),0))}if(h.length===0)for(let u=0;u<a;u++){const f=i+(l?-u:u),g=t.getLineMaxColumn(f);h.push(new mn(new k(f,g,f,g),0,0,new M(f,g),0))}return{viewStates:h,reversed:l,fromLineNumber:i,fromVisualColumn:n,toLineNumber:s,toVisualColumn:r}}static columnSelectLeft(e,t,i){let n=i.toViewVisualColumn;return n>0&&n--,vf.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,n)}static columnSelectRight(e,t,i){let n=0;const s=Math.min(i.fromViewLineNumber,i.toViewLineNumber),r=Math.max(i.fromViewLineNumber,i.toViewLineNumber);for(let l=s;l<=r;l++){const c=t.getLineMaxColumn(l),d=e.visibleColumnFromColumn(t,new M(l,c));n=Math.max(n,d)}let a=i.toViewVisualColumn;return a<n&&a++,this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,i.toViewLineNumber,a)}static columnSelectUp(e,t,i,n){const s=n?e.pageSize:1,r=Math.max(1,i.toViewLineNumber-s);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,r,i.toViewVisualColumn)}static columnSelectDown(e,t,i,n){const s=n?e.pageSize:1,r=Math.min(t.getLineCount(),i.toViewLineNumber+s);return this.columnSelect(e,t,i.fromViewLineNumber,i.fromViewVisualColumn,r,i.toViewVisualColumn)}}class Dn{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromPositions(n.getEndPosition())}}class m2{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){const i=this._range.getStartPosition(),n=this._range.getEndPosition(),s=n.lineNumber,r=this._text.length+(this._range.isEmpty()?0:-1);let a=UH(e,n,r);a.lineNumber>s&&(a=new M(s,e.getLineMaxColumn(s)));const l=k.fromPositions(i,a);t.addTrackedEditOperation(l,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromPositions(n.getEndPosition())}}class goe{constructor(e,t){this._range=e,this._text=t}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromRange(n,0)}}class $y{constructor(e,t,i=!1){this._range=e,this._text=t,this.insertsAutoWhitespace=i}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromPositions(n.getStartPosition())}}class jy{constructor(e,t,i,n,s=!1){this._range=e,this._text=t,this._columnDeltaOffset=n,this._lineNumberDeltaOffset=i,this.insertsAutoWhitespace=s}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromPositions(n.getEndPosition().delta(this._lineNumberDeltaOffset,this._columnDeltaOffset))}}class poe{constructor(e){this._range=e}getEditOperations(e,t){const i=e.getValueInRange(this._range),n=this._range.getEndPosition(),s=n.lineNumber;let r=UH(e,n,i.length);r.lineNumber>s&&(r=new M(s,e.getLineMaxColumn(s)));const a=k.fromPositions(n,r);t.addTrackedEditOperation(a,"")}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return ce.fromPositions(n.getEndPosition())}}class _2{constructor(e,t,i,n=!1){this._range=e,this._text=t,this._initialSelection=i,this._forceMoveMarkers=n,this._selectionId=null}getEditOperations(e,t){t.addTrackedEditOperation(this._range,this._text,this._forceMoveMarkers),this._selectionId=t.trackSelection(this._initialSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function UH(o,e,t){if(t<0)throw new Error("Unexpected negative delta");const i=o.getLineCount();let n=new M(i,o.getLineMaxColumn(i));for(let s=e.lineNumber;s<=i;s++)if(s===e.lineNumber){const r=t-o.getLineMaxColumn(e.lineNumber)+e.column;if(r<=0){n=new M(e.lineNumber,e.column+t);break}t=r}else{const r=t-o.getLineMaxColumn(s);if(r<=0){n=new M(s,t);break}t=r}return n}class D1{static whitespaceVisibleColumn(e,t,i){const n=e.length;let s=0,r=-1,a=-1;for(let l=0;l<n;l++){if(l===t)return[r,a,s];switch(s%i===0&&(r=l,a=s),e.charCodeAt(l)){case 32:s+=1;break;case 9:s=ti.nextRenderTabStop(s,i);break;default:return[-1,-1,-1]}}return t===n?[r,a,s]:[-1,-1,-1]}static atomicPosition(e,t,i,n){const s=e.length,[r,a,l]=D1.whitespaceVisibleColumn(e,t,i);if(l===-1)return-1;let c;switch(n){case 0:c=!0;break;case 1:c=!1;break;case 2:if(l%i===0)return t;c=l%i<=i/2;break}if(c){if(r===-1)return-1;let u=a;for(let f=r;f<s;++f){if(u===a+i)return r;switch(e.charCodeAt(f)){case 32:u+=1;break;case 9:u=ti.nextRenderTabStop(u,i);break;default:return-1}}return u===a+i?r:-1}const d=ti.nextRenderTabStop(l,i);let h=l;for(let u=t;u<s;u++){if(h===d)return u;switch(e.charCodeAt(u)){case 32:h+=1;break;case 9:h=ti.nextRenderTabStop(h,i);break;default:return-1}}return h===d?s:-1}}class b2{constructor(e,t,i){this._cursorPositionBrand=void 0,this.lineNumber=e,this.column=t,this.leftoverVisibleColumns=i}}class ht{static leftPosition(e,t){if(t.column>e.getLineMinColumn(t.lineNumber))return t.delta(void 0,-t6(e.getLineContent(t.lineNumber),t.column-1));if(t.lineNumber>1){const i=t.lineNumber-1;return new M(i,e.getLineMaxColumn(i))}else return t}static leftPositionAtomicSoftTabs(e,t,i){if(t.column<=e.getLineIndentColumn(t.lineNumber)){const n=e.getLineMinColumn(t.lineNumber),s=e.getLineContent(t.lineNumber),r=D1.atomicPosition(s,t.column-1,i,0);if(r!==-1&&r+1>=n)return new M(t.lineNumber,r+1)}return this.leftPosition(e,t)}static left(e,t,i){const n=e.stickyTabStops?ht.leftPositionAtomicSoftTabs(t,i,e.tabSize):ht.leftPosition(t,i);return new b2(n.lineNumber,n.column,0)}static moveLeft(e,t,i,n,s){let r,a;if(i.hasSelection()&&!n)r=i.selection.startLineNumber,a=i.selection.startColumn;else{const l=i.position.delta(void 0,-(s-1)),c=t.normalizePosition(ht.clipPositionColumn(l,t),0),d=ht.left(e,t,c);r=d.lineNumber,a=d.column}return i.move(n,r,a,0)}static clipPositionColumn(e,t){return new M(e.lineNumber,ht.clipRange(e.column,t.getLineMinColumn(e.lineNumber),t.getLineMaxColumn(e.lineNumber)))}static clipRange(e,t,i){return e<t?t:e>i?i:e}static rightPosition(e,t,i){return i<e.getLineMaxColumn(t)?i=i+vR(e.getLineContent(t),i-1):t<e.getLineCount()&&(t=t+1,i=e.getLineMinColumn(t)),new M(t,i)}static rightPositionAtomicSoftTabs(e,t,i,n,s){if(i<e.getLineIndentColumn(t)){const r=e.getLineContent(t),a=D1.atomicPosition(r,i-1,n,1);if(a!==-1)return new M(t,a+1)}return this.rightPosition(e,t,i)}static right(e,t,i){const n=e.stickyTabStops?ht.rightPositionAtomicSoftTabs(t,i.lineNumber,i.column,e.tabSize,e.indentSize):ht.rightPosition(t,i.lineNumber,i.column);return new b2(n.lineNumber,n.column,0)}static moveRight(e,t,i,n,s){let r,a;if(i.hasSelection()&&!n)r=i.selection.endLineNumber,a=i.selection.endColumn;else{const l=i.position.delta(void 0,s-1),c=t.normalizePosition(ht.clipPositionColumn(l,t),1),d=ht.right(e,t,c);r=d.lineNumber,a=d.column}return i.move(n,r,a,0)}static vertical(e,t,i,n,s,r,a,l){const c=ti.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize)+s,d=t.getLineCount(),h=i===1&&n===1,u=i===d&&n===t.getLineMaxColumn(i),f=r<i?h:u;if(i=r,i<1?(i=1,a?n=t.getLineMinColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):i>d?(i=d,a?n=t.getLineMaxColumn(i):n=Math.min(t.getLineMaxColumn(i),n)):n=e.columnFromVisibleColumn(t,i,c),f?s=0:s=c-ti.visibleColumnFromColumn(t.getLineContent(i),n,e.tabSize),l!==void 0){const g=new M(i,n),m=t.normalizePosition(g,l);s=s+(n-m.column),i=m.lineNumber,n=m.column}return new b2(i,n,s)}static down(e,t,i,n,s,r,a){return this.vertical(e,t,i,n,s,i+r,a,4)}static moveDown(e,t,i,n,s){let r,a;i.hasSelection()&&!n?(r=i.selection.endLineNumber,a=i.selection.endColumn):(r=i.position.lineNumber,a=i.position.column);let l=0,c;do if(c=ht.down(e,t,r+l,a,i.leftoverVisibleColumns,s,!0),t.normalizePosition(new M(c.lineNumber,c.column),2).lineNumber>r)break;while(l++<10&&r+l<t.getLineCount());return i.move(n,c.lineNumber,c.column,c.leftoverVisibleColumns)}static translateDown(e,t,i){const n=i.selection,s=ht.down(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),r=ht.down(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new mn(new k(s.lineNumber,s.column,s.lineNumber,s.column),0,s.leftoverVisibleColumns,new M(r.lineNumber,r.column),r.leftoverVisibleColumns)}static up(e,t,i,n,s,r,a){return this.vertical(e,t,i,n,s,i-r,a,3)}static moveUp(e,t,i,n,s){let r,a;i.hasSelection()&&!n?(r=i.selection.startLineNumber,a=i.selection.startColumn):(r=i.position.lineNumber,a=i.position.column);const l=ht.up(e,t,r,a,i.leftoverVisibleColumns,s,!0);return i.move(n,l.lineNumber,l.column,l.leftoverVisibleColumns)}static translateUp(e,t,i){const n=i.selection,s=ht.up(e,t,n.selectionStartLineNumber,n.selectionStartColumn,i.selectionStartLeftoverVisibleColumns,1,!1),r=ht.up(e,t,n.positionLineNumber,n.positionColumn,i.leftoverVisibleColumns,1,!1);return new mn(new k(s.lineNumber,s.column,s.lineNumber,s.column),0,s.leftoverVisibleColumns,new M(r.lineNumber,r.column),r.leftoverVisibleColumns)}static _isBlankLine(e,t){return e.getLineFirstNonWhitespaceColumn(t)===0}static moveToPrevBlankLine(e,t,i,n){let s=i.position.lineNumber;for(;s>1&&this._isBlankLine(t,s);)s--;for(;s>1&&!this._isBlankLine(t,s);)s--;return i.move(n,s,t.getLineMinColumn(s),0)}static moveToNextBlankLine(e,t,i,n){const s=t.getLineCount();let r=i.position.lineNumber;for(;r<s&&this._isBlankLine(t,r);)r++;for(;r<s&&!this._isBlankLine(t,r);)r++;return i.move(n,r,t.getLineMinColumn(r),0)}static moveToBeginningOfLine(e,t,i,n){const s=i.position.lineNumber,r=t.getLineMinColumn(s),a=t.getLineFirstNonWhitespaceColumn(s)||r;let l;return i.position.column===a?l=r:l=a,i.move(n,s,l,0)}static moveToEndOfLine(e,t,i,n,s){const r=i.position.lineNumber,a=t.getLineMaxColumn(r);return i.move(n,r,a,s?1073741824-a:0)}static moveToBeginningOfBuffer(e,t,i,n){return i.move(n,1,1,0)}static moveToEndOfBuffer(e,t,i,n){const s=t.getLineCount(),r=t.getLineMaxColumn(s);return i.move(n,s,r,0)}}class wf{static deleteRight(e,t,i,n){const s=[];let r=e!==3;for(let a=0,l=n.length;a<l;a++){const c=n[a],d=this.getDeleteRightRange(c,i,t);if(d.isEmpty()){s[a]=null;continue}d.startLineNumber!==d.endLineNumber&&(r=!0),s[a]=new Dn(d,"")}return[r,s]}static getDeleteRightRange(e,t,i){if(!e.isEmpty())return e;const n=e.getPosition(),s=ht.right(i,t,n);if(i.trimWhitespaceOnDelete&&s.lineNumber!==n.lineNumber){const r=t.getLineFirstNonWhitespaceColumn(n.lineNumber)>0,a=t.getLineFirstNonWhitespaceColumn(s.lineNumber);if(r&&a>0)return new k(s.lineNumber,a,n.lineNumber,n.column)}return new k(s.lineNumber,s.column,n.lineNumber,n.column)}static isAutoClosingPairDelete(e,t,i,n,s,r,a){if(t==="never"&&i==="never"||e==="never")return!1;for(let l=0,c=r.length;l<c;l++){const d=r[l],h=d.getPosition();if(!d.isEmpty())return!1;const u=s.getLineContent(h.lineNumber);if(h.column<2||h.column>=u.length+1)return!1;const f=u.charAt(h.column-2),g=n.get(f);if(!g)return!1;if(hh(f)){if(i==="never")return!1}else if(t==="never")return!1;const m=u.charAt(h.column-1);let _=!1;for(const b of g)b.open===f&&b.close===m&&(_=!0);if(!_)return!1;if(e==="auto"){let b=!1;for(let C=0,w=a.length;C<w;C++){const v=a[C];if(h.lineNumber===v.startLineNumber&&h.column===v.startColumn){b=!0;break}}if(!b)return!1}}return!0}static _runAutoClosingPairDelete(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s].getPosition(),l=new k(a.lineNumber,a.column-1,a.lineNumber,a.column+1);n[s]=new Dn(l,"")}return[!0,n]}static deleteLeft(e,t,i,n,s){if(this.isAutoClosingPairDelete(t.autoClosingDelete,t.autoClosingBrackets,t.autoClosingQuotes,t.autoClosingPairs.autoClosingPairsOpenByEnd,i,n,s))return this._runAutoClosingPairDelete(t,i,n);const r=[];let a=e!==2;for(let l=0,c=n.length;l<c;l++){const d=wf.getDeleteLeftRange(n[l],i,t);if(d.isEmpty()){r[l]=null;continue}d.startLineNumber!==d.endLineNumber&&(a=!0),r[l]=new Dn(d,"")}return[a,r]}static getDeleteLeftRange(e,t,i){if(!e.isEmpty())return e;const n=e.getPosition();if(i.useTabStops&&n.column>1){const s=t.getLineContent(n.lineNumber),r=es(s),a=r===-1?s.length+1:r+1;if(n.column<=a){const l=i.visibleColumnFromColumn(t,n),c=ti.prevIndentTabStop(l,i.indentSize),d=i.columnFromVisibleColumn(t,n.lineNumber,c);return new k(n.lineNumber,d,n.lineNumber,n.column)}}return k.fromPositions(wf.getPositionAfterDeleteLeft(n,t),n)}static getPositionAfterDeleteLeft(e,t){if(e.column>1){const i=Pie(e.column-1,t.getLineContent(e.lineNumber));return e.with(void 0,i+1)}else if(e.lineNumber>1){const i=e.lineNumber-1;return new M(i,t.getLineMaxColumn(i))}else return e}static cut(e,t,i){const n=[];let s=null;i.sort((r,a)=>M.compare(r.getStartPosition(),a.getEndPosition()));for(let r=0,a=i.length;r<a;r++){const l=i[r];if(l.isEmpty())if(e.emptySelectionClipboard){const c=l.getPosition();let d,h,u,f;c.lineNumber<t.getLineCount()?(d=c.lineNumber,h=1,u=c.lineNumber+1,f=1):c.lineNumber>1&&s?.endLineNumber!==c.lineNumber?(d=c.lineNumber-1,h=t.getLineMaxColumn(c.lineNumber-1),u=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber)):(d=c.lineNumber,h=1,u=c.lineNumber,f=t.getLineMaxColumn(c.lineNumber));const g=new k(d,h,u,f);s=g,g.isEmpty()?n[r]=null:n[r]=new Dn(g,"")}else n[r]=null;else n[r]=new Dn(l,"")}return new _s(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}const Sf={DateTimeFormat(o,e){return new Ln(()=>{try{return new Intl.DateTimeFormat(o,e)}catch{return new Intl.DateTimeFormat(void 0,e)}})},Collator(o,e){return new Ln(()=>{try{return new Intl.Collator(o,e)}catch{return new Intl.Collator(void 0,e)}})},Segmenter(o,e){return new Ln(()=>{try{return new Intl.Segmenter(o,e)}catch{return new Intl.Segmenter(void 0,e)}})},Locale(o,e){return new Ln(()=>{try{return new Intl.Locale(o,e)}catch{return new Intl.Locale(Gu,e)}})},NumberFormat(o,e){return new Ln(()=>{try{return new Intl.NumberFormat(o,e)}catch{return new Intl.NumberFormat(void 0,e)}})}};function qy(o){return o<0?0:o>255?255:o|0}function jm(o){return o<0?0:o>4294967295?4294967295:o|0}class qm{constructor(e){const t=qy(e);this._defaultValue=t,this._asciiMap=qm._createAsciiMap(t),this._map=new Map}static _createAsciiMap(e){const t=new Uint8Array(256);return t.fill(e),t}set(e,t){const i=qy(t);e>=0&&e<256?this._asciiMap[e]=i:this._map.set(e,i)}get(e){return e>=0&&e<256?this._asciiMap[e]:this._map.get(e)||this._defaultValue}clear(){this._asciiMap.fill(this._defaultValue),this._map.clear()}}class Ky{constructor(){this._actual=new qm(0)}add(e){this._actual.set(e,1)}has(e){return this._actual.get(e)===1}clear(){return this._actual.clear()}}class moe extends qm{constructor(e,t){super(0),this._segmenter=null,this._cachedLine=null,this._cachedSegments=[],this.intlSegmenterLocales=t,this.intlSegmenterLocales.length>0?this._segmenter=Sf.Segmenter(this.intlSegmenterLocales,{granularity:"word"}):this._segmenter=null;for(let i=0,n=e.length;i<n;i++)this.set(e.charCodeAt(i),2);this.set(32,1),this.set(9,1)}findPrevIntlWordBeforeOrAtOffset(e,t){let i=null;for(const n of this._getIntlSegmenterWordsOnLine(e)){if(n.index>t)break;i=n}return i}findNextIntlWordAtOrAfterOffset(e,t){for(const i of this._getIntlSegmenterWordsOnLine(e))if(!(i.index<t))return i;return null}_getIntlSegmenterWordsOnLine(e){return this._segmenter?this._cachedLine===e?this._cachedSegments:(this._cachedLine=e,this._cachedSegments=this._filterWordSegments(this._segmenter.value.segment(e)),this._cachedSegments):[]}_filterWordSegments(e){const t=[];for(const i of e)this._isWordLike(i)&&t.push(i);return t}_isWordLike(e){return!!e.isWordLike}}const $H=new dl(10);function Sr(o,e){const t=`${o}/${e.join(",")}`;let i=$H.get(t);return i||(i=new moe(o,e),$H.set(t,i)),i}class ut{static _createWord(e,t,i,n,s){return{start:n,end:s,wordType:t,nextCharClass:i}}static _createIntlWord(e,t){return{start:e.index,end:e.index+e.segment.length,wordType:1,nextCharClass:t}}static _findPreviousWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindPreviousWordOnLine(n,e,i)}static _doFindPreviousWordOnLine(e,t,i){let n=0;const s=t.findPrevIntlWordBeforeOrAtOffset(e,i.column-2);for(let r=i.column-2;r>=0;r--){const a=e.charCodeAt(r),l=t.get(a);if(s&&r===s.index)return this._createIntlWord(s,l);if(l===0){if(n===2)return this._createWord(e,n,l,r+1,this._findEndOfWord(e,t,n,r+1));n=1}else if(l===2){if(n===1)return this._createWord(e,n,l,r+1,this._findEndOfWord(e,t,n,r+1));n=2}else if(l===1&&n!==0)return this._createWord(e,n,l,r+1,this._findEndOfWord(e,t,n,r+1))}return n!==0?this._createWord(e,n,1,0,this._findEndOfWord(e,t,n,0)):null}static _findEndOfWord(e,t,i,n){const s=t.findNextIntlWordAtOrAfterOffset(e,n),r=e.length;for(let a=n;a<r;a++){const l=e.charCodeAt(a),c=t.get(l);if(s&&a===s.index+s.segment.length||c===1||i===1&&c===2||i===2&&c===0)return a}return r}static _findNextWordOnLine(e,t,i){const n=t.getLineContent(i.lineNumber);return this._doFindNextWordOnLine(n,e,i)}static _doFindNextWordOnLine(e,t,i){let n=0;const s=e.length,r=t.findNextIntlWordAtOrAfterOffset(e,i.column-1);for(let a=i.column-1;a<s;a++){const l=e.charCodeAt(a),c=t.get(l);if(r&&a===r.index)return this._createIntlWord(r,c);if(c===0){if(n===2)return this._createWord(e,n,c,this._findStartOfWord(e,t,n,a-1),a);n=1}else if(c===2){if(n===1)return this._createWord(e,n,c,this._findStartOfWord(e,t,n,a-1),a);n=2}else if(c===1&&n!==0)return this._createWord(e,n,c,this._findStartOfWord(e,t,n,a-1),a)}return n!==0?this._createWord(e,n,1,this._findStartOfWord(e,t,n,s-1),s):null}static _findStartOfWord(e,t,i,n){const s=t.findPrevIntlWordBeforeOrAtOffset(e,n);for(let r=n;r>=0;r--){const a=e.charCodeAt(r),l=t.get(a);if(s&&r===s.index)return r;if(l===1||i===1&&l===2||i===2&&l===0)return r+1}return 0}static moveWordLeft(e,t,i,n,s){let r=i.lineNumber,a=i.column;a===1&&r>1&&(r=r-1,a=t.getLineMaxColumn(r));let l=ut._findPreviousWordOnLine(e,t,new M(r,a));if(n===0)return new M(r,l?l.start+1:1);if(n===1)return!s&&l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=ut._findPreviousWordOnLine(e,t,new M(r,l.start+1))),new M(r,l?l.start+1:1);if(n===3){for(;l&&l.wordType===2;)l=ut._findPreviousWordOnLine(e,t,new M(r,l.start+1));return new M(r,l?l.start+1:1)}return l&&a<=l.end+1&&(l=ut._findPreviousWordOnLine(e,t,new M(r,l.start+1))),new M(r,l?l.end+1:1)}static _moveWordPartLeft(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===1)return i>1?new M(i-1,e.getLineMaxColumn(i-1)):t;const s=e.getLineContent(i);for(let r=t.column-1;r>1;r--){const a=s.charCodeAt(r-2),l=s.charCodeAt(r-1);if(a===95&&l!==95)return new M(i,r);if(a===45&&l!==45)return new M(i,r);if((Jd(a)||oy(a))&&ll(l))return new M(i,r);if(ll(a)&&ll(l)&&r+1<n){const c=s.charCodeAt(r);if(Jd(c)||oy(c))return new M(i,r)}}return new M(i,1)}static moveWordRight(e,t,i,n){let s=i.lineNumber,r=i.column,a=!1;r===t.getLineMaxColumn(s)&&s<t.getLineCount()&&(a=!0,s=s+1,r=1);let l=ut._findNextWordOnLine(e,t,new M(s,r));if(n===2)l&&l.wordType===2&&l.end-l.start===1&&l.nextCharClass===0&&(l=ut._findNextWordOnLine(e,t,new M(s,l.end+1))),l?r=l.end+1:r=t.getLineMaxColumn(s);else if(n===3){for(a&&(r=0);l&&(l.wordType===2||l.start+1<=r);)l=ut._findNextWordOnLine(e,t,new M(s,l.end+1));l?r=l.start+1:r=t.getLineMaxColumn(s)}else l&&!a&&r>=l.start+1&&(l=ut._findNextWordOnLine(e,t,new M(s,l.end+1))),l?r=l.start+1:r=t.getLineMaxColumn(s);return new M(s,r)}static _moveWordPartRight(e,t){const i=t.lineNumber,n=e.getLineMaxColumn(i);if(t.column===n)return i<e.getLineCount()?new M(i+1,1):t;const s=e.getLineContent(i);for(let r=t.column+1;r<n;r++){const a=s.charCodeAt(r-2),l=s.charCodeAt(r-1);if(a!==95&&l===95)return new M(i,r);if(a!==45&&l===45)return new M(i,r);if((Jd(a)||oy(a))&&ll(l))return new M(i,r);if(ll(a)&&ll(l)&&r+1<n){const c=s.charCodeAt(r);if(Jd(c)||oy(c))return new M(i,r)}}return new M(i,n)}static _deleteWordLeftWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-2,s=Kr(i,n);return s+1<n?new k(t.lineNumber,s+2,t.lineNumber,t.column):null}static deleteWordLeft(e,t){const i=e.wordSeparators,n=e.model,s=e.selection,r=e.whitespaceHeuristics;if(!s.isEmpty())return s;if(wf.isAutoClosingPairDelete(e.autoClosingDelete,e.autoClosingBrackets,e.autoClosingQuotes,e.autoClosingPairs.autoClosingPairsOpenByEnd,e.model,[e.selection],e.autoClosedCharacters)){const h=e.selection.getPosition();return new k(h.lineNumber,h.column-1,h.lineNumber,h.column+1)}const a=new M(s.positionLineNumber,s.positionColumn);let l=a.lineNumber,c=a.column;if(l===1&&c===1)return null;if(r){const h=this._deleteWordLeftWhitespace(n,a);if(h)return h}let d=ut._findPreviousWordOnLine(i,n,a);return t===0?d?c=d.start+1:c>1?c=1:(l--,c=n.getLineMaxColumn(l)):(d&&c<=d.end+1&&(d=ut._findPreviousWordOnLine(i,n,new M(l,d.start+1))),d?c=d.end+1:c>1?c=1:(l--,c=n.getLineMaxColumn(l))),new k(l,c,a.lineNumber,a.column)}static deleteInsideWord(e,t,i){if(!i.isEmpty())return i;const n=new M(i.positionLineNumber,i.positionColumn),s=this._deleteInsideWordWhitespace(t,n);return s||this._deleteInsideWordDetermineDeleteRange(e,t,n)}static _charAtIsWhitespace(e,t){const i=e.charCodeAt(t);return i===32||i===9}static _deleteInsideWordWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=i.length;if(n===0)return null;let s=Math.max(t.column-2,0);if(!this._charAtIsWhitespace(i,s))return null;let r=Math.min(t.column-1,n-1);if(!this._charAtIsWhitespace(i,r))return null;for(;s>0&&this._charAtIsWhitespace(i,s-1);)s--;for(;r+1<n&&this._charAtIsWhitespace(i,r+1);)r++;return new k(t.lineNumber,s+1,t.lineNumber,r+2)}static _deleteInsideWordDetermineDeleteRange(e,t,i){const n=t.getLineContent(i.lineNumber),s=n.length;if(s===0)return i.lineNumber>1?new k(i.lineNumber-1,t.getLineMaxColumn(i.lineNumber-1),i.lineNumber,1):i.lineNumber<t.getLineCount()?new k(i.lineNumber,1,i.lineNumber+1,1):new k(i.lineNumber,1,i.lineNumber,1);const r=h=>h.start+1<=i.column&&i.column<=h.end+1,a=(h,u)=>(h=Math.min(h,i.column),u=Math.max(u,i.column),new k(i.lineNumber,h,i.lineNumber,u)),l=h=>{let u=h.start+1,f=h.end+1,g=!1;for(;f-1<s&&this._charAtIsWhitespace(n,f-1);)g=!0,f++;if(!g)for(;u>1&&this._charAtIsWhitespace(n,u-2);)u--;return a(u,f)},c=ut._findPreviousWordOnLine(e,t,i);if(c&&r(c))return l(c);const d=ut._findNextWordOnLine(e,t,i);return d&&r(d)?l(d):c&&d?a(c.end+1,d.start+1):c?a(c.start+1,c.end+1):d?a(d.start+1,d.end+1):a(1,s+1)}static _deleteWordPartLeft(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=ut._moveWordPartLeft(e,i);return new k(i.lineNumber,i.column,n.lineNumber,n.column)}static _findFirstNonWhitespaceChar(e,t){const i=e.length;for(let n=t;n<i;n++){const s=e.charAt(n);if(s!==" "&&s!==" ")return n}return i}static _deleteWordRightWhitespace(e,t){const i=e.getLineContent(t.lineNumber),n=t.column-1,s=this._findFirstNonWhitespaceChar(i,n);return n+1<s?new k(t.lineNumber,t.column,t.lineNumber,s+1):null}static deleteWordRight(e,t){const i=e.wordSeparators,n=e.model,s=e.selection,r=e.whitespaceHeuristics;if(!s.isEmpty())return s;const a=new M(s.positionLineNumber,s.positionColumn);let l=a.lineNumber,c=a.column;const d=n.getLineCount(),h=n.getLineMaxColumn(l);if(l===d&&c===h)return null;if(r){const f=this._deleteWordRightWhitespace(n,a);if(f)return f}let u=ut._findNextWordOnLine(i,n,a);return t===2?u?c=u.end+1:c<h||l===d?c=h:(l++,u=ut._findNextWordOnLine(i,n,new M(l,1)),u?c=u.start+1:c=n.getLineMaxColumn(l)):(u&&c>=u.start+1&&(u=ut._findNextWordOnLine(i,n,new M(l,u.end+1))),u?c=u.start+1:c<h||l===d?c=h:(l++,u=ut._findNextWordOnLine(i,n,new M(l,1)),u?c=u.start+1:c=n.getLineMaxColumn(l))),new k(l,c,a.lineNumber,a.column)}static _deleteWordPartRight(e,t){if(!t.isEmpty())return t;const i=t.getPosition(),n=ut._moveWordPartRight(e,i);return new k(i.lineNumber,i.column,n.lineNumber,n.column)}static _createWordAtPosition(e,t,i){const n=new k(t,i.start+1,t,i.end+1);return{word:e.getValueInRange(n),startColumn:n.startColumn,endColumn:n.endColumn}}static getWordAtPosition(e,t,i,n){const s=Sr(t,i),r=ut._findPreviousWordOnLine(s,e,n);if(r&&r.wordType===1&&r.start<=n.column-1&&n.column-1<=r.end)return ut._createWordAtPosition(e,n.lineNumber,r);const a=ut._findNextWordOnLine(s,e,n);return a&&a.wordType===1&&a.start<=n.column-1&&n.column-1<=a.end?ut._createWordAtPosition(e,n.lineNumber,a):null}static word(e,t,i,n,s){const r=Sr(e.wordSeparators,e.wordSegmenterLocales),a=ut._findPreviousWordOnLine(r,t,s),l=ut._findNextWordOnLine(r,t,s);if(!n){let f,g;return a&&a.wordType===1&&a.start<=s.column-1&&s.column-1<=a.end?(f=a.start+1,g=a.end+1):l&&l.wordType===1&&l.start<=s.column-1&&s.column-1<=l.end?(f=l.start+1,g=l.end+1):(a?f=a.end+1:f=1,l?g=l.start+1:g=t.getLineMaxColumn(s.lineNumber)),new mn(new k(s.lineNumber,f,s.lineNumber,g),1,0,new M(s.lineNumber,g),0)}let c,d;a&&a.wordType===1&&a.start<s.column-1&&s.column-1<a.end?(c=a.start+1,d=a.end+1):l&&l.wordType===1&&l.start<s.column-1&&s.column-1<l.end?(c=l.start+1,d=l.end+1):(c=s.column,d=s.column);const h=s.lineNumber;let u;if(i.selectionStart.containsPosition(s))u=i.selectionStart.endColumn;else if(s.isBeforeOrEqual(i.selectionStart.getStartPosition())){u=c;const f=new M(h,u);i.selectionStart.containsPosition(f)&&(u=i.selectionStart.endColumn)}else{u=d;const f=new M(h,u);i.selectionStart.containsPosition(f)&&(u=i.selectionStart.startColumn)}return i.move(!0,h,u,0)}}class Gy extends ut{static deleteWordPartLeft(e){const t=Zy([ut.deleteWordLeft(e,0),ut.deleteWordLeft(e,2),ut._deleteWordPartLeft(e.model,e.selection)]);return t.sort(k.compareRangesUsingEnds),t[2]}static deleteWordPartRight(e){const t=Zy([ut.deleteWordRight(e,0),ut.deleteWordRight(e,2),ut._deleteWordPartRight(e.model,e.selection)]);return t.sort(k.compareRangesUsingStarts),t[0]}static moveWordPartLeft(e,t,i,n){const s=Zy([ut.moveWordLeft(e,t,i,0,n),ut.moveWordLeft(e,t,i,2,n),ut._moveWordPartLeft(t,i)]);return s.sort(M.compare),s[2]}static moveWordPartRight(e,t,i){const n=Zy([ut.moveWordRight(e,t,i,0),ut.moveWordRight(e,t,i,2),ut._moveWordPartRight(t,i)]);return n.sort(M.compare),n[0]}}function Zy(o){return o.filter(e=>!!e)}function fl(o){if(!o||typeof o!="object"||o instanceof RegExp)return o;const e=Array.isArray(o)?[]:{};return Object.entries(o).forEach(([t,i])=>{e[t]=i&&typeof i=="object"?fl(i):i}),e}function _oe(o){if(!o||typeof o!="object")return o;const e=[o];for(;e.length>0;){const t=e.shift();Object.freeze(t);for(const i in t)if(jH.call(t,i)){const n=t[i];typeof n=="object"&&!Object.isFrozen(n)&&!Pte(n)&&e.push(n)}}return o}const jH=Object.prototype.hasOwnProperty;function qH(o,e){return C2(o,e,new Set)}function C2(o,e,t){if(hr(o))return o;const i=e(o);if(typeof i<"u")return i;if(Array.isArray(o)){const n=[];for(const s of o)n.push(C2(s,e,t));return n}if(nn(o)){if(t.has(o))throw new Error("Cannot clone recursive data-structure");t.add(o);const n={};for(const s in o)jH.call(o,s)&&(n[s]=C2(o[s],e,t));return t.delete(o),n}return o}function Yy(o,e,t=!0){return nn(o)?(nn(e)&&Object.keys(e).forEach(i=>{i in o?t&&(nn(o[i])&&nn(e[i])?Yy(o[i],e[i],t):o[i]=e[i]):o[i]=e[i]}),o):e}function fo(o,e){if(o===e)return!0;if(o==null||e===null||e===void 0||typeof o!=typeof e||typeof o!="object"||Array.isArray(o)!==Array.isArray(e))return!1;let t,i;if(Array.isArray(o)){if(o.length!==e.length)return!1;for(t=0;t<o.length;t++)if(!fo(o[t],e[t]))return!1}else{const n=[];for(i in o)n.push(i);n.sort();const s=[];for(i in e)s.push(i);if(s.sort(),!fo(n,s))return!1;for(t=0;t<n.length;t++)if(!fo(o[n[t]],e[n[t]]))return!1}return!0}var Ao;(function(o){o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=4]="Right",o[o.Full=7]="Full"})(Ao||(Ao={}));var xa;(function(o){o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=3]="Right"})(xa||(xa={}));var Oo;(function(o){o[o.LTR=0]="LTR",o[o.RTL=1]="RTL"})(Oo||(Oo={}));var yr;(function(o){o[o.Both=0]="Both",o[o.Right=1]="Right",o[o.Left=2]="Left",o[o.None=3]="None"})(yr||(yr={}));class Xy{get originalIndentSize(){return this._indentSizeIsTabSize?"tabSize":this.indentSize}constructor(e){this._textModelResolvedOptionsBrand=void 0,this.tabSize=Math.max(1,e.tabSize|0),e.indentSize==="tabSize"?(this.indentSize=this.tabSize,this._indentSizeIsTabSize=!0):(this.indentSize=Math.max(1,e.indentSize|0),this._indentSizeIsTabSize=!1),this.insertSpaces=!!e.insertSpaces,this.defaultEOL=e.defaultEOL|0,this.trimAutoWhitespace=!!e.trimAutoWhitespace,this.bracketPairColorizationOptions=e.bracketPairColorizationOptions}equals(e){return this.tabSize===e.tabSize&&this._indentSizeIsTabSize===e._indentSizeIsTabSize&&this.indentSize===e.indentSize&&this.insertSpaces===e.insertSpaces&&this.defaultEOL===e.defaultEOL&&this.trimAutoWhitespace===e.trimAutoWhitespace&&fo(this.bracketPairColorizationOptions,e.bracketPairColorizationOptions)}createChangeEvent(e){return{tabSize:this.tabSize!==e.tabSize,indentSize:this.indentSize!==e.indentSize,insertSpaces:this.insertSpaces!==e.insertSpaces,trimAutoWhitespace:this.trimAutoWhitespace!==e.trimAutoWhitespace}}}class E1{constructor(e,t){this._findMatchBrand=void 0,this.range=e,this.matches=t}}function boe(o){return o&&typeof o.read=="function"}class v2{constructor(e,t,i,n,s,r){this.identifier=e,this.range=t,this.text=i,this.forceMoveMarkers=n,this.isAutoWhitespaceEdit=s,this._isTracked=r}}class Coe{constructor(e,t,i){this.regex=e,this.wordSeparators=t,this.simpleSearch=i}}class voe{constructor(e,t,i){this.reverseEdits=e,this.changes=t,this.trimAutoWhitespaceLineNumbers=i}}function KH(o){return!o.isTooLargeForSyncing()&&!o.isForSimpleWidget}class _n{static addCursorDown(e,t,i){const n=[];let s=0;for(let r=0,a=t.length;r<a;r++){const l=t[r];n[s++]=new nt(l.modelState,l.viewState),i?n[s++]=nt.fromModelState(ht.translateDown(e.cursorConfig,e.model,l.modelState)):n[s++]=nt.fromViewState(ht.translateDown(e.cursorConfig,e,l.viewState))}return n}static addCursorUp(e,t,i){const n=[];let s=0;for(let r=0,a=t.length;r<a;r++){const l=t[r];n[s++]=new nt(l.modelState,l.viewState),i?n[s++]=nt.fromModelState(ht.translateUp(e.cursorConfig,e.model,l.modelState)):n[s++]=nt.fromViewState(ht.translateUp(e.cursorConfig,e,l.viewState))}return n}static moveToBeginningOfLine(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=this._moveToLineStart(e,a,i)}return n}static _moveToLineStart(e,t,i){const n=t.viewState.position.column,s=t.modelState.position.column,r=n===s,a=t.viewState.position.lineNumber,l=e.getLineFirstNonWhitespaceColumn(a);return!r&&!(n===l)?this._moveToLineStartByView(e,t,i):this._moveToLineStartByModel(e,t,i)}static _moveToLineStartByView(e,t,i){return nt.fromViewState(ht.moveToBeginningOfLine(e.cursorConfig,e,t.viewState,i))}static _moveToLineStartByModel(e,t,i){return nt.fromModelState(ht.moveToBeginningOfLine(e.cursorConfig,e.model,t.modelState,i))}static moveToEndOfLine(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const l=t[r];s[r]=this._moveToLineEnd(e,l,i,n)}return s}static _moveToLineEnd(e,t,i,n){const s=t.viewState.position,r=e.getLineMaxColumn(s.lineNumber),a=s.column===r,l=t.modelState.position,c=e.model.getLineMaxColumn(l.lineNumber),d=r-s.column===c-l.column;return a||d?this._moveToLineEndByModel(e,t,i,n):this._moveToLineEndByView(e,t,i,n)}static _moveToLineEndByView(e,t,i,n){return nt.fromViewState(ht.moveToEndOfLine(e.cursorConfig,e,t.viewState,i,n))}static _moveToLineEndByModel(e,t,i,n){return nt.fromModelState(ht.moveToEndOfLine(e.cursorConfig,e.model,t.modelState,i,n))}static expandLineSelection(e,t){const i=[];for(let n=0,s=t.length;n<s;n++){const r=t[n],a=r.modelState.selection.startLineNumber,l=e.model.getLineCount();let c=r.modelState.selection.endLineNumber,d;c===l?d=e.model.getLineMaxColumn(l):(c++,d=1),i[n]=nt.fromModelState(new mn(new k(a,1,a,1),0,0,new M(c,d),0))}return i}static moveToBeginningOfBuffer(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=nt.fromModelState(ht.moveToBeginningOfBuffer(e.cursorConfig,e.model,a.modelState,i))}return n}static moveToEndOfBuffer(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s];n[s]=nt.fromModelState(ht.moveToEndOfBuffer(e.cursorConfig,e.model,a.modelState,i))}return n}static selectAll(e,t){const i=e.model.getLineCount(),n=e.model.getLineMaxColumn(i);return nt.fromModelState(new mn(new k(1,1,1,1),0,0,new M(i,n),0))}static line(e,t,i,n,s){const r=e.model.validatePosition(n),a=s?e.coordinatesConverter.validateViewPosition(new M(s.lineNumber,s.column),r):e.coordinatesConverter.convertModelPositionToViewPosition(r);if(!i){const c=e.model.getLineCount();let d=r.lineNumber+1,h=1;return d>c&&(d=c,h=e.model.getLineMaxColumn(d)),nt.fromModelState(new mn(new k(r.lineNumber,1,d,h),2,0,new M(d,h),0))}const l=t.modelState.selectionStart.getStartPosition().lineNumber;if(r.lineNumber<l)return nt.fromViewState(t.viewState.move(!0,a.lineNumber,1,0));if(r.lineNumber>l){const c=e.getLineCount();let d=a.lineNumber+1,h=1;return d>c&&(d=c,h=e.getLineMaxColumn(d)),nt.fromViewState(t.viewState.move(!0,d,h,0))}else{const c=t.modelState.selectionStart.getEndPosition();return nt.fromModelState(t.modelState.move(!0,c.lineNumber,c.column,0))}}static word(e,t,i,n){const s=e.model.validatePosition(n);return nt.fromModelState(ut.word(e.cursorConfig,e.model,t.modelState,i,s))}static cancelSelection(e,t){if(!t.modelState.hasSelection())return new nt(t.modelState,t.viewState);const i=t.viewState.position.lineNumber,n=t.viewState.position.column;return nt.fromViewState(new mn(new k(i,n,i,n),0,0,new M(i,n),0))}static moveTo(e,t,i,n,s){if(i){if(t.modelState.selectionStartKind===1)return this.word(e,t,i,n);if(t.modelState.selectionStartKind===2)return this.line(e,t,i,n,s)}const r=e.model.validatePosition(n),a=s?e.coordinatesConverter.validateViewPosition(new M(s.lineNumber,s.column),r):e.coordinatesConverter.convertModelPositionToViewPosition(r);return nt.fromViewState(t.viewState.move(i,a.lineNumber,a.column,0))}static simpleMove(e,t,i,n,s,r){switch(i){case 0:return r===4?this._moveHalfLineLeft(e,t,n):this._moveLeft(e,t,n,s);case 1:return r===4?this._moveHalfLineRight(e,t,n):this._moveRight(e,t,n,s);case 2:return r===2?this._moveUpByViewLines(e,t,n,s):this._moveUpByModelLines(e,t,n,s);case 3:return r===2?this._moveDownByViewLines(e,t,n,s):this._moveDownByModelLines(e,t,n,s);case 4:return r===2?t.map(a=>nt.fromViewState(ht.moveToPrevBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>nt.fromModelState(ht.moveToPrevBlankLine(e.cursorConfig,e.model,a.modelState,n)));case 5:return r===2?t.map(a=>nt.fromViewState(ht.moveToNextBlankLine(e.cursorConfig,e,a.viewState,n))):t.map(a=>nt.fromModelState(ht.moveToNextBlankLine(e.cursorConfig,e.model,a.modelState,n)));case 6:return this._moveToViewMinColumn(e,t,n);case 7:return this._moveToViewFirstNonWhitespaceColumn(e,t,n);case 8:return this._moveToViewCenterColumn(e,t,n);case 9:return this._moveToViewMaxColumn(e,t,n);case 10:return this._moveToViewLastNonWhitespaceColumn(e,t,n);default:return null}}static viewportMove(e,t,i,n,s){const r=e.getCompletelyVisibleViewRange(),a=e.coordinatesConverter.convertViewRangeToModelRange(r);switch(i){case 11:{const l=this._firstLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 13:{const l=this._lastLineNumberInRange(e.model,a,s),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 12:{const l=Math.round((a.startLineNumber+a.endLineNumber)/2),c=e.model.getLineFirstNonWhitespaceColumn(l);return[this._moveToModelPosition(e,t[0],n,l,c)]}case 14:{const l=[];for(let c=0,d=t.length;c<d;c++){const h=t[c];l[c]=this.findPositionInViewportIfOutside(e,h,r,n)}return l}default:return null}}static findPositionInViewportIfOutside(e,t,i,n){const s=t.viewState.position.lineNumber;if(i.startLineNumber<=s&&s<=i.endLineNumber-1)return new nt(t.modelState,t.viewState);{let r;s>i.endLineNumber-1?r=i.endLineNumber-1:s<i.startLineNumber?r=i.startLineNumber:r=s;const a=ht.vertical(e.cursorConfig,e,s,t.viewState.position.column,t.viewState.leftoverVisibleColumns,r,!1);return nt.fromViewState(t.viewState.move(n,a.lineNumber,a.column,a.leftoverVisibleColumns))}}static _firstLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.min(t.endLineNumber,n+i-1)}static _lastLineNumberInRange(e,t,i){let n=t.startLineNumber;return t.startColumn!==e.getLineMinColumn(n)&&n++,Math.max(n,t.endLineNumber-i+1)}static _moveLeft(e,t,i,n){return t.map(s=>{const a=e.getTextDirection(s.viewState.position.lineNumber)===Oo.RTL;return nt.fromViewState(a?ht.moveRight(e.cursorConfig,e,s.viewState,i,n):ht.moveLeft(e.cursorConfig,e,s.viewState,i,n))})}static _moveHalfLineLeft(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=Math.round(e.getLineLength(l)/2);n[s]=nt.fromViewState(ht.moveLeft(e.cursorConfig,e,a.viewState,i,c))}return n}static _moveRight(e,t,i,n){return t.map(s=>{const a=e.getTextDirection(s.viewState.position.lineNumber)===Oo.RTL;return nt.fromViewState(a?ht.moveLeft(e.cursorConfig,e,s.viewState,i,n):ht.moveRight(e.cursorConfig,e,s.viewState,i,n))})}static _moveHalfLineRight(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=Math.round(e.getLineLength(l)/2);n[s]=nt.fromViewState(ht.moveRight(e.cursorConfig,e,a.viewState,i,c))}return n}static _moveDownByViewLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const l=t[r];s[r]=nt.fromViewState(ht.moveDown(e.cursorConfig,e,l.viewState,i,n))}return s}static _moveDownByModelLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const l=t[r];s[r]=nt.fromModelState(ht.moveDown(e.cursorConfig,e.model,l.modelState,i,n))}return s}static _moveUpByViewLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const l=t[r];s[r]=nt.fromViewState(ht.moveUp(e.cursorConfig,e,l.viewState,i,n))}return s}static _moveUpByModelLines(e,t,i,n){const s=[];for(let r=0,a=t.length;r<a;r++){const l=t[r];s[r]=nt.fromModelState(ht.moveUp(e.cursorConfig,e.model,l.modelState,i,n))}return s}static _moveToViewPosition(e,t,i,n,s){return nt.fromViewState(t.viewState.move(i,n,s,0))}static _moveToModelPosition(e,t,i,n,s){return nt.fromModelState(t.modelState.move(i,n,s,0))}static _moveToViewMinColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=e.getLineMinColumn(l);n[s]=this._moveToViewPosition(e,a,i,l,c)}return n}static _moveToViewFirstNonWhitespaceColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=e.getLineFirstNonWhitespaceColumn(l);n[s]=this._moveToViewPosition(e,a,i,l,c)}return n}static _moveToViewCenterColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=Math.round((e.getLineMaxColumn(l)+e.getLineMinColumn(l))/2);n[s]=this._moveToViewPosition(e,a,i,l,c)}return n}static _moveToViewMaxColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=e.getLineMaxColumn(l);n[s]=this._moveToViewPosition(e,a,i,l,c)}return n}static _moveToViewLastNonWhitespaceColumn(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.viewState.position.lineNumber,c=e.getLineLastNonWhitespaceColumn(l);n[s]=this._moveToViewPosition(e,a,i,l,c)}return n}}var Qy;(function(o){const e=function(i){if(!nn(i))return!1;const n=i;return!(!ji(n.to)||!Qn(n.select)&&!MB(n.select)||!Qn(n.by)&&!ji(n.by)||!Qn(n.value)&&!bc(n.value))};o.metadata={description:"Move cursor to a logical position in the view",args:[{name:"Cursor move argument object",description:`Property-value pairs that can be passed through this argument:
* 'to': A mandatory logical position value providing where to move the cursor.
\`\`\`
'left', 'right', 'up', 'down', 'prevBlankLine', 'nextBlankLine',
'wrappedLineStart', 'wrappedLineEnd', 'wrappedLineColumnCenter'
'wrappedLineFirstNonWhitespaceCharacter', 'wrappedLineLastNonWhitespaceCharacter'
'viewPortTop', 'viewPortCenter', 'viewPortBottom', 'viewPortIfOutside'
\`\`\`
* 'by': Unit to move. Default is computed based on 'to' value.
\`\`\`
'line', 'wrappedLine', 'character', 'halfLine'
\`\`\`
* 'value': Number of units to move. Default is '1'.
* 'select': If 'true' makes the selection. Default is 'false'.
`,constraint:e,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["left","right","up","down","prevBlankLine","nextBlankLine","wrappedLineStart","wrappedLineEnd","wrappedLineColumnCenter","wrappedLineFirstNonWhitespaceCharacter","wrappedLineLastNonWhitespaceCharacter","viewPortTop","viewPortCenter","viewPortBottom","viewPortIfOutside"]},by:{type:"string",enum:["line","wrappedLine","character","halfLine"]},value:{type:"number",default:1},select:{type:"boolean",default:!1}}}}]},o.RawDirection={Left:"left",Right:"right",Up:"up",Down:"down",PrevBlankLine:"prevBlankLine",NextBlankLine:"nextBlankLine",WrappedLineStart:"wrappedLineStart",WrappedLineFirstNonWhitespaceCharacter:"wrappedLineFirstNonWhitespaceCharacter",WrappedLineColumnCenter:"wrappedLineColumnCenter",WrappedLineEnd:"wrappedLineEnd",WrappedLineLastNonWhitespaceCharacter:"wrappedLineLastNonWhitespaceCharacter",ViewPortTop:"viewPortTop",ViewPortCenter:"viewPortCenter",ViewPortBottom:"viewPortBottom",ViewPortIfOutside:"viewPortIfOutside"},o.RawUnit={Line:"line",WrappedLine:"wrappedLine",Character:"character",HalfLine:"halfLine"};function t(i){if(!i.to)return null;let n;switch(i.to){case o.RawDirection.Left:n=0;break;case o.RawDirection.Right:n=1;break;case o.RawDirection.Up:n=2;break;case o.RawDirection.Down:n=3;break;case o.RawDirection.PrevBlankLine:n=4;break;case o.RawDirection.NextBlankLine:n=5;break;case o.RawDirection.WrappedLineStart:n=6;break;case o.RawDirection.WrappedLineFirstNonWhitespaceCharacter:n=7;break;case o.RawDirection.WrappedLineColumnCenter:n=8;break;case o.RawDirection.WrappedLineEnd:n=9;break;case o.RawDirection.WrappedLineLastNonWhitespaceCharacter:n=10;break;case o.RawDirection.ViewPortTop:n=11;break;case o.RawDirection.ViewPortBottom:n=13;break;case o.RawDirection.ViewPortCenter:n=12;break;case o.RawDirection.ViewPortIfOutside:n=14;break;default:return null}let s=0;switch(i.by){case o.RawUnit.Line:s=1;break;case o.RawUnit.WrappedLine:s=2;break;case o.RawUnit.Character:s=3;break;case o.RawUnit.HalfLine:s=4;break}return{direction:n,unit:s,select:!!i.select,value:i.value||1}}o.parse=t})(Qy||(Qy={}));var Ai;(function(o){o[o.None=0]="None",o[o.Indent=1]="Indent",o[o.IndentOutdent=2]="IndentOutdent",o[o.Outdent=3]="Outdent"})(Ai||(Ai={}));class w2{constructor(e){if(this._neutralCharacter=null,this._neutralCharacterSearched=!1,this.open=e.open,this.close=e.close,this._inString=!0,this._inComment=!0,this._inRegEx=!0,Array.isArray(e.notIn))for(let t=0,i=e.notIn.length;t<i;t++)switch(e.notIn[t]){case"string":this._inString=!1;break;case"comment":this._inComment=!1;break;case"regex":this._inRegEx=!1;break}}isOK(e){switch(e){case 0:return!0;case 1:return this._inComment;case 2:return this._inString;case 3:return this._inRegEx}}shouldAutoClose(e,t){if(e.getTokenCount()===0)return!0;const i=e.findTokenIndexAtOffset(t-2),n=e.getStandardTokenType(i);return this.isOK(n)}_findNeutralCharacterInRange(e,t){for(let i=e;i<=t;i++){const n=String.fromCharCode(i);if(!this.open.includes(n)&&!this.close.includes(n))return n}return null}findNeutralCharacter(){return this._neutralCharacterSearched||(this._neutralCharacterSearched=!0,this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(48,57)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(97,122)),this._neutralCharacter||(this._neutralCharacter=this._findNeutralCharacterInRange(65,90))),this._neutralCharacter}}class woe{constructor(e){this.autoClosingPairsOpenByStart=new Map,this.autoClosingPairsOpenByEnd=new Map,this.autoClosingPairsCloseByStart=new Map,this.autoClosingPairsCloseByEnd=new Map,this.autoClosingPairsCloseSingleChar=new Map;for(const t of e)N1(this.autoClosingPairsOpenByStart,t.open.charAt(0),t),N1(this.autoClosingPairsOpenByEnd,t.open.charAt(t.open.length-1),t),N1(this.autoClosingPairsCloseByStart,t.close.charAt(0),t),N1(this.autoClosingPairsCloseByEnd,t.close.charAt(t.close.length-1),t),t.close.length===1&&t.open.length===1&&N1(this.autoClosingPairsCloseSingleChar,t.close,t)}}function N1(o,e,t){o.has(e)?o.get(e).push(t):o.set(e,[t])}const Jy="`~!@#$%^&*()-=+[{]}\\|;:'\",.<>/?";function Soe(o=""){let e="(-?\\d*\\.\\d\\w*)|([^";for(const t of Jy)o.indexOf(t)>=0||(e+="\\"+t);return e+="\\s]+)",new RegExp(e,"g")}const S2=Soe();function y2(o){let e=S2;if(o&&o instanceof RegExp)if(o.global)e=o;else{let t="g";o.ignoreCase&&(t+="i"),o.multiline&&(t+="m"),o.unicode&&(t+="u"),e=new RegExp(o.source,t)}return e.lastIndex=0,e}const GH=new Jn;GH.unshift({maxLen:1e3,windowSize:15,timeBudget:150});function T1(o,e,t,i,n){if(e=y2(e),n||(n=Ye.first(GH)),t.length>n.maxLen){let c=o-n.maxLen/2;return c<0?c=0:i+=c,t=t.substring(c,o+n.maxLen/2),T1(o,e,t,i,n)}const s=Date.now(),r=o-1-i;let a=-1,l=null;for(let c=1;!(Date.now()-s>=n.timeBudget);c++){const d=r-n.windowSize*c;e.lastIndex=Math.max(0,d);const h=yoe(e,t,r,a);if(!h&&l||(l=h,d<=0))break;a=d}if(l){const c={word:l[0],startColumn:i+1+l.index,endColumn:i+1+l.index+l[0].length};return e.lastIndex=0,c}return null}function yoe(o,e,t,i){let n;for(;n=o.exec(e);){const s=n.index||0;if(s<=t&&o.lastIndex>=t)return n;if(i>0&&s>i)return null}return null}const mC=class mC{constructor(e){if(e.autoClosingPairs?this._autoClosingPairs=e.autoClosingPairs.map(t=>new w2(t)):e.brackets?this._autoClosingPairs=e.brackets.map(t=>new w2({open:t[0],close:t[1]})):this._autoClosingPairs=[],e.__electricCharacterSupport&&e.__electricCharacterSupport.docComment){const t=e.__electricCharacterSupport.docComment;this._autoClosingPairs.push(new w2({open:t.open,close:t.close||""}))}this._autoCloseBeforeForQuotes=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:mC.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES,this._autoCloseBeforeForBrackets=typeof e.autoCloseBefore=="string"?e.autoCloseBefore:mC.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS,this._surroundingPairs=e.surroundingPairs||this._autoClosingPairs}getAutoClosingPairs(){return this._autoClosingPairs}getAutoCloseBeforeSet(e){return e?this._autoCloseBeforeForQuotes:this._autoCloseBeforeForBrackets}getSurroundingPairs(){return this._surroundingPairs}};mC.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_QUOTES=`;:.,=}])>
`,mC.DEFAULT_AUTOCLOSE_BEFORE_LANGUAGE_DEFINED_BRACKETS=`'"\`;:.,=}])>
`;let L2=mC,x2;function ZH(){return x2||(x2=new TextDecoder("UTF-16LE")),x2}let k2;function Loe(){return k2||(k2=new TextDecoder("UTF-16BE")),k2}let I2;function YH(){return I2||(I2=HB()?ZH():Loe()),I2}function xoe(o,e,t){const i=new Uint16Array(o.buffer,e,t);return t>0&&(i[0]===65279||i[0]===65534)?koe(o,e,t):ZH().decode(i)}function koe(o,e,t){const i=[];let n=0;for(let s=0;s<t;s++){const r=rne(o,e);e+=2,i[n++]=String.fromCharCode(r)}return i.join("")}class uh{constructor(e){this._capacity=e|0,this._buffer=new Uint16Array(this._capacity),this._completedStrings=null,this._bufferLength=0}reset(){this._completedStrings=null,this._bufferLength=0}build(){return this._completedStrings!==null?(this._flushBuffer(),this._completedStrings.join("")):this._buildBuffer()}_buildBuffer(){if(this._bufferLength===0)return"";const e=new Uint16Array(this._buffer.buffer,0,this._bufferLength);return YH().decode(e)}_flushBuffer(){const e=this._buildBuffer();this._bufferLength=0,this._completedStrings===null?this._completedStrings=[e]:this._completedStrings[this._completedStrings.length]=e}appendCharCode(e){const t=this._capacity-this._bufferLength;t<=1&&(t===0||zi(e))&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendASCIICharCode(e){this._bufferLength===this._capacity&&this._flushBuffer(),this._buffer[this._bufferLength++]=e}appendString(e){const t=e.length;if(this._bufferLength+t>=this._capacity){this._flushBuffer(),this._completedStrings[this._completedStrings.length]=e;return}for(let i=0;i<t;i++)this._buffer[this._bufferLength++]=e.charCodeAt(i)}}class eL{constructor(e,t,i,n,s,r){this._richEditBracketBrand=void 0,this.languageId=e,this.index=t,this.open=i,this.close=n,this.forwardRegex=s,this.reversedRegex=r,this._openSet=eL._toSet(this.open),this._closeSet=eL._toSet(this.close)}isOpen(e){return this._openSet.has(e)}isClose(e){return this._closeSet.has(e)}static _toSet(e){const t=new Set;for(const i of e)t.add(i);return t}}function Ioe(o){const e=o.length;o=o.map(r=>[r[0].toLowerCase(),r[1].toLowerCase()]);const t=[];for(let r=0;r<e;r++)t[r]=r;const i=(r,a)=>{const[l,c]=r,[d,h]=a;return l===d||l===h||c===d||c===h},n=(r,a)=>{const l=Math.min(r,a),c=Math.max(r,a);for(let d=0;d<e;d++)t[d]===c&&(t[d]=l)};for(let r=0;r<e;r++){const a=o[r];for(let l=r+1;l<e;l++){const c=o[l];i(a,c)&&n(t[r],t[l])}}const s=[];for(let r=0;r<e;r++){const a=[],l=[];for(let c=0;c<e;c++)if(t[c]===r){const[d,h]=o[c];a.push(d),l.push(h)}a.length>0&&s.push({open:a,close:l})}return s}class Doe{constructor(e,t){this._richEditBracketsBrand=void 0;const i=Ioe(t);this.brackets=i.map((n,s)=>new eL(e,s,n.open,n.close,Eoe(n.open,n.close,i,s),Noe(n.open,n.close,i,s))),this.forwardRegex=Toe(this.brackets),this.reversedRegex=Roe(this.brackets),this.textIsBracket={},this.textIsOpenBracket={},this.maxBracketLength=0;for(const n of this.brackets){for(const s of n.open)this.textIsBracket[s]=n,this.textIsOpenBracket[s]=!0,this.maxBracketLength=Math.max(this.maxBracketLength,s.length);for(const s of n.close)this.textIsBracket[s]=n,this.textIsOpenBracket[s]=!1,this.maxBracketLength=Math.max(this.maxBracketLength,s.length)}}}function XH(o,e,t,i){for(let n=0,s=e.length;n<s;n++){if(n===t)continue;const r=e[n];for(const a of r.open)a.indexOf(o)>=0&&i.push(a);for(const a of r.close)a.indexOf(o)>=0&&i.push(a)}}function QH(o,e){return o.length-e.length}function tL(o){if(o.length<=1)return o;const e=[],t=new Set;for(const i of o)t.has(i)||(e.push(i),t.add(i));return e}function Eoe(o,e,t,i){let n=[];n=n.concat(o),n=n.concat(e);for(let s=0,r=n.length;s<r;s++)XH(n[s],t,i,n);return n=tL(n),n.sort(QH),n.reverse(),R1(n)}function Noe(o,e,t,i){let n=[];n=n.concat(o),n=n.concat(e);for(let s=0,r=n.length;s<r;s++)XH(n[s],t,i,n);return n=tL(n),n.sort(QH),n.reverse(),R1(n.map(D2))}function Toe(o){let e=[];for(const t of o){for(const i of t.open)e.push(i);for(const i of t.close)e.push(i)}return e=tL(e),R1(e)}function Roe(o){let e=[];for(const t of o){for(const i of t.open)e.push(i);for(const i of t.close)e.push(i)}return e=tL(e),R1(e.map(D2))}function Moe(o){const e=/^[\w ]+$/.test(o);return o=oo(o),e?`\\b${o}\\b`:o}function R1(o,e){const t=`(${o.map(Moe).join(")|(")})`;return JB(t,!0,e)}const D2=(function(){function o(i){const n=new Uint16Array(i.length);let s=0;for(let r=i.length-1;r>=0;r--)n[s++]=i.charCodeAt(r);return YH().decode(n)}let e=null,t=null;return function(n){return e!==n&&(e=n,t=o(e)),t}})();class Yr{static _findPrevBracketInText(e,t,i,n){const s=i.match(e);if(!s)return null;const r=i.length-(s.index||0),a=s[0].length,l=n+r;return new k(t,l-a+1,t,l+1)}static findPrevBracketInRange(e,t,i,n,s){const a=D2(i).substring(i.length-s,i.length-n);return this._findPrevBracketInText(e,t,a,n)}static findNextBracketInText(e,t,i,n){const s=i.match(e);if(!s)return null;const r=s.index||0,a=s[0].length;if(a===0)return null;const l=n+r;return new k(t,l+1,t,l+1+a)}static findNextBracketInRange(e,t,i,n,s){const r=i.substring(n,s);return this.findNextBracketInText(e,t,r,n)}}class Poe{constructor(e){this._richEditBrackets=e}getElectricCharacters(){const e=[];if(this._richEditBrackets)for(const t of this._richEditBrackets.brackets)for(const i of t.close){const n=i.charAt(i.length-1);e.push(n)}return Dc(e)}onElectricCharacter(e,t,i){if(!this._richEditBrackets||this._richEditBrackets.brackets.length===0)return null;const n=t.findTokenIndexAtOffset(i-1);if(ul(t.getStandardTokenType(n)))return null;const s=this._richEditBrackets.reversedRegex,r=t.getLineContent().substring(0,i-1)+e,a=Yr.findPrevBracketInRange(s,1,r,0,r.length);if(!a)return null;const l=r.substring(a.startColumn-1,a.endColumn-1).toLowerCase();if(this._richEditBrackets.textIsOpenBracket[l])return null;const d=t.getActualLineContentBefore(a.startColumn-1);return/^\s*$/.test(d)?{matchOpenBracket:l}:null}}function iL(o){return o.global&&(o.lastIndex=0),!0}class Aoe{constructor(e){this._indentationRules=e}shouldIncrease(e){return!!(this._indentationRules&&this._indentationRules.increaseIndentPattern&&iL(this._indentationRules.increaseIndentPattern)&&this._indentationRules.increaseIndentPattern.test(e))}shouldDecrease(e){return!!(this._indentationRules&&this._indentationRules.decreaseIndentPattern&&iL(this._indentationRules.decreaseIndentPattern)&&this._indentationRules.decreaseIndentPattern.test(e))}shouldIndentNextLine(e){return!!(this._indentationRules&&this._indentationRules.indentNextLinePattern&&iL(this._indentationRules.indentNextLinePattern)&&this._indentationRules.indentNextLinePattern.test(e))}shouldIgnore(e){return!!(this._indentationRules&&this._indentationRules.unIndentedLinePattern&&iL(this._indentationRules.unIndentedLinePattern)&&this._indentationRules.unIndentedLinePattern.test(e))}getIndentMetadata(e){let t=0;return this.shouldIncrease(e)&&(t+=1),this.shouldDecrease(e)&&(t+=2),this.shouldIndentNextLine(e)&&(t+=4),this.shouldIgnore(e)&&(t+=8),t}}class Km{constructor(e){e=e||{},e.brackets=e.brackets||[["(",")"],["{","}"],["[","]"]],this._brackets=[],e.brackets.forEach(t=>{const i=Km._createOpenBracketRegExp(t[0]),n=Km._createCloseBracketRegExp(t[1]);i&&n&&this._brackets.push({open:t[0],openRegExp:i,close:t[1],closeRegExp:n})}),this._regExpRules=e.onEnterRules||[]}onEnter(e,t,i,n){if(e>=3)for(let s=0,r=this._regExpRules.length;s<r;s++){const a=this._regExpRules[s];if([{reg:a.beforeText,text:i},{reg:a.afterText,text:n},{reg:a.previousLineText,text:t}].every(c=>c.reg?(c.reg.lastIndex=0,c.reg.test(c.text)):!0))return a.action}if(e>=2&&i.length>0&&n.length>0)for(let s=0,r=this._brackets.length;s<r;s++){const a=this._brackets[s];if(a.openRegExp.test(i)&&a.closeRegExp.test(n))return{indentAction:Ai.IndentOutdent}}if(e>=2&&i.length>0){for(let s=0,r=this._brackets.length;s<r;s++)if(this._brackets[s].openRegExp.test(i))return{indentAction:Ai.Indent}}return null}static _createOpenBracketRegExp(e){let t=oo(e);return/\B/.test(t.charAt(0))||(t="\\b"+t),t+="\\s*$",Km._safeRegExp(t)}static _createCloseBracketRegExp(e){let t=oo(e);return/\B/.test(t.charAt(t.length-1))||(t=t+"\\b"),t="^\\s*"+t,Km._safeRegExp(t)}static _safeRegExp(e){try{return new RegExp(e)}catch(t){return Ee(t),null}}}const Me=We("configurationService");function E2(o,e){const t=Object.create(null);for(const i in o)JH(t,i,o[i],e);return t}function JH(o,e,t,i){const n=e.split("."),s=n.pop();let r=o;for(let a=0;a<n.length;a++){const l=n[a];let c=r[l];switch(typeof c){case"undefined":c=r[l]=Object.create(null);break;case"object":if(c===null){i(`Ignoring ${e} as ${n.slice(0,a+1).join(".")} is null`);return}break;default:i(`Ignoring ${e} as ${n.slice(0,a+1).join(".")} is ${JSON.stringify(c)}`);return}r=c}if(typeof r=="object"&&r!==null)try{r[s]=t}catch{i(`Ignoring ${e} as ${n.join(".")} is ${JSON.stringify(r)}`)}else i(`Ignoring ${e} as ${n.join(".")} is ${JSON.stringify(r)}`)}function Ooe(o,e){const t=e.split(".");eV(o,t)}function eV(o,e){if(!o)return;const t=e.shift();if(e.length===0){delete o[t];return}if(Object.keys(o).indexOf(t)!==-1){const i=o[t];typeof i=="object"&&!Array.isArray(i)&&(eV(i,e),Object.keys(i).length===0&&delete o[t])}}function tV(o,e,t){function i(r,a){let l=r;for(const c of a){if(typeof l!="object"||l===null)return;l=l[c]}return l}const n=e.split("."),s=i(o,n);return typeof s>"u"?t:s}function Foe(o){return o.replace(/^\[/,"").replace(/]$/g,"").replace(/\]\[/g,", ")}const Mt=We("languageService");class gl{constructor(e,t=[],i=!1){this.ctor=e,this.staticArguments=t,this.supportsDelayedInstantiation=i}}const iV=[];function je(o,e,t){e instanceof gl||(e=new gl(e,[],!!t)),iV.push([o,e])}function nV(){return iV}const _i=Object.freeze({text:"text/plain",binary:"application/octet-stream",unknown:"application/unknown",markdown:"text/markdown",latex:"text/latex",uriList:"text/uri-list",html:"text/html"}),nL={JSONContribution:"base.contributions.json"};function Woe(o){return o.length>0&&o.charAt(o.length-1)==="#"?o.substring(0,o.length-1):o}class Boe extends A{constructor(){super(...arguments),this.schemasById={},this._onDidChangeSchema=this._register(new P)}registerSchema(e,t,i){const n=Woe(e);this.schemasById[n]=t,this._onDidChangeSchema.fire(e),i&&i.add(ue(()=>{delete this.schemasById[n],this._onDidChangeSchema.fire(e)}))}notifySchemaChanged(e){this._onDidChangeSchema.fire(e)}}const Hoe=new Boe;ei.add(nL.JSONContribution,Hoe);const ka={Configuration:"base.contributions.configuration"},sL="vscode://schemas/settings/resourceLanguage",sV=ei.as(nL.JSONContribution);class Voe extends A{constructor(){super(),this.registeredConfigurationDefaults=[],this.overrideIdentifiers=new Set,this._onDidSchemaChange=this._register(new P),this._onDidUpdateConfiguration=this._register(new P),this.configurationDefaultsOverrides=new Map,this.defaultLanguageConfigurationOverridesNode={id:"defaultOverrides",title:p(1649,"Default Language Configuration Overrides"),properties:{}},this.configurationContributors=[this.defaultLanguageConfigurationOverridesNode],this.resourceLanguageSettingsSchema={properties:{},patternProperties:{},additionalProperties:!0,allowTrailingCommas:!0,allowComments:!0},this.configurationProperties={},this.policyConfigurations=new Map,this.excludedConfigurationProperties={},sV.registerSchema(sL,this.resourceLanguageSettingsSchema),this.registerOverridePropertyPatternKey()}registerConfiguration(e,t=!0){return this.registerConfigurations([e],t),e}registerConfigurations(e,t=!0){const i=new Set;this.doRegisterConfigurations(e,t,i),sV.registerSchema(sL,this.resourceLanguageSettingsSchema),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:i})}registerDefaultConfigurations(e){const t=new Set;this.doRegisterDefaultConfigurations(e,t),this._onDidSchemaChange.fire(),this._onDidUpdateConfiguration.fire({properties:t,defaultsOverrides:!0})}doRegisterDefaultConfigurations(e,t){this.registeredConfigurationDefaults.push(...e);const i=[];for(const{overrides:n,source:s}of e)for(const r in n){t.add(r);const a=this.configurationDefaultsOverrides.get(r)??this.configurationDefaultsOverrides.set(r,{configurationDefaultOverrides:[]}).get(r),l=n[r];if(a.configurationDefaultOverrides.push({value:l,source:s}),fh.test(r)){const c=this.mergeDefaultConfigurationsForOverrideIdentifier(r,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c,this.updateDefaultOverrideProperty(r,c,s),i.push(...oL(r))}else{const c=this.mergeDefaultConfigurationsForConfigurationProperty(r,l,s,a.configurationDefaultOverrideValue);if(!c)continue;a.configurationDefaultOverrideValue=c;const d=this.configurationProperties[r];d&&(this.updatePropertyDefaultValue(r,d),this.updateSchema(r,d))}}this.doRegisterOverrideIdentifiers(i)}updateDefaultOverrideProperty(e,t,i){const n={type:"object",default:t.value,description:p(1650,"Configure settings to be overridden for {0}.",Foe(e)),$ref:sL,defaultDefaultValue:t.value,source:i,defaultValueSource:i};this.configurationProperties[e]=n,this.defaultLanguageConfigurationOverridesNode.properties[e]=n}mergeDefaultConfigurationsForOverrideIdentifier(e,t,i,n){const s=n?.value||{},r=n?.source??new Map;if(!(r instanceof Map)){console.error("objectConfigurationSources is not a Map");return}for(const a of Object.keys(t)){const l=t[a];if(nn(l)&&(Qn(s[a])||nn(s[a]))){if(s[a]={...s[a]??{},...l},i)for(const d in l)r.set(`${a}.${d}`,i)}else s[a]=l,i?r.set(a,i):r.delete(a)}return{value:s,source:r}}mergeDefaultConfigurationsForConfigurationProperty(e,t,i,n){const s=this.configurationProperties[e],r=n?.value??s?.defaultDefaultValue;let a=i;if(nn(t)&&(s!==void 0&&s.type==="object"||s===void 0&&(Qn(r)||nn(r)))){if(a=n?.source??new Map,!(a instanceof Map)){console.error("defaultValueSource is not a Map");return}for(const c in t)i&&a.set(`${e}.${c}`,i);t={...nn(r)?r:{},...t}}return{value:t,source:a}}registerOverrideIdentifiers(e){this.doRegisterOverrideIdentifiers(e),this._onDidSchemaChange.fire()}doRegisterOverrideIdentifiers(e){for(const t of e)this.overrideIdentifiers.add(t);this.updateOverridePropertyPatternKey()}doRegisterConfigurations(e,t,i){e.forEach(n=>{this.validateAndRegisterProperties(n,t,n.extensionInfo,n.restrictedProperties,void 0,i),this.configurationContributors.push(n),this.registerJSONConfiguration(n)})}validateAndRegisterProperties(e,t=!0,i,n,s=4,r){s=hr(e.scope)?s:e.scope;const a=e.properties;if(a)for(const c in a){const d=a[c];if(t&&$oe(c,d)){delete a[c];continue}d.source=i,d.defaultDefaultValue=a[c].default,this.updatePropertyDefaultValue(c,d),fh.test(c)?d.scope=void 0:(d.scope=hr(d.scope)?s:d.scope,d.restricted=hr(d.restricted)?!!n?.includes(c):d.restricted),d.experiment?d.tags?.some(f=>f.toLowerCase()==="onexp")||(d.tags=d.tags??[],d.tags.push("onExP")):d.tags?.some(f=>f.toLowerCase()==="onexp")&&(console.error(`Invalid tag 'onExP' found for property '${c}'. Please use 'experiment' property instead.`),d.experiment={mode:"startup"});const h=a[c].hasOwnProperty("included")&&!a[c].included,u=a[c].policy?.name;h?(this.excludedConfigurationProperties[c]=a[c],u&&(this.policyConfigurations.set(u,c),r.add(c)),delete a[c]):(r.add(c),u&&this.policyConfigurations.set(u,c),this.configurationProperties[c]=a[c],!a[c].deprecationMessage&&a[c].markdownDeprecationMessage&&(a[c].deprecationMessage=a[c].markdownDeprecationMessage))}const l=e.allOf;if(l)for(const c of l)this.validateAndRegisterProperties(c,t,i,n,s,r)}getConfigurationProperties(){return this.configurationProperties}getPolicyConfigurations(){return this.policyConfigurations}getExcludedConfigurationProperties(){return this.excludedConfigurationProperties}registerJSONConfiguration(e){const t=i=>{const n=i.properties;if(n)for(const r in n)this.updateSchema(r,n[r]);i.allOf?.forEach(t)};t(e)}updateSchema(e,t){switch(t.scope){case 1:break;case 2:break;case 3:break;case 7:break;case 4:break;case 5:break;case 6:this.resourceLanguageSettingsSchema.properties[e]=t;break}}updateOverridePropertyPatternKey(){for(const e of this.overrideIdentifiers.values()){const t=`[${e}]`,i={type:"object",description:p(1651,"Configure editor settings to be overridden for a language."),errorMessage:p(1652,"This setting does not support per-language configuration."),$ref:sL};this.updatePropertyDefaultValue(t,i)}}registerOverridePropertyPatternKey(){p(1653,"Configure editor settings to be overridden for a language."),p(1654,"This setting does not support per-language configuration."),this._onDidSchemaChange.fire()}updatePropertyDefaultValue(e,t){const i=this.configurationDefaultsOverrides.get(e)?.configurationDefaultOverrideValue;let n,s;i&&(!t.disallowConfigurationDefault||!i.source)&&(n=i.value,s=i.source),Qn(n)&&(n=t.defaultDefaultValue,s=void 0),Qn(n)&&(n=Uoe(t.type)),t.default=n,t.defaultValueSource=s}}const oV="\\[([^\\]]+)\\]",rV=new RegExp(oV,"g"),zoe=`^(${oV})+$`,fh=new RegExp(zoe);function oL(o){const e=[];if(fh.test(o)){let t=rV.exec(o);for(;t?.length;){const i=t[1].trim();i&&e.push(i),t=rV.exec(o)}}return Dc(e)}function Uoe(o){switch(Array.isArray(o)?o[0]:o){case"boolean":return!1;case"integer":case"number":return 0;case"string":return"";case"array":return[];case"object":return{};default:return null}}const rL=new Voe;ei.add(ka.Configuration,rL);function $oe(o,e){return o.trim()?fh.test(o)?p(1656,"Cannot register '{0}'. This matches property pattern '\\\\[.*\\\\]$' for describing language specific editor settings. Use 'configurationDefaults' contribution.",o):rL.getConfigurationProperties()[o]!==void 0?p(1657,"Cannot register '{0}'. This property is already registered.",o):e.policy?.name&&rL.getPolicyConfigurations().get(e.policy?.name)!==void 0?p(1658,"Cannot register '{0}'. The associated policy {1} is already registered with {2}.",o,e.policy?.name,rL.getPolicyConfigurations().get(e.policy?.name)):null:p(1655,"Cannot register an empty property")}const joe={ModesRegistry:"editor.modesRegistry"};class qoe extends A{constructor(){super(),this._onDidChangeLanguages=this._register(new P),this.onDidChangeLanguages=this._onDidChangeLanguages.event,this._languages=[]}registerLanguage(e){return this._languages.push(e),this._onDidChangeLanguages.fire(void 0),{dispose:()=>{for(let t=0,i=this._languages.length;t<i;t++)if(this._languages[t]===e){this._languages.splice(t,1);return}}}}getLanguages(){return this._languages}}const Gm=new qoe;ei.add(joe.ModesRegistry,Gm);const Fo="plaintext";Gm.registerLanguage({id:Fo,extensions:[".txt"],aliases:[p(780,"Plain Text"),"text"],mimetypes:[_i.text]}),ei.as(ka.Configuration).registerDefaultConfigurations([{overrides:{"[plaintext]":{"editor.unicodeHighlight.ambiguousCharacters":!1,"editor.unicodeHighlight.invisibleCharacters":!1},"[go]":{"editor.insertSpaces":!1},"[makefile]":{"editor.insertSpaces":!1},"[shellscript]":{"files.eol":`
`},"[yaml]":{"editor.insertSpaces":!0,"editor.tabSize":2}}}]);class Koe{constructor(e,t){this.languageId=e;const i=t.brackets?aV(t.brackets):[],n=new gR(a=>{const l=new Set;return{info:new Goe(this,a,l),closing:l}}),s=new gR(a=>{const l=new Set,c=new Set;return{info:new Zoe(this,a,l,c),opening:l,openingColorized:c}});for(const[a,l]of i){const c=n.get(a),d=s.get(l);c.closing.add(d.info),d.opening.add(c.info)}const r=t.colorizedBracketPairs?aV(t.colorizedBracketPairs):i.filter(a=>!(a[0]==="<"&&a[1]===">"));for(const[a,l]of r){const c=n.get(a),d=s.get(l);c.closing.add(d.info),d.openingColorized.add(c.info),d.opening.add(c.info)}this._openingBrackets=new Map([...n.cachedValues].map(([a,l])=>[a,l.info])),this._closingBrackets=new Map([...s.cachedValues].map(([a,l])=>[a,l.info]))}get openingBrackets(){return[...this._openingBrackets.values()]}get closingBrackets(){return[...this._closingBrackets.values()]}getOpeningBracketInfo(e){return this._openingBrackets.get(e)}getClosingBracketInfo(e){return this._closingBrackets.get(e)}getBracketInfo(e){return this.getOpeningBracketInfo(e)||this.getClosingBracketInfo(e)}getBracketRegExp(e){const t=Array.from([...this._openingBrackets.keys(),...this._closingBrackets.keys()]);return R1(t,e)}}function aV(o){return o.filter(([e,t])=>e!==""&&t!=="")}class lV{constructor(e,t){this.config=e,this.bracketText=t}get languageId(){return this.config.languageId}}class Goe extends lV{constructor(e,t,i){super(e,t),this.openedBrackets=i,this.isOpeningBracket=!0}}class Zoe extends lV{constructor(e,t,i,n){super(e,t),this.openingBrackets=i,this.openingColorizedBrackets=n,this.isOpeningBracket=!1}closes(e){return e.config!==this.config?!1:this.openingBrackets.has(e)}closesColorized(e){return e.config!==this.config?!1:this.openingColorizedBrackets.has(e)}getOpeningBrackets(){return[...this.openingBrackets]}}var Yoe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cV=function(o,e){return function(t,i){e(t,i,o)}};class N2{constructor(e){this.languageId=e}affects(e){return this.languageId?this.languageId===e:!0}}const Jt=We("languageConfigurationService");let T2=class extends A{constructor(e,t){super(),this.configurationService=e,this.languageService=t,this._registry=this._register(new ere),this.onDidChangeEmitter=this._register(new P),this.onDidChange=this.onDidChangeEmitter.event,this.configurations=new Map;const i=new Set(Object.values(R2));this._register(this.configurationService.onDidChangeConfiguration(n=>{const s=n.change.keys.some(a=>i.has(a)),r=n.change.overrides.filter(([a,l])=>l.some(c=>i.has(c))).map(([a])=>a);if(s)this.configurations.clear(),this.onDidChangeEmitter.fire(new N2(void 0));else for(const a of r)this.languageService.isRegisteredLanguageId(a)&&(this.configurations.delete(a),this.onDidChangeEmitter.fire(new N2(a)))})),this._register(this._registry.onDidChange(n=>{this.configurations.delete(n.languageId),this.onDidChangeEmitter.fire(new N2(n.languageId))}))}register(e,t,i){return this._registry.register(e,t,i)}getLanguageConfiguration(e){let t=this.configurations.get(e);return t||(t=Xoe(e,this._registry,this.configurationService,this.languageService),this.configurations.set(e,t)),t}};T2=Yoe([cV(0,Me),cV(1,Mt)],T2);function Xoe(o,e,t,i){let n=e.getLanguageConfiguration(o);if(!n){if(!i.isRegisteredLanguageId(o))return new Zm(o,{});n=new Zm(o,{})}const s=Qoe(n.languageId,t),r=uV([n.underlyingConfig,s]);return new Zm(n.languageId,r)}const R2={brackets:"editor.language.brackets",colorizedBracketPairs:"editor.language.colorizedBracketPairs"};function Qoe(o,e){const t=e.getValue(R2.brackets,{overrideIdentifier:o}),i=e.getValue(R2.colorizedBracketPairs,{overrideIdentifier:o});return{brackets:dV(t),colorizedBracketPairs:dV(i)}}function dV(o){if(Array.isArray(o))return o.map(e=>{if(!(!Array.isArray(e)||e.length!==2))return[e[0],e[1]]}).filter(e=>!!e)}function hV(o,e,t){const i=o.getLineContent(e);let n=It(i);return n.length>t-1&&(n=n.substring(0,t-1)),n}class Joe{constructor(e){this.languageId=e,this._resolved=null,this._entries=[],this._order=0,this._resolved=null}register(e,t){const i=new fV(e,t,++this._order);return this._entries.push(i),this._resolved=null,ue(()=>{for(let n=0;n<this._entries.length;n++)if(this._entries[n]===i){this._entries.splice(n,1),this._resolved=null;break}})}getResolvedConfiguration(){if(!this._resolved){const e=this._resolve();e&&(this._resolved=new Zm(this.languageId,e))}return this._resolved}_resolve(){return this._entries.length===0?null:(this._entries.sort(fV.cmp),uV(this._entries.map(e=>e.configuration)))}}function uV(o){let e={comments:void 0,brackets:void 0,wordPattern:void 0,indentationRules:void 0,onEnterRules:void 0,autoClosingPairs:void 0,surroundingPairs:void 0,autoCloseBefore:void 0,folding:void 0,colorizedBracketPairs:void 0,__electricCharacterSupport:void 0};for(const t of o)e={comments:t.comments||e.comments,brackets:t.brackets||e.brackets,wordPattern:t.wordPattern||e.wordPattern,indentationRules:t.indentationRules||e.indentationRules,onEnterRules:t.onEnterRules||e.onEnterRules,autoClosingPairs:t.autoClosingPairs||e.autoClosingPairs,surroundingPairs:t.surroundingPairs||e.surroundingPairs,autoCloseBefore:t.autoCloseBefore||e.autoCloseBefore,folding:t.folding||e.folding,colorizedBracketPairs:t.colorizedBracketPairs||e.colorizedBracketPairs,__electricCharacterSupport:t.__electricCharacterSupport||e.__electricCharacterSupport};return e}class fV{constructor(e,t,i){this.configuration=e,this.priority=t,this.order=i}static cmp(e,t){return e.priority===t.priority?e.order-t.order:e.priority-t.priority}}class gV{constructor(e){this.languageId=e}}class ere extends A{constructor(){super(),this._entries=new Map,this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._register(this.register(Fo,{brackets:[["(",")"],["[","]"],["{","}"]],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"},{open:"`",close:"`"}],colorizedBracketPairs:[],folding:{offSide:!0}},0))}register(e,t,i=0){let n=this._entries.get(e);n||(n=new Joe(e),this._entries.set(e,n));const s=n.register(t,i);return this._onDidChange.fire(new gV(e)),ue(()=>{s.dispose(),this._onDidChange.fire(new gV(e))})}getLanguageConfiguration(e){return this._entries.get(e)?.getResolvedConfiguration()||null}}class Zm{constructor(e,t){this.languageId=e,this.underlyingConfig=t,this._brackets=null,this._electricCharacter=null,this._onEnterSupport=this.underlyingConfig.brackets||this.underlyingConfig.indentationRules||this.underlyingConfig.onEnterRules?new Km(this.underlyingConfig):null,this.comments=Zm._handleComments(this.underlyingConfig),this.characterPair=new L2(this.underlyingConfig),this.wordDefinition=this.underlyingConfig.wordPattern||S2,this.indentationRules=this.underlyingConfig.indentationRules,this.underlyingConfig.indentationRules?this.indentRulesSupport=new Aoe(this.underlyingConfig.indentationRules):this.indentRulesSupport=null,this.foldingRules=this.underlyingConfig.folding||{},this.bracketsNew=new Koe(e,this.underlyingConfig)}getWordDefinition(){return y2(this.wordDefinition)}get brackets(){return!this._brackets&&this.underlyingConfig.brackets&&(this._brackets=new Doe(this.languageId,this.underlyingConfig.brackets)),this._brackets}get electricCharacter(){return this._electricCharacter||(this._electricCharacter=new Poe(this.brackets)),this._electricCharacter}onEnter(e,t,i,n){return this._onEnterSupport?this._onEnterSupport.onEnter(e,t,i,n):null}getAutoClosingPairs(){return new woe(this.characterPair.getAutoClosingPairs())}getAutoCloseBeforeSet(e){return this.characterPair.getAutoCloseBeforeSet(e)}getSurroundingPairs(){return this.characterPair.getSurroundingPairs()}static _handleComments(e){const t=e.comments;if(!t)return null;const i={};if(t.lineComment&&(typeof t.lineComment=="string"?i.lineCommentToken=t.lineComment:(i.lineCommentToken=t.lineComment.comment,i.lineCommentNoIndent=t.lineComment.noIndent)),t.blockComment){const[n,s]=t.blockComment;i.blockCommentStartToken=n,i.blockCommentEndToken=s}return i}}je(Jt,T2,1);class zn{static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static getClassNameFromMetadata(e){let i="mtk"+this.getForeground(e);const n=this.getFontStyle(e);return n&1&&(i+=" mtki"),n&2&&(i+=" mtkb"),n&4&&(i+=" mtku"),n&8&&(i+=" mtks"),i}static getInlineStyleFromMetadata(e,t){const i=this.getForeground(e),n=this.getFontStyle(e);let s=`color: ${t[i]};`;n&1&&(s+="font-style: italic;"),n&2&&(s+="font-weight: bold;");let r="";return n&4&&(r+=" underline"),n&8&&(r+=" line-through"),r&&(s+=`text-decoration:${r};`),s}static getPresentationFromMetadata(e){const t=this.getForeground(e),i=this.getFontStyle(e);return{foreground:t,italic:!!(i&1),bold:!!(i&2),underline:!!(i&4),strikethrough:!!(i&8)}}}class pe{static fromTo(e,t){return new pe(e,t)}static addRange(e,t){let i=0;for(;i<t.length&&t[i].endExclusive<e.start;)i++;let n=i;for(;n<t.length&&t[n].start<=e.endExclusive;)n++;if(i===n)t.splice(i,0,e);else{const s=Math.min(e.start,t[i].start),r=Math.max(e.endExclusive,t[n-1].endExclusive);t.splice(i,n-i,new pe(s,r))}}static tryCreate(e,t){if(!(e>t))return new pe(e,t)}static ofLength(e){return new pe(0,e)}static ofStartAndLength(e,t){return new pe(e,e+t)}static emptyAt(e){return new pe(e,e)}constructor(e,t){if(this.start=e,this.endExclusive=t,e>t)throw new Ce(`Invalid range: ${this.toString()}`)}get isEmpty(){return this.start===this.endExclusive}delta(e){return new pe(this.start+e,this.endExclusive+e)}deltaStart(e){return new pe(this.start+e,this.endExclusive)}deltaEnd(e){return new pe(this.start,this.endExclusive+e)}get length(){return this.endExclusive-this.start}toString(){return`[${this.start}, ${this.endExclusive})`}equals(e){return this.start===e.start&&this.endExclusive===e.endExclusive}contains(e){return this.start<=e&&e<this.endExclusive}join(e){return new pe(Math.min(this.start,e.start),Math.max(this.endExclusive,e.endExclusive))}intersect(e){const t=Math.max(this.start,e.start),i=Math.min(this.endExclusive,e.endExclusive);if(t<=i)return new pe(t,i)}intersectionLength(e){const t=Math.max(this.start,e.start),i=Math.min(this.endExclusive,e.endExclusive);return Math.max(0,i-t)}intersects(e){const t=Math.max(this.start,e.start),i=Math.min(this.endExclusive,e.endExclusive);return t<i}intersectsOrTouches(e){const t=Math.max(this.start,e.start),i=Math.min(this.endExclusive,e.endExclusive);return t<=i}isBefore(e){return this.endExclusive<=e.start}isAfter(e){return this.start>=e.endExclusive}slice(e){return e.slice(this.start,this.endExclusive)}substring(e){return e.substring(this.start,this.endExclusive)}clip(e){if(this.isEmpty)throw new Ce(`Invalid clipping range: ${this.toString()}`);return Math.max(this.start,Math.min(this.endExclusive-1,e))}clipCyclic(e){if(this.isEmpty)throw new Ce(`Invalid clipping range: ${this.toString()}`);return e<this.start?this.endExclusive-(this.start-e)%this.length:e>=this.endExclusive?this.start+(e-this.start)%this.length:e}forEach(e){for(let t=this.start;t<this.endExclusive;t++)e(t)}joinRightTouching(e){if(this.endExclusive!==e.start)throw new Ce(`Invalid join: ${this.toString()} and ${e.toString()}`);return new pe(this.start,e.endExclusive)}}class M2{constructor(){this._sortedRanges=[]}addRange(e){let t=0;for(;t<this._sortedRanges.length&&this._sortedRanges[t].endExclusive<e.start;)t++;let i=t;for(;i<this._sortedRanges.length&&this._sortedRanges[i].start<=e.endExclusive;)i++;if(t===i)this._sortedRanges.splice(t,0,e);else{const n=Math.min(e.start,this._sortedRanges[t].start),s=Math.max(e.endExclusive,this._sortedRanges[i-1].endExclusive);this._sortedRanges.splice(t,i-t,new pe(n,s))}}toString(){return this._sortedRanges.map(e=>e.toString()).join(", ")}intersectsStrict(e){let t=0;for(;t<this._sortedRanges.length&&this._sortedRanges[t].endExclusive<=e.start;)t++;return t<this._sortedRanges.length&&this._sortedRanges[t].start<e.endExclusive}intersectWithRange(e){const t=new M2;for(const i of this._sortedRanges){const n=i.intersect(e);n&&t.addRange(n)}return t}intersectWithRangeLength(e){return this.intersectWithRange(e).length}get length(){return this._sortedRanges.reduce((e,t)=>e+t.length,0)}}const Wd=class Wd{static createEmpty(e,t){const i=Wd.defaultTokenMetadata,n=new Uint32Array(2);return n[0]=e.length,n[1]=i,new Wd(n,e,t)}static createFromTextAndMetadata(e,t){let i=0,n="";const s=new Array;for(const{text:r,metadata:a}of e)s.push(i+r.length,a),i+=r.length,n+=r;return new Wd(new Uint32Array(s),n,t)}static convertToEndOffset(e,t){const n=(e.length>>>1)-1;for(let s=0;s<n;s++)e[s<<1]=e[s+1<<1];e[n<<1]=t}static findIndexInTokensArray(e,t){if(e.length<=2)return 0;let i=0,n=(e.length>>>1)-1;for(;i<n;){const s=i+Math.floor((n-i)/2),r=e[s<<1];if(r===t)return s+1;r<t?i=s+1:r>t&&(n=s)}return i}constructor(e,t,i){this._lineTokensBrand=void 0,(e.length>1?e[e.length-2]:0)!==t.length&&Ee(new Error("Token length and text length do not match!")),this._tokens=e,this._tokensCount=this._tokens.length>>>1,this._text=t,this.languageIdCodec=i}getTextLength(){return this._text.length}equals(e){return e instanceof Wd?this.slicedEquals(e,0,this._tokensCount):!1}slicedEquals(e,t,i){if(this._text!==e._text||this._tokensCount!==e._tokensCount)return!1;const n=t<<1,s=n+(i<<1);for(let r=n;r<s;r++)if(this._tokens[r]!==e._tokens[r])return!1;return!0}getLineContent(){return this._text}getCount(){return this._tokensCount}getStartOffset(e){return e>0?this._tokens[e-1<<1]:0}getMetadata(e){return this._tokens[(e<<1)+1]}getLanguageId(e){const t=this._tokens[(e<<1)+1],i=zn.getLanguageId(t);return this.languageIdCodec.decodeLanguageId(i)}getStandardTokenType(e){const t=this._tokens[(e<<1)+1];return zn.getTokenType(t)}getForeground(e){const t=this._tokens[(e<<1)+1];return zn.getForeground(t)}getClassName(e){const t=this._tokens[(e<<1)+1];return zn.getClassNameFromMetadata(t)}getInlineStyle(e,t){const i=this._tokens[(e<<1)+1];return zn.getInlineStyleFromMetadata(i,t)}getPresentation(e){const t=this._tokens[(e<<1)+1];return zn.getPresentationFromMetadata(t)}getEndOffset(e){return this._tokens[e<<1]}findTokenIndexAtOffset(e){return Wd.findIndexInTokensArray(this._tokens,e)}inflate(){return this}sliceAndInflate(e,t,i){return new P2(this,e,t,i)}sliceZeroCopy(e){return this.sliceAndInflate(e.start,e.endExclusive,0)}withInserted(e){if(e.length===0)return this;let t=0,i=0,n="";const s=new Array;let r=0;for(;;){const a=t<this._tokensCount?this._tokens[t<<1]:-1,l=i<e.length?e[i]:null;if(a!==-1&&(l===null||a<=l.offset)){n+=this._text.substring(r,a);const c=this._tokens[(t<<1)+1];s.push(n.length,c),t++,r=a}else if(l){if(l.offset>r){n+=this._text.substring(r,l.offset);const c=this._tokens[(t<<1)+1];s.push(n.length,c),r=l.offset}n+=l.text,s.push(n.length,l.tokenMetadata),i++}else break}return new Wd(new Uint32Array(s),n,this.languageIdCodec)}getTokensInRange(e){const t=new ire,i=this.findTokenIndexAtOffset(e.start),n=this.findTokenIndexAtOffset(e.endExclusive);for(let s=i;s<=n;s++){const a=new pe(this.getStartOffset(s),this.getEndOffset(s)).intersectionLength(e);a>0&&t.add(a,this.getMetadata(s))}return t.build()}getTokenText(e){const t=this.getStartOffset(e),i=this.getEndOffset(e);return this._text.substring(t,i)}forEach(e){const t=this.getCount();for(let i=0;i<t;i++)e(i)}toString(){let e="";return this.forEach(t=>{e+=`[${this.getTokenText(t)}]{${this.getClassName(t)}}`}),e}};Wd.defaultTokenMetadata=(32768|2<<24)>>>0;let bi=Wd;class P2{constructor(e,t,i,n){this._source=e,this._startOffset=t,this._endOffset=i,this._deltaOffset=n,this._firstTokenIndex=e.findTokenIndexAtOffset(t),this.languageIdCodec=e.languageIdCodec,this._tokensCount=0;for(let s=this._firstTokenIndex,r=e.getCount();s<r&&!(e.getStartOffset(s)>=i);s++)this._tokensCount++}getMetadata(e){return this._source.getMetadata(this._firstTokenIndex+e)}getLanguageId(e){return this._source.getLanguageId(this._firstTokenIndex+e)}getLineContent(){return this._source.getLineContent().substring(this._startOffset,this._endOffset)}equals(e){return e instanceof P2?this._startOffset===e._startOffset&&this._endOffset===e._endOffset&&this._deltaOffset===e._deltaOffset&&this._source.slicedEquals(e._source,this._firstTokenIndex,this._tokensCount):!1}getCount(){return this._tokensCount}getStandardTokenType(e){return this._source.getStandardTokenType(this._firstTokenIndex+e)}getForeground(e){return this._source.getForeground(this._firstTokenIndex+e)}getEndOffset(e){const t=this._source.getEndOffset(this._firstTokenIndex+e);return Math.min(this._endOffset,t)-this._startOffset+this._deltaOffset}getClassName(e){return this._source.getClassName(this._firstTokenIndex+e)}getInlineStyle(e,t){return this._source.getInlineStyle(this._firstTokenIndex+e,t)}getPresentation(e){return this._source.getPresentation(this._firstTokenIndex+e)}findTokenIndexAtOffset(e){return this._source.findTokenIndexAtOffset(e+this._startOffset-this._deltaOffset)-this._firstTokenIndex}getTokenText(e){const t=this._firstTokenIndex+e,i=this._source.getStartOffset(t),n=this._source.getEndOffset(t);let s=this._source.getTokenText(t);return i<this._startOffset&&(s=s.substring(this._startOffset-i)),n>this._endOffset&&(s=s.substring(0,s.length-(n-this._endOffset))),s}forEach(e){for(let t=0;t<this.getCount();t++)e(t)}}function tre(o,e){const t=e.lineNumber;if(!o.tokenization.isCheapToTokenize(t))return;o.tokenization.forceTokenization(t);const i=o.tokenization.getLineTokens(t),n=i.findTokenIndexAtOffset(e.column-1);return i.getStandardTokenType(n)}class Oc{static fromLineTokens(e){const t=[];for(let i=0;i<e.getCount();i++)t.push(new A2(e.getEndOffset(i)-e.getStartOffset(i),e.getMetadata(i)));return Oc.create(t)}static create(e){return new Oc(e)}constructor(e){this._tokenInfo=e}toLineTokens(e,t){return bi.createFromTextAndMetadata(this.map((i,n)=>({text:i.substring(e),metadata:n.metadata})),t)}forEach(e){let t=0;for(const i of this._tokenInfo){const n=new pe(t,t+i.length);e(n,i),t+=i.length}}map(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=new pe(i,i+n.length);t.push(e(s,n)),i+=n.length}return t}slice(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=i,r=s+n.length;if(r>e.start){if(s>=e.endExclusive)break;const a=Math.max(0,e.start-s),l=Math.max(0,r-e.endExclusive);t.push(new A2(n.length-a-l,n.metadata))}i+=n.length}return Oc.create(t)}}class A2{constructor(e,t){this.length=e,this.metadata=t}}class ire{constructor(){this._tokens=[]}add(e,t){this._tokens.push(new A2(e,t))}build(){return Oc.create(this._tokens)}}class O2{constructor(e,t,i){this._indentRulesSupport=t,this._indentationLineProcessor=new pV(e,i)}shouldIncrease(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIncrease(i)}shouldDecrease(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldDecrease(i)}shouldIgnore(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIgnore(i)}shouldIndentNextLine(e,t){const i=this._indentationLineProcessor.getProcessedLine(e,t);return this._indentRulesSupport.shouldIndentNextLine(i)}}class F2{constructor(e,t){this.model=e,this.indentationLineProcessor=new pV(e,t)}getProcessedTokenContextAroundRange(e){const t=this._getProcessedTokensBeforeRange(e),i=this._getProcessedTokensAfterRange(e),n=this._getProcessedPreviousLineTokens(e);return{beforeRangeProcessedTokens:t,afterRangeProcessedTokens:i,previousLineProcessedTokens:n}}_getProcessedTokensBeforeRange(e){this.model.tokenization.forceTokenization(e.startLineNumber);const t=this.model.tokenization.getLineTokens(e.startLineNumber),i=Cf(t,e.startColumn-1);let n;if(W2(this.model,e.getStartPosition())){const r=e.startColumn-1-i.firstCharOffset,a=i.firstCharOffset,l=a+r;n=t.sliceAndInflate(a,l,0)}else{const r=e.startColumn-1;n=t.sliceAndInflate(0,r,0)}return this.indentationLineProcessor.getProcessedTokens(n)}_getProcessedTokensAfterRange(e){const t=e.isEmpty()?e.getStartPosition():e.getEndPosition();this.model.tokenization.forceTokenization(t.lineNumber);const i=this.model.tokenization.getLineTokens(t.lineNumber),n=Cf(i,t.column-1),s=t.column-1-n.firstCharOffset,r=n.firstCharOffset+s,a=n.firstCharOffset+n.getLineLength(),l=i.sliceAndInflate(r,a,0);return this.indentationLineProcessor.getProcessedTokens(l)}_getProcessedPreviousLineTokens(e){const t=f=>{this.model.tokenization.forceTokenization(f);const g=this.model.tokenization.getLineTokens(f),m=this.model.getLineMaxColumn(f)-1;return Cf(g,m)};this.model.tokenization.forceTokenization(e.startLineNumber);const i=this.model.tokenization.getLineTokens(e.startLineNumber),n=Cf(i,e.startColumn-1),s=bi.createEmpty("",n.languageIdCodec),r=e.startLineNumber-1;if(r===0||!(n.firstCharOffset===0))return s;const c=t(r);if(!(n.languageId===c.languageId))return s;const h=c.toIViewLineTokens();return this.indentationLineProcessor.getProcessedTokens(h)}}class pV{constructor(e,t){this.model=e,this.languageConfigurationService=t}getProcessedLine(e,t){const i=(r,a)=>{const l=It(r);return a+r.substring(l.length)};this.model.tokenization.forceTokenization?.(e);const n=this.model.tokenization.getLineTokens(e);let s=this.getProcessedTokens(n).getLineContent();return t!==void 0&&(s=i(s,t)),s}getProcessedTokens(e){const t=l=>l===2||l===3||l===1,i=e.getLanguageId(0),s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew.getBracketRegExp({global:!0}),r=[];return e.forEach(l=>{const c=e.getStandardTokenType(l);let d=e.getTokenText(l);t(c)&&(d=d.replace(s,""));const h=e.getMetadata(l);r.push({text:d,metadata:h})}),bi.createFromTextAndMetadata(r,e.languageIdCodec)}}function W2(o,e){o.tokenization.forceTokenization(e.lineNumber);const t=o.tokenization.getLineTokens(e.lineNumber),i=Cf(t,e.column-1),n=i.firstCharOffset===0,s=t.getLanguageId(0)===i.languageId;return!n&&!s}function Ym(o,e,t,i){e.tokenization.forceTokenization(t.startLineNumber);const n=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),s=i.getLanguageConfiguration(n);if(!s)return null;const a=new F2(e,i).getProcessedTokenContextAroundRange(t),l=a.previousLineProcessedTokens.getLineContent(),c=a.beforeRangeProcessedTokens.getLineContent(),d=a.afterRangeProcessedTokens.getLineContent(),h=s.onEnter(o,l,c,d);if(!h)return null;const u=h.indentAction;let f=h.appendText;const g=h.removeText||0;f?u===Ai.Indent&&(f=" "+f):u===Ai.Indent||u===Ai.IndentOutdent?f=" ":f="";let m=hV(e,t.startLineNumber,t.startColumn);return g&&(m=m.substring(0,m.length-g)),{indentAction:u,appendText:f,removeText:g,indentation:m}}var nre=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sre=function(o,e){return function(t,i){e(t,i,o)}},aL;const B2=Object.create(null);function yf(o,e){if(e<=0)return"";B2[o]||(B2[o]=["",o]);const t=B2[o];for(let i=t.length;i<=e;i++)t[i]=t[i-1]+o;return t[e]}let Lr=aL=class{static unshiftIndent(e,t,i,n,s){const r=ti.visibleColumnFromColumn(e,t,i);if(s){const a=yf(" ",n),c=ti.prevIndentTabStop(r,n)/n;return yf(a,c)}else{const c=ti.prevRenderTabStop(r,i)/i;return yf(" ",c)}}static shiftIndent(e,t,i,n,s){const r=ti.visibleColumnFromColumn(e,t,i);if(s){const a=yf(" ",n),c=ti.nextIndentTabStop(r,n)/n;return yf(a,c)}else{const c=ti.nextRenderTabStop(r,i)/i;return yf(" ",c)}}constructor(e,t,i){this._languageConfigurationService=i,this._opts=t,this._selection=e,this._selectionId=null,this._useLastEditRangeForCursorEndPosition=!1,this._selectionStartColumnStaysPut=!1}_addEditOperation(e,t,i){this._useLastEditRangeForCursorEndPosition?e.addTrackedEditOperation(t,i):e.addEditOperation(t,i)}getEditOperations(e,t){const i=this._selection.startLineNumber;let n=this._selection.endLineNumber;this._selection.endColumn===1&&i!==n&&(n=n-1);const{tabSize:s,indentSize:r,insertSpaces:a}=this._opts,l=i===n;if(this._opts.useTabStops){this._selection.isEmpty()&&/^\s*$/.test(e.getLineContent(i))&&(this._useLastEditRangeForCursorEndPosition=!0);let c=0,d=0;for(let h=i;h<=n;h++,c=d){d=0;const u=e.getLineContent(h);let f=es(u);if(this._opts.isUnshift&&(u.length===0||f===0)||!l&&!this._opts.isUnshift&&u.length===0)continue;if(f===-1&&(f=u.length),h>1&&ti.visibleColumnFromColumn(u,f+1,s)%r!==0&&e.tokenization.isCheapToTokenize(h-1)){const _=Ym(this._opts.autoIndent,e,new k(h-1,e.getLineMaxColumn(h-1),h-1,e.getLineMaxColumn(h-1)),this._languageConfigurationService);if(_){if(d=c,_.appendText)for(let b=0,C=_.appendText.length;b<C&&d<r&&_.appendText.charCodeAt(b)===32;b++)d++;_.removeText&&(d=Math.max(0,d-_.removeText));for(let b=0;b<d&&!(f===0||u.charCodeAt(f-1)!==32);b++)f--}}if(this._opts.isUnshift&&f===0)continue;let g;this._opts.isUnshift?g=aL.unshiftIndent(u,f+1,s,r,a):g=aL.shiftIndent(u,f+1,s,r,a),this._addEditOperation(t,new k(h,1,h,f+1),g),h===i&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn<=f+1)}}else{!this._opts.isUnshift&&this._selection.isEmpty()&&e.getLineLength(i)===0&&(this._useLastEditRangeForCursorEndPosition=!0);const c=a?yf(" ",r):" ";for(let d=i;d<=n;d++){const h=e.getLineContent(d);let u=es(h);if(!(this._opts.isUnshift&&(h.length===0||u===0))&&!(!l&&!this._opts.isUnshift&&h.length===0)&&(u===-1&&(u=h.length),!(this._opts.isUnshift&&u===0)))if(this._opts.isUnshift){u=Math.min(u,r);for(let f=0;f<u;f++)if(h.charCodeAt(f)===9){u=f+1;break}this._addEditOperation(t,new k(d,1,d,u+1),"")}else this._addEditOperation(t,new k(d,1,d,1),c),d===i&&!this._selection.isEmpty()&&(this._selectionStartColumnStaysPut=this._selection.startColumn===1)}}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){if(this._useLastEditRangeForCursorEndPosition){const n=t.getInverseEditOperations()[0];return new ce(n.range.endLineNumber,n.range.endColumn,n.range.endLineNumber,n.range.endColumn)}const i=t.getTrackedSelection(this._selectionId);if(this._selectionStartColumnStaysPut){const n=this._selection.startColumn;return i.startColumn<=n?i:i.getDirection()===0?new ce(i.startLineNumber,n,i.endLineNumber,i.endColumn):new ce(i.endLineNumber,i.endColumn,i.startLineNumber,n)}return i}};Lr=aL=nre([sre(2,Jt)],Lr);class ore{constructor(e,t,i){this._range=e,this._charBeforeSelection=t,this._charAfterSelection=i}getEditOperations(e,t){t.addTrackedEditOperation(new k(this._range.startLineNumber,this._range.startColumn,this._range.startLineNumber,this._range.startColumn),this._charBeforeSelection),t.addTrackedEditOperation(new k(this._range.endLineNumber,this._range.endColumn,this._range.endLineNumber,this._range.endColumn),this._charAfterSelection||null)}computeCursorState(e,t){const i=t.getInverseEditOperations(),n=i[0].range,s=i[1].range;return new ce(n.endLineNumber,n.endColumn,s.endLineNumber,s.endColumn-this._charAfterSelection.length)}}class rre{constructor(e,t,i){this._position=e,this._text=t,this._charAfter=i}getEditOperations(e,t){t.addTrackedEditOperation(new k(this._position.lineNumber,this._position.column,this._position.lineNumber,this._position.column),this._text+this._charAfter)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return new ce(n.endLineNumber,n.startColumn,n.endLineNumber,n.endColumn-this._charAfter.length)}}function are(o,e,t){const i=o.tokenization.getLanguageIdAtPosition(e,0);if(e>1){let n,s=-1;for(n=e-1;n>=1;n--){if(o.tokenization.getLanguageIdAtPosition(n,0)!==i)return s;const r=o.getLineContent(n);if(t.shouldIgnore(n)||/^\s+$/.test(r)||r===""){s=n;continue}return n}}return-1}function M1(o,e,t,i=!0,n){if(o<4)return null;const s=n.getLanguageConfiguration(e.tokenization.getLanguageId()).indentRulesSupport;if(!s)return null;const r=new O2(e,s,n);if(t<=1)return{indentation:"",action:null};for(let l=t-1;l>0&&e.getLineContent(l)==="";l--)if(l===1)return{indentation:"",action:null};const a=are(e,t,r);if(a<0)return null;if(a<1)return{indentation:"",action:null};if(r.shouldIncrease(a)||r.shouldIndentNextLine(a)){const l=e.getLineContent(a);return{indentation:It(l),action:Ai.Indent,line:a}}else if(r.shouldDecrease(a)){const l=e.getLineContent(a);return{indentation:It(l),action:null,line:a}}else{if(a===1)return{indentation:It(e.getLineContent(a)),action:null,line:a};const l=a-1,c=s.getIndentMetadata(e.getLineContent(l));if(!(c&3)&&c&4){let d=0;for(let h=l-1;h>0;h--)if(!r.shouldIndentNextLine(h)){d=h;break}return{indentation:It(e.getLineContent(d+1)),action:null,line:d+1}}if(i)return{indentation:It(e.getLineContent(a)),action:null,line:a};for(let d=a;d>0;d--){if(r.shouldIncrease(d))return{indentation:It(e.getLineContent(d)),action:Ai.Indent,line:d};if(r.shouldIndentNextLine(d)){let h=0;for(let u=d-1;u>0;u--)if(!r.shouldIndentNextLine(d)){h=u;break}return{indentation:It(e.getLineContent(h+1)),action:null,line:h+1}}else if(r.shouldDecrease(d))return{indentation:It(e.getLineContent(d)),action:null,line:d}}return{indentation:It(e.getLineContent(1)),action:null,line:1}}}function P1(o,e,t,i,n,s){if(o<4)return null;const r=s.getLanguageConfiguration(t);if(!r)return null;const a=s.getLanguageConfiguration(t).indentRulesSupport;if(!a)return null;const l=new O2(e,a,s),c=M1(o,e,i,void 0,s);if(c){const d=c.line;if(d!==void 0){let h=!0;for(let u=d;u<i-1;u++)if(!/^\s*$/.test(e.getLineContent(u))){h=!1;break}if(h){const u=r.onEnter(o,"",e.getLineContent(d),"");if(u){let f=It(e.getLineContent(d));return u.removeText&&(f=f.substring(0,f.length-u.removeText)),u.indentAction===Ai.Indent||u.indentAction===Ai.IndentOutdent?f=n.shiftIndent(f):u.indentAction===Ai.Outdent&&(f=n.unshiftIndent(f)),l.shouldDecrease(i)&&(f=n.unshiftIndent(f)),u.appendText&&(f+=u.appendText),It(f)}}}return l.shouldDecrease(i)?c.action===Ai.Indent?c.indentation:n.unshiftIndent(c.indentation):c.action===Ai.Indent?n.shiftIndent(c.indentation):c.indentation}return null}function lre(o,e,t,i,n){if(o<4)return null;const s=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),r=n.getLanguageConfiguration(s).indentRulesSupport;if(!r)return null;e.tokenization.forceTokenization(t.startLineNumber);const l=new F2(e,n).getProcessedTokenContextAroundRange(t),c=l.afterRangeProcessedTokens,d=l.beforeRangeProcessedTokens,h=It(d.getLineContent()),u=dre(e,t.startLineNumber,d),f=W2(e,t.getStartPosition()),g=e.getLineContent(t.startLineNumber),m=It(g),_=M1(o,u,t.startLineNumber+1,void 0,n);if(!_){const C=f?m:h;return{beforeEnter:C,afterEnter:C}}let b=f?m:_.indentation;return _.action===Ai.Indent&&(b=i.shiftIndent(b)),r.shouldDecrease(c.getLineContent())&&(b=i.unshiftIndent(b)),{beforeEnter:f?m:h,afterEnter:b}}function cre(o,e,t,i,n,s){const r=o.autoIndent;if(r<4||W2(e,t.getStartPosition()))return null;const l=e.getLanguageIdAtPosition(t.startLineNumber,t.startColumn),c=s.getLanguageConfiguration(l).indentRulesSupport;if(!c)return null;const h=new F2(e,s).getProcessedTokenContextAroundRange(t),u=h.beforeRangeProcessedTokens.getLineContent(),f=h.afterRangeProcessedTokens.getLineContent(),g=u+f,m=u+i+f;if(!c.shouldDecrease(g)&&c.shouldDecrease(m)){const b=M1(r,e,t.startLineNumber,!1,s);if(!b)return null;let C=b.indentation;return b.action!==Ai.Indent&&(C=n.unshiftIndent(C)),C}const _=t.startLineNumber-1;if(_>0){const b=e.getLineContent(_);if(c.shouldIndentNextLine(b)&&c.shouldIncrease(m)){const w=M1(r,e,t.startLineNumber,!1,s)?.indentation;if(w!==void 0){const v=e.getLineContent(t.startLineNumber),S=It(v),x=n.shiftIndent(w)===S,I=/^\s*$/.test(g),D=o.autoClosingPairs.autoClosingPairsOpenByEnd.get(i),F=D&&D.length>0&&I;if(x&&F)return w}}}return null}function mV(o,e,t){const i=t.getLanguageConfiguration(o.getLanguageId()).indentRulesSupport;return!i||e<1||e>o.getLineCount()?null:i.getIndentMetadata(o.getLineContent(e))}function dre(o,e,t){return{tokenization:{getLineTokens:n=>n===e?t:o.tokenization.getLineTokens(n),getLanguageId:()=>o.getLanguageId(),getLanguageIdAtPosition:(n,s)=>o.getLanguageIdAtPosition(n,s)},getLineContent:n=>n===e?t.getLineContent():o.getLineContent(n)}}class hre{static getEdits(e,t,i,n,s){if(!s&&this._isAutoIndentType(e,t,i)){const r=[];for(const l of i){const c=this._findActualIndentationForSelection(e,t,l,n);if(c===null)return;r.push({selection:l,indentation:c})}const a=H2.getAutoClosingPairClose(e,t,i,n,!1);return this._getIndentationAndAutoClosingPairEdits(e,t,r,n,a)}}static _isAutoIndentType(e,t,i){if(e.autoIndent<4)return!1;for(let n=0,s=i.length;n<s;n++)if(!t.tokenization.isCheapToTokenize(i[n].getEndPosition().lineNumber))return!1;return!0}static _findActualIndentationForSelection(e,t,i,n){const s=cre(e,t,i,n,{shiftIndent:a=>U2(e,a),unshiftIndent:a=>dL(e,a)},e.languageConfigurationService);if(s===null)return null;const r=hV(t,i.startLineNumber,i.startColumn);return s===e.normalizeIndentation(r)?null:s}static _getIndentationAndAutoClosingPairEdits(e,t,i,n,s){const r=i.map(({selection:l,indentation:c})=>{if(s!==null){const d=this._getEditFromIndentationAndSelection(e,t,c,l,n,!1);return new Sre(d,l,n,s)}else{const d=this._getEditFromIndentationAndSelection(e,t,c,l,n,!0);return Lf(d.range,d.text,!1)}}),a={shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1};return new _s(4,r,a)}static _getEditFromIndentationAndSelection(e,t,i,n,s,r=!0){const a=n.startLineNumber,l=t.getLineFirstNonWhitespaceColumn(a);let c=e.normalizeIndentation(i);if(l!==0){const h=t.getLineContent(a);c+=h.substring(l-1,n.startColumn-1)}return c+=r?s:"",{range:new k(a,1,n.endLineNumber,n.endColumn),text:c}}}class ure{static getEdits(e,t,i,n,s,r){if(vV(t,i,n,s,r))return this._runAutoClosingOvertype(e,n,r)}static _runAutoClosingOvertype(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const l=t[s].getPosition(),c=new k(l.lineNumber,l.column,l.lineNumber,l.column+1);n[s]=new Dn(c,i)}return new _s(4,n,{shouldPushStackElementBefore:cL(e,4),shouldPushStackElementAfter:!1})}}class fre{static getEdits(e,t,i,n,s){if(vV(e,t,i,n,s)){const r=i.map(a=>new Dn(new k(a.positionLineNumber,a.positionColumn,a.positionLineNumber,a.positionColumn+1),"",!1));return new _s(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}}class H2{static getEdits(e,t,i,n,s,r){if(!r){const a=this.getAutoClosingPairClose(e,t,i,n,s);if(a!==null)return this._runAutoClosingOpenCharType(i,n,s,a)}}static _runAutoClosingOpenCharType(e,t,i,n){const s=[];for(let r=0,a=e.length;r<a;r++){const l=e[r];s[r]=new wre(l,t,!i,n)}return new _s(4,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}static getAutoClosingPairClose(e,t,i,n,s){for(const g of i)if(!g.isEmpty())return null;const r=i.map(g=>{const m=g.getPosition();return s?{lineNumber:m.lineNumber,beforeColumn:m.column-n.length,afterColumn:m.column}:{lineNumber:m.lineNumber,beforeColumn:m.column,afterColumn:m.column}}),a=this._findAutoClosingPairOpen(e,t,r.map(g=>new M(g.lineNumber,g.beforeColumn)),n);if(!a)return null;let l,c;if(hh(n)?(l=e.autoClosingQuotes,c=e.shouldAutoCloseBefore.quote):(e.blockCommentStartToken?a.open.includes(e.blockCommentStartToken):!1)?(l=e.autoClosingComments,c=e.shouldAutoCloseBefore.comment):(l=e.autoClosingBrackets,c=e.shouldAutoCloseBefore.bracket),l==="never")return null;const h=this._findContainedAutoClosingPair(e,a),u=h?h.close:"";let f=!0;for(const g of r){const{lineNumber:m,beforeColumn:_,afterColumn:b}=g,C=t.getLineContent(m),w=C.substring(0,_-1),v=C.substring(b-1);if(v.startsWith(u)||(f=!1),v.length>0){const I=v.charAt(0);if(!this._isBeforeClosingBrace(e,v)&&!c(I))return null}if(a.open.length===1&&(n==="'"||n==='"')&&l!=="always"){const I=Sr(e.wordSeparators,[]);if(w.length>0){const D=w.charCodeAt(w.length-1);if(I.get(D)===0)return null}}if(!t.tokenization.isCheapToTokenize(m))return null;t.tokenization.forceTokenization(m);const S=t.tokenization.getLineTokens(m),L=Cf(S,_-1);if(!a.shouldAutoClose(L,_-L.firstCharOffset))return null;const x=a.findNeutralCharacter();if(x){const I=t.tokenization.getTokenTypeIfInsertingCharacter(m,_,x);if(!a.isOK(I))return null}}return f?a.close.substring(0,a.close.length-u.length):a.close}static _findContainedAutoClosingPair(e,t){if(t.open.length<=1)return null;const i=t.close.charAt(t.close.length-1),n=e.autoClosingPairs.autoClosingPairsCloseByEnd.get(i)||[];let s=null;for(const r of n)r.open!==t.open&&t.open.includes(r.open)&&t.close.endsWith(r.close)&&(!s||r.open.length>s.open.length)&&(s=r);return s}static _findAutoClosingPairOpen(e,t,i,n){const s=e.autoClosingPairs.autoClosingPairsOpenByEnd.get(n);if(!s)return null;let r=null;for(const a of s)if(r===null||a.open.length>r.open.length){let l=!0;for(const c of i)if(t.getValueInRange(new k(c.lineNumber,c.column-a.open.length+1,c.lineNumber,c.column))+n!==a.open){l=!1;break}l&&(r=a)}return r}static _isBeforeClosingBrace(e,t){const i=t.charAt(0),n=e.autoClosingPairs.autoClosingPairsOpenByStart.get(i)||[],s=e.autoClosingPairs.autoClosingPairsCloseByStart.get(i)||[],r=n.some(l=>t.startsWith(l.open)),a=s.some(l=>t.startsWith(l.close));return!r&&a}}class _V{static getEdits(e,t){if(!(e.inputMode==="overtype"))return null;const n=t.map(s=>new poe(s.insertedTextRange));return new _s(4,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}class gre{static getEdits(e,t,i,n,s){if(!s&&this._isSurroundSelectionType(e,t,i,n))return this._runSurroundSelectionType(e,i,n)}static _runSurroundSelectionType(e,t,i){const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=e.surroundingPairs[i];n[s]=new ore(a,i,l)}return new _s(0,n,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _isSurroundSelectionType(e,t,i,n){if(!wV(e,n)||!e.surroundingPairs.hasOwnProperty(n))return!1;const s=hh(n);for(const r of i){if(r.isEmpty())return!1;let a=!0;for(let l=r.startLineNumber;l<=r.endLineNumber;l++){const c=t.getLineContent(l),d=l===r.startLineNumber?r.startColumn-1:0,h=l===r.endLineNumber?r.endColumn-1:c.length,u=c.substring(d,h);if(/[^ \t]/.test(u)){a=!1;break}}if(a)return!1;if(s&&r.startLineNumber===r.endLineNumber&&r.startColumn+1===r.endColumn){const l=t.getValueInRange(r);if(hh(l))return!1}}return!0}}class pre{static getEdits(e,t,i,n,s,r){if(!r&&this._isTypeInterceptorElectricChar(t,i,n)){const a=this._typeInterceptorElectricChar(e,t,i,n[0],s);if(a)return a}}static _isTypeInterceptorElectricChar(e,t,i){return!!(i.length===1&&t.tokenization.isCheapToTokenize(i[0].getEndPosition().lineNumber))}static _typeInterceptorElectricChar(e,t,i,n,s){if(!t.electricChars.hasOwnProperty(s)||!n.isEmpty())return null;const r=n.getPosition();i.tokenization.forceTokenization(r.lineNumber);const a=i.tokenization.getLineTokens(r.lineNumber);let l;try{l=t.onElectricCharacter(s,a,r.column)}catch(c){return Ee(c),null}if(!l)return null;if(l.matchOpenBracket){const c=(a.getLineContent()+s).lastIndexOf(l.matchOpenBracket)+1,d=i.bracketPairs.findMatchingBracketUp(l.matchOpenBracket,{lineNumber:r.lineNumber,column:c},500);if(d){if(d.startLineNumber===r.lineNumber)return null;const h=i.getLineContent(d.startLineNumber),u=It(h),f=t.normalizeIndentation(u),g=i.getLineContent(r.lineNumber),m=i.getLineFirstNonWhitespaceColumn(r.lineNumber)||r.column,_=g.substring(m-1,r.column-1),b=f+_+s,C=new k(r.lineNumber,1,r.lineNumber,r.column),w=new Dn(C,b);return new _s(z2(b,e),[w],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!0})}}return null}}class mre{static getEdits(e,t,i,n,s){const r=[];for(let l=0,c=i.length;l<c;l++){const d=e.inputMode==="overtype"&&!s?m2:Dn;r[l]=new d(i[l],n)}const a=z2(n,t);return new _s(a,r,{shouldPushStackElementBefore:cL(t,a),shouldPushStackElementAfter:!1})}}class lL{static getEdits(e,t,i,n,s){if(!s&&n===`
`){const r=[];for(let a=0,l=i.length;a<l;a++)r[a]=this._enter(e,t,!1,i[a]);return new _s(4,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}}static _enter(e,t,i,n){if(e.autoIndent===0)return Lf(n,`
`,i);if(!t.tokenization.isCheapToTokenize(n.getStartPosition().lineNumber)||e.autoIndent===1){const l=t.getLineContent(n.startLineNumber),c=It(l).substring(0,n.startColumn-1);return Lf(n,`
`+e.normalizeIndentation(c),i)}const s=Ym(e.autoIndent,t,n,e.languageConfigurationService);if(s){if(s.indentAction===Ai.None)return Lf(n,`
`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===Ai.Indent)return Lf(n,`
`+e.normalizeIndentation(s.indentation+s.appendText),i);if(s.indentAction===Ai.IndentOutdent){const l=e.normalizeIndentation(s.indentation),c=e.normalizeIndentation(s.indentation+s.appendText),d=`
`+c+`
`+l;return i?new $y(n,d,!0):new jy(n,d,-1,c.length-l.length,!0)}else if(s.indentAction===Ai.Outdent){const l=dL(e,s.indentation);return Lf(n,`
`+e.normalizeIndentation(l+s.appendText),i)}}const r=t.getLineContent(n.startLineNumber),a=It(r).substring(0,n.startColumn-1);if(e.autoIndent>=4){const l=lre(e.autoIndent,t,n,{unshiftIndent:c=>dL(e,c),shiftIndent:c=>U2(e,c),normalizeIndentation:c=>e.normalizeIndentation(c)},e.languageConfigurationService);if(l){let c=e.visibleColumnFromColumn(t,n.getEndPosition());const d=n.endColumn,h=t.getLineContent(n.endLineNumber),u=es(h);if(u>=0?n=n.setEndPosition(n.endLineNumber,Math.max(n.endColumn,u+1)):n=n.setEndPosition(n.endLineNumber,t.getLineMaxColumn(n.endLineNumber)),i)return new $y(n,`
`+e.normalizeIndentation(l.afterEnter),!0);{let f=0;return d<=u+1&&(e.insertSpaces||(c=Math.ceil(c/e.indentSize)),f=Math.min(c+1-e.normalizeIndentation(l.afterEnter).length-1,0)),new jy(n,`
`+e.normalizeIndentation(l.afterEnter),0,f,!0)}}}return Lf(n,`
`+e.normalizeIndentation(a),i)}static lineInsertBefore(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++){let a=i[s].positionLineNumber;if(a===1)n[s]=new $y(new k(1,1,1,1),`
`);else{a--;const l=t.getLineMaxColumn(a);n[s]=this._enter(e,t,!1,new k(a,l,a,l))}}return n}static lineInsertAfter(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s].positionLineNumber,l=t.getLineMaxColumn(a);n[s]=this._enter(e,t,!1,new k(a,l,a,l))}return n}static lineBreakInsert(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=this._enter(e,t,!0,i[s]);return n}}class _re{static getEdits(e,t,i,n,s,r){const a=this._distributePasteToCursors(e,i,n,s,r);return a?(i=i.sort(k.compareRangesUsingStarts),this._distributedPaste(e,t,i,a)):this._simplePaste(e,t,i,n,s)}static _distributePasteToCursors(e,t,i,n,s){if(n||t.length===1)return null;if(s&&s.length===t.length)return s;if(e.multiCursorPaste==="spread"){i.charCodeAt(i.length-1)===10&&(i=i.substring(0,i.length-1)),i.charCodeAt(i.length-1)===13&&(i=i.substring(0,i.length-1));const r=ro(i);if(r.length===t.length)return r}return null}static _distributedPaste(e,t,i,n){const s=[];for(let r=0,a=i.length;r<a;r++){const c=e.overtypeOnPaste&&e.inputMode==="overtype"?m2:Dn;s[r]=new c(i[r],n[r])}return new _s(0,s,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}static _simplePaste(e,t,i,n,s){const r=[];for(let a=0,l=i.length;a<l;a++){const c=i[a],d=c.getPosition();if(s&&!c.isEmpty()&&(s=!1),s&&n.indexOf(`
`)!==n.length-1&&(s=!1),s){const h=new k(d.lineNumber,1,d.lineNumber,1);r[a]=new _2(h,n,c,!0)}else{const u=e.overtypeOnPaste&&e.inputMode==="overtype"?m2:Dn;r[a]=new u(c,n)}}return new _s(0,r,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!0})}}class bre{static getEdits(e,t,i,n,s,r,a,l){const c=n.map(d=>this._compositionType(i,d,s,r,a,l));return new _s(4,c,{shouldPushStackElementBefore:cL(e,4),shouldPushStackElementAfter:!1})}static _compositionType(e,t,i,n,s,r){if(!t.isEmpty())return null;const a=t.getPosition(),l=Math.max(1,a.column-n),c=Math.min(e.getLineMaxColumn(a.lineNumber),a.column+s),d=new k(a.lineNumber,l,a.lineNumber,c);return new jy(d,i,0,r)}}class Cre{static getEdits(e,t,i){const n=[];for(let r=0,a=t.length;r<a;r++)n[r]=new Dn(t[r],i);const s=z2(i,e);return new _s(s,n,{shouldPushStackElementBefore:cL(e,s),shouldPushStackElementAfter:!1})}}class vre{static getCommands(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++){const a=i[s];if(a.isEmpty()){const l=t.getLineContent(a.startLineNumber);if(/^\s*$/.test(l)&&t.tokenization.isCheapToTokenize(a.startLineNumber)){let c=this._goodIndentForLine(e,t,a.startLineNumber);c=c||" ";const d=e.normalizeIndentation(c);if(!l.startsWith(d)){n[s]=new Dn(new k(a.startLineNumber,1,a.startLineNumber,l.length+1),d,!0);continue}}n[s]=this._replaceJumpToNextIndent(e,t,a,!0)}else{if(a.startLineNumber===a.endLineNumber){const l=t.getLineMaxColumn(a.startLineNumber);if(a.startColumn!==1||a.endColumn!==l){n[s]=this._replaceJumpToNextIndent(e,t,a,!1);continue}}n[s]=new Lr(a,{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService)}}return n}static _goodIndentForLine(e,t,i){let n=null,s="";const r=M1(e.autoIndent,t,i,!1,e.languageConfigurationService);if(r)n=r.action,s=r.indentation;else if(i>1){let a;for(a=i-1;a>=1;a--){const d=t.getLineContent(a);if(Kr(d)>=0)break}if(a<1)return null;const l=t.getLineMaxColumn(a),c=Ym(e.autoIndent,t,new k(a,l,a,l),e.languageConfigurationService);c&&(s=c.indentation+c.appendText)}return n&&(n===Ai.Indent&&(s=U2(e,s)),n===Ai.Outdent&&(s=dL(e,s)),s=e.normalizeIndentation(s)),s||null}static _replaceJumpToNextIndent(e,t,i,n){let s="";const r=i.getStartPosition();if(e.insertSpaces){const a=e.visibleColumnFromColumn(t,r),l=e.indentSize,c=l-a%l;for(let d=0;d<c;d++)s+=" "}else s=" ";return new Dn(i,s,n)}}class V2 extends jy{constructor(e,t,i,n,s,r){super(e,t,i,n),this._openCharacter=s,this._closeCharacter=r,this.closeCharacterRange=null,this.enclosingRange=null}_computeCursorStateWithRange(e,t,i){return this.closeCharacterRange=new k(t.startLineNumber,t.endColumn-this._closeCharacter.length,t.endLineNumber,t.endColumn),this.enclosingRange=new k(t.startLineNumber,t.endColumn-this._openCharacter.length-this._closeCharacter.length,t.endLineNumber,t.endColumn),super.computeCursorState(e,i)}}class wre extends V2{constructor(e,t,i,n){const s=(i?t:"")+n,r=0,a=-n.length;super(e,s,r,a,t,n)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._computeCursorStateWithRange(e,n,t)}}class Sre extends V2{constructor(e,t,i,n){const s=i+n,r=0,a=i.length;super(t,s,r,a,i,n),this._autoIndentationEdit=e,this._autoClosingEdit={range:t,text:s}}getEditOperations(e,t){t.addTrackedEditOperation(this._autoIndentationEdit.range,this._autoIndentationEdit.text),t.addTrackedEditOperation(this._autoClosingEdit.range,this._autoClosingEdit.text)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length!==2)throw new Error("There should be two inverse edit operations!");const n=i[0].range,s=i[1].range,r=n.plusRange(s);return this._computeCursorStateWithRange(e,r,t)}}function z2(o,e){return o===" "?e===5||e===6?6:5:4}function cL(o,e){return CV(o)&&!CV(e)?!0:o===5?!1:bV(o)!==bV(e)}function bV(o){return o===6||o===5?"space":o}function CV(o){return o===4||o===5||o===6}function vV(o,e,t,i,n){if(o.autoClosingOvertype==="never"||!o.autoClosingPairs.autoClosingPairsCloseSingleChar.has(n))return!1;for(let s=0,r=t.length;s<r;s++){const a=t[s];if(!a.isEmpty())return!1;const l=a.getPosition(),c=e.getLineContent(l.lineNumber);if(c.charAt(l.column-1)!==n)return!1;const h=hh(n);if((l.column>2?c.charCodeAt(l.column-2):0)===92&&h)return!1;if(o.autoClosingOvertype==="auto"){let f=!1;for(let g=0,m=i.length;g<m;g++){const _=i[g];if(l.lineNumber===_.startLineNumber&&l.column===_.startColumn){f=!0;break}}if(!f)return!1}}return!0}function Lf(o,e,t){return t?new $y(o,e,!0):new Dn(o,e,!0)}function U2(o,e,t){return t=t||1,Lr.shiftIndent(e,e.length+t,o.tabSize,o.indentSize,o.insertSpaces)}function dL(o,e,t){return t=t||1,Lr.unshiftIndent(e,e.length+t,o.tabSize,o.indentSize,o.insertSpaces)}function wV(o,e){return hh(e)?o.autoSurround==="quotes"||o.autoSurround==="languageDefined":o.autoSurround==="brackets"||o.autoSurround==="languageDefined"}class gh{static indent(e,t,i){if(t===null||i===null)return[];const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=new Lr(i[s],{isUnshift:!1,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService);return n}static outdent(e,t,i){const n=[];for(let s=0,r=i.length;s<r;s++)n[s]=new Lr(i[s],{isUnshift:!0,tabSize:e.tabSize,indentSize:e.indentSize,insertSpaces:e.insertSpaces,useTabStops:e.useTabStops,autoIndent:e.autoIndent},e.languageConfigurationService);return n}static paste(e,t,i,n,s,r){return _re.getEdits(e,t,i,n,s,r)}static tab(e,t,i){return vre.getCommands(e,t,i)}static compositionType(e,t,i,n,s,r,a,l){return bre.getEdits(e,t,i,n,s,r,a,l)}static compositionEndWithInterceptors(e,t,i,n,s,r){if(!n)return null;let a=null;for(const u of n)if(a===null)a=u.insertedText;else if(a!==u.insertedText)return null;if(!a||a.length!==1)return _V.getEdits(t,n);const l=a;let c=!1;for(const u of n)if(u.deletedText.length!==0){c=!0;break}if(c){if(!wV(t,l)||!t.surroundingPairs.hasOwnProperty(l))return null;const u=hh(l);for(const m of n)if(m.deletedSelectionStart!==0||m.deletedSelectionEnd!==m.deletedText.length||/^[ \t]+$/.test(m.deletedText)||u&&hh(m.deletedText))return null;const f=[];for(const m of s){if(!m.isEmpty())return null;f.push(m.getPosition())}if(f.length!==n.length)return null;const g=[];for(let m=0,_=f.length;m<_;m++)g.push(new rre(f[m],n[m].deletedText,t.surroundingPairs[l]));return new _s(4,g,{shouldPushStackElementBefore:!0,shouldPushStackElementAfter:!1})}const d=fre.getEdits(t,i,s,r,l);if(d!==void 0)return d;const h=H2.getEdits(t,i,s,l,!0,!1);return h!==void 0?h:_V.getEdits(t,n)}static typeWithInterceptors(e,t,i,n,s,r,a){const l=lL.getEdits(i,n,s,a,e);if(l!==void 0)return l;const c=hre.getEdits(i,n,s,a,e);if(c!==void 0)return c;const d=ure.getEdits(t,i,n,s,r,a);if(d!==void 0)return d;const h=H2.getEdits(i,n,s,a,!1,e);if(h!==void 0)return h;const u=gre.getEdits(i,n,s,a,e);if(u!==void 0)return u;const f=pre.getEdits(t,i,n,s,a,e);return f!==void 0?f:mre.getEdits(i,t,s,a,e)}static typeWithoutInterceptors(e,t,i,n,s){return Cre.getEdits(e,n,s)}}class yre{constructor(e,t,i,n,s,r,a){this.deletedText=e,this.deletedSelectionStart=t,this.deletedSelectionEnd=i,this.insertedText=n,this.insertedSelectionStart=s,this.insertedSelectionEnd=r,this.insertedTextRange=a}}var T;(function(o){o.editorSimpleInput=new ae("editorSimpleInput",!1,!0),o.editorTextFocus=new ae("editorTextFocus",!1,p(678,"Whether the editor text has focus (cursor is blinking)")),o.focus=new ae("editorFocus",!1,p(679,"Whether the editor or an editor widget has focus (e.g. focus is in the find widget)")),o.textInputFocus=new ae("textInputFocus",!1,p(680,"Whether an editor or a rich text input has focus (cursor is blinking)")),o.readOnly=new ae("editorReadonly",!1,p(681,"Whether the editor is read-only")),o.inDiffEditor=new ae("inDiffEditor",!1,p(682,"Whether the context is a diff editor")),o.isEmbeddedDiffEditor=new ae("isEmbeddedDiffEditor",!1,p(683,"Whether the context is an embedded diff editor")),o.multiDiffEditorAllCollapsed=new ae("multiDiffEditorAllCollapsed",void 0,p(684,"Whether all files in multi diff editor are collapsed")),o.hasChanges=new ae("diffEditorHasChanges",!1,p(685,"Whether the diff editor has changes")),o.comparingMovedCode=new ae("comparingMovedCode",!1,p(686,"Whether a moved code block is selected for comparison")),o.accessibleDiffViewerVisible=new ae("accessibleDiffViewerVisible",!1,p(687,"Whether the accessible diff viewer is visible")),o.diffEditorRenderSideBySideInlineBreakpointReached=new ae("diffEditorRenderSideBySideInlineBreakpointReached",!1,p(688,"Whether the diff editor render side by side inline breakpoint is reached")),o.diffEditorInlineMode=new ae("diffEditorInlineMode",!1,p(689,"Whether inline mode is active")),o.diffEditorOriginalWritable=new ae("diffEditorOriginalWritable",!1,p(690,"Whether modified is writable in the diff editor")),o.diffEditorModifiedWritable=new ae("diffEditorModifiedWritable",!1,p(691,"Whether modified is writable in the diff editor")),o.diffEditorOriginalUri=new ae("diffEditorOriginalUri","",p(692,"The uri of the original document")),o.diffEditorModifiedUri=new ae("diffEditorModifiedUri","",p(693,"The uri of the modified document")),o.columnSelection=new ae("editorColumnSelection",!1,p(694,"Whether `editor.columnSelection` is enabled")),o.writable=o.readOnly.toNegated(),o.hasNonEmptySelection=new ae("editorHasSelection",!1,p(695,"Whether the editor has text selected")),o.hasOnlyEmptySelection=o.hasNonEmptySelection.toNegated(),o.hasMultipleSelections=new ae("editorHasMultipleSelections",!1,p(696,"Whether the editor has multiple selections")),o.hasSingleSelection=o.hasMultipleSelections.toNegated(),o.tabMovesFocus=new ae("editorTabMovesFocus",!1,p(697,"Whether `Tab` will move focus out of the editor")),o.tabDoesNotMoveFocus=o.tabMovesFocus.toNegated(),o.isInEmbeddedEditor=new ae("isInEmbeddedEditor",!1,!0),o.canUndo=new ae("canUndo",!1,!0),o.canRedo=new ae("canRedo",!1,!0),o.hoverVisible=new ae("editorHoverVisible",!1,p(698,"Whether the editor hover is visible")),o.hoverFocused=new ae("editorHoverFocused",!1,p(699,"Whether the editor hover is focused")),o.stickyScrollFocused=new ae("stickyScrollFocused",!1,p(700,"Whether the sticky scroll is focused")),o.stickyScrollVisible=new ae("stickyScrollVisible",!1,p(701,"Whether the sticky scroll is visible")),o.standaloneColorPickerVisible=new ae("standaloneColorPickerVisible",!1,p(702,"Whether the standalone color picker is visible")),o.standaloneColorPickerFocused=new ae("standaloneColorPickerFocused",!1,p(703,"Whether the standalone color picker is focused")),o.inCompositeEditor=new ae("inCompositeEditor",void 0,p(704,"Whether the editor is part of a larger editor (e.g. notebooks)")),o.notInCompositeEditor=o.inCompositeEditor.toNegated(),o.languageId=new ae("editorLangId","",p(705,"The language identifier of the editor")),o.hasCompletionItemProvider=new ae("editorHasCompletionItemProvider",!1,p(706,"Whether the editor has a completion item provider")),o.hasCodeActionsProvider=new ae("editorHasCodeActionsProvider",!1,p(707,"Whether the editor has a code actions provider")),o.hasCodeLensProvider=new ae("editorHasCodeLensProvider",!1,p(708,"Whether the editor has a code lens provider")),o.hasDefinitionProvider=new ae("editorHasDefinitionProvider",!1,p(709,"Whether the editor has a definition provider")),o.hasDeclarationProvider=new ae("editorHasDeclarationProvider",!1,p(710,"Whether the editor has a declaration provider")),o.hasImplementationProvider=new ae("editorHasImplementationProvider",!1,p(711,"Whether the editor has an implementation provider")),o.hasTypeDefinitionProvider=new ae("editorHasTypeDefinitionProvider",!1,p(712,"Whether the editor has a type definition provider")),o.hasHoverProvider=new ae("editorHasHoverProvider",!1,p(713,"Whether the editor has a hover provider")),o.hasDocumentHighlightProvider=new ae("editorHasDocumentHighlightProvider",!1,p(714,"Whether the editor has a document highlight provider")),o.hasDocumentSymbolProvider=new ae("editorHasDocumentSymbolProvider",!1,p(715,"Whether the editor has a document symbol provider")),o.hasReferenceProvider=new ae("editorHasReferenceProvider",!1,p(716,"Whether the editor has a reference provider")),o.hasRenameProvider=new ae("editorHasRenameProvider",!1,p(717,"Whether the editor has a rename provider")),o.hasSignatureHelpProvider=new ae("editorHasSignatureHelpProvider",!1,p(718,"Whether the editor has a signature help provider")),o.hasInlayHintsProvider=new ae("editorHasInlayHintsProvider",!1,p(719,"Whether the editor has an inline hints provider")),o.hasDocumentFormattingProvider=new ae("editorHasDocumentFormattingProvider",!1,p(720,"Whether the editor has a document formatting provider")),o.hasDocumentSelectionFormattingProvider=new ae("editorHasDocumentSelectionFormattingProvider",!1,p(721,"Whether the editor has a document selection formatting provider")),o.hasMultipleDocumentFormattingProvider=new ae("editorHasMultipleDocumentFormattingProvider",!1,p(722,"Whether the editor has multiple document formatting providers")),o.hasMultipleDocumentSelectionFormattingProvider=new ae("editorHasMultipleDocumentSelectionFormattingProvider",!1,p(723,"Whether the editor has multiple document selection formatting providers"))})(T||(T={}));const at=0;class Ci extends Bi{runEditorCommand(e,t,i){const n=t._getViewModel();n&&this.runCoreEditorCommand(n,i||{})}}var En;(function(o){const e=function(i){if(!nn(i))return!1;const n=i;return!(!ji(n.to)||!Qn(n.by)&&!ji(n.by)||!Qn(n.value)&&!bc(n.value)||!Qn(n.revealCursor)&&!MB(n.revealCursor))};o.metadata={description:"Scroll editor in the given direction",args:[{name:"Editor scroll argument object",description:"Property-value pairs that can be passed through this argument:\n * 'to': A mandatory direction value.\n ```\n 'up', 'down'\n ```\n * 'by': Unit to move. Default is computed based on 'to' value.\n ```\n 'line', 'wrappedLine', 'page', 'halfPage', 'editor'\n ```\n * 'value': Number of units to move. Default is '1'.\n * 'revealCursor': If 'true' reveals the cursor if it is outside view port.\n ",constraint:e,schema:{type:"object",required:["to"],properties:{to:{type:"string",enum:["up","down"]},by:{type:"string",enum:["line","wrappedLine","page","halfPage","editor"]},value:{type:"number",default:1},revealCursor:{type:"boolean"}}}}]},o.RawDirection={Up:"up",Right:"right",Down:"down",Left:"left"},o.RawUnit={Line:"line",WrappedLine:"wrappedLine",Page:"page",HalfPage:"halfPage",Editor:"editor",Column:"column"};function t(i){let n;switch(i.to){case o.RawDirection.Up:n=1;break;case o.RawDirection.Right:n=2;break;case o.RawDirection.Down:n=3;break;case o.RawDirection.Left:n=4;break;default:return null}let s;switch(i.by){case o.RawUnit.Line:s=1;break;case o.RawUnit.WrappedLine:s=2;break;case o.RawUnit.Page:s=3;break;case o.RawUnit.HalfPage:s=4;break;case o.RawUnit.Editor:s=5;break;case o.RawUnit.Column:s=6;break;default:s=2}const r=Math.floor(i.value||1),a=!!i.revealCursor;return{direction:n,unit:s,value:r,revealCursor:a,select:!!i.select}}o.parse=t})(En||(En={}));var Xm;(function(o){const e=function(t){if(!nn(t))return!1;const i=t;return!(!bc(i.lineNumber)&&!ji(i.lineNumber)||!Qn(i.at)&&!ji(i.at))};o.metadata={description:"Reveal the given line at the given logical position",args:[{name:"Reveal line argument object",description:"Property-value pairs that can be passed through this argument:\n * 'lineNumber': A mandatory line number value.\n * 'at': Logical position at which line has to be revealed.\n ```\n 'top', 'center', 'bottom'\n ```\n ",constraint:e,schema:{type:"object",required:["lineNumber"],properties:{lineNumber:{type:["number","string"]},at:{type:"string",enum:["top","center","bottom"]}}}}]},o.RawAtArgument={Top:"top",Center:"center",Bottom:"bottom"}})(Xm||(Xm={}));class $2{constructor(e){e.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(et).getFocusedCodeEditor();return n&&n.hasTextFocus()?this._runEditorCommand(t,n,i):!1}),e.addImplementation(1e3,"generic-dom-input-textarea",(t,i)=>{const n=Ui();return n&&ya(n)?(this.runDOMCommand(n),!0):!1}),e.addImplementation(0,"generic-dom",(t,i)=>{const n=t.get(et).getActiveCodeEditor();return n?(n.focus(),this._runEditorCommand(t,n,i)):!1})}_runEditorCommand(e,t,i){const n=this.runEditorCommand(e,t,i);return n||!0}}var cn;(function(o){class e extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){if(!w.position)return;C.model.pushStackElement(),C.setCursorStates(w.source,3,[_n.moveTo(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position,w.viewPosition)])&&w.revealType!==2&&C.revealAllCursors(w.source,!0,!0)}}o.MoveTo=re(new e({id:"_moveTo",inSelectionMode:!1,precondition:void 0})),o.MoveToSelect=re(new e({id:"_moveToSelect",inSelectionMode:!0,precondition:void 0}));class t extends Ci{runCoreEditorCommand(C,w){C.model.pushStackElement();const v=this._getColumnSelectResult(C,C.getPrimaryCursorState(),C.getCursorColumnSelectData(),w);v!==null&&(C.setCursorStates(w.source,3,v.viewStates.map(S=>nt.fromViewState(S))),C.setCursorColumnSelectData({isReal:!0,fromViewLineNumber:v.fromLineNumber,fromViewVisualColumn:v.fromVisualColumn,toViewLineNumber:v.toLineNumber,toViewVisualColumn:v.toVisualColumn}),v.reversed?C.revealTopMostCursor(w.source):C.revealBottomMostCursor(w.source))}}o.ColumnSelect=re(new class extends t{constructor(){super({id:"columnSelect",precondition:void 0})}_getColumnSelectResult(b,C,w,v){if(typeof v.position>"u"||typeof v.viewPosition>"u"||typeof v.mouseColumn>"u")return null;const S=b.model.validatePosition(v.position),L=b.coordinatesConverter.validateViewPosition(new M(v.viewPosition.lineNumber,v.viewPosition.column),S),x=v.doColumnSelect?w.fromViewLineNumber:L.lineNumber,I=v.doColumnSelect?w.fromViewVisualColumn:v.mouseColumn-1;return vf.columnSelect(b.cursorConfig,b,x,I,L.lineNumber,v.mouseColumn-1)}}),o.CursorColumnSelectLeft=re(new class extends t{constructor(){super({id:"cursorColumnSelectLeft",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3599,linux:{primary:0}}})}_getColumnSelectResult(b,C,w,v){return vf.columnSelectLeft(b.cursorConfig,b,w)}}),o.CursorColumnSelectRight=re(new class extends t{constructor(){super({id:"cursorColumnSelectRight",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3601,linux:{primary:0}}})}_getColumnSelectResult(b,C,w,v){return vf.columnSelectRight(b.cursorConfig,b,w)}});class i extends t{constructor(C){super(C),this._isPaged=C.isPaged}_getColumnSelectResult(C,w,v,S){return vf.columnSelectUp(C.cursorConfig,C,v,this._isPaged)}}o.CursorColumnSelectUp=re(new i({isPaged:!1,id:"cursorColumnSelectUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3600,linux:{primary:0}}})),o.CursorColumnSelectPageUp=re(new i({isPaged:!0,id:"cursorColumnSelectPageUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3595,linux:{primary:0}}}));class n extends t{constructor(C){super(C),this._isPaged=C.isPaged}_getColumnSelectResult(C,w,v,S){return vf.columnSelectDown(C.cursorConfig,C,v,this._isPaged)}}o.CursorColumnSelectDown=re(new n({isPaged:!1,id:"cursorColumnSelectDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3602,linux:{primary:0}}})),o.CursorColumnSelectPageDown=re(new n({isPaged:!0,id:"cursorColumnSelectPageDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3596,linux:{primary:0}}}));class s extends Ci{constructor(){super({id:"cursorMove",precondition:void 0,metadata:Qy.metadata})}runCoreEditorCommand(C,w){const v=Qy.parse(w);v&&this._runCursorMove(C,w.source,v)}_runCursorMove(C,w,v){C.model.pushStackElement(),C.setCursorStates(w,3,s._move(C,C.getCursorStates(),v)),C.revealAllCursors(w,!0)}static _move(C,w,v){const S=v.select,L=v.value;switch(v.direction){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:return _n.simpleMove(C,w,v.direction,S,L,v.unit);case 11:case 13:case 12:case 14:return _n.viewportMove(C,w,v.direction,S,L);default:return null}}}o.CursorMoveImpl=s,o.CursorMove=re(new s);class r extends Ci{constructor(C){super(C),this._staticArgs=C.args}runCoreEditorCommand(C,w){let v=this._staticArgs;this._staticArgs.value===-1&&(v={direction:this._staticArgs.direction,unit:this._staticArgs.unit,select:this._staticArgs.select,value:w.pageSize||C.cursorConfig.pageSize}),C.model.pushStackElement(),C.setCursorStates(w.source,3,_n.simpleMove(C,C.getCursorStates(),v.direction,v.select,v.value,v.unit)),C.revealAllCursors(w.source,!0)}}o.CursorLeft=re(new r({args:{direction:0,unit:0,select:!1,value:1},id:"cursorLeft",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:15,mac:{primary:15,secondary:[288]}}})),o.CursorLeftSelect=re(new r({args:{direction:0,unit:0,select:!0,value:1},id:"cursorLeftSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1039}})),o.CursorRight=re(new r({args:{direction:1,unit:0,select:!1,value:1},id:"cursorRight",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:17,mac:{primary:17,secondary:[292]}}})),o.CursorRightSelect=re(new r({args:{direction:1,unit:0,select:!0,value:1},id:"cursorRightSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1041}})),o.CursorUp=re(new r({args:{direction:2,unit:2,select:!1,value:1},id:"cursorUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:16,mac:{primary:16,secondary:[302]}}})),o.CursorUpSelect=re(new r({args:{direction:2,unit:2,select:!0,value:1},id:"cursorUpSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1040,secondary:[3088],mac:{primary:1040},linux:{primary:1040}}})),o.CursorPageUp=re(new r({args:{direction:2,unit:2,select:!1,value:-1},id:"cursorPageUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:11}})),o.CursorPageUpSelect=re(new r({args:{direction:2,unit:2,select:!0,value:-1},id:"cursorPageUpSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1035}})),o.CursorDown=re(new r({args:{direction:3,unit:2,select:!1,value:1},id:"cursorDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:18,mac:{primary:18,secondary:[300]}}})),o.CursorDownSelect=re(new r({args:{direction:3,unit:2,select:!0,value:1},id:"cursorDownSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1042,secondary:[3090],mac:{primary:1042},linux:{primary:1042}}})),o.CursorPageDown=re(new r({args:{direction:3,unit:2,select:!1,value:-1},id:"cursorPageDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:12}})),o.CursorPageDownSelect=re(new r({args:{direction:3,unit:2,select:!0,value:-1},id:"cursorPageDownSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1036}})),o.CreateCursor=re(new class extends Ci{constructor(){super({id:"createCursor",precondition:void 0})}runCoreEditorCommand(b,C){if(!C.position)return;let w;C.wholeLine?w=_n.line(b,b.getPrimaryCursorState(),!1,C.position,C.viewPosition):w=_n.moveTo(b,b.getPrimaryCursorState(),!1,C.position,C.viewPosition);const v=b.getCursorStates();if(v.length>1){const S=w.modelState?w.modelState.position:null,L=w.viewState?w.viewState.position:null;for(let x=0,I=v.length;x<I;x++){const D=v[x];if(!(S&&!D.modelState.selection.containsPosition(S))&&!(L&&!D.viewState.selection.containsPosition(L))){v.splice(x,1),b.model.pushStackElement(),b.setCursorStates(C.source,3,v);return}}}v.push(w),b.model.pushStackElement(),b.setCursorStates(C.source,3,v)}}),o.LastCursorMoveToSelect=re(new class extends Ci{constructor(){super({id:"_lastCursorMoveToSelect",precondition:void 0})}runCoreEditorCommand(b,C){if(!C.position)return;const w=b.getLastAddedCursorIndex(),v=b.getCursorStates(),S=v.slice(0);S[w]=_n.moveTo(b,v[w],!0,C.position,C.viewPosition),b.model.pushStackElement(),b.setCursorStates(C.source,3,S)}});class a extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,_n.moveToBeginningOfLine(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorHome=re(new a({inSelectionMode:!1,id:"cursorHome",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:14,mac:{primary:14,secondary:[2063]}}})),o.CursorHomeSelect=re(new a({inSelectionMode:!0,id:"cursorHomeSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1038,mac:{primary:1038,secondary:[3087]}}}));class l extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,this._exec(C.getCursorStates())),C.revealAllCursors(w.source,!0)}_exec(C){const w=[];for(let v=0,S=C.length;v<S;v++){const L=C[v],x=L.modelState.position.lineNumber;w[v]=nt.fromModelState(L.modelState.move(this._inSelectionMode,x,1,0))}return w}}o.CursorLineStart=re(new l({inSelectionMode:!1,id:"cursorLineStart",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:0,mac:{primary:287}}})),o.CursorLineStartSelect=re(new l({inSelectionMode:!0,id:"cursorLineStartSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:0,mac:{primary:1311}}}));class c extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,_n.moveToEndOfLine(C,C.getCursorStates(),this._inSelectionMode,w.sticky||!1)),C.revealAllCursors(w.source,!0)}}o.CursorEnd=re(new c({inSelectionMode:!1,id:"cursorEnd",precondition:void 0,kbOpts:{args:{sticky:!1},weight:at,kbExpr:T.textInputFocus,primary:13,mac:{primary:13,secondary:[2065]}},metadata:{description:"Go to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:p(61,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}})),o.CursorEndSelect=re(new c({inSelectionMode:!0,id:"cursorEndSelect",precondition:void 0,kbOpts:{args:{sticky:!1},weight:at,kbExpr:T.textInputFocus,primary:1037,mac:{primary:1037,secondary:[3089]}},metadata:{description:"Select to End",args:[{name:"args",schema:{type:"object",properties:{sticky:{description:p(62,"Stick to the end even when going to longer lines"),type:"boolean",default:!1}}}}]}}));class d extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,this._exec(C,C.getCursorStates())),C.revealAllCursors(w.source,!0)}_exec(C,w){const v=[];for(let S=0,L=w.length;S<L;S++){const x=w[S],I=x.modelState.position.lineNumber,D=C.model.getLineMaxColumn(I);v[S]=nt.fromModelState(x.modelState.move(this._inSelectionMode,I,D,0))}return v}}o.CursorLineEnd=re(new d({inSelectionMode:!1,id:"cursorLineEnd",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:0,mac:{primary:291}}})),o.CursorLineEndSelect=re(new d({inSelectionMode:!0,id:"cursorLineEndSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:0,mac:{primary:1315}}}));class h extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,_n.moveToBeginningOfBuffer(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorTop=re(new h({inSelectionMode:!1,id:"cursorTop",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2062,mac:{primary:2064}}})),o.CursorTopSelect=re(new h({inSelectionMode:!0,id:"cursorTopSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3086,mac:{primary:3088}}}));class u extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){C.model.pushStackElement(),C.setCursorStates(w.source,3,_n.moveToEndOfBuffer(C,C.getCursorStates(),this._inSelectionMode)),C.revealAllCursors(w.source,!0)}}o.CursorBottom=re(new u({inSelectionMode:!1,id:"cursorBottom",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2061,mac:{primary:2066}}})),o.CursorBottomSelect=re(new u({inSelectionMode:!0,id:"cursorBottomSelect",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:3085,mac:{primary:3090}}}));class f extends Ci{constructor(){super({id:"editorScroll",precondition:void 0,metadata:En.metadata})}determineScrollMethod(C){const w=[6],v=[1,2,3,4,5,6],S=[4,2],L=[1,3];return w.includes(C.unit)&&S.includes(C.direction)?this._runHorizontalEditorScroll.bind(this):v.includes(C.unit)&&L.includes(C.direction)?this._runVerticalEditorScroll.bind(this):null}runCoreEditorCommand(C,w){const v=En.parse(w);if(!v)return;const S=this.determineScrollMethod(v);S&&S(C,w.source,v)}_runVerticalEditorScroll(C,w,v){const S=this._computeDesiredScrollTop(C,v);if(v.revealCursor){const L=C.getCompletelyVisibleViewRangeAtScrollTop(S);C.setCursorStates(w,3,[_n.findPositionInViewportIfOutside(C,C.getPrimaryCursorState(),L,v.select)])}C.viewLayout.setScrollPosition({scrollTop:S},0)}_computeDesiredScrollTop(C,w){if(w.unit===1){const L=C.viewLayout.getFutureViewport(),x=C.getCompletelyVisibleViewRangeAtScrollTop(L.top),I=C.coordinatesConverter.convertViewRangeToModelRange(x);let D;w.direction===1?D=Math.max(1,I.startLineNumber-w.value):D=Math.min(C.model.getLineCount(),I.startLineNumber+w.value);const R=C.coordinatesConverter.convertModelPositionToViewPosition(new M(D,1));return C.viewLayout.getVerticalOffsetForLineNumber(R.lineNumber)}if(w.unit===5){let L=0;return w.direction===3&&(L=C.model.getLineCount()-C.cursorConfig.pageSize),C.viewLayout.getVerticalOffsetForLineNumber(L)}let v;w.unit===3?v=C.cursorConfig.pageSize*w.value:w.unit===4?v=Math.round(C.cursorConfig.pageSize/2)*w.value:v=w.value;const S=(w.direction===1?-1:1)*v;return C.viewLayout.getCurrentScrollTop()+S*C.cursorConfig.lineHeight}_runHorizontalEditorScroll(C,w,v){const S=this._computeDesiredScrollLeft(C,v);C.viewLayout.setScrollPosition({scrollLeft:S},0)}_computeDesiredScrollLeft(C,w){const v=(w.direction===4?-1:1)*w.value;return C.viewLayout.getCurrentScrollLeft()+v*C.cursorConfig.typicalHalfwidthCharacterWidth}}o.EditorScrollImpl=f,o.EditorScroll=re(new f),o.ScrollLineUp=re(new class extends Ci{constructor(){super({id:"scrollLineUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2064,mac:{primary:267}}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Up,by:En.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollPageUp=re(new class extends Ci{constructor(){super({id:"scrollPageUp",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2059,win:{primary:523},linux:{primary:523}}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Up,by:En.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollEditorTop=re(new class extends Ci{constructor(){super({id:"scrollEditorTop",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Up,by:En.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollLineDown=re(new class extends Ci{constructor(){super({id:"scrollLineDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2066,mac:{primary:268}}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Down,by:En.RawUnit.WrappedLine,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollPageDown=re(new class extends Ci{constructor(){super({id:"scrollPageDown",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:2060,win:{primary:524},linux:{primary:524}}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Down,by:En.RawUnit.Page,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollEditorBottom=re(new class extends Ci{constructor(){super({id:"scrollEditorBottom",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Down,by:En.RawUnit.Editor,value:1,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollLeft=re(new class extends Ci{constructor(){super({id:"scrollLeft",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Left,by:En.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:C.source})}}),o.ScrollRight=re(new class extends Ci{constructor(){super({id:"scrollRight",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus}})}runCoreEditorCommand(b,C){o.EditorScroll.runCoreEditorCommand(b,{to:En.RawDirection.Right,by:En.RawUnit.Column,value:2,revealCursor:!1,select:!1,source:C.source})}});class g extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){w.position&&(C.model.pushStackElement(),C.setCursorStates(w.source,3,[_n.word(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position)]),w.revealType!==2&&C.revealAllCursors(w.source,!0,!0))}}o.WordSelect=re(new g({inSelectionMode:!1,id:"_wordSelect",precondition:void 0})),o.WordSelectDrag=re(new g({inSelectionMode:!0,id:"_wordSelectDrag",precondition:void 0})),o.LastCursorWordSelect=re(new class extends Ci{constructor(){super({id:"lastCursorWordSelect",precondition:void 0})}runCoreEditorCommand(b,C){if(!C.position)return;const w=b.getLastAddedCursorIndex(),v=b.getCursorStates(),S=v.slice(0),L=v[w];S[w]=_n.word(b,L,L.modelState.hasSelection(),C.position),b.model.pushStackElement(),b.setCursorStates(C.source,3,S)}});class m extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){w.position&&(C.model.pushStackElement(),C.setCursorStates(w.source,3,[_n.line(C,C.getPrimaryCursorState(),this._inSelectionMode,w.position,w.viewPosition)]),w.revealType!==2&&C.revealAllCursors(w.source,!1,!0))}}o.LineSelect=re(new m({inSelectionMode:!1,id:"_lineSelect",precondition:void 0})),o.LineSelectDrag=re(new m({inSelectionMode:!0,id:"_lineSelectDrag",precondition:void 0}));class _ extends Ci{constructor(C){super(C),this._inSelectionMode=C.inSelectionMode}runCoreEditorCommand(C,w){if(!w.position)return;const v=C.getLastAddedCursorIndex(),S=C.getCursorStates(),L=S.slice(0);L[v]=_n.line(C,S[v],this._inSelectionMode,w.position,w.viewPosition),C.model.pushStackElement(),C.setCursorStates(w.source,3,L)}}o.LastCursorLineSelect=re(new _({inSelectionMode:!1,id:"lastCursorLineSelect",precondition:void 0})),o.LastCursorLineSelectDrag=re(new _({inSelectionMode:!0,id:"lastCursorLineSelectDrag",precondition:void 0})),o.CancelSelection=re(new class extends Ci{constructor(){super({id:"cancelSelection",precondition:T.hasNonEmptySelection,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(b,C){b.model.pushStackElement(),b.setCursorStates(C.source,3,[_n.cancelSelection(b,b.getPrimaryCursorState())]),b.revealAllCursors(C.source,!0)}}),o.RemoveSecondaryCursors=re(new class extends Ci{constructor(){super({id:"removeSecondaryCursors",precondition:T.hasMultipleSelections,kbOpts:{weight:at+1,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}})}runCoreEditorCommand(b,C){b.model.pushStackElement(),b.setCursorStates(C.source,3,[b.getPrimaryCursorState()]),b.revealAllCursors(C.source,!0),cl(p(63,"Removed secondary cursors"))}}),o.RevealLine=re(new class extends Ci{constructor(){super({id:"revealLine",precondition:void 0,metadata:Xm.metadata})}runCoreEditorCommand(b,C){const w=C,v=w.lineNumber||0;let S=typeof v=="number"?v+1:parseInt(v)+1;S<1&&(S=1);const L=b.model.getLineCount();S>L&&(S=L);const x=new k(S,1,S,b.model.getLineMaxColumn(S));let I=0;if(w.at)switch(w.at){case Xm.RawAtArgument.Top:I=3;break;case Xm.RawAtArgument.Center:I=1;break;case Xm.RawAtArgument.Bottom:I=4;break}const D=b.coordinatesConverter.convertModelRangeToViewRange(x);b.revealRange(C.source,!1,D,I,0)}}),o.SelectAll=new class extends $2{constructor(){super(ooe)}runDOMCommand(b){Fs&&(b.focus(),b.select()),b.ownerDocument.execCommand("selectAll")}runEditorCommand(b,C,w){const v=C._getViewModel();v&&this.runCoreEditorCommand(v,w)}runCoreEditorCommand(b,C){b.model.pushStackElement(),b.setCursorStates("keyboard",3,[_n.selectAll(b,b.getPrimaryCursorState())])}},o.SetSelection=re(new class extends Ci{constructor(){super({id:"setSelection",precondition:void 0})}runCoreEditorCommand(b,C){C.selection&&(b.model.pushStackElement(),b.setCursorStates(C.source,3,[nt.fromModelSelection(C.selection)]))}})})(cn||(cn={}));const Lre=K.and(T.textInputFocus,T.columnSelection);function Qm(o,e){rn.registerKeybindingRule({id:o,primary:e,when:Lre,weight:at+1})}Qm(cn.CursorColumnSelectLeft.id,1039),Qm(cn.CursorColumnSelectRight.id,1041),Qm(cn.CursorColumnSelectUp.id,1040),Qm(cn.CursorColumnSelectPageUp.id,1035),Qm(cn.CursorColumnSelectDown.id,1042),Qm(cn.CursorColumnSelectPageDown.id,1036);function SV(o){return o.register(),o}var Jm;(function(o){class e extends Bi{runEditorCommand(i,n,s){const r=n._getViewModel();r&&this.runCoreEditingCommand(n,r,s||{})}}o.CoreEditingCommand=e,o.LineBreakInsert=re(new class extends e{constructor(){super({id:"lineBreakInsert",precondition:T.writable,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:0,mac:{primary:301}}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,lL.lineBreakInsert(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection)))}}),o.Outdent=re(new class extends e{constructor(){super({id:"outdent",precondition:T.writable,kbOpts:{weight:at,kbExpr:K.and(T.editorTextFocus,T.tabDoesNotMoveFocus),primary:1026}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,gh.outdent(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),o.Tab=re(new class extends e{constructor(){super({id:"tab",precondition:T.writable,kbOpts:{weight:at,kbExpr:K.and(T.editorTextFocus,T.tabDoesNotMoveFocus),primary:2}})}runCoreEditingCommand(t,i,n){t.pushUndoStop(),t.executeCommands(this.id,gh.tab(i.cursorConfig,i.model,i.getCursorStates().map(s=>s.modelState.selection))),t.pushUndoStop()}}),o.DeleteLeft=re(new class extends e{constructor(){super({id:"deleteLeft",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:1,secondary:[1025],mac:{primary:1,secondary:[1025,294,257]}}})}runCoreEditingCommand(t,i,n){const[s,r]=wf.deleteLeft(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection),i.getCursorAutoClosedCharacters());s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(2)}}),o.DeleteRight=re(new class extends e{constructor(){super({id:"deleteRight",precondition:void 0,kbOpts:{weight:at,kbExpr:T.textInputFocus,primary:20,mac:{primary:20,secondary:[290,276]}}})}runCoreEditingCommand(t,i,n){const[s,r]=wf.deleteRight(i.getPrevEditOperationType(),i.cursorConfig,i.model,i.getCursorStates().map(a=>a.modelState.selection));s&&t.pushUndoStop(),t.executeCommands(this.id,r),i.setPrevEditOperationType(3)}}),o.Undo=new class extends $2{constructor(){super(VH)}runDOMCommand(t){t.ownerDocument.execCommand("undo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(104)===!0))return i.getModel().undo()}},o.Redo=new class extends $2{constructor(){super(zH)}runDOMCommand(t){t.ownerDocument.execCommand("redo")}runEditorCommand(t,i,n){if(!(!i.hasModel()||i.getOption(104)===!0))return i.getModel().redo()}}})(Jm||(Jm={}));class yV extends Uy{constructor(e,t,i){super({id:e,precondition:void 0,metadata:i}),this._handlerId=t}runCommand(e,t){const i=e.get(et).getFocusedCodeEditor();i&&i.trigger("keyboard",this._handlerId,t)}}function xf(o,e){SV(new yV("default:"+o,o)),SV(new yV(o,o,e))}xf("type",{description:"Type",args:[{name:"args",schema:{type:"object",required:["text"],properties:{text:{type:"string"}}}}]}),xf("replacePreviousChar"),xf("compositionType"),xf("compositionStart"),xf("compositionEnd"),xf("paste"),xf("cut");const j2=We("markerDecorationsService");var xre=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kre=function(o,e){return function(t,i){e(t,i,o)}};let hL=(_C=class{constructor(e,t){}dispose(){}},_C.ID="editor.contrib.markerDecorations",_C);hL=xre([kre(1,j2)],hL),Qe(hL.ID,hL,0);class uL{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=""}focus(){this.domNode.focus()}setMaxWidth(e){const t=Ia(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){const t=Ia(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){const t=Ia(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){const t=Ia(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){const t=Ia(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){const t=Ia(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){const t=Ia(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingLeft(e){const t=Ia(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=Ia(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=Ia(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){const t=Ia(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 Ia(o){return typeof o=="number"?`${o}px`:o}function lt(o){return new uL(o)}function dn(o,e){o instanceof uL?(o.setFontFamily(e.getMassagedFontFamily()),o.setFontWeight(e.fontWeight),o.setFontSize(e.fontSize),o.setFontFeatureSettings(e.fontFeatureSettings),o.setFontVariationSettings(e.fontVariationSettings),o.setLineHeight(e.lineHeight),o.setLetterSpacing(e.letterSpacing)):(o.style.fontFamily=e.getMassagedFontFamily(),o.style.fontWeight=e.fontWeight,o.style.fontSize=e.fontSize+"px",o.style.fontFeatureSettings=e.fontFeatureSettings,o.style.fontVariationSettings=e.fontVariationSettings,o.style.lineHeight=e.lineHeight+"px",o.style.letterSpacing=e.letterSpacing+"px")}class LV extends A{constructor(e,t){super(),this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._referenceDomElement=e,this._width=-1,this._height=-1,this._resizeObserver=null,this.measureReferenceDomElement(!1,t)}dispose(){this.stopObserving(),super.dispose()}getWidth(){return this._width}getHeight(){return this._height}startObserving(){if(!this._resizeObserver&&this._referenceDomElement){let e=null;const t=()=>{e?this.observe({width:e.width,height:e.height}):this.observe()};let i=!1,n=!1;const s=()=>{if(i&&!n)try{i=!1,n=!0,t()}finally{Hs(me(this._referenceDomElement),()=>{n=!1,s()})}};this._resizeObserver=new ResizeObserver(r=>{r&&r[0]&&r[0].contentRect?e={width:r[0].contentRect.width,height:r[0].contentRect.height}:e=null,i=!0,s()}),this._resizeObserver.observe(this._referenceDomElement)}}stopObserving(){this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}observe(e){this.measureReferenceDomElement(!0,e)}measureReferenceDomElement(e,t){let i=0,n=0;t?(i=t.width,n=t.height):this._referenceDomElement&&(i=this._referenceDomElement.clientWidth,n=this._referenceDomElement.clientHeight),i=Math.max(5,i),n=Math.max(5,n),(this._width!==i||this._height!==n)&&(this._width=i,this._height=n,e&&this._onDidChange.fire())}}class Ire extends A{constructor(e){super(),this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._listener=()=>this._handleChange(e,!0),this._mediaQueryList=null,this._handleChange(e,!1)}_handleChange(e,t){this._mediaQueryList?.removeEventListener("change",this._listener),this._mediaQueryList=e.matchMedia(`(resolution: ${e.devicePixelRatio}dppx)`),this._mediaQueryList.addEventListener("change",this._listener),t&&this._onDidChange.fire()}}class Dre extends A{get value(){return this._value}constructor(e){super(),this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._value=this._getPixelRatio(e);const t=this._register(new Ire(e));this._register(t.onDidChange(()=>{this._value=this._getPixelRatio(e),this._onDidChange.fire(this._value)}))}_getPixelRatio(e){const t=document.createElement("canvas").getContext("2d"),i=e.devicePixelRatio||1,n=t.webkitBackingStorePixelRatio||t.mozBackingStorePixelRatio||t.msBackingStorePixelRatio||t.oBackingStorePixelRatio||t.backingStorePixelRatio||1;return i/n}}class Ere{constructor(){this.mapWindowIdToPixelRatioMonitor=new Map}_getOrCreatePixelRatioMonitor(e){const t=b1(e);let i=this.mapWindowIdToPixelRatioMonitor.get(t);return i||(i=new Dre(e),this.mapWindowIdToPixelRatioMonitor.set(t,i),ie.once(Zne)(({vscodeWindowId:n})=>{n===t&&(i?.dispose(),this.mapWindowIdToPixelRatioMonitor.delete(t))})),i}getInstance(e){return this._getOrCreatePixelRatioMonitor(e)}}const A1=new Ere;class Nre{constructor(e,t){this.chr=e,this.type=t,this.width=0}fulfill(e){this.width=e}}class q2{constructor(e,t){this._bareFontInfo=e,this._requests=t,this._container=null,this._testElements=null}read(e){this._createDomElements(),e.document.body.appendChild(this._container),this._readFromDomElements(),this._container?.remove(),this._container=null,this._testElements=null}_createDomElements(){const e=document.createElement("div");e.style.position="absolute",e.style.top="-50000px",e.style.width="50000px";const t=document.createElement("div");dn(t,this._bareFontInfo),e.appendChild(t);const i=document.createElement("div");dn(i,this._bareFontInfo),i.style.fontWeight="bold",e.appendChild(i);const n=document.createElement("div");dn(n,this._bareFontInfo),n.style.fontStyle="italic",e.appendChild(n);const s=[];for(const r of this._requests){let a;r.type===0&&(a=t),r.type===2&&(a=i),r.type===1&&(a=n),a.appendChild(document.createElement("br"));const l=document.createElement("span");q2._render(l,r),a.appendChild(l),s.push(l)}this._container=e,this._testElements=s}static _render(e,t){if(t.chr===" "){let i=" ";for(let n=0;n<8;n++)i+=i;e.innerText=i}else{let i=t.chr;for(let n=0;n<8;n++)i+=i;e.textContent=i}}_readFromDomElements(){for(let e=0,t=this._requests.length;e<t;e++){const i=this._requests[e],n=this._testElements[e];i.fulfill(n.offsetWidth/256)}}}function Tre(o,e,t){new q2(e,t).read(o)}const Un={tabSize:4,indentSize:4,insertSpaces:!0,detectIndentation:!0,trimAutoWhitespace:!0,largeFileOptimizations:!0,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},pl=8;class xV{constructor(e){this._values=e}hasChanged(e){return this._values[e]}}class kV{constructor(){this.stableMinimapLayoutInput=null,this.stableFitMaxMinimapScale=0,this.stableFitRemainingWidth=0}}class Zt{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return fL(e,t)}compute(e,t,i){return i}}class O1{constructor(e,t){this.newValue=e,this.didChange=t}}function fL(o,e){if(typeof o!="object"||typeof e!="object"||!o||!e)return new O1(e,o!==e);if(Array.isArray(o)||Array.isArray(e)){const i=Array.isArray(o)&&Array.isArray(e)&&Ut(o,e);return new O1(e,!i)}let t=!1;for(const i in e)if(e.hasOwnProperty(i)){const n=fL(o[i],e[i]);n.didChange&&(o[i]=n.newValue,t=!0)}return new O1(o,t)}class ph{constructor(e){this.schema=void 0,this.id=e,this.name="_never_",this.defaultValue=void 0}applyUpdate(e,t){return fL(e,t)}validate(e){return this.defaultValue}}class e_{constructor(e,t,i,n){this.id=e,this.name=t,this.defaultValue=i,this.schema=n}applyUpdate(e,t){return fL(e,t)}validate(e){return typeof e>"u"?this.defaultValue:e}compute(e,t,i){return i}}function _e(o,e){return typeof o>"u"?e:o==="false"?!1:!!o}class Ve extends e_{constructor(e,t,i,n=void 0){typeof n<"u"&&(n.type="boolean",n.default=i),super(e,t,i,n)}validate(e){return _e(e,this.defaultValue)}}function kf(o,e,t,i){if(typeof o>"u")return e;let n=parseInt(o,10);return isNaN(n)?e:(n=Math.max(t,n),n=Math.min(i,n),n|0)}class vt extends e_{static clampedInt(e,t,i,n){return kf(e,t,i,n)}constructor(e,t,i,n,s,r=void 0){typeof r<"u"&&(r.type="integer",r.default=i,r.minimum=n,r.maximum=s),super(e,t,i,r),this.minimum=n,this.maximum=s}validate(e){return vt.clampedInt(e,this.defaultValue,this.minimum,this.maximum)}}function Rre(o,e,t,i){if(typeof o>"u")return e;const n=Wo.float(o,e);return Wo.clamp(n,t,i)}class Wo extends e_{static clamp(e,t,i){return e<t?t:e>i?i:e}static float(e,t){if(typeof e=="number")return e;if(typeof e>"u")return t;const i=parseFloat(e);return isNaN(i)?t:i}constructor(e,t,i,n,s,r,a){typeof s<"u"&&(s.type="number",s.default=i,s.minimum=r,s.maximum=a),super(e,t,i,s),this.validationFn=n,this.minimum=r,this.maximum=a}validate(e){return this.validationFn(Wo.float(e,this.defaultValue))}}class ss extends e_{static string(e,t){return typeof e!="string"?t:e}constructor(e,t,i,n=void 0){typeof n<"u"&&(n.type="string",n.default=i),super(e,t,i,n)}validate(e){return ss.string(e,this.defaultValue)}}function Ot(o,e,t,i){return typeof o!="string"?e:i&&o in i?i[o]:t.indexOf(o)===-1?e:o}class Yt extends e_{constructor(e,t,i,n,s=void 0){typeof s<"u"&&(s.type="string",s.enum=n,s.default=i),super(e,t,i,s),this._allowedValues=n}validate(e){return Ot(e,this.defaultValue,this._allowedValues)}}class F1 extends Zt{constructor(e,t,i,n,s,r,a=void 0){typeof a<"u"&&(a.type="string",a.enum=s,a.default=n),super(e,t,i,a),this._allowedValues=s,this._convert=r}validate(e){return typeof e!="string"?this.defaultValue:this._allowedValues.indexOf(e)===-1?this.defaultValue:this._convert(e)}}function Mre(o){switch(o){case"none":return 0;case"keep":return 1;case"brackets":return 2;case"advanced":return 3;case"full":return 4}}class Pre extends Zt{constructor(){super(2,"accessibilitySupport",0,{type:"string",enum:["auto","on","off"],enumDescriptions:[p(198,"Use platform APIs to detect when a Screen Reader is attached."),p(199,"Optimize for usage with a Screen Reader."),p(200,"Assume a screen reader is not attached.")],default:"auto",tags:["accessibility"],description:p(201,"Controls if the UI should run in a mode where it is optimized for screen readers.")})}validate(e){switch(e){case"auto":return 0;case"off":return 1;case"on":return 2}return this.defaultValue}compute(e,t,i){return i===0?e.accessibilitySupport:i}}class Are extends Zt{constructor(){const e={insertSpace:!0,ignoreEmptyLines:!0};super(29,"comments",e,{"editor.comments.insertSpace":{type:"boolean",default:e.insertSpace,description:p(202,"Controls whether a space character is inserted when commenting.")},"editor.comments.ignoreEmptyLines":{type:"boolean",default:e.ignoreEmptyLines,description:p(203,"Controls if empty lines should be ignored with toggle, add or remove actions for line comments.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertSpace:_e(t.insertSpace,this.defaultValue.insertSpace),ignoreEmptyLines:_e(t.ignoreEmptyLines,this.defaultValue.ignoreEmptyLines)}}}function Ore(o){switch(o){case"blink":return 1;case"smooth":return 2;case"phase":return 3;case"expand":return 4;case"solid":return 5}}var hn;(function(o){o[o.Line=1]="Line",o[o.Block=2]="Block",o[o.Underline=3]="Underline",o[o.LineThin=4]="LineThin",o[o.BlockOutline=5]="BlockOutline",o[o.UnderlineThin=6]="UnderlineThin"})(hn||(hn={}));function IV(o){switch(o){case"line":return hn.Line;case"block":return hn.Block;case"underline":return hn.Underline;case"line-thin":return hn.LineThin;case"block-outline":return hn.BlockOutline;case"underline-thin":return hn.UnderlineThin}}class Fre extends ph{constructor(){super(162)}compute(e,t,i){const n=["monaco-editor"];return t.get(48)&&n.push(t.get(48)),e.extraEditorClassName&&n.push(e.extraEditorClassName),t.get(82)==="default"?n.push("mouse-default"):t.get(82)==="copy"&&n.push("mouse-copy"),t.get(127)&&n.push("showUnused"),t.get(157)&&n.push("showDeprecated"),n.join(" ")}}class Wre extends Ve{constructor(){super(45,"emptySelectionClipboard",!0,{description:p(204,"Controls whether copying without a selection copies the current line.")})}compute(e,t,i){return i&&e.emptySelectionClipboard}}class Bre extends Zt{constructor(){const e={cursorMoveOnType:!0,findOnType:!0,seedSearchStringFromSelection:"always",autoFindInSelection:"never",globalFindClipboard:!1,addExtraSpaceOnTop:!0,loop:!0,history:"workspace",replaceHistory:"workspace"};super(50,"find",e,{"editor.find.cursorMoveOnType":{type:"boolean",default:e.cursorMoveOnType,description:p(205,"Controls whether the cursor should jump to find matches while typing.")},"editor.find.seedSearchStringFromSelection":{type:"string",enum:["never","always","selection"],default:e.seedSearchStringFromSelection,enumDescriptions:[p(206,"Never seed search string from the editor selection."),p(207,"Always seed search string from the editor selection, including word at cursor position."),p(208,"Only seed search string from the editor selection.")],description:p(209,"Controls whether the search string in the Find Widget is seeded from the editor selection.")},"editor.find.autoFindInSelection":{type:"string",enum:["never","always","multiline"],default:e.autoFindInSelection,enumDescriptions:[p(210,"Never turn on Find in Selection automatically (default)."),p(211,"Always turn on Find in Selection automatically."),p(212,"Turn on Find in Selection automatically when multiple lines of content are selected.")],description:p(213,"Controls the condition for turning on Find in Selection automatically.")},"editor.find.globalFindClipboard":{type:"boolean",default:e.globalFindClipboard,description:p(214,"Controls whether the Find Widget should read or modify the shared find clipboard on macOS."),included:ze},"editor.find.addExtraSpaceOnTop":{type:"boolean",default:e.addExtraSpaceOnTop,description:p(215,"Controls whether the Find Widget should add extra lines on top of the editor. When true, you can scroll beyond the first line when the Find Widget is visible.")},"editor.find.loop":{type:"boolean",default:e.loop,description:p(216,"Controls whether the search automatically restarts from the beginning (or the end) when no further matches can be found.")},"editor.find.history":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(217,"Do not store search history from the find widget."),p(218,"Store search history across the active workspace")],description:p(219,"Controls how the find widget history should be stored")},"editor.find.replaceHistory":{type:"string",enum:["never","workspace"],default:"workspace",enumDescriptions:[p(220,"Do not store history from the replace widget."),p(221,"Store replace history across the active workspace")],description:p(222,"Controls how the replace widget history should be stored")},"editor.find.findOnType":{type:"boolean",default:e.findOnType,description:p(223,"Controls whether the Find Widget should search as you type.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{cursorMoveOnType:_e(t.cursorMoveOnType,this.defaultValue.cursorMoveOnType),findOnType:_e(t.findOnType,this.defaultValue.findOnType),seedSearchStringFromSelection:typeof e.seedSearchStringFromSelection=="boolean"?e.seedSearchStringFromSelection?"always":"never":Ot(t.seedSearchStringFromSelection,this.defaultValue.seedSearchStringFromSelection,["never","always","selection"]),autoFindInSelection:typeof e.autoFindInSelection=="boolean"?e.autoFindInSelection?"always":"never":Ot(t.autoFindInSelection,this.defaultValue.autoFindInSelection,["never","always","multiline"]),globalFindClipboard:_e(t.globalFindClipboard,this.defaultValue.globalFindClipboard),addExtraSpaceOnTop:_e(t.addExtraSpaceOnTop,this.defaultValue.addExtraSpaceOnTop),loop:_e(t.loop,this.defaultValue.loop),history:Ot(t.history,this.defaultValue.history,["never","workspace"]),replaceHistory:Ot(t.replaceHistory,this.defaultValue.replaceHistory,["never","workspace"])}}}const Bd=class Bd extends Zt{constructor(){super(60,"fontLigatures",Bd.OFF,{anyOf:[{type:"boolean",description:p(224,"Enables/Disables font ligatures ('calt' and 'liga' font features). Change this to a string for fine-grained control of the 'font-feature-settings' CSS property.")},{type:"string",description:p(225,"Explicit 'font-feature-settings' CSS property. A boolean can be passed instead if one only needs to turn on/off ligatures.")}],description:p(226,"Configures font ligatures or font features. Can be either a boolean to enable/disable ligatures or a string for the value of the CSS 'font-feature-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"||e.length===0?Bd.OFF:e==="true"?Bd.ON:e:e?Bd.ON:Bd.OFF}};Bd.OFF='"liga" off, "calt" off',Bd.ON='"liga" on, "calt" on';let Fc=Bd;const Hd=class Hd extends Zt{constructor(){super(63,"fontVariations",Hd.OFF,{anyOf:[{type:"boolean",description:p(227,"Enables/Disables the translation from font-weight to font-variation-settings. Change this to a string for fine-grained control of the 'font-variation-settings' CSS property.")},{type:"string",description:p(228,"Explicit 'font-variation-settings' CSS property. A boolean can be passed instead if one only needs to translate font-weight to font-variation-settings.")}],description:p(229,"Configures font variations. Can be either a boolean to enable/disable the translation from font-weight to font-variation-settings or a string for the value of the CSS 'font-variation-settings' property."),default:!1})}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e==="false"?Hd.OFF:e==="true"?Hd.TRANSLATE:e:e?Hd.TRANSLATE:Hd.OFF}compute(e,t,i){return e.fontInfo.fontVariationSettings}};Hd.OFF="normal",Hd.TRANSLATE="translate";let W1=Hd;class Hre extends ph{constructor(){super(59)}compute(e,t,i){return e.fontInfo}}class Vre extends ph{constructor(){super(161)}compute(e,t,i){return e.inputMode==="overtype"?t.get(92):t.get(34)}}class zre extends ph{constructor(){super(170)}compute(e,t){return e.editContextSupported&&t.get(44)}}class Ure extends ph{constructor(){super(172)}compute(e,t){return e.accessibilitySupport===2?t.get(7):t.get(6)}}class $re extends e_{constructor(){super(61,"fontSize",bs.fontSize,{type:"number",minimum:6,maximum:100,default:bs.fontSize,description:p(230,"Controls the font size in pixels.")})}validate(e){const t=Wo.float(e,this.defaultValue);return t===0?bs.fontSize:Wo.clamp(t,6,100)}compute(e,t,i){return e.fontInfo.fontSize}}const lc=class lc extends Zt{constructor(){super(62,"fontWeight",bs.fontWeight,{anyOf:[{type:"number",minimum:lc.MINIMUM_VALUE,maximum:lc.MAXIMUM_VALUE,errorMessage:p(231,'Only "normal" and "bold" keywords or numbers between 1 and 1000 are allowed.')},{type:"string",pattern:"^(normal|bold|1000|[1-9][0-9]{0,2})$"},{enum:lc.SUGGESTION_VALUES}],default:bs.fontWeight,description:p(232,'Controls the font weight. Accepts "normal" and "bold" keywords or numbers between 1 and 1000.')})}validate(e){return e==="normal"||e==="bold"?e:String(vt.clampedInt(e,bs.fontWeight,lc.MINIMUM_VALUE,lc.MAXIMUM_VALUE))}};lc.SUGGESTION_VALUES=["normal","bold","100","200","300","400","500","600","700","800","900"],lc.MINIMUM_VALUE=1,lc.MAXIMUM_VALUE=1e3;let K2=lc;class jre extends Zt{constructor(){const e={multiple:"peek",multipleDefinitions:"peek",multipleTypeDefinitions:"peek",multipleDeclarations:"peek",multipleImplementations:"peek",multipleReferences:"peek",multipleTests:"peek",alternativeDefinitionCommand:"editor.action.goToReferences",alternativeTypeDefinitionCommand:"editor.action.goToReferences",alternativeDeclarationCommand:"editor.action.goToReferences",alternativeImplementationCommand:"",alternativeReferenceCommand:"",alternativeTestsCommand:""},t={type:"string",enum:["peek","gotoAndPeek","goto"],default:e.multiple,enumDescriptions:[p(233,"Show Peek view of the results (default)"),p(234,"Go to the primary result and show a Peek view"),p(235,"Go to the primary result and enable Peek-less navigation to others")]},i=["","editor.action.referenceSearch.trigger","editor.action.goToReferences","editor.action.peekImplementation","editor.action.goToImplementation","editor.action.peekTypeDefinition","editor.action.goToTypeDefinition","editor.action.peekDeclaration","editor.action.revealDeclaration","editor.action.peekDefinition","editor.action.revealDefinitionAside","editor.action.revealDefinition"];super(67,"gotoLocation",e,{"editor.gotoLocation.multiple":{deprecationMessage:p(236,"This setting is deprecated, please use separate settings like 'editor.editor.gotoLocation.multipleDefinitions' or 'editor.editor.gotoLocation.multipleImplementations' instead.")},"editor.gotoLocation.multipleDefinitions":{description:p(237,"Controls the behavior the 'Go to Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleTypeDefinitions":{description:p(238,"Controls the behavior the 'Go to Type Definition'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleDeclarations":{description:p(239,"Controls the behavior the 'Go to Declaration'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleImplementations":{description:p(240,"Controls the behavior the 'Go to Implementations'-command when multiple target locations exist."),...t},"editor.gotoLocation.multipleReferences":{description:p(241,"Controls the behavior the 'Go to References'-command when multiple target locations exist."),...t},"editor.gotoLocation.alternativeDefinitionCommand":{type:"string",default:e.alternativeDefinitionCommand,enum:i,description:p(242,"Alternative command id that is being executed when the result of 'Go to Definition' is the current location.")},"editor.gotoLocation.alternativeTypeDefinitionCommand":{type:"string",default:e.alternativeTypeDefinitionCommand,enum:i,description:p(243,"Alternative command id that is being executed when the result of 'Go to Type Definition' is the current location.")},"editor.gotoLocation.alternativeDeclarationCommand":{type:"string",default:e.alternativeDeclarationCommand,enum:i,description:p(244,"Alternative command id that is being executed when the result of 'Go to Declaration' is the current location.")},"editor.gotoLocation.alternativeImplementationCommand":{type:"string",default:e.alternativeImplementationCommand,enum:i,description:p(245,"Alternative command id that is being executed when the result of 'Go to Implementation' is the current location.")},"editor.gotoLocation.alternativeReferenceCommand":{type:"string",default:e.alternativeReferenceCommand,enum:i,description:p(246,"Alternative command id that is being executed when the result of 'Go to Reference' is the current location.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{multiple:Ot(t.multiple,this.defaultValue.multiple,["peek","gotoAndPeek","goto"]),multipleDefinitions:t.multipleDefinitions??Ot(t.multipleDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleTypeDefinitions:t.multipleTypeDefinitions??Ot(t.multipleTypeDefinitions,"peek",["peek","gotoAndPeek","goto"]),multipleDeclarations:t.multipleDeclarations??Ot(t.multipleDeclarations,"peek",["peek","gotoAndPeek","goto"]),multipleImplementations:t.multipleImplementations??Ot(t.multipleImplementations,"peek",["peek","gotoAndPeek","goto"]),multipleReferences:t.multipleReferences??Ot(t.multipleReferences,"peek",["peek","gotoAndPeek","goto"]),multipleTests:t.multipleTests??Ot(t.multipleTests,"peek",["peek","gotoAndPeek","goto"]),alternativeDefinitionCommand:ss.string(t.alternativeDefinitionCommand,this.defaultValue.alternativeDefinitionCommand),alternativeTypeDefinitionCommand:ss.string(t.alternativeTypeDefinitionCommand,this.defaultValue.alternativeTypeDefinitionCommand),alternativeDeclarationCommand:ss.string(t.alternativeDeclarationCommand,this.defaultValue.alternativeDeclarationCommand),alternativeImplementationCommand:ss.string(t.alternativeImplementationCommand,this.defaultValue.alternativeImplementationCommand),alternativeReferenceCommand:ss.string(t.alternativeReferenceCommand,this.defaultValue.alternativeReferenceCommand),alternativeTestsCommand:ss.string(t.alternativeTestsCommand,this.defaultValue.alternativeTestsCommand)}}}class qre extends Zt{constructor(){const e={enabled:!0,delay:300,hidingDelay:300,sticky:!0,above:!0};super(69,"hover",e,{"editor.hover.enabled":{type:"boolean",default:e.enabled,description:p(247,"Controls whether the hover is shown.")},"editor.hover.delay":{type:"number",default:e.delay,minimum:0,maximum:1e4,description:p(248,"Controls the delay in milliseconds after which the hover is shown.")},"editor.hover.sticky":{type:"boolean",default:e.sticky,description:p(249,"Controls whether the hover should remain visible when mouse is moved over it.")},"editor.hover.hidingDelay":{type:"integer",minimum:0,default:e.hidingDelay,markdownDescription:p(250,"Controls the delay in milliseconds after which the hover is hidden. Requires `#editor.hover.sticky#` to be enabled.")},"editor.hover.above":{type:"boolean",default:e.above,description:p(251,"Prefer showing hovers above the line, if there's space.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),delay:vt.clampedInt(t.delay,this.defaultValue.delay,0,1e4),sticky:_e(t.sticky,this.defaultValue.sticky),hidingDelay:vt.clampedInt(t.hidingDelay,this.defaultValue.hidingDelay,0,6e5),above:_e(t.above,this.defaultValue.above)}}}class t_ extends ph{constructor(){super(165)}compute(e,t,i){return t_.computeLayout(t,{memory:e.memory,outerWidth:e.outerWidth,outerHeight:e.outerHeight,isDominatedByLongLines:e.isDominatedByLongLines,lineHeight:e.fontInfo.lineHeight,viewLineCount:e.viewLineCount,lineNumbersDigitCount:e.lineNumbersDigitCount,typicalHalfwidthCharacterWidth:e.fontInfo.typicalHalfwidthCharacterWidth,maxDigitWidth:e.fontInfo.maxDigitWidth,pixelRatio:e.pixelRatio,glyphMarginDecorationLaneCount:e.glyphMarginDecorationLaneCount})}static computeContainedMinimapLineCount(e){const t=e.height/e.lineHeight,i=Math.floor(e.paddingTop/e.lineHeight);let n=Math.floor(e.paddingBottom/e.lineHeight);e.scrollBeyondLastLine&&(n=Math.max(n,t-1));const s=(i+e.viewLineCount+n)/(e.pixelRatio*e.height),r=Math.floor(e.viewLineCount/s);return{typicalViewportLineCount:t,extraLinesBeforeFirstLine:i,extraLinesBeyondLastLine:n,desiredRatio:s,minimapLineCount:r}}static _computeMinimapLayout(e,t){const i=e.outerWidth,n=e.outerHeight,s=e.pixelRatio;if(!e.minimap.enabled)return{renderMinimap:0,minimapLeft:0,minimapWidth:0,minimapHeightIsEditorHeight:!1,minimapIsSampling:!1,minimapScale:1,minimapLineHeight:1,minimapCanvasInnerWidth:0,minimapCanvasInnerHeight:Math.floor(s*n),minimapCanvasOuterWidth:0,minimapCanvasOuterHeight:n};const r=t.stableMinimapLayoutInput,a=r&&e.outerHeight===r.outerHeight&&e.lineHeight===r.lineHeight&&e.typicalHalfwidthCharacterWidth===r.typicalHalfwidthCharacterWidth&&e.pixelRatio===r.pixelRatio&&e.scrollBeyondLastLine===r.scrollBeyondLastLine&&e.paddingTop===r.paddingTop&&e.paddingBottom===r.paddingBottom&&e.minimap.enabled===r.minimap.enabled&&e.minimap.side===r.minimap.side&&e.minimap.size===r.minimap.size&&e.minimap.showSlider===r.minimap.showSlider&&e.minimap.renderCharacters===r.minimap.renderCharacters&&e.minimap.maxColumn===r.minimap.maxColumn&&e.minimap.scale===r.minimap.scale&&e.verticalScrollbarWidth===r.verticalScrollbarWidth&&e.isViewportWrapping===r.isViewportWrapping,l=e.lineHeight,c=e.typicalHalfwidthCharacterWidth,d=e.scrollBeyondLastLine,h=e.minimap.renderCharacters;let u=s>=2?Math.round(e.minimap.scale*2):e.minimap.scale;const f=e.minimap.maxColumn,g=e.minimap.size,m=e.minimap.side,_=e.verticalScrollbarWidth,b=e.viewLineCount,C=e.remainingWidth,w=e.isViewportWrapping,v=h?2:3;let S=Math.floor(s*n);const L=S/s;let x=!1,I=!1,D=v*u,R=u/s,F=1;if(g==="fill"||g==="fit"){const{typicalViewportLineCount:oe,extraLinesBeforeFirstLine:fe,extraLinesBeyondLastLine:Ie,desiredRatio:Ae,minimapLineCount:tt}=t_.computeContainedMinimapLineCount({viewLineCount:b,scrollBeyondLastLine:d,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:n,lineHeight:l,pixelRatio:s});if(b/tt>1)x=!0,I=!0,u=1,D=1,R=u/s;else{let At=!1,_t=u+1;if(g==="fit"){const tn=Math.ceil((fe+b+Ie)*D);w&&a&&C<=t.stableFitRemainingWidth?(At=!0,_t=t.stableFitMaxMinimapScale):At=tn>S}if(g==="fill"||At){x=!0;const tn=u;D=Math.min(l*s,Math.max(1,Math.floor(1/Ae))),w&&a&&C<=t.stableFitRemainingWidth&&(_t=t.stableFitMaxMinimapScale),u=Math.min(_t,Math.max(1,Math.floor(D/v))),u>tn&&(F=Math.min(2,u/tn)),R=u/s/F,S=Math.ceil(Math.max(oe,fe+b+Ie)*D),w?(t.stableMinimapLayoutInput=e,t.stableFitRemainingWidth=C,t.stableFitMaxMinimapScale=u):(t.stableMinimapLayoutInput=null,t.stableFitRemainingWidth=0)}}}const O=Math.floor(f*R),B=Math.min(O,Math.max(0,Math.floor((C-_-2)*R/(c+R)))+pl);let V=Math.floor(s*B);const z=V/s;V=Math.floor(V*F);const ee=h?1:2,se=m==="left"?0:i-B-_;return{renderMinimap:ee,minimapLeft:se,minimapWidth:B,minimapHeightIsEditorHeight:x,minimapIsSampling:I,minimapScale:u,minimapLineHeight:D,minimapCanvasInnerWidth:V,minimapCanvasInnerHeight:S,minimapCanvasOuterWidth:z,minimapCanvasOuterHeight:L}}static computeLayout(e,t){const i=t.outerWidth|0,n=t.outerHeight|0,s=t.lineHeight|0,r=t.lineNumbersDigitCount|0,a=t.typicalHalfwidthCharacterWidth,l=t.maxDigitWidth,c=t.pixelRatio,d=t.viewLineCount,h=e.get(154),u=h==="inherit"?e.get(153):h,f=u==="inherit"?e.get(149):u,g=e.get(152),m=t.isDominatedByLongLines,_=e.get(66),b=e.get(76).renderType!==0,C=e.get(77),w=e.get(119),v=e.get(96),S=e.get(81),L=e.get(117),x=L.verticalScrollbarSize,I=L.verticalHasArrows,D=L.arrowSize,R=L.horizontalScrollbarSize,F=e.get(52),O=e.get(126)!=="never";let B=e.get(74);F&&O&&(B+=16);let V=0;if(b){const As=Math.max(r,C);V=Math.round(As*l)}let z=0;_&&(z=s*t.glyphMarginDecorationLaneCount);let ee=0,se=ee+z,oe=se+V,fe=oe+B;const Ie=i-z-V-B;let Ae=!1,tt=!1,Ke=-1;e.get(2)===2&&u==="inherit"&&m?(Ae=!0,tt=!0):f==="on"||f==="bounded"?tt=!0:f==="wordWrapColumn"&&(Ke=g);const At=t_._computeMinimapLayout({outerWidth:i,outerHeight:n,lineHeight:s,typicalHalfwidthCharacterWidth:a,pixelRatio:c,scrollBeyondLastLine:w,paddingTop:v.top,paddingBottom:v.bottom,minimap:S,verticalScrollbarWidth:x,viewLineCount:d,remainingWidth:Ie,isViewportWrapping:tt},t.memory||new kV);At.renderMinimap!==0&&At.minimapLeft===0&&(ee+=At.minimapWidth,se+=At.minimapWidth,oe+=At.minimapWidth,fe+=At.minimapWidth);const _t=Ie-At.minimapWidth,tn=Math.max(1,Math.floor((_t-x-2)/a)),Mi=I?D:0;return tt&&(Ke=Math.max(1,tn),f==="bounded"&&(Ke=Math.min(Ke,g))),{width:i,height:n,glyphMarginLeft:ee,glyphMarginWidth:z,glyphMarginDecorationLaneCount:t.glyphMarginDecorationLaneCount,lineNumbersLeft:se,lineNumbersWidth:V,decorationsLeft:oe,decorationsWidth:B,contentLeft:fe,contentWidth:_t,minimap:At,viewportColumn:tn,isWordWrapMinified:Ae,isViewportWrapping:tt,wrappingColumn:Ke,verticalScrollbarWidth:x,horizontalScrollbarHeight:R,overviewRuler:{top:Mi,width:x,height:n-2*Mi,right:0}}}}class Kre extends Zt{constructor(){super(156,"wrappingStrategy","simple",{"editor.wrappingStrategy":{enumDescriptions:[p(252,"Assumes that all characters are of the same width. This is a fast algorithm that works correctly for monospace fonts and certain scripts (like Latin characters) where glyphs are of equal width."),p(253,"Delegates wrapping points computation to the browser. This is a slow algorithm, that might cause freezes for large files, but it works correctly in all cases.")],type:"string",enum:["simple","advanced"],default:"simple",description:p(254,"Controls the algorithm that computes wrapping points. Note that when in accessibility mode, advanced will be used for the best experience.")}})}validate(e){return Ot(e,"simple",["simple","advanced"])}compute(e,t,i){return t.get(2)===2?"advanced":i}}var Xr;(function(o){o.Off="off",o.OnCode="onCode",o.On="on"})(Xr||(Xr={}));class Gre extends Zt{constructor(){const e={enabled:Xr.OnCode};super(73,"lightbulb",e,{"editor.lightbulb.enabled":{type:"string",enum:[Xr.Off,Xr.OnCode,Xr.On],default:e.enabled,enumDescriptions:[p(255,"Disable the code action menu."),p(256,"Show the code action menu when the cursor is on lines with code."),p(257,"Show the code action menu when the cursor is on lines with code or on empty lines.")],description:p(258,"Enables the Code Action lightbulb in the editor.")}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{enabled:Ot(e.enabled,this.defaultValue.enabled,[Xr.Off,Xr.OnCode,Xr.On])}}}class Zre extends Zt{constructor(){const e={enabled:!0,maxLineCount:5,defaultModel:"outlineModel",scrollWithEditor:!0};super(131,"stickyScroll",e,{"editor.stickyScroll.enabled":{type:"boolean",default:e.enabled,description:p(259,"Shows the nested current scopes during the scroll at the top of the editor.")},"editor.stickyScroll.maxLineCount":{type:"number",default:e.maxLineCount,minimum:1,maximum:20,description:p(260,"Defines the maximum number of sticky lines to show.")},"editor.stickyScroll.defaultModel":{type:"string",enum:["outlineModel","foldingProviderModel","indentationModel"],default:e.defaultModel,description:p(261,"Defines the model to use for determining which lines to stick. If the outline model does not exist, it will fall back on the folding provider model which falls back on the indentation model. This order is respected in all three cases.")},"editor.stickyScroll.scrollWithEditor":{type:"boolean",default:e.scrollWithEditor,description:p(262,"Enable scrolling of Sticky Scroll with the editor's horizontal scrollbar.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),maxLineCount:vt.clampedInt(t.maxLineCount,this.defaultValue.maxLineCount,1,20),defaultModel:Ot(t.defaultModel,this.defaultValue.defaultModel,["outlineModel","foldingProviderModel","indentationModel"]),scrollWithEditor:_e(t.scrollWithEditor,this.defaultValue.scrollWithEditor)}}}class Yre extends Zt{constructor(){const e={enabled:"on",fontSize:0,fontFamily:"",padding:!1,maximumLength:43};super(159,"inlayHints",e,{"editor.inlayHints.enabled":{type:"string",default:e.enabled,description:p(263,"Enables the inlay hints in the editor."),enum:["on","onUnlessPressed","offUnlessPressed","off"],markdownEnumDescriptions:[p(264,"Inlay hints are enabled"),p(265,"Inlay hints are showing by default and hide when holding {0}",ze?"Ctrl+Option":"Ctrl+Alt"),p(266,"Inlay hints are hidden by default and show when holding {0}",ze?"Ctrl+Option":"Ctrl+Alt"),p(267,"Inlay hints are disabled")]},"editor.inlayHints.fontSize":{type:"number",default:e.fontSize,markdownDescription:p(268,"Controls font size of inlay hints in the editor. As default the {0} is used when the configured value is less than {1} or greater than the editor font size.","`#editor.fontSize#`","`5`")},"editor.inlayHints.fontFamily":{type:"string",default:e.fontFamily,markdownDescription:p(269,"Controls font family of inlay hints in the editor. When set to empty, the {0} is used.","`#editor.fontFamily#`")},"editor.inlayHints.padding":{type:"boolean",default:e.padding,description:p(270,"Enables the padding around the inlay hints in the editor.")},"editor.inlayHints.maximumLength":{type:"number",default:e.maximumLength,markdownDescription:p(271,"Maximum overall length of inlay hints, for a single line, before they get truncated by the editor. Set to `0` to never truncate")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return typeof t.enabled=="boolean"&&(t.enabled=t.enabled?"on":"off"),{enabled:Ot(t.enabled,this.defaultValue.enabled,["on","off","offUnlessPressed","onUnlessPressed"]),fontSize:vt.clampedInt(t.fontSize,this.defaultValue.fontSize,0,100),fontFamily:ss.string(t.fontFamily,this.defaultValue.fontFamily),padding:_e(t.padding,this.defaultValue.padding),maximumLength:vt.clampedInt(t.maximumLength,this.defaultValue.maximumLength,0,Number.MAX_SAFE_INTEGER)}}}class Xre extends Zt{constructor(){super(74,"lineDecorationsWidth",10)}validate(e){return typeof e=="string"&&/^\d+(\.\d+)?ch$/.test(e)?-parseFloat(e.substring(0,e.length-2)):vt.clampedInt(e,this.defaultValue,0,1e3)}compute(e,t,i){return i<0?vt.clampedInt(-i*e.fontInfo.typicalHalfwidthCharacterWidth,this.defaultValue,0,1e3):i}}class Qre extends Wo{constructor(){super(75,"lineHeight",bs.lineHeight,e=>Wo.clamp(e,0,150),{markdownDescription:p(272,`Controls the line height.
- Use 0 to automatically compute the line height from the font size.
- Values between 0 and 8 will be used as a multiplier with the font size.
- Values greater than or equal to 8 will be used as effective values.`)},0,150)}compute(e,t,i){return e.fontInfo.lineHeight}}class Jre extends Zt{constructor(){const e={enabled:!0,size:"proportional",side:"right",showSlider:"mouseover",autohide:"none",renderCharacters:!0,maxColumn:120,scale:1,showRegionSectionHeaders:!0,showMarkSectionHeaders:!0,markSectionHeaderRegex:"\\bMARK:\\s*(?<separator>-?)\\s*(?<label>.*)$",sectionHeaderFontSize:9,sectionHeaderLetterSpacing:1};super(81,"minimap",e,{"editor.minimap.enabled":{type:"boolean",default:e.enabled,description:p(273,"Controls whether the minimap is shown.")},"editor.minimap.autohide":{type:"string",enum:["none","mouseover","scroll"],enumDescriptions:[p(274,"The minimap is always shown."),p(275,"The minimap is hidden when mouse is not over the minimap and shown when mouse is over the minimap."),p(276,"The minimap is only shown when the editor is scrolled")],default:e.autohide,description:p(277,"Controls whether the minimap is hidden automatically.")},"editor.minimap.size":{type:"string",enum:["proportional","fill","fit"],enumDescriptions:[p(278,"The minimap has the same size as the editor contents (and might scroll)."),p(279,"The minimap will stretch or shrink as necessary to fill the height of the editor (no scrolling)."),p(280,"The minimap will shrink as necessary to never be larger than the editor (no scrolling).")],default:e.size,description:p(281,"Controls the size of the minimap.")},"editor.minimap.side":{type:"string",enum:["left","right"],default:e.side,description:p(282,"Controls the side where to render the minimap.")},"editor.minimap.showSlider":{type:"string",enum:["always","mouseover"],default:e.showSlider,description:p(283,"Controls when the minimap slider is shown.")},"editor.minimap.scale":{type:"number",default:e.scale,minimum:1,maximum:3,enum:[1,2,3],description:p(284,"Scale of content drawn in the minimap: 1, 2 or 3.")},"editor.minimap.renderCharacters":{type:"boolean",default:e.renderCharacters,description:p(285,"Render the actual characters on a line as opposed to color blocks.")},"editor.minimap.maxColumn":{type:"number",default:e.maxColumn,description:p(286,"Limit the width of the minimap to render at most a certain number of columns.")},"editor.minimap.showRegionSectionHeaders":{type:"boolean",default:e.showRegionSectionHeaders,description:p(287,"Controls whether named regions are shown as section headers in the minimap.")},"editor.minimap.showMarkSectionHeaders":{type:"boolean",default:e.showMarkSectionHeaders,description:p(288,"Controls whether MARK: comments are shown as section headers in the minimap.")},"editor.minimap.markSectionHeaderRegex":{type:"string",default:e.markSectionHeaderRegex,description:p(289,"Defines the regular expression used to find section headers in comments. The regex must contain a named match group `label` (written as `(?<label>.+)`) that encapsulates the section header, otherwise it will not work. Optionally you can include another match group named `separator`. Use \\n in the pattern to match multi-line headers.")},"editor.minimap.sectionHeaderFontSize":{type:"number",default:e.sectionHeaderFontSize,description:p(290,"Controls the font size of section headers in the minimap.")},"editor.minimap.sectionHeaderLetterSpacing":{type:"number",default:e.sectionHeaderLetterSpacing,description:p(291,"Controls the amount of space (in pixels) between characters of section header. This helps the readability of the header in small font sizes.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;let i=this.defaultValue.markSectionHeaderRegex;const n=e.markSectionHeaderRegex;if(typeof n=="string")try{new RegExp(n,"d"),i=n}catch{}return{enabled:_e(t.enabled,this.defaultValue.enabled),autohide:Ot(t.autohide,this.defaultValue.autohide,["none","mouseover","scroll"]),size:Ot(t.size,this.defaultValue.size,["proportional","fill","fit"]),side:Ot(t.side,this.defaultValue.side,["right","left"]),showSlider:Ot(t.showSlider,this.defaultValue.showSlider,["always","mouseover"]),renderCharacters:_e(t.renderCharacters,this.defaultValue.renderCharacters),scale:vt.clampedInt(t.scale,1,1,3),maxColumn:vt.clampedInt(t.maxColumn,this.defaultValue.maxColumn,1,1e4),showRegionSectionHeaders:_e(t.showRegionSectionHeaders,this.defaultValue.showRegionSectionHeaders),showMarkSectionHeaders:_e(t.showMarkSectionHeaders,this.defaultValue.showMarkSectionHeaders),markSectionHeaderRegex:i,sectionHeaderFontSize:Wo.clamp(t.sectionHeaderFontSize??this.defaultValue.sectionHeaderFontSize,4,32),sectionHeaderLetterSpacing:Wo.clamp(t.sectionHeaderLetterSpacing??this.defaultValue.sectionHeaderLetterSpacing,0,5)}}}function eae(o){return o==="ctrlCmd"?ze?"metaKey":"ctrlKey":"altKey"}class tae extends Zt{constructor(){super(96,"padding",{top:0,bottom:0},{"editor.padding.top":{type:"number",default:0,minimum:0,maximum:1e3,description:p(292,"Controls the amount of space between the top edge of the editor and the first line.")},"editor.padding.bottom":{type:"number",default:0,minimum:0,maximum:1e3,description:p(293,"Controls the amount of space between the bottom edge of the editor and the last line.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{top:vt.clampedInt(t.top,0,0,1e3),bottom:vt.clampedInt(t.bottom,0,0,1e3)}}}class iae extends Zt{constructor(){const e={enabled:!0,cycle:!0};super(98,"parameterHints",e,{"editor.parameterHints.enabled":{type:"boolean",default:e.enabled,description:p(294,"Enables a pop-up that shows parameter documentation and type information as you type.")},"editor.parameterHints.cycle":{type:"boolean",default:e.cycle,description:p(295,"Controls whether the parameter hints menu cycles or closes when reaching the end of the list.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),cycle:_e(t.cycle,this.defaultValue.cycle)}}}class nae extends ph{constructor(){super(163)}compute(e,t,i){return e.pixelRatio}}class sae extends Zt{constructor(){super(100,"placeholder",void 0)}validate(e){return typeof e>"u"?this.defaultValue:typeof e=="string"?e:this.defaultValue}}class oae extends Zt{constructor(){const e={other:"on",comments:"off",strings:"off"},t=[{type:"boolean"},{type:"string",enum:["on","inline","off"],enumDescriptions:[p(296,"Quick suggestions show inside the suggest widget"),p(297,"Quick suggestions show as ghost text"),p(298,"Quick suggestions are disabled")]}];super(102,"quickSuggestions",e,{type:"object",additionalProperties:!1,properties:{strings:{anyOf:t,default:e.strings,description:p(299,"Enable quick suggestions inside strings.")},comments:{anyOf:t,default:e.comments,description:p(300,"Enable quick suggestions inside comments.")},other:{anyOf:t,default:e.other,description:p(301,"Enable quick suggestions outside of strings and comments.")}},default:e,markdownDescription:p(302,"Controls whether suggestions should automatically show up while typing. This can be controlled for typing in comments, strings, and other code. Quick suggestion can be configured to show as ghost text or with the suggest widget. Also be aware of the {0}-setting which controls if suggestions are triggered by special characters.","`#editor.suggestOnTriggerCharacters#`")}),this.defaultValue=e}validate(e){if(typeof e=="boolean"){const c=e?"on":"off";return{comments:c,strings:c,other:c}}if(!e||typeof e!="object")return this.defaultValue;const{other:t,comments:i,strings:n}=e,s=["on","inline","off"];let r,a,l;return typeof t=="boolean"?r=t?"on":"off":r=Ot(t,this.defaultValue.other,s),typeof i=="boolean"?a=i?"on":"off":a=Ot(i,this.defaultValue.comments,s),typeof n=="boolean"?l=n?"on":"off":l=Ot(n,this.defaultValue.strings,s),{other:r,comments:a,strings:l}}}class rae extends Zt{constructor(){super(76,"lineNumbers",{renderType:1,renderFn:null},{type:"string",enum:["off","on","relative","interval"],enumDescriptions:[p(303,"Line numbers are not rendered."),p(304,"Line numbers are rendered as absolute number."),p(305,"Line numbers are rendered as distance in lines to cursor position."),p(306,"Line numbers are rendered every 10 lines.")],default:"on",description:p(307,"Controls the display of line numbers.")})}validate(e){let t=this.defaultValue.renderType,i=this.defaultValue.renderFn;return typeof e<"u"&&(typeof e=="function"?(t=4,i=e):e==="interval"?t=3:e==="relative"?t=2:e==="on"?t=1:t=0),{renderType:t,renderFn:i}}}function gL(o){const e=o.get(112);return e==="editable"?o.get(104):e!=="on"}function pL(o){return!o.get(172)}class aae extends Zt{constructor(){const e=[],t={type:"number",description:p(308,"Number of monospace characters at which this editor ruler will render.")};super(116,"rulers",e,{type:"array",items:{anyOf:[t,{type:["object"],properties:{column:t,color:{type:"string",description:p(309,"Color of this editor ruler."),format:"color-hex"}}}]},default:e,description:p(310,"Render vertical rulers after a certain number of monospace characters. Use multiple values for multiple rulers. No rulers are drawn if array is empty.")})}validate(e){if(Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="number")t.push({column:vt.clampedInt(i,0,0,1e4),color:null});else if(i&&typeof i=="object"){const n=i;t.push({column:vt.clampedInt(n.column,0,0,1e4),color:n.color})}return t.sort((i,n)=>i.column-n.column),t}return this.defaultValue}}class lae extends Zt{constructor(){super(105,"readOnlyMessage",void 0)}validate(e){return!e||typeof e!="object"?this.defaultValue:e}}function DV(o,e){if(typeof o!="string")return e;switch(o){case"hidden":return 2;case"visible":return 3;default:return 1}}let cae=class extends Zt{constructor(){const e={vertical:1,horizontal:1,arrowSize:11,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,horizontalScrollbarSize:12,horizontalSliderSize:12,verticalScrollbarSize:14,verticalSliderSize:14,handleMouseWheel:!0,alwaysConsumeMouseWheel:!0,scrollByPage:!1,ignoreHorizontalScrollbarInContentHeight:!1};super(117,"scrollbar",e,{"editor.scrollbar.vertical":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(311,"The vertical scrollbar will be visible only when necessary."),p(312,"The vertical scrollbar will always be visible."),p(313,"The vertical scrollbar will always be hidden.")],default:"auto",description:p(314,"Controls the visibility of the vertical scrollbar.")},"editor.scrollbar.horizontal":{type:"string",enum:["auto","visible","hidden"],enumDescriptions:[p(315,"The horizontal scrollbar will be visible only when necessary."),p(316,"The horizontal scrollbar will always be visible."),p(317,"The horizontal scrollbar will always be hidden.")],default:"auto",description:p(318,"Controls the visibility of the horizontal scrollbar.")},"editor.scrollbar.verticalScrollbarSize":{type:"number",default:e.verticalScrollbarSize,description:p(319,"The width of the vertical scrollbar.")},"editor.scrollbar.horizontalScrollbarSize":{type:"number",default:e.horizontalScrollbarSize,description:p(320,"The height of the horizontal scrollbar.")},"editor.scrollbar.scrollByPage":{type:"boolean",default:e.scrollByPage,description:p(321,"Controls whether clicks scroll by page or jump to click position.")},"editor.scrollbar.ignoreHorizontalScrollbarInContentHeight":{type:"boolean",default:e.ignoreHorizontalScrollbarInContentHeight,description:p(322,"When set, the horizontal scrollbar will not increase the size of the editor's content.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e,i=vt.clampedInt(t.horizontalScrollbarSize,this.defaultValue.horizontalScrollbarSize,0,1e3),n=vt.clampedInt(t.verticalScrollbarSize,this.defaultValue.verticalScrollbarSize,0,1e3);return{arrowSize:vt.clampedInt(t.arrowSize,this.defaultValue.arrowSize,0,1e3),vertical:DV(t.vertical,this.defaultValue.vertical),horizontal:DV(t.horizontal,this.defaultValue.horizontal),useShadows:_e(t.useShadows,this.defaultValue.useShadows),verticalHasArrows:_e(t.verticalHasArrows,this.defaultValue.verticalHasArrows),horizontalHasArrows:_e(t.horizontalHasArrows,this.defaultValue.horizontalHasArrows),handleMouseWheel:_e(t.handleMouseWheel,this.defaultValue.handleMouseWheel),alwaysConsumeMouseWheel:_e(t.alwaysConsumeMouseWheel,this.defaultValue.alwaysConsumeMouseWheel),horizontalScrollbarSize:i,horizontalSliderSize:vt.clampedInt(t.horizontalSliderSize,i,0,1e3),verticalScrollbarSize:n,verticalSliderSize:vt.clampedInt(t.verticalSliderSize,n,0,1e3),scrollByPage:_e(t.scrollByPage,this.defaultValue.scrollByPage),ignoreHorizontalScrollbarInContentHeight:_e(t.ignoreHorizontalScrollbarInContentHeight,this.defaultValue.ignoreHorizontalScrollbarInContentHeight)}}};const Bo="inUntrustedWorkspace",Us={allowedCharacters:"editor.unicodeHighlight.allowedCharacters",invisibleCharacters:"editor.unicodeHighlight.invisibleCharacters",nonBasicASCII:"editor.unicodeHighlight.nonBasicASCII",ambiguousCharacters:"editor.unicodeHighlight.ambiguousCharacters",includeComments:"editor.unicodeHighlight.includeComments",includeStrings:"editor.unicodeHighlight.includeStrings",allowedLocales:"editor.unicodeHighlight.allowedLocales"};class dae extends Zt{constructor(){const e={nonBasicASCII:Bo,invisibleCharacters:!0,ambiguousCharacters:!0,includeComments:Bo,includeStrings:!0,allowedCharacters:{},allowedLocales:{_os:!0,_vscode:!0}};super(142,"unicodeHighlight",e,{[Us.nonBasicASCII]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Bo],default:e.nonBasicASCII,description:p(323,"Controls whether all non-basic ASCII characters are highlighted. Only characters between U+0020 and U+007E, tab, line-feed and carriage-return are considered basic ASCII.")},[Us.invisibleCharacters]:{restricted:!0,type:"boolean",default:e.invisibleCharacters,description:p(324,"Controls whether characters that just reserve space or have no width at all are highlighted.")},[Us.ambiguousCharacters]:{restricted:!0,type:"boolean",default:e.ambiguousCharacters,description:p(325,"Controls whether characters are highlighted that can be confused with basic ASCII characters, except those that are common in the current user locale.")},[Us.includeComments]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Bo],default:e.includeComments,description:p(326,"Controls whether characters in comments should also be subject to Unicode highlighting.")},[Us.includeStrings]:{restricted:!0,type:["boolean","string"],enum:[!0,!1,Bo],default:e.includeStrings,description:p(327,"Controls whether characters in strings should also be subject to Unicode highlighting.")},[Us.allowedCharacters]:{restricted:!0,type:"object",default:e.allowedCharacters,description:p(328,"Defines allowed characters that are not being highlighted."),additionalProperties:{type:"boolean"}},[Us.allowedLocales]:{restricted:!0,type:"object",additionalProperties:{type:"boolean"},default:e.allowedLocales,description:p(329,"Unicode characters that are common in allowed locales are not being highlighted.")}})}applyUpdate(e,t){let i=!1;t.allowedCharacters&&e&&(fo(e.allowedCharacters,t.allowedCharacters)||(e={...e,allowedCharacters:t.allowedCharacters},i=!0)),t.allowedLocales&&e&&(fo(e.allowedLocales,t.allowedLocales)||(e={...e,allowedLocales:t.allowedLocales},i=!0));const n=super.applyUpdate(e,t);return i?new O1(n.newValue,!0):n}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{nonBasicASCII:i_(t.nonBasicASCII,Bo,[!0,!1,Bo]),invisibleCharacters:_e(t.invisibleCharacters,this.defaultValue.invisibleCharacters),ambiguousCharacters:_e(t.ambiguousCharacters,this.defaultValue.ambiguousCharacters),includeComments:i_(t.includeComments,Bo,[!0,!1,Bo]),includeStrings:i_(t.includeStrings,Bo,[!0,!1,Bo]),allowedCharacters:this.validateBooleanMap(e.allowedCharacters,this.defaultValue.allowedCharacters),allowedLocales:this.validateBooleanMap(e.allowedLocales,this.defaultValue.allowedLocales)}}validateBooleanMap(e,t){if(typeof e!="object"||!e)return t;const i={};for(const[n,s]of Object.entries(e))s===!0&&(i[n]=!0);return i}}class hae extends Zt{constructor(){const e={enabled:!0,mode:"subwordSmart",showToolbar:"onHover",suppressSuggestions:!1,keepOnBlur:!1,fontFamily:"default",syntaxHighlightingEnabled:!0,minShowDelay:0,suppressInSnippetMode:!1,edits:{enabled:!0,showCollapsed:!1,renderSideBySide:"auto",allowCodeShifting:"always"},triggerCommandOnProviderChange:!0,experimental:{suppressInlineSuggestions:"",showOnSuggestConflict:"never",emptyResponseInformation:!0}};super(71,"inlineSuggest",e,{"editor.inlineSuggest.enabled":{type:"boolean",default:e.enabled,description:p(330,"Controls whether to automatically show inline suggestions in the editor.")},"editor.inlineSuggest.showToolbar":{type:"string",default:e.showToolbar,enum:["always","onHover","never"],enumDescriptions:[p(331,"Show the inline suggestion toolbar whenever an inline suggestion is shown."),p(332,"Show the inline suggestion toolbar when hovering over an inline suggestion."),p(333,"Never show the inline suggestion toolbar.")],description:p(334,"Controls when to show the inline suggestion toolbar.")},"editor.inlineSuggest.syntaxHighlightingEnabled":{type:"boolean",default:e.syntaxHighlightingEnabled,description:p(335,"Controls whether to show syntax highlighting for inline suggestions in the editor.")},"editor.inlineSuggest.suppressSuggestions":{type:"boolean",default:e.suppressSuggestions,description:p(336,"Controls how inline suggestions interact with the suggest widget. If enabled, the suggest widget is not shown automatically when inline suggestions are available.")},"editor.inlineSuggest.suppressInSnippetMode":{type:"boolean",default:e.suppressInSnippetMode,description:p(337,"Controls whether inline suggestions are suppressed when in snippet mode.")},"editor.inlineSuggest.minShowDelay":{type:"number",default:0,minimum:0,maximum:1e4,description:p(338,"Controls the minimal delay in milliseconds after which inline suggestions are shown after typing.")},"editor.inlineSuggest.experimental.suppressInlineSuggestions":{type:"string",default:e.experimental.suppressInlineSuggestions,tags:["experimental"],description:p(339,"Suppresses inline completions for specified extension IDs -- comma separated."),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.emptyResponseInformation":{type:"boolean",default:e.experimental.emptyResponseInformation,tags:["experimental"],description:p(340,"Controls whether to send request information from the inline suggestion provider."),experiment:{mode:"auto"}},"editor.inlineSuggest.triggerCommandOnProviderChange":{type:"boolean",default:e.triggerCommandOnProviderChange,tags:["experimental"],description:p(341,"Controls whether to trigger a command when the inline suggestion provider changes."),experiment:{mode:"auto"}},"editor.inlineSuggest.experimental.showOnSuggestConflict":{type:"string",default:e.experimental.showOnSuggestConflict,tags:["experimental"],enum:["always","never","whenSuggestListIsIncomplete"],description:p(342,"Controls whether to show inline suggestions when there is a suggest conflict."),experiment:{mode:"auto"}},"editor.inlineSuggest.fontFamily":{type:"string",default:e.fontFamily,description:p(343,"Controls the font family of the inline suggestions.")},"editor.inlineSuggest.edits.allowCodeShifting":{type:"string",default:e.edits.allowCodeShifting,description:p(344,"Controls whether showing a suggestion will shift the code to make space for the suggestion inline."),enum:["always","horizontal","never"],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.renderSideBySide":{type:"string",default:e.edits.renderSideBySide,description:p(345,"Controls whether larger suggestions can be shown side by side."),enum:["auto","never"],enumDescriptions:[p(346,"Larger suggestions will show side by side if there is enough space, otherwise they will be shown below."),p(347,"Larger suggestions are never shown side by side and will always be shown below.")],tags:["nextEditSuggestions"]},"editor.inlineSuggest.edits.showCollapsed":{type:"boolean",default:e.edits.showCollapsed,description:p(348,"Controls whether the suggestion will show as collapsed until jumping to it."),tags:["nextEditSuggestions"]}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),mode:Ot(t.mode,this.defaultValue.mode,["prefix","subword","subwordSmart"]),showToolbar:Ot(t.showToolbar,this.defaultValue.showToolbar,["always","onHover","never"]),suppressSuggestions:_e(t.suppressSuggestions,this.defaultValue.suppressSuggestions),keepOnBlur:_e(t.keepOnBlur,this.defaultValue.keepOnBlur),fontFamily:ss.string(t.fontFamily,this.defaultValue.fontFamily),syntaxHighlightingEnabled:_e(t.syntaxHighlightingEnabled,this.defaultValue.syntaxHighlightingEnabled),minShowDelay:vt.clampedInt(t.minShowDelay,0,0,1e4),suppressInSnippetMode:_e(t.suppressInSnippetMode,this.defaultValue.suppressInSnippetMode),edits:{enabled:_e(t.edits?.enabled,this.defaultValue.edits.enabled),showCollapsed:_e(t.edits?.showCollapsed,this.defaultValue.edits.showCollapsed),allowCodeShifting:Ot(t.edits?.allowCodeShifting,this.defaultValue.edits.allowCodeShifting,["always","horizontal","never"]),renderSideBySide:Ot(t.edits?.renderSideBySide,this.defaultValue.edits.renderSideBySide,["never","auto"])},triggerCommandOnProviderChange:_e(t.triggerCommandOnProviderChange,this.defaultValue.triggerCommandOnProviderChange),experimental:{suppressInlineSuggestions:ss.string(t.experimental?.suppressInlineSuggestions,this.defaultValue.experimental.suppressInlineSuggestions),showOnSuggestConflict:Ot(t.experimental?.showOnSuggestConflict,this.defaultValue.experimental.showOnSuggestConflict,["always","never","whenSuggestListIsIncomplete"]),emptyResponseInformation:_e(t.experimental?.emptyResponseInformation,this.defaultValue.experimental.emptyResponseInformation)}}}}class uae extends Zt{constructor(){const e={enabled:Un.bracketPairColorizationOptions.enabled,independentColorPoolPerBracketType:Un.bracketPairColorizationOptions.independentColorPoolPerBracketType};super(21,"bracketPairColorization",e,{"editor.bracketPairColorization.enabled":{type:"boolean",default:e.enabled,markdownDescription:p(349,"Controls whether bracket pair colorization is enabled or not. Use {0} to override the bracket highlight colors.","`#workbench.colorCustomizations#`")},"editor.bracketPairColorization.independentColorPoolPerBracketType":{type:"boolean",default:e.independentColorPoolPerBracketType,description:p(350,"Controls whether each bracket type has its own independent color pool.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),independentColorPoolPerBracketType:_e(t.independentColorPoolPerBracketType,this.defaultValue.independentColorPoolPerBracketType)}}}class fae extends Zt{constructor(){const e={bracketPairs:!1,bracketPairsHorizontal:"active",highlightActiveBracketPair:!0,indentation:!0,highlightActiveIndentation:!0};super(22,"guides",e,{"editor.guides.bracketPairs":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(351,"Enables bracket pair guides."),p(352,"Enables bracket pair guides only for the active bracket pair."),p(353,"Disables bracket pair guides.")],default:e.bracketPairs,description:p(354,"Controls whether bracket pair guides are enabled or not.")},"editor.guides.bracketPairsHorizontal":{type:["boolean","string"],enum:[!0,"active",!1],enumDescriptions:[p(355,"Enables horizontal guides as addition to vertical bracket pair guides."),p(356,"Enables horizontal guides only for the active bracket pair."),p(357,"Disables horizontal bracket pair guides.")],default:e.bracketPairsHorizontal,description:p(358,"Controls whether horizontal bracket pair guides are enabled or not.")},"editor.guides.highlightActiveBracketPair":{type:"boolean",default:e.highlightActiveBracketPair,description:p(359,"Controls whether the editor should highlight the active bracket pair.")},"editor.guides.indentation":{type:"boolean",default:e.indentation,description:p(360,"Controls whether the editor should render indent guides.")},"editor.guides.highlightActiveIndentation":{type:["boolean","string"],enum:[!0,"always",!1],enumDescriptions:[p(361,"Highlights the active indent guide."),p(362,"Highlights the active indent guide even if bracket guides are highlighted."),p(363,"Do not highlight the active indent guide.")],default:e.highlightActiveIndentation,description:p(364,"Controls whether the editor should highlight the active indent guide.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{bracketPairs:i_(t.bracketPairs,this.defaultValue.bracketPairs,[!0,!1,"active"]),bracketPairsHorizontal:i_(t.bracketPairsHorizontal,this.defaultValue.bracketPairsHorizontal,[!0,!1,"active"]),highlightActiveBracketPair:_e(t.highlightActiveBracketPair,this.defaultValue.highlightActiveBracketPair),indentation:_e(t.indentation,this.defaultValue.indentation),highlightActiveIndentation:i_(t.highlightActiveIndentation,this.defaultValue.highlightActiveIndentation,[!0,!1,"always"])}}}function i_(o,e,t){const i=t.indexOf(o);return i===-1?e:t[i]}class gae extends Zt{constructor(){const e={insertMode:"insert",filterGraceful:!0,snippetsPreventQuickSuggestions:!1,localityBonus:!1,shareSuggestSelections:!1,selectionMode:"always",showIcons:!0,showStatusBar:!1,preview:!1,previewMode:"subwordSmart",showInlineDetails:!0,showMethods:!0,showFunctions:!0,showConstructors:!0,showDeprecated:!0,matchOnWordStartOnly:!0,showFields:!0,showVariables:!0,showClasses:!0,showStructs:!0,showInterfaces:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showConstants:!0,showEnums:!0,showEnumMembers:!0,showKeywords:!0,showWords:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showSnippets:!0,showUsers:!0,showIssues:!0};super(134,"suggest",e,{"editor.suggest.insertMode":{type:"string",enum:["insert","replace"],enumDescriptions:[p(365,"Insert suggestion without overwriting text right of the cursor."),p(366,"Insert suggestion and overwrite text right of the cursor.")],default:e.insertMode,description:p(367,"Controls whether words are overwritten when accepting completions. Note that this depends on extensions opting into this feature.")},"editor.suggest.filterGraceful":{type:"boolean",default:e.filterGraceful,description:p(368,"Controls whether filtering and sorting suggestions accounts for small typos.")},"editor.suggest.localityBonus":{type:"boolean",default:e.localityBonus,description:p(369,"Controls whether sorting favors words that appear close to the cursor.")},"editor.suggest.shareSuggestSelections":{type:"boolean",default:e.shareSuggestSelections,markdownDescription:p(370,"Controls whether remembered suggestion selections are shared between multiple workspaces and windows (needs `#editor.suggestSelection#`).")},"editor.suggest.selectionMode":{type:"string",enum:["always","never","whenTriggerCharacter","whenQuickSuggestion"],enumDescriptions:[p(371,"Always select a suggestion when automatically triggering IntelliSense."),p(372,"Never select a suggestion when automatically triggering IntelliSense."),p(373,"Select a suggestion only when triggering IntelliSense from a trigger character."),p(374,"Select a suggestion only when triggering IntelliSense as you type.")],default:e.selectionMode,markdownDescription:p(375,"Controls whether a suggestion is selected when the widget shows. Note that this only applies to automatically triggered suggestions ({0} and {1}) and that a suggestion is always selected when explicitly invoked, e.g via `Ctrl+Space`.","`#editor.quickSuggestions#`","`#editor.suggestOnTriggerCharacters#`")},"editor.suggest.snippetsPreventQuickSuggestions":{type:"boolean",default:e.snippetsPreventQuickSuggestions,description:p(376,"Controls whether an active snippet prevents quick suggestions.")},"editor.suggest.showIcons":{type:"boolean",default:e.showIcons,description:p(377,"Controls whether to show or hide icons in suggestions.")},"editor.suggest.showStatusBar":{type:"boolean",default:e.showStatusBar,description:p(378,"Controls the visibility of the status bar at the bottom of the suggest widget.")},"editor.suggest.preview":{type:"boolean",default:e.preview,description:p(379,"Controls whether to preview the suggestion outcome in the editor.")},"editor.suggest.showInlineDetails":{type:"boolean",default:e.showInlineDetails,description:p(380,"Controls whether suggest details show inline with the label or only in the details widget.")},"editor.suggest.maxVisibleSuggestions":{type:"number",deprecationMessage:p(381,"This setting is deprecated. The suggest widget can now be resized.")},"editor.suggest.filteredTypes":{type:"object",deprecationMessage:p(382,"This setting is deprecated, please use separate settings like 'editor.suggest.showKeywords' or 'editor.suggest.showSnippets' instead.")},"editor.suggest.showMethods":{type:"boolean",default:!0,markdownDescription:p(383,"When enabled IntelliSense shows `method`-suggestions.")},"editor.suggest.showFunctions":{type:"boolean",default:!0,markdownDescription:p(384,"When enabled IntelliSense shows `function`-suggestions.")},"editor.suggest.showConstructors":{type:"boolean",default:!0,markdownDescription:p(385,"When enabled IntelliSense shows `constructor`-suggestions.")},"editor.suggest.showDeprecated":{type:"boolean",default:!0,markdownDescription:p(386,"When enabled IntelliSense shows `deprecated`-suggestions.")},"editor.suggest.matchOnWordStartOnly":{type:"boolean",default:!0,markdownDescription:p(387,"When enabled IntelliSense filtering requires that the first character matches on a word start. For example, `c` on `Console` or `WebContext` but _not_ on `description`. When disabled IntelliSense will show more results but still sorts them by match quality.")},"editor.suggest.showFields":{type:"boolean",default:!0,markdownDescription:p(388,"When enabled IntelliSense shows `field`-suggestions.")},"editor.suggest.showVariables":{type:"boolean",default:!0,markdownDescription:p(389,"When enabled IntelliSense shows `variable`-suggestions.")},"editor.suggest.showClasses":{type:"boolean",default:!0,markdownDescription:p(390,"When enabled IntelliSense shows `class`-suggestions.")},"editor.suggest.showStructs":{type:"boolean",default:!0,markdownDescription:p(391,"When enabled IntelliSense shows `struct`-suggestions.")},"editor.suggest.showInterfaces":{type:"boolean",default:!0,markdownDescription:p(392,"When enabled IntelliSense shows `interface`-suggestions.")},"editor.suggest.showModules":{type:"boolean",default:!0,markdownDescription:p(393,"When enabled IntelliSense shows `module`-suggestions.")},"editor.suggest.showProperties":{type:"boolean",default:!0,markdownDescription:p(394,"When enabled IntelliSense shows `property`-suggestions.")},"editor.suggest.showEvents":{type:"boolean",default:!0,markdownDescription:p(395,"When enabled IntelliSense shows `event`-suggestions.")},"editor.suggest.showOperators":{type:"boolean",default:!0,markdownDescription:p(396,"When enabled IntelliSense shows `operator`-suggestions.")},"editor.suggest.showUnits":{type:"boolean",default:!0,markdownDescription:p(397,"When enabled IntelliSense shows `unit`-suggestions.")},"editor.suggest.showValues":{type:"boolean",default:!0,markdownDescription:p(398,"When enabled IntelliSense shows `value`-suggestions.")},"editor.suggest.showConstants":{type:"boolean",default:!0,markdownDescription:p(399,"When enabled IntelliSense shows `constant`-suggestions.")},"editor.suggest.showEnums":{type:"boolean",default:!0,markdownDescription:p(400,"When enabled IntelliSense shows `enum`-suggestions.")},"editor.suggest.showEnumMembers":{type:"boolean",default:!0,markdownDescription:p(401,"When enabled IntelliSense shows `enumMember`-suggestions.")},"editor.suggest.showKeywords":{type:"boolean",default:!0,markdownDescription:p(402,"When enabled IntelliSense shows `keyword`-suggestions.")},"editor.suggest.showWords":{type:"boolean",default:!0,markdownDescription:p(403,"When enabled IntelliSense shows `text`-suggestions.")},"editor.suggest.showColors":{type:"boolean",default:!0,markdownDescription:p(404,"When enabled IntelliSense shows `color`-suggestions.")},"editor.suggest.showFiles":{type:"boolean",default:!0,markdownDescription:p(405,"When enabled IntelliSense shows `file`-suggestions.")},"editor.suggest.showReferences":{type:"boolean",default:!0,markdownDescription:p(406,"When enabled IntelliSense shows `reference`-suggestions.")},"editor.suggest.showCustomcolors":{type:"boolean",default:!0,markdownDescription:p(407,"When enabled IntelliSense shows `customcolor`-suggestions.")},"editor.suggest.showFolders":{type:"boolean",default:!0,markdownDescription:p(408,"When enabled IntelliSense shows `folder`-suggestions.")},"editor.suggest.showTypeParameters":{type:"boolean",default:!0,markdownDescription:p(409,"When enabled IntelliSense shows `typeParameter`-suggestions.")},"editor.suggest.showSnippets":{type:"boolean",default:!0,markdownDescription:p(410,"When enabled IntelliSense shows `snippet`-suggestions.")},"editor.suggest.showUsers":{type:"boolean",default:!0,markdownDescription:p(411,"When enabled IntelliSense shows `user`-suggestions.")},"editor.suggest.showIssues":{type:"boolean",default:!0,markdownDescription:p(412,"When enabled IntelliSense shows `issues`-suggestions.")}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{insertMode:Ot(t.insertMode,this.defaultValue.insertMode,["insert","replace"]),filterGraceful:_e(t.filterGraceful,this.defaultValue.filterGraceful),snippetsPreventQuickSuggestions:_e(t.snippetsPreventQuickSuggestions,this.defaultValue.filterGraceful),localityBonus:_e(t.localityBonus,this.defaultValue.localityBonus),shareSuggestSelections:_e(t.shareSuggestSelections,this.defaultValue.shareSuggestSelections),selectionMode:Ot(t.selectionMode,this.defaultValue.selectionMode,["always","never","whenQuickSuggestion","whenTriggerCharacter"]),showIcons:_e(t.showIcons,this.defaultValue.showIcons),showStatusBar:_e(t.showStatusBar,this.defaultValue.showStatusBar),preview:_e(t.preview,this.defaultValue.preview),previewMode:Ot(t.previewMode,this.defaultValue.previewMode,["prefix","subword","subwordSmart"]),showInlineDetails:_e(t.showInlineDetails,this.defaultValue.showInlineDetails),showMethods:_e(t.showMethods,this.defaultValue.showMethods),showFunctions:_e(t.showFunctions,this.defaultValue.showFunctions),showConstructors:_e(t.showConstructors,this.defaultValue.showConstructors),showDeprecated:_e(t.showDeprecated,this.defaultValue.showDeprecated),matchOnWordStartOnly:_e(t.matchOnWordStartOnly,this.defaultValue.matchOnWordStartOnly),showFields:_e(t.showFields,this.defaultValue.showFields),showVariables:_e(t.showVariables,this.defaultValue.showVariables),showClasses:_e(t.showClasses,this.defaultValue.showClasses),showStructs:_e(t.showStructs,this.defaultValue.showStructs),showInterfaces:_e(t.showInterfaces,this.defaultValue.showInterfaces),showModules:_e(t.showModules,this.defaultValue.showModules),showProperties:_e(t.showProperties,this.defaultValue.showProperties),showEvents:_e(t.showEvents,this.defaultValue.showEvents),showOperators:_e(t.showOperators,this.defaultValue.showOperators),showUnits:_e(t.showUnits,this.defaultValue.showUnits),showValues:_e(t.showValues,this.defaultValue.showValues),showConstants:_e(t.showConstants,this.defaultValue.showConstants),showEnums:_e(t.showEnums,this.defaultValue.showEnums),showEnumMembers:_e(t.showEnumMembers,this.defaultValue.showEnumMembers),showKeywords:_e(t.showKeywords,this.defaultValue.showKeywords),showWords:_e(t.showWords,this.defaultValue.showWords),showColors:_e(t.showColors,this.defaultValue.showColors),showFiles:_e(t.showFiles,this.defaultValue.showFiles),showReferences:_e(t.showReferences,this.defaultValue.showReferences),showFolders:_e(t.showFolders,this.defaultValue.showFolders),showTypeParameters:_e(t.showTypeParameters,this.defaultValue.showTypeParameters),showSnippets:_e(t.showSnippets,this.defaultValue.showSnippets),showUsers:_e(t.showUsers,this.defaultValue.showUsers),showIssues:_e(t.showIssues,this.defaultValue.showIssues)}}}class pae extends Zt{constructor(){super(129,"smartSelect",{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},{"editor.smartSelect.selectLeadingAndTrailingWhitespace":{description:p(413,"Whether leading and trailing whitespace should always be selected."),default:!0,type:"boolean"},"editor.smartSelect.selectSubwords":{description:p(414,"Whether subwords (like 'foo' in 'fooBar' or 'foo_bar') should be selected."),default:!0,type:"boolean"}})}validate(e){return!e||typeof e!="object"?this.defaultValue:{selectLeadingAndTrailingWhitespace:_e(e.selectLeadingAndTrailingWhitespace,this.defaultValue.selectLeadingAndTrailingWhitespace),selectSubwords:_e(e.selectSubwords,this.defaultValue.selectSubwords)}}}class mae extends Zt{constructor(){const e=[];super(147,"wordSegmenterLocales",e,{anyOf:[{type:"string"},{type:"array",items:{type:"string"}}],description:p(415,"Locales to be used for word segmentation when doing word related navigations or operations. Specify the BCP 47 language tag of the word you wish to recognize (e.g., ja, zh-CN, zh-Hant-TW, etc.)."),type:"array",items:{type:"string"},default:e})}validate(e){if(typeof e=="string"&&(e=[e]),Array.isArray(e)){const t=[];for(const i of e)if(typeof i=="string")try{Intl.Segmenter.supportedLocalesOf(i).length>0&&t.push(i)}catch{}return t}return this.defaultValue}}class _ae extends Zt{constructor(){super(155,"wrappingIndent",1,{"editor.wrappingIndent":{type:"string",enum:["none","same","indent","deepIndent"],enumDescriptions:[p(416,"No indentation. Wrapped lines begin at column 1."),p(417,"Wrapped lines get the same indentation as the parent."),p(418,"Wrapped lines get +1 indentation toward the parent."),p(419,"Wrapped lines get +2 indentation toward the parent.")],description:p(420,"Controls the indentation of wrapped lines."),default:"same"}})}validate(e){switch(e){case"none":return 0;case"same":return 1;case"indent":return 2;case"deepIndent":return 3}return 1}compute(e,t,i){return t.get(2)===2?0:i}}class bae extends ph{constructor(){super(166)}compute(e,t,i){const n=t.get(165);return{isDominatedByLongLines:e.isDominatedByLongLines,isWordWrapMinified:n.isWordWrapMinified,isViewportWrapping:n.isViewportWrapping,wrappingColumn:n.wrappingColumn}}}class Cae extends Zt{constructor(){const e={enabled:!0,showDropSelector:"afterDrop"};super(43,"dropIntoEditor",e,{"editor.dropIntoEditor.enabled":{type:"boolean",default:e.enabled,markdownDescription:p(421,"Controls whether you can drag and drop a file into a text editor by holding down the `Shift` key (instead of opening the file in an editor).")},"editor.dropIntoEditor.showDropSelector":{type:"string",markdownDescription:p(422,"Controls if a widget is shown when dropping files into the editor. This widget lets you control how the file is dropped."),enum:["afterDrop","never"],enumDescriptions:[p(423,"Show the drop selector widget after a file is dropped into the editor."),p(424,"Never show the drop selector widget. Instead the default drop provider is always used.")],default:"afterDrop"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),showDropSelector:Ot(t.showDropSelector,this.defaultValue.showDropSelector,["afterDrop","never"])}}}class vae extends Zt{constructor(){const e={enabled:!0,showPasteSelector:"afterPaste"};super(97,"pasteAs",e,{"editor.pasteAs.enabled":{type:"boolean",default:e.enabled,markdownDescription:p(425,"Controls whether you can paste content in different ways.")},"editor.pasteAs.showPasteSelector":{type:"string",markdownDescription:p(426,"Controls if a widget is shown when pasting content in to the editor. This widget lets you control how the file is pasted."),enum:["afterPaste","never"],enumDescriptions:[p(427,"Show the paste selector widget after content is pasted into the editor."),p(428,"Never show the paste selector widget. Instead the default pasting behavior is always used.")],default:"afterPaste"}})}validate(e){if(!e||typeof e!="object")return this.defaultValue;const t=e;return{enabled:_e(t.enabled,this.defaultValue.enabled),showPasteSelector:Ot(t.showPasteSelector,this.defaultValue.showPasteSelector,["afterPaste","never"])}}}const bs={fontFamily:ze?"Menlo, Monaco, 'Courier New', monospace":gn?"Consolas, 'Courier New', monospace":"'Droid Sans Mono', 'monospace', monospace",fontWeight:"normal",fontSize:ze?12:14,lineHeight:0,letterSpacing:0},n_=[];function X(o){return n_[o.id]=o,o}const Da={acceptSuggestionOnCommitCharacter:X(new Ve(0,"acceptSuggestionOnCommitCharacter",!0,{markdownDescription:p(429,"Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (`;`) can be a commit character that accepts a suggestion and types that character.")})),acceptSuggestionOnEnter:X(new Yt(1,"acceptSuggestionOnEnter","on",["on","smart","off"],{markdownEnumDescriptions:["",p(430,"Only accept a suggestion with `Enter` when it makes a textual change."),""],markdownDescription:p(431,"Controls whether suggestions should be accepted on `Enter`, in addition to `Tab`. Helps to avoid ambiguity between inserting new lines or accepting suggestions.")})),accessibilitySupport:X(new Pre),accessibilityPageSize:X(new vt(3,"accessibilityPageSize",500,1,1073741824,{description:p(432,"Controls the number of lines in the editor that can be read out by a screen reader at once. When we detect a screen reader we automatically set the default to be 500. Warning: this has a performance implication for numbers larger than the default."),tags:["accessibility"]})),allowOverflow:X(new Ve(4,"allowOverflow",!0)),allowVariableLineHeights:X(new Ve(5,"allowVariableLineHeights",!0,{description:p(433,"Controls whether to allow using variable line heights in the editor.")})),allowVariableFonts:X(new Ve(6,"allowVariableFonts",!0,{description:p(434,"Controls whether to allow using variable fonts in the editor.")})),allowVariableFontsInAccessibilityMode:X(new Ve(7,"allowVariableFontsInAccessibilityMode",!1,{description:p(435,"Controls whether to allow using variable fonts in the editor in the accessibility mode."),tags:["accessibility"]})),ariaLabel:X(new ss(8,"ariaLabel",p(436,"Editor content"))),ariaRequired:X(new Ve(9,"ariaRequired",!1,void 0)),screenReaderAnnounceInlineSuggestion:X(new Ve(12,"screenReaderAnnounceInlineSuggestion",!0,{description:p(437,"Control whether inline suggestions are announced by a screen reader."),tags:["accessibility"]})),autoClosingBrackets:X(new Yt(10,"autoClosingBrackets","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(438,"Use language configurations to determine when to autoclose brackets."),p(439,"Autoclose brackets only when the cursor is to the left of whitespace."),""],description:p(440,"Controls whether the editor should automatically close brackets after the user adds an opening bracket.")})),autoClosingComments:X(new Yt(11,"autoClosingComments","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(441,"Use language configurations to determine when to autoclose comments."),p(442,"Autoclose comments only when the cursor is to the left of whitespace."),""],description:p(443,"Controls whether the editor should automatically close comments after the user adds an opening comment.")})),autoClosingDelete:X(new Yt(13,"autoClosingDelete","auto",["always","auto","never"],{enumDescriptions:["",p(444,"Remove adjacent closing quotes or brackets only if they were automatically inserted."),""],description:p(445,"Controls whether the editor should remove adjacent closing quotes or brackets when deleting.")})),autoClosingOvertype:X(new Yt(14,"autoClosingOvertype","auto",["always","auto","never"],{enumDescriptions:["",p(446,"Type over closing quotes or brackets only if they were automatically inserted."),""],description:p(447,"Controls whether the editor should type over closing quotes or brackets.")})),autoClosingQuotes:X(new Yt(15,"autoClosingQuotes","languageDefined",["always","languageDefined","beforeWhitespace","never"],{enumDescriptions:["",p(448,"Use language configurations to determine when to autoclose quotes."),p(449,"Autoclose quotes only when the cursor is to the left of whitespace."),""],description:p(450,"Controls whether the editor should automatically close quotes after the user adds an opening quote.")})),autoIndent:X(new F1(16,"autoIndent",4,"full",["none","keep","brackets","advanced","full"],Mre,{enumDescriptions:[p(451,"The editor will not insert indentation automatically."),p(452,"The editor will keep the current line's indentation."),p(453,"The editor will keep the current line's indentation and honor language defined brackets."),p(454,"The editor will keep the current line's indentation, honor language defined brackets and invoke special onEnterRules defined by languages."),p(455,"The editor will keep the current line's indentation, honor language defined brackets, invoke special onEnterRules defined by languages, and honor indentationRules defined by languages.")],description:p(456,"Controls whether the editor should automatically adjust the indentation when users type, paste, move or indent lines.")})),autoIndentOnPaste:X(new Ve(17,"autoIndentOnPaste",!1,{description:p(457,"Controls whether the editor should automatically auto-indent the pasted content.")})),autoIndentOnPasteWithinString:X(new Ve(18,"autoIndentOnPasteWithinString",!0,{description:p(458,"Controls whether the editor should automatically auto-indent the pasted content when pasted within a string. This takes effect when autoIndentOnPaste is true.")})),automaticLayout:X(new Ve(19,"automaticLayout",!1)),autoSurround:X(new Yt(20,"autoSurround","languageDefined",["languageDefined","quotes","brackets","never"],{enumDescriptions:[p(459,"Use language configurations to determine when to automatically surround selections."),p(460,"Surround with quotes but not brackets."),p(461,"Surround with brackets but not quotes."),""],description:p(462,"Controls whether the editor should automatically surround selections when typing quotes or brackets.")})),bracketPairColorization:X(new uae),bracketPairGuides:X(new fae),stickyTabStops:X(new Ve(132,"stickyTabStops",!1,{description:p(463,"Emulate selection behavior of tab characters when using spaces for indentation. Selection will stick to tab stops.")})),codeLens:X(new Ve(23,"codeLens",!0,{description:p(464,"Controls whether the editor shows CodeLens.")})),codeLensFontFamily:X(new ss(24,"codeLensFontFamily","",{description:p(465,"Controls the font family for CodeLens.")})),codeLensFontSize:X(new vt(25,"codeLensFontSize",0,0,100,{type:"number",default:0,minimum:0,maximum:100,markdownDescription:p(466,"Controls the font size in pixels for CodeLens. When set to 0, 90% of `#editor.fontSize#` is used.")})),colorDecorators:X(new Ve(26,"colorDecorators",!0,{description:p(467,"Controls whether the editor should render the inline color decorators and color picker.")})),colorDecoratorActivatedOn:X(new Yt(168,"colorDecoratorsActivatedOn","clickAndHover",["clickAndHover","hover","click"],{enumDescriptions:[p(468,"Make the color picker appear both on click and hover of the color decorator"),p(469,"Make the color picker appear on hover of the color decorator"),p(470,"Make the color picker appear on click of the color decorator")],description:p(471,"Controls the condition to make a color picker appear from a color decorator.")})),colorDecoratorsLimit:X(new vt(27,"colorDecoratorsLimit",500,1,1e6,{markdownDescription:p(472,"Controls the max number of color decorators that can be rendered in an editor at once.")})),columnSelection:X(new Ve(28,"columnSelection",!1,{description:p(473,"Enable that the selection with the mouse and keys is doing column selection.")})),comments:X(new Are),contextmenu:X(new Ve(30,"contextmenu",!0)),copyWithSyntaxHighlighting:X(new Ve(31,"copyWithSyntaxHighlighting",!0,{description:p(474,"Controls whether syntax highlighting should be copied into the clipboard.")})),cursorBlinking:X(new F1(32,"cursorBlinking",1,"blink",["blink","smooth","phase","expand","solid"],Ore,{description:p(475,"Control the cursor animation style.")})),cursorSmoothCaretAnimation:X(new Yt(33,"cursorSmoothCaretAnimation","off",["off","explicit","on"],{enumDescriptions:[p(476,"Smooth caret animation is disabled."),p(477,"Smooth caret animation is enabled only when the user moves the cursor with an explicit gesture."),p(478,"Smooth caret animation is always enabled.")],description:p(479,"Controls whether the smooth caret animation should be enabled.")})),cursorStyle:X(new F1(34,"cursorStyle",hn.Line,"line",["line","block","underline","line-thin","block-outline","underline-thin"],IV,{description:p(480,"Controls the cursor style in insert input mode.")})),overtypeCursorStyle:X(new F1(92,"overtypeCursorStyle",hn.Block,"block",["line","block","underline","line-thin","block-outline","underline-thin"],IV,{description:p(481,"Controls the cursor style in overtype input mode.")})),cursorSurroundingLines:X(new vt(35,"cursorSurroundingLines",0,0,1073741824,{description:p(482,"Controls the minimal number of visible leading lines (minimum 0) and trailing lines (minimum 1) surrounding the cursor. Known as 'scrollOff' or 'scrollOffset' in some other editors.")})),cursorSurroundingLinesStyle:X(new Yt(36,"cursorSurroundingLinesStyle","default",["default","all"],{enumDescriptions:[p(483,"`cursorSurroundingLines` is enforced only when triggered via the keyboard or API."),p(484,"`cursorSurroundingLines` is enforced always.")],markdownDescription:p(485,"Controls when `#editor.cursorSurroundingLines#` should be enforced.")})),cursorWidth:X(new vt(37,"cursorWidth",0,0,1073741824,{markdownDescription:p(486,"Controls the width of the cursor when `#editor.cursorStyle#` is set to `line`.")})),cursorHeight:X(new vt(38,"cursorHeight",0,0,1073741824,{markdownDescription:p(487,"Controls the height of the cursor when `#editor.cursorStyle#` is set to `line`. Cursor's max height depends on line height.")})),disableLayerHinting:X(new Ve(39,"disableLayerHinting",!1)),disableMonospaceOptimizations:X(new Ve(40,"disableMonospaceOptimizations",!1)),domReadOnly:X(new Ve(41,"domReadOnly",!1)),dragAndDrop:X(new Ve(42,"dragAndDrop",!0,{description:p(488,"Controls whether the editor should allow moving selections via drag and drop.")})),emptySelectionClipboard:X(new Wre),dropIntoEditor:X(new Cae),editContext:X(new Ve(44,"editContext",!0,{description:p(489,"Sets whether the EditContext API should be used instead of the text area to power input in the editor."),included:QT||VB||ma})),renderRichScreenReaderContent:X(new Ve(107,"renderRichScreenReaderContent",!1,{markdownDescription:p(490,"Whether to render rich screen reader content when the `#editor.editContext#` setting is enabled.")})),stickyScroll:X(new Zre),experimentalGpuAcceleration:X(new Yt(46,"experimentalGpuAcceleration","off",["off","on"],{tags:["experimental"],enumDescriptions:[p(491,"Use regular DOM-based rendering."),p(492,"Use GPU acceleration.")],description:p(493,"Controls whether to use the experimental GPU acceleration to render the editor.")})),experimentalWhitespaceRendering:X(new Yt(47,"experimentalWhitespaceRendering","svg",["svg","font","off"],{enumDescriptions:[p(494,"Use a new rendering method with svgs."),p(495,"Use a new rendering method with font characters."),p(496,"Use the stable rendering method.")],description:p(497,"Controls whether whitespace is rendered with a new, experimental method.")})),extraEditorClassName:X(new ss(48,"extraEditorClassName","")),fastScrollSensitivity:X(new Wo(49,"fastScrollSensitivity",5,o=>o<=0?5:o,{markdownDescription:p(498,"Scrolling speed multiplier when pressing `Alt`.")})),find:X(new Bre),fixedOverflowWidgets:X(new Ve(51,"fixedOverflowWidgets",!1)),folding:X(new Ve(52,"folding",!0,{description:p(499,"Controls whether the editor has code folding enabled.")})),foldingStrategy:X(new Yt(53,"foldingStrategy","auto",["auto","indentation"],{enumDescriptions:[p(500,"Use a language-specific folding strategy if available, else the indentation-based one."),p(501,"Use the indentation-based folding strategy.")],description:p(502,"Controls the strategy for computing folding ranges.")})),foldingHighlight:X(new Ve(54,"foldingHighlight",!0,{description:p(503,"Controls whether the editor should highlight folded ranges.")})),foldingImportsByDefault:X(new Ve(55,"foldingImportsByDefault",!1,{description:p(504,"Controls whether the editor automatically collapses import ranges.")})),foldingMaximumRegions:X(new vt(56,"foldingMaximumRegions",5e3,10,65e3,{description:p(505,"The maximum number of foldable regions. Increasing this value may result in the editor becoming less responsive when the current source has a large number of foldable regions.")})),unfoldOnClickAfterEndOfLine:X(new Ve(57,"unfoldOnClickAfterEndOfLine",!1,{description:p(506,"Controls whether clicking on the empty content after a folded line will unfold the line.")})),fontFamily:X(new ss(58,"fontFamily",bs.fontFamily,{description:p(507,"Controls the font family.")})),fontInfo:X(new Hre),fontLigatures2:X(new Fc),fontSize:X(new $re),fontWeight:X(new K2),fontVariations:X(new W1),formatOnPaste:X(new Ve(64,"formatOnPaste",!1,{description:p(508,"Controls whether the editor should automatically format the pasted content. A formatter must be available and the formatter should be able to format a range in a document.")})),formatOnType:X(new Ve(65,"formatOnType",!1,{description:p(509,"Controls whether the editor should automatically format the line after typing.")})),glyphMargin:X(new Ve(66,"glyphMargin",!0,{description:p(510,"Controls whether the editor should render the vertical glyph margin. Glyph margin is mostly used for debugging.")})),gotoLocation:X(new jre),hideCursorInOverviewRuler:X(new Ve(68,"hideCursorInOverviewRuler",!1,{description:p(511,"Controls whether the cursor should be hidden in the overview ruler.")})),hover:X(new qre),inDiffEditor:X(new Ve(70,"inDiffEditor",!1)),inertialScroll:X(new Ve(158,"inertialScroll",!1,{description:p(512,"Make scrolling inertial - mostly useful with touchpad on linux.")})),letterSpacing:X(new Wo(72,"letterSpacing",bs.letterSpacing,o=>Wo.clamp(o,-5,20),{description:p(513,"Controls the letter spacing in pixels.")})),lightbulb:X(new Gre),lineDecorationsWidth:X(new Xre),lineHeight:X(new Qre),lineNumbers:X(new rae),lineNumbersMinChars:X(new vt(77,"lineNumbersMinChars",5,1,300)),linkedEditing:X(new Ve(78,"linkedEditing",!1,{description:p(514,"Controls whether the editor has linked editing enabled. Depending on the language, related symbols such as HTML tags, are updated while editing.")})),links:X(new Ve(79,"links",!0,{description:p(515,"Controls whether the editor should detect links and make them clickable.")})),matchBrackets:X(new Yt(80,"matchBrackets","always",["always","near","never"],{description:p(516,"Highlight matching brackets.")})),minimap:X(new Jre),mouseStyle:X(new Yt(82,"mouseStyle","text",["text","default","copy"])),mouseWheelScrollSensitivity:X(new Wo(83,"mouseWheelScrollSensitivity",1,o=>o===0?1:o,{markdownDescription:p(517,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")})),mouseWheelZoom:X(new Ve(84,"mouseWheelZoom",!1,{markdownDescription:ze?p(518,"Zoom the font of the editor when using mouse wheel and holding `Cmd`."):p(519,"Zoom the font of the editor when using mouse wheel and holding `Ctrl`.")})),multiCursorMergeOverlapping:X(new Ve(85,"multiCursorMergeOverlapping",!0,{description:p(520,"Merge multiple cursors when they are overlapping.")})),multiCursorModifier:X(new F1(86,"multiCursorModifier","altKey","alt",["ctrlCmd","alt"],eae,{markdownEnumDescriptions:[p(521,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),p(522,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],markdownDescription:p(523,"The modifier to be used to add multiple cursors with the mouse. The Go to Definition and Open Link mouse gestures will adapt such that they do not conflict with the [multicursor modifier](https://code.visualstudio.com/docs/editor/codebasics#_multicursor-modifier).")})),mouseMiddleClickAction:X(new Yt(87,"mouseMiddleClickAction","default",["default","openLink","ctrlLeftClick"],{description:p(524,"Controls what happens when middle mouse button is clicked in the editor.")})),multiCursorPaste:X(new Yt(88,"multiCursorPaste","spread",["spread","full"],{markdownEnumDescriptions:[p(525,"Each cursor pastes a single line of the text."),p(526,"Each cursor pastes the full text.")],markdownDescription:p(527,"Controls pasting when the line count of the pasted text matches the cursor count.")})),multiCursorLimit:X(new vt(89,"multiCursorLimit",1e4,1,1e5,{markdownDescription:p(528,"Controls the max number of cursors that can be in an active editor at once.")})),occurrencesHighlight:X(new Yt(90,"occurrencesHighlight","singleFile",["off","singleFile","multiFile"],{markdownEnumDescriptions:[p(529,"Does not highlight occurrences."),p(530,"Highlights occurrences only in the current file."),p(531,"Experimental: Highlights occurrences across all valid open files.")],markdownDescription:p(532,"Controls whether occurrences should be highlighted across open files.")})),occurrencesHighlightDelay:X(new vt(91,"occurrencesHighlightDelay",0,0,2e3,{description:p(533,"Controls the delay in milliseconds after which occurrences are highlighted."),tags:["preview"]})),overtypeOnPaste:X(new Ve(93,"overtypeOnPaste",!0,{description:p(534,"Controls whether pasting should overtype.")})),overviewRulerBorder:X(new Ve(94,"overviewRulerBorder",!0,{description:p(535,"Controls whether a border should be drawn around the overview ruler.")})),overviewRulerLanes:X(new vt(95,"overviewRulerLanes",3,0,3)),padding:X(new tae),pasteAs:X(new vae),parameterHints:X(new iae),peekWidgetDefaultFocus:X(new Yt(99,"peekWidgetDefaultFocus","tree",["tree","editor"],{enumDescriptions:[p(536,"Focus the tree when opening peek"),p(537,"Focus the editor when opening peek")],description:p(538,"Controls whether to focus the inline editor or the tree in the peek widget.")})),placeholder:X(new sae),definitionLinkOpensInPeek:X(new Ve(101,"definitionLinkOpensInPeek",!1,{description:p(539,"Controls whether the Go to Definition mouse gesture always opens the peek widget.")})),quickSuggestions:X(new oae),quickSuggestionsDelay:X(new vt(103,"quickSuggestionsDelay",10,0,1073741824,{description:p(540,"Controls the delay in milliseconds after which quick suggestions will show up."),experiment:{mode:"auto"}})),readOnly:X(new Ve(104,"readOnly",!1)),readOnlyMessage:X(new lae),renameOnType:X(new Ve(106,"renameOnType",!1,{description:p(541,"Controls whether the editor auto renames on type."),markdownDeprecationMessage:p(542,"Deprecated, use `#editor.linkedEditing#` instead.")})),renderControlCharacters:X(new Ve(108,"renderControlCharacters",!0,{description:p(543,"Controls whether the editor should render control characters."),restricted:!0})),renderFinalNewline:X(new Yt(109,"renderFinalNewline",Ws?"dimmed":"on",["off","on","dimmed"],{description:p(544,"Render last line number when the file ends with a newline.")})),renderLineHighlight:X(new Yt(110,"renderLineHighlight","line",["none","gutter","line","all"],{enumDescriptions:["","","",p(545,"Highlights both the gutter and the current line.")],description:p(546,"Controls how the editor should render the current line highlight.")})),renderLineHighlightOnlyWhenFocus:X(new Ve(111,"renderLineHighlightOnlyWhenFocus",!1,{description:p(547,"Controls if the editor should render the current line highlight only when the editor is focused.")})),renderValidationDecorations:X(new Yt(112,"renderValidationDecorations","editable",["editable","on","off"])),renderWhitespace:X(new Yt(113,"renderWhitespace","selection",["none","boundary","selection","trailing","all"],{enumDescriptions:["",p(548,"Render whitespace characters except for single spaces between words."),p(549,"Render whitespace characters only on selected text."),p(550,"Render only trailing whitespace characters."),""],description:p(551,"Controls how the editor should render whitespace characters.")})),revealHorizontalRightPadding:X(new vt(114,"revealHorizontalRightPadding",15,0,1e3)),roundedSelection:X(new Ve(115,"roundedSelection",!0,{description:p(552,"Controls whether selections should have rounded corners.")})),rulers:X(new aae),scrollbar:X(new cae),scrollBeyondLastColumn:X(new vt(118,"scrollBeyondLastColumn",4,0,1073741824,{description:p(553,"Controls the number of extra characters beyond which the editor will scroll horizontally.")})),scrollBeyondLastLine:X(new Ve(119,"scrollBeyondLastLine",!0,{description:p(554,"Controls whether the editor will scroll beyond the last line.")})),scrollOnMiddleClick:X(new Ve(171,"scrollOnMiddleClick",!1,{description:p(555,"Controls whether the editor will scroll when the middle button is pressed.")})),scrollPredominantAxis:X(new Ve(120,"scrollPredominantAxis",!0,{description:p(556,"Scroll only along the predominant axis when scrolling both vertically and horizontally at the same time. Prevents horizontal drift when scrolling vertically on a trackpad.")})),selectionClipboard:X(new Ve(121,"selectionClipboard",!0,{description:p(557,"Controls whether the Linux primary clipboard should be supported."),included:Ws})),selectionHighlight:X(new Ve(122,"selectionHighlight",!0,{description:p(558,"Controls whether the editor should highlight matches similar to the selection.")})),selectionHighlightMaxLength:X(new vt(123,"selectionHighlightMaxLength",200,0,1073741824,{description:p(559,"Controls how many characters can be in the selection before similiar matches are not highlighted. Set to zero for unlimited.")})),selectionHighlightMultiline:X(new Ve(124,"selectionHighlightMultiline",!1,{description:p(560,"Controls whether the editor should highlight selection matches that span multiple lines.")})),selectOnLineNumbers:X(new Ve(125,"selectOnLineNumbers",!0)),showFoldingControls:X(new Yt(126,"showFoldingControls","mouseover",["always","never","mouseover"],{enumDescriptions:[p(561,"Always show the folding controls."),p(562,"Never show the folding controls and reduce the gutter size."),p(563,"Only show the folding controls when the mouse is over the gutter.")],description:p(564,"Controls when the folding controls on the gutter are shown.")})),showUnused:X(new Ve(127,"showUnused",!0,{description:p(565,"Controls fading out of unused code.")})),showDeprecated:X(new Ve(157,"showDeprecated",!0,{description:p(566,"Controls strikethrough deprecated variables.")})),inlayHints:X(new Yre),snippetSuggestions:X(new Yt(128,"snippetSuggestions","inline",["top","bottom","inline","none"],{enumDescriptions:[p(567,"Show snippet suggestions on top of other suggestions."),p(568,"Show snippet suggestions below other suggestions."),p(569,"Show snippets suggestions with other suggestions."),p(570,"Do not show snippet suggestions.")],description:p(571,"Controls whether snippets are shown with other suggestions and how they are sorted.")})),smartSelect:X(new pae),smoothScrolling:X(new Ve(130,"smoothScrolling",!1,{description:p(572,"Controls whether the editor will scroll using an animation.")})),stopRenderingLineAfter:X(new vt(133,"stopRenderingLineAfter",1e4,-1,1073741824)),suggest:X(new gae),inlineSuggest:X(new hae),inlineCompletionsAccessibilityVerbose:X(new Ve(169,"inlineCompletionsAccessibilityVerbose",!1,{description:p(573,"Controls whether the accessibility hint should be provided to screen reader users when an inline completion is shown.")})),suggestFontSize:X(new vt(135,"suggestFontSize",0,0,1e3,{markdownDescription:p(574,"Font size for the suggest widget. When set to {0}, the value of {1} is used.","`0`","`#editor.fontSize#`")})),suggestLineHeight:X(new vt(136,"suggestLineHeight",0,0,1e3,{markdownDescription:p(575,"Line height for the suggest widget. When set to {0}, the value of {1} is used. The minimum value is 8.","`0`","`#editor.lineHeight#`")})),suggestOnTriggerCharacters:X(new Ve(137,"suggestOnTriggerCharacters",!0,{description:p(576,"Controls whether suggestions should automatically show up when typing trigger characters.")})),suggestSelection:X(new Yt(138,"suggestSelection","first",["first","recentlyUsed","recentlyUsedByPrefix"],{markdownEnumDescriptions:[p(577,"Always select the first suggestion."),p(578,"Select recent suggestions unless further typing selects one, e.g. `console.| -> console.log` because `log` has been completed recently."),p(579,"Select suggestions based on previous prefixes that have completed those suggestions, e.g. `co -> console` and `con -> const`.")],description:p(580,"Controls how suggestions are pre-selected when showing the suggest list.")})),tabCompletion:X(new Yt(139,"tabCompletion","off",["on","off","onlySnippets"],{enumDescriptions:[p(581,"Tab complete will insert the best matching suggestion when pressing tab."),p(582,"Disable tab completions."),p(583,"Tab complete snippets when their prefix match. Works best when 'quickSuggestions' aren't enabled.")],description:p(584,"Enables tab completions.")})),tabIndex:X(new vt(140,"tabIndex",0,-1,1073741824)),trimWhitespaceOnDelete:X(new Ve(141,"trimWhitespaceOnDelete",!1,{description:p(585,"Controls whether the editor will also delete the next line's indentation whitespace when deleting a newline.")})),unicodeHighlight:X(new dae),unusualLineTerminators:X(new Yt(143,"unusualLineTerminators","prompt",["auto","off","prompt"],{enumDescriptions:[p(586,"Unusual line terminators are automatically removed."),p(587,"Unusual line terminators are ignored."),p(588,"Unusual line terminators prompt to be removed.")],description:p(589,"Remove unusual line terminators that might cause problems.")})),useShadowDOM:X(new Ve(144,"useShadowDOM",!0)),useTabStops:X(new Ve(145,"useTabStops",!0,{description:p(590,"Spaces and tabs are inserted and deleted in alignment with tab stops.")})),wordBreak:X(new Yt(146,"wordBreak","normal",["normal","keepAll"],{markdownEnumDescriptions:[p(591,"Use the default line break rule."),p(592,"Word breaks should not be used for Chinese/Japanese/Korean (CJK) text. Non-CJK text behavior is the same as for normal.")],description:p(593,"Controls the word break rules used for Chinese/Japanese/Korean (CJK) text.")})),wordSegmenterLocales:X(new mae),wordSeparators:X(new ss(148,"wordSeparators",Jy,{description:p(594,"Characters that will be used as word separators when doing word related navigations or operations.")})),wordWrap:X(new Yt(149,"wordWrap","off",["off","on","wordWrapColumn","bounded"],{markdownEnumDescriptions:[p(595,"Lines will never wrap."),p(596,"Lines will wrap at the viewport width."),p(597,"Lines will wrap at `#editor.wordWrapColumn#`."),p(598,"Lines will wrap at the minimum of viewport and `#editor.wordWrapColumn#`.")],description:p(599,"Controls how lines should wrap.")})),wordWrapBreakAfterCharacters:X(new ss(150,"wordWrapBreakAfterCharacters"," })]?|/&.,;¢°′″‰℃、。。、¢,.:;?!%・・ゝゞヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻ァィゥェォャュョッー”〉》」』】〕)]}」")),wordWrapBreakBeforeCharacters:X(new ss(151,"wordWrapBreakBeforeCharacters","([{‘“〈《「『【〔([{「£¥$£¥+")),wordWrapColumn:X(new vt(152,"wordWrapColumn",80,1,1073741824,{markdownDescription:p(600,"Controls the wrapping column of the editor when `#editor.wordWrap#` is `wordWrapColumn` or `bounded`.")})),wordWrapOverride1:X(new Yt(153,"wordWrapOverride1","inherit",["off","on","inherit"])),wordWrapOverride2:X(new Yt(154,"wordWrapOverride2","inherit",["off","on","inherit"])),wrapOnEscapedLineFeeds:X(new Ve(160,"wrapOnEscapedLineFeeds",!1,{markdownDescription:p(601,'Controls whether literal `\\n` shall trigger a wordWrap when `#editor.wordWrap#` is enabled.\n\nFor example:\n```c\nchar* str="hello\\nworld"\n```\nwill be displayed as\n```c\nchar* str="hello\\n\n world"\n```')})),effectiveCursorStyle:X(new Vre),editorClassName:X(new Fre),defaultColorDecorators:X(new Yt(167,"defaultColorDecorators","auto",["auto","always","never"],{enumDescriptions:[p(602,"Show default color decorators only when no extension provides colors decorators."),p(603,"Always show default color decorators."),p(604,"Never show default color decorators.")],description:p(605,"Controls whether inline color decorations should be shown using the default document color provider.")})),pixelRatio:X(new nae),tabFocusMode:X(new Ve(164,"tabFocusMode",!1,{markdownDescription:p(606,"Controls whether the editor receives tabs or defers them to the workbench for navigation.")})),layoutInfo:X(new t_),wrappingInfo:X(new bae),wrappingIndent:X(new _ae),wrappingStrategy:X(new Kre),effectiveEditContextEnabled:X(new zre),effectiveAllowVariableFonts:X(new Ure)},xr=new class{constructor(){this._zoomLevel=0,this._onDidChangeZoomLevel=new P,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event}getZoomLevel(){return this._zoomLevel}setZoomLevel(o){o=Math.min(Math.max(-5,o),20),this._zoomLevel!==o&&(this._zoomLevel=o,this._onDidChangeZoomLevel.fire(this._zoomLevel))}},wae=ze?1.5:1.35,G2=8;class If{static createFromValidatedSettings(e,t,i){const n=e.get(58),s=e.get(62),r=e.get(61),a=e.get(60),l=e.get(63),c=e.get(75),d=e.get(72);return If._create(n,s,r,a,l,c,d,t,i)}static _create(e,t,i,n,s,r,a,l,c){r===0?r=wae*i:r<G2&&(r=r*i),r=Math.round(r),r<G2&&(r=G2);const d=1+(c?0:xr.getZoomLevel()*.1);return i*=d,r*=d,s===W1.TRANSLATE&&(t==="normal"||t==="bold"?s=W1.OFF:(s=`'wght' ${parseInt(t,10)}`,t="normal")),new If({pixelRatio:l,fontFamily:e,fontWeight:t,fontSize:i,fontFeatureSettings:n,fontVariationSettings:s,lineHeight:r,letterSpacing:a})}constructor(e){this._bareFontInfoBrand=void 0,this.pixelRatio=e.pixelRatio,this.fontFamily=String(e.fontFamily),this.fontWeight=String(e.fontWeight),this.fontSize=e.fontSize,this.fontFeatureSettings=e.fontFeatureSettings,this.fontVariationSettings=e.fontVariationSettings,this.lineHeight=e.lineHeight|0,this.letterSpacing=e.letterSpacing}getId(){return`${this.pixelRatio}-${this.fontFamily}-${this.fontWeight}-${this.fontSize}-${this.fontFeatureSettings}-${this.fontVariationSettings}-${this.lineHeight}-${this.letterSpacing}`}getMassagedFontFamily(){const e=bs.fontFamily,t=If._wrapInQuotes(this.fontFamily);return this.fontFamily!==e?`${t}, ${e}`:t}static _wrapInQuotes(e){return/[,"']/.test(e)?e:/[+ ]/.test(e)?`"${e}"`:e}}const Sae=2;class Z2 extends If{constructor(e,t){super(e),this._editorStylingBrand=void 0,this.version=Sae,this.isTrusted=t,this.isMonospace=e.isMonospace,this.typicalHalfwidthCharacterWidth=e.typicalHalfwidthCharacterWidth,this.typicalFullwidthCharacterWidth=e.typicalFullwidthCharacterWidth,this.canUseHalfwidthRightwardsArrow=e.canUseHalfwidthRightwardsArrow,this.spaceWidth=e.spaceWidth,this.middotWidth=e.middotWidth,this.wsmiddotWidth=e.wsmiddotWidth,this.maxDigitWidth=e.maxDigitWidth}equals(e){return this.fontFamily===e.fontFamily&&this.fontWeight===e.fontWeight&&this.fontSize===e.fontSize&&this.fontFeatureSettings===e.fontFeatureSettings&&this.fontVariationSettings===e.fontVariationSettings&&this.lineHeight===e.lineHeight&&this.letterSpacing===e.letterSpacing&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.typicalFullwidthCharacterWidth===e.typicalFullwidthCharacterWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.maxDigitWidth===e.maxDigitWidth}}class yae extends A{constructor(){super(...arguments),this._cache=new Map,this._evictUntrustedReadingsTimeout=-1,this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event}dispose(){this._evictUntrustedReadingsTimeout!==-1&&(clearTimeout(this._evictUntrustedReadingsTimeout),this._evictUntrustedReadingsTimeout=-1),super.dispose()}clearAllFontInfos(){this._cache.clear(),this._onDidChange.fire()}_ensureCache(e){const t=b1(e);let i=this._cache.get(t);return i||(i=new Lae,this._cache.set(t,i)),i}_writeToCache(e,t,i){this._ensureCache(e).put(t,i),!i.isTrusted&&this._evictUntrustedReadingsTimeout===-1&&(this._evictUntrustedReadingsTimeout=e.setTimeout(()=>{this._evictUntrustedReadingsTimeout=-1,this._evictUntrustedReadings(e)},5e3))}_evictUntrustedReadings(e){const t=this._ensureCache(e),i=t.getValues();let n=!1;for(const s of i)s.isTrusted||(n=!0,t.remove(s));n&&this._onDidChange.fire()}readFontInfo(e,t){const i=this._ensureCache(e);if(!i.has(t)){let n=this._actualReadFontInfo(e,t);(n.typicalHalfwidthCharacterWidth<=2||n.typicalFullwidthCharacterWidth<=2||n.spaceWidth<=2||n.maxDigitWidth<=2)&&(n=new Z2({pixelRatio:A1.getInstance(e).value,fontFamily:n.fontFamily,fontWeight:n.fontWeight,fontSize:n.fontSize,fontFeatureSettings:n.fontFeatureSettings,fontVariationSettings:n.fontVariationSettings,lineHeight:n.lineHeight,letterSpacing:n.letterSpacing,isMonospace:n.isMonospace,typicalHalfwidthCharacterWidth:Math.max(n.typicalHalfwidthCharacterWidth,5),typicalFullwidthCharacterWidth:Math.max(n.typicalFullwidthCharacterWidth,5),canUseHalfwidthRightwardsArrow:n.canUseHalfwidthRightwardsArrow,spaceWidth:Math.max(n.spaceWidth,5),middotWidth:Math.max(n.middotWidth,5),wsmiddotWidth:Math.max(n.wsmiddotWidth,5),maxDigitWidth:Math.max(n.maxDigitWidth,5)},!1)),this._writeToCache(e,t,n)}return i.get(t)}_createRequest(e,t,i,n){const s=new Nre(e,t);return i.push(s),n?.push(s),s}_actualReadFontInfo(e,t){const i=[],n=[],s=this._createRequest("n",0,i,n),r=this._createRequest("",0,i,null),a=this._createRequest(" ",0,i,n),l=this._createRequest("0",0,i,n),c=this._createRequest("1",0,i,n),d=this._createRequest("2",0,i,n),h=this._createRequest("3",0,i,n),u=this._createRequest("4",0,i,n),f=this._createRequest("5",0,i,n),g=this._createRequest("6",0,i,n),m=this._createRequest("7",0,i,n),_=this._createRequest("8",0,i,n),b=this._createRequest("9",0,i,n),C=this._createRequest("→",0,i,n),w=this._createRequest("→",0,i,null),v=this._createRequest("·",0,i,n),S=this._createRequest("⸱",0,i,null),L="|/-_ilm%";for(let F=0,O=L.length;F<O;F++)this._createRequest(L.charAt(F),0,i,n),this._createRequest(L.charAt(F),1,i,n),this._createRequest(L.charAt(F),2,i,n);Tre(e,t,i);const x=Math.max(l.width,c.width,d.width,h.width,u.width,f.width,g.width,m.width,_.width,b.width);let I=t.fontFeatureSettings===Fc.OFF;const D=n[0].width;for(let F=1,O=n.length;I&&F<O;F++){const B=D-n[F].width;if(B<-.001||B>.001){I=!1;break}}let R=!0;return I&&w.width!==D&&(R=!1),w.width>C.width&&(R=!1),new Z2({pixelRatio:A1.getInstance(e).value,fontFamily:t.fontFamily,fontWeight:t.fontWeight,fontSize:t.fontSize,fontFeatureSettings:t.fontFeatureSettings,fontVariationSettings:t.fontVariationSettings,lineHeight:t.lineHeight,letterSpacing:t.letterSpacing,isMonospace:I,typicalHalfwidthCharacterWidth:s.width,typicalFullwidthCharacterWidth:r.width,canUseHalfwidthRightwardsArrow:R,spaceWidth:a.width,middotWidth:v.width,wsmiddotWidth:S.width,maxDigitWidth:x},!0)}}class Lae{constructor(){this._keys=Object.create(null),this._values=Object.create(null)}has(e){const t=e.getId();return!!this._values[t]}get(e){const t=e.getId();return this._values[t]}put(e,t){const i=e.getId();this._keys[i]=e,this._values[i]=t}remove(e){const t=e.getId();delete this._keys[t],delete this._values[t]}getValues(){return Object.keys(this._keys).map(e=>this._values[e])}}const Y2=new yae,bC=class bC{constructor(e,t){this.key=e,this.migrate=t}apply(e){const t=bC._read(e,this.key),i=s=>bC._read(e,s),n=(s,r)=>bC._write(e,s,r);this.migrate(t,i,n)}static _read(e,t){if(typeof e>"u")return;const i=t.indexOf(".");if(i>=0){const n=t.substring(0,i);return this._read(e[n],t.substring(i+1))}return e[t]}static _write(e,t,i){const n=t.indexOf(".");if(n>=0){const s=t.substring(0,n);e[s]=e[s]||{},this._write(e[s],t.substring(n+1),i);return}e[t]=i}};bC.items=[];let B1=bC;function kr(o,e){B1.items.push(new B1(o,e))}function Cs(o,e){kr(o,(t,i,n)=>{if(typeof t<"u"){for(const[s,r]of e)if(t===s){n(o,r);return}}})}function xae(o){B1.items.forEach(e=>e.apply(o))}Cs("wordWrap",[[!0,"on"],[!1,"off"]]),Cs("lineNumbers",[[!0,"on"],[!1,"off"]]),Cs("cursorBlinking",[["visible","solid"]]),Cs("renderWhitespace",[[!0,"boundary"],[!1,"none"]]),Cs("renderLineHighlight",[[!0,"line"],[!1,"none"]]),Cs("acceptSuggestionOnEnter",[[!0,"on"],[!1,"off"]]),Cs("tabCompletion",[[!1,"off"],[!0,"onlySnippets"]]),Cs("hover",[[!0,{enabled:!0}],[!1,{enabled:!1}]]),Cs("parameterHints",[[!0,{enabled:!0}],[!1,{enabled:!1}]]),Cs("autoIndent",[[!1,"advanced"],[!0,"full"]]),Cs("matchBrackets",[[!0,"always"],[!1,"never"]]),Cs("renderFinalNewline",[[!0,"on"],[!1,"off"]]),Cs("cursorSmoothCaretAnimation",[[!0,"on"],[!1,"off"]]),Cs("occurrencesHighlight",[[!0,"singleFile"],[!1,"off"]]),Cs("wordBasedSuggestions",[[!0,"matchingDocuments"],[!1,"off"]]),Cs("defaultColorDecorators",[[!0,"auto"],[!1,"never"]]),Cs("minimap.autohide",[[!0,"mouseover"],[!1,"none"]]),kr("autoClosingBrackets",(o,e,t)=>{o===!1&&(t("autoClosingBrackets","never"),typeof e("autoClosingQuotes")>"u"&&t("autoClosingQuotes","never"),typeof e("autoSurround")>"u"&&t("autoSurround","never"))}),kr("renderIndentGuides",(o,e,t)=>{typeof o<"u"&&(t("renderIndentGuides",void 0),typeof e("guides.indentation")>"u"&&t("guides.indentation",!!o))}),kr("highlightActiveIndentGuide",(o,e,t)=>{typeof o<"u"&&(t("highlightActiveIndentGuide",void 0),typeof e("guides.highlightActiveIndentation")>"u"&&t("guides.highlightActiveIndentation",!!o))});const kae={method:"showMethods",function:"showFunctions",constructor:"showConstructors",deprecated:"showDeprecated",field:"showFields",variable:"showVariables",class:"showClasses",struct:"showStructs",interface:"showInterfaces",module:"showModules",property:"showProperties",event:"showEvents",operator:"showOperators",unit:"showUnits",value:"showValues",constant:"showConstants",enum:"showEnums",enumMember:"showEnumMembers",keyword:"showKeywords",text:"showWords",color:"showColors",file:"showFiles",reference:"showReferences",folder:"showFolders",typeParameter:"showTypeParameters",snippet:"showSnippets"};kr("suggest.filteredTypes",(o,e,t)=>{if(o&&typeof o=="object"){for(const i of Object.entries(kae))o[i[0]]===!1&&typeof e(`suggest.${i[1]}`)>"u"&&t(`suggest.${i[1]}`,!1);t("suggest.filteredTypes",void 0)}}),kr("quickSuggestions",(o,e,t)=>{if(typeof o=="boolean"){const i=o?"on":"off";t("quickSuggestions",{comments:i,strings:i,other:i})}}),kr("experimental.stickyScroll.enabled",(o,e,t)=>{typeof o=="boolean"&&(t("experimental.stickyScroll.enabled",void 0),typeof e("stickyScroll.enabled")>"u"&&t("stickyScroll.enabled",o))}),kr("experimental.stickyScroll.maxLineCount",(o,e,t)=>{typeof o=="number"&&(t("experimental.stickyScroll.maxLineCount",void 0),typeof e("stickyScroll.maxLineCount")>"u"&&t("stickyScroll.maxLineCount",o))}),kr("editor.experimentalEditContextEnabled",(o,e,t)=>{typeof o=="boolean"&&(t("editor.experimentalEditContextEnabled",void 0),typeof e("editor.editContext")>"u"&&t("editor.editContext",o))}),kr("codeActionsOnSave",(o,e,t)=>{if(o&&typeof o=="object"){let i=!1;const n={};for(const s of Object.entries(o))typeof s[1]=="boolean"?(i=!0,n[s[0]]=s[1]?"explicit":"never"):n[s[0]]=s[1];i&&t("codeActionsOnSave",n)}}),kr("codeActionWidget.includeNearbyQuickfixes",(o,e,t)=>{typeof o=="boolean"&&(t("codeActionWidget.includeNearbyQuickfixes",void 0),typeof e("codeActionWidget.includeNearbyQuickFixes")>"u"&&t("codeActionWidget.includeNearbyQuickFixes",o))}),kr("lightbulb.enabled",(o,e,t)=>{typeof o=="boolean"&&t("lightbulb.enabled",o?void 0:"off")}),kr("inlineSuggest.edits.codeShifting",(o,e,t)=>{typeof o=="boolean"&&(t("inlineSuggest.edits.codeShifting",void 0),t("inlineSuggest.edits.allowCodeShifting",o?"always":"never"))});class Iae{constructor(){this._tabFocus=!1,this._onDidChangeTabFocus=new P,this.onDidChangeTabFocus=this._onDidChangeTabFocus.event}getTabFocusMode(){return this._tabFocus}setTabFocusMode(e){this._tabFocus=e,this._onDidChangeTabFocus.fire(this._tabFocus)}}const s_=new Iae,bn=We("accessibilityService"),o_=new ae("accessibilityModeEnabled",!1);var Dae=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Eae=function(o,e){return function(t,i){e(t,i,o)}};let X2=class extends A{constructor(e,t,i,n,s){super(),this._accessibilityService=s,this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._onDidChangeFast=this._register(new P),this.onDidChangeFast=this._onDidChangeFast.event,this._isDominatedByLongLines=!1,this._viewLineCount=1,this._lineNumbersDigitCount=1,this._reservedHeight=0,this._glyphMarginDecorationLaneCount=1,this._computeOptionsMemory=new kV,this.isSimpleWidget=e,this.contextMenuId=t,this._containerObserver=this._register(new LV(n,i.dimension)),this._targetWindowId=me(n).vscodeWindowId,this._rawOptions=EV(i),this._validatedOptions=mh.validateOptions(this._rawOptions),this.options=this._computeOptions(),this.options.get(19)&&this._containerObserver.startObserving(),this._register(xr.onDidChangeZoomLevel(()=>this._recomputeOptions())),this._register(s_.onDidChangeTabFocus(()=>this._recomputeOptions())),this._register(this._containerObserver.onDidChange(()=>this._recomputeOptions())),this._register(Y2.onDidChange(()=>this._recomputeOptions())),this._register(A1.getInstance(me(n)).onDidChange(()=>this._recomputeOptions())),this._register(this._accessibilityService.onDidChangeScreenReaderOptimized(()=>this._recomputeOptions())),this._register(p2.onDidChangeInputMode(()=>this._recomputeOptions()))}_recomputeOptions(){const e=this._computeOptions(),t=mh.checkEquals(this.options,e);t!==null&&(this.options=e,this._onDidChangeFast.fire(t),this._onDidChange.fire(t))}_computeOptions(){const e=this._readEnvConfiguration(),t=If.createFromValidatedSettings(this._validatedOptions,e.pixelRatio,this.isSimpleWidget),i=this._readFontInfo(t),n={memory:this._computeOptionsMemory,outerWidth:e.outerWidth,outerHeight:e.outerHeight-this._reservedHeight,fontInfo:i,extraEditorClassName:e.extraEditorClassName,isDominatedByLongLines:this._isDominatedByLongLines,viewLineCount:this._viewLineCount,lineNumbersDigitCount:this._lineNumbersDigitCount,emptySelectionClipboard:e.emptySelectionClipboard,pixelRatio:e.pixelRatio,tabFocusMode:this._validatedOptions.get(164)||s_.getTabFocusMode(),inputMode:p2.getInputMode(),accessibilitySupport:e.accessibilitySupport,glyphMarginDecorationLaneCount:this._glyphMarginDecorationLaneCount,editContextSupported:e.editContextSupported};return mh.computeOptions(this._validatedOptions,n)}_readEnvConfiguration(){return{extraEditorClassName:Tae(),outerWidth:this._containerObserver.getWidth(),outerHeight:this._containerObserver.getHeight(),emptySelectionClipboard:KS||Fs,pixelRatio:A1.getInstance(Z6(this._targetWindowId,!0).window).value,editContextSupported:typeof globalThis.EditContext=="function",accessibilitySupport:this._accessibilityService.isScreenReaderOptimized()?2:this._accessibilityService.getAccessibilitySupport()}}_readFontInfo(e){return Y2.readFontInfo(Z6(this._targetWindowId,!0).window,e)}getRawOptions(){return this._rawOptions}updateOptions(e){const t=EV(e);mh.applyUpdate(this._rawOptions,t)&&(this._validatedOptions=mh.validateOptions(this._rawOptions),this._recomputeOptions())}observeContainer(e){this._containerObserver.observe(e)}setIsDominatedByLongLines(e){this._isDominatedByLongLines!==e&&(this._isDominatedByLongLines=e,this._recomputeOptions())}setModelLineCount(e){const t=Nae(e);this._lineNumbersDigitCount!==t&&(this._lineNumbersDigitCount=t,this._recomputeOptions())}setViewLineCount(e){this._viewLineCount!==e&&(this._viewLineCount=e,this._recomputeOptions())}setReservedHeight(e){this._reservedHeight!==e&&(this._reservedHeight=e,this._recomputeOptions())}setGlyphMarginDecorationLaneCount(e){this._glyphMarginDecorationLaneCount!==e&&(this._glyphMarginDecorationLaneCount=e,this._recomputeOptions())}};X2=Dae([Eae(4,bn)],X2);function Nae(o){let e=0;for(;o;)o=Math.floor(o/10),e++;return e||1}function Tae(){let o="";return qu||NB?(o+="no-minimap-shadow ",o+="enable-user-select "):o+="no-user-select ",ze&&(o+="mac "),o}class Rae{constructor(){this._values=[]}_read(e){return this._values[e]}get(e){return this._values[e]}_write(e,t){this._values[e]=t}}class Mae{constructor(){this._values=[]}_read(e){if(e>=this._values.length)throw new Error("Cannot read uninitialized value");return this._values[e]}get(e){return this._read(e)}_write(e,t){this._values[e]=t}}class mh{static validateOptions(e){const t=new Rae;for(const i of n_){const n=i.name==="_never_"?void 0:e[i.name];t._write(i.id,i.validate(n))}return t}static computeOptions(e,t){const i=new Mae;for(const n of n_)i._write(n.id,n.compute(t,i,e._read(n.id)));return i}static _deepEquals(e,t){if(typeof e!="object"||typeof t!="object"||!e||!t)return e===t;if(Array.isArray(e)||Array.isArray(t))return Array.isArray(e)&&Array.isArray(t)?Ut(e,t):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const i in e)if(!mh._deepEquals(e[i],t[i]))return!1;return!0}static checkEquals(e,t){const i=[];let n=!1;for(const s of n_){const r=!mh._deepEquals(e._read(s.id),t._read(s.id));i[s.id]=r,r&&(n=!0)}return n?new xV(i):null}static applyUpdate(e,t){let i=!1;for(const n of n_)if(t.hasOwnProperty(n.name)){const s=n.applyUpdate(e[n.name],t[n.name]);e[n.name]=s.newValue,i=i||s.didChange}return i}}function EV(o){const e=fl(o);return xae(e),e}var _h;(function(o){const e={total:0,min:Number.MAX_VALUE,max:0},t={...e},i={...e},n={...e};let s=0;const r={keydown:0,input:0,render:0};function a(){b(),performance.mark("inputlatency/start"),performance.mark("keydown/start"),r.keydown=1,queueMicrotask(l)}o.onKeyDown=a;function l(){r.keydown===1&&(performance.mark("keydown/end"),r.keydown=2)}function c(){performance.mark("input/start"),r.input=1,_()}o.onBeforeInput=c;function d(){r.input===0&&c(),queueMicrotask(h)}o.onInput=d;function h(){r.input===1&&(performance.mark("input/end"),r.input=2)}function u(){b()}o.onKeyUp=u;function f(){b()}o.onSelectionChange=f;function g(){r.keydown===2&&r.input===2&&r.render===0&&(performance.mark("render/start"),r.render=1,queueMicrotask(m),_())}o.onRenderStart=g;function m(){r.render===1&&(performance.mark("render/end"),r.render=2)}function _(){setTimeout(b)}function b(){r.keydown===2&&r.input===2&&r.render===2&&(performance.mark("inputlatency/end"),performance.measure("keydown","keydown/start","keydown/end"),performance.measure("input","input/start","input/end"),performance.measure("render","render/start","render/end"),performance.measure("inputlatency","inputlatency/start","inputlatency/end"),C("keydown",e),C("input",t),C("render",i),C("inputlatency",n),s++,w())}function C(x,I){const D=performance.getEntriesByName(x)[0].duration;I.total+=D,I.min=Math.min(I.min,D),I.max=Math.max(I.max,D)}function w(){performance.clearMarks("keydown/start"),performance.clearMarks("keydown/end"),performance.clearMarks("input/start"),performance.clearMarks("input/end"),performance.clearMarks("render/start"),performance.clearMarks("render/end"),performance.clearMarks("inputlatency/start"),performance.clearMarks("inputlatency/end"),performance.clearMeasures("keydown"),performance.clearMeasures("input"),performance.clearMeasures("render"),performance.clearMeasures("inputlatency"),r.keydown=0,r.input=0,r.render=0}function v(){if(s===0)return;const x={keydown:S(e),input:S(t),render:S(i),total:S(n),sampleCount:s};return L(e),L(t),L(i),L(n),s=0,x}o.getAndClearMeasurements=v;function S(x){return{average:x.total/s,max:x.max,min:x.min}}function L(x){x.total=0,x.min=Number.MAX_VALUE,x.max=0}})(_h||(_h={}));const mL=new Map;function Pae(){return new Aae}class Aae{constructor(){this._currentCssStyle="",this._styleSheet=void 0}setStyle(e){e!==this._currentCssStyle&&(this._currentCssStyle=e,this._styleSheet?this._styleSheet.textContent=e:this._styleSheet=Ir(bt.document.head,t=>t.textContent=e))}dispose(){this._styleSheet&&(this._styleSheet.remove(),this._styleSheet=void 0)}}function Ir(o=bt.document.head,e,t){const i=document.createElement("style");if(i.type="text/css",i.media="screen",e?.(i),o.appendChild(i),t&&t.add(ue(()=>i.remove())),o===bt.document.head){const n=new Set;mL.set(i,n),t&&t.add(ue(()=>mL.delete(i)));for(const{window:s,disposables:r}of G6()){if(s===bt)continue;const a=r.add(Oae(i,n,s));t?.add(a)}}return i}function Oae(o,e,t){const i=new U,n=o.cloneNode(!0);t.document.head.appendChild(n),i.add(ue(()=>n.remove()));for(const s of TV(o))n.sheet?.insertRule(s.cssText,n.sheet?.cssRules.length);return i.add(nse.observe(o,i,{childList:!0,subtree:Fs,characterData:Fs})(()=>{n.textContent=o.textContent})),e.add(n),i.add(ue(()=>e.delete(n))),i}let Q2=null;function NV(){return Q2||(Q2=Ir()),Q2}function TV(o){return o?.sheet?.rules?o.sheet.rules:o?.sheet?.cssRules?o.sheet.cssRules:[]}function _L(o,e,t=NV()){if(!(!t||!e)){t.sheet?.insertRule(`${o} {${e}}`,0);for(const i of mL.get(t)??[])_L(o,e,i)}}function J2(o,e=NV()){if(!e)return;const t=TV(e),i=[];for(let n=0;n<t.length;n++){const s=t[n];Fae(s)&&s.selectorText.indexOf(o)!==-1&&i.push(n)}for(let n=i.length-1;n>=0;n--)e.sheet?.deleteRule(i[n]);for(const n of mL.get(e)??[])J2(o,n)}function Fae(o){return typeof o.selectorText=="string"}function Wae(o){const e=new U,t=e.add(Pae());return e.add(Se(i=>{t.setStyle(o.read(i))})),e}class r_{constructor(){this._hooks=new U,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;const i=this._onStopCallback;this._onStopCallback=null,e&&i&&i(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,i,n,s){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=n,this._onStopCallback=s;let r=e;try{e.setPointerCapture(t),this._hooks.add(ue(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{r=me(e)}this._hooks.add(W(r,te.POINTER_MOVE,a=>{if(a.buttons!==i){this.stopMonitoring(!0);return}a.preventDefault(),this._pointerMoveCallback(a)})),this._hooks.add(W(r,te.POINTER_UP,a=>this.stopMonitoring(!0)))}}function bh(o,e){const t=Math.pow(10,e);return Math.round(o*t)/t}class q{constructor(e,t,i,n=1){this._rgbaBrand=void 0,this.r=Math.min(255,Math.max(0,e))|0,this.g=Math.min(255,Math.max(0,t))|0,this.b=Math.min(255,Math.max(0,i))|0,this.a=bh(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.r===t.r&&e.g===t.g&&e.b===t.b&&e.a===t.a}}class Qr{constructor(e,t,i,n){this._hslaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=bh(Math.max(Math.min(1,t),0),3),this.l=bh(Math.max(Math.min(1,i),0),3),this.a=bh(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.l===t.l&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,n=e.b/255,s=e.a,r=Math.max(t,i,n),a=Math.min(t,i,n);let l=0,c=0;const d=(a+r)/2,h=r-a;if(h>0){switch(c=Math.min(d<=.5?h/(2*d):h/(2-2*d),1),r){case t:l=(i-n)/h+(i<n?6:0);break;case i:l=(n-t)/h+2;break;case n:l=(t-i)/h+4;break}l*=60,l=Math.round(l)}return new Qr(l,c,d,s)}static _hue2rgb(e,t,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?e+(t-e)*6*i:i<1/2?t:i<2/3?e+(t-e)*(2/3-i)*6:e}static toRGBA(e){const t=e.h/360,{s:i,l:n,a:s}=e;let r,a,l;if(i===0)r=a=l=n;else{const c=n<.5?n*(1+i):n+i-n*i,d=2*n-c;r=Qr._hue2rgb(d,c,t+1/3),a=Qr._hue2rgb(d,c,t),l=Qr._hue2rgb(d,c,t-1/3)}return new q(Math.round(r*255),Math.round(a*255),Math.round(l*255),s)}}class ml{constructor(e,t,i,n){this._hsvaBrand=void 0,this.h=Math.max(Math.min(360,e),0)|0,this.s=bh(Math.max(Math.min(1,t),0),3),this.v=bh(Math.max(Math.min(1,i),0),3),this.a=bh(Math.max(Math.min(1,n),0),3)}static equals(e,t){return e.h===t.h&&e.s===t.s&&e.v===t.v&&e.a===t.a}static fromRGBA(e){const t=e.r/255,i=e.g/255,n=e.b/255,s=Math.max(t,i,n),r=Math.min(t,i,n),a=s-r,l=s===0?0:a/s;let c;return a===0?c=0:s===t?c=((i-n)/a%6+6)%6:s===i?c=(n-t)/a+2:c=(t-i)/a+4,new ml(Math.round(c*60),l,s,e.a)}static toRGBA(e){const{h:t,s:i,v:n,a:s}=e,r=n*i,a=r*(1-Math.abs(t/60%2-1)),l=n-r;let[c,d,h]=[0,0,0];return t<60?(c=r,d=a):t<120?(c=a,d=r):t<180?(d=r,h=a):t<240?(d=a,h=r):t<300?(c=a,h=r):t<=360&&(c=r,h=a),c=Math.round((c+l)*255),d=Math.round((d+l)*255),h=Math.round((h+l)*255),new q(c,d,h,s)}}const pi=class pi{static fromHex(e){return pi.Format.CSS.parseHex(e)||pi.red}static equals(e,t){return!e&&!t?!0:!e||!t?!1:e.equals(t)}get hsla(){return this._hsla?this._hsla:Qr.fromRGBA(this.rgba)}get hsva(){return this._hsva?this._hsva:ml.fromRGBA(this.rgba)}constructor(e){if(e)if(e instanceof q)this.rgba=e;else if(e instanceof Qr)this._hsla=e,this.rgba=Qr.toRGBA(e);else if(e instanceof ml)this._hsva=e,this.rgba=ml.toRGBA(e);else throw new Error("Invalid color ctor argument");else throw new Error("Color needs a value")}equals(e){return!!e&&q.equals(this.rgba,e.rgba)&&Qr.equals(this.hsla,e.hsla)&&ml.equals(this.hsva,e.hsva)}getRelativeLuminance(){const e=pi._relativeLuminanceForComponent(this.rgba.r),t=pi._relativeLuminanceForComponent(this.rgba.g),i=pi._relativeLuminanceForComponent(this.rgba.b),n=.2126*e+.7152*t+.0722*i;return bh(n,4)}static _relativeLuminanceForComponent(e){const t=e/255;return t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4)}isLighter(){return(this.rgba.r*299+this.rgba.g*587+this.rgba.b*114)/1e3>=128}isLighterThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t>i}isDarkerThan(e){const t=this.getRelativeLuminance(),i=e.getRelativeLuminance();return t<i}lighten(e){return new pi(new Qr(this.hsla.h,this.hsla.s,this.hsla.l+this.hsla.l*e,this.hsla.a))}darken(e){return new pi(new Qr(this.hsla.h,this.hsla.s,this.hsla.l-this.hsla.l*e,this.hsla.a))}transparent(e){const{r:t,g:i,b:n,a:s}=this.rgba;return new pi(new q(t,i,n,s*e))}isTransparent(){return this.rgba.a===0}isOpaque(){return this.rgba.a===1}opposite(){return new pi(new q(255-this.rgba.r,255-this.rgba.g,255-this.rgba.b,this.rgba.a))}mix(e,t=.5){const i=Math.min(Math.max(t,0),1),n=this.rgba,s=e.rgba,r=n.r+(s.r-n.r)*i,a=n.g+(s.g-n.g)*i,l=n.b+(s.b-n.b)*i,c=n.a+(s.a-n.a)*i;return new pi(new q(r,a,l,c))}makeOpaque(e){if(this.isOpaque()||e.rgba.a!==1)return this;const{r:t,g:i,b:n,a:s}=this.rgba;return new pi(new q(e.rgba.r-s*(e.rgba.r-t),e.rgba.g-s*(e.rgba.g-i),e.rgba.b-s*(e.rgba.b-n),1))}toString(){return this._toString||(this._toString=pi.Format.CSS.format(this)),this._toString}toNumber32Bit(){return this._toNumber32Bit||(this._toNumber32Bit=(this.rgba.r<<24|this.rgba.g<<16|this.rgba.b<<8|this.rgba.a*255<<0)>>>0),this._toNumber32Bit}static getLighterColor(e,t,i){if(e.isLighterThan(t))return e;i=i||.5;const n=e.getRelativeLuminance(),s=t.getRelativeLuminance();return i=i*(s-n)/s,e.lighten(i)}static getDarkerColor(e,t,i){if(e.isDarkerThan(t))return e;i=i||.5;const n=e.getRelativeLuminance(),s=t.getRelativeLuminance();return i=i*(n-s)/n,e.darken(i)}};pi.white=new pi(new q(255,255,255,1)),pi.black=new pi(new q(0,0,0,1)),pi.red=new pi(new q(255,0,0,1)),pi.blue=new pi(new q(0,0,255,1)),pi.green=new pi(new q(0,255,0,1)),pi.cyan=new pi(new q(0,255,255,1)),pi.lightgrey=new pi(new q(211,211,211,1)),pi.transparent=new pi(new q(0,0,0,0));let $=pi;(function(o){(function(e){(function(t){function i(m){return m.rgba.a===1?`rgb(${m.rgba.r}, ${m.rgba.g}, ${m.rgba.b})`:o.Format.CSS.formatRGBA(m)}t.formatRGB=i;function n(m){return`rgba(${m.rgba.r}, ${m.rgba.g}, ${m.rgba.b}, ${+m.rgba.a.toFixed(2)})`}t.formatRGBA=n;function s(m){return m.hsla.a===1?`hsl(${m.hsla.h}, ${Math.round(m.hsla.s*100)}%, ${Math.round(m.hsla.l*100)}%)`:o.Format.CSS.formatHSLA(m)}t.formatHSL=s;function r(m){return`hsla(${m.hsla.h}, ${Math.round(m.hsla.s*100)}%, ${Math.round(m.hsla.l*100)}%, ${m.hsla.a.toFixed(2)})`}t.formatHSLA=r;function a(m){const _=m.toString(16);return _.length!==2?"0"+_:_}function l(m){return`#${a(m.rgba.r)}${a(m.rgba.g)}${a(m.rgba.b)}`}t.formatHex=l;function c(m,_=!1){return _&&m.rgba.a===1?o.Format.CSS.formatHex(m):`#${a(m.rgba.r)}${a(m.rgba.g)}${a(m.rgba.b)}${a(Math.round(m.rgba.a*255))}`}t.formatHexA=c;function d(m){return m.isOpaque()?o.Format.CSS.formatHex(m):o.Format.CSS.formatRGBA(m)}t.format=d;function h(m){if(m==="transparent")return o.transparent;if(m.startsWith("#"))return f(m);if(m.startsWith("rgba(")){const _=m.match(/rgba\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+), *(?<a>(?:\+|-)?\d+(\.\d+)?)\)/);if(!_)throw new Error("Invalid color format "+m);const b=parseInt(_.groups?.r??"0"),C=parseInt(_.groups?.g??"0"),w=parseInt(_.groups?.b??"0"),v=parseFloat(_.groups?.a??"0");return new o(new q(b,C,w,v))}if(m.startsWith("rgb(")){const _=m.match(/rgb\((?<r>(?:\+|-)?\d+), *(?<g>(?:\+|-)?\d+), *(?<b>(?:\+|-)?\d+)\)/);if(!_)throw new Error("Invalid color format "+m);const b=parseInt(_.groups?.r??"0"),C=parseInt(_.groups?.g??"0"),w=parseInt(_.groups?.b??"0");return new o(new q(b,C,w))}return u(m)}t.parse=h;function u(m){switch(m){case"aliceblue":return new o(new q(240,248,255,1));case"antiquewhite":return new o(new q(250,235,215,1));case"aqua":return new o(new q(0,255,255,1));case"aquamarine":return new o(new q(127,255,212,1));case"azure":return new o(new q(240,255,255,1));case"beige":return new o(new q(245,245,220,1));case"bisque":return new o(new q(255,228,196,1));case"black":return new o(new q(0,0,0,1));case"blanchedalmond":return new o(new q(255,235,205,1));case"blue":return new o(new q(0,0,255,1));case"blueviolet":return new o(new q(138,43,226,1));case"brown":return new o(new q(165,42,42,1));case"burlywood":return new o(new q(222,184,135,1));case"cadetblue":return new o(new q(95,158,160,1));case"chartreuse":return new o(new q(127,255,0,1));case"chocolate":return new o(new q(210,105,30,1));case"coral":return new o(new q(255,127,80,1));case"cornflowerblue":return new o(new q(100,149,237,1));case"cornsilk":return new o(new q(255,248,220,1));case"crimson":return new o(new q(220,20,60,1));case"cyan":return new o(new q(0,255,255,1));case"darkblue":return new o(new q(0,0,139,1));case"darkcyan":return new o(new q(0,139,139,1));case"darkgoldenrod":return new o(new q(184,134,11,1));case"darkgray":return new o(new q(169,169,169,1));case"darkgreen":return new o(new q(0,100,0,1));case"darkgrey":return new o(new q(169,169,169,1));case"darkkhaki":return new o(new q(189,183,107,1));case"darkmagenta":return new o(new q(139,0,139,1));case"darkolivegreen":return new o(new q(85,107,47,1));case"darkorange":return new o(new q(255,140,0,1));case"darkorchid":return new o(new q(153,50,204,1));case"darkred":return new o(new q(139,0,0,1));case"darksalmon":return new o(new q(233,150,122,1));case"darkseagreen":return new o(new q(143,188,143,1));case"darkslateblue":return new o(new q(72,61,139,1));case"darkslategray":return new o(new q(47,79,79,1));case"darkslategrey":return new o(new q(47,79,79,1));case"darkturquoise":return new o(new q(0,206,209,1));case"darkviolet":return new o(new q(148,0,211,1));case"deeppink":return new o(new q(255,20,147,1));case"deepskyblue":return new o(new q(0,191,255,1));case"dimgray":return new o(new q(105,105,105,1));case"dimgrey":return new o(new q(105,105,105,1));case"dodgerblue":return new o(new q(30,144,255,1));case"firebrick":return new o(new q(178,34,34,1));case"floralwhite":return new o(new q(255,250,240,1));case"forestgreen":return new o(new q(34,139,34,1));case"fuchsia":return new o(new q(255,0,255,1));case"gainsboro":return new o(new q(220,220,220,1));case"ghostwhite":return new o(new q(248,248,255,1));case"gold":return new o(new q(255,215,0,1));case"goldenrod":return new o(new q(218,165,32,1));case"gray":return new o(new q(128,128,128,1));case"green":return new o(new q(0,128,0,1));case"greenyellow":return new o(new q(173,255,47,1));case"grey":return new o(new q(128,128,128,1));case"honeydew":return new o(new q(240,255,240,1));case"hotpink":return new o(new q(255,105,180,1));case"indianred":return new o(new q(205,92,92,1));case"indigo":return new o(new q(75,0,130,1));case"ivory":return new o(new q(255,255,240,1));case"khaki":return new o(new q(240,230,140,1));case"lavender":return new o(new q(230,230,250,1));case"lavenderblush":return new o(new q(255,240,245,1));case"lawngreen":return new o(new q(124,252,0,1));case"lemonchiffon":return new o(new q(255,250,205,1));case"lightblue":return new o(new q(173,216,230,1));case"lightcoral":return new o(new q(240,128,128,1));case"lightcyan":return new o(new q(224,255,255,1));case"lightgoldenrodyellow":return new o(new q(250,250,210,1));case"lightgray":return new o(new q(211,211,211,1));case"lightgreen":return new o(new q(144,238,144,1));case"lightgrey":return new o(new q(211,211,211,1));case"lightpink":return new o(new q(255,182,193,1));case"lightsalmon":return new o(new q(255,160,122,1));case"lightseagreen":return new o(new q(32,178,170,1));case"lightskyblue":return new o(new q(135,206,250,1));case"lightslategray":return new o(new q(119,136,153,1));case"lightslategrey":return new o(new q(119,136,153,1));case"lightsteelblue":return new o(new q(176,196,222,1));case"lightyellow":return new o(new q(255,255,224,1));case"lime":return new o(new q(0,255,0,1));case"limegreen":return new o(new q(50,205,50,1));case"linen":return new o(new q(250,240,230,1));case"magenta":return new o(new q(255,0,255,1));case"maroon":return new o(new q(128,0,0,1));case"mediumaquamarine":return new o(new q(102,205,170,1));case"mediumblue":return new o(new q(0,0,205,1));case"mediumorchid":return new o(new q(186,85,211,1));case"mediumpurple":return new o(new q(147,112,219,1));case"mediumseagreen":return new o(new q(60,179,113,1));case"mediumslateblue":return new o(new q(123,104,238,1));case"mediumspringgreen":return new o(new q(0,250,154,1));case"mediumturquoise":return new o(new q(72,209,204,1));case"mediumvioletred":return new o(new q(199,21,133,1));case"midnightblue":return new o(new q(25,25,112,1));case"mintcream":return new o(new q(245,255,250,1));case"mistyrose":return new o(new q(255,228,225,1));case"moccasin":return new o(new q(255,228,181,1));case"navajowhite":return new o(new q(255,222,173,1));case"navy":return new o(new q(0,0,128,1));case"oldlace":return new o(new q(253,245,230,1));case"olive":return new o(new q(128,128,0,1));case"olivedrab":return new o(new q(107,142,35,1));case"orange":return new o(new q(255,165,0,1));case"orangered":return new o(new q(255,69,0,1));case"orchid":return new o(new q(218,112,214,1));case"palegoldenrod":return new o(new q(238,232,170,1));case"palegreen":return new o(new q(152,251,152,1));case"paleturquoise":return new o(new q(175,238,238,1));case"palevioletred":return new o(new q(219,112,147,1));case"papayawhip":return new o(new q(255,239,213,1));case"peachpuff":return new o(new q(255,218,185,1));case"peru":return new o(new q(205,133,63,1));case"pink":return new o(new q(255,192,203,1));case"plum":return new o(new q(221,160,221,1));case"powderblue":return new o(new q(176,224,230,1));case"purple":return new o(new q(128,0,128,1));case"rebeccapurple":return new o(new q(102,51,153,1));case"red":return new o(new q(255,0,0,1));case"rosybrown":return new o(new q(188,143,143,1));case"royalblue":return new o(new q(65,105,225,1));case"saddlebrown":return new o(new q(139,69,19,1));case"salmon":return new o(new q(250,128,114,1));case"sandybrown":return new o(new q(244,164,96,1));case"seagreen":return new o(new q(46,139,87,1));case"seashell":return new o(new q(255,245,238,1));case"sienna":return new o(new q(160,82,45,1));case"silver":return new o(new q(192,192,192,1));case"skyblue":return new o(new q(135,206,235,1));case"slateblue":return new o(new q(106,90,205,1));case"slategray":return new o(new q(112,128,144,1));case"slategrey":return new o(new q(112,128,144,1));case"snow":return new o(new q(255,250,250,1));case"springgreen":return new o(new q(0,255,127,1));case"steelblue":return new o(new q(70,130,180,1));case"tan":return new o(new q(210,180,140,1));case"teal":return new o(new q(0,128,128,1));case"thistle":return new o(new q(216,191,216,1));case"tomato":return new o(new q(255,99,71,1));case"turquoise":return new o(new q(64,224,208,1));case"violet":return new o(new q(238,130,238,1));case"wheat":return new o(new q(245,222,179,1));case"white":return new o(new q(255,255,255,1));case"whitesmoke":return new o(new q(245,245,245,1));case"yellow":return new o(new q(255,255,0,1));case"yellowgreen":return new o(new q(154,205,50,1));default:return null}}function f(m){const _=m.length;if(_===0||m.charCodeAt(0)!==35)return null;if(_===7){const b=16*g(m.charCodeAt(1))+g(m.charCodeAt(2)),C=16*g(m.charCodeAt(3))+g(m.charCodeAt(4)),w=16*g(m.charCodeAt(5))+g(m.charCodeAt(6));return new o(new q(b,C,w,1))}if(_===9){const b=16*g(m.charCodeAt(1))+g(m.charCodeAt(2)),C=16*g(m.charCodeAt(3))+g(m.charCodeAt(4)),w=16*g(m.charCodeAt(5))+g(m.charCodeAt(6)),v=16*g(m.charCodeAt(7))+g(m.charCodeAt(8));return new o(new q(b,C,w,v/255))}if(_===4){const b=g(m.charCodeAt(1)),C=g(m.charCodeAt(2)),w=g(m.charCodeAt(3));return new o(new q(16*b+b,16*C+C,16*w+w))}if(_===5){const b=g(m.charCodeAt(1)),C=g(m.charCodeAt(2)),w=g(m.charCodeAt(3)),v=g(m.charCodeAt(4));return new o(new q(16*b+b,16*C+C,16*w+w,(16*v+v)/255))}return null}t.parseHex=f;function g(m){switch(m){case 48:return 0;case 49:return 1;case 50:return 2;case 51:return 3;case 52:return 4;case 53:return 5;case 54:return 6;case 55:return 7;case 56:return 8;case 57:return 9;case 97:return 10;case 65:return 10;case 98:return 11;case 66:return 11;case 99:return 12;case 67:return 12;case 100:return 13;case 68:return 13;case 101:return 14;case 69:return 14;case 102:return 15;case 70:return 15}return 0}})(e.CSS||(e.CSS={}))})(o.Format||(o.Format={}))})($||($={}));function eM(o){return`--vscode-${o.replace(/\./g,"-")}`}function J(o){return`var(${eM(o)})`}function RV(o,e){return`var(${eM(o)}, ${e})`}function Bae(o){return o!==null&&typeof o=="object"&&"light"in o&&"dark"in o}const MV={ColorContribution:"base.contributions.colors"},Hae="default";class Vae extends A{constructor(){super(),this._onDidChangeSchema=this._register(new P),this.onDidChangeSchema=this._onDidChangeSchema.event,this.colorSchema={type:"object",properties:{}},this.colorReferenceSchema={type:"string",enum:[],enumDescriptions:[]},this.colorsById={}}registerColor(e,t,i,n=!1,s){const r={id:e,description:i,defaults:t,needsTransparency:n,deprecationMessage:s};this.colorsById[e]=r;const a={type:"string",format:"color-hex",defaultSnippets:[{body:"${1:#ff0000}"}]};return s&&(a.deprecationMessage=s),n&&(a.pattern="^#(?:(?<rgba>[0-9a-fA-f]{3}[0-9a-eA-E])|(?:[0-9a-fA-F]{6}(?:(?![fF]{2})(?:[0-9a-fA-F]{2}))))?$",a.patternErrorMessage=p(2004,"This color must be transparent or it will obscure content")),this.colorSchema.properties[e]={description:i,oneOf:[a,{type:"string",const:Hae,description:p(2005,"Use the default color.")}]},this.colorReferenceSchema.enum.push(e),this.colorReferenceSchema.enumDescriptions.push(i),this._onDidChangeSchema.fire(),e}getColors(){return Object.keys(this.colorsById).map(e=>this.colorsById[e])}resolveDefaultColor(e,t){const i=this.colorsById[e];if(i?.defaults){const n=Bae(i.defaults)?i.defaults[t.type]:i.defaults;return Dr(n,t)}}getColorSchema(){return this.colorSchema}toString(){const e=(t,i)=>{const n=t.indexOf(".")===-1?0:1,s=i.indexOf(".")===-1?0:1;return n!==s?n-s:t.localeCompare(i)};return Object.keys(this.colorsById).sort(e).map(t=>`- \`${t}\`: ${this.colorsById[t].description}`).join(`
`)}}const bL=new Vae;ei.add(MV.ColorContribution,bL);function N(o,e,t,i,n){return bL.registerColor(o,e,t,i,n)}function zae(o,e){switch(o.op){case 0:return Dr(o.value,e)?.darken(o.factor);case 1:return Dr(o.value,e)?.lighten(o.factor);case 2:return Dr(o.value,e)?.transparent(o.factor);case 7:{const t=Dr(o.color,e)||$.transparent,i=Dr(o.with,e)||$.transparent;return t.mix(i,o.ratio)}case 3:{const t=Dr(o.background,e);return t?Dr(o.value,e)?.makeOpaque(t):Dr(o.value,e)}case 4:for(const t of o.values){const i=Dr(t,e);if(i)return i}return;case 6:return Dr(e.defines(o.if)?o.then:o.else,e);case 5:{const t=Dr(o.value,e);if(!t)return;const i=Dr(o.background,e);return i?t.isDarkerThan(i)?$.getLighterColor(t,i,o.factor).transparent(o.transparency):$.getDarkerColor(t,i,o.factor).transparent(o.transparency):t.transparent(o.factor*o.transparency)}default:throw ZC()}}function $s(o,e){return{op:0,value:o,factor:e}}function Ea(o,e){return{op:1,value:o,factor:e}}function Ne(o,e){return{op:2,value:o,factor:e}}function H1(...o){return{op:4,values:o}}function Uae(o,e,t){return{op:6,if:o,then:e,else:t}}function PV(o,e,t,i){return{op:5,value:o,background:e,factor:t,transparency:i}}function Dr(o,e){if(o!==null){if(typeof o=="string")return o[0]==="#"?$.fromHex(o):e.getColor(o);if(o instanceof $)return o;if(typeof o=="object")return zae(o,e)}}const AV="vscode://schemas/workbench-colors",OV=ei.as(nL.JSONContribution);OV.registerSchema(AV,bL.getColorSchema());const FV=new wt(()=>OV.notifySchemaChanged(AV),200);bL.onDidChangeSchema(()=>{FV.isScheduled()||FV.schedule()});const Ue=N("foreground",{dark:"#CCCCCC",light:"#616161",hcDark:"#FFFFFF",hcLight:"#292929"},p(1756,"Overall foreground color. This color is only used if not overridden by a component."));N("disabledForeground",{dark:"#CCCCCC80",light:"#61616180",hcDark:"#A5A5A5",hcLight:"#7F7F7F"},p(1757,"Overall foreground for disabled elements. This color is only used if not overridden by a component.")),N("errorForeground",{dark:"#F48771",light:"#A1260D",hcDark:"#F48771",hcLight:"#B5200D"},p(1758,"Overall foreground color for error messages. This color is only used if not overridden by a component."));const WV=N("descriptionForeground",{light:"#717171",dark:Ne(Ue,.7),hcDark:Ne(Ue,.7),hcLight:Ne(Ue,.7)},p(1759,"Foreground color for description text providing additional information, for example for a label.")),CL=N("icon.foreground",{dark:"#C5C5C5",light:"#424242",hcDark:"#FFFFFF",hcLight:"#292929"},p(1760,"The default color for icons in the workbench.")),_l=N("focusBorder",{dark:"#007FD4",light:"#0090F1",hcDark:"#F38518",hcLight:"#006BBD"},p(1761,"Overall border color for focused elements. This color is only used if not overridden by a component.")),Ze=N("contrastBorder",{light:null,dark:null,hcDark:"#6FC3DF",hcLight:"#0F4A85"},p(1762,"An extra border around elements to separate them from others for greater contrast.")),jt=N("contrastActiveBorder",{light:null,dark:null,hcDark:_l,hcLight:_l},p(1763,"An extra border around active elements to separate them from others for greater contrast."));N("selection.background",null,p(1764,"The background color of text selections in the workbench (e.g. for input fields or text areas). Note that this does not apply to selections within the editor."));const $ae=N("textLink.foreground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},p(1765,"Foreground color for links in text."));N("textLink.activeForeground",{light:"#006AB1",dark:"#3794FF",hcDark:"#21A6FF",hcLight:"#0F4A85"},p(1766,"Foreground color for links in text when clicked on and on mouse hover.")),N("textSeparator.foreground",{light:"#0000002e",dark:"#ffffff2e",hcDark:$.black,hcLight:"#292929"},p(1767,"Color for text separators.")),N("textPreformat.foreground",{light:"#A31515",dark:"#D7BA7D",hcDark:"#000000",hcLight:"#FFFFFF"},p(1768,"Foreground color for preformatted text segments.")),N("textPreformat.background",{light:"#0000001A",dark:"#FFFFFF1A",hcDark:"#FFFFFF",hcLight:"#09345f"},p(1769,"Background color for preformatted text segments.")),N("textBlockQuote.background",{light:"#f2f2f2",dark:"#222222",hcDark:null,hcLight:"#F2F2F2"},p(1770,"Background color for block quotes in text.")),N("textBlockQuote.border",{light:"#007acc80",dark:"#007acc80",hcDark:$.white,hcLight:"#292929"},p(1771,"Border color for block quotes in text.")),N("textCodeBlock.background",{light:"#dcdcdc66",dark:"#0a0a0a66",hcDark:$.black,hcLight:"#F2F2F2"},p(1772,"Background color for code blocks in text.")),N("sash.hoverBorder",_l,p(1977,"Border color of active sashes."));const vL=N("badge.background",{dark:"#4D4D4D",light:"#C4C4C4",hcDark:$.black,hcLight:"#0F4A85"},p(1978,"Badge background color. Badges are small information labels, e.g. for search results count.")),jae=N("badge.foreground",{dark:$.white,light:"#333",hcDark:$.white,hcLight:$.white},p(1979,"Badge foreground color. Badges are small information labels, e.g. for search results count."));N("activityWarningBadge.foreground",{dark:$.black.lighten(.2),light:$.white,hcDark:null,hcLight:$.black.lighten(.2)},p(1980,"Foreground color of the warning activity badge")),N("activityWarningBadge.background",{dark:"#CCA700",light:"#BF8803",hcDark:null,hcLight:"#CCA700"},p(1981,"Background color of the warning activity badge")),N("activityErrorBadge.foreground",{dark:$.black.lighten(.2),light:$.white,hcDark:null,hcLight:$.black.lighten(.2)},p(1982,"Foreground color of the error activity badge")),N("activityErrorBadge.background",{dark:"#F14C4C",light:"#E51400",hcDark:null,hcLight:"#F14C4C"},p(1983,"Background color of the error activity badge"));const wL=N("scrollbar.shadow",{dark:"#000000",light:"#DDDDDD",hcDark:null,hcLight:null},p(1984,"Scrollbar shadow to indicate that the view is scrolled.")),BV=N("scrollbarSlider.background",{dark:$.fromHex("#797979").transparent(.4),light:$.fromHex("#646464").transparent(.4),hcDark:Ne(Ze,.6),hcLight:Ne(Ze,.4)},p(1985,"Scrollbar slider background color.")),HV=N("scrollbarSlider.hoverBackground",{dark:$.fromHex("#646464").transparent(.7),light:$.fromHex("#646464").transparent(.7),hcDark:Ne(Ze,.8),hcLight:Ne(Ze,.8)},p(1986,"Scrollbar slider background color when hovering.")),VV=N("scrollbarSlider.activeBackground",{dark:$.fromHex("#BFBFBF").transparent(.4),light:$.fromHex("#000000").transparent(.6),hcDark:Ze,hcLight:Ze},p(1987,"Scrollbar slider background color when clicked on.")),qae=N("progressBar.background",{dark:$.fromHex("#0E70C0"),light:$.fromHex("#0E70C0"),hcDark:Ze,hcLight:Ze},p(1988,"Background color of the progress bar that can show for long running operations."));N("chart.line",{dark:"#236B8E",light:"#236B8E",hcDark:"#236B8E",hcLight:"#236B8E"},p(1989,"Line color for the chart.")),N("chart.axis",{dark:$.fromHex("#BFBFBF").transparent(.4),light:$.fromHex("#000000").transparent(.6),hcDark:Ze,hcLight:Ze},p(1990,"Axis color for the chart.")),N("chart.guide",{dark:$.fromHex("#BFBFBF").transparent(.2),light:$.fromHex("#000000").transparent(.2),hcDark:Ze,hcLight:Ze},p(1991,"Guide line for the chart."));const xi=N("editor.background",{light:"#ffffff",dark:"#1E1E1E",hcDark:$.black,hcLight:$.white},p(1781,"Editor background color.")),bl=N("editor.foreground",{light:"#333333",dark:"#BBBBBB",hcDark:$.white,hcLight:Ue},p(1782,"Editor default foreground color."));N("editorStickyScroll.background",xi,p(1783,"Background color of sticky scroll in the editor")),N("editorStickyScrollGutter.background",xi,p(1784,"Background color of the gutter part of sticky scroll in the editor")),N("editorStickyScrollHover.background",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:null,hcLight:$.fromHex("#0F4A85").transparent(.1)},p(1785,"Background color of sticky scroll on hover in the editor")),N("editorStickyScroll.border",{dark:null,light:null,hcDark:Ze,hcLight:Ze},p(1786,"Border color of sticky scroll in the editor")),N("editorStickyScroll.shadow",wL,p(1787," Shadow color of sticky scroll in the editor"));const Ho=N("editorWidget.background",{dark:"#252526",light:"#F3F3F3",hcDark:"#0C141F",hcLight:$.white},p(1788,"Background color of editor widgets, such as find/replace.")),SL=N("editorWidget.foreground",Ue,p(1789,"Foreground color of editor widgets, such as find/replace.")),tM=N("editorWidget.border",{dark:"#454545",light:"#C8C8C8",hcDark:Ze,hcLight:Ze},p(1790,"Border color of editor widgets. The color is only used if the widget chooses to have a border and if the color is not overridden by a widget."));N("editorWidget.resizeBorder",null,p(1791,"Border color of the resize bar of editor widgets. The color is only used if the widget chooses to have a resize border and if the color is not overridden by a widget.")),N("editorError.background",null,p(1792,"Background color of error text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const yL=N("editorError.foreground",{dark:"#F14C4C",light:"#E51400",hcDark:"#F48771",hcLight:"#B5200D"},p(1793,"Foreground color of error squigglies in the editor.")),Kae=N("editorError.border",{dark:null,light:null,hcDark:$.fromHex("#E47777").transparent(.8),hcLight:"#B5200D"},p(1794,"If set, color of double underlines for errors in the editor.")),Gae=N("editorWarning.background",null,p(1795,"Background color of warning text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0),Wc=N("editorWarning.foreground",{dark:"#CCA700",light:"#BF8803",hcDark:"#FFD370",hcLight:"#895503"},p(1796,"Foreground color of warning squigglies in the editor.")),V1=N("editorWarning.border",{dark:null,light:null,hcDark:$.fromHex("#FFCC00").transparent(.8),hcLight:$.fromHex("#FFCC00").transparent(.8)},p(1797,"If set, color of double underlines for warnings in the editor."));N("editorInfo.background",null,p(1798,"Background color of info text in the editor. The color must not be opaque so as not to hide underlying decorations."),!0);const Cl=N("editorInfo.foreground",{dark:"#3794FF",light:"#1a85ff",hcDark:"#3794FF",hcLight:"#1a85ff"},p(1799,"Foreground color of info squigglies in the editor.")),z1=N("editorInfo.border",{dark:null,light:null,hcDark:$.fromHex("#3794FF").transparent(.8),hcLight:"#292929"},p(1800,"If set, color of double underlines for infos in the editor.")),Zae=N("editorHint.foreground",{dark:$.fromHex("#eeeeee").transparent(.7),light:"#6c6c6c",hcDark:null,hcLight:null},p(1801,"Foreground color of hint squigglies in the editor."));N("editorHint.border",{dark:null,light:null,hcDark:$.fromHex("#eeeeee").transparent(.8),hcLight:"#292929"},p(1802,"If set, color of double underlines for hints in the editor."));const Yae=N("editorLink.activeForeground",{dark:"#4E94CE",light:$.blue,hcDark:$.cyan,hcLight:"#292929"},p(1803,"Color of active links.")),Ch=N("editor.selectionBackground",{light:"#ADD6FF",dark:"#264F78",hcDark:"#f3f518",hcLight:"#0F4A85"},p(1804,"Color of the editor selection.")),Xae=N("editor.selectionForeground",{light:null,dark:null,hcDark:"#000000",hcLight:$.white},p(1805,"Color of the selected text for high contrast.")),zV=N("editor.inactiveSelectionBackground",{light:Ne(Ch,.5),dark:Ne(Ch,.5),hcDark:Ne(Ch,.7),hcLight:Ne(Ch,.5)},p(1806,"Color of the selection in an inactive editor. The color must not be opaque so as not to hide underlying decorations."),!0),iM=N("editor.selectionHighlightBackground",{light:PV(Ch,xi,.3,.6),dark:PV(Ch,xi,.3,.6),hcDark:null,hcLight:null},p(1807,"Color for regions with the same content as the selection. The color must not be opaque so as not to hide underlying decorations."),!0);N("editor.selectionHighlightBorder",{light:null,dark:null,hcDark:jt,hcLight:jt},p(1808,"Border color for regions with the same content as the selection.")),N("editor.compositionBorder",{light:"#000000",dark:"#ffffff",hcLight:"#000000",hcDark:"#ffffff"},p(1809,"The border color for an IME composition.")),N("editor.findMatchBackground",{light:"#A8AC94",dark:"#515C6A",hcDark:null,hcLight:null},p(1810,"Color of the current search match."));const Qae=N("editor.findMatchForeground",null,p(1811,"Text color of the current search match.")),Bc=N("editor.findMatchHighlightBackground",{light:"#EA5C0055",dark:"#EA5C0055",hcDark:null,hcLight:null},p(1812,"Color of the other search matches. The color must not be opaque so as not to hide underlying decorations."),!0),Jae=N("editor.findMatchHighlightForeground",null,p(1813,"Foreground color of the other search matches."),!0);N("editor.findRangeHighlightBackground",{dark:"#3a3d4166",light:"#b4b4b44d",hcDark:null,hcLight:null},p(1814,"Color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0),N("editor.findMatchBorder",{light:null,dark:null,hcDark:jt,hcLight:jt},p(1815,"Border color of the current search match."));const vh=N("editor.findMatchHighlightBorder",{light:null,dark:null,hcDark:jt,hcLight:jt},p(1816,"Border color of the other search matches.")),ele=N("editor.findRangeHighlightBorder",{dark:null,light:null,hcDark:Ne(jt,.4),hcLight:Ne(jt,.4)},p(1817,"Border color of the range limiting the search. The color must not be opaque so as not to hide underlying decorations."),!0);N("editor.hoverHighlightBackground",{light:"#ADD6FF26",dark:"#264f7840",hcDark:"#ADD6FF26",hcLight:null},p(1818,"Highlight below the word for which a hover is shown. The color must not be opaque so as not to hide underlying decorations."),!0);const LL=N("editorHoverWidget.background",Ho,p(1819,"Background color of the editor hover.")),UV=N("editorHoverWidget.foreground",SL,p(1820,"Foreground color of the editor hover.")),nM=N("editorHoverWidget.border",tM,p(1821,"Border color of the editor hover."));N("editorHoverWidget.statusBarBackground",{dark:Ea(LL,.2),light:$s(LL,.05),hcDark:Ho,hcLight:Ho},p(1822,"Background color of the editor hover status bar."));const sM=N("editorInlayHint.foreground",{dark:"#969696",light:"#969696",hcDark:$.white,hcLight:$.black},p(1823,"Foreground color of inline hints")),oM=N("editorInlayHint.background",{dark:Ne(vL,.1),light:Ne(vL,.1),hcDark:Ne($.white,.1),hcLight:Ne(vL,.1)},p(1824,"Background color of inline hints")),tle=N("editorInlayHint.typeForeground",sM,p(1825,"Foreground color of inline hints for types")),ile=N("editorInlayHint.typeBackground",oM,p(1826,"Background color of inline hints for types")),nle=N("editorInlayHint.parameterForeground",sM,p(1827,"Foreground color of inline hints for parameters")),sle=N("editorInlayHint.parameterBackground",oM,p(1828,"Background color of inline hints for parameters")),ole=N("editorLightBulb.foreground",{dark:"#FFCC00",light:"#DDB100",hcDark:"#FFCC00",hcLight:"#007ACC"},p(1829,"The color used for the lightbulb actions icon."));N("editorLightBulbAutoFix.foreground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p(1830,"The color used for the lightbulb auto fix actions icon.")),N("editorLightBulbAi.foreground",ole,p(1831,"The color used for the lightbulb AI icon.")),N("editor.snippetTabstopHighlightBackground",{dark:new $(new q(124,124,124,.3)),light:new $(new q(10,50,100,.2)),hcDark:new $(new q(124,124,124,.3)),hcLight:new $(new q(10,50,100,.2))},p(1832,"Highlight background color of a snippet tabstop.")),N("editor.snippetTabstopHighlightBorder",null,p(1833,"Highlight border color of a snippet tabstop.")),N("editor.snippetFinalTabstopHighlightBackground",null,p(1834,"Highlight background color of the final tabstop of a snippet.")),N("editor.snippetFinalTabstopHighlightBorder",{dark:"#525252",light:new $(new q(10,50,100,.5)),hcDark:"#525252",hcLight:"#292929"},p(1835,"Highlight border color of the final tabstop of a snippet."));const rM=new $(new q(155,185,85,.2)),aM=new $(new q(255,0,0,.2)),Df=N("diffEditor.insertedTextBackground",{dark:"#9ccc2c33",light:"#9ccc2c40",hcDark:null,hcLight:null},p(1836,"Background color for text that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0),wh=N("diffEditor.removedTextBackground",{dark:"#ff000033",light:"#ff000033",hcDark:null,hcLight:null},p(1837,"Background color for text that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),xL=N("diffEditor.insertedLineBackground",{dark:rM,light:rM,hcDark:null,hcLight:null},p(1838,"Background color for lines that got inserted. The color must not be opaque so as not to hide underlying decorations."),!0);N("diffEditor.removedLineBackground",{dark:aM,light:aM,hcDark:null,hcLight:null},p(1839,"Background color for lines that got removed. The color must not be opaque so as not to hide underlying decorations."),!0),N("diffEditorGutter.insertedLineBackground",null,p(1840,"Background color for the margin where lines got inserted.")),N("diffEditorGutter.removedLineBackground",null,p(1841,"Background color for the margin where lines got removed."));const rle=N("diffEditorOverview.insertedForeground",null,p(1842,"Diff overview ruler foreground for inserted content.")),ale=N("diffEditorOverview.removedForeground",null,p(1843,"Diff overview ruler foreground for removed content."));N("diffEditor.insertedTextBorder",{dark:null,light:null,hcDark:"#33ff2eff",hcLight:"#374E06"},p(1844,"Outline color for the text that got inserted.")),N("diffEditor.removedTextBorder",{dark:null,light:null,hcDark:"#FF008F",hcLight:"#AD0707"},p(1845,"Outline color for text that got removed.")),N("diffEditor.border",{dark:null,light:null,hcDark:Ze,hcLight:Ze},p(1846,"Border color between the two text editors.")),N("diffEditor.diagonalFill",{dark:"#cccccc33",light:"#22222233",hcDark:null,hcLight:null},p(1847,"Color of the diff editor's diagonal fill. The diagonal fill is used in side-by-side diff views.")),N("diffEditor.unchangedRegionBackground","sideBar.background",p(1848,"The background color of unchanged blocks in the diff editor.")),N("diffEditor.unchangedRegionForeground","foreground",p(1849,"The foreground color of unchanged blocks in the diff editor.")),N("diffEditor.unchangedCodeBackground",{dark:"#74747429",light:"#b8b8b829",hcDark:null,hcLight:null},p(1850,"The background color of unchanged code in the diff editor."));const a_=N("widget.shadow",{dark:Ne($.black,.36),light:Ne($.black,.16),hcDark:null,hcLight:null},p(1851,"Shadow color of widgets such as find/replace inside the editor.")),lM=N("widget.border",{dark:null,light:null,hcDark:Ze,hcLight:Ze},p(1852,"Border color of widgets such as find/replace inside the editor.")),$V=N("toolbar.hoverBackground",{dark:"#5a5d5e50",light:"#b8b8b850",hcDark:null,hcLight:null},p(1853,"Toolbar background when hovering over actions using the mouse"));N("toolbar.hoverOutline",{dark:null,light:null,hcDark:jt,hcLight:jt},p(1854,"Toolbar outline when hovering over actions using the mouse")),N("toolbar.activeBackground",{dark:Ea($V,.1),light:$s($V,.1),hcDark:null,hcLight:null},p(1855,"Toolbar background when holding the mouse over actions"));const lle=N("breadcrumb.foreground",Ne(Ue,.8),p(1856,"Color of focused breadcrumb items.")),cle=N("breadcrumb.background",xi,p(1857,"Background color of breadcrumb items.")),jV=N("breadcrumb.focusForeground",{light:$s(Ue,.2),dark:Ea(Ue,.1),hcDark:Ea(Ue,.1),hcLight:Ea(Ue,.1)},p(1858,"Color of focused breadcrumb items.")),dle=N("breadcrumb.activeSelectionForeground",{light:$s(Ue,.2),dark:Ea(Ue,.1),hcDark:Ea(Ue,.1),hcLight:Ea(Ue,.1)},p(1859,"Color of selected breadcrumb items."));N("breadcrumbPicker.background",Ho,p(1860,"Background color of breadcrumb item picker."));const qV=.5,KV=$.fromHex("#40C8AE").transparent(qV),GV=$.fromHex("#40A6FF").transparent(qV),ZV=$.fromHex("#606060").transparent(.4),cM=.4,l_=1,dM=N("merge.currentHeaderBackground",{dark:KV,light:KV,hcDark:null,hcLight:null},p(1861,"Current header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);N("merge.currentContentBackground",Ne(dM,cM),p(1862,"Current content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const hM=N("merge.incomingHeaderBackground",{dark:GV,light:GV,hcDark:null,hcLight:null},p(1863,"Incoming header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);N("merge.incomingContentBackground",Ne(hM,cM),p(1864,"Incoming content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const uM=N("merge.commonHeaderBackground",{dark:ZV,light:ZV,hcDark:null,hcLight:null},p(1865,"Common ancestor header background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);N("merge.commonContentBackground",Ne(uM,cM),p(1866,"Common ancestor content background in inline merge-conflicts. The color must not be opaque so as not to hide underlying decorations."),!0);const c_=N("merge.border",{dark:null,light:null,hcDark:"#C3DF6F",hcLight:"#007ACC"},p(1867,"Border color on headers and the splitter in inline merge-conflicts."));N("editorOverviewRuler.currentContentForeground",{dark:Ne(dM,l_),light:Ne(dM,l_),hcDark:c_,hcLight:c_},p(1868,"Current overview ruler foreground for inline merge-conflicts.")),N("editorOverviewRuler.incomingContentForeground",{dark:Ne(hM,l_),light:Ne(hM,l_),hcDark:c_,hcLight:c_},p(1869,"Incoming overview ruler foreground for inline merge-conflicts.")),N("editorOverviewRuler.commonContentForeground",{dark:Ne(uM,l_),light:Ne(uM,l_),hcDark:c_,hcLight:c_},p(1870,"Common ancestor overview ruler foreground for inline merge-conflicts."));const fM=N("editorOverviewRuler.findMatchForeground",{dark:"#d186167e",light:"#d186167e",hcDark:"#AB5A00",hcLight:"#AB5A00"},p(1871,"Overview ruler marker color for find matches. The color must not be opaque so as not to hide underlying decorations."),!0),YV=N("editorOverviewRuler.selectionHighlightForeground","#A0A0A0CC",p(1872,"Overview ruler marker color for selection highlights. The color must not be opaque so as not to hide underlying decorations."),!0),hle=N("problemsErrorIcon.foreground",yL,p(1873,"The color used for the problems error icon.")),ule=N("problemsWarningIcon.foreground",Wc,p(1874,"The color used for the problems warning icon.")),fle=N("problemsInfoIcon.foreground",Cl,p(1875,"The color used for the problems info icon.")),gM=N("minimap.findMatchHighlight",{light:"#d18616",dark:"#d18616",hcDark:"#AB5A00",hcLight:"#0F4A85"},p(1966,"Minimap marker color for find matches."),!0),kL=N("minimap.selectionOccurrenceHighlight",{light:"#c9c9c9",dark:"#676767",hcDark:"#ffffff",hcLight:"#0F4A85"},p(1967,"Minimap marker color for repeating editor selections."),!0),XV=N("minimap.selectionHighlight",{light:"#ADD6FF",dark:"#264F78",hcDark:"#ffffff",hcLight:"#0F4A85"},p(1968,"Minimap marker color for the editor selection."),!0),gle=N("minimap.infoHighlight",{dark:Cl,light:Cl,hcDark:z1,hcLight:z1},p(1969,"Minimap marker color for infos.")),ple=N("minimap.warningHighlight",{dark:Wc,light:Wc,hcDark:V1,hcLight:V1},p(1970,"Minimap marker color for warnings.")),mle=N("minimap.errorHighlight",{dark:new $(new q(255,18,18,.7)),light:new $(new q(255,18,18,.7)),hcDark:new $(new q(255,50,50,1)),hcLight:"#B5200D"},p(1971,"Minimap marker color for errors.")),_le=N("minimap.background",null,p(1972,"Minimap background color.")),ble=N("minimap.foregroundOpacity",$.fromHex("#000f"),p(1973,'Opacity of foreground elements rendered in the minimap. For example, "#000000c0" will render the elements with 75% opacity.'));N("minimapSlider.background",Ne(BV,.5),p(1974,"Minimap slider background color.")),N("minimapSlider.hoverBackground",Ne(HV,.5),p(1975,"Minimap slider background color when hovering.")),N("minimapSlider.activeBackground",Ne(VV,.5),p(1976,"Minimap slider background color when clicked on.")),N("charts.foreground",Ue,p(1773,"The foreground color used in charts.")),N("charts.lines",Ne(Ue,.5),p(1774,"The color used for horizontal lines in charts.")),N("charts.red",yL,p(1775,"The red color used in chart visualizations.")),N("charts.blue",Cl,p(1776,"The blue color used in chart visualizations.")),N("charts.yellow",Wc,p(1777,"The yellow color used in chart visualizations.")),N("charts.orange",gM,p(1778,"The orange color used in chart visualizations.")),N("charts.green",{dark:"#89D185",light:"#388A34",hcDark:"#89D185",hcLight:"#374e06"},p(1779,"The green color used in chart visualizations.")),N("charts.purple",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p(1780,"The purple color used in chart visualizations."));const pM=N("input.background",{dark:"#3C3C3C",light:$.white,hcDark:$.black,hcLight:$.white},p(1876,"Input box background.")),QV=N("input.foreground",Ue,p(1877,"Input box foreground.")),JV=N("input.border",{dark:null,light:null,hcDark:Ze,hcLight:Ze},p(1878,"Input box border.")),IL=N("inputOption.activeBorder",{dark:"#007ACC",light:"#007ACC",hcDark:Ze,hcLight:Ze},p(1879,"Border color of activated options in input fields.")),Cle=N("inputOption.hoverBackground",{dark:"#5a5d5e80",light:"#b8b8b850",hcDark:null,hcLight:null},p(1880,"Background color of activated options in input fields.")),U1=N("inputOption.activeBackground",{dark:Ne(_l,.4),light:Ne(_l,.2),hcDark:$.transparent,hcLight:$.transparent},p(1881,"Background hover color of options in input fields.")),DL=N("inputOption.activeForeground",{dark:$.white,light:$.black,hcDark:Ue,hcLight:Ue},p(1882,"Foreground color of activated options in input fields."));N("input.placeholderForeground",{light:Ne(Ue,.5),dark:Ne(Ue,.5),hcDark:Ne(Ue,.7),hcLight:Ne(Ue,.7)},p(1883,"Input box foreground color for placeholder text."));const vle=N("inputValidation.infoBackground",{dark:"#063B49",light:"#D6ECF2",hcDark:$.black,hcLight:$.white},p(1884,"Input validation background color for information severity.")),wle=N("inputValidation.infoForeground",{dark:null,light:null,hcDark:null,hcLight:Ue},p(1885,"Input validation foreground color for information severity.")),Sle=N("inputValidation.infoBorder",{dark:"#007acc",light:"#007acc",hcDark:Ze,hcLight:Ze},p(1886,"Input validation border color for information severity.")),yle=N("inputValidation.warningBackground",{dark:"#352A05",light:"#F6F5D2",hcDark:$.black,hcLight:$.white},p(1887,"Input validation background color for warning severity.")),Lle=N("inputValidation.warningForeground",{dark:null,light:null,hcDark:null,hcLight:Ue},p(1888,"Input validation foreground color for warning severity.")),xle=N("inputValidation.warningBorder",{dark:"#B89500",light:"#B89500",hcDark:Ze,hcLight:Ze},p(1889,"Input validation border color for warning severity.")),kle=N("inputValidation.errorBackground",{dark:"#5A1D1D",light:"#F2DEDE",hcDark:$.black,hcLight:$.white},p(1890,"Input validation background color for error severity.")),Ile=N("inputValidation.errorForeground",{dark:null,light:null,hcDark:null,hcLight:Ue},p(1891,"Input validation foreground color for error severity.")),Dle=N("inputValidation.errorBorder",{dark:"#BE1100",light:"#BE1100",hcDark:Ze,hcLight:Ze},p(1892,"Input validation border color for error severity.")),EL=N("dropdown.background",{dark:"#3C3C3C",light:$.white,hcDark:$.black,hcLight:$.white},p(1893,"Dropdown background.")),Ele=N("dropdown.listBackground",{dark:null,light:null,hcDark:$.black,hcLight:$.white},p(1894,"Dropdown list background.")),mM=N("dropdown.foreground",{dark:"#F0F0F0",light:Ue,hcDark:$.white,hcLight:Ue},p(1895,"Dropdown foreground.")),_M=N("dropdown.border",{dark:EL,light:"#CECECE",hcDark:Ze,hcLight:Ze},p(1896,"Dropdown border.")),NL=N("button.foreground",$.white,p(1897,"Button foreground color.")),Nle=N("button.separator",Ne(NL,.4),p(1898,"Button separator color.")),Ef=N("button.background",{dark:"#0E639C",light:"#007ACC",hcDark:null,hcLight:"#0F4A85"},p(1899,"Button background color.")),Tle=N("button.hoverBackground",{dark:Ea(Ef,.2),light:$s(Ef,.2),hcDark:Ef,hcLight:Ef},p(1900,"Button background color when hovering.")),Rle=N("button.border",Ze,p(1901,"Button border color.")),ez=N("button.secondaryForeground",{dark:$.white,light:$.white,hcDark:$.white,hcLight:Ue},p(1902,"Secondary button foreground color.")),TL=N("button.secondaryBackground",{dark:"#3A3D41",light:"#5F6A79",hcDark:null,hcLight:$.white},p(1903,"Secondary button background color.")),Mle=N("button.secondaryHoverBackground",{dark:Ea(TL,.2),light:$s(TL,.2),hcDark:null,hcLight:null},p(1904,"Secondary button background color when hovering.")),$1=N("radio.activeForeground",DL,p(1905,"Foreground color of active radio option.")),Ple=N("radio.activeBackground",U1,p(1906,"Background color of active radio option.")),Ale=N("radio.activeBorder",IL,p(1907,"Border color of the active radio option.")),Ole=N("radio.inactiveForeground",null,p(1908,"Foreground color of inactive radio option.")),Fle=N("radio.inactiveBackground",null,p(1909,"Background color of inactive radio option.")),Wle=N("radio.inactiveBorder",{light:Ne($1,.2),dark:Ne($1,.2),hcDark:Ne($1,.4),hcLight:Ne($1,.2)},p(1910,"Border color of the inactive radio option.")),Ble=N("radio.inactiveHoverBackground",Cle,p(1911,"Background color of inactive active radio option when hovering.")),bM=N("checkbox.background",EL,p(1912,"Background color of checkbox widget."));N("checkbox.selectBackground",Ho,p(1913,"Background color of checkbox widget when the element it's in is selected."));const CM=N("checkbox.foreground",mM,p(1914,"Foreground color of checkbox widget.")),Hle=N("checkbox.border",_M,p(1915,"Border color of checkbox widget."));N("checkbox.selectBorder",CL,p(1916,"Border color of checkbox widget when the element it's in is selected."));const Vle=N("checkbox.disabled.background",{op:7,color:bM,with:CM,ratio:.33},p(1917,"Background of a disabled checkbox.")),zle=N("checkbox.disabled.foreground",{op:7,color:CM,with:bM,ratio:.33},p(1918,"Foreground of a disabled checkbox.")),Ule=N("keybindingLabel.background",{dark:new $(new q(128,128,128,.17)),light:new $(new q(221,221,221,.4)),hcDark:$.transparent,hcLight:$.transparent},p(1919,"Keybinding label background color. The keybinding label is used to represent a keyboard shortcut.")),$le=N("keybindingLabel.foreground",{dark:$.fromHex("#CCCCCC"),light:$.fromHex("#555555"),hcDark:$.white,hcLight:Ue},p(1920,"Keybinding label foreground color. The keybinding label is used to represent a keyboard shortcut.")),jle=N("keybindingLabel.border",{dark:new $(new q(51,51,51,.6)),light:new $(new q(204,204,204,.4)),hcDark:new $(new q(111,195,223)),hcLight:Ze},p(1921,"Keybinding label border color. The keybinding label is used to represent a keyboard shortcut.")),qle=N("keybindingLabel.bottomBorder",{dark:new $(new q(68,68,68,.6)),light:new $(new q(187,187,187,.4)),hcDark:new $(new q(111,195,223)),hcLight:Ue},p(1922,"Keybinding label border bottom color. The keybinding label is used to represent a keyboard shortcut.")),Kle=N("list.focusBackground",null,p(1923,"List/Tree background color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Gle=N("list.focusForeground",null,p(1924,"List/Tree foreground color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Zle=N("list.focusOutline",{dark:_l,light:_l,hcDark:jt,hcLight:jt},p(1925,"List/Tree outline color for the focused item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Yle=N("list.focusAndSelectionOutline",null,p(1926,"List/Tree outline color for the focused item when the list/tree is active and selected. An active list/tree has keyboard focus, an inactive does not.")),Nf=N("list.activeSelectionBackground",{dark:"#04395E",light:"#0060C0",hcDark:null,hcLight:$.fromHex("#0F4A85").transparent(.1)},p(1927,"List/Tree background color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),j1=N("list.activeSelectionForeground",{dark:$.white,light:$.white,hcDark:null,hcLight:null},p(1928,"List/Tree foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),tz=N("list.activeSelectionIconForeground",null,p(1929,"List/Tree icon foreground color for the selected item when the list/tree is active. An active list/tree has keyboard focus, an inactive does not.")),Xle=N("list.inactiveSelectionBackground",{dark:"#37373D",light:"#E4E6F1",hcDark:null,hcLight:$.fromHex("#0F4A85").transparent(.1)},p(1930,"List/Tree background color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Qle=N("list.inactiveSelectionForeground",null,p(1931,"List/Tree foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),Jle=N("list.inactiveSelectionIconForeground",null,p(1932,"List/Tree icon foreground color for the selected item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),ece=N("list.inactiveFocusBackground",null,p(1933,"List/Tree background color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),tce=N("list.inactiveFocusOutline",null,p(1934,"List/Tree outline color for the focused item when the list/tree is inactive. An active list/tree has keyboard focus, an inactive does not.")),iz=N("list.hoverBackground",{dark:"#2A2D2E",light:"#F0F0F0",hcDark:$.white.transparent(.1),hcLight:$.fromHex("#0F4A85").transparent(.1)},p(1935,"List/Tree background when hovering over items using the mouse.")),nz=N("list.hoverForeground",null,p(1936,"List/Tree foreground when hovering over items using the mouse.")),ice=N("list.dropBackground",{dark:"#062F4A",light:"#D6EBFF",hcDark:null,hcLight:null},p(1937,"List/Tree drag and drop background when moving items over other items when using the mouse.")),nce=N("list.dropBetweenBackground",{dark:CL,light:CL,hcDark:null,hcLight:null},p(1938,"List/Tree drag and drop border color when moving items between items when using the mouse.")),d_=N("list.highlightForeground",{dark:"#2AAAFF",light:"#0066BF",hcDark:_l,hcLight:_l},p(1939,"List/Tree foreground color of the match highlights when searching inside the list/tree.")),sce=N("list.focusHighlightForeground",{dark:d_,light:Uae(Nf,d_,"#BBE7FF"),hcDark:d_,hcLight:d_},p(1940,"List/Tree foreground color of the match highlights on actively focused items when searching inside the list/tree."));N("list.invalidItemForeground",{dark:"#B89500",light:"#B89500",hcDark:"#B89500",hcLight:"#B5200D"},p(1941,"List/Tree foreground color for invalid items, for example an unresolved root in explorer.")),N("list.errorForeground",{dark:"#F88070",light:"#B01011",hcDark:null,hcLight:null},p(1942,"Foreground color of list items containing errors.")),N("list.warningForeground",{dark:"#CCA700",light:"#855F00",hcDark:null,hcLight:null},p(1943,"Foreground color of list items containing warnings."));const oce=N("listFilterWidget.background",{light:$s(Ho,0),dark:Ea(Ho,0),hcDark:Ho,hcLight:Ho},p(1944,"Background color of the type filter widget in lists and trees.")),rce=N("listFilterWidget.outline",{dark:$.transparent,light:$.transparent,hcDark:"#f38518",hcLight:"#007ACC"},p(1945,"Outline color of the type filter widget in lists and trees.")),ace=N("listFilterWidget.noMatchesOutline",{dark:"#BE1100",light:"#BE1100",hcDark:Ze,hcLight:Ze},p(1946,"Outline color of the type filter widget in lists and trees, when there are no matches.")),lce=N("listFilterWidget.shadow",a_,p(1947,"Shadow color of the type filter widget in lists and trees."));N("list.filterMatchBackground",{dark:Bc,light:Bc,hcDark:null,hcLight:null},p(1948,"Background color of the filtered match.")),N("list.filterMatchBorder",{dark:vh,light:vh,hcDark:Ze,hcLight:jt},p(1949,"Border color of the filtered match.")),N("list.deemphasizedForeground",{dark:"#8C8C8C",light:"#8E8E90",hcDark:"#A7A8A9",hcLight:"#666666"},p(1950,"List/Tree foreground color for items that are deemphasized."));const sz=N("tree.indentGuidesStroke",{dark:"#585858",light:"#a9a9a9",hcDark:"#a9a9a9",hcLight:"#a5a5a5"},p(1951,"Tree stroke color for the indentation guides.")),cce=N("tree.inactiveIndentGuidesStroke",Ne(sz,.4),p(1952,"Tree stroke color for the indentation guides that are not active.")),dce=N("tree.tableColumnsBorder",{dark:"#CCCCCC20",light:"#61616120",hcDark:null,hcLight:null},p(1953,"Table border color between columns.")),hce=N("tree.tableOddRowsBackground",{dark:Ne(Ue,.04),light:Ne(Ue,.04),hcDark:null,hcLight:null},p(1954,"Background color for odd table rows."));N("editorActionList.background",Ho,p(1955,"Action List background color."));const uce=N("editorActionList.foreground",SL,p(1956,"Action List foreground color."));N("editorActionList.focusForeground",j1,p(1957,"Action List foreground color for the focused item.")),N("editorActionList.focusBackground",Nf,p(1958,"Action List background color for the focused item."));const fce=N("menu.border",{dark:null,light:null,hcDark:Ze,hcLight:Ze},p(1959,"Border color of menus.")),gce=N("menu.foreground",mM,p(1960,"Foreground color of menu items.")),pce=N("menu.background",EL,p(1961,"Background color of menu items.")),mce=N("menu.selectionForeground",j1,p(1962,"Foreground color of the selected menu item in menus.")),_ce=N("menu.selectionBackground",Nf,p(1963,"Background color of the selected menu item in menus.")),bce=N("menu.selectionBorder",{dark:null,light:null,hcDark:jt,hcLight:jt},p(1964,"Border color of the selected menu item in menus.")),Cce=N("menu.separatorBackground",{dark:"#606060",light:"#D4D4D4",hcDark:Ze,hcLight:Ze},p(1965,"Color of a separator menu item in menus.")),vM=N("quickInput.background",Ho,p(1992,"Quick picker background color. The quick picker widget is the container for pickers like the command palette.")),vce=N("quickInput.foreground",SL,p(1993,"Quick picker foreground color. The quick picker widget is the container for pickers like the command palette.")),wce=N("quickInputTitle.background",{dark:new $(new q(255,255,255,.105)),light:new $(new q(0,0,0,.06)),hcDark:"#000000",hcLight:$.white},p(1994,"Quick picker title background color. The quick picker widget is the container for pickers like the command palette.")),oz=N("pickerGroup.foreground",{dark:"#3794FF",light:"#0066BF",hcDark:$.white,hcLight:"#0F4A85"},p(1995,"Quick picker color for grouping labels.")),Sce=N("pickerGroup.border",{dark:"#3F3F46",light:"#CCCEDB",hcDark:$.white,hcLight:"#0F4A85"},p(1996,"Quick picker color for grouping borders.")),rz=N("quickInput.list.focusBackground",null,"",void 0,p(1997,"Please use quickInputList.focusBackground instead")),q1=N("quickInputList.focusForeground",j1,p(1998,"Quick picker foreground color for the focused item.")),wM=N("quickInputList.focusIconForeground",tz,p(1999,"Quick picker icon foreground color for the focused item.")),K1=N("quickInputList.focusBackground",{dark:H1(rz,Nf),light:H1(rz,Nf),hcDark:null,hcLight:null},p(2e3,"Quick picker background color for the focused item."));N("search.resultsInfoForeground",{light:Ue,dark:Ne(Ue,.65),hcDark:Ue,hcLight:Ue},p(2001,"Color of the text in the search viewlet's completion message.")),N("searchEditor.findMatchBackground",{light:Ne(Bc,.66),dark:Ne(Bc,.66),hcDark:Bc,hcLight:Bc},p(2002,"Color of the Search Editor query matches.")),N("searchEditor.findMatchBorder",{light:Ne(vh,.66),dark:Ne(vh,.66),hcDark:vh,hcLight:vh},p(2003,"Border color of the Search Editor query matches."));class G1{constructor(e,t){this.x=e,this.y=t,this._pageCoordinatesBrand=void 0}toClientCoordinates(e){return new az(this.x-e.scrollX,this.y-e.scrollY)}}class az{constructor(e,t){this.clientX=e,this.clientY=t,this._clientCoordinatesBrand=void 0}toPageCoordinates(e){return new G1(this.clientX+e.scrollX,this.clientY+e.scrollY)}}class yce{constructor(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n,this._editorPagePositionBrand=void 0}}class Lce{constructor(e,t){this.x=e,this.y=t,this._positionRelativeToEditorBrand=void 0}}function RL(o){const e=mi(o);return new yce(e.left,e.top,e.width,e.height)}function ML(o,e,t){const i=e.width/o.offsetWidth,n=e.height/o.offsetHeight,s=(t.x-e.x)/i,r=(t.y-e.y)/n;return new Lce(s,r)}class Hc extends yn{constructor(e,t,i){super(me(i),e),this._editorMouseEventBrand=void 0,this.isFromPointerCapture=t,this.pos=new G1(this.posx,this.posy),this.editorPos=RL(i),this.relativePos=ML(i,this.editorPos,this.pos)}}class xce{constructor(e){this._editorViewDomNode=e}_create(e){return new Hc(e,!1,this._editorViewDomNode)}onContextMenu(e,t){return W(e,te.CONTEXT_MENU,i=>{t(this._create(i))})}onMouseUp(e,t){return W(e,te.MOUSE_UP,i=>{t(this._create(i))})}onMouseDown(e,t){return W(e,te.MOUSE_DOWN,i=>{t(this._create(i))})}onPointerDown(e,t){return W(e,te.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onMouseLeave(e,t){return W(e,te.MOUSE_LEAVE,i=>{t(this._create(i))})}onMouseMove(e,t){return W(e,te.MOUSE_MOVE,i=>t(this._create(i)))}}class kce{constructor(e){this._editorViewDomNode=e}_create(e){return new Hc(e,!1,this._editorViewDomNode)}onPointerUp(e,t){return W(e,"pointerup",i=>{t(this._create(i))})}onPointerDown(e,t){return W(e,te.POINTER_DOWN,i=>{t(this._create(i),i.pointerId)})}onPointerLeave(e,t){return W(e,te.POINTER_LEAVE,i=>{t(this._create(i))})}onPointerMove(e,t){return W(e,"pointermove",i=>t(this._create(i)))}}class Ice extends A{constructor(e){super(),this._editorViewDomNode=e,this._globalPointerMoveMonitor=this._register(new r_),this._keydownListener=null}startMonitoring(e,t,i,n,s){this._keydownListener=Si(e.ownerDocument,"keydown",r=>{r.toKeyCodeChord().isModifierKey()||this._globalPointerMoveMonitor.stopMonitoring(!0,r.browserEvent)},!0),this._globalPointerMoveMonitor.startMonitoring(e,t,i,r=>{n(new Hc(r,!0,this._editorViewDomNode))},r=>{this._keydownListener.dispose(),s(r)})}stopMonitoring(){this._globalPointerMoveMonitor.stopMonitoring(!0)}}const sN=class sN{constructor(e){this._editor=e,this._instanceId=++sN._idPool,this._counter=0,this._rules=new ny,this._garbageCollectionScheduler=new wt(()=>this.garbageCollect(),1e3)}dispose(){this._rules.dispose(),this._garbageCollectionScheduler.dispose()}createClassNameRef(e){const t=this.getOrCreateRule(e);return t.increaseRefCount(),{className:t.className,dispose:()=>{t.decreaseRefCount(),this._garbageCollectionScheduler.schedule()}}}getOrCreateRule(e){const t=this.computeUniqueKey(e);let i=this._rules.get(t);if(!i){const n=this._counter++;i=new Dce(t,`dyn-rule-${this._instanceId}-${n}`,ky(this._editor.getContainerDomNode())?this._editor.getContainerDomNode():void 0,e),this._rules.set(t,i)}return i}computeUniqueKey(e){return JSON.stringify(e)}garbageCollect(){for(const e of this._rules.values())e.hasReferences()||this._rules.deleteAndDispose(e.key)}};sN._idPool=0;let PL=sN;class Dce{constructor(e,t,i,n){this.key=e,this.className=t,this.properties=n,this._referenceCount=0,this._styleElementDisposables=new U,this._styleElement=Ir(i,void 0,this._styleElementDisposables),this._styleElement.textContent=this.getCssText(this.className,this.properties)}getCssText(e,t){let i=`.${e} {`;for(const n in t){const s=t[n];let r;typeof s=="object"?r=J(s.id):r=s;const a=Ece(n);i+=`
${a}: ${r};`}return i+=`
}`,i}dispose(){this._styleElementDisposables.dispose(),this._styleElement=void 0}increaseRefCount(){this._referenceCount++}decreaseRefCount(){this._referenceCount--}hasReferences(){return this._referenceCount>0}}function Ece(o){return o.replace(/(^[A-Z])/,([e])=>e.toLowerCase()).replace(/([A-Z])/g,([e])=>`-${e.toLowerCase()}`)}class Tf extends A{constructor(){super(),this._shouldRender=!0}shouldRender(){return this._shouldRender}forceShouldRender(){this._shouldRender=!0}setShouldRender(){this._shouldRender=!0}onDidRender(){this._shouldRender=!1}onCompositionStart(e){return!1}onCompositionEnd(e){return!1}onConfigurationChanged(e){return!1}onCursorStateChanged(e){return!1}onDecorationsChanged(e){return!1}onFlushed(e){return!1}onFocusChanged(e){return!1}onLanguageConfigurationChanged(e){return!1}onLineMappingChanged(e){return!1}onLinesChanged(e){return!1}onLinesDeleted(e){return!1}onLinesInserted(e){return!1}onRevealRangeRequest(e){return!1}onScrollChanged(e){return!1}onThemeChanged(e){return!1}onTokensChanged(e){return!1}onTokensColorsChanged(e){return!1}onZonesChanged(e){return!1}handleEvents(e){let t=!1;for(let i=0,n=e.length;i<n;i++){const s=e[i];switch(s.type){case 0:this.onCompositionStart(s)&&(t=!0);break;case 1:this.onCompositionEnd(s)&&(t=!0);break;case 2:this.onConfigurationChanged(s)&&(t=!0);break;case 3:this.onCursorStateChanged(s)&&(t=!0);break;case 4:this.onDecorationsChanged(s)&&(t=!0);break;case 5:this.onFlushed(s)&&(t=!0);break;case 6:this.onFocusChanged(s)&&(t=!0);break;case 7:this.onLanguageConfigurationChanged(s)&&(t=!0);break;case 8:this.onLineMappingChanged(s)&&(t=!0);break;case 9:this.onLinesChanged(s)&&(t=!0);break;case 10:this.onLinesDeleted(s)&&(t=!0);break;case 11:this.onLinesInserted(s)&&(t=!0);break;case 12:this.onRevealRangeRequest(s)&&(t=!0);break;case 13:this.onScrollChanged(s)&&(t=!0);break;case 15:this.onTokensChanged(s)&&(t=!0);break;case 14:this.onThemeChanged(s)&&(t=!0);break;case 16:this.onTokensColorsChanged(s)&&(t=!0);break;case 17:this.onZonesChanged(s)&&(t=!0);break;default:console.info("View received unknown event: "),console.info(s)}}t&&(this._shouldRender=!0)}}class vs extends Tf{constructor(e){super(),this._context=e,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}}class Na{static write(e,t){e.setAttribute("data-mprt",String(t))}static read(e){const t=e.getAttribute("data-mprt");return t===null?0:parseInt(t,10)}static collect(e,t){const i=[];let n=0;for(;e&&e!==e.ownerDocument.body&&e!==t;)e.nodeType===e.ELEMENT_NODE&&(i[n++]=this.read(e)),e=e.parentElement;const s=new Uint8Array(n);for(let r=0;r<n;r++)s[r]=i[n-r-1];return s}}class Nce{constructor(e,t){this._restrictedRenderingContextBrand=void 0,this._viewLayout=e,this.viewportData=t,this.scrollWidth=this._viewLayout.getScrollWidth(),this.scrollHeight=this._viewLayout.getScrollHeight(),this.visibleRange=this.viewportData.visibleRange,this.bigNumbersDelta=this.viewportData.bigNumbersDelta;const i=this._viewLayout.getCurrentViewport();this.scrollTop=i.top,this.scrollLeft=i.left,this.viewportWidth=i.width,this.viewportHeight=i.height}getScrolledTopFromAbsoluteTop(e){return e-this.scrollTop}getVerticalOffsetForLineNumber(e,t){return this._viewLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t){return this._viewLayout.getVerticalOffsetAfterLineNumber(e,t)}getLineHeightForLineNumber(e){return this._viewLayout.getLineHeightForLineNumber(e)}getDecorationsInViewport(){return this.viewportData.getDecorationsInViewport()}}class Tce extends Nce{constructor(e,t,i,n){super(e,t),this._renderingContextBrand=void 0,this._viewLines=i,this._viewLinesGpu=n}linesVisibleRangesForRange(e,t){const i=this._viewLines.linesVisibleRangesForRange(e,t);if(!this._viewLinesGpu)return i??null;const n=this._viewLinesGpu.linesVisibleRangesForRange(e,t);return i?n?i.concat(n).sort((s,r)=>s.lineNumber-r.lineNumber):i:n}visibleRangeForPosition(e){return this._viewLines.visibleRangeForPosition(e)??this._viewLinesGpu?.visibleRangeForPosition(e)??null}}class lz{constructor(e,t,i,n){this.outsideRenderedLine=e,this.lineNumber=t,this.ranges=i,this.continuesOnNextLine=n}}class Z1{static from(e){const t=new Array(e.length);for(let i=0,n=e.length;i<n;i++){const s=e[i];t[i]=new Z1(s.left,s.width)}return t}constructor(e,t){this._horizontalRangeBrand=void 0,this.left=Math.round(e),this.width=Math.round(t)}toString(){return`[${this.left},${this.width}]`}}class Sh{constructor(e,t){this._floatHorizontalRangeBrand=void 0,this.left=e,this.width=t}toString(){return`[${this.left},${this.width}]`}static compare(e,t){return e.left-t.left}}class cz{constructor(e,t){this.outsideRenderedLine=e,this.originalLeft=t,this.left=Math.round(this.originalLeft)}}class SM{constructor(e,t){this.outsideRenderedLine=e,this.ranges=t}}class AL{static _createRange(){return this._handyReadyRange||(this._handyReadyRange=document.createRange()),this._handyReadyRange}static _detachRange(e,t){e.selectNodeContents(t)}static _readClientRects(e,t,i,n,s){const r=this._createRange();try{return r.setStart(e,t),r.setEnd(i,n),r.getClientRects()}catch{return null}finally{this._detachRange(r,s)}}static _mergeAdjacentRanges(e){if(e.length===1)return e;e.sort(Sh.compare);const t=[];let i=0,n=e[0];for(let s=1,r=e.length;s<r;s++){const a=e[s];n.left+n.width+.9>=a.left?n.width=Math.max(n.width,a.left+a.width-n.left):(t[i++]=n,n=a)}return t[i++]=n,t}static _createHorizontalRangesFromClientRects(e,t,i){if(!e||e.length===0)return null;const n=[];for(let s=0,r=e.length;s<r;s++){const a=e[s];n[s]=new Sh(Math.max(0,(a.left-t)/i),a.width/i)}return this._mergeAdjacentRanges(n)}static readHorizontalRanges(e,t,i,n,s,r){const l=e.children.length-1;if(0>l)return null;if(t=Math.min(l,Math.max(0,t)),n=Math.min(l,Math.max(0,n)),t===n&&i===s&&i===0&&!e.children[t].firstChild){const u=e.children[t].getClientRects();return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(u,r.clientRectDeltaLeft,r.clientRectScale)}t!==n&&n>0&&s===0&&(n--,s=1073741824);let c=e.children[t].firstChild,d=e.children[n].firstChild;if((!c||!d)&&(!c&&i===0&&t>0&&(c=e.children[t-1].firstChild,i=1073741824),!d&&s===0&&n>0&&(d=e.children[n-1].firstChild,s=1073741824)),!c||!d)return null;i=Math.min(c.textContent.length,Math.max(0,i)),s=Math.min(d.textContent.length,Math.max(0,s));const h=this._readClientRects(c,i,d,s,r.endNode);return r.markDidDomLayout(),this._createHorizontalRangesFromClientRects(h,r.clientRectDeltaLeft,r.clientRectScale)}}class os{constructor(e,t,i,n){this.startColumn=e,this.endColumn=t,this.className=i,this.type=n,this._lineDecorationBrand=void 0}static _equals(e,t){return e.startColumn===t.startColumn&&e.endColumn===t.endColumn&&e.className===t.className&&e.type===t.type}static equalsArr(e,t){const i=e.length,n=t.length;if(i!==n)return!1;for(let s=0;s<i;s++)if(!os._equals(e[s],t[s]))return!1;return!0}static extractWrapped(e,t,i){if(e.length===0)return e;const n=t+1,s=i+1,r=i-t,a=[];let l=0;for(const c of e)c.endColumn<=n||c.startColumn>=s||(a[l++]=new os(Math.max(1,c.startColumn-n+1),Math.min(r+1,c.endColumn-n+1),c.className,c.type));return a}static filter(e,t,i,n){if(e.length===0)return[];const s=[];let r=0;for(let a=0,l=e.length;a<l;a++){const c=e[a],d=c.range;if(d.endLineNumber<t||d.startLineNumber>t||d.isEmpty()&&(c.type===0||c.type===3))continue;const h=d.startLineNumber===t?d.startColumn:i,u=d.endLineNumber===t?d.endColumn:n;s[r++]=new os(h,u,c.inlineClassName,c.type)}return s}static _typeCompare(e,t){const i=[2,0,1,3];return i[e]-i[t]}static compare(e,t){if(e.startColumn!==t.startColumn)return e.startColumn-t.startColumn;if(e.endColumn!==t.endColumn)return e.endColumn-t.endColumn;const i=os._typeCompare(e.type,t.type);return i!==0?i:e.className!==t.className?e.className<t.className?-1:1:0}}class dz{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.className=i,this.metadata=n}}class OL{constructor(){this.stopOffsets=[],this.classNames=[],this.metadata=[],this.count=0}static _metadata(e){let t=0;for(let i=0,n=e.length;i<n;i++)t|=e[i];return t}consumeLowerThan(e,t,i){for(;this.count>0&&this.stopOffsets[0]<e;){let n=0;for(;n+1<this.count&&this.stopOffsets[n]===this.stopOffsets[n+1];)n++;i.push(new dz(t,this.stopOffsets[n],this.classNames.join(" "),OL._metadata(this.metadata))),t=this.stopOffsets[n]+1,this.stopOffsets.splice(0,n+1),this.classNames.splice(0,n+1),this.metadata.splice(0,n+1),this.count-=n+1}return this.count>0&&t<e&&(i.push(new dz(t,e-1,this.classNames.join(" "),OL._metadata(this.metadata))),t=e),t}insert(e,t,i){if(this.count===0||this.stopOffsets[this.count-1]<=e)this.stopOffsets.push(e),this.classNames.push(t),this.metadata.push(i);else for(let n=0;n<this.count;n++)if(this.stopOffsets[n]>=e){this.stopOffsets.splice(n,0,e),this.classNames.splice(n,0,t),this.metadata.splice(n,0,i);break}this.count++}}class Rce{static normalize(e,t){if(t.length===0)return[];const i=[],n=new OL;let s=0;for(let r=0,a=t.length;r<a;r++){const l=t[r];let c=l.startColumn,d=l.endColumn;const h=l.className,u=l.type===1?2:l.type===2?4:0;if(c>1){const m=e.charCodeAt(c-2);zi(m)&&c--}if(d>1){const m=e.charCodeAt(d-2);zi(m)&&d--}const f=c-1,g=d-2;s=n.consumeLowerThan(f,s,i),n.count===0&&(s=f),n.insert(g,h,u)}return n.consumeLowerThan(1073741824,s,i),i}}class un{constructor(e,t,i,n){this.endIndex=e,this.type=t,this.metadata=i,this.containsRTL=n,this._linePartBrand=void 0}isWhitespace(){return!!(this.metadata&1)}isPseudoAfter(){return!!(this.metadata&4)}}class Vc{get isLTR(){return!this.containsRTL&&this.textDirection!==Oo.RTL}constructor(e,t,i,n,s,r,a,l,c,d,h,u,f,g,m,_,b,C,w,v,S,L=!1){this.useMonospaceOptimizations=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.continuesWithWrappedLine=n,this.isBasicASCII=s,this.containsRTL=r,this.fauxIndentLength=a,this.lineTokens=l,this.lineDecorations=c.sort(os.compare),this.tabSize=d,this.startVisibleColumn=h,this.spaceWidth=u,this.stopRenderingLineAfter=m,this.renderWhitespace=_==="all"?4:_==="boundary"?1:_==="selection"?2:_==="trailing"?3:0,this.renderControlCharacters=b,this.fontLigatures=C,this.selectionsOnLine=w&&w.sort((D,R)=>D.start<R.start?-1:1),this.renderNewLineWhenEmpty=L,this.textDirection=v,this.verticalScrollbarSize=S;const x=Math.abs(g-u),I=Math.abs(f-u);x<I?(this.renderSpaceWidth=g,this.renderSpaceCharCode=11825):(this.renderSpaceWidth=f,this.renderSpaceCharCode=183)}sameSelection(e){if(this.selectionsOnLine===null)return e===null;if(e===null||e.length!==this.selectionsOnLine.length)return!1;for(let t=0;t<this.selectionsOnLine.length;t++)if(!this.selectionsOnLine[t].equals(e[t]))return!1;return!0}equals(e){return this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineContent===e.lineContent&&this.continuesWithWrappedLine===e.continuesWithWrappedLine&&this.isBasicASCII===e.isBasicASCII&&this.containsRTL===e.containsRTL&&this.fauxIndentLength===e.fauxIndentLength&&this.tabSize===e.tabSize&&this.startVisibleColumn===e.startVisibleColumn&&this.spaceWidth===e.spaceWidth&&this.renderSpaceWidth===e.renderSpaceWidth&&this.renderSpaceCharCode===e.renderSpaceCharCode&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.renderWhitespace===e.renderWhitespace&&this.renderControlCharacters===e.renderControlCharacters&&this.fontLigatures===e.fontLigatures&&os.equalsArr(this.lineDecorations,e.lineDecorations)&&this.lineTokens.equals(e.lineTokens)&&this.sameSelection(e.selectionsOnLine)&&this.textDirection===e.textDirection&&this.verticalScrollbarSize===e.verticalScrollbarSize&&this.renderNewLineWhenEmpty===e.renderNewLineWhenEmpty}}class hz{constructor(e,t){this.partIndex=e,this.charIndex=t}}class vl{static getPartIndex(e){return(e&4294901760)>>>16}static getCharIndex(e){return(e&65535)>>>0}constructor(e,t){this.length=e,this._data=new Uint32Array(this.length),this._horizontalOffset=new Uint32Array(this.length)}setColumnInfo(e,t,i,n){const s=(t<<16|i<<0)>>>0;this._data[e-1]=s,this._horizontalOffset[e-1]=n}getHorizontalOffset(e){return this._horizontalOffset.length===0?0:this._horizontalOffset[e-1]}charOffsetToPartData(e){return this.length===0?0:e<0?this._data[0]:e>=this.length?this._data[this.length-1]:this._data[e]}getDomPosition(e){const t=this.charOffsetToPartData(e-1),i=vl.getPartIndex(t),n=vl.getCharIndex(t);return new hz(i,n)}getColumn(e,t){return this.partDataToCharOffset(e.partIndex,t,e.charIndex)+1}partDataToCharOffset(e,t,i){if(this.length===0)return 0;const n=(e<<16|i<<0)>>>0;let s=0,r=this.length-1;for(;s+1<r;){const m=s+r>>>1,_=this._data[m];if(_===n)return m;_>n?r=m:s=m}if(s===r)return s;const a=this._data[s],l=this._data[r];if(a===n)return s;if(l===n)return r;const c=vl.getPartIndex(a),d=vl.getCharIndex(a),h=vl.getPartIndex(l);let u;c!==h?u=t:u=vl.getCharIndex(l);const f=i-d,g=u-i;return f<=g?s:r}}class yM{constructor(e,t){this._renderLineOutputBrand=void 0,this.characterMapping=e,this.containsForeignElements=t}}function h_(o,e){if(o.lineContent.length===0){if(o.lineDecorations.length>0){e.appendString("<span>");let t=0,i=0,n=0;for(const r of o.lineDecorations)(r.type===1||r.type===2)&&(e.appendString('<span class="'),e.appendString(r.className),e.appendString('"></span>'),r.type===1&&(n|=1,t++),r.type===2&&(n|=2,i++));e.appendString("</span>");const s=new vl(1,t+i);return s.setColumnInfo(1,t,0,0),new yM(s,n)}return o.renderNewLineWhenEmpty?e.appendString(`<span><span>
</span></span>`):e.appendString("<span><span></span></span>"),new yM(new vl(0,0),0)}return Vce(Ace(o),e)}class Mce{constructor(e,t,i){this.characterMapping=e,this.html=t,this.containsForeignElements=i}}function FL(o){const e=new uh(1e4),t=h_(o,e);return new Mce(t.characterMapping,e.build(),t.containsForeignElements)}class Pce{constructor(e,t,i,n,s,r,a,l,c,d,h,u,f,g,m){this.fontIsMonospace=e,this.canUseHalfwidthRightwardsArrow=t,this.lineContent=i,this.len=n,this.isOverflowing=s,this.overflowingCharCount=r,this.parts=a,this.containsForeignElements=l,this.fauxIndentLength=c,this.tabSize=d,this.startVisibleColumn=h,this.spaceWidth=u,this.renderSpaceCharCode=f,this.renderWhitespace=g,this.renderControlCharacters=m}}function Ace(o){const e=o.lineContent;let t,i,n;o.stopRenderingLineAfter!==-1&&o.stopRenderingLineAfter<e.length?(t=!0,i=e.length-o.stopRenderingLineAfter,n=o.stopRenderingLineAfter):(t=!1,i=0,n=e.length);let s=Oce(e,o.containsRTL,o.lineTokens,o.fauxIndentLength,n);o.renderControlCharacters&&!o.isBasicASCII&&(s=Wce(e,s)),(o.renderWhitespace===4||o.renderWhitespace===1||o.renderWhitespace===2&&o.selectionsOnLine||o.renderWhitespace===3&&!o.continuesWithWrappedLine)&&(s=Bce(o,e,n,s));let r=0;if(o.lineDecorations.length>0){for(let a=0,l=o.lineDecorations.length;a<l;a++){const c=o.lineDecorations[a];c.type===3||c.type===1?r|=1:c.type===2&&(r|=2)}s=Hce(e,n,s,o.lineDecorations)}return o.containsRTL||(s=Fce(e,s,!o.isBasicASCII||o.fontLigatures)),new Pce(o.useMonospaceOptimizations,o.canUseHalfwidthRightwardsArrow,e,n,t,i,s,r,o.fauxIndentLength,o.tabSize,o.startVisibleColumn,o.spaceWidth,o.renderSpaceCharCode,o.renderWhitespace,o.renderControlCharacters)}function Oce(o,e,t,i,n){const s=[];let r=0;i>0&&(s[r++]=new un(i,"",0,!1));let a=i;for(let l=0,c=t.getCount();l<c;l++){const d=t.getEndOffset(l);if(d<=i)continue;const h=t.getClassName(l);if(d>=n){const f=e?Tm(o.substring(a,n)):!1;s[r++]=new un(n,h,0,f);break}const u=e?Tm(o.substring(a,d)):!1;s[r++]=new un(d,h,0,u),a=d}return s}function Fce(o,e,t){let i=0;const n=[];let s=0;if(t)for(let r=0,a=e.length;r<a;r++){const l=e[r],c=l.endIndex;if(i+50<c){const d=l.type,h=l.metadata,u=l.containsRTL;let f=-1,g=i;for(let m=i;m<c;m++)o.charCodeAt(m)===32&&(f=m),f!==-1&&m-g>=50&&(n[s++]=new un(f+1,d,h,u),g=f+1,f=-1);g!==c&&(n[s++]=new un(c,d,h,u))}else n[s++]=l;i=c}else for(let r=0,a=e.length;r<a;r++){const l=e[r],c=l.endIndex,d=c-i;if(d>50){const h=l.type,u=l.metadata,f=l.containsRTL,g=Math.ceil(d/50);for(let m=1;m<g;m++){const _=i+m*50;n[s++]=new un(_,h,u,f)}n[s++]=new un(c,h,u,f)}else n[s++]=l;i=c}return n}function uz(o){return o<32?o!==9:o===127||o>=8234&&o<=8238||o>=8294&&o<=8297||o>=8206&&o<=8207||o===1564}function Wce(o,e){const t=[];let i=new un(0,"",0,!1),n=0;for(const s of e){const r=s.endIndex;for(;n<r;n++){const a=o.charCodeAt(n);uz(a)&&(n>i.endIndex&&(i=new un(n,s.type,s.metadata,s.containsRTL),t.push(i)),i=new un(n+1,"mtkcontrol",s.metadata,!1),t.push(i))}n>i.endIndex&&(i=new un(r,s.type,s.metadata,s.containsRTL),t.push(i))}return t}function Bce(o,e,t,i){const n=o.continuesWithWrappedLine,s=o.fauxIndentLength,r=o.tabSize,a=o.startVisibleColumn,l=o.useMonospaceOptimizations,c=o.selectionsOnLine,d=o.renderWhitespace===1,h=o.renderWhitespace===3,u=o.renderSpaceWidth!==o.spaceWidth,f=[];let g=0,m=0,_=i[m].type,b=i[m].containsRTL,C=i[m].endIndex;const w=i.length;let v=!1,S=es(e),L;S===-1?(v=!0,S=t,L=t):L=Kr(e);let x=!1,I=0,D=c&&c[I],R=a%r;for(let O=s;O<t;O++){const B=e.charCodeAt(O);D&&D.endExclusive<=O&&(I++,D=c&&c[I]);let V;if(O<S||O>L)V=!0;else if(B===9)V=!0;else if(B===32)if(d)if(x)V=!0;else{const z=O+1<t?e.charCodeAt(O+1):0;V=z===32||z===9}else V=!0;else V=!1;if(V&&c&&(V=!!D&&D.start<=O&&O<D.endExclusive),V&&h&&(V=v||O>L),V&&b&&O>=S&&O<=L&&(V=!1),x){if(!V||!l&&R>=r){if(u){const z=g>0?f[g-1].endIndex:s;for(let ee=z+1;ee<=O;ee++)f[g++]=new un(ee,"mtkw",1,!1)}else f[g++]=new un(O,"mtkw",1,!1);R=R%r}}else(O===C||V&&O>s)&&(f[g++]=new un(O,_,0,b),R=R%r);for(B===9?R=r:th(B)?R+=2:R++,x=V;O===C&&(m++,m<w);)_=i[m].type,b=i[m].containsRTL,C=i[m].endIndex}let F=!1;if(x)if(n&&d){const O=t>0?e.charCodeAt(t-1):0,B=t>1?e.charCodeAt(t-2):0;O===32&&B!==32&&B!==9||(F=!0)}else F=!0;if(F)if(u){const O=g>0?f[g-1].endIndex:s;for(let B=O+1;B<=t;B++)f[g++]=new un(B,"mtkw",1,!1)}else f[g++]=new un(t,"mtkw",1,!1);else f[g++]=new un(t,_,0,b);return f}function Hce(o,e,t,i){i.sort(os.compare);const n=Rce.normalize(o,i),s=n.length;let r=0;const a=[];let l=0,c=0;for(let h=0,u=t.length;h<u;h++){const f=t[h],g=f.endIndex,m=f.type,_=f.metadata,b=f.containsRTL;for(;r<s&&n[r].startOffset<g;){const C=n[r];if(C.startOffset>c&&(c=C.startOffset,a[l++]=new un(c,m,_,b)),C.endOffset+1<=g)c=C.endOffset+1,a[l++]=new un(c,m+" "+C.className,_|C.metadata,b),r++;else{c=g,a[l++]=new un(c,m+" "+C.className,_|C.metadata,b);break}}g>c&&(c=g,a[l++]=new un(c,m,_,b))}const d=t[t.length-1].endIndex;if(r<s&&n[r].startOffset===d)for(;r<s&&n[r].startOffset===d;){const h=n[r];a[l++]=new un(c,h.className,h.metadata,!1),r++}return a}function Vce(o,e){const t=o.fontIsMonospace,i=o.canUseHalfwidthRightwardsArrow,n=o.containsForeignElements,s=o.lineContent,r=o.len,a=o.isOverflowing,l=o.overflowingCharCount,c=o.parts,d=o.fauxIndentLength,h=o.tabSize,u=o.startVisibleColumn,f=o.spaceWidth,g=o.renderSpaceCharCode,m=o.renderWhitespace,_=o.renderControlCharacters,b=new vl(r+1,c.length);let C=!1,w=0,v=u,S=0,L=0,x=0;e.appendString("<span>");for(let I=0,D=c.length;I<D;I++){const R=c[I],F=R.endIndex,O=R.type,B=R.containsRTL,V=m!==0&&R.isWhitespace(),z=V&&!t&&(O==="mtkw"||!n),ee=w===F&&R.isPseudoAfter();if(S=0,e.appendString("<span "),B&&e.appendString('style="unicode-bidi:isolate" '),e.appendString('class="'),e.appendString(z?"mtkz":O),e.appendASCIICharCode(34),V){let se=0;{let oe=w,fe=v;for(;oe<F;oe++){const Ae=(s.charCodeAt(oe)===9?h-fe%h:1)|0;se+=Ae,oe>=d&&(fe+=Ae)}}for(z&&(e.appendString(' style="width:'),e.appendString(String(f*se)),e.appendString('px"')),e.appendASCIICharCode(62);w<F;w++){b.setColumnInfo(w+1,I-x,S,L),x=0;const oe=s.charCodeAt(w);let fe,Ie;if(oe===9){fe=h-v%h|0,Ie=fe,!i||Ie>1?e.appendCharCode(8594):e.appendCharCode(65515);for(let Ae=2;Ae<=Ie;Ae++)e.appendCharCode(160)}else fe=2,Ie=1,e.appendCharCode(g),e.appendCharCode(8204);S+=fe,L+=Ie,w>=d&&(v+=Ie)}}else for(e.appendASCIICharCode(62);w<F;w++){b.setColumnInfo(w+1,I-x,S,L),x=0;const se=s.charCodeAt(w);let oe=1,fe=1;switch(se){case 9:oe=h-v%h,fe=oe;for(let Ie=1;Ie<=oe;Ie++)e.appendCharCode(160);break;case 32:e.appendCharCode(160);break;case 60:e.appendString("&lt;");break;case 62:e.appendString("&gt;");break;case 38:e.appendString("&amp;");break;case 0:_?e.appendCharCode(9216):e.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:e.appendCharCode(65533);break;default:th(se)&&fe++,_&&se<32?e.appendCharCode(9216+se):_&&se===127?e.appendCharCode(9249):_&&uz(se)?(e.appendString("[U+"),e.appendString(zce(se)),e.appendString("]"),oe=8,fe=oe):e.appendCharCode(se)}S+=oe,L+=fe,w>=d&&(v+=fe)}ee?x++:x=0,w>=r&&!C&&R.isPseudoAfter()&&(C=!0,b.setColumnInfo(w+1,I,S,L)),e.appendString("</span>")}return C||b.setColumnInfo(r+1,c.length-1,S,L),a&&(e.appendString('<span class="mtkoverflow">'),e.appendString(p(792,"Show more ({0})",Uce(l))),e.appendString("</span>")),e.appendString("</span>"),new yM(b,n)}function zce(o){return o.toString(16).toUpperCase().padStart(4,"0")}function Uce(o){return o<1024?p(793,"{0} chars",o):o<1024*1024?`${(o/1024).toFixed(1)} KB`:`${(o/1024/1024).toFixed(1)} MB`}var Er;(function(o){o.DARK="dark",o.LIGHT="light",o.HIGH_CONTRAST_DARK="hcDark",o.HIGH_CONTRAST_LIGHT="hcLight"})(Er||(Er={}));var u_;(function(o){o.VS="vs",o.VS_DARK="vs-dark",o.HC_BLACK="hc-black",o.HC_LIGHT="hc-light"})(u_||(u_={}));function Ta(o){return o===Er.HIGH_CONTRAST_DARK||o===Er.HIGH_CONTRAST_LIGHT}function Rf(o){return o===Er.DARK||o===Er.HIGH_CONTRAST_DARK}const $ce=(function(){return ma?!0:!(Ws||Fs||qu)})();let f_=!0;const oN=class oN{constructor(e,t){this._viewGpuContext=e,this._options=t,this._isMaybeInvalid=!0,this._renderedViewLine=null}getDomNode(){return this._renderedViewLine&&this._renderedViewLine.domNode?this._renderedViewLine.domNode.domNode:null}setDomNode(e){if(this._renderedViewLine)this._renderedViewLine.domNode=lt(e);else throw new Error("I have no rendered view line to set the dom node to...")}onContentChanged(){this._isMaybeInvalid=!0}onTokensChanged(){this._isMaybeInvalid=!0}onDecorationsChanged(){this._isMaybeInvalid=!0}onOptionsChanged(e){this._isMaybeInvalid=!0,this._options=e}onSelectionChanged(){return Ta(this._options.themeType)||this._renderedViewLine?.input.renderWhitespace===2?(this._isMaybeInvalid=!0,!0):!1}renderLine(e,t,i,n,s){if(this._options.useGpu&&this._viewGpuContext?.canRender(this._options,n,e))return this._renderedViewLine?.domNode?.domNode.remove(),this._renderedViewLine=null,!1;if(this._isMaybeInvalid===!1)return!1;this._isMaybeInvalid=!1;const r=n.getViewLineRenderingData(e),a=this._options,l=os.filter(r.inlineDecorations,e,r.minColumn,r.maxColumn),c=r.hasVariableFonts||a.experimentalWhitespaceRendering==="off"?a.renderWhitespace:"none",d=!r.hasVariableFonts;let h=null;if(Ta(a.themeType)||c==="selection"){const m=n.selections;for(const _ of m){if(_.endLineNumber<e||_.startLineNumber>e)continue;const b=_.startLineNumber===e?_.startColumn:r.minColumn,C=_.endLineNumber===e?_.endColumn:r.maxColumn;b<C&&(Ta(a.themeType)&&l.push(new os(b,C,"inline-selected-text",0)),c==="selection"&&(h||(h=[]),h.push(new pe(b-1,C-1))))}}const u=new Vc(a.useMonospaceOptimizations,a.canUseHalfwidthRightwardsArrow,r.content,r.continuesWithWrappedLine,r.isBasicASCII,r.containsRTL,r.minColumn-1,r.tokens,l,r.tabSize,r.startVisibleColumn,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,a.stopRenderingLineAfter,c,a.renderControlCharacters,a.fontLigatures!==Fc.OFF,h,r.textDirection,a.verticalScrollbarSize);if(this._renderedViewLine&&this._renderedViewLine.input.equals(u))return!1;s.appendString("<div "),r.textDirection===Oo.RTL?s.appendString('dir="rtl" '):r.containsRTL&&s.appendString('dir="ltr" '),s.appendString('style="top:'),s.appendString(String(t)),s.appendString("px;height:"),s.appendString(String(i)),s.appendString("px;line-height:"),s.appendString(String(i)),r.textDirection===Oo.RTL&&(s.appendString("px;padding-right:"),s.appendString(String(a.verticalScrollbarSize))),s.appendString('px;" class="'),s.appendString(oN.CLASS_NAME),s.appendString('">');const f=h_(u,s);s.appendString("</div>");let g=null;return d&&f_&&$ce&&r.isBasicASCII&&u.isLTR&&a.useMonospaceOptimizations&&f.containsForeignElements===0&&(g=new WL(this._renderedViewLine?this._renderedViewLine.domNode:null,u,f.characterMapping)),g||(g=gz(this._renderedViewLine?this._renderedViewLine.domNode:null,u,f.characterMapping,f.containsForeignElements)),this._renderedViewLine=g,!0}layoutLine(e,t,i){this._renderedViewLine&&this._renderedViewLine.domNode&&(this._renderedViewLine.domNode.setTop(t),this._renderedViewLine.domNode.setHeight(i),this._renderedViewLine.domNode.setLineHeight(i))}isRenderedRTL(){return this._renderedViewLine?this._renderedViewLine.input.textDirection===Oo.RTL:!1}getWidth(e){return this._renderedViewLine?this._renderedViewLine.getWidth(e):0}getWidthIsFast(){return this._renderedViewLine?this._renderedViewLine.getWidthIsFast():!0}needsMonospaceFontCheck(){return this._renderedViewLine?this._renderedViewLine instanceof WL:!1}monospaceAssumptionsAreValid(){return this._renderedViewLine&&this._renderedViewLine instanceof WL?this._renderedViewLine.monospaceAssumptionsAreValid():f_}onMonospaceAssumptionsInvalidated(){this._renderedViewLine&&this._renderedViewLine instanceof WL&&(this._renderedViewLine=this._renderedViewLine.toSlowRenderedLine())}getVisibleRangesForRange(e,t,i,n){if(!this._renderedViewLine)return null;t=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,t)),i=Math.min(this._renderedViewLine.input.lineContent.length+1,Math.max(1,i));const s=this._renderedViewLine.input.stopRenderingLineAfter;if(s!==-1&&t>s+1&&i>s+1)return new SM(!0,[new Sh(this.getWidth(n),0)]);s!==-1&&t>s+1&&(t=s+1),s!==-1&&i>s+1&&(i=s+1);const r=this._renderedViewLine.getVisibleRangesForRange(e,t,i,n);return r&&r.length>0?new SM(!1,r):null}getColumnOfNodeOffset(e,t){return this._renderedViewLine?this._renderedViewLine.getColumnOfNodeOffset(e,t):1}};oN.CLASS_NAME="view-line";let zc=oN;class WL{constructor(e,t,i){this._cachedWidth=-1,this.domNode=e,this.input=t;const n=Math.floor(t.lineContent.length/300);if(n>0){this._keyColumnPixelOffsetCache=new Float32Array(n);for(let s=0;s<n;s++)this._keyColumnPixelOffsetCache[s]=-1}else this._keyColumnPixelOffsetCache=null;this._characterMapping=i,this._charWidth=t.spaceWidth}getWidth(e){if(!this.domNode||this.input.lineContent.length<300){const t=this._characterMapping.getHorizontalOffset(this._characterMapping.length);return Math.round(this._charWidth*t)}return this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth}getWidthIsFast(){return this.input.lineContent.length<300||this._cachedWidth!==-1}monospaceAssumptionsAreValid(){if(!this.domNode)return f_;if(this.input.lineContent.length<300){const e=this.getWidth(null),t=this.domNode.domNode.firstChild.offsetWidth;Math.abs(e-t)>=2&&(console.warn("monospace assumptions have been violated, therefore disabling monospace optimizations!"),f_=!1)}return f_}toSlowRenderedLine(){return gz(this.domNode,this.input,this._characterMapping,0)}getVisibleRangesForRange(e,t,i,n){const s=this._getColumnPixelOffset(e,t,n),r=this._getColumnPixelOffset(e,i,n);return[new Sh(s,r-s)]}_getColumnPixelOffset(e,t,i){if(t<=300){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const n=Math.floor((t-1)/300)-1,s=(n+1)*300+1;let r=-1;if(this._keyColumnPixelOffsetCache&&(r=this._keyColumnPixelOffsetCache[n],r===-1&&(r=this._actualReadPixelOffset(e,s,i),this._keyColumnPixelOffsetCache[n]=r)),r===-1){const c=this._characterMapping.getHorizontalOffset(t);return this._charWidth*c}const a=this._characterMapping.getHorizontalOffset(s),l=this._characterMapping.getHorizontalOffset(t);return r+this._charWidth*(l-a)}_getReadingTarget(e){return e.domNode.firstChild}_actualReadPixelOffset(e,t,i){if(!this.domNode)return-1;const n=this._characterMapping.getDomPosition(t),s=AL.readHorizontalRanges(this._getReadingTarget(this.domNode),n.partIndex,n.charIndex,n.partIndex,n.charIndex,i);return!s||s.length===0?-1:s[0].left}getColumnOfNodeOffset(e,t){return Y1(this._characterMapping,e,t)}}class fz{constructor(e,t,i,n){if(this.domNode=e,this.input=t,this._characterMapping=i,this._isWhitespaceOnly=/^\s*$/.test(t.lineContent),this._containsForeignElements=n,this._cachedWidth=-1,this._pixelOffsetCache=null,t.isLTR){this._pixelOffsetCache=new Float32Array(Math.max(2,this._characterMapping.length+1));for(let s=0,r=this._characterMapping.length;s<=r;s++)this._pixelOffsetCache[s]=-1}}_getReadingTarget(e){return e.domNode.firstChild}getWidth(e){return this.domNode?(this._cachedWidth===-1&&(this._cachedWidth=this._getReadingTarget(this.domNode).offsetWidth,e?.markDidDomLayout()),this._cachedWidth):0}getWidthIsFast(){return this._cachedWidth!==-1}getVisibleRangesForRange(e,t,i,n){if(!this.domNode)return null;if(this._pixelOffsetCache!==null){const s=this._readPixelOffset(this.domNode,e,t,n);if(s===-1)return null;const r=this._readPixelOffset(this.domNode,e,i,n);return r===-1?null:[new Sh(s,r-s)]}return this._readVisibleRangesForRange(this.domNode,e,t,i,n)}_readVisibleRangesForRange(e,t,i,n,s){if(i===n){const r=this._readPixelOffset(e,t,i,s);return r===-1?null:[new Sh(r,0)]}else return this._readRawVisibleRangesForRange(e,i,n,s)}_readPixelOffset(e,t,i,n){if(this.input.isLTR&&this._characterMapping.length===0){if(this._containsForeignElements===0||this._containsForeignElements===2)return 0;if(this._containsForeignElements===1)return this.getWidth(n);const s=this._getReadingTarget(e);return s.firstChild?(n.markDidDomLayout(),s.firstChild.offsetWidth):0}if(this._pixelOffsetCache!==null){const s=this._pixelOffsetCache[i];if(s!==-1)return s;const r=this._actualReadPixelOffset(e,t,i,n);return this._pixelOffsetCache[i]=r,r}return this._actualReadPixelOffset(e,t,i,n)}_actualReadPixelOffset(e,t,i,n){if(this._characterMapping.length===0){const l=AL.readHorizontalRanges(this._getReadingTarget(e),0,0,0,0,n);return!l||l.length===0?-1:l[0].left}if(this.input.isLTR&&i===this._characterMapping.length&&this._isWhitespaceOnly&&this._containsForeignElements===0)return this.getWidth(n);const s=this._characterMapping.getDomPosition(i),r=AL.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,s.partIndex,s.charIndex,n);if(!r||r.length===0)return-1;const a=r[0].left;if(this.input.isBasicASCII){const l=this._characterMapping.getHorizontalOffset(i),c=Math.round(this.input.spaceWidth*l);if(Math.abs(c-a)<=1)return c}return a}_readRawVisibleRangesForRange(e,t,i,n){if(this.input.isLTR&&t===1&&i===this._characterMapping.length)return[new Sh(0,this.getWidth(n))];const s=this._characterMapping.getDomPosition(t),r=this._characterMapping.getDomPosition(i);return AL.readHorizontalRanges(this._getReadingTarget(e),s.partIndex,s.charIndex,r.partIndex,r.charIndex,n)}getColumnOfNodeOffset(e,t){return Y1(this._characterMapping,e,t)}}class jce extends fz{_readVisibleRangesForRange(e,t,i,n,s){const r=super._readVisibleRangesForRange(e,t,i,n,s);if(!r||r.length===0||i===n||i===1&&n===this._characterMapping.length)return r;if(this.input.isLTR){const a=this._readPixelOffset(e,t,n,s);if(a!==-1){const l=r[r.length-1];l.left<a&&(l.width=a-l.left)}}return r}}const gz=(function(){return KS?qce:Kce})();function qce(o,e,t,i){return new jce(o,e,t,i)}function Kce(o,e,t,i){return new fz(o,e,t,i)}function Y1(o,e,t){const i=e.textContent.length;let n=-1;for(;e;)e=e.previousSibling,n++;return o.getColumn(new hz(n,t),i)}class yh{constructor(e=null){this.hitTarget=e,this.type=0}}class pz{get hitTarget(){return this.spanNode}constructor(e,t,i){this.position=e,this.spanNode=t,this.injectedText=i,this.type=1}}var Mf;(function(o){function e(t,i,n){const s=t.getPositionFromDOMInfo(i,n);return s?new pz(s,i,null):new yh(i)}o.createFromDOMInfo=e})(Mf||(Mf={}));class Gce{constructor(e,t){this.lastViewCursorsRenderData=e,this.lastTextareaPosition=t}}class Nn{static _deduceRage(e,t=null){return!t&&e?new k(e.lineNumber,e.column,e.lineNumber,e.column):t??null}static createUnknown(e,t,i){return{type:0,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createTextarea(e,t){return{type:1,element:e,mouseColumn:t,position:null,range:null}}static createMargin(e,t,i,n,s,r){return{type:e,element:t,mouseColumn:i,position:n,range:s,detail:r}}static createViewZone(e,t,i,n,s){return{type:e,element:t,mouseColumn:i,position:n,range:this._deduceRage(n),detail:s}}static createContentText(e,t,i,n,s){return{type:6,element:e,mouseColumn:t,position:i,range:this._deduceRage(i,n),detail:s}}static createContentEmpty(e,t,i,n){return{type:7,element:e,mouseColumn:t,position:i,range:this._deduceRage(i),detail:n}}static createContentWidget(e,t,i){return{type:9,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createScrollbar(e,t,i){return{type:11,element:e,mouseColumn:t,position:i,range:this._deduceRage(i)}}static createOverlayWidget(e,t,i){return{type:12,element:e,mouseColumn:t,position:null,range:null,detail:i}}static createOutsideEditor(e,t,i,n){return{type:13,element:null,mouseColumn:e,position:t,range:this._deduceRage(t),outsidePosition:i,outsideDistance:n}}static _typeToString(e){return e===1?"TEXTAREA":e===2?"GUTTER_GLYPH_MARGIN":e===3?"GUTTER_LINE_NUMBERS":e===4?"GUTTER_LINE_DECORATIONS":e===5?"GUTTER_VIEW_ZONE":e===6?"CONTENT_TEXT":e===7?"CONTENT_EMPTY":e===8?"CONTENT_VIEW_ZONE":e===9?"CONTENT_WIDGET":e===10?"OVERVIEW_RULER":e===11?"SCROLLBAR":e===12?"OVERLAY_WIDGET":"UNKNOWN"}static toString(e){return this._typeToString(e.type)+": "+e.position+" - "+e.range+" - "+JSON.stringify(e.detail)}}class ws{static isTextArea(e){return e.length===2&&e[0]===3&&e[1]===7}static isChildOfViewLines(e){return e.length>=4&&e[0]===3&&e[3]===8}static isStrictChildOfViewLines(e){return e.length>4&&e[0]===3&&e[3]===8}static isChildOfScrollableElement(e){return e.length>=2&&e[0]===3&&e[1]===6}static isChildOfMinimap(e){return e.length>=2&&e[0]===3&&e[1]===9}static isChildOfContentWidgets(e){return e.length>=4&&e[0]===3&&e[3]===1}static isChildOfOverflowGuard(e){return e.length>=1&&e[0]===3}static isChildOfOverflowingContentWidgets(e){return e.length>=1&&e[0]===2}static isChildOfOverlayWidgets(e){return e.length>=2&&e[0]===3&&e[1]===4}static isChildOfOverflowingOverlayWidgets(e){return e.length>=1&&e[0]===5}}class g_{constructor(e,t,i){this.viewModel=e.viewModel;const n=e.configuration.options;this.layoutInfo=n.get(165),this.viewDomNode=t.viewDomNode,this.viewLinesGpu=t.viewLinesGpu,this.lineHeight=n.get(75),this.stickyTabStops=n.get(132),this.typicalHalfwidthCharacterWidth=n.get(59).typicalHalfwidthCharacterWidth,this.lastRenderData=i,this._context=e,this._viewHelper=t}getZoneAtCoord(e){return g_.getZoneAtCoord(this._context,e)}static getZoneAtCoord(e,t){const i=e.viewLayout.getWhitespaceAtVerticalOffset(t);if(i){const n=i.verticalOffset+i.height/2,s=e.viewModel.getLineCount();let r=null,a,l=null;return i.afterLineNumber!==s&&(l=new M(i.afterLineNumber+1,1)),i.afterLineNumber>0&&(r=new M(i.afterLineNumber,e.viewModel.getLineMaxColumn(i.afterLineNumber))),l===null?a=r:r===null?a=l:t<n?a=r:a=l,{viewZoneId:i.id,afterLineNumber:i.afterLineNumber,positionBefore:r,positionAfter:l,position:a}}return null}getFullLineRangeAtCoord(e){if(this._context.viewLayout.isAfterLines(e)){const n=this._context.viewModel.getLineCount(),s=this._context.viewModel.getLineMaxColumn(n);return{range:new k(n,s,n,s),isAfterLines:!0}}const t=this._context.viewLayout.getLineNumberAtVerticalOffset(e),i=this._context.viewModel.getLineMaxColumn(t);return{range:new k(t,1,t,i),isAfterLines:!1}}getLineNumberAtVerticalOffset(e){return this._context.viewLayout.getLineNumberAtVerticalOffset(e)}isAfterLines(e){return this._context.viewLayout.isAfterLines(e)}isInTopPadding(e){return this._context.viewLayout.isInTopPadding(e)}isInBottomPadding(e){return this._context.viewLayout.isInBottomPadding(e)}getVerticalOffsetForLineNumber(e){return this._context.viewLayout.getVerticalOffsetForLineNumber(e)}findAttribute(e,t){return g_._findAttribute(e,t,this._viewHelper.viewDomNode)}static _findAttribute(e,t,i){for(;e&&e!==e.ownerDocument.body;){if(e.hasAttribute&&e.hasAttribute(t))return e.getAttribute(t);if(e===i)return null;e=e.parentNode}return null}getLineWidth(e){return this._viewHelper.getLineWidth(e)}isRtl(e){return this.viewModel.getTextDirection(e)===Oo.RTL}visibleRangeForPosition(e,t){return this._viewHelper.visibleRangeForPosition(e,t)}getPositionFromDOMInfo(e,t){return this._viewHelper.getPositionFromDOMInfo(e,t)}getCurrentScrollTop(){return this._context.viewLayout.getCurrentScrollTop()}getCurrentScrollLeft(){return this._context.viewLayout.getCurrentScrollLeft()}}class Zce{constructor(e,t,i,n){this.editorPos=t,this.pos=i,this.relativePos=n,this.mouseVerticalOffset=Math.max(0,e.getCurrentScrollTop()+this.relativePos.y),this.mouseContentHorizontalOffset=e.getCurrentScrollLeft()+this.relativePos.x-e.layoutInfo.contentLeft,this.isInMarginArea=this.relativePos.x<e.layoutInfo.contentLeft&&this.relativePos.x>=e.layoutInfo.glyphMarginLeft,this.isInContentArea=!this.isInMarginArea,this.mouseColumn=Math.max(0,rs._getMouseColumn(this.mouseContentHorizontalOffset,e.typicalHalfwidthCharacterWidth))}}class Yce extends Zce{get target(){return this._useHitTestTarget?this.hitTestResult.value.hitTarget:this._eventTarget}get targetPath(){return this._targetPathCacheElement!==this.target&&(this._targetPathCacheElement=this.target,this._targetPathCacheValue=Na.collect(this.target,this._ctx.viewDomNode)),this._targetPathCacheValue}constructor(e,t,i,n,s){super(e,t,i,n),this.hitTestResult=new Ln(()=>rs.doHitTest(this._ctx,this)),this._targetPathCacheElement=null,this._targetPathCacheValue=new Uint8Array(0),this._ctx=e,this._eventTarget=s;const r=!!this._eventTarget;this._useHitTestTarget=!r}toString(){return`pos(${this.pos.x},${this.pos.y}), editorPos(${this.editorPos.x},${this.editorPos.y}), relativePos(${this.relativePos.x},${this.relativePos.y}), mouseVerticalOffset: ${this.mouseVerticalOffset}, mouseContentHorizontalOffset: ${this.mouseContentHorizontalOffset}
target: ${this.target?this.target.outerHTML:null}`}get wouldBenefitFromHitTestTargetSwitch(){return!this._useHitTestTarget&&this.hitTestResult.value.hitTarget!==null&&this.target!==this.hitTestResult.value.hitTarget}switchToHitTestTarget(){this._useHitTestTarget=!0}_getMouseColumn(e=null){return e&&e.column<this._ctx.viewModel.getLineMaxColumn(e.lineNumber)?ti.visibleColumnFromColumn(this._ctx.viewModel.getLineContent(e.lineNumber),e.column,this._ctx.viewModel.model.getOptions().tabSize)+1:this.mouseColumn}fulfillUnknown(e=null){return Nn.createUnknown(this.target,this._getMouseColumn(e),e)}fulfillTextarea(){return Nn.createTextarea(this.target,this._getMouseColumn())}fulfillMargin(e,t,i,n){return Nn.createMargin(e,this.target,this._getMouseColumn(t),t,i,n)}fulfillViewZone(e,t,i){return Nn.createViewZone(e,this.target,this._getMouseColumn(t),t,i)}fulfillContentText(e,t,i){return Nn.createContentText(this.target,this._getMouseColumn(e),e,t,i)}fulfillContentEmpty(e,t){return Nn.createContentEmpty(this.target,this._getMouseColumn(e),e,t)}fulfillContentWidget(e){return Nn.createContentWidget(this.target,this._getMouseColumn(),e)}fulfillScrollbar(e){return Nn.createScrollbar(this.target,this._getMouseColumn(e),e)}fulfillOverlayWidget(e){return Nn.createOverlayWidget(this.target,this._getMouseColumn(),e)}}const mz={isAfterLines:!0};function Pf(o){return{isAfterLines:!1,horizontalDistanceToText:o}}class rs{constructor(e,t){this._context=e,this._viewHelper=t}mouseTargetIsWidget(e){const t=e.target,i=Na.collect(t,this._viewHelper.viewDomNode);return!!(ws.isChildOfContentWidgets(i)||ws.isChildOfOverflowingContentWidgets(i)||ws.isChildOfOverlayWidgets(i)||ws.isChildOfOverflowingOverlayWidgets(i))}createMouseTarget(e,t,i,n,s){const r=new g_(this._context,this._viewHelper,e),a=new Yce(r,t,i,n,s);try{const l=rs._createMouseTarget(r,a);if(l.type===6&&r.stickyTabStops&&l.position!==null){const c=rs._snapToSoftTabBoundary(l.position,r.viewModel),d=k.fromPositions(c,c).plusRange(l.range);return a.fulfillContentText(c,d,l.detail)}return l}catch{return a.fulfillUnknown()}}static _createMouseTarget(e,t){if(t.target===null)return t.fulfillUnknown();const i=t;let n=null;return!ws.isChildOfOverflowGuard(t.targetPath)&&!ws.isChildOfOverflowingContentWidgets(t.targetPath)&&!ws.isChildOfOverflowingOverlayWidgets(t.targetPath)&&(n=n||t.fulfillUnknown()),n=n||rs._hitTestContentWidget(e,i),n=n||rs._hitTestOverlayWidget(e,i),n=n||rs._hitTestMinimap(e,i),n=n||rs._hitTestScrollbarSlider(e,i),n=n||rs._hitTestViewZone(e,i),n=n||rs._hitTestMargin(e,i),n=n||rs._hitTestViewCursor(e,i),n=n||rs._hitTestTextArea(e,i),n=n||rs._hitTestViewLines(e,i),n=n||rs._hitTestScrollbar(e,i),n||t.fulfillUnknown()}static _hitTestContentWidget(e,t){if(ws.isChildOfContentWidgets(t.targetPath)||ws.isChildOfOverflowingContentWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillContentWidget(i):t.fulfillUnknown()}return null}static _hitTestOverlayWidget(e,t){if(ws.isChildOfOverlayWidgets(t.targetPath)||ws.isChildOfOverflowingOverlayWidgets(t.targetPath)){const i=e.findAttribute(t.target,"widgetId");return i?t.fulfillOverlayWidget(i):t.fulfillUnknown()}return null}static _hitTestViewCursor(e,t){if(t.target){const i=e.lastRenderData.lastViewCursorsRenderData;for(const n of i)if(t.target===n.domNode)return t.fulfillContentText(n.position,null,{mightBeForeignElement:!1,injectedText:null})}if(t.isInContentArea){const i=e.lastRenderData.lastViewCursorsRenderData,n=t.mouseContentHorizontalOffset,s=t.mouseVerticalOffset;for(const r of i){if(n<r.contentLeft||n>r.contentLeft+r.width)continue;const a=e.getVerticalOffsetForLineNumber(r.position.lineNumber);if(a<=s&&s<=a+r.height)return t.fulfillContentText(r.position,null,{mightBeForeignElement:!1,injectedText:null})}}return null}static _hitTestViewZone(e,t){const i=e.getZoneAtCoord(t.mouseVerticalOffset);if(i){const n=t.isInContentArea?8:5;return t.fulfillViewZone(n,i.position,i)}return null}static _hitTestTextArea(e,t){return ws.isTextArea(t.targetPath)?e.lastRenderData.lastTextareaPosition?t.fulfillContentText(e.lastRenderData.lastTextareaPosition,null,{mightBeForeignElement:!1,injectedText:null}):t.fulfillTextarea():null}static _hitTestMargin(e,t){if(t.isInMarginArea){const i=e.getFullLineRangeAtCoord(t.mouseVerticalOffset),n=i.range.getStartPosition();let s=Math.abs(t.relativePos.x);const r={isAfterLines:i.isAfterLines,glyphMarginLeft:e.layoutInfo.glyphMarginLeft,glyphMarginWidth:e.layoutInfo.glyphMarginWidth,lineNumbersWidth:e.layoutInfo.lineNumbersWidth,offsetX:s};if(s-=e.layoutInfo.glyphMarginLeft,s<=e.layoutInfo.glyphMarginWidth){const a=e.viewModel.coordinatesConverter.convertViewPositionToModelPosition(i.range.getStartPosition()),l=e.viewModel.glyphLanes.getLanesAtLine(a.lineNumber);return r.glyphMarginLane=l[Math.floor(s/e.lineHeight)],t.fulfillMargin(2,n,i.range,r)}return s-=e.layoutInfo.glyphMarginWidth,s<=e.layoutInfo.lineNumbersWidth?t.fulfillMargin(3,n,i.range,r):(s-=e.layoutInfo.lineNumbersWidth,t.fulfillMargin(4,n,i.range,r))}return null}static _hitTestViewLines(e,t){if(!ws.isChildOfViewLines(t.targetPath))return null;if(e.isInTopPadding(t.mouseVerticalOffset))return t.fulfillContentEmpty(new M(1,1),mz);if(e.isAfterLines(t.mouseVerticalOffset)||e.isInBottomPadding(t.mouseVerticalOffset)){const n=e.viewModel.getLineCount(),s=e.viewModel.getLineMaxColumn(n);return t.fulfillContentEmpty(new M(n,s),mz)}if(ws.isStrictChildOfViewLines(t.targetPath)){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineLength(n),r=e.getLineWidth(n);if(s===0){const l=Pf(t.mouseContentHorizontalOffset-r);return t.fulfillContentEmpty(new M(n,1),l)}if(e.isRtl(n)){if(t.mouseContentHorizontalOffset+r<=e.layoutInfo.contentWidth-e.layoutInfo.verticalScrollbarWidth){const l=Pf(t.mouseContentHorizontalOffset-r),c=new M(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(c,l)}}else if(t.mouseContentHorizontalOffset>=r){const l=Pf(t.mouseContentHorizontalOffset-r),c=new M(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(c,l)}}else if(e.viewLinesGpu){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset);if(e.viewModel.getLineLength(n)===0){const l=e.getLineWidth(n),c=Pf(t.mouseContentHorizontalOffset-l);return t.fulfillContentEmpty(new M(n,1),c)}const s=e.getLineWidth(n);if(e.isRtl(n)){if(t.mouseContentHorizontalOffset+s<=e.layoutInfo.contentWidth-e.layoutInfo.verticalScrollbarWidth){const l=Pf(t.mouseContentHorizontalOffset-s),c=new M(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(c,l)}}else if(t.mouseContentHorizontalOffset>=s){const l=Pf(t.mouseContentHorizontalOffset-s),c=new M(n,e.viewModel.getLineMaxColumn(n));return t.fulfillContentEmpty(c,l)}const a=e.viewLinesGpu.getPositionAtCoordinate(n,t.mouseContentHorizontalOffset);if(a){const l={injectedText:null,mightBeForeignElement:!1};return t.fulfillContentText(a,k.fromPositions(a,a),l)}}const i=t.hitTestResult.value;return i.type===1?rs.createMouseTargetFromHitTestPosition(e,t,i.spanNode,i.position,i.injectedText):t.wouldBenefitFromHitTestTargetSwitch?(t.switchToHitTestTarget(),this._createMouseTarget(e,t)):t.fulfillUnknown()}static _hitTestMinimap(e,t){if(ws.isChildOfMinimap(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new M(i,n))}return null}static _hitTestScrollbarSlider(e,t){if(ws.isChildOfScrollableElement(t.targetPath)&&t.target&&t.target.nodeType===1){const i=t.target.className;if(i&&/\b(slider|scrollbar)\b/.test(i)){const n=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),s=e.viewModel.getLineMaxColumn(n);return t.fulfillScrollbar(new M(n,s))}}return null}static _hitTestScrollbar(e,t){if(ws.isChildOfScrollableElement(t.targetPath)){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.viewModel.getLineMaxColumn(i);return t.fulfillScrollbar(new M(i,n))}return null}getMouseColumn(e){const t=this._context.configuration.options,i=t.get(165),n=this._context.viewLayout.getCurrentScrollLeft()+e.x-i.contentLeft;return rs._getMouseColumn(n,t.get(59).typicalHalfwidthCharacterWidth)}static _getMouseColumn(e,t){return e<0?1:Math.round(e/t)+1}static createMouseTargetFromHitTestPosition(e,t,i,n,s){const r=n.lineNumber,a=n.column,l=e.getLineWidth(r);if(t.mouseContentHorizontalOffset>l){const b=Pf(t.mouseContentHorizontalOffset-l);return t.fulfillContentEmpty(n,b)}const c=e.visibleRangeForPosition(r,a);if(!c)return t.fulfillUnknown(n);const d=c.left;if(Math.abs(t.mouseContentHorizontalOffset-d)<1)return t.fulfillContentText(n,null,{mightBeForeignElement:!!s,injectedText:s});const h=[];if(h.push({offset:c.left,column:a}),a>1){const b=e.visibleRangeForPosition(r,a-1);b&&h.push({offset:b.left,column:a-1})}const u=e.viewModel.getLineMaxColumn(r);if(a<u){const b=e.visibleRangeForPosition(r,a+1);b&&h.push({offset:b.left,column:a+1})}h.sort((b,C)=>b.offset-C.offset);const f=t.pos.toClientCoordinates(me(e.viewDomNode)),g=i.getBoundingClientRect(),m=g.left<=f.clientX&&f.clientX<=g.right;let _=null;for(let b=1;b<h.length;b++){const C=h[b-1],w=h[b];if(C.offset<=t.mouseContentHorizontalOffset&&t.mouseContentHorizontalOffset<=w.offset){_=new k(r,C.column,r,w.column);const v=Math.abs(C.offset-t.mouseContentHorizontalOffset),S=Math.abs(w.offset-t.mouseContentHorizontalOffset);n=v<S?new M(r,C.column):new M(r,w.column);break}}return t.fulfillContentText(n,_,{mightBeForeignElement:!m||!!s,injectedText:s})}static _doHitTestWithCaretRangeFromPoint(e,t){const i=e.getLineNumberAtVerticalOffset(t.mouseVerticalOffset),n=e.getVerticalOffsetForLineNumber(i),s=n+e.lineHeight;if(!(i===e.viewModel.getLineCount()&&t.mouseVerticalOffset>s)){const a=Math.floor((n+s)/2);let l=t.pos.y+(a-t.mouseVerticalOffset);l<=t.editorPos.y&&(l=t.editorPos.y+1),l>=t.editorPos.y+t.editorPos.height&&(l=t.editorPos.y+t.editorPos.height-1);const c=new G1(t.pos.x,l),d=this._actualDoHitTestWithCaretRangeFromPoint(e,c.toClientCoordinates(me(e.viewDomNode)));if(d.type===1)return d}return this._actualDoHitTestWithCaretRangeFromPoint(e,t.pos.toClientCoordinates(me(e.viewDomNode)))}static _actualDoHitTestWithCaretRangeFromPoint(e,t){const i=ah(e.viewDomNode);let n;if(i?typeof i.caretRangeFromPoint>"u"?n=Xce(i,t.clientX,t.clientY):n=i.caretRangeFromPoint(t.clientX,t.clientY):n=e.viewDomNode.ownerDocument.caretRangeFromPoint(t.clientX,t.clientY),!n||!n.startContainer)return new yh;const s=n.startContainer;if(s.nodeType===s.TEXT_NODE){const r=s.parentNode,a=r?r.parentNode:null,l=a?a.parentNode:null;return(l&&l.nodeType===l.ELEMENT_NODE?l.className:null)===zc.CLASS_NAME?Mf.createFromDOMInfo(e,r,n.startOffset):new yh(s.parentNode)}else if(s.nodeType===s.ELEMENT_NODE){const r=s.parentNode,a=r?r.parentNode:null;return(a&&a.nodeType===a.ELEMENT_NODE?a.className:null)===zc.CLASS_NAME?Mf.createFromDOMInfo(e,s,s.textContent.length):new yh(s)}return new yh}static _doHitTestWithCaretPositionFromPoint(e,t){const i=e.viewDomNode.ownerDocument.caretPositionFromPoint(t.clientX,t.clientY);if(i.offsetNode.nodeType===i.offsetNode.TEXT_NODE){const n=i.offsetNode.parentNode,s=n?n.parentNode:null,r=s?s.parentNode:null;return(r&&r.nodeType===r.ELEMENT_NODE?r.className:null)===zc.CLASS_NAME?Mf.createFromDOMInfo(e,i.offsetNode.parentNode,i.offset):new yh(i.offsetNode.parentNode)}if(i.offsetNode.nodeType===i.offsetNode.ELEMENT_NODE){const n=i.offsetNode.parentNode,s=n&&n.nodeType===n.ELEMENT_NODE?n.className:null,r=n?n.parentNode:null,a=r&&r.nodeType===r.ELEMENT_NODE?r.className:null;if(s===zc.CLASS_NAME){const l=i.offsetNode.childNodes[Math.min(i.offset,i.offsetNode.childNodes.length-1)];if(l)return Mf.createFromDOMInfo(e,l,0)}else if(a===zc.CLASS_NAME)return Mf.createFromDOMInfo(e,i.offsetNode,0)}return new yh(i.offsetNode)}static _snapToSoftTabBoundary(e,t){const i=t.getLineContent(e.lineNumber),{tabSize:n}=t.model.getOptions(),s=D1.atomicPosition(i,e.column-1,n,2);return s!==-1?new M(e.lineNumber,s+1):e}static doHitTest(e,t){let i=new yh;if(typeof e.viewDomNode.ownerDocument.caretRangeFromPoint=="function"?i=this._doHitTestWithCaretRangeFromPoint(e,t):e.viewDomNode.ownerDocument.caretPositionFromPoint&&(i=this._doHitTestWithCaretPositionFromPoint(e,t.pos.toClientCoordinates(me(e.viewDomNode)))),i.type===1){const n=e.viewModel.getInjectedTextAt(i.position),s=e.viewModel.normalizePosition(i.position,2);(n||!s.equals(i.position))&&(i=new pz(s,i.spanNode,n))}return i}}function Xce(o,e,t){const i=document.createRange();let n=o.elementFromPoint(e,t);if(n?.hasChildNodes()){for(;n&&n.firstChild&&n.firstChild.nodeType!==n.firstChild.TEXT_NODE&&n.lastChild&&n.lastChild.firstChild;)n=n.lastChild;const s=n.getBoundingClientRect(),r=me(n),a=r.getComputedStyle(n,null).getPropertyValue("font-style"),l=r.getComputedStyle(n,null).getPropertyValue("font-variant"),c=r.getComputedStyle(n,null).getPropertyValue("font-weight"),d=r.getComputedStyle(n,null).getPropertyValue("font-size"),h=r.getComputedStyle(n,null).getPropertyValue("line-height"),u=r.getComputedStyle(n,null).getPropertyValue("font-family"),f=`${a} ${l} ${c} ${d}/${h} ${u}`,g=n.innerText;let m=s.left,_=0,b;if(e>s.left+s.width)_=g.length;else{const C=LM.getInstance();for(let w=0;w<g.length+1;w++){if(b=C.getCharWidth(g.charAt(w),f)/2,m+=b,e<m){_=w;break}m+=b}}i.setStart(n.firstChild,_),i.setEnd(n.firstChild,_)}return i}const wp=class wp{static getInstance(){return wp._INSTANCE||(wp._INSTANCE=new wp),wp._INSTANCE}constructor(){this._cache={},this._canvas=document.createElement("canvas")}getCharWidth(e,t){const i=e+t;if(this._cache[i])return this._cache[i];const n=this._canvas.getContext("2d");n.font=t;const r=n.measureText(e).width;return this._cache[i]=r,r}};wp._INSTANCE=null;let LM=wp;function vi(o,e,t){let i=null,n=null;if(typeof t.value=="function"?(i="value",n=t.value,n.length!==0&&console.warn("Memoize should only be used in functions with zero parameters")):typeof t.get=="function"&&(i="get",n=t.get),!n)throw new Error("not supported");const s=`$memoize$${e}`;t[i]=function(...r){return this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:n.apply(this,r)}),this[s]}}var Qce=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pt;(function(o){o.Tap="-monaco-gesturetap",o.Change="-monaco-gesturechange",o.Start="-monaco-gesturestart",o.End="-monaco-gesturesend",o.Contextmenu="-monaco-gesturecontextmenu"})(Pt||(Pt={}));const On=class On extends A{constructor(){super(),this.dispatched=!1,this.targets=new Jn,this.ignoreTargets=new Jn,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(ie.runAndSubscribe(C1,({window:e,disposables:t})=>{t.add(W(e.document,"touchstart",i=>this.onTouchStart(i),{passive:!1})),t.add(W(e.document,"touchend",i=>this.onTouchEnd(e,i))),t.add(W(e.document,"touchmove",i=>this.onTouchMove(i),{passive:!1}))},{window:bt,disposables:this._store}))}static addTarget(e){if(!On.isTouchDevice())return A.None;On.INSTANCE||(On.INSTANCE=new On);const t=On.INSTANCE.targets.push(e);return ue(t)}static ignoreTarget(e){if(!On.isTouchDevice())return A.None;On.INSTANCE||(On.INSTANCE=new On);const t=On.INSTANCE.ignoreTargets.push(e);return ue(t)}static isTouchDevice(){return"ontouchstart"in bt||navigator.maxTouchPoints>0}dispose(){this.handle&&(this.handle.dispose(),this.handle=null),super.dispose()}onTouchStart(e){const t=Date.now();this.handle&&(this.handle.dispose(),this.handle=null);for(let i=0,n=e.targetTouches.length;i<n;i++){const s=e.targetTouches.item(i);this.activeTouches[s.identifier]={id:s.identifier,initialTarget:s.target,initialTimeStamp:t,initialPageX:s.pageX,initialPageY:s.pageY,rollingTimestamps:[t],rollingPageX:[s.pageX],rollingPageY:[s.pageY]};const r=this.newGestureEvent(Pt.Start,s.target);r.pageX=s.pageX,r.pageY=s.pageY,this.dispatchEvent(r)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}onTouchEnd(e,t){const i=Date.now(),n=Object.keys(this.activeTouches).length;for(let s=0,r=t.changedTouches.length;s<r;s++){const a=t.changedTouches.item(s);if(!this.activeTouches.hasOwnProperty(String(a.identifier))){console.warn("move of an UNKNOWN touch",a);continue}const l=this.activeTouches[a.identifier],c=Date.now()-l.initialTimeStamp;if(c<On.HOLD_DELAY&&Math.abs(l.initialPageX-l.rollingPageX.at(-1))<30&&Math.abs(l.initialPageY-l.rollingPageY.at(-1))<30){const d=this.newGestureEvent(Pt.Tap,l.initialTarget);d.pageX=l.rollingPageX.at(-1),d.pageY=l.rollingPageY.at(-1),this.dispatchEvent(d)}else if(c>=On.HOLD_DELAY&&Math.abs(l.initialPageX-l.rollingPageX.at(-1))<30&&Math.abs(l.initialPageY-l.rollingPageY.at(-1))<30){const d=this.newGestureEvent(Pt.Contextmenu,l.initialTarget);d.pageX=l.rollingPageX.at(-1),d.pageY=l.rollingPageY.at(-1),this.dispatchEvent(d)}else if(n===1){const d=l.rollingPageX.at(-1),h=l.rollingPageY.at(-1),u=l.rollingTimestamps.at(-1)-l.rollingTimestamps[0],f=d-l.rollingPageX[0],g=h-l.rollingPageY[0],m=[...this.targets].filter(_=>l.initialTarget instanceof Node&&_.contains(l.initialTarget));this.inertia(e,m,i,Math.abs(f)/u,f>0?1:-1,d,Math.abs(g)/u,g>0?1:-1,h)}this.dispatchEvent(this.newGestureEvent(Pt.End,l.initialTarget)),delete this.activeTouches[a.identifier]}this.dispatched&&(t.preventDefault(),t.stopPropagation(),this.dispatched=!1)}newGestureEvent(e,t){const i=document.createEvent("CustomEvent");return i.initEvent(e,!1,!0),i.initialTarget=t,i.tapCount=0,i}dispatchEvent(e){if(e.type===Pt.Tap){const t=new Date().getTime();let i=0;t-this._lastSetTapCountTime>On.CLEAR_TAP_COUNT_TIME?i=1:i=2,this._lastSetTapCountTime=t,e.tapCount=i}else(e.type===Pt.Change||e.type===Pt.Contextmenu)&&(this._lastSetTapCountTime=0);if(e.initialTarget instanceof Node){for(const i of this.ignoreTargets)if(i.contains(e.initialTarget))return;const t=[];for(const i of this.targets)if(i.contains(e.initialTarget)){let n=0,s=e.initialTarget;for(;s&&s!==i;)n++,s=s.parentElement;t.push([n,i])}t.sort((i,n)=>i[0]-n[0]);for(const[i,n]of t)n.dispatchEvent(e),this.dispatched=!0}}inertia(e,t,i,n,s,r,a,l,c){this.handle=Hs(e,()=>{const d=Date.now(),h=d-i;let u=0,f=0,g=!0;n+=On.SCROLL_FRICTION*h,a+=On.SCROLL_FRICTION*h,n>0&&(g=!1,u=s*n*h),a>0&&(g=!1,f=l*a*h);const m=this.newGestureEvent(Pt.Change);m.translationX=u,m.translationY=f,t.forEach(_=>_.dispatchEvent(m)),g||this.inertia(e,t,d,n,s,r+u,a,l,c+f)})}onTouchMove(e){const t=Date.now();for(let i=0,n=e.changedTouches.length;i<n;i++){const s=e.changedTouches.item(i);if(!this.activeTouches.hasOwnProperty(String(s.identifier))){console.warn("end of an UNKNOWN touch",s);continue}const r=this.activeTouches[s.identifier],a=this.newGestureEvent(Pt.Change,r.initialTarget);a.translationX=s.pageX-r.rollingPageX.at(-1),a.translationY=s.pageY-r.rollingPageY.at(-1),a.pageX=s.pageX,a.pageY=s.pageY,this.dispatchEvent(a),r.rollingPageX.length>3&&(r.rollingPageX.shift(),r.rollingPageY.shift(),r.rollingTimestamps.shift()),r.rollingPageX.push(s.pageX),r.rollingPageY.push(s.pageY),r.rollingTimestamps.push(t)}this.dispatched&&(e.preventDefault(),e.stopPropagation(),this.dispatched=!1)}};On.SCROLL_FRICTION=-.005,On.HOLD_DELAY=700,On.CLEAR_TAP_COUNT_TIME=400;let $n=On;Qce([vi],$n,"isTouchDevice",null);let go=class extends A{onclick(e,t){this._register(W(e,te.CLICK,i=>t(new yn(me(e),i))))}onmousedown(e,t){this._register(W(e,te.MOUSE_DOWN,i=>t(new yn(me(e),i))))}onmouseover(e,t){this._register(W(e,te.MOUSE_OVER,i=>t(new yn(me(e),i))))}onmouseleave(e,t){this._register(W(e,te.MOUSE_LEAVE,i=>t(new yn(me(e),i))))}onkeydown(e,t){this._register(W(e,te.KEY_DOWN,i=>t(new St(i))))}onkeyup(e,t){this._register(W(e,te.KEY_UP,i=>t(new St(i))))}oninput(e,t){this._register(W(e,te.INPUT,t))}onblur(e,t){this._register(W(e,te.BLUR,t))}onfocus(e,t){this._register(W(e,te.FOCUS,t))}ignoreGesture(e){return $n.ignoreTarget(e)}};const p_=11;class Jce extends go{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement("div"),this.bgDomNode.className="arrow-background",this.bgDomNode.style.position="absolute",this.bgDomNode.style.width=e.bgWidth+"px",this.bgDomNode.style.height=e.bgHeight+"px",typeof e.top<"u"&&(this.bgDomNode.style.top="0px"),typeof e.left<"u"&&(this.bgDomNode.style.left="0px"),typeof e.bottom<"u"&&(this.bgDomNode.style.bottom="0px"),typeof e.right<"u"&&(this.bgDomNode.style.right="0px"),this.domNode=document.createElement("div"),this.domNode.className=e.className,this.domNode.classList.add(...ve.asClassNameArray(e.icon)),this.domNode.style.position="absolute",this.domNode.style.width=p_+"px",this.domNode.style.height=p_+"px",typeof e.top<"u"&&(this.domNode.style.top=e.top+"px"),typeof e.left<"u"&&(this.domNode.style.left=e.left+"px"),typeof e.bottom<"u"&&(this.domNode.style.bottom=e.bottom+"px"),typeof e.right<"u"&&(this.domNode.style.right=e.right+"px"),this._pointerMoveMonitor=this._register(new r_),this._register(Si(this.bgDomNode,te.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._register(Si(this.domNode,te.POINTER_DOWN,t=>this._arrowPointerDown(t))),this._pointerdownRepeatTimer=this._register(new Ly),this._pointerdownScheduleRepeatTimer=this._register(new No)}_arrowPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,me(e))};this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(t,200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,i=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault()}}class ede extends A{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 No)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3?!0:this._rawShouldBeVisible}_updateShouldBeVisible(){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(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?" fade":"")))}}const tde=140;class _z extends go{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 ede(e.visibility,"visible scrollbar "+e.extraScrollbarClassName,"invisible scrollbar "+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new r_),this._shouldRender=!0,this.domNode=lt(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(W(this.domNode.domNode,te.POINTER_DOWN,t=>this._domNodePointerDown(t)))}_createArrow(e){const t=this._register(new Jce(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,i,n){this.slider=lt(document.createElement("div")),this.slider.setClassName("slider"),this.slider.setPosition("absolute"),this.slider.setTop(e),this.slider.setLeft(t),typeof i=="number"&&this.slider.setWidth(i),typeof n=="number"&&this.slider.setHeight(n),this.slider.setLayerHinting(!0),this.slider.setContain("strict"),this.domNode.domNode.appendChild(this.slider.domNode),this._register(W(this.slider.domNode,te.POINTER_DOWN,s=>{s.button===0&&(s.preventDefault(),this._sliderPointerDown(s))})),this.onclick(this.slider.domNode,s=>{s.leftButton&&s.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?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,i;if(e.target===this.domNode.domNode&&typeof e.offsetX=="number"&&typeof e.offsetY=="number")t=e.offsetX,i=e.offsetY;else{const r=mi(this.domNode.domNode);t=e.pageX-r.left,i=e.pageY-r.top}const n=e.pointerType==="mouse",s=e.button===0;if(s||!n){const r=this._pointerDownRelativePosition(t,i);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r))}s&&(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,s=>{const r=this._sliderOrthogonalPointerPosition(s),a=Math.abs(r-i);if(gn&&a>tde){this._setDesiredScrollPositionNow(n.getScrollPosition());return}const c=this._sliderPointerPosition(s)-t;this._setDesiredScrollPositionNow(n.getDesiredScrollPositionFromDelta(c))},()=>{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()}}const ide=20;class m_{constructor(e,t,i,n,s,r){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(i),this._arrowSize=Math.round(e),this._visibleSize=n,this._scrollSize=s,this._scrollPosition=r,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new m_(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):!1}setScrollSize(e){const t=Math.round(e);return this._scrollSize!==t?(this._scrollSize=t,this._refreshComputedValues(),!0):!1}setScrollPosition(e){const t=Math.round(e);return this._scrollPosition!==t?(this._scrollPosition=t,this._refreshComputedValues(),!0):!1}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,i,n,s){const r=Math.max(0,i-e),a=Math.max(0,r-2*t),l=n>0&&n>i;if(!l)return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(a),computedSliderRatio:0,computedSliderPosition:0};const c=Math.round(Math.max(ide,Math.floor(i*a/n))),d=(a-c)/(n-i),h=s*d;return{computedAvailableSize:Math.round(r),computedIsNeeded:l,computedSliderSize:Math.round(c),computedSliderRatio:d,computedSliderPosition:Math.round(h)}}_refreshComputedValues(){const e=m_._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 t<this._computedSliderPosition?i-=this._visibleSize:i+=this._visibleSize,i}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;const t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}}class nde extends _z{constructor(e,t,i){const n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new m_(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,n.width,n.scrollWidth,s.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:"horizontal",scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows){const r=(t.arrowSize-p_)/2,a=(t.horizontalScrollbarSize-p_)/2;this._createArrow({className:"scra",icon:Y.scrollbarButtonLeft,top:a,left:r,bottom:void 0,right:void 0,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Zu(null,1,0))}),this._createArrow({className:"scra",icon:Y.scrollbarButtonRight,top:a,left:void 0,bottom:void 0,right:r,bgWidth:t.arrowSize,bgHeight:t.horizontalScrollbarSize,onActivate:()=>this._host.onMouseWheel(new Zu(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(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}}class sde extends _z{constructor(e,t,i){const n=e.getScrollDimensions(),s=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:i,scrollbarState:new m_(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,n.height,n.scrollHeight,s.scrollTop),visibility:t.vertical,extraScrollbarClassName:"vertical",scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows){const r=(t.arrowSize-p_)/2,a=(t.verticalScrollbarSize-p_)/2;this._createArrow({className:"scra",icon:Y.scrollbarButtonUp,top:r,left:a,bottom:void 0,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Zu(null,0,1))}),this._createArrow({className:"scra",icon:Y.scrollbarButtonDown,top:void 0,left:a,bottom:r,right:void 0,bgWidth:t.verticalScrollbarSize,bgHeight:t.arrowSize,onActivate:()=>this._host.onMouseWheel(new Zu(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(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}}class BL{constructor(e,t,i,n,s,r,a){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t=t|0,i=i|0,n=n|0,s=s|0,r=r|0,a=a|0),this.rawScrollLeft=n,this.rawScrollTop=a,t<0&&(t=0),n+t>i&&(n=i-t),n<0&&(n=0),s<0&&(s=0),a+s>r&&(a=r-s),a<0&&(a=0),this.width=t,this.scrollWidth=i,this.scrollLeft=n,this.height=s,this.scrollHeight=r,this.scrollTop=a}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 BL(this._forceIntegerValues,typeof e.width<"u"?e.width:this.width,typeof e.scrollWidth<"u"?e.scrollWidth:this.scrollWidth,t?this.rawScrollLeft:this.scrollLeft,typeof e.height<"u"?e.height:this.height,typeof e.scrollHeight<"u"?e.scrollHeight:this.scrollHeight,t?this.rawScrollTop:this.scrollTop)}withScrollPosition(e){return new BL(this._forceIntegerValues,this.width,this.scrollWidth,typeof e.scrollLeft<"u"?e.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof e.scrollTop<"u"?e.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){const i=this.width!==e.width,n=this.scrollWidth!==e.scrollWidth,s=this.scrollLeft!==e.scrollLeft,r=this.height!==e.height,a=this.scrollHeight!==e.scrollHeight,l=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:r,scrollHeightChanged:a,scrollTopChanged:l}}}class __ extends A{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new P),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new BL(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){const i=this._state.withScrollDimensions(e,t);this._setState(i,!!this._smoothScrolling),this._smoothScrolling?.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(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>"u"?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>"u"?this._smoothScrolling.to.scrollTop:e.scrollTop};const i=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===i.scrollLeft&&this._smoothScrolling.to.scrollTop===i.scrollTop)return;let n;t?n=new X1(this._smoothScrolling.from,i,this._smoothScrolling.startTime,this._smoothScrolling.duration):n=this._smoothScrolling.combine(this._state,i,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=n}else{const i=this._state.withScrollPosition(e);this._smoothScrolling=X1.start(this._state,i,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;const e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),!!this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){const i=this._state;i.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(i,t)))}}class bz{constructor(e,t,i){this.scrollLeft=e,this.scrollTop=t,this.isDone=i}}function xM(o,e){const t=e-o;return function(i){return o+t*ade(i)}}function ode(o,e,t){return function(i){return i<t?o(i/t):e((i-t)/(1-t))}}class X1{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 s,r;return e<t?(s=e+.75*i,r=t-.75*i):(s=e-.75*i,r=t+.75*i),ode(xM(e,s),xM(r,t),.33)}return xM(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){const t=(e-this.startTime)/this.duration;if(t<1){const i=this.scrollLeft(t),n=this.scrollTop(t);return new bz(i,n,!1)}return new bz(this.to.scrollLeft,this.to.scrollTop,!0)}combine(e,t,i){return X1.start(e,t,i)}static start(e,t,i){i=i+10;const n=Date.now()-10;return new X1(e,t,n,i)}}function rde(o){return Math.pow(o,3)}function ade(o){return 1-rde(1-o)}const lde=500,Cz=50;class cde{constructor(e,t,i){this.timestamp=e,this.deltaX=t,this.deltaY=i,this.score=0}}const rN=class rN{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,i=1,n=this._rear;do{const s=n===this._front?e:Math.pow(2,-i);if(e-=s,t+=this._memory[n].score*s,n===this._front)break;n=(this._capacity+n-1)%this._capacity,i++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(GC){const t=me(e.browserEvent),i=UT(t);this.accept(Date.now(),e.deltaX*i,e.deltaY*i)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,i){let n=null;const s=new cde(e,t,i);this._front===-1&&this._rear===-1?(this._memory[0]=s,this._front=0,this._rear=0):(n=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=s),s.score=this._computeScore(s,n)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let i=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(i+=.25),t){const n=Math.abs(e.deltaX),s=Math.abs(e.deltaY),r=Math.abs(t.deltaX),a=Math.abs(t.deltaY),l=Math.max(Math.min(n,r),1),c=Math.max(Math.min(s,a),1),d=Math.max(n,r),h=Math.max(s,a);d%l===0&&h%c===0&&(i-=.5)}return Math.min(Math.max(i,0),1)}_isAlmostInt(e){const t=Number.EPSILON*100;return Math.abs(Math.round(e)-e)<.01+t}};rN.INSTANCE=new rN;let HL=rN;class kM extends go{get onScroll(){return this._onScroll.event}get options(){return this._options}constructor(e,t,i){super(),this._inertialTimeout=null,this._inertialSpeed={X:0,Y:0},this._onScroll=this._register(new P),this._onWillScroll=this._register(new P),e.style.overflow="hidden",this._options=dde(t),this._scrollable=i,this._register(this._scrollable.onScroll(s=>{this._onWillScroll.fire(s),this._onDidScroll(s),this._onScroll.fire(s)}));const n={onMouseWheel:s=>this._onMouseWheel(s),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new sde(this._scrollable,this._options,n)),this._horizontalScrollbar=this._register(new nde(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=lt(document.createElement("div")),this._leftShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=lt(document.createElement("div")),this._topShadowDomNode.setClassName("shadow"),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=lt(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,s=>this._onMouseOver(s)),this.onmouseleave(this._listenOnDomNode,s=>this._onMouseLeave(s)),this._hideTimeout=this._register(new No),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}dispose(){this._mouseWheelToDispose=pt(this._mouseWheelToDispose),this._inertialTimeout&&(this._inertialTimeout.dispose(),this._inertialTimeout=null),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,ze&&(this._options.className+=" mac"),this._domNode.className="monaco-scrollable-element "+this._options.className}updateOptions(e){typeof e.handleMouseWheel<"u"&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<"u"&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<"u"&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<"u"&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<"u"&&(this._options.horizontal=e.horizontal),typeof e.vertical<"u"&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<"u"&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<"u"&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<"u"&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new Zu(e))}async _periodicSync(){let e=!1;(this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0)&&(this._scrollable.setScrollPositionNow({scrollTop:this._scrollable.getCurrentScrollPosition().scrollTop-this._inertialSpeed.Y*100,scrollLeft:this._scrollable.getCurrentScrollPosition().scrollLeft-this._inertialSpeed.X*100}),this._inertialSpeed.X*=.9,this._inertialSpeed.Y*=.9,Math.abs(this._inertialSpeed.X)<.01&&(this._inertialSpeed.X=0),Math.abs(this._inertialSpeed.Y)<.01&&(this._inertialSpeed.Y=0),e=this._inertialSpeed.X!==0||this._inertialSpeed.Y!==0),e?(this._inertialTimeout||(this._inertialTimeout=new No),this._inertialTimeout.cancelAndSet(()=>this._periodicSync(),1e3/60)):(this._inertialTimeout?.dispose(),this._inertialTimeout=null)}_setListeningToMouseWheel(e){if(this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=pt(this._mouseWheelToDispose),e)){const i=n=>{this._onMouseWheel(new Zu(n))};this._mouseWheelToDispose.push(W(this._listenOnDomNode,te.MOUSE_WHEEL,i,{passive:!1}))}}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;const t=HL.INSTANCE;t.acceptStandardWheelEvent(e);let i=!1;if(e.deltaY||e.deltaX){let s=e.deltaY*this._options.mouseWheelScrollSensitivity,r=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&r+s===0?r=s=0:Math.abs(s)>=Math.abs(r)?r=0:s=0),this._options.flipAxes&&([s,r]=[r,s]);const a=!ze&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!r&&(r=s,s=0),e.browserEvent&&e.browserEvent.altKey&&(r=r*this._options.fastScrollSensitivity,s=s*this._options.fastScrollSensitivity);const l=this._scrollable.getFutureScrollPosition();let c={};if(s){const d=Cz*s,h=l.scrollTop-(d<0?Math.floor(d):Math.ceil(d));this._verticalScrollbar.writeScrollPosition(c,h)}if(r){const d=Cz*r,h=l.scrollLeft-(d<0?Math.floor(d):Math.ceil(d));this._horizontalScrollbar.writeScrollPosition(c,h)}if(c=this._scrollable.validateScrollPosition(c),this._options.inertialScroll&&(r||s)){let d=!1;this._inertialSpeed.X===0&&this._inertialSpeed.Y===0&&(d=!0),this._inertialSpeed.Y=(s<0?-1:1)*Math.abs(s)**1.02,this._inertialSpeed.X=(r<0?-1:1)*Math.abs(r)**1.02,d&&this._periodicSync()}(l.scrollLeft!==c.scrollLeft||l.scrollTop!==c.scrollTop)&&(this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(c):this._scrollable.setScrollPositionNow(c),i=!0)}let n=i;!n&&this._options.alwaysConsumeMouseWheel&&(n=!0),!n&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(n=!0),n&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw new Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){const e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,i=e.scrollLeft>0,n=i?" left":"",s=t?" top":"",r=i||t?" top-left-corner":"";this._leftShadowDomNode.setClassName(`shadow${n}`),this._topShadowDomNode.setClassName(`shadow${s}`),this._topLeftShadowDomNode.setClassName(`shadow${r}${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(),lde)}}class vz extends kM{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new __({forceIntegerValues:!0,smoothScrollDuration:0,scheduleAtNextAnimationFrame:n=>Hs(me(e),n)});super(e,t,i),this._register(i)}setScrollPosition(e){this._scrollable.setScrollPositionNow(e)}}class VL extends kM{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 Q1 extends kM{constructor(e,t){t=t||{},t.mouseWheelSmoothScroll=!1;const i=new __({forceIntegerValues:!1,smoothScrollDuration:0,scheduleAtNextAnimationFrame:n=>Hs(me(e),n)});super(e,t,i),this._register(i),this._element=e,this._register(this.onScroll(n=>{n.scrollTopChanged&&(this._element.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this._element.scrollLeft=n.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})}}function dde(o){const e={lazyRender:typeof o.lazyRender<"u"?o.lazyRender:!1,className:typeof o.className<"u"?o.className:"",useShadows:typeof o.useShadows<"u"?o.useShadows:!0,handleMouseWheel:typeof o.handleMouseWheel<"u"?o.handleMouseWheel:!0,flipAxes:typeof o.flipAxes<"u"?o.flipAxes:!1,consumeMouseWheelIfScrollbarIsNeeded:typeof o.consumeMouseWheelIfScrollbarIsNeeded<"u"?o.consumeMouseWheelIfScrollbarIsNeeded:!1,alwaysConsumeMouseWheel:typeof o.alwaysConsumeMouseWheel<"u"?o.alwaysConsumeMouseWheel:!1,scrollYToX:typeof o.scrollYToX<"u"?o.scrollYToX:!1,mouseWheelScrollSensitivity:typeof o.mouseWheelScrollSensitivity<"u"?o.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof o.fastScrollSensitivity<"u"?o.fastScrollSensitivity:5,scrollPredominantAxis:typeof o.scrollPredominantAxis<"u"?o.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof o.mouseWheelSmoothScroll<"u"?o.mouseWheelSmoothScroll:!0,inertialScroll:typeof o.inertialScroll<"u"?o.inertialScroll:!1,arrowSize:typeof o.arrowSize<"u"?o.arrowSize:11,listenOnDomNode:typeof o.listenOnDomNode<"u"?o.listenOnDomNode:null,horizontal:typeof o.horizontal<"u"?o.horizontal:1,horizontalScrollbarSize:typeof o.horizontalScrollbarSize<"u"?o.horizontalScrollbarSize:10,horizontalSliderSize:typeof o.horizontalSliderSize<"u"?o.horizontalSliderSize:0,horizontalHasArrows:typeof o.horizontalHasArrows<"u"?o.horizontalHasArrows:!1,vertical:typeof o.vertical<"u"?o.vertical:1,verticalScrollbarSize:typeof o.verticalScrollbarSize<"u"?o.verticalScrollbarSize:10,verticalHasArrows:typeof o.verticalHasArrows<"u"?o.verticalHasArrows:!1,verticalSliderSize:typeof o.verticalSliderSize<"u"?o.verticalSliderSize:0,scrollByPage:typeof o.scrollByPage<"u"?o.scrollByPage:!1};return e.horizontalSliderSize=typeof o.horizontalSliderSize<"u"?o.horizontalSliderSize:e.horizontalScrollbarSize,e.verticalSliderSize=typeof o.verticalSliderSize<"u"?o.verticalSliderSize:e.verticalScrollbarSize,ze&&(e.className+=" mac"),e}class wz extends A{constructor(e,t,i,n){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=n,this._operation=null}dispose(){super.dispose(),this.stop()}start(e,t){this._operation?this._operation.setPosition(e,t):this._operation=this._createDragScrollingOperation(e,t)}stop(){this._operation&&(this._operation.dispose(),this._operation=null)}}class Sz extends A{constructor(e,t,i,n,s,r){super(),this._context=e,this._viewHelper=t,this._mouseTargetFactory=i,this._dispatchMouse=n,this._position=s,this._mouseEvent=r,this._lastTime=Date.now(),this._animationFrameDisposable=Hs(me(r.browserEvent),()=>this._execute())}dispose(){this._animationFrameDisposable.dispose(),super.dispose()}setPosition(e,t){this._position=e,this._mouseEvent=t}_tick(){const e=Date.now(),t=e-this._lastTime;return this._lastTime=e,t}}class hde extends wz{_createDragScrollingOperation(e,t){return new ude(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}}class ude extends Sz{_getScrollSpeed(){const e=this._context.configuration.options.get(75),t=this._context.configuration.options.get(165).height/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){const e=this._context.configuration.options.get(75),t=this._getScrollSpeed(),i=this._tick(),n=t*(i/1e3)*e,s=this._position.outsidePosition==="above"?-n:n;this._context.viewModel.viewLayout.deltaScrollNow(0,s),this._viewHelper.renderNow();const r=this._context.viewLayout.getLinesViewportData(),a=this._position.outsidePosition==="above"?r.startLineNumber:r.endLineNumber;let l;{const c=RL(this._viewHelper.viewDomNode),d=this._context.configuration.options.get(165).horizontalScrollbarHeight,h=new G1(this._mouseEvent.pos.x,c.y+c.height-d-.1),u=ML(this._viewHelper.viewDomNode,c,h);l=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),c,h,u,null)}(!l.position||l.position.lineNumber!==a)&&(this._position.outsidePosition==="above"?l=Nn.createOutsideEditor(this._position.mouseColumn,new M(a,1),"above",this._position.outsideDistance):l=Nn.createOutsideEditor(this._position.mouseColumn,new M(a,this._context.viewModel.getLineMaxColumn(a)),"below",this._position.outsideDistance)),this._dispatchMouse(l,!0,2),this._animationFrameDisposable=Hs(me(l.element),()=>this._execute())}}class fde extends wz{_createDragScrollingOperation(e,t){return new gde(this._context,this._viewHelper,this._mouseTargetFactory,this._dispatchMouse,e,t)}}class gde extends Sz{_getScrollSpeed(){const e=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,t=this._context.configuration.options.get(165).contentWidth/e,i=this._position.outsideDistance/e;return i<=1.5?Math.max(30,t*(1+i)):i<=3?Math.max(60,t*(2+i)):Math.max(200,t*(7+i))}_execute(){const e=this._context.configuration.options.get(59).typicalFullwidthCharacterWidth,t=this._getScrollSpeed(),i=this._tick(),n=t*(i/1e3)*e*.5,s=this._position.outsidePosition==="left"?-n:n;if(this._context.viewModel.viewLayout.deltaScrollNow(s,0),this._viewHelper.renderNow(),!this._position.position)return;const r=this._position.position.lineNumber;let a;{const l=RL(this._viewHelper.viewDomNode),c=this._context.configuration.options.get(165).horizontalScrollbarHeight,d=new G1(this._mouseEvent.pos.x,l.y+l.height-c-.1),h=ML(this._viewHelper.viewDomNode,l,d);a=this._mouseTargetFactory.createMouseTarget(this._viewHelper.getLastRenderData(),l,d,h,null)}this._position.outsidePosition==="left"?a=Nn.createOutsideEditor(a.mouseColumn,new M(r,a.mouseColumn),"left",this._position.outsideDistance):a=Nn.createOutsideEditor(a.mouseColumn,new M(r,a.mouseColumn),"right",this._position.outsideDistance),this._dispatchMouse(a,!0,2),this._animationFrameDisposable=Hs(me(a.element),()=>this._execute())}}class IM extends Tf{constructor(e,t,i){super(),this._mouseLeaveMonitor=null,this._context=e,this.viewController=t,this.viewHelper=i,this.mouseTargetFactory=new rs(this._context,i),this._mouseDownOperation=this._register(new pde(this._context,this.viewController,this.viewHelper,this.mouseTargetFactory,(r,a)=>this._createMouseTarget(r,a),r=>this._getMouseColumn(r))),this.lastMouseLeaveTime=-1,this._height=this._context.configuration.options.get(165).height;const n=new xce(this.viewHelper.viewDomNode);this._register(n.onContextMenu(this.viewHelper.viewDomNode,r=>this._onContextMenu(r,!0))),this._register(n.onMouseMove(this.viewHelper.viewDomNode,r=>{this._onMouseMove(r),this._mouseLeaveMonitor||(this._mouseLeaveMonitor=W(this.viewHelper.viewDomNode.ownerDocument,"mousemove",a=>{this.viewHelper.viewDomNode.contains(a.target)||this._onMouseLeave(new Hc(a,!1,this.viewHelper.viewDomNode))}))})),this._register(n.onMouseUp(this.viewHelper.viewDomNode,r=>this._onMouseUp(r))),this._register(n.onMouseLeave(this.viewHelper.viewDomNode,r=>this._onMouseLeave(r)));let s=0;this._register(n.onPointerDown(this.viewHelper.viewDomNode,(r,a)=>{s=a})),this._register(W(this.viewHelper.viewDomNode,te.POINTER_UP,r=>{this._mouseDownOperation.onPointerUp()})),this._register(n.onMouseDown(this.viewHelper.viewDomNode,r=>this._onMouseDown(r,s))),this._setupMouseWheelZoomListener(),this._context.addEventHandler(this)}_setupMouseWheelZoomListener(){const e=HL.INSTANCE;let t=0,i=xr.getZoomLevel(),n=!1,s=0;const r=l=>{if(this.viewController.emitMouseWheel(l),!this._context.configuration.options.get(84))return;const c=new Zu(l);if(e.acceptStandardWheelEvent(c),e.isPhysicalMouseWheel()){if(a(l)){const d=xr.getZoomLevel(),h=c.deltaY>0?1:-1;xr.setZoomLevel(d+h),c.preventDefault(),c.stopPropagation()}}else Date.now()-t>50&&(i=xr.getZoomLevel(),n=a(l),s=0),t=Date.now(),s+=c.deltaY,n&&(xr.setZoomLevel(i+s/5),c.preventDefault(),c.stopPropagation())};this._register(W(this.viewHelper.viewDomNode,te.MOUSE_WHEEL,r,{capture:!0,passive:!1}));function a(l){return ze?(l.metaKey||l.ctrlKey)&&!l.shiftKey&&!l.altKey:l.ctrlKey&&!l.metaKey&&!l.shiftKey&&!l.altKey}}dispose(){this._context.removeEventHandler(this),this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),super.dispose()}onConfigurationChanged(e){if(e.hasChanged(165)){const t=this._context.configuration.options.get(165).height;this._height!==t&&(this._height=t,this._mouseDownOperation.onHeightChanged())}return!1}onCursorStateChanged(e){return this._mouseDownOperation.onCursorStateChanged(e),!1}onFocusChanged(e){return!1}getTargetAtClientPoint(e,t){const n=new az(e,t).toPageCoordinates(me(this.viewHelper.viewDomNode)),s=RL(this.viewHelper.viewDomNode);if(n.y<s.y||n.y>s.y+s.height||n.x<s.x||n.x>s.x+s.width)return null;const r=ML(this.viewHelper.viewDomNode,s,n);return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),s,n,r,null)}_createMouseTarget(e,t){let i=e.target;if(!this.viewHelper.viewDomNode.contains(i)){const n=ah(this.viewHelper.viewDomNode);n&&(i=n.elementsFromPoint(e.posx,e.posy).find(s=>this.viewHelper.viewDomNode.contains(s)))}return this.mouseTargetFactory.createMouseTarget(this.viewHelper.getLastRenderData(),e.editorPos,e.pos,e.relativePos,t?i:null)}_getMouseColumn(e){return this.mouseTargetFactory.getMouseColumn(e.relativePos)}_onContextMenu(e,t){this.viewController.emitContextMenu({event:e,target:this._createMouseTarget(e,t)})}_onMouseMove(e){this.mouseTargetFactory.mouseTargetIsWidget(e)||e.preventDefault(),!(this._mouseDownOperation.isActive()||e.timestamp<this.lastMouseLeaveTime)&&this.viewController.emitMouseMove({event:e,target:this._createMouseTarget(e,!0)})}_onMouseLeave(e){this._mouseLeaveMonitor&&(this._mouseLeaveMonitor.dispose(),this._mouseLeaveMonitor=null),this.lastMouseLeaveTime=new Date().getTime(),this.viewController.emitMouseLeave({event:e,target:null})}_onMouseUp(e){this.viewController.emitMouseUp({event:e,target:this._createMouseTarget(e,!0)})}_onMouseDown(e,t){const i=this._createMouseTarget(e,!0),n=i.type===6||i.type===7,s=i.type===2||i.type===3||i.type===4,r=i.type===3,a=this._context.configuration.options.get(125),l=i.type===8||i.type===5,c=i.type===9;let d=e.leftButton||e.middleButton;ze&&e.leftButton&&e.ctrlKey&&(d=!1);const h=()=>{e.preventDefault(),this.viewHelper.focusTextArea()};if(d&&(n||r&&a))h(),this._mouseDownOperation.start(i.type,e,t);else if(s)e.preventDefault();else if(l){const u=i.detail;d&&this.viewHelper.shouldSuppressMouseDownOnViewZone(u.viewZoneId)&&(h(),this._mouseDownOperation.start(i.type,e,t),e.preventDefault())}else c&&this.viewHelper.shouldSuppressMouseDownOnWidget(i.detail)&&(h(),e.preventDefault());this.viewController.emitMouseDown({event:e,target:i})}}class pde extends A{constructor(e,t,i,n,s,r){super(),this._context=e,this._viewController=t,this._viewHelper=i,this._mouseTargetFactory=n,this._createMouseTarget=s,this._getMouseColumn=r,this._mouseMoveMonitor=this._register(new Ice(this._viewHelper.viewDomNode)),this._topBottomDragScrolling=this._register(new hde(this._context,this._viewHelper,this._mouseTargetFactory,(a,l,c)=>this._dispatchMouse(a,l,c))),this._leftRightDragScrolling=this._register(new fde(this._context,this._viewHelper,this._mouseTargetFactory,(a,l,c)=>this._dispatchMouse(a,l,c))),this._mouseState=new DM,this._currentSelection=new ce(1,1,1,1),this._isActive=!1,this._lastMouseEvent=null}dispose(){super.dispose()}isActive(){return this._isActive}_onMouseDownThenMove(e){this._lastMouseEvent=e,this._mouseState.setModifiers(e);const t=this._findMousePosition(e,!1);t&&(this._mouseState.isDragAndDrop?this._viewController.emitMouseDrag({event:e,target:t}):t.type===13?t.outsidePosition==="above"||t.outsidePosition==="below"?(this._topBottomDragScrolling.start(t,e),this._leftRightDragScrolling.stop()):(this._leftRightDragScrolling.start(t,e),this._topBottomDragScrolling.stop()):(this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop(),this._dispatchMouse(t,!0,1)))}start(e,t,i){this._lastMouseEvent=t,this._mouseState.setStartedOnLineNumbers(e===3),this._mouseState.setStartButtons(t),this._mouseState.setModifiers(t);const n=this._findMousePosition(t,!0);if(!n||!n.position)return;this._mouseState.trySetCount(t.detail,n.position),t.detail=this._mouseState.count;const s=this._context.configuration.options;if(!s.get(104)&&s.get(42)&&!s.get(28)&&!this._mouseState.altKey&&t.detail<2&&!this._isActive&&!this._currentSelection.isEmpty()&&n.type===6&&n.position&&this._currentSelection.containsPosition(n.position)){this._mouseState.isDragAndDrop=!0,this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),r=>{const a=this._findMousePosition(this._lastMouseEvent,!1);Mc(r)?this._viewController.emitMouseDropCanceled():this._viewController.emitMouseDrop({event:this._lastMouseEvent,target:a?this._createMouseTarget(this._lastMouseEvent,!0):null}),this._stop()});return}this._mouseState.isDragAndDrop=!1,this._dispatchMouse(n,t.shiftKey,1),this._isActive||(this._isActive=!0,this._mouseMoveMonitor.startMonitoring(this._viewHelper.viewLinesDomNode,i,t.buttons,r=>this._onMouseDownThenMove(r),()=>this._stop()))}_stop(){this._isActive=!1,this._topBottomDragScrolling.stop(),this._leftRightDragScrolling.stop()}onHeightChanged(){this._mouseMoveMonitor.stopMonitoring()}onPointerUp(){this._mouseMoveMonitor.stopMonitoring()}onCursorStateChanged(e){this._currentSelection=e.selections[0]}_getPositionOutsideEditor(e){const t=e.editorPos,i=this._context.viewModel,n=this._context.viewLayout,s=this._getMouseColumn(e);if(e.posy<t.y){const h=t.y-e.posy,u=Math.max(n.getCurrentScrollTop()-h,0),f=g_.getZoneAtCoord(this._context,u);if(f){const m=this._helpPositionJumpOverViewZone(f);if(m)return Nn.createOutsideEditor(s,m,"above",h)}const g=n.getLineNumberAtVerticalOffset(u);return Nn.createOutsideEditor(s,new M(g,1),"above",h)}if(e.posy>t.y+t.height){const h=e.posy-t.y-t.height,u=n.getCurrentScrollTop()+e.relativePos.y,f=g_.getZoneAtCoord(this._context,u);if(f){const m=this._helpPositionJumpOverViewZone(f);if(m)return Nn.createOutsideEditor(s,m,"below",h)}const g=n.getLineNumberAtVerticalOffset(u);return Nn.createOutsideEditor(s,new M(g,i.getLineMaxColumn(g)),"below",h)}const r=n.getLineNumberAtVerticalOffset(n.getCurrentScrollTop()+e.relativePos.y),a=this._context.configuration.options.get(165),l=a.contentLeft;if(e.relativePos.x<=l){const h=l-e.relativePos.x;return Nn.createOutsideEditor(s,new M(r,1),"left",h)}const d=a.minimap.minimapLeft===0?a.width-a.verticalScrollbarWidth:a.minimap.minimapLeft;if(e.relativePos.x>=d){const h=e.relativePos.x-d;return Nn.createOutsideEditor(s,new M(r,i.getLineMaxColumn(r)),"right",h)}return null}_findMousePosition(e,t){const i=this._getPositionOutsideEditor(e);if(i)return i;const n=this._createMouseTarget(e,t);if(!n.position)return null;if(n.type===8||n.type===5){const r=this._helpPositionJumpOverViewZone(n.detail);if(r)return Nn.createViewZone(n.type,n.element,n.mouseColumn,r,n.detail)}return n}_helpPositionJumpOverViewZone(e){const t=new M(this._currentSelection.selectionStartLineNumber,this._currentSelection.selectionStartColumn),i=e.positionBefore,n=e.positionAfter;return i&&n?i.isBefore(t)?i:n:null}_dispatchMouse(e,t,i){e.position&&this._viewController.dispatchMouse({position:e.position,mouseColumn:e.mouseColumn,startedOnLineNumbers:this._mouseState.startedOnLineNumbers,revealType:i,inSelectionMode:t,mouseDownCount:this._mouseState.count,altKey:this._mouseState.altKey,ctrlKey:this._mouseState.ctrlKey,metaKey:this._mouseState.metaKey,shiftKey:this._mouseState.shiftKey,leftButton:this._mouseState.leftButton,middleButton:this._mouseState.middleButton,onInjectedText:e.type===6&&e.detail.injectedText!==null})}}const aN=class aN{get altKey(){return this._altKey}get ctrlKey(){return this._ctrlKey}get metaKey(){return this._metaKey}get shiftKey(){return this._shiftKey}get leftButton(){return this._leftButton}get middleButton(){return this._middleButton}get startedOnLineNumbers(){return this._startedOnLineNumbers}constructor(){this._altKey=!1,this._ctrlKey=!1,this._metaKey=!1,this._shiftKey=!1,this._leftButton=!1,this._middleButton=!1,this._startedOnLineNumbers=!1,this._lastMouseDownPosition=null,this._lastMouseDownPositionEqualCount=0,this._lastMouseDownCount=0,this._lastSetMouseDownCountTime=0,this.isDragAndDrop=!1}get count(){return this._lastMouseDownCount}setModifiers(e){this._altKey=e.altKey,this._ctrlKey=e.ctrlKey,this._metaKey=e.metaKey,this._shiftKey=e.shiftKey}setStartButtons(e){this._leftButton=e.leftButton,this._middleButton=e.middleButton}setStartedOnLineNumbers(e){this._startedOnLineNumbers=e}trySetCount(e,t){const i=new Date().getTime();i-this._lastSetMouseDownCountTime>aN.CLEAR_MOUSE_DOWN_COUNT_TIME&&(e=1),this._lastSetMouseDownCountTime=i,e>this._lastMouseDownCount+1&&(e=this._lastMouseDownCount+1),this._lastMouseDownPosition&&this._lastMouseDownPosition.equals(t)?this._lastMouseDownPositionEqualCount++:this._lastMouseDownPositionEqualCount=1,this._lastMouseDownPosition=t,this._lastMouseDownCount=Math.min(e,this._lastMouseDownPositionEqualCount)}};aN.CLEAR_MOUSE_DOWN_COUNT_TIME=400;let DM=aN;class gt{get event(){return this.emitter.event}constructor(e,t,i){const n=s=>this.emitter.fire(s);this.emitter=new P({onWillAddFirstListener:()=>e.addEventListener(t,n,i),onDidRemoveLastListener:()=>e.removeEventListener(t,n,i)})}dispose(){this.emitter.dispose()}}function yz(o,e,t,i){const n=o.getPlainTextToCopy(e,t,gn),s=o.model.getEOL(),r=t&&e.length===1&&e[0].isEmpty(),a=Array.isArray(n)?n:null,l=Array.isArray(n)?n.join(s):n;let c,d=null;if(EM.forceCopyWithSyntaxHighlighting||i&&l.length<65536){const u=o.getRichTextToCopy(e,t);u&&(c=u.html,d=u.mode)}return{isFromEmptySelection:r,multicursorText:a,text:l,html:c,mode:d}}const lN=class lN{constructor(){this._lastState=null}set(e,t){this._lastState={lastCopiedValue:e,data:t}}get(e){return this._lastState&&this._lastState.lastCopiedValue===e?this._lastState.data:(this._lastState=null,null)}};lN.INSTANCE=new lN;let wl=lN;const EM={forceCopyWithSyntaxHighlighting:!1},Af={getTextData(o){const e=o.getData(_i.text);let t=null;const i=o.getData("vscode-editor-data");if(typeof i=="string")try{t=JSON.parse(i),t.version!==1&&(t=null)}catch{}return e.length===0&&t===null&&o.files.length>0?[Array.prototype.slice.call(o.files,0).map(s=>s.name).join(`
`),null]:[e,t]},setTextData(o,e,t,i){o.setData(_i.text,e),typeof t=="string"&&o.setData("text/html",t),o.setData("vscode-editor-data",JSON.stringify(i))}},Sp=class Sp{constructor(e,t,i,n,s){this.value=e,this.selectionStart=t,this.selectionEnd=i,this.selection=n,this.newlineCountBeforeSelection=s}toString(){return`[ <${this.value}>, selectionStart: ${this.selectionStart}, selectionEnd: ${this.selectionEnd}]`}static readFromTextArea(e,t){const i=e.getValue(),n=e.getSelectionStart(),s=e.getSelectionEnd();let r;if(t){const a=i.substring(0,n),l=t.value.substring(0,t.selectionStart);a===l&&(r=t.newlineCountBeforeSelection)}return new Sp(i,n,s,null,r)}collapseSelection(){return this.selectionStart===this.value.length?this:new Sp(this.value,this.value.length,this.value.length,null,void 0)}isWrittenToTextArea(e,t){const i=this.value===e.getValue();return t?this.selectionStart===e.getSelectionStart()&&this.selectionEnd===e.getSelectionEnd()&&i:i}writeToTextArea(e,t,i){t.setValue(e,this.value),i&&t.setSelectionRange(e,this.selectionStart,this.selectionEnd)}deduceEditorPosition(e){if(e<=this.selectionStart){const n=this.value.substring(e,this.selectionStart);return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,n,-1)}if(e>=this.selectionEnd){const n=this.value.substring(this.selectionEnd,e);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,n,1)}const t=this.value.substring(this.selectionStart,e);if(t.indexOf("…")===-1)return this._finishDeduceEditorPosition(this.selection?.getStartPosition()??null,t,1);const i=this.value.substring(e,this.selectionEnd);return this._finishDeduceEditorPosition(this.selection?.getEndPosition()??null,i,-1)}_finishDeduceEditorPosition(e,t,i){let n=0,s=-1;for(;(s=t.indexOf(`
`,s+1))!==-1;)n++;return[e,i*t.length,n]}static deduceInput(e,t,i){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};const n=Math.min(Gr(e.value,t.value),e.selectionStart,t.selectionStart),s=Math.min(Lc(e.value,t.value),e.value.length-e.selectionEnd,t.value.length-t.selectionEnd);e.value.substring(n,e.value.length-s);const r=t.value.substring(n,t.value.length-s),a=e.selectionStart-n,l=e.selectionEnd-n,c=t.selectionStart-n,d=t.selectionEnd-n;if(c===d){const u=e.selectionStart-n;return{text:r,replacePrevCharCnt:u,replaceNextCharCnt:0,positionDelta:0}}const h=l-a;return{text:r,replacePrevCharCnt:h,replaceNextCharCnt:0,positionDelta:0}}static deduceAndroidCompositionInput(e,t){if(!e)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0};if(e.value===t.value)return{text:"",replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:t.selectionEnd-e.selectionEnd};const i=Math.min(Gr(e.value,t.value),e.selectionEnd),n=Math.min(Lc(e.value,t.value),e.value.length-e.selectionEnd),s=e.value.substring(i,e.value.length-n),r=t.value.substring(i,t.value.length-n);e.selectionStart-i;const a=e.selectionEnd-i;t.selectionStart-i;const l=t.selectionEnd-i;return{text:r,replacePrevCharCnt:a,replaceNextCharCnt:s.length-a,positionDelta:l-r.length}}static fromScreenReaderContentState(e){return new Sp(e.value,e.selectionStart,e.selectionEnd,e.selection,e.newlineCountBeforeSelection)}};Sp.EMPTY=new Sp("",0,0,null,void 0);let as=Sp;const Of=(function(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID.bind(crypto);const o=new Uint8Array(16),e=[];for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return function(){crypto.getRandomValues(o),o[6]=o[6]&15|64,o[8]=o[8]&63|128;let i=0,n="";return n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+="-",n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n+=e[o[i++]],n}})();function Lz(o){return`${o}-${Of()}`}var mde=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xz=function(o,e){return function(t,i){e(t,i,o)}},zL;(function(o){o.Tap="-monaco-textarea-synthetic-tap"})(zL||(zL={}));class _de{constructor(){this._lastTypeTextLength=0}handleCompositionUpdate(e){e=e||"";const t={text:e,replacePrevCharCnt:this._lastTypeTextLength,replaceNextCharCnt:0,positionDelta:0};return this._lastTypeTextLength=e.length,t}}let NM=class extends A{get textAreaState(){return this._textAreaState}constructor(e,t,i,n,s,r){super(),this._host=e,this._textArea=t,this._OS=i,this._browser=n,this._accessibilityService=s,this._logService=r,this._onFocus=this._register(new P),this.onFocus=this._onFocus.event,this._onBlur=this._register(new P),this.onBlur=this._onBlur.event,this._onKeyDown=this._register(new P),this.onKeyDown=this._onKeyDown.event,this._onKeyUp=this._register(new P),this.onKeyUp=this._onKeyUp.event,this._onCut=this._register(new P),this.onCut=this._onCut.event,this._onPaste=this._register(new P),this.onPaste=this._onPaste.event,this._onType=this._register(new P),this.onType=this._onType.event,this._onCompositionStart=this._register(new P),this.onCompositionStart=this._onCompositionStart.event,this._onCompositionUpdate=this._register(new P),this.onCompositionUpdate=this._onCompositionUpdate.event,this._onCompositionEnd=this._register(new P),this.onCompositionEnd=this._onCompositionEnd.event,this._onSelectionChangeRequest=this._register(new P),this.onSelectionChangeRequest=this._onSelectionChangeRequest.event,this._asyncFocusGainWriteScreenReaderContent=this._register(new ct),this._asyncTriggerCut=this._register(new wt(()=>this._onCut.fire(),0)),this._textAreaState=as.EMPTY,this._selectionChangeListener=null,this._accessibilityService.isScreenReaderOptimized()&&this.writeNativeTextAreaContent("ctor"),this._register(ie.runAndSubscribe(this._accessibilityService.onDidChangeScreenReaderOptimized,()=>{this._accessibilityService.isScreenReaderOptimized()&&!this._asyncFocusGainWriteScreenReaderContent.value?this._asyncFocusGainWriteScreenReaderContent.value=this._register(new wt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)):this._asyncFocusGainWriteScreenReaderContent.clear()})),this._hasFocus=!1,this._currentComposition=null;let a=null;this._register(this._textArea.onKeyDown(l=>{const c=new St(l);(c.keyCode===114||this._currentComposition&&c.keyCode===1)&&c.stopPropagation(),c.equals(9)&&c.preventDefault(),a=c,this._onKeyDown.fire(c)})),this._register(this._textArea.onKeyUp(l=>{const c=new St(l);this._onKeyUp.fire(c)})),this._register(this._textArea.onCompositionStart(l=>{const c=new _de;if(this._currentComposition){this._currentComposition=c;return}if(this._currentComposition=c,this._OS===2&&a&&a.equals(114)&&this._textAreaState.selectionStart===this._textAreaState.selectionEnd&&this._textAreaState.selectionStart>0&&this._textAreaState.value.substr(this._textAreaState.selectionStart-1,1)===l.data&&(a.code==="ArrowRight"||a.code==="ArrowLeft")){c.handleCompositionUpdate("x"),this._onCompositionStart.fire({data:l.data});return}if(this._browser.isAndroid){this._onCompositionStart.fire({data:l.data});return}this._onCompositionStart.fire({data:l.data})})),this._register(this._textArea.onCompositionUpdate(l=>{const c=this._currentComposition;if(!c)return;if(this._browser.isAndroid){const h=as.readFromTextArea(this._textArea,this._textAreaState),u=as.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(u),this._onCompositionUpdate.fire(l);return}const d=c.handleCompositionUpdate(l.data);this._textAreaState=as.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionUpdate.fire(l)})),this._register(this._textArea.onCompositionEnd(l=>{const c=this._currentComposition;if(!c)return;if(this._currentComposition=null,this._browser.isAndroid){const h=as.readFromTextArea(this._textArea,this._textAreaState),u=as.deduceAndroidCompositionInput(this._textAreaState,h);this._textAreaState=h,this._onType.fire(u),this._onCompositionEnd.fire();return}const d=c.handleCompositionUpdate(l.data);this._textAreaState=as.readFromTextArea(this._textArea,this._textAreaState),this._onType.fire(d),this._onCompositionEnd.fire()})),this._register(this._textArea.onInput(l=>{if(this._textArea.setIgnoreSelectionChangeTime("received input event"),this._currentComposition)return;const c=as.readFromTextArea(this._textArea,this._textAreaState),d=as.deduceInput(this._textAreaState,c,this._OS===2);d.replacePrevCharCnt===0&&d.text.length===1&&(zi(d.text.charCodeAt(0))||d.text.charCodeAt(0)===127)||(this._textAreaState=c,(d.text!==""||d.replacePrevCharCnt!==0||d.replaceNextCharCnt!==0||d.positionDelta!==0)&&(l.inputType==="insertFromPaste"?this._onPaste.fire({text:d.text,metadata:wl.INSTANCE.get(d.text)}):this._onType.fire(d)))})),this._register(this._textArea.onCut(l=>{this._logService.trace("TextAreaInput#onCut",l),this._textArea.setIgnoreSelectionChangeTime("received cut event"),this._ensureClipboardGetsEditorSelection(l),this._asyncTriggerCut.schedule()})),this._register(this._textArea.onCopy(l=>{this._logService.trace("TextAreaInput#onCopy",l),this._ensureClipboardGetsEditorSelection(l)})),this._register(this._textArea.onPaste(l=>{if(this._logService.trace("TextAreaInput#onPaste",l),this._textArea.setIgnoreSelectionChangeTime("received paste event"),l.preventDefault(),!l.clipboardData)return;let[c,d]=Af.getTextData(l.clipboardData);this._logService.trace("TextAreaInput#onPaste with id : ",d?.id," with text.length: ",c.length),c&&(d=d||wl.INSTANCE.get(c),this._logService.trace("TextAreaInput#onPaste (before onPaste)"),this._onPaste.fire({text:c,metadata:d}))})),this._register(this._textArea.onFocus(()=>{const l=this._hasFocus;this._setHasFocus(!0),this._accessibilityService.isScreenReaderOptimized()&&this._browser.isSafari&&!l&&this._hasFocus&&(this._asyncFocusGainWriteScreenReaderContent.value||(this._asyncFocusGainWriteScreenReaderContent.value=new wt(()=>this.writeNativeTextAreaContent("asyncFocusGain"),0)),this._asyncFocusGainWriteScreenReaderContent.value.schedule())})),this._register(this._textArea.onBlur(()=>{this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("blurWithoutCompositionEnd"),this._onCompositionEnd.fire()),this._setHasFocus(!1)})),this._register(this._textArea.onSyntheticTap(()=>{this._browser.isAndroid&&this._currentComposition&&(this._currentComposition=null,this.writeNativeTextAreaContent("tapWithoutCompositionEnd"),this._onCompositionEnd.fire())}))}_installSelectionChangeListener(){let e=0;return W(this._textArea.ownerDocument,"selectionchange",t=>{if(_h.onSelectionChange(),!this._hasFocus||this._currentComposition||!this._browser.isChrome)return;const i=Date.now(),n=i-e;if(e=i,n<5)return;const s=i-this._textArea.getIgnoreSelectionChangeTime();if(this._textArea.resetSelectionChangeTime(),s<100||!this._textAreaState.selection)return;const r=this._textArea.getValue();if(this._textAreaState.value!==r)return;const a=this._textArea.getSelectionStart(),l=this._textArea.getSelectionEnd();if(this._textAreaState.selectionStart===a&&this._textAreaState.selectionEnd===l)return;const c=this._textAreaState.deduceEditorPosition(a),d=this._host.deduceModelPosition(c[0],c[1],c[2]),h=this._textAreaState.deduceEditorPosition(l),u=this._host.deduceModelPosition(h[0],h[1],h[2]),f=new ce(d.lineNumber,d.column,u.lineNumber,u.column);this._onSelectionChangeRequest.fire(f)})}dispose(){super.dispose(),this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null)}focusTextArea(){this._setHasFocus(!0),this.refreshFocusState()}isFocused(){return this._hasFocus}refreshFocusState(){this._setHasFocus(this._textArea.hasFocus())}_setHasFocus(e){this._hasFocus!==e&&(this._hasFocus=e,this._selectionChangeListener&&(this._selectionChangeListener.dispose(),this._selectionChangeListener=null),this._hasFocus&&(this._selectionChangeListener=this._installSelectionChangeListener()),this._hasFocus&&this.writeNativeTextAreaContent("focusgain"),this._hasFocus?this._onFocus.fire():this._onBlur.fire())}_setAndWriteTextAreaState(e,t){this._hasFocus||(t=t.collapseSelection()),t.isWrittenToTextArea(this._textArea,this._hasFocus)||this._logService.trace(`writeTextAreaState(reason: ${e})`),t.writeToTextArea(e,this._textArea,this._hasFocus),this._textAreaState=t}writeNativeTextAreaContent(e){!this._accessibilityService.isScreenReaderOptimized()&&e==="render"||this._currentComposition||this._setAndWriteTextAreaState(e,this._host.getScreenReaderContent())}_ensureClipboardGetsEditorSelection(e){const t=this._host.getDataToCopy();let i;this._logService.getLevel()===Qi.Trace&&(i=Of());const n={version:1,id:i,isFromEmptySelection:t.isFromEmptySelection,multicursorText:t.multicursorText,mode:t.mode};wl.INSTANCE.set(this._browser.isFirefox?t.text.replace(/\r\n/g,`
`):t.text,n),e.preventDefault(),e.clipboardData&&Af.setTextData(e.clipboardData,t.text,t.html,n),this._logService.trace("TextAreaEditContextInput#_ensureClipboardGetsEditorSelection with id : ",i," with text.length: ",t.text.length)}};NM=mde([xz(4,bn),xz(5,Rt)],NM);class bde extends A{get ownerDocument(){return this._actual.ownerDocument}constructor(e){super(),this._actual=e,this._onSyntheticTap=this._register(new P),this.onSyntheticTap=this._onSyntheticTap.event,this._ignoreSelectionChangeTime=0,this.onKeyDown=this._register(new gt(this._actual,"keydown")).event,this.onKeyPress=this._register(new gt(this._actual,"keypress")).event,this.onKeyUp=this._register(new gt(this._actual,"keyup")).event,this.onCompositionStart=this._register(new gt(this._actual,"compositionstart")).event,this.onCompositionUpdate=this._register(new gt(this._actual,"compositionupdate")).event,this.onCompositionEnd=this._register(new gt(this._actual,"compositionend")).event,this.onBeforeInput=this._register(new gt(this._actual,"beforeinput")).event,this.onInput=this._register(new gt(this._actual,"input")).event,this.onCut=this._register(new gt(this._actual,"cut")).event,this.onCopy=this._register(new gt(this._actual,"copy")).event,this.onPaste=this._register(new gt(this._actual,"paste")).event,this.onFocus=this._register(new gt(this._actual,"focus")).event,this.onBlur=this._register(new gt(this._actual,"blur")).event,this._register(this.onKeyDown(()=>_h.onKeyDown())),this._register(this.onBeforeInput(()=>_h.onBeforeInput())),this._register(this.onInput(()=>_h.onInput())),this._register(this.onKeyUp(()=>_h.onKeyUp())),this._register(W(this._actual,zL.Tap,()=>this._onSyntheticTap.fire()))}hasFocus(){const e=ah(this._actual);return e?e.activeElement===this._actual:this._actual.isConnected?Ui()===this._actual:!1}setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}getIgnoreSelectionChangeTime(){return this._ignoreSelectionChangeTime}resetSelectionChangeTime(){this._ignoreSelectionChangeTime=0}getValue(){return this._actual.value}setValue(e,t){const i=this._actual;i.value!==t&&(this.setIgnoreSelectionChangeTime("setValue"),i.value=t)}getSelectionStart(){return this._actual.selectionDirection==="backward"?this._actual.selectionEnd:this._actual.selectionStart}getSelectionEnd(){return this._actual.selectionDirection==="backward"?this._actual.selectionStart:this._actual.selectionEnd}setSelectionRange(e,t,i){const n=this._actual;let s=null;const r=ah(n);r?s=r.activeElement:s=Ui();const a=me(s),l=s===n,c=n.selectionStart,d=n.selectionEnd;if(l&&c===t&&d===i){Fs&&a.parent!==a&&n.focus();return}if(l){this.setIgnoreSelectionChangeTime("setSelectionRange"),n.setSelectionRange(t,i),Fs&&a.parent!==a&&n.focus();return}try{const h=ose(n);this.setIgnoreSelectionChangeTime("setSelectionRange"),n.focus(),n.setSelectionRange(t,i),rse(n,h)}catch{}}}class Cde extends IM{constructor(e,t,i){super(e,t,i),this._register($n.addTarget(this.viewHelper.linesContentDomNode)),this._register(W(this.viewHelper.linesContentDomNode,Pt.Tap,s=>this.onTap(s))),this._register(W(this.viewHelper.linesContentDomNode,Pt.Change,s=>this.onChange(s))),this._register(W(this.viewHelper.linesContentDomNode,Pt.Contextmenu,s=>this._onContextMenu(new Hc(s,!1,this.viewHelper.viewDomNode),!1))),this._lastPointerType="mouse",this._register(W(this.viewHelper.linesContentDomNode,"pointerdown",s=>{const r=s.pointerType;if(r==="mouse"){this._lastPointerType="mouse";return}else r==="touch"?this._lastPointerType="touch":this._lastPointerType="pen"}));const n=new kce(this.viewHelper.viewDomNode);this._register(n.onPointerMove(this.viewHelper.viewDomNode,s=>this._onMouseMove(s))),this._register(n.onPointerUp(this.viewHelper.viewDomNode,s=>this._onMouseUp(s))),this._register(n.onPointerLeave(this.viewHelper.viewDomNode,s=>this._onMouseLeave(s))),this._register(n.onPointerDown(this.viewHelper.viewDomNode,(s,r)=>this._onMouseDown(s,r)))}onTap(e){!e.initialTarget||!this.viewHelper.linesContentDomNode.contains(e.initialTarget)||(e.preventDefault(),this.viewHelper.focusTextArea(),this._dispatchGesture(e,!1))}onChange(e){this._lastPointerType==="touch"&&this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY),this._lastPointerType==="pen"&&this._dispatchGesture(e,!0)}_dispatchGesture(e,t){const i=this._createMouseTarget(new Hc(e,!1,this.viewHelper.viewDomNode),!1);i.position&&this.viewController.dispatchMouse({position:i.position,mouseColumn:i.position.column,startedOnLineNumbers:!1,revealType:1,mouseDownCount:e.tapCount,inSelectionMode:t,altKey:!1,ctrlKey:!1,metaKey:!1,shiftKey:!1,leftButton:!1,middleButton:!1,onInjectedText:i.type===6&&i.detail.injectedText!==null})}_onMouseDown(e,t){e.browserEvent.pointerType!=="touch"&&super._onMouseDown(e,t)}}class vde extends IM{constructor(e,t,i){super(e,t,i),this._register($n.addTarget(this.viewHelper.linesContentDomNode)),this._register(W(this.viewHelper.linesContentDomNode,Pt.Tap,n=>this.onTap(n))),this._register(W(this.viewHelper.linesContentDomNode,Pt.Change,n=>this.onChange(n))),this._register(W(this.viewHelper.linesContentDomNode,Pt.Contextmenu,n=>this._onContextMenu(new Hc(n,!1,this.viewHelper.viewDomNode),!1)))}onTap(e){e.preventDefault(),this.viewHelper.focusTextArea();const t=this._createMouseTarget(new Hc(e,!1,this.viewHelper.viewDomNode),!1);if(t.position){const i=document.createEvent("CustomEvent");i.initEvent(zL.Tap,!1,!0),this.viewHelper.dispatchTextAreaEvent(i),this.viewController.moveTo(t.position,1)}}onChange(e){this._context.viewModel.viewLayout.deltaScrollNow(-e.translationX,-e.translationY)}}class wde extends A{constructor(e,t,i){super(),(ur||$te&&FB)&&t1.pointerEvents?this.handler=this._register(new Cde(e,t,i)):bt.TouchEvent?this.handler=this._register(new vde(e,t,i)):this.handler=this._register(new IM(e,t,i))}getTargetAtClientPoint(e,t){return this.handler.getTargetAtClientPoint(e,t)}}class Sde{constructor(e,t,i,n){this.configuration=e,this.viewModel=t,this.userInputEvents=i,this.commandDelegate=n}paste(e,t,i,n){this.commandDelegate.paste(e,t,i,n)}type(e){this.commandDelegate.type(e)}compositionType(e,t,i,n){this.commandDelegate.compositionType(e,t,i,n)}compositionStart(){this.commandDelegate.startComposition()}compositionEnd(){this.commandDelegate.endComposition()}cut(){this.commandDelegate.cut()}setSelection(e){cn.SetSelection.runCoreEditorCommand(this.viewModel,{source:"keyboard",selection:e})}_validateViewColumn(e){const t=this.viewModel.getLineMinColumn(e.lineNumber);return e.column<t?new M(e.lineNumber,t):e}_hasMulticursorModifier(e){switch(this.configuration.options.get(86)){case"altKey":return e.altKey;case"ctrlKey":return e.ctrlKey;case"metaKey":return e.metaKey;default:return!1}}_hasNonMulticursorModifier(e){switch(this.configuration.options.get(86)){case"altKey":return e.ctrlKey||e.metaKey;case"ctrlKey":return e.altKey||e.metaKey;case"metaKey":return e.ctrlKey||e.altKey;default:return!1}}dispatchMouse(e){const t=this.configuration.options,i=Ws&&t.get(121),n=t.get(28),s=t.get(171);e.middleButton&&!i?s||this._columnSelect(e.position,e.mouseColumn,e.inSelectionMode):e.startedOnLineNumbers?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelect(e.position,e.revealType):this._createCursor(e.position,!0):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType):e.mouseDownCount>=4?this._selectAll():e.mouseDownCount===3?this._hasMulticursorModifier(e)?e.inSelectionMode?this._lastCursorLineSelectDrag(e.position,e.revealType):this._lastCursorLineSelect(e.position,e.revealType):e.inSelectionMode?this._lineSelectDrag(e.position,e.revealType):this._lineSelect(e.position,e.revealType):e.mouseDownCount===2?e.onInjectedText||(this._hasMulticursorModifier(e)?this._lastCursorWordSelect(e.position,e.revealType):e.inSelectionMode?this._wordSelectDrag(e.position,e.revealType):this._wordSelect(e.position,e.revealType)):this._hasMulticursorModifier(e)?this._hasNonMulticursorModifier(e)||(e.shiftKey?this._columnSelect(e.position,e.mouseColumn,!0):e.inSelectionMode?this._lastCursorMoveToSelect(e.position,e.revealType):this._createCursor(e.position,!1)):e.inSelectionMode?e.altKey?this._columnSelect(e.position,e.mouseColumn,!0):n?this._columnSelect(e.position,e.mouseColumn,!0):this._moveToSelect(e.position,e.revealType):this.moveTo(e.position,e.revealType)}_usualArgs(e,t){return e=this._validateViewColumn(e),{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,revealType:t}}moveTo(e,t){cn.MoveTo.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_moveToSelect(e,t){cn.MoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_columnSelect(e,t,i){e=this._validateViewColumn(e),cn.ColumnSelect.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,mouseColumn:t,doColumnSelect:i})}_createCursor(e,t){e=this._validateViewColumn(e),cn.CreateCursor.runCoreEditorCommand(this.viewModel,{source:"mouse",position:this._convertViewToModelPosition(e),viewPosition:e,wholeLine:t})}_lastCursorMoveToSelect(e,t){cn.LastCursorMoveToSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelect(e,t){cn.WordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_wordSelectDrag(e,t){cn.WordSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorWordSelect(e,t){cn.LastCursorWordSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelect(e,t){cn.LineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lineSelectDrag(e,t){cn.LineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelect(e,t){cn.LastCursorLineSelect.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_lastCursorLineSelectDrag(e,t){cn.LastCursorLineSelectDrag.runCoreEditorCommand(this.viewModel,this._usualArgs(e,t))}_selectAll(){cn.SelectAll.runCoreEditorCommand(this.viewModel,{source:"mouse"})}_convertViewToModelPosition(e){return this.viewModel.coordinatesConverter.convertViewPositionToModelPosition(e)}emitKeyDown(e){this.userInputEvents.emitKeyDown(e)}emitKeyUp(e){this.userInputEvents.emitKeyUp(e)}emitContextMenu(e){this.userInputEvents.emitContextMenu(e)}emitMouseMove(e){this.userInputEvents.emitMouseMove(e)}emitMouseLeave(e){this.userInputEvents.emitMouseLeave(e)}emitMouseUp(e){this.userInputEvents.emitMouseUp(e)}emitMouseDown(e){this.userInputEvents.emitMouseDown(e)}emitMouseDrag(e){this.userInputEvents.emitMouseDrag(e)}emitMouseDrop(e){this.userInputEvents.emitMouseDrop(e)}emitMouseDropCanceled(){this.userInputEvents.emitMouseDropCanceled()}emitMouseWheel(e){this.userInputEvents.emitMouseWheel(e)}}function Sl(o,e){const t=globalThis.MonacoEnvironment;if(t?.createTrustedTypesPolicy)try{return t.createTrustedTypesPolicy(o,e)}catch(i){Ee(i);return}try{return globalThis.trustedTypes?.createPolicy(o,e)}catch(i){Ee(i);return}}class kz{constructor(e){this._lineFactory=e,this._set(1,[])}flush(){this._set(1,[])}_set(e,t){this._lines=t,this._rendLineNumberStart=e}_get(){return{rendLineNumberStart:this._rendLineNumberStart,lines:this._lines}}getStartLineNumber(){return this._rendLineNumberStart}getEndLineNumber(){return this._rendLineNumberStart+this._lines.length-1}getCount(){return this._lines.length}getLine(e){const t=e-this._rendLineNumberStart;if(t<0||t>=this._lines.length)throw new Ce("Illegal value for lineNumber");return this._lines[t]}onLinesDeleted(e,t){if(this.getCount()===0)return null;const i=this.getStartLineNumber(),n=this.getEndLineNumber();if(t<i){const l=t-e+1;return this._rendLineNumberStart-=l,null}if(e>n)return null;let s=0,r=0;for(let l=i;l<=n;l++){const c=l-this._rendLineNumberStart;e<=l&&l<=t&&(r===0?(s=c,r=1):r++)}if(e<i){let l=0;t<i?l=t-e+1:l=i-e,this._rendLineNumberStart-=l}return this._lines.splice(s,r)}onLinesChanged(e,t){const i=e+t-1;if(this.getCount()===0)return!1;const n=this.getStartLineNumber(),s=this.getEndLineNumber();let r=!1;for(let a=e;a<=i;a++)a>=n&&a<=s&&(this._lines[a-this._rendLineNumberStart].onContentChanged(),r=!0);return r}onLinesInserted(e,t){if(this.getCount()===0)return null;const i=t-e+1,n=this.getStartLineNumber(),s=this.getEndLineNumber();if(e<=n)return this._rendLineNumberStart+=i,null;if(e>s)return null;if(i+e>s)return this._lines.splice(e-this._rendLineNumberStart,s-e+1);const r=[];for(let h=0;h<i;h++)r[h]=this._lineFactory.createLine();const a=e-this._rendLineNumberStart,l=this._lines.slice(0,a),c=this._lines.slice(a,this._lines.length-i),d=this._lines.slice(this._lines.length-i,this._lines.length);return this._lines=l.concat(r).concat(c),d}onTokensChanged(e){if(this.getCount()===0)return!1;const t=this.getStartLineNumber(),i=this.getEndLineNumber();let n=!1;for(let s=0,r=e.length;s<r;s++){const a=e[s];if(a.toLineNumber<t||a.fromLineNumber>i)continue;const l=Math.max(t,a.fromLineNumber),c=Math.min(i,a.toLineNumber);for(let d=l;d<=c;d++){const h=d-this._rendLineNumberStart;this._lines[h].onTokensChanged(),n=!0}}return n}}class Iz{constructor(e,t){this._viewContext=e,this._lineFactory=t,this.domNode=this._createDomNode(),this._linesCollection=new kz(this._lineFactory)}_createDomNode(){const e=lt(document.createElement("div"));return e.setClassName("view-layer"),e.setPosition("absolute"),e.domNode.setAttribute("role","presentation"),e.domNode.setAttribute("aria-hidden","true"),e}onConfigurationChanged(e){return!!e.hasChanged(165)}onFlushed(e,t){if(t){const i=this._linesCollection.getStartLineNumber(),n=this._linesCollection.getEndLineNumber();for(let s=i;s<=n;s++)this._linesCollection.getLine(s).getDomNode()?.remove()}return this._linesCollection.flush(),!0}onLinesChanged(e){return this._linesCollection.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){const t=this._linesCollection.onLinesDeleted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++)t[i].getDomNode()?.remove();return!0}onLinesInserted(e){const t=this._linesCollection.onLinesInserted(e.fromLineNumber,e.toLineNumber);if(t)for(let i=0,n=t.length;i<n;i++)t[i].getDomNode()?.remove();return!0}onScrollChanged(e){return e.scrollTopChanged}onTokensChanged(e){return this._linesCollection.onTokensChanged(e.ranges)}onZonesChanged(e){return!0}getStartLineNumber(){return this._linesCollection.getStartLineNumber()}getEndLineNumber(){return this._linesCollection.getEndLineNumber()}getVisibleLine(e){return this._linesCollection.getLine(e)}renderLines(e){const t=this._linesCollection._get(),i=new TM(this.domNode.domNode,this._lineFactory,e,this._viewContext),n={rendLineNumberStart:t.rendLineNumberStart,lines:t.lines,linesLength:t.lines.length},s=i.render(n,e.startLineNumber,e.endLineNumber,e.relativeVerticalOffset);this._linesCollection._set(s.rendLineNumberStart,s.lines)}}const Vd=class Vd{constructor(e,t,i,n){this._domNode=e,this._lineFactory=t,this._viewportData=i,this._viewContext=n}render(e,t,i,n){const s={rendLineNumberStart:e.rendLineNumberStart,lines:e.lines.slice(0),linesLength:e.linesLength};if(s.rendLineNumberStart+s.linesLength-1<t||i<s.rendLineNumberStart){s.rendLineNumberStart=t,s.linesLength=i-t+1,s.lines=[];for(let r=t;r<=i;r++)s.lines[r-t]=this._lineFactory.createLine();return this._finishRendering(s,!0,n),s}if(this._renderUntouchedLines(s,Math.max(t-s.rendLineNumberStart,0),Math.min(i-s.rendLineNumberStart,s.linesLength-1),n,t),s.rendLineNumberStart>t){const r=t,a=Math.min(i,s.rendLineNumberStart-1);r<=a&&(this._insertLinesBefore(s,r,a,n,t),s.linesLength+=a-r+1)}else if(s.rendLineNumberStart<t){const r=Math.min(s.linesLength,t-s.rendLineNumberStart);r>0&&(this._removeLinesBefore(s,r),s.linesLength-=r)}if(s.rendLineNumberStart=t,s.rendLineNumberStart+s.linesLength-1<i){const r=s.rendLineNumberStart+s.linesLength,a=i;r<=a&&(this._insertLinesAfter(s,r,a,n,t),s.linesLength+=a-r+1)}else if(s.rendLineNumberStart+s.linesLength-1>i){const r=Math.max(0,i-s.rendLineNumberStart+1),l=s.linesLength-1-r+1;l>0&&(this._removeLinesAfter(s,l),s.linesLength-=l)}return this._finishRendering(s,!1,n),s}_renderUntouchedLines(e,t,i,n,s){const r=e.rendLineNumberStart,a=e.lines;for(let l=t;l<=i;l++){const c=r+l;a[l].layoutLine(c,n[c-s],this._lineHeightForLineNumber(c))}}_insertLinesBefore(e,t,i,n,s){const r=[];let a=0;for(let l=t;l<=i;l++)r[a++]=this._lineFactory.createLine();e.lines=r.concat(e.lines)}_removeLinesBefore(e,t){for(let i=0;i<t;i++)e.lines[i].getDomNode()?.remove();e.lines.splice(0,t)}_insertLinesAfter(e,t,i,n,s){const r=[];let a=0;for(let l=t;l<=i;l++)r[a++]=this._lineFactory.createLine();e.lines=e.lines.concat(r)}_removeLinesAfter(e,t){const i=e.linesLength-t;for(let n=0;n<t;n++)e.lines[i+n].getDomNode()?.remove();e.lines.splice(i,t)}_finishRenderingNewLines(e,t,i,n){Vd._ttPolicy&&(i=Vd._ttPolicy.createHTML(i));const s=this._domNode.lastChild;t||!s?this._domNode.innerHTML=i:s.insertAdjacentHTML("afterend",i);let r=this._domNode.lastChild;for(let a=e.linesLength-1;a>=0;a--){const l=e.lines[a];n[a]&&(l.setDomNode(r),r=r.previousSibling)}}_finishRenderingInvalidLines(e,t,i){const n=document.createElement("div");Vd._ttPolicy&&(t=Vd._ttPolicy.createHTML(t)),n.innerHTML=t;for(let s=0;s<e.linesLength;s++){const r=e.lines[s];if(i[s]){const a=n.firstChild,l=r.getDomNode();l.parentNode.replaceChild(a,l),r.setDomNode(a)}}}_finishRendering(e,t,i){const n=Vd._sb,s=e.linesLength,r=e.lines,a=e.rendLineNumberStart,l=[];{n.reset();let c=!1;for(let d=0;d<s;d++){const h=r[d];if(l[d]=!1,h.getDomNode())continue;const f=d+a;h.renderLine(f,i[d],this._lineHeightForLineNumber(f),this._viewportData,n)&&(l[d]=!0,c=!0)}c&&this._finishRenderingNewLines(e,t,n.build(),l)}{n.reset();let c=!1;const d=[];for(let h=0;h<s;h++){const u=r[h];if(d[h]=!1,l[h])continue;const f=h+a;u.renderLine(f,i[h],this._lineHeightForLineNumber(f),this._viewportData,n)&&(d[h]=!0,c=!0)}c&&this._finishRenderingInvalidLines(e,n.build(),d)}}_lineHeightForLineNumber(e){return this._viewContext.viewLayout.getLineHeightForLineNumber(e)}};Vd._ttPolicy=Sl("editorViewLayer",{createHTML:e=>e}),Vd._sb=new uh(1e5);let TM=Vd;class Dz extends vs{constructor(e){super(e),this._dynamicOverlays=[],this._isFocused=!1,this._visibleLines=new Iz(this._context,{createLine:()=>new yde(this._dynamicOverlays)}),this.domNode=this._visibleLines.domNode;const i=this._context.configuration.options.get(59);dn(this.domNode,i),this.domNode.setClassName("view-overlays")}shouldRender(){if(super.shouldRender())return!0;for(let e=0,t=this._dynamicOverlays.length;e<t;e++)if(this._dynamicOverlays[e].shouldRender())return!0;return!1}dispose(){super.dispose();for(let e=0,t=this._dynamicOverlays.length;e<t;e++)this._dynamicOverlays[e].dispose();this._dynamicOverlays=[]}getDomNode(){return this.domNode}addDynamicOverlay(e){this._dynamicOverlays.push(e)}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e);const i=this._context.configuration.options.get(59);return dn(this.domNode,i),!0}onFlushed(e){return this._visibleLines.onFlushed(e)}onFocusChanged(e){return this._isFocused=e.isFocused,!0}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onScrollChanged(e){return this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._visibleLines.onZonesChanged(e)}prepareRender(e){const t=this._dynamicOverlays.filter(i=>i.shouldRender());for(let i=0,n=t.length;i<n;i++){const s=t[i];s.prepareRender(e),s.onDidRender()}}render(e){this._viewOverlaysRender(e),this.domNode.toggleClassName("focused",this._isFocused)}_viewOverlaysRender(e){this._visibleLines.renderLines(e.viewportData)}}class yde{constructor(e){this._dynamicOverlays=e,this._domNode=null,this._renderedContent=null}getDomNode(){return this._domNode?this._domNode.domNode:null}setDomNode(e){this._domNode=lt(e)}onContentChanged(){}onTokensChanged(){}renderLine(e,t,i,n,s){let r="";for(let a=0,l=this._dynamicOverlays.length;a<l;a++){const c=this._dynamicOverlays[a];r+=c.render(n.startLineNumber,e)}return this._renderedContent===r?!1:(this._renderedContent=r,s.appendString('<div style="top:'),s.appendString(String(t)),s.appendString("px;height:"),s.appendString(String(i)),s.appendString("px;line-height:"),s.appendString(String(i)),s.appendString('px;">'),s.appendString(r),s.appendString("</div>"),!0)}layoutLine(e,t,i){this._domNode&&(this._domNode.setTop(t),this._domNode.setHeight(i),this._domNode.setLineHeight(i))}}class Lde extends Dz{constructor(e){super(e);const i=this._context.configuration.options.get(165);this._contentWidth=i.contentWidth,this.domNode.setHeight(0)}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._contentWidth=i.contentWidth,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollWidthChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e),this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth))}}class xde extends Dz{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._contentLeft=i.contentLeft,this.domNode.setClassName("margin-view-overlays"),this.domNode.setWidth(1),dn(this.domNode,t.get(59))}onConfigurationChanged(e){const t=this._context.configuration.options;dn(this.domNode,t.get(59));const i=t.get(165);return this._contentLeft=i.contentLeft,super.onConfigurationChanged(e)||!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollHeightChanged}_viewOverlaysRender(e){super._viewOverlaysRender(e);const t=Math.min(e.scrollHeight,1e6);this.domNode.setHeight(t),this.domNode.setWidth(this._contentLeft)}}class UL{constructor(e){this.onKeyDown=null,this.onKeyUp=null,this.onContextMenu=null,this.onMouseMove=null,this.onMouseLeave=null,this.onMouseDown=null,this.onMouseUp=null,this.onMouseDrag=null,this.onMouseDrop=null,this.onMouseDropCanceled=null,this.onMouseWheel=null,this._coordinatesConverter=e}emitKeyDown(e){this.onKeyDown?.(e)}emitKeyUp(e){this.onKeyUp?.(e)}emitContextMenu(e){this.onContextMenu?.(this._convertViewToModelMouseEvent(e))}emitMouseMove(e){this.onMouseMove?.(this._convertViewToModelMouseEvent(e))}emitMouseLeave(e){this.onMouseLeave?.(this._convertViewToModelMouseEvent(e))}emitMouseDown(e){this.onMouseDown?.(this._convertViewToModelMouseEvent(e))}emitMouseUp(e){this.onMouseUp?.(this._convertViewToModelMouseEvent(e))}emitMouseDrag(e){this.onMouseDrag?.(this._convertViewToModelMouseEvent(e))}emitMouseDrop(e){this.onMouseDrop?.(this._convertViewToModelMouseEvent(e))}emitMouseDropCanceled(){this.onMouseDropCanceled?.()}emitMouseWheel(e){this.onMouseWheel?.(e)}_convertViewToModelMouseEvent(e){return e.target?{event:e.event,target:this._convertViewToModelMouseTarget(e.target)}:e}_convertViewToModelMouseTarget(e){return UL.convertViewToModelMouseTarget(e,this._coordinatesConverter)}static convertViewToModelMouseTarget(e,t){const i={...e};return i.position&&(i.position=t.convertViewPositionToModelPosition(i.position)),i.range&&(i.range=t.convertViewRangeToModelRange(i.range)),(i.type===5||i.type===8)&&(i.detail=this.convertViewToModelViewZoneData(i.detail,t)),i}static convertViewToModelViewZoneData(e,t){return{viewZoneId:e.viewZoneId,positionBefore:e.positionBefore?t.convertViewPositionToModelPosition(e.positionBefore):e.positionBefore,positionAfter:e.positionAfter?t.convertViewPositionToModelPosition(e.positionAfter):e.positionAfter,position:t.convertViewPositionToModelPosition(e.position),afterLineNumber:t.convertViewPositionToModelPosition(new M(e.afterLineNumber,1)).lineNumber}}}class kde extends vs{constructor(e){super(e),this.blocks=[],this.contentWidth=-1,this.contentLeft=0,this.domNode=lt(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("blockDecorations-container"),this.update()}update(){let e=!1;const i=this._context.configuration.options.get(165),n=i.contentWidth-i.verticalScrollbarWidth;this.contentWidth!==n&&(this.contentWidth=n,e=!0);const s=i.contentLeft;return this.contentLeft!==s&&(this.contentLeft=s,e=!0),e}dispose(){super.dispose()}onConfigurationChanged(e){return this.update()}onScrollChanged(e){return e.scrollTopChanged||e.scrollLeftChanged}onDecorationsChanged(e){return!0}onZonesChanged(e){return!0}prepareRender(e){}render(e){let t=0;const i=e.getDecorationsInViewport();for(const n of i){if(!n.options.blockClassName)continue;let s=this.blocks[t];s||(s=this.blocks[t]=lt(document.createElement("div")),this.domNode.appendChild(s));let r,a;n.options.blockIsAfterEnd?(r=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!1),a=e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0)):(r=e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!0),a=n.range.isEmpty()&&!n.options.blockDoesNotCollapse?e.getVerticalOffsetForLineNumber(n.range.startLineNumber,!1):e.getVerticalOffsetAfterLineNumber(n.range.endLineNumber,!0));const[l,c,d,h]=n.options.blockPadding??[0,0,0,0];s.setClassName("blockDecorations-block "+n.options.blockClassName),s.setLeft(this.contentLeft-h),s.setWidth(this.contentWidth+h+c),s.setTop(r-e.scrollTop-l),s.setHeight(a-r+l+d),t++}for(let n=t;n<this.blocks.length;n++)this.blocks[n].domNode.remove();this.blocks.length=t}}class Ide extends vs{constructor(e,t){super(e),this._viewDomNode=t,this._widgets={},this.domNode=lt(document.createElement("div")),Na.write(this.domNode,1),this.domNode.setClassName("contentWidgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this.overflowingContentWidgetsDomNode=lt(document.createElement("div")),Na.write(this.overflowingContentWidgetsDomNode,2),this.overflowingContentWidgetsDomNode.setClassName("overflowingContentWidgets")}dispose(){super.dispose(),this._widgets={}}onConfigurationChanged(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onConfigurationChanged(e);return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLineMappingChanged(e){return this._updateAnchorsViewPositions(),!0}onLinesChanged(e){return this._updateAnchorsViewPositions(),!0}onLinesDeleted(e){return this._updateAnchorsViewPositions(),!0}onLinesInserted(e){return this._updateAnchorsViewPositions(),!0}onScrollChanged(e){return!0}onZonesChanged(e){return!0}_updateAnchorsViewPositions(){const e=Object.keys(this._widgets);for(const t of e)this._widgets[t].updateAnchorViewPosition()}addWidget(e){const t=new Dde(this._context,this._viewDomNode,e);this._widgets[t.id]=t,t.allowEditorOverflow?this.overflowingContentWidgetsDomNode.appendChild(t.domNode):this.domNode.appendChild(t.domNode),this.setShouldRender()}setWidgetPosition(e,t,i,n,s){this._widgets[e.getId()].setPosition(t,i,n,s),this.setShouldRender()}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const i=this._widgets[t];delete this._widgets[t];const n=i.domNode.domNode;n.remove(),n.removeAttribute("monaco-visible-content-widget"),this.setShouldRender()}}shouldSuppressMouseDownOnWidget(e){return this._widgets.hasOwnProperty(e)?this._widgets[e].suppressMouseDown:!1}onBeforeRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].onBeforeRender(e)}prepareRender(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].prepareRender(e)}render(e){const t=Object.keys(this._widgets);for(const i of t)this._widgets[i].render(e)}}class Dde{constructor(e,t,i){this._primaryAnchor=new J1(null,null),this._secondaryAnchor=new J1(null,null),this._context=e,this._viewDomNode=t,this._actual=i;const n=this._context.configuration.options,s=n.get(165),r=n.get(4);this.domNode=lt(this._actual.getDomNode()),this.id=this._actual.getId(),this.allowEditorOverflow=(this._actual.allowEditorOverflow||!1)&&r,this.suppressMouseDown=this._actual.suppressMouseDown||!1,this._fixedOverflowWidgets=n.get(51),this._contentWidth=s.contentWidth,this._contentLeft=s.contentLeft,this._affinity=null,this._preference=[],this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1,this._maxWidth=this._getMaxWidth(),this._isVisible=!1,this._renderData=null,this.domNode.setPosition(this._fixedOverflowWidgets&&this.allowEditorOverflow?"fixed":"absolute"),this.domNode.setDisplay("none"),this.domNode.setVisibility("hidden"),this.domNode.setAttribute("widgetId",this.id),this.domNode.setMaxWidth(this._maxWidth)}onConfigurationChanged(e){const t=this._context.configuration.options;if(e.hasChanged(165)){const i=t.get(165);this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._maxWidth=this._getMaxWidth()}}updateAnchorViewPosition(){this._setPosition(this._affinity,this._primaryAnchor.modelPosition,this._secondaryAnchor.modelPosition)}_setPosition(e,t,i){this._affinity=e,this._primaryAnchor=n(t,this._context.viewModel,this._affinity),this._secondaryAnchor=n(i,this._context.viewModel,this._affinity);function n(s,r,a){if(!s)return new J1(null,null);const l=r.model.validatePosition(s);if(r.coordinatesConverter.modelPositionIsVisible(l)){const c=r.coordinatesConverter.convertModelPositionToViewPosition(l,a??void 0);return new J1(s,c)}return new J1(s,null)}}_getMaxWidth(){const e=this.domNode.domNode.ownerDocument,t=e.defaultView;return this.allowEditorOverflow?t?.innerWidth||e.documentElement.offsetWidth||e.body.offsetWidth:this._contentWidth}setPosition(e,t,i,n){this._setPosition(n,e,t),this._preference=i,this._primaryAnchor.viewPosition&&this._preference&&this._preference.length>0?this.domNode.setDisplay("block"):this.domNode.setDisplay("none"),this._cachedDomNodeOffsetWidth=-1,this._cachedDomNodeOffsetHeight=-1}_layoutBoxInViewport(e,t,i,n){const s=e.top,r=s,a=e.top+e.height,l=n.viewportHeight-a,c=s-i,d=r>=i,h=a,u=l>=i;let f=e.left;return f+t>n.scrollLeft+n.viewportWidth&&(f=n.scrollLeft+n.viewportWidth-t),f<n.scrollLeft&&(f=n.scrollLeft),{fitsAbove:d,aboveTop:c,fitsBelow:u,belowTop:h,left:f}}_layoutHorizontalSegmentInPage(e,t,i,n){const a=Math.max(15,t.left-n),l=Math.min(t.left+t.width+n,e.width-15),d=this._viewDomNode.domNode.ownerDocument.defaultView;let h=t.left+i-(d?.scrollX??0);if(h+n>l){const u=h-(l-n);h-=u,i-=u}if(h<a){const u=h-a;h-=u,i-=u}return[i,h]}_layoutBoxInPage(e,t,i,n){const s=e.top-i,r=e.top+e.height,a=mi(this._viewDomNode.domNode),l=this._viewDomNode.domNode.ownerDocument,c=l.defaultView,d=a.top+s-(c?.scrollY??0),h=a.top+r-(c?.scrollY??0),u=rh(l.body),[f,g]=this._layoutHorizontalSegmentInPage(u,a,e.left-n.scrollLeft+this._contentLeft,t),m=22,_=22,b=d>=m,C=h+i<=u.height-_;return this._fixedOverflowWidgets?{fitsAbove:b,aboveTop:Math.max(d,m),fitsBelow:C,belowTop:h,left:g}:{fitsAbove:b,aboveTop:s,fitsBelow:C,belowTop:r,left:f}}_prepareRenderWidgetAtExactPositionOverflowing(e){return new ev(e.top,e.left+this._contentLeft)}_getAnchorsCoordinates(e){const t=s(this._primaryAnchor.viewPosition,this._affinity),i=this._secondaryAnchor.viewPosition?.lineNumber===this._primaryAnchor.viewPosition?.lineNumber?this._secondaryAnchor.viewPosition:null,n=s(i,this._affinity);return{primary:t,secondary:n};function s(r,a){if(!r)return null;const l=e.visibleRangeForPosition(r);if(!l)return null;const c=r.column===1&&a===3?0:l.left,d=e.getVerticalOffsetForLineNumber(r.lineNumber)-e.scrollTop,h=e.getLineHeightForLineNumber(r.lineNumber);return new Ez(d,c,h)}}_reduceAnchorCoordinates(e,t,i){if(!t)return e;const n=this._context.configuration.options.get(59);let s=t.left;return s<e.left?s=Math.max(s,e.left-i+n.typicalFullwidthCharacterWidth):s=Math.min(s,e.left+i-n.typicalFullwidthCharacterWidth),new Ez(e.top,s,e.height)}_prepareRenderWidget(e){if(!this._preference||this._preference.length===0)return null;const{primary:t,secondary:i}=this._getAnchorsCoordinates(e);if(!t)return{kind:"offViewport",preserveFocus:this.domNode.domNode.contains(this.domNode.domNode.ownerDocument.activeElement)};if(this._cachedDomNodeOffsetWidth===-1||this._cachedDomNodeOffsetHeight===-1){let r=null;if(typeof this._actual.beforeRender=="function"&&(r=RM(this._actual.beforeRender,this._actual)),r)this._cachedDomNodeOffsetWidth=r.width,this._cachedDomNodeOffsetHeight=r.height;else{const l=this.domNode.domNode.getBoundingClientRect();this._cachedDomNodeOffsetWidth=Math.round(l.width),this._cachedDomNodeOffsetHeight=Math.round(l.height)}}const n=this._reduceAnchorCoordinates(t,i,this._cachedDomNodeOffsetWidth);let s;this.allowEditorOverflow?s=this._layoutBoxInPage(n,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e):s=this._layoutBoxInViewport(n,this._cachedDomNodeOffsetWidth,this._cachedDomNodeOffsetHeight,e);for(let r=1;r<=2;r++)for(const a of this._preference)if(a===1){if(!s)return null;if(r===2||s.fitsAbove)return{kind:"inViewport",coordinate:new ev(s.aboveTop,s.left),position:1}}else if(a===2){if(!s)return null;if(r===2||s.fitsBelow)return{kind:"inViewport",coordinate:new ev(s.belowTop,s.left),position:2}}else return this.allowEditorOverflow?{kind:"inViewport",coordinate:this._prepareRenderWidgetAtExactPositionOverflowing(new ev(n.top,n.left)),position:0}:{kind:"inViewport",coordinate:new ev(n.top,n.left),position:0};return null}onBeforeRender(e){!this._primaryAnchor.viewPosition||!this._preference||this._primaryAnchor.viewPosition.lineNumber<e.startLineNumber||this._primaryAnchor.viewPosition.lineNumber>e.endLineNumber||this.domNode.setMaxWidth(this._maxWidth)}prepareRender(e){this._renderData=this._prepareRenderWidget(e)}render(e){if(!this._renderData||this._renderData.kind==="offViewport"){this._isVisible&&(this.domNode.removeAttribute("monaco-visible-content-widget"),this._isVisible=!1,this._renderData?.kind==="offViewport"&&this._renderData.preserveFocus?this.domNode.setTop(-1e3):this.domNode.setVisibility("hidden")),typeof this._actual.afterRender=="function"&&RM(this._actual.afterRender,this._actual,null,null);return}this.allowEditorOverflow?(this.domNode.setTop(this._renderData.coordinate.top),this.domNode.setLeft(this._renderData.coordinate.left)):(this.domNode.setTop(this._renderData.coordinate.top+e.scrollTop-e.bigNumbersDelta),this.domNode.setLeft(this._renderData.coordinate.left)),this._isVisible||(this.domNode.setVisibility("inherit"),this.domNode.setAttribute("monaco-visible-content-widget","true"),this._isVisible=!0),typeof this._actual.afterRender=="function"&&RM(this._actual.afterRender,this._actual,this._renderData.position,this._renderData.coordinate)}}class J1{constructor(e,t){this.modelPosition=e,this.viewPosition=t}}class ev{constructor(e,t){this.top=e,this.left=t,this._coordinateBrand=void 0}}class Ez{constructor(e,t,i){this.top=e,this.left=t,this.height=i,this._anchorCoordinateBrand=void 0}}function RM(o,e,...t){try{return o.call(e,...t)}catch{return null}}class Lh extends Tf{}const li=We("themeService");function ci(o){return{id:o}}function MM(o){switch(o){case Er.DARK:return u_.VS_DARK;case Er.HIGH_CONTRAST_DARK:return u_.HC_BLACK;case Er.HIGH_CONTRAST_LIGHT:return u_.HC_LIGHT;default:return u_.VS}}const Nz={ThemingContribution:"base.contributions.theming"};class Ede extends A{constructor(){super(),this.themingParticipants=[],this.themingParticipants=[],this.onThemingParticipantAddedEmitter=this._register(new P)}onColorThemeChange(e){return this.themingParticipants.push(e),this.onThemingParticipantAddedEmitter.fire(e),ue(()=>{const t=this.themingParticipants.indexOf(e);this.themingParticipants.splice(t,1)})}getThemingParticipants(){return this.themingParticipants}}const Tz=new Ede;ei.add(Nz.ThemingContribution,Tz);function Nr(o){return Tz.onColorThemeChange(o)}class Nde extends A{constructor(e){super(),this.themeService=e,this.theme=e.getColorTheme(),this._register(this.themeService.onDidColorThemeChange(t=>this.onThemeChange(t)))}onThemeChange(e){this.theme=e,this.updateStyles()}updateStyles(){}}const Rz=N("editor.lineHighlightBackground",null,p(607,"Background color for the highlight of line at the cursor position.")),Mz=N("editor.lineHighlightBorder",{dark:"#282828",light:"#eeeeee",hcDark:"#f38518",hcLight:Ze},p(608,"Background color for the border around the line at the cursor position."));N("editor.rangeHighlightBackground",{dark:"#ffffff0b",light:"#fdff0033",hcDark:null,hcLight:null},p(609,"Background color of highlighted ranges, like by quick open and find features. The color must not be opaque so as not to hide underlying decorations."),!0),N("editor.rangeHighlightBorder",{dark:null,light:null,hcDark:jt,hcLight:jt},p(610,"Background color of the border around highlighted ranges.")),N("editor.symbolHighlightBackground",{dark:Bc,light:Bc,hcDark:null,hcLight:null},p(611,"Background color of highlighted symbol, like for go to definition or go next/previous symbol. The color must not be opaque so as not to hide underlying decorations."),!0),N("editor.symbolHighlightBorder",{dark:null,light:null,hcDark:jt,hcLight:jt},p(612,"Background color of the border around highlighted symbols."));const $L=N("editorCursor.foreground",{dark:"#AEAFAD",light:$.black,hcDark:$.white,hcLight:"#0F4A85"},p(613,"Color of the editor cursor.")),PM=N("editorCursor.background",null,p(614,"The background color of the editor cursor. Allows customizing the color of a character overlapped by a block cursor.")),Pz=N("editorMultiCursor.primary.foreground",$L,p(615,"Color of the primary editor cursor when multiple cursors are present.")),Tde=N("editorMultiCursor.primary.background",PM,p(616,"The background color of the primary editor cursor when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),Az=N("editorMultiCursor.secondary.foreground",$L,p(617,"Color of secondary editor cursors when multiple cursors are present.")),Rde=N("editorMultiCursor.secondary.background",PM,p(618,"The background color of secondary editor cursors when multiple cursors are present. Allows customizing the color of a character overlapped by a block cursor.")),AM=N("editorWhitespace.foreground",{dark:"#e3e4e229",light:"#33333333",hcDark:"#e3e4e229",hcLight:"#CCCCCC"},p(619,"Color of whitespace characters in the editor.")),Mde=N("editorLineNumber.foreground",{dark:"#858585",light:"#237893",hcDark:$.white,hcLight:"#292929"},p(620,"Color of editor line numbers.")),Pde=N("editorIndentGuide.background",AM,p(621,"Color of the editor indentation guides."),!1,p(622,"'editorIndentGuide.background' is deprecated. Use 'editorIndentGuide.background1' instead.")),Ade=N("editorIndentGuide.activeBackground",AM,p(623,"Color of the active editor indentation guides."),!1,p(624,"'editorIndentGuide.activeBackground' is deprecated. Use 'editorIndentGuide.activeBackground1' instead.")),tv=N("editorIndentGuide.background1",Pde,p(625,"Color of the editor indentation guides (1).")),Ode=N("editorIndentGuide.background2","#00000000",p(626,"Color of the editor indentation guides (2).")),Fde=N("editorIndentGuide.background3","#00000000",p(627,"Color of the editor indentation guides (3).")),Wde=N("editorIndentGuide.background4","#00000000",p(628,"Color of the editor indentation guides (4).")),Bde=N("editorIndentGuide.background5","#00000000",p(629,"Color of the editor indentation guides (5).")),Hde=N("editorIndentGuide.background6","#00000000",p(630,"Color of the editor indentation guides (6).")),iv=N("editorIndentGuide.activeBackground1",Ade,p(631,"Color of the active editor indentation guides (1).")),Vde=N("editorIndentGuide.activeBackground2","#00000000",p(632,"Color of the active editor indentation guides (2).")),zde=N("editorIndentGuide.activeBackground3","#00000000",p(633,"Color of the active editor indentation guides (3).")),Ude=N("editorIndentGuide.activeBackground4","#00000000",p(634,"Color of the active editor indentation guides (4).")),$de=N("editorIndentGuide.activeBackground5","#00000000",p(635,"Color of the active editor indentation guides (5).")),jde=N("editorIndentGuide.activeBackground6","#00000000",p(636,"Color of the active editor indentation guides (6).")),qde=N("editorActiveLineNumber.foreground",{dark:"#c6c6c6",light:"#0B216F",hcDark:jt,hcLight:jt},p(637,"Color of editor active line number"),!1,p(638,"Id is deprecated. Use 'editorLineNumber.activeForeground' instead."));N("editorLineNumber.activeForeground",qde,p(639,"Color of editor active line number"));const Kde=N("editorLineNumber.dimmedForeground",null,p(640,"Color of the final editor line when editor.renderFinalNewline is set to dimmed.")),Gde=N("editorRuler.foreground",{dark:"#5A5A5A",light:$.lightgrey,hcDark:$.white,hcLight:"#292929"},p(641,"Color of the editor rulers."));N("editorCodeLens.foreground",{dark:"#999999",light:"#919191",hcDark:"#999999",hcLight:"#292929"},p(642,"Foreground color of editor CodeLens")),N("editorBracketMatch.background",{dark:"#0064001a",light:"#0064001a",hcDark:"#0064001a",hcLight:"#0000"},p(643,"Background color behind matching brackets")),N("editorBracketMatch.border",{dark:"#888",light:"#B9B9B9",hcDark:Ze,hcLight:Ze},p(644,"Color for matching brackets boxes"));const Zde=N("editorOverviewRuler.border",{dark:"#7f7f7f4d",light:"#7f7f7f4d",hcDark:"#7f7f7f4d",hcLight:"#666666"},p(645,"Color of the overview ruler border.")),Yde=N("editorOverviewRuler.background",null,p(646,"Background color of the editor overview ruler."));N("editorGutter.background",xi,p(647,"Background color of the editor gutter. The gutter contains the glyph margins and the line numbers.")),N("editorUnnecessaryCode.border",{dark:null,light:null,hcDark:$.fromHex("#fff").transparent(.8),hcLight:Ze},p(648,"Border color of unnecessary (unused) source code in the editor."));const Xde=N("editorUnnecessaryCode.opacity",{dark:$.fromHex("#000a"),light:$.fromHex("#0007"),hcDark:null,hcLight:null},p(649,`Opacity of unnecessary (unused) source code in the editor. For example, "#000000c0" will render the code with 75% opacity. For high contrast themes, use the 'editorUnnecessaryCode.border' theme color to underline unnecessary code instead of fading it out.`));N("editorGhostText.border",{dark:null,light:null,hcDark:$.fromHex("#fff").transparent(.8),hcLight:$.fromHex("#292929").transparent(.8)},p(650,"Border color of ghost text in the editor."));const Qde=N("editorGhostText.foreground",{dark:$.fromHex("#ffffff56"),light:$.fromHex("#0007"),hcDark:null,hcLight:null},p(651,"Foreground color of the ghost text in the editor."));N("editorGhostText.background",null,p(652,"Background color of the ghost text in the editor."));const Jde=new $(new q(0,122,204,.6)),Oz=N("editorOverviewRuler.rangeHighlightForeground",Jde,p(653,"Overview ruler marker color for range highlights. The color must not be opaque so as not to hide underlying decorations."),!0),ehe=N("editorOverviewRuler.errorForeground",{dark:new $(new q(255,18,18,.7)),light:new $(new q(255,18,18,.7)),hcDark:new $(new q(255,50,50,1)),hcLight:"#B5200D"},p(654,"Overview ruler marker color for errors.")),the=N("editorOverviewRuler.warningForeground",{dark:Wc,light:Wc,hcDark:V1,hcLight:V1},p(655,"Overview ruler marker color for warnings.")),ihe=N("editorOverviewRuler.infoForeground",{dark:Cl,light:Cl,hcDark:z1,hcLight:z1},p(656,"Overview ruler marker color for infos.")),Fz=N("editorBracketHighlight.foreground1",{dark:"#FFD700",light:"#0431FAFF",hcDark:"#FFD700",hcLight:"#0431FAFF"},p(657,"Foreground color of brackets (1). Requires enabling bracket pair colorization.")),Wz=N("editorBracketHighlight.foreground2",{dark:"#DA70D6",light:"#319331FF",hcDark:"#DA70D6",hcLight:"#319331FF"},p(658,"Foreground color of brackets (2). Requires enabling bracket pair colorization.")),Bz=N("editorBracketHighlight.foreground3",{dark:"#179FFF",light:"#7B3814FF",hcDark:"#87CEFA",hcLight:"#7B3814FF"},p(659,"Foreground color of brackets (3). Requires enabling bracket pair colorization.")),Hz=N("editorBracketHighlight.foreground4","#00000000",p(660,"Foreground color of brackets (4). Requires enabling bracket pair colorization.")),Vz=N("editorBracketHighlight.foreground5","#00000000",p(661,"Foreground color of brackets (5). Requires enabling bracket pair colorization.")),zz=N("editorBracketHighlight.foreground6","#00000000",p(662,"Foreground color of brackets (6). Requires enabling bracket pair colorization.")),nhe=N("editorBracketHighlight.unexpectedBracket.foreground",{dark:new $(new q(255,18,18,.8)),light:new $(new q(255,18,18,.8)),hcDark:new $(new q(255,50,50,1)),hcLight:"#B5200D"},p(663,"Foreground color of unexpected brackets.")),she=N("editorBracketPairGuide.background1","#00000000",p(664,"Background color of inactive bracket pair guides (1). Requires enabling bracket pair guides.")),ohe=N("editorBracketPairGuide.background2","#00000000",p(665,"Background color of inactive bracket pair guides (2). Requires enabling bracket pair guides.")),rhe=N("editorBracketPairGuide.background3","#00000000",p(666,"Background color of inactive bracket pair guides (3). Requires enabling bracket pair guides.")),ahe=N("editorBracketPairGuide.background4","#00000000",p(667,"Background color of inactive bracket pair guides (4). Requires enabling bracket pair guides.")),lhe=N("editorBracketPairGuide.background5","#00000000",p(668,"Background color of inactive bracket pair guides (5). Requires enabling bracket pair guides.")),che=N("editorBracketPairGuide.background6","#00000000",p(669,"Background color of inactive bracket pair guides (6). Requires enabling bracket pair guides.")),dhe=N("editorBracketPairGuide.activeBackground1","#00000000",p(670,"Background color of active bracket pair guides (1). Requires enabling bracket pair guides.")),hhe=N("editorBracketPairGuide.activeBackground2","#00000000",p(671,"Background color of active bracket pair guides (2). Requires enabling bracket pair guides.")),uhe=N("editorBracketPairGuide.activeBackground3","#00000000",p(672,"Background color of active bracket pair guides (3). Requires enabling bracket pair guides.")),fhe=N("editorBracketPairGuide.activeBackground4","#00000000",p(673,"Background color of active bracket pair guides (4). Requires enabling bracket pair guides.")),ghe=N("editorBracketPairGuide.activeBackground5","#00000000",p(674,"Background color of active bracket pair guides (5). Requires enabling bracket pair guides.")),phe=N("editorBracketPairGuide.activeBackground6","#00000000",p(675,"Background color of active bracket pair guides (6). Requires enabling bracket pair guides."));N("editorUnicodeHighlight.border",Wc,p(676,"Border color used to highlight unicode characters.")),N("editorUnicodeHighlight.background",Gae,p(677,"Background color used to highlight unicode characters.")),Nr((o,e)=>{const t=o.getColor(xi),i=o.getColor(Rz),n=i&&!i.isTransparent()?i:t;n&&e.addRule(`.monaco-editor .inputarea.ime-input { background-color: ${n}; }`)});class Uz extends Lh{constructor(e){super(),this._context=e;const t=this._context.configuration.options,i=t.get(165);this._renderLineHighlight=t.get(110),this._renderLineHighlightOnlyWhenFocus=t.get(111),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._selectionIsEmpty=!0,this._focused=!1,this._cursorLineNumbers=[1],this._selections=[new ce(1,1,1,1)],this._renderData=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}_readFromSelections(){let e=!1;const t=new Set;for(const s of this._selections)t.add(s.positionLineNumber);const i=Array.from(t);i.sort((s,r)=>s-r),Ut(this._cursorLineNumbers,i)||(this._cursorLineNumbers=i,e=!0);const n=this._selections.every(s=>s.isEmpty());return this._selectionIsEmpty!==n&&(this._selectionIsEmpty=n,e=!0),e}onThemeChanged(e){return this._readFromSelections()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._renderLineHighlight=t.get(110),this._renderLineHighlightOnlyWhenFocus=t.get(111),this._wordWrap=i.isViewportWrapping,this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,!0}onCursorStateChanged(e){return this._selections=e.selections,this._readFromSelections()}onFlushed(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollWidthChanged||e.scrollTopChanged}onZonesChanged(e){return!0}onFocusChanged(e){return this._renderLineHighlightOnlyWhenFocus?(this._focused=e.isFocused,!0):!1}prepareRender(e){if(!this._shouldRenderThis()){this._renderData=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=[];for(let r=t;r<=i;r++){const a=r-t;n[a]=""}if(this._wordWrap){const r=this._renderOne(e,!1);for(const a of this._cursorLineNumbers){const l=this._context.viewModel.coordinatesConverter,c=l.convertViewPositionToModelPosition(new M(a,1)).lineNumber,d=l.convertModelPositionToViewPosition(new M(c,1)).lineNumber,h=l.convertModelPositionToViewPosition(new M(c,this._context.viewModel.model.getLineMaxColumn(c))).lineNumber,u=Math.max(d,t),f=Math.min(h,i);for(let g=u;g<=f;g++){const m=g-t;n[m]=r}}}const s=this._renderOne(e,!0);for(const r of this._cursorLineNumbers){if(r<t||r>i)continue;const a=r-t;n[a]=s}this._renderData=n}render(e,t){if(!this._renderData)return"";const i=t-e;return i>=this._renderData.length?"":this._renderData[i]}_shouldRenderInMargin(){return(this._renderLineHighlight==="gutter"||this._renderLineHighlight==="all")&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}_shouldRenderInContent(){return(this._renderLineHighlight==="line"||this._renderLineHighlight==="all")&&this._selectionIsEmpty&&(!this._renderLineHighlightOnlyWhenFocus||this._focused)}}class mhe extends Uz{_renderOne(e,t){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-both":"")+(t?" current-line-exact":"")}" style="width:${Math.max(e.scrollWidth,this._contentWidth)}px;"></div>`}_shouldRenderThis(){return this._shouldRenderInContent()}_shouldRenderOther(){return this._shouldRenderInMargin()}}class _he extends Uz{_renderOne(e,t){return`<div class="${"current-line"+(this._shouldRenderInMargin()?" current-line-margin":"")+(this._shouldRenderOther()?" current-line-margin-both":"")+(this._shouldRenderInMargin()&&t?" current-line-exact-margin":"")}" style="width:${this._contentLeft}px"></div>`}_shouldRenderThis(){return!0}_shouldRenderOther(){return this._shouldRenderInContent()}}Nr((o,e)=>{const t=o.getColor(Rz);if(t&&(e.addRule(`.monaco-editor .view-overlays .current-line { background-color: ${t}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-margin { background-color: ${t}; border: none; }`)),!t||t.isTransparent()||o.defines(Mz)){const i=o.getColor(Mz);i&&(e.addRule(`.monaco-editor .view-overlays .current-line-exact { border: 2px solid ${i}; }`),e.addRule(`.monaco-editor .margin-view-overlays .current-line-exact-margin { border: 2px solid ${i}; }`),Ta(o.type)&&(e.addRule(".monaco-editor .view-overlays .current-line-exact { border-width: 1px; }"),e.addRule(".monaco-editor .margin-view-overlays .current-line-exact-margin { border-width: 1px; }")))}});class bhe extends Lh{constructor(e){super(),this._context=e;const t=this._context.configuration.options;this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}prepareRender(e){const t=e.getDecorationsInViewport();let i=[],n=0;for(let l=0,c=t.length;l<c;l++){const d=t[l];d.options.className&&(i[n++]=d)}i=i.sort((l,c)=>{if(l.options.zIndex<c.options.zIndex)return-1;if(l.options.zIndex>c.options.zIndex)return 1;const d=l.options.className,h=c.options.className;return d<h?-1:d>h?1:k.compareRangesUsingStarts(l.range,c.range)});const s=e.visibleRange.startLineNumber,r=e.visibleRange.endLineNumber,a=[];for(let l=s;l<=r;l++){const c=l-s;a[c]=""}this._renderWholeLineDecorations(e,i,a),this._renderNormalDecorations(e,i,a),this._renderResult=a}_renderWholeLineDecorations(e,t,i){const n=e.visibleRange.startLineNumber,s=e.visibleRange.endLineNumber;for(let r=0,a=t.length;r<a;r++){const l=t[r];if(!l.options.isWholeLine)continue;const c='<div class="cdr '+l.options.className+'" style="left:0;width:100%;"></div>',d=Math.max(l.range.startLineNumber,n),h=Math.min(l.range.endLineNumber,s);for(let u=d;u<=h;u++){const f=u-n;i[f]+=c}}}_renderNormalDecorations(e,t,i){const n=e.visibleRange.startLineNumber;let s=null,r=!1,a=null,l=!1;for(let c=0,d=t.length;c<d;c++){const h=t[c];if(h.options.isWholeLine)continue;const u=h.options.className,f=!!h.options.showIfCollapsed;let g=h.range;if(f&&g.endColumn===1&&g.endLineNumber!==g.startLineNumber&&(g=new k(g.startLineNumber,g.startColumn,g.endLineNumber-1,this._context.viewModel.getLineMaxColumn(g.endLineNumber-1))),s===u&&r===f&&k.areIntersectingOrTouching(a,g)){a=k.plusRange(a,g);continue}s!==null&&this._renderNormalDecoration(e,a,s,l,r,n,i),s=u,r=f,a=g,l=h.options.shouldFillLineOnLineBreak??!1}s!==null&&this._renderNormalDecoration(e,a,s,l,r,n,i)}_renderNormalDecoration(e,t,i,n,s,r,a){const l=e.linesVisibleRangesForRange(t,i==="findMatch");if(l)for(let c=0,d=l.length;c<d;c++){const h=l[c];if(h.outsideRenderedLine)continue;const u=h.lineNumber-r;if(s&&h.ranges.length===1){const f=h.ranges[0];if(f.width<this._typicalHalfwidthCharacterWidth){const g=Math.round(f.left+f.width/2),m=Math.max(0,Math.round(g-this._typicalHalfwidthCharacterWidth/2));h.ranges[0]=new Z1(m,this._typicalHalfwidthCharacterWidth)}}for(let f=0,g=h.ranges.length;f<g;f++){const m=n&&h.continuesOnNextLine&&g===1,_=h.ranges[f],b='<div class="cdr '+i+'" style="left:'+String(_.left)+"px;width:"+(m?"100%;":String(_.width)+"px;")+'"></div>';a[u]+=b}}}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class Che extends vs{constructor(e,t,i,n){super(e);const s=this._context.configuration.options,r=s.get(117),a=s.get(83),l=s.get(49),c=s.get(120),d=s.get(158),h={listenOnDomNode:i.domNode,className:"editor-scrollable "+MM(e.theme.type),useShadows:!1,lazyRender:!0,vertical:r.vertical,horizontal:r.horizontal,verticalHasArrows:r.verticalHasArrows,horizontalHasArrows:r.horizontalHasArrows,verticalScrollbarSize:r.verticalScrollbarSize,verticalSliderSize:r.verticalSliderSize,horizontalScrollbarSize:r.horizontalScrollbarSize,horizontalSliderSize:r.horizontalSliderSize,handleMouseWheel:r.handleMouseWheel,alwaysConsumeMouseWheel:r.alwaysConsumeMouseWheel,arrowSize:r.arrowSize,mouseWheelScrollSensitivity:a,fastScrollSensitivity:l,scrollPredominantAxis:c,scrollByPage:r.scrollByPage,inertialScroll:d};this.scrollbar=this._register(new VL(t.domNode,h,this._context.viewLayout.getScrollable())),Na.write(this.scrollbar.getDomNode(),6),this.scrollbarDomNode=lt(this.scrollbar.getDomNode()),this.scrollbarDomNode.setPosition("absolute"),this._setLayout();const u=(f,g,m)=>{const _={};{const b=f.scrollTop;b&&(_.scrollTop=this._context.viewLayout.getCurrentScrollTop()+b,f.scrollTop=0)}if(m){const b=f.scrollLeft;b&&(_.scrollLeft=this._context.viewLayout.getCurrentScrollLeft()+b,f.scrollLeft=0)}this._context.viewModel.viewLayout.setScrollPosition(_,1)};this._register(W(i.domNode,"scroll",f=>u(i.domNode,!0,!0))),this._register(W(t.domNode,"scroll",f=>u(t.domNode,!0,!1))),this._register(W(n.domNode,"scroll",f=>u(n.domNode,!0,!1))),this._register(W(this.scrollbarDomNode.domNode,"scroll",f=>u(this.scrollbarDomNode.domNode,!0,!1)))}dispose(){super.dispose()}_setLayout(){const e=this._context.configuration.options,t=e.get(165);this.scrollbarDomNode.setLeft(t.contentLeft),e.get(81).side==="right"?this.scrollbarDomNode.setWidth(t.contentWidth+t.minimap.minimapWidth):this.scrollbarDomNode.setWidth(t.contentWidth),this.scrollbarDomNode.setHeight(t.height)}getOverviewRulerLayoutInfo(){return this.scrollbar.getOverviewRulerLayoutInfo()}getDomNode(){return this.scrollbarDomNode}delegateVerticalScrollbarPointerDown(e){this.scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this.scrollbar.delegateScrollFromMouseWheelEvent(e)}onConfigurationChanged(e){if(e.hasChanged(117)||e.hasChanged(83)||e.hasChanged(49)){const t=this._context.configuration.options,i=t.get(117),n=t.get(83),s=t.get(49),r=t.get(120),a={vertical:i.vertical,horizontal:i.horizontal,verticalScrollbarSize:i.verticalScrollbarSize,horizontalScrollbarSize:i.horizontalScrollbarSize,scrollByPage:i.scrollByPage,handleMouseWheel:i.handleMouseWheel,mouseWheelScrollSensitivity:n,fastScrollSensitivity:s,scrollPredominantAxis:r};this.scrollbar.updateOptions(a)}return e.hasChanged(165)&&this._setLayout(),!0}onScrollChanged(e){return!0}onThemeChanged(e){return this.scrollbar.updateClassName("editor-scrollable "+MM(this._context.theme.type)),!0}prepareRender(e){}render(e){this.scrollbar.renderNow()}}class OM{constructor(e,t,i,n,s){this.startLineNumber=e,this.endLineNumber=t,this.className=i,this.tooltip=n,this._decorationToRenderBrand=void 0,this.zIndex=s??0}}class vhe{constructor(e,t,i){this.className=e,this.zIndex=t,this.tooltip=i}}class whe{constructor(){this.decorations=[]}add(e){this.decorations.push(e)}getDecorations(){return this.decorations}}class $z extends Lh{_render(e,t,i){const n=[];for(let a=e;a<=t;a++){const l=a-e;n[l]=new whe}if(i.length===0)return n;i.sort((a,l)=>a.className===l.className?a.startLineNumber===l.startLineNumber?a.endLineNumber-l.endLineNumber:a.startLineNumber-l.startLineNumber:a.className<l.className?-1:1);let s=null,r=0;for(let a=0,l=i.length;a<l;a++){const c=i[a],d=c.className,h=c.zIndex;let u=Math.max(c.startLineNumber,e)-e;const f=Math.min(c.endLineNumber,t)-e;s===d?(u=Math.max(r+1,u),r=Math.max(r,f)):(s=d,r=f);for(let g=u;g<=r;g++)n[g].add(new vhe(d,h,c.tooltip))}return n}}class She extends vs{constructor(e){super(e),this._widgets={},this._context=e;const t=this._context.configuration.options,i=t.get(165);this.domNode=lt(document.createElement("div")),this.domNode.setClassName("glyph-margin-widgets"),this.domNode.setPosition("absolute"),this.domNode.setTop(0),this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._glyphMarginDecorationLaneCount=i.glyphMarginDecorationLaneCount,this._managedDomNodes=[],this._decorationGlyphsToRender=[]}dispose(){this._managedDomNodes=[],this._decorationGlyphsToRender=[],this._widgets={},super.dispose()}getWidgets(){return Object.values(this._widgets)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._lineHeight=t.get(75),this._glyphMargin=t.get(66),this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._glyphMarginDecorationLaneCount=i.glyphMarginDecorationLaneCount,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}addWidget(e){const t=lt(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:e.getPosition(),domNode:t,renderInfo:null},t.setPosition("absolute"),t.setDisplay("none"),t.setAttribute("widgetId",e.getId()),this.domNode.appendChild(t),this.setShouldRender()}setWidgetPosition(e,t){const i=this._widgets[e.getId()];return i.preference.lane===t.lane&&i.preference.zIndex===t.zIndex&&k.equalsRange(i.preference.range,t.range)?!1:(i.preference=t,this.setShouldRender(),!0)}removeWidget(e){const t=e.getId();if(this._widgets[t]){const n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender()}}_collectDecorationBasedGlyphRenderRequest(e,t){const i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,s=e.getDecorationsInViewport();for(const r of s){const a=r.options.glyphMarginClassName;if(!a)continue;const l=Math.max(r.range.startLineNumber,i),c=Math.min(r.range.endLineNumber,n),d=r.options.glyphMargin?.position??xa.Center,h=r.options.zIndex??0;for(let u=l;u<=c;u++){const f=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(u,0)),g=this._context.viewModel.glyphLanes.getLanesAtLine(f.lineNumber).indexOf(d);t.push(new yhe(u,g,h,a))}}}_collectWidgetBasedGlyphRenderRequest(e,t){const i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(const s of Object.values(this._widgets)){const r=s.preference.range,{startLineNumber:a,endLineNumber:l}=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(k.lift(r));if(!a||!l||l<i||a>n)continue;const c=Math.max(a,i),d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(c,0)),h=this._context.viewModel.glyphLanes.getLanesAtLine(d.lineNumber).indexOf(s.preference.lane);t.push(new Lhe(c,h,s.preference.zIndex,s))}}_collectSortedGlyphRenderRequests(e){const t=[];return this._collectDecorationBasedGlyphRenderRequest(e,t),this._collectWidgetBasedGlyphRenderRequest(e,t),t.sort((i,n)=>i.lineNumber===n.lineNumber?i.laneIndex===n.laneIndex?i.zIndex===n.zIndex?n.type===i.type?i.type===0&&n.type===0?i.className<n.className?-1:1:0:n.type-i.type:n.zIndex-i.zIndex:i.laneIndex-n.laneIndex:i.lineNumber-n.lineNumber),t}prepareRender(e){if(!this._glyphMargin){this._decorationGlyphsToRender=[];return}for(const n of Object.values(this._widgets))n.renderInfo=null;const t=new Ec(this._collectSortedGlyphRenderRequests(e)),i=[];for(;t.length>0;){const n=t.peek();if(!n)break;const s=t.takeWhile(a=>a.lineNumber===n.lineNumber&&a.laneIndex===n.laneIndex);if(!s||s.length===0)break;const r=s[0];if(r.type===0){const a=[];for(const l of s){if(l.zIndex!==r.zIndex||l.type!==r.type)break;(a.length===0||a[a.length-1]!==l.className)&&a.push(l.className)}i.push(r.accept(a.join(" ")))}else r.widget.renderInfo={lineNumber:r.lineNumber,laneIndex:r.laneIndex}}this._decorationGlyphsToRender=i}render(e){if(!this._glyphMargin){for(const i of Object.values(this._widgets))i.domNode.setDisplay("none");for(;this._managedDomNodes.length>0;)this._managedDomNodes.pop()?.domNode.remove();return}const t=Math.round(this._glyphMarginWidth/this._glyphMarginDecorationLaneCount);for(const i of Object.values(this._widgets))if(!i.renderInfo)i.domNode.setDisplay("none");else{const n=e.viewportData.relativeVerticalOffset[i.renderInfo.lineNumber-e.viewportData.startLineNumber],s=this._glyphMarginLeft+i.renderInfo.laneIndex*this._lineHeight;i.domNode.setDisplay("block"),i.domNode.setTop(n),i.domNode.setLeft(s),i.domNode.setWidth(t),i.domNode.setHeight(this._lineHeight)}for(let i=0;i<this._decorationGlyphsToRender.length;i++){const n=this._decorationGlyphsToRender[i],s=n.lineNumber,r=e.viewportData.relativeVerticalOffset[s-e.viewportData.startLineNumber],a=this._glyphMarginLeft+n.laneIndex*this._lineHeight;let l;i<this._managedDomNodes.length?l=this._managedDomNodes[i]:(l=lt(document.createElement("div")),this._managedDomNodes.push(l),this.domNode.appendChild(l));const c=this._context.viewLayout.getLineHeightForLineNumber(s);l.setClassName("cgmr codicon "+n.combinedClassName),l.setPosition("absolute"),l.setTop(r),l.setLeft(a),l.setWidth(t),l.setHeight(c)}for(;this._managedDomNodes.length>this._decorationGlyphsToRender.length;)this._managedDomNodes.pop()?.domNode.remove()}}class yhe{constructor(e,t,i,n){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.className=n,this.type=0}accept(e){return new xhe(this.lineNumber,this.laneIndex,e)}}class Lhe{constructor(e,t,i,n){this.lineNumber=e,this.laneIndex=t,this.zIndex=i,this.widget=n,this.type=1}}class xhe{constructor(e,t,i){this.lineNumber=e,this.laneIndex=t,this.combinedClassName=i}}function nv(o,e,t=o.length-1){const i=khe(o,e,t);if(i!==-1)return o[i]}function khe(o,e,t=o.length-1){for(let i=t;i>=0;i--){const n=o[i];if(e(n))return i}return-1}function b_(o,e){const t=C_(o,e);return t===-1?void 0:o[t]}function C_(o,e,t=0,i=o.length){let n=t,s=i;for(;n<s;){const r=Math.floor((n+s)/2);e(o[r])?n=r+1:s=r}return n-1}function Ihe(o,e){const t=sv(o,e);return t===o.length?void 0:o[t]}function sv(o,e,t=0,i=o.length){let n=t,s=i;for(;n<s;){const r=Math.floor((n+s)/2);e(o[r])?s=r:n=r+1}return n}const cN=class cN{constructor(e){this._array=e,this._findLastMonotonousLastIdx=0}findLastMonotonous(e){if(cN.assertInvariants){if(this._prevFindLastPredicate){for(const i of this._array)if(this._prevFindLastPredicate(i)&&!e(i))throw new Error("MonotonousArray: current predicate must be weaker than (or equal to) the previous predicate.")}this._prevFindLastPredicate=e}const t=C_(this._array,e,this._findLastMonotonousLastIdx);return this._findLastMonotonousLastIdx=t+1,t===-1?void 0:this._array[t]}};cN.assertInvariants=!1;let jL=cN;function FM(o,e){if(o.length===0)return;let t=o[0];for(let i=1;i<o.length;i++){const n=o[i];e(n,t)>0&&(t=n)}return t}function jz(o,e){if(o.length===0)return;let t=o[0];for(let i=1;i<o.length;i++){const n=o[i];e(n,t)>=0&&(t=n)}return t}function qz(o,e){return FM(o,(t,i)=>-e(t,i))}function Dhe(o,e){if(o.length===0)return-1;let t=0;for(let i=1;i<o.length;i++){const n=o[i];e(n,o[t])>0&&(t=i)}return t}function Ehe(o,e){for(const t of o){const i=e(t);if(i!==void 0)return i}}class Kz extends A{constructor(){super(...arguments),this._isDisposed=!1}dispose(){super.dispose(),this._isDisposed=!0}assertNotDisposed(){if(this._isDisposed)throw new Error("TextModelPart is disposed!")}}function qL(o,e){let t=0,i=0;const n=o.length;for(;i<n;){const s=o.charCodeAt(i);if(s===32)t++;else if(s===9)t=t-t%e+e;else break;i++}return i===n?-1:t}var Ff;(function(o){o[o.Disabled=0]="Disabled",o[o.EnabledForActive=1]="EnabledForActive",o[o.Enabled=2]="Enabled"})(Ff||(Ff={}));class Wf{constructor(e,t,i,n,s,r){if(this.visibleColumn=e,this.column=t,this.className=i,this.horizontalLine=n,this.forWrappedLinesAfterColumn=s,this.forWrappedLinesBeforeOrAtColumn=r,e!==-1==(t!==-1))throw new Error}}class ov{constructor(e,t){this.top=e,this.endColumn=t}}class Nhe extends Kz{constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t}getLanguageConfiguration(e){return this.languageConfigurationService.getLanguageConfiguration(e)}_computeIndentLevel(e){return qL(this.textModel.getLineContent(e+1),this.textModel.getOptions().tabSize)}getActiveIndentGuide(e,t,i){this.assertNotDisposed();const n=this.textModel.getLineCount();if(e<1||e>n)throw new Ce("Illegal value for lineNumber");const s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide);let a=-2,l=-1,c=-2,d=-1;const h=x=>{if(a!==-1&&(a===-2||a>x-1)){a=-1,l=-1;for(let I=x-2;I>=0;I--){const D=this._computeIndentLevel(I);if(D>=0){a=I,l=D;break}}}if(c===-2){c=-1,d=-1;for(let I=x;I<n;I++){const D=this._computeIndentLevel(I);if(D>=0){c=I,d=D;break}}}};let u=-2,f=-1,g=-2,m=-1;const _=x=>{if(u===-2){u=-1,f=-1;for(let I=x-2;I>=0;I--){const D=this._computeIndentLevel(I);if(D>=0){u=I,f=D;break}}}if(g!==-1&&(g===-2||g<x-1)){g=-1,m=-1;for(let I=x;I<n;I++){const D=this._computeIndentLevel(I);if(D>=0){g=I,m=D;break}}}};let b=0,C=!0,w=0,v=!0,S=0,L=0;for(let x=0;C||v;x++){const I=e-x,D=e+x;x>1&&(I<1||I<t)&&(C=!1),x>1&&(D>n||D>i)&&(v=!1),x>5e4&&(C=!1,v=!1);let R=-1;if(C&&I>=1){const O=this._computeIndentLevel(I-1);O>=0?(c=I-1,d=O,R=Math.ceil(O/this.textModel.getOptions().indentSize)):(h(I),R=this._getIndentLevelForWhitespaceLine(r,l,d))}let F=-1;if(v&&D<=n){const O=this._computeIndentLevel(D-1);O>=0?(u=D-1,f=O,F=Math.ceil(O/this.textModel.getOptions().indentSize)):(_(D),F=this._getIndentLevelForWhitespaceLine(r,f,m))}if(x===0){L=R;continue}if(x===1){if(D<=n&&F>=0&&L+1===F){C=!1,b=D,w=D,S=F;continue}if(I>=1&&R>=0&&R-1===L){v=!1,b=I,w=I,S=R;continue}if(b=e,w=e,S=L,S===0)return{startLineNumber:b,endLineNumber:w,indent:S}}C&&(R>=S?b=I:C=!1),v&&(F>=S?w=D:v=!1)}return{startLineNumber:b,endLineNumber:w,indent:S}}getLinesBracketGuides(e,t,i,n){const s=[];for(let h=e;h<=t;h++)s.push([]);const r=!0,a=this.textModel.bracketPairs.getBracketPairsInRangeWithMinIndentation(new k(e,1,t,this.textModel.getLineMaxColumn(t))).toArray();let l;if(i&&a.length>0){const h=(e<=i.lineNumber&&i.lineNumber<=t?a:this.textModel.bracketPairs.getBracketPairsInRange(k.fromPositions(i)).toArray()).filter(u=>k.strictContainsPosition(u.range,i));l=nv(h,u=>r)?.range}const c=this.textModel.getOptions().bracketPairColorizationOptions.independentColorPoolPerBracketType,d=new Gz;for(const h of a){if(!h.closingBracketRange)continue;const u=l&&h.range.equalsRange(l);if(!u&&!n.includeInactive)continue;const f=d.getInlineClassName(h.nestingLevel,h.nestingLevelOfEqualBracketType,c)+(n.highlightActive&&u?" "+d.activeClassName:""),g=h.openingBracketRange.getStartPosition(),m=h.closingBracketRange.getStartPosition(),_=n.horizontalGuides===Ff.Enabled||n.horizontalGuides===Ff.EnabledForActive&&u;if(h.range.startLineNumber===h.range.endLineNumber){_&&s[h.range.startLineNumber-e].push(new Wf(-1,h.openingBracketRange.getEndPosition().column,f,new ov(!1,m.column),-1,-1));continue}const b=this.getVisibleColumnFromPosition(m),C=this.getVisibleColumnFromPosition(h.openingBracketRange.getStartPosition()),w=Math.min(C,b,h.minVisibleColumnIndentation+1);let v=!1;es(this.textModel.getLineContent(h.closingBracketRange.startLineNumber))<h.closingBracketRange.startColumn-1&&(v=!0);const x=Math.max(g.lineNumber,e),I=Math.min(m.lineNumber,t),D=v?1:0;for(let R=x;R<I+D;R++)s[R-e].push(new Wf(w,-1,f,null,R===g.lineNumber?g.column:-1,R===m.lineNumber?m.column:-1));_&&(g.lineNumber>=e&&C>w&&s[g.lineNumber-e].push(new Wf(w,-1,f,new ov(!1,g.column),-1,-1)),m.lineNumber<=t&&b>w&&s[m.lineNumber-e].push(new Wf(w,-1,f,new ov(!v,m.column),-1,-1)))}for(const h of s)h.sort((u,f)=>u.visibleColumn-f.visibleColumn);return s}getVisibleColumnFromPosition(e){return ti.visibleColumnFromColumn(this.textModel.getLineContent(e.lineNumber),e.column,this.textModel.getOptions().tabSize)+1}getLinesIndentGuides(e,t){this.assertNotDisposed();const i=this.textModel.getLineCount();if(e<1||e>i)throw new Error("Illegal value for startLineNumber");if(t<1||t>i)throw new Error("Illegal value for endLineNumber");const n=this.textModel.getOptions(),s=this.getLanguageConfiguration(this.textModel.getLanguageId()).foldingRules,r=!!(s&&s.offSide),a=new Array(t-e+1);let l=-2,c=-1,d=-2,h=-1;for(let u=e;u<=t;u++){const f=u-e,g=this._computeIndentLevel(u-1);if(g>=0){l=u-1,c=g,a[f]=Math.ceil(g/n.indentSize);continue}if(l===-2){l=-1,c=-1;for(let m=u-2;m>=0;m--){const _=this._computeIndentLevel(m);if(_>=0){l=m,c=_;break}}}if(d!==-1&&(d===-2||d<u-1)){d=-1,h=-1;for(let m=u;m<i;m++){const _=this._computeIndentLevel(m);if(_>=0){d=m,h=_;break}}}a[f]=this._getIndentLevelForWhitespaceLine(r,c,h)}return a}_getIndentLevelForWhitespaceLine(e,t,i){const n=this.textModel.getOptions();return t===-1||i===-1?0:t<i?1+Math.floor(t/n.indentSize):t===i||e?Math.ceil(i/n.indentSize):1+Math.floor(i/n.indentSize)}}class Gz{constructor(){this.activeClassName="indent-active"}getInlineClassName(e,t,i){return this.getInlineClassNameOfLevel(i?t:e)}getInlineClassNameOfLevel(e){return`bracket-indent-guide lvl-${e%30}`}}class The extends Lh{constructor(e){super(),this._context=e,this._primaryPosition=null;const t=this._context.configuration.options,i=t.get(166),n=t.get(59);this._spaceWidth=n.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(22),this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(166),n=t.get(59);return this._spaceWidth=n.spaceWidth,this._maxIndentLeft=i.wrappingColumn===-1?-1:i.wrappingColumn*n.typicalHalfwidthCharacterWidth,this._bracketPairGuideOptions=t.get(22),!0}onCursorStateChanged(e){const i=e.selections[0].getPosition();return this._primaryPosition?.equals(i)?!1:(this._primaryPosition=i,!0)}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onLanguageConfigurationChanged(e){return!0}prepareRender(e){if(!this._bracketPairGuideOptions.indentation&&this._bracketPairGuideOptions.bracketPairs===!1){this._renderResult=null;return}const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=e.scrollWidth,s=this._primaryPosition,r=this.getGuidesByLine(t,Math.min(i+1,this._context.viewModel.getLineCount()),s),a=[];for(let l=t;l<=i;l++){const c=l-t,d=r[c];let h="";const u=e.visibleRangeForPosition(new M(l,1))?.left??0;for(const f of d){const g=f.column===-1?u+(f.visibleColumn-1)*this._spaceWidth:e.visibleRangeForPosition(new M(l,f.column)).left;if(g>n||this._maxIndentLeft>0&&g>this._maxIndentLeft)break;const m=f.horizontalLine?f.horizontalLine.top?"horizontal-top":"horizontal-bottom":"vertical",_=f.horizontalLine?(e.visibleRangeForPosition(new M(l,f.horizontalLine.endColumn))?.left??g+this._spaceWidth)-g:this._spaceWidth;h+=`<div class="core-guide ${f.className} ${m}" style="left:${g}px;width:${_}px"></div>`}a[c]=h}this._renderResult=a}getGuidesByLine(e,t,i){const n=this._bracketPairGuideOptions.bracketPairs!==!1?this._context.viewModel.getBracketGuidesInRangeByLine(e,t,i,{highlightActive:this._bracketPairGuideOptions.highlightActiveBracketPair,horizontalGuides:this._bracketPairGuideOptions.bracketPairsHorizontal===!0?Ff.Enabled:this._bracketPairGuideOptions.bracketPairsHorizontal==="active"?Ff.EnabledForActive:Ff.Disabled,includeInactive:this._bracketPairGuideOptions.bracketPairs===!0}):null,s=this._bracketPairGuideOptions.indentation?this._context.viewModel.getLinesIndentGuides(e,t):null;let r=0,a=0,l=0;if(this._bracketPairGuideOptions.highlightActiveIndentation!==!1&&i){const h=this._context.viewModel.getActiveIndentGuide(i.lineNumber,e,t);r=h.startLineNumber,a=h.endLineNumber,l=h.indent}const{indentSize:c}=this._context.viewModel.model.getOptions(),d=[];for(let h=e;h<=t;h++){const u=new Array;d.push(u);const f=n?n[h-e]:[],g=new Ec(f),m=s?s[h-e]:0;for(let _=1;_<=m;_++){const b=(_-1)*c+1,C=(this._bracketPairGuideOptions.highlightActiveIndentation==="always"||f.length===0)&&r<=h&&h<=a&&_===l;u.push(...g.takeWhile(v=>v.visibleColumn<b)||[]);const w=g.peek();(!w||w.visibleColumn!==b||w.horizontalLine)&&u.push(new Wf(b,-1,`core-guide-indent lvl-${(_-1)%30}`+(C?" indent-active":""),null,-1,-1))}u.push(...g.takeWhile(_=>!0)||[])}return d}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}function v_(o){if(!(o&&o.isTransparent()))return o}Nr((o,e)=>{const t=[{bracketColor:Fz,guideColor:she,guideColorActive:dhe},{bracketColor:Wz,guideColor:ohe,guideColorActive:hhe},{bracketColor:Bz,guideColor:rhe,guideColorActive:uhe},{bracketColor:Hz,guideColor:ahe,guideColorActive:fhe},{bracketColor:Vz,guideColor:lhe,guideColorActive:ghe},{bracketColor:zz,guideColor:che,guideColorActive:phe}],i=new Gz,n=[{indentColor:tv,indentColorActive:iv},{indentColor:Ode,indentColorActive:Vde},{indentColor:Fde,indentColorActive:zde},{indentColor:Wde,indentColorActive:Ude},{indentColor:Bde,indentColorActive:$de},{indentColor:Hde,indentColorActive:jde}],s=t.map(a=>{const l=o.getColor(a.bracketColor),c=o.getColor(a.guideColor),d=o.getColor(a.guideColorActive),h=v_(v_(c)??l?.transparent(.3)),u=v_(v_(d)??l);if(!(!h||!u))return{guideColor:h,guideColorActive:u}}).filter(sn),r=n.map(a=>{const l=o.getColor(a.indentColor),c=o.getColor(a.indentColorActive),d=v_(l),h=v_(c);if(!(!d||!h))return{indentColor:d,indentColorActive:h}}).filter(sn);if(s.length>0){for(let a=0;a<30;a++){const l=s[a%s.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(a).replace(/ /g,".")} { --guide-color: ${l.guideColor}; --guide-color-active: ${l.guideColorActive}; }`)}e.addRule(".monaco-editor .vertical { box-shadow: 1px 0 0 0 var(--guide-color) inset; }"),e.addRule(".monaco-editor .horizontal-top { border-top: 1px solid var(--guide-color); }"),e.addRule(".monaco-editor .horizontal-bottom { border-bottom: 1px solid var(--guide-color); }"),e.addRule(`.monaco-editor .vertical.${i.activeClassName} { box-shadow: 1px 0 0 0 var(--guide-color-active) inset; }`),e.addRule(`.monaco-editor .horizontal-top.${i.activeClassName} { border-top: 1px solid var(--guide-color-active); }`),e.addRule(`.monaco-editor .horizontal-bottom.${i.activeClassName} { border-bottom: 1px solid var(--guide-color-active); }`)}if(r.length>0){for(let a=0;a<30;a++){const l=r[a%r.length];e.addRule(`.monaco-editor .lines-content .core-guide-indent.lvl-${a} { --indent-color: ${l.indentColor}; --indent-color-active: ${l.indentColorActive}; }`)}e.addRule(".monaco-editor .lines-content .core-guide-indent { box-shadow: 1px 0 0 0 var(--indent-color) inset; }"),e.addRule(".monaco-editor .lines-content .core-guide-indent.indent-active { box-shadow: 1px 0 0 0 var(--indent-color-active) inset; }")}});const dN=class dN extends Lh{constructor(e){super(),this._context=e,this._readConfig(),this._lastCursorModelPosition=new M(1,1),this._renderResult=null,this._activeModelLineNumber=1,this._context.addEventHandler(this)}_readConfig(){const e=this._context.configuration.options;this._lineHeight=e.get(75);const t=e.get(76);this._renderLineNumbers=t.renderType,this._renderCustomLineNumbers=t.renderFn,this._renderFinalNewline=e.get(109);const i=e.get(165);this._lineNumbersLeft=i.lineNumbersLeft,this._lineNumbersWidth=i.lineNumbersWidth}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return this._readConfig(),!0}onCursorStateChanged(e){const t=e.selections[0].getPosition();this._lastCursorModelPosition=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(t);let i=!1;return this._activeModelLineNumber!==this._lastCursorModelPosition.lineNumber&&(this._activeModelLineNumber=this._lastCursorModelPosition.lineNumber,i=!0),(this._renderLineNumbers===2||this._renderLineNumbers===3)&&(i=!0),i}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return e.affectsLineNumber}_getLineRenderLineNumber(e){const t=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(e,1));if(t.column!==1)return"";const i=t.lineNumber;if(this._renderCustomLineNumbers)return this._renderCustomLineNumbers(i);if(this._renderLineNumbers===2){const n=Math.abs(this._lastCursorModelPosition.lineNumber-i);return n===0?'<span class="relative-current-line-number">'+i+"</span>":String(n)}if(this._renderLineNumbers===3){if(this._lastCursorModelPosition.lineNumber===i||i%10===0)return String(i);const n=this._context.viewModel.getLineCount();return i===n?String(i):""}return String(i)}prepareRender(e){if(this._renderLineNumbers===0){this._renderResult=null;return}const t=Ws?this._lineHeight%2===0?" lh-even":" lh-odd":"",i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber,s=this._context.viewModel.getDecorationsInViewport(e.visibleRange).filter(c=>!!c.options.lineNumberClassName);s.sort((c,d)=>k.compareRangesUsingEnds(c.range,d.range));let r=0;const a=this._context.viewModel.getLineCount(),l=[];for(let c=i;c<=n;c++){const d=c-i,h=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(c,1)).lineNumber;let u=this._getLineRenderLineNumber(c),f="";for(;r<s.length&&s[r].range.endLineNumber<c;)r++;for(let g=r;g<s.length;g++){const{range:m,options:_}=s[g];m.startLineNumber<=c&&(f+=" "+_.lineNumberClassName)}if(!u&&!f){l[d]="";continue}c===a&&this._context.viewModel.getLineLength(c)===0&&(this._renderFinalNewline==="off"&&(u=""),this._renderFinalNewline==="dimmed"&&(f+=" dimmed-line-number")),h===this._activeModelLineNumber&&(f+=" active-line-number"),l[d]=`<div class="${dN.CLASS_NAME}${t}${f}" style="left:${this._lineNumbersLeft}px;width:${this._lineNumbersWidth}px;">${u}</div>`}this._renderResult=l}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};dN.CLASS_NAME="line-numbers";let KL=dN;Nr((o,e)=>{const t=o.getColor(Mde),i=o.getColor(Kde);i?e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${i}; }`):t&&e.addRule(`.monaco-editor .line-numbers.dimmed-line-number { color: ${t.transparent(.4)}; }`)});const w_="monaco-mouse-cursor-text";class WM{get didDomLayout(){return this._didDomLayout}readClientRect(){if(!this._clientRectRead){this._clientRectRead=!0;const e=this._domNode.getBoundingClientRect();this.markDidDomLayout(),this._clientRectDeltaLeft=e.left,this._clientRectScale=e.width/this._domNode.offsetWidth}}get clientRectDeltaLeft(){return this._clientRectRead||this.readClientRect(),this._clientRectDeltaLeft}get clientRectScale(){return this._clientRectRead||this.readClientRect(),this._clientRectScale}constructor(e,t){this._domNode=e,this.endNode=t,this._didDomLayout=!1,this._clientRectDeltaLeft=0,this._clientRectScale=1,this._clientRectRead=!1}markDidDomLayout(){this._didDomLayout=!0}}class GL{constructor(e,t){this.themeType=t;const i=e.options,n=i.get(59);this.renderWhitespace=i.get(113),this.experimentalWhitespaceRendering=i.get(47),this.renderControlCharacters=i.get(108),this.spaceWidth=n.spaceWidth,this.middotWidth=n.middotWidth,this.wsmiddotWidth=n.wsmiddotWidth,this.useMonospaceOptimizations=n.isMonospace&&!i.get(40),this.canUseHalfwidthRightwardsArrow=n.canUseHalfwidthRightwardsArrow,this.lineHeight=i.get(75),this.stopRenderingLineAfter=i.get(133),this.fontLigatures=i.get(60),this.verticalScrollbarSize=i.get(117).verticalScrollbarSize,this.useGpu=i.get(46)==="on"}equals(e){return this.themeType===e.themeType&&this.renderWhitespace===e.renderWhitespace&&this.experimentalWhitespaceRendering===e.experimentalWhitespaceRendering&&this.renderControlCharacters===e.renderControlCharacters&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.useMonospaceOptimizations===e.useMonospaceOptimizations&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter&&this.fontLigatures===e.fontLigatures&&this.verticalScrollbarSize===e.verticalScrollbarSize&&this.useGpu===e.useGpu}}class Rhe{constructor(){this._currentVisibleRange=new k(1,1,1,1)}getCurrentVisibleRange(){return this._currentVisibleRange}setCurrentVisibleRange(e){this._currentVisibleRange=e}}class Mhe{constructor(e,t,i,n,s,r,a){this.minimalReveal=e,this.lineNumber=t,this.startColumn=i,this.endColumn=n,this.startScrollTop=s,this.stopScrollTop=r,this.scrollType=a,this.type="range",this.minLineNumber=t,this.maxLineNumber=t}}class Phe{constructor(e,t,i,n,s){this.minimalReveal=e,this.selections=t,this.startScrollTop=i,this.stopScrollTop=n,this.scrollType=s,this.type="selections";let r=t[0].startLineNumber,a=t[0].endLineNumber;for(let l=1,c=t.length;l<c;l++){const d=t[l];r=Math.min(r,d.startLineNumber),a=Math.max(a,d.endLineNumber)}this.minLineNumber=r,this.maxLineNumber=a}}const hN=class hN extends vs{constructor(e,t,i){super(e);const n=this._context.configuration,s=this._context.configuration.options,r=s.get(59),a=s.get(166);this._lineHeight=s.get(75),this._typicalHalfwidthCharacterWidth=r.typicalHalfwidthCharacterWidth,this._isViewportWrapping=a.isViewportWrapping,this._revealHorizontalRightPadding=s.get(114),this._cursorSurroundingLines=s.get(35),this._cursorSurroundingLinesStyle=s.get(36),this._canUseLayerHinting=!s.get(39),this._viewLineOptions=new GL(n,this._context.theme.type),this._linesContent=i,this._textRangeRestingSpot=document.createElement("div"),this._visibleLines=new Iz(this._context,{createLine:()=>new zc(t,this._viewLineOptions)}),this.domNode=this._visibleLines.domNode,Na.write(this.domNode,8),this.domNode.setClassName(`view-lines ${w_}`),dn(this.domNode,r),this._maxLineWidth=0,this._asyncUpdateLineWidths=new wt(()=>{this._updateLineWidthsSlow()},200),this._asyncCheckMonospaceFontAssumptions=new wt(()=>{this._checkMonospaceFontAssumptions()},2e3),this._lastRenderedData=new Rhe,this._horizontalRevealRequest=null,this._stickyScrollEnabled=s.get(131).enabled,this._maxNumberStickyLines=s.get(131).maxLineCount}dispose(){this._asyncUpdateLineWidths.dispose(),this._asyncCheckMonospaceFontAssumptions.dispose(),super.dispose()}getDomNode(){return this.domNode}onConfigurationChanged(e){this._visibleLines.onConfigurationChanged(e),e.hasChanged(166)&&(this._maxLineWidth=0);const t=this._context.configuration.options,i=t.get(59),n=t.get(166);return this._lineHeight=t.get(75),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._isViewportWrapping=n.isViewportWrapping,this._revealHorizontalRightPadding=t.get(114),this._cursorSurroundingLines=t.get(35),this._cursorSurroundingLinesStyle=t.get(36),this._canUseLayerHinting=!t.get(39),this._stickyScrollEnabled=t.get(131).enabled,this._maxNumberStickyLines=t.get(131).maxLineCount,dn(this.domNode,i),this._onOptionsMaybeChanged(),e.hasChanged(165)&&(this._maxLineWidth=0),!0}_onOptionsMaybeChanged(){const e=this._context.configuration,t=new GL(e,this._context.theme.type);if(!this._viewLineOptions.equals(t)){this._viewLineOptions=t;const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++)this._visibleLines.getVisibleLine(s).onOptionsChanged(this._viewLineOptions);return!0}return!1}onCursorStateChanged(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=!1;for(let s=t;s<=i;s++)n=this._visibleLines.getVisibleLine(s).onSelectionChanged()||n;return n}onDecorationsChanged(e){{const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++)this._visibleLines.getVisibleLine(n).onDecorationsChanged()}return!0}onFlushed(e){const t=this._visibleLines.onFlushed(e,this._viewLineOptions.useGpu);return this._maxLineWidth=0,t}onLinesChanged(e){return this._visibleLines.onLinesChanged(e)}onLinesDeleted(e){return this._visibleLines.onLinesDeleted(e)}onLinesInserted(e){return this._visibleLines.onLinesInserted(e)}onRevealRangeRequest(e){const t=this._computeScrollTopToRevealRange(this._context.viewLayout.getFutureViewport(),e.source,e.minimalReveal,e.range,e.selections,e.verticalType);if(t===-1)return!1;let i=this._context.viewLayout.validateScrollPosition({scrollTop:t});e.revealHorizontal?e.range&&e.range.startLineNumber!==e.range.endLineNumber?i={scrollTop:i.scrollTop,scrollLeft:0}:e.range?this._horizontalRevealRequest=new Mhe(e.minimalReveal,e.range.startLineNumber,e.range.startColumn,e.range.endColumn,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType):e.selections&&e.selections.length>0&&(this._horizontalRevealRequest=new Phe(e.minimalReveal,e.selections,this._context.viewLayout.getCurrentScrollTop(),i.scrollTop,e.scrollType)):this._horizontalRevealRequest=null;const s=Math.abs(this._context.viewLayout.getCurrentScrollTop()-i.scrollTop)<=this._lineHeight?1:e.scrollType;return this._context.viewModel.viewLayout.setScrollPosition(i,s),!0}onScrollChanged(e){if(this._horizontalRevealRequest&&e.scrollLeftChanged&&(this._horizontalRevealRequest=null),this._horizontalRevealRequest&&e.scrollTopChanged){const t=Math.min(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop),i=Math.max(this._horizontalRevealRequest.startScrollTop,this._horizontalRevealRequest.stopScrollTop);(e.scrollTop<t||e.scrollTop>i)&&(this._horizontalRevealRequest=null)}return this.domNode.setWidth(e.scrollWidth),this._visibleLines.onScrollChanged(e)||!0}onTokensChanged(e){return this._visibleLines.onTokensChanged(e)}onZonesChanged(e){return this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth),this._visibleLines.onZonesChanged(e)}onThemeChanged(e){return this._onOptionsMaybeChanged()}getPositionFromDOMInfo(e,t){const i=this._getViewLineDomNode(e);if(i===null)return null;const n=this._getLineNumberFor(i);if(n===-1||n<1||n>this._context.viewModel.getLineCount())return null;if(this._context.viewModel.getLineMaxColumn(n)===1)return new M(n,1);const s=this._visibleLines.getStartLineNumber(),r=this._visibleLines.getEndLineNumber();if(n<s||n>r)return null;let a=this._visibleLines.getVisibleLine(n).getColumnOfNodeOffset(e,t);const l=this._context.viewModel.getLineMinColumn(n);return a<l&&(a=l),new M(n,a)}_getViewLineDomNode(e){for(;e&&e.nodeType===1;){if(e.className===zc.CLASS_NAME)return e;e=e.parentElement}return null}_getLineNumberFor(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();for(let n=t;n<=i;n++){const s=this._visibleLines.getVisibleLine(n);if(e===s.getDomNode())return n}return-1}getLineWidth(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();if(e<t||e>i)return-1;const n=new WM(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getWidth(n);return this._updateLineWidthsSlowIfDomDidLayout(n),s}linesVisibleRangesForRange(e,t){if(this.shouldRender())return null;const i=e.endLineNumber,n=k.intersectRanges(e,this._lastRenderedData.getCurrentVisibleRange());if(!n)return null;const s=[];let r=0;const a=new WM(this.domNode.domNode,this._textRangeRestingSpot);let l=0;t&&(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(n.startLineNumber,1)).lineNumber);const c=this._visibleLines.getStartLineNumber(),d=this._visibleLines.getEndLineNumber();for(let h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<c||h>d)continue;const u=h===n.startLineNumber?n.startColumn:1,f=h!==i,g=f?this._context.viewModel.getLineMaxColumn(h):n.endColumn,_=this._visibleLines.getVisibleLine(h).getVisibleRangesForRange(h,u,g,a);if(_){if(t&&h<i){const b=l;if(l=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(h+1,1)).lineNumber,b!==l){const C=_.ranges[_.ranges.length-1];C.width+=this._typicalHalfwidthCharacterWidth,this._context.viewModel.getTextDirection(b)===Oo.RTL&&(C.left-=this._typicalHalfwidthCharacterWidth)}}s[r++]=new lz(_.outsideRenderedLine,h,Z1.from(_.ranges),f)}}return this._updateLineWidthsSlowIfDomDidLayout(a),r===0?null:s}_visibleRangesForLineRange(e,t,i){if(this.shouldRender()||e<this._visibleLines.getStartLineNumber()||e>this._visibleLines.getEndLineNumber())return null;const n=new WM(this.domNode.domNode,this._textRangeRestingSpot),s=this._visibleLines.getVisibleLine(e).getVisibleRangesForRange(e,t,i,n);return this._updateLineWidthsSlowIfDomDidLayout(n),s}_lineIsRenderedRTL(e){return e<this._visibleLines.getStartLineNumber()||e>this._visibleLines.getEndLineNumber()?!1:this._visibleLines.getVisibleLine(e).isRenderedRTL()}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new cz(t.outsideRenderedLine,t.ranges[0].left):null}_updateLineWidthsFast(){return this._updateLineWidths(!0)}_updateLineWidthsSlow(){this._updateLineWidths(!1)}_updateLineWidthsSlowIfDomDidLayout(e){e.didDomLayout&&(this._asyncUpdateLineWidths.isScheduled()||(this._asyncUpdateLineWidths.cancel(),this._updateLineWidthsSlow()))}_updateLineWidths(e){const t=this._visibleLines.getStartLineNumber(),i=this._visibleLines.getEndLineNumber();let n=1,s=!0;for(let r=t;r<=i;r++){const a=this._visibleLines.getVisibleLine(r);if(e&&!a.getWidthIsFast()){s=!1;continue}n=Math.max(n,a.getWidth(null))}return s&&t===1&&i===this._context.viewModel.getLineCount()&&(this._maxLineWidth=0),this._ensureMaxLineWidth(n),s}_checkMonospaceFontAssumptions(){let e=-1,t=-1;const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++){const r=this._visibleLines.getVisibleLine(s);if(r.needsMonospaceFontCheck()){const a=r.getWidth(null);a>t&&(t=a,e=s)}}if(e!==-1&&!this._visibleLines.getVisibleLine(e).monospaceAssumptionsAreValid())for(let s=i;s<=n;s++)this._visibleLines.getVisibleLine(s).onMonospaceAssumptionsInvalidated()}prepareRender(){throw new Error("Not supported")}render(){throw new Error("Not supported")}renderText(e){if(this._visibleLines.renderLines(e),this._lastRenderedData.setCurrentVisibleRange(e.visibleRange),this.domNode.setWidth(this._context.viewLayout.getScrollWidth()),this.domNode.setHeight(Math.min(this._context.viewLayout.getScrollHeight(),1e6)),this._horizontalRevealRequest){const i=this._horizontalRevealRequest;if(e.startLineNumber<=i.minLineNumber&&i.maxLineNumber<=e.endLineNumber){this._horizontalRevealRequest=null,this.onDidRender();const n=this._computeScrollLeftToReveal(i);n&&(!this._isViewportWrapping&&!n.hasRTL&&this._ensureMaxLineWidth(n.maxHorizontalOffset),this._context.viewModel.viewLayout.setScrollPosition({scrollLeft:n.scrollLeft},i.scrollType))}}if(this._updateLineWidthsFast()?this._asyncUpdateLineWidths.cancel():this._asyncUpdateLineWidths.schedule(),Ws&&!this._asyncCheckMonospaceFontAssumptions.isScheduled()){const i=this._visibleLines.getStartLineNumber(),n=this._visibleLines.getEndLineNumber();for(let s=i;s<=n;s++)if(this._visibleLines.getVisibleLine(s).needsMonospaceFontCheck()){this._asyncCheckMonospaceFontAssumptions.schedule();break}}this._linesContent.setLayerHinting(this._canUseLayerHinting),this._linesContent.setContain("strict");const t=this._context.viewLayout.getCurrentScrollTop()-e.bigNumbersDelta;this._linesContent.setTop(-t),this._linesContent.setLeft(-this._context.viewLayout.getCurrentScrollLeft())}_ensureMaxLineWidth(e){const t=Math.ceil(e);this._maxLineWidth<t&&(this._maxLineWidth=t,this._context.viewModel.viewLayout.setMaxLineWidth(this._maxLineWidth))}_computeScrollTopToRevealRange(e,t,i,n,s,r){const a=e.top,l=e.height,c=a+l;let d,h,u;if(s&&s.length>0){let b=s[0].startLineNumber,C=s[0].endLineNumber;for(let w=1,v=s.length;w<v;w++){const S=s[w];b=Math.min(b,S.startLineNumber),C=Math.max(C,S.endLineNumber)}d=!1,h=this._context.viewLayout.getVerticalOffsetForLineNumber(b),u=this._context.viewLayout.getVerticalOffsetForLineNumber(C)+this._lineHeight}else if(n)d=!0,h=this._context.viewLayout.getVerticalOffsetForLineNumber(n.startLineNumber),u=this._context.viewLayout.getVerticalOffsetForLineNumber(n.endLineNumber)+this._lineHeight;else return-1;const f=(t==="mouse"||i)&&this._cursorSurroundingLinesStyle==="default";let g=0,m=0;if(f)i||(g=this._lineHeight);else{const b=l/this._lineHeight,C=Math.max(this._cursorSurroundingLines,this._stickyScrollEnabled?this._maxNumberStickyLines:0),w=Math.min(b/2,C);g=w*this._lineHeight,m=Math.max(0,w-1)*this._lineHeight}i||(r===0||r===4)&&(m+=this._lineHeight),h-=g,u+=m;let _;if(u-h>l){if(!d)return-1;_=h}else if(r===5||r===6)if(r===6&&a<=h&&u<=c)_=a;else{const b=Math.max(5*this._lineHeight,l*.2),C=h-b,w=u-l;_=Math.max(w,C)}else if(r===1||r===2)if(r===2&&a<=h&&u<=c)_=a;else{const b=(h+u)/2;_=Math.max(0,b-l/2)}else _=this._computeMinimumScrolling(a,c,h,u,r===3,r===4);return _}_computeScrollLeftToReveal(e){const t=this._context.viewLayout.getCurrentViewport(),i=this._context.configuration.options.get(165),n=t.left,s=n+t.width-i.verticalScrollbarWidth;let r=1073741824,a=0,l=!1;if(e.type==="range"){l=this._lineIsRenderedRTL(e.lineNumber);const d=this._visibleRangesForLineRange(e.lineNumber,e.startColumn,e.endColumn);if(!d)return null;for(const h of d.ranges)r=Math.min(r,Math.round(h.left)),a=Math.max(a,Math.round(h.left+h.width))}else for(const d of e.selections){if(d.startLineNumber!==d.endLineNumber)return null;const h=this._visibleRangesForLineRange(d.startLineNumber,d.startColumn,d.endColumn);if(l||=this._lineIsRenderedRTL(d.startLineNumber),!h)return null;for(const u of h.ranges)r=Math.min(r,Math.round(u.left)),a=Math.max(a,Math.round(u.left+u.width))}return e.minimalReveal||(r=Math.max(0,r-hN.HORIZONTAL_EXTRA_PX),a+=this._revealHorizontalRightPadding),e.type==="selections"&&a-r>t.width?null:{scrollLeft:this._computeMinimumScrolling(n,s,r,a),maxHorizontalOffset:a,hasRTL:l}}_computeMinimumScrolling(e,t,i,n,s,r){e=e|0,t=t|0,i=i|0,n=n|0,s=!!s,r=!!r;const a=t-e;if(n-i<a){if(s)return i;if(r)return Math.max(0,n-a);if(i<e)return i;if(n>t)return Math.max(0,n-a)}else return i;return e}};hN.HORIZONTAL_EXTRA_PX=30;let BM=hN;class Ahe extends $z{constructor(e){super(),this._context=e;const i=this._context.configuration.options.get(165);this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._decorationsLeft=i.decorationsLeft,this._decorationsWidth=i.decorationsWidth,!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.options.linesDecorationsClassName,c=a.options.zIndex;l&&(i[n++]=new OM(a.range.startLineNumber,a.range.endLineNumber,l,a.options.linesDecorationsTooltip??null,c));const d=a.options.firstLineDecorationClassName;d&&(i[n++]=new OM(a.range.startLineNumber,a.range.startLineNumber,d,a.options.linesDecorationsTooltip??null,c))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),s=this._decorationsLeft.toString(),r=this._decorationsWidth.toString(),a='" style="left:'+s+"px;width:"+r+'px;"></div>',l=[];for(let c=t;c<=i;c++){const d=c-t,h=n[d].getDecorations();let u="";for(const f of h){let g='<div class="cldr '+f.className;f.tooltip!==null&&(g+='" title="'+f.tooltip),g+=a,u+=g}l[d]=u}this._renderResult=l}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}const CC=class CC extends vs{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._canUseLayerHinting=!t.get(39),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,this._domNode=lt(document.createElement("div")),this._domNode.setClassName(CC.OUTER_CLASS_NAME),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._glyphMarginBackgroundDomNode=lt(document.createElement("div")),this._glyphMarginBackgroundDomNode.setClassName(CC.CLASS_NAME),this._domNode.appendChild(this._glyphMarginBackgroundDomNode)}dispose(){super.dispose()}getDomNode(){return this._domNode}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._canUseLayerHinting=!t.get(39),this._contentLeft=i.contentLeft,this._glyphMarginLeft=i.glyphMarginLeft,this._glyphMarginWidth=i.glyphMarginWidth,!0}onScrollChanged(e){return super.onScrollChanged(e)||e.scrollTopChanged}prepareRender(e){}render(e){this._domNode.setLayerHinting(this._canUseLayerHinting),this._domNode.setContain("strict");const t=e.scrollTop-e.bigNumbersDelta;this._domNode.setTop(-t);const i=Math.min(e.scrollHeight,1e6);this._domNode.setHeight(i),this._domNode.setWidth(this._contentLeft),this._glyphMarginBackgroundDomNode.setLeft(this._glyphMarginLeft),this._glyphMarginBackgroundDomNode.setWidth(this._glyphMarginWidth),this._glyphMarginBackgroundDomNode.setHeight(i)}};CC.CLASS_NAME="glyph-margin",CC.OUTER_CLASS_NAME="margin";let ZL=CC;class Ohe extends $z{constructor(e){super(),this._context=e,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_getDecorations(e){const t=e.getDecorationsInViewport(),i=[];let n=0;for(let s=0,r=t.length;s<r;s++){const a=t[s],l=a.options.marginClassName,c=a.options.zIndex;l&&(i[n++]=new OM(a.range.startLineNumber,a.range.endLineNumber,l,null,c))}return i}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=this._render(t,i,this._getDecorations(e)),s=[];for(let r=t;r<=i;r++){const a=r-t,l=n[a].getDecorations();let c="";for(const d of l)c+='<div class="cmdr '+d.className+'" style=""></div>';s[a]=c}this._renderResult=s}render(e,t){return this._renderResult?this._renderResult[t-e]:""}}const wu=class wu{constructor(e,t,i,n){this._rgba8Brand=void 0,this.r=wu._clamp(e),this.g=wu._clamp(t),this.b=wu._clamp(i),this.a=wu._clamp(n)}equals(e){return this.r===e.r&&this.g===e.g&&this.b===e.b&&this.a===e.a}static _clamp(e){return e<0?0:e>255?255:e|0}};wu.Empty=new wu(0,0,0,0);let Uc=wu,Fhe=class{constructor(){this._tokenizationSupports=new Map,this._factories=new Map,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._colorMap=null}handleChange(e){this._onDidChange.fire({changedLanguages:e,changedColorMap:!1})}register(e,t){return this._tokenizationSupports.set(e,t),this.handleChange([e]),ue(()=>{this._tokenizationSupports.get(e)===t&&(this._tokenizationSupports.delete(e),this.handleChange([e]))})}get(e){return this._tokenizationSupports.get(e)||null}registerFactory(e,t){this._factories.get(e)?.dispose();const i=new Whe(this,e,t);return this._factories.set(e,i),ue(()=>{const n=this._factories.get(e);!n||n!==i||(this._factories.delete(e),n.dispose())})}async getOrCreate(e){const t=this.get(e);if(t)return t;const i=this._factories.get(e);return!i||i.isResolved?null:(await i.resolve(),this.get(e))}isResolved(e){if(this.get(e))return!0;const i=this._factories.get(e);return!!(!i||i.isResolved)}setColorMap(e){this._colorMap=e,this._onDidChange.fire({changedLanguages:Array.from(this._tokenizationSupports.keys()),changedColorMap:!0})}getColorMap(){return this._colorMap}getDefaultBackground(){return this._colorMap&&this._colorMap.length>2?this._colorMap[2]:null}};class Whe extends A{get isResolved(){return this._isResolved}constructor(e,t,i){super(),this._registry=e,this._languageId=t,this._factory=i,this._isDisposed=!1,this._resolvePromise=null,this._isResolved=!1}dispose(){this._isDisposed=!0,super.dispose()}async resolve(){return this._resolvePromise||(this._resolvePromise=this._create()),this._resolvePromise}async _create(){const e=await this._factory.tokenizationSupport;this._isResolved=!0,e&&!this._isDisposed&&this._register(this._registry.register(this._languageId,e))}}let rv=class{constructor(e,t,i){this.offset=e,this.type=t,this.language=i,this._tokenBrand=void 0}toString(){return"("+this.offset+", "+this.type+")"}};class HM{constructor(e,t){this.tokens=e,this.endState=t,this._tokenizationResultBrand=void 0}}class YL{constructor(e,t){this.tokens=e,this.endState=t,this._encodedTokenizationResultBrand=void 0}}var po;(function(o){o[o.Increase=0]="Increase",o[o.Decrease=1]="Decrease"})(po||(po={}));var S_;(function(o){const e=new Map;e.set(0,Y.symbolMethod),e.set(1,Y.symbolFunction),e.set(2,Y.symbolConstructor),e.set(3,Y.symbolField),e.set(4,Y.symbolVariable),e.set(5,Y.symbolClass),e.set(6,Y.symbolStruct),e.set(7,Y.symbolInterface),e.set(8,Y.symbolModule),e.set(9,Y.symbolProperty),e.set(10,Y.symbolEvent),e.set(11,Y.symbolOperator),e.set(12,Y.symbolUnit),e.set(13,Y.symbolValue),e.set(15,Y.symbolEnum),e.set(14,Y.symbolConstant),e.set(15,Y.symbolEnum),e.set(16,Y.symbolEnumMember),e.set(17,Y.symbolKeyword),e.set(28,Y.symbolSnippet),e.set(18,Y.symbolText),e.set(19,Y.symbolColor),e.set(20,Y.symbolFile),e.set(21,Y.symbolReference),e.set(22,Y.symbolCustomColor),e.set(23,Y.symbolFolder),e.set(24,Y.symbolTypeParameter),e.set(25,Y.account),e.set(26,Y.issues),e.set(27,Y.tools);function t(r){let a=e.get(r);return a||(console.info("No codicon found for CompletionItemKind "+r),a=Y.symbolProperty),a}o.toIcon=t;function i(r){switch(r){case 0:return p(724,"Method");case 1:return p(725,"Function");case 2:return p(726,"Constructor");case 3:return p(727,"Field");case 4:return p(728,"Variable");case 5:return p(729,"Class");case 6:return p(730,"Struct");case 7:return p(731,"Interface");case 8:return p(732,"Module");case 9:return p(733,"Property");case 10:return p(734,"Event");case 11:return p(735,"Operator");case 12:return p(736,"Unit");case 13:return p(737,"Value");case 14:return p(738,"Constant");case 15:return p(739,"Enum");case 16:return p(740,"Enum Member");case 17:return p(741,"Keyword");case 18:return p(742,"Text");case 19:return p(743,"Color");case 20:return p(744,"File");case 21:return p(745,"Reference");case 22:return p(746,"Custom Color");case 23:return p(747,"Folder");case 24:return p(748,"Type Parameter");case 25:return p(749,"User");case 26:return p(750,"Issue");case 27:return p(751,"Tool");case 28:return p(752,"Snippet");default:return""}}o.toLabel=i;const n=new Map;n.set("method",0),n.set("function",1),n.set("constructor",2),n.set("field",3),n.set("variable",4),n.set("class",5),n.set("struct",6),n.set("interface",7),n.set("module",8),n.set("property",9),n.set("event",10),n.set("operator",11),n.set("unit",12),n.set("value",13),n.set("constant",14),n.set("enum",15),n.set("enum-member",16),n.set("enumMember",16),n.set("keyword",17),n.set("snippet",28),n.set("text",18),n.set("color",19),n.set("file",20),n.set("reference",21),n.set("customcolor",22),n.set("folder",23),n.set("type-parameter",24),n.set("typeParameter",24),n.set("account",25),n.set("issue",26),n.set("tool",27);function s(r,a){let l=n.get(r);return typeof l>"u"&&!a&&(l=9),l}o.fromString=s})(S_||(S_={}));var js;(function(o){o[o.Automatic=0]="Automatic",o[o.Explicit=1]="Explicit"})(js||(js={}));class Zz{constructor(e,t,i,n){this.range=e,this.text=t,this.completionKind=i,this.isSnippetText=n}equals(e){return k.lift(this.range).equalsRange(e.range)&&this.text===e.text&&this.completionKind===e.completionKind&&this.isSnippetText===e.isSnippetText}}var VM;(function(o){o[o.Code=1]="Code",o[o.Label=2]="Label"})(VM||(VM={}));class XL{static fromExtensionId(e){return new XL(e,void 0,void 0)}constructor(e,t,i){this.extensionId=e,this.extensionVersion=t,this.providerId=i}toString(){let e="";return this.extensionId&&(e+=this.extensionId),this.extensionVersion&&(e+=`@${this.extensionVersion}`),this.providerId&&(e+=`:${this.providerId}`),e.length===0&&(e="unknown"),e}}var Bf;(function(o){o[o.Accepted=0]="Accepted",o[o.Rejected=1]="Rejected",o[o.Ignored=2]="Ignored"})(Bf||(Bf={}));var av;(function(o){o[o.Automatic=0]="Automatic",o[o.PasteAs=1]="PasteAs"})(av||(av={}));var yl;(function(o){o[o.Invoke=1]="Invoke",o[o.TriggerCharacter=2]="TriggerCharacter",o[o.ContentChange=3]="ContentChange"})(yl||(yl={}));var y_;(function(o){o[o.Text=0]="Text",o[o.Read=1]="Read",o[o.Write=2]="Write"})(y_||(y_={}));function Bhe(o){return o&&be.isUri(o.uri)&&k.isIRange(o.range)&&(k.isIRange(o.originSelectionRange)||k.isIRange(o.targetSelectionRange))}const Hhe={17:p(753,"array"),16:p(754,"boolean"),4:p(755,"class"),13:p(756,"constant"),8:p(757,"constructor"),9:p(758,"enumeration"),21:p(759,"enumeration member"),23:p(760,"event"),7:p(761,"field"),0:p(762,"file"),11:p(763,"function"),10:p(764,"interface"),19:p(765,"key"),5:p(766,"method"),1:p(767,"module"),2:p(768,"namespace"),20:p(769,"null"),15:p(770,"number"),18:p(771,"object"),24:p(772,"operator"),3:p(773,"package"),6:p(774,"property"),14:p(775,"string"),22:p(776,"struct"),25:p(777,"type parameter"),12:p(778,"variable")};function Vhe(o,e){return p(779,"{0} ({1})",o,Hhe[e])}var QL;(function(o){const e=new Map;e.set(0,Y.symbolFile),e.set(1,Y.symbolModule),e.set(2,Y.symbolNamespace),e.set(3,Y.symbolPackage),e.set(4,Y.symbolClass),e.set(5,Y.symbolMethod),e.set(6,Y.symbolProperty),e.set(7,Y.symbolField),e.set(8,Y.symbolConstructor),e.set(9,Y.symbolEnum),e.set(10,Y.symbolInterface),e.set(11,Y.symbolFunction),e.set(12,Y.symbolVariable),e.set(13,Y.symbolConstant),e.set(14,Y.symbolString),e.set(15,Y.symbolNumber),e.set(16,Y.symbolBoolean),e.set(17,Y.symbolArray),e.set(18,Y.symbolObject),e.set(19,Y.symbolKey),e.set(20,Y.symbolNull),e.set(21,Y.symbolEnumMember),e.set(22,Y.symbolStruct),e.set(23,Y.symbolEvent),e.set(24,Y.symbolOperator),e.set(25,Y.symbolTypeParameter);function t(s){let r=e.get(s);return r||(console.info("No codicon found for SymbolKind "+s),r=Y.symbolProperty),r}o.toIcon=t;const i=new Map;i.set(0,20),i.set(1,8),i.set(2,8),i.set(3,8),i.set(4,5),i.set(5,0),i.set(6,9),i.set(7,3),i.set(8,2),i.set(9,15),i.set(10,7),i.set(11,1),i.set(12,4),i.set(13,14),i.set(14,18),i.set(15,13),i.set(16,13),i.set(17,13),i.set(18,13),i.set(19,17),i.set(20,13),i.set(21,16),i.set(22,6),i.set(23,10),i.set(24,11),i.set(25,24);function n(s){let r=i.get(s);return r===void 0&&(console.info("No completion kind found for SymbolKind "+s),r=20),r}o.toCompletionKind=n})(QL||(QL={}));const ha=class ha{static fromValue(e){switch(e){case"comment":return ha.Comment;case"imports":return ha.Imports;case"region":return ha.Region}return new ha(e)}constructor(e){this.value=e}};ha.Comment=new ha("comment"),ha.Imports=new ha("imports"),ha.Region=new ha("region");let $c=ha;var zM;(function(o){o[o.AIGenerated=1]="AIGenerated"})(zM||(zM={}));var lv;(function(o){o[o.Invoke=0]="Invoke",o[o.Automatic=1]="Automatic"})(lv||(lv={}));var UM;(function(o){function e(t){return!t||typeof t!="object"?!1:typeof t.id=="string"&&typeof t.title=="string"}o.is=e})(UM||(UM={}));var JL;(function(o){o[o.Type=1]="Type",o[o.Parameter=2]="Parameter"})(JL||(JL={}));class zhe{constructor(e){this.createSupport=e,this._tokenizationSupport=null}dispose(){this._tokenizationSupport&&this._tokenizationSupport.then(e=>{e&&e.dispose()})}get tokenizationSupport(){return this._tokenizationSupport||(this._tokenizationSupport=this.createSupport()),this._tokenizationSupport}}const di=new Fhe,uN=class uN extends A{static getInstance(){return this._INSTANCE||(this._INSTANCE=new uN),this._INSTANCE}constructor(){super(),this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._updateColorMap(),this._register(di.onDidChange(e=>{e.changedColorMap&&this._updateColorMap()}))}_updateColorMap(){const e=di.getColorMap();if(!e){this._colors=[Uc.Empty],this._backgroundIsLight=!0;return}this._colors=[Uc.Empty];for(let i=1;i<e.length;i++){const n=e[i].rgba;this._colors[i]=new Uc(n.r,n.g,n.b,Math.round(n.a*255))}const t=e[2].getRelativeLuminance();this._backgroundIsLight=t>=.5,this._onDidChange.fire(void 0)}getColor(e){return(e<1||e>=this._colors.length)&&(e=2),this._colors[e]}backgroundIsLight(){return this._backgroundIsLight}};uN._INSTANCE=null;let ex=uN;const Uhe=(()=>{const o=[];for(let e=32;e<=126;e++)o.push(e);return o.push(65533),o})(),$he=(o,e)=>(o-=32,o<0||o>96?e<=2?(o+96)%96:95:o);class cv{constructor(e,t){this.scale=t,this._minimapCharRendererBrand=void 0,this.charDataNormal=cv.soften(e,12/15),this.charDataLight=cv.soften(e,50/60)}static soften(e,t){const i=new Uint8ClampedArray(e.length);for(let n=0,s=e.length;n<s;n++)i[n]=qy(e[n]*t);return i}renderChar(e,t,i,n,s,r,a,l,c,d,h){const u=1*this.scale,f=2*this.scale,g=h?1:f;if(t+u>e.width||i+g>e.height){console.warn("bad render request outside image data");return}const m=d?this.charDataLight:this.charDataNormal,_=$he(n,c),b=e.width*4,C=a.r,w=a.g,v=a.b,S=s.r-C,L=s.g-w,x=s.b-v,I=Math.max(r,l),D=e.data;let R=_*u*f,F=i*b+t*4;for(let O=0;O<g;O++){let B=F;for(let V=0;V<u;V++){const z=m[R++]/255*(r/255);D[B++]=C+S*z,D[B++]=w+L*z,D[B++]=v+x*z,D[B++]=I}F+=b}}blockRenderChar(e,t,i,n,s,r,a,l){const c=1*this.scale,d=2*this.scale,h=l?1:d;if(t+c>e.width||i+h>e.height){console.warn("bad render request outside image data");return}const u=e.width*4,f=.5*(s/255),g=r.r,m=r.g,_=r.b,b=n.r-g,C=n.g-m,w=n.b-_,v=g+b*f,S=m+C*f,L=_+w*f,x=Math.max(s,a),I=e.data;let D=i*u+t*4;for(let R=0;R<h;R++){let F=D;for(let O=0;O<c;O++)I[F++]=v,I[F++]=S,I[F++]=L,I[F++]=x;D+=u}}}const Yz={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,A:10,B:11,C:12,D:13,E:14,F:15},Xz=o=>{const e=new Uint8ClampedArray(o.length/2);for(let t=0;t<o.length;t+=2)e[t>>1]=Yz[o[t]]<<4|Yz[o[t+1]]&15;return e},Qz={1:Yu(()=>Xz("0000511D6300CF609C709645A78432005642574171487021003C451900274D35D762755E8B629C5BA856AF57BA649530C167D1512A272A3F6038604460398526BCA2A968DB6F8957C768BE5FBE2FB467CF5D8D5B795DC7625B5DFF50DE64C466DB2FC47CD860A65E9A2EB96CB54CE06DA763AB2EA26860524D3763536601005116008177A8705E53AB738E6A982F88BAA35B5F5B626D9C636B449B737E5B7B678598869A662F6B5B8542706C704C80736A607578685B70594A49715A4522E792")),2:Yu(()=>Xz("000000000000000055394F383D2800008B8B1F210002000081B1CBCBCC820000847AAF6B9AAF2119BE08B8881AD60000A44FD07DCCF107015338130C00000000385972265F390B406E2437634B4B48031B12B8A0847000001E15B29A402F0000000000004B33460B00007A752C2A0000000000004D3900000084394B82013400ABA5CFC7AD9C0302A45A3E5A98AB000089A43382D97900008BA54AA087A70A0248A6A7AE6DBE0000BF6F94987EA40A01A06DCFA7A7A9030496C32F77891D0000A99FB1A0AFA80603B29AB9CA75930D010C0948354D3900000C0948354F37460D0028BE673D8400000000AF9D7B6E00002B007AA8933400007AA642675C2700007984CFB9C3985B768772A8A6B7B20000CAAECAAFC4B700009F94A6009F840009D09F9BA4CA9C0000CC8FC76DC87F0000C991C472A2000000A894A48CA7B501079BA2C9C69BA20000B19A5D3FA89000005CA6009DA2960901B0A7F0669FB200009D009E00B7890000DAD0F5D092820000D294D4C48BD10000B5A7A4A3B1A50402CAB6CBA6A2000000B5A7A4A3B1A8044FCDADD19D9CB00000B7778F7B8AAE0803C9AB5D3F5D3F00009EA09EA0BAB006039EA0989A8C7900009B9EF4D6B7C00000A9A7816CACA80000ABAC84705D3F000096DA635CDC8C00006F486F266F263D4784006124097B00374F6D2D6D2D6D4A3A95872322000000030000000000008D8939130000000000002E22A5C9CBC70600AB25C0B5C9B400061A2DB04CA67001082AA6BEBEBFC606002321DACBC19E03087AA08B6768380000282FBAC0B8CA7A88AD25BBA5A29900004C396C5894A6000040485A6E356E9442A32CD17EADA70000B4237923628600003E2DE9C1D7B500002F25BBA5A2990000231DB6AFB4A804023025C0B5CAB588062B2CBDBEC0C706882435A75CA20000002326BD6A82A908048B4B9A5A668000002423A09CB4BB060025259C9D8A7900001C1FCAB2C7C700002A2A9387ABA200002626A4A47D6E9D14333163A0C87500004B6F9C2D643A257049364936493647358A34438355497F1A0000A24C1D590000D38DFFBDD4CD3126"))};class dv{static create(e,t){if(this.lastCreated&&e===this.lastCreated.scale&&t===this.lastFontFamily)return this.lastCreated;let i;return Qz[e]?i=new cv(Qz[e](),e):i=dv.createFromSampleData(dv.createSampleData(t).data,e),this.lastFontFamily=t,this.lastCreated=i,i}static createSampleData(e){const t=document.createElement("canvas"),i=t.getContext("2d");t.style.height="16px",t.height=16,t.width=960,t.style.width="960px",i.fillStyle="#ffffff",i.font=`bold 16px ${e}`,i.textBaseline="middle";let n=0;for(const s of Uhe)i.fillText(String.fromCharCode(s),n,16/2),n+=10;return i.getImageData(0,0,960,16)}static createFromSampleData(e,t){if(e.length!==61440)throw new Error("Unexpected source in MinimapCharRenderer");const n=dv._downsample(e,t);return new cv(n,t)}static _downsampleChar(e,t,i,n,s){const r=1*s,a=2*s;let l=n,c=0;for(let d=0;d<a;d++){const h=d/a*16,u=(d+1)/a*16;for(let f=0;f<r;f++){const g=f/r*10,m=(f+1)/r*10;let _=0,b=0;for(let w=h;w<u;w++){const v=t+Math.floor(w)*3840,S=1-(w-Math.floor(w));for(let L=g;L<m;L++){const x=1-(L-Math.floor(L)),I=v+Math.floor(L)*4,D=x*S;b+=D,_+=e[I]*e[I+3]/255*D}}const C=_/b;c=Math.max(c,C),i[l++]=qy(C)}}return c}static _downsample(e,t){const i=2*t*1*t,n=i*96,s=new Uint8ClampedArray(n);let r=0,a=0,l=0;for(let c=0;c<96;c++)l=Math.max(l,this._downsampleChar(e,a,s,r,t)),r+=i,a+=40;if(l>0){const c=255/l;for(let d=0;d<n;d++)s[d]*=c}return s}}const jhe=gn?'"Segoe WPC", "Segoe UI", sans-serif':ze?"-apple-system, BlinkMacSystemFont, sans-serif":'system-ui, "Ubuntu", "Droid Sans", sans-serif';class Jz{constructor(e,t){this._viewModelDecorationBrand=void 0,this.range=e,this.options=t}}function $M(o,e){return!(e.options.hideInCommentTokens&&jM(o,e)||e.options.hideInStringTokens&&qM(o,e))}function jM(o,e){return eU(o,e.range,t=>t===1)}function qM(o,e){return eU(o,e.range,t=>t===2)}function eU(o,e,t){for(let i=e.startLineNumber;i<=e.endLineNumber;i++){const n=o.tokenization.getLineTokens(i),s=i===e.startLineNumber,r=i===e.endLineNumber;let a=s?n.findTokenIndexAtOffset(e.startColumn-1):0;for(;a<n.getCount()&&!(r&&n.getStartOffset(a)>e.endColumn-1);){if(!t(n.getStandardTokenType(a)))return!1;a++}}return!0}const qhe=140,Khe=2;class L_{constructor(e,t,i){const n=e.options,s=n.get(163),r=n.get(165),a=r.minimap,l=n.get(59),c=n.get(81);this.renderMinimap=a.renderMinimap,this.size=c.size,this.minimapHeightIsEditorHeight=a.minimapHeightIsEditorHeight,this.scrollBeyondLastLine=n.get(119),this.paddingTop=n.get(96).top,this.paddingBottom=n.get(96).bottom,this.showSlider=c.showSlider,this.autohide=c.autohide,this.pixelRatio=s,this.typicalHalfwidthCharacterWidth=l.typicalHalfwidthCharacterWidth,this.lineHeight=n.get(75),this.minimapLeft=a.minimapLeft,this.minimapWidth=a.minimapWidth,this.minimapHeight=r.height,this.canvasInnerWidth=a.minimapCanvasInnerWidth,this.canvasInnerHeight=a.minimapCanvasInnerHeight,this.canvasOuterWidth=a.minimapCanvasOuterWidth,this.canvasOuterHeight=a.minimapCanvasOuterHeight,this.isSampling=a.minimapIsSampling,this.editorHeight=r.height,this.fontScale=a.minimapScale,this.minimapLineHeight=a.minimapLineHeight,this.minimapCharWidth=1*this.fontScale,this.sectionHeaderFontFamily=jhe,this.sectionHeaderFontSize=c.sectionHeaderFontSize*s,this.sectionHeaderLetterSpacing=c.sectionHeaderLetterSpacing,this.sectionHeaderFontColor=L_._getSectionHeaderColor(t,i.getColor(1)),this.charRenderer=Yu(()=>dv.create(this.fontScale,l.fontFamily)),this.defaultBackgroundColor=i.getColor(2),this.backgroundColor=L_._getMinimapBackground(t,this.defaultBackgroundColor),this.foregroundAlpha=L_._getMinimapForegroundOpacity(t)}static _getMinimapBackground(e,t){const i=e.getColor(_le);return i?new Uc(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}static _getMinimapForegroundOpacity(e){const t=e.getColor(ble);return t?Uc._clamp(Math.round(255*t.rgba.a)):255}static _getSectionHeaderColor(e,t){const i=e.getColor(bl);return i?new Uc(i.rgba.r,i.rgba.g,i.rgba.b,Math.round(255*i.rgba.a)):t}equals(e){return this.renderMinimap===e.renderMinimap&&this.size===e.size&&this.minimapHeightIsEditorHeight===e.minimapHeightIsEditorHeight&&this.scrollBeyondLastLine===e.scrollBeyondLastLine&&this.paddingTop===e.paddingTop&&this.paddingBottom===e.paddingBottom&&this.showSlider===e.showSlider&&this.autohide===e.autohide&&this.pixelRatio===e.pixelRatio&&this.typicalHalfwidthCharacterWidth===e.typicalHalfwidthCharacterWidth&&this.lineHeight===e.lineHeight&&this.minimapLeft===e.minimapLeft&&this.minimapWidth===e.minimapWidth&&this.minimapHeight===e.minimapHeight&&this.canvasInnerWidth===e.canvasInnerWidth&&this.canvasInnerHeight===e.canvasInnerHeight&&this.canvasOuterWidth===e.canvasOuterWidth&&this.canvasOuterHeight===e.canvasOuterHeight&&this.isSampling===e.isSampling&&this.editorHeight===e.editorHeight&&this.fontScale===e.fontScale&&this.minimapLineHeight===e.minimapLineHeight&&this.minimapCharWidth===e.minimapCharWidth&&this.sectionHeaderFontSize===e.sectionHeaderFontSize&&this.sectionHeaderLetterSpacing===e.sectionHeaderLetterSpacing&&this.defaultBackgroundColor&&this.defaultBackgroundColor.equals(e.defaultBackgroundColor)&&this.backgroundColor&&this.backgroundColor.equals(e.backgroundColor)&&this.foregroundAlpha===e.foregroundAlpha}}class hv{constructor(e,t,i,n,s,r,a,l,c){this.scrollTop=e,this.scrollHeight=t,this.sliderNeeded=i,this._computedSliderRatio=n,this.sliderTop=s,this.sliderHeight=r,this.topPaddingLineCount=a,this.startLineNumber=l,this.endLineNumber=c}getDesiredScrollTopFromDelta(e){return Math.round(this.scrollTop+e/this._computedSliderRatio)}getDesiredScrollTopFromTouchLocation(e){return Math.round((e-this.sliderHeight/2)/this._computedSliderRatio)}intersectWithViewport(e){const t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumber,e.endLineNumber);return t>i?null:[t,i]}getYForLineNumber(e,t){return+(e-this.startLineNumber+this.topPaddingLineCount)*t}static create(e,t,i,n,s,r,a,l,c,d,h){const u=e.pixelRatio,f=e.minimapLineHeight,g=Math.floor(e.canvasInnerHeight/f),m=e.lineHeight;if(e.minimapHeightIsEditorHeight){let L=l*e.lineHeight+e.paddingTop+e.paddingBottom;e.scrollBeyondLastLine&&(L+=Math.max(0,s-e.lineHeight-e.paddingBottom));const x=Math.max(1,Math.floor(s*s/L)),I=Math.max(0,e.minimapHeight-x),D=I/(d-s),R=c*D,F=I>0,O=Math.floor(e.canvasInnerHeight/e.minimapLineHeight),B=Math.floor(e.paddingTop/e.lineHeight);return new hv(c,d,F,D,R,x,B,1,Math.min(a,O))}let _;if(r&&i!==a){const L=i-t+1;_=Math.floor(L*f/u)}else{const L=s/m;_=Math.floor(L*f/u)}const b=Math.floor(e.paddingTop/m);let C=Math.floor(e.paddingBottom/m);if(e.scrollBeyondLastLine){const L=s/m;C=Math.max(C,L-1)}let w;if(C>0){const L=s/m;w=(b+a+C-L-1)*f/u}else w=Math.max(0,(b+a)*f/u-_);w=Math.min(e.minimapHeight-_,w);const v=w/(d-s),S=c*v;if(g>=b+a+C){const L=w>0;return new hv(c,d,L,v,S,_,b,1,a)}else{let L;t>1?L=t+b:L=Math.max(1,c/m);let x,I=Math.max(1,Math.floor(L-S*u/f));I<b?(x=b-I+1,I=1):(x=0,I=Math.max(1,I-b)),h&&h.scrollHeight===d&&(h.scrollTop>c&&(I=Math.min(I,h.startLineNumber),x=Math.max(x,h.topPaddingLineCount)),h.scrollTop<c&&(I=Math.max(I,h.startLineNumber),x=Math.min(x,h.topPaddingLineCount)));const D=Math.min(a,I-x+g-1),R=(c-n)/m;let F;return c>=e.paddingTop?F=(t-I+x+R)*f/u:F=c/e.paddingTop*(x+R)*f/u,new hv(c,d,!0,v,F,_,x,I,D)}}}const fN=class fN{constructor(e){this.dy=e}onContentChanged(){this.dy=-1}onTokensChanged(){this.dy=-1}};fN.INVALID=new fN(-1);let tx=fN;class tU{constructor(e,t,i){this.renderedLayout=e,this._imageData=t,this._renderedLines=new kz({createLine:()=>tx.INVALID}),this._renderedLines._set(e.startLineNumber,i)}linesEquals(e){if(!this.scrollEquals(e))return!1;const i=this._renderedLines._get().lines;for(let n=0,s=i.length;n<s;n++)if(i[n].dy===-1)return!1;return!0}scrollEquals(e){return this.renderedLayout.startLineNumber===e.startLineNumber&&this.renderedLayout.endLineNumber===e.endLineNumber}_get(){const e=this._renderedLines._get();return{imageData:this._imageData,rendLineNumberStart:e.rendLineNumberStart,lines:e.lines}}onLinesChanged(e,t){return this._renderedLines.onLinesChanged(e,t)}onLinesDeleted(e,t){this._renderedLines.onLinesDeleted(e,t)}onLinesInserted(e,t){this._renderedLines.onLinesInserted(e,t)}onTokensChanged(e){return this._renderedLines.onTokensChanged(e)}}class KM{constructor(e,t,i,n){this._backgroundFillData=KM._createBackgroundFillData(t,i,n),this._buffers=[e.createImageData(t,i),e.createImageData(t,i)],this._lastUsedBuffer=0}getBuffer(){this._lastUsedBuffer=1-this._lastUsedBuffer;const e=this._buffers[this._lastUsedBuffer];return e.data.set(this._backgroundFillData),e}static _createBackgroundFillData(e,t,i){const n=i.r,s=i.g,r=i.b,a=i.a,l=new Uint8ClampedArray(e*t*4);let c=0;for(let d=0;d<t;d++)for(let h=0;h<e;h++)l[c]=n,l[c+1]=s,l[c+2]=r,l[c+3]=a,c+=4;return l}}class uv{static compute(e,t,i){if(e.renderMinimap===0||!e.isSampling)return[null,[]];const{minimapLineCount:n}=t_.computeContainedMinimapLineCount({viewLineCount:t,scrollBeyondLastLine:e.scrollBeyondLastLine,paddingTop:e.paddingTop,paddingBottom:e.paddingBottom,height:e.editorHeight,lineHeight:e.lineHeight,pixelRatio:e.pixelRatio}),s=t/n,r=s/2;if(!i||i.minimapLines.length===0){const _=[];if(_[0]=1,n>1){for(let b=0,C=n-1;b<C;b++)_[b]=Math.round(b*s+r);_[n-1]=t}return[new uv(s,_),[]]}const a=i.minimapLines,l=a.length,c=[];let d=0,h=0,u=1;const f=10;let g=[],m=null;for(let _=0;_<n;_++){const b=Math.max(u,Math.round(_*s)),C=Math.max(b,Math.round((_+1)*s));for(;d<l&&a[d]<b;){if(g.length<f){const v=d+1+h;m&&m.type==="deleted"&&m._oldIndex===d-1?m.deleteToLineNumber++:(m={type:"deleted",_oldIndex:d,deleteFromLineNumber:v,deleteToLineNumber:v},g.push(m)),h--}d++}let w;if(d<l&&a[d]<=C)w=a[d],d++;else if(_===0?w=1:_+1===n?w=t:w=Math.round(_*s+r),g.length<f){const v=d+1+h;m&&m.type==="inserted"&&m._i===_-1?m.insertToLineNumber++:(m={type:"inserted",_i:_,insertFromLineNumber:v,insertToLineNumber:v},g.push(m)),h++}c[_]=w,u=w}if(g.length<f)for(;d<l;){const _=d+1+h;m&&m.type==="deleted"&&m._oldIndex===d-1?m.deleteToLineNumber++:(m={type:"deleted",_oldIndex:d,deleteFromLineNumber:_,deleteToLineNumber:_},g.push(m)),h--,d++}else g=[{type:"flush"}];return[new uv(s,c),g]}constructor(e,t){this.samplingRatio=e,this.minimapLines=t}modelLineToMinimapLine(e){return Math.min(this.minimapLines.length,Math.max(1,Math.round(e/this.samplingRatio)))}modelLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e)-1;for(;i>0&&this.minimapLines[i-1]>=e;)i--;let n=this.modelLineToMinimapLine(t)-1;for(;n+1<this.minimapLines.length&&this.minimapLines[n+1]<=t;)n++;if(i===n){const s=this.minimapLines[i];if(s<e||s>t)return null}return[i+1,n+1]}decorationLineRangeToMinimapLineRange(e,t){let i=this.modelLineToMinimapLine(e),n=this.modelLineToMinimapLine(t);return e!==t&&n===i&&(n===this.minimapLines.length?i>1&&i--:n++),[i,n]}onLinesDeleted(e){const t=e.toLineNumber-e.fromLineNumber+1;let i=this.minimapLines.length,n=0;for(let s=this.minimapLines.length-1;s>=0&&!(this.minimapLines[s]<e.fromLineNumber);s--)this.minimapLines[s]<=e.toLineNumber?(this.minimapLines[s]=Math.max(1,e.fromLineNumber-1),i=Math.min(i,s),n=Math.max(n,s)):this.minimapLines[s]-=t;return[i,n]}onLinesInserted(e){const t=e.toLineNumber-e.fromLineNumber+1;for(let i=this.minimapLines.length-1;i>=0&&!(this.minimapLines[i]<e.fromLineNumber);i--)this.minimapLines[i]+=t}}class Ghe extends vs{constructor(e){super(e),this._sectionHeaderCache=new dl(10,1.5),this.tokensColorTracker=ex.getInstance(),this._selections=[],this._minimapSelections=null,this.options=new L_(this._context.configuration,this._context.theme,this.tokensColorTracker);const[t]=uv.compute(this.options,this._context.viewModel.getLineCount(),null);this._samplingState=t,this._shouldCheckSampling=!1,this._actual=new x_(e.theme,this)}dispose(){this._actual.dispose(),super.dispose()}getDomNode(){return this._actual.getDomNode()}_onOptionsMaybeChanged(){const e=new L_(this._context.configuration,this._context.theme,this.tokensColorTracker);return this.options.equals(e)?!1:(this.options=e,this._recreateLineSampling(),this._actual.onDidChangeOptions(),!0)}onConfigurationChanged(e){return this._onOptionsMaybeChanged()}onCursorStateChanged(e){return this._selections=e.selections,this._minimapSelections=null,this._actual.onSelectionChanged()}onDecorationsChanged(e){return e.affectsMinimap?this._actual.onDecorationsChanged():!1}onFlushed(e){return this._samplingState&&(this._shouldCheckSampling=!0),this._actual.onFlushed()}onLinesChanged(e){if(this._samplingState){const t=this._samplingState.modelLineRangeToMinimapLineRange(e.fromLineNumber,e.fromLineNumber+e.count-1);return t?this._actual.onLinesChanged(t[0],t[1]-t[0]+1):!1}else return this._actual.onLinesChanged(e.fromLineNumber,e.count)}onLinesDeleted(e){if(this._samplingState){const[t,i]=this._samplingState.onLinesDeleted(e);return t<=i&&this._actual.onLinesChanged(t+1,i-t+1),this._shouldCheckSampling=!0,!0}else return this._actual.onLinesDeleted(e.fromLineNumber,e.toLineNumber)}onLinesInserted(e){return this._samplingState?(this._samplingState.onLinesInserted(e),this._shouldCheckSampling=!0,!0):this._actual.onLinesInserted(e.fromLineNumber,e.toLineNumber)}onScrollChanged(e){return this._actual.onScrollChanged(e)}onThemeChanged(e){return this._actual.onThemeChanged(),this._onOptionsMaybeChanged(),!0}onTokensChanged(e){if(this._samplingState){const t=[];for(const i of e.ranges){const n=this._samplingState.modelLineRangeToMinimapLineRange(i.fromLineNumber,i.toLineNumber);n&&t.push({fromLineNumber:n[0],toLineNumber:n[1]})}return t.length?this._actual.onTokensChanged(t):!1}else return this._actual.onTokensChanged(e.ranges)}onTokensColorsChanged(e){return this._onOptionsMaybeChanged(),this._actual.onTokensColorsChanged()}onZonesChanged(e){return this._actual.onZonesChanged()}prepareRender(e){this._shouldCheckSampling&&(this._shouldCheckSampling=!1,this._recreateLineSampling())}render(e){let t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber;this._samplingState&&(t=this._samplingState.modelLineToMinimapLine(t),i=this._samplingState.modelLineToMinimapLine(i));const n={viewportContainsWhitespaceGaps:e.viewportData.whitespaceViewportData.length>0,scrollWidth:e.scrollWidth,scrollHeight:e.scrollHeight,viewportStartLineNumber:t,viewportEndLineNumber:i,viewportStartLineNumberVerticalOffset:e.getVerticalOffsetForLineNumber(t),scrollTop:e.scrollTop,scrollLeft:e.scrollLeft,viewportWidth:e.viewportWidth,viewportHeight:e.viewportHeight};this._actual.render(n)}_recreateLineSampling(){this._minimapSelections=null;const e=!!this._samplingState,[t,i]=uv.compute(this.options,this._context.viewModel.getLineCount(),this._samplingState);if(this._samplingState=t,e&&this._samplingState)for(const n of i)switch(n.type){case"deleted":this._actual.onLinesDeleted(n.deleteFromLineNumber,n.deleteToLineNumber);break;case"inserted":this._actual.onLinesInserted(n.insertFromLineNumber,n.insertToLineNumber);break;case"flush":this._actual.onFlushed();break}}getLineCount(){return this._samplingState?this._samplingState.minimapLines.length:this._context.viewModel.getLineCount()}getRealLineCount(){return this._context.viewModel.getLineCount()}getLineContent(e){return this._samplingState?this._context.viewModel.getLineContent(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineContent(e)}getLineMaxColumn(e){return this._samplingState?this._context.viewModel.getLineMaxColumn(this._samplingState.minimapLines[e-1]):this._context.viewModel.getLineMaxColumn(e)}getMinimapLinesRenderingData(e,t,i){if(this._samplingState){const n=[];for(let s=0,r=t-e+1;s<r;s++)i[s]?n[s]=this._context.viewModel.getViewLineData(this._samplingState.minimapLines[e+s-1]):n[s]=null;return n}return this._context.viewModel.getMinimapLinesRenderingData(e,t,i).data}getSelections(){if(this._minimapSelections===null)if(this._samplingState){this._minimapSelections=[];for(const e of this._selections){const[t,i]=this._samplingState.decorationLineRangeToMinimapLineRange(e.startLineNumber,e.endLineNumber);this._minimapSelections.push(new ce(t,e.startColumn,i,e.endColumn))}}else this._minimapSelections=this._selections;return this._minimapSelections}getMinimapDecorationsInViewport(e,t){return this._getMinimapDecorationsInViewport(e,t).filter(i=>!i.options.minimap?.sectionHeaderStyle)}getSectionHeaderDecorationsInViewport(e,t){const i=this.options.sectionHeaderFontSize/this.options.minimapLineHeight;return e=Math.floor(Math.max(1,e-i)),this._getMinimapDecorationsInViewport(e,t).filter(n=>!!n.options.minimap?.sectionHeaderStyle)}_getMinimapDecorationsInViewport(e,t){let i;if(this._samplingState){const s=this._samplingState.minimapLines[e-1],r=this._samplingState.minimapLines[t-1];i=new k(s,1,r,this._context.viewModel.getLineMaxColumn(r))}else i=new k(e,1,t,this._context.viewModel.getLineMaxColumn(t));const n=this._context.viewModel.getMinimapDecorationsInRange(i);if(this._samplingState){const s=[];for(const r of n){if(!r.options.minimap)continue;const a=r.range,l=this._samplingState.modelLineToMinimapLine(a.startLineNumber),c=this._samplingState.modelLineToMinimapLine(a.endLineNumber);s.push(new Jz(new k(l,a.startColumn,c,a.endColumn),r.options))}return s}return n}getSectionHeaderText(e,t){const i=e.options.minimap?.sectionHeaderText;if(!i)return null;const n=this._sectionHeaderCache.get(i);if(n)return n;const s=t(i);return this._sectionHeaderCache.set(i,s),s}getOptions(){return this._context.viewModel.model.getOptions()}revealLineNumber(e){this._samplingState&&(e=this._samplingState.minimapLines[e-1]),this._context.viewModel.revealRange("mouse",!1,new k(e,1,e,1),1,0)}setScrollTop(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e},1)}}class x_ extends A{constructor(e,t){super(),this._renderDecorations=!1,this._gestureInProgress=!1,this._isMouseOverMinimap=!1,this._theme=e,this._model=t,this._lastRenderData=null,this._buffers=null,this._selectionColor=this._theme.getColor(XV),this._domNode=lt(document.createElement("div")),Na.write(this._domNode,9),this._domNode.setClassName(this._getMinimapDomNodeClassName()),this._domNode.setPosition("absolute"),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._shadow=lt(document.createElement("div")),this._shadow.setClassName("minimap-shadow-hidden"),this._domNode.appendChild(this._shadow),this._canvas=lt(document.createElement("canvas")),this._canvas.setPosition("absolute"),this._canvas.setLeft(0),this._domNode.appendChild(this._canvas),this._decorationsCanvas=lt(document.createElement("canvas")),this._decorationsCanvas.setPosition("absolute"),this._decorationsCanvas.setClassName("minimap-decorations-layer"),this._decorationsCanvas.setLeft(0),this._domNode.appendChild(this._decorationsCanvas),this._slider=lt(document.createElement("div")),this._slider.setPosition("absolute"),this._slider.setClassName("minimap-slider"),this._slider.setLayerHinting(!0),this._slider.setContain("strict"),this._domNode.appendChild(this._slider),this._sliderHorizontal=lt(document.createElement("div")),this._sliderHorizontal.setPosition("absolute"),this._sliderHorizontal.setClassName("minimap-slider-horizontal"),this._slider.appendChild(this._sliderHorizontal),this._applyLayout(),this._hideDelayedScheduler=this._register(new wt(()=>this._hideImmediatelyIfMouseIsOutside(),500)),this._register(Si(this._domNode.domNode,te.MOUSE_OVER,()=>{this._isMouseOverMinimap=!0})),this._register(Si(this._domNode.domNode,te.MOUSE_LEAVE,()=>{this._isMouseOverMinimap=!1})),this._pointerDownListener=Si(this._domNode.domNode,te.POINTER_DOWN,i=>{i.preventDefault();const n=i.pointerType==="mouse",s=i.button===0;if(this._model.options.renderMinimap!==0&&this._lastRenderData){if(this._model.options.size!=="proportional"){if(s&&this._lastRenderData){const a=mi(this._slider.domNode),l=a.top+a.height/2;this._startSliderDragging(i,l,this._lastRenderData.renderedLayout)}return}if(s||!n){const a=this._model.options.minimapLineHeight,l=this._model.options.canvasInnerHeight/this._model.options.canvasOuterHeight*i.offsetY;let d=Math.floor(l/a)+this._lastRenderData.renderedLayout.startLineNumber-this._lastRenderData.renderedLayout.topPaddingLineCount;d=Math.min(d,this._model.getLineCount()),this._model.revealLineNumber(d)}}}),this._sliderPointerMoveMonitor=new r_,this._sliderPointerDownListener=Si(this._slider.domNode,te.POINTER_DOWN,i=>{i.preventDefault(),i.stopPropagation(),i.button===0&&this._lastRenderData&&this._startSliderDragging(i,i.pageY,this._lastRenderData.renderedLayout)}),this._gestureDisposable=$n.addTarget(this._domNode.domNode),this._sliderTouchStartListener=W(this._domNode.domNode,Pt.Start,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&(this._slider.toggleClassName("active",!0),this._gestureInProgress=!0,this.scrollDueToTouchEvent(i))},{passive:!1}),this._sliderTouchMoveListener=W(this._domNode.domNode,Pt.Change,i=>{i.preventDefault(),i.stopPropagation(),this._lastRenderData&&this._gestureInProgress&&this.scrollDueToTouchEvent(i)},{passive:!1}),this._sliderTouchEndListener=Si(this._domNode.domNode,Pt.End,i=>{i.preventDefault(),i.stopPropagation(),this._gestureInProgress=!1,this._slider.toggleClassName("active",!1)})}_hideSoon(){this._hideDelayedScheduler.cancel(),this._hideDelayedScheduler.schedule()}_hideImmediatelyIfMouseIsOutside(){if(this._isMouseOverMinimap){this._hideSoon();return}this._domNode.toggleClassName("active",!1)}_startSliderDragging(e,t,i){if(!e.target||!(e.target instanceof Element))return;const n=e.pageX;this._slider.toggleClassName("active",!0);const s=(r,a)=>{const l=mi(this._domNode.domNode),c=Math.min(Math.abs(a-n),Math.abs(a-l.left),Math.abs(a-l.left-l.width));if(gn&&c>qhe){this._model.setScrollTop(i.scrollTop);return}const d=r-t;this._model.setScrollTop(i.getDesiredScrollTopFromDelta(d))};e.pageY!==t&&s(e.pageY,n),this._sliderPointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,r=>s(r.pageY,r.pageX),()=>{this._slider.toggleClassName("active",!1)})}scrollDueToTouchEvent(e){const t=this._domNode.domNode.getBoundingClientRect().top,i=this._lastRenderData.renderedLayout.getDesiredScrollTopFromTouchLocation(e.pageY-t);this._model.setScrollTop(i)}dispose(){this._pointerDownListener.dispose(),this._sliderPointerMoveMonitor.dispose(),this._sliderPointerDownListener.dispose(),this._gestureDisposable.dispose(),this._sliderTouchStartListener.dispose(),this._sliderTouchMoveListener.dispose(),this._sliderTouchEndListener.dispose(),super.dispose()}_getMinimapDomNodeClassName(){const e=["minimap"];return this._model.options.showSlider==="always"?e.push("slider-always"):e.push("slider-mouseover"),this._model.options.autohide==="mouseover"?e.push("minimap-autohide-mouseover"):this._model.options.autohide==="scroll"&&e.push("minimap-autohide-scroll"),e.join(" ")}getDomNode(){return this._domNode}_applyLayout(){this._domNode.setLeft(this._model.options.minimapLeft),this._domNode.setWidth(this._model.options.minimapWidth),this._domNode.setHeight(this._model.options.minimapHeight),this._shadow.setHeight(this._model.options.minimapHeight),this._canvas.setWidth(this._model.options.canvasOuterWidth),this._canvas.setHeight(this._model.options.canvasOuterHeight),this._canvas.domNode.width=this._model.options.canvasInnerWidth,this._canvas.domNode.height=this._model.options.canvasInnerHeight,this._decorationsCanvas.setWidth(this._model.options.canvasOuterWidth),this._decorationsCanvas.setHeight(this._model.options.canvasOuterHeight),this._decorationsCanvas.domNode.width=this._model.options.canvasInnerWidth,this._decorationsCanvas.domNode.height=this._model.options.canvasInnerHeight,this._slider.setWidth(this._model.options.minimapWidth)}_getBuffer(){return this._buffers||this._model.options.canvasInnerWidth>0&&this._model.options.canvasInnerHeight>0&&(this._buffers=new KM(this._canvas.domNode.getContext("2d"),this._model.options.canvasInnerWidth,this._model.options.canvasInnerHeight,this._model.options.backgroundColor)),this._buffers?this._buffers.getBuffer():null}onDidChangeOptions(){this._lastRenderData=null,this._buffers=null,this._applyLayout(),this._domNode.setClassName(this._getMinimapDomNodeClassName())}onSelectionChanged(){return this._renderDecorations=!0,!0}onDecorationsChanged(){return this._renderDecorations=!0,!0}onFlushed(){return this._lastRenderData=null,!0}onLinesChanged(e,t){return this._lastRenderData?this._lastRenderData.onLinesChanged(e,t):!1}onLinesDeleted(e,t){return this._lastRenderData?.onLinesDeleted(e,t),!0}onLinesInserted(e,t){return this._lastRenderData?.onLinesInserted(e,t),!0}onScrollChanged(e){return this._model.options.autohide==="scroll"&&(e.scrollTopChanged||e.scrollHeightChanged)&&(this._domNode.toggleClassName("active",!0),this._hideSoon()),this._renderDecorations=!0,!0}onThemeChanged(){return this._selectionColor=this._theme.getColor(XV),this._renderDecorations=!0,!0}onTokensChanged(e){return this._lastRenderData?this._lastRenderData.onTokensChanged(e):!1}onTokensColorsChanged(){return this._lastRenderData=null,this._buffers=null,!0}onZonesChanged(){return this._lastRenderData=null,!0}render(e){if(this._model.options.renderMinimap===0){this._shadow.setClassName("minimap-shadow-hidden"),this._sliderHorizontal.setWidth(0),this._sliderHorizontal.setHeight(0);return}e.scrollLeft+e.viewportWidth>=e.scrollWidth?this._shadow.setClassName("minimap-shadow-hidden"):this._shadow.setClassName("minimap-shadow-visible");const i=hv.create(this._model.options,e.viewportStartLineNumber,e.viewportEndLineNumber,e.viewportStartLineNumberVerticalOffset,e.viewportHeight,e.viewportContainsWhitespaceGaps,this._model.getLineCount(),this._model.getRealLineCount(),e.scrollTop,e.scrollHeight,this._lastRenderData?this._lastRenderData.renderedLayout:null);this._slider.setDisplay(i.sliderNeeded?"block":"none"),this._slider.setTop(i.sliderTop),this._slider.setHeight(i.sliderHeight),this._sliderHorizontal.setLeft(0),this._sliderHorizontal.setWidth(this._model.options.minimapWidth),this._sliderHorizontal.setTop(0),this._sliderHorizontal.setHeight(i.sliderHeight),this.renderDecorations(i),this._lastRenderData=this.renderLines(i)}renderDecorations(e){if(this._renderDecorations){this._renderDecorations=!1;const t=this._model.getSelections();t.sort(k.compareRangesUsingStarts);const i=this._model.getMinimapDecorationsInViewport(e.startLineNumber,e.endLineNumber);i.sort((u,f)=>(u.options.zIndex||0)-(f.options.zIndex||0));const{canvasInnerWidth:n,canvasInnerHeight:s}=this._model.options,r=this._model.options.minimapLineHeight,a=this._model.options.minimapCharWidth,l=this._model.getOptions().tabSize,c=this._decorationsCanvas.domNode.getContext("2d");c.clearRect(0,0,n,s);const d=new iU(e.startLineNumber,e.endLineNumber,!1);this._renderSelectionLineHighlights(c,t,d,e,r),this._renderDecorationsLineHighlights(c,i,d,e,r);const h=new iU(e.startLineNumber,e.endLineNumber,null);this._renderSelectionsHighlights(c,t,h,e,r,l,a,n),this._renderDecorationsHighlights(c,i,h,e,r,l,a,n),this._renderSectionHeaders(e)}}_renderSelectionLineHighlights(e,t,i,n,s){if(!this._selectionColor||this._selectionColor.isTransparent())return;e.fillStyle=this._selectionColor.transparent(.5).toString();let r=0,a=0;for(const l of t){const c=n.intersectWithViewport(l);if(!c)continue;const[d,h]=c;for(let g=d;g<=h;g++)i.set(g,!0);const u=n.getYForLineNumber(d,s),f=n.getYForLineNumber(h,s);a>=u||(a>r&&e.fillRect(pl,r,e.canvas.width,a-r),r=u),a=f}a>r&&e.fillRect(pl,r,e.canvas.width,a-r)}_renderDecorationsLineHighlights(e,t,i,n,s){const r=new Map;for(let a=t.length-1;a>=0;a--){const l=t[a],c=l.options.minimap;if(!c||c.position!==1)continue;const d=n.intersectWithViewport(l.range);if(!d)continue;const[h,u]=d,f=c.getColor(this._theme.value);if(!f||f.isTransparent())continue;let g=r.get(f.toString());g||(g=f.transparent(.5).toString(),r.set(f.toString(),g)),e.fillStyle=g;for(let m=h;m<=u;m++){if(i.has(m))continue;i.set(m,!0);const _=n.getYForLineNumber(h,s);e.fillRect(pl,_,e.canvas.width,s)}}}_renderSelectionsHighlights(e,t,i,n,s,r,a,l){if(!(!this._selectionColor||this._selectionColor.isTransparent()))for(const c of t){const d=n.intersectWithViewport(c);if(!d)continue;const[h,u]=d;for(let f=h;f<=u;f++)this.renderDecorationOnLine(e,i,c,this._selectionColor,n,f,s,s,r,a,l)}}_renderDecorationsHighlights(e,t,i,n,s,r,a,l){for(const c of t){const d=c.options.minimap;if(!d)continue;const h=n.intersectWithViewport(c.range);if(!h)continue;const[u,f]=h,g=d.getColor(this._theme.value);if(!(!g||g.isTransparent()))for(let m=u;m<=f;m++)switch(d.position){case 1:this.renderDecorationOnLine(e,i,c.range,g,n,m,s,s,r,a,l);continue;case 2:{const _=n.getYForLineNumber(m,s);this.renderDecoration(e,g,2,_,Khe,s);continue}}}}renderDecorationOnLine(e,t,i,n,s,r,a,l,c,d,h){const u=s.getYForLineNumber(r,l);if(u+a<0||u>this._model.options.canvasInnerHeight)return;const{startLineNumber:f,endLineNumber:g}=i,m=f===r?i.startColumn:1,_=g===r?i.endColumn:this._model.getLineMaxColumn(r),b=this.getXOffsetForPosition(t,r,m,c,d,h),C=this.getXOffsetForPosition(t,r,_,c,d,h);this.renderDecoration(e,n,b,u,C-b,a)}getXOffsetForPosition(e,t,i,n,s,r){if(i===1)return pl;if((i-1)*s>=r)return r;let l=e.get(t);if(!l){const c=this._model.getLineContent(t);l=[pl];let d=pl;for(let h=1;h<c.length+1;h++){const u=c.charCodeAt(h-1),f=u===9?n*s:th(u)?2*s:s,g=d+f;if(g>=r){l[h]=r;break}l[h]=g,d=g}e.set(t,l)}return i-1<l.length?l[i-1]:r}renderDecoration(e,t,i,n,s,r){e.fillStyle=t&&t.toString()||"",e.fillRect(i,n,s,r)}_renderSectionHeaders(e){const t=this._model.options.minimapLineHeight,i=this._model.options.sectionHeaderFontSize,n=this._model.options.sectionHeaderLetterSpacing,s=i*1.5,{canvasInnerWidth:r}=this._model.options,a=this._model.options.backgroundColor,l=`rgb(${a.r} ${a.g} ${a.b} / .7)`,c=this._model.options.sectionHeaderFontColor,d=`rgb(${c.r} ${c.g} ${c.b})`,h=d,u=this._decorationsCanvas.domNode.getContext("2d");u.letterSpacing=n+"px",u.font="500 "+i+"px "+this._model.options.sectionHeaderFontFamily,u.strokeStyle=h,u.lineWidth=.4;const f=this._model.getSectionHeaderDecorationsInViewport(e.startLineNumber,e.endLineNumber);f.sort((m,_)=>m.range.startLineNumber-_.range.startLineNumber);const g=x_._fitSectionHeader.bind(null,u,r-pl);for(const m of f){const _=e.getYForLineNumber(m.range.startLineNumber,t)+i,b=_-i,C=b+2,w=this._model.getSectionHeaderText(m,g);x_._renderSectionLabel(u,w,m.options.minimap?.sectionHeaderStyle===2,l,d,r,b,s,_,C)}}static _fitSectionHeader(e,t,i){if(!i)return i;const n="…",s=e.measureText(i).width,r=e.measureText(n).width;if(s<=t||s<=r)return i;const a=i.length,l=s/i.length,c=Math.floor((t-r)/l)-1;let d=Math.ceil(c/2);for(;d>0&&/\s/.test(i[d-1]);)--d;return i.substring(0,d)+n+i.substring(a-(c-d))}static _renderSectionLabel(e,t,i,n,s,r,a,l,c,d){t&&(e.fillStyle=n,e.fillRect(0,a,r,l),e.fillStyle=s,e.fillText(t,pl,c)),i&&(e.beginPath(),e.moveTo(0,d),e.lineTo(r,d),e.closePath(),e.stroke())}renderLines(e){const t=e.startLineNumber,i=e.endLineNumber,n=this._model.options.minimapLineHeight;if(this._lastRenderData&&this._lastRenderData.linesEquals(e)){const z=this._lastRenderData._get();return new tU(e,z.imageData,z.lines)}const s=this._getBuffer();if(!s)return null;const[r,a,l]=x_._renderUntouchedLines(s,e.topPaddingLineCount,t,i,n,this._lastRenderData),c=this._model.getMinimapLinesRenderingData(t,i,l),d=this._model.getOptions().tabSize,h=this._model.options.defaultBackgroundColor,u=this._model.options.backgroundColor,f=this._model.options.foregroundAlpha,g=this._model.tokensColorTracker,m=g.backgroundIsLight(),_=this._model.options.renderMinimap,b=this._model.options.charRenderer(),C=this._model.options.fontScale,w=this._model.options.minimapCharWidth,S=(_===1?2:3)*C,L=n>S?Math.floor((n-S)/2):0,x=u.a/255,I=new Uc(Math.round((u.r-h.r)*x+h.r),Math.round((u.g-h.g)*x+h.g),Math.round((u.b-h.b)*x+h.b),255);let D=e.topPaddingLineCount*n;const R=[];for(let z=0,ee=i-t+1;z<ee;z++)l[z]&&x_._renderLine(s,I,u.a,m,_,w,g,f,b,D,L,d,c[z],C,n),R[z]=new tx(D),D+=n;const F=r===-1?0:r,B=(a===-1?s.height:a)-F;return this._canvas.domNode.getContext("2d").putImageData(s,0,0,0,F,s.width,B),new tU(e,s,R)}static _renderUntouchedLines(e,t,i,n,s,r){const a=[];if(!r){for(let D=0,R=n-i+1;D<R;D++)a[D]=!0;return[-1,-1,a]}const l=r._get(),c=l.imageData.data,d=l.rendLineNumberStart,h=l.lines,u=h.length,f=e.width,g=e.data,m=(n-i+1)*s*f*4;let _=-1,b=-1,C=-1,w=-1,v=-1,S=-1,L=t*s;for(let D=i;D<=n;D++){const R=D-i,F=D-d,O=F>=0&&F<u?h[F].dy:-1;if(O===-1){a[R]=!0,L+=s;continue}const B=O*f*4,V=(O+s)*f*4,z=L*f*4,ee=(L+s)*f*4;w===B&&S===z?(w=V,S=ee):(C!==-1&&(g.set(c.subarray(C,w),v),_===-1&&C===0&&C===v&&(_=w),b===-1&&w===m&&C===v&&(b=C)),C=B,w=V,v=z,S=ee),a[R]=!1,L+=s}C!==-1&&(g.set(c.subarray(C,w),v),_===-1&&C===0&&C===v&&(_=w),b===-1&&w===m&&C===v&&(b=C));const x=_===-1?-1:_/(f*4),I=b===-1?-1:b/(f*4);return[x,I,a]}static _renderLine(e,t,i,n,s,r,a,l,c,d,h,u,f,g,m){const _=f.content,b=f.tokens,C=e.width-r,w=m===1;let v=pl,S=0,L=0;for(let x=0,I=b.getCount();x<I;x++){const D=b.getEndOffset(x),R=b.getForeground(x),F=a.getColor(R);for(;S<D;S++){if(v>C)return;const O=_.charCodeAt(S);if(O===9){const B=u-(S+L)%u;L+=B-1,v+=B*r}else if(O===32)v+=r;else{const B=th(O)?2:1;for(let V=0;V<B;V++)if(s===2?c.blockRenderChar(e,v,d+h,F,l,t,i,w):c.renderChar(e,v,d+h,O,F,l,t,i,g,n,w),v+=r,v>C)return}}}}}class iU{constructor(e,t,i){this._startLineNumber=e,this._endLineNumber=t,this._defaultValue=i,this._values=[];for(let n=0,s=this._endLineNumber-this._startLineNumber+1;n<s;n++)this._values[n]=i}has(e){return this.get(e)!==this._defaultValue}set(e,t){e<this._startLineNumber||e>this._endLineNumber||(this._values[e-this._startLineNumber]=t)}get(e){return e<this._startLineNumber||e>this._endLineNumber?this._defaultValue:this._values[e-this._startLineNumber]}}class Zhe extends vs{constructor(e,t){super(e),this._viewDomNode=t;const n=this._context.configuration.options.get(165);this._widgets={},this._verticalScrollbarWidth=n.verticalScrollbarWidth,this._minimapWidth=n.minimap.minimapWidth,this._horizontalScrollbarHeight=n.horizontalScrollbarHeight,this._editorHeight=n.height,this._editorWidth=n.width,this._viewDomNodeRect={top:0,left:0,width:0,height:0},this._domNode=lt(document.createElement("div")),Na.write(this._domNode,4),this._domNode.setClassName("overlayWidgets"),this.overflowingOverlayWidgetsDomNode=lt(document.createElement("div")),Na.write(this.overflowingOverlayWidgetsDomNode,5),this.overflowingOverlayWidgetsDomNode.setClassName("overflowingOverlayWidgets")}dispose(){super.dispose(),this._widgets={}}getDomNode(){return this._domNode}onConfigurationChanged(e){const i=this._context.configuration.options.get(165);return this._verticalScrollbarWidth=i.verticalScrollbarWidth,this._minimapWidth=i.minimap.minimapWidth,this._horizontalScrollbarHeight=i.horizontalScrollbarHeight,this._editorHeight=i.height,this._editorWidth=i.width,!0}_widgetCanOverflow(e){const i=this._context.configuration.options.get(4);return(e.allowEditorOverflow||!1)&&i}addWidget(e){const t=lt(e.getDomNode());this._widgets[e.getId()]={widget:e,preference:null,domNode:t},t.setPosition("absolute"),t.setAttribute("widgetId",e.getId()),this._widgetCanOverflow(e)?this.overflowingOverlayWidgetsDomNode.appendChild(t):this._domNode.appendChild(t),this.setShouldRender(),this._updateMaxMinWidth()}setWidgetPosition(e,t){const i=this._widgets[e.getId()],n=t?t.preference:null,s=t?.stackOridinal;return i.preference===n&&i.stack===s?(this._updateMaxMinWidth(),!1):(i.preference=n,i.stack=s,this.setShouldRender(),this._updateMaxMinWidth(),!0)}removeWidget(e){const t=e.getId();if(this._widgets.hasOwnProperty(t)){const n=this._widgets[t].domNode.domNode;delete this._widgets[t],n.remove(),this.setShouldRender(),this._updateMaxMinWidth()}}_updateMaxMinWidth(){let e=0;const t=Object.keys(this._widgets);for(let i=0,n=t.length;i<n;i++){const s=t[i],a=this._widgets[s].widget.getMinContentWidthInPx?.();typeof a<"u"&&(e=Math.max(e,a))}this._context.viewLayout.setOverlayWidgetsMinWidth(e)}_renderWidget(e,t){const i=e.domNode;if(e.preference===null){i.setTop("");return}const n=2*this._verticalScrollbarWidth+this._minimapWidth;if(e.preference===0||e.preference===1){if(e.preference===1){const s=i.domNode.clientHeight;i.setTop(this._editorHeight-s-2*this._horizontalScrollbarHeight)}else i.setTop(0);e.stack!==void 0?(i.setTop(t[e.preference]),t[e.preference]+=i.domNode.clientWidth):i.setRight(n)}else if(e.preference===2)i.domNode.style.right="50%",e.stack!==void 0?(i.setTop(t[2]),t[2]+=i.domNode.clientHeight):i.setTop(0);else{const{top:s,left:r}=e.preference;if(this._context.configuration.options.get(51)&&this._widgetCanOverflow(e.widget)){const l=this._viewDomNodeRect;i.setTop(s+l.top),i.setLeft(r+l.left),i.setPosition("fixed")}else i.setTop(s),i.setLeft(r),i.setPosition("absolute")}}prepareRender(e){this._viewDomNodeRect=mi(this._viewDomNode.domNode)}render(e){this._domNode.setWidth(this._editorWidth);const t=Object.keys(this._widgets),i=Array.from({length:3},()=>0);t.sort((n,s)=>(this._widgets[n].stack||0)-(this._widgets[s].stack||0));for(let n=0,s=t.length;n<s;n++){const r=t[n];this._renderWidget(this._widgets[r],i)}}}class nU{constructor(e,t,i,n){this._viewportBrand=void 0,this.top=e|0,this.left=t|0,this.width=i|0,this.height=n|0}}class Yhe{constructor(e,t){this.tabSize=e,this.data=t}}class GM{constructor(e,t,i,n,s,r,a){this._viewLineDataBrand=void 0,this.content=e,this.continuesWithWrappedLine=t,this.minColumn=i,this.maxColumn=n,this.startVisibleColumn=s,this.tokens=r,this.inlineDecorations=a}}class Vo{constructor(e,t,i,n,s,r,a,l,c,d,h,u){this.minColumn=e,this.maxColumn=t,this.content=i,this.continuesWithWrappedLine=n,this.isBasicASCII=Vo.isBasicASCII(i,r),this.containsRTL=Vo.containsRTL(i,this.isBasicASCII,s),this.tokens=a,this.inlineDecorations=l,this.tabSize=c,this.startVisibleColumn=d,this.textDirection=h,this.hasVariableFonts=u}static isBasicASCII(e,t){return t?c1(e):!0}static containsRTL(e,t,i){return!t&&i?Tm(e):!1}}class fv{constructor(e,t,i){this.color=e,this.zIndex=t,this.data=i}static compareByRenderingProps(e,t){return e.zIndex===t.zIndex?e.color<t.color?-1:e.color>t.color?1:0:e.zIndex-t.zIndex}static equals(e,t){return e.color===t.color&&e.zIndex===t.zIndex&&Ut(e.data,t.data)}static equalsArr(e,t){return Ut(e,t,fv.equals)}}class Xhe{constructor(e,t){const i=e.options;this.lineHeight=i.get(75),this.pixelRatio=i.get(163),this.overviewRulerLanes=i.get(95),this.renderBorder=i.get(94);const n=t.getColor(Zde);this.borderColor=n?n.toString():null,this.hideCursor=i.get(68);const s=t.getColor($L);this.cursorColorSingle=s?s.transparent(.7).toString():null;const r=t.getColor(Pz);this.cursorColorPrimary=r?r.transparent(.7).toString():null;const a=t.getColor(Az);this.cursorColorSecondary=a?a.transparent(.7).toString():null,this.themeType=t.type;const l=i.get(81),c=l.enabled,d=l.side,h=t.getColor(Yde),u=di.getDefaultBackground();h?this.backgroundColor=h:c&&d==="right"?this.backgroundColor=u:this.backgroundColor=null;const g=i.get(165).overviewRuler;this.top=g.top,this.right=g.right,this.domWidth=g.width,this.domHeight=g.height,this.overviewRulerLanes===0?(this.canvasWidth=0,this.canvasHeight=0):(this.canvasWidth=this.domWidth*this.pixelRatio|0,this.canvasHeight=this.domHeight*this.pixelRatio|0);const[m,_]=this._initLanes(1,this.canvasWidth,this.overviewRulerLanes);this.x=m,this.w=_}_initLanes(e,t,i){const n=t-e;if(i>=3){const s=Math.floor(n/3),r=Math.floor(n/3),a=n-s-r,l=e,c=l+s,d=l+s+a;return[[0,l,c,l,d,l,c,l],[0,s,a,s+a,r,s+a+r,a+r,s+a+r]]}else if(i===2){const s=Math.floor(n/2),r=n-s,a=e,l=a+s;return[[0,a,a,a,l,a,a,a],[0,s,s,s,r,s+r,s+r,s+r]]}else{const s=e,r=n;return[[0,s,s,s,s,s,s,s],[0,r,r,r,r,r,r,r]]}}equals(e){return this.lineHeight===e.lineHeight&&this.pixelRatio===e.pixelRatio&&this.overviewRulerLanes===e.overviewRulerLanes&&this.renderBorder===e.renderBorder&&this.borderColor===e.borderColor&&this.hideCursor===e.hideCursor&&this.cursorColorSingle===e.cursorColorSingle&&this.cursorColorPrimary===e.cursorColorPrimary&&this.cursorColorSecondary===e.cursorColorSecondary&&this.themeType===e.themeType&&$.equals(this.backgroundColor,e.backgroundColor)&&this.top===e.top&&this.right===e.right&&this.domWidth===e.domWidth&&this.domHeight===e.domHeight&&this.canvasWidth===e.canvasWidth&&this.canvasHeight===e.canvasHeight}}class Qhe extends vs{constructor(e){super(e),this._actualShouldRender=0,this._renderedDecorations=[],this._renderedCursorPositions=[],this._domNode=lt(document.createElement("canvas")),this._domNode.setClassName("decorationsOverviewRuler"),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._domNode.setAttribute("aria-hidden","true"),this._updateSettings(!1),this._tokensColorTrackerListener=di.onDidChange(t=>{t.changedColorMap&&this._updateSettings(!0)}),this._cursorPositions=[{position:new M(1,1),color:this._settings.cursorColorSingle}]}dispose(){super.dispose(),this._tokensColorTrackerListener.dispose()}_updateSettings(e){const t=new Xhe(this._context.configuration,this._context.theme);return this._settings&&this._settings.equals(t)?!1:(this._settings=t,this._domNode.setTop(this._settings.top),this._domNode.setRight(this._settings.right),this._domNode.setWidth(this._settings.domWidth),this._domNode.setHeight(this._settings.domHeight),this._domNode.domNode.width=this._settings.canvasWidth,this._domNode.domNode.height=this._settings.canvasHeight,e&&this._render(),!0)}_markRenderingIsNeeded(){return this._actualShouldRender=2,!0}_markRenderingIsMaybeNeeded(){return this._actualShouldRender=1,!0}onConfigurationChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}onCursorStateChanged(e){this._cursorPositions=[];for(let t=0,i=e.selections.length;t<i;t++){let n=this._settings.cursorColorSingle;i>1&&(n=t===0?this._settings.cursorColorPrimary:this._settings.cursorColorSecondary),this._cursorPositions.push({position:e.selections[t].getPosition(),color:n})}return this._cursorPositions.sort((t,i)=>M.compare(t.position,i.position)),this._markRenderingIsMaybeNeeded()}onDecorationsChanged(e){return e.affectsOverviewRuler?this._markRenderingIsMaybeNeeded():!1}onFlushed(e){return this._markRenderingIsNeeded()}onScrollChanged(e){return e.scrollHeightChanged?this._markRenderingIsNeeded():!1}onZonesChanged(e){return this._markRenderingIsNeeded()}onThemeChanged(e){return this._updateSettings(!1)?this._markRenderingIsNeeded():!1}getDomNode(){return this._domNode.domNode}prepareRender(e){}render(e){this._render(),this._actualShouldRender=0}_render(){const e=this._settings.backgroundColor;if(this._settings.overviewRulerLanes===0){this._domNode.setBackgroundColor(e?$.Format.CSS.formatHexA(e):""),this._domNode.setDisplay("none");return}const t=this._context.viewModel.getAllOverviewRulerDecorations(this._context.theme);if(t.sort(fv.compareByRenderingProps),this._actualShouldRender===1&&!fv.equalsArr(this._renderedDecorations,t)&&(this._actualShouldRender=2),this._actualShouldRender===1&&!Ut(this._renderedCursorPositions,this._cursorPositions,(g,m)=>g.position.lineNumber===m.position.lineNumber&&g.color===m.color)&&(this._actualShouldRender=2),this._actualShouldRender===1)return;this._renderedDecorations=t,this._renderedCursorPositions=this._cursorPositions,this._domNode.setDisplay("block");const i=this._settings.canvasWidth,n=this._settings.canvasHeight,s=this._settings.lineHeight,r=this._context.viewLayout,a=this._context.viewLayout.getScrollHeight(),l=n/a,c=6*this._settings.pixelRatio|0,d=c/2|0,h=this._domNode.domNode.getContext("2d");e?e.isOpaque()?(h.fillStyle=$.Format.CSS.formatHexA(e),h.fillRect(0,0,i,n)):(h.clearRect(0,0,i,n),h.fillStyle=$.Format.CSS.formatHexA(e),h.fillRect(0,0,i,n)):h.clearRect(0,0,i,n);const u=this._settings.x,f=this._settings.w;for(const g of t){const m=g.color,_=g.data;h.fillStyle=m;let b=0,C=0,w=0;for(let v=0,S=_.length/3;v<S;v++){const L=_[3*v],x=_[3*v+1],I=_[3*v+2];let D=r.getVerticalOffsetForLineNumber(x)*l|0,R=(r.getVerticalOffsetForLineNumber(I)+s)*l|0;if(R-D<c){let O=(D+R)/2|0;O<d?O=d:O+d>n&&(O=n-d),D=O-d,R=O+d}D>w+1||L!==b?(v!==0&&h.fillRect(u[b],C,f[b],w-C),b=L,C=D,w=R):R>w&&(w=R)}h.fillRect(u[b],C,f[b],w-C)}if(!this._settings.hideCursor){const g=2*this._settings.pixelRatio|0,m=g/2|0,_=this._settings.x[7],b=this._settings.w[7];let C=-100,w=-100,v=null;for(let S=0,L=this._cursorPositions.length;S<L;S++){const x=this._cursorPositions[S].color;if(!x)continue;const I=this._cursorPositions[S].position;let D=r.getVerticalOffsetForLineNumber(I.lineNumber)*l|0;D<m?D=m:D+m>n&&(D=n-m);const R=D-m,F=R+g;R>w+1||x!==v?(S!==0&&v&&h.fillRect(_,C,b,w-C),C=R,w=F):F>w&&(w=F),v=x,h.fillStyle=x}v&&h.fillRect(_,C,b,w-C)}this._settings.renderBorder&&this._settings.borderColor&&this._settings.overviewRulerLanes>0&&(h.beginPath(),h.lineWidth=1,h.strokeStyle=this._settings.borderColor,h.moveTo(0,0),h.lineTo(0,n),h.moveTo(1,0),h.lineTo(i,0),h.stroke())}}class sU{constructor(e,t,i){this._colorZoneBrand=void 0,this.from=e|0,this.to=t|0,this.colorId=i|0}static compare(e,t){return e.colorId===t.colorId?e.from===t.from?e.to-t.to:e.from-t.from:e.colorId-t.colorId}}class oU{constructor(e,t,i,n){this._overviewRulerZoneBrand=void 0,this.startLineNumber=e,this.endLineNumber=t,this.heightInLines=i,this.color=n,this._colorZone=null}static compare(e,t){return e.color===t.color?e.startLineNumber===t.startLineNumber?e.heightInLines===t.heightInLines?e.endLineNumber-t.endLineNumber:e.heightInLines-t.heightInLines:e.startLineNumber-t.startLineNumber:e.color<t.color?-1:1}setColorZone(e){this._colorZone=e}getColorZones(){return this._colorZone}}class Jhe{constructor(e){this._getVerticalOffsetForLine=e,this._zones=[],this._colorZonesInvalid=!1,this._lineHeight=0,this._domWidth=0,this._domHeight=0,this._outerHeight=0,this._pixelRatio=1,this._lastAssignedId=0,this._color2Id=Object.create(null),this._id2Color=[]}getId2Color(){return this._id2Color}setZones(e){this._zones=e,this._zones.sort(oU.compare)}setLineHeight(e){return this._lineHeight===e?!1:(this._lineHeight=e,this._colorZonesInvalid=!0,!0)}setPixelRatio(e){this._pixelRatio=e,this._colorZonesInvalid=!0}getDOMWidth(){return this._domWidth}getCanvasWidth(){return this._domWidth*this._pixelRatio}setDOMWidth(e){return this._domWidth===e?!1:(this._domWidth=e,this._colorZonesInvalid=!0,!0)}getDOMHeight(){return this._domHeight}getCanvasHeight(){return this._domHeight*this._pixelRatio}setDOMHeight(e){return this._domHeight===e?!1:(this._domHeight=e,this._colorZonesInvalid=!0,!0)}getOuterHeight(){return this._outerHeight}setOuterHeight(e){return this._outerHeight===e?!1:(this._outerHeight=e,this._colorZonesInvalid=!0,!0)}resolveColorZones(){const e=this._colorZonesInvalid,t=Math.floor(this._lineHeight),i=Math.floor(this.getCanvasHeight()),n=Math.floor(this._outerHeight),s=i/n,r=Math.floor(4*this._pixelRatio/2),a=[];for(let l=0,c=this._zones.length;l<c;l++){const d=this._zones[l];if(!e){const v=d.getColorZones();if(v){a.push(v);continue}}const h=this._getVerticalOffsetForLine(d.startLineNumber),u=d.heightInLines===0?this._getVerticalOffsetForLine(d.endLineNumber)+t:h+d.heightInLines*t,f=Math.floor(s*h),g=Math.floor(s*u);let m=Math.floor((f+g)/2),_=g-m;_<r&&(_=r),m-_<0&&(m=_),m+_>i&&(m=i-_);const b=d.color;let C=this._color2Id[b];C||(C=++this._lastAssignedId,this._color2Id[b]=C,this._id2Color[C]=b);const w=new sU(m-_,m+_,C);d.setColorZone(w),a.push(w)}return this._colorZonesInvalid=!1,a.sort(sU.compare),a}}class eue extends Tf{constructor(e,t){super(),this._context=e;const i=this._context.configuration.options;this._domNode=lt(document.createElement("canvas")),this._domNode.setClassName(t),this._domNode.setPosition("absolute"),this._domNode.setLayerHinting(!0),this._domNode.setContain("strict"),this._zoneManager=new Jhe(n=>this._context.viewLayout.getVerticalOffsetForLineNumber(n)),this._zoneManager.setDOMWidth(0),this._zoneManager.setDOMHeight(0),this._zoneManager.setOuterHeight(this._context.viewLayout.getScrollHeight()),this._zoneManager.setLineHeight(i.get(75)),this._zoneManager.setPixelRatio(i.get(163)),this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return e.hasChanged(75)&&(this._zoneManager.setLineHeight(t.get(75)),this._render()),e.hasChanged(163)&&(this._zoneManager.setPixelRatio(t.get(163)),this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render()),!0}onFlushed(e){return this._render(),!0}onScrollChanged(e){return e.scrollHeightChanged&&(this._zoneManager.setOuterHeight(e.scrollHeight),this._render()),!0}onZonesChanged(e){return this._render(),!0}getDomNode(){return this._domNode.domNode}setLayout(e){this._domNode.setTop(e.top),this._domNode.setRight(e.right);let t=!1;t=this._zoneManager.setDOMWidth(e.width)||t,t=this._zoneManager.setDOMHeight(e.height)||t,t&&(this._domNode.setWidth(this._zoneManager.getDOMWidth()),this._domNode.setHeight(this._zoneManager.getDOMHeight()),this._domNode.domNode.width=this._zoneManager.getCanvasWidth(),this._domNode.domNode.height=this._zoneManager.getCanvasHeight(),this._render())}setZones(e){this._zoneManager.setZones(e),this._render()}_render(){if(this._zoneManager.getOuterHeight()===0)return!1;const e=this._zoneManager.getCanvasWidth(),t=this._zoneManager.getCanvasHeight(),i=this._zoneManager.resolveColorZones(),n=this._zoneManager.getId2Color(),s=this._domNode.domNode.getContext("2d");return s.clearRect(0,0,e,t),i.length>0&&this._renderOneLane(s,i,n,e),!0}_renderOneLane(e,t,i,n){let s=0,r=0,a=0;for(const l of t){const c=l.colorId,d=l.from,h=l.to;c!==s?(e.fillRect(0,r,n,a-r),s=c,e.fillStyle=i[s],r=d,a=h):a>=d?a=Math.max(a,h):(e.fillRect(0,r,n,a-r),r=d,a=h)}e.fillRect(0,r,n,a-r)}}class tue extends vs{constructor(e){super(e),this.domNode=lt(document.createElement("div")),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.domNode.setClassName("view-rulers"),this._renderedRulers=[];const t=this._context.configuration.options;this._rulers=t.get(116),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth}dispose(){super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._rulers=t.get(116),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onScrollChanged(e){return e.scrollHeightChanged}prepareRender(e){}_ensureRulersCount(){const e=this._renderedRulers.length,t=this._rulers.length;if(e===t)return;if(e<t){const{tabSize:n}=this._context.viewModel.model.getOptions(),s=n;let r=t-e;for(;r>0;){const a=lt(document.createElement("div"));a.setClassName("view-ruler"),a.setWidth(s),this.domNode.appendChild(a),this._renderedRulers.push(a),r--}return}let i=e-t;for(;i>0;){const n=this._renderedRulers.pop();this.domNode.removeChild(n),i--}}render(e){this._ensureRulersCount();for(let t=0,i=this._rulers.length;t<i;t++){const n=this._renderedRulers[t],s=this._rulers[t];n.setBoxShadow(s.color?`1px 0 0 0 ${s.color} inset`:""),n.setHeight(Math.min(e.scrollHeight,1e6)),n.setLeft(s.column*this._typicalHalfwidthCharacterWidth)}}}class iue extends vs{constructor(e){super(e),this._scrollTop=0,this._width=0,this._updateWidth(),this._shouldShow=!1;const i=this._context.configuration.options.get(117);this._useShadows=i.useShadows,this._domNode=lt(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true")}dispose(){super.dispose()}_updateShouldShow(){const e=this._useShadows&&this._scrollTop>0;return this._shouldShow!==e?(this._shouldShow=e,!0):!1}getDomNode(){return this._domNode}_updateWidth(){const t=this._context.configuration.options.get(165);t.minimap.renderMinimap===0||t.minimap.minimapWidth>0&&t.minimap.minimapLeft===0?this._width=t.width:this._width=t.width-t.verticalScrollbarWidth}onConfigurationChanged(e){const i=this._context.configuration.options.get(117);return this._useShadows=i.useShadows,this._updateWidth(),this._updateShouldShow(),!0}onScrollChanged(e){return this._scrollTop=e.scrollTop,this._updateShouldShow()}prepareRender(e){}render(e){this._domNode.setWidth(this._width),this._domNode.setClassName(this._shouldShow?"scroll-decoration":"")}}class nue{constructor(e){this.left=e.left,this.width=e.width,this.startStyle=null,this.endStyle=null}}class sue{constructor(e,t){this.lineNumber=e,this.ranges=t}}function oue(o){return new nue(o)}function rue(o){return new sue(o.lineNumber,o.ranges.map(oue))}const Ii=class Ii extends Lh{constructor(e){super(),this._previousFrameVisibleRangesWithStyle=[],this._context=e;const t=this._context.configuration.options;this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,this._selections=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=this._context.configuration.options;return this._roundedSelection=t.get(115),this._typicalHalfwidthCharacterWidth=t.get(59).typicalHalfwidthCharacterWidth,!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}_visibleRangesHaveGaps(e){for(let t=0,i=e.length;t<i;t++)if(e[t].ranges.length>1)return!0;return!1}_enrichVisibleRangesWithStyle(e,t,i){const n=this._typicalHalfwidthCharacterWidth/4;let s=null,r=null;if(i&&i.length>0&&t.length>0){const a=t[0].lineNumber;if(a===e.startLineNumber)for(let c=0;!s&&c<i.length;c++)i[c].lineNumber===a&&(s=i[c].ranges[0]);const l=t[t.length-1].lineNumber;if(l===e.endLineNumber)for(let c=i.length-1;!r&&c>=0;c--)i[c].lineNumber===l&&(r=i[c].ranges[0]);s&&!s.startStyle&&(s=null),r&&!r.startStyle&&(r=null)}for(let a=0,l=t.length;a<l;a++){const c=t[a].ranges[0],d=c.left,h=c.left+c.width,u={top:0,bottom:0},f={top:0,bottom:0};if(a>0){const g=t[a-1].ranges[0].left,m=t[a-1].ranges[0].left+t[a-1].ranges[0].width;ix(d-g)<n?u.top=2:d>g&&(u.top=1),ix(h-m)<n?f.top=2:g<h&&h<m&&(f.top=1)}else s&&(u.top=s.startStyle.top,f.top=s.endStyle.top);if(a+1<l){const g=t[a+1].ranges[0].left,m=t[a+1].ranges[0].left+t[a+1].ranges[0].width;ix(d-g)<n?u.bottom=2:g<d&&d<m&&(u.bottom=1),ix(h-m)<n?f.bottom=2:h<m&&(f.bottom=1)}else r&&(u.bottom=r.startStyle.bottom,f.bottom=r.endStyle.bottom);c.startStyle=u,c.endStyle=f}}_getVisibleRangesWithStyle(e,t,i){const s=(t.linesVisibleRangesForRange(e,!0)||[]).map(rue);return!this._visibleRangesHaveGaps(s)&&this._roundedSelection&&this._enrichVisibleRangesWithStyle(t.visibleRange,s,i),s}_createSelectionPiece(e,t,i,n,s){return'<div class="cslr '+i+'" style="top:'+e.toString()+"px;bottom:"+t.toString()+"px;left:"+n.toString()+"px;width:"+s.toString()+'px;"></div>'}_actualRenderOneSelection(e,t,i,n){if(n.length===0)return;const s=!!n[0].ranges[0].startStyle,r=n[0].lineNumber,a=n[n.length-1].lineNumber;for(let l=0,c=n.length;l<c;l++){const d=n[l],h=d.lineNumber,u=h-t,f=i&&h===r?1:0,g=i&&h!==r&&h===a?1:0;let m="",_="";for(let b=0,C=d.ranges.length;b<C;b++){const w=d.ranges[b];if(s){const S=w.startStyle,L=w.endStyle;if(S.top===1||S.bottom===1){m+=this._createSelectionPiece(f,g,Ii.SELECTION_CLASS_NAME,w.left-Ii.ROUNDED_PIECE_WIDTH,Ii.ROUNDED_PIECE_WIDTH);let x=Ii.EDITOR_BACKGROUND_CLASS_NAME;S.top===1&&(x+=" "+Ii.SELECTION_TOP_RIGHT),S.bottom===1&&(x+=" "+Ii.SELECTION_BOTTOM_RIGHT),m+=this._createSelectionPiece(f,g,x,w.left-Ii.ROUNDED_PIECE_WIDTH,Ii.ROUNDED_PIECE_WIDTH)}if(L.top===1||L.bottom===1){m+=this._createSelectionPiece(f,g,Ii.SELECTION_CLASS_NAME,w.left+w.width,Ii.ROUNDED_PIECE_WIDTH);let x=Ii.EDITOR_BACKGROUND_CLASS_NAME;L.top===1&&(x+=" "+Ii.SELECTION_TOP_LEFT),L.bottom===1&&(x+=" "+Ii.SELECTION_BOTTOM_LEFT),m+=this._createSelectionPiece(f,g,x,w.left+w.width,Ii.ROUNDED_PIECE_WIDTH)}}let v=Ii.SELECTION_CLASS_NAME;if(s){const S=w.startStyle,L=w.endStyle;S.top===0&&(v+=" "+Ii.SELECTION_TOP_LEFT),S.bottom===0&&(v+=" "+Ii.SELECTION_BOTTOM_LEFT),L.top===0&&(v+=" "+Ii.SELECTION_TOP_RIGHT),L.bottom===0&&(v+=" "+Ii.SELECTION_BOTTOM_RIGHT)}_+=this._createSelectionPiece(f,g,v,w.left,w.width)}e[u][0]+=m,e[u][1]+=_}}prepareRender(e){const t=[],i=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber;for(let r=i;r<=n;r++){const a=r-i;t[a]=["",""]}const s=[];for(let r=0,a=this._selections.length;r<a;r++){const l=this._selections[r];if(l.isEmpty()){s[r]=null;continue}const c=this._getVisibleRangesWithStyle(l,e,this._previousFrameVisibleRangesWithStyle[r]);s[r]=c,this._actualRenderOneSelection(t,i,this._selections.length>1,c)}this._previousFrameVisibleRangesWithStyle=s,this._renderResult=t.map(([r,a])=>r+a)}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};Ii.SELECTION_CLASS_NAME="selected-text",Ii.SELECTION_TOP_LEFT="top-left-radius",Ii.SELECTION_BOTTOM_LEFT="bottom-left-radius",Ii.SELECTION_TOP_RIGHT="top-right-radius",Ii.SELECTION_BOTTOM_RIGHT="bottom-right-radius",Ii.EDITOR_BACKGROUND_CLASS_NAME="monaco-editor-background",Ii.ROUNDED_PIECE_WIDTH=10;let ZM=Ii;Nr((o,e)=>{const t=o.getColor(Xae);t&&!t.isTransparent()&&e.addRule(`.monaco-editor .view-line span.inline-selected-text { color: ${t}; }`)});function ix(o){return o<0?-o:o}class rU{constructor(e,t,i,n,s,r,a){this.top=e,this.left=t,this.paddingLeft=i,this.width=n,this.height=s,this.textContent=r,this.textContentClassName=a}}var jc;(function(o){o[o.Single=0]="Single",o[o.MultiPrimary=1]="MultiPrimary",o[o.MultiSecondary=2]="MultiSecondary"})(jc||(jc={}));class aU{constructor(e,t){this._context=e;const i=this._context.configuration.options,n=i.get(59);this._cursorStyle=i.get(161),this._typicalHalfwidthCharacterWidth=n.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(i.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=i.get(38),this._isVisible=!0,this._domNode=lt(document.createElement("div")),this._domNode.setClassName(`cursor ${w_}`),this._domNode.setHeight(this._context.viewLayout.getLineHeightForLineNumber(1)),this._domNode.setTop(0),this._domNode.setLeft(0),dn(this._domNode,n),this._domNode.setDisplay("none"),this._position=new M(1,1),this._pluralityClass="",this.setPlurality(t),this._lastRenderedContent="",this._renderData=null}getDomNode(){return this._domNode}getPosition(){return this._position}setPlurality(e){switch(e){default:case jc.Single:this._pluralityClass="";break;case jc.MultiPrimary:this._pluralityClass="cursor-primary";break;case jc.MultiSecondary:this._pluralityClass="cursor-secondary";break}}show(){this._isVisible||(this._domNode.setVisibility("inherit"),this._isVisible=!0)}hide(){this._isVisible&&(this._domNode.setVisibility("hidden"),this._isVisible=!1)}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(59);return this._cursorStyle=t.get(161),this._typicalHalfwidthCharacterWidth=i.typicalHalfwidthCharacterWidth,this._lineCursorWidth=Math.min(t.get(37),this._typicalHalfwidthCharacterWidth),this._lineCursorHeight=t.get(38),dn(this._domNode,i),!0}onCursorPositionChanged(e,t){return t?this._domNode.domNode.style.transitionProperty="none":this._domNode.domNode.style.transitionProperty="",this._position=e,!0}_getGraphemeAwarePosition(){const{lineNumber:e,column:t}=this._position,i=this._context.viewModel.getLineContent(e),[n,s]=Die(i,t-1);return[new M(e,n+1),i.substring(n,s)]}_prepareRender(e){let t="",i="";const[n,s]=this._getGraphemeAwarePosition(),r=this._context.viewLayout.getLineHeightForLineNumber(n.lineNumber),a=this._lineCursorHeight===0?r:Math.min(r,this._lineCursorHeight),l=(r-a)/2;if(this._cursorStyle===hn.Line||this._cursorStyle===hn.LineThin){const m=e.visibleRangeForPosition(n);if(!m||m.outsideRenderedLine)return null;const _=me(this._domNode.domNode);let b;this._cursorStyle===hn.Line?(b=rH(_,this._lineCursorWidth>0?this._lineCursorWidth:2),b>2&&(t=s,i=this._getTokenClassName(n))):b=rH(_,1);let C=m.left,w=0;b>=2&&C>=1&&(w=1,C-=w);const v=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.bigNumbersDelta+l;return new rU(v,C,w,b,a,t,i)}const c=e.linesVisibleRangesForRange(new k(n.lineNumber,n.column,n.lineNumber,n.column+s.length),!1);if(!c||c.length===0)return null;const d=c[0];if(d.outsideRenderedLine||d.ranges.length===0)return null;const h=d.ranges[0],u=s===" "?this._typicalHalfwidthCharacterWidth:h.width<1?this._typicalHalfwidthCharacterWidth:h.width;this._cursorStyle===hn.Block&&(t=s,i=this._getTokenClassName(n));let f=e.getVerticalOffsetForLineNumber(n.lineNumber)-e.bigNumbersDelta,g=r;return(this._cursorStyle===hn.Underline||this._cursorStyle===hn.UnderlineThin)&&(f+=r-2,g=2),new rU(f,h.left,0,u,g,t,i)}_getTokenClassName(e){const t=this._context.viewModel.getViewLineData(e.lineNumber),i=t.tokens.findTokenIndexAtOffset(e.column-1);return t.tokens.getClassName(i)}prepareRender(e){this._renderData=this._prepareRender(e)}render(e){return this._renderData?(this._lastRenderedContent!==this._renderData.textContent&&(this._lastRenderedContent=this._renderData.textContent,this._domNode.domNode.textContent=this._lastRenderedContent),this._domNode.setClassName(`cursor ${this._pluralityClass} ${w_} ${this._renderData.textContentClassName}`),this._domNode.setDisplay("block"),this._domNode.setTop(this._renderData.top),this._domNode.setLeft(this._renderData.left),this._domNode.setPaddingLeft(this._renderData.paddingLeft),this._domNode.setWidth(this._renderData.width),this._domNode.setLineHeight(this._renderData.height),this._domNode.setHeight(this._renderData.height),{domNode:this._domNode.domNode,position:this._position,contentLeft:this._renderData.left,height:this._renderData.height,width:2}):(this._domNode.setDisplay("none"),null)}}const IS=class IS extends vs{constructor(e){super(e);const t=this._context.configuration.options;this._readOnly=t.get(104),this._cursorBlinking=t.get(32),this._cursorStyle=t.get(161),this._cursorSmoothCaretAnimation=t.get(33),this._editContextEnabled=t.get(170),this._selectionIsEmpty=!0,this._isComposingInput=!1,this._isVisible=!1,this._primaryCursor=new aU(this._context,jc.Single),this._secondaryCursors=[],this._renderData=[],this._domNode=lt(document.createElement("div")),this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true"),this._updateDomClassName(),this._domNode.appendChild(this._primaryCursor.getDomNode()),this._startCursorBlinkAnimation=new No,this._cursorFlatBlinkInterval=new Ly,this._blinkingEnabled=!1,this._editorHasFocus=!1,this._updateBlinking()}dispose(){super.dispose(),this._startCursorBlinkAnimation.dispose(),this._cursorFlatBlinkInterval.dispose()}getDomNode(){return this._domNode}onCompositionStart(e){return this._isComposingInput=!0,this._updateBlinking(),!0}onCompositionEnd(e){return this._isComposingInput=!1,this._updateBlinking(),!0}onConfigurationChanged(e){const t=this._context.configuration.options;this._readOnly=t.get(104),this._cursorBlinking=t.get(32),this._cursorStyle=t.get(161),this._cursorSmoothCaretAnimation=t.get(33),this._editContextEnabled=t.get(170),this._updateBlinking(),this._updateDomClassName(),this._primaryCursor.onConfigurationChanged(e);for(let i=0,n=this._secondaryCursors.length;i<n;i++)this._secondaryCursors[i].onConfigurationChanged(e);return!0}_onCursorPositionChanged(e,t,i){const n=this._secondaryCursors.length!==t.length||this._cursorSmoothCaretAnimation==="explicit"&&i!==3;if(this._primaryCursor.setPlurality(t.length?jc.MultiPrimary:jc.Single),this._primaryCursor.onCursorPositionChanged(e,n),this._updateBlinking(),this._secondaryCursors.length<t.length){const s=t.length-this._secondaryCursors.length;for(let r=0;r<s;r++){const a=new aU(this._context,jc.MultiSecondary);this._domNode.domNode.insertBefore(a.getDomNode().domNode,this._primaryCursor.getDomNode().domNode.nextSibling),this._secondaryCursors.push(a)}}else if(this._secondaryCursors.length>t.length){const s=this._secondaryCursors.length-t.length;for(let r=0;r<s;r++)this._domNode.removeChild(this._secondaryCursors[0].getDomNode()),this._secondaryCursors.splice(0,1)}for(let s=0;s<t.length;s++)this._secondaryCursors[s].onCursorPositionChanged(t[s],n)}onCursorStateChanged(e){const t=[];for(let n=0,s=e.selections.length;n<s;n++)t[n]=e.selections[n].getPosition();this._onCursorPositionChanged(t[0],t.slice(1),e.reason);const i=e.selections[0].isEmpty();return this._selectionIsEmpty!==i&&(this._selectionIsEmpty=i,this._updateDomClassName()),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onFocusChanged(e){return this._editorHasFocus=e.isFocused,this._updateBlinking(),!1}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return!0}onTokensChanged(e){const t=i=>{for(let n=0,s=e.ranges.length;n<s;n++)if(e.ranges[n].fromLineNumber<=i.lineNumber&&i.lineNumber<=e.ranges[n].toLineNumber)return!0;return!1};if(t(this._primaryCursor.getPosition()))return!0;for(const i of this._secondaryCursors)if(t(i.getPosition()))return!0;return!1}onZonesChanged(e){return!0}_getCursorBlinking(){return this._isComposingInput&&!this._editContextEnabled||!this._editorHasFocus?0:this._readOnly?5:this._cursorBlinking}_updateBlinking(){this._startCursorBlinkAnimation.cancel(),this._cursorFlatBlinkInterval.cancel();const e=this._getCursorBlinking(),t=e===0,i=e===5;t?this._hide():this._show(),this._blinkingEnabled=!1,this._updateDomClassName(),!t&&!i&&(e===1?this._cursorFlatBlinkInterval.cancelAndSet(()=>{this._isVisible?this._hide():this._show()},IS.BLINK_INTERVAL,me(this._domNode.domNode)):this._startCursorBlinkAnimation.setIfNotSet(()=>{this._blinkingEnabled=!0,this._updateDomClassName()},IS.BLINK_INTERVAL))}_updateDomClassName(){this._domNode.setClassName(this._getClassName())}_getClassName(){let e="cursors-layer";switch(this._selectionIsEmpty||(e+=" has-selection"),this._cursorStyle){case hn.Line:e+=" cursor-line-style";break;case hn.Block:e+=" cursor-block-style";break;case hn.Underline:e+=" cursor-underline-style";break;case hn.LineThin:e+=" cursor-line-thin-style";break;case hn.BlockOutline:e+=" cursor-block-outline-style";break;case hn.UnderlineThin:e+=" cursor-underline-thin-style";break;default:e+=" cursor-line-style"}if(this._blinkingEnabled)switch(this._getCursorBlinking()){case 1:e+=" cursor-blink";break;case 2:e+=" cursor-smooth";break;case 3:e+=" cursor-phase";break;case 4:e+=" cursor-expand";break;case 5:e+=" cursor-solid";break;default:e+=" cursor-solid"}else e+=" cursor-solid";return(this._cursorSmoothCaretAnimation==="on"||this._cursorSmoothCaretAnimation==="explicit")&&(e+=" cursor-smooth-caret-animation"),e}_show(){this._primaryCursor.show();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].show();this._isVisible=!0}_hide(){this._primaryCursor.hide();for(let e=0,t=this._secondaryCursors.length;e<t;e++)this._secondaryCursors[e].hide();this._isVisible=!1}prepareRender(e){this._primaryCursor.prepareRender(e);for(let t=0,i=this._secondaryCursors.length;t<i;t++)this._secondaryCursors[t].prepareRender(e)}render(e){const t=[];let i=0;const n=this._primaryCursor.render(e);n&&(t[i++]=n);for(let s=0,r=this._secondaryCursors.length;s<r;s++){const a=this._secondaryCursors[s].render(e);a&&(t[i++]=a)}this._renderData=t}getLastRenderData(){return this._renderData}};IS.BLINK_INTERVAL=500;let YM=IS;Nr((o,e)=>{const t=[{class:".cursor",foreground:$L,background:PM},{class:".cursor-primary",foreground:Pz,background:Tde},{class:".cursor-secondary",foreground:Az,background:Rde}];for(const i of t){const n=o.getColor(i.foreground);if(n){let s=o.getColor(i.background);s||(s=n.opposite()),e.addRule(`.monaco-editor .cursors-layer ${i.class} { background-color: ${n}; border-color: ${n}; color: ${s}; }`),Ta(o.type)&&e.addRule(`.monaco-editor .cursors-layer.has-selection ${i.class} { border-left: 1px solid ${s}; border-right: 1px solid ${s}; }`)}}});const XM=()=>{throw new Error("Invalid change accessor")};class aue extends vs{constructor(e){super(e);const t=this._context.configuration.options,i=t.get(165);this._lineHeight=t.get(75),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,this.domNode=lt(document.createElement("div")),this.domNode.setClassName("view-zones"),this.domNode.setPosition("absolute"),this.domNode.setAttribute("role","presentation"),this.domNode.setAttribute("aria-hidden","true"),this.marginDomNode=lt(document.createElement("div")),this.marginDomNode.setClassName("margin-view-zones"),this.marginDomNode.setPosition("absolute"),this.marginDomNode.setAttribute("role","presentation"),this.marginDomNode.setAttribute("aria-hidden","true"),this._zones={}}dispose(){super.dispose(),this._zones={}}_recomputeWhitespacesProps(){const e=this._context.viewLayout.getWhitespaces(),t=new Map;for(const n of e)t.set(n.id,n);let i=!1;return this._context.viewModel.changeWhitespace(n=>{const s=Object.keys(this._zones);for(let r=0,a=s.length;r<a;r++){const l=s[r],c=this._zones[l],d=this._computeWhitespaceProps(c.delegate);c.isInHiddenArea=d.isInHiddenArea;const h=t.get(l);h&&(h.afterLineNumber!==d.afterViewLineNumber||h.height!==d.heightInPx)&&(n.changeOneWhitespace(l,d.afterViewLineNumber,d.heightInPx),this._safeCallOnComputedHeight(c.delegate,d.heightInPx),i=!0)}}),i}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);return this._lineHeight=t.get(75),this._contentWidth=i.contentWidth,this._contentLeft=i.contentLeft,e.hasChanged(75)&&this._recomputeWhitespacesProps(),!0}onLineMappingChanged(e){return this._recomputeWhitespacesProps()}onLinesDeleted(e){return!0}onScrollChanged(e){return e.scrollTopChanged||e.scrollWidthChanged}onZonesChanged(e){return!0}onLinesInserted(e){return!0}_getZoneOrdinal(e){return e.ordinal??e.afterColumn??1e4}_computeWhitespaceProps(e){if(e.afterLineNumber===0)return{isInHiddenArea:!1,afterViewLineNumber:0,heightInPx:this._heightInPixels(e),minWidthInPx:this._minWidthInPixels(e)};let t;if(typeof e.afterColumn<"u")t=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:e.afterColumn});else{const r=this._context.viewModel.model.validatePosition({lineNumber:e.afterLineNumber,column:1}).lineNumber;t=new M(r,this._context.viewModel.model.getLineMaxColumn(r))}let i;t.column===this._context.viewModel.model.getLineMaxColumn(t.lineNumber)?i=this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber+1,column:1}):i=this._context.viewModel.model.validatePosition({lineNumber:t.lineNumber,column:t.column+1});const n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t,e.afterColumnAffinity,!0),s=e.showInHiddenAreas||this._context.viewModel.coordinatesConverter.modelPositionIsVisible(i);return{isInHiddenArea:!s,afterViewLineNumber:n.lineNumber,heightInPx:s?this._heightInPixels(e):0,minWidthInPx:this._minWidthInPixels(e)}}changeViewZones(e){let t=!1;return this._context.viewModel.changeWhitespace(i=>{const n={addZone:s=>(t=!0,this._addZone(i,s)),removeZone:s=>{s&&(t=this._removeZone(i,s)||t)},layoutZone:s=>{s&&(t=this._layoutZone(i,s)||t)}};lue(e,n),n.addZone=XM,n.removeZone=XM,n.layoutZone=XM}),t}_addZone(e,t){const i=this._computeWhitespaceProps(t),s={whitespaceId:e.insertWhitespace(i.afterViewLineNumber,this._getZoneOrdinal(t),i.heightInPx,i.minWidthInPx),delegate:t,isInHiddenArea:i.isInHiddenArea,isVisible:!1,domNode:lt(t.domNode),marginDomNode:t.marginDomNode?lt(t.marginDomNode):null};return this._safeCallOnComputedHeight(s.delegate,i.heightInPx),s.domNode.setPosition("absolute"),s.domNode.domNode.style.width="100%",s.domNode.setDisplay("none"),s.domNode.setAttribute("monaco-view-zone",s.whitespaceId),this.domNode.appendChild(s.domNode),s.marginDomNode&&(s.marginDomNode.setPosition("absolute"),s.marginDomNode.domNode.style.width="100%",s.marginDomNode.setDisplay("none"),s.marginDomNode.setAttribute("monaco-view-zone",s.whitespaceId),this.marginDomNode.appendChild(s.marginDomNode)),this._zones[s.whitespaceId]=s,this.setShouldRender(),s.whitespaceId}_removeZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t];return delete this._zones[t],e.removeWhitespace(i.whitespaceId),i.domNode.removeAttribute("monaco-visible-view-zone"),i.domNode.removeAttribute("monaco-view-zone"),i.domNode.domNode.remove(),i.marginDomNode&&(i.marginDomNode.removeAttribute("monaco-visible-view-zone"),i.marginDomNode.removeAttribute("monaco-view-zone"),i.marginDomNode.domNode.remove()),this.setShouldRender(),!0}return!1}_layoutZone(e,t){if(this._zones.hasOwnProperty(t)){const i=this._zones[t],n=this._computeWhitespaceProps(i.delegate);return i.isInHiddenArea=n.isInHiddenArea,e.changeOneWhitespace(i.whitespaceId,n.afterViewLineNumber,n.heightInPx),this._safeCallOnComputedHeight(i.delegate,n.heightInPx),this.setShouldRender(),!0}return!1}shouldSuppressMouseDownOnViewZone(e){return this._zones.hasOwnProperty(e)?!!this._zones[e].delegate.suppressMouseDown:!1}_heightInPixels(e){return typeof e.heightInPx=="number"?e.heightInPx:typeof e.heightInLines=="number"?this._lineHeight*e.heightInLines:this._lineHeight}_minWidthInPixels(e){return typeof e.minWidthInPx=="number"?e.minWidthInPx:0}_safeCallOnComputedHeight(e,t){if(typeof e.onComputedHeight=="function")try{e.onComputedHeight(t)}catch(i){Ee(i)}}_safeCallOnDomNodeTop(e,t){if(typeof e.onDomNodeTop=="function")try{e.onDomNodeTop(t)}catch(i){Ee(i)}}prepareRender(e){}render(e){const t=e.viewportData.whitespaceViewportData,i={};let n=!1;for(const r of t)this._zones[r.id].isInHiddenArea||(i[r.id]=r,n=!0);const s=Object.keys(this._zones);for(let r=0,a=s.length;r<a;r++){const l=s[r],c=this._zones[l];let d=0,h=0,u="none";i.hasOwnProperty(l)?(d=i[l].verticalOffset-e.bigNumbersDelta,h=i[l].height,u="block",c.isVisible||(c.domNode.setAttribute("monaco-visible-view-zone","true"),c.isVisible=!0),this._safeCallOnDomNodeTop(c.delegate,e.getScrolledTopFromAbsoluteTop(i[l].verticalOffset))):(c.isVisible&&(c.domNode.removeAttribute("monaco-visible-view-zone"),c.isVisible=!1),this._safeCallOnDomNodeTop(c.delegate,e.getScrolledTopFromAbsoluteTop(-1e6))),c.domNode.setTop(d),c.domNode.setHeight(h),c.domNode.setDisplay(u),c.marginDomNode&&(c.marginDomNode.setTop(d),c.marginDomNode.setHeight(h),c.marginDomNode.setDisplay(u))}n&&(this.domNode.setWidth(Math.max(e.scrollWidth,this._contentWidth)),this.marginDomNode.setWidth(this._contentLeft))}}function lue(o,e){try{return o(e)}catch(t){Ee(t)}}class cue extends Lh{constructor(e){super(),this._context=e,this._options=new lU(this._context.configuration),this._selection=[],this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){const t=new lU(this._context.configuration);return this._options.equals(t)?e.hasChanged(165):(this._options=t,!0)}onCursorStateChanged(e){return this._selection=e.selections,this._options.renderWhitespace==="selection"}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}prepareRender(e){if(this._options.renderWhitespace==="none"){this._renderResult=null;return}const t=e.visibleRange.startLineNumber,n=e.visibleRange.endLineNumber-t+1,s=new Array(n);for(let r=0;r<n;r++)s[r]=!0;this._renderResult=[];for(let r=e.viewportData.startLineNumber;r<=e.viewportData.endLineNumber;r++){const a=r-e.viewportData.startLineNumber,l=this._context.viewModel.getViewLineRenderingData(r);let c=null;if(this._options.renderWhitespace==="selection"){const d=this._selection;for(const h of d){if(h.endLineNumber<r||h.startLineNumber>r)continue;const u=h.startLineNumber===r?h.startColumn:l.minColumn,f=h.endLineNumber===r?h.endColumn:l.maxColumn;u<f&&(c||(c=[]),c.push(new pe(u-1,f-1)))}}this._renderResult[a]=this._applyRenderWhitespace(e,r,c,l)}}_applyRenderWhitespace(e,t,i,n){if(n.hasVariableFonts||this._options.renderWhitespace==="selection"&&!i||this._options.renderWhitespace==="trailing"&&n.continuesWithWrappedLine)return"";const s=this._context.theme.getColor(AM),r=this._options.renderWithSVG,a=n.content,l=this._options.stopRenderingLineAfter===-1?a.length:Math.min(this._options.stopRenderingLineAfter,a.length),c=n.continuesWithWrappedLine,d=n.minColumn-1,h=this._options.renderWhitespace==="boundary",u=this._options.renderWhitespace==="trailing",f=e.getLineHeightForLineNumber(t),g=this._options.middotWidth,m=this._options.wsmiddotWidth,_=this._options.spaceWidth,b=Math.abs(m-_),C=Math.abs(g-_),w=b<C?11825:183,v=this._options.canUseHalfwidthRightwardsArrow;let S="",L=!1,x=es(a),I;x===-1?(L=!0,x=l,I=l):I=Kr(a);let D=0,R=i&&i[D],F=0;for(let O=d;O<l;O++){const B=a.charCodeAt(O);if(R&&R.endExclusive<=O&&(D++,R=i&&i[D]),B!==9&&B!==32||u&&!L&&O<=I)continue;if(h&&O>=x&&O<=I&&B===32){const z=O-1>=0?a.charCodeAt(O-1):0,ee=O+1<l?a.charCodeAt(O+1):0;if(z!==32&&ee!==32)continue}if(h&&c&&O===l-1){const z=O-1>=0?a.charCodeAt(O-1):0;if(B===32&&z!==32&&z!==9)continue}if(i&&!(R&&R.start<=O&&O<R.endExclusive))continue;const V=e.visibleRangeForPosition(new M(t,O+1));V&&(r?(F=Math.max(F,V.left),B===9?S+=this._renderArrow(f,_,V.left):S+=`<circle cx="${(V.left+_/2).toFixed(2)}" cy="${(f/2).toFixed(2)}" r="${(_/7).toFixed(2)}" />`):B===9?S+=`<div class="mwh" style="left:${V.left}px;height:${f}px;">${v?"→":"→"}</div>`:S+=`<div class="mwh" style="left:${V.left}px;height:${f}px;">${String.fromCharCode(w)}</div>`)}return r?(F=Math.round(F+_),`<svg style="bottom:0;position:absolute;width:${F}px;height:${f}px" viewBox="0 0 ${F} ${f}" xmlns="http://www.w3.org/2000/svg" fill="${s}">`+S+"</svg>"):S}_renderArrow(e,t,i){const n=t/7,s=t,r=e/2,a=i,l={x:0,y:n/2},c={x:100/125*s,y:l.y},d={x:c.x-.2*c.x,y:c.y+.2*c.x},h={x:d.x+.1*c.x,y:d.y+.1*c.x},u={x:h.x+.35*c.x,y:h.y-.35*c.x},f={x:u.x,y:-u.y},g={x:h.x,y:-h.y},m={x:d.x,y:-d.y},_={x:c.x,y:-c.y},b={x:l.x,y:-l.y};return`<path d="M ${[l,c,d,h,u,f,g,m,_,b].map(v=>`${(a+v.x).toFixed(2)} ${(r+v.y).toFixed(2)}`).join(" L ")}" />`}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}}class lU{constructor(e){const t=e.options,i=t.get(59),n=t.get(47);n==="off"?(this.renderWhitespace="none",this.renderWithSVG=!1):n==="svg"?(this.renderWhitespace=t.get(113),this.renderWithSVG=!0):(this.renderWhitespace=t.get(113),this.renderWithSVG=!1),this.spaceWidth=i.spaceWidth,this.middotWidth=i.middotWidth,this.wsmiddotWidth=i.wsmiddotWidth,this.canUseHalfwidthRightwardsArrow=i.canUseHalfwidthRightwardsArrow,this.lineHeight=t.get(75),this.stopRenderingLineAfter=t.get(133)}equals(e){return this.renderWhitespace===e.renderWhitespace&&this.renderWithSVG===e.renderWithSVG&&this.spaceWidth===e.spaceWidth&&this.middotWidth===e.middotWidth&&this.wsmiddotWidth===e.wsmiddotWidth&&this.canUseHalfwidthRightwardsArrow===e.canUseHalfwidthRightwardsArrow&&this.lineHeight===e.lineHeight&&this.stopRenderingLineAfter===e.stopRenderingLineAfter}}class due{constructor(e,t,i,n){this.selections=e,this.startLineNumber=t.startLineNumber|0,this.endLineNumber=t.endLineNumber|0,this.relativeVerticalOffset=t.relativeVerticalOffset,this.bigNumbersDelta=t.bigNumbersDelta|0,this.lineHeight=t.lineHeight|0,this.whitespaceViewportData=i,this._model=n,this.visibleRange=new k(t.startLineNumber,this._model.getLineMinColumn(t.startLineNumber),t.endLineNumber,this._model.getLineMaxColumn(t.endLineNumber))}getViewLineRenderingData(e){return this._model.getViewportViewLineRenderingData(this.visibleRange,e)}getDecorationsInViewport(){return this._model.getDecorationsInViewport(this.visibleRange)}}class hue{get type(){return this._theme.type}get value(){return this._theme}constructor(e){this._theme=e}update(e){this._theme=e}getColor(e){return this._theme.getColor(e)}}class uue{constructor(e,t,i){this.configuration=e,this.theme=new hue(t),this.viewModel=i,this.viewLayout=i.viewLayout}addEventHandler(e){this.viewModel.addViewEventHandler(e)}removeEventHandler(e){this.viewModel.removeViewEventHandler(e)}}const Hf=new Float32Array([1,0,1,1,0,1,0,0,0,1,1,0]);function Vf(o){if(!o)throw new Error(`Value "${o}" cannot be null`);return o}function cU(o,e,t){let i=new e.ResizeObserver(n=>{const s=n.find(l=>l.target===o);if(!s)return;if(!("devicePixelContentBoxSize"in s)){i?.disconnect(),i=void 0;return}const r=s.devicePixelContentBoxSize[0].inlineSize,a=s.devicePixelContentBoxSize[0].blockSize;r>0&&a>0&&t(r,a)});try{i.observe(o,{box:["device-pixel-content-box"]})}catch{throw i.disconnect(),i=void 0,new Ce("Could not observe device pixel dimensions")}return ue(()=>i?.disconnect())}var fue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};let gue=0;class gv extends A{get cacheKey(){return`${this.fontFamily}_${this.fontSize}px`}constructor(e,t,i,n){super(),this.fontSize=e,this.fontFamily=t,this.devicePixelRatio=i,this._decorationStyleCache=n,this.id=gue++,this._workGlyph={source:null,boundingBox:{left:0,bottom:0,right:0,top:0},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0},this._workGlyphConfig={chars:void 0,tokenMetadata:0,decorationStyleSetId:0},this._antiAliasing=ze?"greyscale":"subpixel";const s=Math.ceil(this.fontSize*i);this._canvas=new OffscreenCanvas(s*3,s*3),this._ctx=Vf(this._canvas.getContext("2d",{willReadFrequently:!0,alpha:this._antiAliasing==="greyscale"})),this._ctx.textBaseline="top",this._ctx.fillStyle="#FFFFFF",this._ctx.font=`${s}px ${this.fontFamily}`,this._textMetrics=this._ctx.measureText("A")}rasterizeGlyph(e,t,i,n){return e===""?{source:this._canvas,boundingBox:{top:0,left:0,bottom:-1,right:-1},originOffset:{x:0,y:0},fontBoundingBoxAscent:0,fontBoundingBoxDescent:0}:this._workGlyphConfig.chars===e&&this._workGlyphConfig.tokenMetadata===t&&this._workGlyphConfig.decorationStyleSetId===i?this._workGlyph:(this._workGlyphConfig.chars=e,this._workGlyphConfig.tokenMetadata=t,this._workGlyphConfig.decorationStyleSetId=i,this._rasterizeGlyph(e,t,i,n))}_rasterizeGlyph(e,t,i,n){const s=Math.ceil(this.fontSize*this.devicePixelRatio),r=s*3;this._canvas.width!==r&&(this._canvas.width=r,this._canvas.height=r),this._ctx.save();const a=(t&15)/10,l=zn.getBackground(t),c=n[l],d=this._decorationStyleCache.getStyleSet(i);this._antiAliasing==="subpixel"?(this._ctx.fillStyle=c,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height)):this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height);const h=new uh(200),u=zn.getFontStyle(t);u&1&&h.appendString("italic "),d?.bold!==void 0?d.bold&&h.appendString("bold "):u&2&&h.appendString("bold "),h.appendString(`${s}px ${this.fontFamily}`),this._ctx.font=h.build();const f=s,g=s;d?.color!==void 0?this._ctx.fillStyle=`#${d.color.toString(16).padStart(8,"0")}`:this._ctx.fillStyle=n[zn.getForeground(t)],this._ctx.textBaseline="top",d?.opacity!==void 0&&(this._ctx.globalAlpha=d.opacity),this._ctx.fillText(e,f+a,g),this._ctx.restore();const m=this._ctx.getImageData(0,0,this._canvas.width,this._canvas.height);if(this._antiAliasing==="subpixel"){const _=parseInt(c.substring(1,3),16),b=parseInt(c.substring(3,5),16),C=parseInt(c.substring(5,7),16);this._clearColor(m,_,b,C),this._ctx.putImageData(m,0,0)}return this._findGlyphBoundingBox(m,this._workGlyph.boundingBox),this._workGlyph.source=this._canvas,this._workGlyph.originOffset.x=this._workGlyph.boundingBox.left-f,this._workGlyph.originOffset.y=this._workGlyph.boundingBox.top-g,this._workGlyph.fontBoundingBoxAscent=this._textMetrics.fontBoundingBoxAscent,this._workGlyph.fontBoundingBoxDescent=this._textMetrics.fontBoundingBoxDescent,this._workGlyph}_clearColor(e,t,i,n){for(let s=0;s<e.data.length;s+=4)e.data[s]===t&&e.data[s+1]===i&&e.data[s+2]===n&&(e.data[s+3]=0)}_findGlyphBoundingBox(e,t){const i=this._canvas.height,n=this._canvas.width;let s=!1;for(let r=0;r<i;r++){for(let a=0;a<n;a++){const l=r*n*4+a*4+3;if(e.data[l]!==0){t.top=r,s=!0;break}}if(s)break}t.left=0,s=!1;for(let r=0;r<n;r++){for(let a=0;a<i;a++){const l=a*n*4+r*4+3;if(e.data[l]!==0){t.left=r,s=!0;break}}if(s)break}t.right=n,s=!1;for(let r=n-1;r>=t.left;r--){for(let a=0;a<i;a++){const l=a*n*4+r*4+3;if(e.data[l]!==0){t.right=r,s=!0;break}}if(s)break}t.bottom=t.top,s=!1;for(let r=i-1;r>=0;r--){for(let a=0;a<n;a++){const l=r*n*4+a*4+3;if(e.data[l]!==0){t.bottom=r,s=!0;break}}if(s)break}}getTextMetrics(e){return this._ctx.measureText(e)}}fue([vi],gv.prototype,"cacheKey",null);var pue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mue=function(o,e){return function(t,i){e(t,i,o)}};let nx=class extends A{constructor(e){super(),this._logService=e,this._tasks=[],this._i=0,this._register(ue(()=>this.clear()))}enqueue(e){this._tasks.push(e),this._start()}clear(){this._idleCallback&&(this._cancelCallback(this._idleCallback),this._idleCallback=void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||(this._idleCallback=this._requestCallback(this._process.bind(this)))}_process(e){this._idleCallback=void 0;let t=0,i=0,n=e.timeRemaining(),s=0;for(;this._i<this._tasks.length;){if(t=Date.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,Date.now()-t),i=Math.max(t,i),s=e.timeRemaining(),i*1.5>s){n-t<-20&&this._logService.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(n-t))}ms`),this._start();return}n=s}this.clear()}};nx=pue([mue(0,Rt)],nx);class _ue extends nx{_requestCallback(e){return ft().setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){ft().clearTimeout(e)}_createDeadline(e){const t=Date.now()+e;return{timeRemaining:()=>Math.max(0,t-Date.now())}}}class bue extends nx{_requestCallback(e){return ft().requestIdleCallback(e)}_cancelCallback(e){ft().cancelIdleCallback(e)}}const Cue="requestIdleCallback"in ft()?bue:_ue;class vue{constructor(e,t){this._canvas=e,this._textureIndex=t,this._currentRow={x:0,y:0,h:0},this._allocatedGlyphs=new Set,this._nextIndex=0,this._ctx=Vf(this._canvas.getContext("2d",{willReadFrequently:!0}))}allocate(e){const t=e.boundingBox.right-e.boundingBox.left+1,i=e.boundingBox.bottom-e.boundingBox.top+1;if(t>this._canvas.width||i>this._canvas.height)throw new Ce("Glyph is too large for the atlas page");if(e.boundingBox.right-e.boundingBox.left+1>this._canvas.width-this._currentRow.x&&(this._currentRow.x=0,this._currentRow.y+=this._currentRow.h,this._currentRow.h=1),this._currentRow.y+e.boundingBox.bottom-e.boundingBox.top+1>this._canvas.height)return;this._ctx.drawImage(e.source,e.boundingBox.left,e.boundingBox.top,t,i,this._currentRow.x,this._currentRow.y,t,i);const n={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:this._currentRow.x,y:this._currentRow.y,w:t,h:i,originOffsetX:e.originOffset.x,originOffsetY:e.originOffset.y,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent};return this._currentRow.x+=t,this._currentRow.h=Math.max(this._currentRow.h,i),this._allocatedGlyphs.add(n),n}getUsagePreview(){const e=this._canvas.width,t=this._canvas.height,i=new OffscreenCanvas(e,t),n=Vf(i.getContext("2d"));n.fillStyle="#808080",n.fillRect(0,0,e,t);const s=new Map,r=new Map;for(const a of this._allocatedGlyphs)s.set(a.y,Math.max(s.get(a.y)??0,a.h)),r.set(a.y,Math.max(r.get(a.y)??0,a.x+a.w));for(const a of this._allocatedGlyphs)n.fillStyle="#4040FF",n.fillRect(a.x,a.y,a.w,a.h),n.fillStyle="#FF0000",n.fillRect(a.x,a.y+a.h,a.w,s.get(a.y)-a.h);for(const[a,l]of r.entries())a!==this._currentRow.y&&(n.fillStyle="#FF0000",n.fillRect(l,a,e-l,s.get(a)));return i.convertToBlob()}getStats(){const e=this._canvas.width,t=this._canvas.height;let i=0,n=0;const s=e*t,r=new Map,a=new Map;for(const l of this._allocatedGlyphs)r.set(l.y,Math.max(r.get(l.y)??0,l.h)),a.set(l.y,Math.max(a.get(l.y)??0,l.x+l.w));for(const l of this._allocatedGlyphs)i+=l.w*l.h,n+=l.w*(r.get(l.y)-l.h);for(const[l,c]of a.entries())l!==this._currentRow.y&&(n+=(e-c)*r.get(l));return[`page${this._textureIndex}:`,` Total: ${s} (${e}x${t})`,` Used: ${i} (${(i/s*100).toPrecision(2)}%)`,` Wasted: ${n} (${(n/s*100).toPrecision(2)}%)`,`Efficiency: ${(i/(i+n)*100).toPrecision(2)}%`].join(`
`)}}class wue{constructor(e,t,i){this._canvas=e,this._textureIndex=t,this._slabs=[],this._activeSlabsByDims=new Vy,this._unusedRects=[],this._openRegionsByHeight=new Map,this._openRegionsByWidth=new Map,this._allocatedGlyphs=new Set,this._nextIndex=0,this._ctx=Vf(this._canvas.getContext("2d",{willReadFrequently:!0})),this._slabW=Math.min(i?.slabW??64<<Math.max(Math.floor(ft().devicePixelRatio)-1,0),this._canvas.width),this._slabH=Math.min(i?.slabH??this._slabW,this._canvas.height),this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}allocate(e){const t=e.boundingBox.right-e.boundingBox.left+1,i=e.boundingBox.bottom-e.boundingBox.top+1;if(t>this._canvas.width||i>this._canvas.height)throw new Ce("Glyph is too large for the atlas page");if(t>this._slabW||i>this._slabH){if(this._allocatedGlyphs.size>0)return;let c=this._canvas.width;for(;t<c/2&&i<c/2;)c/=2;this._slabW=c,this._slabH=c,this._slabsPerRow=Math.floor(this._canvas.width/this._slabW),this._slabsPerColumn=Math.floor(this._canvas.height/this._slabH)}const n={w:t,h:i};let s=this._activeSlabsByDims.get(n.w,n.h);if(s){const c=Math.floor(this._slabW/s.entryW)*Math.floor(this._slabH/s.entryH);s.count>=c&&(s=void 0)}let r,a;if(!s)if(t<i){const c=this._openRegionsByWidth.get(t);if(c?.length)for(let d=c.length-1;d>=0;d--){const h=c[d];if(h.w>=t&&h.h>=i){r=h.x,a=h.y,t<h.w&&this._unusedRects.push({x:h.x+t,y:h.y,w:h.w-t,h:i}),h.y+=i,h.h-=i,h.h===0&&(d===c.length-1?c.pop():this._unusedRects.splice(d,1));break}}}else{const c=this._openRegionsByHeight.get(i);if(c?.length)for(let d=c.length-1;d>=0;d--){const h=c[d];if(h.w>=t&&h.h>=i){r=h.x,a=h.y,i<h.h&&this._unusedRects.push({x:h.x,y:h.y+i,w:t,h:h.h-i}),h.x+=t,h.w-=t,h.h===0&&(d===c.length-1?c.pop():this._unusedRects.splice(d,1));break}}}if(r===void 0||a===void 0){if(!s){if(this._slabs.length>=this._slabsPerRow*this._slabsPerColumn)return;s={x:Math.floor(this._slabs.length%this._slabsPerRow)*this._slabW,y:Math.floor(this._slabs.length/this._slabsPerRow)*this._slabH,entryW:n.w,entryH:n.h,count:0};const d=this._slabW%s.entryW,h=this._slabH%s.entryH;d&&dU(this._openRegionsByWidth,d,{x:s.x+this._slabW-d,w:d,y:s.y,h:this._slabH-(h??0)}),h&&dU(this._openRegionsByHeight,h,{x:s.x,w:this._slabW,y:s.y+this._slabH-h,h}),this._slabs.push(s),this._activeSlabsByDims.set(s,n.w,n.h)}const c=Math.floor(this._slabW/s.entryW);r=s.x+Math.floor(s.count%c)*s.entryW,a=s.y+Math.floor(s.count/c)*s.entryH,s.count++}this._ctx.drawImage(e.source,e.boundingBox.left,e.boundingBox.top,t,i,r,a,t,i);const l={pageIndex:this._textureIndex,glyphIndex:this._nextIndex++,x:r,y:a,w:t,h:i,originOffsetX:e.originOffset.x,originOffsetY:e.originOffset.y,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent};return this._allocatedGlyphs.add(l),l}getUsagePreview(){const e=this._canvas.width,t=this._canvas.height,i=new OffscreenCanvas(e,t),n=Vf(i.getContext("2d"));n.fillStyle="#808080",n.fillRect(0,0,e,t);let s=0,r=0,a=0;const l=64<<Math.floor(ft().devicePixelRatio)-1,c=l;for(const h of this._slabs){let u=0,f=0;for(let _=0;_<h.count;_++)u+h.entryW>l&&(u=0,f+=h.entryH),n.fillStyle="#FF0000",n.fillRect(h.x+u,h.y+f,h.entryW,h.entryH),s+=h.entryW*h.entryH,u+=h.entryW;const g=Math.floor(l/h.entryW),m=Math.floor(c/h.entryH);h.entryW*g*h.entryH*m}for(const h of this._allocatedGlyphs)r+=h.w*h.h,n.fillStyle="#4040FF",n.fillRect(h.x,h.y,h.w,h.h);const d=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(const h of d)n.fillStyle="#FF000088",n.fillRect(h.x,h.y,h.w,h.h),a+=h.w*h.h;return n.globalAlpha=.5,n.drawImage(this._canvas,0,0),n.globalAlpha=1,i.convertToBlob()}getStats(){const e=this._canvas.width,t=this._canvas.height;let i=0,n=0,s=0,r=0,a=0;const l=e*t,c=64<<Math.floor(ft().devicePixelRatio)-1,d=c;for(const g of this._slabs){let m=0,_=0;for(let v=0;v<g.count;v++)m+g.entryW>c&&(m=0,_+=g.entryH),i+=g.entryW*g.entryH,m+=g.entryW;const b=Math.floor(c/g.entryW),C=Math.floor(d/g.entryH),w=g.entryW*b*g.entryH*C;s+=c*d-w}for(const g of this._allocatedGlyphs)n+=g.w*g.h;const h=Array.from(this._openRegionsByWidth.values()).flat().concat(Array.from(this._openRegionsByHeight.values()).flat());for(const g of h)a+=g.w*g.h;const u=s-a;r=i-(n-u);const f=n/(n+r+a);return[`page[${this._textureIndex}]:`,` Total: ${l}px (${e}x${t})`,` Used: ${n}px (${(n/l*100).toFixed(2)}%)`,` Wasted: ${r}px (${(r/l*100).toFixed(2)}%)`,`Restricted: ${a}px (${(a/l*100).toFixed(2)}%) (hard to allocate)`,`Efficiency: ${f===1?"100":(f*100).toFixed(2)}%`,` Slabs: ${this._slabs.length} of ${Math.floor(this._canvas.width/c)*Math.floor(this._canvas.height/d)}`].join(`
`)}}function dU(o,e,t){let i=o.get(e);i||(i=[],o.set(e,i)),i.push(t)}var Sue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hU=function(o,e){return function(t,i){e(t,i,o)}},QM;let Ra=(yp=class extends A{get version(){return this._version}get usedArea(){return this._usedArea}get source(){return this._canvas}get glyphs(){return this._glyphInOrderSet.values()}constructor(e,t,i,n,s){switch(super(),this._logService=n,this._version=0,this._usedArea={left:0,top:0,right:0,bottom:0},this._glyphMap=new Vy,this._glyphInOrderSet=new Set,this._canvas=new OffscreenCanvas(t,t),this._colorMap=s.getColorTheme().tokenColorMap,i){case"shelf":this._allocator=new vue(this._canvas,e);break;case"slab":this._allocator=new wue(this._canvas,e);break;default:this._allocator=i(this._canvas,e);break}this._register(ue(()=>{this._canvas.width=1,this._canvas.height=1}))}getGlyph(e,t,i,n){return this._glyphMap.get(t,i,n,e.cacheKey)??this._createGlyph(e,t,i,n)}_createGlyph(e,t,i,n){if(this._glyphInOrderSet.size>=QM.maximumGlyphCount)return;const s=e.rasterizeGlyph(t,i,n,this._colorMap),r=this._allocator.allocate(s);if(r!==void 0)return this._glyphMap.set(r,t,i,n,e.cacheKey),this._glyphInOrderSet.add(r),this._version++,this._usedArea.right=Math.max(this._usedArea.right,r.x+r.w-1),this._usedArea.bottom=Math.max(this._usedArea.bottom,r.y+r.h-1),this._logService.getLevel()===Qi.Trace&&this._logService.trace("New glyph",{chars:t,tokenMetadata:i,decorationStyleSetId:n,rasterizedGlyph:s,glyph:r}),r}getUsagePreview(){return this._allocator.getUsagePreview()}getStats(){return this._allocator.getStats()}},QM=yp,yp.maximumGlyphCount=5e3,yp);Ra=QM=Sue([hU(3,Rt),hU(4,li)],Ra);var yue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uU=function(o,e){return function(t,i){e(t,i,o)}},sx;let xh=(Lp=class extends A{get pages(){return this._pages}constructor(e,t,i,n,s){super(),this._maxTextureSize=e,this._decorationStyleCache=i,this._themeService=n,this._instantiationService=s,this._warmUpTask=this._register(new ct),this._warmedUpRasterizers=new Set,this._pages=[],this._glyphPageIndex=new Vy,this._onDidDeleteGlyphs=this._register(new P),this.onDidDeleteGlyphs=this._onDidDeleteGlyphs.event,this._allocatorType=t?.allocatorType??"slab",this._register(ie.runAndSubscribe(this._themeService.onDidColorThemeChange,()=>{this._colorMap&&this.clear(),this._colorMap=this._themeService.getColorTheme().tokenColorMap}));const r=Math.max(1,Math.floor(ft().devicePixelRatio));this.pageSize=Math.min(1024*r,this._maxTextureSize),this._initFirstPage(),this._register(ue(()=>pt(this._pages)))}_initFirstPage(){const e=this._instantiationService.createInstance(Ra,0,this.pageSize,this._allocatorType);this._pages.push(e);const t=new gv(1,"",1,this._decorationStyleCache);e.getGlyph(t,"",0,0),t.dispose()}clear(){for(const e of this._pages)e.dispose();this._pages.length=0,this._glyphPageIndex.clear(),this._warmedUpRasterizers.clear(),this._warmUpTask.clear(),this._initFirstPage(),this._onDidDeleteGlyphs.fire()}getGlyph(e,t,i,n,s){return i&=-2048,i|=Math.floor(s%1*10),this._warmedUpRasterizers.has(e.id)||(this._warmUpAtlas(e),this._warmedUpRasterizers.add(e.id)),this._tryGetGlyph(this._glyphPageIndex.get(t,i,n,e.cacheKey)??0,e,t,i,n)}_tryGetGlyph(e,t,i,n,s){return this._glyphPageIndex.set(e,i,n,s,t.cacheKey),this._pages[e].getGlyph(t,i,n,s)??(e+1<this._pages.length?this._tryGetGlyph(e+1,t,i,n,s):void 0)??this._getGlyphFromNewPage(t,i,n,s)}_getGlyphFromNewPage(e,t,i,n){if(this._pages.length>=sx.maximumPageCount)throw new Error(`Attempt to create a texture atlas page past the limit ${sx.maximumPageCount}`);return this._pages.push(this._instantiationService.createInstance(Ra,this._pages.length,this.pageSize,this._allocatorType)),this._glyphPageIndex.set(this._pages.length-1,t,i,n,e.cacheKey),this._pages[this._pages.length-1].getGlyph(e,t,i,n)}getStats(){return this._pages.map(e=>e.getStats())}_warmUpAtlas(e){const t=this._colorMap;if(!t)throw new Ce("Cannot warm atlas without color map");this._warmUpTask.value?.clear();const i=this._warmUpTask.value=this._instantiationService.createInstance(Cue);for(let n=65;n<=90;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)});for(let n=97;n<=122;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)});for(let n=33;n<=126;n++)for(const s of t.keys())i.enqueue(()=>{for(let r=0;r<1;r+=.1)this.getGlyph(e,String.fromCharCode(n),s<<15&16744448,0,r)})}},sx=Lp,Lp.maximumPageCount=16,Lp);xh=sx=yue([uU(3,li),uU(4,ge)],xh);var pv;(function(o){o[o.Ignore=0]="Ignore",o[o.Info=1]="Info",o[o.Warning=2]="Warning",o[o.Error=3]="Error"})(pv||(pv={})),(function(o){const e="error",t="warning",i="warn",n="info",s="ignore";function r(l){return l?Nm(e,l)?o.Error:Nm(t,l)||Nm(i,l)?o.Warning:Nm(n,l)?o.Info:o.Ignore:o.Ignore}o.fromValue=r;function a(l){switch(l){case o.Error:return e;case o.Warning:return t;case o.Info:return n;default:return s}}o.toString=a})(pv||(pv={}));const ii=pv;var k_=ii;const hi=We("notificationService");class Lue{}var qs;(function(o){async function e(n){try{if(!navigator.gpu)throw new Error("This browser does not support WebGPU");const s=await navigator.gpu.requestAdapter();if(!s)throw new Error("This browser supports WebGPU but it appears to be disabled");return JM(await s.requestDevice())}catch(s){throw n&&n(s.message),s}}o.requestDevice=e;function t(n,s,r){const a=n.createBuffer(s);return r&&n.queue.writeBuffer(a,0,Ku(r)?r():r),JM(a)}o.createBuffer=t;function i(n,s){return JM(n.createTexture(s))}o.createTexture=i})(qs||(qs={}));function JM(o){return{object:o,dispose:()=>o.destroy()}}class xue{get dataOffset(){return this._startIndex}get dirtySize(){if(!(this._startIndex===void 0||this._endIndex===void 0))return this._endIndex-this._startIndex+1}get isDirty(){return this._startIndex!==void 0}flag(e,t=1){return this._flag(e),t>1&&this._flag(e+t-1),e}_flag(e){(this._startIndex===void 0||e<this._startIndex)&&(this._startIndex=e),(this._endIndex===void 0||e>this._endIndex)&&(this._endIndex=e)}clear(){this._startIndex=void 0,this._endIndex=void 0}}function kue(o,e){return new Iue(o,e)}class Iue extends A{get entryCount(){return this._entries.size}get dirtyTracker(){return this._dirtyTracker}constructor(e,t){super(),this.propertySpecs=e,this.capacity=t,this._dirtyTracker=new xue,this._propertySpecsMap=new Map,this._entries=new Jn,this._onDidChange=this._register(new P),this._onDidChangeBuffer=this._register(new P),this.onDidChangeBuffer=this._onDidChangeBuffer.event,this.view=new Float32Array(t*e.length),this.buffer=this.view.buffer,this._entrySize=e.length;for(let i=0;i<e.length;i++){const n={offset:i,...e[i]};this._propertySpecsMap.set(n.name,n)}this._register(ue(()=>pt(this._entries)))}createEntry(e){this._entries.size===this.capacity&&(this._expandBuffer(),this._onDidChangeBuffer.fire());const t=new Due(this.view,this._propertySpecsMap,this._dirtyTracker,this._entries.size,e),i=this._entries.push(t),n=[];return n.push(ie.forward(t.onDidChange,this._onDidChange)),n.push(t.onWillDispose(()=>{const s=t.i;i(),this.view.set(this.view.subarray(s*this._entrySize+2,this._entries.size*this._entrySize+2),s*this._entrySize);for(const r of this._entries)r.i>s&&r.i--;this._dirtyTracker.flag(s,(this._entries.size-s)*this._entrySize),pt(n)})),t}_expandBuffer(){this.capacity*=2;const e=new Float32Array(this.capacity*this._entrySize);e.set(this.view),this.view=e,this.buffer=this.view.buffer}}class Due extends A{constructor(e,t,i,n,s){super(),this._view=e,this._propertySpecsMap=t,this._dirtyTracker=i,this.i=n,this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this._onWillDispose=this._register(new P),this.onWillDispose=this._onWillDispose.event;for(const r of this._propertySpecsMap.values())this._view[this.i*this._propertySpecsMap.size+r.offset]=s[r.name];this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}dispose(){this._onWillDispose.fire(),super.dispose()}setRaw(e){if(e.length!==this._propertySpecsMap.size)throw new Error(`Data length ${e.length} does not match the number of properties in the collection (${this._propertySpecsMap.size})`);this._view.set(e,this.i*this._propertySpecsMap.size),this._dirtyTracker.flag(this.i*this._propertySpecsMap.size,this._propertySpecsMap.size)}}const Eue=`
struct Vertex {
@location(0) position: vec2f,
};
struct LayoutInfo {
canvasDims: vec2f,
viewportOffset: vec2f,
viewportDims: vec2f,
}
struct ScrollOffset {
offset: vec2f,
}
struct Shape {
position: vec2f,
size: vec2f,
color: vec4f,
};
struct VSOutput {
@builtin(position) position: vec4f,
@location(1) color: vec4f,
};
// Uniforms
@group(0) @binding(1) var<uniform> layoutInfo: LayoutInfo;
// Storage buffers
@group(0) @binding(0) var<storage, read> shapes: array<Shape>;
@group(0) @binding(2) var<uniform> scrollOffset: ScrollOffset;
@vertex fn vs(
vert: Vertex,
@builtin(instance_index) instanceIndex: u32,
@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
let shape = shapes[instanceIndex];
var vsOut: VSOutput;
vsOut.position = vec4f(
(
// Top left corner
vec2f(-1, 1) +
// Convert pixel position to clipspace
vec2f( 2, -2) / layoutInfo.canvasDims *
// Shape position and size
(layoutInfo.viewportOffset - scrollOffset.offset + shape.position + vert.position * shape.size)
),
0.0,
1.0
);
vsOut.color = shape.color;
return vsOut;
}
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
return vsOut.color;
}
`;class Nue extends Tf{constructor(e,t,i,n,s,r){super(),this._context=e,this._contentLeft=t,this._devicePixelRatio=i,this._canvas=n,this._ctx=s,this._shapeBindBuffer=this._register(new ct),this._initialized=!1,this._shapeCollection=this._register(kue([{name:"x"},{name:"y"},{name:"width"},{name:"height"},{name:"red"},{name:"green"},{name:"blue"},{name:"alpha"}],32)),this._context.addEventHandler(this),this._initWebgpu(r)}async _initWebgpu(e){if(this._device=await e,this._store.isDisposed)return;const t=navigator.gpu.getPreferredCanvasFormat();this._ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco rectangle renderer render pass",colorAttachments:[this._renderPassColorAttachment]};let i;{const a=new Float32Array(6),l=(c=this._canvas.width,d=this._canvas.height)=>(a[0]=c,a[1]=d,a[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*ft().devicePixelRatio),a[3]=0,a[4]=a[0]-a[2],a[5]=a[1]-a[3],a);i=this._register(qs.createBuffer(this._device,{label:"Monaco rectangle renderer uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>l())).object,this._register(cU(this._canvas,ft(),(c,d)=>{this._device.queue.writeBuffer(i,0,l(c,d))}))}const n=2;this._scrollOffsetBindBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco rectangle renderer scroll offset buffer",size:n*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(n);const s=()=>qs.createBuffer(this._device,{label:"Monaco rectangle renderer shape buffer",size:this._shapeCollection.buffer.byteLength,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST});this._shapeBindBuffer.value=s(),this._register(ie.runAndSubscribe(this._shapeCollection.onDidChangeBuffer,()=>{this._shapeBindBuffer.value=s(),this._pipeline&&this._updateBindGroup(this._pipeline,i)})),this._vertexBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco rectangle renderer vertex buffer",size:Hf.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},Hf)).object;const r=this._device.createShaderModule({label:"Monaco rectangle renderer shader module",code:Eue});this._pipeline=this._device.createRenderPipeline({label:"Monaco rectangle renderer render pipeline",layout:"auto",vertex:{module:r,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:r,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._updateBindGroup(this._pipeline,i),this._initialized=!0}_updateBindGroup(e,t){this._bindGroup=this._device.createBindGroup({label:"Monaco rectangle renderer bind group",layout:e.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._shapeBindBuffer.value.object}},{binding:1,resource:{buffer:t}},{binding:2,resource:{buffer:this._scrollOffsetBindBuffer}}]})}register(e,t,i,n,s,r,a,l){return this._shapeCollection.createEntry({x:e,y:t,width:i,height:n,red:s,green:r,blue:a,alpha:l})}onScrollChanged(e){if(this._device){const t=ft().devicePixelRatio;this._scrollOffsetValueBuffer[0]=this._context.viewLayout.getCurrentScrollLeft()*t,this._scrollOffsetValueBuffer[1]=this._context.viewLayout.getCurrentScrollTop()*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer)}return!0}_update(){if(!this._device)return;const e=this._shapeCollection;e.dirtyTracker.isDirty&&(this._device.queue.writeBuffer(this._shapeBindBuffer.value.object,0,e.buffer,e.dirtyTracker.dataOffset,e.dirtyTracker.dirtySize*e.view.BYTES_PER_ELEMENT),e.dirtyTracker.clear())}draw(e){if(!this._initialized)return;this._update();const t=this._device.createCommandEncoder({label:"Monaco rectangle renderer command encoder"});this._renderPassColorAttachment.view=this._ctx.getCurrentTexture().createView();const i=t.beginRenderPass(this._renderPassDescriptor);i.setPipeline(this._pipeline),i.setVertexBuffer(0,this._vertexBuffer),i.setBindGroup(0,this._bindGroup);const n=Math.ceil(this._contentLeft.get()*this._devicePixelRatio.get());i.setScissorRect(n,0,this._canvas.width-n,this._canvas.height),i.draw(Hf.length/2,this._shapeCollection.entryCount),i.end();const s=t.finish();this._device.queue.submit([s])}}class Tue extends A{constructor(){super(),this._ruleCache=new Map,this._container=Q("div.monaco-decoration-css-rule-extractor"),this._dummyElement=Q("span"),this._container.appendChild(this._dummyElement),this._register(ue(()=>this._container.remove()))}getStyleRules(e,t){const i=this._ruleCache.get(t);if(i)return i;this._dummyElement.className=t,e.appendChild(this._container);const n=this._getStyleRules(t);return this._ruleCache.set(t,n),e.removeChild(this._container),n}_getStyleRules(e){const t=[],n=[...w1().styleSheets];for(let s=0;s<n.length;s++){const r=n[s];for(const a of r.cssRules)if(a instanceof CSSImportRule)a.styleSheet&&n.push(a.styleSheet);else if(a instanceof CSSStyleRule){const l=`.${e}`,c=a.selectorText.indexOf(l);if(c!==-1){const d=c+l.length;(a.selectorText.length===d||a.selectorText.substring(d,d+1).match(/[ :]/))&&t.push(a)}}}return t}}class Rue{constructor(){this._nextId=1,this._cacheById=new Map,this._cacheByStyle=new Vy}getOrCreateEntry(e,t,i){if(e===void 0&&t===void 0&&i===void 0)return 0;const n=this._cacheByStyle.get(e??0,t?1:0,i===void 0?"":i.toFixed(2));if(n)return n.id;const s=this._nextId++,r={id:s,color:e,bold:t,opacity:i};return this._cacheById.set(s,r),this._cacheByStyle.set(r,e??0,t?1:0,i===void 0?"":i.toFixed(2)),s}getStyleSet(e){if(e!==0)return this._cacheById.get(e)}}var Mue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},eP=function(o,e){return function(t,i){e(t,i,o)}},Ss;let ls=(Su=class extends A{static get decorationCssRuleExtractor(){return Ss._decorationCssRuleExtractor}static get decorationStyleCache(){return Ss._decorationStyleCache}static get atlas(){if(!Ss._atlas)throw new Ce("Cannot call ViewGpuContext.textureAtlas before device is resolved");return Ss._atlas}get atlas(){return Ss.atlas}constructor(e,t,i,n){super(),this._instantiationService=t,this._notificationService=i,this.configurationService=n,this.maxGpuCols=2e3,this.canvas=lt(document.createElement("canvas")),this.canvas.setClassName("editorCanvas"),this._register(ie.runAndSubscribe(n.onDidChangeConfiguration,l=>{if(!l||l.affectsConfiguration("editor.scrollbar.verticalScrollbarSize")){const c=n.getValue("editor").scrollbar?.verticalScrollbarSize??14;this.canvas.domNode.style.boxSizing="border-box",this.canvas.domNode.style.paddingRight=`${c}px`}})),this.ctx=Vf(this.canvas.domNode.getContext("webgpu")),Ss.device||(Ss.device=qs.requestDevice(l=>{const c=[{label:p(73,"Use DOM-based rendering"),run:()=>this.configurationService.updateValue("editor.experimentalGpuAcceleration","off")}];this._notificationService.prompt(k_.Warning,l,c)}).then(l=>(Ss.deviceSync=l.object,Ss._atlas||(Ss._atlas=this._instantiationService.createInstance(xh,l.object.limits.maxTextureDimension2D,void 0,Ss.decorationStyleCache)),l.object)));const s=Le(this,ft().devicePixelRatio);this._register(W(ft(),"resize",()=>{s.set(ft().devicePixelRatio,void 0)})),this.devicePixelRatio=s,this._register(Sa(this.devicePixelRatio,()=>Ss.atlas?.clear()));const r=Le(this,{width:this.canvas.domNode.width,height:this.canvas.domNode.height});this._register(cU(this.canvas.domNode,ft(),(l,c)=>{this.canvas.domNode.width=l,this.canvas.domNode.height=c,r.set({width:l,height:c},void 0)})),this.canvasDevicePixelDimensions=r;const a=Le(this,0);this._register(this.configurationService.onDidChangeConfiguration(l=>{a.set(e.configuration.options.get(165).contentLeft,void 0)})),this.contentLeft=a,this.rectangleRenderer=this._instantiationService.createInstance(Nue,e,this.contentLeft,this.devicePixelRatio,this.canvas.domNode,this.ctx,Ss.device)}canRender(e,t,i){const n=t.getViewLineRenderingData(i);if(n.containsRTL||n.maxColumn>this.maxGpuCols)return!1;if(n.inlineDecorations.length>0){let s=!0;for(const r of n.inlineDecorations){if(r.type!==0){s=!1;break}const a=Ss._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,r.inlineClassName);if(s&&=a.every(l=>{if(l.selectorText.includes(":"))return!1;for(const c of l.style)if(!fU(c,l.style))return!1;return!0}),!s)break}return s}return!0}canRenderDetailed(e,t,i){const n=t.getViewLineRenderingData(i),s=[];if(n.containsRTL&&s.push("containsRTL"),n.maxColumn>this.maxGpuCols&&s.push("maxColumn > maxGpuCols"),n.inlineDecorations.length>0){let r=!0;const a=[],l=[],c=[];for(const d of n.inlineDecorations){if(d.type!==0){a.push(d.type),r=!1;continue}const h=Ss._decorationCssRuleExtractor.getStyleRules(this.canvas.domNode,d.inlineClassName);r&&=h.every(u=>{if(u.selectorText.includes(":"))return l.push(u.selectorText),!1;for(const f of u.style)if(!fU(f,u.style))return c.push(`${f}: ${u.style[f]}`),!1;return!0})}a.length>0&&s.push(`inlineDecorations with unsupported types (${a.map(d=>`\`${d}\``).join(", ")})`),c.length>0&&s.push(`inlineDecorations with unsupported CSS rules (${c.map(d=>`\`${d}\``).join(", ")})`),l.length>0&&s.push(`inlineDecorations with unsupported CSS selectors (${l.map(d=>`\`${d}\``).join(", ")})`)}return s}},Ss=Su,Su._decorationCssRuleExtractor=new Tue,Su._decorationStyleCache=new Rue,Su);ls=Ss=Mue([eP(1,ge),eP(2,hi),eP(3,Me)],ls);const Pue=["color","font-weight","opacity"];function fU(o,e){return!!Pue.includes(o)}function ox(o,e){return o.isBasicASCII&&e.useMonospaceOptimizations?new Aue(o):new Oue(o)}class Aue{constructor(e){this._content=e.content}getSegmentAtIndex(e){return this._content[e]}}class Oue{constructor(e){this._segments=[];const t=e.content,i=Sf.Segmenter(void 0,{granularity:"grapheme"}).value,n=Array.from(i.segment(t));let s=0;for(let r=0;r<t.length;r++){const a=n[s];if(!a)break;if(a.index!==r){this._segments.push(void 0);continue}s++,this._segments.push(a)}}getSegmentAtIndex(e){return this._segments[e]?.segment}}class gU extends Tf{get glyphRasterizer(){return this._glyphRasterizer.value}constructor(e,t,i,n){super(),this._context=e,this._viewGpuContext=t,this._device=i,this._glyphRasterizer=n,this._context.addEventHandler(this)}}const pU=`
struct GlyphInfo {
position: vec2f,
size: vec2f,
origin: vec2f,
};
struct Vertex {
@location(0) position: vec2f,
};
struct Cell {
position: vec2f,
unused1: vec2f,
glyphIndex: f32,
textureIndex: f32
};
struct LayoutInfo {
canvasDims: vec2f,
viewportOffset: vec2f,
viewportDims: vec2f,
}
struct ScrollOffset {
offset: vec2f
}
struct VSOutput {
@builtin(position) position: vec4f,
@location(1) layerIndex: f32,
@location(0) texcoord: vec2f,
};
// Uniforms
@group(0) @binding(4) var<uniform> layoutInfo: LayoutInfo;
@group(0) @binding(5) var<uniform> atlasDims: vec2f;
@group(0) @binding(6) var<uniform> scrollOffset: ScrollOffset;
// Storage buffers
@group(0) @binding(0) var<storage, read> glyphInfo: array<array<GlyphInfo, ${Ra.maximumGlyphCount}>, ${xh.maximumPageCount}>;
@group(0) @binding(1) var<storage, read> cells: array<Cell>;
@vertex fn vs(
vert: Vertex,
@builtin(instance_index) instanceIndex: u32,
@builtin(vertex_index) vertexIndex : u32
) -> VSOutput {
let cell = cells[instanceIndex];
var glyph = glyphInfo[u32(cell.textureIndex)][u32(cell.glyphIndex)];
var vsOut: VSOutput;
// Multiple vert.position by 2,-2 to get it into clipspace which ranged from -1 to 1
vsOut.position = vec4f(
// Make everything relative to top left instead of center
vec2f(-1, 1) +
((vert.position * vec2f(2, -2)) / layoutInfo.canvasDims) * glyph.size +
((cell.position * vec2f(2, -2)) / layoutInfo.canvasDims) +
((glyph.origin * vec2f(2, -2)) / layoutInfo.canvasDims) +
(((layoutInfo.viewportOffset - scrollOffset.offset * vec2(1, -1)) * 2) / layoutInfo.canvasDims),
0.0,
1.0
);
vsOut.layerIndex = cell.textureIndex;
// Textures are flipped from natural direction on the y-axis, so flip it back
vsOut.texcoord = vert.position;
vsOut.texcoord = (
// Glyph offset (0-1)
(glyph.position / atlasDims) +
// Glyph coordinate (0-1)
(vsOut.texcoord * (glyph.size / atlasDims))
);
return vsOut;
}
@group(0) @binding(2) var ourSampler: sampler;
@group(0) @binding(3) var ourTexture: texture_2d_array<f32>;
@fragment fn fs(vsOut: VSOutput) -> @location(0) vec4f {
return textureSample(ourTexture, ourSampler, vsOut.texcoord, u32(vsOut.layerIndex));
}
`,cc=class cc extends gU{get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}constructor(e,t,i,n){super(e,t,i,n),this.type="viewport",this.wgsl=pU,this._cellBindBufferLineCapacity=63,this._activeDoubleBufferIndex=0,this._visibleObjectCount=0,this._scrollInitialized=!1,this._onDidChangeBindGroupEntries=this._register(new P),this.onDidChangeBindGroupEntries=this._onDidChangeBindGroupEntries.event,this._rebuildCellBuffer(this._cellBindBufferLineCapacity);const s=2;this._scrollOffsetBindBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:s*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(s)}_rebuildCellBuffer(e){this._cellBindBuffer?.destroy();const t=(Math.floor(e/32)+1)*32,i=t*cc.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco full file cell buffer",size:i,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(i),new ArrayBuffer(i)],this._cellBindBufferLineCapacity=t,this._onDidChangeBindGroupEntries.fire()}onConfigurationChanged(e){return!0}onDecorationsChanged(e){return!0}onTokensChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLinesChanged(e){return!0}onScrollChanged(e){const t=ft().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return!0}onLineMappingChanged(e){return!0}onZonesChanged(e){return!0}reset(){for(const e of[0,1]){const t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}}update(e,t){let i="",n,s=0,r=0,a=0,l=0,c=0,d=0,h,u=0,f=0,g=0,m=0,_,b,C,w,v,S=0,L=0,x;const I=ft().devicePixelRatio;let D;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0),this._cellBindBufferLineCapacity<e.endLineNumber-e.startLineNumber+1&&this._rebuildCellBuffer(e.endLineNumber-e.startLineNumber+1);const R=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]);R.fill(0);const F=cc.maxSupportedColumns*6;for(r=e.startLineNumber;r<=e.endLineNumber;r++)if(this._viewGpuContext.canRender(t,e,r)){w=e.getViewLineRenderingData(r),d=0,D=ox(w,t),s=t.spaceWidth*I,l=0,x=w.tokens,f=w.minColumn-1,g=0;for(let B=0,V=x.getCount();B<V;B++)if(g=x.getEndOffset(B),!(g<=f)){for(m=x.getMetadata(B),a=f;a<g&&!(a>cc.maxSupportedColumns);a++){if(n=D.getSegmentAtIndex(a),n===void 0)continue;i=n,w.isBasicASCII&&t.useMonospaceOptimizations||(s=this.glyphRasterizer.getTextMetrics(i).width),b=void 0,_=void 0,C=void 0;for(v of w.inlineDecorations){if(r<v.range.startLineNumber||r>v.range.endLineNumber||r===v.range.startLineNumber&&a<v.range.startColumn-1||r===v.range.endLineNumber&&a>=v.range.endColumn-1)continue;const ee=ls.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,v.inlineClassName);for(const se of ee)for(const oe of se.style){const fe=se.styleMap.get(oe)?.toString()??"";switch(oe){case"color":{const Ie=$.Format.CSS.parse(fe);if(!Ie)throw new Ce("Invalid color format "+fe);b=Ie.toNumber32Bit();break}case"font-weight":{Fue(fe)>=400?_=!0:_=!1;break}case"opacity":{C=Wue(fe);break}default:throw new Ce("Unexpected inline decoration style")}}}if(i===" "||i===" "){if(u=((r-1)*cc.maxSupportedColumns+a)*6,R.fill(0,u,u+6),i===" "){const ee=a+d;d=ti.nextRenderTabStop(a+d,w.tabSize),l+=s*(d-ee),d-=a+1}else l+=s;continue}const z=ls.decorationStyleCache.getOrCreateEntry(b,_,C);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,i,m,z,l),c=Math.round(e.relativeVerticalOffset[r-e.startLineNumber]*I+Math.floor((e.lineHeight*I-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),u=((r-e.startLineNumber)*cc.maxSupportedColumns+a)*6,R[u+0]=Math.floor(l),R[u+1]=c,R[u+4]=h.glyphIndex,R[u+5]=h.pageIndex,l+=s}f=g}S=((r-e.startLineNumber)*cc.maxSupportedColumns+g)*6,L=(r-e.startLineNumber)*cc.maxSupportedColumns*6,R.fill(0,S,L)}const O=(e.endLineNumber-e.startLineNumber+1)*F;return this._device.queue.writeBuffer(this._cellBindBuffer,0,R.buffer,0,(e.endLineNumber-e.startLineNumber)*F*Float32Array.BYTES_PER_ELEMENT),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=O,O}draw(e,t){if(this._visibleObjectCount<=0)throw new Ce("Attempt to draw 0 objects");e.draw(Hf.length/2,this._visibleObjectCount)}};cc.maxSupportedColumns=2e3;let tP=cc;function Fue(o){switch(o){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(o)}function Wue(o){return o.endsWith("%")?parseFloat(o.substring(0,o.length-1))/100:o.match(/^\d+(?:\.\d*)/)?parseFloat(o):1}const Fn=class Fn extends gU{get bindGroupEntries(){return[{binding:1,resource:{buffer:this._cellBindBuffer}},{binding:6,resource:{buffer:this._scrollOffsetBindBuffer}}]}constructor(e,t,i,n){super(e,t,i,n),this.type="fullfile",this.wgsl=pU,this._activeDoubleBufferIndex=0,this._upToDateLines=[new Set,new Set],this._visibleObjectCount=0,this._finalRenderedLine=0,this._scrollInitialized=!1,this._queuedBufferUpdates=[[],[]];const s=Fn.maxSupportedLines*Fn.maxSupportedColumns*6*Float32Array.BYTES_PER_ELEMENT;this._cellBindBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco full file cell buffer",size:s,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._cellValueBuffers=[new ArrayBuffer(s),new ArrayBuffer(s)];const r=2;this._scrollOffsetBindBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco scroll offset buffer",size:r*Float32Array.BYTES_PER_ELEMENT,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST})).object,this._scrollOffsetValueBuffer=new Float32Array(r)}onConfigurationChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onDecorationsChanged(e){return this._invalidateAllLines(),!0}onTokensChanged(e){for(const t of e.ranges)this._invalidateLineRange(t.fromLineNumber,t.toLineNumber);return!0}onLinesDeleted(e){return this._invalidateLinesFrom(e.fromLineNumber),this._queueBufferUpdate(e),!0}onLinesInserted(e){return this._invalidateLinesFrom(e.fromLineNumber),!0}onLinesChanged(e){return this._invalidateLineRange(e.fromLineNumber,e.fromLineNumber+e.count),!0}onScrollChanged(e){const t=ft().devicePixelRatio;return this._scrollOffsetValueBuffer[0]=(e?.scrollLeft??this._context.viewLayout.getCurrentScrollLeft())*t,this._scrollOffsetValueBuffer[1]=(e?.scrollTop??this._context.viewLayout.getCurrentScrollTop())*t,this._device.queue.writeBuffer(this._scrollOffsetBindBuffer,0,this._scrollOffsetValueBuffer),!0}onThemeChanged(e){return this._invalidateAllLines(),!0}onLineMappingChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}onZonesChanged(e){return this._invalidateAllLines(),this._queueBufferUpdate(e),!0}_invalidateAllLines(){this._upToDateLines[0].clear(),this._upToDateLines[1].clear()}_invalidateLinesFrom(e){for(const t of[0,1]){const i=this._upToDateLines[t];for(const n of i)n>=e&&i.delete(n)}}_invalidateLineRange(e,t){for(let i=e;i<=t;i++)this._upToDateLines[0].delete(i),this._upToDateLines[1].delete(i)}reset(){this._invalidateAllLines();for(const e of[0,1]){const t=new Float32Array(this._cellValueBuffers[e]);t.fill(0,0,t.length),this._device.queue.writeBuffer(this._cellBindBuffer,0,t.buffer,0,t.byteLength)}this._finalRenderedLine=0}update(e,t){let i="",n,s=0,r=0,a=0,l=0,c=0,d=0,h,u=0,f=0,g=0,m=0,_,b,C,w,v,S=0,L=0,x;const I=ft().devicePixelRatio;let D;this._scrollInitialized||(this.onScrollChanged(),this._scrollInitialized=!0);const R=new Float32Array(this._cellValueBuffers[this._activeDoubleBufferIndex]),F=Fn.maxSupportedColumns*6,O=this._upToDateLines[this._activeDoubleBufferIndex];let B=3e3,V=0;const z=this._queuedBufferUpdates[this._activeDoubleBufferIndex];for(;z.length;){const se=z.shift();switch(se.type){case 2:case 8:case 17:{R.fill(0),B=1,V=Math.max(V,this._finalRenderedLine),this._finalRenderedLine=0;break}case 10:{const oe=(se.fromLineNumber-1)*Fn.maxSupportedColumns*6,fe=se.toLineNumber*Fn.maxSupportedColumns*6,Ie=(this._finalRenderedLine-(se.toLineNumber-se.fromLineNumber+1))*Fn.maxSupportedColumns*6;R.set(R.subarray(fe),oe),R.fill(0,Ie),B=Math.min(B,se.fromLineNumber),V=Math.max(V,this._finalRenderedLine),this._finalRenderedLine-=se.toLineNumber-se.fromLineNumber+1;break}}}for(r=e.startLineNumber;r<=e.endLineNumber;r++){if(!this._viewGpuContext.canRender(t,e,r)){S=(r-1)*Fn.maxSupportedColumns*6,L=r*Fn.maxSupportedColumns*6,R.fill(0,S,L),B=Math.min(B,r),V=Math.max(V,r);continue}if(!O.has(r)){B=Math.min(B,r),V=Math.max(V,r),w=e.getViewLineRenderingData(r),d=0,D=ox(w,t),s=t.spaceWidth*I,l=0,x=w.tokens,f=w.minColumn-1,g=0;for(let se=0,oe=x.getCount();se<oe;se++)if(g=x.getEndOffset(se),!(g<=f)){for(m=x.getMetadata(se),a=f;a<g&&!(a>Fn.maxSupportedColumns);a++){if(n=D.getSegmentAtIndex(a),n===void 0)continue;i=n,w.isBasicASCII&&t.useMonospaceOptimizations||(s=this.glyphRasterizer.getTextMetrics(i).width),b=void 0,_=void 0,C=void 0;for(v of w.inlineDecorations){if(r<v.range.startLineNumber||r>v.range.endLineNumber||r===v.range.startLineNumber&&a<v.range.startColumn-1||r===v.range.endLineNumber&&a>=v.range.endColumn-1)continue;const Ie=ls.decorationCssRuleExtractor.getStyleRules(this._viewGpuContext.canvas.domNode,v.inlineClassName);for(const Ae of Ie)for(const tt of Ae.style){const Ke=Ae.styleMap.get(tt)?.toString()??"";switch(tt){case"color":{const At=$.Format.CSS.parse(Ke);if(!At)throw new Ce("Invalid color format "+Ke);b=At.toNumber32Bit();break}case"font-weight":{Bue(Ke)>=400?_=!0:_=!1;break}case"opacity":{C=Hue(Ke);break}default:throw new Ce("Unexpected inline decoration style")}}}if(i===" "||i===" "){if(u=((r-1)*Fn.maxSupportedColumns+a)*6,R.fill(0,u,u+6),i===" "){const Ie=a+d;d=ti.nextRenderTabStop(a+d,w.tabSize),l+=s*(d-Ie),d-=a+1}else l+=s;continue}const fe=ls.decorationStyleCache.getOrCreateEntry(b,_,C);h=this._viewGpuContext.atlas.getGlyph(this.glyphRasterizer,i,m,fe,l),c=Math.round(e.relativeVerticalOffset[r-e.startLineNumber]*I+Math.floor((e.lineHeight*I-(h.fontBoundingBoxAscent+h.fontBoundingBoxDescent))/2)+h.fontBoundingBoxAscent),u=((r-1)*Fn.maxSupportedColumns+a)*6,R[u+0]=Math.floor(l),R[u+1]=c,R[u+4]=h.glyphIndex,R[u+5]=h.pageIndex,l+=s}f=g}S=((r-1)*Fn.maxSupportedColumns+g)*6,L=r*Fn.maxSupportedColumns*6,R.fill(0,S,L),O.add(r)}}const ee=(e.endLineNumber-e.startLineNumber+1)*F;return B=Math.min(B,Fn.maxSupportedLines),V=Math.min(V,Fn.maxSupportedLines),B<=V&&this._device.queue.writeBuffer(this._cellBindBuffer,(B-1)*F*Float32Array.BYTES_PER_ELEMENT,R.buffer,(B-1)*F*Float32Array.BYTES_PER_ELEMENT,(V-B+1)*F*Float32Array.BYTES_PER_ELEMENT),this._finalRenderedLine=Math.max(this._finalRenderedLine,V),this._activeDoubleBufferIndex=this._activeDoubleBufferIndex?0:1,this._visibleObjectCount=ee,ee}draw(e,t){if(this._visibleObjectCount<=0)throw new Ce("Attempt to draw 0 objects");e.draw(Hf.length/2,this._visibleObjectCount,void 0,(t.startLineNumber-1)*Fn.maxSupportedColumns)}_queueBufferUpdate(e){this._queuedBufferUpdates[0].push(e),this._queuedBufferUpdates[1].push(e)}};Fn.maxSupportedLines=3e3,Fn.maxSupportedColumns=200;let zf=Fn;function Bue(o){switch(o){case"lighter":case"normal":return 400;case"bolder":case"bold":return 700}return parseInt(o)}function Hue(o){return o.endsWith("%")?parseFloat(o.substring(0,o.length-1))/100:o.match(/^\d+(?:\.\d*)/)?parseFloat(o):1}var Vue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mU=function(o,e){return function(t,i){e(t,i,o)}};let iP=class extends vs{constructor(e,t,i,n){super(e),this._viewGpuContext=t,this._instantiationService=i,this._logService=n,this._atlasGpuTextureVersions=[],this._initialized=!1,this._glyphRasterizer=this._register(new ct),this._renderStrategy=this._register(new ct),this.canvas=this._viewGpuContext.canvas.domNode,this._register(Se(s=>{this._viewGpuContext.canvasDevicePixelDimensions.read(s);const r=this._lastViewportData;r&&setTimeout(()=>{r===this._lastViewportData&&this.renderText(r)})})),this.initWebgpu()}async initWebgpu(){if(this._device=ls.deviceSync||await ls.device,this._store.isDisposed)return;const e=ls.atlas;this._register(e.onDidDeleteGlyphs(()=>{this._atlasGpuTextureVersions.length=0,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._renderStrategy.value.reset()}));const t=navigator.gpu.getPreferredCanvasFormat();this._viewGpuContext.ctx.configure({device:this._device,format:t,alphaMode:"premultiplied"}),this._renderPassColorAttachment={view:null,loadOp:"load",storeOp:"store"},this._renderPassDescriptor={label:"Monaco render pass",colorAttachments:[this._renderPassColorAttachment]};let i;{const l=new Float32Array(6),c=(d=this.canvas.width,h=this.canvas.height)=>(l[0]=d,l[1]=h,l[2]=Math.ceil(this._context.configuration.options.get(165).contentLeft*ft().devicePixelRatio),l[3]=0,l[4]=l[0]-l[2],l[5]=l[1]-l[3],l);i=this._register(qs.createBuffer(this._device,{label:"Monaco uniform buffer",size:24,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>c())).object,this._register(Sa(this._viewGpuContext.canvasDevicePixelDimensions,({width:d,height:h})=>{this._device.queue.writeBuffer(i,0,c(d,h))})),this._register(Sa(this._viewGpuContext.contentLeft,()=>{this._device.queue.writeBuffer(i,0,c())}))}let n;n=this._register(qs.createBuffer(this._device,{label:"Monaco atlas info uniform buffer",size:8,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST},()=>{const l=new Float32Array(2);return l[0]=e.pageSize,l[1]=e.pageSize,l})).object;const s=this._context.configuration.options.get(58),r=this._context.configuration.options.get(61);this._glyphRasterizer.value=this._register(new gv(r,s,this._viewGpuContext.devicePixelRatio.get(),ls.decorationStyleCache)),this._register(Sa(this._viewGpuContext.devicePixelRatio,()=>{this._refreshGlyphRasterizer()})),this._renderStrategy.value=this._instantiationService.createInstance(zf,this._context,this._viewGpuContext,this._device,this._glyphRasterizer),this._glyphStorageBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco glyph storage buffer",size:xh.maximumPageCount*(Ra.maximumGlyphCount*24),usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST})).object,this._atlasGpuTextureVersions[0]=0,this._atlasGpuTextureVersions[1]=0,this._atlasGpuTexture=this._register(qs.createTexture(this._device,{label:"Monaco atlas texture",format:"rgba8unorm",size:{width:e.pageSize,height:e.pageSize,depthOrArrayLayers:xh.maximumPageCount},dimension:"2d",usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT})).object,this._updateAtlasStorageBufferAndTexture(),this._vertexBuffer=this._register(qs.createBuffer(this._device,{label:"Monaco vertex buffer",size:Hf.byteLength,usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST},Hf)).object;const a=this._device.createShaderModule({label:"Monaco shader module",code:this._renderStrategy.value.wgsl});if(this._pipeline=this._device.createRenderPipeline({label:"Monaco render pipeline",layout:"auto",vertex:{module:a,buffers:[{arrayStride:2*Float32Array.BYTES_PER_ELEMENT,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]}]},fragment:{module:a,targets:[{format:t,blend:{color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"},alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha"}}}]}}),this._rebuildBindGroup=()=>{this._bindGroup=this._device.createBindGroup({label:"Monaco bind group",layout:this._pipeline.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:this._glyphStorageBuffer}},{binding:2,resource:this._device.createSampler({label:"Monaco atlas sampler",magFilter:"nearest",minFilter:"nearest"})},{binding:3,resource:this._atlasGpuTexture.createView()},{binding:4,resource:{buffer:i}},{binding:5,resource:{buffer:n}},...this._renderStrategy.value.bindGroupEntries]})},this._rebuildBindGroup(),this._initialized=!0,this._initViewportData){for(const l of this._initViewportData)this.renderText(l);this._initViewportData=void 0}}_refreshRenderStrategy(e){if(this._renderStrategy.value?.type==="viewport"||e.endLineNumber<zf.maxSupportedLines&&this._viewportMaxColumn(e)<zf.maxSupportedColumns)return;this._logService.trace(`File is larger than ${zf.maxSupportedLines} lines or ${zf.maxSupportedColumns} columns, switching to viewport render strategy`);const t=this._instantiationService.createInstance(tP,this._context,this._viewGpuContext,this._device,this._glyphRasterizer);this._renderStrategy.value=t,this._register(t.onDidChangeBindGroupEntries(()=>this._rebuildBindGroup?.())),this._rebuildBindGroup?.()}_viewportMaxColumn(e){let t=0,i;for(let n=e.startLineNumber;n<=e.endLineNumber;n++)i=e.getViewLineRenderingData(n),t=Math.max(t,i.maxColumn);return t}_updateAtlasStorageBufferAndTexture(){for(const[e,t]of ls.atlas.pages.entries()){if(e>=xh.maximumPageCount){console.log(`Attempt to upload atlas page [${e}], only ${xh.maximumPageCount} are supported currently`);continue}if(t.version===this._atlasGpuTextureVersions[e])continue;this._logService.trace("Updating atlas page[",e,"] from version ",this._atlasGpuTextureVersions[e]," to version ",t.version);const i=6*Ra.maximumGlyphCount,n=new Float32Array(i);let s=0;for(const r of t.glyphs)n[s+0]=r.x,n[s+0+1]=r.y,n[s+2]=r.w,n[s+2+1]=r.h,n[s+4]=r.originOffsetX,n[s+4+1]=r.originOffsetY,s+=6;if(s/6>Ra.maximumGlyphCount)throw new Error(`Attempting to write more glyphs (${s/6}) than the GPUBuffer can hold (${Ra.maximumGlyphCount})`);this._device.queue.writeBuffer(this._glyphStorageBuffer,e*6*Ra.maximumGlyphCount*Float32Array.BYTES_PER_ELEMENT,n,0,6*Ra.maximumGlyphCount),t.usedArea.right-t.usedArea.left>0&&t.usedArea.bottom-t.usedArea.top>0&&this._device.queue.copyExternalImageToTexture({source:t.source},{texture:this._atlasGpuTexture,origin:{x:t.usedArea.left,y:t.usedArea.top,z:e}},{width:t.usedArea.right-t.usedArea.left+1,height:t.usedArea.bottom-t.usedArea.top+1}),this._atlasGpuTextureVersions[e]=t.version}}prepareRender(e){throw new Ce("Should not be called")}render(e){throw new Ce("Should not be called")}onConfigurationChanged(e){return this._refreshGlyphRasterizer(),!0}onCursorStateChanged(e){return!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onLineMappingChanged(e){return!0}onRevealRangeRequest(e){return!0}onScrollChanged(e){return!0}onThemeChanged(e){return!0}onZonesChanged(e){return!0}_refreshGlyphRasterizer(){const e=this._glyphRasterizer.value;if(!e)return;const t=this._context.configuration.options.get(58),i=this._context.configuration.options.get(61),n=this._viewGpuContext.devicePixelRatio.get();(e.fontFamily!==t||e.fontSize!==i||e.devicePixelRatio!==n)&&(this._glyphRasterizer.value=new gv(i,t,n,ls.decorationStyleCache))}renderText(e){if(this._initialized)return this._refreshRenderStrategy(e),this._renderText(e);this._initViewportData=this._initViewportData??[],this._initViewportData.push(e)}_renderText(e){this._viewGpuContext.rectangleRenderer.draw(e);const t=new GL(this._context.configuration,this._context.theme.type);this._renderStrategy.value.update(e,t),this._updateAtlasStorageBufferAndTexture();const i=this._device.createCommandEncoder({label:"Monaco command encoder"});this._renderPassColorAttachment.view=this._viewGpuContext.ctx.getCurrentTexture().createView({label:"Monaco canvas texture view"});const n=i.beginRenderPass(this._renderPassDescriptor);n.setPipeline(this._pipeline),n.setVertexBuffer(0,this._vertexBuffer);const s=Math.ceil(this._viewGpuContext.contentLeft.get()*this._viewGpuContext.devicePixelRatio.get());n.setScissorRect(s,0,this.canvas.width-s,this.canvas.height),n.setBindGroup(0,this._bindGroup),this._renderStrategy.value.draw(n,e),n.end();const r=i.finish();this._device.queue.submit([r]),this._lastViewportData=e,this._lastViewLineOptions=t}linesVisibleRangesForRange(e,t){if(!this._lastViewportData)return null;const i=e.endLineNumber,n=k.intersectRanges(e,this._lastViewportData.visibleRange);if(!n)return null;const s=this._lastViewportData.startLineNumber,r=this._lastViewportData.endLineNumber,a=this._lastViewportData,l=this._lastViewLineOptions;if(!a||!l)return null;const c=[];let d=0;t&&(d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(n.startLineNumber,1)).lineNumber);for(let h=n.startLineNumber;h<=n.endLineNumber;h++){if(h<s||h>r)continue;const u=h===n.startLineNumber?n.startColumn:1,f=h!==i,g=f?this._context.viewModel.getLineMaxColumn(h):n.endColumn,m=this._visibleRangesForLineRange(h,u,g);if(m){if(t&&h<i){const _=d;d=this._context.viewModel.coordinatesConverter.convertViewPositionToModelPosition(new M(h+1,1)).lineNumber,_!==d&&(m.ranges[m.ranges.length-1].width+=l.spaceWidth)}c.push(new lz(m.outsideRenderedLine,h,Z1.from(m.ranges),f))}}return c.length===0?null:c}_visibleRangesForLineRange(e,t,i){if(this.shouldRender())return null;const n=this._lastViewportData,s=this._lastViewLineOptions;if(!n||!s||e<n.startLineNumber||e>n.endLineNumber)return null;const r=n.getViewLineRenderingData(e),a=r.content;let l;r.isBasicASCII&&s.useMonospaceOptimizations||(l=ox(r,s));let c="",d=0,h=0;for(let m=0;m<t-1;m++){if(r.isBasicASCII&&s.useMonospaceOptimizations)c=a.charAt(m);else{if(c=l.getSegmentAtIndex(m),c===void 0)continue;h+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(c).width/ft().devicePixelRatio-s.spaceWidth}c===" "?d=ti.nextRenderTabStop(d,r.tabSize):d++}let u=d,f=0;for(let m=t-1;m<i-1;m++){if(r.isBasicASCII&&s.useMonospaceOptimizations)c=a.charAt(m);else{if(c=l.getSegmentAtIndex(m),c===void 0)continue;f+=this._renderStrategy.value.glyphRasterizer.getTextMetrics(c).width/ft().devicePixelRatio-s.spaceWidth}c===" "?u=ti.nextRenderTabStop(u,r.tabSize):u++}return new SM(!1,[new Sh(d*s.spaceWidth+h,(u-d)*s.spaceWidth+f)])}visibleRangeForPosition(e){const t=this._visibleRangesForLineRange(e.lineNumber,e.column,e.column);return t?new cz(t.outsideRenderedLine,t.ranges[0].left):null}getLineWidth(e){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;const t=this._lastViewportData.getViewLineRenderingData(e),n=this._visibleRangesForLineRange(e,1,t.maxColumn)?.ranges.at(-1);if(n)return n.width}getPositionAtCoordinate(e,t){if(!this._lastViewportData||!this._lastViewLineOptions||!this._viewGpuContext.canRender(this._lastViewLineOptions,this._lastViewportData,e))return;const i=this._lastViewportData.getViewLineRenderingData(e),n=i.content,s=ft().devicePixelRatio,r=t*s,a=this._lastViewLineOptions.spaceWidth*s,l=ox(i,this._lastViewLineOptions);let c=0,d=0,h=0,u=0;for(let f=0;f<n.length;f++){const g=l.getSegmentAtIndex(f);if(g===void 0){u++;continue}if(g===" "){const m=f+h;h=ti.nextRenderTabStop(f+h,i.tabSize),d=a*(h-m),h-=f+1}else i.isBasicASCII&&this._lastViewLineOptions.useMonospaceOptimizations?d=a:d=this._renderStrategy.value.glyphRasterizer.getTextMetrics(g).width;if(r<c+d/2)break;c+=d,u++}return new M(e,u+1)}};iP=Vue([mU(2,ge),mU(3,Rt)],iP);class zue{constructor(){this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._enabled=!0}get enabled(){return this._enabled}enable(){this._enabled=!0,this._onDidChange.fire()}disable(){this._enabled=!1,this._onDidChange.fire()}}const Ll=new zue,ot=We("keybindingService");class _U extends vs{}class bU{_getPageOfLine(e,t){return Math.floor((e-1)/t)}_getRangeForPage(e,t){const i=e*t,n=i+1,s=i+t;return new k(n,1,s+1,1)}fromEditorSelection(e,t,i,n){const r=this._getPageOfLine(t.startLineNumber,i),a=this._getRangeForPage(r,i),l=this._getPageOfLine(t.endLineNumber,i),c=this._getRangeForPage(l,i);let d=a.intersectRanges(new k(1,1,t.startLineNumber,t.startColumn));if(n&&e.getValueLengthInRange(d,1)>500){const w=e.modifyPosition(d.getEndPosition(),-500);d=k.fromPositions(w,d.getEndPosition())}const h=e.getValueInRange(d,1),u=e.getLineCount(),f=e.getLineMaxColumn(u);let g=c.intersectRanges(new k(t.endLineNumber,t.endColumn,u,f));if(n&&e.getValueLengthInRange(g,1)>500){const w=e.modifyPosition(g.getStartPosition(),500);g=k.fromPositions(g.getStartPosition(),w)}const m=e.getValueInRange(g,1);let _;if(r===l||r+1===l)_=e.getValueInRange(t,1);else{const w=a.intersectRanges(t),v=c.intersectRanges(t);_=e.getValueInRange(w,1)+"…"+e.getValueInRange(v,1)}n&&_.length>2*500&&(_=_.substring(0,500)+"…"+_.substring(_.length-500,_.length));let b,C;return t.getDirection()===0?(b=h.length,C=h.length+_.length):(C=h.length,b=h.length+_.length),{value:h+_+m,selection:t,selectionStart:b,selectionEnd:C,startPositionWithinEditor:d.getStartPosition(),newlineCountBeforeSelection:d.endLineNumber-d.startLineNumber}}}function nP(o,e){if(o.get(2)===1){const i=e.lookupKeybinding("editor.action.toggleScreenReaderAccessibilityMode")?.getAriaLabel(),n=e.lookupKeybinding("workbench.action.showCommands")?.getAriaLabel(),s=e.lookupKeybinding("workbench.action.openGlobalKeybindings")?.getAriaLabel(),r=p(56,"The editor is not accessible at this time.");return i?p(57,"{0} To enable screen reader optimized mode, use {1}",r,i):n?p(58,"{0} To enable screen reader optimized mode, open the quick pick with {1} and run the command Toggle Screen Reader Accessibility Mode, which is currently not triggerable via keyboard.",r,n):s?p(59,"{0} Please assign a keybinding for the command Toggle Screen Reader Accessibility Mode by accessing the keybindings editor with {1} and run it.",r,s):r}return o.get(8)}function CU(o){let e=0,t=-1;do{if(t=o.indexOf(`
`,t+1),t===-1)break;e++}while(!0);return e}var Uue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vU=function(o,e){return function(t,i){e(t,i,o)}};class $ue{constructor(e,t,i,n,s){this._context=e,this.modelLineNumber=t,this.distanceToModelLineStart=i,this.widthOfHiddenLineTextBefore=n,this.distanceToModelLineEnd=s,this._visibleTextAreaBrand=void 0,this.startPosition=null,this.endPosition=null,this.visibleTextareaStart=null,this.visibleTextareaEnd=null,this._previousPresentation=null}prepareRender(e){const t=new M(this.modelLineNumber,this.distanceToModelLineStart+1),i=new M(this.modelLineNumber,this._context.viewModel.model.getLineMaxColumn(this.modelLineNumber)-this.distanceToModelLineEnd);this.startPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(t),this.endPosition=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i),this.startPosition.lineNumber===this.endPosition.lineNumber?(this.visibleTextareaStart=e.visibleRangeForPosition(this.startPosition),this.visibleTextareaEnd=e.visibleRangeForPosition(this.endPosition)):(this.visibleTextareaStart=null,this.visibleTextareaEnd=null)}definePresentation(e){return this._previousPresentation||(e?this._previousPresentation=e:this._previousPresentation={foreground:1,italic:!1,bold:!1,underline:!1,strikethrough:!1}),this._previousPresentation}}const sP=Fs;let oP=class extends _U{constructor(e,t,i,n,s,r){super(e),this._keybindingService=s,this._instantiationService=r,this._primaryCursorPosition=new M(1,1),this._primaryCursorVisibleRange=null,this._viewController=i,this._visibleRangeProvider=n,this._scrollLeft=0,this._scrollTop=0;const a=this._context.configuration.options,l=a.get(165);this._setAccessibilityOptions(a),this._contentLeft=l.contentLeft,this._contentWidth=l.contentWidth,this._contentHeight=l.height,this._fontInfo=a.get(59),this._emptySelectionClipboard=a.get(45),this._copyWithSyntaxHighlighting=a.get(31),this._visibleTextArea=null,this._selections=[new ce(1,1,1,1)],this._modelSelections=[new ce(1,1,1,1)],this._lastRenderPosition=null,this.textArea=lt(document.createElement("textarea")),Na.write(this.textArea,7),this.textArea.setClassName(`inputarea ${w_}`),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:c}=this._context.viewModel.model.getOptions();this.textArea.domNode.style.tabSize=`${c*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("autocorrect","off"),this.textArea.setAttribute("autocapitalize","off"),this.textArea.setAttribute("autocomplete","off"),this.textArea.setAttribute("spellcheck","false"),this.textArea.setAttribute("aria-label",nP(a,this._keybindingService)),this.textArea.setAttribute("aria-required",a.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(a.get(140))),this.textArea.setAttribute("role","textbox"),this.textArea.setAttribute("aria-roledescription",p(60,"editor")),this.textArea.setAttribute("aria-multiline","true"),this.textArea.setAttribute("aria-autocomplete",a.get(104)?"none":"both"),this._ensureReadOnlyAttribute(),this.textAreaCover=lt(document.createElement("div")),this.textAreaCover.setPosition("absolute"),t.appendChild(this.textArea),t.appendChild(this.textAreaCover);const d=new bU,h={getDataToCopy:()=>yz(this._context.viewModel,this._modelSelections,this._emptySelectionClipboard,this._copyWithSyntaxHighlighting),getScreenReaderContent:()=>{if(this._accessibilitySupport===1){const g=this._selections[0];if(ze&&g.isEmpty()){const _=g.getStartPosition();let b=this._getWordBeforePosition(_);if(b.length===0&&(b=this._getCharacterBeforePosition(_)),b.length>0)return new as(b,b.length,b.length,k.fromPositions(_),0)}if(ze&&!g.isEmpty()&&this._context.viewModel.getValueLengthInRange(g,0)<500){const _=this._context.viewModel.getValueInRange(g,0);return new as(_,0,_.length,g,0)}if(qu&&!g.isEmpty()){const _="vscode-placeholder";return new as(_,0,_.length,null,void 0)}return as.EMPTY}if(TB){const g=this._selections[0];if(g.isEmpty()){const m=g.getStartPosition(),[_,b]=this._getAndroidWordAtPosition(m);if(_.length>0)return new as(_,b,b,k.fromPositions(m),0)}return as.EMPTY}const f=d.fromEditorSelection(this._context.viewModel,this._selections[0],this._accessibilityPageSize,this._accessibilitySupport===0);return as.fromScreenReaderContentState(f)},deduceModelPosition:(f,g,m)=>this._context.viewModel.deduceModelPositionRelativeToViewPosition(f,g,m)},u=this._register(new bde(this.textArea.domNode));this._textAreaInput=this._register(this._instantiationService.createInstance(NM,h,u,so,{isAndroid:TB,isChrome:GC,isFirefox:Fs,isSafari:qu})),this._register(this._textAreaInput.onKeyDown(f=>{this._viewController.emitKeyDown(f)})),this._register(this._textAreaInput.onKeyUp(f=>{this._viewController.emitKeyUp(f)})),this._register(this._textAreaInput.onPaste(f=>{let g=!1,m=null,_=null;f.metadata&&(g=this._emptySelectionClipboard&&!!f.metadata.isFromEmptySelection,m=typeof f.metadata.multicursorText<"u"?f.metadata.multicursorText:null,_=f.metadata.mode),this._viewController.paste(f.text,g,m,_)})),this._register(this._textAreaInput.onCut(()=>{this._viewController.cut()})),this._register(this._textAreaInput.onType(f=>{f.replacePrevCharCnt||f.replaceNextCharCnt||f.positionDelta?this._viewController.compositionType(f.text,f.replacePrevCharCnt,f.replaceNextCharCnt,f.positionDelta):this._viewController.type(f.text)})),this._register(this._textAreaInput.onSelectionChangeRequest(f=>{this._viewController.setSelection(f)})),this._register(this._textAreaInput.onCompositionStart(f=>{const g=this.textArea.domNode,m=this._modelSelections[0],{distanceToModelLineStart:_,widthOfHiddenTextBefore:b}=(()=>{const w=g.value.substring(0,Math.min(g.selectionStart,g.selectionEnd)),v=w.lastIndexOf(`
`),S=w.substring(v+1),L=S.lastIndexOf(" "),x=S.length-L-1,I=m.getStartPosition(),D=Math.min(I.column-1,x),R=I.column-1-D,F=S.substring(0,S.length-D),{tabSize:O}=this._context.viewModel.model.getOptions(),B=jue(this.textArea.domNode.ownerDocument,F,this._fontInfo,O);return{distanceToModelLineStart:R,widthOfHiddenTextBefore:B}})(),{distanceToModelLineEnd:C}=(()=>{const w=g.value.substring(Math.max(g.selectionStart,g.selectionEnd)),v=w.indexOf(`
`),S=v===-1?w:w.substring(0,v),L=S.indexOf(" "),x=L===-1?S.length:S.length-L-1,I=m.getEndPosition(),D=Math.min(this._context.viewModel.model.getLineMaxColumn(I.lineNumber)-I.column,x);return{distanceToModelLineEnd:this._context.viewModel.model.getLineMaxColumn(I.lineNumber)-I.column-D}})();this._context.viewModel.revealRange("keyboard",!0,k.fromPositions(this._selections[0].getStartPosition()),0,1),this._visibleTextArea=new $ue(this._context,m.startLineNumber,_,b,C),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render(),this.textArea.setClassName(`inputarea ${w_} ime-input`),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(this._textAreaInput.onCompositionUpdate(f=>{this._visibleTextArea&&(this._visibleTextArea.prepareRender(this._visibleRangeProvider),this._render())})),this._register(this._textAreaInput.onCompositionEnd(()=>{this._visibleTextArea=null,this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off"),this._render(),this.textArea.setClassName(`inputarea ${w_}`),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()})),this._register(this._textAreaInput.onFocus(()=>{this._context.viewModel.setHasFocus(!0)})),this._register(this._textAreaInput.onBlur(()=>{this._context.viewModel.setHasFocus(!1)})),this._register(Ll.onDidChange(()=>{this._ensureReadOnlyAttribute()}))}get domNode(){return this.textArea}writeScreenReaderContent(e){this._textAreaInput.writeNativeTextAreaContent(e)}dispose(){super.dispose(),this.textArea.domNode.remove(),this.textAreaCover.domNode.remove()}_getAndroidWordAtPosition(e){const t='`~!@#$%^&*()-=+[{]}\\|;:",.<>/?',i=this._context.viewModel.getLineContent(e.lineNumber),n=Sr(t,[]);let s=!0,r=e.column,a=!0,l=e.column,c=0;for(;c<50&&(s||a);){if(s&&r<=1&&(s=!1),s){const d=i.charCodeAt(r-2);n.get(d)!==0?s=!1:r--}if(a&&l>i.length&&(a=!1),a){const d=i.charCodeAt(l-1);n.get(d)!==0?a=!1:l++}c++}return[i.substring(r-1,l-1),e.column-r]}_getWordBeforePosition(e){const t=this._context.viewModel.getLineContent(e.lineNumber),i=Sr(this._context.configuration.options.get(148),[]);let n=e.column,s=0;for(;n>1;){const r=t.charCodeAt(n-2);if(i.get(r)!==0||s>50)return t.substring(n-1,e.column-1);s++,n--}return t.substring(0,e.column-1)}_getCharacterBeforePosition(e){if(e.column>1){const i=this._context.viewModel.getLineContent(e.lineNumber).charAt(e.column-2);if(!zi(i.charCodeAt(0)))return i}return""}_setAccessibilityOptions(e){this._accessibilitySupport=e.get(2);const t=e.get(3);this._accessibilitySupport===2&&t===Da.accessibilityPageSize.defaultValue?this._accessibilityPageSize=500:this._accessibilityPageSize=t;const n=e.get(165).wrappingColumn;if(n!==-1&&this._accessibilitySupport!==1){const s=e.get(59);this._textAreaWrapping=!0,this._textAreaWidth=Math.round(n*s.typicalHalfwidthCharacterWidth)}else this._textAreaWrapping=!1,this._textAreaWidth=sP?0:1}onConfigurationChanged(e){const t=this._context.configuration.options,i=t.get(165);this._setAccessibilityOptions(t),this._contentLeft=i.contentLeft,this._contentWidth=i.contentWidth,this._contentHeight=i.height,this._fontInfo=t.get(59),this._emptySelectionClipboard=t.get(45),this._copyWithSyntaxHighlighting=t.get(31),this.textArea.setAttribute("wrap",this._textAreaWrapping&&!this._visibleTextArea?"on":"off");const{tabSize:n}=this._context.viewModel.model.getOptions();return this.textArea.domNode.style.tabSize=`${n*this._fontInfo.spaceWidth}px`,this.textArea.setAttribute("aria-label",nP(t,this._keybindingService)),this.textArea.setAttribute("aria-required",t.get(9)?"true":"false"),this.textArea.setAttribute("tabindex",String(t.get(140))),(e.hasChanged(41)||e.hasChanged(104))&&this._ensureReadOnlyAttribute(),e.hasChanged(2)&&this._textAreaInput.writeNativeTextAreaContent("strategy changed"),!0}onCursorStateChanged(e){return this._selections=e.selections.slice(0),this._modelSelections=e.modelSelections.slice(0),this._textAreaInput.writeNativeTextAreaContent("selection changed"),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}isFocused(){return this._textAreaInput.isFocused()}focus(){this._textAreaInput.focusTextArea()}refreshFocusState(){this._textAreaInput.refreshFocusState()}getLastRenderData(){return this._lastRenderPosition}setAriaOptions(e){e.activeDescendant?(this.textArea.setAttribute("aria-haspopup","true"),this.textArea.setAttribute("aria-autocomplete","list"),this.textArea.setAttribute("aria-activedescendant",e.activeDescendant)):(this.textArea.setAttribute("aria-haspopup","false"),this.textArea.setAttribute("aria-autocomplete","both"),this.textArea.removeAttribute("aria-activedescendant")),e.role&&this.textArea.setAttribute("role",e.role)}_ensureReadOnlyAttribute(){const e=this._context.configuration.options;!Ll.enabled||e.get(41)&&e.get(104)?this.textArea.setAttribute("readonly","true"):this.textArea.removeAttribute("readonly")}prepareRender(e){this._primaryCursorPosition=new M(this._selections[0].positionLineNumber,this._selections[0].positionColumn),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primaryCursorPosition),this._visibleTextArea?.prepareRender(e)}render(e){this._textAreaInput.writeNativeTextAreaContent("render"),this._render()}_render(){if(this._visibleTextArea){const i=this._visibleTextArea.visibleTextareaStart,n=this._visibleTextArea.visibleTextareaEnd,s=this._visibleTextArea.startPosition,r=this._visibleTextArea.endPosition;if(s&&r&&i&&n&&n.left>=this._scrollLeft&&i.left<=this._scrollLeft+this._contentWidth){const a=this._context.viewLayout.getVerticalOffsetForLineNumber(this._primaryCursorPosition.lineNumber)-this._scrollTop,l=CU(this.textArea.domNode.value.substr(0,this.textArea.domNode.selectionStart));let c=this._visibleTextArea.widthOfHiddenLineTextBefore,d=this._contentLeft+i.left-this._scrollLeft,h=n.left-i.left+1;if(d<this._contentLeft){const w=this._contentLeft-d;d+=w,c+=w,h-=w}h>this._contentWidth&&(h=this._contentWidth);const u=this._context.viewLayout.getLineHeightForLineNumber(s.lineNumber),f=this._context.viewModel.getFontSizeAtPosition(this._primaryCursorPosition),g=this._context.viewModel.getViewLineData(s.lineNumber),m=g.tokens.findTokenIndexAtOffset(s.column-1),_=g.tokens.findTokenIndexAtOffset(r.column-1),b=m===_,C=this._visibleTextArea.definePresentation(b?g.tokens.getPresentation(m):null);this.textArea.domNode.scrollTop=l*u,this.textArea.domNode.scrollLeft=c,this._doRender({lastRenderPosition:null,top:a,left:d,width:h,height:u,useCover:!1,color:(di.getColorMap()||[])[C.foreground],italic:C.italic,bold:C.bold,underline:C.underline,strikethrough:C.strikethrough,fontSize:f})}return}if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}const e=this._contentLeft+this._primaryCursorVisibleRange.left-this._scrollLeft;if(e<this._contentLeft||e>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}const t=this._context.viewLayout.getVerticalOffsetForLineNumber(this._selections[0].positionLineNumber)-this._scrollTop;if(t<0||t>this._contentHeight){this._renderAtTopLeft();return}if(ze||this._accessibilitySupport===2){const i=this._primaryCursorPosition.lineNumber,n=this._context.viewLayout.getLineHeightForLineNumber(i);this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:n,useCover:!1}),this.textArea.domNode.scrollLeft=this._primaryCursorVisibleRange.left;const s=this._textAreaInput.textAreaState.newlineCountBeforeSelection??CU(this.textArea.domNode.value.substring(0,this.textArea.domNode.selectionStart));this.textArea.domNode.scrollTop=s*n;return}this._doRender({lastRenderPosition:this._primaryCursorPosition,top:t,left:this._textAreaWrapping?this._contentLeft:e,width:this._textAreaWidth,height:sP?0:1,useCover:!1})}_renderAtTopLeft(){this._doRender({lastRenderPosition:null,top:0,left:0,width:this._textAreaWidth,height:sP?0:1,useCover:!0})}_doRender(e){this._lastRenderPosition=e.lastRenderPosition;const t=this.textArea,i=this.textAreaCover;dn(t,this._fontInfo),t.setTop(e.top),t.setLeft(e.left),t.setWidth(e.width),t.setHeight(e.height),t.setLineHeight(e.height),t.setFontSize(e.fontSize??this._fontInfo.fontSize),t.setColor(e.color?$.Format.CSS.formatHex(e.color):""),t.setFontStyle(e.italic?"italic":""),e.bold&&t.setFontWeight("bold"),t.setTextDecoration(`${e.underline?" underline":""}${e.strikethrough?" line-through":""}`),i.setTop(e.useCover?e.top:0),i.setLeft(e.useCover?e.left:0),i.setWidth(e.useCover?e.width:0),i.setHeight(e.useCover?e.height:0);const n=this._context.configuration.options;n.get(66)?i.setClassName("monaco-editor-background textAreaCover "+ZL.OUTER_CLASS_NAME):n.get(76).renderType!==0?i.setClassName("monaco-editor-background textAreaCover "+KL.CLASS_NAME):i.setClassName("monaco-editor-background textAreaCover")}};oP=Uue([vU(4,ot),vU(5,ge)],oP);function jue(o,e,t,i){if(e.length===0)return 0;const n=o.createElement("div");n.style.position="absolute",n.style.top="-50000px",n.style.width="50000px";const s=o.createElement("span");dn(s,t),s.style.whiteSpace="pre",s.style.tabSize=`${i*t.spaceWidth}px`,s.append(e),n.appendChild(s),o.body.appendChild(n);const r=s.offsetWidth;return n.remove(),r}var que=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kue=function(o,e){return function(t,i){e(t,i,o)}};let rP=class extends A{constructor(e,t,i){super(),this._domNode=t,this._onFocusChange=i,this._isFocused=!1,this._isPaused=!1,this._register(W(this._domNode,"focus",()=>{e.trace("NativeEditContext.focus"),!this._isPaused&&this.refreshFocusState()})),this._register(W(this._domNode,"blur",()=>{e.trace("NativeEditContext.blur"),!this._isPaused&&this._handleFocusedChanged(!1)}))}pause(){this._isPaused=!0}resume(){this._isPaused=!1,this.refreshFocusState()}_handleFocusedChanged(e){this._isFocused!==e&&(this._isFocused=e,this._onFocusChange(this._isFocused))}focus(){this._domNode.focus(),this.refreshFocusState()}refreshFocusState(){const e=ah(this._domNode),t=e?e.activeElement:Ui(),i=this._domNode===t;this._handleFocusedChanged(i)}get isFocused(){return this._isFocused}};rP=que([Kue(0,Rt)],rP);function mv(o,e,t,i){return o.addEventListener(e,t,i),{dispose(){o.removeEventListener(e,t)}}}var Gue=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Zue=function(o,e){return function(t,i){e(t,i,o)}};const Yue=Sl("richScreenReaderContent",{createHTML:o=>o}),aP="data-line-number";let lP=class extends A{constructor(e,t,i,n){super(),this._domNode=e,this._context=t,this._viewController=i,this._accessibilityService=n,this._selectionChangeListener=this._register(new ct),this._accessibilityPageSize=1,this._ignoreSelectionChangeTime=0,this._state=_v.NULL,this._strategy=new Jue,this._renderedLines=new Map,this._renderedSelection=new ce(1,1,1,1),this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){const t=ft().document.activeElement;if(!t||t!==this._domNode.domNode)return;if(this._accessibilityService.isScreenReaderOptimized()){const n=this._getScreenReaderContentLineIntervals(e);this._state.equals(n)||(this._state=n,this._renderedLines=this._renderScreenReaderContent(n)),this._renderedSelection.equalsSelection(e)||(this._renderedSelection=e,this._setSelectionOnScreenReaderContent(this._context,this._renderedLines,e))}else this._state=_v.NULL,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){const t=this._state.intervals;if(!t.length)return;const i=this._context.viewModel.viewLayout,n=t[0].startLine,s=i.getVerticalOffsetForLineNumber(n),r=i.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=r-s}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return W(this._domNode.domNode.ownerDocument,"selectionchange",()=>{if(!(ft().document.activeElement===this._domNode.domNode)||!this._accessibilityService.isScreenReaderOptimized()||!Ll.enabled)return;const s=Date.now(),r=s-e;if(e=s,r<5)return;const a=s-this._ignoreSelectionChangeTime;if(this._ignoreSelectionChangeTime=0,a<100)return;const l=this._getEditorSelectionFromDomRange();l&&this._viewController.setSelection(l)})}_renderScreenReaderContent(e){const t=[],i=new Map;for(const n of e.intervals)for(let s=n.startLine;s<=n.endLine;s++){const r=this._renderLine(s);i.set(s,r),t.push(r.domNode)}return this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.replaceChildren(...t),i}_renderLine(e){const t=this._context.viewModel,i=t.getViewLineRenderingData(e),n=this._context.configuration.options,s=n.get(59),r=n.get(133),a=n.get(108),l=n.get(60),c=n.get(40),d=os.filter(i.inlineDecorations,e,i.minColumn,i.maxColumn),h=s.isMonospace&&!c,u=l!==Fc.OFF;let f;n.get(47)==="off"?f=n.get(113):f="none";const m=new Vc(h,s.canUseHalfwidthRightwardsArrow,i.content,i.continuesWithWrappedLine,i.isBasicASCII,i.containsRTL,i.minColumn-1,i.tokens,d,i.tabSize,i.startVisibleColumn,s.spaceWidth,s.middotWidth,s.wsmiddotWidth,r,f,a,u,null,null,0,!0),_=new uh(1e4),b=h_(m,_),C=_.build(),w=Yue?.createHTML(C)??C,v=t.viewLayout.getLineHeightForLineNumber(e)+"px",S=document.createElement("div");return S.innerHTML=w,S.style.lineHeight=v,S.style.height=v,S.setAttribute(aP,e.toString()),new Xue(S,b.characterMapping)}_setSelectionOnScreenReaderContent(e,t,i){const s=ft().document.getSelection();if(!s)return;const r=i.startLineNumber,a=i.endLineNumber,l=t.get(r),c=t.get(a);if(!l||!c)return;const d=e.viewModel,h=d.model,u=d.coordinatesConverter,f=new k(r,1,r,i.selectionStartColumn),g=u.convertViewRangeToModelRange(f),m=h.getCharacterCountInRange(g),_=new k(a,1,a,i.positionColumn),b=u.convertViewRangeToModelRange(_),C=h.getCharacterCountInRange(b),w=l.characterMapping.getDomPosition(m),v=c.characterMapping.getDomPosition(C),S=l.domNode.firstChild,L=c.domNode.firstChild,x=S.childNodes,I=L.childNodes,D=x.item(w.partIndex),R=I.item(v.partIndex);!D.firstChild||!R.firstChild||(this._setIgnoreSelectionChangeTime("setRange"),s.setBaseAndExtent(D.firstChild,i.startColumn===1?0:w.charIndex+1,R.firstChild,i.endColumn===1?0:v.charIndex+1))}_getScreenReaderContentLineIntervals(e){return this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize)}_getEditorSelectionFromDomRange(){if(!this._renderedLines)return;const e=ft().document.getSelection();if(!e||e.rangeCount===0)return;const i=e.getRangeAt(0),n=i.startContainer,s=i.endContainer,r=n.parentElement,a=s.parentElement;if(!r||!ai(r)||!a||!ai(a))return;const l=r.parentElement?.parentElement,c=a.parentElement?.parentElement;if(!l||!c)return;const d=l.getAttribute(aP),h=c.getAttribute(aP);if(!d||!h)return;const u=parseInt(d),f=parseInt(h),g=this._renderedLines.get(u)?.characterMapping,m=this._renderedLines.get(f)?.characterMapping;if(!g||!m)return;const _=Y1(g,r,i.startOffset),b=Y1(m,a,i.endOffset);return e.direction==="forward"?new ce(u,_,f,b):new ce(f,b,u,_)}};lP=Gue([Zue(3,bn)],lP);class Xue{constructor(e,t){this.domNode=e,this.characterMapping=t}}class Que{constructor(e,t){this.startLine=e,this.endLine=t}}class _v{constructor(e,t){this.intervals=t;let i="";for(const n of t)for(let s=n.startLine;s<=n.endLine;s++)i+=e.getLineContent(s)+`
`;this.value=i}equals(e){return this.value===e.value}static get NULL(){const e={getLineContent:()=>"",getLineCount:()=>1,getLineMaxColumn:()=>1,getValueInRange:()=>"",getValueLengthInRange:()=>0,modifyPosition:(t,i)=>t};return new _v(e,[])}}class Jue{constructor(){}_getPageOfLine(e,t){return Math.floor((e-1)/t)}_getRangeForPage(e,t,i){const n=t*i,s=n+1,r=Math.min(n+i,e.getLineCount());return new Que(s,r)}fromEditorSelection(e,t,i){const n=this._getPageOfLine(t.startLineNumber,i),s=this._getRangeForPage(e,n,i),r=this._getPageOfLine(t.endLineNumber,i),a=this._getRangeForPage(e,r,i),l=[{startLine:s.startLine,endLine:s.endLine}];return n+1<r&&l.push({startLine:a.startLine,endLine:a.endLine}),new _v(e,l)}}class efe{constructor(e){this.replacements=e;let t=-1;for(const i of e){if(!(i.replaceRange.start>=t))throw new Ce(`Edits must be disjoint and sorted. Found ${i} after ${t}`);t=i.replaceRange.endExclusive}}toString(){return`[${this.replacements.map(t=>t.toString()).join(", ")}]`}normalize(){const e=[];let t;for(const i of this.replacements)if(!(i.getNewLength()===0&&i.replaceRange.length===0)){if(t&&t.replaceRange.endExclusive===i.replaceRange.start){const n=t.tryJoinTouching(i);if(n){t=n;continue}}t&&e.push(t),t=i}return t&&e.push(t),this._createNew(e)}compose(e){const t=this.normalize(),i=e.normalize();if(t.isEmpty())return i;if(i.isEmpty())return t;const n=[...t.replacements],s=[];let r=0;for(const a of i.replacements){for(;;){const h=n[0];if(!h||h.replaceRange.start+r+h.getNewLength()>=a.replaceRange.start)break;n.shift(),s.push(h),r+=h.getNewLength()-h.replaceRange.length}const l=r;let c,d;for(;;){const h=n[0];if(!h||h.replaceRange.start+r>a.replaceRange.endExclusive)break;c||(c=h),d=h,n.shift(),r+=h.getNewLength()-h.replaceRange.length}if(!c)s.push(a.delta(-r));else{const h=Math.min(c.replaceRange.start,a.replaceRange.start-l),u=a.replaceRange.start-(c.replaceRange.start+l);if(u>0){const _=c.slice(pe.emptyAt(h),new pe(0,u));s.push(_)}if(!d)throw new Ce("Invariant violation: lastIntersecting is undefined");const f=d.replaceRange.endExclusive+r-a.replaceRange.endExclusive;if(f>0){const _=d.slice(pe.ofStartAndLength(d.replaceRange.endExclusive,0),new pe(d.getNewLength()-f,d.getNewLength()));n.unshift(_),r-=_.getNewLength()-_.replaceRange.length}const g=new pe(h,a.replaceRange.endExclusive-r),m=a.slice(g,new pe(0,a.getNewLength()));s.push(m)}}for(;;){const a=n.shift();if(!a)break;s.push(a)}return this._createNew(s).normalize()}getNewRanges(){const e=[];let t=0;for(const i of this.replacements)e.push(pe.ofStartAndLength(i.replaceRange.start+t,i.getNewLength())),t+=i.getLengthDelta();return e}isEmpty(){return this.replacements.length===0}}class tfe{constructor(e){this.replaceRange=e}delta(e){return this.slice(this.replaceRange.delta(e),new pe(0,this.getNewLength()))}getLengthDelta(){return this.getNewLength()-this.replaceRange.length}toString(){return`{ ${this.replaceRange.toString()} -> ${this.getNewLength()} }`}get isEmpty(){return this.getNewLength()===0&&this.replaceRange.length===0}getRangeAfterReplace(){return new pe(this.replaceRange.start,this.replaceRange.start+this.getNewLength())}}class ife extends efe{apply(e){const t=[];let i=0;for(const n of this.replacements)t.push(e.substring(i,n.replaceRange.start)),t.push(n.newText),i=n.replaceRange.endExclusive;return t.push(e.substring(i)),t.join("")}}class nfe extends tfe{constructor(e,t){super(e),this.newText=t}getNewLength(){return this.newText.length}toString(){return`${this.replaceRange} -> ${JSON.stringify(this.newText)}`}replace(e){return e.substring(0,this.replaceRange.start)+this.newText+e.substring(this.replaceRange.endExclusive)}removeCommonSuffixPrefix(e){const t=e.substring(this.replaceRange.start,this.replaceRange.endExclusive),i=Gr(t,this.newText),n=Math.min(t.length-i,this.newText.length-i,Lc(t,this.newText)),s=new pe(this.replaceRange.start+i,this.replaceRange.endExclusive-n),r=this.newText.substring(i,this.newText.length-n);return new Cn(s,r)}removeCommonSuffixAndPrefix(e){return this.removeCommonSuffix(e).removeCommonPrefix(e)}removeCommonPrefix(e){const t=this.replaceRange.substring(e),i=Gr(t,this.newText);return i===0?this:this.slice(this.replaceRange.deltaStart(i),new pe(i,this.newText.length))}removeCommonSuffix(e){const t=this.replaceRange.substring(e),i=Lc(t,this.newText);return i===0?this:this.slice(this.replaceRange.deltaEnd(-i),new pe(0,this.newText.length-i))}toJson(){return{txt:this.newText,pos:this.replaceRange.start,len:this.replaceRange.length}}}const vC=class vC extends ife{static compose(e){if(e.length===0)return vC.empty;let t=e[0];for(let i=1;i<e.length;i++)t=t.compose(e[i]);return t}constructor(e){super(e)}_createNew(e){return new vC(e)}};vC.empty=new vC([]);let qc=vC;class Cn extends nfe{static insert(e,t){return new Cn(pe.emptyAt(e),t)}static replace(e,t){return new Cn(e,t)}equals(e){return this.replaceRange.equals(e.replaceRange)&&this.newText===e.newText}tryJoinTouching(e){return new Cn(this.replaceRange.joinRightTouching(e.replaceRange),this.newText+e.newText)}slice(e,t){return new Cn(e,t?t.substring(this.newText):this.newText)}}function wU(o,e){o=o.slice();const t=[];let i=0;for(const n of e.replacements){for(;;){const r=o[0];if(!r||r.endExclusive>=n.replaceRange.start)break;o.shift(),t.push(r.delta(i))}const s=[];for(;;){const r=o[0];if(!r||!r.intersectsOrTouches(n.replaceRange))break;o.shift(),s.push(r)}for(let r=s.length-1;r>=0;r--){let a=s[r];const l=a.intersect(n.replaceRange).length;a=a.deltaEnd(-l+(r===0?n.newText.length:0));const c=a.start-n.replaceRange.start;c>0&&(a=a.delta(-c)),r!==0&&(a=a.delta(n.newText.length)),a=a.delta(-(n.newText.length-n.replaceRange.length)),o.unshift(a)}i+=n.newText.length-n.replaceRange.length}for(;;){const n=o[0];if(!n)break;o.shift(),t.push(n.delta(i))}return t}const Vr=class Vr{static ofLength(e,t){return new Vr(e,e+t)}static fromRange(e){return new Vr(e.startLineNumber,e.endLineNumber)}static fromRangeInclusive(e){return new Vr(e.startLineNumber,e.endLineNumber+1)}static joinMany(e){if(e.length===0)return[];let t=new Tr(e[0].slice());for(let i=1;i<e.length;i++)t=t.getUnion(new Tr(e[i].slice()));return t.ranges}static join(e){if(e.length===0)throw new Ce("lineRanges cannot be empty");let t=e[0].startLineNumber,i=e[0].endLineNumberExclusive;for(let n=1;n<e.length;n++)t=Math.min(t,e[n].startLineNumber),i=Math.max(i,e[n].endLineNumberExclusive);return new Vr(t,i)}static deserialize(e){return new Vr(e[0],e[1])}constructor(e,t){if(e>t)throw new Ce(`startLineNumber ${e} cannot be after endLineNumberExclusive ${t}`);this.startLineNumber=e,this.endLineNumberExclusive=t}contains(e){return this.startLineNumber<=e&&e<this.endLineNumberExclusive}get isEmpty(){return this.startLineNumber===this.endLineNumberExclusive}delta(e){return new Vr(this.startLineNumber+e,this.endLineNumberExclusive+e)}deltaLength(e){return new Vr(this.startLineNumber,this.endLineNumberExclusive+e)}get length(){return this.endLineNumberExclusive-this.startLineNumber}join(e){return new Vr(Math.min(this.startLineNumber,e.startLineNumber),Math.max(this.endLineNumberExclusive,e.endLineNumberExclusive))}toString(){return`[${this.startLineNumber},${this.endLineNumberExclusive})`}intersect(e){const t=Math.max(this.startLineNumber,e.startLineNumber),i=Math.min(this.endLineNumberExclusive,e.endLineNumberExclusive);if(t<=i)return new Vr(t,i)}intersectsStrict(e){return this.startLineNumber<e.endLineNumberExclusive&&e.startLineNumber<this.endLineNumberExclusive}intersectsOrTouches(e){return this.startLineNumber<=e.endLineNumberExclusive&&e.startLineNumber<=this.endLineNumberExclusive}equals(e){return this.startLineNumber===e.startLineNumber&&this.endLineNumberExclusive===e.endLineNumberExclusive}toInclusiveRange(){return this.isEmpty?null:new k(this.startLineNumber,1,this.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER)}toExclusiveRange(){return new k(this.startLineNumber,1,this.endLineNumberExclusive,1)}mapToLineArray(e){const t=[];for(let i=this.startLineNumber;i<this.endLineNumberExclusive;i++)t.push(e(i));return t}forEach(e){for(let t=this.startLineNumber;t<this.endLineNumberExclusive;t++)e(t)}serialize(){return[this.startLineNumber,this.endLineNumberExclusive]}toOffsetRange(){return new pe(this.startLineNumber-1,this.endLineNumberExclusive-1)}addMargin(e,t){return new Vr(this.startLineNumber-e,this.endLineNumberExclusive+t)}};Vr.compareByStart=kn(e=>e.startLineNumber,lo);let ke=Vr;class Tr{constructor(e=[]){this._normalizedRanges=e}get ranges(){return this._normalizedRanges}addRange(e){if(e.length===0)return;const t=sv(this._normalizedRanges,n=>n.endLineNumberExclusive>=e.startLineNumber),i=C_(this._normalizedRanges,n=>n.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)this._normalizedRanges.splice(t,0,e);else if(t===i-1){const n=this._normalizedRanges[t];this._normalizedRanges[t]=n.join(e)}else{const n=this._normalizedRanges[t].join(this._normalizedRanges[i-1]).join(e);this._normalizedRanges.splice(t,i-t,n)}}contains(e){const t=b_(this._normalizedRanges,i=>i.startLineNumber<=e);return!!t&&t.endLineNumberExclusive>e}intersects(e){const t=b_(this._normalizedRanges,i=>i.startLineNumber<e.endLineNumberExclusive);return!!t&&t.endLineNumberExclusive>e.startLineNumber}getUnion(e){if(this._normalizedRanges.length===0)return e;if(e._normalizedRanges.length===0)return this;const t=[];let i=0,n=0,s=null;for(;i<this._normalizedRanges.length||n<e._normalizedRanges.length;){let r=null;if(i<this._normalizedRanges.length&&n<e._normalizedRanges.length){const a=this._normalizedRanges[i],l=e._normalizedRanges[n];a.startLineNumber<l.startLineNumber?(r=a,i++):(r=l,n++)}else i<this._normalizedRanges.length?(r=this._normalizedRanges[i],i++):(r=e._normalizedRanges[n],n++);s===null?s=r:s.endLineNumberExclusive>=r.startLineNumber?s=new ke(s.startLineNumber,Math.max(s.endLineNumberExclusive,r.endLineNumberExclusive)):(t.push(s),s=r)}return s!==null&&t.push(s),new Tr(t)}subtractFrom(e){const t=sv(this._normalizedRanges,r=>r.endLineNumberExclusive>=e.startLineNumber),i=C_(this._normalizedRanges,r=>r.startLineNumber<=e.endLineNumberExclusive)+1;if(t===i)return new Tr([e]);const n=[];let s=e.startLineNumber;for(let r=t;r<i;r++){const a=this._normalizedRanges[r];a.startLineNumber>s&&n.push(new ke(s,a.startLineNumber)),s=a.endLineNumberExclusive}return s<e.endLineNumberExclusive&&n.push(new ke(s,e.endLineNumberExclusive)),new Tr(n)}toString(){return this._normalizedRanges.map(e=>e.toString()).join(", ")}getIntersection(e){const t=[];let i=0,n=0;for(;i<this._normalizedRanges.length&&n<e._normalizedRanges.length;){const s=this._normalizedRanges[i],r=e._normalizedRanges[n],a=s.intersect(r);a&&!a.isEmpty&&t.push(a),s.endLineNumberExclusive<r.endLineNumberExclusive?i++:n++}return new Tr(t)}getWithDelta(e){return new Tr(this._normalizedRanges.map(t=>t.delta(e)))}}const el=class el{static betweenPositions(e,t){return e.lineNumber===t.lineNumber?new el(0,t.column-e.column):new el(t.lineNumber-e.lineNumber,t.column-1)}static fromPosition(e){return new el(e.lineNumber-1,e.column-1)}static ofRange(e){return el.betweenPositions(e.getStartPosition(),e.getEndPosition())}static ofText(e){let t=0,i=0;for(const n of e)n===`
`?(t++,i=0):i++;return new el(t,i)}constructor(e,t){this.lineCount=e,this.columnCount=t}isGreaterThanOrEqualTo(e){return this.lineCount!==e.lineCount?this.lineCount>e.lineCount:this.columnCount>=e.columnCount}add(e){return e.lineCount===0?new el(this.lineCount,this.columnCount+e.columnCount):new el(this.lineCount+e.lineCount,e.columnCount)}createRange(e){return this.lineCount===0?new k(e.lineNumber,e.column,e.lineNumber,e.column+this.columnCount):new k(e.lineNumber,e.column,e.lineNumber+this.lineCount,this.columnCount+1)}toRange(){return new k(1,1,this.lineCount+1,this.columnCount+1)}toLineRange(){return ke.ofLength(1,this.lineCount+1)}addToPosition(e){return this.lineCount===0?new M(e.lineNumber,e.column+this.columnCount):new M(e.lineNumber+this.lineCount,this.columnCount+1)}toString(){return`${this.lineCount},${this.columnCount}`}};el.zero=new el(0,0);let $i=el;class SU{getOffsetRange(e){return new pe(this.getOffset(e.getStartPosition()),this.getOffset(e.getEndPosition()))}getRange(e){return k.fromPositions(this.getPosition(e.start),this.getPosition(e.endExclusive))}getStringReplacement(e){return new Uf.deps.StringReplacement(this.getOffsetRange(e.range),e.text)}getTextReplacement(e){return new Uf.deps.TextReplacement(this.getRange(e.replaceRange),e.newText)}getTextEdit(e){const t=e.replacements.map(i=>this.getTextReplacement(i));return new Uf.deps.TextEdit(t)}}const rB=class rB{static get deps(){if(!this._deps)throw new Error("Dependencies not set. Call _setDependencies first.");return this._deps}};rB._deps=void 0;let Uf=rB;function sfe(o){Uf._deps=o}class rx extends SU{constructor(e){super(),this.text=e,this.lineStartOffsetByLineIdx=[],this.lineEndOffsetByLineIdx=[],this.lineStartOffsetByLineIdx.push(0);for(let t=0;t<e.length;t++)e.charAt(t)===`
`&&(this.lineStartOffsetByLineIdx.push(t+1),t>0&&e.charAt(t-1)==="\r"?this.lineEndOffsetByLineIdx.push(t-1):this.lineEndOffsetByLineIdx.push(t));this.lineEndOffsetByLineIdx.push(e.length)}getOffset(e){const t=this._validatePosition(e);return this.lineStartOffsetByLineIdx[t.lineNumber-1]+t.column-1}_validatePosition(e){if(e.lineNumber<1)return new M(1,1);const t=this.textLength.lineCount+1;if(e.lineNumber>t){const n=this.getLineLength(t);return new M(t,n+1)}if(e.column<1)return new M(e.lineNumber,1);const i=this.getLineLength(e.lineNumber);return e.column-1>i?new M(e.lineNumber,i+1):e}getPosition(e){const t=C_(this.lineStartOffsetByLineIdx,s=>s<=e),i=t+1,n=e-this.lineStartOffsetByLineIdx[t]+1;return new M(i,n)}get textLength(){const e=this.lineStartOffsetByLineIdx.length-1;return new Uf.deps.TextLength(e,this.text.length-this.lineStartOffsetByLineIdx[e])}getLineLength(e){return this.lineEndOffsetByLineIdx[e-1]-this.lineStartOffsetByLineIdx[e-1]}}class cP{constructor(){this._transformer=void 0}get endPositionExclusive(){return this.length.addToPosition(new M(1,1))}get lineRange(){return this.length.toLineRange()}getValue(){return this.getValueOfRange(this.length.toRange())}getValueOfOffsetRange(e){return this.getValueOfRange(this.getTransformer().getRange(e))}getLineLength(e){return this.getValueOfRange(new k(e,1,e,Number.MAX_SAFE_INTEGER)).length}getTransformer(){return this._transformer||(this._transformer=new rx(this.getValue())),this._transformer}getLineAt(e){return this.getValueOfRange(new k(e,1,e,Number.MAX_SAFE_INTEGER))}}class ofe extends cP{constructor(e,t){YC(t>=1),super(),this._getLineContent=e,this._lineCount=t}getValueOfRange(e){if(e.startLineNumber===e.endLineNumber)return this._getLineContent(e.startLineNumber).substring(e.startColumn-1,e.endColumn-1);let t=this._getLineContent(e.startLineNumber).substring(e.startColumn-1);for(let i=e.startLineNumber+1;i<e.endLineNumber;i++)t+=`
`+this._getLineContent(i);return t+=`
`+this._getLineContent(e.endLineNumber).substring(0,e.endColumn-1),t}getLineLength(e){return this._getLineContent(e).length}get length(){const e=this._getLineContent(this._lineCount);return new $i(this._lineCount-1,e.length)}}class ax extends ofe{constructor(e){super(t=>e[t-1],e.length)}}class kh extends cP{constructor(e){super(),this.value=e,this._t=new rx(this.value)}getValueOfRange(e){return this._t.getOffsetRange(e).substring(this.value)}get length(){return this._t.textLength}}class mo{static fromStringEdit(e,t){const i=e.replacements.map(n=>Oi.fromStringReplacement(n,t));return new mo(i)}static fromParallelReplacementsUnsorted(e){const t=e.slice().sort(kn(i=>i.range,k.compareRangesUsingStarts));return new mo(t)}constructor(e){this.replacements=e,Xd(()=>XC(e,(t,i)=>t.range.getEndPosition().isBeforeOrEqual(i.range.getStartPosition())))}mapPosition(e){let t=0,i=0,n=0;for(const s of this.replacements){const r=s.range.getStartPosition();if(e.isBeforeOrEqual(r))break;const a=s.range.getEndPosition(),l=$i.ofText(s.text);if(e.isBefore(a)){const c=new M(r.lineNumber+t,r.column+(r.lineNumber+t===i?n:0)),d=l.addToPosition(c);return lx(c,d)}r.lineNumber+t!==i&&(n=0),t+=l.lineCount-(s.range.endLineNumber-s.range.startLineNumber),l.lineCount===0?a.lineNumber!==r.lineNumber?n+=l.columnCount-(a.column-1):n+=l.columnCount-(a.column-r.column):n=l.columnCount,i=a.lineNumber+t}return new M(e.lineNumber+t,e.column+(e.lineNumber+t===i?n:0))}mapRange(e){function t(r){return r instanceof M?r:r.getStartPosition()}function i(r){return r instanceof M?r:r.getEndPosition()}const n=t(this.mapPosition(e.getStartPosition())),s=i(this.mapPosition(e.getEndPosition()));return lx(n,s)}apply(e){let t="",i=new M(1,1);for(const s of this.replacements){const r=s.range,a=r.getStartPosition(),l=r.getEndPosition(),c=lx(i,a);c.isEmpty()||(t+=e.getValueOfRange(c)),t+=s.text,i=l}const n=lx(i,e.endPositionExclusive);return n.isEmpty()||(t+=e.getValueOfRange(n)),t}applyToString(e){const t=new kh(e);return this.apply(t)}getNewRanges(){const e=[];let t=0,i=0,n=0;for(const s of this.replacements){const r=$i.ofText(s.text),a=M.lift({lineNumber:s.range.startLineNumber+i,column:s.range.startColumn+(s.range.startLineNumber===t?n:0)}),l=r.createRange(a);e.push(l),i=l.endLineNumber-s.range.endLineNumber,n=l.endColumn-s.range.endColumn,t=s.range.endLineNumber}return e}toReplacement(e){if(this.replacements.length===0)throw new Ce;if(this.replacements.length===1)return this.replacements[0];const t=this.replacements[0].range.getStartPosition(),i=this.replacements[this.replacements.length-1].range.getEndPosition();let n="";for(let s=0;s<this.replacements.length;s++){const r=this.replacements[s];if(n+=r.text,s<this.replacements.length-1){const a=this.replacements[s+1],l=k.fromPositions(r.range.getEndPosition(),a.range.getStartPosition()),c=e.getValueOfRange(l);n+=c}}return new Oi(k.fromPositions(t,i),n)}toString(e){return e===void 0?this.replacements.map(t=>t.toString()).join(`
`):typeof e=="string"?this.toString(new kh(e)):this.replacements.length===0?"":this.replacements.map(t=>{const n=e.getValueOfRange(t.range),s=k.fromPositions(new M(Math.max(1,t.range.startLineNumber-1),1),t.range.getStartPosition());let r=e.getValueOfRange(s);r.length>10&&(r="..."+r.substring(r.length-10));const a=k.fromPositions(t.range.getEndPosition(),new M(t.range.endLineNumber+1,1));let l=e.getValueOfRange(a);l.length>10&&(l=l.substring(0,10)+"...");let c=n;if(c.length>10){const h=Math.floor(5);c=c.substring(0,h)+"..."+c.substring(c.length-h)}let d=t.text;if(d.length>10){const h=Math.floor(5);d=d.substring(0,h)+"..."+d.substring(d.length-h)}return c.length===0?`${r}❰${d}❱${l}`:`${r}❰${c}↦${d}❱${l}`}).join(`
`)}}class Oi{static joinReplacements(e,t){if(e.length===0)throw new Ce;if(e.length===1)return e[0];const i=e[0].range.getStartPosition(),n=e[e.length-1].range.getEndPosition();let s="";for(let r=0;r<e.length;r++){const a=e[r];if(s+=a.text,r<e.length-1){const l=e[r+1],c=k.fromPositions(a.range.getEndPosition(),l.range.getStartPosition()),d=t.getValueOfRange(c);s+=d}}return new Oi(k.fromPositions(i,n),s)}static fromStringReplacement(e,t){return new Oi(t.getTransformer().getRange(e.replaceRange),e.newText)}static delete(e){return new Oi(e,"")}constructor(e,t){this.range=e,this.text=t}get isEmpty(){return this.range.isEmpty()&&this.text.length===0}static equals(e,t){return e.range.equalsRange(t.range)&&e.text===t.text}equals(e){return Oi.equals(this,e)}removeCommonPrefixAndSuffix(e){return this.removeCommonPrefix(e).removeCommonSuffix(e)}removeCommonPrefix(e){const t=e.getValueOfRange(this.range).replaceAll(`\r
`,`
`),i=this.text.replaceAll(`\r
`,`
`),n=Gr(t,i),s=$i.ofText(t.substring(0,n)).addToPosition(this.range.getStartPosition()),r=i.substring(n),a=k.fromPositions(s,this.range.getEndPosition());return new Oi(a,r)}removeCommonSuffix(e){const t=e.getValueOfRange(this.range).replaceAll(`\r
`,`
`),i=this.text.replaceAll(`\r
`,`
`),n=Lc(t,i),s=$i.ofText(t.substring(0,t.length-n)).addToPosition(this.range.getStartPosition()),r=i.substring(0,i.length-n),a=k.fromPositions(this.range.getStartPosition(),s);return new Oi(a,r)}toString(){const e=this.range.getStartPosition(),t=this.range.getEndPosition();return`(${e.lineNumber},${e.column} -> ${t.lineNumber},${t.column}): "${this.text}"`}}function lx(o,e){if(o.lineNumber===e.lineNumber&&o.column===Number.MAX_SAFE_INTEGER)return k.fromPositions(e,e);if(!o.isBeforeOrEqual(e))throw new Ce("start must be before end");return new k(o.lineNumber,o.column,e.lineNumber,e.column)}sfe({StringEdit:qc,StringReplacement:Cn,TextReplacement:Oi,TextEdit:mo,TextLength:$i});var rfe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},afe=function(o,e){return function(t,i){e(t,i,o)}};let dP=class extends A{constructor(e,t,i,n){super(),this._domNode=e,this._context=t,this._viewController=i,this._accessibilityService=n,this._selectionChangeListener=this._register(new ct),this._accessibilityPageSize=1,this._ignoreSelectionChangeTime=0,this._strategy=new bU,this.onConfigurationChanged(this._context.configuration.options)}updateScreenReaderContent(e){const t=this._domNode.domNode,i=ft().document.activeElement;if(!i||i!==t)return;if(this._accessibilityService.isScreenReaderOptimized()){this._state=this._getScreenReaderContentState(e),t.textContent!==this._state.value&&(this._setIgnoreSelectionChangeTime("setValue"),t.textContent=this._state.value);const s=ft().document.getSelection();if(!s)return;const r=this._getScreenReaderRange(this._state.selectionStart,this._state.selectionEnd);if(!r)return;this._setIgnoreSelectionChangeTime("setRange"),s.setBaseAndExtent(r.anchorNode,r.anchorOffset,r.focusNode,r.focusOffset)}else this._state=void 0,this._setIgnoreSelectionChangeTime("setValue"),this._domNode.domNode.textContent=""}updateScrollTop(e){if(!this._state)return;const t=this._context.viewModel.viewLayout,i=this._state.startPositionWithinEditor.lineNumber,n=t.getVerticalOffsetForLineNumber(i),s=t.getVerticalOffsetForLineNumber(e.positionLineNumber);this._domNode.domNode.scrollTop=s-n}onFocusChange(e){e?this._selectionChangeListener.value=this._setSelectionChangeListener():this._selectionChangeListener.value=void 0}onConfigurationChanged(e){this._accessibilityPageSize=e.get(3)}onWillCut(){this._setIgnoreSelectionChangeTime("onCut")}onWillPaste(){this._setIgnoreSelectionChangeTime("onWillPaste")}_setIgnoreSelectionChangeTime(e){this._ignoreSelectionChangeTime=Date.now()}_setSelectionChangeListener(){let e=0;return W(this._domNode.domNode.ownerDocument,"selectionchange",()=>{const t=this._accessibilityService.isScreenReaderOptimized();if(!this._state||!t||!Ll.enabled||!(ft().document.activeElement===this._domNode.domNode))return;const s=ft().document.getSelection();if(!s||s.rangeCount===0)return;const a=s.getRangeAt(0),l=Date.now(),c=l-e;if(e=l,c<5)return;const d=l-this._ignoreSelectionChangeTime;this._ignoreSelectionChangeTime=0,!(d<100)&&this._viewController.setSelection(this._getEditorSelectionFromDomRange(this._context,this._state,s.direction,a))})}_getScreenReaderContentState(e){const t=this._strategy.fromEditorSelection(this._context.viewModel,e,this._accessibilityPageSize,this._accessibilityService.getAccessibilitySupport()===0),i=this._context.viewModel.model.getPositionAt(1/0);let n=t.value;return i.column===1&&e.getEndPosition().equals(i)&&(n+=`
`),t.value=n,t}_getScreenReaderRange(e,t){const i=this._domNode.domNode.firstChild;if(!i)return;const n=new globalThis.Range;return n.setStart(i,e),n.setEnd(i,t),{anchorNode:i,anchorOffset:e,focusNode:i,focusOffset:t}}_getEditorSelectionFromDomRange(e,t,i,n){const s=e.viewModel,r=s.model,l=s.coordinatesConverter.convertViewPositionToModelPosition(t.startPositionWithinEditor),c=r.getOffsetAt(l);let d=n.startOffset+c,h=n.endOffset+c;if(r.getEndOfLineSequence()===1){const b=t.value,C=new rx(b),w=C.getPosition(n.startOffset),v=C.getPosition(n.endOffset);d+=w.lineNumber-1,h+=v.lineNumber-1}const f=r.getPositionAt(d),g=r.getPositionAt(h),m=i==="forward"?f:g,_=i==="forward"?g:f;return ce.fromPositions(m,_)}};dP=rfe([afe(3,bn)],dP);var lfe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},yU=function(o,e){return function(t,i){e(t,i,o)}};let hP=class extends A{constructor(e,t,i,n,s){super(),this._domNode=e,this._context=t,this._viewController=i,this._keybindingService=n,this._accessibilityService=s,this._contentLeft=1,this._contentWidth=1,this._contentHeight=1,this._divWidth=1,this._primarySelection=new ce(1,1,1,1),this._primaryCursorVisibleRange=null,this._state=this._register(new ct),this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes()}onWillPaste(){this._state.value?.onWillPaste()}onWillCut(){this._state.value?.onWillCut()}handleFocusChange(e){this._state.value?.onFocusChange(e),this.writeScreenReaderContent()}onConfigurationChanged(e){this._instantiateScreenReaderContent(),this._updateConfigurationSettings(),this._updateDomAttributes(),e.hasChanged(2)&&this.writeScreenReaderContent()}_instantiateScreenReaderContent(){const e=this._context.configuration.options.get(107);this._renderRichContent!==e&&(this._renderRichContent=e,this._state.value=this._createScreenReaderContent(e))}_createScreenReaderContent(e){return e?new lP(this._domNode,this._context,this._viewController,this._accessibilityService):new dP(this._domNode,this._context,this._viewController,this._accessibilityService)}_updateConfigurationSettings(){const e=this._context.configuration.options,t=e.get(165),i=t.wrappingColumn;this._contentLeft=t.contentLeft,this._contentWidth=t.contentWidth,this._contentHeight=t.height,this._fontInfo=e.get(59),this._divWidth=Math.round(i*this._fontInfo.typicalHalfwidthCharacterWidth),this._state.value?.onConfigurationChanged(e)}_updateDomAttributes(){const e=this._context.configuration.options;this._domNode.domNode.setAttribute("role","textbox"),this._domNode.domNode.setAttribute("aria-required",e.get(9)?"true":"false"),this._domNode.domNode.setAttribute("aria-multiline","true"),this._domNode.domNode.setAttribute("aria-autocomplete",e.get(104)?"none":"both"),this._domNode.domNode.setAttribute("aria-roledescription",p(55,"editor")),this._domNode.domNode.setAttribute("aria-label",nP(e,this._keybindingService));const t=this._context.viewModel.model.getOptions().tabSize,i=e.get(59).spaceWidth;this._domNode.domNode.style.tabSize=`${t*i}px`;const n=e.get(154),s=n==="inherit"?e.get(153):n,r=s==="inherit"?e.get(149):s;this._domNode.domNode.style.textWrap=r==="off"?"nowrap":"wrap"}onCursorStateChanged(e){this._primarySelection=e.selections[0]??new ce(1,1,1,1)}prepareRender(e){this.writeScreenReaderContent(),this._primaryCursorVisibleRange=e.visibleRangeForPosition(this._primarySelection.getPosition())}render(e){if(!this._primaryCursorVisibleRange){this._renderAtTopLeft();return}const t=this._context.viewLayout.getCurrentScrollLeft(),i=this._contentLeft+this._primaryCursorVisibleRange.left-t;if(i<this._contentLeft||i>this._contentLeft+this._contentWidth){this._renderAtTopLeft();return}const n=this._context.viewLayout.getCurrentScrollTop(),s=this._primarySelection.positionLineNumber,r=this._context.viewLayout.getVerticalOffsetForLineNumber(s)-n;if(r<0||r>this._contentHeight){this._renderAtTopLeft();return}const a=this._context.viewLayout.getLineHeightForLineNumber(s);this._doRender(r,this._contentLeft,this._divWidth,a),this._state.value?.updateScrollTop(this._primarySelection)}_renderAtTopLeft(){this._doRender(0,0,this._contentWidth,1)}_doRender(e,t,i,n){dn(this._domNode,this._fontInfo),this._domNode.setTop(e),this._domNode.setLeft(t),this._domNode.setWidth(i),this._domNode.setHeight(n),this._domNode.setLineHeight(n)}setAriaOptions(e){e.activeDescendant?(this._domNode.setAttribute("aria-haspopup","true"),this._domNode.setAttribute("aria-autocomplete","list"),this._domNode.setAttribute("aria-activedescendant",e.activeDescendant)):(this._domNode.setAttribute("aria-haspopup","false"),this._domNode.setAttribute("aria-autocomplete","both"),this._domNode.removeAttribute("aria-activedescendant")),e.role&&this._domNode.setAttribute("role",e.role)}writeScreenReaderContent(){this._state.value?.updateScreenReaderContent(this._primarySelection)}};hP=lfe([yU(3,ot),yU(4,bn)],hP);var uP;(function(o){function e(t,i){return new t.EditContext(i)}o.create=e})(uP||(uP={}));class cfe{constructor(){this._nativeEditContextMapping=new Map}register(e,t){return this._nativeEditContextMapping.set(e,t),{dispose:()=>{this._nativeEditContextMapping.delete(e)}}}get(e){return this._nativeEditContextMapping.get(e)}}const fP=new cfe;var dfe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LU=function(o,e){return function(t,i){e(t,i,o)}},bv;(function(o){o.NONE="edit-context-composition-none",o.SECONDARY="edit-context-composition-secondary",o.PRIMARY="edit-context-composition-primary"})(bv||(bv={}));let cx=class extends _U{constructor(e,t,i,n,s,r,a){super(t),this._viewController=n,this._visibleRangeProvider=s,this.logService=a,this._previousEditContextSelection=new pe(0,0),this._editContextPrimarySelection=new ce(1,1,1,1),this._decorations=[],this._primarySelection=new ce(1,1,1,1),this._targetWindowId=-1,this._scrollTop=0,this._scrollLeft=0,this.domNode=new uL(document.createElement("div")),this.domNode.setClassName("native-edit-context"),this._imeTextArea=new uL(document.createElement("textarea")),this._imeTextArea.setClassName("ime-text-area"),this._imeTextArea.setAttribute("readonly","true"),this._imeTextArea.setAttribute("tabindex","-1"),this._imeTextArea.setAttribute("aria-hidden","true"),this.domNode.setAttribute("autocorrect","off"),this.domNode.setAttribute("autocapitalize","off"),this.domNode.setAttribute("autocomplete","off"),this.domNode.setAttribute("spellcheck","false"),this._updateDomAttributes(),i.appendChild(this.domNode),i.appendChild(this._imeTextArea),this._parent=i.domNode,this._focusTracker=this._register(new rP(a,this.domNode.domNode,h=>{a.trace("NativeEditContext#handleFocusChange : ",h),this._screenReaderSupport.handleFocusChange(h),this._context.viewModel.setHasFocus(h)}));const l=me(this.domNode.domNode);this._editContext=uP.create(l),this.setEditContextOnDomNode(),this._screenReaderSupport=this._register(r.createInstance(hP,this.domNode,t,this._viewController)),this._register(W(this.domNode.domNode,"copy",h=>{this.logService.trace("NativeEditContext#copy"),this._ensureClipboardGetsEditorSelection(h)})),this._register(W(this.domNode.domNode,"cut",h=>{this.logService.trace("NativeEditContext#cut"),this._screenReaderSupport.onWillCut(),this._ensureClipboardGetsEditorSelection(h),this.logService.trace("NativeEditContext#cut (before viewController.cut)"),this._viewController.cut()})),this._register(W(this.domNode.domNode,"keyup",h=>this._onKeyUp(h))),this._register(W(this.domNode.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(W(this._imeTextArea.domNode,"keyup",h=>this._onKeyUp(h))),this._register(W(this._imeTextArea.domNode,"keydown",async h=>this._onKeyDown(h))),this._register(W(this.domNode.domNode,"beforeinput",async h=>{(h.inputType==="insertParagraph"||h.inputType==="insertLineBreak")&&this._onType(this._viewController,{text:`
`,replacePrevCharCnt:0,replaceNextCharCnt:0,positionDelta:0})})),this._register(W(this.domNode.domNode,"paste",h=>{if(this.logService.trace("NativeEditContext#paste"),h.preventDefault(),!h.clipboardData)return;let[u,f]=Af.getTextData(h.clipboardData);if(this.logService.trace("NativeEditContext#paste with id : ",f?.id," with text.length: ",u.length),!u)return;f=f||wl.INSTANCE.get(u);let g=!1,m=null,_=null;f&&(g=this._context.configuration.options.get(45)&&!!f.isFromEmptySelection,m=typeof f.multicursorText<"u"?f.multicursorText:null,_=f.mode),this.logService.trace("NativeEditContext#paste (before viewController.paste)"),this._viewController.paste(u,g,m,_)})),this._register(mv(this._editContext,"textformatupdate",h=>this._handleTextFormatUpdate(h))),this._register(mv(this._editContext,"characterboundsupdate",h=>this._updateCharacterBounds(h)));let c;this._register(mv(this._editContext,"textupdate",h=>{const u=h.text;if(u.length===1){const f=u.charCodeAt(0);if(zi(f)){c=u;return}if(eh(f)&&c){const g={text:c+u,selectionEnd:h.selectionEnd,selectionStart:h.selectionStart,updateRangeStart:h.updateRangeStart-1,updateRangeEnd:h.updateRangeEnd-1};c=void 0,this._emitTypeEvent(this._viewController,g);return}}this._emitTypeEvent(this._viewController,h)})),this._register(mv(this._editContext,"compositionstart",h=>{this._updateEditContext(),this._viewController.compositionStart(),this._context.viewModel.onCompositionStart()})),this._register(mv(this._editContext,"compositionend",h=>{this._updateEditContext(),this._viewController.compositionEnd(),this._context.viewModel.onCompositionEnd()}));let d=!1;this._register(Ll.onDidChange(()=>{Ll.enabled&&d&&(this._focusTracker.resume(),this.domNode.focus(),d=!1),!Ll.enabled&&this.isFocused()&&(this._focusTracker.pause(),this._imeTextArea.focus(),d=!0)})),this._register(fP.register(e,this))}dispose(){this.domNode.domNode.editContext=void 0,this.domNode.domNode.blur(),this.domNode.domNode.remove(),this._imeTextArea.domNode.remove(),super.dispose()}setAriaOptions(e){this._screenReaderSupport.setAriaOptions(e)}getLastRenderData(){return this._primarySelection.getPosition()}prepareRender(e){this._screenReaderSupport.prepareRender(e),this._updateSelectionAndControlBounds(e)}render(e){this._screenReaderSupport.render(e)}onCursorStateChanged(e){return this._primarySelection=e.modelSelections[0]??new ce(1,1,1,1),this._screenReaderSupport.onCursorStateChanged(e),this._updateEditContext(),!0}onConfigurationChanged(e){return this._screenReaderSupport.onConfigurationChanged(e),this._updateDomAttributes(),!0}onDecorationsChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return this._updateEditContextOnLineChange(e.fromLineNumber,e.fromLineNumber+e.count-1),!0}onLinesDeleted(e){return this._updateEditContextOnLineChange(e.fromLineNumber,e.toLineNumber),!0}onLinesInserted(e){return this._updateEditContextOnLineChange(e.fromLineNumber,e.toLineNumber),!0}_updateEditContextOnLineChange(e,t){this._editContextPrimarySelection.endLineNumber<e||this._editContextPrimarySelection.startLineNumber>t||this._updateEditContext()}onScrollChanged(e){return this._scrollLeft=e.scrollLeft,this._scrollTop=e.scrollTop,!0}onZonesChanged(e){return!0}onWillPaste(){this.logService.trace("NativeEditContext#onWillPaste"),this._onWillPaste()}_onWillPaste(){this._screenReaderSupport.onWillPaste()}onWillCopy(){this.logService.trace("NativeEditContext#onWillCopy"),this.logService.trace("NativeEditContext#isFocused : ",this.domNode.domNode===Ui())}writeScreenReaderContent(){this._screenReaderSupport.writeScreenReaderContent()}isFocused(){return this._focusTracker.isFocused}focus(){this._focusTracker.focus(),this.refreshFocusState()}refreshFocusState(){this._focusTracker.refreshFocusState()}setEditContextOnDomNode(){const e=me(this.domNode.domNode),t=b1(e);this._targetWindowId!==t&&(this.domNode.domNode.editContext=this._editContext,this._targetWindowId=t)}_onKeyUp(e){this._viewController.emitKeyUp(new St(e))}_onKeyDown(e){const t=new St(e);t.keyCode===114&&t.stopPropagation(),this._viewController.emitKeyDown(t)}_updateDomAttributes(){const e=this._context.configuration.options;this.domNode.domNode.setAttribute("tabindex",String(e.get(140)))}_updateEditContext(){const e=this._getNewEditContextState();e&&(this._editContext.updateText(0,Number.MAX_SAFE_INTEGER,e.text??" "),this._editContext.updateSelection(e.selectionStartOffset,e.selectionEndOffset),this._editContextPrimarySelection=e.editContextPrimarySelection,this._previousEditContextSelection=new pe(e.selectionStartOffset,e.selectionEndOffset))}_emitTypeEvent(e,t){if(!this._editContext)return;const i=this._previousEditContextSelection.endExclusive,n=this._previousEditContextSelection.start;this._previousEditContextSelection=new pe(t.selectionStart,t.selectionEnd);let s=0,r=0;t.updateRangeEnd>i&&(s=t.updateRangeEnd-i),t.updateRangeStart<n&&(r=n-t.updateRangeStart);let a="";n<t.updateRangeStart&&(a+=this._editContext.text.substring(n,t.updateRangeStart)),a+=t.text,i>t.updateRangeEnd&&(a+=this._editContext.text.substring(t.updateRangeEnd,i));let l=0;t.selectionStart===t.selectionEnd&&n===i&&(l=t.selectionStart-(t.updateRangeStart+t.text.length));const c={text:a,replacePrevCharCnt:r,replaceNextCharCnt:s,positionDelta:l};this._onType(e,c)}_onType(e,t){t.replacePrevCharCnt||t.replaceNextCharCnt||t.positionDelta?e.compositionType(t.text,t.replacePrevCharCnt,t.replaceNextCharCnt,t.positionDelta):e.type(t.text)}_getNewEditContextState(){const e=this._primarySelection,t=this._context.viewModel.model;if(!t.isValidRange(e))return;const i=e.startLineNumber,n=e.endLineNumber,s=t.getLineMaxColumn(n),r=new k(i,1,n,s),a=t.getValueInRange(r,0),l=e.startColumn-1,c=a.length+e.endColumn-s;return{text:a,selectionStartOffset:l,selectionEndOffset:c,editContextPrimarySelection:e}}_editContextStartPosition(){return new M(this._editContextPrimarySelection.startLineNumber,1)}_handleTextFormatUpdate(e){if(!this._editContext)return;const t=e.getTextFormats(),i=this._editContextStartPosition(),n=[];t.forEach(s=>{const r=this._context.viewModel.model,a=r.getOffsetAt(i),l=r.getPositionAt(a+s.rangeStart),c=r.getPositionAt(a+s.rangeEnd),d=k.fromPositions(l,c),h=s.underlineThickness.toLowerCase();let u=bv.NONE;switch(h){case"thin":u=bv.SECONDARY;break;case"thick":u=bv.PRIMARY;break}n.push({range:d,options:{description:"textFormatDecoration",inlineClassName:u}})}),this._decorations=this._context.viewModel.model.deltaDecorations(this._decorations,n)}_updateSelectionAndControlBounds(e){if(!this._parent)return;const i=this._context.configuration.options.get(165).contentLeft,n=this._parent.getBoundingClientRect(),s=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(this._primarySelection),r=this._context.viewLayout.getVerticalOffsetForLineNumber(s.startLineNumber),a=n.top+r-this._scrollTop,c=this._context.viewLayout.getVerticalOffsetAfterLineNumber(s.endLineNumber)-r;let d=n.left+i-this._scrollLeft,h;if(this._primarySelection.isEmpty()){const f=e.visibleRangeForPosition(s.getStartPosition());f&&(d+=f.left),h=0}else h=n.width-i;const u=new DOMRect(d,a,h,c);this._editContext.updateSelectionBounds(u),this._editContext.updateControlBounds(u)}_updateCharacterBounds(e){if(!this._parent)return;const t=this._context.configuration.options,i=t.get(59).typicalHalfwidthCharacterWidth,n=t.get(165).contentLeft,s=this._parent.getBoundingClientRect(),r=[],a=new rx(this._editContext.text);for(let l=e.rangeStart;l<e.rangeEnd;l++){const c=a.getPosition(l),d=this._editContextPrimarySelection.startLineNumber-1,h=new M(d+c.lineNumber,c.column),u=h.delta(0,1),f=k.fromPositions(h,u),g=this._context.viewModel.coordinatesConverter.convertModelRangeToViewRange(f),m=this._visibleRangeProvider.linesVisibleRangesForRange(g,!0)??[],_=g.startLineNumber,b=this._context.viewLayout.getVerticalOffsetForLineNumber(_),C=s.top+b-this._scrollTop;let w=0,v=i;if(m.length>0)for(const L of m[0].ranges){w=L.left,v=L.width;break}const S=this._context.viewLayout.getLineHeightForLineNumber(_);r.push(new DOMRect(s.left+n+w-this._scrollLeft,C,v,S))}this._editContext.updateCharacterBounds(e.rangeStart,r)}_ensureClipboardGetsEditorSelection(e){const t=this._context.configuration.options,i=t.get(45),n=t.get(31),s=this._context.viewModel.getCursorStates().map(c=>c.modelState.selection),r=yz(this._context.viewModel,s,i,n);let a;this.logService.getLevel()===Qi.Trace&&(a=Of());const l={version:1,id:a,isFromEmptySelection:r.isFromEmptySelection,multicursorText:r.multicursorText,mode:r.mode};wl.INSTANCE.set(Fs?r.text.replace(/\r\n/g,`
`):r.text,l),e.preventDefault(),e.clipboardData&&Af.setTextData(e.clipboardData,r.text,r.html,l),this.logService.trace("NativeEditContext#_ensureClipboardGetsEditorSelectios with id : ",a," with text.length: ",r.text.length)}};cx=dfe([LU(5,ge),LU(6,Rt)],cx);class hfe extends vs{constructor(e,t){super(e),this._viewGpuContext=t,this._gpuShapes=[],this._register(Se(i=>this._updateEntries(i)))}onConfigurationChanged(e){return this._updateEntries(void 0),!0}prepareRender(e){}render(e){}_updateEntries(e){const t=this._context.configuration.options,i=t.get(116),n=t.get(59).typicalHalfwidthCharacterWidth,s=this._viewGpuContext.devicePixelRatio.read(e);for(let r=0,a=i.length;r<a;r++){const l=i[r],c=this._gpuShapes[r],d=l.color?$.fromHex(l.color):this._context.theme.getColor(Gde)??$.white,h=[l.column*n*s,0,Math.max(1,Math.ceil(s)),Number.MAX_SAFE_INTEGER,d.rgba.r/255,d.rgba.g/255,d.rgba.b/255,d.rgba.a];c?c.setRaw(h):this._gpuShapes[r]=this._viewGpuContext.rectangleRenderer.register(...h)}for(;this._gpuShapes.length>i.length;)this._gpuShapes.splice(-1,1)[0].dispose()}}const gN=class gN extends Lh{constructor(e,t){super(),this._viewGpuContext=t,this._context=e,this._renderResult=null,this._context.addEventHandler(this)}dispose(){this._context.removeEventHandler(this),this._renderResult=null,super.dispose()}onConfigurationChanged(e){return!0}onCursorStateChanged(e){return!0}onFlushed(e){return!0}onLinesChanged(e){return!0}onLinesDeleted(e){return!0}onLinesInserted(e){return!0}onScrollChanged(e){return e.scrollTopChanged}onZonesChanged(e){return!0}onDecorationsChanged(e){return!0}prepareRender(e){const t=e.visibleRange.startLineNumber,i=e.visibleRange.endLineNumber,n=e.viewportData,s=new GL(this._context.configuration,this._context.theme.type),r=[];for(let a=t;a<=i;a++){const l=a-t,c=this._viewGpuContext.canRenderDetailed(s,n,a);r[l]=c.length?`<div class="${gN.CLASS_NAME}" title="Cannot render on GPU: ${c.join(", ")}"></div>`:""}this._renderResult=r}render(e,t){if(!this._renderResult)return"";const i=t-e;return i<0||i>=this._renderResult.length?"":this._renderResult[i]}};gN.CLASS_NAME="gpu-mark";let gP=gN;var ufe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ffe=function(o,e){return function(t,i){e(t,i,o)}};let pP=class extends Tf{constructor(e,t,i,n,s,r,a,l,c){super(),this._instantiationService=c,this._shouldRecomputeGlyphMarginLanes=!1,this._ownerID=t,this._widgetFocusTracker=this._register(new gfe(e,l)),this._register(this._widgetFocusTracker.onChange(()=>{this._context.viewModel.setHasWidgetFocus(this._widgetFocusTracker.hasFocus())})),this._selections=[new ce(1,1,1,1)],this._renderAnimationFrame=null,this._overflowGuardContainer=lt(document.createElement("div")),Na.write(this._overflowGuardContainer,3),this._overflowGuardContainer.setClassName("overflow-guard"),this._viewController=new Sde(n,r,a,i),this._context=new uue(n,s,r),this._context.addEventHandler(this),this._viewParts=[],this._editContextEnabled=this._context.configuration.options.get(170),this._accessibilitySupport=this._context.configuration.options.get(2),this._editContext=this._instantiateEditContext(),this._viewParts.push(this._editContext),this._linesContent=lt(document.createElement("div")),this._linesContent.setClassName("lines-content monaco-editor-background"),this._linesContent.setPosition("absolute"),this.domNode=lt(document.createElement("div")),this.domNode.setClassName(this._getEditorClassName()),this.domNode.setAttribute("role","code"),this._context.configuration.options.get(46)==="on"&&(this._viewGpuContext=this._instantiationService.createInstance(ls,this._context)),this._scrollbar=new Che(this._context,this._linesContent,this.domNode,this._overflowGuardContainer),this._viewParts.push(this._scrollbar),this._viewLines=new BM(this._context,this._viewGpuContext,this._linesContent),this._viewGpuContext&&(this._viewLinesGpu=this._instantiationService.createInstance(iP,this._context,this._viewGpuContext)),this._viewZones=new aue(this._context),this._viewParts.push(this._viewZones);const d=new Qhe(this._context);this._viewParts.push(d);const h=new iue(this._context);this._viewParts.push(h);const u=new Lde(this._context);this._viewParts.push(u),u.addDynamicOverlay(new mhe(this._context)),u.addDynamicOverlay(new ZM(this._context)),u.addDynamicOverlay(new The(this._context)),u.addDynamicOverlay(new bhe(this._context)),u.addDynamicOverlay(new cue(this._context));const f=new xde(this._context);this._viewParts.push(f),f.addDynamicOverlay(new _he(this._context)),f.addDynamicOverlay(new Ohe(this._context)),f.addDynamicOverlay(new Ahe(this._context)),f.addDynamicOverlay(new KL(this._context)),this._viewGpuContext&&f.addDynamicOverlay(new gP(this._context,this._viewGpuContext)),this._glyphMarginWidgets=new She(this._context),this._viewParts.push(this._glyphMarginWidgets);const g=new ZL(this._context);g.getDomNode().appendChild(this._viewZones.marginDomNode),g.getDomNode().appendChild(f.getDomNode()),g.getDomNode().appendChild(this._glyphMarginWidgets.domNode),this._viewParts.push(g),this._contentWidgets=new Ide(this._context,this.domNode),this._viewParts.push(this._contentWidgets),this._viewCursors=new YM(this._context),this._viewParts.push(this._viewCursors),this._overlayWidgets=new Zhe(this._context,this.domNode),this._viewParts.push(this._overlayWidgets);const m=this._viewGpuContext?new hfe(this._context,this._viewGpuContext):new tue(this._context);this._viewParts.push(m);const _=new kde(this._context);this._viewParts.push(_);const b=new Ghe(this._context);if(this._viewParts.push(b),d){const C=this._scrollbar.getOverviewRulerLayoutInfo();C.parent.insertBefore(d.getDomNode(),C.insertBefore)}this._linesContent.appendChild(u.getDomNode()),"domNode"in m&&this._linesContent.appendChild(m.domNode),this._linesContent.appendChild(this._viewZones.domNode),this._linesContent.appendChild(this._viewLines.getDomNode()),this._linesContent.appendChild(this._contentWidgets.domNode),this._linesContent.appendChild(this._viewCursors.getDomNode()),this._overflowGuardContainer.appendChild(g.getDomNode()),this._overflowGuardContainer.appendChild(this._scrollbar.getDomNode()),this._viewGpuContext&&this._overflowGuardContainer.appendChild(this._viewGpuContext.canvas),this._overflowGuardContainer.appendChild(h.getDomNode()),this._overflowGuardContainer.appendChild(this._overlayWidgets.getDomNode()),this._overflowGuardContainer.appendChild(b.getDomNode()),this._overflowGuardContainer.appendChild(_.domNode),this.domNode.appendChild(this._overflowGuardContainer),l?(l.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode.domNode),l.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode)):(this.domNode.appendChild(this._contentWidgets.overflowingContentWidgetsDomNode),this.domNode.appendChild(this._overlayWidgets.overflowingOverlayWidgetsDomNode)),this._applyLayout(),this._pointerHandler=this._register(new wde(this._context,this._viewController,this._createPointerHandlerHelper()))}_instantiateEditContext(){return this._context.configuration.options.get(170)?this._instantiationService.createInstance(cx,this._ownerID,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper()):this._instantiationService.createInstance(oP,this._context,this._overflowGuardContainer,this._viewController,this._createTextAreaHandlerHelper())}_updateEditContext(){const e=this._context.configuration.options.get(170),t=this._context.configuration.options.get(2);if(this._editContextEnabled===e&&this._accessibilitySupport===t)return;this._editContextEnabled=e,this._accessibilitySupport=t;const i=this._editContext.isFocused(),n=this._viewParts.indexOf(this._editContext);this._editContext.dispose(),this._editContext=this._instantiateEditContext(),i&&this._editContext.focus(),n!==-1&&this._viewParts.splice(n,1,this._editContext)}_computeGlyphMarginLanes(){const e=this._context.viewModel.model,t=this._context.viewModel.glyphLanes;let i=[],n=0;i=i.concat(e.getAllMarginDecorations().map(s=>{const r=s.options.glyphMargin?.position??xa.Center;return n=Math.max(n,s.range.endLineNumber),{range:s.range,lane:r,persist:s.options.glyphMargin?.persistLane}})),i=i.concat(this._glyphMarginWidgets.getWidgets().map(s=>{const r=e.validateRange(s.preference.range);return n=Math.max(n,r.endLineNumber),{range:r,lane:s.preference.lane}})),i.sort((s,r)=>k.compareRangesUsingStarts(s.range,r.range)),t.reset(n);for(const s of i)t.push(s.lane,s.range,s.persist);return t}_createPointerHandlerHelper(){return{viewDomNode:this.domNode.domNode,linesContentDomNode:this._linesContent.domNode,viewLinesDomNode:this._viewLines.getDomNode().domNode,viewLinesGpu:this._viewLinesGpu,focusTextArea:()=>{this.focus()},dispatchTextAreaEvent:e=>{this._editContext.domNode.domNode.dispatchEvent(e)},getLastRenderData:()=>{const e=this._viewCursors.getLastRenderData()||[],t=this._editContext.getLastRenderData();return new Gce(e,t)},renderNow:()=>{this.render(!0,!1)},shouldSuppressMouseDownOnViewZone:e=>this._viewZones.shouldSuppressMouseDownOnViewZone(e),shouldSuppressMouseDownOnWidget:e=>this._contentWidgets.shouldSuppressMouseDownOnWidget(e),getPositionFromDOMInfo:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.getPositionFromDOMInfo(e,t)),visibleRangeForPosition:(e,t)=>{this._flushAccumulatedAndRenderNow();const i=new M(e,t);return this._viewLines.visibleRangeForPosition(i)??this._viewLinesGpu?.visibleRangeForPosition(i)??null},getLineWidth:e=>{if(this._flushAccumulatedAndRenderNow(),this._viewLinesGpu){const t=this._viewLinesGpu.getLineWidth(e);if(t!==void 0)return t}return this._viewLines.getLineWidth(e)}}}_createTextAreaHandlerHelper(){return{visibleRangeForPosition:e=>(this._flushAccumulatedAndRenderNow(),this._viewLines.visibleRangeForPosition(e)),linesVisibleRangesForRange:(e,t)=>(this._flushAccumulatedAndRenderNow(),this._viewLines.linesVisibleRangesForRange(e,t))}}_applyLayout(){const t=this._context.configuration.options.get(165);this.domNode.setWidth(t.width),this.domNode.setHeight(t.height),this._overflowGuardContainer.setWidth(t.width),this._overflowGuardContainer.setHeight(t.height),this._linesContent.setWidth(16777216),this._linesContent.setHeight(16777216)}_getEditorClassName(){const e=this._editContext.isFocused()?" focused":"";return this._context.configuration.options.get(162)+" "+MM(this._context.theme.type)+e}handleEvents(e){super.handleEvents(e),this._scheduleRender()}onConfigurationChanged(e){return this.domNode.setClassName(this._getEditorClassName()),this._updateEditContext(),this._applyLayout(),!1}onCursorStateChanged(e){return this._selections=e.selections,!1}onDecorationsChanged(e){return e.affectsGlyphMargin&&(this._shouldRecomputeGlyphMarginLanes=!0),!1}onFocusChanged(e){return this.domNode.setClassName(this._getEditorClassName()),!1}onThemeChanged(e){return this._context.theme.update(e.theme),this.domNode.setClassName(this._getEditorClassName()),!1}dispose(){this._renderAnimationFrame!==null&&(this._renderAnimationFrame.dispose(),this._renderAnimationFrame=null),this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove(),this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove(),this._context.removeEventHandler(this),this._viewGpuContext?.dispose(),this._viewLines.dispose(),this._viewLinesGpu?.dispose();for(const e of this._viewParts)e.dispose();super.dispose()}_scheduleRender(){if(this._store.isDisposed)throw new Ce;if(this._renderAnimationFrame===null){this._editContext instanceof cx&&this._editContext.setEditContextOnDomNode();const e=this._createCoordinatedRendering();this._renderAnimationFrame=mP.INSTANCE.scheduleCoordinatedRendering({window:me(this.domNode?.domNode),prepareRenderText:()=>{if(this._store.isDisposed)throw new Ce;try{return e.prepareRenderText()}finally{this._renderAnimationFrame=null}},renderText:()=>{if(this._store.isDisposed)throw new Ce;return e.renderText()},prepareRender:(t,i)=>{if(this._store.isDisposed)throw new Ce;return e.prepareRender(t,i)},render:(t,i)=>{if(this._store.isDisposed)throw new Ce;return e.render(t,i)}})}}_flushAccumulatedAndRenderNow(){const e=this._createCoordinatedRendering();Ih(()=>e.prepareRenderText());const t=Ih(()=>e.renderText());if(t){const[i,n]=t;Ih(()=>e.prepareRender(i,n)),Ih(()=>e.render(i,n))}}_getViewPartsToRender(){const e=[];let t=0;for(const i of this._viewParts)i.shouldRender()&&(e[t++]=i);return e}_createCoordinatedRendering(){return{prepareRenderText:()=>{if(this._shouldRecomputeGlyphMarginLanes){this._shouldRecomputeGlyphMarginLanes=!1;const e=this._computeGlyphMarginLanes();this._context.configuration.setGlyphMarginDecorationLaneCount(e.requiredLanes)}_h.onRenderStart()},renderText:()=>{if(!this.domNode.domNode.isConnected)return null;let e=this._getViewPartsToRender();if(!this._viewLines.shouldRender()&&e.length===0)return null;const t=this._context.viewLayout.getLinesViewportData();this._context.viewModel.setViewport(t.startLineNumber,t.endLineNumber,t.centeredLineNumber);const i=new due(this._selections,t,this._context.viewLayout.getWhitespaceViewportData(),this._context.viewModel);return this._contentWidgets.shouldRender()&&this._contentWidgets.onBeforeRender(i),this._viewLines.shouldRender()&&(this._viewLines.renderText(i),this._viewLines.onDidRender(),e=this._getViewPartsToRender()),this._viewLinesGpu?.shouldRender()&&(this._viewLinesGpu.renderText(i),this._viewLinesGpu.onDidRender()),[e,new Tce(this._context.viewLayout,i,this._viewLines,this._viewLinesGpu)]},prepareRender:(e,t)=>{for(const i of e)i.prepareRender(t)},render:(e,t)=>{for(const i of e)i.render(t),i.onDidRender()}}}delegateVerticalScrollbarPointerDown(e){this._scrollbar.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){this._scrollbar.delegateScrollFromMouseWheelEvent(e)}restoreState(e){this._context.viewModel.viewLayout.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft},1),this._context.viewModel.visibleLinesStabilized()}getOffsetForColumn(e,t){const i=this._context.viewModel.model.validatePosition({lineNumber:e,column:t}),n=this._context.viewModel.coordinatesConverter.convertModelPositionToViewPosition(i);this._flushAccumulatedAndRenderNow();const s=this._viewLines.visibleRangeForPosition(new M(n.lineNumber,n.column));return s?s.left:-1}getTargetAtClientPoint(e,t){const i=this._pointerHandler.getTargetAtClientPoint(e,t);return i?UL.convertViewToModelMouseTarget(i,this._context.viewModel.coordinatesConverter):null}createOverviewRuler(e){return new eue(this._context,e)}change(e){this._viewZones.changeViewZones(e),this._scheduleRender()}render(e,t){if(t){this._viewLines.forceShouldRender();for(const i of this._viewParts)i.forceShouldRender()}e?this._flushAccumulatedAndRenderNow():this._scheduleRender()}writeScreenReaderContent(e){this._editContext.writeScreenReaderContent(e)}focus(){this._editContext.focus()}isFocused(){return this._editContext.isFocused()}isWidgetFocused(){return this._widgetFocusTracker.hasFocus()}setAriaOptions(e){this._editContext.setAriaOptions(e)}addContentWidget(e){this._contentWidgets.addWidget(e.widget),this.layoutContentWidget(e),this._scheduleRender()}layoutContentWidget(e){this._contentWidgets.setWidgetPosition(e.widget,e.position?.position??null,e.position?.secondaryPosition??null,e.position?.preference??null,e.position?.positionAffinity??null),this._scheduleRender()}removeContentWidget(e){this._contentWidgets.removeWidget(e.widget),this._scheduleRender()}addOverlayWidget(e){this._overlayWidgets.addWidget(e.widget),this.layoutOverlayWidget(e),this._scheduleRender()}layoutOverlayWidget(e){this._overlayWidgets.setWidgetPosition(e.widget,e.position)&&this._scheduleRender()}removeOverlayWidget(e){this._overlayWidgets.removeWidget(e.widget),this._scheduleRender()}addGlyphMarginWidget(e){this._glyphMarginWidgets.addWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}layoutGlyphMarginWidget(e){const t=e.position;this._glyphMarginWidgets.setWidgetPosition(e.widget,t)&&(this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender())}removeGlyphMarginWidget(e){this._glyphMarginWidgets.removeWidget(e.widget),this._shouldRecomputeGlyphMarginLanes=!0,this._scheduleRender()}};pP=ufe([ffe(8,ge)],pP);function Ih(o){try{return o()}catch(e){return Ee(e),null}}const pN=class pN{constructor(){this._coordinatedRenderings=[],this._animationFrameRunners=new Map}scheduleCoordinatedRendering(e){return this._coordinatedRenderings.push(e),this._scheduleRender(e.window),{dispose:()=>{const t=this._coordinatedRenderings.indexOf(e);if(t!==-1&&(this._coordinatedRenderings.splice(t,1),this._coordinatedRenderings.length===0)){for(const[i,n]of this._animationFrameRunners)n.dispose();this._animationFrameRunners.clear()}}}}_scheduleRender(e){if(!this._animationFrameRunners.has(e)){const t=()=>{this._animationFrameRunners.delete(e),this._onRenderScheduled()};this._animationFrameRunners.set(e,yy(e,t,100))}}_onRenderScheduled(){const e=this._coordinatedRenderings.slice(0);this._coordinatedRenderings=[];for(const i of e)Ih(()=>i.prepareRenderText());const t=[];for(let i=0,n=e.length;i<n;i++){const s=e[i];t[i]=Ih(()=>s.renderText())}for(let i=0,n=e.length;i<n;i++){const s=e[i],r=t[i];if(!r)continue;const[a,l]=r;Ih(()=>s.prepareRender(a,l))}for(let i=0,n=e.length;i<n;i++){const s=e[i],r=t[i];if(!r)continue;const[a,l]=r;Ih(()=>s.render(a,l))}}};pN.INSTANCE=new pN;let mP=pN;class gfe extends A{constructor(e,t){super(),this._onChange=this._register(new P),this.onChange=this._onChange.event,this._hadFocus=void 0,this._hasDomElementFocus=!1,this._domFocusTracker=this._register(br(e)),this._overflowWidgetsDomNodeHasFocus=!1,this._register(this._domFocusTracker.onDidFocus(()=>{this._hasDomElementFocus=!0,this._update()})),this._register(this._domFocusTracker.onDidBlur(()=>{this._hasDomElementFocus=!1,this._update()})),t&&(this._overflowWidgetsDomNode=this._register(br(t)),this._register(this._overflowWidgetsDomNode.onDidFocus(()=>{this._overflowWidgetsDomNodeHasFocus=!0,this._update()})),this._register(this._overflowWidgetsDomNode.onDidBlur(()=>{this._overflowWidgetsDomNodeHasFocus=!1,this._update()})))}_update(){const e=this._hasDomElementFocus||this._overflowWidgetsDomNodeHasFocus;this._hadFocus!==e&&(this._hadFocus=e,this._onChange.fire(void 0))}hasFocus(){return this._hadFocus??!1}}class Cv{constructor(e,t,i,n,s){this.injectionOffsets=e,this.injectionOptions=t,this.breakOffsets=i,this.breakOffsetsVisibleColumn=n,this.wrappedTextIndentLength=s}getOutputLineCount(){return this.breakOffsets.length}getMinOutputOffset(e){return e>0?this.wrappedTextIndentLength:0}getLineLength(e){const t=e>0?this.breakOffsets[e-1]:0;let n=this.breakOffsets[e]-t;return e>0&&(n+=this.wrappedTextIndentLength),n}getMaxOutputOffset(e){return this.getLineLength(e)}translateToInputOffset(e,t){e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength));let n=e===0?t:this.breakOffsets[e-1]+t;if(this.injectionOffsets!==null)for(let s=0;s<this.injectionOffsets.length&&n>this.injectionOffsets[s];s++)n<this.injectionOffsets[s]+this.injectionOptions[s].content.length?n=this.injectionOffsets[s]:n-=this.injectionOptions[s].content.length;return n}translateToOutputPosition(e,t=2){let i=e;if(this.injectionOffsets!==null)for(let n=0;n<this.injectionOffsets.length&&!(e<this.injectionOffsets[n]||t!==1&&e===this.injectionOffsets[n]);n++)i+=this.injectionOptions[n].content.length;return this.offsetInInputWithInjectionsToOutputPosition(i,t)}offsetInInputWithInjectionsToOutputPosition(e,t=2){let i=0,n=this.breakOffsets.length-1,s=0,r=0;for(;i<=n;){s=i+(n-i)/2|0;const l=this.breakOffsets[s];if(r=s>0?this.breakOffsets[s-1]:0,t===0)if(e<=r)n=s-1;else if(e>l)i=s+1;else break;else if(e<r)n=s-1;else if(e>=l)i=s+1;else break}let a=e-r;return s>0&&(a+=this.wrappedTextIndentLength),new dx(s,a)}normalizeOutputPosition(e,t,i){if(this.injectionOffsets!==null){const n=this.outputPositionToOffsetInInputWithInjections(e,t),s=this.normalizeOffsetInInputWithInjectionsAroundInjections(n,i);if(s!==n)return this.offsetInInputWithInjectionsToOutputPosition(s,i)}if(i===0){if(e>0&&t===this.getMinOutputOffset(e))return new dx(e-1,this.getMaxOutputOffset(e-1))}else if(i===1){const n=this.getOutputLineCount()-1;if(e<n&&t===this.getMaxOutputOffset(e))return new dx(e+1,this.getMinOutputOffset(e+1))}return new dx(e,t)}outputPositionToOffsetInInputWithInjections(e,t){return e>0&&(t=Math.max(0,t-this.wrappedTextIndentLength)),(e>0?this.breakOffsets[e-1]:0)+t}normalizeOffsetInInputWithInjectionsAroundInjections(e,t){const i=this.getInjectedTextAtOffset(e);if(!i)return e;if(t===2){if(e===i.offsetInInputWithInjections+i.length&&xU(this.injectionOptions[i.injectedTextIndex].cursorStops))return i.offsetInInputWithInjections+i.length;{let n=i.offsetInInputWithInjections;if(kU(this.injectionOptions[i.injectedTextIndex].cursorStops))return n;let s=i.injectedTextIndex-1;for(;s>=0&&this.injectionOffsets[s]===this.injectionOffsets[i.injectedTextIndex]&&!(xU(this.injectionOptions[s].cursorStops)||(n-=this.injectionOptions[s].content.length,kU(this.injectionOptions[s].cursorStops)));)s--;return n}}else if(t===1||t===4){let n=i.offsetInInputWithInjections+i.length,s=i.injectedTextIndex;for(;s+1<this.injectionOffsets.length&&this.injectionOffsets[s+1]===this.injectionOffsets[s];)n+=this.injectionOptions[s+1].content.length,s++;return n}else if(t===0||t===3){let n=i.offsetInInputWithInjections,s=i.injectedTextIndex;for(;s-1>=0&&this.injectionOffsets[s-1]===this.injectionOffsets[s];)n-=this.injectionOptions[s-1].content.length,s--;return n}ZC()}getInjectedText(e,t){const i=this.outputPositionToOffsetInInputWithInjections(e,t),n=this.getInjectedTextAtOffset(i);return n?{options:this.injectionOptions[n.injectedTextIndex]}:null}getInjectedTextAtOffset(e){const t=this.injectionOffsets,i=this.injectionOptions;if(t!==null){let n=0;for(let s=0;s<t.length;s++){const r=i[s].content.length,a=t[s]+n,l=t[s]+n+r;if(a>e)break;if(e<=l)return{injectedTextIndex:s,offsetInInputWithInjections:a,length:r};n+=r}}}}function xU(o){return o==null?!0:o===yr.Right||o===yr.Both}function kU(o){return o==null?!0:o===yr.Left||o===yr.Both}class dx{constructor(e,t){this.outputLineIndex=e,this.outputOffset=t}toString(){return`${this.outputLineIndex}:${this.outputOffset}`}toPosition(e){return new M(e+this.outputLineIndex,this.outputOffset+1)}}class pfe{constructor(){this.changeType=1}}class Ma{static applyInjectedText(e,t){if(!t||t.length===0)return e;let i="",n=0;for(const s of t)i+=e.substring(n,s.column-1),n=s.column-1,i+=s.options.content;return i+=e.substring(n),i}static fromDecorations(e){const t=[];for(const i of e)i.options.before&&i.options.before.content.length>0&&t.push(new Ma(i.ownerId,i.range.startLineNumber,i.range.startColumn,i.options.before,0)),i.options.after&&i.options.after.content.length>0&&t.push(new Ma(i.ownerId,i.range.endLineNumber,i.range.endColumn,i.options.after,1));return t.sort((i,n)=>i.lineNumber===n.lineNumber?i.column===n.column?i.order-n.order:i.column-n.column:i.lineNumber-n.lineNumber),t}constructor(e,t,i,n,s){this.ownerId=e,this.lineNumber=t,this.column=i,this.options=n,this.order=s}}class IU{constructor(e,t,i){this.changeType=2,this.lineNumber=e,this.detail=t,this.injectedText=i}}class mfe{constructor(e,t,i,n){this.ownerId=e,this.decorationId=t,this.lineNumber=i,this.lineHeight=n}}class _fe{constructor(e,t){this.ownerId=e,this.lineNumber=t}}class bfe{constructor(e,t){this.changeType=3,this.fromLineNumber=e,this.toLineNumber=t}}class Cfe{constructor(e,t,i,n){this.changeType=4,this.injectedTexts=n,this.fromLineNumber=e,this.toLineNumber=t,this.detail=i}}class vfe{constructor(){this.changeType=5}}class I_{constructor(e,t,i,n){this.changes=e,this.versionId=t,this.isUndoing=i,this.isRedoing=n,this.resultingSelection=null}containsEvent(e){for(let t=0,i=this.changes.length;t<i;t++)if(this.changes[t].changeType===e)return!0;return!1}static merge(e,t){const i=[].concat(e.changes).concat(t.changes),n=t.versionId,s=e.isUndoing||t.isUndoing,r=e.isRedoing||t.isRedoing;return new I_(i,n,s,r)}}class DU{constructor(e){this.changes=e}}let EU=class{constructor(e){this.changes=e}},NU=class{constructor(e){this.changes=e}};class $f{constructor(e,t){this.rawContentChangedEvent=e,this.contentChangedEvent=t}merge(e){const t=I_.merge(this.rawContentChangedEvent,e.rawContentChangedEvent),i=$f._mergeChangeEvents(this.contentChangedEvent,e.contentChangedEvent);return new $f(t,i)}static _mergeChangeEvents(e,t){const i=[].concat(e.changes).concat(t.changes),n=t.eol,s=t.versionId,r=e.isUndoing||t.isUndoing,a=e.isRedoing||t.isRedoing,l=e.isFlush||t.isFlush,c=e.isEolChange&&t.isEolChange;return{changes:i,eol:n,isEolChange:c,versionId:s,isUndoing:r,isRedoing:a,isFlush:l,detailedReasons:e.detailedReasons.concat(t.detailedReasons),detailedReasonsChangeLengths:e.detailedReasonsChangeLengths.concat(t.detailedReasonsChangeLengths)}}}const wfe=Sl("domLineBreaksComputer",{createHTML:o=>o});class _P{static create(e){return new _P(new WeakRef(e))}constructor(e){this.targetWindow=e}createLineBreaksComputer(e,t,i,n,s,r){const a=[],l=[];return{addRequest:(c,d,h)=>{a.push(c),l.push(d)},finalize:()=>Sfe(Qd(this.targetWindow.deref()),a,e,t,i,n,s,l)}}}function Sfe(o,e,t,i,n,s,r,a){function l(D){const R=a[D];if(R){const F=Ma.applyInjectedText(e[D],R),O=R.map(V=>V.options),B=R.map(V=>V.column-1);return new Cv(B,O,[F.length],[],0)}else return null}if(n===-1){const D=[];for(let R=0,F=e.length;R<F;R++)D[R]=l(R);return D}const c=Math.round(n*t.typicalHalfwidthCharacterWidth),h=Math.round(i*(s===3?2:s===2?1:0)),u=Math.ceil(t.spaceWidth*h),f=document.createElement("div");dn(f,t);const g=new uh(1e4),m=[],_=[],b=[],C=[],w=[];for(let D=0;D<e.length;D++){const R=Ma.applyInjectedText(e[D],a[D]);let F=0,O=0,B=c;if(s!==0)if(F=es(R),F===-1)F=0;else{for(let se=0;se<F;se++){const oe=R.charCodeAt(se)===9?i-O%i:1;O+=oe}const ee=Math.ceil(t.spaceWidth*O);ee+t.typicalFullwidthCharacterWidth>c?(F=0,O=0):B=c-ee}const V=R.substr(F),z=yfe(V,O,i,B,g,u);m[D]=F,_[D]=O,b[D]=V,C[D]=z[0],w[D]=z[1]}const v=g.build(),S=wfe?.createHTML(v)??v;f.innerHTML=S,f.style.position="absolute",f.style.top="10000",r==="keepAll"?(f.style.wordBreak="keep-all",f.style.overflowWrap="anywhere"):(f.style.wordBreak="inherit",f.style.overflowWrap="break-word"),o.document.body.appendChild(f);const L=document.createRange(),x=Array.prototype.slice.call(f.children,0),I=[];for(let D=0;D<e.length;D++){const R=x[D],F=Lfe(L,R,b[D],C[D]);if(F===null){I[D]=l(D);continue}const O=m[D],B=_[D]+h,V=w[D],z=[];for(let fe=0,Ie=F.length;fe<Ie;fe++)z[fe]=V[F[fe]];if(O!==0)for(let fe=0,Ie=F.length;fe<Ie;fe++)F[fe]+=O;let ee,se;const oe=a[D];oe?(ee=oe.map(fe=>fe.options),se=oe.map(fe=>fe.column-1)):(ee=null,se=null),I[D]=new Cv(se,ee,F,z,B)}return f.remove(),I}function yfe(o,e,t,i,n,s){if(s!==0){const u=String(s);n.appendString('<div style="text-indent: -'),n.appendString(u),n.appendString("px; padding-left: "),n.appendString(u),n.appendString("px; box-sizing: border-box; width:")}else n.appendString('<div style="width:');n.appendString(String(i)),n.appendString('px;">');const r=o.length;let a=e,l=0;const c=[],d=[];let h=0<r?o.charCodeAt(0):0;n.appendString("<span>");for(let u=0;u<r;u++){u!==0&&u%16384===0&&n.appendString("</span><span>"),c[u]=l,d[u]=a;const f=h;h=u+1<r?o.charCodeAt(u+1):0;let g=1,m=1;switch(f){case 9:g=t-a%t,m=g;for(let _=1;_<=g;_++)_<g?n.appendCharCode(160):n.appendASCIICharCode(32);break;case 32:h===32?n.appendCharCode(160):n.appendASCIICharCode(32);break;case 60:n.appendString("&lt;");break;case 62:n.appendString("&gt;");break;case 38:n.appendString("&amp;");break;case 0:n.appendString("&#00;");break;case 65279:case 8232:case 8233:case 133:n.appendCharCode(65533);break;default:th(f)&&m++,f<32?n.appendCharCode(9216+f):n.appendCharCode(f)}l+=g,a+=m}return n.appendString("</span>"),c[o.length]=l,d[o.length]=a,n.appendString("</div>"),[c,d]}function Lfe(o,e,t,i){if(t.length<=1)return null;const n=Array.prototype.slice.call(e.children,0),s=[];try{bP(o,n,i,0,null,t.length-1,null,s)}catch(r){return console.log(r),null}return s.length===0?null:(s.push(t.length),s)}function bP(o,e,t,i,n,s,r,a){if(i===s||(n=n||CP(o,e,t[i],t[i+1]),r=r||CP(o,e,t[s],t[s+1]),Math.abs(n[0].top-r[0].top)<=.1))return;if(i+1===s){a.push(s);return}const l=i+(s-i)/2|0,c=CP(o,e,t[l],t[l+1]);bP(o,e,t,i,n,l,c,a),bP(o,e,t,l,c,s,r,a)}function CP(o,e,t,i){return o.setStart(e[t/16384|0].firstChild,t%16384),o.setEnd(e[i/16384|0].firstChild,i%16384),o.getClientRects()}class xfe extends A{constructor(){super(),this._editor=null,this._instantiationService=null,this._instances=this._register(new ny),this._pending=new Map,this._finishedInstantiation=[],this._finishedInstantiation[0]=!1,this._finishedInstantiation[1]=!1,this._finishedInstantiation[2]=!1,this._finishedInstantiation[3]=!1}initialize(e,t,i){this._editor=e,this._instantiationService=i;for(const n of t){if(this._pending.has(n.id)){Ee(new Error(`Cannot have two contributions with the same id ${n.id}`));continue}this._pending.set(n.id,n)}this._instantiateSome(0),this._register(v1(me(this._editor.getDomNode()),()=>{this._instantiateSome(1)})),this._register(v1(me(this._editor.getDomNode()),()=>{this._instantiateSome(2)})),this._register(v1(me(this._editor.getDomNode()),()=>{this._instantiateSome(3)},5e3))}saveViewState(){const e={};for(const[t,i]of this._instances)typeof i.saveViewState=="function"&&(e[t]=i.saveViewState());return e}restoreViewState(e){for(const[t,i]of this._instances)typeof i.restoreViewState=="function"&&i.restoreViewState(e[t])}get(e){return this._instantiateById(e),this._instances.get(e)||null}onBeforeInteractionEvent(){this._instantiateSome(2)}onAfterModelAttached(){return v1(me(this._editor?.getDomNode()),()=>{this._instantiateSome(1)},50)}_instantiateSome(e){if(this._finishedInstantiation[e])return;this._finishedInstantiation[e]=!0;const t=this._findPendingContributionsByInstantiation(e);for(const i of t)this._instantiateById(i.id)}_findPendingContributionsByInstantiation(e){const t=[];for(const[,i]of this._pending)i.instantiation===e&&t.push(i);return t}_instantiateById(e){const t=this._pending.get(e);if(t){if(this._pending.delete(e),!this._instantiationService||!this._editor)throw new Error("Cannot instantiate contributions before being initialized!");try{const i=this._instantiationService.createInstance(t.ctor,this._editor);this._instances.set(t.id,i),typeof i.restoreViewState=="function"&&t.instantiation!==0&&console.warn(`Editor contribution '${t.id}' should be eager instantiated because it uses saveViewState / restoreViewState.`)}catch(i){Ee(i)}}}}class TU{constructor(e,t,i,n,s,r,a){this.id=e,this.label=t,this.alias=i,this.metadata=n,this._precondition=s,this._run=r,this._contextKeyService=a}isSupported(){return this._contextKeyService.contextMatchesRules(this._precondition)}run(e){return this.isSupported()?this._run(e):Promise.resolve(void 0)}}const vv={ICodeEditor:"vs.editor.ICodeEditor",IDiffEditor:"vs.editor.IDiffEditor"};function Dh(o){let e=0,t=0,i=0,n=0;for(let s=0,r=o.length;s<r;s++){const a=o.charCodeAt(s);a===13?(e===0&&(t=s),e++,s+1<r&&o.charCodeAt(s+1)===10?(n|=2,s++):n|=3,i=s+1):a===10&&(n|=1,e===0&&(t=s),e++,i=s+1)}return e===0&&(t=o.length),[e,t,o.length-i,n]}class RU{constructor(e,t,i,n){this.range=e,this.nestingLevel=t,this.nestingLevelOfEqualBracketType=i,this.isInvalid=n}}class kfe{constructor(e,t,i,n,s,r){this.range=e,this.openingBracketRange=t,this.closingBracketRange=i,this.nestingLevel=n,this.nestingLevelOfEqualBracketType=s,this.bracketPairNode=r}get openingBracketInfo(){return this.bracketPairNode.openingBracket.bracketInfo}}class Ife extends kfe{constructor(e,t,i,n,s,r,a){super(e,t,i,n,s,r),this.minVisibleColumnIndentation=a}}function Dfe(o,e,t,i){return o!==t?Ti(t-o,i):Ti(0,i-e)}const ys=0;function hx(o){return o===0}const zo=2**26;function Ti(o,e){return o*zo+e}function Rr(o){const e=o,t=Math.floor(e/zo),i=e-t*zo;return new $i(t,i)}function Efe(o){return Math.floor(o/zo)}function _5e(o){return o}function ui(o,e){let t=o+e;return e>=zo&&(t=t-o%zo),t}function Nfe(o,e){return o.reduce((t,i)=>ui(t,e(i)),ys)}function MU(o,e){return o===e}function wv(o,e){const t=o,i=e;if(i-t<=0)return ys;const s=Math.floor(t/zo),r=Math.floor(i/zo),a=i-r*zo;if(s===r){const l=t-s*zo;return Ti(0,a-l)}else return Ti(r-s,a)}function D_(o,e){return o<e}function E_(o,e){return o<=e}function Sv(o,e){return o>=e}function N_(o){return Ti(o.lineNumber-1,o.column-1)}function jf(o,e){const t=o,i=Math.floor(t/zo),n=t-i*zo,s=e,r=Math.floor(s/zo),a=s-r*zo;return new k(i+1,n+1,r+1,a+1)}function Tfe(o){const e=ro(o);return Ti(e.length-1,e[e.length-1].length)}class Kc{static fromModelContentChanges(e){return e.map(i=>{const n=k.lift(i.range);return new Kc(N_(n.getStartPosition()),N_(n.getEndPosition()),Tfe(i.text))}).reverse()}constructor(e,t,i){this.startOffset=e,this.endOffset=t,this.newLength=i}toString(){return`[${Rr(this.startOffset)}...${Rr(this.endOffset)}) -> ${Rr(this.newLength)}`}}class Rfe{constructor(e){this.nextEditIdx=0,this.deltaOldToNewLineCount=0,this.deltaOldToNewColumnCount=0,this.deltaLineIdxInOld=-1,this.edits=e.map(t=>vP.from(t))}getOffsetBeforeChange(e){return this.adjustNextEdit(e),this.translateCurToOld(e)}getDistanceToNextChange(e){this.adjustNextEdit(e);const t=this.edits[this.nextEditIdx],i=t?this.translateOldToCur(t.offsetObj):null;return i===null?null:wv(e,i)}translateOldToCur(e){return e.lineCount===this.deltaLineIdxInOld?Ti(e.lineCount+this.deltaOldToNewLineCount,e.columnCount+this.deltaOldToNewColumnCount):Ti(e.lineCount+this.deltaOldToNewLineCount,e.columnCount)}translateCurToOld(e){const t=Rr(e);return t.lineCount-this.deltaOldToNewLineCount===this.deltaLineIdxInOld?Ti(t.lineCount-this.deltaOldToNewLineCount,t.columnCount-this.deltaOldToNewColumnCount):Ti(t.lineCount-this.deltaOldToNewLineCount,t.columnCount)}adjustNextEdit(e){for(;this.nextEditIdx<this.edits.length;){const t=this.edits[this.nextEditIdx],i=this.translateOldToCur(t.endOffsetAfterObj);if(E_(i,e)){this.nextEditIdx++;const n=Rr(i),s=Rr(this.translateOldToCur(t.endOffsetBeforeObj)),r=n.lineCount-s.lineCount;this.deltaOldToNewLineCount+=r;const a=this.deltaLineIdxInOld===t.endOffsetBeforeObj.lineCount?this.deltaOldToNewColumnCount:0,l=n.columnCount-s.columnCount;this.deltaOldToNewColumnCount=a+l,this.deltaLineIdxInOld=t.endOffsetBeforeObj.lineCount}else break}}}class vP{static from(e){return new vP(e.startOffset,e.endOffset,e.newLength)}constructor(e,t,i){this.endOffsetBeforeObj=Rr(t),this.endOffsetAfterObj=Rr(ui(e,i)),this.offsetObj=Rr(e)}}const ux=[],zr=class zr{static create(e,t){if(e<=128&&t.length===0){let i=zr.cache[e];return i||(i=new zr(e,t),zr.cache[e]=i),i}return new zr(e,t)}static getEmpty(){return this.empty}constructor(e,t){this.items=e,this.additionalItems=t}add(e,t){const i=t.getKey(e);let n=i>>5;if(n===0){const r=1<<i|this.items;return r===this.items?this:zr.create(r,this.additionalItems)}n--;const s=this.additionalItems.slice(0);for(;s.length<n;)s.push(0);return s[n]|=1<<(i&31),zr.create(this.items,s)}merge(e){const t=this.items|e.items;if(this.additionalItems===ux&&e.additionalItems===ux)return t===this.items?this:t===e.items?e:zr.create(t,ux);const i=[];for(let n=0;n<Math.max(this.additionalItems.length,e.additionalItems.length);n++){const s=this.additionalItems[n]||0,r=e.additionalItems[n]||0;i.push(s|r)}return zr.create(t,i)}intersects(e){if((this.items&e.items)!==0)return!0;for(let t=0;t<Math.min(this.additionalItems.length,e.additionalItems.length);t++)if((this.additionalItems[t]&e.additionalItems[t])!==0)return!0;return!1}};zr.cache=new Array(129),zr.empty=zr.create(0,ux);let _o=zr;const PU={getKey(o){return o}};class AU{constructor(){this.items=new Map}getKey(e){let t=this.items.get(e);return t===void 0&&(t=this.items.size,this.items.set(e,t)),t}}class wP{get length(){return this._length}constructor(e){this._length=e}}class yv extends wP{static create(e,t,i){let n=e.length;return t&&(n=ui(n,t.length)),i&&(n=ui(n,i.length)),new yv(n,e,t,i,t?t.missingOpeningBracketIds:_o.getEmpty())}get kind(){return 2}get listHeight(){return 0}get childrenLength(){return 3}getChild(e){switch(e){case 0:return this.openingBracket;case 1:return this.child;case 2:return this.closingBracket}throw new Error("Invalid child index")}get children(){const e=[];return e.push(this.openingBracket),this.child&&e.push(this.child),this.closingBracket&&e.push(this.closingBracket),e}constructor(e,t,i,n,s){super(e),this.openingBracket=t,this.child=i,this.closingBracket=n,this.missingOpeningBracketIds=s}canBeReused(e){return!(this.closingBracket===null||e.intersects(this.missingOpeningBracketIds))}deepClone(){return new yv(this.length,this.openingBracket.deepClone(),this.child&&this.child.deepClone(),this.closingBracket&&this.closingBracket.deepClone(),this.missingOpeningBracketIds)}computeMinIndentation(e,t){return this.child?this.child.computeMinIndentation(ui(e,this.openingBracket.length),t):Number.MAX_SAFE_INTEGER}}class xl extends wP{static create23(e,t,i,n=!1){let s=e.length,r=e.missingOpeningBracketIds;if(e.listHeight!==t.listHeight)throw new Error("Invalid list heights");if(s=ui(s,t.length),r=r.merge(t.missingOpeningBracketIds),i){if(e.listHeight!==i.listHeight)throw new Error("Invalid list heights");s=ui(s,i.length),r=r.merge(i.missingOpeningBracketIds)}return n?new Mfe(s,e.listHeight+1,e,t,i,r):new Lv(s,e.listHeight+1,e,t,i,r)}static getEmpty(){return new Pfe(ys,0,[],_o.getEmpty())}get kind(){return 4}get missingOpeningBracketIds(){return this._missingOpeningBracketIds}constructor(e,t,i){super(e),this.listHeight=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}throwIfImmutable(){}makeLastElementMutable(){this.throwIfImmutable();const e=this.childrenLength;if(e===0)return;const t=this.getChild(e-1),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(e-1,i),i}makeFirstElementMutable(){if(this.throwIfImmutable(),this.childrenLength===0)return;const t=this.getChild(0),i=t.kind===4?t.toMutable():t;return t!==i&&this.setChild(0,i),i}canBeReused(e){if(e.intersects(this.missingOpeningBracketIds)||this.childrenLength===0)return!1;let t=this;for(;t.kind===4;){const i=t.childrenLength;if(i===0)throw new Ce;t=t.getChild(i-1)}return t.canBeReused(e)}handleChildrenChanged(){this.throwIfImmutable();const e=this.childrenLength;let t=this.getChild(0).length,i=this.getChild(0).missingOpeningBracketIds;for(let n=1;n<e;n++){const s=this.getChild(n);t=ui(t,s.length),i=i.merge(s.missingOpeningBracketIds)}this._length=t,this._missingOpeningBracketIds=i,this.cachedMinIndentation=-1}computeMinIndentation(e,t){if(this.cachedMinIndentation!==-1)return this.cachedMinIndentation;let i=Number.MAX_SAFE_INTEGER,n=e;for(let s=0;s<this.childrenLength;s++){const r=this.getChild(s);r&&(i=Math.min(i,r.computeMinIndentation(n,t)),n=ui(n,r.length))}return this.cachedMinIndentation=i,i}}class Lv extends xl{get childrenLength(){return this._item3!==null?3:2}getChild(e){switch(e){case 0:return this._item1;case 1:return this._item2;case 2:return this._item3}throw new Error("Invalid child index")}setChild(e,t){switch(e){case 0:this._item1=t;return;case 1:this._item2=t;return;case 2:this._item3=t;return}throw new Error("Invalid child index")}get children(){return this._item3?[this._item1,this._item2,this._item3]:[this._item1,this._item2]}get item1(){return this._item1}get item2(){return this._item2}get item3(){return this._item3}constructor(e,t,i,n,s,r){super(e,t,r),this._item1=i,this._item2=n,this._item3=s}deepClone(){return new Lv(this.length,this.listHeight,this._item1.deepClone(),this._item2.deepClone(),this._item3?this._item3.deepClone():null,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){if(this._item3)throw new Error("Cannot append to a full (2,3) tree node");this.throwIfImmutable(),this._item3=e,this.handleChildrenChanged()}unappendChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item3;return this._item3=null,this.handleChildrenChanged(),e}prependChildOfSameHeight(e){if(this._item3)throw new Error("Cannot prepend to a full (2,3) tree node");this.throwIfImmutable(),this._item3=this._item2,this._item2=this._item1,this._item1=e,this.handleChildrenChanged()}unprependChild(){if(!this._item3)throw new Error("Cannot remove from a non-full (2,3) tree node");this.throwIfImmutable();const e=this._item1;return this._item1=this._item2,this._item2=this._item3,this._item3=null,this.handleChildrenChanged(),e}toMutable(){return this}}class Mfe extends Lv{toMutable(){return new Lv(this.length,this.listHeight,this.item1,this.item2,this.item3,this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}class fx extends xl{get childrenLength(){return this._children.length}getChild(e){return this._children[e]}setChild(e,t){this._children[e]=t}get children(){return this._children}constructor(e,t,i,n){super(e,t,n),this._children=i}deepClone(){const e=new Array(this._children.length);for(let t=0;t<this._children.length;t++)e[t]=this._children[t].deepClone();return new fx(this.length,this.listHeight,e,this.missingOpeningBracketIds)}appendChildOfSameHeight(e){this.throwIfImmutable(),this._children.push(e),this.handleChildrenChanged()}unappendChild(){this.throwIfImmutable();const e=this._children.pop();return this.handleChildrenChanged(),e}prependChildOfSameHeight(e){this.throwIfImmutable(),this._children.unshift(e),this.handleChildrenChanged()}unprependChild(){this.throwIfImmutable();const e=this._children.shift();return this.handleChildrenChanged(),e}toMutable(){return this}}class Pfe extends fx{toMutable(){return new fx(this.length,this.listHeight,[...this.children],this.missingOpeningBracketIds)}throwIfImmutable(){throw new Error("this instance is immutable")}}const Afe=[];class SP extends wP{get listHeight(){return 0}get childrenLength(){return 0}getChild(e){return null}get children(){return Afe}deepClone(){return this}}class qf extends SP{get kind(){return 0}get missingOpeningBracketIds(){return _o.getEmpty()}canBeReused(e){return!0}computeMinIndentation(e,t){const i=Rr(e),n=(i.columnCount===0?i.lineCount:i.lineCount+1)+1,s=Efe(ui(e,this.length))+1;let r=Number.MAX_SAFE_INTEGER;for(let a=n;a<=s;a++){const l=t.getLineFirstNonWhitespaceColumn(a),c=t.getLineContent(a);if(l===0)continue;const d=ti.visibleColumnFromColumn(c,l,t.getOptions().tabSize);r=Math.min(r,d)}return r}}class gx extends SP{static create(e,t,i){return new gx(e,t,i)}get kind(){return 1}get missingOpeningBracketIds(){return _o.getEmpty()}constructor(e,t,i){super(e),this.bracketInfo=t,this.bracketIds=i}get text(){return this.bracketInfo.bracketText}get languageId(){return this.bracketInfo.languageId}canBeReused(e){return!1}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}class Ofe extends SP{get kind(){return 3}constructor(e,t){super(t),this.missingOpeningBracketIds=e}canBeReused(e){return!e.intersects(this.missingOpeningBracketIds)}computeMinIndentation(e,t){return Number.MAX_SAFE_INTEGER}}let Eh=class{constructor(e,t,i,n,s){this.length=e,this.kind=t,this.bracketId=i,this.bracketIds=n,this.astNode=s}};class OU{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.reader=new Ffe(this.textModel,this.bracketTokens),this._offset=ys,this.didPeek=!1,this.peeked=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}get offset(){return this._offset}get length(){return Ti(this.textBufferLineCount-1,this.textBufferLastLineLength)}skip(e){this.didPeek=!1,this._offset=ui(this._offset,e);const t=Rr(this._offset);this.reader.setPosition(t.lineCount,t.columnCount)}read(){let e;return this.peeked?(this.didPeek=!1,e=this.peeked):e=this.reader.read(),e&&(this._offset=ui(this._offset,e.length)),e}peek(){return this.didPeek||(this.peeked=this.reader.read(),this.didPeek=!0),this.peeked}}class Ffe{constructor(e,t){this.textModel=e,this.bracketTokens=t,this.lineIdx=0,this.line=null,this.lineCharOffset=0,this.lineTokens=null,this.lineTokenOffset=0,this.peekedToken=null,this.textBufferLineCount=e.getLineCount(),this.textBufferLastLineLength=e.getLineLength(this.textBufferLineCount)}setPosition(e,t){e===this.lineIdx?(this.lineCharOffset=t,this.line!==null&&(this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset))):(this.lineIdx=e,this.lineCharOffset=t,this.line=null),this.peekedToken=null}read(){if(this.peekedToken){const s=this.peekedToken;return this.peekedToken=null,this.lineCharOffset+=s.length,s}if(this.lineIdx>this.textBufferLineCount-1||this.lineIdx===this.textBufferLineCount-1&&this.lineCharOffset>=this.textBufferLastLineLength)return null;this.line===null&&(this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.line=this.lineTokens.getLineContent(),this.lineTokenOffset=this.lineCharOffset===0?0:this.lineTokens.findTokenIndexAtOffset(this.lineCharOffset));const e=this.lineIdx,t=this.lineCharOffset;let i=0;for(;;){const s=this.lineTokens,r=s.getCount();let a=null;if(this.lineTokenOffset<r){const l=s.getMetadata(this.lineTokenOffset);for(;this.lineTokenOffset+1<r&&l===s.getMetadata(this.lineTokenOffset+1);)this.lineTokenOffset++;const c=zn.getTokenType(l)===0,d=zn.containsBalancedBrackets(l),h=s.getEndOffset(this.lineTokenOffset);if(d&&c&&this.lineCharOffset<h){const u=s.getLanguageId(this.lineTokenOffset),f=this.line.substring(this.lineCharOffset,h),g=this.bracketTokens.getSingleLanguageBracketTokens(u),m=g.regExpGlobal;if(m){m.lastIndex=0;const _=m.exec(f);_&&(a=g.getToken(_[0]),a&&(this.lineCharOffset+=_.index))}}if(i+=h-this.lineCharOffset,a)if(e!==this.lineIdx||t!==this.lineCharOffset){this.peekedToken=a;break}else return this.lineCharOffset+=a.length,a;else this.lineTokenOffset++,this.lineCharOffset=h}else if(this.lineIdx===this.textBufferLineCount-1||(this.lineIdx++,this.lineTokens=this.textModel.tokenization.getLineTokens(this.lineIdx+1),this.lineTokenOffset=0,this.line=this.lineTokens.getLineContent(),this.lineCharOffset=0,i+=33,i>1e3))break;if(i>1500)break}const n=Dfe(e,t,this.lineIdx,this.lineCharOffset);return new Eh(n,0,-1,_o.getEmpty(),new qf(n))}}class Wfe{constructor(e,t){this.text=e,this._offset=ys,this.idx=0;const i=t.getRegExpStr(),n=i?new RegExp(i+`|
`,"gi"):null,s=[];let r,a=0,l=0,c=0,d=0;const h=[];for(let g=0;g<60;g++)h.push(new Eh(Ti(0,g),0,-1,_o.getEmpty(),new qf(Ti(0,g))));const u=[];for(let g=0;g<60;g++)u.push(new Eh(Ti(1,g),0,-1,_o.getEmpty(),new qf(Ti(1,g))));if(n)for(n.lastIndex=0;(r=n.exec(e))!==null;){const g=r.index,m=r[0];if(m===`
`)a++,l=g+1;else{if(c!==g){let _;if(d===a){const b=g-c;if(b<h.length)_=h[b];else{const C=Ti(0,b);_=new Eh(C,0,-1,_o.getEmpty(),new qf(C))}}else{const b=a-d,C=g-l;if(b===1&&C<u.length)_=u[C];else{const w=Ti(b,C);_=new Eh(w,0,-1,_o.getEmpty(),new qf(w))}}s.push(_)}s.push(t.getToken(m)),c=g+m.length,d=a}}const f=e.length;if(c!==f){const g=d===a?Ti(0,f-c):Ti(a-d,f-l);s.push(new Eh(g,0,-1,_o.getEmpty(),new qf(g)))}this.length=Ti(a,f-l),this.tokens=s}get offset(){return this._offset}read(){return this.tokens[this.idx++]||null}peek(){return this.tokens[this.idx]||null}skip(e){throw new Mte}}class yP{static createFromLanguage(e,t){function i(s){return t.getKey(`${s.languageId}:::${s.bracketText}`)}const n=new Map;for(const s of e.bracketsNew.openingBrackets){const r=Ti(0,s.bracketText.length),a=i(s),l=_o.getEmpty().add(a,PU);n.set(s.bracketText,new Eh(r,1,a,l,gx.create(r,s,l)))}for(const s of e.bracketsNew.closingBrackets){const r=Ti(0,s.bracketText.length);let a=_o.getEmpty();const l=s.getOpeningBrackets();for(const c of l)a=a.add(i(c),PU);n.set(s.bracketText,new Eh(r,2,i(l[0]),a,gx.create(r,s,a)))}return new yP(n)}constructor(e){this.map=e,this.hasRegExp=!1,this._regExpGlobal=null}getRegExpStr(){if(this.isEmpty)return null;{const e=[...this.map.keys()];return e.sort(),e.reverse(),e.map(t=>Bfe(t)).join("|")}}get regExpGlobal(){if(!this.hasRegExp){const e=this.getRegExpStr();this._regExpGlobal=e?new RegExp(e,"gi"):null,this.hasRegExp=!0}return this._regExpGlobal}getToken(e){return this.map.get(e.toLowerCase())}findClosingTokenText(e){for(const[t,i]of this.map)if(i.kind===2&&i.bracketIds.intersects(e))return t}get isEmpty(){return this.map.size===0}}function Bfe(o){let e=oo(o);return/^[\w ]+/.test(o)&&(e=`\\b${e}`),/[\w ]+$/.test(o)&&(e=`${e}\\b`),e}class FU{constructor(e,t){this.denseKeyProvider=e,this.getLanguageConfiguration=t,this.languageIdToBracketTokens=new Map}didLanguageChange(e){return this.languageIdToBracketTokens.has(e)}getSingleLanguageBracketTokens(e){let t=this.languageIdToBracketTokens.get(e);return t||(t=yP.createFromLanguage(this.getLanguageConfiguration(e),this.denseKeyProvider),this.languageIdToBracketTokens.set(e,t)),t}}function Hfe(o){if(o.length===0)return null;if(o.length===1)return o[0];let e=0;function t(){if(e>=o.length)return null;const r=e,a=o[r].listHeight;for(e++;e<o.length&&o[e].listHeight===a;)e++;return e-r>=2?WU(r===0&&e===o.length?o:o.slice(r,e),!1):o[r]}let i=t(),n=t();if(!n)return i;for(let r=t();r;r=t())BU(i,n)<=BU(n,r)?(i=LP(i,n),n=r):n=LP(n,r);return LP(i,n)}function WU(o,e=!1){if(o.length===0)return null;if(o.length===1)return o[0];let t=o.length;for(;t>3;){const i=t>>1;for(let n=0;n<i;n++){const s=n<<1;o[n]=xl.create23(o[s],o[s+1],s+3===t?o[s+2]:null,e)}t=i}return xl.create23(o[0],o[1],t>=3?o[2]:null,e)}function BU(o,e){return Math.abs(o.listHeight-e.listHeight)}function LP(o,e){return o.listHeight===e.listHeight?xl.create23(o,e,null,!1):o.listHeight>e.listHeight?Vfe(o,e):zfe(e,o)}function Vfe(o,e){o=o.toMutable();let t=o;const i=[];let n;for(;;){if(e.listHeight===t.listHeight){n=e;break}if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeLastElementMutable()}for(let s=i.length-1;s>=0;s--){const r=i[s];n?r.childrenLength>=3?n=xl.create23(r.unappendChild(),n,null,!1):(r.appendChildOfSameHeight(n),n=void 0):r.handleChildrenChanged()}return n?xl.create23(o,n,null,!1):o}function zfe(o,e){o=o.toMutable();let t=o;const i=[];for(;e.listHeight!==t.listHeight;){if(t.kind!==4)throw new Error("unexpected");i.push(t),t=t.makeFirstElementMutable()}let n=e;for(let s=i.length-1;s>=0;s--){const r=i[s];n?r.childrenLength>=3?n=xl.create23(n,r.unprependChild(),null,!1):(r.prependChildOfSameHeight(n),n=void 0):r.handleChildrenChanged()}return n?xl.create23(n,o,null,!1):o}class Ufe{constructor(e){this.lastOffset=ys,this.nextNodes=[e],this.offsets=[ys],this.idxs=[]}readLongestNodeAt(e,t){if(D_(e,this.lastOffset))throw new Error("Invalid offset");for(this.lastOffset=e;;){const i=xv(this.nextNodes);if(!i)return;const n=xv(this.offsets);if(D_(e,n))return;if(D_(n,e))if(ui(n,i.length)<=e)this.nextNodeAfterCurrent();else{const s=xP(i);s!==-1?(this.nextNodes.push(i.getChild(s)),this.offsets.push(n),this.idxs.push(s)):this.nextNodeAfterCurrent()}else{if(t(i))return this.nextNodeAfterCurrent(),i;{const s=xP(i);if(s===-1){this.nextNodeAfterCurrent();return}else this.nextNodes.push(i.getChild(s)),this.offsets.push(n),this.idxs.push(s)}}}}nextNodeAfterCurrent(){for(;;){const e=xv(this.offsets),t=xv(this.nextNodes);if(this.nextNodes.pop(),this.offsets.pop(),this.idxs.length===0)break;const i=xv(this.nextNodes),n=xP(i,this.idxs[this.idxs.length-1]);if(n!==-1){this.nextNodes.push(i.getChild(n)),this.offsets.push(ui(e,t.length)),this.idxs[this.idxs.length-1]=n;break}else this.idxs.pop()}}}function xP(o,e=-1){for(;;){if(e++,e>=o.childrenLength)return-1;if(o.getChild(e))return e}}function xv(o){return o.length>0?o[o.length-1]:void 0}function kP(o,e,t,i){return new $fe(o,e,t,i).parseDocument()}class $fe{constructor(e,t,i,n){if(this.tokenizer=e,this.createImmutableLists=n,this._itemsConstructed=0,this._itemsFromCache=0,i&&n)throw new Error("Not supported");this.oldNodeReader=i?new Ufe(i):void 0,this.positionMapper=new Rfe(t)}parseDocument(){this._itemsConstructed=0,this._itemsFromCache=0;let e=this.parseList(_o.getEmpty(),0);return e||(e=xl.getEmpty()),e}parseList(e,t){const i=[];for(;;){let s=this.tryReadChildFromCache(e);if(!s){const r=this.tokenizer.peek();if(!r||r.kind===2&&r.bracketIds.intersects(e))break;s=this.parseChild(e,t+1)}s.kind===4&&s.childrenLength===0||i.push(s)}return this.oldNodeReader?Hfe(i):WU(i,this.createImmutableLists)}tryReadChildFromCache(e){if(this.oldNodeReader){const t=this.positionMapper.getDistanceToNextChange(this.tokenizer.offset);if(t===null||!hx(t)){const i=this.oldNodeReader.readLongestNodeAt(this.positionMapper.getOffsetBeforeChange(this.tokenizer.offset),n=>t!==null&&!D_(n.length,t)?!1:n.canBeReused(e));if(i)return this._itemsFromCache++,this.tokenizer.skip(i.length),i}}}parseChild(e,t){this._itemsConstructed++;const i=this.tokenizer.read();switch(i.kind){case 2:return new Ofe(i.bracketIds,i.length);case 0:return i.astNode;case 1:{if(t>300)return new qf(i.length);const n=e.merge(i.bracketIds),s=this.parseList(n,t+1),r=this.tokenizer.peek();return r&&r.kind===2&&(r.bracketId===i.bracketId||r.bracketIds.intersects(i.bracketIds))?(this.tokenizer.read(),yv.create(i.astNode,s,r.astNode)):yv.create(i.astNode,s,null)}default:throw new Error("unexpected")}}}function px(o,e){if(o.length===0)return e;if(e.length===0)return o;const t=new Ec(HU(o)),i=HU(e);i.push({modified:!1,lengthBefore:void 0,lengthAfter:void 0});let n=t.dequeue();function s(c){if(c===void 0){const h=t.takeWhile(u=>!0)||[];return n&&h.unshift(n),h}const d=[];for(;n&&!hx(c);){const[h,u]=n.splitAt(c);d.push(h),c=wv(h.lengthAfter,c),n=u??t.dequeue()}return hx(c)||d.push(new Nh(!1,c,c)),d}const r=[];function a(c,d,h){if(r.length>0&&MU(r[r.length-1].endOffset,c)){const u=r[r.length-1];r[r.length-1]=new Kc(u.startOffset,d,ui(u.newLength,h))}else r.push({startOffset:c,endOffset:d,newLength:h})}let l=ys;for(const c of i){const d=s(c.lengthBefore);if(c.modified){const h=Nfe(d,f=>f.lengthBefore),u=ui(l,h);a(l,u,c.lengthAfter),l=u}else for(const h of d){const u=l;l=ui(l,h.lengthBefore),h.modified&&a(u,l,h.lengthAfter)}}return r}class Nh{constructor(e,t,i){this.modified=e,this.lengthBefore=t,this.lengthAfter=i}splitAt(e){const t=wv(e,this.lengthAfter);return MU(t,ys)?[this,void 0]:this.modified?[new Nh(this.modified,this.lengthBefore,e),new Nh(this.modified,ys,t)]:[new Nh(this.modified,e,e),new Nh(this.modified,t,t)]}toString(){return`${this.modified?"M":"U"}:${Rr(this.lengthBefore)} -> ${Rr(this.lengthAfter)}`}}function HU(o){const e=[];let t=ys;for(const i of o){const n=wv(t,i.startOffset);hx(n)||e.push(new Nh(!1,n,n));const s=wv(i.startOffset,i.endOffset);e.push(new Nh(!0,s,i.newLength)),t=i.endOffset}return e}class jfe extends A{didLanguageChange(e){return this.brackets.didLanguageChange(e)}constructor(e,t){if(super(),this.textModel=e,this.getLanguageConfiguration=t,this.didChangeEmitter=new P,this.denseKeyProvider=new AU,this.brackets=new FU(this.denseKeyProvider,this.getLanguageConfiguration),this.onDidChange=this.didChangeEmitter.event,this.queuedTextEditsForInitialAstWithoutTokens=[],this.queuedTextEdits=[],e.tokenization.hasTokens)e.tokenization.backgroundTokenizationState===2?(this.initialAstWithoutTokens=void 0,this.astWithTokens=this.parseDocumentFromTextBuffer([],void 0,!1)):(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer([],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens);else{const i=this.brackets.getSingleLanguageBracketTokens(this.textModel.getLanguageId()),n=new Wfe(this.textModel.getValue(),i);this.initialAstWithoutTokens=kP(n,[],void 0,!0),this.astWithTokens=this.initialAstWithoutTokens}}handleDidChangeBackgroundTokenizationState(){if(this.textModel.tokenization.backgroundTokenizationState===2){const e=this.initialAstWithoutTokens===void 0;this.initialAstWithoutTokens=void 0,e||this.didChangeEmitter.fire()}}handleDidChangeTokens({ranges:e}){const t=e.map(i=>new Kc(Ti(i.fromLineNumber-1,0),Ti(i.toLineNumber,0),Ti(i.toLineNumber-i.fromLineNumber+1,0)));this.handleEdits(t,!0),this.initialAstWithoutTokens||this.didChangeEmitter.fire()}handleContentChanged(e){const t=Kc.fromModelContentChanges(e.changes);this.handleEdits(t,!1)}handleEdits(e,t){const i=px(this.queuedTextEdits,e);this.queuedTextEdits=i,this.initialAstWithoutTokens&&!t&&(this.queuedTextEditsForInitialAstWithoutTokens=px(this.queuedTextEditsForInitialAstWithoutTokens,e))}flushQueue(){this.queuedTextEdits.length>0&&(this.astWithTokens=this.parseDocumentFromTextBuffer(this.queuedTextEdits,this.astWithTokens,!1),this.queuedTextEdits=[]),this.queuedTextEditsForInitialAstWithoutTokens.length>0&&(this.initialAstWithoutTokens&&(this.initialAstWithoutTokens=this.parseDocumentFromTextBuffer(this.queuedTextEditsForInitialAstWithoutTokens,this.initialAstWithoutTokens,!1)),this.queuedTextEditsForInitialAstWithoutTokens=[])}parseDocumentFromTextBuffer(e,t,i){const n=t,s=new OU(this.textModel,this.brackets);return kP(s,e,n,i)}getBracketsInRange(e,t){this.flushQueue();const i=Ti(e.startLineNumber-1,e.startColumn-1),n=Ti(e.endLineNumber-1,e.endColumn-1);return new of(s=>{const r=this.initialAstWithoutTokens||this.astWithTokens;IP(r,ys,r.length,i,n,s,0,0,new Map,t)})}getBracketPairsInRange(e,t){this.flushQueue();const i=N_(e.getStartPosition()),n=N_(e.getEndPosition());return new of(s=>{const r=this.initialAstWithoutTokens||this.astWithTokens,a=new qfe(s,t,this.textModel);DP(r,ys,r.length,i,n,a,0,new Map)})}getFirstBracketAfter(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return zU(t,ys,t.length,N_(e))}getFirstBracketBefore(e){this.flushQueue();const t=this.initialAstWithoutTokens||this.astWithTokens;return VU(t,ys,t.length,N_(e))}}function VU(o,e,t,i){if(o.kind===4||o.kind===2){const n=[];for(const s of o.children)t=ui(e,s.length),n.push({nodeOffsetStart:e,nodeOffsetEnd:t}),e=t;for(let s=n.length-1;s>=0;s--){const{nodeOffsetStart:r,nodeOffsetEnd:a}=n[s];if(D_(r,i)){const l=VU(o.children[s],r,a,i);if(l)return l}}return null}else{if(o.kind===3)return null;if(o.kind===1){const n=jf(e,t);return{bracketInfo:o.bracketInfo,range:n}}}return null}function zU(o,e,t,i){if(o.kind===4||o.kind===2){for(const n of o.children){if(t=ui(e,n.length),D_(i,t)){const s=zU(n,e,t,i);if(s)return s}e=t}return null}else{if(o.kind===3)return null;if(o.kind===1){const n=jf(e,t);return{bracketInfo:o.bracketInfo,range:n}}}return null}function IP(o,e,t,i,n,s,r,a,l,c,d=!1){if(r>200)return!0;e:for(;;)switch(o.kind){case 4:{const h=o.childrenLength;for(let u=0;u<h;u++){const f=o.getChild(u);if(f){if(t=ui(e,f.length),E_(e,n)&&Sv(t,i)){if(Sv(t,n)){o=f;continue e}if(!IP(f,e,t,i,n,s,r,0,l,c))return!1}e=t}}return!0}case 2:{const h=!c||!o.closingBracket||o.closingBracket.bracketInfo.closesColorized(o.openingBracket.bracketInfo);let u=0;if(l){let g=l.get(o.openingBracket.text);g===void 0&&(g=0),u=g,h&&(g++,l.set(o.openingBracket.text,g))}const f=o.childrenLength;for(let g=0;g<f;g++){const m=o.getChild(g);if(m){if(t=ui(e,m.length),E_(e,n)&&Sv(t,i)){if(Sv(t,n)&&m.kind!==1){o=m,h?(r++,a=u+1):a=u;continue e}if((h||m.kind!==1||!o.closingBracket)&&!IP(m,e,t,i,n,s,h?r+1:r,h?u+1:u,l,c,!o.closingBracket))return!1}e=t}}return l?.set(o.openingBracket.text,u),!0}case 3:{const h=jf(e,t);return s(new RU(h,r-1,0,!0))}case 1:{const h=jf(e,t);return s(new RU(h,r-1,a-1,d))}case 0:return!0}}class qfe{constructor(e,t,i){this.push=e,this.includeMinIndentation=t,this.textModel=i}}function DP(o,e,t,i,n,s,r,a){if(r>200)return!0;let l=!0;if(o.kind===2){let c=0;if(a){let u=a.get(o.openingBracket.text);u===void 0&&(u=0),c=u,u++,a.set(o.openingBracket.text,u)}const d=ui(e,o.openingBracket.length);let h=-1;if(s.includeMinIndentation&&(h=o.computeMinIndentation(e,s.textModel)),l=s.push(new Ife(jf(e,t),jf(e,d),o.closingBracket?jf(ui(d,o.child?.length||ys),t):void 0,r,c,o,h)),e=d,l&&o.child){const u=o.child;if(t=ui(e,u.length),E_(e,n)&&Sv(t,i)&&(l=DP(u,e,t,i,n,s,r+1,a),!l))return!1}a?.set(o.openingBracket.text,c)}else{let c=e;for(const d of o.children){const h=c;if(c=ui(c,d.length),E_(h,n)&&E_(i,c)&&(l=DP(d,h,c,i,n,s,r,a),!l))return!1}}return l}class Kfe extends A{get canBuildAST(){return this.textModel.getValueLength()<=5e6}constructor(e,t){super(),this.textModel=e,this.languageConfigurationService=t,this.bracketPairsTree=this._register(new ct),this.onDidChangeEmitter=new P,this.onDidChange=this.onDidChangeEmitter.event,this.bracketsRequested=!1}handleLanguageConfigurationServiceChange(e){(!e.languageId||this.bracketPairsTree.value?.object.didLanguageChange(e.languageId))&&(this.bracketPairsTree.clear(),this.updateBracketPairsTree())}handleDidChangeOptions(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeLanguage(e){this.bracketPairsTree.clear(),this.updateBracketPairsTree()}handleDidChangeContent(e){this.bracketPairsTree.value?.object.handleContentChanged(e)}handleDidChangeBackgroundTokenizationState(){this.bracketPairsTree.value?.object.handleDidChangeBackgroundTokenizationState()}handleDidChangeTokens(e){this.bracketPairsTree.value?.object.handleDidChangeTokens(e)}updateBracketPairsTree(){if(this.bracketsRequested&&this.canBuildAST){if(!this.bracketPairsTree.value){const e=new U;this.bracketPairsTree.value=Gfe(e.add(new jfe(this.textModel,t=>this.languageConfigurationService.getLanguageConfiguration(t))),e),e.add(this.bracketPairsTree.value.object.onDidChange(t=>this.onDidChangeEmitter.fire(t))),this.onDidChangeEmitter.fire()}}else this.bracketPairsTree.value&&(this.bracketPairsTree.clear(),this.onDidChangeEmitter.fire())}getBracketPairsInRange(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!1)||of.empty}getBracketPairsInRangeWithMinIndentation(e){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketPairsInRange(e,!0)||of.empty}getBracketsInRange(e,t=!1){return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getBracketsInRange(e,t)||of.empty}findMatchingBracketUp(e,t,i){const n=this.textModel.validatePosition(t),s=this.textModel.getLanguageIdAtPosition(n.lineNumber,n.column);if(this.canBuildAST){const r=this.languageConfigurationService.getLanguageConfiguration(s).bracketsNew.getClosingBracketInfo(e);if(!r)return null;const a=this.getBracketPairsInRange(k.fromPositions(t,t)).findLast(l=>r.closes(l.openingBracketInfo));return a?a.openingBracketRange:null}else{const r=e.toLowerCase(),a=this.languageConfigurationService.getLanguageConfiguration(s).brackets;if(!a)return null;const l=a.textIsBracket[r];return l?mx(this._findMatchingBracketUp(l,n,EP(i))):null}}matchBracket(e,t){if(this.canBuildAST){const i=this.getBracketPairsInRange(k.fromPositions(e,e)).filter(n=>n.closingBracketRange!==void 0&&(n.openingBracketRange.containsPosition(e)||n.closingBracketRange.containsPosition(e))).findLastMaxBy(kn(n=>n.openingBracketRange.containsPosition(e)?n.openingBracketRange:n.closingBracketRange,k.compareRangesUsingStarts));return i?[i.openingBracketRange,i.closingBracketRange]:null}else{const i=EP(t);return this._matchBracket(this.textModel.validatePosition(e),i)}}_establishBracketSearchOffsets(e,t,i,n){const s=t.getCount(),r=t.getLanguageId(n);let a=Math.max(0,e.column-1-i.maxBracketLength);for(let c=n-1;c>=0;c--){const d=t.getEndOffset(c);if(d<=a)break;if(ul(t.getStandardTokenType(c))||t.getLanguageId(c)!==r){a=d;break}}let l=Math.min(t.getLineContent().length,e.column-1+i.maxBracketLength);for(let c=n+1;c<s;c++){const d=t.getStartOffset(c);if(d>=l)break;if(ul(t.getStandardTokenType(c))||t.getLanguageId(c)!==r){l=d;break}}return{searchStartOffset:a,searchEndOffset:l}}_matchBracket(e,t){const i=e.lineNumber,n=this.textModel.tokenization.getLineTokens(i),s=this.textModel.getLineContent(i),r=n.findTokenIndexAtOffset(e.column-1);if(r<0)return null;const a=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(r)).brackets;if(a&&!ul(n.getStandardTokenType(r))){let{searchStartOffset:l,searchEndOffset:c}=this._establishBracketSearchOffsets(e,n,a,r),d=null;for(;;){const h=Yr.findNextBracketInRange(a.forwardRegex,i,s,l,c);if(!h)break;if(h.startColumn<=e.column&&e.column<=h.endColumn){const u=s.substring(h.startColumn-1,h.endColumn-1).toLowerCase(),f=this._matchFoundBracket(h,a.textIsBracket[u],a.textIsOpenBracket[u],t);if(f){if(f instanceof Gc)return null;d=f}}l=h.endColumn-1}if(d)return d}if(r>0&&n.getStartOffset(r)===e.column-1){const l=r-1,c=this.languageConfigurationService.getLanguageConfiguration(n.getLanguageId(l)).brackets;if(c&&!ul(n.getStandardTokenType(l))){const{searchStartOffset:d,searchEndOffset:h}=this._establishBracketSearchOffsets(e,n,c,l),u=Yr.findPrevBracketInRange(c.reversedRegex,i,s,d,h);if(u&&u.startColumn<=e.column&&e.column<=u.endColumn){const f=s.substring(u.startColumn-1,u.endColumn-1).toLowerCase(),g=this._matchFoundBracket(u,c.textIsBracket[f],c.textIsOpenBracket[f],t);if(g)return g instanceof Gc?null:g}}}return null}_matchFoundBracket(e,t,i,n){if(!t)return null;const s=i?this._findMatchingBracketDown(t,e.getEndPosition(),n):this._findMatchingBracketUp(t,e.getStartPosition(),n);return s?s instanceof Gc?s:[e,s]:null}_findMatchingBracketUp(e,t,i){const n=e.languageId,s=e.reversedRegex;let r=-1,a=0;const l=(c,d,h,u)=>{for(;;){if(i&&++a%100===0&&!i())return Gc.INSTANCE;const f=Yr.findPrevBracketInRange(s,c,d,h,u);if(!f)break;const g=d.substring(f.startColumn-1,f.endColumn-1).toLowerCase();if(e.isOpen(g)?r++:e.isClose(g)&&r--,r===0)return f;u=f.startColumn-1}return null};for(let c=t.lineNumber;c>=1;c--){const d=this.textModel.tokenization.getLineTokens(c),h=d.getCount(),u=this.textModel.getLineContent(c);let f=h-1,g=u.length,m=u.length;c===t.lineNumber&&(f=d.findTokenIndexAtOffset(t.column-1),g=t.column-1,m=t.column-1);let _=!0;for(;f>=0;f--){const b=d.getLanguageId(f)===n&&!ul(d.getStandardTokenType(f));if(b)_?g=d.getStartOffset(f):(g=d.getStartOffset(f),m=d.getEndOffset(f));else if(_&&g!==m){const C=l(c,u,g,m);if(C)return C}_=b}if(_&&g!==m){const b=l(c,u,g,m);if(b)return b}}return null}_findMatchingBracketDown(e,t,i){const n=e.languageId,s=e.forwardRegex;let r=1,a=0;const l=(d,h,u,f)=>{for(;;){if(i&&++a%100===0&&!i())return Gc.INSTANCE;const g=Yr.findNextBracketInRange(s,d,h,u,f);if(!g)break;const m=h.substring(g.startColumn-1,g.endColumn-1).toLowerCase();if(e.isOpen(m)?r++:e.isClose(m)&&r--,r===0)return g;u=g.endColumn-1}return null},c=this.textModel.getLineCount();for(let d=t.lineNumber;d<=c;d++){const h=this.textModel.tokenization.getLineTokens(d),u=h.getCount(),f=this.textModel.getLineContent(d);let g=0,m=0,_=0;d===t.lineNumber&&(g=h.findTokenIndexAtOffset(t.column-1),m=t.column-1,_=t.column-1);let b=!0;for(;g<u;g++){const C=h.getLanguageId(g)===n&&!ul(h.getStandardTokenType(g));if(C)b||(m=h.getStartOffset(g)),_=h.getEndOffset(g);else if(b&&m!==_){const w=l(d,f,m,_);if(w)return w}b=C}if(b&&m!==_){const C=l(d,f,m,_);if(C)return C}}return null}findPrevBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketBefore(t)||null;let i=null,n=null,s=null;for(let r=t.lineNumber;r>=1;r--){const a=this.textModel.tokenization.getLineTokens(r),l=a.getCount(),c=this.textModel.getLineContent(r);let d=l-1,h=c.length,u=c.length;if(r===t.lineNumber){d=a.findTokenIndexAtOffset(t.column-1),h=t.column-1,u=t.column-1;const g=a.getLanguageId(d);i!==g&&(i=g,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew)}let f=!0;for(;d>=0;d--){const g=a.getLanguageId(d);if(i!==g){if(n&&s&&f&&h!==u){const _=Yr.findPrevBracketInRange(n.reversedRegex,r,c,h,u);if(_)return this._toFoundBracket(s,_);f=!1}i=g,n=this.languageConfigurationService.getLanguageConfiguration(i).brackets,s=this.languageConfigurationService.getLanguageConfiguration(i).bracketsNew}const m=!!n&&!ul(a.getStandardTokenType(d));if(m)f?h=a.getStartOffset(d):(h=a.getStartOffset(d),u=a.getEndOffset(d));else if(s&&n&&f&&h!==u){const _=Yr.findPrevBracketInRange(n.reversedRegex,r,c,h,u);if(_)return this._toFoundBracket(s,_)}f=m}if(s&&n&&f&&h!==u){const g=Yr.findPrevBracketInRange(n.reversedRegex,r,c,h,u);if(g)return this._toFoundBracket(s,g)}}return null}findNextBracket(e){const t=this.textModel.validatePosition(e);if(this.canBuildAST)return this.bracketsRequested=!0,this.updateBracketPairsTree(),this.bracketPairsTree.value?.object.getFirstBracketAfter(t)||null;const i=this.textModel.getLineCount();let n=null,s=null,r=null;for(let a=t.lineNumber;a<=i;a++){const l=this.textModel.tokenization.getLineTokens(a),c=l.getCount(),d=this.textModel.getLineContent(a);let h=0,u=0,f=0;if(a===t.lineNumber){h=l.findTokenIndexAtOffset(t.column-1),u=t.column-1,f=t.column-1;const m=l.getLanguageId(h);n!==m&&(n=m,s=this.languageConfigurationService.getLanguageConfiguration(n).brackets,r=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew)}let g=!0;for(;h<c;h++){const m=l.getLanguageId(h);if(n!==m){if(r&&s&&g&&u!==f){const b=Yr.findNextBracketInRange(s.forwardRegex,a,d,u,f);if(b)return this._toFoundBracket(r,b);g=!1}n=m,s=this.languageConfigurationService.getLanguageConfiguration(n).brackets,r=this.languageConfigurationService.getLanguageConfiguration(n).bracketsNew}const _=!!s&&!ul(l.getStandardTokenType(h));if(_)g||(u=l.getStartOffset(h)),f=l.getEndOffset(h);else if(r&&s&&g&&u!==f){const b=Yr.findNextBracketInRange(s.forwardRegex,a,d,u,f);if(b)return this._toFoundBracket(r,b)}g=_}if(r&&s&&g&&u!==f){const m=Yr.findNextBracketInRange(s.forwardRegex,a,d,u,f);if(m)return this._toFoundBracket(r,m)}}return null}findEnclosingBrackets(e,t){const i=this.textModel.validatePosition(e);if(this.canBuildAST){const f=k.fromPositions(i),g=this.getBracketPairsInRange(k.fromPositions(i,i)).findLast(m=>m.closingBracketRange!==void 0&&m.range.strictContainsRange(f));return g?[g.openingBracketRange,g.closingBracketRange]:null}const n=EP(t),s=this.textModel.getLineCount(),r=new Map;let a=[];const l=(f,g)=>{if(!r.has(f)){const m=[];for(let _=0,b=g?g.brackets.length:0;_<b;_++)m[_]=0;r.set(f,m)}a=r.get(f)};let c=0;const d=(f,g,m,_,b)=>{for(;;){if(n&&++c%100===0&&!n())return Gc.INSTANCE;const C=Yr.findNextBracketInRange(f.forwardRegex,g,m,_,b);if(!C)break;const w=m.substring(C.startColumn-1,C.endColumn-1).toLowerCase(),v=f.textIsBracket[w];if(v&&(v.isOpen(w)?a[v.index]++:v.isClose(w)&&a[v.index]--,a[v.index]===-1))return this._matchFoundBracket(C,v,!1,n);_=C.endColumn-1}return null};let h=null,u=null;for(let f=i.lineNumber;f<=s;f++){const g=this.textModel.tokenization.getLineTokens(f),m=g.getCount(),_=this.textModel.getLineContent(f);let b=0,C=0,w=0;if(f===i.lineNumber){b=g.findTokenIndexAtOffset(i.column-1),C=i.column-1,w=i.column-1;const S=g.getLanguageId(b);h!==S&&(h=S,u=this.languageConfigurationService.getLanguageConfiguration(h).brackets,l(h,u))}let v=!0;for(;b<m;b++){const S=g.getLanguageId(b);if(h!==S){if(u&&v&&C!==w){const x=d(u,f,_,C,w);if(x)return mx(x);v=!1}h=S,u=this.languageConfigurationService.getLanguageConfiguration(h).brackets,l(h,u)}const L=!!u&&!ul(g.getStandardTokenType(b));if(L)v||(C=g.getStartOffset(b)),w=g.getEndOffset(b);else if(u&&v&&C!==w){const x=d(u,f,_,C,w);if(x)return mx(x)}v=L}if(u&&v&&C!==w){const S=d(u,f,_,C,w);if(S)return mx(S)}}return null}_toFoundBracket(e,t){if(!t)return null;let i=this.textModel.getValueInRange(t);i=i.toLowerCase();const n=e.getBracketInfo(i);return n?{range:t,bracketInfo:n}:null}}function Gfe(o,e){return{object:o,dispose:()=>e?.dispose()}}function EP(o){if(typeof o>"u")return()=>!0;{const e=Date.now();return()=>Date.now()-e<=o}}const mN=class mN{constructor(){this._searchCanceledBrand=void 0}};mN.INSTANCE=new mN;let Gc=mN;function mx(o){return o instanceof Gc?null:o}class Zfe extends A{constructor(e){super(),this.textModel=e,this.colorProvider=new UU,this.onDidChangeEmitter=new P,this.onDidChange=this.onDidChangeEmitter.event,this.colorizationOptions=e.getOptions().bracketPairColorizationOptions,this._register(e.bracketPairs.onDidChange(t=>{this.onDidChangeEmitter.fire()}))}handleDidChangeOptions(e){this.colorizationOptions=this.textModel.getOptions().bracketPairColorizationOptions}getDecorationsInRange(e,t,i,n){return n?[]:t===void 0?[]:this.colorizationOptions.enabled?this.textModel.bracketPairs.getBracketsInRange(e,!0).map(r=>({id:`bracket${r.range.toString()}-${r.nestingLevel}`,options:{description:"BracketPairColorization",inlineClassName:this.colorProvider.getInlineClassName(r,this.colorizationOptions.independentColorPoolPerBracketType)},ownerId:0,range:r.range})).toArray():[]}getAllDecorations(e,t){return e===void 0?[]:this.colorizationOptions.enabled?this.getDecorationsInRange(new k(1,1,this.textModel.getLineCount(),1),e,t):[]}}class UU{constructor(){this.unexpectedClosingBracketClassName="unexpected-closing-bracket"}getInlineClassName(e,t){return e.isInvalid?this.unexpectedClosingBracketClassName:this.getInlineClassNameOfLevel(t?e.nestingLevelOfEqualBracketType:e.nestingLevel)}getInlineClassNameOfLevel(e){return`bracket-highlighting-${e%30}`}}Nr((o,e)=>{const t=[Fz,Wz,Bz,Hz,Vz,zz],i=new UU;e.addRule(`.monaco-editor .${i.unexpectedClosingBracketClassName} { color: ${o.getColor(nhe)}; }`);const n=t.map(s=>o.getColor(s)).filter(s=>!!s).filter(s=>!s.isTransparent());for(let s=0;s<30;s++){const r=n[s%n.length];e.addRule(`.monaco-editor .${i.getInlineClassNameOfLevel(s)} { color: ${r}; }`)}});function _x(o){return o.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}class Tn{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,i,n){this.oldPosition=e,this.oldText=t,this.newPosition=i,this.newText=n}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${_x(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${_x(this.oldText)}")`:`(replace@${this.oldPosition} "${_x(this.oldText)}" with "${_x(this.newText)}")`}static _writeStringSize(e){return 4+2*e.length}static _writeString(e,t,i){const n=t.length;va(e,n,i),i+=4;for(let s=0;s<n;s++)ane(e,t.charCodeAt(s),i),i+=2;return i}static _readString(e,t){const i=Ca(e,t);return t+=4,xoe(e,t,i)}writeSize(){return 8+Tn._writeStringSize(this.oldText)+Tn._writeStringSize(this.newText)}write(e,t){return va(e,this.oldPosition,t),t+=4,va(e,this.newPosition,t),t+=4,t=Tn._writeString(e,this.oldText,t),t=Tn._writeString(e,this.newText,t),t}static read(e,t,i){const n=Ca(e,t);t+=4;const s=Ca(e,t);t+=4;const r=Tn._readString(e,t);t+=Tn._writeStringSize(r);const a=Tn._readString(e,t);return t+=Tn._writeStringSize(a),i.push(new Tn(n,r,s,a)),t}}function Yfe(o,e){return o===null||o.length===0?e:new kl(o,e).compress()}class kl{constructor(e,t){this._prevEdits=e,this._currEdits=t,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let e=0,t=0,i=this._getPrev(e),n=this._getCurr(t);for(;e<this._prevLen||t<this._currLen;){if(i===null){this._acceptCurr(n),n=this._getCurr(++t);continue}if(n===null){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldEnd<=i.newPosition){this._acceptCurr(n),n=this._getCurr(++t);continue}if(i.newEnd<=n.oldPosition){this._acceptPrev(i),i=this._getPrev(++e);continue}if(n.oldPosition<i.newPosition){const[c,d]=kl._splitCurr(n,i.newPosition-n.oldPosition);this._acceptCurr(c),n=d;continue}if(i.newPosition<n.oldPosition){const[c,d]=kl._splitPrev(i,n.oldPosition-i.newPosition);this._acceptPrev(c),i=d;continue}let a,l;if(n.oldEnd===i.newEnd)a=i,l=n,i=this._getPrev(++e),n=this._getCurr(++t);else if(n.oldEnd<i.newEnd){const[c,d]=kl._splitPrev(i,n.oldLength);a=c,l=n,i=d,n=this._getCurr(++t)}else{const[c,d]=kl._splitCurr(n,i.newLength);a=i,l=c,i=this._getPrev(++e),n=d}this._result[this._resultLen++]=new Tn(a.oldPosition,a.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=a.newLength-a.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}const s=kl._merge(this._result);return kl._removeNoOps(s)}_acceptCurr(e){this._result[this._resultLen++]=kl._rebaseCurr(this._prevDeltaOffset,e),this._currDeltaOffset+=e.newLength-e.oldLength}_getCurr(e){return e<this._currLen?this._currEdits[e]:null}_acceptPrev(e){this._result[this._resultLen++]=kl._rebasePrev(this._currDeltaOffset,e),this._prevDeltaOffset+=e.newLength-e.oldLength}_getPrev(e){return e<this._prevLen?this._prevEdits[e]:null}static _rebaseCurr(e,t){return new Tn(t.oldPosition-e,t.oldText,t.newPosition,t.newText)}static _rebasePrev(e,t){return new Tn(t.oldPosition,t.oldText,t.newPosition+e,t.newText)}static _splitPrev(e,t){const i=e.newText.substr(0,t),n=e.newText.substr(t);return[new Tn(e.oldPosition,e.oldText,e.newPosition,i),new Tn(e.oldEnd,"",e.newPosition+t,n)]}static _splitCurr(e,t){const i=e.oldText.substr(0,t),n=e.oldText.substr(t);return[new Tn(e.oldPosition,i,e.newPosition,e.newText),new Tn(e.oldPosition+t,n,e.newEnd,"")]}static _merge(e){if(e.length===0)return e;const t=[];let i=0,n=e[0];for(let s=1;s<e.length;s++){const r=e[s];n.oldEnd===r.oldPosition?n=new Tn(n.oldPosition,n.oldText+r.oldText,n.newPosition,n.newText+r.newText):(t[i++]=n,n=r)}return t[i++]=n,t}static _removeNoOps(e){if(e.length===0)return e;const t=[];let i=0;for(let n=0;n<e.length;n++){const s=e[n];s.oldText!==s.newText&&(t[i++]=s)}return t}}const Xfe=Symbol("TextModelEditSource");class $U{constructor(e,t){this.metadata=e}toString(){return`${this.metadata.source}`}getType(){const e=this.metadata;switch(e.source){case"cursor":return e.kind;case"inlineCompletionAccept":return e.source+(e.$nes?":nes":"");case"unknown":return e.name||"unknown";default:return e.source}}toKey(e,t={}){const i=this.metadata;return Object.entries(i).filter(([s,r])=>{const a=t[s];return a!==void 0?a:(s.match(/\$/g)||[]).length<=e&&r!==void 0&&r!==null&&r!==""}).map(([s,r])=>`${s}:${r}`).join("-")}}function Ks(o){return new $U(o,Xfe)}const jn={unknown(o){return Ks({source:"unknown",name:o.name})},rename:()=>Ks({source:"rename"}),chatApplyEdits(o){return Ks({source:"Chat.applyEdits",$modelId:jU(o.modelId),$extensionId:o.extensionId?.extensionId,$extensionVersion:o.extensionId?.version,$$languageId:o.languageId,$$sessionId:o.sessionId,$$requestId:o.requestId,$$mode:o.mode,$$codeBlockSuggestionId:o.codeBlockSuggestionId})},chatUndoEdits:()=>Ks({source:"Chat.undoEdits"}),chatReset:()=>Ks({source:"Chat.reset"}),inlineCompletionAccept(o){return Ks({source:"inlineCompletionAccept",$nes:o.nes,...bx(o.providerId),$$requestUuid:o.requestUuid,$$languageId:o.languageId})},inlineCompletionPartialAccept(o){return Ks({source:"inlineCompletionPartialAccept",type:o.type,$nes:o.nes,...bx(o.providerId),$$requestUuid:o.requestUuid,$$languageId:o.languageId})},inlineChatApplyEdit(o){return Ks({source:"inlineChat.applyEdits",$modelId:jU(o.modelId),$extensionId:o.extensionId?.extensionId,$extensionVersion:o.extensionId?.version,$$requestId:o.requestId,$$languageId:o.languageId})},reloadFromDisk:()=>Ks({source:"reloadFromDisk"}),cursor(o){return Ks({source:"cursor",kind:o.kind,detailedSource:o.detailedSource})},setValue:()=>Ks({source:"setValue"}),eolChange:()=>Ks({source:"eolChange"}),applyEdits:()=>Ks({source:"applyEdits"}),snippet:()=>Ks({source:"snippet"}),suggest:o=>Ks({source:"suggest",...bx(o.providerId)}),codeAction:o=>Ks({source:"codeAction",$kind:o.kind,...bx(o.providerId)})};function bx(o){return o?{$extensionId:o.extensionId,$extensionVersion:o.extensionVersion,$providerId:o.providerId}:{}}function jU(o){if(o!==void 0)return o.replaceAll("/","|")}class kv{static fromText(e){const t=$i.ofText(e).lineCount,i=e.length;return new kv(t,0,i,0)}static tryCreate(e,t,i,n){if(!(e===void 0||t===void 0||i===void 0||n===void 0))return new kv(e,t,i,n)}constructor(e,t,i,n){this.linesAdded=e,this.linesRemoved=t,this.charsAdded=i,this.charsRemoved=n}}var qU;(function(o){function e(){const t=Lz("sgt");return t}o.newId=e})(qU||(qU={}));function b5e(o){return o}function T_(o){return o.toString()}class fn{static create(e,t){const i=e.getAlternativeVersionId(),n=NP(e);return new fn(i,i,n,n,t,t,[])}constructor(e,t,i,n,s,r,a){this.beforeVersionId=e,this.afterVersionId=t,this.beforeEOL=i,this.afterEOL=n,this.beforeCursorState=s,this.afterCursorState=r,this.changes=a}append(e,t,i,n,s){t.length>0&&(this.changes=Yfe(this.changes,t)),this.afterEOL=i,this.afterVersionId=n,this.afterCursorState=s}static _writeSelectionsSize(e){return 4+16*(e?e.length:0)}static _writeSelections(e,t,i){if(va(e,t?t.length:0,i),i+=4,t)for(const n of t)va(e,n.selectionStartLineNumber,i),i+=4,va(e,n.selectionStartColumn,i),i+=4,va(e,n.positionLineNumber,i),i+=4,va(e,n.positionColumn,i),i+=4;return i}static _readSelections(e,t,i){const n=Ca(e,t);t+=4;for(let s=0;s<n;s++){const r=Ca(e,t);t+=4;const a=Ca(e,t);t+=4;const l=Ca(e,t);t+=4;const c=Ca(e,t);t+=4,i.push(new ce(r,a,l,c))}return t}serialize(){let e=10+fn._writeSelectionsSize(this.beforeCursorState)+fn._writeSelectionsSize(this.afterCursorState)+4;for(const n of this.changes)e+=n.writeSize();const t=new Uint8Array(e);let i=0;va(t,this.beforeVersionId,i),i+=4,va(t,this.afterVersionId,i),i+=4,v6(t,this.beforeEOL,i),i+=1,v6(t,this.afterEOL,i),i+=1,i=fn._writeSelections(t,this.beforeCursorState,i),i=fn._writeSelections(t,this.afterCursorState,i),va(t,this.changes.length,i),i+=4;for(const n of this.changes)i=n.write(t,i);return t.buffer}static deserialize(e){const t=new Uint8Array(e);let i=0;const n=Ca(t,i);i+=4;const s=Ca(t,i);i+=4;const r=C6(t,i);i+=1;const a=C6(t,i);i+=1;const l=[];i=fn._readSelections(t,i,l);const c=[];i=fn._readSelections(t,i,c);const d=Ca(t,i);i+=4;const h=[];for(let u=0;u<d;u++)i=Tn.read(t,i,h);return new fn(n,s,r,a,l,c,h)}}class KU{get type(){return 0}get resource(){return be.isUri(this.model)?this.model:this.model.uri}constructor(e,t,i,n){this.label=e,this.code=t,this.model=i,this._data=fn.create(i,n)}toString(){return(this._data instanceof fn?this._data:fn.deserialize(this._data)).changes.map(t=>t.toString()).join(", ")}matchesResource(e){return(be.isUri(this.model)?this.model:this.model.uri).toString()===e.toString()}setModel(e){this.model=e}canAppend(e){return this.model===e&&this._data instanceof fn}append(e,t,i,n,s){this._data instanceof fn&&this._data.append(e,t,i,n,s)}close(){this._data instanceof fn&&(this._data=this._data.serialize())}open(){this._data instanceof fn||(this._data=fn.deserialize(this._data))}undo(){if(be.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof fn&&(this._data=this._data.serialize());const e=fn.deserialize(this._data);this.model._applyUndo(e.changes,e.beforeEOL,e.beforeVersionId,e.beforeCursorState)}redo(){if(be.isUri(this.model))throw new Error("Invalid SingleModelEditStackElement");this._data instanceof fn&&(this._data=this._data.serialize());const e=fn.deserialize(this._data);this.model._applyRedo(e.changes,e.afterEOL,e.afterVersionId,e.afterCursorState)}heapSize(){return this._data instanceof fn&&(this._data=this._data.serialize()),this._data.byteLength+168}}class Qfe{get resources(){return this._editStackElementsArr.map(e=>e.resource)}constructor(e,t,i){this.label=e,this.code=t,this.type=1,this._isOpen=!0,this._editStackElementsArr=i.slice(0),this._editStackElementsMap=new Map;for(const n of this._editStackElementsArr){const s=T_(n.resource);this._editStackElementsMap.set(s,n)}this._delegate=null}prepareUndoRedo(){if(this._delegate)return this._delegate.prepareUndoRedo(this)}matchesResource(e){const t=T_(e);return this._editStackElementsMap.has(t)}setModel(e){const t=T_(be.isUri(e)?e:e.uri);this._editStackElementsMap.has(t)&&this._editStackElementsMap.get(t).setModel(e)}canAppend(e){if(!this._isOpen)return!1;const t=T_(e.uri);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).canAppend(e):!1}append(e,t,i,n,s){const r=T_(e.uri);this._editStackElementsMap.get(r).append(e,t,i,n,s)}close(){this._isOpen=!1}open(){}undo(){this._isOpen=!1;for(const e of this._editStackElementsArr)e.undo()}redo(){for(const e of this._editStackElementsArr)e.redo()}heapSize(e){const t=T_(e);return this._editStackElementsMap.has(t)?this._editStackElementsMap.get(t).heapSize():0}split(){return this._editStackElementsArr}toString(){const e=[];for(const t of this._editStackElementsArr)e.push(`${vr(t.resource)}: ${t}`);return`{${e.join(", ")}}`}}function NP(o){return o.getEOL()===`
`?0:1}function Zc(o){return o?o instanceof KU||o instanceof Qfe:!1}class TP{constructor(e,t){this._model=e,this._undoRedoService=t}pushStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);Zc(e)&&e.close()}popStackElement(){const e=this._undoRedoService.getLastElement(this._model.uri);Zc(e)&&e.open()}clear(){this._undoRedoService.removeElements(this._model.uri)}_getOrCreateEditStackElement(e,t){const i=this._undoRedoService.getLastElement(this._model.uri);if(Zc(i)&&i.canAppend(this._model))return i;const n=new KU(p(781,"Typing"),"undoredo.textBufferEdit",this._model,e);return this._undoRedoService.pushElement(n,t),n}pushEOL(e){const t=this._getOrCreateEditStackElement(null,void 0);this._model.setEOL(e),t.append(this._model,[],NP(this._model),this._model.getAlternativeVersionId(),null)}pushEditOperation(e,t,i,n,s=jn.unknown({name:"pushEditOperation"})){const r=this._getOrCreateEditStackElement(e,n),a=this._model.applyEdits(t,!0,s),l=TP._computeCursorState(i,a),c=a.map((d,h)=>({index:h,textChange:d.textChange}));return c.sort((d,h)=>d.textChange.oldPosition===h.textChange.oldPosition?d.index-h.index:d.textChange.oldPosition-h.textChange.oldPosition),r.append(this._model,c.map(d=>d.textChange),NP(this._model),this._model.getAlternativeVersionId(),l),l}static _computeCursorState(e,t){try{return e?e(t):null}catch(i){return Ee(i),null}}}class Jfe{constructor(){this.spacesDiff=0,this.looksLikeAlignment=!1}}function ege(o,e,t,i,n){n.spacesDiff=0,n.looksLikeAlignment=!1;let s;for(s=0;s<e&&s<i;s++){const u=o.charCodeAt(s),f=t.charCodeAt(s);if(u!==f)break}let r=0,a=0;for(let u=s;u<e;u++)o.charCodeAt(u)===32?r++:a++;let l=0,c=0;for(let u=s;u<i;u++)t.charCodeAt(u)===32?l++:c++;if(r>0&&a>0||l>0&&c>0)return;const d=Math.abs(a-c),h=Math.abs(r-l);if(d===0){n.spacesDiff=h,h>0&&0<=l-1&&l-1<o.length&&l<t.length&&t.charCodeAt(l)!==32&&o.charCodeAt(l-1)===32&&o.charCodeAt(o.length-1)===44&&(n.looksLikeAlignment=!0);return}if(h%d===0){n.spacesDiff=h/d;return}}function GU(o,e,t){const i=Math.min(o.getLineCount(),1e4);let n=0,s=0,r="",a=0;const l=[2,4,6,8,3,5,7],c=8,d=[0,0,0,0,0,0,0,0,0],h=new Jfe;for(let g=1;g<=i;g++){const m=o.getLineLength(g),_=o.getLineContent(g),b=m<=65536;let C=!1,w=0,v=0,S=0;for(let x=0,I=m;x<I;x++){const D=b?_.charCodeAt(x):o.getLineCharCode(g,x);if(D===9)S++;else if(D===32)v++;else{C=!0,w=x;break}}if(!C||(S>0?n++:v>1&&s++,ege(r,a,_,w,h),h.looksLikeAlignment&&!(t&&e===h.spacesDiff)))continue;const L=h.spacesDiff;L<=c&&d[L]++,r=_,a=w}let u=t;n!==s&&(u=n<s);let f=e;if(u){let g=u?0:.1*i;l.forEach(m=>{const _=d[m];_>g&&(g=_,f=m)}),f===4&&d[4]>0&&d[2]>0&&d[2]>=d[4]/2&&(f=2)}return{insertSpaces:u,tabSize:f}}function Gs(o){return(o.metadata&1)>>>0}function qt(o,e){o.metadata=o.metadata&254|e<<0}function Rn(o){return(o.metadata&2)>>>1===1}function Ft(o,e){o.metadata=o.metadata&253|(e?1:0)<<1}function ZU(o){return(o.metadata&4)>>>2===1}function YU(o,e){o.metadata=o.metadata&251|(e?1:0)<<2}function XU(o){return(o.metadata&64)>>>6===1}function QU(o,e){o.metadata=o.metadata&191|(e?1:0)<<6}function JU(o){return(o.metadata&128)>>>7===1}function e$(o,e){o.metadata=o.metadata&127|(e?1:0)<<7}function tge(o){return(o.metadata&24)>>>3}function t$(o,e){o.metadata=o.metadata&231|e<<3}function ige(o){return(o.metadata&32)>>>5===1}function i$(o,e){o.metadata=o.metadata&223|(e?1:0)<<5}class n${constructor(e,t,i){this.metadata=0,this.parent=this,this.left=this,this.right=this,qt(this,1),this.start=t,this.end=i,this.delta=0,this.maxEnd=i,this.id=e,this.ownerId=0,this.options=null,YU(this,!1),QU(this,!1),t$(this,1),i$(this,!1),e$(this,!1),this.cachedVersionId=0,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=null,Ft(this,!1)}reset(e,t,i,n){this.start=t,this.end=i,this.maxEnd=i,this.cachedVersionId=e,this.cachedAbsoluteStart=t,this.cachedAbsoluteEnd=i,this.range=n}setOptions(e){this.options=e;const t=this.options.className;YU(this,t==="squiggly-error"||t==="squiggly-warning"||t==="squiggly-info"),QU(this,this.options.glyphMarginClassName!==null),t$(this,this.options.stickiness),i$(this,this.options.collapseOnReplaceEdit),e$(this,this.options.affectsFont??!1)}setCachedOffsets(e,t,i){this.cachedVersionId!==i&&(this.range=null),this.cachedVersionId=i,this.cachedAbsoluteStart=e,this.cachedAbsoluteEnd=t}detach(){this.parent=null,this.left=null,this.right=null}}const qe=new n$(null,0,0);qe.parent=qe,qe.left=qe,qe.right=qe,qt(qe,0);class RP{constructor(){this.root=qe,this.requestNormalizeDelta=!1}intervalSearch(e,t,i,n,s,r,a){return this.root===qe?[]:dge(this,e,t,i,n,s,r,a)}search(e,t,i,n,s){return this.root===qe?[]:cge(this,e,t,i,n,s)}collectNodesFromOwner(e){return age(this,e)}collectNodesPostOrder(){return lge(this)}insert(e){s$(this,e),this._normalizeDeltaIfNecessary()}delete(e){o$(this,e),this._normalizeDeltaIfNecessary()}resolveNode(e,t){const i=e;let n=0;for(;e!==this.root;)e===e.parent.right&&(n+=e.parent.delta),e=e.parent;const s=i.start+n,r=i.end+n;i.setCachedOffsets(s,r,t)}acceptReplace(e,t,i,n){const s=oge(this,e,e+t);for(let r=0,a=s.length;r<a;r++){const l=s[r];o$(this,l)}this._normalizeDeltaIfNecessary(),rge(this,e,e+t,i),this._normalizeDeltaIfNecessary();for(let r=0,a=s.length;r<a;r++){const l=s[r];l.start=l.cachedAbsoluteStart,l.end=l.cachedAbsoluteEnd,sge(l,e,e+t,i,n),l.maxEnd=l.end,s$(this,l)}this._normalizeDeltaIfNecessary()}_normalizeDeltaIfNecessary(){this.requestNormalizeDelta&&(this.requestNormalizeDelta=!1,nge(this))}}function nge(o){let e=o.root,t=0;for(;e!==qe;){if(e.left!==qe&&!Rn(e.left)){e=e.left;continue}if(e.right!==qe&&!Rn(e.right)){t+=e.delta,e=e.right;continue}e.start=t+e.start,e.end=t+e.end,e.delta=0,Th(e),Ft(e,!0),Ft(e.left,!1),Ft(e.right,!1),e===e.parent.right&&(t-=e.parent.delta),e=e.parent}Ft(o.root,!1)}function R_(o,e,t,i){return o<t?!0:o>t||i===1?!1:i===2?!0:e}function sge(o,e,t,i,n){const s=tge(o),r=s===0||s===2,a=s===1||s===2,l=t-e,c=i,d=Math.min(l,c),h=o.start;let u=!1;const f=o.end;let g=!1;e<=h&&f<=t&&ige(o)&&(o.start=e,u=!0,o.end=e,g=!0);{const _=n?1:l>0?2:0;!u&&R_(h,r,e,_)&&(u=!0),!g&&R_(f,a,e,_)&&(g=!0)}if(d>0&&!n){const _=l>c?2:0;!u&&R_(h,r,e+d,_)&&(u=!0),!g&&R_(f,a,e+d,_)&&(g=!0)}{const _=n?1:0;!u&&R_(h,r,t,_)&&(o.start=e+c,u=!0),!g&&R_(f,a,t,_)&&(o.end=e+c,g=!0)}const m=c-l;u||(o.start=Math.max(0,h+m)),g||(o.end=Math.max(0,f+m)),o.start>o.end&&(o.end=o.start)}function oge(o,e,t){let i=o.root,n=0,s=0,r=0,a=0;const l=[];let c=0;for(;i!==qe;){if(Rn(i)){Ft(i.left,!1),Ft(i.right,!1),i===i.parent.right&&(n-=i.parent.delta),i=i.parent;continue}if(!Rn(i.left)){if(s=n+i.maxEnd,s<e){Ft(i,!0);continue}if(i.left!==qe){i=i.left;continue}}if(r=n+i.start,r>t){Ft(i,!0);continue}if(a=n+i.end,a>=e&&(i.setCachedOffsets(r,a,0),l[c++]=i),Ft(i,!0),i.right!==qe&&!Rn(i.right)){n+=i.delta,i=i.right;continue}}return Ft(o.root,!1),l}function rge(o,e,t,i){let n=o.root,s=0,r=0,a=0;const l=i-(t-e);for(;n!==qe;){if(Rn(n)){Ft(n.left,!1),Ft(n.right,!1),n===n.parent.right&&(s-=n.parent.delta),Th(n),n=n.parent;continue}if(!Rn(n.left)){if(r=s+n.maxEnd,r<e){Ft(n,!0);continue}if(n.left!==qe){n=n.left;continue}}if(a=s+n.start,a>t){n.start+=l,n.end+=l,n.delta+=l,(n.delta<-1073741824||n.delta>1073741824)&&(o.requestNormalizeDelta=!0),Ft(n,!0);continue}if(Ft(n,!0),n.right!==qe&&!Rn(n.right)){s+=n.delta,n=n.right;continue}}Ft(o.root,!1)}function age(o,e){let t=o.root;const i=[];let n=0;for(;t!==qe;){if(Rn(t)){Ft(t.left,!1),Ft(t.right,!1),t=t.parent;continue}if(t.left!==qe&&!Rn(t.left)){t=t.left;continue}if(t.ownerId===e&&(i[n++]=t),Ft(t,!0),t.right!==qe&&!Rn(t.right)){t=t.right;continue}}return Ft(o.root,!1),i}function lge(o){let e=o.root;const t=[];let i=0;for(;e!==qe;){if(Rn(e)){Ft(e.left,!1),Ft(e.right,!1),e=e.parent;continue}if(e.left!==qe&&!Rn(e.left)){e=e.left;continue}if(e.right!==qe&&!Rn(e.right)){e=e.right;continue}t[i++]=e,Ft(e,!0)}return Ft(o.root,!1),t}function cge(o,e,t,i,n,s){let r=o.root,a=0,l=0,c=0;const d=[];let h=0;for(;r!==qe;){if(Rn(r)){Ft(r.left,!1),Ft(r.right,!1),r===r.parent.right&&(a-=r.parent.delta),r=r.parent;continue}if(r.left!==qe&&!Rn(r.left)){r=r.left;continue}l=a+r.start,c=a+r.end,r.setCachedOffsets(l,c,n);let u=!0;if(e&&r.ownerId&&r.ownerId!==e&&(u=!1),t&&ZU(r)&&(u=!1),i&&JU(r)&&(u=!1),s&&!XU(r)&&(u=!1),u&&(d[h++]=r),Ft(r,!0),r.right!==qe&&!Rn(r.right)){a+=r.delta,r=r.right;continue}}return Ft(o.root,!1),d}function dge(o,e,t,i,n,s,r,a){let l=o.root,c=0,d=0,h=0,u=0;const f=[];let g=0;for(;l!==qe;){if(Rn(l)){Ft(l.left,!1),Ft(l.right,!1),l===l.parent.right&&(c-=l.parent.delta),l=l.parent;continue}if(!Rn(l.left)){if(d=c+l.maxEnd,d<e){Ft(l,!0);continue}if(l.left!==qe){l=l.left;continue}}if(h=c+l.start,h>t){Ft(l,!0);continue}if(u=c+l.end,u>=e){l.setCachedOffsets(h,u,r);let m=!0;i&&l.ownerId&&l.ownerId!==i&&(m=!1),n&&ZU(l)&&(m=!1),s&&JU(l)&&(m=!1),a&&!XU(l)&&(m=!1),m&&(f[g++]=l)}if(Ft(l,!0),l.right!==qe&&!Rn(l.right)){c+=l.delta,l=l.right;continue}}return Ft(o.root,!1),f}function s$(o,e){if(o.root===qe)return e.parent=qe,e.left=qe,e.right=qe,qt(e,0),o.root=e,o.root;hge(o,e),Rh(e.parent);let t=e;for(;t!==o.root&&Gs(t.parent)===1;)if(t.parent===t.parent.parent.left){const i=t.parent.parent.right;Gs(i)===1?(qt(t.parent,0),qt(i,0),qt(t.parent.parent,1),t=t.parent.parent):(t===t.parent.right&&(t=t.parent,Iv(o,t)),qt(t.parent,0),qt(t.parent.parent,1),Dv(o,t.parent.parent))}else{const i=t.parent.parent.left;Gs(i)===1?(qt(t.parent,0),qt(i,0),qt(t.parent.parent,1),t=t.parent.parent):(t===t.parent.left&&(t=t.parent,Dv(o,t)),qt(t.parent,0),qt(t.parent.parent,1),Iv(o,t.parent.parent))}return qt(o.root,0),e}function hge(o,e){let t=0,i=o.root;const n=e.start,s=e.end;for(;;)if(fge(n,s,i.start+t,i.end+t)<0)if(i.left===qe){e.start-=t,e.end-=t,e.maxEnd-=t,i.left=e;break}else i=i.left;else if(i.right===qe){e.start-=t+i.delta,e.end-=t+i.delta,e.maxEnd-=t+i.delta,i.right=e;break}else t+=i.delta,i=i.right;e.parent=i,e.left=qe,e.right=qe,qt(e,1)}function o$(o,e){let t,i;if(e.left===qe?(t=e.right,i=e,t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta):e.right===qe?(t=e.left,i=e):(i=uge(e.right),t=i.right,t.start+=i.delta,t.end+=i.delta,t.delta+=i.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),i.start+=e.delta,i.end+=e.delta,i.delta=e.delta,(i.delta<-1073741824||i.delta>1073741824)&&(o.requestNormalizeDelta=!0)),i===o.root){o.root=t,qt(t,0),e.detach(),MP(),Th(t),o.root.parent=qe;return}const n=Gs(i)===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?t.parent=i.parent:(i.parent===e?t.parent=i:t.parent=i.parent,i.left=e.left,i.right=e.right,i.parent=e.parent,qt(i,Gs(e)),e===o.root?o.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==qe&&(i.left.parent=i),i.right!==qe&&(i.right.parent=i)),e.detach(),n){Rh(t.parent),i!==e&&(Rh(i),Rh(i.parent)),MP();return}Rh(t),Rh(t.parent),i!==e&&(Rh(i),Rh(i.parent));let s;for(;t!==o.root&&Gs(t)===0;)t===t.parent.left?(s=t.parent.right,Gs(s)===1&&(qt(s,0),qt(t.parent,1),Iv(o,t.parent),s=t.parent.right),Gs(s.left)===0&&Gs(s.right)===0?(qt(s,1),t=t.parent):(Gs(s.right)===0&&(qt(s.left,0),qt(s,1),Dv(o,s),s=t.parent.right),qt(s,Gs(t.parent)),qt(t.parent,0),qt(s.right,0),Iv(o,t.parent),t=o.root)):(s=t.parent.left,Gs(s)===1&&(qt(s,0),qt(t.parent,1),Dv(o,t.parent),s=t.parent.left),Gs(s.left)===0&&Gs(s.right)===0?(qt(s,1),t=t.parent):(Gs(s.left)===0&&(qt(s.right,0),qt(s,1),Iv(o,s),s=t.parent.left),qt(s,Gs(t.parent)),qt(t.parent,0),qt(s.left,0),Dv(o,t.parent),t=o.root));qt(t,0),MP()}function uge(o){for(;o.left!==qe;)o=o.left;return o}function MP(){qe.parent=qe,qe.delta=0,qe.start=0,qe.end=0}function Iv(o,e){const t=e.right;t.delta+=e.delta,(t.delta<-1073741824||t.delta>1073741824)&&(o.requestNormalizeDelta=!0),t.start+=e.delta,t.end+=e.delta,e.right=t.left,t.left!==qe&&(t.left.parent=e),t.parent=e.parent,e.parent===qe?o.root=t:e===e.parent.left?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t,Th(e),Th(t)}function Dv(o,e){const t=e.left;e.delta-=t.delta,(e.delta<-1073741824||e.delta>1073741824)&&(o.requestNormalizeDelta=!0),e.start-=t.delta,e.end-=t.delta,e.left=t.right,t.right!==qe&&(t.right.parent=e),t.parent=e.parent,e.parent===qe?o.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t,Th(e),Th(t)}function r$(o){let e=o.end;if(o.left!==qe){const t=o.left.maxEnd;t>e&&(e=t)}if(o.right!==qe){const t=o.right.maxEnd+o.delta;t>e&&(e=t)}return e}function Th(o){o.maxEnd=r$(o)}function Rh(o){for(;o!==qe;){const e=r$(o);if(o.maxEnd===e)return;o.maxEnd=e,o=o.parent}}function fge(o,e,t,i){return o===t?e-i:o-t}class PP{constructor(e,t){this.piece=e,this.color=t,this.size_left=0,this.lf_left=0,this.parent=this,this.left=this,this.right=this}next(){if(this.right!==Oe)return AP(this.right);let e=this;for(;e.parent!==Oe&&e.parent.left!==e;)e=e.parent;return e.parent===Oe?Oe:e.parent}prev(){if(this.left!==Oe)return a$(this.left);let e=this;for(;e.parent!==Oe&&e.parent.right!==e;)e=e.parent;return e.parent===Oe?Oe:e.parent}detach(){this.parent=null,this.left=null,this.right=null}}const Oe=new PP(null,0);Oe.parent=Oe,Oe.left=Oe,Oe.right=Oe,Oe.color=0;function AP(o){for(;o.left!==Oe;)o=o.left;return o}function a$(o){for(;o.right!==Oe;)o=o.right;return o}function OP(o){return o===Oe?0:o.size_left+o.piece.length+OP(o.right)}function FP(o){return o===Oe?0:o.lf_left+o.piece.lineFeedCnt+FP(o.right)}function WP(){Oe.parent=Oe}function Ev(o,e){const t=e.right;t.size_left+=e.size_left+(e.piece?e.piece.length:0),t.lf_left+=e.lf_left+(e.piece?e.piece.lineFeedCnt:0),e.right=t.left,t.left!==Oe&&(t.left.parent=e),t.parent=e.parent,e.parent===Oe?o.root=t:e.parent.left===e?e.parent.left=t:e.parent.right=t,t.left=e,e.parent=t}function Nv(o,e){const t=e.left;e.left=t.right,t.right!==Oe&&(t.right.parent=e),t.parent=e.parent,e.size_left-=t.size_left+(t.piece?t.piece.length:0),e.lf_left-=t.lf_left+(t.piece?t.piece.lineFeedCnt:0),e.parent===Oe?o.root=t:e===e.parent.right?e.parent.right=t:e.parent.left=t,t.right=e,e.parent=t}function Cx(o,e){let t,i;if(e.left===Oe?(i=e,t=i.right):e.right===Oe?(i=e,t=i.left):(i=AP(e.right),t=i.right),i===o.root){o.root=t,t.color=0,e.detach(),WP(),o.root.parent=Oe;return}const n=i.color===1;if(i===i.parent.left?i.parent.left=t:i.parent.right=t,i===e?(t.parent=i.parent,Tv(o,t)):(i.parent===e?t.parent=i:t.parent=i.parent,Tv(o,t),i.left=e.left,i.right=e.right,i.parent=e.parent,i.color=e.color,e===o.root?o.root=i:e===e.parent.left?e.parent.left=i:e.parent.right=i,i.left!==Oe&&(i.left.parent=i),i.right!==Oe&&(i.right.parent=i),i.size_left=e.size_left,i.lf_left=e.lf_left,Tv(o,i)),e.detach(),t.parent.left===t){const r=OP(t),a=FP(t);if(r!==t.parent.size_left||a!==t.parent.lf_left){const l=r-t.parent.size_left,c=a-t.parent.lf_left;t.parent.size_left=r,t.parent.lf_left=a,Yc(o,t.parent,l,c)}}if(Tv(o,t.parent),n){WP();return}let s;for(;t!==o.root&&t.color===0;)t===t.parent.left?(s=t.parent.right,s.color===1&&(s.color=0,t.parent.color=1,Ev(o,t.parent),s=t.parent.right),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.right.color===0&&(s.left.color=0,s.color=1,Nv(o,s),s=t.parent.right),s.color=t.parent.color,t.parent.color=0,s.right.color=0,Ev(o,t.parent),t=o.root)):(s=t.parent.left,s.color===1&&(s.color=0,t.parent.color=1,Nv(o,t.parent),s=t.parent.left),s.left.color===0&&s.right.color===0?(s.color=1,t=t.parent):(s.left.color===0&&(s.right.color=0,s.color=1,Ev(o,s),s=t.parent.left),s.color=t.parent.color,t.parent.color=0,s.left.color=0,Nv(o,t.parent),t=o.root));t.color=0,WP()}function l$(o,e){for(Tv(o,e);e!==o.root&&e.parent.color===1;)if(e.parent===e.parent.parent.left){const t=e.parent.parent.right;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.right&&(e=e.parent,Ev(o,e)),e.parent.color=0,e.parent.parent.color=1,Nv(o,e.parent.parent))}else{const t=e.parent.parent.left;t.color===1?(e.parent.color=0,t.color=0,e.parent.parent.color=1,e=e.parent.parent):(e===e.parent.left&&(e=e.parent,Nv(o,e)),e.parent.color=0,e.parent.parent.color=1,Ev(o,e.parent.parent))}o.root.color=0}function Yc(o,e,t,i){for(;e!==o.root&&e!==Oe;)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}function Tv(o,e){let t=0,i=0;if(e!==o.root){for(;e!==o.root&&e===e.parent.right;)e=e.parent;if(e!==o.root)for(e=e.parent,t=OP(e.left)-e.size_left,i=FP(e.left)-e.lf_left,e.size_left+=t,e.lf_left+=i;e!==o.root&&(t!==0||i!==0);)e.parent.left===e&&(e.parent.size_left+=t,e.parent.lf_left+=i),e=e.parent}}const gge=999;class Kf{constructor(e,t,i,n){this.searchString=e,this.isRegex=t,this.matchCase=i,this.wordSeparators=n}parseSearchRequest(){if(this.searchString==="")return null;let e;this.isRegex?e=c$(this.searchString):e=this.searchString.indexOf(`
`)>=0;let t=null;try{t=JB(this.searchString,this.isRegex,{matchCase:this.matchCase,wholeWord:!1,multiline:e,global:!0,unicode:!0})}catch{return null}if(!t)return null;let i=!this.isRegex&&!e;return i&&this.searchString.toLowerCase()!==this.searchString.toUpperCase()&&(i=this.matchCase),new Coe(t,this.wordSeparators?Sr(this.wordSeparators,[]):null,i?this.searchString:null)}}function c$(o){if(!o||o.length===0)return!1;for(let e=0,t=o.length;e<t;e++){const i=o.charCodeAt(e);if(i===10)return!0;if(i===92){if(e++,e>=t)break;const n=o.charCodeAt(e);if(n===110||n===114||n===87)return!0}}return!1}function Gf(o,e,t){if(!t)return new E1(o,null);const i=[];for(let n=0,s=e.length;n<s;n++)i[n]=e[n];return new E1(o,i)}class d${constructor(e){const t=[];let i=0;for(let n=0,s=e.length;n<s;n++)e.charCodeAt(n)===10&&(t[i++]=n);this._lineFeedsOffsets=t}findLineFeedCountBeforeOffset(e){const t=this._lineFeedsOffsets;let i=0,n=t.length-1;if(n===-1||e<=t[0])return 0;for(;i<n;){const s=i+((n-i)/2>>0);t[s]>=e?n=s-1:t[s+1]>=e?(i=s,n=s):i=s+1}return i+1}}class vx{static findMatches(e,t,i,n,s){const r=t.parseSearchRequest();return r?r.regex.multiline?this._doFindMatchesMultiline(e,i,new M_(r.wordSeparators,r.regex),n,s):this._doFindMatchesLineByLine(e,i,r,n,s):[]}static _getMultilineMatchRange(e,t,i,n,s,r){let a,l=0;n?(l=n.findLineFeedCountBeforeOffset(s),a=t+s+l):a=t+s;let c;if(n){const f=n.findLineFeedCountBeforeOffset(s+r.length)-l;c=a+r.length+f}else c=a+r.length;const d=e.getPositionAt(a),h=e.getPositionAt(c);return new k(d.lineNumber,d.column,h.lineNumber,h.column)}static _doFindMatchesMultiline(e,t,i,n,s){const r=e.getOffsetAt(t.getStartPosition()),a=e.getValueInRange(t,1),l=e.getEOL()===`\r
`?new d$(a):null,c=[];let d=0,h;for(i.reset(0);h=i.next(a);)if(c[d++]=Gf(this._getMultilineMatchRange(e,r,a,l,h.index,h[0]),h,n),d>=s)return c;return c}static _doFindMatchesLineByLine(e,t,i,n,s){const r=[];let a=0;if(t.startLineNumber===t.endLineNumber){const c=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);return a=this._findMatchesInLine(i,c,t.startLineNumber,t.startColumn-1,a,r,n,s),r}const l=e.getLineContent(t.startLineNumber).substring(t.startColumn-1);a=this._findMatchesInLine(i,l,t.startLineNumber,t.startColumn-1,a,r,n,s);for(let c=t.startLineNumber+1;c<t.endLineNumber&&a<s;c++)a=this._findMatchesInLine(i,e.getLineContent(c),c,0,a,r,n,s);if(a<s){const c=e.getLineContent(t.endLineNumber).substring(0,t.endColumn-1);a=this._findMatchesInLine(i,c,t.endLineNumber,0,a,r,n,s)}return r}static _findMatchesInLine(e,t,i,n,s,r,a,l){const c=e.wordSeparators;if(!a&&e.simpleSearch){const u=e.simpleSearch,f=u.length,g=t.length;let m=-f;for(;(m=t.indexOf(u,m+f))!==-1;)if((!c||BP(c,t,g,m,f))&&(r[s++]=new E1(new k(i,m+1+n,i,m+1+f+n),null),s>=l))return s;return s}const d=new M_(e.wordSeparators,e.regex);let h;d.reset(0);do if(h=d.next(t),h&&(r[s++]=Gf(new k(i,h.index+1+n,i,h.index+1+h[0].length+n),h,a),s>=l))return s;while(h);return s}static findNextMatch(e,t,i,n){const s=t.parseSearchRequest();if(!s)return null;const r=new M_(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindNextMatchMultiline(e,i,r,n):this._doFindNextMatchLineByLine(e,i,r,n)}static _doFindNextMatchMultiline(e,t,i,n){const s=new M(t.lineNumber,1),r=e.getOffsetAt(s),a=e.getLineCount(),l=e.getValueInRange(new k(s.lineNumber,s.column,a,e.getLineMaxColumn(a)),1),c=e.getEOL()===`\r
`?new d$(l):null;i.reset(t.column-1);const d=i.next(l);return d?Gf(this._getMultilineMatchRange(e,r,l,c,d.index,d[0]),d,n):t.lineNumber!==1||t.column!==1?this._doFindNextMatchMultiline(e,new M(1,1),i,n):null}static _doFindNextMatchLineByLine(e,t,i,n){const s=e.getLineCount(),r=t.lineNumber,a=e.getLineContent(r),l=this._findFirstMatchInLine(i,a,r,t.column,n);if(l)return l;for(let c=1;c<=s;c++){const d=(r+c-1)%s,h=e.getLineContent(d+1),u=this._findFirstMatchInLine(i,h,d+1,1,n);if(u)return u}return null}static _findFirstMatchInLine(e,t,i,n,s){e.reset(n-1);const r=e.next(t);return r?Gf(new k(i,r.index+1,i,r.index+1+r[0].length),r,s):null}static findPreviousMatch(e,t,i,n){const s=t.parseSearchRequest();if(!s)return null;const r=new M_(s.wordSeparators,s.regex);return s.regex.multiline?this._doFindPreviousMatchMultiline(e,i,r,n):this._doFindPreviousMatchLineByLine(e,i,r,n)}static _doFindPreviousMatchMultiline(e,t,i,n){const s=this._doFindMatchesMultiline(e,new k(1,1,t.lineNumber,t.column),i,n,10*gge);if(s.length>0)return s[s.length-1];const r=e.getLineCount();return t.lineNumber!==r||t.column!==e.getLineMaxColumn(r)?this._doFindPreviousMatchMultiline(e,new M(r,e.getLineMaxColumn(r)),i,n):null}static _doFindPreviousMatchLineByLine(e,t,i,n){const s=e.getLineCount(),r=t.lineNumber,a=e.getLineContent(r).substring(0,t.column-1),l=this._findLastMatchInLine(i,a,r,n);if(l)return l;for(let c=1;c<=s;c++){const d=(s+r-c-1)%s,h=e.getLineContent(d+1),u=this._findLastMatchInLine(i,h,d+1,n);if(u)return u}return null}static _findLastMatchInLine(e,t,i,n){let s=null,r;for(e.reset(0);r=e.next(t);)s=Gf(new k(i,r.index+1,i,r.index+1+r[0].length),r,n);return s}}function pge(o,e,t,i,n){if(i===0)return!0;const s=e.charCodeAt(i-1);if(o.get(s)!==0||s===13||s===10)return!0;if(n>0){const r=e.charCodeAt(i);if(o.get(r)!==0)return!0}return!1}function mge(o,e,t,i,n){if(i+n===t)return!0;const s=e.charCodeAt(i+n);if(o.get(s)!==0||s===13||s===10)return!0;if(n>0){const r=e.charCodeAt(i+n-1);if(o.get(r)!==0)return!0}return!1}function BP(o,e,t,i,n){return pge(o,e,t,i,n)&&mge(o,e,t,i,n)}class M_{constructor(e,t){this._wordSeparators=e,this._searchRegex=t,this._prevMatchStartIndex=-1,this._prevMatchLength=0}reset(e){this._searchRegex.lastIndex=e,this._prevMatchStartIndex=-1,this._prevMatchLength=0}next(e){const t=e.length;let i;do{if(this._prevMatchStartIndex+this._prevMatchLength===t||(i=this._searchRegex.exec(e),!i))return null;const n=i.index,s=i[0].length;if(n===this._prevMatchStartIndex&&s===this._prevMatchLength){if(s===0){ry(e,t,this._searchRegex.lastIndex)>65535?this._searchRegex.lastIndex+=2:this._searchRegex.lastIndex+=1;continue}return null}if(this._prevMatchStartIndex=n,this._prevMatchLength=s,!this._wordSeparators||BP(this._wordSeparators,e,t,n,s))return i}while(i);return null}}const Xc=65535;function h$(o){let e;return o[o.length-1]<65536?e=new Uint16Array(o.length):e=new Uint32Array(o.length),e.set(o,0),e}class _ge{constructor(e,t,i,n,s){this.lineStarts=e,this.cr=t,this.lf=i,this.crlf=n,this.isBasicASCII=s}}function Qc(o,e=!0){const t=[0];let i=1;for(let n=0,s=o.length;n<s;n++){const r=o.charCodeAt(n);r===13?n+1<s&&o.charCodeAt(n+1)===10?(t[i++]=n+2,n++):t[i++]=n+1:r===10&&(t[i++]=n+1)}return e?h$(t):t}function bge(o,e){o.length=0,o[0]=0;let t=1,i=0,n=0,s=0,r=!0;for(let l=0,c=e.length;l<c;l++){const d=e.charCodeAt(l);d===13?l+1<c&&e.charCodeAt(l+1)===10?(s++,o[t++]=l+2,l++):(i++,o[t++]=l+1):d===10?(n++,o[t++]=l+1):r&&d!==9&&(d<32||d>126)&&(r=!1)}const a=new _ge(h$(o),i,n,s,r);return o.length=0,a}class bo{constructor(e,t,i,n,s){this.bufferIndex=e,this.start=t,this.end=i,this.lineFeedCnt=n,this.length=s}}class Zf{constructor(e,t){this.buffer=e,this.lineStarts=t}}class Cge{constructor(e,t){this._pieces=[],this._tree=e,this._BOM=t,this._index=0,e.root!==Oe&&e.iterate(e.root,i=>(i!==Oe&&this._pieces.push(i.piece),!0))}read(){return this._pieces.length===0?this._index===0?(this._index++,this._BOM):null:this._index>this._pieces.length-1?null:this._index===0?this._BOM+this._tree.getPieceContent(this._pieces[this._index++]):this._tree.getPieceContent(this._pieces[this._index++])}}class vge{constructor(e){this._limit=e,this._cache=[]}get(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartOffset<=e&&i.nodeStartOffset+i.node.piece.length>=e)return i}return null}get2(e){for(let t=this._cache.length-1;t>=0;t--){const i=this._cache[t];if(i.nodeStartLineNumber&&i.nodeStartLineNumber<e&&i.nodeStartLineNumber+i.node.piece.lineFeedCnt>=e)return i}return null}set(e){this._cache.length>=this._limit&&this._cache.shift(),this._cache.push(e)}validate(e){let t=!1;const i=this._cache;for(let n=0;n<i.length;n++){const s=i[n];if(s.node.parent===null||s.nodeStartOffset>=e){i[n]=null,t=!0;continue}}if(t){const n=[];for(const s of i)s!==null&&n.push(s);this._cache=n}}}class wge{constructor(e,t,i){this.create(e,t,i)}create(e,t,i){this._buffers=[new Zf("",[0])],this._lastChangeBufferPos={line:0,column:0},this.root=Oe,this._lineCnt=1,this._length=0,this._EOL=t,this._EOLLength=t.length,this._EOLNormalized=i;let n=null;for(let s=0,r=e.length;s<r;s++)if(e[s].buffer.length>0){e[s].lineStarts||(e[s].lineStarts=Qc(e[s].buffer));const a=new bo(s+1,{line:0,column:0},{line:e[s].lineStarts.length-1,column:e[s].buffer.length-e[s].lineStarts[e[s].lineStarts.length-1]},e[s].lineStarts.length-1,e[s].buffer.length);this._buffers.push(e[s]),n=this.rbInsertRight(n,a)}this._searchCache=new vge(1),this._lastVisitedLine={lineNumber:0,value:""},this.computeBufferMetadata()}normalizeEOL(e){const t=Xc,i=t-Math.floor(t/3),n=i*2;let s="",r=0;const a=[];if(this.iterate(this.root,l=>{const c=this.getNodeContent(l),d=c.length;if(r<=i||r+d<n)return s+=c,r+=d,!0;const h=s.replace(/\r\n|\r|\n/g,e);return a.push(new Zf(h,Qc(h))),s=c,r=d,!0}),r>0){const l=s.replace(/\r\n|\r|\n/g,e);a.push(new Zf(l,Qc(l)))}this.create(a,e,!0)}getEOL(){return this._EOL}setEOL(e){this._EOL=e,this._EOLLength=this._EOL.length,this.normalizeEOL(e)}createSnapshot(e){return new Cge(this,e)}getOffsetAt(e,t){let i=0,n=this.root;for(;n!==Oe;)if(n.left!==Oe&&n.lf_left+1>=e)n=n.left;else if(n.lf_left+n.piece.lineFeedCnt+1>=e){i+=n.size_left;const s=this.getAccumulatedValue(n,e-n.lf_left-2);return i+=s+t-1}else e-=n.lf_left+n.piece.lineFeedCnt,i+=n.size_left+n.piece.length,n=n.right;return i}getPositionAt(e){e=Math.floor(e),e=Math.max(0,e);let t=this.root,i=0;const n=e;for(;t!==Oe;)if(t.size_left!==0&&t.size_left>=e)t=t.left;else if(t.size_left+t.piece.length>=e){const s=this.getIndexOf(t,e-t.size_left);if(i+=t.lf_left+s.index,s.index===0){const r=this.getOffsetAt(i+1,1),a=n-r;return new M(i+1,a+1)}return new M(i+1,s.remainder+1)}else if(e-=t.size_left+t.piece.length,i+=t.lf_left+t.piece.lineFeedCnt,t.right===Oe){const s=this.getOffsetAt(i+1,1),r=n-e-s;return new M(i+1,r+1)}else t=t.right;return new M(1,1)}getValueInRange(e,t){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return"";const i=this.nodeAt2(e.startLineNumber,e.startColumn),n=this.nodeAt2(e.endLineNumber,e.endColumn),s=this.getValueInRange2(i,n);return t?t!==this._EOL||!this._EOLNormalized?s.replace(/\r\n|\r|\n/g,t):t===this.getEOL()&&this._EOLNormalized?s:s.replace(/\r\n|\r|\n/g,t):s}getValueInRange2(e,t){if(e.node===t.node){const a=e.node,l=this._buffers[a.piece.bufferIndex].buffer,c=this.offsetInBuffer(a.piece.bufferIndex,a.piece.start);return l.substring(c+e.remainder,c+t.remainder)}let i=e.node;const n=this._buffers[i.piece.bufferIndex].buffer,s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);let r=n.substring(s+e.remainder,s+i.piece.length);for(i=i.next();i!==Oe;){const a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(i===t.node){r+=a.substring(l,l+t.remainder);break}else r+=a.substr(l,i.piece.length);i=i.next()}return r}getLinesContent(){const e=[];let t=0,i="",n=!1;return this.iterate(this.root,s=>{if(s===Oe)return!0;const r=s.piece;let a=r.length;if(a===0)return!0;const l=this._buffers[r.bufferIndex].buffer,c=this._buffers[r.bufferIndex].lineStarts,d=r.start.line,h=r.end.line;let u=c[d]+r.start.column;if(n&&(l.charCodeAt(u)===10&&(u++,a--),e[t++]=i,i="",n=!1,a===0))return!0;if(d===h)return!this._EOLNormalized&&l.charCodeAt(u+a-1)===13?(n=!0,i+=l.substr(u,a-1)):i+=l.substr(u,a),!0;i+=this._EOLNormalized?l.substring(u,Math.max(u,c[d+1]-this._EOLLength)):l.substring(u,c[d+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;for(let f=d+1;f<h;f++)i=this._EOLNormalized?l.substring(c[f],c[f+1]-this._EOLLength):l.substring(c[f],c[f+1]).replace(/(\r\n|\r|\n)$/,""),e[t++]=i;return!this._EOLNormalized&&l.charCodeAt(c[h]+r.end.column-1)===13?(n=!0,r.end.column===0?t--:i=l.substr(c[h],r.end.column-1)):i=l.substr(c[h],r.end.column),!0}),n&&(e[t++]=i,i=""),e[t++]=i,e}getLength(){return this._length}getLineCount(){return this._lineCnt}getLineContent(e){return this._lastVisitedLine.lineNumber===e?this._lastVisitedLine.value:(this._lastVisitedLine.lineNumber=e,e===this._lineCnt?this._lastVisitedLine.value=this.getLineRawContent(e):this._EOLNormalized?this._lastVisitedLine.value=this.getLineRawContent(e,this._EOLLength):this._lastVisitedLine.value=this.getLineRawContent(e).replace(/(\r\n|\r|\n)$/,""),this._lastVisitedLine.value)}_getCharCode(e){if(e.remainder===e.node.piece.length){const t=e.node.next();if(!t)return 0;const i=this._buffers[t.piece.bufferIndex],n=this.offsetInBuffer(t.piece.bufferIndex,t.piece.start);return i.buffer.charCodeAt(n)}else{const t=this._buffers[e.node.piece.bufferIndex],n=this.offsetInBuffer(e.node.piece.bufferIndex,e.node.piece.start)+e.remainder;return t.buffer.charCodeAt(n)}}getLineCharCode(e,t){const i=this.nodeAt2(e,t+1);return this._getCharCode(i)}getLineLength(e){if(e===this.getLineCount()){const t=this.getOffsetAt(e,1);return this.getLength()-t}return this.getOffsetAt(e+1,1)-this.getOffsetAt(e,1)-this._EOLLength}getNearestChunk(e){const t=this.nodeAt(e);if(t.remainder===t.node.piece.length){const i=t.node.next();if(!i||i===Oe)return"";const n=this._buffers[i.piece.bufferIndex],s=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n.buffer.substring(s,s+i.piece.length)}else{const i=this._buffers[t.node.piece.bufferIndex],n=this.offsetInBuffer(t.node.piece.bufferIndex,t.node.piece.start),s=n+t.remainder,r=n+t.node.piece.length;return i.buffer.substring(s,r)}}findMatchesInNode(e,t,i,n,s,r,a,l,c,d,h){const u=this._buffers[e.piece.bufferIndex],f=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start),g=this.offsetInBuffer(e.piece.bufferIndex,s),m=this.offsetInBuffer(e.piece.bufferIndex,r);let _;const b={line:0,column:0};let C,w;t._wordSeparators?(C=u.buffer.substring(g,m),w=v=>v+g,t.reset(0)):(C=u.buffer,w=v=>v,t.reset(g));do if(_=t.next(C),_){if(w(_.index)>=m)return d;this.positionInBuffer(e,w(_.index)-f,b);const v=this.getLineFeedCnt(e.piece.bufferIndex,s,b),S=b.line===s.line?b.column-s.column+n:b.column+1,L=S+_[0].length;if(h[d++]=Gf(new k(i+v,S,i+v,L),_,l),w(_.index)+_[0].length>=m||d>=c)return d}while(_);return d}findMatchesLineByLine(e,t,i,n){const s=[];let r=0;const a=new M_(t.wordSeparators,t.regex);let l=this.nodeAt2(e.startLineNumber,e.startColumn);if(l===null)return[];const c=this.nodeAt2(e.endLineNumber,e.endColumn);if(c===null)return[];let d=this.positionInBuffer(l.node,l.remainder);const h=this.positionInBuffer(c.node,c.remainder);if(l.node===c.node)return this.findMatchesInNode(l.node,a,e.startLineNumber,e.startColumn,d,h,t,i,n,r,s),s;let u=e.startLineNumber,f=l.node;for(;f!==c.node;){const m=this.getLineFeedCnt(f.piece.bufferIndex,d,f.piece.end);if(m>=1){const b=this._buffers[f.piece.bufferIndex].lineStarts,C=this.offsetInBuffer(f.piece.bufferIndex,f.piece.start),w=b[d.line+m],v=u===e.startLineNumber?e.startColumn:1;if(r=this.findMatchesInNode(f,a,u,v,d,this.positionInBuffer(f,w-C),t,i,n,r,s),r>=n)return s;u+=m}const _=u===e.startLineNumber?e.startColumn-1:0;if(u===e.endLineNumber){const b=this.getLineContent(u).substring(_,e.endColumn-1);return r=this._findMatchesInLine(t,a,b,e.endLineNumber,_,r,s,i,n),s}if(r=this._findMatchesInLine(t,a,this.getLineContent(u).substr(_),u,_,r,s,i,n),r>=n)return s;u++,l=this.nodeAt2(u,1),f=l.node,d=this.positionInBuffer(l.node,l.remainder)}if(u===e.endLineNumber){const m=u===e.startLineNumber?e.startColumn-1:0,_=this.getLineContent(u).substring(m,e.endColumn-1);return r=this._findMatchesInLine(t,a,_,e.endLineNumber,m,r,s,i,n),s}const g=u===e.startLineNumber?e.startColumn:1;return r=this.findMatchesInNode(c.node,a,u,g,d,h,t,i,n,r,s),s}_findMatchesInLine(e,t,i,n,s,r,a,l,c){const d=e.wordSeparators;if(!l&&e.simpleSearch){const u=e.simpleSearch,f=u.length,g=i.length;let m=-f;for(;(m=i.indexOf(u,m+f))!==-1;)if((!d||BP(d,i,g,m,f))&&(a[r++]=new E1(new k(n,m+1+s,n,m+1+f+s),null),r>=c))return r;return r}let h;t.reset(0);do if(h=t.next(i),h&&(a[r++]=Gf(new k(n,h.index+1+s,n,h.index+1+h[0].length+s),h,l),r>=c))return r;while(h);return r}insert(e,t,i=!1){if(this._EOLNormalized=this._EOLNormalized&&i,this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",this.root!==Oe){const{node:n,remainder:s,nodeStartOffset:r}=this.nodeAt(e),a=n.piece,l=a.bufferIndex,c=this.positionInBuffer(n,s);if(n.piece.bufferIndex===0&&a.end.line===this._lastChangeBufferPos.line&&a.end.column===this._lastChangeBufferPos.column&&r+a.length===e&&t.length<Xc){this.appendToNode(n,t),this.computeBufferMetadata();return}if(r===e)this.insertContentToNodeLeft(t,n),this._searchCache.validate(e);else if(r+n.piece.length>e){const d=[];let h=new bo(a.bufferIndex,c,a.end,this.getLineFeedCnt(a.bufferIndex,c,a.end),this.offsetInBuffer(l,a.end)-this.offsetInBuffer(l,c));if(this.shouldCheckCRLF()&&this.endWithCR(t)&&this.nodeCharCodeAt(n,s)===10){const m={line:h.start.line+1,column:0};h=new bo(h.bufferIndex,m,h.end,this.getLineFeedCnt(h.bufferIndex,m,h.end),h.length-1),t+=`
`}if(this.shouldCheckCRLF()&&this.startWithLF(t))if(this.nodeCharCodeAt(n,s-1)===13){const m=this.positionInBuffer(n,s-1);this.deleteNodeTail(n,m),t="\r"+t,n.piece.length===0&&d.push(n)}else this.deleteNodeTail(n,c);else this.deleteNodeTail(n,c);const u=this.createNewPieces(t);h.length>0&&this.rbInsertRight(n,h);let f=n;for(let g=0;g<u.length;g++)f=this.rbInsertRight(f,u[g]);this.deleteNodes(d)}else this.insertContentToNodeRight(t,n)}else{const n=this.createNewPieces(t);let s=this.rbInsertLeft(null,n[0]);for(let r=1;r<n.length;r++)s=this.rbInsertRight(s,n[r])}this.computeBufferMetadata()}delete(e,t){if(this._lastVisitedLine.lineNumber=0,this._lastVisitedLine.value="",t<=0||this.root===Oe)return;const i=this.nodeAt(e),n=this.nodeAt(e+t),s=i.node,r=n.node;if(s===r){const u=this.positionInBuffer(s,i.remainder),f=this.positionInBuffer(s,n.remainder);if(i.nodeStartOffset===e){if(t===s.piece.length){const g=s.next();Cx(this,s),this.validateCRLFWithPrevNode(g),this.computeBufferMetadata();return}this.deleteNodeHead(s,f),this._searchCache.validate(e),this.validateCRLFWithPrevNode(s),this.computeBufferMetadata();return}if(i.nodeStartOffset+s.piece.length===e+t){this.deleteNodeTail(s,u),this.validateCRLFWithNextNode(s),this.computeBufferMetadata();return}this.shrinkNode(s,u,f),this.computeBufferMetadata();return}const a=[],l=this.positionInBuffer(s,i.remainder);this.deleteNodeTail(s,l),this._searchCache.validate(e),s.piece.length===0&&a.push(s);const c=this.positionInBuffer(r,n.remainder);this.deleteNodeHead(r,c),r.piece.length===0&&a.push(r);const d=s.next();for(let u=d;u!==Oe&&u!==r;u=u.next())a.push(u);const h=s.piece.length===0?s.prev():s;this.deleteNodes(a),this.validateCRLFWithNextNode(h),this.computeBufferMetadata()}insertContentToNodeLeft(e,t){const i=[];if(this.shouldCheckCRLF()&&this.endWithCR(e)&&this.startWithLF(t)){const r=t.piece,a={line:r.start.line+1,column:0},l=new bo(r.bufferIndex,a,r.end,this.getLineFeedCnt(r.bufferIndex,a,r.end),r.length-1);t.piece=l,e+=`
`,Yc(this,t,-1,-1),t.piece.length===0&&i.push(t)}const n=this.createNewPieces(e);let s=this.rbInsertLeft(t,n[n.length-1]);for(let r=n.length-2;r>=0;r--)s=this.rbInsertLeft(s,n[r]);this.validateCRLFWithPrevNode(s),this.deleteNodes(i)}insertContentToNodeRight(e,t){this.adjustCarriageReturnFromNext(e,t)&&(e+=`
`);const i=this.createNewPieces(e),n=this.rbInsertRight(t,i[0]);let s=n;for(let r=1;r<i.length;r++)s=this.rbInsertRight(s,i[r]);this.validateCRLFWithPrevNode(n)}positionInBuffer(e,t,i){const n=e.piece,s=e.piece.bufferIndex,r=this._buffers[s].lineStarts,l=r[n.start.line]+n.start.column+t;let c=n.start.line,d=n.end.line,h=0,u=0,f=0;for(;c<=d&&(h=c+(d-c)/2|0,f=r[h],h!==d);)if(u=r[h+1],l<f)d=h-1;else if(l>=u)c=h+1;else break;return i?(i.line=h,i.column=l-f,null):{line:h,column:l-f}}getLineFeedCnt(e,t,i){if(i.column===0)return i.line-t.line;const n=this._buffers[e].lineStarts;if(i.line===n.length-1)return i.line-t.line;const s=n[i.line+1],r=n[i.line]+i.column;if(s>r+1)return i.line-t.line;const a=r-1;return this._buffers[e].buffer.charCodeAt(a)===13?i.line-t.line+1:i.line-t.line}offsetInBuffer(e,t){return this._buffers[e].lineStarts[t.line]+t.column}deleteNodes(e){for(let t=0;t<e.length;t++)Cx(this,e[t])}createNewPieces(e){if(e.length>Xc){const d=[];for(;e.length>Xc;){const u=e.charCodeAt(Xc-1);let f;u===13||u>=55296&&u<=56319?(f=e.substring(0,Xc-1),e=e.substring(Xc-1)):(f=e.substring(0,Xc),e=e.substring(Xc));const g=Qc(f);d.push(new bo(this._buffers.length,{line:0,column:0},{line:g.length-1,column:f.length-g[g.length-1]},g.length-1,f.length)),this._buffers.push(new Zf(f,g))}const h=Qc(e);return d.push(new bo(this._buffers.length,{line:0,column:0},{line:h.length-1,column:e.length-h[h.length-1]},h.length-1,e.length)),this._buffers.push(new Zf(e,h)),d}let t=this._buffers[0].buffer.length;const i=Qc(e,!1);let n=this._lastChangeBufferPos;if(this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-1]===t&&t!==0&&this.startWithLF(e)&&this.endWithCR(this._buffers[0].buffer)){this._lastChangeBufferPos={line:this._lastChangeBufferPos.line,column:this._lastChangeBufferPos.column+1},n=this._lastChangeBufferPos;for(let d=0;d<i.length;d++)i[d]+=t+1;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+="_"+e,t+=1}else{if(t!==0)for(let d=0;d<i.length;d++)i[d]+=t;this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(i.slice(1)),this._buffers[0].buffer+=e}const s=this._buffers[0].buffer.length,r=this._buffers[0].lineStarts.length-1,a=s-this._buffers[0].lineStarts[r],l={line:r,column:a},c=new bo(0,n,l,this.getLineFeedCnt(0,n,l),s-t);return this._lastChangeBufferPos=l,[c]}getLineRawContent(e,t=0){let i=this.root,n="";const s=this._searchCache.get2(e);if(s){i=s.node;const r=this.getAccumulatedValue(i,e-s.nodeStartLineNumber-1),a=this._buffers[i.piece.bufferIndex].buffer,l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);if(s.nodeStartLineNumber+i.piece.lineFeedCnt===e)n=a.substring(l+r,l+i.piece.length);else{const c=this.getAccumulatedValue(i,e-s.nodeStartLineNumber);return a.substring(l+r,l+c-t)}}else{let r=0;const a=e;for(;i!==Oe;)if(i.left!==Oe&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this.getAccumulatedValue(i,e-i.lf_left-1),d=this._buffers[i.piece.bufferIndex].buffer,h=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return r+=i.size_left,this._searchCache.set({node:i,nodeStartOffset:r,nodeStartLineNumber:a-(e-1-i.lf_left)}),d.substring(h+l,h+c-t)}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const l=this.getAccumulatedValue(i,e-i.lf_left-2),c=this._buffers[i.piece.bufferIndex].buffer,d=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n=c.substring(d+l,d+i.piece.length);break}else e-=i.lf_left+i.piece.lineFeedCnt,r+=i.size_left+i.piece.length,i=i.right}for(i=i.next();i!==Oe;){const r=this._buffers[i.piece.bufferIndex].buffer;if(i.piece.lineFeedCnt>0){const a=this.getAccumulatedValue(i,0),l=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);return n+=r.substring(l,l+a-t),n}else{const a=this.offsetInBuffer(i.piece.bufferIndex,i.piece.start);n+=r.substr(a,i.piece.length)}i=i.next()}return n}computeBufferMetadata(){let e=this.root,t=1,i=0;for(;e!==Oe;)t+=e.lf_left+e.piece.lineFeedCnt,i+=e.size_left+e.piece.length,e=e.right;this._lineCnt=t,this._length=i,this._searchCache.validate(this._length)}getIndexOf(e,t){const i=e.piece,n=this.positionInBuffer(e,t),s=n.line-i.start.line;if(this.offsetInBuffer(i.bufferIndex,i.end)-this.offsetInBuffer(i.bufferIndex,i.start)===t){const r=this.getLineFeedCnt(e.piece.bufferIndex,i.start,n);if(r!==s)return{index:r,remainder:0}}return{index:s,remainder:n.column}}getAccumulatedValue(e,t){if(t<0)return 0;const i=e.piece,n=this._buffers[i.bufferIndex].lineStarts,s=i.start.line+t+1;return s>i.end.line?n[i.end.line]+i.end.column-n[i.start.line]-i.start.column:n[s]-n[i.start.line]-i.start.column}deleteNodeTail(e,t){const i=e.piece,n=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.end),r=t,a=this.offsetInBuffer(i.bufferIndex,r),l=this.getLineFeedCnt(i.bufferIndex,i.start,r),c=l-n,d=a-s,h=i.length+d;e.piece=new bo(i.bufferIndex,i.start,r,l,h),Yc(this,e,d,c)}deleteNodeHead(e,t){const i=e.piece,n=i.lineFeedCnt,s=this.offsetInBuffer(i.bufferIndex,i.start),r=t,a=this.getLineFeedCnt(i.bufferIndex,r,i.end),l=this.offsetInBuffer(i.bufferIndex,r),c=a-n,d=s-l,h=i.length+d;e.piece=new bo(i.bufferIndex,r,i.end,a,h),Yc(this,e,d,c)}shrinkNode(e,t,i){const n=e.piece,s=n.start,r=n.end,a=n.length,l=n.lineFeedCnt,c=t,d=this.getLineFeedCnt(n.bufferIndex,n.start,c),h=this.offsetInBuffer(n.bufferIndex,t)-this.offsetInBuffer(n.bufferIndex,s);e.piece=new bo(n.bufferIndex,n.start,c,d,h),Yc(this,e,h-a,d-l);const u=new bo(n.bufferIndex,i,r,this.getLineFeedCnt(n.bufferIndex,i,r),this.offsetInBuffer(n.bufferIndex,r)-this.offsetInBuffer(n.bufferIndex,i)),f=this.rbInsertRight(e,u);this.validateCRLFWithPrevNode(f)}appendToNode(e,t){this.adjustCarriageReturnFromNext(t,e)&&(t+=`
`);const i=this.shouldCheckCRLF()&&this.startWithLF(t)&&this.endWithCR(e),n=this._buffers[0].buffer.length;this._buffers[0].buffer+=t;const s=Qc(t,!1);for(let f=0;f<s.length;f++)s[f]+=n;if(i){const f=this._buffers[0].lineStarts[this._buffers[0].lineStarts.length-2];this._buffers[0].lineStarts.pop(),this._lastChangeBufferPos={line:this._lastChangeBufferPos.line-1,column:n-f}}this._buffers[0].lineStarts=this._buffers[0].lineStarts.concat(s.slice(1));const r=this._buffers[0].lineStarts.length-1,a=this._buffers[0].buffer.length-this._buffers[0].lineStarts[r],l={line:r,column:a},c=e.piece.length+t.length,d=e.piece.lineFeedCnt,h=this.getLineFeedCnt(0,e.piece.start,l),u=h-d;e.piece=new bo(e.piece.bufferIndex,e.piece.start,l,h,c),this._lastChangeBufferPos=l,Yc(this,e,t.length,u)}nodeAt(e){let t=this.root;const i=this._searchCache.get(e);if(i)return{node:i.node,nodeStartOffset:i.nodeStartOffset,remainder:e-i.nodeStartOffset};let n=0;for(;t!==Oe;)if(t.size_left>e)t=t.left;else if(t.size_left+t.piece.length>=e){n+=t.size_left;const s={node:t,remainder:e-t.size_left,nodeStartOffset:n};return this._searchCache.set(s),s}else e-=t.size_left+t.piece.length,n+=t.size_left+t.piece.length,t=t.right;return null}nodeAt2(e,t){let i=this.root,n=0;for(;i!==Oe;)if(i.left!==Oe&&i.lf_left>=e-1)i=i.left;else if(i.lf_left+i.piece.lineFeedCnt>e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2),r=this.getAccumulatedValue(i,e-i.lf_left-1);return n+=i.size_left,{node:i,remainder:Math.min(s+t-1,r),nodeStartOffset:n}}else if(i.lf_left+i.piece.lineFeedCnt===e-1){const s=this.getAccumulatedValue(i,e-i.lf_left-2);if(s+t-1<=i.piece.length)return{node:i,remainder:s+t-1,nodeStartOffset:n};t-=i.piece.length-s;break}else e-=i.lf_left+i.piece.lineFeedCnt,n+=i.size_left+i.piece.length,i=i.right;for(i=i.next();i!==Oe;){if(i.piece.lineFeedCnt>0){const s=this.getAccumulatedValue(i,0),r=this.offsetOfNode(i);return{node:i,remainder:Math.min(t-1,s),nodeStartOffset:r}}else if(i.piece.length>=t-1){const s=this.offsetOfNode(i);return{node:i,remainder:t-1,nodeStartOffset:s}}else t-=i.piece.length;i=i.next()}return null}nodeCharCodeAt(e,t){if(e.piece.lineFeedCnt<1)return-1;const i=this._buffers[e.piece.bufferIndex],n=this.offsetInBuffer(e.piece.bufferIndex,e.piece.start)+t;return i.buffer.charCodeAt(n)}offsetOfNode(e){if(!e)return 0;let t=e.size_left;for(;e!==this.root;)e.parent.right===e&&(t+=e.parent.size_left+e.parent.piece.length),e=e.parent;return t}shouldCheckCRLF(){return!(this._EOLNormalized&&this._EOL===`
`)}startWithLF(e){if(typeof e=="string")return e.charCodeAt(0)===10;if(e===Oe||e.piece.lineFeedCnt===0)return!1;const t=e.piece,i=this._buffers[t.bufferIndex].lineStarts,n=t.start.line,s=i[n]+t.start.column;return n===i.length-1||i[n+1]>s+1?!1:this._buffers[t.bufferIndex].buffer.charCodeAt(s)===10}endWithCR(e){return typeof e=="string"?e.charCodeAt(e.length-1)===13:e===Oe||e.piece.lineFeedCnt===0?!1:this.nodeCharCodeAt(e,e.piece.length-1)===13}validateCRLFWithPrevNode(e){if(this.shouldCheckCRLF()&&this.startWithLF(e)){const t=e.prev();this.endWithCR(t)&&this.fixCRLF(t,e)}}validateCRLFWithNextNode(e){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const t=e.next();this.startWithLF(t)&&this.fixCRLF(e,t)}}fixCRLF(e,t){const i=[],n=this._buffers[e.piece.bufferIndex].lineStarts;let s;e.piece.end.column===0?s={line:e.piece.end.line-1,column:n[e.piece.end.line]-n[e.piece.end.line-1]-1}:s={line:e.piece.end.line,column:e.piece.end.column-1};const r=e.piece.length-1,a=e.piece.lineFeedCnt-1;e.piece=new bo(e.piece.bufferIndex,e.piece.start,s,a,r),Yc(this,e,-1,-1),e.piece.length===0&&i.push(e);const l={line:t.piece.start.line+1,column:0},c=t.piece.length-1,d=this.getLineFeedCnt(t.piece.bufferIndex,l,t.piece.end);t.piece=new bo(t.piece.bufferIndex,l,t.piece.end,d,c),Yc(this,t,-1,-1),t.piece.length===0&&i.push(t);const h=this.createNewPieces(`\r
`);this.rbInsertRight(e,h[0]);for(let u=0;u<i.length;u++)Cx(this,i[u])}adjustCarriageReturnFromNext(e,t){if(this.shouldCheckCRLF()&&this.endWithCR(e)){const i=t.next();if(this.startWithLF(i)){if(e+=`
`,i.piece.length===1)Cx(this,i);else{const n=i.piece,s={line:n.start.line+1,column:0},r=n.length-1,a=this.getLineFeedCnt(n.bufferIndex,s,n.end);i.piece=new bo(n.bufferIndex,s,n.end,a,r),Yc(this,i,-1,-1)}return!0}}return!1}iterate(e,t){if(e===Oe)return t(Oe);const i=this.iterate(e.left,t);return i&&t(e)&&this.iterate(e.right,t)}getNodeContent(e){if(e===Oe)return"";const t=this._buffers[e.piece.bufferIndex],i=e.piece,n=this.offsetInBuffer(i.bufferIndex,i.start),s=this.offsetInBuffer(i.bufferIndex,i.end);return t.buffer.substring(n,s)}getPieceContent(e){const t=this._buffers[e.bufferIndex],i=this.offsetInBuffer(e.bufferIndex,e.start),n=this.offsetInBuffer(e.bufferIndex,e.end);return t.buffer.substring(i,n)}rbInsertRight(e,t){const i=new PP(t,1);if(i.left=Oe,i.right=Oe,i.parent=Oe,i.size_left=0,i.lf_left=0,this.root===Oe)this.root=i,i.color=0;else if(e.right===Oe)e.right=i,i.parent=e;else{const s=AP(e.right);s.left=i,i.parent=s}return l$(this,i),i}rbInsertLeft(e,t){const i=new PP(t,1);if(i.left=Oe,i.right=Oe,i.parent=Oe,i.size_left=0,i.lf_left=0,this.root===Oe)this.root=i,i.color=0;else if(e.left===Oe)e.left=i,i.parent=e;else{const n=a$(e.left);n.right=i,i.parent=n}return l$(this,i),i}}class P_ extends A{constructor(e,t,i,n,s,r,a){super(),this._onDidChangeContent=this._register(new P),this._BOM=t,this._mightContainNonBasicASCII=!r,this._mightContainRTL=n,this._mightContainUnusualLineTerminators=s,this._pieceTree=new wge(e,i,a)}mightContainRTL(){return this._mightContainRTL}mightContainUnusualLineTerminators(){return this._mightContainUnusualLineTerminators}resetMightContainUnusualLineTerminators(){this._mightContainUnusualLineTerminators=!1}mightContainNonBasicASCII(){return this._mightContainNonBasicASCII}getBOM(){return this._BOM}getEOL(){return this._pieceTree.getEOL()}createSnapshot(e){return this._pieceTree.createSnapshot(e?this._BOM:"")}getOffsetAt(e,t){return this._pieceTree.getOffsetAt(e,t)}getPositionAt(e){return this._pieceTree.getPositionAt(e)}getRangeAt(e,t){const i=e+t,n=this.getPositionAt(e),s=this.getPositionAt(i);return new k(n.lineNumber,n.column,s.lineNumber,s.column)}getValueInRange(e,t=0){if(e.isEmpty())return"";const i=this._getEndOfLine(t);return this._pieceTree.getValueInRange(e,i)}getValueLengthInRange(e,t=0){if(e.isEmpty())return 0;if(e.startLineNumber===e.endLineNumber)return e.endColumn-e.startColumn;const i=this.getOffsetAt(e.startLineNumber,e.startColumn),n=this.getOffsetAt(e.endLineNumber,e.endColumn);let s=0;const r=this._getEndOfLine(t),a=this.getEOL();if(r.length!==a.length){const l=r.length-a.length,c=e.endLineNumber-e.startLineNumber;s=l*c}return n-i+s}getCharacterCountInRange(e,t=0){if(this._mightContainNonBasicASCII){let i=0;const n=e.startLineNumber,s=e.endLineNumber;for(let r=n;r<=s;r++){const a=this.getLineContent(r),l=r===n?e.startColumn-1:0,c=r===s?e.endColumn-1:a.length;for(let d=l;d<c;d++)zi(a.charCodeAt(d))?(i=i+1,d=d+1):i=i+1}return i+=this._getEndOfLine(t).length*(s-n),i}return this.getValueLengthInRange(e,t)}getNearestChunk(e){return this._pieceTree.getNearestChunk(e)}getLength(){return this._pieceTree.getLength()}getLineCount(){return this._pieceTree.getLineCount()}getLinesContent(){return this._pieceTree.getLinesContent()}getLineContent(e){return this._pieceTree.getLineContent(e)}getLineCharCode(e,t){return this._pieceTree.getLineCharCode(e,t)}getLineLength(e){return this._pieceTree.getLineLength(e)}getLineFirstNonWhitespaceColumn(e){const t=es(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){const t=Kr(this.getLineContent(e));return t===-1?0:t+2}_getEndOfLine(e){switch(e){case 1:return`
`;case 2:return`\r
`;case 0:return this.getEOL();default:throw new Error("Unknown EOL preference")}}setEOL(e){this._pieceTree.setEOL(e)}applyEdits(e,t,i){let n=this._mightContainRTL,s=this._mightContainUnusualLineTerminators,r=this._mightContainNonBasicASCII,a=!0,l=[];for(let m=0;m<e.length;m++){const _=e[m];a&&_._isTracked&&(a=!1);const b=_.range;if(_.text){let L=!0;r||(L=!c1(_.text),r=L),!n&&L&&(n=Tm(_.text)),!s&&L&&(s=n6(_.text))}let C="",w=0,v=0,S=0;if(_.text){let L;[w,v,S,L]=Dh(_.text);const x=this.getEOL();L===0||L===(x===`\r
`?2:1)?C=_.text:C=_.text.replace(/\r\n|\r|\n/g,x)}l[m]={sortIndex:m,identifier:_.identifier||null,range:b,rangeOffset:this.getOffsetAt(b.startLineNumber,b.startColumn),rangeLength:this.getValueLengthInRange(b),text:C,eolCount:w,firstLineLength:v,lastLineLength:S,forceMoveMarkers:!!_.forceMoveMarkers,isAutoWhitespaceEdit:_.isAutoWhitespaceEdit||!1}}l.sort(P_._sortOpsAscending);let c=!1;for(let m=0,_=l.length-1;m<_;m++){const b=l[m].range.getEndPosition(),C=l[m+1].range.getStartPosition();if(C.isBeforeOrEqual(b)){if(C.isBefore(b))throw new Error("Overlapping ranges are not allowed!");c=!0}}a&&(l=this._reduceOperations(l));const d=i||t?P_._getInverseEditRanges(l):[],h=[];if(t)for(let m=0;m<l.length;m++){const _=l[m],b=d[m];if(_.isAutoWhitespaceEdit&&_.range.isEmpty())for(let C=b.startLineNumber;C<=b.endLineNumber;C++){let w="";C===b.startLineNumber&&(w=this.getLineContent(_.range.startLineNumber),es(w)!==-1)||h.push({lineNumber:C,oldContent:w})}}let u=null;if(i){let m=0;u=[];for(let _=0;_<l.length;_++){const b=l[_],C=d[_],w=this.getValueInRange(b.range),v=b.rangeOffset+m;m+=b.text.length-w.length,u[_]={sortIndex:b.sortIndex,identifier:b.identifier,range:C,text:w,textChange:new Tn(b.rangeOffset,w,v,b.text)}}c||u.sort((_,b)=>_.sortIndex-b.sortIndex)}this._mightContainRTL=n,this._mightContainUnusualLineTerminators=s,this._mightContainNonBasicASCII=r;const f=this._doApplyEdits(l);let g=null;if(t&&h.length>0){h.sort((m,_)=>_.lineNumber-m.lineNumber),g=[];for(let m=0,_=h.length;m<_;m++){const b=h[m].lineNumber;if(m>0&&h[m-1].lineNumber===b)continue;const C=h[m].oldContent,w=this.getLineContent(b);w.length===0||w===C||es(w)!==-1||g.push(b)}}return this._onDidChangeContent.fire(),new voe(u,f,g)}_reduceOperations(e){return e.length<1e3?e:[this._toSingleEditOperation(e)]}_toSingleEditOperation(e){let t=!1;const i=e[0].range,n=e[e.length-1].range,s=new k(i.startLineNumber,i.startColumn,n.endLineNumber,n.endColumn);let r=i.startLineNumber,a=i.startColumn;const l=[];for(let f=0,g=e.length;f<g;f++){const m=e[f],_=m.range;t=t||m.forceMoveMarkers,l.push(this.getValueInRange(new k(r,a,_.startLineNumber,_.startColumn))),m.text.length>0&&l.push(m.text),r=_.endLineNumber,a=_.endColumn}const c=l.join(""),[d,h,u]=Dh(c);return{sortIndex:0,identifier:e[0].identifier,range:s,rangeOffset:this.getOffsetAt(s.startLineNumber,s.startColumn),rangeLength:this.getValueLengthInRange(s,0),text:c,eolCount:d,firstLineLength:h,lastLineLength:u,forceMoveMarkers:t,isAutoWhitespaceEdit:!1}}_doApplyEdits(e){e.sort(P_._sortOpsDescending);const t=[];for(let i=0;i<e.length;i++){const n=e[i],s=n.range.startLineNumber,r=n.range.startColumn,a=n.range.endLineNumber,l=n.range.endColumn;if(s===a&&r===l&&n.text.length===0)continue;n.text?(this._pieceTree.delete(n.rangeOffset,n.rangeLength),this._pieceTree.insert(n.rangeOffset,n.text,!0)):this._pieceTree.delete(n.rangeOffset,n.rangeLength);const c=new k(s,r,a,l);t.push({range:c,rangeLength:n.rangeLength,text:n.text,rangeOffset:n.rangeOffset,forceMoveMarkers:n.forceMoveMarkers})}return t}findMatchesLineByLine(e,t,i,n){return this._pieceTree.findMatchesLineByLine(e,t,i,n)}static _getInverseEditRanges(e){const t=[];let i=0,n=0,s=null;for(let r=0,a=e.length;r<a;r++){const l=e[r];let c,d;s?s.range.endLineNumber===l.range.startLineNumber?(c=i,d=n+(l.range.startColumn-s.range.endColumn)):(c=i+(l.range.startLineNumber-s.range.endLineNumber),d=l.range.startColumn):(c=l.range.startLineNumber,d=l.range.startColumn);let h;if(l.text.length>0){const u=l.eolCount+1;u===1?h=new k(c,d,c,d+l.firstLineLength):h=new k(c,d,c+u-1,l.lastLineLength+1)}else h=new k(c,d,c,d);i=h.endLineNumber,n=h.endColumn,t.push(h),s=l}return t}static _sortOpsAscending(e,t){const i=k.compareRangesUsingEnds(e.range,t.range);return i===0?e.sortIndex-t.sortIndex:i}static _sortOpsDescending(e,t){const i=k.compareRangesUsingEnds(e.range,t.range);return i===0?t.sortIndex-e.sortIndex:-i}}class Sge{constructor(e,t,i,n,s,r,a,l,c){this._chunks=e,this._bom=t,this._cr=i,this._lf=n,this._crlf=s,this._containsRTL=r,this._containsUnusualLineTerminators=a,this._isBasicASCII=l,this._normalizeEOL=c}_getEOL(e){const t=this._cr+this._lf+this._crlf,i=this._cr+this._crlf;return t===0?e===1?`
`:`\r
`:i>t/2?`\r
`:`
`}create(e){const t=this._getEOL(e),i=this._chunks;if(this._normalizeEOL&&(t===`\r
`&&(this._cr>0||this._lf>0)||t===`
`&&(this._cr>0||this._crlf>0)))for(let s=0,r=i.length;s<r;s++){const a=i[s].buffer.replace(/\r\n|\r|\n/g,t),l=Qc(a);i[s]=new Zf(a,l)}const n=new P_(i,this._bom,t,this._containsRTL,this._containsUnusualLineTerminators,this._isBasicASCII,this._normalizeEOL);return{textBuffer:n,disposable:n}}}class u${constructor(){this.chunks=[],this.BOM="",this._hasPreviousChar=!1,this._previousChar=0,this._tmpLineStarts=[],this.cr=0,this.lf=0,this.crlf=0,this.containsRTL=!1,this.containsUnusualLineTerminators=!1,this.isBasicASCII=!0}acceptChunk(e){if(e.length===0)return;this.chunks.length===0&&yR(e)&&(this.BOM=Tie,e=e.substr(1));const t=e.charCodeAt(e.length-1);t===13||t>=55296&&t<=56319?(this._acceptChunk1(e.substr(0,e.length-1),!1),this._hasPreviousChar=!0,this._previousChar=t):(this._acceptChunk1(e,!1),this._hasPreviousChar=!1,this._previousChar=t)}_acceptChunk1(e,t){!t&&e.length===0||(this._hasPreviousChar?this._acceptChunk2(String.fromCharCode(this._previousChar)+e):this._acceptChunk2(e))}_acceptChunk2(e){const t=bge(this._tmpLineStarts,e);this.chunks.push(new Zf(e,t.lineStarts)),this.cr+=t.cr,this.lf+=t.lf,this.crlf+=t.crlf,t.isBasicASCII||(this.isBasicASCII=!1,this.containsRTL||(this.containsRTL=Tm(e)),this.containsUnusualLineTerminators||(this.containsUnusualLineTerminators=n6(e)))}finish(e=!0){return this._finish(),new Sge(this.chunks,this.BOM,this.cr,this.lf,this.crlf,this.containsRTL,this.containsUnusualLineTerminators,this.isBasicASCII,e)}_finish(){if(this.chunks.length===0&&this._acceptChunk1("",!0),this._hasPreviousChar){this._hasPreviousChar=!1;const e=this.chunks[this.chunks.length-1];e.buffer+=String.fromCharCode(this._previousChar);const t=Qc(e.buffer);e.lineStarts=t,this._previousChar===13&&this.cr++}}}class yge{constructor(){this._onDidChangeVisibleRanges=new P,this.onDidChangeVisibleRanges=this._onDidChangeVisibleRanges.event,this._views=new Set,this._viewsChanged=_r(this),this.visibleLineRanges=In({owner:this,equalsFn:f1(UR())},e=>(this._viewsChanged.read(e),ke.joinMany([...this._views].map(i=>i.state.read(e)?.visibleLineRanges??[]))))}attachView(){const e=new xge(t=>{this._onDidChangeVisibleRanges.fire({view:e,state:t})});return this._views.add(e),this._viewsChanged.trigger(void 0),e}detachView(e){this._views.delete(e),this._onDidChangeVisibleRanges.fire({view:e,state:void 0}),this._viewsChanged.trigger(void 0)}}class Lge{constructor(e,t){this.visibleLineRanges=e,this.stabilized=t}equals(e){return this===e?!0:!(!Ut(this.visibleLineRanges,e.visibleLineRanges,(t,i)=>t.equals(i))||this.stabilized!==e.stabilized)}}class xge{get state(){return this._state}constructor(e){this.handleStateChange=e,this._state=m1({owner:this,equalsFn:rf((t,i)=>t.equals(i))},void 0)}setVisibleLines(e,t){const i=e.map(s=>new ke(s.startLineNumber,s.endLineNumber+1)),n=new Lge(i,t);this._state.set(n,void 0,void 0),this.handleStateChange(n)}}class kge extends A{get lineRanges(){return this._lineRanges}constructor(e){super(),this._refreshTokens=e,this.runner=this._register(new wt(()=>this.update(),50)),this._computedLineRanges=[],this._lineRanges=[]}update(){Ut(this._computedLineRanges,this._lineRanges,(e,t)=>e.equals(t))||(this._computedLineRanges=this._lineRanges,this._refreshTokens())}handleStateChange(e){this._lineRanges=e.visibleLineRanges,e.stabilized?(this.runner.cancel(),this.update()):this.runner.schedule()}}class f$ extends A{get backgroundTokenizationState(){return this._backgroundTokenizationState}constructor(e,t){super(),this._languageIdCodec=e,this._textModel=t,this._onDidChangeTokens=this._register(new P),this.onDidChangeTokens=this._onDidChangeTokens.event}tokenizeIfCheap(e){this.isCheapToTokenize(e)&&this.forceTokenization(e)}}function Ige(o,e){const t=o.gotoNextSibling(),i=e.gotoNextSibling();if(t!==i)throw new Error("Trees are out of sync");return t&&i}function g$(o,e){const t=o.gotoParent(),i=e.gotoParent();if(t!==i)throw new Error("Trees are out of sync");return t&&i}function Dge(o,e,t){const i=o.gotoFirstChild(),n=e.gotoFirstChild();if(i!==n)throw new Error("Trees are out of sync");if(t===0)return i&&n;for(let s=1;s<=t;s++){const r=o.gotoNextSibling(),a=e.gotoNextSibling();if(r!==a)throw new Error("Trees are out of sync");if(!r||!a)return!1}return i&&n}function p$(o,e){do{if(o.currentNode.nextSibling)return Ige(o,e);o.currentNode.parent&&g$(o,e)}while(o.currentNode.nextSibling||o.currentNode.parent);return!1}function Ege(o,e){const t=e.walk();t.resetTo(o);const i=o.currentNode;do if(t.currentNode.previousSibling&&t.currentNode.endIndex-t.currentNode.startIndex!==0)t.gotoPreviousSibling();else{for(;!t.currentNode.previousSibling&&t.currentNode.parent;)t.gotoParent();t.gotoPreviousSibling()}while(t.currentNode.endIndex>i.startIndex&&(t.currentNode.parent||t.currentNode.previousSibling)&&t.currentNode.id!==i.id);if(t.currentNode.id!==i.id&&t.currentNode.endIndex<=i.startIndex)return t.currentNode}var Nge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},m$=function(o,e){return function(t,i){e(t,i,o)}};let HP=class extends A{constructor(e,t,i,n,s,r,a){super(),this.languageId=e,this._ranges=t,this._parser=i,this._parserClass=n,this.textModel=s,this._logService=r,this._telemetryService=a,this._tree=Le(this,void 0),this.tree=this._tree,this._treeLastParsedVersion=Le(this,-1),this.treeLastParsedVersion=this._treeLastParsedVersion,this._onDidChangeContentQueue=new _ie,this._tree=Le(this,void 0),this.tree=this._tree,this._register(ue(()=>{this._tree.get()?.delete(),this._lastFullyParsed?.delete(),this._lastFullyParsedWithEdits?.delete(),this._parser.delete()})),this.handleContentChange(void 0,this._ranges)}handleContentChange(e,t){const i=this.textModel.getVersionId();let n=[];t&&(n=this._setRanges(t)),e&&this._applyEdits(e.changes),this._onDidChangeContentQueue.clearPending(),this._onDidChangeContentQueue.schedule(async()=>{if(this._store.isDisposed)return;const s=this._lastFullyParsed;let r;this._lastFullyParsedWithEdits&&this._lastFullyParsed&&(r=this._findChangedNodes(this._lastFullyParsedWithEdits,this._lastFullyParsed));const a=await this._parseAndUpdateTree(i);if(a){let l;r?s&&r&&(l=this._findTreeChanges(a,r,n)):this._ranges&&(l=this._ranges.map(d=>({newRange:new k(d.startPosition.row+1,d.startPosition.column+1,d.endPosition.row+1,d.endPosition.column+1),oldRangeLength:d.endIndex-d.startIndex,newRangeStartOffset:d.startIndex,newRangeEndOffset:d.endIndex}))),l||(l=[{newRange:this.textModel.getFullModelRange(),newRangeStartOffset:0,newRangeEndOffset:this.textModel.getValueLength()}]);const c=this._tree.get();Dt(d=>{this._tree.set(a,d,{ranges:l,versionId:i}),this._treeLastParsedVersion.set(i,d)}),c?.delete()}})}_applyEdits(e){for(const t of e){const i=$i.ofRange(k.lift(t.range)),n=$i.ofText(t.text),s=t.text.length===0?n:i.add(n),r={startIndex:t.rangeOffset,oldEndIndex:t.rangeOffset+t.rangeLength,newEndIndex:t.rangeOffset+t.text.length,startPosition:{row:t.range.startLineNumber-1,column:t.range.startColumn-1},oldEndPosition:{row:t.range.endLineNumber-1,column:t.range.endColumn-1},newEndPosition:{row:t.range.startLineNumber+s.lineCount-1,column:s.lineCount?s.columnCount:t.range.endColumn+s.columnCount}};this._tree.get()?.edit(r),this._lastFullyParsedWithEdits?.edit(r)}}_findChangedNodes(e,t){if(this._ranges&&this._ranges.every(a=>a.startPosition.row!==e.rootNode.startPosition.row)||e.rootNode.startPosition.row!==0)return[];const i=e.walk(),n=t.walk(),s=[];let r=!0;do if(i.currentNode.hasChanges){const a=i.currentNode.children,l=[],c=a.filter((d,h)=>d?.hasChanges||n.currentNode.children.length<=h?(l.push(h),!0):!1);if(c.length===0||i.currentNode.hasError!==n.currentNode.hasError){for(;i.currentNode.parent&&r&&!i.currentNode.isNamed;)r=g$(i,n);const d=i.currentNode,h=Ege(i,e)??d;s.push({startIndex:h.startIndex,endIndex:d.endIndex,startPosition:h.startPosition,endPosition:d.endPosition}),r=p$(i,n)}else c.length>=1&&(r=Dge(i,n,l[0]))}else r=p$(i,n);while(r);return i.delete(),n.delete(),s}_findTreeChanges(e,t,i){let n=0;const s=[];for(let r=0;r<t.length;r++){const a=t[r];if(s.length>0&&a.startIndex>=s[s.length-1].newRangeStartOffset&&a.endIndex<=s[s.length-1].newRangeEndOffset)continue;const l=e.walk(),c=()=>l.startIndex<a.startIndex&&l.endIndex>a.endIndex;for(;c();){let m=l.gotoFirstChild(),_=!1;for(;m;)if(c()&&l.currentNode.isNamed){_=!0;break}else m=l.gotoNextSibling();if(!_){l.gotoParent();break}if(l.currentNode.childCount===0)break}const d=l.currentNode.startPosition,h=l.currentNode.endPosition,u=l.currentNode.startIndex,f=l.currentNode.endIndex,g={newRange:new k(d.row+1,d.column+1,h.row+1,h.column+1),newRangeStartOffset:u,newRangeEndOffset:f};n<i.length&&_$(i[n],{startIndex:u,endIndex:f})?(i[n].startIndex<g.newRangeStartOffset&&(g.newRange=g.newRange.setStartPosition(i[n].startPosition.row+1,i[n].startPosition.column+1),g.newRangeStartOffset=i[n].startIndex),i[n].endIndex>g.newRangeEndOffset&&(g.newRange=g.newRange.setEndPosition(i[n].endPosition.row+1,i[n].endPosition.column+1),g.newRangeEndOffset=i[n].endIndex),n++):n<i.length&&i[n].endIndex<g.newRangeStartOffset&&s.push({newRange:new k(i[n].startPosition.row+1,i[n].startPosition.column+1,i[n].endPosition.row+1,i[n].endPosition.column+1),newRangeStartOffset:i[n].startIndex,newRangeEndOffset:i[n].endIndex}),s.length>0&&s[s.length-1].newRangeEndOffset>=g.newRangeStartOffset?(s[s.length-1].newRange=k.fromPositions(s[s.length-1].newRange.getStartPosition(),g.newRange.getEndPosition()),s[s.length-1].newRangeEndOffset=g.newRangeEndOffset):s.push(g)}return this._constrainRanges(s)}_constrainRanges(e){if(!this._ranges)return e;const t=[];let i=0,n=0;for(;i<e.length&&n<this._ranges.length;){const s=e[i],r=this._ranges[n];if(s.newRangeEndOffset<r.startIndex)i++;else if(s.newRangeStartOffset>r.endIndex)n++;else{const a=Math.max(s.newRangeStartOffset,r.startIndex),l=Math.min(s.newRangeEndOffset,r.endIndex),c=s.newRange.intersectRanges(new k(r.startPosition.row+1,r.startPosition.column+1,r.endPosition.row+1,r.endPosition.column+1));t.push({newRange:c,newRangeEndOffset:l,newRangeStartOffset:a}),l<s.newRangeEndOffset?(s.newRange=k.fromPositions(c.getEndPosition(),s.newRange.getEndPosition()),s.newRangeStartOffset=l+1):i++}}return t}async _parseAndUpdateTree(e){const t=await this._parse();if(t)return this._lastFullyParsed?.delete(),this._lastFullyParsed=t.copy(),this._lastFullyParsedWithEdits?.delete(),this._lastFullyParsedWithEdits=t.copy(),t;this._tree.get()||this._parser.reset()}_parse(){let e="fullParse";return this._tree.get()&&(e="incrementalParse"),this._parseAndYield(e)}async _parseAndYield(e){let t=0,i=0;const n=this.textModel.getVersionId();let s;const r=Tge();do{const a=performance.now();s=this._parser.parse((l,c)=>this._parseCallback(l),this._tree.get(),{progressCallback:r,includedRanges:this._ranges}),t+=performance.now()-a,i++,await new Promise(l=>ey(l))}while(!this._store.isDisposed&&!s&&n===this.textModel.getVersionId());return this._sendParseTimeTelemetry(e,t,i),s&&n===this.textModel.getVersionId()?s:void 0}_parseCallback(e){try{return this.textModel.getTextBuffer().getNearestChunk(e)}catch(t){this._logService.debug("Error getting chunk for tree-sitter parsing",t)}}_setRanges(e){const t=[];if(this._ranges)for(const i of e){let n=!1;for(let s=0;s<this._ranges.length;s++){const r=this._ranges[s];if(Rge(r,i)||_$(r,i)){n=!0;break}}n||t.push(i)}else t.push(...e);return this._ranges=e,t}_sendParseTimeTelemetry(e,t,i){this._logService.debug(`Tree parsing (${e}) took ${t} ms and ${i} passes.`),e==="fullParse"?this._telemetryService.publicLog2("treeSitter.fullParse",{languageId:this.languageId,time:t,passes:i}):this._telemetryService.publicLog2("treeSitter.incrementalParse",{languageId:this.languageId,time:t,passes:i})}createParsedTreeSync(e){const t=new this._parserClass;t.setLanguage(this._parser.language);const i=t.parse(e);return t.delete(),i??void 0}};HP=Nge([m$(5,Rt),m$(6,Vn)],HP);function Tge(){let o=performance.now();return function(t){const i=performance.now();return i-o>50?(o=i,!0):!1}}function Rge(o,e){return o.startPosition.row===e.startPosition.row&&o.startPosition.column===e.startPosition.column&&o.endPosition.row===e.endPosition.row&&o.endPosition.column===e.endPosition.column&&o.startIndex===e.startIndex&&o.endIndex===e.endIndex}function _$(o,e){return o.startIndex<=e.startIndex&&o.endIndex>=e.startIndex||e.startIndex<=o.startIndex&&e.endIndex>=o.startIndex}const A_=new class{clone(){return this}equals(o){return this===o}};function VP(o,e){return new HM([new rv(0,"",o)],e)}function wx(o,e){const t=new Uint32Array(2);return t[0]=0,t[1]=(o<<0|0|0|32768|2<<24)>>>0,new YL(t,e===null?A_:e)}class Mge{constructor(e){this._default=e,this._store=[]}get(e){return e<this._store.length?this._store[e]:this._default}set(e,t){for(;e>=this._store.length;)this._store[this._store.length]=this._default;this._store[e]=t}replace(e,t,i){if(e>=this._store.length)return;if(t===0){this.insert(e,i);return}else if(i===0){this.delete(e,t);return}const n=this._store.slice(0,e),s=this._store.slice(e+t),r=Pge(i,this._default);this._store=n.concat(r,s)}delete(e,t){t===0||e>=this._store.length||this._store.splice(e,t)}insert(e,t){if(t===0||e>=this._store.length)return;const i=[];for(let n=0;n<t;n++)i[n]=this._default;this._store=my(this._store,e,i)}}function Pge(o,e){const t=[];for(let i=0;i<o;i++)t[i]=e;return t}class Age{get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._startLineNumber+this._tokens.length-1}constructor(e,t){this._startLineNumber=e,this._tokens=t}getLineTokens(e){return this._tokens[e-this._startLineNumber]}appendLineTokens(e){this._tokens.push(e)}}class zP{constructor(){this._tokens=[]}add(e,t){if(this._tokens.length>0){const i=this._tokens[this._tokens.length-1];if(i.endLineNumber+1===e){i.appendLineTokens(t);return}}this._tokens.push(new Age(e,[t]))}finalize(){return this._tokens}}class Oge{constructor(e,t){this.tokenizationSupport=t,this.initialState=this.tokenizationSupport.getInitialState(),this.store=new UP(e)}getStartState(e){return this.store.getStartState(e,this.initialState)}getFirstInvalidLine(){return this.store.getFirstInvalidLine(this.initialState)}}class Fge extends Oge{constructor(e,t,i,n){super(e,t),this._textModel=i,this._languageIdCodec=n}updateTokensUntilLine(e,t){const i=this._textModel.getLanguageId();for(;;){const n=this.getFirstInvalidLine();if(!n||n.lineNumber>t)break;const s=this._textModel.getLineContent(n.lineNumber),r=Rv(this._languageIdCodec,i,this.tokenizationSupport,s,!0,n.startState);e.add(n.lineNumber,r.tokens),this.store.setEndState(n.lineNumber,r.endState)}}getTokenTypeIfInsertingCharacter(e,t){const i=this.getStartState(e.lineNumber);if(!i)return 0;const n=this._textModel.getLanguageId(),s=this._textModel.getLineContent(e.lineNumber),r=s.substring(0,e.column-1)+t+s.substring(e.column-1),a=Rv(this._languageIdCodec,n,this.tokenizationSupport,r,!0,i),l=new bi(a.tokens,r,this._languageIdCodec);if(l.getCount()===0)return 0;const c=l.findTokenIndexAtOffset(e.column-1);return l.getStandardTokenType(c)}tokenizeLinesAt(e,t){const i=this.getStartState(e);if(!i)return null;const n=this._textModel.getLanguageId(),s=[];let r=i;for(const a of t){const l=Rv(this._languageIdCodec,n,this.tokenizationSupport,a,!0,r);s.push(new bi(l.tokens,a,this._languageIdCodec)),r=l.endState}return s}hasAccurateTokensForLine(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t}isCheapToTokenize(e){const t=this.store.getFirstInvalidEndStateLineNumberOrMax();return e<t||e===t&&this._textModel.getLineLength(e)<2048}tokenizeHeuristically(e,t,i){if(i<=this.store.getFirstInvalidEndStateLineNumberOrMax())return{heuristicTokens:!1};if(t<=this.store.getFirstInvalidEndStateLineNumberOrMax())return this.updateTokensUntilLine(e,i),{heuristicTokens:!1};let n=this.guessStartState(t);const s=this._textModel.getLanguageId();for(let r=t;r<=i;r++){const a=this._textModel.getLineContent(r),l=Rv(this._languageIdCodec,s,this.tokenizationSupport,a,!0,n);e.add(r,l.tokens),n=l.endState}return{heuristicTokens:!0}}guessStartState(e){let{likelyRelevantLines:t,initialState:i}=b$(this._textModel,e,this);i||(i=this.tokenizationSupport.getInitialState());const n=this._textModel.getLanguageId();let s=i;for(const r of t)s=Rv(this._languageIdCodec,n,this.tokenizationSupport,r,!1,s).endState;return s}}function b$(o,e,t){let i=o.getLineFirstNonWhitespaceColumn(e);const n=[];let s=null;for(let r=e-1;i>1&&r>=1;r--){const a=o.getLineFirstNonWhitespaceColumn(r);if(a!==0&&a<i&&(n.push(o.getLineContent(r)),i=a,s=t?.getStartState(r),s))break}return n.reverse(),{likelyRelevantLines:n,initialState:s??void 0}}class UP{constructor(e){this.lineCount=e,this._tokenizationStateStore=new Wge,this._invalidEndStatesLineNumbers=new Bge,this._invalidEndStatesLineNumbers.addRange(new pe(1,e+1))}getEndState(e){return this._tokenizationStateStore.getEndState(e)}setEndState(e,t){if(!t)throw new Ce("Cannot set null/undefined state");this._invalidEndStatesLineNumbers.delete(e);const i=this._tokenizationStateStore.setEndState(e,t);return i&&e<this.lineCount&&this._invalidEndStatesLineNumbers.addRange(new pe(e+1,e+2)),i}acceptChange(e,t){this.lineCount+=t-e.length,this._tokenizationStateStore.acceptChange(e,t),this._invalidEndStatesLineNumbers.addRangeAndResize(new pe(e.startLineNumber,e.endLineNumberExclusive),t)}acceptChanges(e){for(const t of e){const[i]=Dh(t.text);this.acceptChange(new ke(t.range.startLineNumber,t.range.endLineNumber+1),i+1)}}invalidateEndStateRange(e){this._invalidEndStatesLineNumbers.addRange(new pe(e.startLineNumber,e.endLineNumberExclusive))}getFirstInvalidEndStateLineNumber(){return this._invalidEndStatesLineNumbers.min}getFirstInvalidEndStateLineNumberOrMax(){return this.getFirstInvalidEndStateLineNumber()||Number.MAX_SAFE_INTEGER}allStatesValid(){return this._invalidEndStatesLineNumbers.min===null}getStartState(e,t){return e===1?t:this.getEndState(e-1)}getFirstInvalidLine(e){const t=this.getFirstInvalidEndStateLineNumber();if(t===null)return null;const i=this.getStartState(t,e);if(!i)throw new Ce("Start state must be defined");return{lineNumber:t,startState:i}}}class Wge{constructor(){this._lineEndStates=new Mge(null)}getEndState(e){return this._lineEndStates.get(e)}setEndState(e,t){const i=this._lineEndStates.get(e);return i&&i.equals(t)?!1:(this._lineEndStates.set(e,t),!0)}acceptChange(e,t){let i=e.length;t>0&&i>0&&(i--,t--),this._lineEndStates.replace(e.startLineNumber,i,t)}}class Bge{constructor(){this._ranges=[]}get min(){return this._ranges.length===0?null:this._ranges[0].start}delete(e){const t=this._ranges.findIndex(i=>i.contains(e));if(t!==-1){const i=this._ranges[t];i.start===e?i.endExclusive===e+1?this._ranges.splice(t,1):this._ranges[t]=new pe(e+1,i.endExclusive):i.endExclusive===e+1?this._ranges[t]=new pe(i.start,e):this._ranges.splice(t,1,new pe(i.start,e),new pe(e+1,i.endExclusive))}}addRange(e){pe.addRange(e,this._ranges)}addRangeAndResize(e,t){let i=0;for(;!(i>=this._ranges.length||e.start<=this._ranges[i].endExclusive);)i++;let n=i;for(;!(n>=this._ranges.length||e.endExclusive<this._ranges[n].start);)n++;const s=t-e.length;for(let r=n;r<this._ranges.length;r++)this._ranges[r]=this._ranges[r].delta(s);if(i===n){const r=new pe(e.start,e.start+t);r.isEmpty||this._ranges.splice(i,0,r)}else{const r=Math.min(e.start,this._ranges[i].start),a=Math.max(e.endExclusive,this._ranges[n-1].endExclusive),l=new pe(r,a+s);l.isEmpty?this._ranges.splice(i,n-i):this._ranges.splice(i,n-i,l)}}toString(){return this._ranges.map(e=>e.toString()).join(" + ")}}function Rv(o,e,t,i,n,s){let r=null;if(t)try{r=t.tokenizeEncoded(i,n,s.clone())}catch(a){Ee(a)}return r||(r=wx(o.encodeLanguageId(e),s)),bi.convertToEndOffset(r.tokens,i.length),r}class Hge{constructor(e,t){this._tokenizerWithStateStore=e,this._backgroundTokenStore=t,this._isDisposed=!1,this._isScheduled=!1}dispose(){this._isDisposed=!0}handleChanges(){this._beginBackgroundTokenization()}_beginBackgroundTokenization(){this._isScheduled||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._isScheduled=!0,fR(e=>{this._isScheduled=!1,this._backgroundTokenizeWithDeadline(e)}))}_backgroundTokenizeWithDeadline(e){const t=Date.now()+e.timeRemaining(),i=()=>{this._isDisposed||!this._tokenizerWithStateStore._textModel.isAttachedToEditor()||!this._hasLinesToTokenize()||(this._backgroundTokenizeForAtLeast1ms(),Date.now()<t?ey(i):this._beginBackgroundTokenization())};i()}_backgroundTokenizeForAtLeast1ms(){const e=this._tokenizerWithStateStore._textModel.getLineCount(),t=new zP,i=Ki.create(!1);do if(i.elapsed()>1||this._tokenizeOneInvalidLine(t)>=e)break;while(this._hasLinesToTokenize());this._backgroundTokenStore.setTokens(t.finalize()),this.checkFinished()}_hasLinesToTokenize(){return this._tokenizerWithStateStore?!this._tokenizerWithStateStore.store.allStatesValid():!1}_tokenizeOneInvalidLine(e){const t=this._tokenizerWithStateStore?.getFirstInvalidLine();return t?(this._tokenizerWithStateStore.updateTokensUntilLine(e,t.lineNumber),t.lineNumber):this._tokenizerWithStateStore._textModel.getLineCount()+1}checkFinished(){this._isDisposed||this._tokenizerWithStateStore.store.allStatesValid()&&this._backgroundTokenStore.backgroundTokenizationFinished()}requestTokens(e,t){this._tokenizerWithStateStore.store.invalidateEndStateRange(new ke(e,t))}}class Yf{get children(){return this._children}get length(){return this._length}constructor(e){this.height=e,this._children=[],this._length=0}static create(e,t){const i=new Yf(e.height+1);return i.appendChild(e),i.appendChild(t),i}canAppendChild(){return this._children.length<3}appendChild(e){if(!this.canAppendChild())throw new Error("Cannot insert more than 3 children in a ListNode");this._children.push(e),this._length+=e.length,this._updateParentLength(e.length),Ls(e)||(e.parent=this)}_updateParentLength(e){let t=this.parent;for(;t;)t._length+=e,t=t.parent}unappendChild(){const e=this._children.pop();return this._length-=e.length,this._updateParentLength(-e.length),e}prependChild(e){if(this._children.length>=3)throw new Error("Cannot prepend more than 3 children in a ListNode");this._children.unshift(e),this._length+=e.length,this._updateParentLength(e.length),Ls(e)||(e.parent=this)}unprependChild(){const e=this._children.shift();return this._length-=e.length,this._updateParentLength(-e.length),e}lastChild(){return this._children[this._children.length-1]}dispose(){this._children.splice(0,this._children.length)}}var Uo;(function(o){o[o.None=0]="None",o[o.ViewportGuess=1]="ViewportGuess",o[o.EditGuess=2]="EditGuess",o[o.Accurate=3]="Accurate"})(Uo||(Uo={}));function Ls(o){return o.token!==void 0}function C$(o,e){let t=o;const i=[];let n;for(;;){if(e.height===t.height){n=e;break}if(Ls(t))throw new Error("unexpected");i.push(t),t=t.lastChild()}for(let s=i.length-1;s>=0;s--){const r=i[s];n&&(r.children.length>=3?n=Yf.create(r.unappendChild(),n):(r.appendChild(n),n=void 0))}if(n){const s=new Yf(n.height+1);return s.appendChild(o),s.appendChild(n),s}else return o}function Vge(o,e){let t=o;const i=[];for(;e.height!==t.height;){if(Ls(t))throw new Error("unexpected");i.push(t),t=t.children[0]}let n=e;for(let s=i.length-1;s>=0;s--){const r=i[s];n&&(r.children.length>=3?n=Yf.create(n,r.unprependChild()):(r.prependChild(n),n=void 0))}return n?Yf.create(n,o):o}function zge(o,e){return o.height===e.height?Yf.create(o,e):o.height>e.height?C$(o,e):Vge(e,o)}class Uge{constructor(e){this._textModel=e,this._root=this.createEmptyRoot()}createEmptyRoot(){return{length:this._textModel.getValueLength(),token:0,height:0,tokenQuality:Uo.None}}buildStore(e,t){this._root=this.createFromUpdates(e,t)}createFromUpdates(e,t){if(e.length===0)return this.createEmptyRoot();let i={length:e[0].length,token:e[0].token,height:0,tokenQuality:t};for(let n=1;n<e.length;n++)i=C$(i,{length:e[n].length,token:e[n].token,height:0,tokenQuality:t});return i}update(e,t,i){t.length!==0&&this.replace(e,t[0].startOffsetInclusive,t,i)}delete(e,t){this.replace(e,t,[],Uo.EditGuess)}replace(e,t,i,n){const s=t+e,r=[],a=[],l=[{node:this._root,offset:0}];for(;l.length>0;){const h=l.pop(),u=h.offset;if(u<t&&u+h.node.length<=t){Ls(h.node)||(h.node.parent=void 0),r.push(h.node);continue}else Ls(h.node)&&u<t&&r.push({length:t-u,token:h.node.token,height:0,tokenQuality:h.node.tokenQuality});if(!(t<=u&&u+h.node.length<=s)){if(u>=s){Ls(h.node)||(h.node.parent=void 0),a.push(h.node);continue}else if(Ls(h.node)&&u+h.node.length>s){a.push({length:u+h.node.length-s,token:h.node.token,height:0,tokenQuality:h.node.tokenQuality});continue}if(!Ls(h.node)){let f=u+h.node.length;for(let g=h.node.children.length-1;g>=0;g--)f-=h.node.children[g].length,l.push({node:h.node.children[g],offset:f})}}}let c;i.length>0?c=r.concat(this.createFromUpdates(i,n),a):c=r.concat(a);let d=c[0];for(let h=1;h<c.length;h++)d=zge(d,c[h]);this._root=d??this.createEmptyRoot()}traverseInOrderInRange(e,t,i){const n=[{node:this._root,offset:0}];for(;n.length>0;){const{node:s,offset:r}=n.pop();if(!(r+s.length<=e||r>=t)){if(i(s,r))return;if(!Ls(s)){let l=r+s.length;for(let c=s.children.length-1;c>=0;c--)l-=s.children[c].length,n.push({node:s.children[c],offset:l})}}}}getTokenAt(e){let t;return this.traverseInOrderInRange(e,this._root.length,(i,n)=>Ls(i)?(t={token:i.token,startOffsetInclusive:n,length:i.length},!0):!1),t}getTokensInRange(e,t){const i=[];return this.traverseInOrderInRange(e,t,(n,s)=>{if(Ls(n)){let r=n.length,a=s;s<e&&s+n.length>t?(a=e,r=t-e):s<e?(r-=e-s,a=e):s+n.length>t&&(r-=s+n.length-t),i.push({token:n.token,startOffsetInclusive:a,length:r})}return!1}),i}markForRefresh(e,t){this.traverseInOrderInRange(e,t,i=>(Ls(i)&&(i.tokenQuality=Uo.None),!1))}rangeHasTokens(e,t,i){let n=!0;return this.traverseInOrderInRange(e,t,s=>(Ls(s)&&s.tokenQuality<i&&(n=!1),!1)),n}rangeNeedsRefresh(e,t){let i=!1;return this.traverseInOrderInRange(e,t,n=>(Ls(n)&&n.tokenQuality!==Uo.Accurate&&(i=!0),!1)),i}getNeedsRefresh(){const e=[];return this.traverseInOrderInRange(0,this._textModel.getValueLength(),(t,i)=>(Ls(t)&&t.tokenQuality!==Uo.Accurate&&(e.length>0&&e[e.length-1].endOffset===i?e[e.length-1].endOffset+=t.length:e.push({startOffset:i,endOffset:i+t.length})),!1)),e}dispose(){const e=[[this._root,!1]];for(;e.length>0;){const[t,i]=e.pop();if(!Ls(t))if(i)t.dispose(),t.parent=void 0;else{e.push([t,!0]);for(let n=t.children.length-1;n>=0;n--)e.push([t.children[n],!1])}}this._root=void 0}}const $ge=We("treeSitterThemeService");var jge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qge=function(o,e){return function(t,i){e(t,i,o)}};let $P=class extends A{get _textModel(){return this._tree.textModel}constructor(e,t,i,n,s){super(),this._tree=e,this._highlightingQueries=t,this._languageIdCodec=i,this._visibleLineRanges=n,this._treeSitterThemeService=s,this._onDidChangeTokens=this._register(new P),this.onDidChangeTokens=this._onDidChangeTokens.event,this._onDidCompleteBackgroundTokenization=this._register(new P),this.onDidChangeBackgroundTokenization=this._onDidCompleteBackgroundTokenization.event,this._encodedLanguageId=this._languageIdCodec.encodeLanguageId(this._tree.languageId),this._register(Sa(this._treeSitterThemeService.onChange,()=>{this._updateTheme()})),this._tokenStore=this._register(new Uge(this._textModel)),this._accurateVersion=this._textModel.getVersionId(),this._guessVersion=this._textModel.getVersionId(),this._tokenStore.buildStore(this._createEmptyTokens(),Uo.None),this._register(Se(r=>{const a=this._visibleLineRanges.read(r);this._parseAndTokenizeViewPort(a)})),this._register(Om({owner:this,changeTracker:Ane({tree:this._tree.tree})},(r,a)=>{const l=a.changes.at(0)?.change;if(a.changes.length>1)throw new Ce("The tree changed twice in one transaction. This is currently not supported and should not happen.");if(!l)a.tree&&this._firstTreeUpdate(this._tree.treeLastParsedVersion.read(r));else{if(this.hasTokens())for(const c of l.ranges)this._markForRefresh(c.newRange);this.hasTokens()?this._handleTreeUpdate(l.ranges,l.versionId):this._firstTreeUpdate(l.versionId)}}))}handleContentChanged(e){this._guessVersion=e.versionId;for(const t of e.changes)if(t.text.length>t.rangeLength){const i=t.rangeOffset>0?t.rangeOffset-1:t.rangeOffset,n=this._tokenStore.getTokenAt(i);let s;n?(s={startOffsetInclusive:n.startOffsetInclusive,length:n.length+t.text.length-t.rangeLength,token:n.token},this._tokenStore.markForRefresh(i,t.rangeOffset+(t.text.length>t.rangeLength?t.text.length:t.rangeLength))):s={startOffsetInclusive:i,length:t.text.length,token:0},this._tokenStore.update(n?.length??0,[s],Uo.EditGuess)}else if(t.text.length<t.rangeLength){const i=t.rangeLength-t.text.length;this._tokenStore.delete(i,t.rangeOffset)}}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this.getTokens(e);return new bi(i,t,this._languageIdCodec)}_createEmptyTokens(){const e=this._emptyToken(),t=this._textModel.getValueLength();return[this._emptyTokensForOffsetAndLength(0,t,e)]}_emptyToken(){return this._treeSitterThemeService.findMetadata([],this._encodedLanguageId,!1,void 0)}_emptyTokensForOffsetAndLength(e,t,i){return{token:i,length:e+t,startOffsetInclusive:0}}hasAccurateTokensForLine(e){return this.hasTokens(new k(e,1,e,this._textModel.getLineMaxColumn(e)))}tokenizeLinesAt(e,t){const i=this._guessTokensForLinesContent(e,t),n=[];if(!i)return null;for(let s=0;s<i.length;s++)n.push(new bi(i[s],t[s],this._languageIdCodec));return n}_rangeHasTokens(e,t){return this._tokenStore.rangeHasTokens(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()),t)}hasTokens(e){return!e||this._guessVersion===this._accurateVersion?!0:!this._tokenStore.rangeNeedsRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}getTokens(e){const t=this._textModel.getOffsetAt({lineNumber:e,column:1}),i=this._textModel.getOffsetAt({lineNumber:e,column:this._textModel.getLineLength(e)+1}),n=this._tokenStore.getTokensInRange(t,i),s=new Uint32Array(n.length*2);for(let r=0;r<n.length;r++)s[r*2]=n[r].startOffsetInclusive-t+n[r].length,s[r*2+1]=n[r].token;return s}getTokensInRange(e,t,i,n){const s=n?this._tokenizeCapturesWithMetadata(n,t,i):this._tokenize(e,t,i);if(s?.endOffsetsAndMetadata)return this._rangeTokensAsUpdates(t,s.endOffsetsAndMetadata)}_updateTokensInStore(e,t,i){this._accurateVersion=e;for(const n of t){const s=n.newTokens.length>0?n.newTokens[n.newTokens.length-1]:void 0;let r;s&&this._guessVersion>=e?r=s.startOffsetInclusive+s.length-n.newTokens[0].startOffsetInclusive:n.oldRangeLength?r=n.oldRangeLength:r=0,this._tokenStore.update(r,n.newTokens,i)}}_markForRefresh(e){this._tokenStore.markForRefresh(this._textModel.getOffsetAt(e.getStartPosition()),this._textModel.getOffsetAt(e.getEndPosition()))}_getNeedsRefresh(){const e=this._tokenStore.getNeedsRefresh();return e?e.map(t=>({range:k.fromPositions(this._textModel.getPositionAt(t.startOffset),this._textModel.getPositionAt(t.endOffset)),startOffset:t.startOffset,endOffset:t.endOffset})):[]}_parseAndTokenizeViewPort(e){const t=e.map(i=>i.toInclusiveRange()).filter(sn);for(const i of t){const n=this._textModel.getOffsetAt(i.getStartPosition()),s=this._textModel.getOffsetAt(i.getEndPosition()),r=this._textModel.getVersionId();if(this._rangeHasTokens(i,Uo.ViewportGuess))continue;const a=this._textModel.getValueInRange(i),l=this._forceParseAndTokenizeContent(i,n,s,a,!0);if(!l||this._rangeHasTokens(i,Uo.ViewportGuess)||l.length===0)continue;const c=l[l.length-1],d=c.startOffsetInclusive+c.length-l[0].startOffsetInclusive;this._updateTokensInStore(r,[{newTokens:l,oldRangeLength:d}],Uo.ViewportGuess),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]}})}}_guessTokensForLinesContent(e,t){if(t.length===0)return;const i=t.join(this._textModel.getEOL()),n=new k(1,1,e+t.length,t[t.length-1].length+1),s=this._textModel.getOffsetAt({lineNumber:e,column:1}),r=this._forceParseAndTokenizeContent(n,s,s+i.length,i,!1);if(!r)return;const a=new Array(t.length);let l=0,c=0,d=0;for(let h=0;h<t.length;h++){const u=[];let f=!1;for(let g=l;!f&&g<r.length;g++){const m=r[g],_=m.endOffset-d,b=c-d;if(_<=t[h].length)u.push({endOffset:_,metadata:m.metadata}),l++;else if(b<t[h].length){const C={endOffset:t[h].length,metadata:m.metadata};u.push(C),f=!0}else f=!0;c=m.endOffset}a[h]=this._endOffsetTokensToUint32Array(u),d+=t[h].length+this._textModel.getEOL().length}return a}_forceParseAndTokenizeContent(e,t,i,n,s){const r=b$(this._textModel,e.startLineNumber).likelyRelevantLines,a=r.join(this._textModel.getEOL()),l=this._tree.createParsedTreeSync(`${a}${n}`);if(!l)return;const c=new k(1,1,e.endLineNumber-e.startLineNumber+1+r.length,e.endColumn),d=this.captureAtRange(c),h=this._tokenizeCapturesWithMetadata(d,a.length,i-t+a.length);if(l.delete(),!!h)return s?this._rangeTokensAsUpdates(t,h.endOffsetsAndMetadata,a.length):h.endOffsetsAndMetadata}_firstTreeUpdate(e){return this._setViewPortTokens(e)}_setViewPortTokens(e){const t=this._visibleLineRanges.get().map(i=>{const n=i.toInclusiveRange();if(!n)return;const s=this._textModel.getOffsetAt(n.getStartPosition()),r=this._textModel.getOffsetAt(n.getEndPosition());return{newRange:n,newRangeEndOffset:r,newRangeStartOffset:s}}).filter(sn);return this._handleTreeUpdate(t,e)}_handleTreeUpdate(e,t){const i=[];for(let r=0;r<e.length;r++)if(e[r].newRange.endLineNumber-e[r].newRange.startLineNumber>1e3){const l=e[r].newRange.endLineNumber;let c=e[r].newRange.startLineNumber,d=e[r].newRange.startColumn,h=c+1e3;do{const u=new M(c,d),f=h===e[r].newRange.endLineNumber?e[r].newRange.endColumn:this._textModel.getLineMaxColumn(h),g=new M(h,f),m=k.fromPositions(u,g);i.push({range:m,startOffset:this._textModel.getOffsetAt(m.getStartPosition()),endOffset:this._textModel.getOffsetAt(m.getEndPosition())}),c=h+1,d=1,h<l&&h+1e3>l?h=l:h=h+1e3}while(h<=l)}else if(r===0||i[r-1].endOffset<e[r].newRangeStartOffset)i.push({range:e[r].newRange,startOffset:e[r].newRangeStartOffset,endOffset:e[r].newRangeEndOffset});else if(i[r-1].endOffset<e[r].newRangeEndOffset){const l=this._textModel.getPositionAt(i[r-1].endOffset+1),c=new k(l.lineNumber,l.column,e[r].newRange.endLineNumber,e[r].newRange.endColumn);i.push({range:c,startOffset:i[r-1].endOffset+1,endOffset:e[r].newRangeEndOffset})}const s=i.map(r=>this._getCaptures(r.range));return this._updateTreeForRanges(i,t,s).then(()=>{!this._textModel.isDisposed()&&this._tree.treeLastParsedVersion.get()===this._textModel.getVersionId()&&this._refreshNeedsRefresh(t)})}async _updateTreeForRanges(e,t,i){let n;for(let s=0;s<e.length&&!(!this._textModel.isDisposed()&&t!==this._textModel.getVersionId());s++){const r=i[s],a=e[s],l=this.getTokensInRange(a.range,a.startOffset,a.endOffset,r);l?n={newTokens:l}:n={newTokens:[]},this._updateTokensInStore(t,[n],Uo.Accurate),this._onDidChangeTokens.fire({changes:{semanticTokensApplied:!1,ranges:[{fromLineNumber:a.range.getStartPosition().lineNumber,toLineNumber:a.range.getEndPosition().lineNumber}]}}),await new Promise(c=>ey(c))}this._onDidCompleteBackgroundTokenization.fire()}_refreshNeedsRefresh(e){const t=this._getNeedsRefresh();if(t.length===0)return;const i=new Array(t.length);for(let n=0;n<t.length;n++){const s=t[n];i[n]={newRange:s.range,newRangeStartOffset:s.startOffset,newRangeEndOffset:s.endOffset}}this._handleTreeUpdate(i,e)}_rangeTokensAsUpdates(e,t,i){const n=[];let s=0;for(const r of t){if(r.endOffset<=s||i&&r.endOffset<i)continue;let a;i&&s<i?a={startOffsetInclusive:e+i,length:r.endOffset-i,token:r.metadata}:a={startOffsetInclusive:e+s,length:r.endOffset-s,token:r.metadata},n.push(a),s=r.endOffset}return n}_updateTheme(){const e=this._textModel.getFullModelRange();this._markForRefresh(e),this._parseAndTokenizeViewPort(this._visibleLineRanges.get())}captureAtRange(e){const t=this._tree.tree.get();return t?this._highlightingQueries.captures(t.rootNode,{startPosition:{row:e.startLineNumber-1,column:e.startColumn-1},endPosition:{row:e.endLineNumber-1,column:e.endColumn-1}}).map(i=>({name:i.name,text:i.node.text,node:{startIndex:i.node.startIndex,endIndex:i.node.endIndex,startPosition:{lineNumber:i.node.startPosition.row+1,column:i.node.startPosition.column+1},endPosition:{lineNumber:i.node.endPosition.row+1,column:i.node.endPosition.column+1}},encodedLanguageId:this._encodedLanguageId})):[]}captureAtRangeWithInjections(e){const t=this.captureAtRange(e);for(let i=0;i<t.length;i++){const n=t[i],s=n.node.startPosition.lineNumber,r=n.node.endPosition.lineNumber,a=n.node.startPosition.column,l=n.node.endPosition.column,c=s>e.startLineNumber&&s<e.endLineNumber?s:e.startLineNumber,d=r>e.startLineNumber&&r<e.endLineNumber?r:e.endLineNumber,h=s===e.startLineNumber?a<e.startColumn?e.startColumn:a:s<e.startLineNumber?e.startColumn:a,u=r===e.endLineNumber?l>e.endColumn?e.endColumn:l:r>e.endLineNumber?e.endColumn:l,f=new k(c,h,d,u),g=this._getInjectionCaptures(n,f);g&&g.length>0&&(t.splice(i+1,0,...g),i+=g.length)}return t}tokenizeEncoded(e){const t=this._tokenizeEncoded(e);if(!t)return;const i=this._rangeTokensAsUpdates(this._textModel.getOffsetAt({lineNumber:e,column:1}),t.result);t.versionId===this._textModel.getVersionId()&&this._updateTokensInStore(t.versionId,[{newTokens:i,oldRangeLength:this._textModel.getLineLength(e)}],Uo.Accurate)}_getCaptures(e){return this.captureAtRangeWithInjections(e)}_tokenize(e,t,i){const n=this._getCaptures(e),s=this._tokenizeCapturesWithMetadata(n,t,i);if(s)return{...s,versionId:this._tree.treeLastParsedVersion.get()}}_createTokensFromCaptures(e,t,i){const n=this._tree.tree.get(),s=Ki.create(),r=i-t,a=this._languageIdCodec.encodeLanguageId(this._tree.languageId),l=Kge[this._tree.languageId]||"source";if(e.length===0)return n?(s.stop(),{endOffsets:[{endOffset:r,scopes:[],encodedLanguageId:a}],captureTime:s.elapsed()}):void 0;const c=Array(e.length);c.fill({endOffset:0,scopes:[l],encodedLanguageId:a});let d=0;const h=()=>{c.push({endOffset:0,scopes:[l],encodedLanguageId:a})},u=(m,_)=>m.name.includes("punctuation")&&m.text?Array.from(m.text.matchAll(Gge)).map(b=>_+b.index):void 0,f=(m,_,b,C)=>{if(C!==void 0){const w=c[C].scopes;let v=c[C].bracket;if((C>0?c[C-1].endOffset:0)!==_){let L;if(v&&v.length>0){L=[];const x=[];for(let I=0;I<v.length;I++){const D=v[I];D<_?L.push(D):D>b&&x.push(D)}L.length===0&&(L=void 0),x.length===0?v=void 0:v=x}c.splice(C,0,{endOffset:_,scopes:[...w],bracket:L,encodedLanguageId:m.encodedLanguageId}),C++,h(),d++}c.splice(C,0,{endOffset:b,scopes:[...w,m.name],bracket:u(m,_),encodedLanguageId:m.encodedLanguageId}),c[d].bracket=v}else c[d]={endOffset:b,scopes:[l,m.name],bracket:u(m,_),encodedLanguageId:m.encodedLanguageId};d++};for(let m=0;m<e.length;m++){const _=e[m],b=_.node.endIndex<i?_.node.endIndex<t?t:_.node.endIndex:i,C=_.node.startIndex<t?t:_.node.startIndex,w=b-t;let v;const S=b-C;m>0?v=c[d-1].endOffset:v=C-t-1;const L=w-S;if(v>=0&&v<L&&(c[d]={endOffset:L,scopes:[l],encodedLanguageId:this._encodedLanguageId},d++,h()),!(S<0))if(v>=w){let x=d-1,I=c[x].endOffset,D=x>=2?c[x-1].endOffset:0;do{if(D+S===I){if(D===L){c[x].scopes.push(_.name);const R=c[x].bracket;c[x].bracket=R&&R.length>0?R:u(_,L)}}else if(D<=L){f(_,L,w,x);break}x--,D=x>=1?c[x-1].endOffset:0,I=x>=0?c[x].endOffset:0}while(I>L)}else f(_,L,w)}c[d-1].endOffset<r&&r-c[d-1].endOffset>0&&(h(),c[d]={endOffset:r,scopes:c[d].scopes,encodedLanguageId:this._encodedLanguageId},d++);for(let m=0;m<c.length;m++)if(c[m].endOffset===0&&m!==0){c.splice(m,c.length-m);break}const g=s.elapsed();return{endOffsets:c,captureTime:g}}_getInjectionCaptures(e,t){return[]}_tokenizeCapturesWithMetadata(e,t,i){const n=Ki.create(),s=this._createTokensFromCaptures(e,t,i);if(!s)return;const r=s.endOffsets;for(let l=0;l<r.length;l++){const c=r[l];c.metadata=this._treeSitterThemeService.findMetadata(c.scopes,c.encodedLanguageId,!!c.bracket&&c.bracket.length>0,void 0)}const a=n.elapsed();return{endOffsetsAndMetadata:r,captureTime:s.captureTime,metadataTime:a}}_tokenizeEncoded(e){const t=this._textModel.getOffsetAt({lineNumber:e,column:1}),i=this._textModel.getLineCount(),n=e+1<=i?this._textModel.getOffsetAt({lineNumber:e+1,column:1}):this._textModel.getValueLength(),s=n-t,r=this._tokenize(new k(e,1,e,s+1),t,n);if(r)return{result:r.endOffsetsAndMetadata,captureTime:r.captureTime,metadataTime:r.metadataTime,versionId:r.versionId}}_endOffsetTokensToUint32Array(e){const t=new Uint32Array(e.length*2);for(let i=0;i<e.length;i++)t[i*2]=e[i].endOffset,t[i*2+1]=e[i].metadata;return t}};$P=jge([qge(4,$ge)],$P);const Kge={css:"source.css",typescript:"source.ts",ini:"source.ini",regex:"source.regex"},Gge=/[\{\}\[\]\<\>\(\)]/g,jP=We("treeSitterLibraryService");var Zge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},v$=function(o,e){return function(t,i){e(t,i,o)}};let qP=class extends f${constructor(e,t,i,n,s,r){super(t,i),this._languageIdObs=e,this._treeSitterLibraryService=s,this._instantiationService=r,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new P),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event;const a=new Mne(this._treeSitterLibraryService.getParserClass()),l=j(this,c=>a.promiseResult?.read(c)?.getDataOrThrow());this._tree=j(this,c=>{const d=l.read(c);if(!d)return;const h=this._languageIdObs.read(c),u=this._treeSitterLibraryService.getLanguage(h,c);if(!u)return;const f=new d;if(c.store.add(ue(()=>{f.delete()})),f.setLanguage(u),this._treeSitterLibraryService.getInjectionQueries(h,c)!==void 0)return c.store.add(this._instantiationService.createInstance(HP,h,void 0,f,d,this._textModel))}),this._tokenizationImpl=j(this,c=>{const d=this._tree.read(c);if(!d)return;const h=this._treeSitterLibraryService.getHighlightingQueries(d.languageId,c);if(h)return c.store.add(this._instantiationService.createInstance($P,d,h,this._languageIdCodec,n))}),this._register(Se(c=>{const d=this._tokenizationImpl.read(c);d&&(c.store.add(d.onDidChangeTokens(h=>{this._onDidChangeTokens.fire(h.changes)})),c.store.add(d.onDidChangeBackgroundTokenization(h=>{this._backgroundTokenizationState=2,this._onDidChangeBackgroundTokenizationState.fire()})))}))}getLineTokens(e){const t=this._tokenizationImpl.get();if(!t){const i=this._textModel.getLineContent(e);return bi.createEmpty(i,this._languageIdCodec)}return t.getLineTokens(e)}todo_resetTokenization(e=!0){e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}handleDidChangeAttached(){}handleDidChangeContent(e){e.isFlush?this.todo_resetTokenization(!1):this._tokenizationImpl.get()?.handleContentChanged(e),this._tree.get()?.handleContentChange(e)}forceTokenization(e){const t=this._tokenizationImpl.get();t&&(t.hasAccurateTokensForLine(e)||t.tokenizeEncoded(e))}hasAccurateTokensForLine(e){const t=this._tokenizationImpl.get();return t?t.hasAccurateTokensForLine(e):!1}isCheapToTokenize(e){return!0}getTokenTypeIfInsertingCharacter(e,t,i){return 0}tokenizeLinesAt(e,t){const i=this._tokenizationImpl.get();return i?i.tokenizeLinesAt(e,t):null}get hasTokens(){const e=this._tokenizationImpl.get();return e?e.hasTokens():!1}};qP=Zge([v$(4,jP),v$(5,ge)],qP);class KP{constructor(e){this._pieces=[],this._isComplete=!1,this._languageIdCodec=e}flush(){this._pieces=[],this._isComplete=!1}isEmpty(){return this._pieces.length===0}set(e,t,i=void 0){if(this._pieces=e||[],this._isComplete=t,i)for(const n of this._pieces)n.reportIfInvalid(i)}setPartial(e,t){let i=e;if(t.length>0){const s=t[0].getRange(),r=t[t.length-1].getRange();if(!s||!r)return e;i=e.plusRange(s).plusRange(r)}let n=null;for(let s=0,r=this._pieces.length;s<r;s++){const a=this._pieces[s];if(a.endLineNumber<i.startLineNumber)continue;if(a.startLineNumber>i.endLineNumber){n=n||{index:s};break}if(a.removeTokens(i),a.isEmpty()){this._pieces.splice(s,1),s--,r--;continue}if(a.endLineNumber<i.startLineNumber)continue;if(a.startLineNumber>i.endLineNumber){n=n||{index:s};continue}const[l,c]=a.split(i);if(l.isEmpty()){n=n||{index:s};continue}c.isEmpty()||(this._pieces.splice(s,1,l,c),s++,r++,n=n||{index:s})}return n=n||{index:this._pieces.length},t.length>0&&(this._pieces=my(this._pieces,n.index,t)),i}isComplete(){return this._isComplete}addSparseTokens(e,t){if(t.getTextLength()===0)return t;const i=this._pieces;if(i.length===0)return t;const n=KP._findFirstPieceWithLine(i,e),s=i[n].getLineTokens(e);if(!s)return t;const r=t.getCount(),a=s.getCount();let l=0;const c=[];let d=0,h=0;const u=(f,g)=>{f!==h&&(h=f,c[d++]=f,c[d++]=g)};for(let f=0;f<a;f++){const g=Math.min(s.getStartCharacter(f),t.getTextLength()),m=Math.min(s.getEndCharacter(f),t.getTextLength()),_=s.getMetadata(f),b=((_&1?2048:0)|(_&2?4096:0)|(_&4?8192:0)|(_&8?16384:0)|(_&16?16744448:0)|(_&32?4278190080:0))>>>0,C=~b>>>0;for(;l<r&&t.getEndOffset(l)<=g;)u(t.getEndOffset(l),t.getMetadata(l)),l++;for(l<r&&t.getStartOffset(l)<g&&u(g,t.getMetadata(l));l<r&&t.getEndOffset(l)<m;)u(t.getEndOffset(l),t.getMetadata(l)&C|_&b),l++;if(l<r)u(m,t.getMetadata(l)&C|_&b),t.getEndOffset(l)===m&&l++;else{const w=Math.min(Math.max(0,l-1),r-1);u(m,t.getMetadata(w)&C|_&b)}}for(;l<r;)u(t.getEndOffset(l),t.getMetadata(l)),l++;return new bi(new Uint32Array(c),t.getLineContent(),this._languageIdCodec)}static _findFirstPieceWithLine(e,t){let i=0,n=e.length-1;for(;i<n;){let s=i+Math.floor((n-i)/2);if(e[s].endLineNumber<t)i=s+1;else if(e[s].startLineNumber>t)n=s-1;else{for(;s>i&&e[s-1].startLineNumber<=t&&t<=e[s-1].endLineNumber;)s--;return s}}return i}acceptEdit(e,t,i,n,s){for(const r of this._pieces)r.acceptEdit(e,t,i,n,s)}}const Jc=new Uint32Array(0).buffer;class Il{static deleteBeginning(e,t){return e===null||e===Jc?e:Il.delete(e,0,t)}static deleteEnding(e,t){if(e===null||e===Jc)return e;const i=ed(e),n=i[i.length-2];return Il.delete(e,t,n)}static delete(e,t,i){if(e===null||e===Jc||t===i)return e;const n=ed(e),s=n.length>>>1;if(t===0&&n[n.length-2]===i)return Jc;const r=bi.findIndexInTokensArray(n,t),a=r>0?n[r-1<<1]:0,l=n[r<<1];if(i<l){const f=i-t;for(let g=r;g<s;g++)n[g<<1]-=f;return e}let c,d;a!==t?(n[r<<1]=t,c=r+1<<1,d=t):(c=r<<1,d=a);const h=i-t;for(let f=r+1;f<s;f++){const g=n[f<<1]-h;g>d&&(n[c++]=g,n[c++]=n[(f<<1)+1],d=g)}if(c===n.length)return e;const u=new Uint32Array(c);return u.set(n.subarray(0,c),0),u.buffer}static append(e,t){if(t===Jc)return e;if(e===Jc)return t;if(e===null)return e;if(t===null)return null;const i=ed(e),n=ed(t),s=n.length>>>1,r=new Uint32Array(i.length+n.length);r.set(i,0);let a=i.length;const l=i[i.length-2];for(let c=0;c<s;c++)r[a++]=n[c<<1]+l,r[a++]=n[(c<<1)+1];return r.buffer}static insert(e,t,i){if(e===null||e===Jc)return e;const n=ed(e),s=n.length>>>1;let r=bi.findIndexInTokensArray(n,t);r>0&&n[r-1<<1]===t&&r--;for(let a=r;a<s;a++)n[a<<1]+=i;return e}}function ed(o){return o instanceof Uint32Array?o:new Uint32Array(o)}class Mv{constructor(e){this._lineTokens=[],this._len=0,this._languageIdCodec=e}flush(){this._lineTokens=[],this._len=0}get hasTokens(){return this._lineTokens.length>0}getTokens(e,t,i){let n=null;if(t<this._len&&(n=this._lineTokens[t]),n!==null&&n!==Jc)return new bi(ed(n),i,this._languageIdCodec);const s=new Uint32Array(2);return s[0]=i.length,s[1]=w$(this._languageIdCodec.encodeLanguageId(e)),new bi(s,i,this._languageIdCodec)}static _massageTokens(e,t,i){const n=i?ed(i):null;if(t===0){let s=!1;if(n&&n.length>1&&(s=zn.getLanguageId(n[1])!==e),!s)return Jc}if(!n||n.length===0){const s=new Uint32Array(2);return s[0]=t,s[1]=w$(e),s.buffer}return n[n.length-2]=t,n.byteOffset===0&&n.byteLength===n.buffer.byteLength?n.buffer:n}_ensureLine(e){for(;e>=this._len;)this._lineTokens[this._len]=null,this._len++}_deleteLines(e,t){t!==0&&(e+t>this._len&&(t=this._len-e),this._lineTokens.splice(e,t),this._len-=t)}_insertLines(e,t){if(t===0)return;const i=[];for(let n=0;n<t;n++)i[n]=null;this._lineTokens=my(this._lineTokens,e,i),this._len+=t}setTokens(e,t,i,n,s){const r=Mv._massageTokens(this._languageIdCodec.encodeLanguageId(e),i,n);this._ensureLine(t);const a=this._lineTokens[t];return this._lineTokens[t]=r,s?!Mv._equals(a,r):!1}static _equals(e,t){if(!e||!t)return!e&&!t;const i=ed(e),n=ed(t);if(i.length!==n.length)return!1;for(let s=0,r=i.length;s<r;s++)if(i[s]!==n[s])return!1;return!0}acceptEdit(e,t,i){this._acceptDeleteRange(e),this._acceptInsertText(new M(e.startLineNumber,e.startColumn),t,i)}_acceptDeleteRange(e){const t=e.startLineNumber-1;if(t>=this._len)return;if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._lineTokens[t]=Il.delete(this._lineTokens[t],e.startColumn-1,e.endColumn-1);return}this._lineTokens[t]=Il.deleteEnding(this._lineTokens[t],e.startColumn-1);const i=e.endLineNumber-1;let n=null;i<this._len&&(n=Il.deleteBeginning(this._lineTokens[i],e.endColumn-1)),this._lineTokens[t]=Il.append(this._lineTokens[t],n),this._deleteLines(e.startLineNumber,e.endLineNumber-e.startLineNumber)}_acceptInsertText(e,t,i){if(t===0&&i===0)return;const n=e.lineNumber-1;if(!(n>=this._len)){if(t===0){this._lineTokens[n]=Il.insert(this._lineTokens[n],e.column-1,i);return}this._lineTokens[n]=Il.deleteEnding(this._lineTokens[n],e.column-1),this._lineTokens[n]=Il.insert(this._lineTokens[n],e.column-1,i),this._insertLines(e.lineNumber,t)}}setMultilineTokens(e,t){if(e.length===0)return{changes:[]};const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];let a=0,l=0,c=!1;for(let d=r.startLineNumber;d<=r.endLineNumber;d++)c?(this.setTokens(t.getLanguageId(),d-1,t.getLineLength(d),r.getLineTokens(d),!1),l=d):this.setTokens(t.getLanguageId(),d-1,t.getLineLength(d),r.getLineTokens(d),!0)&&(c=!0,a=d,l=d);c&&i.push({fromLineNumber:a,toLineNumber:l})}return{changes:i}}}function w$(o){return(o<<0|0|0|32768|2<<24|1024)>>>0}class Yge extends f${constructor(e,t,i,n){super(e,t),this.getLanguageId=i,this._tokenizer=null,this._backgroundTokenizationState=1,this._onDidChangeBackgroundTokenizationState=this._register(new P),this.onDidChangeBackgroundTokenizationState=this._onDidChangeBackgroundTokenizationState.event,this._defaultBackgroundTokenizer=null,this._backgroundTokenizer=this._register(new ct),this._tokens=new Mv(this._languageIdCodec),this._debugBackgroundTokenizer=this._register(new ct),this._attachedViewStates=this._register(new ny),this._register(di.onDidChange(s=>{const r=this.getLanguageId();s.changedLanguages.indexOf(r)!==-1&&this.todo_resetTokenization()})),this.todo_resetTokenization(),this._register(n.onDidChangeVisibleRanges(({view:s,state:r})=>{if(r){let a=this._attachedViewStates.get(s);a||(a=new kge(()=>this.refreshRanges(a.lineRanges)),this._attachedViewStates.set(s,a)),a.handleStateChange(r)}else this._attachedViewStates.deleteAndDispose(s)}))}todo_resetTokenization(e=!0){this._tokens.flush(),this._debugBackgroundTokens?.flush(),this._debugBackgroundStates&&(this._debugBackgroundStates=new UP(this._textModel.getLineCount())),e&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]});const t=()=>{if(this._textModel.isTooLargeForTokenization())return[null,null];const s=di.get(this.getLanguageId());if(!s)return[null,null];let r;try{r=s.getInitialState()}catch(a){return Ee(a),[null,null]}return[s,r]},[i,n]=t();if(i&&n?this._tokenizer=new Fge(this._textModel.getLineCount(),i,this._textModel,this._languageIdCodec):this._tokenizer=null,this._backgroundTokenizer.clear(),this._defaultBackgroundTokenizer=null,this._tokenizer){const s={setTokens:r=>{this.setTokens(r)},backgroundTokenizationFinished:()=>{if(this._backgroundTokenizationState===2)return;const r=2;this._backgroundTokenizationState=r,this._onDidChangeBackgroundTokenizationState.fire()},setEndState:(r,a)=>{if(!this._tokenizer)return;const l=this._tokenizer.store.getFirstInvalidEndStateLineNumber();l!==null&&r>=l&&this._tokenizer?.store.setEndState(r,a)}};i&&i.createBackgroundTokenizer&&!i.backgroundTokenizerShouldOnlyVerifyTokens&&(this._backgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,s)),!this._backgroundTokenizer.value&&!this._textModel.isTooLargeForTokenization()&&(this._backgroundTokenizer.value=this._defaultBackgroundTokenizer=new Hge(this._tokenizer,s),this._defaultBackgroundTokenizer.handleChanges()),i?.backgroundTokenizerShouldOnlyVerifyTokens&&i.createBackgroundTokenizer?(this._debugBackgroundTokens=new Mv(this._languageIdCodec),this._debugBackgroundStates=new UP(this._textModel.getLineCount()),this._debugBackgroundTokenizer.clear(),this._debugBackgroundTokenizer.value=i.createBackgroundTokenizer(this._textModel,{setTokens:r=>{this._debugBackgroundTokens?.setMultilineTokens(r,this._textModel)},backgroundTokenizationFinished(){},setEndState:(r,a)=>{this._debugBackgroundStates?.setEndState(r,a)}})):(this._debugBackgroundTokens=void 0,this._debugBackgroundStates=void 0,this._debugBackgroundTokenizer.value=void 0)}this.refreshAllVisibleLineTokens()}handleDidChangeAttached(){this._defaultBackgroundTokenizer?.handleChanges()}handleDidChangeContent(e){if(e.isFlush)this.todo_resetTokenization(!1);else if(!e.isEolChange){for(const t of e.changes){const[i,n]=Dh(t.text);this._tokens.acceptEdit(t.range,i,n),this._debugBackgroundTokens?.acceptEdit(t.range,i,n)}this._debugBackgroundStates?.acceptChanges(e.changes),this._tokenizer&&this._tokenizer.store.acceptChanges(e.changes),this._defaultBackgroundTokenizer?.handleChanges()}}setTokens(e){const{changes:t}=this._tokens.setMultilineTokens(e,this._textModel);return t.length>0&&this._onDidChangeTokens.fire({semanticTokensApplied:!1,ranges:t}),{changes:t}}refreshAllVisibleLineTokens(){const e=ke.joinMany([...this._attachedViewStates].map(([t,i])=>i.lineRanges));this.refreshRanges(e)}refreshRanges(e){for(const t of e)this.refreshRange(t.startLineNumber,t.endLineNumberExclusive-1)}refreshRange(e,t){if(!this._tokenizer)return;e=Math.max(1,Math.min(this._textModel.getLineCount(),e)),t=Math.min(this._textModel.getLineCount(),t);const i=new zP,{heuristicTokens:n}=this._tokenizer.tokenizeHeuristically(i,e,t),s=this.setTokens(i.finalize());if(n)for(const r of s.changes)this._backgroundTokenizer.value?.requestTokens(r.fromLineNumber,r.toLineNumber+1);this._defaultBackgroundTokenizer?.checkFinished()}forceTokenization(e){const t=new zP;this._tokenizer?.updateTokensUntilLine(t,e),this.setTokens(t.finalize()),this._defaultBackgroundTokenizer?.checkFinished()}hasAccurateTokensForLine(e){return this._tokenizer?this._tokenizer.hasAccurateTokensForLine(e):!0}isCheapToTokenize(e){return this._tokenizer?this._tokenizer.isCheapToTokenize(e):!0}getLineTokens(e){const t=this._textModel.getLineContent(e),i=this._tokens.getTokens(this._textModel.getLanguageId(),e-1,t);if(this._debugBackgroundTokens&&this._debugBackgroundStates&&this._tokenizer&&this._debugBackgroundStates.getFirstInvalidEndStateLineNumberOrMax()>e&&this._tokenizer.store.getFirstInvalidEndStateLineNumberOrMax()>e){const n=this._debugBackgroundTokens.getTokens(this._textModel.getLanguageId(),e-1,t);!i.equals(n)&&this._debugBackgroundTokenizer.value?.reportMismatchingTokens&&this._debugBackgroundTokenizer.value.reportMismatchingTokens(e)}return i}getTokenTypeIfInsertingCharacter(e,t,i){if(!this._tokenizer)return 0;const n=this._textModel.validatePosition(new M(e,t));return this.forceTokenization(n.lineNumber),this._tokenizer.getTokenTypeIfInsertingCharacter(n,i)}tokenizeLinesAt(e,t){return this._tokenizer?(this.forceTokenization(e),this._tokenizer.tokenizeLinesAt(e,t)):null}get hasTokens(){return this._tokens.hasTokens}}var Xge=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Sx=function(o,e){return function(t,i){e(t,i,o)}},yx;let GP=yx=class extends Kz{constructor(e,t,i,n,s,r,a,l){super(),this._textModel=e,this._bracketPairsTextModelPart=t,this._languageId=i,this._attachedViews=n,this._languageService=s,this._languageConfigurationService=r,this._instantiationService=a,this._treeSitterLibraryService=l,this._languageIdObs=Le(this,this._languageId),this._useTreeSitter=j(this,d=>{const h=this._languageIdObs.read(d);return this._treeSitterLibraryService.supportsLanguage(h,d)}),this.tokens=j(this,d=>{let h;return this._useTreeSitter.read(d)?h=d.store.add(this._instantiationService.createInstance(qP,this._languageIdObs,this._languageService.languageIdCodec,this._textModel,this._attachedViews.visibleLineRanges)):h=d.store.add(new Yge(this._languageService.languageIdCodec,this._textModel,()=>this._languageId,this._attachedViews)),d.store.add(h.onDidChangeTokens(u=>{this._emitModelTokensChangedEvent(u)})),d.store.add(h.onDidChangeBackgroundTokenizationState(u=>{this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState()})),h});let c=!1;this.tokens.recomputeInitiallyAndOnChange(this._store,d=>{c&&d.todo_resetTokenization(),c=!0}),this._semanticTokens=new KP(this._languageService.languageIdCodec),this._onDidChangeLanguage=this._register(new P),this.onDidChangeLanguage=this._onDidChangeLanguage.event,this._onDidChangeLanguageConfiguration=this._register(new P),this.onDidChangeLanguageConfiguration=this._onDidChangeLanguageConfiguration.event,this._onDidChangeTokens=this._register(new P),this.onDidChangeTokens=this._onDidChangeTokens.event}handleLanguageConfigurationServiceChange(e){e.affects(this._languageId)&&this._onDidChangeLanguageConfiguration.fire({})}handleDidChangeContent(e){if(e.isFlush)this._semanticTokens.flush();else if(!e.isEolChange)for(const t of e.changes){const[i,n,s]=Dh(t.text);this._semanticTokens.acceptEdit(t.range,i,n,s,t.text.length>0?t.text.charCodeAt(0):0)}this.tokens.get().handleDidChangeContent(e)}handleDidChangeAttached(){this.tokens.get().handleDidChangeAttached()}getLineTokens(e){this.validateLineNumber(e);const t=this.tokens.get().getLineTokens(e);return this._semanticTokens.addSparseTokens(e,t)}_emitModelTokensChangedEvent(e){this._textModel._isDisposing()||(this._bracketPairsTextModelPart.handleDidChangeTokens(e),this._onDidChangeTokens.fire(e))}validateLineNumber(e){if(e<1||e>this._textModel.getLineCount())throw new Ce("Illegal value for lineNumber")}get hasTokens(){return this.tokens.get().hasTokens}resetTokenization(){this.tokens.get().todo_resetTokenization()}get backgroundTokenizationState(){return this.tokens.get().backgroundTokenizationState}forceTokenization(e){this.validateLineNumber(e),this.tokens.get().forceTokenization(e)}hasAccurateTokensForLine(e){return this.validateLineNumber(e),this.tokens.get().hasAccurateTokensForLine(e)}isCheapToTokenize(e){return this.validateLineNumber(e),this.tokens.get().isCheapToTokenize(e)}tokenizeIfCheap(e){this.validateLineNumber(e),this.tokens.get().tokenizeIfCheap(e)}getTokenTypeIfInsertingCharacter(e,t,i){return this.tokens.get().getTokenTypeIfInsertingCharacter(e,t,i)}tokenizeLinesAt(e,t){return this.tokens.get().tokenizeLinesAt(e,t)}setSemanticTokens(e,t){this._semanticTokens.set(e,t,this._textModel),this._emitModelTokensChangedEvent({semanticTokensApplied:e!==null,ranges:[{fromLineNumber:1,toLineNumber:this._textModel.getLineCount()}]})}hasCompleteSemanticTokens(){return this._semanticTokens.isComplete()}hasSomeSemanticTokens(){return!this._semanticTokens.isEmpty()}setPartialSemanticTokens(e,t){if(this.hasCompleteSemanticTokens())return;const i=this._textModel.validateRange(this._semanticTokens.setPartial(e,t));this._emitModelTokensChangedEvent({semanticTokensApplied:!0,ranges:[{fromLineNumber:i.startLineNumber,toLineNumber:i.endLineNumber}]})}getWordAtPosition(e){this.assertNotDisposed();const t=this._textModel.validatePosition(e),i=this._textModel.getLineContent(t.lineNumber),n=this.getLineTokens(t.lineNumber),s=n.findTokenIndexAtOffset(t.column-1),[r,a]=yx._findLanguageBoundaries(n,s),l=T1(t.column,this.getLanguageConfiguration(n.getLanguageId(s)).getWordDefinition(),i.substring(r,a),r);if(l&&l.startColumn<=e.column&&e.column<=l.endColumn)return l;if(s>0&&r===t.column-1){const[c,d]=yx._findLanguageBoundaries(n,s-1),h=T1(t.column,this.getLanguageConfiguration(n.getLanguageId(s-1)).getWordDefinition(),i.substring(c,d),c);if(h&&h.startColumn<=e.column&&e.column<=h.endColumn)return h}return null}getLanguageConfiguration(e){return this._languageConfigurationService.getLanguageConfiguration(e)}static _findLanguageBoundaries(e,t){const i=e.getLanguageId(t);let n=0;for(let r=t;r>=0&&e.getLanguageId(r)===i;r--)n=e.getStartOffset(r);let s=e.getLineContent().length;for(let r=t,a=e.getCount();r<a&&e.getLanguageId(r)===i;r++)s=e.getEndOffset(r);return[n,s]}getWordUntilPosition(e){const t=this.getWordAtPosition(e);return t?{word:t.word.substr(0,e.column-t.startColumn),startColumn:t.startColumn,endColumn:e.column}:{word:"",startColumn:e.column,endColumn:e.column}}getLanguageId(){return this._languageId}getLanguageIdAtPosition(e,t){const i=this._textModel.validatePosition(new M(e,t)),n=this.getLineTokens(i.lineNumber);return n.getLanguageId(n.findTokenIndexAtOffset(i.column-1))}setLanguageId(e,t="api"){if(this._languageId===e)return;const i={oldLanguage:this._languageId,newLanguage:e,source:t};this._languageId=e,this._languageIdObs.set(e,void 0),this._bracketPairsTextModelPart.handleDidChangeLanguage(i),this._onDidChangeLanguage.fire(i),this._onDidChangeLanguageConfiguration.fire({})}};GP=yx=Xge([Sx(4,Mt),Sx(5,Jt),Sx(6,ge),Sx(7,jP)],GP);const ZP=We("undoRedoService");class S${constructor(e,t){this.resource=e,this.elements=t}}const wC=class wC{constructor(){this.id=wC._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};wC._ID=0,wC.None=new wC;let YP=wC;const SC=class SC{constructor(){this.id=SC._ID++,this.order=1}nextOrder(){return this.id===0?0:this.order++}};SC._ID=0,SC.None=new SC;let Xf=SC;var y$;function Qge(o,e){const t=new Map;for(const i of o){const n=e(i);let s=t.get(n);s||(s=[],t.set(n,s)),s.push(i)}return t}function Jge(o,e){const t=[],i=[];for(const n of o)e.has(n)||t.push(n);for(const n of e)o.has(n)||i.push(n);return{removed:t,added:i}}function L$(o,e){const t=new Set;for(const i of e)o.has(i)&&t.add(i);return t}class x${constructor(e,t){this.toKey=t,this._map=new Map,this[y$]="SetWithKey";for(const i of e)this.add(i)}get size(){return this._map.size}add(e){const t=this.toKey(e);return this._map.set(t,e),this}delete(e){return this._map.delete(this.toKey(e))}has(e){return this._map.has(this.toKey(e))}*entries(){for(const e of this._map.values())yield[e,e]}keys(){return this.values()}*values(){for(const e of this._map.values())yield e}clear(){this._map.clear()}forEach(e,t){this._map.forEach(i=>e.call(t,i,i,this))}[Symbol.iterator](){return this.values()}}y$=Symbol.toStringTag;var epe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Lx=function(o,e){return function(t,i){e(t,i,o)}},Qf;function tpe(o){const e=new u$;return e.acceptChunk(o),e.finish()}function ipe(o){const e=new u$;let t;for(;typeof(t=o.read())=="string";)e.acceptChunk(t);return e.finish()}function k$(o,e){let t;return typeof o=="string"?t=tpe(o):boe(o)?t=ipe(o):t=o,t.create(e)}let xx=0;const npe=999,spe=1e4,ope=300;class rpe{constructor(e){this._source=e,this._eos=!1}read(){if(this._eos)return null;const e=[];let t=0,i=0;do{const n=this._source.read();if(n===null)return this._eos=!0,t===0?null:e.join("");if(n.length>0&&(e[t++]=n,i+=n.length),i>=64*1024)return e.join("")}while(!0)}}const Pv=()=>{throw new Error("Invalid change accessor")};let Jf=(tl=class extends A{static resolveOptions(e,t){if(t.detectIndentation){const i=GU(e,t.tabSize,t.insertSpaces);return new Xy({tabSize:i.tabSize,indentSize:"tabSize",insertSpaces:i.insertSpaces,trimAutoWhitespace:t.trimAutoWhitespace,defaultEOL:t.defaultEOL,bracketPairColorizationOptions:t.bracketPairColorizationOptions})}return new Xy(t)}get onDidChangeLanguage(){return this._tokenizationTextModelPart.onDidChangeLanguage}get onDidChangeLanguageConfiguration(){return this._tokenizationTextModelPart.onDidChangeLanguageConfiguration}get onDidChangeTokens(){return this._tokenizationTextModelPart.onDidChangeTokens}get onDidChangeOptions(){return this._onDidChangeOptions.event}get onDidChangeAttached(){return this._onDidChangeAttached.event}get onDidChangeLineHeight(){return this._onDidChangeLineHeight.event}get onDidChangeFont(){return this._onDidChangeFont.event}onDidChangeContent(e){return this._eventEmitter.slowEvent(t=>e(t.contentChangedEvent))}onDidChangeContentOrInjectedText(e){return jr(this._eventEmitter.fastEvent(t=>e(t)),this._onDidChangeInjectedText.event(t=>e(t)))}_isDisposing(){return this.__isDisposing}get tokenization(){return this._tokenizationTextModelPart}get bracketPairs(){return this._bracketPairs}get guides(){return this._guidesTextModelPart}constructor(e,t,i,n=null,s,r,a,l){super(),this._undoRedoService=s,this._languageService=r,this._languageConfigurationService=a,this.instantiationService=l,this._onWillDispose=this._register(new P),this.onWillDispose=this._onWillDispose.event,this._onDidChangeDecorations=this._register(new hpe((g,m,_)=>this.handleBeforeFireDecorationsChangedEvent(g,m,_))),this.onDidChangeDecorations=this._onDidChangeDecorations.event,this._onDidChangeOptions=this._register(new P),this._onDidChangeAttached=this._register(new P),this._onDidChangeInjectedText=this._register(new P),this._onDidChangeLineHeight=this._register(new P),this._onDidChangeFont=this._register(new P),this._eventEmitter=this._register(new upe),this._languageSelectionListener=this._register(new ct),this._deltaDecorationCallCnt=0,this._attachedViews=new yge,xx++,this.id="$model"+xx,this.isForSimpleWidget=i.isForSimpleWidget,typeof n>"u"||n===null?this._associatedResource=be.parse("inmemory://model/"+xx):this._associatedResource=n,this._attachedEditorCount=0;const{textBuffer:c,disposable:d}=k$(e,i.defaultEOL);this._buffer=c,this._bufferDisposable=d;const h=this._buffer.getLineCount(),u=this._buffer.getValueLengthInRange(new k(1,1,h,this._buffer.getLineLength(h)+1),0);i.largeFileOptimizations?(this._isTooLargeForTokenization=u>Qf.LARGE_FILE_SIZE_THRESHOLD||h>Qf.LARGE_FILE_LINE_COUNT_THRESHOLD,this._isTooLargeForHeapOperation=u>Qf.LARGE_FILE_HEAP_OPERATION_THRESHOLD):(this._isTooLargeForTokenization=!1,this._isTooLargeForHeapOperation=!1),this._options=Qf.resolveOptions(this._buffer,i);const f=typeof t=="string"?t:t.languageId;typeof t!="string"&&(this._languageSelectionListener.value=t.onDidChange(()=>this._setLanguage(t.languageId))),this._bracketPairs=this._register(new Kfe(this,this._languageConfigurationService)),this._guidesTextModelPart=this._register(new Nhe(this,this._languageConfigurationService)),this._decorationProvider=this._register(new Zfe(this)),this._tokenizationTextModelPart=this.instantiationService.createInstance(GP,this,this._bracketPairs,f,this._attachedViews),this._isTooLargeForSyncing=u>Qf._MODEL_SYNC_LIMIT,this._versionId=1,this._alternativeVersionId=1,this._initialUndoRedoSnapshot=null,this._isDisposed=!1,this.__isDisposing=!1,this._instanceId=s6(xx),this._lastDecorationId=0,this._decorations=Object.create(null),this._decorationsTree=new I$,this._commandManager=new TP(this,this._undoRedoService),this._isUndoing=!1,this._isRedoing=!1,this._trimAutoWhitespaceLines=null,this._register(this._decorationProvider.onDidChange(()=>{this._onDidChangeDecorations.beginDeferredEmit(),this._onDidChangeDecorations.fire(),this._onDidChangeDecorations.endDeferredEmit()})),this._languageService.requestRichLanguageFeatures(f),this._register(this._languageConfigurationService.onDidChange(g=>{this._bracketPairs.handleLanguageConfigurationServiceChange(g),this._tokenizationTextModelPart.handleLanguageConfigurationServiceChange(g)}))}dispose(){this.__isDisposing=!0,this._onWillDispose.fire(),this._tokenizationTextModelPart.dispose(),this._isDisposed=!0,super.dispose(),this._bufferDisposable.dispose(),this.__isDisposing=!1;const e=new P_([],"",`
`,!1,!1,!0,!0);e.dispose(),this._buffer=e,this._bufferDisposable=A.None}_assertNotDisposed(){if(this._isDisposed)throw new Ce("Model is disposed!")}getTextBuffer(){return this._assertNotDisposed(),this._buffer}_emitContentChangedEvent(e,t){this.__isDisposing||(this._tokenizationTextModelPart.handleDidChangeContent(t),this._bracketPairs.handleDidChangeContent(t),this._eventEmitter.fire(new $f(e,t)))}setValue(e,t=jn.setValue()){if(this._assertNotDisposed(),e==null)throw dr();const{textBuffer:i,disposable:n}=k$(e,this._options.defaultEOL);this._setValueFromTextBuffer(i,n,t)}_createContentChanged2(e,t,i,n,s,r,a,l,c,d){return{changes:[{range:e,rangeOffset:t,rangeLength:i,text:s}],eol:this._buffer.getEOL(),isEolChange:c,versionId:this.getVersionId(),isUndoing:r,isRedoing:a,isFlush:l,detailedReasons:[d],detailedReasonsChangeLengths:[1]}}_setValueFromTextBuffer(e,t,i){this._assertNotDisposed();const n=this.getFullModelRange(),s=this.getValueLengthInRange(n),r=this.getLineCount(),a=this.getLineMaxColumn(r);this._buffer=e,this._bufferDisposable.dispose(),this._bufferDisposable=t,this._increaseVersionId(),this._decorations=Object.create(null),this._decorationsTree=new I$,this._commandManager.clear(),this._trimAutoWhitespaceLines=null,this._emitContentChangedEvent(new I_([new pfe],this._versionId,!1,!1),this._createContentChanged2(new k(1,1,r,a),0,s,new M(r,a),this.getValue(),!1,!1,!0,!1,i))}setEOL(e){this._assertNotDisposed();const t=e===1?`\r
`:`
`;if(this._buffer.getEOL()===t)return;const i=this.getFullModelRange(),n=this.getValueLengthInRange(i),s=this.getLineCount(),r=this.getLineMaxColumn(s);this._onBeforeEOLChange(),this._buffer.setEOL(t),this._increaseVersionId(),this._onAfterEOLChange(),this._emitContentChangedEvent(new I_([new vfe],this._versionId,!1,!1),this._createContentChanged2(new k(1,1,s,r),0,n,new M(s,r),this.getValue(),!1,!1,!1,!0,jn.eolChange()))}_onBeforeEOLChange(){this._decorationsTree.ensureAllNodesHaveRanges(this)}_onAfterEOLChange(){const e=this.getVersionId(),t=this._decorationsTree.collectNodesPostOrder();for(let i=0,n=t.length;i<n;i++){const s=t[i],r=s.range,a=s.cachedAbsoluteStart-s.start,l=this._buffer.getOffsetAt(r.startLineNumber,r.startColumn),c=this._buffer.getOffsetAt(r.endLineNumber,r.endColumn);s.cachedAbsoluteStart=l,s.cachedAbsoluteEnd=c,s.cachedVersionId=e,s.start=l-a,s.end=c-a,Th(s)}}onBeforeAttached(){return this._attachedEditorCount++,this._attachedEditorCount===1&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.attachView()}onBeforeDetached(e){this._attachedEditorCount--,this._attachedEditorCount===0&&(this._tokenizationTextModelPart.handleDidChangeAttached(),this._onDidChangeAttached.fire(void 0)),this._attachedViews.detachView(e)}isAttachedToEditor(){return this._attachedEditorCount>0}getAttachedEditorCount(){return this._attachedEditorCount}isTooLargeForSyncing(){return this._isTooLargeForSyncing}isTooLargeForTokenization(){return this._isTooLargeForTokenization}isTooLargeForHeapOperation(){return this._isTooLargeForHeapOperation}isDisposed(){return this._isDisposed}isDominatedByLongLines(){if(this._assertNotDisposed(),this.isTooLargeForTokenization())return!1;let e=0,t=0;const i=this._buffer.getLineCount();for(let n=1;n<=i;n++){const s=this._buffer.getLineLength(n);s>=spe?t+=s:e+=s}return t>e}get uri(){return this._associatedResource}getOptions(){return this._assertNotDisposed(),this._options}getFormattingOptions(){return{tabSize:this._options.indentSize,insertSpaces:this._options.insertSpaces}}updateOptions(e){this._assertNotDisposed();const t=typeof e.tabSize<"u"?e.tabSize:this._options.tabSize,i=typeof e.indentSize<"u"?e.indentSize:this._options.originalIndentSize,n=typeof e.insertSpaces<"u"?e.insertSpaces:this._options.insertSpaces,s=typeof e.trimAutoWhitespace<"u"?e.trimAutoWhitespace:this._options.trimAutoWhitespace,r=typeof e.bracketColorizationOptions<"u"?e.bracketColorizationOptions:this._options.bracketPairColorizationOptions,a=new Xy({tabSize:t,indentSize:i,insertSpaces:n,defaultEOL:this._options.defaultEOL,trimAutoWhitespace:s,bracketPairColorizationOptions:r});if(this._options.equals(a))return;const l=this._options.createChangeEvent(a);this._options=a,this._bracketPairs.handleDidChangeOptions(l),this._decorationProvider.handleDidChangeOptions(l),this._onDidChangeOptions.fire(l)}detectIndentation(e,t){this._assertNotDisposed();const i=GU(this._buffer,t,e);this.updateOptions({insertSpaces:i.insertSpaces,tabSize:i.tabSize,indentSize:i.tabSize})}normalizeIndentation(e){return this._assertNotDisposed(),g2(e,this._options.indentSize,this._options.insertSpaces)}getVersionId(){return this._assertNotDisposed(),this._versionId}mightContainRTL(){return this._buffer.mightContainRTL()}mightContainUnusualLineTerminators(){return this._buffer.mightContainUnusualLineTerminators()}removeUnusualLineTerminators(e=null){const t=this.findMatches(i6.source,!1,!0,!1,null,!1,1073741824);this._buffer.resetMightContainUnusualLineTerminators(),this.pushEditOperations(e,t.map(i=>({range:i.range,text:null})),()=>null)}mightContainNonBasicASCII(){return this._buffer.mightContainNonBasicASCII()}getAlternativeVersionId(){return this._assertNotDisposed(),this._alternativeVersionId}getInitialUndoRedoSnapshot(){return this._assertNotDisposed(),this._initialUndoRedoSnapshot}getOffsetAt(e){this._assertNotDisposed();const t=this._validatePosition(e.lineNumber,e.column,0);return this._buffer.getOffsetAt(t.lineNumber,t.column)}getPositionAt(e){this._assertNotDisposed();const t=Math.min(this._buffer.getLength(),Math.max(0,e));return this._buffer.getPositionAt(t)}_increaseVersionId(){this._versionId=this._versionId+1,this._alternativeVersionId=this._versionId}_overwriteVersionId(e){this._versionId=e}_overwriteAlternativeVersionId(e){this._alternativeVersionId=e}_overwriteInitialUndoRedoSnapshot(e){this._initialUndoRedoSnapshot=e}getValue(e,t=!1){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new Ce("Operation would exceed heap memory limits");const i=this.getFullModelRange(),n=this.getValueInRange(i,e);return t?this._buffer.getBOM()+n:n}createSnapshot(e=!1){return new rpe(this._buffer.createSnapshot(e))}getValueLength(e,t=!1){this._assertNotDisposed();const i=this.getFullModelRange(),n=this.getValueLengthInRange(i,e);return t?this._buffer.getBOM().length+n:n}getValueInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueInRange(this.validateRange(e),t)}getValueLengthInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getValueLengthInRange(this.validateRange(e),t)}getCharacterCountInRange(e,t=0){return this._assertNotDisposed(),this._buffer.getCharacterCountInRange(this.validateRange(e),t)}getLineCount(){return this._assertNotDisposed(),this._buffer.getLineCount()}getLineContent(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Ce("Illegal value for lineNumber");return this._buffer.getLineContent(e)}getLineLength(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Ce("Illegal value for lineNumber");return this._buffer.getLineLength(e)}getLinesContent(){if(this._assertNotDisposed(),this.isTooLargeForHeapOperation())throw new Ce("Operation would exceed heap memory limits");return this._buffer.getLinesContent()}getEOL(){return this._assertNotDisposed(),this._buffer.getEOL()}getEndOfLineSequence(){return this._assertNotDisposed(),this._buffer.getEOL()===`
`?0:1}getLineMinColumn(e){return this._assertNotDisposed(),1}getLineMaxColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Ce("Illegal value for lineNumber");return this._buffer.getLineLength(e)+1}getLineFirstNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Ce("Illegal value for lineNumber");return this._buffer.getLineFirstNonWhitespaceColumn(e)}getLineLastNonWhitespaceColumn(e){if(this._assertNotDisposed(),e<1||e>this.getLineCount())throw new Ce("Illegal value for lineNumber");return this._buffer.getLineLastNonWhitespaceColumn(e)}_validateRangeRelaxedNoAllocations(e){const t=this._buffer.getLineCount(),i=e.startLineNumber,n=e.startColumn;let s=Math.floor(typeof i=="number"&&!isNaN(i)?i:1),r=Math.floor(typeof n=="number"&&!isNaN(n)?n:1);if(s<1)s=1,r=1;else if(s>t)s=t,r=this.getLineMaxColumn(s);else if(r<=1)r=1;else{const h=this.getLineMaxColumn(s);r>=h&&(r=h)}const a=e.endLineNumber,l=e.endColumn;let c=Math.floor(typeof a=="number"&&!isNaN(a)?a:1),d=Math.floor(typeof l=="number"&&!isNaN(l)?l:1);if(c<1)c=1,d=1;else if(c>t)c=t,d=this.getLineMaxColumn(c);else if(d<=1)d=1;else{const h=this.getLineMaxColumn(c);d>=h&&(d=h)}return i===s&&n===r&&a===c&&l===d&&e instanceof k&&!(e instanceof ce)?e:new k(s,r,c,d)}_isValidPosition(e,t,i){if(typeof e!="number"||typeof t!="number"||isNaN(e)||isNaN(t)||e<1||t<1||(e|0)!==e||(t|0)!==t)return!1;const n=this._buffer.getLineCount();if(e>n)return!1;if(t===1)return!0;const s=this.getLineMaxColumn(e);if(t>s)return!1;if(i===1){const r=this._buffer.getLineCharCode(e,t-2);if(zi(r))return!1}return!0}_validatePosition(e,t,i){const n=Math.floor(typeof e=="number"&&!isNaN(e)?e:1),s=Math.floor(typeof t=="number"&&!isNaN(t)?t:1),r=this._buffer.getLineCount();if(n<1)return new M(1,1);if(n>r)return new M(r,this.getLineMaxColumn(r));if(s<=1)return new M(n,1);const a=this.getLineMaxColumn(n);if(s>=a)return new M(n,a);if(i===1){const l=this._buffer.getLineCharCode(n,s-2);if(zi(l))return new M(n,s-1)}return new M(n,s)}validatePosition(e){return this._assertNotDisposed(),e instanceof M&&this._isValidPosition(e.lineNumber,e.column,1)?e:this._validatePosition(e.lineNumber,e.column,1)}isValidRange(e){return this._isValidRange(e,1)}_isValidRange(e,t){const i=e.startLineNumber,n=e.startColumn,s=e.endLineNumber,r=e.endColumn;if(!this._isValidPosition(i,n,0)||!this._isValidPosition(s,r,0))return!1;if(t===1){const a=n>1?this._buffer.getLineCharCode(i,n-2):0,l=r>1&&r<=this._buffer.getLineLength(s)?this._buffer.getLineCharCode(s,r-2):0,c=zi(a),d=zi(l);return!c&&!d}return!0}validateRange(e){if(this._assertNotDisposed(),e instanceof k&&!(e instanceof ce)&&this._isValidRange(e,1))return e;const i=this._validatePosition(e.startLineNumber,e.startColumn,0),n=this._validatePosition(e.endLineNumber,e.endColumn,0),s=i.lineNumber,r=i.column,a=n.lineNumber,l=n.column;{const c=r>1?this._buffer.getLineCharCode(s,r-2):0,d=l>1&&l<=this._buffer.getLineLength(a)?this._buffer.getLineCharCode(a,l-2):0,h=zi(c),u=zi(d);return!h&&!u?new k(s,r,a,l):s===a&&r===l?new k(s,r-1,a,l-1):h&&u?new k(s,r-1,a,l+1):h?new k(s,r-1,a,l):new k(s,r,a,l+1)}}modifyPosition(e,t){this._assertNotDisposed();const i=this.getOffsetAt(e)+t;return this.getPositionAt(Math.min(this._buffer.getLength(),Math.max(0,i)))}getFullModelRange(){this._assertNotDisposed();const e=this.getLineCount();return new k(1,1,e,this.getLineMaxColumn(e))}findMatchesLineByLine(e,t,i,n){return this._buffer.findMatchesLineByLine(e,t,i,n)}findMatches(e,t,i,n,s,r,a=npe){this._assertNotDisposed();let l=null;t!==null&&(Array.isArray(t)||(t=[t]),t.every(h=>k.isIRange(h))&&(l=t.map(h=>this.validateRange(h)))),l===null&&(l=[this.getFullModelRange()]),l=l.sort((h,u)=>h.startLineNumber-u.startLineNumber||h.startColumn-u.startColumn);const c=[];c.push(l.reduce((h,u)=>k.areIntersecting(h,u)?h.plusRange(u):(c.push(h),u)));let d;if(!i&&e.indexOf(`
`)<0){const u=new Kf(e,i,n,s).parseSearchRequest();if(!u)return[];d=f=>this.findMatchesLineByLine(f,u,r,a)}else d=h=>vx.findMatches(this,new Kf(e,i,n,s),h,r,a);return c.map(d).reduce((h,u)=>h.concat(u),[])}findNextMatch(e,t,i,n,s,r){this._assertNotDisposed();const a=this.validatePosition(t);if(!i&&e.indexOf(`
`)<0){const c=new Kf(e,i,n,s).parseSearchRequest();if(!c)return null;const d=this.getLineCount();let h=new k(a.lineNumber,a.column,d,this.getLineMaxColumn(d)),u=this.findMatchesLineByLine(h,c,r,1);return vx.findNextMatch(this,new Kf(e,i,n,s),a,r),u.length>0||(h=new k(1,1,a.lineNumber,this.getLineMaxColumn(a.lineNumber)),u=this.findMatchesLineByLine(h,c,r,1),u.length>0)?u[0]:null}return vx.findNextMatch(this,new Kf(e,i,n,s),a,r)}findPreviousMatch(e,t,i,n,s,r){this._assertNotDisposed();const a=this.validatePosition(t);return vx.findPreviousMatch(this,new Kf(e,i,n,s),a,r)}pushStackElement(){this._commandManager.pushStackElement()}popStackElement(){this._commandManager.popStackElement()}pushEOL(e){if((this.getEOL()===`
`?0:1)!==e)try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEOL(e)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_validateEditOperation(e){return e instanceof v2?e:new v2(e.identifier||null,this.validateRange(e.range),e.text,e.forceMoveMarkers||!1,e.isAutoWhitespaceEdit||!1,e._isTracked||!1)}_validateEditOperations(e){const t=[];for(let i=0,n=e.length;i<n;i++)t[i]=this._validateEditOperation(e[i]);return t}pushEditOperations(e,t,i,n,s){try{return this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._pushEditOperations(e,this._validateEditOperations(t),i,n,s)}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_pushEditOperations(e,t,i,n,s){if(this._options.trimAutoWhitespace&&this._trimAutoWhitespaceLines){const r=t.map(l=>({range:this.validateRange(l.range),text:l.text}));let a=!0;if(e)for(let l=0,c=e.length;l<c;l++){const d=e[l];let h=!1;for(let u=0,f=r.length;u<f;u++){const g=r[u].range,m=g.startLineNumber>d.endLineNumber,_=d.startLineNumber>g.endLineNumber;if(!m&&!_){h=!0;break}}if(!h){a=!1;break}}if(a)for(let l=0,c=this._trimAutoWhitespaceLines.length;l<c;l++){const d=this._trimAutoWhitespaceLines[l],h=this.getLineMaxColumn(d);let u=!0;for(let f=0,g=r.length;f<g;f++){const m=r[f].range,_=r[f].text;if(!(d<m.startLineNumber||d>m.endLineNumber)&&!(d===m.startLineNumber&&m.startColumn===h&&m.isEmpty()&&_&&_.length>0&&_.charAt(0)===`
`)&&!(d===m.startLineNumber&&m.startColumn===1&&m.isEmpty()&&_&&_.length>0&&_.charAt(_.length-1)===`
`)){u=!1;break}}if(u){const f=new k(d,1,d,h);t.push(new v2(null,f,null,!1,!1,!1))}}this._trimAutoWhitespaceLines=null}return this._initialUndoRedoSnapshot===null&&(this._initialUndoRedoSnapshot=this._undoRedoService.createSnapshot(this.uri)),this._commandManager.pushEditOperation(e,t,i,n,s)}_applyUndo(e,t,i,n){const s=e.map(r=>{const a=this.getPositionAt(r.newPosition),l=this.getPositionAt(r.newEnd);return{range:new k(a.lineNumber,a.column,l.lineNumber,l.column),text:r.oldText}});this._applyUndoRedoEdits(s,t,!0,!1,i,n)}_applyRedo(e,t,i,n){const s=e.map(r=>{const a=this.getPositionAt(r.oldPosition),l=this.getPositionAt(r.oldEnd);return{range:new k(a.lineNumber,a.column,l.lineNumber,l.column),text:r.newText}});this._applyUndoRedoEdits(s,t,!1,!0,i,n)}_applyUndoRedoEdits(e,t,i,n,s,r){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit(),this._isUndoing=i,this._isRedoing=n,this.applyEdits(e,!1),this.setEOL(t),this._overwriteAlternativeVersionId(s)}finally{this._isUndoing=!1,this._isRedoing=!1,this._eventEmitter.endDeferredEmit(r),this._onDidChangeDecorations.endDeferredEmit()}}applyEdits(e,t,i){try{this._onDidChangeDecorations.beginDeferredEmit(),this._eventEmitter.beginDeferredEmit();const n=this._validateEditOperations(e);return this._doApplyEdits(n,t??!1,i??jn.applyEdits())}finally{this._eventEmitter.endDeferredEmit(),this._onDidChangeDecorations.endDeferredEmit()}}_doApplyEdits(e,t,i){const n=this._buffer.getLineCount(),s=this._buffer.applyEdits(e,this._options.trimAutoWhitespace,t),r=this._buffer.getLineCount(),a=s.changes;if(this._trimAutoWhitespaceLines=s.trimAutoWhitespaceLineNumbers,a.length!==0){for(let d=0,h=a.length;d<h;d++){const u=a[d];this._decorationsTree.acceptReplace(u.rangeOffset,u.rangeLength,u.text.length,u.forceMoveMarkers)}const l=[];this._increaseVersionId();let c=n;for(let d=0,h=a.length;d<h;d++){const u=a[d],[f]=Dh(u.text);this._onDidChangeDecorations.fire();const g=u.range.startLineNumber,m=u.range.endLineNumber,_=m-g,b=f,C=Math.min(_,b),w=b-_,v=r-c-w+g,S=v,L=v+b,x=this._decorationsTree.getInjectedTextInInterval(this,this.getOffsetAt(new M(S,1)),this.getOffsetAt(new M(L,this.getLineMaxColumn(L))),0),I=Ma.fromDecorations(x),D=new Ec(I);for(let R=C;R>=0;R--){const F=g+R,O=v+R;D.takeFromEndWhile(V=>V.lineNumber>O);const B=D.takeFromEndWhile(V=>V.lineNumber===O);l.push(new IU(F,this.getLineContent(O),B))}if(C<_){const R=g+C;l.push(new bfe(R+1,m))}if(C<b){const R=new Ec(I),F=g+C,O=b-C,B=r-c-O+F+1,V=[],z=[];for(let ee=0;ee<O;ee++){const se=B+ee;z[ee]=this.getLineContent(se),R.takeWhile(oe=>oe.lineNumber<se),V[ee]=R.takeWhile(oe=>oe.lineNumber===se)}l.push(new Cfe(F+1,g+b,z,V))}c+=w}this._emitContentChangedEvent(new I_(l,this.getVersionId(),this._isUndoing,this._isRedoing),{changes:a,eol:this._buffer.getEOL(),isEolChange:!1,versionId:this.getVersionId(),isUndoing:this._isUndoing,isRedoing:this._isRedoing,isFlush:!1,detailedReasons:[i],detailedReasonsChangeLengths:[a.length]})}return s.reverseEdits===null?void 0:s.reverseEdits}undo(){return this._undoRedoService.undo(this.uri)}canUndo(){return this._undoRedoService.canUndo(this.uri)}redo(){return this._undoRedoService.redo(this.uri)}canRedo(){return this._undoRedoService.canRedo(this.uri)}handleBeforeFireDecorationsChangedEvent(e,t,i){if(e&&e.size>0){const s=Array.from(e).map(r=>new IU(r,this.getLineContent(r),this._getInjectedTextInLine(r)));this._onDidChangeInjectedText.fire(new DU(s))}if(t&&t.size>0){const s=Array.from(t).map(r=>new mfe(r.ownerId,r.decorationId,r.lineNumber,r.lineHeight));this._onDidChangeLineHeight.fire(new EU(s))}if(i&&i.size>0){const s=Array.from(i).map(r=>new _fe(r.ownerId,r.lineNumber));this._onDidChangeFont.fire(new NU(s))}}changeDecorations(e,t=0){this._assertNotDisposed();try{return this._onDidChangeDecorations.beginDeferredEmit(),this._changeDecorations(t,e)}finally{this._onDidChangeDecorations.endDeferredEmit()}}_changeDecorations(e,t){const i={addDecoration:(s,r)=>this._deltaDecorationsImpl(e,[],[{range:s,options:r}])[0],changeDecoration:(s,r)=>{this._changeDecorationImpl(e,s,r)},changeDecorationOptions:(s,r)=>{this._changeDecorationOptionsImpl(e,s,N$(r))},removeDecoration:s=>{this._deltaDecorationsImpl(e,[s],[])},deltaDecorations:(s,r)=>s.length===0&&r.length===0?[]:this._deltaDecorationsImpl(e,s,r)};let n=null;try{n=t(i)}catch(s){Ee(s)}return i.addDecoration=Pv,i.changeDecoration=Pv,i.changeDecorationOptions=Pv,i.removeDecoration=Pv,i.deltaDecorations=Pv,n}deltaDecorations(e,t,i=0){if(this._assertNotDisposed(),e||(e=[]),e.length===0&&t.length===0)return[];try{return this._deltaDecorationCallCnt++,this._deltaDecorationCallCnt>1&&(console.warn("Invoking deltaDecorations recursively could lead to leaking decorations."),Ee(new Error("Invoking deltaDecorations recursively could lead to leaking decorations."))),this._onDidChangeDecorations.beginDeferredEmit(),this._deltaDecorationsImpl(i,e,t)}finally{this._onDidChangeDecorations.endDeferredEmit(),this._deltaDecorationCallCnt--}}_getTrackedRange(e){return this.getDecorationRange(e)}_setTrackedRange(e,t,i){const n=e?this._decorations[e]:null;if(!n)return t?this._deltaDecorationsImpl(0,[],[{range:t,options:E$[i]}],!0)[0]:null;if(!t)return this._decorationsTree.delete(n),delete this._decorations[n.id],null;const s=this._validateRangeRelaxedNoAllocations(t),r=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);return this._decorationsTree.delete(n),n.reset(this.getVersionId(),r,a,s),n.setOptions(E$[i]),this._decorationsTree.insert(n),n.id}removeAllDecorationsWithOwnerId(e){if(this._isDisposed)return;const t=this._decorationsTree.collectNodesFromOwner(e);for(let i=0,n=t.length;i<n;i++){const s=t[i];this._decorationsTree.delete(s),delete this._decorations[s.id]}}getDecorationOptions(e){const t=this._decorations[e];return t?t.options:null}getDecorationRange(e){const t=this._decorations[e];return t?this._decorationsTree.getNodeRange(this,t):null}getLineDecorations(e,t=0,i=!1,n=!1){return e<1||e>this.getLineCount()?[]:this.getLinesDecorations(e,e,t,i,n)}getLinesDecorations(e,t,i=0,n=!1,s=!1,r=!1){const a=this.getLineCount(),l=Math.min(a,Math.max(1,e)),c=Math.min(a,Math.max(1,t)),d=this.getLineMaxColumn(c),h=new k(l,1,c,d),u=this._getDecorationsInRange(h,i,n,s,r);return VR(u,this._decorationProvider.getDecorationsInRange(h,i,n)),u}getDecorationsInRange(e,t=0,i=!1,n=!1,s=!1,r=!1){const a=this.validateRange(e),l=this._getDecorationsInRange(a,t,i,n,r);return VR(l,this._decorationProvider.getDecorationsInRange(a,t,i,s)),l}getOverviewRulerDecorations(e=0,t=!1,i=!1){return this._decorationsTree.getAll(this,e,t,i,!0,!1)}getInjectedTextDecorations(e=0){return this._decorationsTree.getAllInjectedText(this,e)}getCustomLineHeightsDecorations(e=0){return this._decorationsTree.getAllCustomLineHeights(this,e)}_getInjectedTextInLine(e){const t=this._buffer.getOffsetAt(e,1),i=t+this._buffer.getLineLength(e),n=this._decorationsTree.getInjectedTextInInterval(this,t,i,0);return Ma.fromDecorations(n).filter(s=>s.lineNumber===e)}getFontDecorationsInRange(e,t=0){const i=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),n=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getFontDecorationsInInterval(this,i,n,t)}getAllDecorations(e=0,t=!1,i=!1){let n=this._decorationsTree.getAll(this,e,t,i,!1,!1);return n=n.concat(this._decorationProvider.getAllDecorations(e,t)),n}getAllMarginDecorations(e=0){return this._decorationsTree.getAll(this,e,!1,!1,!1,!0)}_getDecorationsInRange(e,t,i,n,s){const r=this._buffer.getOffsetAt(e.startLineNumber,e.startColumn),a=this._buffer.getOffsetAt(e.endLineNumber,e.endColumn);return this._decorationsTree.getAllInInterval(this,r,a,t,i,n,s)}getRangeAt(e,t){return this._buffer.getRangeAt(e,t-e)}_changeDecorationImpl(e,t,i){const n=this._decorations[t];if(!n)return;if(n.options.after){const l=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.endLineNumber)}if(n.options.before){const l=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByInjectedText(l.startLineNumber)}if(n.options.lineHeight!==null){const l=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,l.startLineNumber,null)}if(n.options.affectsFont){const l=this.getDecorationRange(t);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,l.startLineNumber)}const s=this._validateRangeRelaxedNoAllocations(i),r=this._buffer.getOffsetAt(s.startLineNumber,s.startColumn),a=this._buffer.getOffsetAt(s.endLineNumber,s.endColumn);this._decorationsTree.delete(n),n.reset(this.getVersionId(),r,a,s),this._decorationsTree.insert(n),this._onDidChangeDecorations.checkAffectedAndFire(n.options),n.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(s.endLineNumber),n.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(s.startLineNumber),n.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,s.startLineNumber,n.options.lineHeight),n.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,n.id,s.startLineNumber)}_changeDecorationOptionsImpl(e,t,i){const n=this._decorations[t];if(!n)return;const s=!!(n.options.overviewRuler&&n.options.overviewRuler.color),r=!!(i.overviewRuler&&i.overviewRuler.color);if(this._onDidChangeDecorations.checkAffectedAndFire(n.options),this._onDidChangeDecorations.checkAffectedAndFire(i),n.options.after||i.after){const c=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.endLineNumber)}if(n.options.before||i.before){const c=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByInjectedText(c.startLineNumber)}if(n.options.lineHeight!==null||i.lineHeight!==null){const c=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,t,c.startLineNumber,i.lineHeight)}if(n.options.affectsFont||i.affectsFont){const c=this._decorationsTree.getNodeRange(this,n);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,t,c.startLineNumber)}const a=s!==r,l=ape(i)!==kx(n);a||l?(this._decorationsTree.delete(n),n.setOptions(i),this._decorationsTree.insert(n)):n.setOptions(i)}_deltaDecorationsImpl(e,t,i,n=!1){const s=this.getVersionId(),r=t.length;let a=0;const l=i.length;let c=0;this._onDidChangeDecorations.beginDeferredEmit();try{const d=new Array(l);for(;a<r||c<l;){let h=null;if(a<r){let u;do u=t[a++],h=this._decorations[u];while(!h&&a<r);if(h){if(h.options.after){const f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber)}if(h.options.before){const f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber)}if(h.options.lineHeight!==null){const f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,u,f.startLineNumber,null)}if(h.options.affectsFont){const f=this._decorationsTree.getNodeRange(this,h);this._onDidChangeDecorations.recordLineAffectedByFontChange(e,u,f.startLineNumber)}this._decorationsTree.delete(h),n||this._onDidChangeDecorations.checkAffectedAndFire(h.options)}}if(c<l){if(!h){const b=++this._lastDecorationId,C=`${this._instanceId};${b}`;h=new n$(C,0,0),this._decorations[C]=h}const u=i[c],f=this._validateRangeRelaxedNoAllocations(u.range),g=N$(u.options),m=this._buffer.getOffsetAt(f.startLineNumber,f.startColumn),_=this._buffer.getOffsetAt(f.endLineNumber,f.endColumn);h.ownerId=e,h.reset(s,m,_,f),h.setOptions(g),h.options.after&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.endLineNumber),h.options.before&&this._onDidChangeDecorations.recordLineAffectedByInjectedText(f.startLineNumber),h.options.lineHeight!==null&&this._onDidChangeDecorations.recordLineAffectedByLineHeightChange(e,h.id,f.startLineNumber,h.options.lineHeight),h.options.affectsFont&&this._onDidChangeDecorations.recordLineAffectedByFontChange(e,h.id,f.startLineNumber),n||this._onDidChangeDecorations.checkAffectedAndFire(g),this._decorationsTree.insert(h),d[c]=h.id,c++}else h&&delete this._decorations[h.id]}return d}finally{this._onDidChangeDecorations.endDeferredEmit()}}getLanguageId(){return this.tokenization.getLanguageId()}setLanguage(e,t){typeof e=="string"?(this._languageSelectionListener.clear(),this._setLanguage(e,t)):(this._languageSelectionListener.value=e.onDidChange(()=>this._setLanguage(e.languageId,t)),this._setLanguage(e.languageId,t))}_setLanguage(e,t){this.tokenization.setLanguageId(e,t),this._languageService.requestRichLanguageFeatures(e)}getLanguageIdAtPosition(e,t){return this.tokenization.getLanguageIdAtPosition(e,t)}getWordAtPosition(e){return this._tokenizationTextModelPart.getWordAtPosition(e)}getWordUntilPosition(e){return this._tokenizationTextModelPart.getWordUntilPosition(e)}normalizePosition(e,t){return e}getLineIndentColumn(e){return XP(this.getLineContent(e))+1}toString(){return`TextModel(${this.uri.toString()})`}},Qf=tl,tl._MODEL_SYNC_LIMIT=50*1024*1024,tl.LARGE_FILE_SIZE_THRESHOLD=20*1024*1024,tl.LARGE_FILE_LINE_COUNT_THRESHOLD=300*1e3,tl.LARGE_FILE_HEAP_OPERATION_THRESHOLD=256*1024*1024,tl.DEFAULT_CREATION_OPTIONS={isForSimpleWidget:!1,tabSize:Un.tabSize,indentSize:Un.indentSize,insertSpaces:Un.insertSpaces,detectIndentation:!1,defaultEOL:1,trimAutoWhitespace:Un.trimAutoWhitespace,largeFileOptimizations:Un.largeFileOptimizations,bracketPairColorizationOptions:Un.bracketPairColorizationOptions},tl);Jf=Qf=epe([Lx(4,ZP),Lx(5,Mt),Lx(6,Jt),Lx(7,ge)],Jf);function XP(o){let e=0;for(const t of o)if(t===" "||t===" ")e++;else break;return e}function QP(o){return!!(o.options.overviewRuler&&o.options.overviewRuler.color)}function ape(o){return!!o.after||!!o.before}function kx(o){return!!o.options.after||!!o.options.before}class I${constructor(){this._decorationsTree0=new RP,this._decorationsTree1=new RP,this._injectedTextDecorationsTree=new RP}ensureAllNodesHaveRanges(e){this.getAll(e,0,!1,!1,!1,!1)}_ensureNodesHaveRanges(e,t){for(const i of t)i.range===null&&(i.range=e.getRangeAt(i.cachedAbsoluteStart,i.cachedAbsoluteEnd));return t}getAllInInterval(e,t,i,n,s,r,a){const l=e.getVersionId(),c=this._intervalSearch(t,i,n,s,r,l,a);return this._ensureNodesHaveRanges(e,c)}_intervalSearch(e,t,i,n,s,r,a){const l=this._decorationsTree0.intervalSearch(e,t,i,n,s,r,a),c=this._decorationsTree1.intervalSearch(e,t,i,n,s,r,a),d=this._injectedTextDecorationsTree.intervalSearch(e,t,i,n,s,r,a);return l.concat(c).concat(d)}getInjectedTextInInterval(e,t,i,n){const s=e.getVersionId(),r=this._injectedTextDecorationsTree.intervalSearch(t,i,n,!1,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>a.options.showIfCollapsed||!a.range.isEmpty())}getFontDecorationsInInterval(e,t,i,n){const s=e.getVersionId(),r=this._decorationsTree0.intervalSearch(t,i,n,!1,!1,s,!1);return this._ensureNodesHaveRanges(e,r).filter(a=>a.options.affectsFont)}getAllInjectedText(e,t){const i=e.getVersionId(),n=this._injectedTextDecorationsTree.search(t,!1,!1,i,!1);return this._ensureNodesHaveRanges(e,n).filter(s=>s.options.showIfCollapsed||!s.range.isEmpty())}getAllCustomLineHeights(e,t){const i=e.getVersionId(),n=this._search(t,!1,!1,!1,i,!1);return this._ensureNodesHaveRanges(e,n).filter(s=>typeof s.options.lineHeight=="number")}getAll(e,t,i,n,s,r){const a=e.getVersionId(),l=this._search(t,i,n,s,a,r);return this._ensureNodesHaveRanges(e,l)}_search(e,t,i,n,s,r){if(n)return this._decorationsTree1.search(e,t,i,s,r);{const a=this._decorationsTree0.search(e,t,i,s,r),l=this._decorationsTree1.search(e,t,i,s,r),c=this._injectedTextDecorationsTree.search(e,t,i,s,r);return a.concat(l).concat(c)}}collectNodesFromOwner(e){const t=this._decorationsTree0.collectNodesFromOwner(e),i=this._decorationsTree1.collectNodesFromOwner(e),n=this._injectedTextDecorationsTree.collectNodesFromOwner(e);return t.concat(i).concat(n)}collectNodesPostOrder(){const e=this._decorationsTree0.collectNodesPostOrder(),t=this._decorationsTree1.collectNodesPostOrder(),i=this._injectedTextDecorationsTree.collectNodesPostOrder();return e.concat(t).concat(i)}insert(e){kx(e)?this._injectedTextDecorationsTree.insert(e):QP(e)?this._decorationsTree1.insert(e):this._decorationsTree0.insert(e)}delete(e){kx(e)?this._injectedTextDecorationsTree.delete(e):QP(e)?this._decorationsTree1.delete(e):this._decorationsTree0.delete(e)}getNodeRange(e,t){const i=e.getVersionId();return t.cachedVersionId!==i&&this._resolveNode(t,i),t.range===null&&(t.range=e.getRangeAt(t.cachedAbsoluteStart,t.cachedAbsoluteEnd)),t.range}_resolveNode(e,t){kx(e)?this._injectedTextDecorationsTree.resolveNode(e,t):QP(e)?this._decorationsTree1.resolveNode(e,t):this._decorationsTree0.resolveNode(e,t)}acceptReplace(e,t,i,n){this._decorationsTree0.acceptReplace(e,t,i,n),this._decorationsTree1.acceptReplace(e,t,i,n),this._injectedTextDecorationsTree.acceptReplace(e,t,i,n)}}function Dl(o){return o.replace(/[^a-z0-9\-_]/gi," ")}class D${constructor(e){this.color=e.color||"",this.darkColor=e.darkColor||""}}class lpe extends D${constructor(e){super(e),this._resolvedColor=null,this.position=typeof e.position=="number"?e.position:Ao.Center}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=null}_resolveColor(e,t){if(typeof e=="string")return e;const i=e?t.getColor(e.id):null;return i?i.toString():""}}class cpe{constructor(e){this.position=e?.position??xa.Center,this.persistLane=e?.persistLane}}class dpe extends D${constructor(e){super(e),this.position=e.position,this.sectionHeaderStyle=e.sectionHeaderStyle??null,this.sectionHeaderText=e.sectionHeaderText??null}getColor(e){return this._resolvedColor||(e.type!=="light"&&this.darkColor?this._resolvedColor=this._resolveColor(this.darkColor,e):this._resolvedColor=this._resolveColor(this.color,e)),this._resolvedColor}invalidateCachedColor(){this._resolvedColor=void 0}_resolveColor(e,t){return typeof e=="string"?$.fromHex(e):t.getColor(e.id)}}class Mh{static from(e){return e instanceof Mh?e:new Mh(e)}constructor(e){this.content=e.content||"",this.tokens=e.tokens??null,this.inlineClassName=e.inlineClassName||null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.attachedData=e.attachedData||null,this.cursorStops=e.cursorStops||null}}class Te{static register(e){return new Te(e)}static createDynamic(e){return new Te(e)}constructor(e){this.description=e.description,this.blockClassName=e.blockClassName?Dl(e.blockClassName):null,this.blockDoesNotCollapse=e.blockDoesNotCollapse??null,this.blockIsAfterEnd=e.blockIsAfterEnd??null,this.blockPadding=e.blockPadding??null,this.stickiness=e.stickiness||0,this.zIndex=e.zIndex||0,this.className=e.className?Dl(e.className):null,this.shouldFillLineOnLineBreak=e.shouldFillLineOnLineBreak??null,this.hoverMessage=e.hoverMessage||null,this.glyphMarginHoverMessage=e.glyphMarginHoverMessage||null,this.lineNumberHoverMessage=e.lineNumberHoverMessage||null,this.isWholeLine=e.isWholeLine||!1,this.lineHeight=e.lineHeight?Math.min(e.lineHeight,ope):null,this.fontSize=e.fontSize||null,this.affectsFont=!!e.fontSize||!!e.fontFamily||!!e.fontWeight||!!e.fontStyle,this.showIfCollapsed=e.showIfCollapsed||!1,this.collapseOnReplaceEdit=e.collapseOnReplaceEdit||!1,this.overviewRuler=e.overviewRuler?new lpe(e.overviewRuler):null,this.minimap=e.minimap?new dpe(e.minimap):null,this.glyphMargin=e.glyphMarginClassName?new cpe(e.glyphMargin):null,this.glyphMarginClassName=e.glyphMarginClassName?Dl(e.glyphMarginClassName):null,this.linesDecorationsClassName=e.linesDecorationsClassName?Dl(e.linesDecorationsClassName):null,this.lineNumberClassName=e.lineNumberClassName?Dl(e.lineNumberClassName):null,this.linesDecorationsTooltip=e.linesDecorationsTooltip?Lie(e.linesDecorationsTooltip):null,this.firstLineDecorationClassName=e.firstLineDecorationClassName?Dl(e.firstLineDecorationClassName):null,this.marginClassName=e.marginClassName?Dl(e.marginClassName):null,this.inlineClassName=e.inlineClassName?Dl(e.inlineClassName):null,this.inlineClassNameAffectsLetterSpacing=e.inlineClassNameAffectsLetterSpacing||!1,this.beforeContentClassName=e.beforeContentClassName?Dl(e.beforeContentClassName):null,this.afterContentClassName=e.afterContentClassName?Dl(e.afterContentClassName):null,this.after=e.after?Mh.from(e.after):null,this.before=e.before?Mh.from(e.before):null,this.hideInCommentTokens=e.hideInCommentTokens??!1,this.hideInStringTokens=e.hideInStringTokens??!1,this.textDirection=e.textDirection??null}}Te.EMPTY=Te.register({description:"empty"});const E$=[Te.register({description:"tracked-range-always-grows-when-typing-at-edges",stickiness:0}),Te.register({description:"tracked-range-never-grows-when-typing-at-edges",stickiness:1}),Te.register({description:"tracked-range-grows-only-when-typing-before",stickiness:2}),Te.register({description:"tracked-range-grows-only-when-typing-after",stickiness:3})];function N$(o){return o instanceof Te?o:Te.createDynamic(o)}class T${static toKey(e){return`${e.ownerId};${e.decorationId};${e.lineNumber}`}constructor(e,t,i,n){this.ownerId=e,this.decorationId=t,this.lineNumber=i,this.lineHeight=n}}class R${static toKey(e){return`${e.ownerId};${e.decorationId};${e.lineNumber}`}constructor(e,t,i){this.ownerId=e,this.decorationId=t,this.lineNumber=i}}class hpe extends A{constructor(e){super(),this.handleBeforeFire=e,this._actual=this._register(new P),this.event=this._actual.event,this._affectedInjectedTextLines=null,this._affectedLineHeights=null,this._affectedFontLines=null,this._deferredCnt=0,this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._affectsLineNumber=!1}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(){this._deferredCnt--,this._deferredCnt===0&&(this._shouldFireDeferred&&this.doFire(),this._affectedInjectedTextLines?.clear(),this._affectedInjectedTextLines=null,this._affectedLineHeights?.clear(),this._affectedLineHeights=null,this._affectedFontLines?.clear(),this._affectedFontLines=null)}recordLineAffectedByInjectedText(e){this._affectedInjectedTextLines||(this._affectedInjectedTextLines=new Set),this._affectedInjectedTextLines.add(e)}recordLineAffectedByLineHeightChange(e,t,i,n){this._affectedLineHeights||(this._affectedLineHeights=new x$([],T$.toKey)),this._affectedLineHeights.add(new T$(e,t,i,n))}recordLineAffectedByFontChange(e,t,i){this._affectedFontLines||(this._affectedFontLines=new x$([],R$.toKey)),this._affectedFontLines.add(new R$(e,t,i))}checkAffectedAndFire(e){this._affectsMinimap||=!!e.minimap?.position,this._affectsOverviewRuler||=!!e.overviewRuler?.color,this._affectsGlyphMargin||=!!e.glyphMarginClassName,this._affectsLineNumber||=!!e.lineNumberClassName,this.tryFire()}fire(){this._affectsMinimap=!0,this._affectsOverviewRuler=!0,this._affectsGlyphMargin=!0,this.tryFire()}tryFire(){this._deferredCnt===0?this.doFire():this._shouldFireDeferred=!0}doFire(){this.handleBeforeFire(this._affectedInjectedTextLines,this._affectedLineHeights,this._affectedFontLines);const e={affectsMinimap:this._affectsMinimap,affectsOverviewRuler:this._affectsOverviewRuler,affectsGlyphMargin:this._affectsGlyphMargin,affectsLineNumber:this._affectsLineNumber};this._shouldFireDeferred=!1,this._affectsMinimap=!1,this._affectsOverviewRuler=!1,this._affectsGlyphMargin=!1,this._actual.fire(e)}}class upe extends A{constructor(){super(),this._fastEmitter=this._register(new P),this.fastEvent=this._fastEmitter.event,this._slowEmitter=this._register(new P),this.slowEvent=this._slowEmitter.event,this._deferredCnt=0,this._deferredEvent=null}beginDeferredEmit(){this._deferredCnt++}endDeferredEmit(e=null){if(this._deferredCnt--,this._deferredCnt===0&&this._deferredEvent!==null){this._deferredEvent.rawContentChangedEvent.resultingSelection=e;const t=this._deferredEvent;this._deferredEvent=null,this._fastEmitter.fire(t),this._slowEmitter.fire(t)}}fire(e){if(this._deferredCnt>0){this._deferredEvent?this._deferredEvent=this._deferredEvent.merge(e):this._deferredEvent=e;return}this._fastEmitter.fire(e),this._slowEmitter.fire(e)}}const he=We("ILanguageFeaturesService");class JP{static create(e){return new JP(e.get(151),e.get(150))}constructor(e,t){this.classifier=new fpe(e,t)}createLineBreaksComputer(e,t,i,n,s,r){const a=[],l=[],c=[];return{addRequest:(d,h,u)=>{a.push(d),l.push(h),c.push(u)},finalize:()=>{const d=e.typicalFullwidthCharacterWidth/e.typicalHalfwidthCharacterWidth,h=[];for(let u=0,f=a.length;u<f;u++){const g=l[u],m=c[u];m&&!m.injectionOptions&&!g&&!r?h[u]=gpe(this.classifier,m,a[u],t,i,d,n,s):h[u]=ppe(this.classifier,a[u],g,t,i,d,n,s,r)}return eA.length=0,tA.length=0,h}}}}class fpe extends qm{constructor(e,t){super(0);for(let i=0;i<e.length;i++)this.set(e.charCodeAt(i),1);for(let i=0;i<t.length;i++)this.set(t.charCodeAt(i),2)}get(e){return e>=0&&e<256?this._asciiMap[e]:e>=12352&&e<=12543||e>=13312&&e<=19903||e>=19968&&e<=40959?3:this._map.get(e)||this._defaultValue}}let eA=[],tA=[];function gpe(o,e,t,i,n,s,r,a){if(n===-1)return null;const l=t.length;if(l<=1)return null;const c=a==="keepAll",d=e.breakOffsets,h=e.breakOffsetsVisibleColumn,u=P$(t,i,n,s,r),f=n-u,g=eA,m=tA;let _=0,b=0,C=0,w=n;const v=d.length;let S=0;if(S>=0){let L=Math.abs(h[S]-w);for(;S+1<v;){const x=Math.abs(h[S+1]-w);if(x>=L)break;L=x,S++}}for(;S<v;){let L=S<0?0:d[S],x=S<0?0:h[S];b>L&&(L=b,x=C);let I=0,D=0,R=0,F=0;if(x<=w){let B=x,V=L===0?0:t.charCodeAt(L-1),z=L===0?0:o.get(V),ee=!0;for(let se=L;se<l;se++){const oe=se,fe=t.charCodeAt(se);let Ie,Ae;if(zi(fe)?(se++,Ie=0,Ae=2):(Ie=o.get(fe),Ae=Av(fe,B,i,s)),oe>b&&iA(V,z,fe,Ie,c)&&(I=oe,D=B),B+=Ae,B>w){oe>b?(R=oe,F=B-Ae):(R=se+1,F=B),B-D>f&&(I=0),ee=!1;break}V=fe,z=Ie}if(ee){_>0&&(g[_]=d[d.length-1],m[_]=h[d.length-1],_++);break}}if(I===0){let B=x,V=t.charCodeAt(L),z=o.get(V),ee=!1;for(let se=L-1;se>=b;se--){const oe=se+1,fe=t.charCodeAt(se);if(fe===9){ee=!0;break}let Ie,Ae;if(eh(fe)?(se--,Ie=0,Ae=2):(Ie=o.get(fe),Ae=th(fe)?s:1),B<=w){if(R===0&&(R=oe,F=B),B<=w-f)break;if(iA(fe,Ie,V,z,c)){I=oe,D=B;break}}B-=Ae,V=fe,z=Ie}if(I!==0){const se=f-(F-D);if(se<=i){const oe=t.charCodeAt(R);let fe;zi(oe)?fe=2:fe=Av(oe,F,i,s),se-fe<0&&(I=0)}}if(ee){S--;continue}}if(I===0&&(I=R,D=F),I<=b){const B=t.charCodeAt(b);zi(B)?(I=b+2,D=C+2):(I=b+1,D=C+Av(B,C,i,s))}for(b=I,g[_]=I,C=D,m[_]=D,_++,w=D+f;S<0||S<v&&h[S]<D;)S++;let O=Math.abs(h[S]-w);for(;S+1<v;){const B=Math.abs(h[S+1]-w);if(B>=O)break;O=B,S++}}return _===0?null:(g.length=_,m.length=_,eA=e.breakOffsets,tA=e.breakOffsetsVisibleColumn,e.breakOffsets=g,e.breakOffsetsVisibleColumn=m,e.wrappedTextIndentLength=u,e)}function ppe(o,e,t,i,n,s,r,a,l){const c=Ma.applyInjectedText(e,t);let d,h;if(t&&t.length>0?(d=t.map(R=>R.options),h=t.map(R=>R.column-1)):(d=null,h=null),n===-1)return d?new Cv(h,d,[c.length],[],0):null;const u=c.length;if(u<=1)return d?new Cv(h,d,[c.length],[],0):null;const f=a==="keepAll",g=P$(c,i,n,s,r),m=n-g,_=[],b=[];let C=0,w=0,v=0,S=n,L=c.charCodeAt(0),x=o.get(L),I=Av(L,0,i,s),D=1;zi(L)&&(I+=1,L=c.charCodeAt(1),x=o.get(L),D++);for(let R=D;R<u;R++){const F=R,O=c.charCodeAt(R);let B,V;zi(O)?(R++,B=0,V=2):(B=o.get(O),V=Av(O,I,i,s)),iA(L,x,O,B,f)&&(w=F,v=I),I+=V,l&&mpe(c,R)&&(I+=S),I>S&&((w===0||I-v>m)&&(w=F,v=I-V),_[C]=w,b[C]=v,C++,S=v+m,w=0),L=O,x=B}return C===0&&(!t||t.length===0)?null:(_[C]=u,b[C]=I,new Cv(h,d,_,b,g))}function Av(o,e,t,i){return o===9?t-e%t:th(o)||o<32?i:1}function M$(o,e){return e-o%e}function mpe(o,e){return e>=2&&(e<3||o.charAt(e-3)!=="\\")&&o.charAt(e-2)==="\\"&&o.charAt(e-1)==="n"&&o.includes('"')}function iA(o,e,t,i,n){return t!==32&&(e===2&&i!==2||e!==1&&i===1||!n&&e===3&&i!==2||!n&&i===3&&e!==1)}function P$(o,e,t,i,n){let s=0;if(n!==0){const r=es(o);if(r!==-1){for(let l=0;l<r;l++){const c=o.charCodeAt(l)===9?M$(s,e):1;s+=c}const a=n===3?2:n===2?1:0;for(let l=0;l<a;l++){const c=M$(s,e);s+=c}s+i>t&&(s=0)}}return s}class Ix{constructor(e){this._selTrackedRange=null,this._trackSelection=!0,this._setState(e,new mn(new k(1,1,1,1),0,0,new M(1,1),0),new mn(new k(1,1,1,1),0,0,new M(1,1),0))}dispose(e){this._removeTrackedRange(e)}startTrackingSelection(e){this._trackSelection=!0,this._updateTrackedRange(e)}stopTrackingSelection(e){this._trackSelection=!1,this._removeTrackedRange(e)}_updateTrackedRange(e){this._trackSelection&&(this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,this.modelState.selection,0))}_removeTrackedRange(e){this._selTrackedRange=e.model._setTrackedRange(this._selTrackedRange,null,0)}asCursorState(){return new nt(this.modelState,this.viewState)}readSelectionFromMarkers(e){const t=e.model._getTrackedRange(this._selTrackedRange);return this.modelState.selection.isEmpty()&&!t.isEmpty()?ce.fromRange(t.collapseToEnd(),this.modelState.selection.getDirection()):ce.fromRange(t,this.modelState.selection.getDirection())}ensureValidState(e){this._setState(e,this.modelState,this.viewState)}setState(e,t,i){this._setState(e,t,i)}static _validatePositionWithCache(e,t,i,n){return t.equals(i)?n:e.normalizePosition(t,2)}static _validateViewState(e,t){const i=t.position,n=t.selectionStart.getStartPosition(),s=t.selectionStart.getEndPosition(),r=e.normalizePosition(i,2),a=this._validatePositionWithCache(e,n,i,r),l=this._validatePositionWithCache(e,s,n,a);return i.equals(r)&&n.equals(a)&&s.equals(l)?t:new mn(k.fromPositions(a,l),t.selectionStartKind,t.selectionStartLeftoverVisibleColumns+n.column-a.column,r,t.leftoverVisibleColumns+i.column-r.column)}_setState(e,t,i){if(i&&(i=Ix._validateViewState(e.viewModel,i)),t){const n=e.model.validateRange(t.selectionStart),s=t.selectionStart.equalsRange(n)?t.selectionStartLeftoverVisibleColumns:0,r=e.model.validatePosition(t.position),a=t.position.equals(r)?t.leftoverVisibleColumns:0;t=new mn(n,t.selectionStartKind,s,r,a)}else{if(!i)return;const n=e.model.validateRange(e.coordinatesConverter.convertViewRangeToModelRange(i.selectionStart)),s=e.model.validatePosition(e.coordinatesConverter.convertViewPositionToModelPosition(i.position));t=new mn(n,i.selectionStartKind,i.selectionStartLeftoverVisibleColumns,s,i.leftoverVisibleColumns)}if(i){const n=e.coordinatesConverter.validateViewRange(i.selectionStart,t.selectionStart),s=e.coordinatesConverter.validateViewPosition(i.position,t.position);i=new mn(n,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,s,t.leftoverVisibleColumns)}else{const n=e.coordinatesConverter.convertModelPositionToViewPosition(new M(t.selectionStart.startLineNumber,t.selectionStart.startColumn)),s=e.coordinatesConverter.convertModelPositionToViewPosition(new M(t.selectionStart.endLineNumber,t.selectionStart.endColumn)),r=new k(n.lineNumber,n.column,s.lineNumber,s.column),a=e.coordinatesConverter.convertModelPositionToViewPosition(t.position);i=new mn(r,t.selectionStartKind,t.selectionStartLeftoverVisibleColumns,a,t.leftoverVisibleColumns)}this.modelState=t,this.viewState=i,this._updateTrackedRange(e)}}class A${constructor(e){this.context=e,this.cursors=[new Ix(e)],this.lastAddedCursorIndex=0}dispose(){for(const e of this.cursors)e.dispose(this.context)}startTrackingSelections(){for(const e of this.cursors)e.startTrackingSelection(this.context)}stopTrackingSelections(){for(const e of this.cursors)e.stopTrackingSelection(this.context)}updateContext(e){this.context=e}ensureValidState(){for(const e of this.cursors)e.ensureValidState(this.context)}readSelectionFromMarkers(){return this.cursors.map(e=>e.readSelectionFromMarkers(this.context))}getAll(){return this.cursors.map(e=>e.asCursorState())}getViewPositions(){return this.cursors.map(e=>e.viewState.position)}getTopMostViewPosition(){return qz(this.cursors,kn(e=>e.viewState.position,M.compare)).viewState.position}getBottomMostViewPosition(){return jz(this.cursors,kn(e=>e.viewState.position,M.compare)).viewState.position}getSelections(){return this.cursors.map(e=>e.modelState.selection)}getViewSelections(){return this.cursors.map(e=>e.viewState.selection)}setSelections(e){this.setStates(nt.fromModelSelections(e))}getPrimaryCursor(){return this.cursors[0].asCursorState()}setStates(e){e!==null&&(this.cursors[0].setState(this.context,e[0].modelState,e[0].viewState),this._setSecondaryStates(e.slice(1)))}_setSecondaryStates(e){const t=this.cursors.length-1,i=e.length;if(t<i){const n=i-t;for(let s=0;s<n;s++)this._addSecondaryCursor()}else if(t>i){const n=t-i;for(let s=0;s<n;s++)this._removeSecondaryCursor(this.cursors.length-2)}for(let n=0;n<i;n++)this.cursors[n+1].setState(this.context,e[n].modelState,e[n].viewState)}killSecondaryCursors(){this._setSecondaryStates([])}_addSecondaryCursor(){this.cursors.push(new Ix(this.context)),this.lastAddedCursorIndex=this.cursors.length-1}getLastAddedCursorIndex(){return this.cursors.length===1||this.lastAddedCursorIndex===0?0:this.lastAddedCursorIndex}_removeSecondaryCursor(e){this.lastAddedCursorIndex>=e+1&&this.lastAddedCursorIndex--,this.cursors[e+1].dispose(this.context),this.cursors.splice(e+1,1)}normalize(){if(this.cursors.length===1)return;const e=this.cursors.slice(0),t=[];for(let i=0,n=e.length;i<n;i++)t.push({index:i,selection:e[i].modelState.selection});t.sort(kn(i=>i.selection,k.compareRangesUsingStarts));for(let i=0;i<t.length-1;i++){const n=t[i],s=t[i+1],r=n.selection,a=s.selection;if(!this.context.cursorConfig.multiCursorMergeOverlapping)continue;let l;if(a.isEmpty()||r.isEmpty()?l=a.getStartPosition().isBeforeOrEqual(r.getEndPosition()):l=a.getStartPosition().isBefore(r.getEndPosition()),l){const c=n.index<s.index?i:i+1,d=n.index<s.index?i+1:i,h=t[d].index,u=t[c].index,f=t[d].selection,g=t[c].selection;if(!f.equalsSelection(g)){const m=f.plusRange(g),_=f.selectionStartLineNumber===f.startLineNumber&&f.selectionStartColumn===f.startColumn,b=g.selectionStartLineNumber===g.startLineNumber&&g.selectionStartColumn===g.startColumn;let C;h===this.lastAddedCursorIndex?(C=_,this.lastAddedCursorIndex=u):C=b;let w;C?w=new ce(m.startLineNumber,m.startColumn,m.endLineNumber,m.endColumn):w=new ce(m.endLineNumber,m.endColumn,m.startLineNumber,m.startColumn),t[c].selection=w;const v=nt.fromModelSelection(w);e[u].setState(this.context,v.modelState,v.viewState)}for(const m of t)m.index>h&&m.index--;e.splice(h,1),t.splice(d,1),this._removeSecondaryCursor(h-1),i--}}}}class O${constructor(e,t,i,n){this._cursorContextBrand=void 0,this.model=e,this.viewModel=t,this.coordinatesConverter=i,this.cursorConfig=n}}class _pe{constructor(){this.type=0}}class bpe{constructor(){this.type=1}}class Cpe{constructor(e){this.type=2,this._source=e}hasChanged(e){return this._source.hasChanged(e)}}class vpe{constructor(e,t,i){this.selections=e,this.modelSelections=t,this.reason=i,this.type=3}}class eg{constructor(e){this.type=4,e?(this.affectsMinimap=e.affectsMinimap,this.affectsOverviewRuler=e.affectsOverviewRuler,this.affectsGlyphMargin=e.affectsGlyphMargin,this.affectsLineNumber=e.affectsLineNumber):(this.affectsMinimap=!0,this.affectsOverviewRuler=!0,this.affectsGlyphMargin=!0,this.affectsLineNumber=!0)}}class Dx{constructor(){this.type=5}}class wpe{constructor(e){this.type=6,this.isFocused=e}}class Spe{constructor(){this.type=7}}class Ex{constructor(){this.type=8}}class F${constructor(e,t){this.fromLineNumber=e,this.count=t,this.type=9}}class nA{constructor(e,t){this.type=10,this.fromLineNumber=e,this.toLineNumber=t}}class sA{constructor(e,t){this.type=11,this.fromLineNumber=e,this.toLineNumber=t}}class Ov{constructor(e,t,i,n,s,r,a){this.source=e,this.minimalReveal=t,this.range=i,this.selections=n,this.verticalType=s,this.revealHorizontal=r,this.scrollType=a,this.type=12}}class ype{constructor(e){this.type=13,this.scrollWidth=e.scrollWidth,this.scrollLeft=e.scrollLeft,this.scrollHeight=e.scrollHeight,this.scrollTop=e.scrollTop,this.scrollWidthChanged=e.scrollWidthChanged,this.scrollLeftChanged=e.scrollLeftChanged,this.scrollHeightChanged=e.scrollHeightChanged,this.scrollTopChanged=e.scrollTopChanged}}class Lpe{constructor(e){this.theme=e,this.type=14}}class xpe{constructor(e){this.type=15,this.ranges=e}}class kpe{constructor(){this.type=16}}let Ipe=class{constructor(){this.type=17}};class Dpe extends A{constructor(){super(),this._onEvent=this._register(new P),this.onEvent=this._onEvent.event,this._eventHandlers=[],this._viewEventQueue=null,this._isConsumingViewEventQueue=!1,this._collector=null,this._collectorCnt=0,this._outgoingEvents=[]}emitOutgoingEvent(e){this._addOutgoingEvent(e),this._emitOutgoingEvents()}_addOutgoingEvent(e){for(let t=0,i=this._outgoingEvents.length;t<i;t++){const n=this._outgoingEvents[t].kind===e.kind?this._outgoingEvents[t].attemptToMerge(e):null;if(n){this._outgoingEvents[t]=n;return}}this._outgoingEvents.push(e)}_emitOutgoingEvents(){for(;this._outgoingEvents.length>0;){if(this._collector||this._isConsumingViewEventQueue)return;const e=this._outgoingEvents.shift();e.isNoOp()||this._onEvent.fire(e)}}addViewEventHandler(e){for(let t=0,i=this._eventHandlers.length;t<i;t++)this._eventHandlers[t]===e&&console.warn("Detected duplicate listener in ViewEventDispatcher",e);this._eventHandlers.push(e)}removeViewEventHandler(e){for(let t=0;t<this._eventHandlers.length;t++)if(this._eventHandlers[t]===e){this._eventHandlers.splice(t,1);break}}beginEmitViewEvents(){return this._collectorCnt++,this._collectorCnt===1&&(this._collector=new Epe),this._collector}endEmitViewEvents(){if(this._collectorCnt--,this._collectorCnt===0){const e=this._collector.outgoingEvents,t=this._collector.viewEvents;this._collector=null;for(const i of e)this._addOutgoingEvent(i);t.length>0&&this._emitMany(t)}this._emitOutgoingEvents()}emitSingleViewEvent(e){try{this.beginEmitViewEvents().emitViewEvent(e)}finally{this.endEmitViewEvents()}}_emitMany(e){this._viewEventQueue?this._viewEventQueue=this._viewEventQueue.concat(e):this._viewEventQueue=e,this._isConsumingViewEventQueue||this._consumeViewEventQueue()}_consumeViewEventQueue(){try{this._isConsumingViewEventQueue=!0,this._doConsumeQueue()}finally{this._isConsumingViewEventQueue=!1}}_doConsumeQueue(){for(;this._viewEventQueue;){const e=this._viewEventQueue;this._viewEventQueue=null;const t=this._eventHandlers.slice(0);for(const i of t)i.handleEvents(e)}}}class Epe{constructor(){this.viewEvents=[],this.outgoingEvents=[]}emitViewEvent(e){this.viewEvents.push(e)}emitOutgoingEvent(e){this.outgoingEvents.push(e)}}class oA{constructor(e,t,i,n){this.kind=0,this._oldContentWidth=e,this._oldContentHeight=t,this.contentWidth=i,this.contentHeight=n,this.contentWidthChanged=this._oldContentWidth!==this.contentWidth,this.contentHeightChanged=this._oldContentHeight!==this.contentHeight}isNoOp(){return!this.contentWidthChanged&&!this.contentHeightChanged}attemptToMerge(e){return e.kind!==this.kind?null:new oA(this._oldContentWidth,this._oldContentHeight,e.contentWidth,e.contentHeight)}}class Nx{constructor(e,t){this.kind=1,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new Nx(this.oldHasFocus,e.hasFocus)}}class Npe{constructor(e,t){this.kind=2,this.oldHasFocus=e,this.hasFocus=t}isNoOp(){return this.oldHasFocus===this.hasFocus}attemptToMerge(e){return e.kind!==this.kind?null:new Nx(this.oldHasFocus,e.hasFocus)}}class rA{constructor(e,t,i,n,s,r,a,l){this.kind=3,this._oldScrollWidth=e,this._oldScrollLeft=t,this._oldScrollHeight=i,this._oldScrollTop=n,this.scrollWidth=s,this.scrollLeft=r,this.scrollHeight=a,this.scrollTop=l,this.scrollWidthChanged=this._oldScrollWidth!==this.scrollWidth,this.scrollLeftChanged=this._oldScrollLeft!==this.scrollLeft,this.scrollHeightChanged=this._oldScrollHeight!==this.scrollHeight,this.scrollTopChanged=this._oldScrollTop!==this.scrollTop}isNoOp(){return!this.scrollWidthChanged&&!this.scrollLeftChanged&&!this.scrollHeightChanged&&!this.scrollTopChanged}attemptToMerge(e){return e.kind!==this.kind?null:new rA(this._oldScrollWidth,this._oldScrollLeft,this._oldScrollHeight,this._oldScrollTop,e.scrollWidth,e.scrollLeft,e.scrollHeight,e.scrollTop)}}class Tpe{constructor(){this.kind=4}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class Rpe{constructor(){this.kind=5}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class Tx{constructor(e,t,i,n,s,r,a){this.kind=7,this.oldSelections=e,this.selections=t,this.oldModelVersionId=i,this.modelVersionId=n,this.source=s,this.reason=r,this.reachedMaxCursorCount=a}static _selectionsAreEqual(e,t){if(!e&&!t)return!0;if(!e||!t)return!1;const i=e.length,n=t.length;if(i!==n)return!1;for(let s=0;s<i;s++)if(!e[s].equalsSelection(t[s]))return!1;return!0}isNoOp(){return Tx._selectionsAreEqual(this.oldSelections,this.selections)&&this.oldModelVersionId===this.modelVersionId}attemptToMerge(e){return e.kind!==this.kind?null:new Tx(this.oldSelections,e.selections,this.oldModelVersionId,e.modelVersionId,e.source,e.reason,this.reachedMaxCursorCount||e.reachedMaxCursorCount)}}class Mpe{constructor(){this.kind=6}isNoOp(){return!1}attemptToMerge(e){return e.kind!==this.kind?null:this}}class Ppe{constructor(e){this.event=e,this.kind=8}isNoOp(){return!1}attemptToMerge(e){return null}}class Ape{constructor(e){this.event=e,this.kind=9}isNoOp(){return!1}attemptToMerge(e){return null}}class Ope{constructor(e){this.event=e,this.kind=10}isNoOp(){return!1}attemptToMerge(e){return null}}class Fpe{constructor(e){this.event=e,this.kind=11}isNoOp(){return!1}attemptToMerge(e){return null}}class Wpe{constructor(e){this.event=e,this.kind=12}isNoOp(){return!1}attemptToMerge(e){return null}}class Bpe{constructor(e){this.event=e,this.kind=13}isNoOp(){return!1}attemptToMerge(e){return null}}class Hpe{constructor(e){this.event=e,this.kind=14}isNoOp(){return!1}attemptToMerge(e){return null}}class Vpe{constructor(e){this.event=e,this.kind=15}isNoOp(){return!1}attemptToMerge(e){return null}}class zpe extends A{constructor(e,t,i,n){super(),this._model=e,this._knownModelVersionId=this._model.getVersionId(),this._viewModel=t,this._coordinatesConverter=i,this.context=new O$(this._model,this._viewModel,this._coordinatesConverter,n),this._cursors=new A$(this.context),this._hasFocus=!1,this._isHandling=!1,this._compositionState=null,this._columnSelectData=null,this._autoClosedActions=[],this._prevEditOperationType=0}dispose(){this._cursors.dispose(),this._autoClosedActions=pt(this._autoClosedActions),super.dispose()}updateConfiguration(e){this.context=new O$(this._model,this._viewModel,this._coordinatesConverter,e),this._cursors.updateContext(this.context)}onLineMappingChanged(e){this._knownModelVersionId===this._model.getVersionId()&&this.setStates(e,"viewModel",0,this.getCursorStates())}setHasFocus(e){this._hasFocus=e}_validateAutoClosedActions(){if(this._autoClosedActions.length>0){const e=this._cursors.getSelections();for(let t=0;t<this._autoClosedActions.length;t++){const i=this._autoClosedActions[t];i.isValid(e)||(i.dispose(),this._autoClosedActions.splice(t,1),t--)}}}getPrimaryCursorState(){return this._cursors.getPrimaryCursor()}getLastAddedCursorIndex(){return this._cursors.getLastAddedCursorIndex()}getCursorStates(){return this._cursors.getAll()}setStates(e,t,i,n){let s=!1;const r=this.context.cursorConfig.multiCursorLimit;n!==null&&n.length>r&&(n=n.slice(0,r),s=!0);const a=Fv.from(this._model,this);return this._cursors.setStates(n),this._cursors.normalize(),this._columnSelectData=null,this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,t,i,a,s)}setCursorColumnSelectData(e){this._columnSelectData=e}revealAll(e,t,i,n,s,r){const a=this._cursors.getViewPositions();let l=null,c=null;a.length>1?c=this._cursors.getViewSelections():l=k.fromPositions(a[0],a[0]),e.emitViewEvent(new Ov(t,i,l,c,n,s,r))}revealPrimary(e,t,i,n,s,r){const l=[this._cursors.getPrimaryCursor().viewState.selection];e.emitViewEvent(new Ov(t,i,null,l,n,s,r))}saveState(){const e=[],t=this._cursors.getSelections();for(let i=0,n=t.length;i<n;i++){const s=t[i];e.push({inSelectionMode:!s.isEmpty(),selectionStart:{lineNumber:s.selectionStartLineNumber,column:s.selectionStartColumn},position:{lineNumber:s.positionLineNumber,column:s.positionColumn}})}return e}restoreState(e,t){const i=[];for(let n=0,s=t.length;n<s;n++){const r=t[n];let a=1,l=1;r.position&&r.position.lineNumber&&(a=r.position.lineNumber),r.position&&r.position.column&&(l=r.position.column);let c=a,d=l;r.selectionStart&&r.selectionStart.lineNumber&&(c=r.selectionStart.lineNumber),r.selectionStart&&r.selectionStart.column&&(d=r.selectionStart.column),i.push({selectionStartLineNumber:c,selectionStartColumn:d,positionLineNumber:a,positionColumn:l})}this.setStates(e,"restoreState",0,nt.fromModelSelections(i)),this.revealAll(e,"restoreState",!1,0,!0,1)}onModelContentChanged(e,t){if(t instanceof DU){if(this._isHandling)return;this._isHandling=!0;try{this.setStates(e,"modelChange",0,this.getCursorStates())}finally{this._isHandling=!1}}else{const i=t.rawContentChangedEvent;if(this._knownModelVersionId=i.versionId,this._isHandling)return;const n=i.containsEvent(1);if(this._prevEditOperationType=0,n)this._cursors.dispose(),this._cursors=new A$(this.context),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(e,"model",1,null,!1);else if(this._hasFocus&&i.resultingSelection&&i.resultingSelection.length>0){const s=nt.fromModelSelections(i.resultingSelection);this.setStates(e,"modelChange",i.isUndoing?5:i.isRedoing?6:2,s)&&this.revealAll(e,"modelChange",!1,0,!0,0)}else{const s=this._cursors.readSelectionFromMarkers();this.setStates(e,"modelChange",2,nt.fromModelSelections(s))}}}getSelection(){return this._cursors.getPrimaryCursor().modelState.selection}getTopMostViewPosition(){return this._cursors.getTopMostViewPosition()}getBottomMostViewPosition(){return this._cursors.getBottomMostViewPosition()}getCursorColumnSelectData(){if(this._columnSelectData)return this._columnSelectData;const e=this._cursors.getPrimaryCursor(),t=e.viewState.selectionStart.getStartPosition(),i=e.viewState.position;return{isReal:!1,fromViewLineNumber:t.lineNumber,fromViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,t),toViewLineNumber:i.lineNumber,toViewVisualColumn:this.context.cursorConfig.visibleColumnFromColumn(this._viewModel,i)}}getSelections(){return this._cursors.getSelections()}setSelections(e,t,i,n){this.setStates(e,t,n,nt.fromModelSelections(i))}getPrevEditOperationType(){return this._prevEditOperationType}setPrevEditOperationType(e){this._prevEditOperationType=e}_pushAutoClosedAction(e,t){const i=[],n=[];for(let a=0,l=e.length;a<l;a++)i.push({range:e[a],options:{description:"auto-closed-character",inlineClassName:"auto-closed-character",stickiness:1}}),n.push({range:t[a],options:{description:"auto-closed-enclosing",stickiness:1}});const s=this._model.deltaDecorations([],i),r=this._model.deltaDecorations([],n);this._autoClosedActions.push(new W$(this._model,s,r))}_executeEditOperation(e,t){if(!e)return;e.shouldPushStackElementBefore&&this._model.pushStackElement();const i=Upe.executeCommands(this._model,this._cursors.getSelections(),e.commands,t);if(i){this._interpretCommandResult(i);const n=[],s=[];for(let r=0;r<e.commands.length;r++){const a=e.commands[r];a instanceof V2&&a.enclosingRange&&a.closeCharacterRange&&(n.push(a.closeCharacterRange),s.push(a.enclosingRange))}n.length>0&&this._pushAutoClosedAction(n,s),this._prevEditOperationType=e.type}e.shouldPushStackElementAfter&&this._model.pushStackElement()}_interpretCommandResult(e){(!e||e.length===0)&&(e=this._cursors.readSelectionFromMarkers()),this._columnSelectData=null,this._cursors.setSelections(e),this._cursors.normalize()}_emitStateChangedIfNecessary(e,t,i,n,s){const r=Fv.from(this._model,this);if(r.equals(n))return!1;const a=this._cursors.getSelections(),l=this._cursors.getViewSelections();if(e.emitViewEvent(new vpe(l,a,i)),!n||n.cursorState.length!==r.cursorState.length||r.cursorState.some((c,d)=>!c.modelState.equals(n.cursorState[d].modelState))){const c=n?n.cursorState.map(h=>h.modelState.selection):null,d=n?n.modelVersionId:0;e.emitOutgoingEvent(new Tx(c,a,d,r.modelVersionId,t||"keyboard",i,s))}return!0}_findAutoClosingPairs(e){if(!e.length)return null;const t=[];for(let i=0,n=e.length;i<n;i++){const s=e[i];if(!s.text||s.text.indexOf(`
`)>=0)return null;const r=s.text.match(/([)\]}>'"`])([^)\]}>'"`]*)$/);if(!r)return null;const a=r[1],l=this.context.cursorConfig.autoClosingPairs.autoClosingPairsCloseSingleChar.get(a);if(!l||l.length!==1)return null;const c=l[0].open,d=s.text.length-r[2].length-1,h=s.text.lastIndexOf(c,d-1);if(h===-1)return null;t.push([h,d])}return t}executeEdits(e,t,i,n,s){let r=null;t==="snippet"&&(r=this._findAutoClosingPairs(i)),r&&(i[0]._isTracked=!0);const a=[],l=[],c=this._model.pushEditOperations(this.getSelections(),i,d=>{if(r)for(let u=0,f=r.length;u<f;u++){const[g,m]=r[u],_=d[u],b=_.range.startLineNumber,C=_.range.startColumn-1+g,w=_.range.startColumn-1+m;a.push(new k(b,w+1,b,w+2)),l.push(new k(b,C+1,b,w+2))}const h=n(d);return h&&(this._isHandling=!0),h},void 0,s);c&&(this._isHandling=!1,this.setSelections(e,t,c,0)),a.length>0&&this._pushAutoClosedAction(a,l)}_executeEdit(e,t,i,n=0){if(this.context.cursorConfig.readOnly)return;const s=Fv.from(this._model,this);this._cursors.stopTrackingSelections(),this._isHandling=!0;try{this._cursors.ensureValidState(),e()}catch(r){Ee(r)}this._isHandling=!1,this._cursors.startTrackingSelections(),this._validateAutoClosedActions(),this._emitStateChangedIfNecessary(t,i,n,s,!1)&&this.revealAll(t,i,!1,0,!0,0)}getAutoClosedCharacters(){return W$.getAllAutoClosedCharacters(this._autoClosedActions)}startComposition(e){this._compositionState=new Wv(this._model,this.getSelections())}endComposition(e,t){const i=jn.cursor({kind:"compositionEnd",detailedSource:t}),n=this._compositionState?this._compositionState.deduceOutcome(this._model,this.getSelections()):null;this._compositionState=null,this._executeEdit(()=>{t==="keyboard"&&this._executeEditOperation(gh.compositionEndWithInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,n,this.getSelections(),this.getAutoClosedCharacters()),i)},e,t)}type(e,t,i){const n=jn.cursor({kind:"type",detailedSource:i});this._executeEdit(()=>{if(i==="keyboard"){const s=t.length;let r=0;for(;r<s;){const a=vR(t,r),l=t.substr(r,a);this._executeEditOperation(gh.typeWithInterceptors(!!this._compositionState,this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),this.getAutoClosedCharacters(),l),n),r+=a}}else this._executeEditOperation(gh.typeWithoutInterceptors(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t),n)},e,i)}compositionType(e,t,i,n,s,r){const a=jn.cursor({kind:"compositionType",detailedSource:r});if(t.length===0&&i===0&&n===0){if(s!==0){const l=this.getSelections().map(c=>{const d=c.getPosition();return new ce(d.lineNumber,d.column+s,d.lineNumber,d.column+s)});this.setSelections(e,r,l,0)}return}this._executeEdit(()=>{this._executeEditOperation(gh.compositionType(this._prevEditOperationType,this.context.cursorConfig,this._model,this.getSelections(),t,i,n,s),a)},e,r)}paste(e,t,i,n,s){const r=jn.cursor({kind:"paste",detailedSource:s});this._executeEdit(()=>{this._executeEditOperation(gh.paste(this.context.cursorConfig,this._model,this.getSelections(),t,i,n||[]),r)},e,s,4)}cut(e,t){const i=jn.cursor({kind:"cut",detailedSource:t});this._executeEdit(()=>{this._executeEditOperation(wf.cut(this.context.cursorConfig,this._model,this.getSelections()),i)},e,t)}executeCommand(e,t,i){const n=jn.cursor({kind:"executeCommand",detailedSource:i});this._executeEdit(()=>{this._cursors.killSecondaryCursors(),this._executeEditOperation(new _s(0,[t],{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),n)},e,i)}executeCommands(e,t,i){const n=jn.cursor({kind:"executeCommands",detailedSource:i});this._executeEdit(()=>{this._executeEditOperation(new _s(0,t,{shouldPushStackElementBefore:!1,shouldPushStackElementAfter:!1}),n)},e,i)}}class Fv{static from(e,t){return new Fv(e.getVersionId(),t.getCursorStates())}constructor(e,t){this.modelVersionId=e,this.cursorState=t}equals(e){if(!e||this.modelVersionId!==e.modelVersionId||this.cursorState.length!==e.cursorState.length)return!1;for(let t=0,i=this.cursorState.length;t<i;t++)if(!this.cursorState[t].equals(e.cursorState[t]))return!1;return!0}}class W${static getAllAutoClosedCharacters(e){let t=[];for(const i of e)t=t.concat(i.getAutoClosedCharactersRanges());return t}constructor(e,t,i){this._model=e,this._autoClosedCharactersDecorations=t,this._autoClosedEnclosingDecorations=i}dispose(){this._autoClosedCharactersDecorations=this._model.deltaDecorations(this._autoClosedCharactersDecorations,[]),this._autoClosedEnclosingDecorations=this._model.deltaDecorations(this._autoClosedEnclosingDecorations,[])}getAutoClosedCharactersRanges(){const e=[];for(let t=0;t<this._autoClosedCharactersDecorations.length;t++){const i=this._model.getDecorationRange(this._autoClosedCharactersDecorations[t]);i&&e.push(i)}return e}isValid(e){const t=[];for(let i=0;i<this._autoClosedEnclosingDecorations.length;i++){const n=this._model.getDecorationRange(this._autoClosedEnclosingDecorations[i]);if(n&&(t.push(n),n.startLineNumber!==n.endLineNumber))return!1}t.sort(k.compareRangesUsingStarts),e.sort(k.compareRangesUsingStarts);for(let i=0;i<e.length;i++)if(i>=t.length||!t[i].strictContainsRange(e[i]))return!1;return!0}}class Upe{static executeCommands(e,t,i,n=jn.unknown({name:"executeCommands"})){const s={model:e,selectionsBefore:t,trackedRanges:[],trackedRangesDirection:[]},r=this._innerExecuteCommands(s,i,n);for(let a=0,l=s.trackedRanges.length;a<l;a++)s.model._setTrackedRange(s.trackedRanges[a],null,0);return r}static _innerExecuteCommands(e,t,i){if(this._arrayIsEmpty(t))return null;const n=this._getEditOperations(e,t);if(n.operations.length===0)return null;const s=n.operations,r=this._getLoserCursorMap(s);if(r.hasOwnProperty("0"))return console.warn("Ignoring commands"),null;const a=[];for(let d=0,h=s.length;d<h;d++)r.hasOwnProperty(s[d].identifier.major.toString())||a.push(s[d]);n.hadTrackedEditOperation&&a.length>0&&(a[0]._isTracked=!0);let l=e.model.pushEditOperations(e.selectionsBefore,a,d=>{const h=[];for(let g=0;g<e.selectionsBefore.length;g++)h[g]=[];for(const g of d)g.identifier&&h[g.identifier.major].push(g);const u=(g,m)=>g.identifier.minor-m.identifier.minor,f=[];for(let g=0;g<e.selectionsBefore.length;g++)h[g].length>0?(h[g].sort(u),f[g]=t[g].computeCursorState(e.model,{getInverseEditOperations:()=>h[g],getTrackedSelection:m=>{const _=parseInt(m,10),b=e.model._getTrackedRange(e.trackedRanges[_]);return e.trackedRangesDirection[_]===0?new ce(b.startLineNumber,b.startColumn,b.endLineNumber,b.endColumn):new ce(b.endLineNumber,b.endColumn,b.startLineNumber,b.startColumn)}})):f[g]=e.selectionsBefore[g];return f},void 0,i);l||(l=e.selectionsBefore);const c=[];for(const d in r)r.hasOwnProperty(d)&&c.push(parseInt(d,10));c.sort((d,h)=>h-d);for(const d of c)l.splice(d,1);return l}static _arrayIsEmpty(e){for(let t=0,i=e.length;t<i;t++)if(e[t])return!1;return!0}static _getEditOperations(e,t){let i=[],n=!1;for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a){const l=this._getEditOperationsFromCommand(e,s,a);i=i.concat(l.operations),n=n||l.hadTrackedEditOperation}}return{operations:i,hadTrackedEditOperation:n}}static _getEditOperationsFromCommand(e,t,i){const n=[];let s=0;const r=(h,u,f=!1)=>{k.isEmpty(h)&&u===""||n.push({identifier:{major:t,minor:s++},range:h,text:u,forceMoveMarkers:f,isAutoWhitespaceEdit:i.insertsAutoWhitespace})};let a=!1;const d={addEditOperation:r,addTrackedEditOperation:(h,u,f)=>{a=!0,r(h,u,f)},trackSelection:(h,u)=>{const f=ce.liftSelection(h);let g;if(f.isEmpty())if(typeof u=="boolean")u?g=2:g=3;else{const b=e.model.getLineMaxColumn(f.startLineNumber);f.startColumn===b?g=2:g=3}else g=1;const m=e.trackedRanges.length,_=e.model._setTrackedRange(null,f,g);return e.trackedRanges[m]=_,e.trackedRangesDirection[m]=f.getDirection(),m.toString()}};try{i.getEditOperations(e.model,d)}catch(h){return Ee(h),{operations:[],hadTrackedEditOperation:!1}}return{operations:n,hadTrackedEditOperation:a}}static _getLoserCursorMap(e){e=e.slice(0),e.sort((i,n)=>-k.compareRangesUsingEnds(i.range,n.range));const t={};for(let i=1;i<e.length;i++){const n=e[i-1],s=e[i];if(k.getStartPosition(n.range).isBefore(k.getEndPosition(s.range))){let r;n.identifier.major>s.identifier.major?r=n.identifier.major:r=s.identifier.major,t[r.toString()]=!0;for(let a=0;a<e.length;a++)e[a].identifier.major===r&&(e.splice(a,1),a<i&&i--,a--);i>0&&i--}}return t}}class $pe{constructor(e,t,i,n){this.text=e,this.lineNumber=t,this.startSelectionOffset=i,this.endSelectionOffset=n}}class Wv{static _capture(e,t){const i=[];for(const n of t){if(n.startLineNumber!==n.endLineNumber)return null;const s=n.startLineNumber;i.push(new $pe(e.getLineContent(s),s,n.startColumn-1,n.endColumn-1))}return i}constructor(e,t){this._original=Wv._capture(e,t)}deduceOutcome(e,t){if(!this._original)return null;const i=Wv._capture(e,t);if(!i||this._original.length!==i.length)return null;const n=[];for(let s=0,r=this._original.length;s<r;s++)n.push(Wv._deduceOutcome(this._original[s],i[s]));return n}static _deduceOutcome(e,t){const i=Math.min(e.startSelectionOffset,t.startSelectionOffset,Gr(e.text,t.text)),n=Math.min(e.text.length-e.endSelectionOffset,t.text.length-t.endSelectionOffset,Lc(e.text,t.text)),s=e.text.substring(i,e.text.length-n),r=i,a=t.text.length-n,l=t.text.substring(r,a),c=new k(t.lineNumber,r+1,t.lineNumber,a+1);return new yre(s,e.startSelectionOffset-i,e.endSelectionOffset-i,l,t.startSelectionOffset-i,t.endSelectionOffset-i,c)}}const B$={getInitialState:()=>A_,tokenizeEncoded:(o,e,t)=>wx(0,t)};async function jpe(o,e,t){if(!t)return H$(e,o.languageIdCodec,B$);const i=await di.getOrCreate(t);return H$(e,o.languageIdCodec,i||B$)}function qpe(o,e,t,i,n,s,r){let a="<div>",l=i,c=0,d=!0;for(let h=0,u=e.getCount();h<u;h++){const f=e.getEndOffset(h);if(f<=i)continue;let g="";for(;l<f&&l<n;l++){const m=o.charCodeAt(l);switch(m){case 9:{let _=s-(l+c)%s;for(c+=_-1;_>0;)r&&d?(g+="&#160;",d=!1):(g+=" ",d=!0),_--;break}case 60:g+="&lt;",d=!1;break;case 62:g+="&gt;",d=!1;break;case 38:g+="&amp;",d=!1;break;case 0:g+="&#00;",d=!1;break;case 65279:case 8232:case 8233:case 133:g+="<22>",d=!1;break;case 13:g+="&#8203",d=!1;break;case 32:r&&d?(g+="&#160;",d=!1):(g+=" ",d=!0);break;default:g+=String.fromCharCode(m),d=!1}}if(a+=`<span style="${e.getInlineStyle(h,t)}">${g}</span>`,f>n||l>=n)break}return a+="</div>",a}function H$(o,e,t){let i='<div class="monaco-tokenized-source">';const n=ro(o);let s=t.getInitialState();for(let r=0,a=n.length;r<a;r++){const l=n[r];r>0&&(i+="<br/>");const c=t.tokenizeEncoded(l,!0,s);bi.convertToEndOffset(c.tokens,l.length);const h=new bi(c.tokens,l,e).inflate();let u=0;for(let f=0,g=h.getCount();f<g;f++){const m=h.getClassName(f),_=h.getEndOffset(f);i+=`<span class="${m}">${qr(l.substring(u,_))}</span>`,u=_}s=c.endState}return i+="</div>",i}class Kpe{constructor(e,t,i,n,s){this.decorationId=e,this.index=t,this.lineNumber=i,this.specialHeight=n,this.prefixSum=s,this.maximumSpecialHeight=n,this.deleted=!1}}class V${constructor(e,t){if(this._decorationIDToCustomLine=new aA,this._orderedCustomLines=[],this._pendingSpecialLinesToInsert=[],this._invalidIndex=0,this._hasPending=!1,this._defaultLineHeight=e,t.length>0){for(const i of t)this.insertOrChangeCustomLineHeight(i.decorationId,i.startLineNumber,i.endLineNumber,i.lineHeight);this.commit()}}set defaultLineHeight(e){this._defaultLineHeight=e}get defaultLineHeight(){return this._defaultLineHeight}removeCustomLineHeight(e){const t=this._decorationIDToCustomLine.get(e);if(t){this._decorationIDToCustomLine.delete(e);for(const i of t)i.deleted=!0,this._invalidIndex=Math.min(this._invalidIndex,i.index);this._hasPending=!0}}insertOrChangeCustomLineHeight(e,t,i,n){this.removeCustomLineHeight(e);for(let s=t;s<=i;s++){const r=new Kpe(e,-1,s,n,0);this._pendingSpecialLinesToInsert.push(r)}this._hasPending=!0}heightForLineNumber(e){const t=this._binarySearchOverOrderedCustomLinesArray(e);return t>=0?this._orderedCustomLines[t].maximumSpecialHeight:this._defaultLineHeight}getAccumulatedLineHeightsIncludingLineNumber(e){const t=this._binarySearchOverOrderedCustomLinesArray(e);if(t>=0)return this._orderedCustomLines[t].prefixSum+this._orderedCustomLines[t].maximumSpecialHeight;if(t===-1)return this._defaultLineHeight*e;const i=-(t+1),n=this._orderedCustomLines[i-1];return n.prefixSum+n.maximumSpecialHeight+this._defaultLineHeight*(e-n.lineNumber)}onLinesDeleted(e,t){const i=t-e+1,n=this._orderedCustomLines.length,s=this._binarySearchOverOrderedCustomLinesArray(e);let r;if(s>=0){r=s;for(let h=s-1;h>=0&&this._orderedCustomLines[h].lineNumber===e;h--)r--}else r=s===-(n+1)&&s!==-1?n-1:-(s+1);const a=this._binarySearchOverOrderedCustomLinesArray(t);let l;if(a>=0){l=a;for(let h=a+1;h<n&&this._orderedCustomLines[h].lineNumber===t;h++)l++}else l=a===-(n+1)&&a!==-1?n-1:-(a+1);const c=l>r,d=l===r&&this._orderedCustomLines[r]&&this._orderedCustomLines[r].lineNumber>=e&&this._orderedCustomLines[r].lineNumber<=t;if(c||d){let h=0;for(let L=r;L<=l;L++)h=Math.max(h,this._orderedCustomLines[L].maximumSpecialHeight);let u=0;if(r>0){const L=this._orderedCustomLines[r-1];u=L.prefixSum+L.maximumSpecialHeight+this._defaultLineHeight*(e-L.lineNumber-1)}else u=e>0?(e-1)*this._defaultLineHeight:0;const f=this._orderedCustomLines[r],g=this._orderedCustomLines[l],m=this._orderedCustomLines[l+1],_=m&&m.lineNumber===t+1?m.maximumSpecialHeight:this._defaultLineHeight,b=g.prefixSum+g.maximumSpecialHeight-f.prefixSum+this._defaultLineHeight*(t-g.lineNumber)+this._defaultLineHeight*(f.lineNumber-e)+_-h,C=new Set,w=[],v=new aA;let S=0;for(let L=0;L<this._orderedCustomLines.length;L++){const x=this._orderedCustomLines[L];if(L<r)w.push(x),v.add(x.decorationId,x);else if(L>=r&&L<=l){const I=x.decorationId;C.has(I)?S++:(x.index-=S,x.lineNumber=e,x.prefixSum=u,x.maximumSpecialHeight=h,w.push(x),v.add(x.decorationId,x))}else L>l&&(x.index-=S,x.lineNumber-=i,x.prefixSum-=b,w.push(x),v.add(x.decorationId,x));C.add(x.decorationId)}this._orderedCustomLines=w,this._decorationIDToCustomLine=v}else{const h=i*this._defaultLineHeight;for(let u=l;u<this._orderedCustomLines.length;u++){const f=this._orderedCustomLines[u];f.lineNumber>t&&(f.lineNumber-=i,f.prefixSum-=h)}}}onLinesInserted(e,t){const i=t-e+1,n=this._binarySearchOverOrderedCustomLinesArray(e);let s;if(n>=0){s=n;for(let d=n-1;d>=0&&this._orderedCustomLines[d].lineNumber===e;d--)s--}else s=-(n+1);const r=[],a=new Set;for(let d=s;d<this._orderedCustomLines.length;d++)this._orderedCustomLines[d].lineNumber===e&&a.add(this._orderedCustomLines[d].decorationId);const l=new Set;for(let d=s-1;d>=0;d--)this._orderedCustomLines[d].lineNumber===e-1&&l.add(this._orderedCustomLines[d].decorationId);const c=L$(l,a);for(let d=s;d<this._orderedCustomLines.length;d++)this._orderedCustomLines[d].lineNumber+=i,this._orderedCustomLines[d].prefixSum+=this._defaultLineHeight*i;if(c.size>0){for(const d of c){const h=this._decorationIDToCustomLine.get(d);if(h){const u=h.reduce((m,_)=>Math.min(m,_.lineNumber),e),f=h.reduce((m,_)=>Math.max(m,_.lineNumber),e),g=h.reduce((m,_)=>Math.max(m,_.specialHeight),0);r.push({decorationId:d,startLineNumber:u,endLineNumber:f,lineHeight:g})}}for(const d of r)this.insertOrChangeCustomLineHeight(d.decorationId,d.startLineNumber,d.endLineNumber,d.lineHeight);this.commit()}}commit(){if(!this._hasPending)return;for(const s of this._pendingSpecialLinesToInsert){const r=this._binarySearchOverOrderedCustomLinesArray(s.lineNumber),a=r>=0?r:-(r+1);this._orderedCustomLines.splice(a,0,s),this._invalidIndex=Math.min(this._invalidIndex,a)}this._pendingSpecialLinesToInsert=[];const e=new aA,t=[];for(let s=0;s<this._invalidIndex;s++){const r=this._orderedCustomLines[s];t.push(r),e.add(r.decorationId,r)}let i=0,n=this._invalidIndex>0?t[this._invalidIndex-1]:void 0;for(let s=this._invalidIndex;s<this._orderedCustomLines.length;s++){const r=this._orderedCustomLines[s];if(r.deleted){i++;continue}if(r.index=s-i,n&&n.lineNumber===r.lineNumber)r.maximumSpecialHeight=n.maximumSpecialHeight,r.prefixSum=n.prefixSum;else{let a=r.specialHeight;for(let c=s;c<this._orderedCustomLines.length;c++){const d=this._orderedCustomLines[c];if(!d.deleted){if(d.lineNumber!==r.lineNumber)break;a=Math.max(a,d.specialHeight)}}r.maximumSpecialHeight=a;let l;n?l=n.prefixSum+n.maximumSpecialHeight+this._defaultLineHeight*(r.lineNumber-n.lineNumber-1):l=this._defaultLineHeight*(r.lineNumber-1),r.prefixSum=l}n=r,t.push(r),e.add(r.decorationId,r)}this._orderedCustomLines=t,this._decorationIDToCustomLine=e,this._invalidIndex=1/0,this._hasPending=!1}_binarySearchOverOrderedCustomLinesArray(e){return FR(this._orderedCustomLines.length,t=>{const i=this._orderedCustomLines[t];return i.lineNumber===e?0:i.lineNumber<e?-1:1})}}class aA{constructor(){this._map=new Map}add(e,t){const i=this._map.get(e);i?i.push(t):this._map.set(e,[t])}get(e){return this._map.get(e)}delete(e){this._map.delete(e)}}class Gpe{constructor(){this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[]}insert(e){this._hasPending=!0,this._inserts.push(e)}change(e){this._hasPending=!0,this._changes.push(e)}remove(e){this._hasPending=!0,this._removes.push(e)}commit(e){if(!this._hasPending)return;const t=this._inserts,i=this._changes,n=this._removes;this._hasPending=!1,this._inserts=[],this._changes=[],this._removes=[],e._commitPendingChanges(t,i,n)}}class Zpe{constructor(e,t,i,n,s){this.id=e,this.afterLineNumber=t,this.ordinal=i,this.height=n,this.minWidth=s,this.prefixSum=0}}let Ype=(yu=class{constructor(e,t,i,n,s){this._instanceId=s6(++yu.INSTANCE_COUNT),this._pendingChanges=new Gpe,this._lastWhitespaceId=0,this._arr=[],this._prefixSumValidIndex=-1,this._minWidth=-1,this._lineCount=e,this._paddingTop=i,this._paddingBottom=n,this._lineHeightsManager=new V$(t,s)}static findInsertionIndex(e,t,i){let n=0,s=e.length;for(;n<s;){const r=n+s>>>1;t===e[r].afterLineNumber?i<e[r].ordinal?s=r:n=r+1:t<e[r].afterLineNumber?s=r:n=r+1}return n}setDefaultLineHeight(e){this._lineHeightsManager.defaultLineHeight=e}setPadding(e,t){this._paddingTop=e,this._paddingBottom=t}onFlushed(e,t){this._lineCount=e,this._lineHeightsManager=new V$(this._lineHeightsManager.defaultLineHeight,t)}changeLineHeights(e){let t=!1;try{e({insertOrChangeCustomLineHeight:(n,s,r,a)=>{t=!0,this._lineHeightsManager.insertOrChangeCustomLineHeight(n,s,r,a)},removeCustomLineHeight:n=>{t=!0,this._lineHeightsManager.removeCustomLineHeight(n)}})}finally{this._lineHeightsManager.commit()}return t}changeWhitespace(e){let t=!1;try{e({insertWhitespace:(n,s,r,a)=>{t=!0,n=n|0,s=s|0,r=r|0,a=a|0;const l=this._instanceId+ ++this._lastWhitespaceId;return this._pendingChanges.insert(new Zpe(l,n,s,r,a)),l},changeOneWhitespace:(n,s,r)=>{t=!0,s=s|0,r=r|0,this._pendingChanges.change({id:n,newAfterLineNumber:s,newHeight:r})},removeWhitespace:n=>{t=!0,this._pendingChanges.remove({id:n})}})}finally{this._pendingChanges.commit(this)}return t}_commitPendingChanges(e,t,i){if((e.length>0||i.length>0)&&(this._minWidth=-1),e.length+t.length+i.length<=1){for(const l of e)this._insertWhitespace(l);for(const l of t)this._changeOneWhitespace(l.id,l.newAfterLineNumber,l.newHeight);for(const l of i){const c=this._findWhitespaceIndex(l.id);c!==-1&&this._removeWhitespace(c)}return}const n=new Set;for(const l of i)n.add(l.id);const s=new Map;for(const l of t)s.set(l.id,l);const r=l=>{const c=[];for(const d of l)if(!n.has(d.id)){if(s.has(d.id)){const h=s.get(d.id);d.afterLineNumber=h.newAfterLineNumber,d.height=h.newHeight}c.push(d)}return c},a=r(this._arr).concat(r(e));a.sort((l,c)=>l.afterLineNumber===c.afterLineNumber?l.ordinal-c.ordinal:l.afterLineNumber-c.afterLineNumber),this._arr=a,this._prefixSumValidIndex=-1}_insertWhitespace(e){const t=yu.findInsertionIndex(this._arr,e.afterLineNumber,e.ordinal);this._arr.splice(t,0,e),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,t-1)}_findWhitespaceIndex(e){const t=this._arr;for(let i=0,n=t.length;i<n;i++)if(t[i].id===e)return i;return-1}_changeOneWhitespace(e,t,i){const n=this._findWhitespaceIndex(e);if(n!==-1&&(this._arr[n].height!==i&&(this._arr[n].height=i,this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,n-1)),this._arr[n].afterLineNumber!==t)){const s=this._arr[n];this._removeWhitespace(n),s.afterLineNumber=t,this._insertWhitespace(s)}}_removeWhitespace(e){this._arr.splice(e,1),this._prefixSumValidIndex=Math.min(this._prefixSumValidIndex,e-1)}onLinesDeleted(e,t){e=e|0,t=t|0,this._lineCount-=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){const s=this._arr[i].afterLineNumber;e<=s&&s<=t?this._arr[i].afterLineNumber=e-1:s>t&&(this._arr[i].afterLineNumber-=t-e+1)}this._lineHeightsManager.onLinesDeleted(e,t)}onLinesInserted(e,t){e=e|0,t=t|0,this._lineCount+=t-e+1;for(let i=0,n=this._arr.length;i<n;i++){const s=this._arr[i].afterLineNumber;e<=s&&(this._arr[i].afterLineNumber+=t-e+1)}this._lineHeightsManager.onLinesInserted(e,t)}getWhitespacesTotalHeight(){return this._arr.length===0?0:this.getWhitespacesAccumulatedHeight(this._arr.length-1)}getWhitespacesAccumulatedHeight(e){e=e|0;let t=Math.max(0,this._prefixSumValidIndex+1);t===0&&(this._arr[0].prefixSum=this._arr[0].height,t++);for(let i=t;i<=e;i++)this._arr[i].prefixSum=this._arr[i-1].prefixSum+this._arr[i].height;return this._prefixSumValidIndex=Math.max(this._prefixSumValidIndex,e),this._arr[e].prefixSum}getLinesTotalHeight(){const e=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(this._lineCount),t=this.getWhitespacesTotalHeight();return e+t+this._paddingTop+this._paddingBottom}getWhitespaceAccumulatedHeightBeforeLineNumber(e){e=e|0;const t=this._findLastWhitespaceBeforeLineNumber(e);return t===-1?0:this.getWhitespacesAccumulatedHeight(t)}_findLastWhitespaceBeforeLineNumber(e){e=e|0;const t=this._arr;let i=0,n=t.length-1;for(;i<=n;){const r=(n-i|0)/2|0,a=i+r|0;if(t[a].afterLineNumber<e){if(a+1>=t.length||t[a+1].afterLineNumber>=e)return a;i=a+1|0}else n=a-1|0}return-1}_findFirstWhitespaceAfterLineNumber(e){e=e|0;const i=this._findLastWhitespaceBeforeLineNumber(e)+1;return i<this._arr.length?i:-1}getFirstWhitespaceIndexAfterLineNumber(e){return e=e|0,this._findFirstWhitespaceAfterLineNumber(e)}getVerticalOffsetForLineNumber(e,t=!1){e=e|0;let i;e>1?i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e-1):i=0;const n=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e-(t?1:0));return i+n+this._paddingTop}getLineHeightForLineNumber(e){return this._lineHeightsManager.heightForLineNumber(e)}getVerticalOffsetAfterLineNumber(e,t=!1){e=e|0;const i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(e),n=this.getWhitespaceAccumulatedHeightBeforeLineNumber(e+(t?1:0));return i+n+this._paddingTop}getWhitespaceMinWidth(){if(this._minWidth===-1){let e=0;for(let t=0,i=this._arr.length;t<i;t++)e=Math.max(e,this._arr[t].minWidth);this._minWidth=e}return this._minWidth}isAfterLines(e){const t=this.getLinesTotalHeight();return e>t}isInTopPadding(e){return this._paddingTop===0?!1:e<this._paddingTop}isInBottomPadding(e){if(this._paddingBottom===0)return!1;const t=this.getLinesTotalHeight();return e>=t-this._paddingBottom}getLineNumberAtOrAfterVerticalOffset(e){if(e=e|0,e<0)return 1;const t=this._lineCount|0;let i=1,n=t;for(;i<n;){const s=(i+n)/2|0,r=this.getLineHeightForLineNumber(s),a=this.getVerticalOffsetForLineNumber(s)|0;if(e>=a+r)i=s+1;else{if(e>=a)return s;n=s}}return i>t?t:i}getLinesViewportData(e,t){e=e|0,t=t|0;const i=this.getLineNumberAtOrAfterVerticalOffset(e)|0,n=this.getVerticalOffsetForLineNumber(i)|0;let s=this._lineCount|0,r=this.getFirstWhitespaceIndexAfterLineNumber(i)|0;const a=this.getWhitespacesCount()|0;let l,c;r===-1?(r=a,c=s+1,l=0):(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);let d=n,h=d;const u=5e5;let f=0;n>=u&&(f=Math.floor(n/u)*u,f=Math.floor(f/this._lineHeightsManager.defaultLineHeight)*this._lineHeightsManager.defaultLineHeight,h-=f);const g=[],m=e+(t-e)/2;let _=-1;for(let v=i;v<=s;v++){const S=this.getLineHeightForLineNumber(v);if(_===-1){const L=d,x=d+S;(L<=m&&m<x||L>m)&&(_=v)}for(d+=S,g[v-i]=h,h+=S;c===v;)h+=l,d+=l,r++,r>=a?c=s+1:(c=this.getAfterLineNumberForWhitespaceIndex(r)|0,l=this.getHeightForWhitespaceIndex(r)|0);if(d>=t){s=v;break}}_===-1&&(_=s);const b=this.getVerticalOffsetForLineNumber(s)|0;let C=i,w=s;if(C<w&&n<e&&C++,C<w){const v=this.getLineHeightForLineNumber(s);b+v>t&&w--}return{bigNumbersDelta:f,startLineNumber:i,endLineNumber:s,relativeVerticalOffset:g,centeredLineNumber:_,completelyVisibleStartLineNumber:C,completelyVisibleEndLineNumber:w,lineHeight:this._lineHeightsManager.defaultLineHeight}}getVerticalOffsetForWhitespaceIndex(e){e=e|0;const t=this.getAfterLineNumberForWhitespaceIndex(e);let i;t>=1?i=this._lineHeightsManager.getAccumulatedLineHeightsIncludingLineNumber(t):i=0;let n;return e>0?n=this.getWhitespacesAccumulatedHeight(e-1):n=0,i+n+this._paddingTop}getWhitespaceIndexAtOrAfterVerticallOffset(e){e=e|0;let t=0,i=this.getWhitespacesCount()-1;if(i<0)return-1;const n=this.getVerticalOffsetForWhitespaceIndex(i),s=this.getHeightForWhitespaceIndex(i);if(e>=n+s)return-1;for(;t<i;){const r=Math.floor((t+i)/2),a=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(e>=a+l)t=r+1;else{if(e>=a)return r;i=r}}return t}getWhitespaceAtVerticalOffset(e){e=e|0;const t=this.getWhitespaceIndexAtOrAfterVerticallOffset(e);if(t<0||t>=this.getWhitespacesCount())return null;const i=this.getVerticalOffsetForWhitespaceIndex(t);if(i>e)return null;const n=this.getHeightForWhitespaceIndex(t),s=this.getIdForWhitespaceIndex(t),r=this.getAfterLineNumberForWhitespaceIndex(t);return{id:s,afterLineNumber:r,verticalOffset:i,height:n}}getWhitespaceViewportData(e,t){e=e|0,t=t|0;const i=this.getWhitespaceIndexAtOrAfterVerticallOffset(e),n=this.getWhitespacesCount()-1;if(i<0)return[];const s=[];for(let r=i;r<=n;r++){const a=this.getVerticalOffsetForWhitespaceIndex(r),l=this.getHeightForWhitespaceIndex(r);if(a>=t)break;s.push({id:this.getIdForWhitespaceIndex(r),afterLineNumber:this.getAfterLineNumberForWhitespaceIndex(r),verticalOffset:a,height:l})}return s}getWhitespaces(){return this._arr.slice(0)}getWhitespacesCount(){return this._arr.length}getIdForWhitespaceIndex(e){return e=e|0,this._arr[e].id}getAfterLineNumberForWhitespaceIndex(e){return e=e|0,this._arr[e].afterLineNumber}getHeightForWhitespaceIndex(e){return e=e|0,this._arr[e].height}},yu.INSTANCE_COUNT=0,yu);const Xpe=125;class Bv{constructor(e,t,i,n){e=e|0,t=t|0,i=i|0,n=n|0,e<0&&(e=0),t<0&&(t=0),i<0&&(i=0),n<0&&(n=0),this.width=e,this.contentWidth=t,this.scrollWidth=Math.max(e,t),this.height=i,this.contentHeight=n,this.scrollHeight=Math.max(i,n)}equals(e){return this.width===e.width&&this.contentWidth===e.contentWidth&&this.height===e.height&&this.contentHeight===e.contentHeight}}class Qpe extends A{constructor(e,t){super(),this._onDidContentSizeChange=this._register(new P),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._dimensions=new Bv(0,0,0,0),this._scrollable=this._register(new __({forceIntegerValues:!0,smoothScrollDuration:e,scheduleAtNextAnimationFrame:t})),this.onDidScroll=this._scrollable.onScroll}getScrollable(){return this._scrollable}setSmoothScrollDuration(e){this._scrollable.setSmoothScrollDuration(e)}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}getScrollDimensions(){return this._dimensions}setScrollDimensions(e){if(this._dimensions.equals(e))return;const t=this._dimensions;this._dimensions=e,this._scrollable.setScrollDimensions({width:e.width,scrollWidth:e.scrollWidth,height:e.height,scrollHeight:e.scrollHeight},!0);const i=t.contentWidth!==e.contentWidth,n=t.contentHeight!==e.contentHeight;(i||n)&&this._onDidContentSizeChange.fire(new oA(t.contentWidth,t.contentHeight,e.contentWidth,e.contentHeight))}getFutureScrollPosition(){return this._scrollable.getFutureScrollPosition()}getCurrentScrollPosition(){return this._scrollable.getCurrentScrollPosition()}setScrollPositionNow(e){this._scrollable.setScrollPositionNow(e)}setScrollPositionSmooth(e){this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}}class Jpe extends A{constructor(e,t,i,n){super(),this._configuration=e;const s=this._configuration.options,r=s.get(165),a=s.get(96);this._linesLayout=new Ype(t,s.get(75),a.top,a.bottom,i),this._maxLineWidth=0,this._overlayWidgetsMinWidth=0,this._scrollable=this._register(new Qpe(0,n)),this._configureSmoothScrollDuration(),this._scrollable.setScrollDimensions(new Bv(r.contentWidth,0,r.height,0)),this.onDidScroll=this._scrollable.onDidScroll,this.onDidContentSizeChange=this._scrollable.onDidContentSizeChange,this._updateHeight()}dispose(){super.dispose()}getScrollable(){return this._scrollable.getScrollable()}onHeightMaybeChanged(){this._updateHeight()}_configureSmoothScrollDuration(){this._scrollable.setSmoothScrollDuration(this._configuration.options.get(130)?Xpe:0)}onConfigurationChanged(e){const t=this._configuration.options;if(e.hasChanged(75)&&this._linesLayout.setDefaultLineHeight(t.get(75)),e.hasChanged(96)){const i=t.get(96);this._linesLayout.setPadding(i.top,i.bottom)}if(e.hasChanged(165)){const i=t.get(165),n=i.contentWidth,s=i.height,r=this._scrollable.getScrollDimensions(),a=r.contentWidth;this._scrollable.setScrollDimensions(new Bv(n,r.contentWidth,s,this._getContentHeight(n,s,a)))}else this._updateHeight();e.hasChanged(130)&&this._configureSmoothScrollDuration()}onFlushed(e,t){this._linesLayout.onFlushed(e,t)}onLinesDeleted(e,t){this._linesLayout.onLinesDeleted(e,t)}onLinesInserted(e,t){this._linesLayout.onLinesInserted(e,t)}_getHorizontalScrollbarHeight(e,t){const n=this._configuration.options.get(117);return n.horizontal===2||e>=t?0:n.horizontalScrollbarSize}_getContentHeight(e,t,i){const n=this._configuration.options;let s=this._linesLayout.getLinesTotalHeight();return n.get(119)?s+=Math.max(0,t-n.get(75)-n.get(96).bottom):n.get(117).ignoreHorizontalScrollbarInContentHeight||(s+=this._getHorizontalScrollbarHeight(e,i)),s}_updateHeight(){const e=this._scrollable.getScrollDimensions(),t=e.width,i=e.height,n=e.contentWidth;this._scrollable.setScrollDimensions(new Bv(t,e.contentWidth,i,this._getContentHeight(t,i,n)))}getCurrentViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getCurrentScrollPosition();return new nU(t.scrollTop,t.scrollLeft,e.width,e.height)}getFutureViewport(){const e=this._scrollable.getScrollDimensions(),t=this._scrollable.getFutureScrollPosition();return new nU(t.scrollTop,t.scrollLeft,e.width,e.height)}_computeContentWidth(){const e=this._configuration.options,t=this._maxLineWidth,i=e.get(166),n=e.get(59),s=e.get(165);if(i.isViewportWrapping){const r=e.get(81);return t>s.contentWidth+n.typicalHalfwidthCharacterWidth&&r.enabled&&r.side==="right"?t+s.verticalScrollbarWidth:t}else{const r=e.get(118)*n.typicalHalfwidthCharacterWidth,a=this._linesLayout.getWhitespaceMinWidth();return Math.max(t+r+s.verticalScrollbarWidth,a,this._overlayWidgetsMinWidth)}}setMaxLineWidth(e){this._maxLineWidth=e,this._updateContentWidth()}setOverlayWidgetsMinWidth(e){this._overlayWidgetsMinWidth=e,this._updateContentWidth()}_updateContentWidth(){const e=this._scrollable.getScrollDimensions();this._scrollable.setScrollDimensions(new Bv(e.width,this._computeContentWidth(),e.height,e.contentHeight)),this._updateHeight()}saveState(){const e=this._scrollable.getFutureScrollPosition(),t=e.scrollTop,i=this._linesLayout.getLineNumberAtOrAfterVerticalOffset(t),n=this._linesLayout.getWhitespaceAccumulatedHeightBeforeLineNumber(i);return{scrollTop:t,scrollTopWithoutViewZones:t-n,scrollLeft:e.scrollLeft}}changeWhitespace(e){const t=this._linesLayout.changeWhitespace(e);return t&&this.onHeightMaybeChanged(),t}changeSpecialLineHeights(e){const t=this._linesLayout.changeLineHeights(e);return t&&this.onHeightMaybeChanged(),t}getVerticalOffsetForLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetForLineNumber(e,t)}getVerticalOffsetAfterLineNumber(e,t=!1){return this._linesLayout.getVerticalOffsetAfterLineNumber(e,t)}getLineHeightForLineNumber(e){return this._linesLayout.getLineHeightForLineNumber(e)}isAfterLines(e){return this._linesLayout.isAfterLines(e)}isInTopPadding(e){return this._linesLayout.isInTopPadding(e)}isInBottomPadding(e){return this._linesLayout.isInBottomPadding(e)}getLineNumberAtVerticalOffset(e){return this._linesLayout.getLineNumberAtOrAfterVerticalOffset(e)}getWhitespaceAtVerticalOffset(e){return this._linesLayout.getWhitespaceAtVerticalOffset(e)}getLinesViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getLinesViewportData(e.top,e.top+e.height)}getLinesViewportDataAtScrollTop(e){const t=this._scrollable.getScrollDimensions();return e+t.height>t.scrollHeight&&(e=t.scrollHeight-t.height),e<0&&(e=0),this._linesLayout.getLinesViewportData(e,e+t.height)}getWhitespaceViewportData(){const e=this.getCurrentViewport();return this._linesLayout.getWhitespaceViewportData(e.top,e.top+e.height)}getWhitespaces(){return this._linesLayout.getWhitespaces()}getContentWidth(){return this._scrollable.getScrollDimensions().contentWidth}getScrollWidth(){return this._scrollable.getScrollDimensions().scrollWidth}getContentHeight(){return this._scrollable.getScrollDimensions().contentHeight}getScrollHeight(){return this._scrollable.getScrollDimensions().scrollHeight}getCurrentScrollLeft(){return this._scrollable.getCurrentScrollPosition().scrollLeft}getCurrentScrollTop(){return this._scrollable.getCurrentScrollPosition().scrollTop}validateScrollPosition(e){return this._scrollable.validateScrollPosition(e)}setScrollPosition(e,t){t===1?this._scrollable.setScrollPositionNow(e):this._scrollable.setScrollPositionSmooth(e)}hasPendingScrollAnimation(){return this._scrollable.hasPendingScrollAnimation()}deltaScrollNow(e,t){const i=this._scrollable.getCurrentScrollPosition();this._scrollable.setScrollPositionNow({scrollLeft:i.scrollLeft+e,scrollTop:i.scrollTop+t})}}class tg{constructor(e,t,i){this.range=e,this.inlineClassName=t,this.type=i}}class eme{constructor(e,t,i,n){this.startOffset=e,this.endOffset=t,this.inlineClassName=i,this.inlineClassNameAffectsLetterSpacing=n}toInlineDecoration(e){return new tg(new k(e,this.startOffset+1,e,this.endOffset+1),this.inlineClassName,this.inlineClassNameAffectsLetterSpacing?3:0)}}class tme{constructor(e,t,i,n,s){this.editorId=e,this.model=t,this.configuration=i,this._linesCollection=n,this._coordinatesConverter=s,this._decorationsCache=Object.create(null),this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}_clearCachedModelDecorationsResolver(){this._cachedModelDecorationsResolver=null,this._cachedModelDecorationsResolverViewRange=null}dispose(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}reset(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onModelDecorationsChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}onLineMappingChanged(){this._decorationsCache=Object.create(null),this._clearCachedModelDecorationsResolver()}_getOrCreateViewModelDecoration(e){const t=e.id;let i=this._decorationsCache[t];if(!i){const n=e.range,s=e.options;let r;if(s.isWholeLine){const a=this._coordinatesConverter.convertModelPositionToViewPosition(new M(n.startLineNumber,1),0,!1,!0),l=this._coordinatesConverter.convertModelPositionToViewPosition(new M(n.endLineNumber,this.model.getLineMaxColumn(n.endLineNumber)),1);r=new k(a.lineNumber,a.column,l.lineNumber,l.column)}else r=this._coordinatesConverter.convertModelRangeToViewRange(n,1);i=new Jz(r,s),this._decorationsCache[t]=i}return i}getMinimapDecorationsInRange(e){return this._getDecorationsInRange(e,!0,!1).decorations}getDecorationsViewportData(e){let t=this._cachedModelDecorationsResolver!==null;return t=t&&e.equalsRange(this._cachedModelDecorationsResolverViewRange),t||(this._cachedModelDecorationsResolver=this._getDecorationsInRange(e,!1,!1),this._cachedModelDecorationsResolverViewRange=e),this._cachedModelDecorationsResolver}getDecorationsOnLine(e,t=!1,i=!1){const n=new k(e,this._linesCollection.getViewLineMinColumn(e),e,this._linesCollection.getViewLineMaxColumn(e));return this._getDecorationsInRange(n,t,i)}_getDecorationsInRange(e,t,i){const n=this._linesCollection.getDecorationsInRange(e,this.editorId,gL(this.configuration.options),pL(this.configuration.options),t,i),s=e.startLineNumber,r=e.endLineNumber,a=[];let l=0;const c=[];for(let h=s;h<=r;h++)c[h-s]=[];let d=!1;for(let h=0,u=n.length;h<u;h++){const f=n[h],g=f.options;if(!$M(this.model,f))continue;const m=this._getOrCreateViewModelDecoration(f),_=m.range;if(a[l++]=m,g.inlineClassName){const b=new tg(_,g.inlineClassName,g.inlineClassNameAffectsLetterSpacing?3:0),C=Math.max(s,_.startLineNumber),w=Math.min(r,_.endLineNumber);for(let v=C;v<=w;v++)c[v-s].push(b)}if(g.beforeContentClassName&&s<=_.startLineNumber&&_.startLineNumber<=r){const b=new tg(new k(_.startLineNumber,_.startColumn,_.startLineNumber,_.startColumn),g.beforeContentClassName,1);c[_.startLineNumber-s].push(b)}if(g.afterContentClassName&&s<=_.endLineNumber&&_.endLineNumber<=r){const b=new tg(new k(_.endLineNumber,_.endColumn,_.endLineNumber,_.endColumn),g.afterContentClassName,2);c[_.endLineNumber-s].push(b)}g.affectsFont&&(d=!0)}return{decorations:a,inlineDecorations:c,hasVariableFonts:d}}}function lA(o,e){return o===null?e?Rx.INSTANCE:Mx.INSTANCE:new ime(o,e)}class ime{constructor(e,t){this._projectionData=e,this._isVisible=t}isVisible(){return this._isVisible}setVisible(e){return this._isVisible=e,this}getProjectionData(){return this._projectionData}getViewLineCount(){return this._isVisible?this._projectionData.getOutputLineCount():0}getViewLineContent(e,t,i){this._assertVisible();const n=i>0?this._projectionData.breakOffsets[i-1]:0,s=this._projectionData.breakOffsets[i];let r;if(this._projectionData.injectionOffsets!==null){const a=this._projectionData.injectionOffsets.map((c,d)=>new Ma(0,0,c+1,this._projectionData.injectionOptions[d],0));r=Ma.applyInjectedText(e.getLineContent(t),a).substring(n,s)}else r=e.getValueInRange({startLineNumber:t,startColumn:n+1,endLineNumber:t,endColumn:s+1});return i>0&&(r=z$(this._projectionData.wrappedTextIndentLength)+r),r}getViewLineLength(e,t,i){return this._assertVisible(),this._projectionData.getLineLength(i)}getViewLineMinColumn(e,t,i){return this._assertVisible(),this._projectionData.getMinOutputOffset(i)+1}getViewLineMaxColumn(e,t,i){return this._assertVisible(),this._projectionData.getMaxOutputOffset(i)+1}getViewLineData(e,t,i){const n=new Array;return this.getViewLinesData(e,t,i,1,0,[!0],n),n[0]}getViewLinesData(e,t,i,n,s,r,a){this._assertVisible();const l=this._projectionData,c=l.injectionOffsets,d=l.injectionOptions;let h=null;if(c){h=[];let f=0,g=0;for(let m=0;m<l.getOutputLineCount();m++){const _=new Array;h[m]=_;const b=m>0?l.breakOffsets[m-1]:0,C=l.breakOffsets[m];for(;g<c.length;){const w=d[g].content.length,v=c[g]+f,S=v+w;if(v>C)break;if(b<S){const L=d[g];if(L.inlineClassName){const x=m>0?l.wrappedTextIndentLength:0,I=x+Math.max(v-b,0),D=x+Math.min(S-b,C-b);I!==D&&_.push(new eme(I,D,L.inlineClassName,L.inlineClassNameAffectsLetterSpacing))}}if(S<=C)f+=w,g++;else break}}}let u;if(c){const f=[];for(let g=0;g<c.length;g++){const m=c[g],_=d[g].tokens;_?_.forEach((b,C)=>{f.push({offset:m,text:b.substring(d[g].content),tokenMetadata:C.metadata})}):f.push({offset:m,text:d[g].content,tokenMetadata:bi.defaultTokenMetadata})}u=e.tokenization.getLineTokens(t).withInserted(f)}else u=e.tokenization.getLineTokens(t);for(let f=i;f<i+n;f++){const g=s+f-i;if(!r[g]){a[g]=null;continue}a[g]=this._getViewLineData(u,h?h[f]:null,f)}}_getViewLineData(e,t,i){this._assertVisible();const n=this._projectionData,s=i>0?n.wrappedTextIndentLength:0,r=i>0?n.breakOffsets[i-1]:0,a=n.breakOffsets[i],l=e.sliceAndInflate(r,a,s);let c=l.getLineContent();i>0&&(c=z$(n.wrappedTextIndentLength)+c);const d=this._projectionData.getMinOutputOffset(i)+1,h=c.length+1,u=i+1<this.getViewLineCount(),f=i===0?0:n.breakOffsetsVisibleColumn[i-1];return new GM(c,u,d,h,f,l,t)}getModelColumnOfViewPosition(e,t){return this._assertVisible(),this._projectionData.translateToInputOffset(e,t-1)+1}getViewPositionOfModelPosition(e,t,i=2){return this._assertVisible(),this._projectionData.translateToOutputPosition(t-1,i).toPosition(e)}getViewLineNumberOfModelPosition(e,t){this._assertVisible();const i=this._projectionData.translateToOutputPosition(t-1);return e+i.outputLineIndex}normalizePosition(e,t,i){const n=t.lineNumber-e;return this._projectionData.normalizeOutputPosition(e,t.column-1,i).toPosition(n)}getInjectedTextAt(e,t){return this._projectionData.getInjectedText(e,t-1)}_assertVisible(){if(!this._isVisible)throw new Error("Not supported")}}const _N=class _N{constructor(){}isVisible(){return!0}setVisible(e){return e?this:Mx.INSTANCE}getProjectionData(){return null}getViewLineCount(){return 1}getViewLineContent(e,t,i){return e.getLineContent(t)}getViewLineLength(e,t,i){return e.getLineLength(t)}getViewLineMinColumn(e,t,i){return e.getLineMinColumn(t)}getViewLineMaxColumn(e,t,i){return e.getLineMaxColumn(t)}getViewLineData(e,t,i){const n=e.tokenization.getLineTokens(t),s=n.getLineContent();return new GM(s,!1,1,s.length+1,0,n.inflate(),null)}getViewLinesData(e,t,i,n,s,r,a){if(!r[s]){a[s]=null;return}a[s]=this.getViewLineData(e,t,0)}getModelColumnOfViewPosition(e,t){return t}getViewPositionOfModelPosition(e,t){return new M(e,t)}getViewLineNumberOfModelPosition(e,t){return e}normalizePosition(e,t,i){return t}getInjectedTextAt(e,t){return null}};_N.INSTANCE=new _N;let Rx=_N;const bN=class bN{constructor(){}isVisible(){return!1}setVisible(e){return e?Rx.INSTANCE:this}getProjectionData(){return null}getViewLineCount(){return 0}getViewLineContent(e,t,i){throw new Error("Not supported")}getViewLineLength(e,t,i){throw new Error("Not supported")}getViewLineMinColumn(e,t,i){throw new Error("Not supported")}getViewLineMaxColumn(e,t,i){throw new Error("Not supported")}getViewLineData(e,t,i){throw new Error("Not supported")}getViewLinesData(e,t,i,n,s,r,a){throw new Error("Not supported")}getModelColumnOfViewPosition(e,t){throw new Error("Not supported")}getViewPositionOfModelPosition(e,t){throw new Error("Not supported")}getViewLineNumberOfModelPosition(e,t){throw new Error("Not supported")}normalizePosition(e,t,i){throw new Error("Not supported")}getInjectedTextAt(e,t){throw new Error("Not supported")}};bN.INSTANCE=new bN;let Mx=bN;const cA=[""];function z$(o){if(o>=cA.length)for(let e=1;e<=o;e++)cA[e]=nme(e);return cA[o]}function nme(o){return new Array(o+1).join(" ")}class sme{constructor(e){this.values=e,this.prefixSum=new Uint32Array(e.length),this.prefixSumValidIndex=new Int32Array(1),this.prefixSumValidIndex[0]=-1}insertValues(e,t){e=jm(e);const i=this.values,n=this.prefixSum,s=t.length;return s===0?!1:(this.values=new Uint32Array(i.length+s),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e),e+s),this.values.set(t,e),e-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=e-1),this.prefixSum=new Uint32Array(this.values.length),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}setValue(e,t){return e=jm(e),t=jm(t),this.values[e]===t?!1:(this.values[e]=t,e-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=e-1),!0)}removeValues(e,t){e=jm(e),t=jm(t);const i=this.values,n=this.prefixSum;if(e>=i.length)return!1;const s=i.length-e;return t>=s&&(t=s),t===0?!1:(this.values=new Uint32Array(i.length-t),this.values.set(i.subarray(0,e),0),this.values.set(i.subarray(e+t),e),this.prefixSum=new Uint32Array(this.values.length),e-1<this.prefixSumValidIndex[0]&&(this.prefixSumValidIndex[0]=e-1),this.prefixSumValidIndex[0]>=0&&this.prefixSum.set(n.subarray(0,this.prefixSumValidIndex[0]+1)),!0)}getTotalSum(){return this.values.length===0?0:this._getPrefixSum(this.values.length-1)}getPrefixSum(e){return e<0?0:(e=jm(e),this._getPrefixSum(e))}_getPrefixSum(e){if(e<=this.prefixSumValidIndex[0])return this.prefixSum[e];let t=this.prefixSumValidIndex[0]+1;t===0&&(this.prefixSum[0]=this.values[0],t++),e>=this.values.length&&(e=this.values.length-1);for(let i=t;i<=e;i++)this.prefixSum[i]=this.prefixSum[i-1]+this.values[i];return this.prefixSumValidIndex[0]=Math.max(this.prefixSumValidIndex[0],e),this.prefixSum[e]}getIndexOf(e){e=Math.floor(e),this.getTotalSum();let t=0,i=this.values.length-1,n=0,s=0,r=0;for(;t<=i;)if(n=t+(i-t)/2|0,s=this.prefixSum[n],r=s-this.values[n],e<r)i=n-1;else if(e>=s)t=n+1;else break;return new U$(n,e-r)}}class ome{constructor(e){this._values=e,this._isValid=!1,this._validEndIndex=-1,this._prefixSum=[],this._indexBySum=[]}getTotalSum(){return this._ensureValid(),this._indexBySum.length}getPrefixSum(e){return this._ensureValid(),e===0?0:this._prefixSum[e-1]}getIndexOf(e){this._ensureValid();const t=this._indexBySum[e],i=t>0?this._prefixSum[t-1]:0;return new U$(t,e-i)}removeValues(e,t){this._values.splice(e,t),this._invalidate(e)}insertValues(e,t){this._values=my(this._values,e,t),this._invalidate(e)}_invalidate(e){this._isValid=!1,this._validEndIndex=Math.min(this._validEndIndex,e-1)}_ensureValid(){if(!this._isValid){for(let e=this._validEndIndex+1,t=this._values.length;e<t;e++){const i=this._values[e],n=e>0?this._prefixSum[e-1]:0;this._prefixSum[e]=n+i;for(let s=0;s<i;s++)this._indexBySum[n+s]=e}this._prefixSum.length=this._values.length,this._indexBySum.length=this._prefixSum[this._prefixSum.length-1],this._isValid=!0,this._validEndIndex=this._values.length-1}}setValue(e,t){this._values[e]!==t&&(this._values[e]=t,this._invalidate(e))}}class U${constructor(e,t){this.index=e,this.remainder=t,this._prefixSumIndexOfResultBrand=void 0,this.index=e,this.remainder=t}}class rme{constructor(e){this._model=e}_validPosition(e){return this._model.validatePosition(e)}_validRange(e){return this._model.validateRange(e)}convertViewPositionToModelPosition(e){return this._validPosition(e)}convertViewRangeToModelRange(e){return this._validRange(e)}validateViewPosition(e,t){return this._validPosition(t)}validateViewRange(e,t){return this._validRange(t)}convertModelPositionToViewPosition(e){return this._validPosition(e)}convertModelRangeToViewRange(e){return this._validRange(e)}modelPositionIsVisible(e){const t=this._model.getLineCount();return!(e.lineNumber<1||e.lineNumber>t)}getModelLineViewLineCount(e){return 1}getViewLineNumberOfModelPosition(e,t){return e}}class ame{constructor(e,t,i,n,s,r,a,l,c,d,h){this._editorId=e,this.model=t,this._validModelVersionId=-1,this._domLineBreaksComputerFactory=i,this._monospaceLineBreaksComputerFactory=n,this.fontInfo=s,this.tabSize=r,this.wrappingStrategy=a,this.wrappingColumn=l,this.wrappingIndent=c,this.wordBreak=d,this.wrapOnEscapedLineFeeds=h,this._constructLines(!0,null)}dispose(){this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[])}createCoordinatesConverter(){return new cme(this)}_constructLines(e,t){this.modelLineProjections=[],e&&(this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,[]));const i=this.model.getLinesContent(),n=this.model.getInjectedTextDecorations(this._editorId),s=i.length,r=this.createLineBreaksComputer(),a=new Ec(Ma.fromDecorations(n));for(let m=0;m<s;m++){const _=a.takeWhile(b=>b.lineNumber===m+1);r.addRequest(i[m],_,t?t[m]:null)}const l=r.finalize(),c=[],d=this.hiddenAreasDecorationIds.map(m=>this.model.getDecorationRange(m)).sort(k.compareRangesUsingStarts);let h=1,u=0,f=-1,g=f+1<d.length?u+1:s+2;for(let m=0;m<s;m++){const _=m+1;_===g&&(f++,h=d[f].startLineNumber,u=d[f].endLineNumber,g=f+1<d.length?u+1:s+2);const b=_>=h&&_<=u,C=lA(l[m],!b);c[m]=C.getViewLineCount(),this.modelLineProjections[m]=C}this._validModelVersionId=this.model.getVersionId(),this.projectedModelLineLineCounts=new ome(c)}getHiddenAreas(){return this.hiddenAreasDecorationIds.map(e=>this.model.getDecorationRange(e))}setHiddenAreas(e){const t=e.map(u=>this.model.validateRange(u)),i=lme(t),n=this.hiddenAreasDecorationIds.map(u=>this.model.getDecorationRange(u)).sort(k.compareRangesUsingStarts);if(i.length===n.length){let u=!1;for(let f=0;f<i.length;f++)if(!i[f].equalsRange(n[f])){u=!0;break}if(!u)return!1}const s=i.map(u=>({range:u,options:Te.EMPTY}));this.hiddenAreasDecorationIds=this.model.deltaDecorations(this.hiddenAreasDecorationIds,s);const r=i;let a=1,l=0,c=-1,d=c+1<r.length?l+1:this.modelLineProjections.length+2,h=!1;for(let u=0;u<this.modelLineProjections.length;u++){const f=u+1;f===d&&(c++,a=r[c].startLineNumber,l=r[c].endLineNumber,d=c+1<r.length?l+1:this.modelLineProjections.length+2);let g=!1;if(f>=a&&f<=l?this.modelLineProjections[u].isVisible()&&(this.modelLineProjections[u]=this.modelLineProjections[u].setVisible(!1),g=!0):(h=!0,this.modelLineProjections[u].isVisible()||(this.modelLineProjections[u]=this.modelLineProjections[u].setVisible(!0),g=!0)),g){const m=this.modelLineProjections[u].getViewLineCount();this.projectedModelLineLineCounts.setValue(u,m)}}return h||this.setHiddenAreas([]),!0}modelPositionIsVisible(e,t){return e<1||e>this.modelLineProjections.length?!1:this.modelLineProjections[e-1].isVisible()}getModelLineViewLineCount(e){return e<1||e>this.modelLineProjections.length?1:this.modelLineProjections[e-1].getViewLineCount()}setTabSize(e){return this.tabSize===e?!1:(this.tabSize=e,this._constructLines(!1,null),!0)}setWrappingSettings(e,t,i,n,s){const r=this.fontInfo.equals(e),a=this.wrappingStrategy===t,l=this.wrappingColumn===i,c=this.wrappingIndent===n,d=this.wordBreak===s;if(r&&a&&l&&c&&d)return!1;const h=r&&a&&!l&&c&&d;this.fontInfo=e,this.wrappingStrategy=t,this.wrappingColumn=i,this.wrappingIndent=n,this.wordBreak=s;let u=null;if(h){u=[];for(let f=0,g=this.modelLineProjections.length;f<g;f++)u[f]=this.modelLineProjections[f].getProjectionData()}return this._constructLines(!1,u),!0}createLineBreaksComputer(){return(this.wrappingStrategy==="advanced"?this._domLineBreaksComputerFactory:this._monospaceLineBreaksComputerFactory).createLineBreaksComputer(this.fontInfo,this.tabSize,this.wrappingColumn,this.wrappingIndent,this.wordBreak,this.wrapOnEscapedLineFeeds)}onModelFlushed(){this._constructLines(!0,null)}onModelLinesDeleted(e,t,i){if(!e||e<=this._validModelVersionId)return null;const n=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,s=this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections.splice(t-1,i-t+1),this.projectedModelLineLineCounts.removeValues(t-1,i-t+1),new nA(n,s)}onModelLinesInserted(e,t,i,n){if(!e||e<=this._validModelVersionId)return null;const s=t>2&&!this.modelLineProjections[t-2].isVisible(),r=t===1?1:this.projectedModelLineLineCounts.getPrefixSum(t-1)+1;let a=0;const l=[],c=[];for(let d=0,h=n.length;d<h;d++){const u=lA(n[d],!s);l.push(u);const f=u.getViewLineCount();a+=f,c[d]=f}return this.modelLineProjections=this.modelLineProjections.slice(0,t-1).concat(l).concat(this.modelLineProjections.slice(t-1)),this.projectedModelLineLineCounts.insertValues(t-1,c),new sA(r,r+a-1)}onModelLineChanged(e,t,i){if(e!==null&&e<=this._validModelVersionId)return[!1,null,null,null];const n=t-1,s=this.modelLineProjections[n].getViewLineCount(),r=this.modelLineProjections[n].isVisible(),a=lA(i,r);this.modelLineProjections[n]=a;const l=this.modelLineProjections[n].getViewLineCount();let c=!1,d=0,h=-1,u=0,f=-1,g=0,m=-1;s>l?(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,h=d+l-1,g=h+1,m=g+(s-l)-1,c=!0):s<l?(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,h=d+s-1,u=h+1,f=u+(l-s)-1,c=!0):(d=this.projectedModelLineLineCounts.getPrefixSum(t-1)+1,h=d+l-1),this.projectedModelLineLineCounts.setValue(n,l);const _=d<=h?new F$(d,h-d+1):null,b=u<=f?new sA(u,f):null,C=g<=m?new nA(g,m):null;return[c,_,b,C]}acceptVersionId(e){this._validModelVersionId=e,this.modelLineProjections.length===1&&!this.modelLineProjections[0].isVisible()&&this.setHiddenAreas([])}getViewLineCount(){return this.projectedModelLineLineCounts.getTotalSum()}_toValidViewLineNumber(e){if(e<1)return 1;const t=this.getViewLineCount();return e>t?t:e|0}getActiveIndentGuide(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t),i=this._toValidViewLineNumber(i);const n=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),s=this.convertViewPositionToModelPosition(t,this.getViewLineMinColumn(t)),r=this.convertViewPositionToModelPosition(i,this.getViewLineMinColumn(i)),a=this.model.guides.getActiveIndentGuide(n.lineNumber,s.lineNumber,r.lineNumber),l=this.convertModelPositionToViewPosition(a.startLineNumber,1),c=this.convertModelPositionToViewPosition(a.endLineNumber,this.model.getLineMaxColumn(a.endLineNumber));return{startLineNumber:l.lineNumber,endLineNumber:c.lineNumber,indent:a.indent}}getViewLineInfo(e){e=this._toValidViewLineNumber(e);const t=this.projectedModelLineLineCounts.getIndexOf(e-1),i=t.index,n=t.remainder;return new $$(i+1,n)}getMinColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getMaxColumnOfViewLine(e){return this.modelLineProjections[e.modelLineNumber-1].getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx)}getModelStartPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMinColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new M(e.modelLineNumber,n)}getModelEndPositionOfViewLine(e){const t=this.modelLineProjections[e.modelLineNumber-1],i=t.getViewLineMaxColumn(this.model,e.modelLineNumber,e.modelLineWrappedLineIdx),n=t.getModelColumnOfViewPosition(e.modelLineWrappedLineIdx,i);return new M(e.modelLineNumber,n)}getViewLineInfosGroupedByModelRanges(e,t){const i=this.getViewLineInfo(e),n=this.getViewLineInfo(t),s=new Array;let r=this.getModelStartPositionOfViewLine(i),a=new Array;for(let l=i.modelLineNumber;l<=n.modelLineNumber;l++){const c=this.modelLineProjections[l-1];if(c.isVisible()){const d=l===i.modelLineNumber?i.modelLineWrappedLineIdx:0,h=l===n.modelLineNumber?n.modelLineWrappedLineIdx+1:c.getViewLineCount();for(let u=d;u<h;u++)a.push(new $$(l,u))}if(!c.isVisible()&&r){const d=new M(l-1,this.model.getLineMaxColumn(l-1)+1),h=k.fromPositions(r,d);s.push(new j$(h,a)),a=[],r=null}else c.isVisible()&&!r&&(r=new M(l,1))}if(r){const l=k.fromPositions(r,this.getModelEndPositionOfViewLine(n));s.push(new j$(l,a))}return s}getViewLinesBracketGuides(e,t,i,n){const s=i?this.convertViewPositionToModelPosition(i.lineNumber,i.column):null,r=[];for(const a of this.getViewLineInfosGroupedByModelRanges(e,t)){const l=a.modelRange.startLineNumber,c=this.model.guides.getLinesBracketGuides(l,a.modelRange.endLineNumber,s,n);for(const d of a.viewLines){const u=c[d.modelLineNumber-l].map(f=>{if(f.forWrappedLinesAfterColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesAfterColumn).lineNumber>=d.modelLineWrappedLineIdx||f.forWrappedLinesBeforeOrAtColumn!==-1&&this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.forWrappedLinesBeforeOrAtColumn).lineNumber<d.modelLineWrappedLineIdx)return;if(!f.horizontalLine)return f;let g=-1;if(f.column!==-1){const b=this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.column);if(b.lineNumber===d.modelLineWrappedLineIdx)g=b.column;else if(b.lineNumber<d.modelLineWrappedLineIdx)g=this.getMinColumnOfViewLine(d);else if(b.lineNumber>d.modelLineWrappedLineIdx)return}const m=this.convertModelPositionToViewPosition(d.modelLineNumber,f.horizontalLine.endColumn),_=this.modelLineProjections[d.modelLineNumber-1].getViewPositionOfModelPosition(0,f.horizontalLine.endColumn);return _.lineNumber===d.modelLineWrappedLineIdx?new Wf(f.visibleColumn,g,f.className,new ov(f.horizontalLine.top,m.column),-1,-1):_.lineNumber<d.modelLineWrappedLineIdx||f.visibleColumn!==-1?void 0:new Wf(f.visibleColumn,g,f.className,new ov(f.horizontalLine.top,this.getMaxColumnOfViewLine(d)),-1,-1)});r.push(u.filter(f=>!!f))}}return r}getViewLinesIndentGuides(e,t){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const i=this.convertViewPositionToModelPosition(e,this.getViewLineMinColumn(e)),n=this.convertViewPositionToModelPosition(t,this.getViewLineMaxColumn(t));let s=[];const r=[],a=[],l=i.lineNumber-1,c=n.lineNumber-1;let d=null;for(let g=l;g<=c;g++){const m=this.modelLineProjections[g];if(m.isVisible()){const _=m.getViewLineNumberOfModelPosition(0,g===l?i.column:1),b=m.getViewLineNumberOfModelPosition(0,this.model.getLineMaxColumn(g+1)),C=b-_+1;let w=0;C>1&&m.getViewLineMinColumn(this.model,g+1,b)===1&&(w=_===0?1:2),r.push(C),a.push(w),d===null&&(d=new M(g+1,0))}else d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,g)),d=null)}d!==null&&(s=s.concat(this.model.guides.getLinesIndentGuides(d.lineNumber,n.lineNumber)),d=null);const h=t-e+1,u=new Array(h);let f=0;for(let g=0,m=s.length;g<m;g++){let _=s[g];const b=Math.min(h-f,r[g]),C=a[g];let w;C===2?w=0:C===1?w=1:w=b;for(let v=0;v<b;v++)v===w&&(_=0),u[f++]=_}return u}getViewLineContent(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineContent(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineLength(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineLength(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMinColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMinColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineMaxColumn(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineMaxColumn(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLineData(e){const t=this.getViewLineInfo(e);return this.modelLineProjections[t.modelLineNumber-1].getViewLineData(this.model,t.modelLineNumber,t.modelLineWrappedLineIdx)}getViewLinesData(e,t,i){e=this._toValidViewLineNumber(e),t=this._toValidViewLineNumber(t);const n=this.projectedModelLineLineCounts.getIndexOf(e-1);let s=e;const r=n.index,a=n.remainder,l=[];for(let c=r,d=this.model.getLineCount();c<d;c++){const h=this.modelLineProjections[c];if(!h.isVisible())continue;const u=c===r?a:0;let f=h.getViewLineCount()-u,g=!1;if(s+f>t&&(g=!0,f=t-s+1),h.getViewLinesData(this.model,c+1,u,f,s-e,i,l),s+=f,g)break}return l}validateViewPosition(e,t,i){e=this._toValidViewLineNumber(e);const n=this.projectedModelLineLineCounts.getIndexOf(e-1),s=n.index,r=n.remainder,a=this.modelLineProjections[s],l=a.getViewLineMinColumn(this.model,s+1,r),c=a.getViewLineMaxColumn(this.model,s+1,r);t<l&&(t=l),t>c&&(t=c);const d=a.getModelColumnOfViewPosition(r,t);return this.model.validatePosition(new M(s+1,d)).equals(i)?new M(e,t):this.convertModelPositionToViewPosition(i.lineNumber,i.column)}validateViewRange(e,t){const i=this.validateViewPosition(e.startLineNumber,e.startColumn,t.getStartPosition()),n=this.validateViewPosition(e.endLineNumber,e.endColumn,t.getEndPosition());return new k(i.lineNumber,i.column,n.lineNumber,n.column)}convertViewPositionToModelPosition(e,t){const i=this.getViewLineInfo(e),n=this.modelLineProjections[i.modelLineNumber-1].getModelColumnOfViewPosition(i.modelLineWrappedLineIdx,t);return this.model.validatePosition(new M(i.modelLineNumber,n))}convertViewRangeToModelRange(e){const t=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),i=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);return new k(t.lineNumber,t.column,i.lineNumber,i.column)}convertModelPositionToViewPosition(e,t,i=2,n=!1,s=!1){const r=this.model.validatePosition(new M(e,t)),a=r.lineNumber,l=r.column;let c=a-1,d=!1;if(s)for(;c<this.modelLineProjections.length&&!this.modelLineProjections[c].isVisible();)c++,d=!0;else for(;c>0&&!this.modelLineProjections[c].isVisible();)c--,d=!0;if(c===0&&!this.modelLineProjections[c].isVisible())return new M(n?0:1,1);const h=1+this.projectedModelLineLineCounts.getPrefixSum(c);let u;return d?s?u=this.modelLineProjections[c].getViewPositionOfModelPosition(h,1,i):u=this.modelLineProjections[c].getViewPositionOfModelPosition(h,this.model.getLineMaxColumn(c+1),i):u=this.modelLineProjections[a-1].getViewPositionOfModelPosition(h,l,i),u}convertModelRangeToViewRange(e,t=0){if(e.isEmpty()){const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,t);return k.fromPositions(i)}else{const i=this.convertModelPositionToViewPosition(e.startLineNumber,e.startColumn,1),n=this.convertModelPositionToViewPosition(e.endLineNumber,e.endColumn,0);return new k(i.lineNumber,i.column,n.lineNumber,n.column)}}getViewLineNumberOfModelPosition(e,t){let i=e-1;if(this.modelLineProjections[i].isVisible()){const s=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(s,t)}for(;i>0&&!this.modelLineProjections[i].isVisible();)i--;if(i===0&&!this.modelLineProjections[i].isVisible())return 1;const n=1+this.projectedModelLineLineCounts.getPrefixSum(i);return this.modelLineProjections[i].getViewLineNumberOfModelPosition(n,this.model.getLineMaxColumn(i+1))}getDecorationsInRange(e,t,i,n,s,r){const a=this.convertViewPositionToModelPosition(e.startLineNumber,e.startColumn),l=this.convertViewPositionToModelPosition(e.endLineNumber,e.endColumn);if(l.lineNumber-a.lineNumber<=e.endLineNumber-e.startLineNumber)return this.model.getDecorationsInRange(new k(a.lineNumber,1,l.lineNumber,l.column),t,i,n,s,r);let c=[];const d=a.lineNumber-1,h=l.lineNumber-1;let u=null;for(let _=d;_<=h;_++)if(this.modelLineProjections[_].isVisible())u===null&&(u=new M(_+1,_===d?a.column:1));else if(u!==null){const C=this.model.getLineMaxColumn(_);c=c.concat(this.model.getDecorationsInRange(new k(u.lineNumber,u.column,_,C),t,i,n,s)),u=null}u!==null&&(c=c.concat(this.model.getDecorationsInRange(new k(u.lineNumber,u.column,l.lineNumber,l.column),t,i,n,s)),u=null),c.sort((_,b)=>{const C=k.compareRangesUsingStarts(_.range,b.range);return C===0?_.id<b.id?-1:_.id>b.id?1:0:C});const f=[];let g=0,m=null;for(const _ of c){const b=_.id;m!==b&&(m=b,f[g++]=_)}return f}getInjectedTextAt(e){const t=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[t.modelLineNumber-1].getInjectedTextAt(t.modelLineWrappedLineIdx,e.column)}normalizePosition(e,t){const i=this.getViewLineInfo(e.lineNumber);return this.modelLineProjections[i.modelLineNumber-1].normalizePosition(i.modelLineWrappedLineIdx,e,t)}getLineIndentColumn(e){const t=this.getViewLineInfo(e);return t.modelLineWrappedLineIdx===0?this.model.getLineIndentColumn(t.modelLineNumber):0}}function lme(o){if(o.length===0)return[];const e=o.slice();e.sort(k.compareRangesUsingStarts);const t=[];let i=e[0].startLineNumber,n=e[0].endLineNumber;for(let s=1,r=e.length;s<r;s++){const a=e[s];a.startLineNumber>n+1?(t.push(new k(i,1,n,1)),i=a.startLineNumber,n=a.endLineNumber):a.endLineNumber>n&&(n=a.endLineNumber)}return t.push(new k(i,1,n,1)),t}class $${constructor(e,t){this.modelLineNumber=e,this.modelLineWrappedLineIdx=t}}class j${constructor(e,t){this.modelRange=e,this.viewLines=t}}class cme{constructor(e){this._lines=e}convertViewPositionToModelPosition(e){return this._lines.convertViewPositionToModelPosition(e.lineNumber,e.column)}convertViewRangeToModelRange(e){return this._lines.convertViewRangeToModelRange(e)}validateViewPosition(e,t){return this._lines.validateViewPosition(e.lineNumber,e.column,t)}validateViewRange(e,t){return this._lines.validateViewRange(e,t)}convertModelPositionToViewPosition(e,t,i,n){return this._lines.convertModelPositionToViewPosition(e.lineNumber,e.column,t,i,n)}convertModelRangeToViewRange(e,t){return this._lines.convertModelRangeToViewRange(e,t)}modelPositionIsVisible(e){return this._lines.modelPositionIsVisible(e.lineNumber,e.column)}getModelLineViewLineCount(e){return this._lines.getModelLineViewLineCount(e)}getViewLineNumberOfModelPosition(e,t){return this._lines.getViewLineNumberOfModelPosition(e,t)}}class dme{constructor(e){this.model=e}dispose(){}createCoordinatesConverter(){return new rme(this.model)}getHiddenAreas(){return[]}setHiddenAreas(e){return!1}setTabSize(e){return!1}setWrappingSettings(e,t,i,n){return!1}createLineBreaksComputer(){const e=[];return{addRequest:(t,i,n)=>{e.push(null)},finalize:()=>e}}onModelFlushed(){}onModelLinesDeleted(e,t,i){return new nA(t,i)}onModelLinesInserted(e,t,i,n){return new sA(t,i)}onModelLineChanged(e,t,i){return[!1,new F$(t,1),null,null]}acceptVersionId(e){}getViewLineCount(){return this.model.getLineCount()}getActiveIndentGuide(e,t,i){return{startLineNumber:e,endLineNumber:e,indent:0}}getViewLinesBracketGuides(e,t,i){return new Array(t-e+1).fill([])}getViewLinesIndentGuides(e,t){const i=t-e+1,n=new Array(i);for(let s=0;s<i;s++)n[s]=0;return n}getViewLineContent(e){return this.model.getLineContent(e)}getViewLineLength(e){return this.model.getLineLength(e)}getViewLineMinColumn(e){return this.model.getLineMinColumn(e)}getViewLineMaxColumn(e){return this.model.getLineMaxColumn(e)}getViewLineData(e){const t=this.model.tokenization.getLineTokens(e),i=t.getLineContent();return new GM(i,!1,1,i.length+1,0,t.inflate(),null)}getViewLinesData(e,t,i){const n=this.model.getLineCount();e=Math.min(Math.max(1,e),n),t=Math.min(Math.max(1,t),n);const s=[];for(let r=e;r<=t;r++){const a=r-e;s[a]=i[a]?this.getViewLineData(r):null}return s}getDecorationsInRange(e,t,i,n,s,r){return this.model.getDecorationsInRange(e,t,i,n,s,r)}normalizePosition(e,t){return this.model.normalizePosition(e,t)}getLineIndentColumn(e){return this.model.getLineIndentColumn(e)}getInjectedTextAt(e){return null}}const ig=xa.Right;class hme{constructor(e){this.persist=0,this._requiredLanes=1,this.lanes=new Uint8Array(Math.ceil((e+1)*ig/8))}reset(e){const t=Math.ceil((e+1)*ig/8);this.lanes.length<t?this.lanes=new Uint8Array(t):this.lanes.fill(0),this._requiredLanes=1}get requiredLanes(){return this._requiredLanes}push(e,t,i){i&&(this.persist|=1<<e-1);for(let n=t.startLineNumber;n<=t.endLineNumber;n++){const s=ig*n+(e-1);this.lanes[s>>>3]|=1<<s%8,this._requiredLanes=Math.max(this._requiredLanes,this.countAtLine(n))}}getLanesAtLine(e){const t=[];let i=ig*e;for(let n=0;n<ig;n++)(this.persist&1<<n||this.lanes[i>>>3]&1<<i%8)&&t.push(n+1),i++;return t.length?t:[xa.Center]}countAtLine(e){let t=ig*e,i=0;for(let n=0;n<ig;n++)(this.persist&1<<n||this.lanes[t>>>3]&1<<t%8)&&i++,t++;return i}}let ume=class extends A{constructor(e,t,i,n,s,r,a,l,c,d){if(super(),this.languageConfigurationService=a,this._themeService=l,this._attachedView=c,this._transactionalTarget=d,this.hiddenAreasModel=new gme,this.previousHiddenAreas=[],this._editorId=e,this._configuration=t,this.model=i,this._eventDispatcher=new Dpe,this.onEvent=this._eventDispatcher.onEvent,this.cursorConfig=new $m(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._updateConfigurationViewLineCount=this._register(new wt(()=>this._updateConfigurationViewLineCountNow(),0)),this._hasFocus=!1,this._viewportStart=dA.create(this.model),this.glyphLanes=new hme(0),this.model.isTooLargeForTokenization())this._lines=new dme(this.model);else{const h=this._configuration.options,u=h.get(59),f=h.get(156),g=h.get(166),m=h.get(155),_=h.get(146),b=h.get(160);this._lines=new ame(this._editorId,this.model,n,s,u,this.model.getOptions().tabSize,f,g.wrappingColumn,m,_,b)}this.coordinatesConverter=this._lines.createCoordinatesConverter(),this._cursor=this._register(new zpe(i,this,this.coordinatesConverter,this.cursorConfig)),this.viewLayout=this._register(new Jpe(this._configuration,this.getLineCount(),this._getCustomLineHeights(),r)),this._register(this.viewLayout.onDidScroll(h=>{h.scrollTopChanged&&this._handleVisibleLinesChanged(),h.scrollTopChanged&&this._viewportStart.invalidate(),this._eventDispatcher.emitSingleViewEvent(new ype(h)),this._eventDispatcher.emitOutgoingEvent(new rA(h.oldScrollWidth,h.oldScrollLeft,h.oldScrollHeight,h.oldScrollTop,h.scrollWidth,h.scrollLeft,h.scrollHeight,h.scrollTop))})),this._register(this.viewLayout.onDidContentSizeChange(h=>{this._eventDispatcher.emitOutgoingEvent(h)})),this._decorations=new tme(this._editorId,this.model,this._configuration,this._lines,this.coordinatesConverter),this._registerModelEvents(),this._register(this._configuration.onDidChangeFast(h=>{try{const u=this._eventDispatcher.beginEmitViewEvents();this._onConfigurationChanged(u,h)}finally{this._eventDispatcher.endEmitViewEvents()}})),this._register(ex.getInstance().onDidChange(()=>{this._eventDispatcher.emitSingleViewEvent(new kpe)})),this._register(this._themeService.onDidColorThemeChange(h=>{this._invalidateDecorationsColorCache(),this._eventDispatcher.emitSingleViewEvent(new Lpe(h))})),this._updateConfigurationViewLineCountNow()}dispose(){super.dispose(),this._decorations.dispose(),this._lines.dispose(),this._viewportStart.dispose(),this._eventDispatcher.dispose()}createLineBreaksComputer(){return this._lines.createLineBreaksComputer()}addViewEventHandler(e){this._eventDispatcher.addViewEventHandler(e)}removeViewEventHandler(e){this._eventDispatcher.removeViewEventHandler(e)}_getCustomLineHeights(){return this._configuration.options.get(5)?this.model.getCustomLineHeightsDecorations(this._editorId).map(i=>{const n=i.range.startLineNumber,s=this.coordinatesConverter.convertModelRangeToViewRange(new k(n,1,n,this.model.getLineMaxColumn(n)));return{decorationId:i.id,startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,lineHeight:i.options.lineHeight||0}}):[]}_updateConfigurationViewLineCountNow(){this._configuration.setViewLineCount(this._lines.getViewLineCount())}getModelVisibleRanges(){const e=this.viewLayout.getLinesViewportData(),t=new k(e.startLineNumber,this.getLineMinColumn(e.startLineNumber),e.endLineNumber,this.getLineMaxColumn(e.endLineNumber));return this._toModelVisibleRanges(t)}visibleLinesStabilized(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!0)}_handleVisibleLinesChanged(){const e=this.getModelVisibleRanges();this._attachedView.setVisibleLines(e,!1)}setHasFocus(e){this._hasFocus=e,this._cursor.setHasFocus(e),this._eventDispatcher.emitSingleViewEvent(new wpe(e)),this._eventDispatcher.emitOutgoingEvent(new Nx(!e,e))}setHasWidgetFocus(e){this._eventDispatcher.emitOutgoingEvent(new Npe(!e,e))}onCompositionStart(){this._eventDispatcher.emitSingleViewEvent(new _pe)}onCompositionEnd(){this._eventDispatcher.emitSingleViewEvent(new bpe)}_captureStableViewport(){if(this._viewportStart.isValid&&this.viewLayout.getCurrentScrollTop()>0){const e=new M(this._viewportStart.viewLineNumber,this.getLineMinColumn(this._viewportStart.viewLineNumber)),t=this.coordinatesConverter.convertViewPositionToModelPosition(e);return new K$(t,this._viewportStart.startLineDelta)}return new K$(null,0)}_onConfigurationChanged(e,t){const i=this._captureStableViewport(),n=this._configuration.options,s=n.get(59),r=n.get(156),a=n.get(166),l=n.get(155),c=n.get(146);this._lines.setWrappingSettings(s,r,a.wrappingColumn,l,c)&&(e.emitViewEvent(new Dx),e.emitViewEvent(new Ex),e.emitViewEvent(new eg(null)),this._cursor.onLineMappingChanged(e),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this._updateConfigurationViewLineCount.schedule()),t.hasChanged(104)&&(this._decorations.reset(),e.emitViewEvent(new eg(null))),t.hasChanged(112)&&(this._decorations.reset(),e.emitViewEvent(new eg(null))),e.emitViewEvent(new Cpe(t)),this.viewLayout.onConfigurationChanged(t),i.recoverViewportStart(this.coordinatesConverter,this.viewLayout),$m.shouldRecreate(t)&&(this.cursorConfig=new $m(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig))}_registerModelEvents(){this._register(this.model.onDidChangeContentOrInjectedText(i=>{try{const s=this._eventDispatcher.beginEmitViewEvents();let r=!1,a=!1;const l=i instanceof $f?i.rawContentChangedEvent.changes:i.changes,c=i instanceof $f?i.rawContentChangedEvent.versionId:null,d=this._lines.createLineBreaksComputer();for(const f of l)switch(f.changeType){case 4:{for(let g=0;g<f.detail.length;g++){const m=f.detail[g];let _=f.injectedTexts[g];_&&(_=_.filter(b=>!b.ownerId||b.ownerId===this._editorId)),d.addRequest(m,_,null)}break}case 2:{let g=null;f.injectedText&&(g=f.injectedText.filter(m=>!m.ownerId||m.ownerId===this._editorId)),d.addRequest(f.detail,g,null);break}}const h=d.finalize(),u=new Ec(h);for(const f of l)switch(f.changeType){case 1:{this._lines.onModelFlushed(),s.emitViewEvent(new Dx),this._decorations.reset(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),r=!0;break}case 3:{const g=this._lines.onModelLinesDeleted(c,f.fromLineNumber,f.toLineNumber);g!==null&&(s.emitViewEvent(g),this.viewLayout.onLinesDeleted(g.fromLineNumber,g.toLineNumber)),r=!0;break}case 4:{const g=u.takeCount(f.detail.length),m=this._lines.onModelLinesInserted(c,f.fromLineNumber,f.toLineNumber,g);m!==null&&(s.emitViewEvent(m),this.viewLayout.onLinesInserted(m.fromLineNumber,m.toLineNumber)),r=!0;break}case 2:{const g=u.dequeue(),[m,_,b,C]=this._lines.onModelLineChanged(c,f.lineNumber,g);a=m,_&&s.emitViewEvent(_),b&&(s.emitViewEvent(b),this.viewLayout.onLinesInserted(b.fromLineNumber,b.toLineNumber)),C&&(s.emitViewEvent(C),this.viewLayout.onLinesDeleted(C.fromLineNumber,C.toLineNumber));break}case 5:break}c!==null&&this._lines.acceptVersionId(c),this.viewLayout.onHeightMaybeChanged(),!r&&a&&(s.emitViewEvent(new Ex),s.emitViewEvent(new eg(null)),this._cursor.onLineMappingChanged(s),this._decorations.onLineMappingChanged())}finally{this._eventDispatcher.endEmitViewEvents()}const n=this._viewportStart.isValid;if(this._viewportStart.invalidate(),this._configuration.setModelLineCount(this.model.getLineCount()),this._updateConfigurationViewLineCountNow(),!this._hasFocus&&this.model.getAttachedEditorCount()>=2&&n){const s=this.model._getTrackedRange(this._viewportStart.modelTrackedRange);if(s){const r=this.coordinatesConverter.convertModelPositionToViewPosition(s.getStartPosition()),a=this.viewLayout.getVerticalOffsetForLineNumber(r.lineNumber);this.viewLayout.setScrollPosition({scrollTop:a+this._viewportStart.startLineDelta},1)}}try{const s=this._eventDispatcher.beginEmitViewEvents();i instanceof $f&&s.emitOutgoingEvent(new Fpe(i.contentChangedEvent)),this._cursor.onModelContentChanged(s,i)}finally{this._eventDispatcher.endEmitViewEvents()}this._handleVisibleLinesChanged()})),this._configuration.options.get(5)&&this._register(this.model.onDidChangeLineHeight(i=>{const n=i.changes.filter(s=>s.ownerId===this._editorId||s.ownerId===0);if(this.viewLayout.changeSpecialLineHeights(s=>{for(const r of n){const{decorationId:a,lineNumber:l,lineHeight:c}=r,d=this.coordinatesConverter.convertModelRangeToViewRange(new k(l,1,l,this.model.getLineMaxColumn(l)));c!==null?s.insertOrChangeCustomLineHeight(a,d.startLineNumber,d.endLineNumber,c):s.removeCustomLineHeight(a)}}),n.length>0){const s=new EU(n);this._eventDispatcher.emitOutgoingEvent(new Hpe(s))}})),this._configuration.options.get(172)&&this._register(this.model.onDidChangeFont(i=>{const n=i.changes.filter(s=>s.ownerId===this._editorId||s.ownerId===0);if(n.length>0){const s=new NU(n);this._eventDispatcher.emitOutgoingEvent(new Vpe(s))}})),this._register(this.model.onDidChangeTokens(i=>{const n=[];for(let s=0,r=i.ranges.length;s<r;s++){const a=i.ranges[s],l=this.coordinatesConverter.convertModelPositionToViewPosition(new M(a.fromLineNumber,1)).lineNumber,c=this.coordinatesConverter.convertModelPositionToViewPosition(new M(a.toLineNumber,this.model.getLineMaxColumn(a.toLineNumber))).lineNumber;n[s]={fromLineNumber:l,toLineNumber:c}}this._eventDispatcher.emitSingleViewEvent(new xpe(n)),this._eventDispatcher.emitOutgoingEvent(new Bpe(i))})),this._register(this.model.onDidChangeLanguageConfiguration(i=>{this._eventDispatcher.emitSingleViewEvent(new Spe),this.cursorConfig=new $m(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Ope(i))})),this._register(this.model.onDidChangeLanguage(i=>{this.cursorConfig=new $m(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Ape(i))})),this._register(this.model.onDidChangeOptions(i=>{if(this._lines.setTabSize(this.model.getOptions().tabSize)){try{const n=this._eventDispatcher.beginEmitViewEvents();n.emitViewEvent(new Dx),n.emitViewEvent(new Ex),n.emitViewEvent(new eg(null)),this._cursor.onLineMappingChanged(n),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights())}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule()}this.cursorConfig=new $m(this.model.getLanguageId(),this.model.getOptions(),this._configuration,this.languageConfigurationService),this._cursor.updateConfiguration(this.cursorConfig),this._eventDispatcher.emitOutgoingEvent(new Wpe(i))})),this._register(this.model.onDidChangeDecorations(i=>{this._decorations.onModelDecorationsChanged(),this._eventDispatcher.emitSingleViewEvent(new eg(i)),this._eventDispatcher.emitOutgoingEvent(new Ppe(i))}))}getFontSizeAtPosition(e){if(!this._configuration.options.get(172))return null;const i=this.model.getFontDecorationsInRange(k.fromPositions(e),this._editorId);let n=this._configuration.options.get(59).fontSize+"px";for(const s of i)if(s.options.fontSize){n=s.options.fontSize;break}return n}setHiddenAreas(e,t,i){this.hiddenAreasModel.setHiddenAreas(t,e);const n=this.hiddenAreasModel.getMergedRanges();if(n===this.previousHiddenAreas&&!i)return;this.previousHiddenAreas=n;const s=this._captureStableViewport();let r=!1;try{const a=this._eventDispatcher.beginEmitViewEvents();r=this._lines.setHiddenAreas(n),r&&(a.emitViewEvent(new Dx),a.emitViewEvent(new Ex),a.emitViewEvent(new eg(null)),this._cursor.onLineMappingChanged(a),this._decorations.onLineMappingChanged(),this.viewLayout.onFlushed(this.getLineCount(),this._getCustomLineHeights()),this.viewLayout.onHeightMaybeChanged());const l=s.viewportStartModelPosition?.lineNumber;l&&n.some(d=>d.startLineNumber<=l&&l<=d.endLineNumber)||s.recoverViewportStart(this.coordinatesConverter,this.viewLayout)}finally{this._eventDispatcher.endEmitViewEvents()}this._updateConfigurationViewLineCount.schedule(),r&&this._eventDispatcher.emitOutgoingEvent(new Rpe)}getVisibleRangesPlusViewportAboveBelow(){const e=this._configuration.options.get(165),t=this._configuration.options.get(75),i=Math.max(20,Math.round(e.height/t)),n=this.viewLayout.getLinesViewportData(),s=Math.max(1,n.completelyVisibleStartLineNumber-i),r=Math.min(this.getLineCount(),n.completelyVisibleEndLineNumber+i);return this._toModelVisibleRanges(new k(s,this.getLineMinColumn(s),r,this.getLineMaxColumn(r)))}getVisibleRanges(){const e=this.getCompletelyVisibleViewRange();return this._toModelVisibleRanges(e)}getHiddenAreas(){return this._lines.getHiddenAreas()}_toModelVisibleRanges(e){const t=this.coordinatesConverter.convertViewRangeToModelRange(e),i=this._lines.getHiddenAreas();if(i.length===0)return[t];const n=[];let s=0,r=t.startLineNumber,a=t.startColumn;const l=t.endLineNumber,c=t.endColumn;for(let d=0,h=i.length;d<h;d++){const u=i[d].startLineNumber,f=i[d].endLineNumber;f<r||u>l||(r<u&&(n[s++]=new k(r,a,u-1,this.model.getLineMaxColumn(u-1))),r=f+1,a=1)}return(r<l||r===l&&a<c)&&(n[s++]=new k(r,a,l,c)),n}getCompletelyVisibleViewRange(){const e=this.viewLayout.getLinesViewportData(),t=e.completelyVisibleStartLineNumber,i=e.completelyVisibleEndLineNumber;return new k(t,this.getLineMinColumn(t),i,this.getLineMaxColumn(i))}getCompletelyVisibleViewRangeAtScrollTop(e){const t=this.viewLayout.getLinesViewportDataAtScrollTop(e),i=t.completelyVisibleStartLineNumber,n=t.completelyVisibleEndLineNumber;return new k(i,this.getLineMinColumn(i),n,this.getLineMaxColumn(n))}saveState(){const e=this.viewLayout.saveState(),t=e.scrollTop,i=this.viewLayout.getLineNumberAtVerticalOffset(t),n=this.coordinatesConverter.convertViewPositionToModelPosition(new M(i,this.getLineMinColumn(i))),s=this.viewLayout.getVerticalOffsetForLineNumber(i)-t;return{scrollLeft:e.scrollLeft,firstPosition:n,firstPositionDeltaTop:s}}reduceRestoreState(e){if(typeof e.firstPosition>"u")return this._reduceRestoreStateCompatibility(e);const t=this.model.validatePosition(e.firstPosition),i=this.coordinatesConverter.convertModelPositionToViewPosition(t),n=this.viewLayout.getVerticalOffsetForLineNumber(i.lineNumber)-e.firstPositionDeltaTop;return{scrollLeft:e.scrollLeft,scrollTop:n}}_reduceRestoreStateCompatibility(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTopWithoutViewZones}}getTabSize(){return this.model.getOptions().tabSize}getLineCount(){return this._lines.getViewLineCount()}setViewport(e,t,i){this._viewportStart.update(this,e)}getActiveIndentGuide(e,t,i){return this._lines.getActiveIndentGuide(e,t,i)}getLinesIndentGuides(e,t){return this._lines.getViewLinesIndentGuides(e,t)}getBracketGuidesInRangeByLine(e,t,i,n){return this._lines.getViewLinesBracketGuides(e,t,i,n)}getLineContent(e){return this._lines.getViewLineContent(e)}getLineLength(e){return this._lines.getViewLineLength(e)}getLineMinColumn(e){return this._lines.getViewLineMinColumn(e)}getLineMaxColumn(e){return this._lines.getViewLineMaxColumn(e)}getLineFirstNonWhitespaceColumn(e){const t=es(this.getLineContent(e));return t===-1?0:t+1}getLineLastNonWhitespaceColumn(e){const t=Kr(this.getLineContent(e));return t===-1?0:t+2}getMinimapDecorationsInRange(e){return this._decorations.getMinimapDecorationsInRange(e)}getDecorationsInViewport(e){return this._decorations.getDecorationsViewportData(e).decorations}getInjectedTextAt(e){return this._lines.getInjectedTextAt(e)}_getTextDirection(e,t){let i=0;for(const n of t){const s=n.range;if(s.startLineNumber>e||s.endLineNumber<e)continue;const r=n.options.textDirection;r===Oo.RTL?i++:r===Oo.LTR&&i--}return i>0?Oo.RTL:Oo.LTR}getTextDirection(e){const t=this._decorations.getDecorationsOnLine(e);return this._getTextDirection(e,t.decorations)}getViewportViewLineRenderingData(e,t){const i=this._decorations.getDecorationsViewportData(e),n=i.inlineDecorations[t-e.startLineNumber];return this._getViewLineRenderingData(t,n,i.hasVariableFonts,i.decorations)}getViewLineRenderingData(e){const t=this._decorations.getDecorationsOnLine(e);return this._getViewLineRenderingData(e,t.inlineDecorations[0],t.hasVariableFonts,t.decorations)}_getViewLineRenderingData(e,t,i,n){const s=this.model.mightContainRTL(),r=this.model.mightContainNonBasicASCII(),a=this.getTabSize(),l=this._lines.getViewLineData(e);return l.inlineDecorations&&(t=[...t,...l.inlineDecorations.map(c=>c.toInlineDecoration(e))]),new Vo(l.minColumn,l.maxColumn,l.content,l.continuesWithWrappedLine,s,r,l.tokens,t,a,l.startVisibleColumn,this._getTextDirection(e,n),i)}getViewLineData(e){return this._lines.getViewLineData(e)}getMinimapLinesRenderingData(e,t,i){const n=this._lines.getViewLinesData(e,t,i);return new Yhe(this.getTabSize(),n)}getAllOverviewRulerDecorations(e){const t=this.model.getOverviewRulerDecorations(this._editorId,gL(this._configuration.options),pL(this._configuration.options)),i=new fme;for(const n of t){const s=n.options,r=s.overviewRuler;if(!r)continue;const a=r.position;if(a===0)continue;const l=r.getColor(e.value),c=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.startLineNumber,n.range.startColumn),d=this.coordinatesConverter.getViewLineNumberOfModelPosition(n.range.endLineNumber,n.range.endColumn);i.accept(l,s.zIndex,c,d,a)}return i.asArray}_invalidateDecorationsColorCache(){const e=this.model.getOverviewRulerDecorations();for(const t of e)t.options.overviewRuler?.invalidateCachedColor(),t.options.minimap?.invalidateCachedColor()}getValueInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueInRange(i,t)}getValueLengthInRange(e,t){const i=this.coordinatesConverter.convertViewRangeToModelRange(e);return this.model.getValueLengthInRange(i,t)}modifyPosition(e,t){const i=this.coordinatesConverter.convertViewPositionToModelPosition(e),n=this.model.modifyPosition(i,t);return this.coordinatesConverter.convertModelPositionToViewPosition(n)}deduceModelPositionRelativeToViewPosition(e,t,i){const n=this.coordinatesConverter.convertViewPositionToModelPosition(e);this.model.getEOL().length===2&&(t<0?t-=i:t+=i);const r=this.model.getOffsetAt(n)+t;return this.model.getPositionAt(r)}getPlainTextToCopy(e,t,i){const n=i?`\r
`:this.model.getEOL();e=e.slice(0),e.sort(k.compareRangesUsingStarts);let s=!1,r=!1;for(const l of e)l.isEmpty()?s=!0:r=!0;if(!r){if(!t)return"";const l=e.map(d=>d.startLineNumber);let c="";for(let d=0;d<l.length;d++)d>0&&l[d-1]===l[d]||(c+=this.model.getLineContent(l[d])+n);return c}if(s&&t){const l=[];let c=0;for(const d of e){const h=d.startLineNumber;d.isEmpty()?h!==c&&l.push(this.model.getLineContent(h)):l.push(this.model.getValueInRange(d,i?2:0)),c=h}return l.length===1?l[0]:l}const a=[];for(const l of e)l.isEmpty()||a.push(this.model.getValueInRange(l,i?2:0));return a.length===1?a[0]:a}getRichTextToCopy(e,t){const i=this.model.getLanguageId();if(i===Fo||e.length!==1)return null;let n=e[0];if(n.isEmpty()){if(!t)return null;const d=n.startLineNumber;n=new k(d,this.model.getLineMinColumn(d),d,this.model.getLineMaxColumn(d))}const s=this._configuration.options.get(59),r=this._getColorMap(),l=/[:;\\\/<>]/.test(s.fontFamily)||s.fontFamily===bs.fontFamily;let c;return l?c=bs.fontFamily:(c=s.fontFamily,c=c.replace(/"/g,"'"),/[,']/.test(c)||/[+ ]/.test(c)&&(c=`'${c}'`),c=`${c}, ${bs.fontFamily}`),{mode:i,html:`<div style="color: ${r[1]};background-color: ${r[2]};font-family: ${c};font-weight: ${s.fontWeight};font-size: ${s.fontSize}px;line-height: ${s.lineHeight}px;white-space: pre;">`+this._getHTMLToCopy(n,r)+"</div>"}}_getHTMLToCopy(e,t){const i=e.startLineNumber,n=e.startColumn,s=e.endLineNumber,r=e.endColumn,a=this.getTabSize();let l="";for(let c=i;c<=s;c++){const d=this.model.tokenization.getLineTokens(c),h=d.getLineContent(),u=c===i?n-1:0,f=c===s?r-1:h.length;h===""?l+="<br>":l+=qpe(h,d.inflate(),t,u,f,a,gn)}return l}_getColorMap(){const e=di.getColorMap(),t=["#000000"];if(e)for(let i=1,n=e.length;i<n;i++)t[i]=$.Format.CSS.formatHex(e[i]);return t}getPrimaryCursorState(){return this._cursor.getPrimaryCursorState()}getLastAddedCursorIndex(){return this._cursor.getLastAddedCursorIndex()}getCursorStates(){return this._cursor.getCursorStates()}setCursorStates(e,t,i){return this._withViewEventsCollector(n=>this._cursor.setStates(n,e,t,i))}getCursorColumnSelectData(){return this._cursor.getCursorColumnSelectData()}getCursorAutoClosedCharacters(){return this._cursor.getAutoClosedCharacters()}setCursorColumnSelectData(e){this._cursor.setCursorColumnSelectData(e)}getPrevEditOperationType(){return this._cursor.getPrevEditOperationType()}setPrevEditOperationType(e){this._cursor.setPrevEditOperationType(e)}getSelection(){return this._cursor.getSelection()}getSelections(){return this._cursor.getSelections()}getPosition(){return this._cursor.getPrimaryCursorState().modelState.position}setSelections(e,t,i=0){this._withViewEventsCollector(n=>this._cursor.setSelections(n,e,t,i))}saveCursorState(){return this._cursor.saveState()}restoreCursorState(e){this._withViewEventsCollector(t=>this._cursor.restoreState(t,e))}_executeCursorEdit(e){if(this._cursor.context.cursorConfig.readOnly){this._eventDispatcher.emitOutgoingEvent(new Mpe);return}this._withViewEventsCollector(e)}executeEdits(e,t,i,n){this._executeCursorEdit(s=>this._cursor.executeEdits(s,e,t,i,n))}startComposition(){this._executeCursorEdit(e=>this._cursor.startComposition(e))}endComposition(e){this._executeCursorEdit(t=>this._cursor.endComposition(t,e))}type(e,t){this._executeCursorEdit(i=>this._cursor.type(i,e,t))}compositionType(e,t,i,n,s){this._executeCursorEdit(r=>this._cursor.compositionType(r,e,t,i,n,s))}paste(e,t,i,n){this._executeCursorEdit(s=>this._cursor.paste(s,e,t,i,n))}cut(e){this._executeCursorEdit(t=>this._cursor.cut(t,e))}executeCommand(e,t){this._executeCursorEdit(i=>this._cursor.executeCommand(i,e,t))}executeCommands(e,t){this._executeCursorEdit(i=>this._cursor.executeCommands(i,e,t))}revealAllCursors(e,t,i=!1){this._withViewEventsCollector(n=>this._cursor.revealAll(n,e,i,0,t,0))}revealPrimaryCursor(e,t,i=!1){this._withViewEventsCollector(n=>this._cursor.revealPrimary(n,e,i,0,t,0))}revealTopMostCursor(e){const t=this._cursor.getTopMostViewPosition(),i=new k(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new Ov(e,!1,i,null,0,!0,0)))}revealBottomMostCursor(e){const t=this._cursor.getBottomMostViewPosition(),i=new k(t.lineNumber,t.column,t.lineNumber,t.column);this._withViewEventsCollector(n=>n.emitViewEvent(new Ov(e,!1,i,null,0,!0,0)))}revealRange(e,t,i,n,s){this._withViewEventsCollector(r=>r.emitViewEvent(new Ov(e,!1,i,null,n,t,s)))}changeWhitespace(e){this.viewLayout.changeWhitespace(e)&&(this._eventDispatcher.emitSingleViewEvent(new Ipe),this._eventDispatcher.emitOutgoingEvent(new Tpe))}_withViewEventsCollector(e){return this._transactionalTarget.batchChanges(()=>{try{const t=this._eventDispatcher.beginEmitViewEvents();return e(t)}finally{this._eventDispatcher.endEmitViewEvents()}})}batchEvents(e){this._withViewEventsCollector(()=>{e()})}normalizePosition(e,t){return this._lines.normalizePosition(e,t)}getLineIndentColumn(e){return this._lines.getLineIndentColumn(e)}};class dA{static create(e){const t=e._setTrackedRange(null,new k(1,1,1,1),1);return new dA(e,1,!1,t,0)}get viewLineNumber(){return this._viewLineNumber}get isValid(){return this._isValid}get modelTrackedRange(){return this._modelTrackedRange}get startLineDelta(){return this._startLineDelta}constructor(e,t,i,n,s){this._model=e,this._viewLineNumber=t,this._isValid=i,this._modelTrackedRange=n,this._startLineDelta=s}dispose(){this._model._setTrackedRange(this._modelTrackedRange,null,1)}update(e,t){const i=e.coordinatesConverter.convertViewPositionToModelPosition(new M(t,e.getLineMinColumn(t))),n=e.model._setTrackedRange(this._modelTrackedRange,new k(i.lineNumber,i.column,i.lineNumber,i.column),1),s=e.viewLayout.getVerticalOffsetForLineNumber(t),r=e.viewLayout.getCurrentScrollTop();this._viewLineNumber=t,this._isValid=!0,this._modelTrackedRange=n,this._startLineDelta=r-s}invalidate(){this._isValid=!1}}class fme{constructor(){this._asMap=Object.create(null),this.asArray=[]}accept(e,t,i,n,s){const r=this._asMap[e];if(r){const a=r.data,l=a[a.length-3],c=a[a.length-1];if(l===s&&c+1>=i){n>c&&(a[a.length-1]=n);return}a.push(s,i,n)}else{const a=new fv(e,t,[s,i,n]);this._asMap[e]=a,this.asArray.push(a)}}}class gme{constructor(){this.hiddenAreas=new Map,this.shouldRecompute=!1,this.ranges=[]}setHiddenAreas(e,t){const i=this.hiddenAreas.get(e);i&&q$(i,t)||(this.hiddenAreas.set(e,t),this.shouldRecompute=!0)}getMergedRanges(){if(!this.shouldRecompute)return this.ranges;this.shouldRecompute=!1;const e=Array.from(this.hiddenAreas.values()).reduce((t,i)=>pme(t,i),[]);return q$(this.ranges,e)?this.ranges:(this.ranges=e,this.ranges)}}function pme(o,e){const t=[];let i=0,n=0;for(;i<o.length&&n<e.length;){const s=o[i],r=e[n];if(s.endLineNumber<r.startLineNumber-1)t.push(o[i++]);else if(r.endLineNumber<s.startLineNumber-1)t.push(e[n++]);else{const a=Math.min(s.startLineNumber,r.startLineNumber),l=Math.max(s.endLineNumber,r.endLineNumber);t.push(new k(a,1,l,1)),i++,n++}}for(;i<o.length;)t.push(o[i++]);for(;n<e.length;)t.push(e[n++]);return t}function q$(o,e){if(o.length!==e.length)return!1;for(let t=0;t<o.length;t++)if(!o[t].equalsRange(e[t]))return!1;return!0}class K${constructor(e,t){this.viewportStartModelPosition=e,this.startLineDelta=t}recoverViewportStart(e,t){if(!this.viewportStartModelPosition)return;const i=e.convertModelPositionToViewPosition(this.viewportStartModelPosition),n=t.getVerticalOffsetForLineNumber(i.lineNumber);t.setScrollPosition({scrollTop:n+this.startLineDelta},1)}}class O_{constructor(...e){this._entries=new Map;for(const[t,i]of e)this.set(t,i)}set(e,t){const i=this._entries.get(e);return this._entries.set(e,t),i}get(e){return this._entries.get(e)}}var mme=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},td=function(o,e){return function(t,i){e(t,i,o)}},ng;let sg=(xp=class extends A{get isSimpleWidget(){return this._configuration.isSimpleWidget}get contextMenuId(){return this._configuration.contextMenuId}get contextKeyService(){return this._contextKeyService}constructor(e,t,i,n,s,r,a,l,c,d,h,u){super(),this.languageConfigurationService=h,this._deliveryQueue=die(),this._contributions=this._register(new xfe),this._onDidDispose=this._register(new P),this.onDidDispose=this._onDidDispose.event,this._onDidChangeModelContent=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelContent=this._onDidChangeModelContent.event,this._onDidChangeModelLanguage=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguage=this._onDidChangeModelLanguage.event,this._onDidChangeModelLanguageConfiguration=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelLanguageConfiguration=this._onDidChangeModelLanguageConfiguration.event,this._onDidChangeModelOptions=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelOptions=this._onDidChangeModelOptions.event,this._onDidChangeModelDecorations=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelDecorations=this._onDidChangeModelDecorations.event,this._onDidChangeLineHeight=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeLineHeight=this._onDidChangeLineHeight.event,this._onDidChangeFont=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeFont=this._onDidChangeFont.event,this._onDidChangeModelTokens=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModelTokens=this._onDidChangeModelTokens.event,this._onDidChangeConfiguration=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeConfiguration=this._onDidChangeConfiguration.event,this._onWillChangeModel=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onWillChangeModel=this._onWillChangeModel.event,this._onDidChangeModel=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeModel=this._onDidChangeModel.event,this._onDidChangeCursorPosition=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorPosition=this._onDidChangeCursorPosition.event,this._onDidChangeCursorSelection=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeCursorSelection=this._onDidChangeCursorSelection.event,this._onDidAttemptReadOnlyEdit=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDidAttemptReadOnlyEdit=this._onDidAttemptReadOnlyEdit.event,this._onDidLayoutChange=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidLayoutChange=this._onDidLayoutChange.event,this._editorTextFocus=this._register(new G$({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorText=this._editorTextFocus.onDidChangeToTrue,this.onDidBlurEditorText=this._editorTextFocus.onDidChangeToFalse,this._editorWidgetFocus=this._register(new G$({deliveryQueue:this._deliveryQueue})),this.onDidFocusEditorWidget=this._editorWidgetFocus.onDidChangeToTrue,this.onDidBlurEditorWidget=this._editorWidgetFocus.onDidChangeToFalse,this._onWillType=this._register(new cs(this._contributions,this._deliveryQueue)),this.onWillType=this._onWillType.event,this._onDidType=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDidType=this._onDidType.event,this._onDidCompositionStart=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDidCompositionStart=this._onDidCompositionStart.event,this._onDidCompositionEnd=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDidCompositionEnd=this._onDidCompositionEnd.event,this._onDidPaste=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDidPaste=this._onDidPaste.event,this._onMouseUp=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseUp=this._onMouseUp.event,this._onMouseDown=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseDown=this._onMouseDown.event,this._onMouseDrag=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseDrag=this._onMouseDrag.event,this._onMouseDrop=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseDrop=this._onMouseDrop.event,this._onMouseDropCanceled=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseDropCanceled=this._onMouseDropCanceled.event,this._onDropIntoEditor=this._register(new cs(this._contributions,this._deliveryQueue)),this.onDropIntoEditor=this._onDropIntoEditor.event,this._onContextMenu=this._register(new cs(this._contributions,this._deliveryQueue)),this.onContextMenu=this._onContextMenu.event,this._onMouseMove=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseMove=this._onMouseMove.event,this._onMouseLeave=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseLeave=this._onMouseLeave.event,this._onMouseWheel=this._register(new cs(this._contributions,this._deliveryQueue)),this.onMouseWheel=this._onMouseWheel.event,this._onKeyUp=this._register(new cs(this._contributions,this._deliveryQueue)),this.onKeyUp=this._onKeyUp.event,this._onKeyDown=this._register(new cs(this._contributions,this._deliveryQueue)),this.onKeyDown=this._onKeyDown.event,this._onDidContentSizeChange=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidContentSizeChange=this._onDidContentSizeChange.event,this._onDidScrollChange=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidScrollChange=this._onDidScrollChange.event,this._onDidChangeViewZones=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeViewZones=this._onDidChangeViewZones.event,this._onDidChangeHiddenAreas=this._register(new P({deliveryQueue:this._deliveryQueue})),this.onDidChangeHiddenAreas=this._onDidChangeHiddenAreas.event,this._updateCounter=0,this._onWillTriggerEditorOperationEvent=this._register(new P),this._onBeginUpdate=this._register(new P),this.onBeginUpdate=this._onBeginUpdate.event,this._onEndUpdate=this._register(new P),this.onEndUpdate=this._onEndUpdate.event,this._onBeforeExecuteEdit=this._register(new P),this.onBeforeExecuteEdit=this._onBeforeExecuteEdit.event,this._actions=new Map,this._bannerDomNode=null,this._dropIntoEditorDecorations=this.createDecorationsCollection(),this.inComposition=!1,s.willCreateCodeEditor();const f={...t};if(this._domElement=e,this._overflowWidgetsDomNode=f.overflowWidgetsDomNode,delete f.overflowWidgetsDomNode,this._id=++_me,this._decorationTypeKeysToIds={},this._decorationTypeSubtypes={},this._telemetryData=i.telemetryData,this._configuration=this._register(this._createConfiguration(i.isSimpleWidget||!1,i.contextMenuId??(i.isSimpleWidget?de.SimpleEditorContext:de.EditorContext),f,d)),this._register(this._configuration.onDidChange(_=>{this._onDidChangeConfiguration.fire(_);const b=this._configuration.options;if(_.hasChanged(165)){const C=b.get(165);this._onDidLayoutChange.fire(C)}})),this._contextKeyService=this._register(a.createScoped(this._domElement)),i.contextKeyValues)for(const[_,b]of Object.entries(i.contextKeyValues))this._contextKeyService.createKey(_,b);this._notificationService=c,this._codeEditorService=s,this._commandService=r,this._themeService=l,this._register(new Cme(this,this._contextKeyService)),this._register(new vme(this,this._contextKeyService,u)),this._instantiationService=this._register(n.createChild(new O_([xe,this._contextKeyService]))),this._modelData=null,this._contentWidgets={},this._overlayWidgets={},this._glyphMarginWidgets={};let g;Array.isArray(i.contributions)?g=i.contributions:g=Um.getEditorContributions(),this._contributions.initialize(this,g,this._instantiationService);for(const _ of Um.getEditorActions()){if(this._actions.has(_.id)){Ee(new Error(`Cannot have two actions with the same id ${_.id}`));continue}const b=new TU(_.id,_.label,_.alias,_.metadata,_.precondition??void 0,C=>this._instantiationService.invokeFunction(w=>Promise.resolve(_.runEditorCommand(w,this,C))),this._contextKeyService);this._actions.set(b.id,b)}const m=()=>!this._configuration.options.get(104)&&this._configuration.options.get(43).enabled;this._register(new use(this._domElement,{onDragOver:_=>{if(!m())return;const b=this.getTargetAtClientPoint(_.clientX,_.clientY);b?.position&&this.showDropIndicatorAt(b.position)},onDrop:async _=>{if(!m()||(this.removeDropIndicator(),!_.dataTransfer))return;const b=this.getTargetAtClientPoint(_.clientX,_.clientY);b?.position&&this._onDropIntoEditor.fire({position:b.position,event:_})},onDragLeave:()=>{this.removeDropIndicator()},onDragEnd:()=>{this.removeDropIndicator()}})),this._codeEditorService.addCodeEditor(this)}writeScreenReaderContent(e){this._modelData?.view.writeScreenReaderContent(e)}_createConfiguration(e,t,i,n){return new X2(e,t,i,this._domElement,n)}getId(){return this.getEditorType()+":"+this._id}getEditorType(){return vv.ICodeEditor}dispose(){this._codeEditorService.removeCodeEditor(this),this._actions.clear(),this._contentWidgets={},this._overlayWidgets={},this._removeDecorationTypes(),this._postDetachModelCleanup(this._detachModel()),this._onDidDispose.fire(),super.dispose()}invokeWithinContext(e){return this._instantiationService.invokeFunction(e)}updateOptions(e){this._configuration.updateOptions(e||{})}getOptions(){return this._configuration.options}getOption(e){return this._configuration.options.get(e)}getRawOptions(){return this._configuration.getRawOptions()}getOverflowWidgetsDomNode(){return this._overflowWidgetsDomNode}getConfiguredWordAtPosition(e){return this._modelData?ut.getWordAtPosition(this._modelData.model,this._configuration.options.get(148),this._configuration.options.get(147),e):null}getValue(e=null){if(!this._modelData)return"";const t=!!(e&&e.preserveBOM);let i=0;return e&&e.lineEnding&&e.lineEnding===`
`?i=1:e&&e.lineEnding&&e.lineEnding===`\r
`&&(i=2),this._modelData.model.getValue(i,t)}setValue(e){try{if(this._beginUpdate(),!this._modelData)return;this._modelData.model.setValue(e)}finally{this._endUpdate()}}getModel(){return this._modelData?this._modelData.model:null}setModel(e=null){try{this._beginUpdate();const t=e;if(this._modelData===null&&t===null||this._modelData&&this._modelData.model===t)return;const i={oldModelUrl:this._modelData?.model.uri||null,newModelUrl:t?.uri||null};this._onWillChangeModel.fire(i);const n=this.hasTextFocus(),s=this._detachModel();this._attachModel(t),this.hasModel()?n&&this.focus():(this._editorTextFocus.setValue(!1),this._editorWidgetFocus.setValue(!1)),this._removeDecorationTypes(),this._onDidChangeModel.fire(i),this._postDetachModelCleanup(s),this._contributionsDisposable=this._contributions.onAfterModelAttached()}finally{this._endUpdate()}}_removeDecorationTypes(){if(this._decorationTypeKeysToIds={},this._decorationTypeSubtypes){for(const e in this._decorationTypeSubtypes){const t=this._decorationTypeSubtypes[e];for(const i in t)this._removeDecorationType(e+"-"+i)}this._decorationTypeSubtypes={}}}getVisibleRanges(){return this._modelData?this._modelData.viewModel.getVisibleRanges():[]}getVisibleRangesPlusViewportAboveBelow(){return this._modelData?this._modelData.viewModel.getVisibleRangesPlusViewportAboveBelow():[]}getWhitespaces(){return this._modelData?this._modelData.viewModel.viewLayout.getWhitespaces():[]}static _getVerticalOffsetAfterPosition(e,t,i,n){const s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetAfterLineNumber(r.lineNumber,n)}getTopForLineNumber(e,t=!1){return this._modelData?ng._getVerticalOffsetForPosition(this._modelData,e,1,t):-1}getTopForPosition(e,t){return this._modelData?ng._getVerticalOffsetForPosition(this._modelData,e,t,!1):-1}static _getVerticalOffsetForPosition(e,t,i,n=!1){const s=e.model.validatePosition({lineNumber:t,column:i}),r=e.viewModel.coordinatesConverter.convertModelPositionToViewPosition(s);return e.viewModel.viewLayout.getVerticalOffsetForLineNumber(r.lineNumber,n)}getBottomForLineNumber(e,t=!1){if(!this._modelData)return-1;const i=this._modelData.model.getLineMaxColumn(e);return ng._getVerticalOffsetAfterPosition(this._modelData,e,i,t)}getLineHeightForPosition(e){if(!this._modelData)return-1;const t=this._modelData.viewModel,i=t.coordinatesConverter,n=M.lift(e);if(i.modelPositionIsVisible(n)){const s=i.convertModelPositionToViewPosition(n);return t.viewLayout.getLineHeightForLineNumber(s.lineNumber)}return 0}setHiddenAreas(e,t,i){this._modelData?.viewModel.setHiddenAreas(e.map(n=>k.lift(n)),t,i)}getVisibleColumnFromPosition(e){if(!this._modelData)return e.column;const t=this._modelData.model.validatePosition(e),i=this._modelData.model.getOptions().tabSize;return ti.visibleColumnFromColumn(this._modelData.model.getLineContent(t.lineNumber),t.column,i)+1}getPosition(){return this._modelData?this._modelData.viewModel.getPosition():null}setPosition(e,t="api"){if(this._modelData){if(!M.isIPosition(e))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,[{selectionStartLineNumber:e.lineNumber,selectionStartColumn:e.column,positionLineNumber:e.lineNumber,positionColumn:e.column}])}}_sendRevealRange(e,t,i,n){if(!this._modelData)return;if(!k.isIRange(e))throw new Error("Invalid arguments");const s=this._modelData.model.validateRange(e),r=this._modelData.viewModel.coordinatesConverter.convertModelRangeToViewRange(s);this._modelData.viewModel.revealRange("api",i,r,t,n)}revealLine(e,t=0){this._revealLine(e,0,t)}revealLineInCenter(e,t=0){this._revealLine(e,1,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._revealLine(e,2,t)}revealLineNearTop(e,t=0){this._revealLine(e,5,t)}_revealLine(e,t,i){if(typeof e!="number")throw new Error("Invalid arguments");this._sendRevealRange(new k(e,1,e,1),t,!1,i)}revealPosition(e,t=0){this._revealPosition(e,0,!0,t)}revealPositionInCenter(e,t=0){this._revealPosition(e,1,!0,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._revealPosition(e,2,!0,t)}revealPositionNearTop(e,t=0){this._revealPosition(e,5,!0,t)}_revealPosition(e,t,i,n){if(!M.isIPosition(e))throw new Error("Invalid arguments");this._sendRevealRange(new k(e.lineNumber,e.column,e.lineNumber,e.column),t,i,n)}getSelection(){return this._modelData?this._modelData.viewModel.getSelection():null}getSelections(){return this._modelData?this._modelData.viewModel.getSelections():null}setSelection(e,t="api"){const i=ce.isISelection(e),n=k.isIRange(e);if(!i&&!n)throw new Error("Invalid arguments");if(i)this._setSelectionImpl(e,t);else if(n){const s={selectionStartLineNumber:e.startLineNumber,selectionStartColumn:e.startColumn,positionLineNumber:e.endLineNumber,positionColumn:e.endColumn};this._setSelectionImpl(s,t)}}_setSelectionImpl(e,t){if(!this._modelData)return;const i=new ce(e.selectionStartLineNumber,e.selectionStartColumn,e.positionLineNumber,e.positionColumn);this._modelData.viewModel.setSelections(t,[i])}revealLines(e,t,i=0){this._revealLines(e,t,0,i)}revealLinesInCenter(e,t,i=0){this._revealLines(e,t,1,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._revealLines(e,t,2,i)}revealLinesNearTop(e,t,i=0){this._revealLines(e,t,5,i)}_revealLines(e,t,i,n){if(typeof e!="number"||typeof t!="number")throw new Error("Invalid arguments");this._sendRevealRange(new k(e,1,t,1),i,!1,n)}revealRange(e,t=0,i=!1,n=!0){this._revealRange(e,i?1:0,n,t)}revealRangeInCenter(e,t=0){this._revealRange(e,1,!0,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._revealRange(e,2,!0,t)}revealRangeNearTop(e,t=0){this._revealRange(e,5,!0,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._revealRange(e,6,!0,t)}revealRangeAtTop(e,t=0){this._revealRange(e,3,!0,t)}_revealRange(e,t,i,n){if(!k.isIRange(e))throw new Error("Invalid arguments");this._sendRevealRange(k.lift(e),t,i,n)}setSelections(e,t="api",i=0){if(this._modelData){if(!e||e.length===0)throw new Error("Invalid arguments");for(let n=0,s=e.length;n<s;n++)if(!ce.isISelection(e[n]))throw new Error("Invalid arguments");this._modelData.viewModel.setSelections(t,e,i)}}getContentWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getContentWidth():-1}getScrollWidth(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollWidth():-1}getScrollLeft(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollLeft():-1}getContentHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getContentHeight():-1}getScrollHeight(){return this._modelData?this._modelData.viewModel.viewLayout.getScrollHeight():-1}getScrollTop(){return this._modelData?this._modelData.viewModel.viewLayout.getCurrentScrollTop():-1}setScrollLeft(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollLeft:e},t)}}setScrollTop(e,t=1){if(this._modelData){if(typeof e!="number")throw new Error("Invalid arguments");this._modelData.viewModel.viewLayout.setScrollPosition({scrollTop:e},t)}}setScrollPosition(e,t=1){this._modelData&&this._modelData.viewModel.viewLayout.setScrollPosition(e,t)}hasPendingScrollAnimation(){return this._modelData?this._modelData.viewModel.viewLayout.hasPendingScrollAnimation():!1}saveViewState(){if(!this._modelData)return null;const e=this._contributions.saveViewState(),t=this._modelData.viewModel.saveCursorState(),i=this._modelData.viewModel.saveState();return{cursorState:t,viewState:i,contributionsState:e}}restoreViewState(e){if(!this._modelData||!this._modelData.hasRealView)return;const t=e;if(t&&t.cursorState&&t.viewState){const i=t.cursorState;Array.isArray(i)?i.length>0&&this._modelData.viewModel.restoreCursorState(i):this._modelData.viewModel.restoreCursorState([i]),this._contributions.restoreViewState(t.contributionsState||{});const n=this._modelData.viewModel.reduceRestoreState(t.viewState);this._modelData.view.restoreState(n)}}handleInitialized(){this._getViewModel()?.visibleLinesStabilized()}getContribution(e){return this._contributions.get(e)}getActions(){return Array.from(this._actions.values())}getSupportedActions(){let e=this.getActions();return e=e.filter(t=>t.isSupported()),e}getAction(e){return this._actions.get(e)||null}trigger(e,t,i){i=i||{};try{switch(this._onWillTriggerEditorOperationEvent.fire({source:e,handlerId:t,payload:i}),this._beginUpdate(),t){case"compositionStart":this._startComposition();return;case"compositionEnd":this._endComposition(e);return;case"type":{const s=i;this._type(e,s.text||"");return}case"replacePreviousChar":{const s=i;this._compositionType(e,s.text||"",s.replaceCharCnt||0,0,0);return}case"compositionType":{const s=i;this._compositionType(e,s.text||"",s.replacePrevCharCnt||0,s.replaceNextCharCnt||0,s.positionDelta||0);return}case"paste":{const s=i;this._paste(e,s.text||"",s.pasteOnNewLine||!1,s.multicursorText||null,s.mode||null,s.clipboardEvent);return}case"cut":this._cut(e);return}const n=this.getAction(t);if(n){Promise.resolve(n.run(i)).then(void 0,Ee);return}if(!this._modelData||this._triggerEditorCommand(e,t,i))return;this._triggerCommand(t,i)}finally{this._endUpdate()}}_triggerCommand(e,t){this._commandService.executeCommand(e,t)}_startComposition(){this._modelData&&(this.inComposition=!0,this._modelData.viewModel.startComposition(),this._onDidCompositionStart.fire())}_endComposition(e){this._modelData&&(this.inComposition=!1,this._modelData.viewModel.endComposition(e),this._onDidCompositionEnd.fire())}_type(e,t){!this._modelData||t.length===0||(e==="keyboard"&&this._onWillType.fire(t),this._modelData.viewModel.type(t,e),e==="keyboard"&&this._onDidType.fire(t))}_compositionType(e,t,i,n,s){this._modelData&&this._modelData.viewModel.compositionType(t,i,n,s,e)}_paste(e,t,i,n,s,r){if(!this._modelData)return;const a=this._modelData.viewModel,l=a.getSelection().getStartPosition();a.paste(t,i,n,e);const c=a.getSelection().getStartPosition();e==="keyboard"&&this._onDidPaste.fire({clipboardEvent:r,range:new k(l.lineNumber,l.column,c.lineNumber,c.column),languageId:s})}_cut(e){this._modelData&&this._modelData.viewModel.cut(e)}_triggerEditorCommand(e,t,i){const n=Um.getEditorCommand(t);return n?(i=i||{},i.source=e,this._instantiationService.invokeFunction(s=>{Promise.resolve(n.runEditorCommand(s,this,i)).then(void 0,Ee)}),!0):!1}_getViewModel(){return this._modelData?this._modelData.viewModel:null}pushUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.pushStackElement(),!0)}popUndoStop(){return!this._modelData||this._configuration.options.get(104)?!1:(this._modelData.model.popStackElement(),!0)}edit(e,t){return this.executeEdits(t,e.replacements.map(i=>({range:i.range,text:i.text})),void 0)}executeEdits(e,t,i){if(!this._modelData||this._configuration.options.get(104))return!1;let n;i?Array.isArray(i)?n=()=>i:n=i:n=()=>null;let s,r;return e instanceof $U?(r=e,s=e.metadata.source):(r=jn.unknown({name:s}),s=e),this._onBeforeExecuteEdit.fire({source:s??void 0}),this._modelData.viewModel.executeEdits(s,t,n,r),!0}executeCommand(e,t){this._modelData&&this._modelData.viewModel.executeCommand(t,e)}executeCommands(e,t){this._modelData&&this._modelData.viewModel.executeCommands(t,e)}createDecorationsCollection(e){return new wme(this,e)}changeDecorations(e){return this._modelData?this._modelData.model.changeDecorations(e,this._id):null}getLineDecorations(e){if(!this._modelData)return null;const t=this._configuration.options;return this._modelData.model.getLineDecorations(e,this._id,gL(t),pL(t))}getDecorationsInRange(e){if(!this._modelData)return null;const t=this._configuration.options;return this._modelData.model.getDecorationsInRange(e,this._id,gL(t),pL(t))}getFontSizeAtPosition(e){return this._modelData?this._modelData.viewModel.getFontSizeAtPosition(e):null}deltaDecorations(e,t){return this._modelData?e.length===0&&t.length===0?e:this._modelData.model.deltaDecorations(e,t,this._id):[]}removeDecorations(e){!this._modelData||e.length===0||this._modelData.model.changeDecorations(t=>{t.deltaDecorations(e,[])})}removeDecorationsByType(e){const t=this._decorationTypeKeysToIds[e];t&&this.changeDecorations(i=>i.deltaDecorations(t,[])),this._decorationTypeKeysToIds.hasOwnProperty(e)&&delete this._decorationTypeKeysToIds[e],this._decorationTypeSubtypes.hasOwnProperty(e)&&delete this._decorationTypeSubtypes[e]}getLayoutInfo(){return this._configuration.options.get(165)}createOverviewRuler(e){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.createOverviewRuler(e)}getContainerDomNode(){return this._domElement}getDomNode(){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.domNode.domNode}delegateVerticalScrollbarPointerDown(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateVerticalScrollbarPointerDown(e)}delegateScrollFromMouseWheelEvent(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.delegateScrollFromMouseWheelEvent(e)}layout(e,t=!1){this._configuration.observeContainer(e),t||this.render()}focus(){!this._modelData||!this._modelData.hasRealView||this._modelData.view.focus()}hasTextFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isFocused()}hasWidgetFocus(){return!this._modelData||!this._modelData.hasRealView?!1:this._modelData.view.isWidgetFocused()}addContentWidget(e){const t={widget:e,position:e.getPosition()};this._contentWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a content widget with the same id:"+e.getId()),this._contentWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addContentWidget(t)}layoutContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutContentWidget(i)}}removeContentWidget(e){const t=e.getId();if(this._contentWidgets.hasOwnProperty(t)){const i=this._contentWidgets[t];delete this._contentWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeContentWidget(i)}}addOverlayWidget(e){const t={widget:e,position:e.getPosition()};this._overlayWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting an overlay widget with the same id."),this._overlayWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addOverlayWidget(t)}layoutOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutOverlayWidget(i)}}removeOverlayWidget(e){const t=e.getId();if(this._overlayWidgets.hasOwnProperty(t)){const i=this._overlayWidgets[t];delete this._overlayWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeOverlayWidget(i)}}addGlyphMarginWidget(e){const t={widget:e,position:e.getPosition()};this._glyphMarginWidgets.hasOwnProperty(e.getId())&&console.warn("Overwriting a glyph margin widget with the same id."),this._glyphMarginWidgets[e.getId()]=t,this._modelData&&this._modelData.hasRealView&&this._modelData.view.addGlyphMarginWidget(t)}layoutGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];i.position=e.getPosition(),this._modelData&&this._modelData.hasRealView&&this._modelData.view.layoutGlyphMarginWidget(i)}}removeGlyphMarginWidget(e){const t=e.getId();if(this._glyphMarginWidgets.hasOwnProperty(t)){const i=this._glyphMarginWidgets[t];delete this._glyphMarginWidgets[t],this._modelData&&this._modelData.hasRealView&&this._modelData.view.removeGlyphMarginWidget(i)}}changeViewZones(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.change(e)}getTargetAtClientPoint(e,t){return!this._modelData||!this._modelData.hasRealView?null:this._modelData.view.getTargetAtClientPoint(e,t)}getScrolledVisiblePosition(e){if(!this._modelData||!this._modelData.hasRealView)return null;const t=this._modelData.model.validatePosition(e),n=this._configuration.options.get(165),s=ng._getVerticalOffsetForPosition(this._modelData,t.lineNumber,t.column)-this.getScrollTop(),r=this._modelData.view.getOffsetForColumn(t.lineNumber,t.column)+n.glyphMarginWidth+n.lineNumbersWidth+n.decorationsWidth-this.getScrollLeft(),a=this.getLineHeightForPosition(t);return{top:s,left:r,height:a}}getOffsetForColumn(e,t){return!this._modelData||!this._modelData.hasRealView?-1:this._modelData.view.getOffsetForColumn(e,t)}render(e=!1){!this._modelData||!this._modelData.hasRealView||this._modelData.viewModel.batchEvents(()=>{this._modelData.view.render(!0,e)})}setAriaOptions(e){!this._modelData||!this._modelData.hasRealView||this._modelData.view.setAriaOptions(e)}applyFontInfo(e){dn(e,this._configuration.options.get(59))}setBanner(e,t){this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),this._bannerDomNode=e,this._configuration.setReservedHeight(e?t:0),this._bannerDomNode&&this._domElement.prepend(this._bannerDomNode)}_attachModel(e){if(!e){this._modelData=null;return}const t=[];this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._configuration.setIsDominatedByLongLines(e.isDominatedByLongLines()),this._configuration.setModelLineCount(e.getLineCount());const i=e.onBeforeAttached(),n=new ume(this._id,this._configuration,e,_P.create(me(this._domElement)),JP.create(this._configuration.options),a=>Hs(me(this._domElement),a),this.languageConfigurationService,this._themeService,i,{batchChanges:a=>{try{return this._beginUpdate(),a()}finally{this._endUpdate()}}});t.push(e.onWillDispose(()=>this.setModel(null))),t.push(n.onEvent(a=>{switch(a.kind){case 0:this._onDidContentSizeChange.fire(a);break;case 1:this._editorTextFocus.setValue(a.hasFocus);break;case 2:this._editorWidgetFocus.setValue(a.hasFocus);break;case 3:this._onDidScrollChange.fire(a);break;case 4:this._onDidChangeViewZones.fire();break;case 5:this._onDidChangeHiddenAreas.fire();break;case 6:this._onDidAttemptReadOnlyEdit.fire();break;case 7:{if(a.reachedMaxCursorCount){const h=this.getOption(89),u=p(80,"The number of cursors has been limited to {0}. Consider using [find and replace](https://code.visualstudio.com/docs/editor/codebasics#_find-and-replace) for larger changes or increase the editor multi cursor limit setting.",h);this._notificationService.prompt(k_.Warning,u,[{label:"Find and Replace",run:()=>{this._commandService.executeCommand("editor.action.startFindReplaceAction")}},{label:p(81,"Increase Multi Cursor Limit"),run:()=>{this._commandService.executeCommand("workbench.action.openSettings2",{query:"editor.multiCursorLimit"})}}])}const l=[];for(let h=0,u=a.selections.length;h<u;h++)l[h]=a.selections[h].getPosition();const c={position:l[0],secondaryPositions:l.slice(1),reason:a.reason,source:a.source};this._onDidChangeCursorPosition.fire(c);const d={selection:a.selections[0],secondarySelections:a.selections.slice(1),modelVersionId:a.modelVersionId,oldSelections:a.oldSelections,oldModelVersionId:a.oldModelVersionId,source:a.source,reason:a.reason};this._onDidChangeCursorSelection.fire(d);break}case 8:this._onDidChangeModelDecorations.fire(a.event);break;case 9:this._domElement.setAttribute("data-mode-id",e.getLanguageId()),this._onDidChangeModelLanguage.fire(a.event);break;case 10:this._onDidChangeModelLanguageConfiguration.fire(a.event);break;case 11:this._onDidChangeModelContent.fire(a.event);break;case 12:this._onDidChangeModelOptions.fire(a.event);break;case 13:this._onDidChangeModelTokens.fire(a.event);break;case 14:this._onDidChangeLineHeight.fire(a.event);break;case 15:this._onDidChangeFont.fire(a.event);break}}));const[s,r]=this._createView(n);if(r){this._domElement.appendChild(s.domNode.domNode);let a=Object.keys(this._contentWidgets);for(let l=0,c=a.length;l<c;l++){const d=a[l];s.addContentWidget(this._contentWidgets[d])}a=Object.keys(this._overlayWidgets);for(let l=0,c=a.length;l<c;l++){const d=a[l];s.addOverlayWidget(this._overlayWidgets[d])}a=Object.keys(this._glyphMarginWidgets);for(let l=0,c=a.length;l<c;l++){const d=a[l];s.addGlyphMarginWidget(this._glyphMarginWidgets[d])}s.render(!1,!0),s.domNode.domNode.setAttribute("data-uri",e.uri.toString())}this._modelData=new bme(e,n,s,r,t,i)}_createView(e){let t;this.isSimpleWidget?t={paste:(s,r,a,l)=>{this._paste("keyboard",s,r,a,l)},type:s=>{this._type("keyboard",s)},compositionType:(s,r,a,l)=>{this._compositionType("keyboard",s,r,a,l)},startComposition:()=>{this._startComposition()},endComposition:()=>{this._endComposition("keyboard")},cut:()=>{this._cut("keyboard")}}:t={paste:(s,r,a,l)=>{const c={text:s,pasteOnNewLine:r,multicursorText:a,mode:l};this._commandService.executeCommand("paste",c)},type:s=>{const r={text:s};this._commandService.executeCommand("type",r)},compositionType:(s,r,a,l)=>{if(a||l){const c={text:s,replacePrevCharCnt:r,replaceNextCharCnt:a,positionDelta:l};this._commandService.executeCommand("compositionType",c)}else{const c={text:s,replaceCharCnt:r};this._commandService.executeCommand("replacePreviousChar",c)}},startComposition:()=>{this._commandService.executeCommand("compositionStart",{})},endComposition:()=>{this._commandService.executeCommand("compositionEnd",{})},cut:()=>{this._commandService.executeCommand("cut",{})}};const i=new UL(e.coordinatesConverter);return i.onKeyDown=s=>this._onKeyDown.fire(s),i.onKeyUp=s=>this._onKeyUp.fire(s),i.onContextMenu=s=>this._onContextMenu.fire(s),i.onMouseMove=s=>this._onMouseMove.fire(s),i.onMouseLeave=s=>this._onMouseLeave.fire(s),i.onMouseDown=s=>this._onMouseDown.fire(s),i.onMouseUp=s=>this._onMouseUp.fire(s),i.onMouseDrag=s=>this._onMouseDrag.fire(s),i.onMouseDrop=s=>this._onMouseDrop.fire(s),i.onMouseDropCanceled=s=>this._onMouseDropCanceled.fire(s),i.onMouseWheel=s=>this._onMouseWheel.fire(s),[new pP(this._domElement,this.getId(),t,this._configuration,this._themeService.getColorTheme(),e,i,this._overflowWidgetsDomNode,this._instantiationService),!0]}_postDetachModelCleanup(e){e?.removeAllDecorationsWithOwnerId(this._id)}_detachModel(){if(this._contributionsDisposable?.dispose(),this._contributionsDisposable=void 0,!this._modelData)return null;const e=this._modelData.model,t=this._modelData.hasRealView?this._modelData.view.domNode.domNode:null;return this._modelData.dispose(),this._modelData=null,this._domElement.removeAttribute("data-mode-id"),t&&this._domElement.contains(t)&&t.remove(),this._bannerDomNode&&this._domElement.contains(this._bannerDomNode)&&this._bannerDomNode.remove(),e}_removeDecorationType(e){this._codeEditorService.removeDecorationType(e)}hasModel(){return this._modelData!==null}showDropIndicatorAt(e){const t=[{range:new k(e.lineNumber,e.column,e.lineNumber,e.column),options:ng.dropIntoEditorDecorationOptions}];this._dropIntoEditorDecorations.set(t),this.revealPosition(e,1)}removeDropIndicator(){this._dropIntoEditorDecorations.clear()}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&this._onBeginUpdate.fire()}_endUpdate(){this._updateCounter--,this._updateCounter===0&&this._onEndUpdate.fire()}},ng=xp,xp.dropIntoEditorDecorationOptions=Te.register({description:"workbench-dnd-target",className:"dnd-target"}),xp);sg=ng=mme([td(3,ge),td(4,et),td(5,Tt),td(6,xe),td(7,li),td(8,hi),td(9,bn),td(10,Jt),td(11,he)],sg);let _me=0,bme=class{constructor(e,t,i,n,s,r){this.model=e,this.viewModel=t,this.view=i,this.hasRealView=n,this.listenersToRemove=s,this.attachedView=r}dispose(){pt(this.listenersToRemove),this.model.onBeforeDetached(this.attachedView),this.hasRealView&&this.view.dispose(),this.viewModel.dispose()}};class G$ extends A{constructor(e){super(),this._emitterOptions=e,this._onDidChangeToTrue=this._register(new P(this._emitterOptions)),this.onDidChangeToTrue=this._onDidChangeToTrue.event,this._onDidChangeToFalse=this._register(new P(this._emitterOptions)),this.onDidChangeToFalse=this._onDidChangeToFalse.event,this._value=0}setValue(e){const t=e?2:1;this._value!==t&&(this._value=t,this._value===2?this._onDidChangeToTrue.fire():this._value===1&&this._onDidChangeToFalse.fire())}}class cs extends P{constructor(e,t){super({deliveryQueue:t}),this._contributions=e}fire(e){this._contributions.onBeforeInteractionEvent(),super.fire(e)}}class Cme extends A{constructor(e,t){super(),this._editor=e,t.createKey("editorId",e.getId()),this._editorSimpleInput=T.editorSimpleInput.bindTo(t),this._editorFocus=T.focus.bindTo(t),this._textInputFocus=T.textInputFocus.bindTo(t),this._editorTextFocus=T.editorTextFocus.bindTo(t),this._tabMovesFocus=T.tabMovesFocus.bindTo(t),this._editorReadonly=T.readOnly.bindTo(t),this._inDiffEditor=T.inDiffEditor.bindTo(t),this._editorColumnSelection=T.columnSelection.bindTo(t),this._hasMultipleSelections=T.hasMultipleSelections.bindTo(t),this._hasNonEmptySelection=T.hasNonEmptySelection.bindTo(t),this._canUndo=T.canUndo.bindTo(t),this._canRedo=T.canRedo.bindTo(t),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromConfig())),this._register(this._editor.onDidChangeCursorSelection(()=>this._updateFromSelection())),this._register(this._editor.onDidFocusEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorWidget(()=>this._updateFromFocus())),this._register(this._editor.onDidFocusEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidBlurEditorText(()=>this._updateFromFocus())),this._register(this._editor.onDidChangeModel(()=>this._updateFromModel())),this._register(this._editor.onDidChangeConfiguration(()=>this._updateFromModel())),this._register(s_.onDidChangeTabFocus(i=>this._tabMovesFocus.set(i))),this._updateFromConfig(),this._updateFromSelection(),this._updateFromFocus(),this._updateFromModel(),this._editorSimpleInput.set(this._editor.isSimpleWidget)}_updateFromConfig(){const e=this._editor.getOptions();this._tabMovesFocus.set(e.get(164)||s_.getTabFocusMode()),this._editorReadonly.set(e.get(104)),this._inDiffEditor.set(e.get(70)),this._editorColumnSelection.set(e.get(28))}_updateFromSelection(){const e=this._editor.getSelections();e?(this._hasMultipleSelections.set(e.length>1),this._hasNonEmptySelection.set(e.some(t=>!t.isEmpty()))):(this._hasMultipleSelections.reset(),this._hasNonEmptySelection.reset())}_updateFromFocus(){this._editorFocus.set(this._editor.hasWidgetFocus()&&!this._editor.isSimpleWidget),this._editorTextFocus.set(this._editor.hasTextFocus()&&!this._editor.isSimpleWidget),this._textInputFocus.set(this._editor.hasTextFocus())}_updateFromModel(){const e=this._editor.getModel();this._canUndo.set(!!(e&&e.canUndo())),this._canRedo.set(!!(e&&e.canRedo()))}}class vme extends A{constructor(e,t,i){super(),this._editor=e,this._contextKeyService=t,this._languageFeaturesService=i,this._langId=T.languageId.bindTo(t),this._hasCompletionItemProvider=T.hasCompletionItemProvider.bindTo(t),this._hasCodeActionsProvider=T.hasCodeActionsProvider.bindTo(t),this._hasCodeLensProvider=T.hasCodeLensProvider.bindTo(t),this._hasDefinitionProvider=T.hasDefinitionProvider.bindTo(t),this._hasDeclarationProvider=T.hasDeclarationProvider.bindTo(t),this._hasImplementationProvider=T.hasImplementationProvider.bindTo(t),this._hasTypeDefinitionProvider=T.hasTypeDefinitionProvider.bindTo(t),this._hasHoverProvider=T.hasHoverProvider.bindTo(t),this._hasDocumentHighlightProvider=T.hasDocumentHighlightProvider.bindTo(t),this._hasDocumentSymbolProvider=T.hasDocumentSymbolProvider.bindTo(t),this._hasReferenceProvider=T.hasReferenceProvider.bindTo(t),this._hasRenameProvider=T.hasRenameProvider.bindTo(t),this._hasSignatureHelpProvider=T.hasSignatureHelpProvider.bindTo(t),this._hasInlayHintsProvider=T.hasInlayHintsProvider.bindTo(t),this._hasDocumentFormattingProvider=T.hasDocumentFormattingProvider.bindTo(t),this._hasDocumentSelectionFormattingProvider=T.hasDocumentSelectionFormattingProvider.bindTo(t),this._hasMultipleDocumentFormattingProvider=T.hasMultipleDocumentFormattingProvider.bindTo(t),this._hasMultipleDocumentSelectionFormattingProvider=T.hasMultipleDocumentSelectionFormattingProvider.bindTo(t),this._isInEmbeddedEditor=T.isInEmbeddedEditor.bindTo(t);const n=()=>this._update();this._register(e.onDidChangeModel(n)),this._register(e.onDidChangeModelLanguage(n)),this._register(i.completionProvider.onDidChange(n)),this._register(i.codeActionProvider.onDidChange(n)),this._register(i.codeLensProvider.onDidChange(n)),this._register(i.definitionProvider.onDidChange(n)),this._register(i.declarationProvider.onDidChange(n)),this._register(i.implementationProvider.onDidChange(n)),this._register(i.typeDefinitionProvider.onDidChange(n)),this._register(i.hoverProvider.onDidChange(n)),this._register(i.documentHighlightProvider.onDidChange(n)),this._register(i.documentSymbolProvider.onDidChange(n)),this._register(i.referenceProvider.onDidChange(n)),this._register(i.renameProvider.onDidChange(n)),this._register(i.documentFormattingEditProvider.onDidChange(n)),this._register(i.documentRangeFormattingEditProvider.onDidChange(n)),this._register(i.signatureHelpProvider.onDidChange(n)),this._register(i.inlayHintsProvider.onDidChange(n)),n()}dispose(){super.dispose()}reset(){this._contextKeyService.bufferChangeEvents(()=>{this._langId.reset(),this._hasCompletionItemProvider.reset(),this._hasCodeActionsProvider.reset(),this._hasCodeLensProvider.reset(),this._hasDefinitionProvider.reset(),this._hasDeclarationProvider.reset(),this._hasImplementationProvider.reset(),this._hasTypeDefinitionProvider.reset(),this._hasHoverProvider.reset(),this._hasDocumentHighlightProvider.reset(),this._hasDocumentSymbolProvider.reset(),this._hasReferenceProvider.reset(),this._hasRenameProvider.reset(),this._hasDocumentFormattingProvider.reset(),this._hasDocumentSelectionFormattingProvider.reset(),this._hasSignatureHelpProvider.reset(),this._isInEmbeddedEditor.reset()})}_update(){const e=this._editor.getModel();if(!e){this.reset();return}this._contextKeyService.bufferChangeEvents(()=>{this._langId.set(e.getLanguageId()),this._hasCompletionItemProvider.set(this._languageFeaturesService.completionProvider.has(e)),this._hasCodeActionsProvider.set(this._languageFeaturesService.codeActionProvider.has(e)),this._hasCodeLensProvider.set(this._languageFeaturesService.codeLensProvider.has(e)),this._hasDefinitionProvider.set(this._languageFeaturesService.definitionProvider.has(e)),this._hasDeclarationProvider.set(this._languageFeaturesService.declarationProvider.has(e)),this._hasImplementationProvider.set(this._languageFeaturesService.implementationProvider.has(e)),this._hasTypeDefinitionProvider.set(this._languageFeaturesService.typeDefinitionProvider.has(e)),this._hasHoverProvider.set(this._languageFeaturesService.hoverProvider.has(e)),this._hasDocumentHighlightProvider.set(this._languageFeaturesService.documentHighlightProvider.has(e)),this._hasDocumentSymbolProvider.set(this._languageFeaturesService.documentSymbolProvider.has(e)),this._hasReferenceProvider.set(this._languageFeaturesService.referenceProvider.has(e)),this._hasRenameProvider.set(this._languageFeaturesService.renameProvider.has(e)),this._hasSignatureHelpProvider.set(this._languageFeaturesService.signatureHelpProvider.has(e)),this._hasInlayHintsProvider.set(this._languageFeaturesService.inlayHintsProvider.has(e)),this._hasDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.has(e)||this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.has(e)),this._hasMultipleDocumentFormattingProvider.set(this._languageFeaturesService.documentFormattingEditProvider.all(e).length+this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._hasMultipleDocumentSelectionFormattingProvider.set(this._languageFeaturesService.documentRangeFormattingEditProvider.all(e).length>1),this._isInEmbeddedEditor.set(e.uri.scheme===we.walkThroughSnippet||e.uri.scheme===we.vscodeChatCodeBlock)})}}class wme{get length(){return this._decorationIds.length}constructor(e,t){this._editor=e,this._decorationIds=[],this._isChangingDecorations=!1,Array.isArray(t)&&t.length>0&&this.set(t)}onDidChange(e,t,i){return this._editor.onDidChangeModelDecorations(n=>{this._isChangingDecorations||e.call(t,n)},i)}getRange(e){return!this._editor.hasModel()||e>=this._decorationIds.length?null:this._editor.getModel().getDecorationRange(this._decorationIds[e])}getRanges(){if(!this._editor.hasModel())return[];const e=this._editor.getModel(),t=[];for(const i of this._decorationIds){const n=e.getDecorationRange(i);n&&t.push(n)}return t}has(e){return this._decorationIds.includes(e.id)}clear(){this._decorationIds.length!==0&&this.set([])}set(e){try{this._isChangingDecorations=!0,this._editor.changeDecorations(t=>{this._decorationIds=t.deltaDecorations(this._decorationIds,e)})}finally{this._isChangingDecorations=!1}return this._decorationIds}append(e){let t=[];try{this._isChangingDecorations=!0,this._editor.changeDecorations(i=>{t=i.deltaDecorations([],e),this._decorationIds=this._decorationIds.concat(t)})}finally{this._isChangingDecorations=!1}return t}}const Sme=encodeURIComponent("<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 3' enable-background='new 0 0 6 3' height='3' width='6'><g fill='"),yme=encodeURIComponent("'><polygon points='5.5,0 2.5,3 1.1,3 4.1,0'/><polygon points='4,0 6,2 6,0.6 5.4,0'/><polygon points='0,2 1,3 2.4,3 0,0.6'/></g></svg>");function F_(o){return Sme+encodeURIComponent(o.toString())+yme}const Lme=encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" height="3" width="12"><g fill="'),xme=encodeURIComponent('"><circle cx="1" cy="1" r="1"/><circle cx="5" cy="1" r="1"/><circle cx="9" cy="1" r="1"/></g></svg>');function Z$(o){return Lme+encodeURIComponent(o.toString())+xme}Nr((o,e)=>{const t=o.getColor(yL);t&&(e.addRule(`.monaco-editor .squiggly-error { background: url("data:image/svg+xml,${F_(t)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-error-decoration: url("data:image/svg+xml,${F_(t)}"); }`));const i=o.getColor(Wc);i&&(e.addRule(`.monaco-editor .squiggly-warning { background: url("data:image/svg+xml,${F_(i)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-warning-decoration: url("data:image/svg+xml,${F_(i)}"); }`));const n=o.getColor(Cl);n&&(e.addRule(`.monaco-editor .squiggly-info { background: url("data:image/svg+xml,${F_(n)}") repeat-x bottom left; }`),e.addRule(`:root { --monaco-editor-info-decoration: url("data:image/svg+xml,${F_(n)}"); }`));const s=o.getColor(Zae);s&&(e.addRule(`.monaco-editor .squiggly-hint { background: url("data:image/svg+xml,${Z$(s)}") no-repeat bottom left; }`),e.addRule(`:root { --monaco-editor-hint-decoration: url("data:image/svg+xml,${Z$(s)}"); }`));const r=o.getColor(Xde);r&&(e.addRule(`.monaco-editor.showUnused .squiggly-inline-unnecessary { opacity: ${r.rgba.a}; }`),e.addRule(`:root { --monaco-editor-unnecessary-decoration-opacity: ${r.rgba.a}; }`))});function id(o,e){return o}function Px(o){return Et(o)}const nd=We("accessibilitySignalService"),Fe=class Fe{static register(e){return new Fe(e.fileName)}constructor(e){this.fileName=e}};Fe.error=Fe.register({fileName:"error.mp3"}),Fe.warning=Fe.register({fileName:"warning.mp3"}),Fe.success=Fe.register({fileName:"success.mp3"}),Fe.foldedArea=Fe.register({fileName:"foldedAreas.mp3"}),Fe.break=Fe.register({fileName:"break.mp3"}),Fe.quickFixes=Fe.register({fileName:"quickFixes.mp3"}),Fe.taskCompleted=Fe.register({fileName:"taskCompleted.mp3"}),Fe.taskFailed=Fe.register({fileName:"taskFailed.mp3"}),Fe.terminalBell=Fe.register({fileName:"terminalBell.mp3"}),Fe.diffLineInserted=Fe.register({fileName:"diffLineInserted.mp3"}),Fe.diffLineDeleted=Fe.register({fileName:"diffLineDeleted.mp3"}),Fe.diffLineModified=Fe.register({fileName:"diffLineModified.mp3"}),Fe.requestSent=Fe.register({fileName:"requestSent.mp3"}),Fe.responseReceived1=Fe.register({fileName:"responseReceived1.mp3"}),Fe.responseReceived2=Fe.register({fileName:"responseReceived2.mp3"}),Fe.responseReceived3=Fe.register({fileName:"responseReceived3.mp3"}),Fe.responseReceived4=Fe.register({fileName:"responseReceived4.mp3"}),Fe.clear=Fe.register({fileName:"clear.mp3"}),Fe.save=Fe.register({fileName:"save.mp3"}),Fe.format=Fe.register({fileName:"format.mp3"}),Fe.voiceRecordingStarted=Fe.register({fileName:"voiceRecordingStarted.mp3"}),Fe.voiceRecordingStopped=Fe.register({fileName:"voiceRecordingStopped.mp3"}),Fe.progress=Fe.register({fileName:"progress.mp3"}),Fe.chatEditModifiedFile=Fe.register({fileName:"chatEditModifiedFile.mp3"}),Fe.editsKept=Fe.register({fileName:"editsKept.mp3"}),Fe.editsUndone=Fe.register({fileName:"editsUndone.mp3"}),Fe.nextEditSuggestion=Fe.register({fileName:"nextEditSuggestion.mp3"}),Fe.terminalCommandSucceeded=Fe.register({fileName:"terminalCommandSucceeded.mp3"}),Fe.chatUserActionRequired=Fe.register({fileName:"chatUserActionRequired.mp3"}),Fe.codeActionTriggered=Fe.register({fileName:"codeActionTriggered.mp3"}),Fe.codeActionApplied=Fe.register({fileName:"codeActionApplied.mp3"});let yt=Fe;class kme{constructor(e){this.randomOneOf=e}}const Re=class Re{constructor(e,t,i,n,s,r,a=!1){this.sound=e,this.name=t,this.legacySoundSettingsKey=i,this.settingsKey=n,this.legacyAnnouncementSettingsKey=s,this.announcementMessage=r,this.managesOwnEnablement=a}static register(e){const t=new kme("randomOneOf"in e.sound?e.sound.randomOneOf:[e.sound]),i=new Re(t,e.name,e.legacySoundSettingsKey,e.settingsKey,e.legacyAnnouncementSettingsKey,e.announcementMessage,e.managesOwnEnablement);return Re._signals.add(i),i}};Re._signals=new Set,Re.errorAtPosition=Re.register({name:p(1561,"Error at Position"),sound:yt.error,announcementMessage:p(1562,"Error"),settingsKey:"accessibility.signals.positionHasError",delaySettingsKey:"accessibility.signalOptions.delays.errorAtPosition"}),Re.warningAtPosition=Re.register({name:p(1563,"Warning at Position"),sound:yt.warning,announcementMessage:p(1564,"Warning"),settingsKey:"accessibility.signals.positionHasWarning",delaySettingsKey:"accessibility.signalOptions.delays.warningAtPosition"}),Re.errorOnLine=Re.register({name:p(1565,"Error on Line"),sound:yt.error,legacySoundSettingsKey:"audioCues.lineHasError",legacyAnnouncementSettingsKey:"accessibility.alert.error",announcementMessage:p(1566,"Error on Line"),settingsKey:"accessibility.signals.lineHasError"}),Re.warningOnLine=Re.register({name:p(1567,"Warning on Line"),sound:yt.warning,legacySoundSettingsKey:"audioCues.lineHasWarning",legacyAnnouncementSettingsKey:"accessibility.alert.warning",announcementMessage:p(1568,"Warning on Line"),settingsKey:"accessibility.signals.lineHasWarning"}),Re.foldedArea=Re.register({name:p(1569,"Folded Area on Line"),sound:yt.foldedArea,legacySoundSettingsKey:"audioCues.lineHasFoldedArea",legacyAnnouncementSettingsKey:"accessibility.alert.foldedArea",announcementMessage:p(1570,"Folded"),settingsKey:"accessibility.signals.lineHasFoldedArea"}),Re.break=Re.register({name:p(1571,"Breakpoint on Line"),sound:yt.break,legacySoundSettingsKey:"audioCues.lineHasBreakpoint",legacyAnnouncementSettingsKey:"accessibility.alert.breakpoint",announcementMessage:p(1572,"Breakpoint"),settingsKey:"accessibility.signals.lineHasBreakpoint"}),Re.inlineSuggestion=Re.register({name:p(1573,"Inline Suggestion on Line"),sound:yt.quickFixes,legacySoundSettingsKey:"audioCues.lineHasInlineSuggestion",settingsKey:"accessibility.signals.lineHasInlineSuggestion"}),Re.nextEditSuggestion=Re.register({name:p(1574,"Next Edit Suggestion on Line"),sound:yt.nextEditSuggestion,legacySoundSettingsKey:"audioCues.nextEditSuggestion",settingsKey:"accessibility.signals.nextEditSuggestion",announcementMessage:p(1575,"Next Edit Suggestion")}),Re.terminalQuickFix=Re.register({name:p(1576,"Terminal Quick Fix"),sound:yt.quickFixes,legacySoundSettingsKey:"audioCues.terminalQuickFix",legacyAnnouncementSettingsKey:"accessibility.alert.terminalQuickFix",announcementMessage:p(1577,"Quick Fix"),settingsKey:"accessibility.signals.terminalQuickFix"}),Re.onDebugBreak=Re.register({name:p(1578,"Debugger Stopped on Breakpoint"),sound:yt.break,legacySoundSettingsKey:"audioCues.onDebugBreak",legacyAnnouncementSettingsKey:"accessibility.alert.onDebugBreak",announcementMessage:p(1579,"Breakpoint"),settingsKey:"accessibility.signals.onDebugBreak"}),Re.noInlayHints=Re.register({name:p(1580,"No Inlay Hints on Line"),sound:yt.error,legacySoundSettingsKey:"audioCues.noInlayHints",legacyAnnouncementSettingsKey:"accessibility.alert.noInlayHints",announcementMessage:p(1581,"No Inlay Hints"),settingsKey:"accessibility.signals.noInlayHints"}),Re.taskCompleted=Re.register({name:p(1582,"Task Completed"),sound:yt.taskCompleted,legacySoundSettingsKey:"audioCues.taskCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.taskCompleted",announcementMessage:p(1583,"Task Completed"),settingsKey:"accessibility.signals.taskCompleted"}),Re.taskFailed=Re.register({name:p(1584,"Task Failed"),sound:yt.taskFailed,legacySoundSettingsKey:"audioCues.taskFailed",legacyAnnouncementSettingsKey:"accessibility.alert.taskFailed",announcementMessage:p(1585,"Task Failed"),settingsKey:"accessibility.signals.taskFailed"}),Re.terminalCommandFailed=Re.register({name:p(1586,"Terminal Command Failed"),sound:yt.error,legacySoundSettingsKey:"audioCues.terminalCommandFailed",legacyAnnouncementSettingsKey:"accessibility.alert.terminalCommandFailed",announcementMessage:p(1587,"Command Failed"),settingsKey:"accessibility.signals.terminalCommandFailed"}),Re.terminalCommandSucceeded=Re.register({name:p(1588,"Terminal Command Succeeded"),sound:yt.terminalCommandSucceeded,announcementMessage:p(1589,"Command Succeeded"),settingsKey:"accessibility.signals.terminalCommandSucceeded"}),Re.terminalBell=Re.register({name:p(1590,"Terminal Bell"),sound:yt.terminalBell,legacySoundSettingsKey:"audioCues.terminalBell",legacyAnnouncementSettingsKey:"accessibility.alert.terminalBell",announcementMessage:p(1591,"Terminal Bell"),settingsKey:"accessibility.signals.terminalBell"}),Re.notebookCellCompleted=Re.register({name:p(1592,"Notebook Cell Completed"),sound:yt.taskCompleted,legacySoundSettingsKey:"audioCues.notebookCellCompleted",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellCompleted",announcementMessage:p(1593,"Notebook Cell Completed"),settingsKey:"accessibility.signals.notebookCellCompleted"}),Re.notebookCellFailed=Re.register({name:p(1594,"Notebook Cell Failed"),sound:yt.taskFailed,legacySoundSettingsKey:"audioCues.notebookCellFailed",legacyAnnouncementSettingsKey:"accessibility.alert.notebookCellFailed",announcementMessage:p(1595,"Notebook Cell Failed"),settingsKey:"accessibility.signals.notebookCellFailed"}),Re.diffLineInserted=Re.register({name:p(1596,"Diff Line Inserted"),sound:yt.diffLineInserted,legacySoundSettingsKey:"audioCues.diffLineInserted",settingsKey:"accessibility.signals.diffLineInserted"}),Re.diffLineDeleted=Re.register({name:p(1597,"Diff Line Deleted"),sound:yt.diffLineDeleted,legacySoundSettingsKey:"audioCues.diffLineDeleted",settingsKey:"accessibility.signals.diffLineDeleted"}),Re.diffLineModified=Re.register({name:p(1598,"Diff Line Modified"),sound:yt.diffLineModified,legacySoundSettingsKey:"audioCues.diffLineModified",settingsKey:"accessibility.signals.diffLineModified"}),Re.chatEditModifiedFile=Re.register({name:p(1599,"Chat Edit Modified File"),sound:yt.chatEditModifiedFile,announcementMessage:p(1600,"File Modified from Chat Edits"),settingsKey:"accessibility.signals.chatEditModifiedFile"}),Re.chatRequestSent=Re.register({name:p(1601,"Chat Request Sent"),sound:yt.requestSent,legacySoundSettingsKey:"audioCues.chatRequestSent",legacyAnnouncementSettingsKey:"accessibility.alert.chatRequestSent",announcementMessage:p(1602,"Chat Request Sent"),settingsKey:"accessibility.signals.chatRequestSent"}),Re.chatResponseReceived=Re.register({name:p(1603,"Chat Response Received"),legacySoundSettingsKey:"audioCues.chatResponseReceived",sound:{randomOneOf:[yt.responseReceived1,yt.responseReceived2,yt.responseReceived3,yt.responseReceived4]},settingsKey:"accessibility.signals.chatResponseReceived"}),Re.codeActionTriggered=Re.register({name:p(1604,"Code Action Request Triggered"),sound:yt.codeActionTriggered,legacySoundSettingsKey:"audioCues.codeActionRequestTriggered",legacyAnnouncementSettingsKey:"accessibility.alert.codeActionRequestTriggered",announcementMessage:p(1605,"Code Action Request Triggered"),settingsKey:"accessibility.signals.codeActionTriggered"}),Re.codeActionApplied=Re.register({name:p(1606,"Code Action Applied"),legacySoundSettingsKey:"audioCues.codeActionApplied",sound:yt.codeActionApplied,settingsKey:"accessibility.signals.codeActionApplied"}),Re.progress=Re.register({name:p(1607,"Progress"),sound:yt.progress,legacySoundSettingsKey:"audioCues.chatResponsePending",legacyAnnouncementSettingsKey:"accessibility.alert.progress",announcementMessage:p(1608,"Progress"),settingsKey:"accessibility.signals.progress"}),Re.clear=Re.register({name:p(1609,"Clear"),sound:yt.clear,legacySoundSettingsKey:"audioCues.clear",legacyAnnouncementSettingsKey:"accessibility.alert.clear",announcementMessage:p(1610,"Clear"),settingsKey:"accessibility.signals.clear"}),Re.save=Re.register({name:p(1611,"Save"),sound:yt.save,legacySoundSettingsKey:"audioCues.save",legacyAnnouncementSettingsKey:"accessibility.alert.save",announcementMessage:p(1612,"Save"),settingsKey:"accessibility.signals.save"}),Re.format=Re.register({name:p(1613,"Format"),sound:yt.format,legacySoundSettingsKey:"audioCues.format",legacyAnnouncementSettingsKey:"accessibility.alert.format",announcementMessage:p(1614,"Format"),settingsKey:"accessibility.signals.format"}),Re.voiceRecordingStarted=Re.register({name:p(1615,"Voice Recording Started"),sound:yt.voiceRecordingStarted,legacySoundSettingsKey:"audioCues.voiceRecordingStarted",settingsKey:"accessibility.signals.voiceRecordingStarted"}),Re.voiceRecordingStopped=Re.register({name:p(1616,"Voice Recording Stopped"),sound:yt.voiceRecordingStopped,legacySoundSettingsKey:"audioCues.voiceRecordingStopped",settingsKey:"accessibility.signals.voiceRecordingStopped"}),Re.editsKept=Re.register({name:p(1617,"Edits Kept"),sound:yt.editsKept,announcementMessage:p(1618,"Edits Kept"),settingsKey:"accessibility.signals.editsKept"}),Re.editsUndone=Re.register({name:p(1619,"Undo Edits"),sound:yt.editsUndone,announcementMessage:p(1620,"Edits Undone"),settingsKey:"accessibility.signals.editsUndone"}),Re.chatUserActionRequired=Re.register({name:p(1621,"Chat User Action Required"),sound:yt.chatUserActionRequired,announcementMessage:p(1622,"Chat User Action Required"),settingsKey:"accessibility.signals.chatUserActionRequired",managesOwnEnablement:!0});let xs=Re;function Y$(o,e,t,i=Gi.ofCaller()){return V6({debugName:()=>`Configuration Key "${o}"`},n=>t.onDidChangeConfiguration(s=>{s.affectsConfiguration(o)&&n(s)}),()=>t.getValue(o)??e,i)}function El(o,e,t,i=Gi.ofCaller()){const n=o.bindTo(e),s=new U;return In({debugName:()=>`Set Context Key "${o.key}"`},r=>{const a=t(r);return n.set(a),a},i).recomputeInitiallyAndOnChange(s),s}const X$=We("progressService"),aB=class aB{constructor(e){this.callback=e}report(e){this._value=e,this.callback(this._value)}};aB.None=Object.freeze({report(){}});let Pa=aB;const sd=We("editorProgressService");class Aa{static capture(e){if(e.getScrollTop()===0||e.hasPendingScrollAnimation())return new Aa(e.getScrollTop(),e.getContentHeight(),null,0,null);let t=null,i=0;const n=e.getVisibleRanges();if(n.length>0){t=n[0].getStartPosition();const s=e.getTopForPosition(t.lineNumber,t.column);i=e.getScrollTop()-s}return new Aa(e.getScrollTop(),e.getContentHeight(),t,i,e.getPosition())}constructor(e,t,i,n,s){this._initialScrollTop=e,this._initialContentHeight=t,this._visiblePosition=i,this._visiblePositionScrollDelta=n,this._cursorPosition=s}restore(e){if(!(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())&&this._visiblePosition){const t=e.getTopForPosition(this._visiblePosition.lineNumber,this._visiblePosition.column);e.setScrollTop(t+this._visiblePositionScrollDelta)}}restoreRelativeVerticalPositionOfCursor(e){if(this._initialContentHeight===e.getContentHeight()&&this._initialScrollTop===e.getScrollTop())return;const t=e.getPosition();if(!this._cursorPosition||!t)return;const i=e.getTopForLineNumber(t.lineNumber)-e.getTopForLineNumber(this._cursorPosition.lineNumber);e.setScrollTop(e.getScrollTop()+i,1)}}const og={RESOURCES:"ResourceURLs",TEXT:_i.text,INTERNAL_URI_LIST:"application/vnd.code.uri-list"};let Ax=()=>({get delay(){return-1},dispose:()=>{},showHover:()=>{}});const Ime=new Ln(()=>Ax("mouse",!1)),Dme=new Ln(()=>Ax("element",!1));function Eme(o){Ax=o}function Zs(o){return o==="element"?Dme.value:Ime.value}function W_(){return Ax("element",!0)}function v5e(o){return o}function od(o,e){if(o!==void 0){const t=o.match(/^\s*var\((.+)\)$/);if(t){const i=t[1].split(",",2);return i.length===2&&(e=od(i[1].trim(),e)),`var(${i[0]}, ${e})`}return o}return e}function Q$(o){const e=o.replaceAll(/[^_\-a-z0-9]/gi,"");return e!==o&&console.warn(`CSS ident value ${o} modified to ${e} to be safe for CSS`),e}function Ph(o){return`'${o.replaceAll(/'/g,"\\000027")}'`}function Nl(o){return o?Co`url('${CSS.escape(_6.uriToBrowserUri(o).toString(!0))}')`:"url('')"}function Ox(o,e=!1){const t=CSS.escape(o);return!e&&t!==o&&console.warn(`CSS class name ${o} modified to ${t} to be safe for CSS`),t}function Co(o,...e){return o.reduce((t,i,n)=>{const s=e[n]||"";return t+i+s},"")}class hA{constructor(){this._parts=[]}push(...e){this._parts.push(...e)}join(e=`
`){return this._parts.join(e)}}function Nme(o){const e=Tme(o);if(e&&e.length>0)return new Uint32Array(e)}let $o=0;const Ah=new Uint32Array(10);function Tme(o){if($o=0,Tl(o,uA,4352),$o>0||(Tl(o,fA,4449),$o>0)||(Tl(o,gA,4520),$o>0)||(Tl(o,rg,12593),$o))return Ah.subarray(0,$o);if(o>=44032&&o<=55203){const e=o-44032,t=e%588,i=Math.floor(e/588),n=Math.floor(t/28),s=t%28-1;if(i<uA.length?Tl(i,uA,0):4352+i-12593<rg.length&&Tl(4352+i,rg,12593),n<fA.length?Tl(n,fA,0):4449+n-12593<rg.length&&Tl(4449+n-12593,rg,12593),s>=0&&(s<gA.length?Tl(s,gA,0):4520+s-12593<rg.length&&Tl(4520+s-12593,rg,12593)),$o>0)return Ah.subarray(0,$o)}}function Tl(o,e,t){o>=t&&o<t+e.length&&Rme(e[o-t])}function Rme(o){o!==0&&(Ah[$o++]=o&255,o>>8&&(Ah[$o++]=o>>8&255),o>>16&&(Ah[$o++]=o>>16&255))}const uA=new Uint8Array([114,82,115,101,69,102,97,113,81,116,84,100,119,87,99,122,120,118,103]),fA=new Uint16Array([107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]),gA=new Uint16Array([114,82,29810,115,30579,26483,101,102,29286,24934,29030,29798,30822,30310,26470,97,113,29809,116,84,100,119,99,122,120,118,103]),rg=new Uint16Array([114,82,29810,115,30579,26483,101,69,102,29286,24934,29030,29798,30822,30310,26470,97,113,81,29809,116,84,100,119,87,99,122,120,118,103,107,111,105,79,106,112,117,80,104,27496,28520,27752,121,110,27246,28782,27758,98,109,27757,108]);function pA(...o){return function(e,t){for(let i=0,n=o.length;i<n;i++){const s=o[i](e,t);if(s)return s}return null}}J$.bind(void 0,!1);const Hv=J$.bind(void 0,!0);function J$(o,e,t){if(!t||t.length<e.length)return null;let i;return o?i=_R(t,e):i=t.indexOf(e)===0,i?e.length>0?[{start:0,end:e.length}]:[]:null}function ej(o,e){const t=e.toLowerCase().indexOf(o.toLowerCase());return t===-1?null:[{start:t,end:t+o.length}]}function tj(o,e){return mA(o.toLowerCase(),e.toLowerCase(),0,0)}function mA(o,e,t,i){if(t===o.length)return[];if(i===e.length)return null;if(o[t]===e[i]){let n=null;return(n=mA(o,e,t+1,i+1))?vA({start:i,end:i+1},n):null}return mA(o,e,t,i+1)}function _A(o){return 97<=o&&o<=122}function Fx(o){return 65<=o&&o<=90}function bA(o){return 48<=o&&o<=57}function ij(o){return o===32||o===9||o===10||o===13}const nj=new Set;"()[]{}<>`'\"-/;:,.?!".split("").forEach(o=>nj.add(o.charCodeAt(0)));function Wx(o){return ij(o)||nj.has(o)}function sj(o,e){return o===e||Wx(o)&&Wx(e)}const CA=new Map;function oj(o){if(CA.has(o))return CA.get(o);let e;const t=Nme(o);return t&&(e=t),CA.set(o,e),e}function rj(o){return _A(o)||Fx(o)||bA(o)}function vA(o,e){return e.length===0?e=[o]:o.end===e[0].start?e[0].start=o.start:e.unshift(o),e}function aj(o,e){for(let t=e;t<o.length;t++){const i=o.charCodeAt(t);if(Fx(i)||bA(i)||t>0&&!rj(o.charCodeAt(t-1)))return t}return o.length}function wA(o,e,t,i){if(t===o.length)return[];if(i===e.length)return null;if(o[t]!==e[i].toLowerCase())return null;{let n=null,s=i+1;for(n=wA(o,e,t+1,i+1);!n&&(s=aj(e,s))<e.length;)n=wA(o,e,t+1,s),s++;return n===null?null:vA({start:i,end:i+1},n)}}function Mme(o){let e=0,t=0,i=0,n=0,s=0;for(let d=0;d<o.length;d++)s=o.charCodeAt(d),Fx(s)&&e++,_A(s)&&t++,rj(s)&&i++,bA(s)&&n++;const r=e/o.length,a=t/o.length,l=i/o.length,c=n/o.length;return{upperPercent:r,lowerPercent:a,alphaPercent:l,numericPercent:c}}function Pme(o){const{upperPercent:e,lowerPercent:t}=o;return t===0&&e>.6}function Ame(o){const{upperPercent:e,lowerPercent:t,alphaPercent:i,numericPercent:n}=o;return t>.2&&e<.8&&i>.6&&n<.2}function Ome(o){let e=0,t=0,i=0,n=0;for(let s=0;s<o.length;s++)i=o.charCodeAt(s),Fx(i)&&e++,_A(i)&&t++,ij(i)&&n++;return(e===0||t===0)&&n===0?o.length<=30:e<=5}function lj(o,e){if(!e||(e=e.trim(),e.length===0)||!Ome(o))return null;e.length>60&&(e=e.substring(0,60));const t=Mme(e);if(!Ame(t)){if(!Pme(t))return null;e=e.toLowerCase()}let i=null,n=0;for(o=o.toLowerCase();n<e.length&&(i=wA(o,e,0,n))===null;)n=aj(e,n+1);return i}function Fme(o,e,t=!1){if(!e||e.length===0)return null;let i=null,n=0;for(o=o.toLowerCase(),e=e.toLowerCase();n<e.length&&(i=SA(o,e,0,n,t),i===null);)n=cj(e,n+1);return i}function SA(o,e,t,i,n){let s=0;if(t===o.length)return[];if(i===e.length)return null;if(!sj(o.charCodeAt(t),e.charCodeAt(i))){const l=oj(o.charCodeAt(t));if(!l)return null;for(let c=0;c<l.length;c++)if(!sj(l[c],e.charCodeAt(i+c)))return null;s+=l.length-1}let r=null,a=i+s+1;if(r=SA(o,e,t+1,a,n),!n)for(;!r&&(a=cj(e,a))<e.length;)r=SA(o,e,t+1,a,n),a++;if(!r)return null;if(o.charCodeAt(t)!==e.charCodeAt(i)){const l=oj(o.charCodeAt(t));if(!l)return r;for(let c=0;c<l.length;c++)if(l[c]!==e.charCodeAt(i+c))return r}return vA({start:i,end:i+s+1},r)}function cj(o,e){for(let t=e;t<o.length;t++)if(Wx(o.charCodeAt(t))||t>0&&Wx(o.charCodeAt(t-1)))return t;return o.length}const Wme=pA(Hv,lj,ej),Bme=pA(Hv,lj,tj),dj=new dl(1e4);function hj(o,e,t=!1){if(typeof o!="string"||typeof e!="string")return null;let i=dj.get(o);i||(i=new RegExp(kie(o),"i"),dj.set(o,i));const n=i.exec(e);return n?[{start:n.index,end:n.index+n[0].length}]:t?Bme(o,e):Wme(o,e)}function Hme(o,e){const t=lg(o,o.toLowerCase(),0,e,e.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return t?Vv(t):null}function Vme(o,e,t,i,n,s){const r=Math.min(13,o.length);for(;t<r;t++){const a=lg(o,e,t,i,n,s,{firstMatchCanBeWeak:!0,boostFullMatch:!0});if(a)return a}return[0,s]}function Vv(o){if(typeof o>"u")return[];const e=[],t=o[1];for(let i=o.length-1;i>1;i--){const n=o[i]+t,s=e[e.length-1];s&&s.end===n?s.end=n+1:e.push({start:n,end:n+1})}return e}const Oh=128;function yA(){const o=[],e=[];for(let t=0;t<=Oh;t++)e[t]=0;for(let t=0;t<=Oh;t++)o.push(e.slice(0));return o}function uj(o){const e=[];for(let t=0;t<=o;t++)e[t]=0;return e}const fj=uj(2*Oh),LA=uj(2*Oh),rd=yA(),ag=yA(),Bx=yA();function Hx(o,e){if(e<0||e>=o.length)return!1;const t=o.codePointAt(e);switch(t){case 95:case 45:case 46:case 32:case 47:case 92:case 39:case 34:case 58:case 36:case 60:case 62:case 40:case 41:case 91:case 93:case 123:case 125:return!0;case void 0:return!1;default:return!!SR(t)}}function gj(o,e){if(e<0||e>=o.length)return!1;switch(o.charCodeAt(e)){case 32:case 9:return!0;default:return!1}}function Vx(o,e,t){return e[o]!==t[o]}function zme(o,e,t,i,n,s,r=!1){for(;e<t&&n<s;)o[e]===i[n]&&(r&&(fj[e]=n),e+=1),n+=1;return e===t}var Jr;(function(o){o.Default=[-100,0];function e(t){return!t||t.length===2&&t[0]===-100&&t[1]===0}o.isDefault=e})(Jr||(Jr={}));const lB=class lB{constructor(e,t){this.firstMatchCanBeWeak=e,this.boostFullMatch=t}};lB.default={boostFullMatch:!0,firstMatchCanBeWeak:!1};let zv=lB;function lg(o,e,t,i,n,s,r=zv.default){const a=o.length>Oh?Oh:o.length,l=i.length>Oh?Oh:i.length;if(t>=a||s>=l||a-t>l-s||!zme(e,t,a,n,s,l,!0))return;Ume(a,l,t,s,e,n);let c=1,d=1,h=t,u=s;const f=[!1];for(c=1,h=t;h<a;c++,h++){const C=fj[h],w=LA[h],v=h+1<a?LA[h+1]:l;for(d=C-s+1,u=C;u<v;d++,u++){let S=Number.MIN_SAFE_INTEGER,L=!1;u<=w&&(S=$me(o,e,h,t,i,n,u,l,s,rd[c-1][d-1]===0,f));let x=0;S!==Number.MIN_SAFE_INTEGER&&(L=!0,x=S+ag[c-1][d-1]);const I=u>C,D=I?ag[c][d-1]+(rd[c][d-1]>0?-5:0):0,R=u>C+1&&rd[c][d-1]>0,F=R?ag[c][d-2]+(rd[c][d-2]>0?-5:0):0;if(R&&(!I||F>=D)&&(!L||F>=x))ag[c][d]=F,Bx[c][d]=3,rd[c][d]=0;else if(I&&(!L||D>=x))ag[c][d]=D,Bx[c][d]=2,rd[c][d]=0;else if(L)ag[c][d]=x,Bx[c][d]=1,rd[c][d]=rd[c-1][d-1]+1;else throw new Error("not possible")}}if(!f[0]&&!r.firstMatchCanBeWeak)return;c--,d--;const g=[ag[c][d],s];let m=0,_=0;for(;c>=1;){let C=d;do{const w=Bx[c][C];if(w===3)C=C-2;else if(w===2)C=C-1;else break}while(C>=1);m>1&&e[t+c-1]===n[s+d-1]&&!Vx(C+s-1,i,n)&&m+1>rd[c][C]&&(C=d),C===d?m++:m=1,_||(_=C),c--,d=C-1,g.push(d)}l-s===a&&r.boostFullMatch&&(g[0]+=2);const b=_-a;return g[0]-=b,g}function Ume(o,e,t,i,n,s){let r=o-1,a=e-1;for(;r>=t&&a>=i;)n[r]===s[a]&&(LA[r]=a,r--),a--}function $me(o,e,t,i,n,s,r,a,l,c,d){if(e[t]!==s[r])return Number.MIN_SAFE_INTEGER;let h=1,u=!1;return r===t-i?h=o[t]===n[r]?7:5:Vx(r,n,s)&&(r===0||!Vx(r-1,n,s))?(h=o[t]===n[r]?7:5,u=!0):Hx(s,r)&&(r===0||!Hx(s,r-1))?h=5:(Hx(s,r-1)||gj(s,r-1))&&(h=5,u=!0),h>1&&t===i&&(d[0]=!0),u||(u=Vx(r,n,s)||Hx(s,r-1)||gj(s,r-1)),t===i?r>l&&(h-=u?3:5):c?h+=u?2:0:h+=u?0:1,r+1===a&&(h-=u?3:5),h}function jme(o,e,t,i,n,s,r){return qme(o,e,t,i,n,s,!0,r)}function qme(o,e,t,i,n,s,r,a){let l=lg(o,e,t,i,n,s,a);if(o.length>=3){const c=Math.min(7,o.length-1);for(let d=t+1;d<c;d++){const h=Kme(o,d);if(h){const u=lg(h,h.toLowerCase(),t,i,n,s,a);u&&(u[0]-=3,(!l||u[0]>l[0])&&(l=u))}}}return l}function Kme(o,e){if(e+1>=o.length)return;const t=o[e],i=o[e+1];if(t!==i)return o.slice(0,e)+i+t+o.slice(e+2)}const Gme="$(",xA=new RegExp(`\\$\\(${ve.iconNameExpression}(?:${ve.iconModifierExpression})?\\)`,"g"),Zme=new RegExp(`(\\\\)?${xA.source}`,"g");function Yme(o){return o.replace(Zme,(e,t)=>t?e:`\\${e}`)}const Xme=new RegExp(`\\\\${xA.source}`,"g");function Qme(o){return o.replace(Xme,e=>`\\${e}`)}const Jme=new RegExp(`(\\s)?(\\\\)?${xA.source}(\\s)?`,"g");function kA(o){return o.indexOf(Gme)===-1?o:o.replace(Jme,(e,t,i,n)=>i?e:t||n||"")}function pj(o){return o?o.replace(/\$\((.*?)\)/g,(e,t)=>` ${t} `).trim():""}const IA=new RegExp(`\\$\\(${ve.iconNameCharacter}+\\)`,"g");function cg(o){IA.lastIndex=0;let e="";const t=[];let i=0;for(;;){const n=IA.lastIndex,s=IA.exec(o),r=o.substring(n,s?.index);if(r.length>0){e+=r;for(let a=0;a<r.length;a++)t.push(i)}if(!s)break;i+=s[0].length}return{text:e,iconOffsets:t}}function Uv(o,e,t=!1){const{text:i,iconOffsets:n}=e;if(!n||n.length===0)return hj(o,i,t);const s=r1(i," "),r=i.length-s.length,a=hj(o,s,t);if(a)for(const l of a){const c=n[l.start+r]+r;l.start+=c,l.end+=c}return a}class qn{constructor(e="",t=!1){if(this.value=e,typeof this.value!="string")throw dr("value");typeof t=="boolean"?(this.isTrusted=t,this.supportThemeIcons=!1,this.supportHtml=!1):(this.isTrusted=t.isTrusted??void 0,this.supportThemeIcons=t.supportThemeIcons??!1,this.supportHtml=t.supportHtml??!1)}appendText(e,t=0){return this.value+=t_e(this.supportThemeIcons?Yme(e):e).replace(/([ \t]+)/g,(i,n)=>"&nbsp;".repeat(n.length)).replace(/\>/gm,"\\>").replace(/\n/g,t===1?`\\
`:`
`),this}appendMarkdown(e){return this.value+=e,this}appendCodeblock(e,t){return this.value+=`
${i_e(t,e)}
`,this}appendLink(e,t,i){return this.value+="[",this.value+=this._escape(t,"]"),this.value+="](",this.value+=this._escape(String(e),")"),i&&(this.value+=` "${this._escape(this._escape(i,'"'),")")}"`),this.value+=")",this}_escape(e,t){const i=new RegExp(oo(t),"g");return e.replace(i,(n,s)=>e.charAt(s-1)!=="\\"?`\\${n}`:n)}}function B_(o){return Rl(o)?!o.value:Array.isArray(o)?o.every(B_):!0}function Rl(o){return o instanceof qn?!0:o&&typeof o=="object"?typeof o.value=="string"&&(typeof o.isTrusted=="boolean"||typeof o.isTrusted=="object"||o.isTrusted===void 0)&&(typeof o.supportThemeIcons=="boolean"||o.supportThemeIcons===void 0):!1}function e_e(o,e){return o===e?!0:!o||!e?!1:o.value===e.value&&o.isTrusted===e.isTrusted&&o.supportThemeIcons===e.supportThemeIcons&&o.supportHtml===e.supportHtml&&(o.baseUri===e.baseUri||!!o.baseUri&&!!e.baseUri&&ch(be.from(o.baseUri),be.from(e.baseUri)))}function t_e(o){return o.replace(/[\\`*_{}[\]()#+\-!~]/g,"\\$&")}function i_e(o,e){const t=o.match(/^`+/gm)?.reduce((n,s)=>n.length>s.length?n:s).length??0,i=t>=3?t+1:3;return[`${"`".repeat(i)}${e}`,o,`${"`".repeat(i)}`].join(`
`)}function zx(o){return o.replace(/"/g,"&quot;")}function DA(o){return o&&o.replace(/\\([\\`*_{}[\]()#+\-.!~])/g,"$1")}function n_e(o){const e=[],t=o.split("|").map(n=>n.trim());o=t[0];const i=t[1];if(i){const n=/height=(\d+)/.exec(i),s=/width=(\d+)/.exec(i),r=n?n[1]:"",a=s?s[1]:"",l=isFinite(parseInt(a)),c=isFinite(parseInt(r));l&&e.push(`width="${a}"`),c&&e.push(`height="${r}"`)}return{href:o,dimensions:e}}function mj(o,...e){return be.from({scheme:we.command,path:o,query:e.length?encodeURIComponent(JSON.stringify(e)):void 0})}class EA{constructor(e){this._prefix=e,this._lastId=0}nextId(){return this._prefix+ ++this._lastId}}const NA=new EA("id#");function TA(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}let dg=TA();function _j(o){dg=o}const bj=/[&<>"']/,s_e=new RegExp(bj.source,"g"),Cj=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,o_e=new RegExp(Cj.source,"g"),r_e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},vj=o=>r_e[o];function Mr(o,e){if(e){if(bj.test(o))return o.replace(s_e,vj)}else if(Cj.test(o))return o.replace(o_e,vj);return o}const a_e=/(^|[^\[])\^/g;function ki(o,e){let t=typeof o=="string"?o:o.source;e=e||"";const i={replace:(n,s)=>{let r=typeof s=="string"?s:s.source;return r=r.replace(a_e,"$1"),t=t.replace(n,r),i},getRegex:()=>new RegExp(t,e)};return i}function wj(o){try{o=encodeURI(o).replace(/%25/g,"%")}catch{return null}return o}const $v={exec:()=>null};function Sj(o,e){const t=o.replace(/\|/g,(s,r,a)=>{let l=!1,c=r;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),i=t.split(/ \|/);let n=0;if(i[0].trim()||i.shift(),i.length>0&&!i[i.length-1].trim()&&i.pop(),e)if(i.length>e)i.splice(e);else for(;i.length<e;)i.push("");for(;n<i.length;n++)i[n]=i[n].trim().replace(/\\\|/g,"|");return i}function jv(o,e,t){const i=o.length;if(i===0)return"";let n=0;for(;n<i&&o.charAt(i-n-1)===e;)n++;return o.slice(0,i-n)}function l_e(o,e){if(o.indexOf(e[1])===-1)return-1;let t=0;for(let i=0;i<o.length;i++)if(o[i]==="\\")i++;else if(o[i]===e[0])t++;else if(o[i]===e[1]&&(t--,t<0))return i;return-1}function yj(o,e,t,i){const n=e.href,s=e.title?Mr(e.title):null,r=o[1].replace(/\\([\[\]])/g,"$1");if(o[0].charAt(0)!=="!"){i.state.inLink=!0;const a={type:"link",raw:t,href:n,title:s,text:r,tokens:i.inlineTokens(r)};return i.state.inLink=!1,a}return{type:"image",raw:t,href:n,title:s,text:Mr(r)}}function c_e(o,e){const t=o.match(/^(\s+)(?:```)/);if(t===null)return e;const i=t[1];return e.split(`
`).map(n=>{const s=n.match(/^\s+/);if(s===null)return n;const[r]=s;return r.length>=i.length?n.slice(i.length):n}).join(`
`)}class Ux{options;rules;lexer;constructor(e){this.options=e||dg}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const i=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?i:jv(i,`
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const i=t[0],n=c_e(i,t[3]||"");return{type:"code",raw:i,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let i=t[2].trim();if(/#$/.test(i)){const n=jv(i,"#");(this.options.pedantic||!n||/ $/.test(n))&&(i=n.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:i,tokens:this.lexer.inline(i)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:jv(t[0],`
`)}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){let i=jv(t[0],`
`).split(`
`),n="",s="";const r=[];for(;i.length>0;){let a=!1;const l=[];let c;for(c=0;c<i.length;c++)if(/^ {0,3}>/.test(i[c]))l.push(i[c]),a=!0;else if(!a)l.push(i[c]);else break;i=i.slice(c);const d=l.join(`
`),h=d.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
$1`).replace(/^ {0,3}>[ \t]?/gm,"");n=n?`${n}
${d}`:d,s=s?`${s}
${h}`:h;const u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(h,r,!0),this.lexer.state.top=u,i.length===0)break;const f=r[r.length-1];if(f?.type==="code")break;if(f?.type==="blockquote"){const g=f,m=g.raw+`
`+i.join(`
`),_=this.blockquote(m);r[r.length-1]=_,n=n.substring(0,n.length-g.raw.length)+_.raw,s=s.substring(0,s.length-g.text.length)+_.text;break}else if(f?.type==="list"){const g=f,m=g.raw+`
`+i.join(`
`),_=this.list(m);r[r.length-1]=_,n=n.substring(0,n.length-f.raw.length)+_.raw,s=s.substring(0,s.length-g.raw.length)+_.raw,i=m.substring(r[r.length-1].raw.length).split(`
`);continue}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let i=t[1].trim();const n=i.length>1,s={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");const r=new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`);let a=!1;for(;e;){let l=!1,c="",d="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;c=t[0],e=e.substring(c.length);let h=t[2].split(`
`,1)[0].replace(/^\t+/,b=>" ".repeat(3*b.length)),u=e.split(`
`,1)[0],f=!h.trim(),g=0;if(this.options.pedantic?(g=2,d=h.trimStart()):f?g=t[1].length+1:(g=t[2].search(/[^ ]/),g=g>4?1:g,d=h.slice(g),g+=t[1].length),f&&/^ *$/.test(u)&&(c+=u+`
`,e=e.substring(u.length+1),l=!0),!l){const b=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),C=new RegExp(`^ {0,${Math.min(3,g-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),w=new RegExp(`^ {0,${Math.min(3,g-1)}}(?:\`\`\`|~~~)`),v=new RegExp(`^ {0,${Math.min(3,g-1)}}#`);for(;e;){const S=e.split(`
`,1)[0];if(u=S,this.options.pedantic&&(u=u.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),w.test(u)||v.test(u)||b.test(u)||C.test(e))break;if(u.search(/[^ ]/)>=g||!u.trim())d+=`
`+u.slice(g);else{if(f||h.search(/[^ ]/)>=4||w.test(h)||v.test(h)||C.test(h))break;d+=`
`+u}!f&&!u.trim()&&(f=!0),c+=S+`
`,e=e.substring(S.length+1),h=u.slice(g)}}s.loose||(a?s.loose=!0:/\n *\n *$/.test(c)&&(a=!0));let m=null,_;this.options.gfm&&(m=/^\[[ xX]\] /.exec(d),m&&(_=m[0]!=="[ ] ",d=d.replace(/^\[[ xX]\] +/,""))),s.items.push({type:"list_item",raw:c,task:!!m,checked:_,loose:!1,text:d,tokens:[]}),s.raw+=c}s.items[s.items.length-1].raw=s.items[s.items.length-1].raw.trimEnd(),s.items[s.items.length-1].text=s.items[s.items.length-1].text.trimEnd(),s.raw=s.raw.trimEnd();for(let l=0;l<s.items.length;l++)if(this.lexer.state.top=!1,s.items[l].tokens=this.lexer.blockTokens(s.items[l].text,[]),!s.loose){const c=s.items[l].tokens.filter(h=>h.type==="space"),d=c.length>0&&c.some(h=>/\n.*\n/.test(h.raw));s.loose=d}if(s.loose)for(let l=0;l<s.items.length;l++)s.items[l].loose=!0;return s}}html(e){const t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){const t=this.rules.block.def.exec(e);if(t){const i=t[1].toLowerCase().replace(/\s+/g," "),n=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:i,raw:t[0],href:n,title:s}}}table(e){const t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;const i=Sj(t[1]),n=t[2].replace(/^\||\| *$/g,"").split("|"),s=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
`):[],r={type:"table",raw:t[0],header:[],align:[],rows:[]};if(i.length===n.length){for(const a of n)/^ *-+: *$/.test(a)?r.align.push("right"):/^ *:-+: *$/.test(a)?r.align.push("center"):/^ *:-+ *$/.test(a)?r.align.push("left"):r.align.push(null);for(let a=0;a<i.length;a++)r.header.push({text:i[a],tokens:this.lexer.inline(i[a]),header:!0,align:r.align[a]});for(const a of s)r.rows.push(Sj(a,r.header.length).map((l,c)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:r.align[c]})));return r}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const i=t[1].charAt(t[1].length-1)===`
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:i,tokens:this.lexer.inline(i)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Mr(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const i=t[2].trim();if(!this.options.pedantic&&/^</.test(i)){if(!/>$/.test(i))return;const r=jv(i.slice(0,-1),"\\");if((i.length-r.length)%2===0)return}else{const r=l_e(t[2],"()");if(r>-1){const l=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const r=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);r&&(n=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(this.options.pedantic&&!/>$/.test(i)?n=n.slice(1):n=n.slice(1,-1)),yj(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer)}}reflink(e,t){let i;if((i=this.rules.inline.reflink.exec(e))||(i=this.rules.inline.nolink.exec(e))){const n=(i[2]||i[1]).replace(/\s+/g," "),s=t[n.toLowerCase()];if(!s){const r=i[0].charAt(0);return{type:"text",raw:r,text:r}}return yj(i,s,i[0],this.lexer)}}emStrong(e,t,i=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!n||n[3]&&i.match(/[\p{L}\p{N}]/u))return;if(!(n[1]||n[2]||"")||!i||this.rules.inline.punctuation.exec(i)){const r=[...n[0]].length-1;let a,l,c=r,d=0;const h=n[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*e.length+r);(n=h.exec(t))!=null;){if(a=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!a)continue;if(l=[...a].length,n[3]||n[4]){c+=l;continue}else if((n[5]||n[6])&&r%3&&!((r+l)%3)){d+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+d);const u=[...n[0]][0].length,f=e.slice(0,r+n.index+u+l);if(Math.min(r,l)%2){const m=f.slice(1,-1);return{type:"em",raw:f,text:m,tokens:this.lexer.inlineTokens(m)}}const g=f.slice(2,-2);return{type:"strong",raw:f,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let i=t[2].replace(/\n/g," ");const n=/[^ ]/.test(i),s=/^ /.test(i)&&/ $/.test(i);return n&&s&&(i=i.substring(1,i.length-1)),i=Mr(i,!0),{type:"codespan",raw:t[0],text:i}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){const t=this.rules.inline.autolink.exec(e);if(t){let i,n;return t[2]==="@"?(i=Mr(t[1]),n="mailto:"+i):(i=Mr(t[1]),n=i),{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let i,n;if(t[2]==="@")i=Mr(t[0]),n="mailto:"+i;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);i=Mr(t[0]),t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:i,href:n,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e){const t=this.rules.inline.text.exec(e);if(t){let i;return this.lexer.state.inRawBlock?i=t[0]:i=Mr(t[0]),{type:"text",raw:t[0],text:i}}}}const d_e=/^(?: *(?:\n|$))+/,h_e=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,u_e=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,qv=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,f_e=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Lj=/(?:[*+-]|\d{1,9}[.)])/,xj=ki(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Lj).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),RA=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,g_e=/^[^\n]+/,MA=/(?!\s*\])(?:\\.|[^\[\]\\])+/,p_e=ki(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label",MA).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),m_e=ki(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Lj).getRegex(),$x="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",PA=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,__e=ki("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))","i").replace("comment",PA).replace("tag",$x).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),kj=ki(RA).replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$x).getRegex(),AA={blockquote:ki(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",kj).getRegex(),code:h_e,def:p_e,fences:u_e,heading:f_e,hr:qv,html:__e,lheading:xj,list:m_e,newline:d_e,paragraph:kj,table:$v,text:g_e},Ij=ki("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$x).getRegex(),b_e={...AA,table:Ij,paragraph:ki(RA).replace("hr",qv).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",Ij).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$x).getRegex()},C_e={...AA,html:ki(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",PA).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:$v,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ki(RA).replace("hr",qv).replace("heading",` *#{1,6} *[^
]`).replace("lheading",xj).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Dj=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,v_e=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Ej=/^( {2,}|\\)\n(?!\s*$)/,w_e=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Kv="\\p{P}\\p{S}",S_e=ki(/^((?![*_])[\spunctuation])/,"u").replace(/punctuation/g,Kv).getRegex(),y_e=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,L_e=ki(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,"u").replace(/punct/g,Kv).getRegex(),x_e=ki("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])","gu").replace(/punct/g,Kv).getRegex(),k_e=ki("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])","gu").replace(/punct/g,Kv).getRegex(),I_e=ki(/\\([punct])/,"gu").replace(/punct/g,Kv).getRegex(),D_e=ki(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),E_e=ki(PA).replace("(?:-->|$)","-->").getRegex(),N_e=ki("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",E_e).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),jx=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,T_e=ki(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",jx).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Nj=ki(/^!?\[(label)\]\[(ref)\]/).replace("label",jx).replace("ref",MA).getRegex(),Tj=ki(/^!?\[(ref)\](?:\[\])?/).replace("ref",MA).getRegex(),R_e=ki("reflink|nolink(?!\\()","g").replace("reflink",Nj).replace("nolink",Tj).getRegex(),OA={_backpedal:$v,anyPunctuation:I_e,autolink:D_e,blockSkip:y_e,br:Ej,code:v_e,del:$v,emStrongLDelim:L_e,emStrongRDelimAst:x_e,emStrongRDelimUnd:k_e,escape:Dj,link:T_e,nolink:Tj,punctuation:S_e,reflink:Nj,reflinkSearch:R_e,tag:N_e,text:w_e,url:$v},M_e={...OA,link:ki(/^!?\[(label)\]\((.*?)\)/).replace("label",jx).getRegex(),reflink:ki(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",jx).getRegex()},FA={...OA,escape:ki(Dj).replace("])","~|])").getRegex(),url:ki(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},P_e={...FA,br:ki(Ej).replace("{2,}","*").getRegex(),text:ki(FA.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},qx={normal:AA,gfm:b_e,pedantic:C_e},Gv={normal:OA,gfm:FA,breaks:P_e,pedantic:M_e};class Ml{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||dg,this.options.tokenizer=this.options.tokenizer||new Ux,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:qx.normal,inline:Gv.normal};this.options.pedantic?(t.block=qx.pedantic,t.inline=Gv.pedantic):this.options.gfm&&(t.block=qx.gfm,this.options.breaks?t.inline=Gv.breaks:t.inline=Gv.gfm),this.tokenizer.rules=t}static get rules(){return{block:qx,inline:Gv}}static lex(e,t){return new Ml(t).lex(e)}static lexInline(e,t){return new Ml(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const i=this.inlineQueue[t];this.inlineTokens(i.src,i.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],i=!1){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(a,l,c)=>l+" ".repeat(c.length));let n,s,r;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(a=>(n=a.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
`+n.raw,s.text+=`
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&(s.type==="paragraph"||s.type==="text")?(s.raw+=`
`+n.raw,s.text+=`
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(r=e,this.options.extensions&&this.options.extensions.startBlock){let a=1/0;const l=e.slice(1);let c;this.options.extensions.startBlock.forEach(d=>{c=d.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(r=e.substring(0,a+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r))){s=t[t.length-1],i&&s?.type==="paragraph"?(s.raw+=`
`+n.raw,s.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),s=t[t.length-1],s&&s.type==="text"?(s.raw+=`
`+n.raw,s.text+=`
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);continue}if(e){const a="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(a);break}else throw new Error(a)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let i,n,s,r=e,a,l,c;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(a=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)d.includes(a[0].slice(a[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(a=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,a.index)+"["+"a".repeat(a[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(a=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,a.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(l||(c=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(i=d.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))){if(i=this.tokenizer.escape(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.tag(e)){e=e.substring(i.raw.length),n=t[t.length-1],n&&i.type==="text"&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(i=this.tokenizer.link(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(i.raw.length),n=t[t.length-1],n&&i.type==="text"&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(i=this.tokenizer.emStrong(e,r,c)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.codespan(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.br(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.del(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.autolink(e)){e=e.substring(i.raw.length),t.push(i);continue}if(!this.state.inLink&&(i=this.tokenizer.url(e))){e=e.substring(i.raw.length),t.push(i);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const h=e.slice(1);let u;this.options.extensions.startInline.forEach(f=>{u=f.call({lexer:this},h),typeof u=="number"&&u>=0&&(d=Math.min(d,u))}),d<1/0&&d>=0&&(s=e.substring(0,d+1))}if(i=this.tokenizer.inlineText(s)){e=e.substring(i.raw.length),i.raw.slice(-1)!=="_"&&(c=i.raw.slice(-1)),l=!0,n=t[t.length-1],n&&n.type==="text"?(n.raw+=i.raw,n.text+=i.text):t.push(i);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}}class Zv{options;parser;constructor(e){this.options=e||dg}space(e){return""}code({text:e,lang:t,escaped:i}){const n=(t||"").match(/^\S*/)?.[0],s=e.replace(/\n$/,"")+`
`;return n?'<pre><code class="language-'+Mr(n)+'">'+(i?s:Mr(s,!0))+`</code></pre>
`:"<pre><code>"+(i?s:Mr(s,!0))+`</code></pre>
`}blockquote({tokens:e}){return`<blockquote>
${this.parser.parse(e)}</blockquote>
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
`}hr(e){return`<hr>
`}list(e){const t=e.ordered,i=e.start;let n="";for(let a=0;a<e.items.length;a++){const l=e.items[a];n+=this.listitem(l)}const s=t?"ol":"ul",r=t&&i!==1?' start="'+i+'"':"";return"<"+s+r+`>
`+n+"</"+s+`>
`}listitem(e){let t="";if(e.task){const i=this.checkbox({checked:!!e.checked});e.loose?e.tokens.length>0&&e.tokens[0].type==="paragraph"?(e.tokens[0].text=i+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=i+" "+e.tokens[0].tokens[0].text)):e.tokens.unshift({type:"text",raw:i+" ",text:i+" "}):t+=i+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`<li>${t}</li>
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
`}table(e){let t="",i="";for(let s=0;s<e.header.length;s++)i+=this.tablecell(e.header[s]);t+=this.tablerow({text:i});let n="";for(let s=0;s<e.rows.length;s++){const r=e.rows[s];i="";for(let a=0;a<r.length;a++)i+=this.tablecell(r[a]);n+=this.tablerow({text:i})}return n&&(n=`<tbody>${n}</tbody>`),`<table>
<thead>
`+t+`</thead>
`+n+`</table>
`}tablerow({text:e}){return`<tr>
${e}</tr>
`}tablecell(e){const t=this.parser.parseInline(e.tokens),i=e.header?"th":"td";return(e.align?`<${i} align="${e.align}">`:`<${i}>`)+t+`</${i}>
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${e}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:i}){const n=this.parser.parseInline(i),s=wj(e);if(s===null)return n;e=s;let r='<a href="'+e+'"';return t&&(r+=' title="'+t+'"'),r+=">"+n+"</a>",r}image({href:e,title:t,text:i}){const n=wj(e);if(n===null)return i;e=n;let s=`<img src="${e}" alt="${i}"`;return t&&(s+=` title="${t}"`),s+=">",s}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):e.text}}class WA{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}}class Pl{options;renderer;textRenderer;constructor(e){this.options=e||dg,this.options.renderer=this.options.renderer||new Zv,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new WA}static parse(e,t){return new Pl(t).parse(e)}static parseInline(e,t){return new Pl(t).parseInline(e)}parse(e,t=!0){let i="";for(let n=0;n<e.length;n++){const s=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=s,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){i+=l||"";continue}}const r=s;switch(r.type){case"space":{i+=this.renderer.space(r);continue}case"hr":{i+=this.renderer.hr(r);continue}case"heading":{i+=this.renderer.heading(r);continue}case"code":{i+=this.renderer.code(r);continue}case"table":{i+=this.renderer.table(r);continue}case"blockquote":{i+=this.renderer.blockquote(r);continue}case"list":{i+=this.renderer.list(r);continue}case"html":{i+=this.renderer.html(r);continue}case"paragraph":{i+=this.renderer.paragraph(r);continue}case"text":{let a=r,l=this.renderer.text(a);for(;n+1<e.length&&e[n+1].type==="text";)a=e[++n],l+=`
`+this.renderer.text(a);t?i+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l}]}):i+=l;continue}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}parseInline(e,t){t=t||this.renderer;let i="";for(let n=0;n<e.length;n++){const s=e[n];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]){const a=this.options.extensions.renderers[s.type].call({parser:this},s);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)){i+=a||"";continue}}const r=s;switch(r.type){case"escape":{i+=t.text(r);break}case"html":{i+=t.html(r);break}case"link":{i+=t.link(r);break}case"image":{i+=t.image(r);break}case"strong":{i+=t.strong(r);break}case"em":{i+=t.em(r);break}case"codespan":{i+=t.codespan(r);break}case"br":{i+=t.br(r);break}case"del":{i+=t.del(r);break}case"text":{i+=t.text(r);break}default:{const a='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return i}}class Kx{options;constructor(e){this.options=e||dg}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}}class Rj{defaults=TA();options=this.setOptions;parse=this.parseMarkdown(Ml.lex,Pl.parse);parseInline=this.parseMarkdown(Ml.lexInline,Pl.parseInline);Parser=Pl;Renderer=Zv;TextRenderer=WA;Lexer=Ml;Tokenizer=Ux;Hooks=Kx;constructor(...e){this.use(...e)}walkTokens(e,t){let i=[];for(const n of e)switch(i=i.concat(t.call(this,n)),n.type){case"table":{const s=n;for(const r of s.header)i=i.concat(this.walkTokens(r.tokens,t));for(const r of s.rows)for(const a of r)i=i.concat(this.walkTokens(a.tokens,t));break}case"list":{const s=n;i=i.concat(this.walkTokens(s.items,t));break}default:{const s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(r=>{const a=s[r].flat(1/0);i=i.concat(this.walkTokens(a,t))}):s.tokens&&(i=i.concat(this.walkTokens(s.tokens,t)))}}return i}use(...e){const t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(i=>{const n={...i};if(n.async=this.defaults.async||n.async||!1,i.extensions&&(i.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const r=t.renderers[s.name];r?t.renderers[s.name]=function(...a){let l=s.renderer.apply(this,a);return l===!1&&(l=r.apply(this,a)),l}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const r=t[s.level];r?r.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),i.renderer){const s=this.defaults.renderer||new Zv(this.defaults);for(const r in i.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;const a=r,l=i.renderer[a],c=s[a];s[a]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=c.apply(s,d)),h||""}}n.renderer=s}if(i.tokenizer){const s=this.defaults.tokenizer||new Ux(this.defaults);for(const r in i.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;const a=r,l=i.tokenizer[a],c=s[a];s[a]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=c.apply(s,d)),h}}n.tokenizer=s}if(i.hooks){const s=this.defaults.hooks||new Kx;for(const r in i.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(r==="options")continue;const a=r,l=i.hooks[a],c=s[a];Kx.passThroughHooks.has(r)?s[a]=d=>{if(this.defaults.async)return Promise.resolve(l.call(s,d)).then(u=>c.call(s,u));const h=l.call(s,d);return c.call(s,h)}:s[a]=(...d)=>{let h=l.apply(s,d);return h===!1&&(h=c.apply(s,d)),h}}n.hooks=s}if(i.walkTokens){const s=this.defaults.walkTokens,r=i.walkTokens;n.walkTokens=function(a){let l=[];return l.push(r.call(this,a)),s&&(l=l.concat(s.call(this,a))),l}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ml.lex(e,t??this.defaults)}parser(e,t){return Pl.parse(e,t??this.defaults)}parseMarkdown(e,t){return(n,s)=>{const r={...s},a={...this.defaults,...r},l=this.onError(!!a.silent,!!a.async);if(this.defaults.async===!0&&r.async===!1)return l(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return l(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return l(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(c=>e(c,a)).then(c=>a.hooks?a.hooks.processAllTokens(c):c).then(c=>a.walkTokens?Promise.all(this.walkTokens(c,a.walkTokens)).then(()=>c):c).then(c=>t(c,a)).then(c=>a.hooks?a.hooks.postprocess(c):c).catch(l);try{a.hooks&&(n=a.hooks.preprocess(n));let c=e(n,a);a.hooks&&(c=a.hooks.processAllTokens(c)),a.walkTokens&&this.walkTokens(c,a.walkTokens);let d=t(c,a);return a.hooks&&(d=a.hooks.postprocess(d)),d}catch(c){return l(c)}}}onError(e,t){return i=>{if(i.message+=`
Please report this to https://github.com/markedjs/marked.`,e){const n="<p>An error occurred:</p><pre>"+Mr(i.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(i);throw i}}}const hg=new Rj;function wi(o,e){return hg.parse(o,e)}wi.options=wi.setOptions=function(o){return hg.setOptions(o),wi.defaults=hg.defaults,_j(wi.defaults),wi},wi.getDefaults=TA,wi.defaults=dg,wi.use=function(...o){return hg.use(...o),wi.defaults=hg.defaults,_j(wi.defaults),wi},wi.walkTokens=function(o,e){return hg.walkTokens(o,e)},wi.parseInline=hg.parseInline,wi.Parser=Pl,wi.parser=Pl.parse,wi.Renderer=Zv,wi.TextRenderer=WA,wi.Lexer=Ml,wi.lexer=Ml.lex,wi.Tokenizer=Ux,wi.Hooks=Kx,wi.parse=wi,wi.options,wi.setOptions,wi.use,wi.walkTokens,wi.parseInline;const A_e=wi;Pl.parse;const Yv=Ml.lex;function O_e(o){return JSON.stringify(o,F_e)}function BA(o){let e=JSON.parse(o);return e=HA(e),e}function F_e(o,e){return e instanceof RegExp?{$mid:2,source:e.source,flags:e.flags}:e}function HA(o,e=0){if(!o||e>200)return o;if(typeof o=="object"){switch(o.$mid){case 1:return be.revive(o);case 2:return new RegExp(o.source,o.flags);case 17:return new Date(o.source)}if(o instanceof sh||o instanceof Uint8Array)return o;if(Array.isArray(o))for(let t=0;t<o.length;++t)o[t]=HA(o[t],e+1);else for(const t in o)Object.hasOwnProperty.call(o,t)&&(o[t]=HA(o[t],e+1))}return o}/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */const{entries:Mj,setPrototypeOf:Pj,isFrozen:W_e,getPrototypeOf:B_e,getOwnPropertyDescriptor:H_e}=Object;let{freeze:vo,seal:ea,create:Aj}=Object,{apply:VA,construct:zA}=typeof Reflect<"u"&&Reflect;vo||(vo=function(e){return e}),ea||(ea=function(e){return e}),VA||(VA=function(e,t,i){return e.apply(t,i)}),zA||(zA=function(e,t){return new e(...t)});const Gx=Pr(Array.prototype.forEach),Oj=Pr(Array.prototype.pop),Xv=Pr(Array.prototype.push),Zx=Pr(String.prototype.toLowerCase),UA=Pr(String.prototype.toString),Fj=Pr(String.prototype.match),Qv=Pr(String.prototype.replace),V_e=Pr(String.prototype.indexOf),z_e=Pr(String.prototype.trim),Oa=Pr(Object.prototype.hasOwnProperty),wo=Pr(RegExp.prototype.test),Jv=U_e(TypeError);function Pr(o){return function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];return VA(o,e,i)}}function U_e(o){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return zA(o,t)}}function Nt(o,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Zx;Pj&&Pj(o,null);let i=e.length;for(;i--;){let n=e[i];if(typeof n=="string"){const s=t(n);s!==n&&(W_e(e)||(e[i]=s),n=s)}o[n]=!0}return o}function $_e(o){for(let e=0;e<o.length;e++)Oa(o,e)||(o[e]=null);return o}function ug(o){const e=Aj(null);for(const[t,i]of Mj(o))Oa(o,t)&&(Array.isArray(i)?e[t]=$_e(i):i&&typeof i=="object"&&i.constructor===Object?e[t]=ug(i):e[t]=i);return e}function ew(o,e){for(;o!==null;){const i=H_e(o,e);if(i){if(i.get)return Pr(i.get);if(typeof i.value=="function")return Pr(i.value)}o=B_e(o)}function t(){return null}return t}const Wj=vo(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),$A=vo(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),jA=vo(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),j_e=vo(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),qA=vo(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),q_e=vo(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Bj=vo(["#text"]),Hj=vo(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),KA=vo(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Vj=vo(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Yx=vo(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),K_e=ea(/\{\{[\w\W]*|[\w\W]*\}\}/gm),G_e=ea(/<%[\w\W]*|[\w\W]*%>/gm),Z_e=ea(/\${[\w\W]*}/gm),Y_e=ea(/^data-[\-\w.\u00B7-\uFFFF]/),X_e=ea(/^aria-[\-\w]+$/),zj=ea(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Q_e=ea(/^(?:\w+script|data):/i),J_e=ea(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Uj=ea(/^html$/i),ebe=ea(/^[a-z][.\w]*(-[.\w]+)+$/i);var $j=Object.freeze({__proto__:null,MUSTACHE_EXPR:K_e,ERB_EXPR:G_e,TMPLIT_EXPR:Z_e,DATA_ATTR:Y_e,ARIA_ATTR:X_e,IS_ALLOWED_URI:zj,IS_SCRIPT_OR_DATA:Q_e,ATTR_WHITESPACE:J_e,DOCTYPE_NAME:Uj,CUSTOM_ELEMENT:ebe});const tw={element:1,text:3,progressingInstruction:7,comment:8,document:9},tbe=function(){return typeof window>"u"?null:window},ibe=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let i=null;const n="data-tt-policy-suffix";t&&t.hasAttribute(n)&&(i=t.getAttribute(n));const s="dompurify"+(i?"#"+i:"");try{return e.createPolicy(s,{createHTML(r){return r},createScriptURL(r){return r}})}catch{return console.warn("TrustedTypes policy "+s+" could not be created."),null}};function jj(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tbe();const e=Ge=>jj(Ge);if(e.version="3.1.7",e.removed=[],!o||!o.document||o.document.nodeType!==tw.document)return e.isSupported=!1,e;let{document:t}=o;const i=t,n=i.currentScript,{DocumentFragment:s,HTMLTemplateElement:r,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=o.NamedNodeMap||o.MozNamedAttrMap,HTMLFormElement:h,DOMParser:u,trustedTypes:f}=o,g=l.prototype,m=ew(g,"cloneNode"),_=ew(g,"remove"),b=ew(g,"nextSibling"),C=ew(g,"childNodes"),w=ew(g,"parentNode");if(typeof r=="function"){const Ge=t.createElement("template");Ge.content&&Ge.content.ownerDocument&&(t=Ge.content.ownerDocument)}let v,S="";const{implementation:L,createNodeIterator:x,createDocumentFragment:I,getElementsByTagName:D}=t,{importNode:R}=i;let F={};e.isSupported=typeof Mj=="function"&&typeof w=="function"&&L&&L.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:B,TMPLIT_EXPR:V,DATA_ATTR:z,ARIA_ATTR:ee,IS_SCRIPT_OR_DATA:se,ATTR_WHITESPACE:oe,CUSTOM_ELEMENT:fe}=$j;let{IS_ALLOWED_URI:Ie}=$j,Ae=null;const tt=Nt({},[...Wj,...$A,...jA,...qA,...Bj]);let Ke=null;const At=Nt({},[...Hj,...KA,...Vj,...Yx]);let _t=Object.seal(Aj(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),tn=null,Mi=null,As=!0,zS=!0,AT=!1,rte=!0,zC=!1,_B=!0,xm=!1,bB=!1,CB=!1,UC=!1,OT=!1,FT=!1,ate=!0,lte=!1;const e5e="user-content-";let vB=!0,US=!1,$C={},jC=null;const cte=Nt({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let dte=null;const hte=Nt({},["audio","video","img","source","image","track"]);let wB=null;const ute=Nt({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),WT="http://www.w3.org/1998/Math/MathML",BT="http://www.w3.org/2000/svg",Zd="http://www.w3.org/1999/xhtml";let qC=Zd,SB=!1,yB=null;const t5e=Nt({},[WT,BT,Zd],UA);let $S=null;const i5e=["application/xhtml+xml","text/html"],n5e="text/html";let fs=null,KC=null;const s5e=t.createElement("form"),fte=function(G){return G instanceof RegExp||G instanceof Function},LB=function(){let G=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(KC&&KC===G)){if((!G||typeof G!="object")&&(G={}),G=ug(G),$S=i5e.indexOf(G.PARSER_MEDIA_TYPE)===-1?n5e:G.PARSER_MEDIA_TYPE,fs=$S==="application/xhtml+xml"?UA:Zx,Ae=Oa(G,"ALLOWED_TAGS")?Nt({},G.ALLOWED_TAGS,fs):tt,Ke=Oa(G,"ALLOWED_ATTR")?Nt({},G.ALLOWED_ATTR,fs):At,yB=Oa(G,"ALLOWED_NAMESPACES")?Nt({},G.ALLOWED_NAMESPACES,UA):t5e,wB=Oa(G,"ADD_URI_SAFE_ATTR")?Nt(ug(ute),G.ADD_URI_SAFE_ATTR,fs):ute,dte=Oa(G,"ADD_DATA_URI_TAGS")?Nt(ug(hte),G.ADD_DATA_URI_TAGS,fs):hte,jC=Oa(G,"FORBID_CONTENTS")?Nt({},G.FORBID_CONTENTS,fs):cte,tn=Oa(G,"FORBID_TAGS")?Nt({},G.FORBID_TAGS,fs):{},Mi=Oa(G,"FORBID_ATTR")?Nt({},G.FORBID_ATTR,fs):{},$C=Oa(G,"USE_PROFILES")?G.USE_PROFILES:!1,As=G.ALLOW_ARIA_ATTR!==!1,zS=G.ALLOW_DATA_ATTR!==!1,AT=G.ALLOW_UNKNOWN_PROTOCOLS||!1,rte=G.ALLOW_SELF_CLOSE_IN_ATTR!==!1,zC=G.SAFE_FOR_TEMPLATES||!1,_B=G.SAFE_FOR_XML!==!1,xm=G.WHOLE_DOCUMENT||!1,UC=G.RETURN_DOM||!1,OT=G.RETURN_DOM_FRAGMENT||!1,FT=G.RETURN_TRUSTED_TYPE||!1,CB=G.FORCE_BODY||!1,ate=G.SANITIZE_DOM!==!1,lte=G.SANITIZE_NAMED_PROPS||!1,vB=G.KEEP_CONTENT!==!1,US=G.IN_PLACE||!1,Ie=G.ALLOWED_URI_REGEXP||zj,qC=G.NAMESPACE||Zd,_t=G.CUSTOM_ELEMENT_HANDLING||{},G.CUSTOM_ELEMENT_HANDLING&&fte(G.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(_t.tagNameCheck=G.CUSTOM_ELEMENT_HANDLING.tagNameCheck),G.CUSTOM_ELEMENT_HANDLING&&fte(G.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(_t.attributeNameCheck=G.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),G.CUSTOM_ELEMENT_HANDLING&&typeof G.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(_t.allowCustomizedBuiltInElements=G.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),zC&&(zS=!1),OT&&(UC=!0),$C&&(Ae=Nt({},Bj),Ke=[],$C.html===!0&&(Nt(Ae,Wj),Nt(Ke,Hj)),$C.svg===!0&&(Nt(Ae,$A),Nt(Ke,KA),Nt(Ke,Yx)),$C.svgFilters===!0&&(Nt(Ae,jA),Nt(Ke,KA),Nt(Ke,Yx)),$C.mathMl===!0&&(Nt(Ae,qA),Nt(Ke,Vj),Nt(Ke,Yx))),G.ADD_TAGS&&(Ae===tt&&(Ae=ug(Ae)),Nt(Ae,G.ADD_TAGS,fs)),G.ADD_ATTR&&(Ke===At&&(Ke=ug(Ke)),Nt(Ke,G.ADD_ATTR,fs)),G.ADD_URI_SAFE_ATTR&&Nt(wB,G.ADD_URI_SAFE_ATTR,fs),G.FORBID_CONTENTS&&(jC===cte&&(jC=ug(jC)),Nt(jC,G.FORBID_CONTENTS,fs)),vB&&(Ae["#text"]=!0),xm&&Nt(Ae,["html","head","body"]),Ae.table&&(Nt(Ae,["tbody"]),delete tn.tbody),G.TRUSTED_TYPES_POLICY){if(typeof G.TRUSTED_TYPES_POLICY.createHTML!="function")throw Jv('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof G.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Jv('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');v=G.TRUSTED_TYPES_POLICY,S=v.createHTML("")}else v===void 0&&(v=ibe(f,n)),v!==null&&typeof S=="string"&&(S=v.createHTML(""));vo&&vo(G),KC=G}},gte=Nt({},["mi","mo","mn","ms","mtext"]),pte=Nt({},["annotation-xml"]),o5e=Nt({},["title","style","font","a","script"]),mte=Nt({},[...$A,...jA,...j_e]),_te=Nt({},[...qA,...q_e]),r5e=function(G){let ye=w(G);(!ye||!ye.tagName)&&(ye={namespaceURI:qC,tagName:"template"});const $e=Zx(G.tagName),Wi=Zx(ye.tagName);return yB[G.namespaceURI]?G.namespaceURI===BT?ye.namespaceURI===Zd?$e==="svg":ye.namespaceURI===WT?$e==="svg"&&(Wi==="annotation-xml"||gte[Wi]):!!mte[$e]:G.namespaceURI===WT?ye.namespaceURI===Zd?$e==="math":ye.namespaceURI===BT?$e==="math"&&pte[Wi]:!!_te[$e]:G.namespaceURI===Zd?ye.namespaceURI===BT&&!pte[Wi]||ye.namespaceURI===WT&&!gte[Wi]?!1:!_te[$e]&&(o5e[$e]||!mte[$e]):!!($S==="application/xhtml+xml"&&yB[G.namespaceURI]):!1},mc=function(G){Xv(e.removed,{element:G});try{w(G).removeChild(G)}catch{_(G)}},HT=function(G,ye){try{Xv(e.removed,{attribute:ye.getAttributeNode(G),from:ye})}catch{Xv(e.removed,{attribute:null,from:ye})}if(ye.removeAttribute(G),G==="is"&&!Ke[G])if(UC||OT)try{mc(ye)}catch{}else try{ye.setAttribute(G,"")}catch{}},bte=function(G){let ye=null,$e=null;if(CB)G="<remove></remove>"+G;else{const Os=Fj(G,/^[\r\n\t ]+/);$e=Os&&Os[0]}$S==="application/xhtml+xml"&&qC===Zd&&(G='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+G+"</body></html>");const Wi=v?v.createHTML(G):G;if(qC===Zd)try{ye=new u().parseFromString(Wi,$S)}catch{}if(!ye||!ye.documentElement){ye=L.createDocument(qC,"template",null);try{ye.documentElement.innerHTML=SB?S:Wi}catch{}}const no=ye.body||ye.documentElement;return G&&$e&&no.insertBefore(t.createTextNode($e),no.childNodes[0]||null),qC===Zd?D.call(ye,xm?"html":"body")[0]:xm?ye.documentElement:no},Cte=function(G){return x.call(G.ownerDocument||G,G,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},vte=function(G){return G instanceof h&&(typeof G.nodeName!="string"||typeof G.textContent!="string"||typeof G.removeChild!="function"||!(G.attributes instanceof d)||typeof G.removeAttribute!="function"||typeof G.setAttribute!="function"||typeof G.namespaceURI!="string"||typeof G.insertBefore!="function"||typeof G.hasChildNodes!="function")},wte=function(G){return typeof a=="function"&&G instanceof a},Yd=function(G,ye,$e){F[G]&&Gx(F[G],Wi=>{Wi.call(e,ye,$e,KC)})},Ste=function(G){let ye=null;if(Yd("beforeSanitizeElements",G,null),vte(G))return mc(G),!0;const $e=fs(G.nodeName);if(Yd("uponSanitizeElement",G,{tagName:$e,allowedTags:Ae}),G.hasChildNodes()&&!wte(G.firstElementChild)&&wo(/<[/\w]/g,G.innerHTML)&&wo(/<[/\w]/g,G.textContent)||G.nodeType===tw.progressingInstruction||_B&&G.nodeType===tw.comment&&wo(/<[/\w]/g,G.data))return mc(G),!0;if(!Ae[$e]||tn[$e]){if(!tn[$e]&&Lte($e)&&(_t.tagNameCheck instanceof RegExp&&wo(_t.tagNameCheck,$e)||_t.tagNameCheck instanceof Function&&_t.tagNameCheck($e)))return!1;if(vB&&!jC[$e]){const Wi=w(G)||G.parentNode,no=C(G)||G.childNodes;if(no&&Wi){const Os=no.length;for(let lr=Os-1;lr>=0;--lr){const _c=m(no[lr],!0);_c.__removalCount=(G.__removalCount||0)+1,Wi.insertBefore(_c,b(G))}}}return mc(G),!0}return G instanceof l&&!r5e(G)||($e==="noscript"||$e==="noembed"||$e==="noframes")&&wo(/<\/no(script|embed|frames)/i,G.innerHTML)?(mc(G),!0):(zC&&G.nodeType===tw.text&&(ye=G.textContent,Gx([O,B,V],Wi=>{ye=Qv(ye,Wi," ")}),G.textContent!==ye&&(Xv(e.removed,{element:G.cloneNode()}),G.textContent=ye)),Yd("afterSanitizeElements",G,null),!1)},yte=function(G,ye,$e){if(ate&&(ye==="id"||ye==="name")&&($e in t||$e in s5e))return!1;if(!(zS&&!Mi[ye]&&wo(z,ye))){if(!(As&&wo(ee,ye))){if(!Ke[ye]||Mi[ye]){if(!(Lte(G)&&(_t.tagNameCheck instanceof RegExp&&wo(_t.tagNameCheck,G)||_t.tagNameCheck instanceof Function&&_t.tagNameCheck(G))&&(_t.attributeNameCheck instanceof RegExp&&wo(_t.attributeNameCheck,ye)||_t.attributeNameCheck instanceof Function&&_t.attributeNameCheck(ye))||ye==="is"&&_t.allowCustomizedBuiltInElements&&(_t.tagNameCheck instanceof RegExp&&wo(_t.tagNameCheck,$e)||_t.tagNameCheck instanceof Function&&_t.tagNameCheck($e))))return!1}else if(!wB[ye]){if(!wo(Ie,Qv($e,oe,""))){if(!((ye==="src"||ye==="xlink:href"||ye==="href")&&G!=="script"&&V_e($e,"data:")===0&&dte[G])){if(!(AT&&!wo(se,Qv($e,oe,"")))){if($e)return!1}}}}}}return!0},Lte=function(G){return G!=="annotation-xml"&&Fj(G,fe)},xte=function(G){Yd("beforeSanitizeAttributes",G,null);const{attributes:ye}=G;if(!ye)return;const $e={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ke};let Wi=ye.length;for(;Wi--;){const no=ye[Wi],{name:Os,namespaceURI:lr,value:_c}=no,jS=fs(Os);let ko=Os==="value"?_c:z_e(_c);if($e.attrName=jS,$e.attrValue=ko,$e.keepAttr=!0,$e.forceKeepAttr=void 0,Yd("uponSanitizeAttribute",G,$e),ko=$e.attrValue,$e.forceKeepAttr||(HT(Os,G),!$e.keepAttr))continue;if(!rte&&wo(/\/>/i,ko)){HT(Os,G);continue}zC&&Gx([O,B,V],Ite=>{ko=Qv(ko,Ite," ")});const kte=fs(G.nodeName);if(yte(kte,jS,ko)){if(lte&&(jS==="id"||jS==="name")&&(HT(Os,G),ko=e5e+ko),_B&&wo(/((--!?|])>)|<\/(style|title)/i,ko)){HT(Os,G);continue}if(v&&typeof f=="object"&&typeof f.getAttributeType=="function"&&!lr)switch(f.getAttributeType(kte,jS)){case"TrustedHTML":{ko=v.createHTML(ko);break}case"TrustedScriptURL":{ko=v.createScriptURL(ko);break}}try{lr?G.setAttributeNS(lr,Os,ko):G.setAttribute(Os,ko),vte(G)?mc(G):Oj(e.removed)}catch{}}}Yd("afterSanitizeAttributes",G,null)},a5e=function Ge(G){let ye=null;const $e=Cte(G);for(Yd("beforeSanitizeShadowDOM",G,null);ye=$e.nextNode();)Yd("uponSanitizeShadowNode",ye,null),!Ste(ye)&&(ye.content instanceof s&&Ge(ye.content),xte(ye));Yd("afterSanitizeShadowDOM",G,null)};return e.sanitize=function(Ge){let G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ye=null,$e=null,Wi=null,no=null;if(SB=!Ge,SB&&(Ge="<!-->"),typeof Ge!="string"&&!wte(Ge))if(typeof Ge.toString=="function"){if(Ge=Ge.toString(),typeof Ge!="string")throw Jv("dirty is not a string, aborting")}else throw Jv("toString is not a function");if(!e.isSupported)return Ge;if(bB||LB(G),e.removed=[],typeof Ge=="string"&&(US=!1),US){if(Ge.nodeName){const _c=fs(Ge.nodeName);if(!Ae[_c]||tn[_c])throw Jv("root node is forbidden and cannot be sanitized in-place")}}else if(Ge instanceof a)ye=bte("<!---->"),$e=ye.ownerDocument.importNode(Ge,!0),$e.nodeType===tw.element&&$e.nodeName==="BODY"||$e.nodeName==="HTML"?ye=$e:ye.appendChild($e);else{if(!UC&&!zC&&!xm&&Ge.indexOf("<")===-1)return v&&FT?v.createHTML(Ge):Ge;if(ye=bte(Ge),!ye)return UC?null:FT?S:""}ye&&CB&&mc(ye.firstChild);const Os=Cte(US?Ge:ye);for(;Wi=Os.nextNode();)Ste(Wi)||(Wi.content instanceof s&&a5e(Wi.content),xte(Wi));if(US)return Ge;if(UC){if(OT)for(no=I.call(ye.ownerDocument);ye.firstChild;)no.appendChild(ye.firstChild);else no=ye;return(Ke.shadowroot||Ke.shadowrootmode)&&(no=R.call(i,no,!0)),no}let lr=xm?ye.outerHTML:ye.innerHTML;return xm&&Ae["!doctype"]&&ye.ownerDocument&&ye.ownerDocument.doctype&&ye.ownerDocument.doctype.name&&wo(Uj,ye.ownerDocument.doctype.name)&&(lr="<!DOCTYPE "+ye.ownerDocument.doctype.name+`>
`+lr),zC&&Gx([O,B,V],_c=>{lr=Qv(lr,_c," ")}),v&&FT?v.createHTML(lr):lr},e.setConfig=function(){let Ge=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};LB(Ge),bB=!0},e.clearConfig=function(){KC=null,bB=!1},e.isValidAttribute=function(Ge,G,ye){KC||LB({});const $e=fs(Ge),Wi=fs(G);return yte($e,Wi,ye)},e.addHook=function(Ge,G){typeof G=="function"&&(F[Ge]=F[Ge]||[],Xv(F[Ge],G))},e.removeHook=function(Ge){if(F[Ge])return Oj(F[Ge])},e.removeHooks=function(Ge){F[Ge]&&(F[Ge]=[])},e.removeAllHooks=function(){F={}},e}var H_=jj();const qj=Object.freeze(["a","abbr","b","bdo","blockquote","br","caption","cite","code","col","colgroup","dd","del","details","dfn","div","dl","dt","em","figcaption","figure","h1","h2","h3","h4","h5","h6","hr","i","img","ins","kbd","label","li","mark","ol","p","pre","q","rp","rt","ruby","s","samp","small","small","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","time","tr","tt","u","ul","var","video","wbr"]),Kj=Object.freeze(["href","target","src","alt","title","for","name","role","tabindex","x-dispatch","required","checked","placeholder","type","start","width","height","align"]),GA="vscode-relative-path";function Gj(o,e){if(e.override==="*")return!0;try{const t=new URL(o,GA+"://");return!!(e.override.includes(t.protocol.replace(/:$/,""))||e.allowRelativePaths&&t.protocol===GA+":"&&!o.trim().toLowerCase().startsWith(GA))}catch{return!1}}function nbe(o,e){H_.addHook("afterSanitizeAttributes",t=>{for(const i of["href","src"])if(t.hasAttribute(i)){const n=t.getAttribute(i);i==="href"?!n.startsWith("#")&&!Gj(n,o)&&t.removeAttribute(i):Gj(n,e)||t.removeAttribute(i)}})}const sbe=Object.freeze({ALLOWED_TAGS:[...qj],ALLOWED_ATTR:[...Kj],ALLOW_UNKNOWN_PROTOCOLS:!0});function obe(o,e){return Zj(o,e,"trusted")}function Zj(o,e,t){try{const i={...sbe};e?.allowedTags&&(e.allowedTags.override&&(i.ALLOWED_TAGS=[...e.allowedTags.override]),e.allowedTags.augment&&(i.ALLOWED_TAGS=[...i.ALLOWED_TAGS??[],...e.allowedTags.augment]));let n=[...Kj];e?.allowedAttributes&&(e.allowedAttributes.override&&(n=[...e.allowedAttributes.override]),e.allowedAttributes.augment&&(n=[...n,...e.allowedAttributes.augment])),n=n.map(a=>typeof a=="string"?a.toLowerCase():{attributeName:a.attributeName.toLowerCase(),shouldKeep:a.shouldKeep});const s=new Set(n.map(a=>typeof a=="string"?a:a.attributeName)),r=new Map;for(const a of n)typeof a=="string"?r.delete(a):r.set(a.attributeName,a);return i.ALLOWED_ATTR=Array.from(s),nbe({override:e?.allowedLinkProtocols?.override??[we.http,we.https],allowRelativePaths:e?.allowRelativeLinkPaths??!1},{override:e?.allowedMediaProtocols?.override??[we.http,we.https],allowRelativePaths:e?.allowRelativeMediaPaths??!1}),e?.replaceWithPlaintext&&H_.addHook("uponSanitizeElement",abe),r.size&&H_.addHook("uponSanitizeAttribute",(a,l)=>{const c=r.get(l.attrName);if(c){const d=c.shouldKeep(a,l);typeof d=="string"?(l.keepAttr=!0,l.attrValue=d):l.keepAttr=d}else l.keepAttr=s.has(l.attrName)}),t==="dom"?H_.sanitize(o,{...i,RETURN_DOM_FRAGMENT:!0}):H_.sanitize(o,{...i,RETURN_TRUSTED_TYPE:!0})}finally{H_.removeAllHooks()}}const rbe=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function abe(o,e,t){if(!e.allowedTags[e.tagName]&&e.tagName!=="body"){const i=Yj(o);o.nodeType===Node.COMMENT_NODE?o.parentElement?.insertBefore(i,o):o.parentElement?.replaceChild(i,o)}}function Yj(o){let e,t;if(o.nodeType===Node.COMMENT_NODE)e=`<!--${o.textContent}-->`;else{const r=o.tagName.toLowerCase(),a=rbe.includes(r),l=o.attributes.length?" "+Array.from(o.attributes).map(c=>`${c.name}="${c.value}"`).join(" "):"";e=`<${r}${l}>`,a||(t=`</${r}>`)}const i=document.createDocumentFragment(),n=o.ownerDocument.createTextNode(e);for(i.appendChild(n);o.firstChild;)i.appendChild(o.firstChild);const s=t?o.ownerDocument.createTextNode(t):void 0;return s&&i.appendChild(s),i}function Xj(o,e,t){const i=Zj(e,t,"dom");Yi(o,i)}const lbe=new RegExp(`(\\\\)?\\$\\((${ve.iconNameExpression}(?:${ve.iconModifierExpression})?)\\)`,"g");function Fh(o){const e=new Array;let t,i=0,n=0;for(;(t=lbe.exec(o))!==null;){n=t.index||0,i<n&&e.push(o.substring(i,n)),i=(t.index||0)+t[0].length;const[,s,r]=t;e.push(s?`$(${r})`:Al({id:r}))}return i<o.length&&e.push(o.substring(i)),e}function Al(o){const e=Q("span");return e.classList.add(...ve.asClassNameArray(o)),e}const ZA=Object.freeze({image:({href:o,title:e,text:t})=>{let i=[],n=[];return o&&({href:o,dimensions:i}=n_e(o),n.push(`src="${zx(o)}"`)),t&&n.push(`alt="${zx(t)}"`),e&&n.push(`title="${zx(e)}"`),i.length&&(n=n.concat(i)),"<img "+n.join(" ")+">"},paragraph({tokens:o}){return`<p>${this.parser.parseInline(o)}</p>`},link({href:o,title:e,tokens:t}){let i=this.parser.parseInline(t);return typeof o!="string"?"":(o===i&&(i=DA(i)),e=typeof e=="string"?zx(DA(e)):"",o=DA(o),o=o.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"),`<a href="${o}" title="${e||o}" draggable="false">${i}</a>`)}});function iw(o,e={},t){const i=new U;let n=!1;const s=new Rj(...e.markedExtensions??[]),{renderer:r,codeBlocks:a,syncCodeBlocks:l}=dbe(s,e,o),c=hbe(o);let d;if(e.fillInIncompleteTokens){const g={...s.defaults,...e.markedOptions,renderer:r},m=s.lexer(c,g),_=Lbe(m);d=s.parser(_,g)}else d=s.parse(c,{...e?.markedOptions,renderer:r,async:!1});o.supportThemeIcons&&(d=Fh(d).map(m=>typeof m=="string"?m:m.outerHTML).join(""));const h=document.createElement("div"),u=tq(o,e.sanitizerConfig??{});Xj(h,d,u),cbe(o,e,h);let f;if(t?(f=t,Yi(t,...h.children)):f=h,a.length>0)Promise.all(a).then(g=>{if(n)return;const m=new Map(g),_=f.querySelectorAll("div[data-code]");for(const b of _){const C=m.get(b.dataset.code??"");C&&Yi(b,C)}e.asyncRenderCallback?.()});else if(l.length>0){const g=new Map(l),m=f.querySelectorAll("div[data-code]");for(const _ of m){const b=g.get(_.dataset.code??"");b&&Yi(_,b)}}if(e.asyncRenderCallback)for(const g of f.getElementsByTagName("img")){const m=i.add(W(g,"load",()=>{m.dispose(),e.asyncRenderCallback()}))}if(e.actionHandler){const g=m=>{const _=new yn(me(f),m);!_.leftButton&&!_.middleButton||Qj(o,e,_)};i.add(W(f,"click",g)),i.add(W(f,"auxclick",g)),i.add(W(f,"keydown",m=>{const _=new St(m);!_.equals(10)&&!_.equals(3)||Qj(o,e,_)}))}for(const g of[...f.getElementsByTagName("input")])if(g.attributes.getNamedItem("type")?.value==="checkbox")g.setAttribute("disabled","");else if(e.sanitizerConfig?.replaceWithPlaintext){const m=Yj(g);g.parentElement?.replaceChild(m,g)}else g.remove();return{element:f,dispose:()=>{n=!0,i.dispose()}}}function cbe(o,e,t){for(const i of t.querySelectorAll("img, audio, video, source")){const n=i.getAttribute("src");if(n){let s=n;try{o.baseUri&&(s=YA(be.from(o.baseUri),s))}catch{}if(i.setAttribute("src",Jj(o,s,!0)),e.sanitizerConfig?.remoteImageIsAllowed){const r=be.parse(s);r.scheme!==we.file&&r.scheme!==we.data&&!e.sanitizerConfig.remoteImageIsAllowed(r)&&i.replaceWith(Q("",void 0,i.outerHTML))}}}for(const i of t.querySelectorAll("a")){const n=i.getAttribute("href");if(i.setAttribute("href",""),!n||/^data:|javascript:/i.test(n)||/^command:/i.test(n)&&!o.isTrusted||/^command:(\/\/\/)?_workbench\.downloadResource/i.test(n))i.replaceWith(...i.childNodes);else{let s=Jj(o,n,!1);o.baseUri&&(s=YA(be.from(o.baseUri),n)),i.dataset.href=s}}}function dbe(o,e,t){const i=new o.Renderer(e.markedOptions);i.image=ZA.image,i.link=ZA.link,i.paragraph=ZA.paragraph;const n=[],s=[];return e.codeBlockRendererSync?i.code=({text:r,lang:a,raw:l})=>{const c=NA.nextId(),d=e.codeBlockRendererSync(eq(a),r,l);return s.push([c,d]),`<div class="code" data-code="${c}">${qr(r)}</div>`}:e.codeBlockRenderer&&(i.code=({text:r,lang:a})=>{const l=NA.nextId(),c=e.codeBlockRenderer(eq(a),r);return n.push(c.then(d=>[l,d])),`<div class="code" data-code="${l}">${qr(r)}</div>`}),t.supportHtml||(i.html=({text:r})=>e.sanitizerConfig?.replaceWithPlaintext?qr(r):(t.isTrusted?r.match(/^(<span[^>]+>)|(<\/\s*span>)$/):void 0)?r:""),{renderer:i,codeBlocks:n,syncCodeBlocks:s}}function hbe(o){let e=o.value;return e.length>1e5&&(e=`${e.substr(0,1e5)}…`),o.supportThemeIcons&&(e=Qme(e)),e}function Qj(o,e,t){const i=t.target.closest("a[data-href]");if(ai(i))try{let n=i.dataset.href;n&&(o.baseUri&&(n=YA(be.from(o.baseUri),n)),e.actionHandler?.(n,o))}catch(n){Ee(n)}finally{t.preventDefault()}}function ube(o,e){let t;try{t=BA(decodeURIComponent(e))}catch{}return t?(t=qH(t,i=>{if(o.uris&&o.uris[i])return be.revive(o.uris[i])}),encodeURIComponent(JSON.stringify(t))):e}function Jj(o,e,t){const i=o.uris&&o.uris[e];let n=be.revive(i);return t?e.startsWith(we.data+":")?e:(n||(n=be.parse(e)),_6.uriToBrowserUri(n).toString(!0)):!n||be.parse(e).toString()===n.toString()?e:(n.query&&(n=n.with({query:ube(o,n.query)})),n.toString())}function eq(o){if(!o)return"";const e=o.split(/[\s+|:|,|\{|\?]/,1);return e.length?e[0]:o}function YA(o,e){return/^\w[\w\d+.-]*:/.test(e)?e:o.path.endsWith("/")?TH(o,e).toString():TH(zy(o),e).toString()}function fbe(o,e,t={}){const i=tq(e,t);return obe(o,i)}const gbe=Object.freeze([...qj,"input"]),pbe=Object.freeze(["align","autoplay","alt","colspan","controls","draggable","height","href","loop","muted","playsinline","poster","rowspan","src","target","title","type","width","start","checked","disabled","value","data-code","data-href",{attributeName:"style",shouldKeep:(o,e)=>o.tagName==="SPAN"&&e.attrName==="style"?/^(color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(background-color\:(#[0-9a-fA-F]+|var\(--vscode(-[a-zA-Z0-9]+)+\));)?(border-radius:[0-9]+px;)?$/.test(e.attrValue):!1},{attributeName:"class",shouldKeep:(o,e)=>o.tagName==="SPAN"&&e.attrName==="class"?/^codicon codicon-[a-z\-]+( codicon-modifier-[a-z\-]+)?$/.test(e.attrValue):!1}]);function tq(o,e){const t=o.isTrusted??!1,i=[we.http,we.https,we.mailto,we.file,we.vscodeFileResource,we.vscodeRemote,we.vscodeRemoteResource,we.vscodeNotebookCell];return t&&i.push(we.command),e.allowedLinkSchemes?.augment&&i.push(...e.allowedLinkSchemes.augment),{allowedTags:{override:e.allowedTags?.override??gbe},allowedAttributes:{override:e.allowedAttributes?.override??pbe},allowedLinkProtocols:{override:i},allowRelativeLinkPaths:!!o.baseUri,allowedMediaProtocols:{override:[we.http,we.https,we.data,we.file,we.vscodeFileResource,we.vscodeRemote,we.vscodeRemoteResource]},replaceWithPlaintext:e.replaceWithPlaintext}}function mbe(o,e){if(typeof o=="string")return o;let t=o.value??"";t.length>1e5&&(t=`${t.substr(0,1e5)}…`);const i=A_e(t,{async:!1,renderer:bbe.value});return fbe(i,{isTrusted:!1},{}).toString().replace(/&(#\d+|[a-zA-Z]+);/g,n=>_be.get(n)??n).trim()}const _be=new Map([["&quot;",'"'],["&nbsp;"," "],["&amp;","&"],["&#39;","'"],["&lt;","<"],["&gt;",">"]]);function iq(){const o=new Zv;return o.code=({text:e})=>qr(e),o.blockquote=({text:e})=>e+`
`,o.html=e=>"",o.heading=function({tokens:e}){return this.parser.parseInline(e)+`
`},o.hr=()=>"",o.list=function({items:e}){return e.map(t=>this.listitem(t)).join(`
`)+`
`},o.listitem=({text:e})=>e+`
`,o.paragraph=function({tokens:e}){return this.parser.parseInline(e)+`
`},o.table=function({header:e,rows:t}){return e.map(i=>this.tablecell(i)).join(" ")+`
`+t.map(i=>i.map(n=>this.tablecell(n)).join(" ")).join(`
`)+`
`},o.tablerow=({text:e})=>e,o.tablecell=function({tokens:e}){return this.parser.parseInline(e)},o.strong=({text:e})=>e,o.em=({text:e})=>e,o.codespan=({text:e})=>qr(e),o.br=e=>`
`,o.del=({text:e})=>e,o.image=e=>"",o.text=({text:e})=>e,o.link=({text:e})=>e,o}const bbe=new Ln(iq);new Ln(()=>{const o=iq();return o.code=({text:e})=>`
\`\`\`
${qr(e)}
\`\`\`
`,o});function nw(o){let e="";return o.forEach(t=>{e+=t.raw}),e}function nq(o){if(o.tokens)for(let e=o.tokens.length-1;e>=0;e--){const t=o.tokens[e];if(t.type==="text"){const i=t.raw.split(`
`),n=i[i.length-1];if(n.includes("`"))return kbe(o);if(n.includes("**"))return Rbe(o);if(n.match(/\*\w/))return Ibe(o);if(n.match(/(^|\s)__\w/))return Mbe(o);if(n.match(/(^|\s)_\w/))return Dbe(o);if(Cbe(n)||vbe(n)&&o.tokens.slice(0,e).some(s=>s.type==="text"&&s.raw.match(/\[[^\]]*$/))){const s=o.tokens.slice(e+1);return s[0]?.type==="link"&&s[1]?.type==="text"&&s[1].raw.match(/^ *"[^"]*$/)||n.match(/^[^"]* +"[^"]*$/)?Nbe(o):Ebe(o)}else if(n.match(/(^|\s)\[\w*[^\]]*$/))return Tbe(o)}}}function Cbe(o){return!!o.match(/(^|\s)\[.*\]\(\w*/)}function vbe(o){return!!o.match(/^[^\[]*\]\([^\)]*$/)}function wbe(o){const e=o.items[o.items.length-1],t=e.tokens?e.tokens[e.tokens.length-1]:void 0,i=c=>{const h=c.items.at(-1)?.tokens.at(-1);return h?.type==="heading"||h?.type==="list"&&i(h)};let n;if(t?.type==="text"&&!("inRawBlock"in e))n=nq(t);else if(i(o)){const c=Yv(o.raw.trim()+" &nbsp;")[0];return c.type!=="list"?void 0:c}if(!n||n.type!=="paragraph")return;const s=nw(o.items.slice(0,-1)),r=e.raw.match(/^(\s*(-|\d+\.|\*) +)/)?.[0];if(!r)return;const a=r+nw(e.tokens.slice(0,-1))+n.raw,l=Yv(s+a)[0];if(l.type==="list")return l}function Sbe(o,e){if(o.raw.match(/-\s*$/))return Yv(e+" &nbsp;")}const ybe=3;function Lbe(o){for(let e=0;e<ybe;e++){const t=xbe(o);if(t)o=t;else break}return o}function xbe(o){let e,t;for(e=0;e<o.length;e++){const n=o[e];if(n.type==="paragraph"&&n.raw.match(/(\n|^)\|/)){t=Pbe(o.slice(e));break}}const i=o.at(-1);if(!t&&i?.type==="list"){const n=wbe(i);n&&(t=[n],e=o.length-1)}if(!t&&i?.type==="paragraph"){const n=nq(i);n&&(t=[n],e=o.length-1)}if(t){const n=[...o.slice(0,e),...t];return n.links=o.links,n}if(i?.type==="heading"){const n=Sbe(i,nw(o));if(n)return n}return null}function kbe(o){return Wh(o,"`")}function Ibe(o){return Wh(o,"*")}function Dbe(o){return Wh(o,"_")}function Ebe(o){return Wh(o,")",!1)}function Nbe(o){return Wh(o,'")',!1)}function Tbe(o){return Wh(o,"](https://microsoft.com)",!1)}function Rbe(o){return Wh(o,"**")}function Mbe(o){return Wh(o,"__")}function Wh(o,e,t=!0){const i=nw(Array.isArray(o)?o:[o]),n=t?i.trimEnd():i;return Yv(n+e)[0]}function Pbe(o){const e=nw(o),t=e.split(`
`);let i,n=!1;for(let s=0;s<t.length;s++){const r=t[s].trim();if(typeof i>"u"&&r.match(/^\s*\|/)){const a=r.match(/(\|[^\|]+)(?=\||$)/g);a&&(i=a.length)}else if(typeof i=="number")if(r.match(/^\s*\|/)){if(s!==t.length-1)return;n=!0}else return}if(typeof i=="number"&&i>0){const s=n?t.slice(0,-1).join(`
`):e,r=!!s.match(/\|\s*$/),a=s+(r?"":"|")+`
|${" --- |".repeat(i)}`;return Yv(a)}}let sq={showInstantHover:()=>{},showDelayedHover:()=>{},setupDelayedHover:()=>A.None,setupDelayedHoverAtMouse:()=>A.None,hideHover:()=>{},showAndFocusLastHover:()=>{},setupManagedHover:()=>({dispose:()=>{},show:()=>{},hide:()=>{},update:()=>{}}),showManagedHover:()=>{}};function Abe(o){sq=o}function ta(){return sq}class Obe{constructor(e){this.spliceables=e}splice(e,t,i){this.spliceables.forEach(n=>n.splice(e,t,i))}}function ks(o,e,t){return Math.min(Math.max(o,e),t)}class oq{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 Fbe{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<this._values.length&&(this._n+=1),this._val=this._sum/this._n,this._val}get value(){return this._val}}class fg extends Error{constructor(e,t){super(`ListError [${e}] ${t}`)}}var Kn;(function(o){function e(s,r){if(s.start>=r.end||r.start>=s.end)return{start:0,end:0};const a=Math.max(s.start,r.start),l=Math.min(s.end,r.end);return l-a<=0?{start:0,end:0}:{start:a,end:l}}o.intersect=e;function t(s){return s.end-s.start<=0}o.isEmpty=t;function i(s,r){return!t(e(s,r))}o.intersects=i;function n(s,r){const a=[],l={start:s.start,end:Math.min(r.start,s.end)},c={start:Math.max(r.end,s.start),end:s.end};return t(l)||a.push(l),t(c)||a.push(c),a}o.relativeComplement=n})(Kn||(Kn={}));function rq(o,e){const t=[];for(const i of e){if(o.start>=i.range.end)continue;if(o.end<i.range.start)break;const n=Kn.intersect(o,i.range);Kn.isEmpty(n)||t.push({range:n,size:i.size})}return t}function XA({start:o,end:e},t){return{start:o+t,end:e+t}}function Wbe(o){const e=[];let t=null;for(const i of o){const n=i.range.start,s=i.range.end,r=i.size;if(t&&r===t.size){t.range.end=s;continue}t={range:{start:n,end:s},size:r},e.push(t)}return e}function Bbe(...o){return Wbe(o.reduce((e,t)=>e.concat(t),[]))}class Hbe{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=e??0,this._size=this._paddingTop}splice(e,t,i=[]){const n=i.length-t,s=rq({start:0,end:e},this.groups),r=rq({start:e+t,end:Number.POSITIVE_INFINITY},this.groups).map(l=>({range:XA(l.range,n),size:l.size})),a=i.map((l,c)=>({range:{start:e+c,end:e+c+1},size:l.size}));this.groups=Bbe(s,a,r),this._size=this._paddingTop+this.groups.reduce((l,c)=>l+c.size*(c.range.end-c.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<this._paddingTop)return 0;let t=0,i=this._paddingTop;for(const n of this.groups){const s=n.range.end-n.range.start,r=i+s*n.size;if(e<r)return t+Math.floor((e-i)/n.size);t+=s,i=r}return t}indexAfter(e){return Math.min(this.indexAt(e)+1,this.count)}positionAt(e){if(e<0)return-1;let t=0,i=0;for(const n of this.groups){const s=n.range.end-n.range.start,r=i+s;if(e<r)return this._paddingTop+t+(e-i)*n.size;t+=s*n.size,i=r}return-1}}class Vbe{constructor(e){this.renderers=e,this.cache=new Map,this.transactionNodesPendingRemoval=new Set,this.inTransaction=!1}alloc(e){let t=this.getTemplateCache(e).pop(),i=!1;if(t)i=this.transactionNodesPendingRemoval.has(t.domNode),i&&this.transactionNodesPendingRemoval.delete(t.domNode);else{const n=Q(".monaco-list-row"),r=this.getRenderer(e).renderTemplate(n);t={domNode:n,templateId:e,templateData:r}}return{row:t,isReusingConnectedDomNode:i}}release(e){e&&this.releaseRow(e)}transact(e){if(this.inTransaction)throw new Error("Already in transaction");this.inTransaction=!0;try{e()}finally{for(const t of this.transactionNodesPendingRemoval)this.doRemoveNode(t);this.transactionNodesPendingRemoval.clear(),this.inTransaction=!1}}releaseRow(e){const{domNode:t,templateId:i}=e;t&&(this.inTransaction?this.transactionNodesPendingRemoval.add(t):this.doRemoveNode(t)),this.getTemplateCache(i).push(e)}doRemoveNode(e){e.classList.remove("scrolling"),e.remove()}getTemplateCache(e){let t=this.cache.get(e);return t||(t=[],this.cache.set(e,t)),t}dispose(){this.cache.forEach((e,t)=>{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}}function zbe(o,e,t,i=[]){if(!o.dataTransfer)return;const n=Q(".monaco-drag-image");n.textContent=t,n.classList.add(...i),(a=>{for(;a&&!a.classList.contains("monaco-workbench");)a=a.parentElement;return a||e.ownerDocument.body})(e).appendChild(n),o.dataTransfer.setDragImage(n,-10,-10),setTimeout(()=>n.remove(),0)}var ad=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};const gg={CurrentDragAndDropData:void 0},Ol={useShadows:!0,verticalScrollMode:1,setRowLineHeight:!0,setRowHeight:!0,supportDynamicHeights:!1,dnd:{getDragElements(o){return[o]},getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}},horizontalScrolling:!1,transformOptimization:!0,alwaysConsumeMouseWheel:!0};class sw{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class Ube{constructor(e){this.elements=e}update(){}getData(){return this.elements}}class $be{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;t<e.files.length;t++){const i=e.files.item(t);i&&(i.size||i.type)&&this.files.push(i)}}}getData(){return{types:this.types,files:this.files}}}function jbe(o,e){return Array.isArray(o)&&Array.isArray(e)?Ut(o,e):o===e}class qbe{constructor(e){e?.getSetSize?this.getSetSize=e.getSetSize.bind(e):this.getSetSize=(t,i,n)=>n,e?.getPosInSet?this.getPosInSet=e.getPosInSet.bind(e):this.getPosInSet=(t,i)=>i+1,e?.getRole?this.getRole=e.getRole.bind(e):this.getRole=t=>"listitem",e?.isChecked?this.isChecked=e.isChecked.bind(e):this.isChecked=t=>{}}}const CN=class CN{get contentHeight(){return this.rangeMap.size}get onDidScroll(){return this.scrollableElement.onScroll}get scrollableElementDomNode(){return this.scrollableElement.getDomNode()}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 t of this.items)this.measureItemWidth(t);this.updateScrollWidth(),this.scrollableElement.setScrollDimensions({width:e2(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=Ol){if(this.virtualDelegate=t,this.domId=`list_id_${++CN.InstanceCount}`,this.renderers=new Map,this.renderWidth=0,this._scrollHeight=0,this.scrollableElementUpdateDisposable=null,this.scrollableElementWidthDelayer=new fr(50),this.splicing=!1,this.dragOverAnimationStopDisposable=A.None,this.dragOverMouseY=0,this.canDrop=!1,this.currentDragFeedbackDisposable=A.None,this.onDragLeaveTimeout=A.None,this.currentSelectionDisposable=A.None,this.disposables=new U,this._onDidChangeContentHeight=new P,this._onDidChangeContentWidth=new P,this.onDidChangeContentHeight=ie.latch(this._onDidChangeContentHeight.event,void 0,this.disposables),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=this.createRangeMap(n.paddingTop??0);for(const r of i)this.renderers.set(r.templateId,r);if(this.cache=this.disposables.add(new Vbe(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",typeof n.mouseSupport=="boolean"?n.mouseSupport:!0),this._horizontalScrolling=n.horizontalScrolling??Ol.horizontalScrolling,this.domNode.classList.toggle("horizontal-scrolling",this._horizontalScrolling),this.paddingBottom=typeof n.paddingBottom>"u"?0:n.paddingBottom,this.accessibilityProvider=new qbe(n.accessibilityProvider),this.rowsContainer=document.createElement("div"),this.rowsContainer.className="monaco-list-rows",(n.transformOptimization??Ol.transformOptimization)&&(this.rowsContainer.style.transform="translate3d(0px, 0px, 0px)",this.rowsContainer.style.overflow="hidden",this.rowsContainer.style.contain="strict"),this.disposables.add($n.addTarget(this.rowsContainer)),this.scrollable=this.disposables.add(new __({forceIntegerValues:!0,smoothScrollDuration:n.smoothScrolling??!1?125:0,scheduleAtNextAnimationFrame:r=>Hs(me(this.domNode),r)})),this.scrollableElement=this.disposables.add(new VL(this.rowsContainer,{alwaysConsumeMouseWheel:n.alwaysConsumeMouseWheel??Ol.alwaysConsumeMouseWheel,horizontal:1,vertical:n.verticalScrollMode??Ol.verticalScrollMode,useShadows:n.useShadows??Ol.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(W(this.rowsContainer,Pt.Change,r=>this.onTouchChange(r))),this.disposables.add(W(this.scrollableElement.getDomNode(),"scroll",r=>{const a=r.target,l=a.scrollTop;a.scrollTop=0,n.scrollToActiveElement&&this.setScrollTop(this.scrollTop+l)})),this.disposables.add(W(this.domNode,"dragover",r=>this.onDragOver(this.toDragEvent(r)))),this.disposables.add(W(this.domNode,"drop",r=>this.onDrop(this.toDragEvent(r)))),this.disposables.add(W(this.domNode,"dragleave",r=>this.onDragLeave(this.toDragEvent(r)))),this.disposables.add(W(this.domNode,"dragend",r=>this.onDragEnd(r))),n.userSelection){if(n.dnd)throw new Error("DND and user selection cannot be used simultaneously");this.disposables.add(W(this.domNode,"mousedown",r=>this.onPotentialSelectionStart(r)))}this.setRowLineHeight=n.setRowLineHeight??Ol.setRowLineHeight,this.setRowHeight=n.setRowHeight??Ol.setRowHeight,this.supportDynamicHeights=n.supportDynamicHeights??Ol.supportDynamicHeights,this.dnd=n.dnd??this.disposables.add(Ol.dnd),this.layout(n.initialSize?.height,n.initialSize?.width),n.scrollToActiveElement&&this._setupFocusObserver(e)}_setupFocusObserver(e){this.disposables.add(W(e,"focus",()=>{const t=Ui();this.activeElement!==t&&t!==null&&(this.activeElement=t,this._scrollToActiveElement(this.activeElement,e))},!0))}_scrollToActiveElement(e,t){const i=t.getBoundingClientRect(),s=e.getBoundingClientRect().top-i.top;s<0&&this.setScrollTop(this.scrollTop+s)}updateOptions(e){e.paddingBottom!==void 0&&(this.paddingBottom=e.paddingBottom,this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight})),e.smoothScrolling!==void 0&&this.scrollable.setSmoothScrollDuration(e.smoothScrolling?125:0),e.horizontalScrolling!==void 0&&(this.horizontalScrolling=e.horizontalScrolling);let t;if(e.scrollByPage!==void 0&&(t={...t??{},scrollByPage:e.scrollByPage}),e.mouseWheelScrollSensitivity!==void 0&&(t={...t??{},mouseWheelScrollSensitivity:e.mouseWheelScrollSensitivity}),e.fastScrollSensitivity!==void 0&&(t={...t??{},fastScrollSensitivity:e.fastScrollSensitivity}),t&&this.scrollableElement.updateOptions(t),e.paddingTop!==void 0&&e.paddingTop!==this.rangeMap.paddingTop){const i=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),n=e.paddingTop-this.rangeMap.paddingTop;this.rangeMap.paddingTop=e.paddingTop,this.render(i,Math.max(0,this.lastRenderTop+n),this.lastRenderHeight,void 0,void 0,!0),this.setScrollTop(this.lastRenderTop),this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.lastRenderTop,this.lastRenderHeight)}}createRangeMap(e){return new Hbe(e)}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},r=Kn.intersect(n,s),a=new Map;for(let S=r.end-1;S>=r.start;S--){const L=this.items[S];if(L.dragStartDisposable.dispose(),L.checkedDisposable.dispose(),L.row){let x=a.get(L.templateId);x||(x=[],a.set(L.templateId,x));const I=this.renderers.get(L.templateId);I&&I.disposeElement&&I.disposeElement(L.element,S,L.row.templateData,{height:L.size}),x.unshift(L.row)}L.row=null,L.stale=!0}const l={start:e+t,end:this.items.length},c=Kn.intersect(l,n),d=Kn.relativeComplement(l,n),h=i.map(S=>({id:String(this.itemId++),element:S,templateId:this.virtualDelegate.getTemplateId(S),size:this.virtualDelegate.getHeight(S),width:void 0,hasDynamicHeight:!!this.virtualDelegate.hasDynamicHeight&&this.virtualDelegate.hasDynamicHeight(S),lastDynamicHeightWidth:void 0,row:null,uri:void 0,dropTarget:!1,dragStartDisposable:A.None,checkedDisposable:A.None,stale:!1}));let u;e===0&&t>=this.items.length?(this.rangeMap=this.createRangeMap(this.rangeMap.paddingTop),this.rangeMap.splice(0,0,h),u=this.items,this.items=h):(this.rangeMap.splice(e,t,h),u=by(this.items,e,t,h));const f=i.length-t,g=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight),m=XA(c,f),_=Kn.intersect(g,m);for(let S=_.start;S<_.end;S++)this.updateItemInDOM(this.items[S],S);const b=Kn.relativeComplement(m,g);for(const S of b)for(let L=S.start;L<S.end;L++)this.removeItemFromDOM(L);const C=d.map(S=>XA(S,f)),v=[{start:e,end:e+i.length},...C].map(S=>Kn.intersect(g,S)).reverse();for(const S of v)for(let L=S.end-1;L>=S.start;L--){const x=this.items[L],D=a.get(x.templateId)?.pop();this.insertItemInDOM(L,D)}for(const S of a.values())for(const L of S)this.cache.release(L);return this.eventuallyUpdateScrollDimensions(),this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight),u.map(S=>S.element)}eventuallyUpdateScrollDimensions(){this._scrollHeight=this.contentHeight,this.rowsContainer.style.height=`${this._scrollHeight}px`,this.scrollableElementUpdateDisposable||(this.scrollableElementUpdateDisposable=Hs(me(this.domNode),()=>{this.scrollableElement.setScrollDimensions({scrollHeight:this.scrollHeight}),this.updateScrollWidth(),this.scrollableElementUpdateDisposable=null}))}eventuallyUpdateScrollWidth(){if(!this.horizontalScrolling){this.scrollableElementWidthDelayer.cancel();return}this.scrollableElementWidthDelayer.trigger(()=>this.updateScrollWidth())}updateScrollWidth(){if(!this.horizontalScrolling)return;let e=0;for(const t of this.items)typeof t.width<"u"&&(e=Math.max(e,t.width));this.scrollWidth=e,this.scrollableElement.setScrollDimensions({scrollWidth:e===0?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(){return this.getVisibleRange(this.lastRenderTop,this.lastRenderHeight).start}element(e){return this.items[e].element}indexOf(e){return this.items.findIndex(t=>t.element===e)}domElement(e){const t=this.items[e].row;return t&&t.domNode}elementHeight(e){return this.items[e].size}elementTop(e){return this.rangeMap.positionAt(e)}indexAt(e){return this.rangeMap.indexAt(e)}indexAfter(e){return this.rangeMap.indexAfter(e)}layout(e,t){const i={height:typeof e=="number"?e:tse(this.domNode)};this.scrollableElementUpdateDisposable&&(this.scrollableElementUpdateDisposable.dispose(),this.scrollableElementUpdateDisposable=null,i.scrollHeight=this.scrollHeight),this.scrollableElement.setScrollDimensions(i),typeof t<"u"&&(this.renderWidth=t,this.supportDynamicHeights&&this._rerender(this.scrollTop,this.renderHeight)),this.horizontalScrolling&&this.scrollableElement.setScrollDimensions({width:typeof t=="number"?t:e2(this.domNode)})}render(e,t,i,n,s,r=!1,a=!1){const l=this.getRenderRange(t,i),c=Kn.relativeComplement(l,e).reverse(),d=Kn.relativeComplement(e,l);if(r){const h=Kn.intersect(e,l);for(let u=h.start;u<h.end;u++)this.updateItemInDOM(this.items[u],u)}this.cache.transact(()=>{for(const h of d)for(let u=h.start;u<h.end;u++)this.removeItemFromDOM(u,a);for(const h of c)for(let u=h.end-1;u>=h.start;u--)this.insertItemInDOM(u)}),n!==void 0&&(this.rowsContainer.style.left=`-${n}px`),this.rowsContainer.style.top=`-${t}px`,this.horizontalScrolling&&s!==void 0&&(this.rowsContainer.style.width=`${Math.max(s,this.renderWidth)}px`),this.lastRenderTop=t,this.lastRenderHeight=i}insertItemInDOM(e,t){const i=this.items[e];if(!i.row)if(t)i.row=t,i.stale=!0;else{const l=this.cache.alloc(i.templateId);i.row=l.row,i.stale||=l.isReusingConnectedDomNode}const n=this.accessibilityProvider.getRole(i.element)||"listitem";i.row.domNode.setAttribute("role",n);const s=this.accessibilityProvider.isChecked(i.element);if(typeof s=="boolean")i.row.domNode.setAttribute("aria-checked",String(!!s));else if(s){const l=c=>i.row.domNode.setAttribute("aria-checked",String(!!c));l(s.value),i.checkedDisposable=s.onDidChange(()=>l(s.value))}if(i.stale||!i.row.domNode.parentElement){const l=this.items.at(e+1)?.row?.domNode??null;(i.row.domNode.parentElement!==this.rowsContainer||i.row.domNode.nextElementSibling!==l)&&this.rowsContainer.insertBefore(i.row.domNode,l),i.stale=!1}this.updateItemInDOM(i,e);const r=this.renderers.get(i.templateId);if(!r)throw new Error(`No renderer found for template id ${i.templateId}`);r?.renderElement(i.element,e,i.row.templateData,{height:i.size});const a=this.dnd.getDragURI(i.element);i.dragStartDisposable.dispose(),i.row.domNode.draggable=!!a,a&&(i.dragStartDisposable=W(i.row.domNode,"dragstart",l=>this.onDragStart(i.element,a,l))),this.horizontalScrolling&&(this.measureItemWidth(i),this.eventuallyUpdateScrollWidth())}measureItemWidth(e){if(!e.row||!e.row.domNode)return;e.row.domNode.style.width="fit-content",e.width=e2(e.row.domNode);const t=me(e.row.domNode).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,t){const i=this.items[e];if(i.dragStartDisposable.dispose(),i.checkedDisposable.dispose(),i.row){const n=this.renderers.get(i.templateId);n&&n.disposeElement&&n.disposeElement(i.element,e,i.row.templateData,{height:i.size,onScroll:t}),this.cache.release(i.row),i.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 ie.map(this.disposables.add(new gt(this.domNode,"click")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseDblClick(){return ie.map(this.disposables.add(new gt(this.domNode,"dblclick")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseMiddleClick(){return ie.filter(ie.map(this.disposables.add(new gt(this.domNode,"auxclick")).event,e=>this.toMouseEvent(e),this.disposables),e=>e.browserEvent.button===1,this.disposables)}get onMouseDown(){return ie.map(this.disposables.add(new gt(this.domNode,"mousedown")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOver(){return ie.map(this.disposables.add(new gt(this.domNode,"mouseover")).event,e=>this.toMouseEvent(e),this.disposables)}get onMouseOut(){return ie.map(this.disposables.add(new gt(this.domNode,"mouseout")).event,e=>this.toMouseEvent(e),this.disposables)}get onContextMenu(){return ie.any(ie.map(this.disposables.add(new gt(this.domNode,"contextmenu")).event,e=>this.toMouseEvent(e),this.disposables),ie.map(this.disposables.add(new gt(this.domNode,Pt.Contextmenu)).event,e=>this.toGestureEvent(e),this.disposables))}get onTouchStart(){return ie.map(this.disposables.add(new gt(this.domNode,"touchstart")).event,e=>this.toTouchEvent(e),this.disposables)}get onTap(){return ie.map(this.disposables.add(new gt(this.rowsContainer,Pt.Tap)).event,e=>this.toGestureEvent(e),this.disposables)}toMouseEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toTouchEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toGestureEvent(e){const t=this.getItemIndexFromEventTarget(e.initialTarget||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element;return{browserEvent:e,index:t,element:n}}toDragEvent(e){const t=this.getItemIndexFromEventTarget(e.target||null),i=typeof t>"u"?void 0:this.items[t],n=i&&i.element,s=this.getTargetSector(e,t);return{browserEvent:e,index:t,element:n,sector:s}}onScroll(e){try{const t=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.render(t,e.scrollTop,e.height,e.scrollLeft,e.scrollWidth,void 0,!0),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){if(!i.dataTransfer)return;const n=this.dnd.getDragElements(e);i.dataTransfer.effectAllowed="copyMove",i.dataTransfer.setData(og.TEXT,t);let s;this.dnd.getDragLabel&&(s=this.dnd.getDragLabel(n,i)),typeof s>"u"&&(s=String(n.length)),zbe(i,this.domNode,s,[this.domId]),this.domNode.classList.add("dragging"),this.currentDragData=new sw(n),gg.CurrentDragAndDropData=new Ube(n),this.dnd.onDragStart?.(this.currentDragData,i)}onPotentialSelectionStart(e){this.currentSelectionDisposable.dispose();const t=qne(this.domNode),i=this.currentSelectionDisposable=new U,n=i.add(new U);n.add(W(this.domNode,"selectstart",()=>{n.add(W(t,"mousemove",s=>{t.getSelection()?.isCollapsed===!1&&this.setupDragAndDropScrollTopAnimation(s)})),i.add(ue(()=>{const s=this.getRenderRange(this.lastRenderTop,this.lastRenderHeight);this.currentSelectionBounds=void 0,this.render(s,this.lastRenderTop,this.lastRenderHeight,void 0,void 0)})),i.add(W(t,"selectionchange",()=>{const s=t.getSelection();if(!s||s.isCollapsed){n.isDisposed&&i.dispose();return}let r=this.getIndexOfListElement(s.anchorNode),a=this.getIndexOfListElement(s.focusNode);r!==void 0&&a!==void 0&&(a<r&&([r,a]=[a,r]),this.currentSelectionBounds={start:r,end:a})}))})),n.add(W(t,"mouseup",()=>{n.dispose(),this.teardownDragAndDropScrollTopAnimation(),t.getSelection()?.isCollapsed!==!1&&i.dispose()}))}getIndexOfListElement(e){if(!(!e||!this.domNode.contains(e)))for(;e&&e!==this.domNode;){if(e.dataset?.index)return Number(e.dataset.index);e=e.parentElement}}onDragOver(e){if(e.browserEvent.preventDefault(),this.onDragLeaveTimeout.dispose(),gg.CurrentDragAndDropData&&gg.CurrentDragAndDropData.getData()==="vscode-ui"||(this.setupDragAndDropScrollTopAnimation(e.browserEvent),!e.browserEvent.dataTransfer))return!1;if(!this.currentDragData)if(gg.CurrentDragAndDropData)this.currentDragData=gg.CurrentDragAndDropData;else{if(!e.browserEvent.dataTransfer.types)return!1;this.currentDragData=new $be}const t=this.dnd.onDragOver(this.currentDragData,e.element,e.index,e.sector,e.browserEvent);if(this.canDrop=typeof t=="boolean"?t:t.accept,!this.canDrop)return this.currentDragFeedback=void 0,this.currentDragFeedbackDisposable.dispose(),!1;e.browserEvent.dataTransfer.dropEffect=typeof t!="boolean"&&t.effect?.type===0?"copy":"move";let i;typeof t!="boolean"&&t.feedback?i=t.feedback:typeof e.index>"u"?i=[-1]:i=[e.index],i=Dc(i).filter(s=>s>=-1&&s<this.length).sort((s,r)=>s-r),i=i[0]===-1?[-1]:i;let n=typeof t!="boolean"&&t.effect&&t.effect.position?t.effect.position:"drop-target";if(jbe(this.currentDragFeedback,i)&&this.currentDragFeedbackPosition===n)return!0;if(this.currentDragFeedback=i,this.currentDragFeedbackPosition=n,this.currentDragFeedbackDisposable.dispose(),i[0]===-1)this.domNode.classList.add(n),this.rowsContainer.classList.add(n),this.currentDragFeedbackDisposable=ue(()=>{this.domNode.classList.remove(n),this.rowsContainer.classList.remove(n)});else{if(i.length>1&&n!=="drop-target")throw new Error("Can't use multiple feedbacks with position different than 'over'");n==="drop-target-after"&&i[0]<this.length-1&&(i[0]+=1,n="drop-target-before");for(const s of i){const r=this.items[s];r.dropTarget=!0,r.row?.domNode.classList.add(n)}this.currentDragFeedbackDisposable=ue(()=>{for(const s of i){const r=this.items[s];r.dropTarget=!1,r.row?.domNode.classList.remove(n)}})}return!0}onDragLeave(e){this.onDragLeaveTimeout.dispose(),this.onDragLeaveTimeout=yc(()=>this.clearDragOverFeedback(),100,this.disposables),this.currentDragData&&this.dnd.onDragLeave?.(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,gg.CurrentDragAndDropData=void 0,!(!t||!e.browserEvent.dataTransfer)&&(e.browserEvent.preventDefault(),t.update(e.browserEvent.dataTransfer),this.dnd.drop(t,e.element,e.index,e.sector,e.browserEvent))}onDragEnd(e){this.canDrop=!1,this.teardownDragAndDropScrollTopAnimation(),this.clearDragOverFeedback(),this.domNode.classList.remove("dragging"),this.currentDragData=void 0,gg.CurrentDragAndDropData=void 0,this.dnd.onDragEnd?.(e)}clearDragOverFeedback(){this.currentDragFeedback=void 0,this.currentDragFeedbackPosition=void 0,this.currentDragFeedbackDisposable.dispose(),this.currentDragFeedbackDisposable=A.None}setupDragAndDropScrollTopAnimation(e){if(!this.dragOverAnimationDisposable){const t=J6(this.domNode).top;this.dragOverAnimationDisposable=hse(me(this.domNode),this.animateDragAndDropScrollTop.bind(this,t))}this.dragOverAnimationStopDisposable.dispose(),this.dragOverAnimationStopDisposable=yc(()=>{this.dragOverAnimationDisposable&&(this.dragOverAnimationDisposable.dispose(),this.dragOverAnimationDisposable=void 0)},1e3,this.disposables),this.dragOverMouseY=e.pageY}animateDragAndDropScrollTop(e){if(this.dragOverMouseY===void 0)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)}getTargetSector(e,t){if(t===void 0)return;const i=e.offsetY/this.items[t].size,n=Math.floor(i/.25);return ks(n,0,3)}getItemIndexFromEventTarget(e){const t=this.scrollableElement.getDomNode();let i=e;for(;(ai(i)||sH(i))&&i!==this.rowsContainer&&t.contains(i);){const n=i.getAttribute("data-index");if(n){const s=Number(n);if(!isNaN(s))return s}i=i.parentElement}}getVisibleRange(e,t){return{start:this.rangeMap.indexAt(e),end:this.rangeMap.indexAfter(e+t-1)}}getRenderRange(e,t){const i=this.getVisibleRange(e,t);if(this.currentSelectionBounds){const n=this.rangeMap.count;i.start=Math.min(i.start,this.currentSelectionBounds.start,n),i.end=Math.min(Math.max(i.end,this.currentSelectionBounds.end+1),n)}return i}_rerender(e,t,i){const n=this.getRenderRange(e,t);let s,r;e===this.elementTop(n.start)?(s=n.start,r=0):n.end-n.start>1&&(s=n.start+1,r=this.elementTop(s)-e);let a=0;for(;;){const l=this.getRenderRange(e,t);let c=!1;for(let d=l.start;d<l.end;d++){const h=this.probeDynamicHeight(d);h!==0&&this.rangeMap.splice(d,1,[this.items[d]]),a+=h,c=c||h!==0}if(!c){a!==0&&this.eventuallyUpdateScrollDimensions();const d=Kn.relativeComplement(n,l);for(const u of d)for(let f=u.start;f<u.end;f++)this.items[f].row&&this.removeItemFromDOM(f);const h=Kn.relativeComplement(l,n).reverse();for(const u of h)for(let f=u.end-1;f>=u.start;f--)this.insertItemInDOM(f);for(let u=l.start;u<l.end;u++)this.items[u].row&&this.updateItemInDOM(this.items[u],u);if(typeof s=="number"){const u=this.scrollable.getFutureScrollPosition().scrollTop-e,f=this.elementTop(s)-r+u;this.setScrollTop(f,i)}this._onDidChangeContentHeight.fire(this.contentHeight);return}}}probeDynamicHeight(e){const t=this.items[e];if(this.virtualDelegate.getDynamicHeight){const r=this.virtualDelegate.getDynamicHeight(t.element);if(r!==null){const a=t.size;return t.size=r,t.lastDynamicHeightWidth=this.renderWidth,r-a}}if(!t.hasDynamicHeight||t.lastDynamicHeightWidth===this.renderWidth||this.virtualDelegate.hasDynamicHeight&&!this.virtualDelegate.hasDynamicHeight(t.element))return 0;const i=t.size;if(t.row)return t.row.domNode.style.height="",t.size=t.row.domNode.offsetHeight,t.size===0&&!Zi(t.row.domNode,me(t.row.domNode).document.body)&&console.warn("Measuring item node that is not in DOM! Add ListView to the DOM before measuring row height!",new Error().stack),t.lastDynamicHeightWidth=this.renderWidth,t.size-i;const{row:n}=this.cache.alloc(t.templateId);n.domNode.style.height="",this.rowsContainer.appendChild(n.domNode);const s=this.renderers.get(t.templateId);if(!s)throw new Ce("Missing renderer for templateId: "+t.templateId);return s.renderElement(t.element,e,n.templateData),t.size=n.domNode.offsetHeight,s.disposeElement?.(t.element,e,n.templateData),this.virtualDelegate.setDynamicHeight?.(t.element,t.size),t.lastDynamicHeightWidth=this.renderWidth,n.domNode.remove(),this.cache.release(n),t.size-i}getElementDomId(e){return`${this.domId}_${e}`}dispose(){for(const e of this.items)if(e.dragStartDisposable.dispose(),e.checkedDisposable.dispose(),e.row){const t=this.renderers.get(e.row.templateId);t&&(t.disposeElement?.(e.element,-1,e.row.templateData,void 0),t.disposeTemplate(e.row.templateData))}this.items=[],this.domNode?.remove(),this.dragOverAnimationDisposable?.dispose(),this.disposables.dispose()}};CN.InstanceCount=0;let ia=CN;ad([vi],ia.prototype,"onMouseClick",null),ad([vi],ia.prototype,"onMouseDblClick",null),ad([vi],ia.prototype,"onMouseMiddleClick",null),ad([vi],ia.prototype,"onMouseDown",null),ad([vi],ia.prototype,"onMouseOver",null),ad([vi],ia.prototype,"onMouseOut",null),ad([vi],ia.prototype,"onContextMenu",null),ad([vi],ia.prototype,"onTouchStart",null),ad([vi],ia.prototype,"onTap",null);var Bh=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class Kbe{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(s=>s.templateData===i);if(n>=0){const s=this.renderedElements[n];this.trait.unrender(i),s.index=t}else{const s={index:t,templateData:i};this.renderedElements.push(s)}this.trait.renderIndex(t,i)}splice(e,t,i){const n=[];for(const s of this.renderedElements)s.index<e?n.push(s):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(i=>i.templateData===e);t<0||this.renderedElements.splice(t,1)}}let Xx=class{get onChange(){return this._onChange.event}get name(){return this._trait}get renderer(){return new Kbe(this)}constructor(e){this._trait=e,this.indexes=[],this.sortedIndexes=[],this._onChange=new P}splice(e,t,i){const n=i.length-t,s=e+t,r=[];let a=0;for(;a<this.sortedIndexes.length&&this.sortedIndexes[a]<e;)r.push(this.sortedIndexes[a++]);for(let l=0;l<i.length;l++)i[l]&&r.push(l+e);for(;a<this.sortedIndexes.length&&this.sortedIndexes[a]>=s;)r.push(this.sortedIndexes[a++]+n);this.renderer.splice(e,t,i.length),this._set(r,r)}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(fq),t)}_set(e,t,i){const n=this.indexes,s=this.sortedIndexes;this.indexes=e,this.sortedIndexes=t;const r=JA(s,e);return this.renderer.renderIndexes(r),this._onChange.fire({indexes:e,browserEvent:i}),n}get(){return this.indexes}contains(e){return py(this.sortedIndexes,e,fq)>=0}dispose(){pt(this._onChange)}};Bh([vi],Xx.prototype,"renderer",null);class Gbe extends Xx{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 QA{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(a=>this.identityProvider.getId(this.view.element(a)).toString());if(n.length===0)return this.trait.splice(e,t,new Array(i.length).fill(!1));const s=new Set(n),r=i.map(a=>s.has(this.identityProvider.getId(a).toString()));this.trait.splice(e,t,r)}}function ow(o,e){return o.classList.contains(e)?!0:o.classList.contains("monaco-list")||!o.parentElement?!1:ow(o.parentElement,e)}function rw(o){return ow(o,"monaco-editor")}function Zbe(o){return ow(o,"monaco-custom-toggle")}function Ybe(o){return ow(o,"action-item")}function aw(o){return ow(o,"monaco-tree-sticky-row")}function lw(o){return o.classList.contains("monaco-tree-sticky-container")}function aq(o){return o.tagName==="A"&&o.classList.contains("monaco-button")||o.tagName==="DIV"&&o.classList.contains("monaco-button-dropdown")?!0:o.classList.contains("monaco-list")||!o.parentElement?!1:aq(o.parentElement)}class lq{get onKeyDown(){return ie.chain(this.disposables.add(new gt(this.view.domNode,"keydown")).event,e=>e.filter(t=>!ya(t.target)).map(t=>new St(t)))}constructor(e,t,i){this.list=e,this.view=t,this.disposables=new U,this.multipleSelectionDisposables=new U,this.multipleSelectionSupport=i.multipleSelectionSupport,this.disposables.add(this.onKeyDown(n=>{switch(n.keyCode){case 3:return this.onEnter(n);case 16:return this.onUpArrow(n);case 18:return this.onDownArrow(n);case 11:return this.onPageUpArrow(n);case 12:return this.onPageDownArrow(n);case 9:return this.onEscape(n);case 31:this.multipleSelectionSupport&&(ze?n.metaKey:n.ctrlKey)&&this.onCtrlA(n)}}))}updateOptions(e){e.multipleSelectionSupport!==void 0&&(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(Bs(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()}}Bh([vi],lq.prototype,"onKeyDown",null);var Fl;(function(o){o[o.Automatic=0]="Automatic",o[o.Trigger=1]="Trigger"})(Fl||(Fl={}));var V_;(function(o){o[o.Idle=0]="Idle",o[o.Typing=1]="Typing"})(V_||(V_={}));const Xbe=new class{mightProducePrintableCharacter(o){return o.ctrlKey||o.metaKey||o.altKey?!1:o.keyCode>=31&&o.keyCode<=56||o.keyCode>=21&&o.keyCode<=30||o.keyCode>=98&&o.keyCode<=107||o.keyCode>=85&&o.keyCode<=95}};class Qbe{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=V_.Idle,this.mode=Fl.Automatic,this.triggered=!1,this.previouslyFocused=-1,this.enabledDisposables=new U,this.disposables=new U,this.updateOptions(e.options)}updateOptions(e){e.typeNavigationEnabled??!0?this.enable():this.disable(),this.mode=e.typeNavigationMode??Fl.Automatic}enable(){if(this.enabled)return;let e=!1;const t=ie.chain(this.enabledDisposables.add(new gt(this.view.domNode,"keydown")).event,s=>s.filter(r=>!ya(r.target)).filter(()=>this.mode===Fl.Automatic||this.triggered).map(r=>new St(r)).filter(r=>e||this.keyboardNavigationEventFilter(r)).filter(r=>this.delegate.mightProducePrintableCharacter(r)).forEach(r=>st.stop(r,!0)).map(r=>r.browserEvent.key)),i=ie.debounce(t,()=>null,800,void 0,void 0,void 0,this.enabledDisposables);ie.reduce(ie.any(t,i),(s,r)=>r===null?null:(s||"")+r,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(){const e=this.list.getFocus();if(e.length>0&&e[0]===this.previouslyFocused){const t=this.list.options.accessibilityProvider?.getAriaLabel(this.list.element(e[0]));typeof t=="string"?ps(t):t&&ps(t.get())}this.previouslyFocused=-1}onInput(e){if(!e){this.state=V_.Idle,this.triggered=!1;return}const t=this.list.getFocus(),i=t.length>0?t[0]:0,n=this.state===V_.Idle?1:0;this.state=V_.Typing;for(let s=0;s<this.list.length;s++){const r=(i+s+n)%this.list.length,a=this.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(this.view.element(r)),l=a&&a.toString();if(this.list.options.typeNavigationEnabled){if(typeof l<"u"){if(Hv(e,l)){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}const c=Hme(e,l);if(c&&c[0].end-c[0].start>1&&c.length===1){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}else if(typeof l>"u"||Hv(e,l)){this.previouslyFocused=i,this.list.setFocus([r]),this.list.reveal(r);return}}}dispose(){this.disable(),this.enabledDisposables.dispose(),this.disposables.dispose()}}class Jbe{constructor(e,t){this.list=e,this.view=t,this.disposables=new U;const i=ie.chain(this.disposables.add(new gt(t.domNode,"keydown")).event,s=>s.filter(r=>!ya(r.target)).map(r=>new St(r)));ie.chain(i,s=>s.filter(r=>r.keyCode===2&&!r.ctrlKey&&!r.metaKey&&!r.shiftKey&&!r.altKey))(this.onTab,this,this.disposables)}onTab(e){if(e.target!==this.view.domNode)return;const t=this.list.getFocus();if(t.length===0)return;const i=this.view.domElement(t[0]);if(!i)return;const n=i.querySelector("[tabIndex]");if(!n||!ai(n)||n.tabIndex===-1)return;const s=me(n).getComputedStyle(n);s.visibility==="hidden"||s.display==="none"||(e.preventDefault(),e.stopPropagation(),n.focus())}dispose(){this.disposables.dispose()}}function cq(o){return ze?o.browserEvent.metaKey:o.browserEvent.ctrlKey}function dq(o){return o.browserEvent.shiftKey}function eCe(o){return i2(o)&&o.button===2}const hq={isSelectionSingleChangeEvent:cq,isSelectionRangeChangeEvent:dq};class uq{get onPointer(){return this._onPointer.event}constructor(e){this.list=e,this.disposables=new U,this._onPointer=this.disposables.add(new P),e.options.multipleSelectionSupport!==!1&&(this.multipleSelectionController=this.list.options.multipleSelectionController||hq),this.mouseSupport=typeof e.options.mouseSupport>"u"||!!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($n.addTarget(e.getHTMLElement()))),ie.any(e.onMouseClick,e.onMouseMiddleClick,e.onTap)(this.onViewPointer,this,this.disposables)}updateOptions(e){e.multipleSelectionSupport!==void 0&&(this.multipleSelectionController=void 0,e.multipleSelectionSupport&&(this.multipleSelectionController=this.list.options.multipleSelectionController||hq))}isSelectionSingleChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionSingleChangeEvent(e):!1}isSelectionRangeChangeEvent(e){return this.multipleSelectionController?this.multipleSelectionController.isSelectionRangeChangeEvent(e):!1}isSelectionChangeEvent(e){return this.isSelectionSingleChangeEvent(e)||this.isSelectionRangeChangeEvent(e)}onMouseDown(e){rw(e.browserEvent.target)||Ui()!==e.browserEvent.target&&this.list.domFocus()}onContextMenu(e){if(ya(e.browserEvent.target)||rw(e.browserEvent.target))return;const t=typeof e.index>"u"?[]:[e.index];this.list.setFocus(t,e.browserEvent)}onViewPointer(e){if(!this.mouseSupport||ya(e.browserEvent.target)||rw(e.browserEvent.target)||e.browserEvent.isHandledByList)return;e.browserEvent.isHandledByList=!0;const t=e.index;if(typeof t>"u"){this.list.setFocus([],e.browserEvent),this.list.setSelection([],e.browserEvent),this.list.setAnchor(void 0);return}if(this.isSelectionChangeEvent(e))return this.changeSelection(e);this.list.setFocus([t],e.browserEvent),this.list.setAnchor(t),eCe(e.browserEvent)||this.list.setSelection([t],e.browserEvent),this._onPointer.fire(e)}onDoubleClick(e){if(ya(e.browserEvent.target)||rw(e.browserEvent.target)||this.isSelectionChangeEvent(e)||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)){typeof i>"u"&&(i=this.list.getFocus()[0]??t,this.list.setAnchor(i));const n=Math.min(i,t),s=Math.max(i,t),r=Bs(n,s+1),a=this.list.getSelection(),l=sCe(JA(a,[i]),i);if(l.length===0)return;const c=JA(r,oCe(a,l));this.list.setSelection(c,e.browserEvent),this.list.setFocus([t],e.browserEvent)}else if(this.isSelectionSingleChangeEvent(e)){const n=this.list.getSelection(),s=n.filter(r=>r!==t);this.list.setFocus([t]),this.list.setAnchor(t),n.length===s.length?this.list.setSelection([...s,t],e.browserEvent):this.list.setSelection(s,e.browserEvent)}}dispose(){this.disposables.dispose()}}class tCe{constructor(e,t){this.styleElement=e,this.selectorSuffix=t}style(e){const t=this.selectorSuffix&&`.${this.selectorSuffix}`,i=[];e.listBackground&&i.push(`.monaco-list${t} .monaco-list-rows { background: ${e.listBackground}; }`),e.listFocusBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.focused { background-color: ${e.listFocusBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.focused:hover { background-color: ${e.listFocusBackground}; }`)),e.listFocusForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),e.listActiveSelectionBackground&&(i.push(`.monaco-list${t}:focus .monaco-list-row.selected { background-color: ${e.listActiveSelectionBackground}; }`),i.push(`.monaco-list${t}:focus .monaco-list-row.selected:hover { background-color: ${e.listActiveSelectionBackground}; }`)),e.listActiveSelectionForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected { color: ${e.listActiveSelectionForeground}; }`),e.listActiveSelectionIconForeground&&i.push(`.monaco-list${t}:focus .monaco-list-row.selected .codicon { color: ${e.listActiveSelectionIconForeground}; }`),e.listFocusAndSelectionBackground&&i.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus .monaco-list-row.selected.focused { background-color: ${e.listFocusAndSelectionBackground}; }
`),e.listFocusAndSelectionForeground&&i.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus .monaco-list-row.selected.focused { color: ${e.listFocusAndSelectionForeground}; }
`),e.listInactiveFocusForeground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { color: ${e.listInactiveFocusForeground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { color: ${e.listInactiveFocusForeground}; }`)),e.listInactiveSelectionIconForeground&&i.push(`.monaco-list${t} .monaco-list-row.focused .codicon { color: ${e.listInactiveSelectionIconForeground}; }`),e.listInactiveFocusBackground&&(i.push(`.monaco-list${t} .monaco-list-row.focused { background-color: ${e.listInactiveFocusBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.focused:hover { background-color: ${e.listInactiveFocusBackground}; }`)),e.listInactiveSelectionBackground&&(i.push(`.monaco-list${t} .monaco-list-row.selected { background-color: ${e.listInactiveSelectionBackground}; }`),i.push(`.monaco-list${t} .monaco-list-row.selected:hover { background-color: ${e.listInactiveSelectionBackground}; }`)),e.listInactiveSelectionForeground&&i.push(`.monaco-list${t} .monaco-list-row.selected { color: ${e.listInactiveSelectionForeground}; }`),e.listHoverBackground&&i.push(`.monaco-list${t}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { background-color: ${e.listHoverBackground}; }`),e.listHoverForeground&&i.push(`.monaco-list${t}:not(.drop-target):not(.dragging) .monaco-list-row:hover:not(.selected):not(.focused) { color: ${e.listHoverForeground}; }`);const n=od(e.listFocusAndSelectionOutline,od(e.listSelectionOutline,e.listFocusOutline??""));n&&i.push(`.monaco-list${t}:focus .monaco-list-row.focused.selected { outline: 1px solid ${n}; outline-offset: -1px;}`),e.listFocusOutline&&i.push(`
.monaco-drag-image${t},
.monaco-list${t}:focus .monaco-list-row.focused,
.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }
`);const s=od(e.listSelectionOutline,e.listInactiveFocusOutline??"");s&&i.push(`.monaco-list${t} .monaco-list-row.focused.selected { outline: 1px dotted ${s}; outline-offset: -1px; }`),e.listSelectionOutline&&i.push(`.monaco-list${t} .monaco-list-row.selected { outline: 1px dotted ${e.listSelectionOutline}; outline-offset: -1px; }`),e.listInactiveFocusOutline&&i.push(`.monaco-list${t} .monaco-list-row.focused { outline: 1px dotted ${e.listInactiveFocusOutline}; outline-offset: -1px; }`),e.listHoverOutline&&i.push(`.monaco-list${t} .monaco-list-row:hover { outline: 1px dashed ${e.listHoverOutline}; outline-offset: -1px; }`),e.listDropOverBackground&&i.push(`
.monaco-list${t}.drop-target,
.monaco-list${t} .monaco-list-rows.drop-target,
.monaco-list${t} .monaco-list-row.drop-target { background-color: ${e.listDropOverBackground} !important; color: inherit !important; }
`),e.listDropBetweenBackground&&(i.push(`
.monaco-list${t} .monaco-list-rows.drop-target-before .monaco-list-row:first-child::before,
.monaco-list${t} .monaco-list-row.drop-target-before::before {
content: ""; position: absolute; top: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${e.listDropBetweenBackground};
}`),i.push(`
.monaco-list${t} .monaco-list-rows.drop-target-after .monaco-list-row:last-child::after,
.monaco-list${t} .monaco-list-row.drop-target-after::after {
content: ""; position: absolute; bottom: 0px; left: 0px; width: 100%; height: 1px;
background-color: ${e.listDropBetweenBackground};
}`)),e.tableColumnsBorder&&i.push(`
.monaco-table > .monaco-split-view2,
.monaco-table > .monaco-split-view2 .monaco-sash.vertical::before,
.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2,
.monaco-workbench:not(.reduce-motion) .monaco-table:hover > .monaco-split-view2 .monaco-sash.vertical::before {
border-color: ${e.tableColumnsBorder};
}
.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2,
.monaco-workbench:not(.reduce-motion) .monaco-table > .monaco-split-view2 .monaco-sash.vertical::before {
border-color: transparent;
}
`),e.tableOddRowsBackgroundColor&&i.push(`
.monaco-table .monaco-list-row[data-parity=odd]:not(.focused):not(.selected):not(:hover) .monaco-table-tr,
.monaco-table .monaco-list:not(:focus) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr,
.monaco-table .monaco-list:not(.focused) .monaco-list-row[data-parity=odd].focused:not(.selected):not(:hover) .monaco-table-tr {
background-color: ${e.tableOddRowsBackgroundColor};
}
`),this.styleElement.textContent=i.join(`
`)}}const iCe={listFocusBackground:"#7FB0D0",listActiveSelectionBackground:"#0E639C",listActiveSelectionForeground:"#FFFFFF",listActiveSelectionIconForeground:"#FFFFFF",listFocusAndSelectionOutline:"#90C2F9",listFocusAndSelectionBackground:"#094771",listFocusAndSelectionForeground:"#FFFFFF",listInactiveSelectionBackground:"#3F3F46",listInactiveSelectionIconForeground:"#FFFFFF",listHoverBackground:"#2A2D2E",listDropOverBackground:"#383B3D",listDropBetweenBackground:"#EEEEEE",treeIndentGuidesStroke:"#a9a9a9",treeInactiveIndentGuidesStroke:$.fromHex("#a9a9a9").transparent(.4).toString(),tableColumnsBorder:$.fromHex("#cccccc").transparent(.2).toString(),tableOddRowsBackgroundColor:$.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,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},nCe={keyboardSupport:!0,mouseSupport:!0,multipleSelectionSupport:!0,dnd:{getDragURI(){return null},onDragStart(){},onDragOver(){return!1},drop(){},dispose(){}}};function sCe(o,e){const t=o.indexOf(e);if(t===-1)return[];const i=[];let n=t-1;for(;n>=0&&o[n]===e-(t-n);)i.push(o[n--]);for(i.reverse(),n=t;n<o.length&&o[n]===e+(n-t);)i.push(o[n++]);return i}function JA(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){t.push(o[i]),i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):t.push(e[n++]);return t}function oCe(o,e){const t=[];let i=0,n=0;for(;i<o.length||n<e.length;)if(i>=o.length)t.push(e[n++]);else if(n>=e.length)t.push(o[i++]);else if(o[i]===e[n]){i++,n++;continue}else o[i]<e[n]?t.push(o[i++]):n++;return t}const fq=(o,e)=>o-e;class rCe{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 r of this.renderers)r.renderElement(e,t,i[s++],n)}disposeElement(e,t,i,n){let s=0;for(const r of this.renderers)r.disposeElement?.(e,t,i[s],n),s+=1}disposeTemplate(e){let t=0;for(const i of this.renderers)i.disposeTemplate(e[t++])}}class aCe{constructor(e){this.accessibilityProvider=e,this.templateId="a18n"}renderTemplate(e){return{container:e,disposables:new U}}renderElement(e,t,i){const n=this.accessibilityProvider.getAriaLabel(e),s=n&&typeof n!="string"?n:Et(n);i.disposables.add(Se(a=>{this.setAriaLabel(a.readObservable(s),i.container)}));const r=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(e);typeof r=="number"?i.container.setAttribute("aria-level",`${r}`):i.container.removeAttribute("aria-level")}setAriaLabel(e,t){e?t.setAttribute("aria-label",e):t.removeAttribute("aria-label")}disposeElement(e,t,i){i.disposables.clear()}disposeTemplate(e){e.disposables.dispose()}}class lCe{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){this.dnd.onDragStart?.(e,t)}onDragOver(e,t,i,n,s){return this.dnd.onDragOver(e,t,i,n,s)}onDragLeave(e,t,i,n){this.dnd.onDragLeave?.(e,t,i,n)}onDragEnd(e){this.dnd.onDragEnd?.(e)}drop(e,t,i,n,s){this.dnd.drop(e,t,i,n,s)}dispose(){this.dnd.dispose()}}class jo{get onDidChangeFocus(){return ie.map(this.eventBufferer.wrapEvent(this.focus.onChange),e=>this.toListEvent(e),this.disposables)}get onDidChangeSelection(){return ie.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=ie.chain(this.disposables.add(new gt(this.view.domNode,"keydown")).event,s=>s.map(r=>new St(r)).filter(r=>e=r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>st.stop(r,!0)).filter(()=>!1)),i=ie.chain(this.disposables.add(new gt(this.view.domNode,"keyup")).event,s=>s.forEach(()=>e=!1).map(r=>new St(r)).filter(r=>r.keyCode===58||r.shiftKey&&r.keyCode===68).map(r=>st.stop(r,!0)).map(({browserEvent:r})=>{const a=this.getFocus(),l=a.length?a[0]:void 0,c=typeof l<"u"?this.view.element(l):void 0,d=typeof l<"u"?this.view.domElement(l):this.view.domNode;return{index:l,element:c,anchor:d,browserEvent:r}})),n=ie.chain(this.view.onContextMenu,s=>s.filter(r=>!e).map(({element:r,index:a,browserEvent:l})=>({element:r,index:a,anchor:new yn(me(this.view.domNode),l),browserEvent:l})));return ie.any(t,i,n)}get onKeyDown(){return this.disposables.add(new gt(this.view.domNode,"keydown")).event}get onDidFocus(){return ie.signal(this.disposables.add(new gt(this.view.domNode,"focus",!0)).event)}get onDidBlur(){return ie.signal(this.disposables.add(new gt(this.view.domNode,"blur",!0)).event)}constructor(e,t,i,n,s=nCe){this.user=e,this._options=s,this.focus=new Xx("focused"),this.anchor=new Xx("anchor"),this.eventBufferer=new i1,this._ariaLabel="",this.disposables=new U,this._onDidDispose=new P,this.onDidDispose=this._onDidDispose.event;const r=this._options.accessibilityProvider&&this._options.accessibilityProvider.getWidgetRole?this._options.accessibilityProvider?.getWidgetRole():"list";this.selection=new Gbe(r!=="listbox");const a=[this.focus.renderer,this.selection.renderer];this.accessibilityProvider=s.accessibilityProvider,this.accessibilityProvider&&(a.push(new aCe(this.accessibilityProvider)),this.accessibilityProvider.onDidChangeActiveDescendant?.(this.onDidChangeActiveDescendant,this,this.disposables)),n=n.map(c=>new rCe(c.templateId,[...a,c]));const l={...s,dnd:s.dnd&&new lCe(this,s.dnd)};if(this.view=this.createListView(t,i,n,l),this.view.domNode.setAttribute("role",r),s.styleController)this.styleController=s.styleController(this.view.domId);else{const c=Ir(this.view.domNode);this.styleController=new tCe(c,this.view.domId)}if(this.spliceable=new Obe([new QA(this.focus,this.view,s.identityProvider),new QA(this.selection,this.view,s.identityProvider),new QA(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 Jbe(this,this.view)),(typeof s.keyboardSupport!="boolean"||s.keyboardSupport)&&(this.keyboardController=new lq(this,this.view,s),this.disposables.add(this.keyboardController)),s.keyboardNavigationLabelProvider){const c=s.keyboardNavigationDelegate||Xbe;this.typeNavigationController=new Qbe(this,this.view,s.keyboardNavigationLabelProvider,s.keyboardNavigationEventFilter??(()=>!0),c),this.disposables.add(this.typeNavigationController)}if(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){const c=this.accessibilityProvider.getWidgetAriaLabel(),d=c&&typeof c!="string"?c:Et(c);this.disposables.add(Se(h=>{this.ariaLabel=h.readObservable(d)}))}this._options.multipleSelectionSupport!==!1&&this.view.domNode.setAttribute("aria-multiselectable","true")}createListView(e,t,i,n){return new ia(e,t,i,n)}createMouseController(e){return new uq(this)}updateOptions(e={}){this._options={...this._options,...e},this.typeNavigationController?.updateOptions(this._options),this._options.multipleSelectionController!==void 0&&(this._options.multipleSelectionSupport?this.view.domNode.setAttribute("aria-multiselectable","true"):this.view.domNode.removeAttribute("aria-multiselectable")),this.mouseController.updateOptions(e),this.keyboardController?.updateOptions(e),this.view.updateOptions(e)}get options(){return this._options}splice(e,t,i=[]){if(e<0||e>this.view.length)throw new fg(this.user,`Invalid start index: ${e}`);if(t<0)throw new fg(this.user,`Invalid delete count: ${t}`);t===0&&i.length===0||this.eventBufferer.bufferEvents(()=>this.spliceable.splice(e,t,i))}rerender(){this.view.rerender()}element(e){return this.view.element(e)}indexOf(e){return this.view.indexOf(e)}indexAt(e){return this.view.indexAt(e)}get length(){return this.view.length}get contentHeight(){return this.view.contentHeight}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}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 fg(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(typeof e>"u"){this.anchor.set([]);return}if(e<0||e>=this.length)throw new fg(this.user,`Invalid index ${e}`);this.anchor.set([e])}getAnchor(){return this.anchor.get().at(0)}getAnchorElement(){const e=this.getAnchor();return typeof e>"u"?void 0:this.element(e)}setFocus(e,t){for(const i of e)if(i<0||i>=this.length)throw new fg(this.user,`Invalid index ${i}`);this.focus.set(e,t)}focusNext(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findNextIndex(s.length>0?s[0]+e:0,t,n);r>-1&&this.setFocus([r],i)}focusPrevious(e=1,t=!1,i,n){if(this.length===0)return;const s=this.focus.get(),r=this.findPreviousIndex(s.length>0?s[0]-e:0,t,n);r>-1&&this.setFocus([r],i)}async focusNextPage(e,t){let i=this.view.indexAt(this.view.getScrollTop()+this.view.renderHeight);i=i===0?0:i-1;const n=this.getFocus()[0];if(n!==i&&(n===void 0||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 r=s+this.view.renderHeight;i>n&&(r-=this.view.elementHeight(i)),this.view.setScrollTop(r),this.view.getScrollTop()!==s&&(this.setFocus([]),await al(0),await this.focusNextPage(e,t))}}async focusPreviousPage(e,t,i=()=>0){let n;const s=i(),r=this.view.getScrollTop()+s;r===0?n=this.view.indexAt(r):n=this.view.indexAfter(r-1);const a=this.getFocus()[0];if(a!==n&&(a===void 0||a>=n)){const l=this.findNextIndex(n,!1,t);l>-1&&a!==l?this.setFocus([l],e):this.setFocus([n],e)}else{const l=r;this.view.setScrollTop(r-this.view.renderHeight-s),this.view.getScrollTop()+i()!==l&&(this.setFocus([]),await al(0),await this.focusPreviousPage(e,t,i))}}focusLast(e,t){if(this.length===0)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(this.length===0)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;n++){if(e>=this.length&&!t)return-1;if(e=e%this.length,!i||i(this.element(e)))return e;e++}return-1}findPreviousIndex(e,t=!1,i){for(let n=0;n<this.length;n++){if(e<0&&!t)return-1;if(e=(this.length+e%this.length)%this.length,!i||i(this.element(e)))return e;e--}return-1}getFocus(){return this.focus.get()}getFocusedElements(){return this.getFocus().map(e=>this.view.element(e))}reveal(e,t,i=0){if(e<0||e>=this.length)throw new fg(this.user,`Invalid index ${e}`);const n=this.view.getScrollTop(),s=this.view.elementTop(e),r=this.view.elementHeight(e);if(bc(t)){const a=r-this.view.renderHeight+i;this.view.setScrollTop(a*ks(t,0,1)+s-i)}else{const a=s+r,l=n+this.view.renderHeight;s<n+i&&a>=l||(s<n+i||a>=l&&r>=this.view.renderHeight?this.view.setScrollTop(s-i):a>=l&&this.view.setScrollTop(a-this.view.renderHeight))}}getRelativeTop(e,t=0){if(e<0||e>=this.length)throw new fg(this.user,`Invalid index ${e}`);const i=this.view.getScrollTop(),n=this.view.elementTop(e),s=this.view.elementHeight(e);if(n<i+t||n+s>i+this.view.renderHeight)return null;const r=s-this.view.renderHeight+t;return Math.abs((i+t-n)/r)}getHTMLElement(){return this.view.domNode}getScrollableElement(){return this.view.scrollableElementDomNode}getElementID(e){return this.view.getElementDomId(e)}getElementTop(e){return this.view.elementTop(e)}style(e){this.styleController.style(e)}toListEvent({indexes:e,browserEvent:t}){return{indexes:e,elements:e.map(i=>this.view.element(i)),browserEvent:t}}_onFocusChange(){const e=this.focus.get();this.view.domNode.classList.toggle("element-focused",e.length>0),this.onDidChangeActiveDescendant()}onDidChangeActiveDescendant(){const e=this.focus.get();if(e.length>0){let t;this.accessibilityProvider?.getActiveDescendantId&&(t=this.accessibilityProvider.getActiveDescendantId(this.view.element(e[0]))),this.view.domNode.setAttribute("aria-activedescendant",t||this.view.getElementDomId(e[0]))}else this.view.domNode.removeAttribute("aria-activedescendant")}_onSelectionChange(){const e=this.selection.get();this.view.domNode.classList.toggle("selection-none",e.length===0),this.view.domNode.classList.toggle("selection-single",e.length===1),this.view.domNode.classList.toggle("selection-multiple",e.length>1)}dispose(){this._onDidDispose.fire(),this.disposables.dispose(),this._onDidDispose.dispose()}}Bh([vi],jo.prototype,"onDidChangeFocus",null),Bh([vi],jo.prototype,"onDidChangeSelection",null),Bh([vi],jo.prototype,"onContextMenu",null),Bh([vi],jo.prototype,"onKeyDown",null),Bh([vi],jo.prototype,"onDidFocus",null),Bh([vi],jo.prototype,"onDidBlur",null);const pg=Q,gq="selectOption.entry.template";class cCe{get templateId(){return gq}renderTemplate(e){const t=Object.create(null);return t.root=e,t.text=Z(e,pg(".option-text")),t.detail=Z(e,pg(".option-detail")),t.decoratorRight=Z(e,pg(".option-decorator-right")),t}renderElement(e,t,i){const n=i,s=e.text,r=e.detail,a=e.decoratorRight,l=e.isDisabled;n.text.textContent=s,n.detail.textContent=r||"",n.decoratorRight.textContent=a||"",l?n.root.classList.add("option-disabled"):n.root.classList.remove("option-disabled")}disposeTemplate(e){}}const dc=class dc extends A{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),typeof this.selectBoxOptions.minBottomMargin!="number"?this.selectBoxOptions.minBottomMargin=dc.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",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=new P,this._register(this._onDidSelect),this.registerListeners(),this.constructSelectDropDown(i),this.selected=t||0,e&&this.setOptions(e,t),this.initStyleSheet()}setTitle(e){!this._hover&&e?this._hover=this._register(ta().setupManagedHover(Zs("mouse"),this.selectElement,e)):this._hover&&this._hover.update(e)}getHeight(){return 22}getTemplateId(){return gq}constructSelectDropDown(e){this.contextViewProvider=e,this.selectDropDownContainer=Q(".monaco-select-box-dropdown-container"),this.selectDropDownContainer.classList.add("monaco-select-box-dropdown-padding"),this.selectionDetailsPane=Z(this.selectDropDownContainer,pg(".select-box-details-pane"));const t=Z(this.selectDropDownContainer,pg(".select-box-dropdown-container-width-control")),i=Z(t,pg(".width-control-div"));this.widthControlElement=document.createElement("span"),this.widthControlElement.className="option-text-width-control",Z(i,this.widthControlElement),this._dropDownPosition=0,this.styleElement=Ir(this.selectDropDownContainer),this.selectDropDownContainer.setAttribute("draggable","true"),this._register(W(this.selectDropDownContainer,te.DRAG_START,n=>{st.stop(n,!0)}))}registerListeners(){this._register(Si(this.selectElement,"change",t=>{this.selected=t.target.selectedIndex,this._onDidSelect.fire({index:t.target.selectedIndex,selected:t.target.value}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)})),this._register(W(this.selectElement,te.CLICK,t=>{st.stop(t),this._isVisible?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(W(this.selectElement,te.MOUSE_DOWN,t=>{st.stop(t)}));let e;this._register(W(this.selectElement,"touchstart",t=>{e=this._isVisible})),this._register(W(this.selectElement,"touchend",t=>{st.stop(t),e?this.hideSelectDropDown(!0):this.showSelectDropDown()})),this._register(W(this.selectElement,te.KEY_DOWN,t=>{const i=new St(t);let n=!1;ze?(i.keyCode===18||i.keyCode===16||i.keyCode===10||i.keyCode===3)&&(n=!0):(i.keyCode===18&&i.altKey||i.keyCode===16&&i.altKey||i.keyCode===10||i.keyCode===3)&&(n=!0),n&&(this.showSelectDropDown(),st.stop(t,!0))}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){Ut(this.options,e)||(this.options=e,this.selectElement.options.length=0,this._hasDetails=!1,this._cachedMaxDetailsHeight=void 0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled)),typeof i.description=="string"&&(this._hasDetails=!0)})),t!==void 0&&(this.select(t),this._currentSelection=this.selected)}setOptionsList(){this.selectList?.splice(0,this.selectList.length,this.options)}select(e){e>=0&&e<this.options.length?this.selected=e:e>this.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.setTitle(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(`
`)}styleSelectElement(){const e=this.styles.selectBackground??"",t=this.styles.selectForeground??"",i=this.styles.selectBorder??"";this.selectElement.style.backgroundColor=e,this.selectElement.style.color=t,this.selectElement.style.borderColor=i}styleList(){const e=this.styles.selectBackground??"",t=od(this.styles.selectListBackground,e);this.selectDropDownListContainer.style.backgroundColor=t,this.selectionDetailsPane.style.backgroundColor=t;const i=this.styles.focusBorder??"";this.selectDropDownContainer.style.outlineColor=i,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.textContent="",!(!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:()=>{this.selectDropDownContainer.remove()}}}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=me(this.selectElement),i=mi(this.selectElement),n=me(this.selectElement).getComputedStyle(this.selectElement),s=parseFloat(n.getPropertyValue("--dropdown-padding-top"))+parseFloat(n.getPropertyValue("--dropdown-padding-bottom")),r=t.innerHeight-i.top-i.height-(this.selectBoxOptions.minBottomMargin||0),a=i.top-dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN,l=this.selectElement.offsetWidth,c=this.setWidthControlElement(this.widthControlElement),d=Math.max(c,Math.round(l)).toString()+"px";this.selectDropDownContainer.style.width=d,this.selectList.getHTMLElement().style.height="",this.selectList.layout();let h=this.selectList.contentHeight;this._hasDetails&&this._cachedMaxDetailsHeight===void 0&&(this._cachedMaxDetailsHeight=this.measureMaxDetailsHeight());const u=this._hasDetails?this._cachedMaxDetailsHeight:0,f=h+s+u,g=Math.floor((r-s-u)/this.getHeight()),m=Math.floor((a-s-u)/this.getHeight());if(e)return i.top+i.height>t.innerHeight-22||i.top<dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||g<1&&m<1?!1:(g<dc.DEFAULT_MINIMUM_VISIBLE_OPTIONS&&m>g&&this.options.length>g?(this._dropDownPosition=1,this.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),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.selectDropDownListContainer.remove(),this.selectionDetailsPane.remove(),this.selectDropDownContainer.appendChild(this.selectDropDownListContainer),this.selectDropDownContainer.appendChild(this.selectionDetailsPane),this.selectionDetailsPane.classList.remove("border-bottom"),this.selectionDetailsPane.classList.add("border-top")),!0);if(i.top+i.height>t.innerHeight-22||i.top<dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN||this._dropDownPosition===0&&g<1||this._dropDownPosition===1&&m<1)return this.hideSelectDropDown(!0),!1;if(this._dropDownPosition===0){if(this._isVisible&&g+m<1)return this.hideSelectDropDown(!0),!1;f>r&&(h=g*this.getHeight())}else f>a&&(h=m*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+s+"px",this.selectDropDownContainer.style.height=""):this.selectDropDownContainer.style.height=h+s+"px",this.updateDetail(this.selected),this.selectDropDownContainer.style.width=d,this.selectDropDownListContainer.setAttribute("tabindex","0"),this.selectElement.classList.add("synthetic-focus"),this.selectDropDownContainer.classList.add("synthetic-focus"),!0}else return!1}setWidthControlElement(e){let t=0;if(e){let i=0,n=0;this.options.forEach((s,r)=>{const a=s.detail?s.detail.length:0,l=s.decoratorRight?s.decoratorRight.length:0,c=s.text.length+a+l;c>n&&(i=r,n=c)}),e.textContent=this.options[i].text+(this.options[i].decoratorRight?this.options[i].decoratorRight+" ":""),t=ho(e)}return t}createSelectList(e){if(this.selectList)return;this.selectDropDownListContainer=Z(e,pg(".select-box-dropdown-list-container")),this.listRenderer=new cCe,this.selectList=this._register(new jo("SelectBoxCustom",this.selectDropDownListContainer,this,[this.listRenderer],{useShadows:!1,verticalScrollMode:3,keyboardSupport:!1,mouseSupport:!1,accessibilityProvider:{getAriaLabel:n=>{let s=n.text;return n.detail&&(s+=`. ${n.detail}`),n.decoratorRight&&(s+=`. ${n.decoratorRight}`),n.description&&(s+=`. ${n.description}`),s},getWidgetAriaLabel:()=>p(16,"Select Box"),getRole:()=>ze?"":"option",getWidgetRole:()=>"listbox"}})),this.selectBoxOptions.ariaLabel&&(this.selectList.ariaLabel=this.selectBoxOptions.ariaLabel);const t=this._register(new gt(this.selectDropDownListContainer,"keydown")),i=ie.chain(t.event,n=>n.filter(()=>this.selectList.length>0).map(s=>new St(s)));this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===3))(this.onEnter,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===2))(this.onEnter,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===9))(this.onEscape,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===16))(this.onUpArrow,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===18))(this.onDownArrow,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===12))(this.onPageDown,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===11))(this.onPageUp,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===14))(this.onHome,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode===13))(this.onEnd,this)),this._register(ie.chain(i,n=>n.filter(s=>s.keyCode>=21&&s.keyCode<=56||s.keyCode>=85&&s.keyCode<=113))(this.onCharacter,this)),this._register(W(this.selectList.getHTMLElement(),te.POINTER_UP,n=>this.onPointerUp(n))),this._register(this.selectList.onMouseOver(n=>typeof n.index<"u"&&this.selectList.setFocus([n.index]))),this._register(this.selectList.onDidChangeFocus(n=>this.onListFocus(n))),this._register(W(this.selectDropDownContainer,te.FOCUS_OUT,n=>{!this._isVisible||Zi(n.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;st.stop(e);const t=e.target;if(!t||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<this.options.length&&!s&&(this.selected=n,this.select(this.selected),this.selectList.setFocus([this.selected]),this.selectList.reveal(this.selectList.getFocus()[0]),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0))}onListBlur(){this._sticky||(this.selected!==this._currentSelection&&this.select(this._currentSelection),this.hideSelectDropDown(!1))}renderDescriptionMarkdown(e,t){const i=s=>{for(let r=0;r<s.childNodes.length;r++){const a=s.childNodes.item(r);(a.tagName&&a.tagName.toLowerCase())==="img"?a.remove():i(a)}},n=iw({value:e,supportThemeIcons:!0},{actionHandler:t});return n.element.classList.add("select-box-description-markdown"),i(n.element),n.element}onListFocus(e){!this._isVisible||!this._hasDetails||this.updateDetail(e.indexes[0])}updateDetail(e){this.selectionDetailsPane.textContent="";const t=this.options[e],i=t?.description??"",n=t?.descriptionIsMarkdown??!1;if(i){if(n){const s=t.descriptionMarkdownActionHandler;this.selectionDetailsPane.appendChild(this.renderDescriptionMarkdown(i,s))}else this.selectionDetailsPane.textContent=i;this.selectionDetailsPane.style.display="block"}else this.selectionDetailsPane.style.display="none";this._skipLayout=!0,this.contextViewProvider.layout(),this._skipLayout=!1}onEscape(e){st.stop(e),this.select(this._currentSelection),this.hideSelectDropDown(!0)}onEnter(e){st.stop(e),this.selected!==this._currentSelection&&(this._currentSelection=this.selected,this._onDidSelect.fire({index:this.selectElement.selectedIndex,selected:this.options[this.selected].text}),this.options[this.selected]&&this.options[this.selected].text&&this.setTitle(this.options[this.selected].text)),this.hideSelectDropDown(!0)}onDownArrow(e){if(this.selected<this.options.length-1){st.stop(e,!0);const t=this.options[this.selected+1].isDisabled;if(t&&this.options.length>this.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){this.selected>0&&(st.stop(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){st.stop(e),this.selectList.focusPreviousPage(),setTimeout(()=>{this.selected=this.selectList.getFocus()[0],this.options[this.selected].isDisabled&&this.selected<this.options.length-1&&(this.selected++,this.selectList.setFocus([this.selected])),this.selectList.reveal(this.selected),this.select(this.selected)},1)}onPageDown(e){st.stop(e),this.selectList.focusNextPage(),setTimeout(()=>{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){st.stop(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){st.stop(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=wc.toString(e.keyCode);let i=-1;for(let n=0;n<this.options.length-1;n++)if(i=(n+this.selected+1)%this.options.length,this.options[i].text.charAt(0).toUpperCase()===t&&!this.options[i].isDisabled){this.select(i),this.selectList.setFocus([i]),this.selectList.reveal(this.selectList.getFocus()[0]),st.stop(e);break}}dispose(){this.hideSelectDropDown(!1),super.dispose()}};dc.DEFAULT_DROPDOWN_MINIMUM_BOTTOM_MARGIN=32,dc.DEFAULT_DROPDOWN_MINIMUM_TOP_MARGIN=2,dc.DEFAULT_MINIMUM_VISIBLE_OPTIONS=3;let eO=dc;class dCe extends A{constructor(e,t,i,n){super(),this.selected=0,this.selectBoxOptions=n||Object.create(null),this.options=[],this.selectElement=document.createElement("select"),this.selectElement.className="monaco-select-box",typeof this.selectBoxOptions.ariaLabel=="string"&&this.selectElement.setAttribute("aria-label",this.selectBoxOptions.ariaLabel),typeof this.selectBoxOptions.ariaDescription=="string"&&this.selectElement.setAttribute("aria-description",this.selectBoxOptions.ariaDescription),this._onDidSelect=this._register(new P),this.styles=i,this.registerListeners(),this.setOptions(e,t)}registerListeners(){this._register($n.addTarget(this.selectElement)),[Pt.Tap].forEach(e=>{this._register(W(this.selectElement,e,t=>{this.selectElement.focus()}))}),this._register(Si(this.selectElement,"click",e=>{st.stop(e,!0)})),this._register(Si(this.selectElement,"change",e=>{this.selectElement.title=e.target.value,this._onDidSelect.fire({index:e.target.selectedIndex,selected:e.target.value})})),this._register(Si(this.selectElement,"keydown",e=>{let t=!1;ze?(e.keyCode===18||e.keyCode===16||e.keyCode===10)&&(t=!0):(e.keyCode===18&&e.altKey||e.keyCode===10||e.keyCode===3)&&(t=!0),t&&e.stopPropagation()}))}get onDidSelect(){return this._onDidSelect.event}setOptions(e,t){(!this.options||!Ut(this.options,e))&&(this.options=e,this.selectElement.options.length=0,this.options.forEach((i,n)=>{this.selectElement.add(this.createOption(i.text,n,i.isDisabled))})),t!==void 0&&this.select(t)}select(e){this.options.length===0?this.selected=0:e>=0&&e<this.options.length?this.selected=e:e>this.options.length-1?this.select(this.options.length-1):this.selected<0&&(this.selected=0),this.selectElement.selectedIndex=this.selected,this.selected<this.options.length&&typeof this.options[this.selected].text=="string"?this.selectElement.title=this.options[this.selected].text:this.selectElement.title=""}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){e.classList.add("select-container"),e.appendChild(this.selectElement),this.setOptions(this.options,this.selected),this.applyStyles()}applyStyles(){this.selectElement&&(this.selectElement.style.backgroundColor=this.styles.selectBackground??"",this.selectElement.style.color=this.styles.selectForeground??"",this.selectElement.style.borderColor=this.styles.selectBorder??"")}createOption(e,t,i){const n=document.createElement("option");return n.value=e,n.text=e,n.disabled=!!i,n}}class hCe extends go{constructor(e,t,i,n,s){super(),ze&&!s?.useCustomDrawn?this.selectBoxDelegate=new dCe(e,t,n,s):this.selectBoxDelegate=new eO(e,t,i,n,s),this._register(this.selectBoxDelegate)}get onDidSelect(){return this.selectBoxDelegate.onDidSelect}setOptions(e,t){this.selectBoxDelegate.setOptions(e,t)}select(e){this.selectBoxDelegate.select(e)}focus(){this.selectBoxDelegate.focus()}blur(){this.selectBoxDelegate.blur()}setFocusable(e){this.selectBoxDelegate.setFocusable(e)}render(e){this.selectBoxDelegate.render(e)}}class Fa extends A{get action(){return this._action}constructor(e,t,i={}){super(),this.options=i,this._context=e||this,this._action=t,t instanceof Mo&&this._register(t.onDidChange(n=>{this.element&&this.handleActionChangeEvent(n)}))}handleActionChangeEvent(e){e.enabled!==void 0&&this.updateEnabled(),e.checked!==void 0&&this.updateChecked(),e.class!==void 0&&this.updateClass(),e.label!==void 0&&(this.updateLabel(),this.updateTooltip()),e.tooltip!==void 0&&this.updateTooltip()}get actionRunner(){return this._actionRunner||(this._actionRunner=this._register(new hf)),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($n.addTarget(e));const i=this.options&&this.options.draggable;i&&(e.draggable=!0,Fs&&this._register(W(e,te.DRAG_START,n=>n.dataTransfer?.setData(og.TEXT,this._action.label)))),this._register(W(t,Pt.Tap,n=>this.onClick(n,!0))),this._register(W(t,te.MOUSE_DOWN,n=>{i||st.stop(n,!0),this._action.enabled&&n.button===0&&t.classList.add("active")})),ze&&this._register(W(t,te.CONTEXT_MENU,n=>{n.button===0&&n.ctrlKey===!0&&this.onClick(n)})),this._register(W(t,te.CLICK,n=>{st.stop(n,!0),this.options&&this.options.isMenu||this.onClick(n)})),this._register(W(t,te.DBLCLICK,n=>{st.stop(n,!0)})),[te.MOUSE_UP,te.MOUSE_OUT].forEach(n=>{this._register(W(t,n,s=>{st.stop(s),t.classList.remove("active")}))})}onClick(e,t=!1){st.stop(e,!0);const i=hr(this._context)?this.options?.useEventAsContext?e:{preserveFocus:t}:this._context;this.actionRunner.run(this._action,i)}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(){}getClass(){return this.action.class}getTooltip(){return this.action.tooltip}getHoverContents(){return this.getTooltip()}updateTooltip(){if(!this.element)return;const e=this.getHoverContents()??"";if(this.updateAriaLabel(),!this.customHover&&e!==""){const t=this.options.hoverDelegate??Zs("element");this.customHover=this._store.add(ta().setupManagedHover(t,this.element,e))}else this.customHover&&this.customHover.update(e)}updateAriaLabel(){if(this.element){const e=this.getTooltip()??"";this.element.setAttribute("aria-label",e)}}updateClass(){}updateChecked(){}dispose(){this.element&&(this.element.remove(),this.element=void 0),this._context=void 0,super.dispose()}}class z_ extends Fa{constructor(e,t,i){i={...i,icon:i.icon!==void 0?i.icon:!1,label:i.label!==void 0?i.label:!0},super(e,t,i),this.options=i,this.cssClass=""}render(e){super.render(e),it(this.element);const t=document.createElement("a");if(t.classList.add("action-label"),t.setAttribute("role",this.getDefaultAriaRole()),this.label=t,this.element.appendChild(t),this.options.label&&this.options.keybinding&&!this.options.keybindingNotRenderedWithLabel){const i=document.createElement("span");i.classList.add("keybinding"),i.textContent=this.options.keybinding,this.element.appendChild(i)}this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked()}getDefaultAriaRole(){return this._action.id===Xi.ID?"presentation":this.options.isMenu?"menuitem":this.options.isTabList?"tab":"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.action.label&&(e=this.action.label,this.options.keybinding&&(e=p(0,"{0} ({1})",e,this.options.keybinding))),e??void 0}updateClass(){this.cssClass&&this.label&&this.label.classList.remove(...this.cssClass.split(" ")),this.options.icon?(this.cssClass=this.getClass(),this.label&&(this.label.classList.add("codicon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" "))),this.updateEnabled()):this.label?.classList.remove("codicon")}updateEnabled(){this.action.enabled?(this.label&&(this.label.removeAttribute("aria-disabled"),this.label.classList.remove("disabled")),this.element?.classList.remove("disabled")):(this.label&&(this.label.setAttribute("aria-disabled","true"),this.label.classList.add("disabled")),this.element?.classList.add("disabled"))}updateAriaLabel(){if(this.label){const e=this.getTooltip()??"";this.label.setAttribute("aria-label",e)}}updateChecked(){this.label&&(this.action.checked!==void 0?(this.label.classList.toggle("checked",this.action.checked),this.options.isTabList?this.label.setAttribute("aria-selected",this.action.checked?"true":"false"):(this.label.setAttribute("aria-checked",this.action.checked?"true":"false"),this.label.setAttribute("role","checkbox"))):(this.label.classList.remove("checked"),this.label.removeAttribute(this.options.isTabList?"aria-selected":"aria-checked"),this.label.setAttribute("role",this.getDefaultAriaRole())))}}class uCe extends Fa{constructor(e,t,i,n,s,r,a){super(e,t),this.selectBox=new hCe(i,n,s,r,a),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(){this.selectBox?.focus()}blur(){this.selectBox?.blur()}render(e){this.selectBox.render(e)}}class Ys extends A{get onDidBlur(){return this._onDidBlur.event}get onDidCancel(){return this._onDidCancel.event}get onDidRun(){return this._onDidRun.event}get onWillRun(){return this._onWillRun.event}constructor(e,t={}){super(),this._actionRunnerDisposables=this._register(new U),this.viewItemDisposables=this._register(new ny),this.triggerKeyDown=!1,this.focusable=!0,this._onDidBlur=this._register(new P),this._onDidCancel=this._register(new P({onWillAddFirstListener:()=>this.cancelHasListener=!0})),this.cancelHasListener=!1,this._onDidRun=this._register(new P),this._onWillRun=this._register(new P),this.options=t,this._context=t.context??null,this._orientation=this.options.orientation??0,this._triggerKeys={keyDown:this.options.triggerKeys?.keyDown??!1,keys:this.options.triggerKeys?.keys??[3,10]},this._hoverDelegate=t.hoverDelegate??this._register(W_()),this.options.actionRunner?this._actionRunner=this.options.actionRunner:(this._actionRunner=new hf,this._actionRunnerDisposables.add(this._actionRunner)),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(s=>this._onDidRun.fire(s))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(s=>this._onWillRun.fire(s))),this.viewItems=[],this.focusedItem=void 0,this.domNode=document.createElement("div"),this.domNode.className="monaco-action-bar";let i,n;switch(this._orientation){case 0:i=[15],n=[17];break;case 1:i=[16],n=[18],this.domNode.className+=" vertical";break}this._register(W(this.domNode,te.KEY_DOWN,s=>{const r=new St(s);let a=!0;const l=typeof this.focusedItem=="number"?this.viewItems[this.focusedItem]:void 0;i&&(r.equals(i[0])||r.equals(i[1]))?a=this.focusPrevious():n&&(r.equals(n[0])||r.equals(n[1]))?a=this.focusNext():r.equals(9)&&this.cancelHasListener?this._onDidCancel.fire():r.equals(14)?a=this.focusFirst():r.equals(13)?a=this.focusLast():r.equals(2)&&l instanceof Fa&&l.trapsArrowNavigation?a=this.focusNext(void 0,!0):this.isTriggerKeyEvent(r)?this._triggerKeys.keyDown?this.doTrigger(r):this.triggerKeyDown=!0:a=!1,a&&(r.preventDefault(),r.stopPropagation())})),this._register(W(this.domNode,te.KEY_UP,s=>{const r=new St(s);this.isTriggerKeyEvent(r)?(!this._triggerKeys.keyDown&&this.triggerKeyDown&&(this.triggerKeyDown=!1,this.doTrigger(r)),r.preventDefault(),r.stopPropagation()):(r.equals(2)||r.equals(1026)||r.equals(16)||r.equals(18)||r.equals(15)||r.equals(17))&&this.updateFocusedItem()})),this.focusTracker=this._register(br(this.domNode)),this._register(this.focusTracker.onDidBlur(()=>{(Ui()===this.domNode||!Zi(Ui(),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()>=1?this.actionsList.setAttribute("role",this.options.ariaRole||"toolbar"):this.actionsList.setAttribute("role","presentation")}setFocusable(e){if(this.focusable=e,this.focusable){const t=this.viewItems.find(i=>i instanceof Fa&&i.isEnabled());t instanceof Fa&&t.setFocusable(!0)}else this.viewItems.forEach(t=>{t instanceof Fa&&t.setFocusable(!1)})}isTriggerKeyEvent(e){let t=!1;return this._triggerKeys.keys.forEach(i=>{t=t||e.equals(i)}),t}updateFocusedItem(){for(let e=0;e<this.actionsList.children.length;e++){const t=this.actionsList.children[e];if(Zi(Ui(),t)){this.focusedItem=e,this.viewItems[this.focusedItem]?.showHover?.();break}}}get context(){return this._context}set context(e){this._context=e,this.viewItems.forEach(t=>t.setActionContext(e))}get actionRunner(){return this._actionRunner}set actionRunner(e){this._actionRunner=e,this._actionRunnerDisposables.clear(),this._actionRunnerDisposables.add(this._actionRunner.onDidRun(t=>this._onDidRun.fire(t))),this._actionRunnerDisposables.add(this._actionRunner.onWillRun(t=>this._onWillRun.fire(t))),this.viewItems.forEach(t=>t.actionRunner=e)}getContainer(){return this.domNode}getAction(e){if(typeof e=="number")return this.viewItems[e]?.action;if(ai(e)){for(;e.parentElement!==this.actionsList;){if(!e.parentElement)return;e=e.parentElement}for(let t=0;t<this.actionsList.childNodes.length;t++)if(this.actionsList.childNodes[t]===e)return this.viewItems[t].action}}push(e,t={}){const i=Array.isArray(e)?e:[e];let n=bc(t.index)?t.index:null;if(i.forEach(s=>{const r=document.createElement("li");r.className="action-item",r.setAttribute("role","presentation");let a;const l={hoverDelegate:this._hoverDelegate,...t,isTabList:this.options.ariaRole==="tablist"};this.options.actionViewItemProvider&&(a=this.options.actionViewItemProvider(s,l)),a||(a=new z_(this.context,s,l)),this.options.allowContextMenu||this.viewItemDisposables.set(a,W(r,te.CONTEXT_MENU,c=>{st.stop(c,!0)})),a.actionRunner=this._actionRunner,a.setActionContext(this.context),a.render(r),n===null||n<0||n>=this.actionsList.children.length?(this.actionsList.appendChild(r),this.viewItems.push(a)):(this.actionsList.insertBefore(r,this.actionsList.children[n]),this.viewItems.splice(n,0,a),n++)}),this.focusable){let s=!1;for(const r of this.viewItems){if(!(r instanceof Fa))continue;let a;s||r.action.id===Xi.ID||!r.isEnabled()&&this.options.focusOnlyEnabledItems?a=!1:a=!0,a?(r.setFocusable(!0),s=!0):r.setFocusable(!1)}}typeof this.focusedItem=="number"&&this.focus(this.focusedItem),this.refreshRole()}clear(){this.isEmpty()||(this.viewItems=pt(this.viewItems),this.viewItemDisposables.clearAndDisposeAll(),pn(this.actionsList),this.refreshRole())}length(){return this.viewItems.length}isEmpty(){return this.viewItems.length===0}focus(e){let t=!1,i;if(e===void 0?t=!0:typeof e=="number"?i=e:typeof e=="boolean"&&(t=e),t&&typeof this.focusedItem>"u"){const n=this.viewItems.findIndex(s=>s.isEnabled());this.focusedItem=n===-1?void 0:n,this.updateFocus(void 0,void 0,!0)}else i!==void 0&&(this.focusedItem=i),this.updateFocus(void 0,void 0,!0)}focusFirst(){return this.focusedItem=this.length()-1,this.focusNext(!0)}focusLast(){return this.focusedItem=0,this.focusPrevious(!0)}focusNext(e,t){if(typeof this.focusedItem>"u")this.focusedItem=this.viewItems.length-1;else if(this.viewItems.length<=1)return!1;const i=this.focusedItem;let n;do{if(!e&&this.options.preventLoopNavigation&&this.focusedItem+1>=this.viewItems.length)return this.focusedItem=i,!1;this.focusedItem=(this.focusedItem+1)%this.viewItems.length,n=this.viewItems[this.focusedItem]}while(this.focusedItem!==i&&(this.options.focusOnlyEnabledItems&&!n.isEnabled()||n.action.id===Xi.ID));return this.updateFocus(void 0,void 0,t),!0}focusPrevious(e){if(typeof this.focusedItem>"u")this.focusedItem=0;else if(this.viewItems.length<=1)return!1;const t=this.focusedItem;let i;do{if(this.focusedItem=this.focusedItem-1,this.focusedItem<0){if(!e&&this.options.preventLoopNavigation)return this.focusedItem=t,!1;this.focusedItem=this.viewItems.length-1}i=this.viewItems[this.focusedItem]}while(this.focusedItem!==t&&(this.options.focusOnlyEnabledItems&&!i.isEnabled()||i.action.id===Xi.ID));return this.updateFocus(!0),!0}updateFocus(e,t,i=!1){typeof this.focusedItem>"u"&&this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem!==void 0&&this.previouslyFocusedItem!==this.focusedItem&&this.viewItems[this.previouslyFocusedItem]?.blur();const n=this.focusedItem!==void 0?this.viewItems[this.focusedItem]:void 0;if(n){let s=!0;Ku(n.focus)||(s=!1),this.options.focusOnlyEnabledItems&&Ku(n.isEnabled)&&!n.isEnabled()&&(s=!1),n.action.id===Xi.ID&&(s=!1),s?(i||this.previouslyFocusedItem!==this.focusedItem)&&(n.focus(e),this.previouslyFocusedItem=this.focusedItem):(this.actionsList.focus({preventScroll:t}),this.previouslyFocusedItem=void 0),s&&n.showHover?.()}}doTrigger(e){if(typeof this.focusedItem>"u")return;const t=this.viewItems[this.focusedItem];if(t instanceof Fa){const i=t._context===null||t._context===void 0?e:t._context;this.run(t._action,i)}}async run(e,t){await this._actionRunner.run(e,t)}dispose(){this._context=void 0,this.viewItems=pt(this.viewItems),this.getContainer().remove(),super.dispose()}}function fCe(o,e,t,i){if(o.length===0)return e;if(e.length===0)return o;const n=[];let s=0,r=0;for(;s<o.length&&r<e.length;){const a=o[s],l=e[r],c=t(a),d=t(l);c<d?(n.push(a),s++):c>d?(n.push(l),r++):(n.push(i(a,l)),s++,r++)}for(;s<o.length;)n.push(o[s]),s++;for(;r<e.length;)n.push(e[r]),r++;return n}function Qx(o,e){const t=new U,i=o.createDecorationsCollection();return t.add(Sy({debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}function U_(o,e){return o.appendChild(e),ue(()=>{e.remove()})}function gCe(o,e){return o.prepend(e),ue(()=>{e.remove()})}class pq extends A{get width(){return this._width}get height(){return this._height}get automaticLayout(){return this._automaticLayout}constructor(e,t){super(),this._automaticLayout=!1,this.elementSizeObserver=this._register(new LV(e,t)),this._width=Le(this,this.elementSizeObserver.getWidth()),this._height=Le(this,this.elementSizeObserver.getHeight()),this._register(this.elementSizeObserver.onDidChange(i=>Dt(n=>{this._width.set(this.elementSizeObserver.getWidth(),n),this._height.set(this.elementSizeObserver.getHeight(),n)})))}observe(e){this.elementSizeObserver.observe(e)}setAutomaticLayout(e){this._automaticLayout=e,e?this.elementSizeObserver.startObserving():this.elementSizeObserver.stopObserving()}}function mq(o,e,t){let i=e.get(),n=i,s=i;const r=Le("animatedValue",i);let a=-1;const l=300;let c;t.add(Om({changeTracker:{createChangeSummary:()=>({animate:!1}),handleChange:(h,u)=>(h.didChange(e)&&(u.animate=u.animate||h.change),!0)}},(h,u)=>{c!==void 0&&(o.cancelAnimationFrame(c),c=void 0),n=s,i=e.read(h),a=Date.now()-(u.animate?0:l),d()}));function d(){const h=Date.now()-a;s=Math.floor(pCe(h,n,i-n,l)),h<l?c=o.requestAnimationFrame(d):s=i,r.set(s,void 0)}return r}function pCe(o,e,t,i){return o===i?e+t:t*(-Math.pow(2,-10*o/i)+1)+e}class tO extends A{constructor(e,t,i){super(),this._register(new iO(e,i)),this._register(Hh(i,{height:t.actualHeight,top:t.actualTop}))}}class $_{get afterLineNumber(){return this._afterLineNumber.get()}constructor(e,t){this._afterLineNumber=e,this.heightInPx=t,this.domNode=document.createElement("div"),this._actualTop=Le(this,void 0),this._actualHeight=Le(this,void 0),this.actualTop=this._actualTop,this.actualHeight=this._actualHeight,this.showInHiddenAreas=!0,this.onChange=this._afterLineNumber,this.onDomNodeTop=i=>{this._actualTop.set(i,void 0)},this.onComputedHeight=i=>{this._actualHeight.set(i,void 0)}}}const vN=class vN{constructor(e,t){this._editor=e,this._domElement=t,this._overlayWidgetId=`managedOverlayWidget-${vN._counter++}`,this._overlayWidget={getId:()=>this._overlayWidgetId,getDomNode:()=>this._domElement,getPosition:()=>null},this._editor.addOverlayWidget(this._overlayWidget)}dispose(){this._editor.removeOverlayWidget(this._overlayWidget)}};vN._counter=0;let iO=vN;function Hh(o,e){return Se(t=>{for(let[i,n]of Object.entries(e))n&&typeof n=="object"&&"read"in n&&(n=n.read(t)),typeof n=="number"&&(n=`${n}px`),i=i.replace(/[A-Z]/g,s=>"-"+s.toLowerCase()),o.style[i]=n})}function Jx(o,e,t,i){const n=new U,s=[];return n.add(Bn((r,a)=>{const l=e.read(r),c=new Map,d=new Map;t&&t(!0),o.changeViewZones(h=>{for(const u of s)h.removeZone(u),i?.delete(u);s.length=0;for(const u of l){const f=h.addZone(u);u.setZoneId&&u.setZoneId(f),s.push(f),i?.add(f),c.set(u,f)}}),t&&t(!1),a.add(Om({changeTracker:{createChangeSummary(){return{zoneIds:[]}},handleChange(h,u){const f=d.get(h.changedObservable);return f!==void 0&&u.zoneIds.push(f),!0}}},(h,u)=>{for(const f of l)f.onChange&&(d.set(f.onChange,c.get(f)),f.onChange.read(h));t&&t(!0),o.changeViewZones(f=>{for(const g of u.zoneIds)f.layoutZone(g)}),t&&t(!1)}))})),n.add({dispose(){t&&t(!0),o.changeViewZones(r=>{for(const a of s)r.removeZone(a)}),i?.clear(),t&&t(!1)}}),n}class mCe extends Xt{dispose(){super.dispose(!0)}}function _q(o,e){const t=nv(e,n=>n.original.startLineNumber<=o.lineNumber);if(!t)return k.fromPositions(o);if(t.original.endLineNumberExclusive<=o.lineNumber){const n=o.lineNumber-t.original.endLineNumberExclusive+t.modified.endLineNumberExclusive;return k.fromPositions(new M(n,o.column))}if(!t.innerChanges)return k.fromPositions(new M(t.modified.startLineNumber,1));const i=nv(t.innerChanges,n=>n.originalRange.getStartPosition().isBeforeOrEqual(o));if(!i){const n=o.lineNumber-t.original.startLineNumber+t.modified.startLineNumber;return k.fromPositions(new M(n,o.column))}if(i.originalRange.containsPosition(o))return i.modifiedRange;{const n=_Ce(i.originalRange.getEndPosition(),o);return k.fromPositions(n.addToPosition(i.modifiedRange.getEndPosition()))}}function _Ce(o,e){return o.lineNumber===e.lineNumber?new $i(0,e.column-o.column):new $i(e.lineNumber-o.lineNumber,e.column-1)}function bCe(o,e){let t;return o.filter(i=>{const n=e(i,t);return t=i,n})}class ek{static create(e,t=void 0){return new bq(e,e,t)}static createWithDisposable(e,t,i=void 0){const n=new U;return n.add(t),n.add(e),new bq(e,n,i)}}class bq extends ek{constructor(e,t,i){super(),this.object=e,this._disposable=t,this._debugOwner=i,this._refCount=1,this._isDisposed=!1,this._owners=[],i&&this._addOwner(i)}_addOwner(e){e&&this._owners.push(e)}createNewRef(e){return this._refCount++,e&&this._addOwner(e),new CCe(this,e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._decreaseRefCount(this._debugOwner))}_decreaseRefCount(e){if(this._refCount--,this._refCount===0&&this._disposable.dispose(),e){const t=this._owners.indexOf(e);t!==-1&&this._owners.splice(t,1)}}}class CCe extends ek{constructor(e,t){super(),this._base=e,this._debugOwner=t,this._isDisposed=!1}get object(){return this._base.object}createNewRef(e){return this._base.createNewRef(e)}dispose(){this._isDisposed||(this._isDisposed=!0,this._base._decreaseRefCount(this._debugOwner))}}class ds{static inverse(e,t,i){const n=[];let s=1,r=1;for(const l of e){const c=new ds(new ke(s,l.original.startLineNumber),new ke(r,l.modified.startLineNumber));c.modified.isEmpty||n.push(c),s=l.original.endLineNumberExclusive,r=l.modified.endLineNumberExclusive}const a=new ds(new ke(s,t+1),new ke(r,i+1));return a.modified.isEmpty||n.push(a),n}static clip(e,t,i){const n=[];for(const s of e){const r=s.original.intersect(t),a=s.modified.intersect(i);r&&!r.isEmpty&&a&&!a.isEmpty&&n.push(new ds(r,a))}return n}constructor(e,t){this.original=e,this.modified=t}toString(){return`{${this.original.toString()}->${this.modified.toString()}}`}flip(){return new ds(this.modified,this.original)}join(e){return new ds(this.original.join(e.original),this.modified.join(e.modified))}toRangeMapping(){const e=this.original.toInclusiveRange(),t=this.modified.toInclusiveRange();if(e&&t)return new Is(e,t);if(this.original.startLineNumber===1||this.modified.startLineNumber===1){if(!(this.modified.startLineNumber===1&&this.original.startLineNumber===1))throw new Ce("not a valid diff");return new Is(new k(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new k(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1))}else return new Is(new k(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),new k(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER,this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER))}toRangeMapping2(e,t){if(Cq(this.original.endLineNumberExclusive,e)&&Cq(this.modified.endLineNumberExclusive,t))return new Is(new k(this.original.startLineNumber,1,this.original.endLineNumberExclusive,1),new k(this.modified.startLineNumber,1,this.modified.endLineNumberExclusive,1));if(!this.original.isEmpty&&!this.modified.isEmpty)return new Is(k.fromPositions(new M(this.original.startLineNumber,1),j_(new M(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),k.fromPositions(new M(this.modified.startLineNumber,1),j_(new M(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));if(this.original.startLineNumber>1&&this.modified.startLineNumber>1)return new Is(k.fromPositions(j_(new M(this.original.startLineNumber-1,Number.MAX_SAFE_INTEGER),e),j_(new M(this.original.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),e)),k.fromPositions(j_(new M(this.modified.startLineNumber-1,Number.MAX_SAFE_INTEGER),t),j_(new M(this.modified.endLineNumberExclusive-1,Number.MAX_SAFE_INTEGER),t)));throw new Ce}}function j_(o,e){if(o.lineNumber<1)return new M(1,1);if(o.lineNumber>e.length)return new M(e.length,e[e.length-1].length+1);const t=e[o.lineNumber-1];return o.column>t.length+1?new M(o.lineNumber,t.length+1):o}function Cq(o,e){return o>=1&&o<=e.length}class qo extends ds{static fromRangeMappings(e){const t=ke.join(e.map(n=>ke.fromRangeInclusive(n.originalRange))),i=ke.join(e.map(n=>ke.fromRangeInclusive(n.modifiedRange)));return new qo(t,i,e)}constructor(e,t,i){super(e,t),this.innerChanges=i}flip(){return new qo(this.modified,this.original,this.innerChanges?.map(e=>e.flip()))}withInnerChangesFromLineRanges(){return new qo(this.original,this.modified,[this.toRangeMapping()])}}class Is{static fromEdit(e){const t=e.getNewRanges();return e.replacements.map((n,s)=>new Is(n.range,t[s]))}static assertSorted(e){for(let t=1;t<e.length;t++){const i=e[t-1],n=e[t];if(!(i.originalRange.getEndPosition().isBeforeOrEqual(n.originalRange.getStartPosition())&&i.modifiedRange.getEndPosition().isBeforeOrEqual(n.modifiedRange.getStartPosition())))throw new Ce("Range mappings must be sorted")}}constructor(e,t){this.originalRange=e,this.modifiedRange=t}toString(){return`{${this.originalRange.toString()}->${this.modifiedRange.toString()}}`}flip(){return new Is(this.modifiedRange,this.originalRange)}toTextEdit(e){const t=e.getValueOfRange(this.modifiedRange);return new Oi(this.originalRange,t)}}function tk(o,e,t,i=!1){const n=[];for(const s of BR(o.map(r=>vCe(r,e,t)),(r,a)=>r.original.intersectsOrTouches(a.original)||r.modified.intersectsOrTouches(a.modified))){const r=s[0],a=s[s.length-1];n.push(new qo(r.original.join(a.original),r.modified.join(a.modified),s.map(l=>l.innerChanges[0])))}return Xd(()=>!i&&n.length>0&&(n[0].modified.startLineNumber!==n[0].original.startLineNumber||t.length.lineCount-n[n.length-1].modified.endLineNumberExclusive!==e.length.lineCount-n[n.length-1].original.endLineNumberExclusive)?!1:XC(n,(s,r)=>r.original.startLineNumber-s.original.endLineNumberExclusive===r.modified.startLineNumber-s.modified.endLineNumberExclusive&&s.original.endLineNumberExclusive<r.original.startLineNumber&&s.modified.endLineNumberExclusive<r.modified.startLineNumber)),n}function vCe(o,e,t){let i=0,n=0;o.modifiedRange.endColumn===1&&o.originalRange.endColumn===1&&o.originalRange.startLineNumber+i<=o.originalRange.endLineNumber&&o.modifiedRange.startLineNumber+i<=o.modifiedRange.endLineNumber&&(n=-1),o.modifiedRange.startColumn-1>=t.getLineLength(o.modifiedRange.startLineNumber)&&o.originalRange.startColumn-1>=e.getLineLength(o.originalRange.startLineNumber)&&o.originalRange.startLineNumber<=o.originalRange.endLineNumber+n&&o.modifiedRange.startLineNumber<=o.modifiedRange.endLineNumber+n&&(i=1);const s=new ke(o.originalRange.startLineNumber+i,o.originalRange.endLineNumber+1+n),r=new ke(o.modifiedRange.startLineNumber+i,o.modifiedRange.endLineNumber+1+n);return new qo(s,r,[o])}const wCe={IconContribution:"base.contributions.icons"};var vq;(function(o){function e(t,i){let n=t.defaults;for(;ve.isThemeIcon(n);){const s=mg.getIcon(n.id);if(!s)return;n=s.defaults}return n}o.getDefinition=e})(vq||(vq={}));var wq;(function(o){function e(i){return{weight:i.weight,style:i.style,src:i.src.map(n=>({format:n.format,location:n.location.toString()}))}}o.toJSONObject=e;function t(i){const n=s=>ji(s)?s:void 0;if(i&&Array.isArray(i.src)&&i.src.every(s=>ji(s.format)&&ji(s.location)))return{weight:n(i.weight),style:n(i.style),src:i.src.map(s=>({format:s.format,location:be.parse(s.location)}))}}o.fromJSONObject=t})(wq||(wq={}));const SCe=/^([\w_-]+)$/,yCe=p(2006,"The font ID must only contain letters, numbers, underscores and dashes.");class LCe extends A{constructor(){super(),this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,this.iconSchema={definitions:{icons:{type:"object",properties:{fontId:{type:"string",description:p(2007,"The id of the font to use. If not set, the font that is defined first is used."),pattern:SCe.source,patternErrorMessage:yCe},fontCharacter:{type:"string",description:p(2008,"The font character associated with the icon definition.")}},additionalProperties:!1,defaultSnippets:[{body:{fontCharacter:"\\\\e030"}}]}},type:"object",properties:{}},this.iconReferenceSchema={type:"string",pattern:`^${ve.iconNameExpression}$`,enum:[],enumDescriptions:[]},this.iconsById={},this.iconFontsById={}}registerIcon(e,t,i,n){const s=this.iconsById[e];if(s){if(i&&!s.description){s.description=i,this.iconSchema.properties[e].markdownDescription=`${i} $(${e})`;const l=this.iconReferenceSchema.enum.indexOf(e);l!==-1&&(this.iconReferenceSchema.enumDescriptions[l]=i),this._onDidChange.fire()}return s}const r={id:e,description:i,defaults:t,deprecationMessage:n};this.iconsById[e]=r;const a={$ref:"#/definitions/icons"};return n&&(a.deprecationMessage=n),i&&(a.markdownDescription=`${i}: $(${e})`),this.iconSchema.properties[e]=a,this.iconReferenceSchema.enum.push(e),this.iconReferenceSchema.enumDescriptions.push(i||""),this._onDidChange.fire(),{id:e}}getIcons(){return Object.keys(this.iconsById).map(e=>this.iconsById[e])}getIcon(e){return this.iconsById[e]}getIconSchema(){return this.iconSchema}toString(){const e=(s,r)=>s.id.localeCompare(r.id),t=s=>{for(;ve.isThemeIcon(s.defaults);)s=this.iconsById[s.defaults.id];return`codicon codicon-${s?s.id:""}`},i=[];i.push("| preview | identifier | default codicon ID | description"),i.push("| ----------- | --------------------------------- | --------------------------------- | --------------------------------- |");const n=Object.keys(this.iconsById).map(s=>this.iconsById[s]);for(const s of n.filter(r=>!!r.description).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|${ve.isThemeIcon(s.defaults)?s.defaults.id:s.id}|${s.description||""}|`);i.push("| preview | identifier "),i.push("| ----------- | --------------------------------- |");for(const s of n.filter(r=>!ve.isThemeIcon(r.defaults)).sort(e))i.push(`|<i class="${t(s)}"></i>|${s.id}|`);return i.join(`
`)}}const mg=new LCe;ei.add(wCe.IconContribution,mg);function Wt(o,e,t,i){return mg.registerIcon(o,e,t,i)}function Sq(){return mg}function xCe(){const o=mH();for(const e in o){const t="\\"+o[e].toString(16);mg.registerIcon(e,{fontCharacter:t})}}xCe();const yq="vscode://schemas/icons",Lq=ei.as(nL.JSONContribution);Lq.registerSchema(yq,mg.getIconSchema());const xq=new wt(()=>Lq.notifySchemaChanged(yq),200);mg.onDidChange(()=>{xq.isScheduled()||xq.schedule()});const kq=Wt("widget-close",Y.close,p(2009,"Icon for the close action in widgets."));Wt("goto-previous-location",Y.arrowUp,p(2010,"Icon for goto previous editor location.")),Wt("goto-next-location",Y.arrowDown,p(2011,"Icon for goto next editor location.")),ve.modify(Y.sync,"spin"),ve.modify(Y.loading,"spin");var nO=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sO=function(o,e){return function(t,i){e(t,i,o)}};const kCe=Wt("diff-review-insert",Y.add,p(94,"Icon for 'Insert' in accessible diff viewer.")),ICe=Wt("diff-review-remove",Y.remove,p(95,"Icon for 'Remove' in accessible diff viewer.")),DCe=Wt("diff-review-close",Y.close,p(96,"Icon for 'Close' in accessible diff viewer."));let _g=(yC=class extends A{constructor(e,t,i,n,s,r,a,l,c){super(),this._parentNode=e,this._visible=t,this._setVisible=i,this._canClose=n,this._width=s,this._height=r,this._diffs=a,this._models=l,this._instantiationService=c,this._state=j(this,d=>{const h=this._visible.read(d);if(this._parentNode.style.visibility=h?"visible":"hidden",!h)return null;const u=d.store.add(this._instantiationService.createInstance(oO,this._diffs,this._models,this._setVisible,this._canClose)),f=d.store.add(this._instantiationService.createInstance(rO,this._parentNode,u,this._width,this._height,this._models));return{model:u,view:f}}).recomputeInitiallyAndOnChange(this._store)}next(){Dt(e=>{const t=this._visible.get();this._setVisible(!0,e),t&&this._state.get().model.nextGroup(e)})}prev(){Dt(e=>{this._setVisible(!0,e),this._state.get().model.previousGroup(e)})}close(){Dt(e=>{this._setVisible(!1,e)})}},yC._ttPolicy=Sl("diffReview",{createHTML:e=>e}),yC);_g=nO([sO(8,ge)],_g);let oO=class extends A{constructor(e,t,i,n,s){super(),this._diffs=e,this._models=t,this._setVisible=i,this.canClose=n,this._accessibilitySignalService=s,this._groups=Le(this,[]),this._currentGroupIdx=Le(this,0),this._currentElementIdx=Le(this,0),this.groups=this._groups,this.currentGroup=this._currentGroupIdx.map((r,a)=>this._groups.read(a)[r]),this.currentGroupIndex=this._currentGroupIdx,this.currentElement=this._currentElementIdx.map((r,a)=>this.currentGroup.read(a)?.lines[r]),this._register(Se(r=>{const a=this._diffs.read(r);if(!a){this._groups.set([],void 0);return}const l=ECe(a,this._models.getOriginalModel().getLineCount(),this._models.getModifiedModel().getLineCount());Dt(c=>{const d=this._models.getModifiedPosition();if(d){const h=l.findIndex(u=>d?.lineNumber<u.range.modified.endLineNumberExclusive);h!==-1&&this._currentGroupIdx.set(h,c)}this._groups.set(l,c)})})),this._register(Se(r=>{const a=this.currentElement.read(r);a?.type===Ds.Deleted?this._accessibilitySignalService.playSignal(xs.diffLineDeleted,{source:"accessibleDiffViewer.currentElementChanged"}):a?.type===Ds.Added&&this._accessibilitySignalService.playSignal(xs.diffLineInserted,{source:"accessibleDiffViewer.currentElementChanged"})})),this._register(Se(r=>{const a=this.currentElement.read(r);if(a&&a.type!==Ds.Header){const l=a.modifiedLineNumber??a.diff.modified.startLineNumber;this._models.modifiedSetSelection(k.fromPositions(new M(l,1)))}}))}_goToGroupDelta(e,t){const i=this.groups.get();!i||i.length<=1||lf(t,n=>{this._currentGroupIdx.set(pe.ofLength(i.length).clipCyclic(this._currentGroupIdx.get()+e),n),this._currentElementIdx.set(0,n)})}nextGroup(e){this._goToGroupDelta(1,e)}previousGroup(e){this._goToGroupDelta(-1,e)}_goToLineDelta(e){const t=this.currentGroup.get();!t||t.lines.length<=1||Dt(i=>{this._currentElementIdx.set(pe.ofLength(t.lines.length).clip(this._currentElementIdx.get()+e),i)})}goToNextLine(){this._goToLineDelta(1)}goToPreviousLine(){this._goToLineDelta(-1)}goToLine(e){const t=this.currentGroup.get();if(!t)return;const i=t.lines.indexOf(e);i!==-1&&Dt(n=>{this._currentElementIdx.set(i,n)})}revealCurrentElementInEditor(){if(!this.canClose.get())return;this._setVisible(!1,void 0);const e=this.currentElement.get();e&&(e.type===Ds.Deleted?this._models.originalReveal(k.fromPositions(new M(e.originalLineNumber,1))):this._models.modifiedReveal(e.type!==Ds.Header?k.fromPositions(new M(e.modifiedLineNumber,1)):void 0))}close(){this.canClose.get()&&(this._setVisible(!1,void 0),this._models.modifiedFocus())}};oO=nO([sO(4,nd)],oO);const cw=3;function ECe(o,e,t){const i=[];for(const n of BR(o,(s,r)=>r.modified.startLineNumber-s.modified.endLineNumberExclusive<2*cw)){const s=[];s.push(new TCe);const r=new ke(Math.max(1,n[0].original.startLineNumber-cw),Math.min(n[n.length-1].original.endLineNumberExclusive+cw,e+1)),a=new ke(Math.max(1,n[0].modified.startLineNumber-cw),Math.min(n[n.length-1].modified.endLineNumberExclusive+cw,t+1));I6(n,(d,h)=>{const u=new ke(d?d.original.endLineNumberExclusive:r.startLineNumber,h?h.original.startLineNumber:r.endLineNumberExclusive),f=new ke(d?d.modified.endLineNumberExclusive:a.startLineNumber,h?h.modified.startLineNumber:a.endLineNumberExclusive);u.forEach(g=>{s.push(new PCe(g,f.startLineNumber+(g-u.startLineNumber)))}),h&&(h.original.forEach(g=>{s.push(new RCe(h,g))}),h.modified.forEach(g=>{s.push(new MCe(h,g))}))});const l=n[0].modified.join(n[n.length-1].modified),c=n[0].original.join(n[n.length-1].original);i.push(new NCe(new ds(l,c),s))}return i}var Ds;(function(o){o[o.Header=0]="Header",o[o.Unchanged=1]="Unchanged",o[o.Deleted=2]="Deleted",o[o.Added=3]="Added"})(Ds||(Ds={}));class NCe{constructor(e,t){this.range=e,this.lines=t}}class TCe{constructor(){this.type=Ds.Header}}class RCe{constructor(e,t){this.diff=e,this.originalLineNumber=t,this.type=Ds.Deleted,this.modifiedLineNumber=void 0}}class MCe{constructor(e,t){this.diff=e,this.modifiedLineNumber=t,this.type=Ds.Added,this.originalLineNumber=void 0}}class PCe{constructor(e,t){this.originalLineNumber=e,this.modifiedLineNumber=t,this.type=Ds.Unchanged}}let rO=class extends A{constructor(e,t,i,n,s,r){super(),this._element=e,this._model=t,this._width=i,this._height=n,this._models=s,this._languageService=r,this.domNode=this._element,this.domNode.className="monaco-component diff-review monaco-editor-background";const a=document.createElement("div");a.className="diff-review-actions",this._actionBar=this._register(new Ys(a)),this._register(Se(l=>{this._actionBar.clear(),this._model.canClose.read(l)&&this._actionBar.push(uf({id:"diffreview.close",label:p(97,"Close"),class:"close-diff-review "+ve.asClassName(DCe),enabled:!0,run:async()=>t.close()}),{label:!1,icon:!0})})),this._content=document.createElement("div"),this._content.className="diff-review-content",this._content.setAttribute("role","code"),this._scrollbar=this._register(new Q1(this._content,{})),Yi(this.domNode,this._scrollbar.getDomNode(),a),this._register(Se(l=>{this._height.read(l),this._width.read(l),this._scrollbar.scanDomNode()})),this._register(ue(()=>{Yi(this.domNode)})),this._register(Hh(this.domNode,{width:this._width,height:this._height})),this._register(Hh(this._content,{width:this._width,height:this._height})),this._register(Bn((l,c)=>{this._model.currentGroup.read(l),this._render(c)})),this._register(Si(this.domNode,"keydown",l=>{(l.equals(18)||l.equals(2066)||l.equals(530))&&(l.preventDefault(),this._model.goToNextLine()),(l.equals(16)||l.equals(2064)||l.equals(528))&&(l.preventDefault(),this._model.goToPreviousLine()),(l.equals(9)||l.equals(2057)||l.equals(521)||l.equals(1033))&&(l.preventDefault(),this._model.close()),(l.equals(10)||l.equals(3))&&(l.preventDefault(),this._model.revealCurrentElementInEditor())}))}_render(e){const t=this._models.getOriginalOptions(),i=this._models.getModifiedOptions(),n=document.createElement("div");n.className="diff-review-table",n.setAttribute("role","list"),n.setAttribute("aria-label",p(98,"Accessible Diff Viewer. Use arrow up and down to navigate.")),dn(n,i.get(59)),Yi(this._content,n);const s=this._models.getOriginalModel(),r=this._models.getModifiedModel();if(!s||!r)return;const a=s.getOptions(),l=r.getOptions(),c=i.get(75),d=this._model.currentGroup.get();for(const h of d?.lines||[]){if(!d)break;let u;if(h.type===Ds.Header){const g=document.createElement("div");g.className="diff-review-row",g.setAttribute("role","listitem");const m=d.range,_=this._model.currentGroupIndex.get(),b=this._model.groups.get().length,C=L=>L===0?p(99,"no lines changed"):L===1?p(100,"1 line changed"):p(101,"{0} lines changed",L),w=C(m.original.length),v=C(m.modified.length);g.setAttribute("aria-label",p(102,"Difference {0} of {1}: original line {2}, {3}, modified line {4}, {5}",_+1,b,m.original.startLineNumber,w,m.modified.startLineNumber,v));const S=document.createElement("div");S.className="diff-review-cell diff-review-summary",S.appendChild(document.createTextNode(`${_+1}/${b}: @@ -${m.original.startLineNumber},${m.original.length} +${m.modified.startLineNumber},${m.modified.length} @@`)),g.appendChild(S),u=g}else u=this._createRow(h,c,this._width.get(),t,s,a,i,r,l);n.appendChild(u);const f=j(g=>this._model.currentElement.read(g)===h);e.add(Se(g=>{const m=f.read(g);u.tabIndex=m?0:-1,m&&u.focus()})),e.add(W(u,"focus",()=>{this._model.goToLine(h)}))}this._scrollbar.scanDomNode()}_createRow(e,t,i,n,s,r,a,l,c){const d=n.get(165),h=d.glyphMarginWidth+d.lineNumbersWidth,u=a.get(165),f=10+u.glyphMarginWidth+u.lineNumbersWidth;let g="diff-review-row",m="";const _="diff-review-spacer";let b=null;switch(e.type){case Ds.Added:g="diff-review-row line-insert",m=" char-insert",b=kCe;break;case Ds.Deleted:g="diff-review-row line-delete",m=" char-delete",b=ICe;break}const C=document.createElement("div");C.style.minWidth=i+"px",C.className=g,C.setAttribute("role","listitem"),C.ariaLevel="";const w=document.createElement("div");w.className="diff-review-cell",w.style.height=`${t}px`,C.appendChild(w);const v=document.createElement("span");v.style.width=h+"px",v.style.minWidth=h+"px",v.className="diff-review-line-number"+m,e.originalLineNumber!==void 0?v.appendChild(document.createTextNode(String(e.originalLineNumber))):v.innerText=" ",w.appendChild(v);const S=document.createElement("span");S.style.width=f+"px",S.style.minWidth=f+"px",S.style.paddingRight="10px",S.className="diff-review-line-number"+m,e.modifiedLineNumber!==void 0?S.appendChild(document.createTextNode(String(e.modifiedLineNumber))):S.innerText=" ",w.appendChild(S);const L=document.createElement("span");if(L.className=_,b){const D=document.createElement("span");D.className=ve.asClassName(b),D.innerText="  ",L.appendChild(D)}else L.innerText="  ";w.appendChild(L);let x;if(e.modifiedLineNumber!==void 0){let D=this._getLineHtml(l,a,c.tabSize,e.modifiedLineNumber,this._languageService.languageIdCodec);_g._ttPolicy&&(D=_g._ttPolicy.createHTML(D)),w.insertAdjacentHTML("beforeend",D),x=l.getLineContent(e.modifiedLineNumber)}else{let D=this._getLineHtml(s,n,r.tabSize,e.originalLineNumber,this._languageService.languageIdCodec);_g._ttPolicy&&(D=_g._ttPolicy.createHTML(D)),w.insertAdjacentHTML("beforeend",D),x=s.getLineContent(e.originalLineNumber)}x.length===0&&(x=p(103,"blank"));let I="";switch(e.type){case Ds.Unchanged:e.originalLineNumber===e.modifiedLineNumber?I=p(104,"{0} unchanged line {1}",x,e.originalLineNumber):I=p(105,"{0} original line {1} modified line {2}",x,e.originalLineNumber,e.modifiedLineNumber);break;case Ds.Added:I=p(106,"+ {0} modified line {1}",x,e.modifiedLineNumber);break;case Ds.Deleted:I=p(107,"- {0} original line {1}",x,e.originalLineNumber);break}return C.setAttribute("aria-label",I),C}_getLineHtml(e,t,i,n,s){const r=e.getLineContent(n),a=t.get(59),l=t.get(117).verticalScrollbarSize,c=bi.createEmpty(r,s),d=Vo.isBasicASCII(r,e.mightContainNonBasicASCII()),h=Vo.containsRTL(r,d,e.mightContainRTL());return FL(new Vc(a.isMonospace&&!t.get(40),a.canUseHalfwidthRightwardsArrow,r,!1,d,h,0,c,[],i,0,a.spaceWidth,a.middotWidth,a.wsmiddotWidth,t.get(133),t.get(113),t.get(108),t.get(60)!==Fc.OFF,null,null,l)).html}};rO=nO([sO(5,Mt)],rO);class ACe{constructor(e){this.editors=e}getOriginalModel(){return this.editors.original.getModel()}getOriginalOptions(){return this.editors.original.getOptions()}originalReveal(e){this.editors.original.revealRange(e),this.editors.original.setSelection(e),this.editors.original.focus()}getModifiedModel(){return this.editors.modified.getModel()}getModifiedOptions(){return this.editors.modified.getOptions()}modifiedReveal(e){e&&(this.editors.modified.revealRange(e),this.editors.modified.setSelection(e)),this.editors.modified.focus()}modifiedSetSelection(e){this.editors.modified.setSelection(e)}modifiedFocus(){this.editors.modified.focus()}getModifiedPosition(){return this.editors.modified.getPosition()??void 0}}N("diffEditor.move.border","#8b8b8b9c",p(134,"The border color for text that got moved in the diff editor.")),N("diffEditor.moveActive.border","#FFA500",p(135,"The active border color for text that got moved in the diff editor.")),N("diffEditor.unchangedRegionShadow",{dark:"#000000",light:"#737373BF",hcDark:"#000000",hcLight:"#737373BF"},p(136,"The color of the shadow around unchanged region widgets."));const OCe=Wt("diff-insert",Y.add,p(137,"Line decoration for inserts in the diff editor.")),Iq=Wt("diff-remove",Y.remove,p(138,"Line decoration for removals in the diff editor.")),Dq=Te.register({className:"line-insert",description:"line-insert",isWholeLine:!0,linesDecorationsClassName:"insert-sign "+ve.asClassName(OCe),marginClassName:"gutter-insert"}),Eq=Te.register({className:"line-delete",description:"line-delete",isWholeLine:!0,linesDecorationsClassName:"delete-sign "+ve.asClassName(Iq),marginClassName:"gutter-delete"}),Nq=Te.register({className:"line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),Tq=Te.register({className:"line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),Rq=Te.register({className:"char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),FCe=Te.register({className:"char-insert",description:"char-insert",isWholeLine:!0}),WCe=Te.register({className:"char-insert diff-range-empty",description:"char-insert diff-range-empty"}),aO=Te.register({className:"char-delete",description:"char-delete",shouldFillLineOnLineBreak:!0}),BCe=Te.register({className:"char-delete",description:"char-delete",isWholeLine:!0}),HCe=Te.register({className:"char-delete diff-range-empty",description:"char-delete diff-range-empty"}),Xs=We("editorWorkerService");var Mq=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lO=function(o,e){return function(t,i){e(t,i,o)}},bg;const Pq=We("diffProviderFactoryService");let cO=class{constructor(e){this.instantiationService=e}createDiffProvider(e){return this.instantiationService.createInstance(dO,e)}};cO=Mq([lO(0,ge)],cO),je(Pq,cO,1);let dO=(kp=class{constructor(e,t,i){this.editorWorkerService=t,this.telemetryService=i,this.onDidChangeEventEmitter=new P,this.onDidChange=this.onDidChangeEventEmitter.event,this.diffAlgorithm="advanced",this.diffAlgorithmOnDidChangeSubscription=void 0,this.setOptions(e)}dispose(){this.diffAlgorithmOnDidChangeSubscription?.dispose()}async computeDiff(e,t,i,n){if(typeof this.diffAlgorithm!="string")return this.diffAlgorithm.computeDiff(e,t,i,n);if(e.isDisposed()||t.isDisposed())return{changes:[],identical:!0,quitEarly:!1,moves:[]};if(e.getLineCount()===1&&e.getLineMaxColumn(1)===1)return t.getLineCount()===1&&t.getLineMaxColumn(1)===1?{changes:[],identical:!0,quitEarly:!1,moves:[]}:{changes:[new qo(new ke(1,2),new ke(1,t.getLineCount()+1),[new Is(e.getFullModelRange(),t.getFullModelRange())])],identical:!1,quitEarly:!1,moves:[]};const s=JSON.stringify([e.uri.toString(),t.uri.toString()]),r=JSON.stringify([e.id,t.id,e.getAlternativeVersionId(),t.getAlternativeVersionId(),JSON.stringify(i)]),a=bg.diffCache.get(s);if(a&&a.context===r)return a.result;const l=Ki.create(),c=await this.editorWorkerService.computeDiff(e.uri,t.uri,i,this.diffAlgorithm),d=l.elapsed();if(this.telemetryService.publicLog2("diffEditor.computeDiff",{timeMs:d,timedOut:c?.quitEarly??!0,detectedMoves:i.computeMoves?c?.moves.length??0:-1}),n.isCancellationRequested)return{changes:[],identical:!1,quitEarly:!0,moves:[]};if(!c)throw new Error("no diff result available");return bg.diffCache.size>10&&bg.diffCache.delete(bg.diffCache.keys().next().value),bg.diffCache.set(s,{result:c,context:r}),c}setOptions(e){let t=!1;e.diffAlgorithm&&this.diffAlgorithm!==e.diffAlgorithm&&(this.diffAlgorithmOnDidChangeSubscription?.dispose(),this.diffAlgorithmOnDidChangeSubscription=void 0,this.diffAlgorithm=e.diffAlgorithm,typeof e.diffAlgorithm!="string"&&(this.diffAlgorithmOnDidChangeSubscription=e.diffAlgorithm.onDidChange(()=>this.onDidChangeEventEmitter.fire())),t=!0),t&&this.onDidChangeEventEmitter.fire()}},bg=kp,kp.diffCache=new Map,kp);dO=bg=Mq([lO(1,Xs),lO(2,Vn)],dO);class ik{constructor(e,t,i){this.changes=e,this.moves=t,this.hitTimeout=i}}class Aq{constructor(e,t){this.lineRangeMapping=e,this.changes=t}}class ld{static trivial(e,t){return new ld([new Ji(pe.ofLength(e.length),pe.ofLength(t.length))],!1)}static trivialTimedOut(e,t){return new ld([new Ji(pe.ofLength(e.length),pe.ofLength(t.length))],!0)}constructor(e,t){this.diffs=e,this.hitTimeout=t}}class Ji{static invert(e,t){const i=[];return I6(e,(n,s)=>{i.push(Ji.fromOffsetPairs(n?n.getEndExclusives():cd.zero,s?s.getStarts():new cd(t,(n?n.seq2Range.endExclusive-n.seq1Range.endExclusive:0)+t)))}),i}static fromOffsetPairs(e,t){return new Ji(new pe(e.offset1,t.offset1),new pe(e.offset2,t.offset2))}static assertSorted(e){let t;for(const i of e){if(t&&!(t.seq1Range.endExclusive<=i.seq1Range.start&&t.seq2Range.endExclusive<=i.seq2Range.start))throw new Ce("Sequence diffs must be sorted");t=i}}constructor(e,t){this.seq1Range=e,this.seq2Range=t}swap(){return new Ji(this.seq2Range,this.seq1Range)}toString(){return`${this.seq1Range} <-> ${this.seq2Range}`}join(e){return new Ji(this.seq1Range.join(e.seq1Range),this.seq2Range.join(e.seq2Range))}delta(e){return e===0?this:new Ji(this.seq1Range.delta(e),this.seq2Range.delta(e))}deltaStart(e){return e===0?this:new Ji(this.seq1Range.deltaStart(e),this.seq2Range.deltaStart(e))}deltaEnd(e){return e===0?this:new Ji(this.seq1Range.deltaEnd(e),this.seq2Range.deltaEnd(e))}intersect(e){const t=this.seq1Range.intersect(e.seq1Range),i=this.seq2Range.intersect(e.seq2Range);if(!(!t||!i))return new Ji(t,i)}getStarts(){return new cd(this.seq1Range.start,this.seq2Range.start)}getEndExclusives(){return new cd(this.seq1Range.endExclusive,this.seq2Range.endExclusive)}}const Ip=class Ip{constructor(e,t){this.offset1=e,this.offset2=t}toString(){return`${this.offset1} <-> ${this.offset2}`}delta(e){return e===0?this:new Ip(this.offset1+e,this.offset2+e)}equals(e){return this.offset1===e.offset1&&this.offset2===e.offset2}};Ip.zero=new Ip(0,0),Ip.max=new Ip(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER);let cd=Ip;const wN=class wN{isValid(){return!0}};wN.instance=new wN;let dw=wN;class VCe{constructor(e){if(this.timeout=e,this.startTime=Date.now(),this.valid=!0,e<=0)throw new Ce("timeout must be positive")}isValid(){return!(Date.now()-this.startTime<this.timeout)&&this.valid&&(this.valid=!1),this.valid}}class hO{constructor(e,t){this.width=e,this.height=t,this.array=[],this.array=new Array(e*t)}get(e,t){return this.array[e+t*this.width]}set(e,t,i){this.array[e+t*this.width]=i}}function uO(o){return o===32||o===9}const DS=class DS{static getKey(e){let t=this.chrKeys.get(e);return t===void 0&&(t=this.chrKeys.size,this.chrKeys.set(e,t)),t}constructor(e,t,i){this.range=e,this.lines=t,this.source=i,this.histogram=[];let n=0;for(let s=e.startLineNumber-1;s<e.endLineNumberExclusive-1;s++){const r=t[s];for(let l=0;l<r.length;l++){n++;const c=r[l],d=DS.getKey(c);this.histogram[d]=(this.histogram[d]||0)+1}n++;const a=DS.getKey(`
`);this.histogram[a]=(this.histogram[a]||0)+1}this.totalCount=n}computeSimilarity(e){let t=0;const i=Math.max(this.histogram.length,e.histogram.length);for(let n=0;n<i;n++)t+=Math.abs((this.histogram[n]??0)-(e.histogram[n]??0));return 1-t/(this.totalCount+e.totalCount)}};DS.chrKeys=new Map;let nk=DS;class zCe{compute(e,t,i=dw.instance,n){if(e.length===0||t.length===0)return ld.trivial(e,t);const s=new hO(e.length,t.length),r=new hO(e.length,t.length),a=new hO(e.length,t.length);for(let g=0;g<e.length;g++)for(let m=0;m<t.length;m++){if(!i.isValid())return ld.trivialTimedOut(e,t);const _=g===0?0:s.get(g-1,m),b=m===0?0:s.get(g,m-1);let C;e.getElement(g)===t.getElement(m)?(g===0||m===0?C=0:C=s.get(g-1,m-1),g>0&&m>0&&r.get(g-1,m-1)===3&&(C+=a.get(g-1,m-1)),C+=n?n(g,m):1):C=-1;const w=Math.max(_,b,C);if(w===C){const v=g>0&&m>0?a.get(g-1,m-1):0;a.set(g,m,v+1),r.set(g,m,3)}else w===_?(a.set(g,m,0),r.set(g,m,1)):w===b&&(a.set(g,m,0),r.set(g,m,2));s.set(g,m,w)}const l=[];let c=e.length,d=t.length;function h(g,m){(g+1!==c||m+1!==d)&&l.push(new Ji(new pe(g+1,c),new pe(m+1,d))),c=g,d=m}let u=e.length-1,f=t.length-1;for(;u>=0&&f>=0;)r.get(u,f)===3?(h(u,f),u--,f--):r.get(u,f)===1?u--:f--;return h(-1,-1),l.reverse(),new ld(l,!1)}}class Oq{compute(e,t,i=dw.instance){if(e.length===0||t.length===0)return ld.trivial(e,t);const n=e,s=t;function r(m,_){for(;m<n.length&&_<s.length&&n.getElement(m)===s.getElement(_);)m++,_++;return m}let a=0;const l=new UCe;l.set(0,r(0,0));const c=new $Ce;c.set(0,l.get(0)===0?null:new Fq(null,0,0,l.get(0)));let d=0;e:for(;;){if(a++,!i.isValid())return ld.trivialTimedOut(n,s);const m=-Math.min(a,s.length+a%2),_=Math.min(a,n.length+a%2);for(d=m;d<=_;d+=2){const b=d===_?-1:l.get(d+1),C=d===m?-1:l.get(d-1)+1,w=Math.min(Math.max(b,C),n.length),v=w-d;if(w>n.length||v>s.length)continue;const S=r(w,v);l.set(d,S);const L=w===b?c.get(d+1):c.get(d-1);if(c.set(d,S!==w?new Fq(L,w,v,S-w):L),l.get(d)===n.length&&l.get(d)-d===s.length)break e}}let h=c.get(d);const u=[];let f=n.length,g=s.length;for(;;){const m=h?h.x+h.length:0,_=h?h.y+h.length:0;if((m!==f||_!==g)&&u.push(new Ji(new pe(m,f),new pe(_,g))),!h)break;f=h.x,g=h.y,h=h.prev}return u.reverse(),new ld(u,!1)}}class Fq{constructor(e,t,i,n){this.prev=e,this.x=t,this.y=i,this.length=n}}class UCe{constructor(){this.positiveArr=new Int32Array(10),this.negativeArr=new Int32Array(10)}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){if(e<0){if(e=-e-1,e>=this.negativeArr.length){const i=this.negativeArr;this.negativeArr=new Int32Array(i.length*2),this.negativeArr.set(i)}this.negativeArr[e]=t}else{if(e>=this.positiveArr.length){const i=this.positiveArr;this.positiveArr=new Int32Array(i.length*2),this.positiveArr.set(i)}this.positiveArr[e]=t}}}class $Ce{constructor(){this.positiveArr=[],this.negativeArr=[]}get(e){return e<0?(e=-e-1,this.negativeArr[e]):this.positiveArr[e]}set(e,t){e<0?(e=-e-1,this.negativeArr[e]=t):this.positiveArr[e]=t}}class sk{constructor(e,t,i){this.lines=e,this.range=t,this.considerWhitespaceChanges=i,this.elements=[],this.firstElementOffsetByLineIdx=[],this.lineStartOffsets=[],this.trimmedWsLengthsByLineIdx=[],this.firstElementOffsetByLineIdx.push(0);for(let n=this.range.startLineNumber;n<=this.range.endLineNumber;n++){let s=e[n-1],r=0;n===this.range.startLineNumber&&this.range.startColumn>1&&(r=this.range.startColumn-1,s=s.substring(r)),this.lineStartOffsets.push(r);let a=0;if(!i){const c=s.trimStart();a=s.length-c.length,s=c.trimEnd()}this.trimmedWsLengthsByLineIdx.push(a);const l=n===this.range.endLineNumber?Math.min(this.range.endColumn-1-r-a,s.length):s.length;for(let c=0;c<l;c++)this.elements.push(s.charCodeAt(c));n<this.range.endLineNumber&&(this.elements.push(10),this.firstElementOffsetByLineIdx.push(this.elements.length))}}toString(){return`Slice: "${this.text}"`}get text(){return this.getText(new pe(0,this.length))}getText(e){return this.elements.slice(e.start,e.endExclusive).map(t=>String.fromCharCode(t)).join("")}getElement(e){return this.elements[e]}get length(){return this.elements.length}getBoundaryScore(e){const t=Hq(e>0?this.elements[e-1]:-1),i=Hq(e<this.elements.length?this.elements[e]:-1);if(t===7&&i===8)return 0;if(t===8)return 150;let n=0;return t!==i&&(n+=10,t===0&&i===1&&(n+=1)),n+=Bq(t),n+=Bq(i),n}translateOffset(e,t="right"){const i=C_(this.firstElementOffsetByLineIdx,s=>s<=e),n=e-this.firstElementOffsetByLineIdx[i];return new M(this.range.startLineNumber+i,1+this.lineStartOffsets[i]+n+(n===0&&t==="left"?0:this.trimmedWsLengthsByLineIdx[i]))}translateRange(e){const t=this.translateOffset(e.start,"right"),i=this.translateOffset(e.endExclusive,"left");return i.isBefore(t)?k.fromPositions(i,i):k.fromPositions(t,i)}findWordContaining(e){if(e<0||e>=this.elements.length||!q_(this.elements[e]))return;let t=e;for(;t>0&&q_(this.elements[t-1]);)t--;let i=e;for(;i<this.elements.length&&q_(this.elements[i]);)i++;return new pe(t,i)}findSubWordContaining(e){if(e<0||e>=this.elements.length||!q_(this.elements[e]))return;let t=e;for(;t>0&&q_(this.elements[t-1])&&!Wq(this.elements[t]);)t--;let i=e;for(;i<this.elements.length&&q_(this.elements[i])&&!Wq(this.elements[i]);)i++;return new pe(t,i)}countLinesIn(e){return this.translateOffset(e.endExclusive).lineNumber-this.translateOffset(e.start).lineNumber}isStronglyEqual(e,t){return this.elements[e]===this.elements[t]}extendToFullLines(e){const t=b_(this.firstElementOffsetByLineIdx,n=>n<=e.start)??0,i=Ihe(this.firstElementOffsetByLineIdx,n=>e.endExclusive<=n)??this.elements.length;return new pe(t,i)}}function q_(o){return o>=97&&o<=122||o>=65&&o<=90||o>=48&&o<=57}function Wq(o){return o>=65&&o<=90}const jCe={0:0,1:0,2:0,3:10,4:2,5:30,6:3,7:10,8:10};function Bq(o){return jCe[o]}function Hq(o){return o===10?8:o===13?7:uO(o)?6:o>=97&&o<=122?0:o>=65&&o<=90?1:o>=48&&o<=57?2:o===-1?3:o===44||o===59?5:4}function qCe(o,e,t,i,n,s){let{moves:r,excludedChanges:a}=GCe(o,e,t,s);if(!s.isValid())return[];const l=o.filter(d=>!a.has(d)),c=ZCe(l,i,n,e,t,s);return VR(r,c),r=YCe(r),r=r.filter(d=>{const h=d.original.toOffsetRange().slice(e).map(f=>f.trim());return h.join(`
`).length>=15&&KCe(h,f=>f.length>=2)>=2}),r=XCe(o,r),r}function KCe(o,e){let t=0;for(const i of o)e(i)&&t++;return t}function GCe(o,e,t,i){const n=[],s=o.filter(l=>l.modified.isEmpty&&l.original.length>=3).map(l=>new nk(l.original,e,l)),r=new Set(o.filter(l=>l.original.isEmpty&&l.modified.length>=3).map(l=>new nk(l.modified,t,l))),a=new Set;for(const l of s){let c=-1,d;for(const h of r){const u=l.computeSimilarity(h);u>c&&(c=u,d=h)}if(c>.9&&d&&(r.delete(d),n.push(new ds(l.range,d.range)),a.add(l.source),a.add(d.source)),!i.isValid())return{moves:n,excludedChanges:a}}return{moves:n,excludedChanges:a}}function ZCe(o,e,t,i,n,s){const r=[],a=new kH;for(const u of o)for(let f=u.original.startLineNumber;f<u.original.endLineNumberExclusive-2;f++){const g=`${e[f-1]}:${e[f+1-1]}:${e[f+2-1]}`;a.add(g,{range:new ke(f,f+3)})}const l=[];o.sort(kn(u=>u.modified.startLineNumber,lo));for(const u of o){let f=[];for(let g=u.modified.startLineNumber;g<u.modified.endLineNumberExclusive-2;g++){const m=`${t[g-1]}:${t[g+1-1]}:${t[g+2-1]}`,_=new ke(g,g+3),b=[];a.forEach(m,({range:C})=>{for(const v of f)if(v.originalLineRange.endLineNumberExclusive+1===C.endLineNumberExclusive&&v.modifiedLineRange.endLineNumberExclusive+1===_.endLineNumberExclusive){v.originalLineRange=new ke(v.originalLineRange.startLineNumber,C.endLineNumberExclusive),v.modifiedLineRange=new ke(v.modifiedLineRange.startLineNumber,_.endLineNumberExclusive),b.push(v);return}const w={modifiedLineRange:_,originalLineRange:C};l.push(w),b.push(w)}),f=b}if(!s.isValid())return[]}l.sort(R6(kn(u=>u.modifiedLineRange.length,lo)));const c=new Tr,d=new Tr;for(const u of l){const f=u.modifiedLineRange.startLineNumber-u.originalLineRange.startLineNumber,g=c.subtractFrom(u.modifiedLineRange),m=d.subtractFrom(u.originalLineRange).getWithDelta(f),_=g.getIntersection(m);for(const b of _.ranges){if(b.length<3)continue;const C=b,w=b.delta(-f);r.push(new ds(w,C)),c.addRange(C),d.addRange(w)}}r.sort(kn(u=>u.original.startLineNumber,lo));const h=new jL(o);for(let u=0;u<r.length;u++){const f=r[u],g=h.findLastMonotonous(L=>L.original.startLineNumber<=f.original.startLineNumber),m=b_(o,L=>L.modified.startLineNumber<=f.modified.startLineNumber),_=Math.max(f.original.startLineNumber-g.original.startLineNumber,f.modified.startLineNumber-m.modified.startLineNumber),b=h.findLastMonotonous(L=>L.original.startLineNumber<f.original.endLineNumberExclusive),C=b_(o,L=>L.modified.startLineNumber<f.modified.endLineNumberExclusive),w=Math.max(b.original.endLineNumberExclusive-f.original.endLineNumberExclusive,C.modified.endLineNumberExclusive-f.modified.endLineNumberExclusive);let v;for(v=0;v<_;v++){const L=f.original.startLineNumber-v-1,x=f.modified.startLineNumber-v-1;if(L>i.length||x>n.length||c.contains(x)||d.contains(L)||!Vq(i[L-1],n[x-1],s))break}v>0&&(d.addRange(new ke(f.original.startLineNumber-v,f.original.startLineNumber)),c.addRange(new ke(f.modified.startLineNumber-v,f.modified.startLineNumber)));let S;for(S=0;S<w;S++){const L=f.original.endLineNumberExclusive+S,x=f.modified.endLineNumberExclusive+S;if(L>i.length||x>n.length||c.contains(x)||d.contains(L)||!Vq(i[L-1],n[x-1],s))break}S>0&&(d.addRange(new ke(f.original.endLineNumberExclusive,f.original.endLineNumberExclusive+S)),c.addRange(new ke(f.modified.endLineNumberExclusive,f.modified.endLineNumberExclusive+S))),(v>0||S>0)&&(r[u]=new ds(new ke(f.original.startLineNumber-v,f.original.endLineNumberExclusive+S),new ke(f.modified.startLineNumber-v,f.modified.endLineNumberExclusive+S)))}return r}function Vq(o,e,t){if(o.trim()===e.trim())return!0;if(o.length>300&&e.length>300)return!1;const n=new Oq().compute(new sk([o],new k(1,1,1,o.length),!1),new sk([e],new k(1,1,1,e.length),!1),t);let s=0;const r=Ji.invert(n.diffs,o.length);for(const d of r)d.seq1Range.forEach(h=>{uO(o.charCodeAt(h))||s++});function a(d){let h=0;for(let u=0;u<o.length;u++)uO(d.charCodeAt(u))||h++;return h}const l=a(o.length>e.length?o:e);return s/l>.6&&l>10}function YCe(o){if(o.length===0)return o;o.sort(kn(t=>t.original.startLineNumber,lo));const e=[o[0]];for(let t=1;t<o.length;t++){const i=e[e.length-1],n=o[t],s=n.original.startLineNumber-i.original.endLineNumberExclusive,r=n.modified.startLineNumber-i.modified.endLineNumberExclusive;if(s>=0&&r>=0&&s+r<=2){e[e.length-1]=i.join(n);continue}e.push(n)}return e}function XCe(o,e){const t=new jL(o);return e=e.filter(i=>{const n=t.findLastMonotonous(a=>a.original.startLineNumber<i.original.endLineNumberExclusive)||new ds(new ke(1,1),new ke(1,1)),s=b_(o,a=>a.modified.startLineNumber<i.modified.endLineNumberExclusive);return n!==s}),e}function zq(o,e,t){let i=t;return i=Uq(o,e,i),i=Uq(o,e,i),i=QCe(o,e,i),i}function Uq(o,e,t){if(t.length===0)return t;const i=[];i.push(t[0]);for(let s=1;s<t.length;s++){const r=i[i.length-1];let a=t[s];if(a.seq1Range.isEmpty||a.seq2Range.isEmpty){const l=a.seq1Range.start-r.seq1Range.endExclusive;let c;for(c=1;c<=l&&!(o.getElement(a.seq1Range.start-c)!==o.getElement(a.seq1Range.endExclusive-c)||e.getElement(a.seq2Range.start-c)!==e.getElement(a.seq2Range.endExclusive-c));c++);if(c--,c===l){i[i.length-1]=new Ji(new pe(r.seq1Range.start,a.seq1Range.endExclusive-l),new pe(r.seq2Range.start,a.seq2Range.endExclusive-l));continue}a=a.delta(-c)}i.push(a)}const n=[];for(let s=0;s<i.length-1;s++){const r=i[s+1];let a=i[s];if(a.seq1Range.isEmpty||a.seq2Range.isEmpty){const l=r.seq1Range.start-a.seq1Range.endExclusive;let c;for(c=0;c<l&&!(!o.isStronglyEqual(a.seq1Range.start+c,a.seq1Range.endExclusive+c)||!e.isStronglyEqual(a.seq2Range.start+c,a.seq2Range.endExclusive+c));c++);if(c===l){i[s+1]=new Ji(new pe(a.seq1Range.start+l,r.seq1Range.endExclusive),new pe(a.seq2Range.start+l,r.seq2Range.endExclusive));continue}c>0&&(a=a.delta(c))}n.push(a)}return i.length>0&&n.push(i[i.length-1]),n}function QCe(o,e,t){if(!o.getBoundaryScore||!e.getBoundaryScore)return t;for(let i=0;i<t.length;i++){const n=i>0?t[i-1]:void 0,s=t[i],r=i+1<t.length?t[i+1]:void 0,a=new pe(n?n.seq1Range.endExclusive+1:0,r?r.seq1Range.start-1:o.length),l=new pe(n?n.seq2Range.endExclusive+1:0,r?r.seq2Range.start-1:e.length);s.seq1Range.isEmpty?t[i]=$q(s,o,e,a,l):s.seq2Range.isEmpty&&(t[i]=$q(s.swap(),e,o,l,a).swap())}return t}function $q(o,e,t,i,n){let r=1;for(;o.seq1Range.start-r>=i.start&&o.seq2Range.start-r>=n.start&&t.isStronglyEqual(o.seq2Range.start-r,o.seq2Range.endExclusive-r)&&r<100;)r++;r--;let a=0;for(;o.seq1Range.start+a<i.endExclusive&&o.seq2Range.endExclusive+a<n.endExclusive&&t.isStronglyEqual(o.seq2Range.start+a,o.seq2Range.endExclusive+a)&&a<100;)a++;if(r===0&&a===0)return o;let l=0,c=-1;for(let d=-r;d<=a;d++){const h=o.seq2Range.start+d,u=o.seq2Range.endExclusive+d,f=o.seq1Range.start+d,g=e.getBoundaryScore(f)+t.getBoundaryScore(h)+t.getBoundaryScore(u);g>c&&(c=g,l=d)}return o.delta(l)}function JCe(o,e,t){const i=[];for(const n of t){const s=i[i.length-1];if(!s){i.push(n);continue}n.seq1Range.start-s.seq1Range.endExclusive<=2||n.seq2Range.start-s.seq2Range.endExclusive<=2?i[i.length-1]=new Ji(s.seq1Range.join(n.seq1Range),s.seq2Range.join(n.seq2Range)):i.push(n)}return i}function jq(o,e,t,i,n=!1){const s=Ji.invert(t,o.length),r=[];let a=new cd(0,0);function l(d,h){if(d.offset1<a.offset1||d.offset2<a.offset2)return;const u=i(o,d.offset1),f=i(e,d.offset2);if(!u||!f)return;let g=new Ji(u,f);const m=g.intersect(h);let _=m.seq1Range.length,b=m.seq2Range.length;for(;s.length>0;){const C=s[0];if(!(C.seq1Range.intersects(g.seq1Range)||C.seq2Range.intersects(g.seq2Range)))break;const v=i(o,C.seq1Range.start),S=i(e,C.seq2Range.start),L=new Ji(v,S),x=L.intersect(C);if(_+=x.seq1Range.length,b+=x.seq2Range.length,g=g.join(L),g.seq1Range.endExclusive>=C.seq1Range.endExclusive)s.shift();else break}(n&&_+b<g.seq1Range.length+g.seq2Range.length||_+b<(g.seq1Range.length+g.seq2Range.length)*2/3)&&r.push(g),a=g.getEndExclusives()}for(;s.length>0;){const d=s.shift();d.seq1Range.isEmpty||(l(d.getStarts(),d),l(d.getEndExclusives().delta(-1),d))}return e1e(t,r)}function e1e(o,e){const t=[];for(;o.length>0||e.length>0;){const i=o[0],n=e[0];let s;i&&(!n||i.seq1Range.start<n.seq1Range.start)?s=o.shift():s=e.shift(),t.length>0&&t[t.length-1].seq1Range.endExclusive>=s.seq1Range.start?t[t.length-1]=t[t.length-1].join(s):t.push(s)}return t}function t1e(o,e,t){let i=t;if(i.length===0)return i;let n=0,s;do{s=!1;const r=[i[0]];for(let a=1;a<i.length;a++){let d=function(u,f){const g=new pe(c.seq1Range.endExclusive,l.seq1Range.start);return o.getText(g).replace(/\s/g,"").length<=4&&(u.seq1Range.length+u.seq2Range.length>5||f.seq1Range.length+f.seq2Range.length>5)};const l=i[a],c=r[r.length-1];d(c,l)?(s=!0,r[r.length-1]=r[r.length-1].join(l)):r.push(l)}i=r}while(n++<10&&s);return i}function i1e(o,e,t){let i=t;if(i.length===0)return i;let n=0,s;do{s=!1;const a=[i[0]];for(let l=1;l<i.length;l++){let h=function(f,g){const m=new pe(d.seq1Range.endExclusive,c.seq1Range.start);if(o.countLinesIn(m)>5||m.length>500)return!1;const b=o.getText(m).trim();if(b.length>20||b.split(/\r\n|\r|\n/).length>1)return!1;const C=o.countLinesIn(f.seq1Range),w=f.seq1Range.length,v=e.countLinesIn(f.seq2Range),S=f.seq2Range.length,L=o.countLinesIn(g.seq1Range),x=g.seq1Range.length,I=e.countLinesIn(g.seq2Range),D=g.seq2Range.length,R=130;function F(O){return Math.min(O,R)}return Math.pow(Math.pow(F(C*40+w),1.5)+Math.pow(F(v*40+S),1.5),1.5)+Math.pow(Math.pow(F(L*40+x),1.5)+Math.pow(F(I*40+D),1.5),1.5)>(R**1.5)**1.5*1.3};const c=i[l],d=a[a.length-1];h(d,c)?(s=!0,a[a.length-1]=a[a.length-1].join(c)):a.push(c)}i=a}while(n++<10&&s);const r=[];return bne(i,(a,l,c)=>{let d=l;function h(b){return b.length>0&&b.trim().length<=3&&l.seq1Range.length+l.seq2Range.length>100}const u=o.extendToFullLines(l.seq1Range),f=o.getText(new pe(u.start,l.seq1Range.start));h(f)&&(d=d.deltaStart(-f.length));const g=o.getText(new pe(l.seq1Range.endExclusive,u.endExclusive));h(g)&&(d=d.deltaEnd(g.length));const m=Ji.fromOffsetPairs(a?a.getEndExclusives():cd.zero,c?c.getStarts():cd.max),_=d.intersect(m);r.length>0&&_.getStarts().equals(r[r.length-1].getEndExclusives())?r[r.length-1]=r[r.length-1].join(_):r.push(_)}),r}let qq=class{constructor(e,t){this.trimmedHash=e,this.lines=t}getElement(e){return this.trimmedHash[e]}get length(){return this.trimmedHash.length}getBoundaryScore(e){const t=e===0?0:Kq(this.lines[e-1]),i=e===this.lines.length?0:Kq(this.lines[e]);return 1e3-(t+i)}getText(e){return this.lines.slice(e.start,e.endExclusive).join(`
`)}isStronglyEqual(e,t){return this.lines[e]===this.lines[t]}};function Kq(o){let e=0;for(;e<o.length&&(o.charCodeAt(e)===32||o.charCodeAt(e)===9);)e++;return e}class n1e{constructor(){this.dynamicProgrammingDiffing=new zCe,this.myersDiffingAlgorithm=new Oq}computeDiff(e,t,i){if(e.length<=1&&Ut(e,t,(x,I)=>x===I))return new ik([],[],!1);if(e.length===1&&e[0].length===0||t.length===1&&t[0].length===0)return new ik([new qo(new ke(1,e.length+1),new ke(1,t.length+1),[new Is(new k(1,1,e.length,e[e.length-1].length+1),new k(1,1,t.length,t[t.length-1].length+1))])],[],!1);const n=i.maxComputationTimeMs===0?dw.instance:new VCe(i.maxComputationTimeMs),s=!i.ignoreTrimWhitespace,r=new Map;function a(x){let I=r.get(x);return I===void 0&&(I=r.size,r.set(x,I)),I}const l=e.map(x=>a(x.trim())),c=t.map(x=>a(x.trim())),d=new qq(l,e),h=new qq(c,t),u=d.length+h.length<1700?this.dynamicProgrammingDiffing.compute(d,h,n,(x,I)=>e[x]===t[I]?t[I].length===0?.1:1+Math.log(1+t[I].length):.99):this.myersDiffingAlgorithm.compute(d,h,n);let f=u.diffs,g=u.hitTimeout;f=zq(d,h,f),f=t1e(d,h,f);const m=[],_=x=>{if(s)for(let I=0;I<x;I++){const D=b+I,R=C+I;if(e[D]!==t[R]){const F=this.refineDiff(e,t,new Ji(new pe(D,D+1),new pe(R,R+1)),n,s,i);for(const O of F.mappings)m.push(O);F.hitTimeout&&(g=!0)}}};let b=0,C=0;for(const x of f){Xd(()=>x.seq1Range.start-b===x.seq2Range.start-C);const I=x.seq1Range.start-b;_(I),b=x.seq1Range.endExclusive,C=x.seq2Range.endExclusive;const D=this.refineDiff(e,t,x,n,s,i);D.hitTimeout&&(g=!0);for(const R of D.mappings)m.push(R)}_(e.length-b);const w=new ax(e),v=new ax(t),S=tk(m,w,v);let L=[];return i.computeMoves&&(L=this.computeMoves(S,e,t,l,c,n,s,i)),Xd(()=>{function x(D,R){if(D.lineNumber<1||D.lineNumber>R.length)return!1;const F=R[D.lineNumber-1];return!(D.column<1||D.column>F.length+1)}function I(D,R){return!(D.startLineNumber<1||D.startLineNumber>R.length+1||D.endLineNumberExclusive<1||D.endLineNumberExclusive>R.length+1)}for(const D of S){if(!D.innerChanges)return!1;for(const R of D.innerChanges)if(!(x(R.modifiedRange.getStartPosition(),t)&&x(R.modifiedRange.getEndPosition(),t)&&x(R.originalRange.getStartPosition(),e)&&x(R.originalRange.getEndPosition(),e)))return!1;if(!I(D.modified,t)||!I(D.original,e))return!1}return!0}),new ik(S,L,g)}computeMoves(e,t,i,n,s,r,a,l){return qCe(e,t,i,n,s,r).map(h=>{const u=this.refineDiff(t,i,new Ji(h.original.toOffsetRange(),h.modified.toOffsetRange()),r,a,l),f=tk(u.mappings,new ax(t),new ax(i),!0);return new Aq(h,f)})}refineDiff(e,t,i,n,s,r){const l=s1e(i).toRangeMapping2(e,t),c=new sk(e,l.originalRange,s),d=new sk(t,l.modifiedRange,s),h=c.length+d.length<500?this.dynamicProgrammingDiffing.compute(c,d,n):this.myersDiffingAlgorithm.compute(c,d,n);let u=h.diffs;return u=zq(c,d,u),u=jq(c,d,u,(g,m)=>g.findWordContaining(m)),r.extendToSubwords&&(u=jq(c,d,u,(g,m)=>g.findSubWordContaining(m),!0)),u=JCe(c,d,u),u=i1e(c,d,u),{mappings:u.map(g=>new Is(c.translateRange(g.seq1Range),d.translateRange(g.seq2Range))),hitTimeout:h.hitTimeout}}}function s1e(o){return new ds(new ke(o.seq1Range.start+1,o.seq1Range.endExclusive+1),new ke(o.seq2Range.start+1,o.seq2Range.endExclusive+1))}var o1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},r1e=function(o,e){return function(t,i){e(t,i,o)}};let fO=class extends A{setActiveMovedText(e){this._activeMovedText.set(e,void 0)}constructor(e,t,i){super(),this.model=e,this._options=t,this._diffProviderFactoryService=i,this._isDiffUpToDate=Le(this,!1),this.isDiffUpToDate=this._isDiffUpToDate,this._diff=Le(this,void 0),this.diff=this._diff,this._unchangedRegions=Le(this,void 0),this.unchangedRegions=j(this,a=>this._options.hideUnchangedRegions.read(a)?this._unchangedRegions.read(a)?.regions??[]:(Dt(l=>{for(const c of this._unchangedRegions.read(void 0)?.regions||[])c.collapseAll(l)}),[])),this.movedTextToCompare=Le(this,void 0),this._activeMovedText=Le(this,void 0),this._hoveredMovedText=Le(this,void 0),this.activeMovedText=j(this,a=>this.movedTextToCompare.read(a)??this._hoveredMovedText.read(a)??this._activeMovedText.read(a)),this._cancellationTokenSource=new Xt,this._diffProvider=j(this,a=>{const l=this._diffProviderFactoryService.createDiffProvider({diffAlgorithm:this._options.diffAlgorithm.read(a)}),c=co("onDidChange",l.onDidChange);return{diffProvider:l,onChangeSignal:c}}),this._register(ue(()=>this._cancellationTokenSource.cancel()));const n=_r("contentChangedSignal"),s=this._register(new wt(()=>n.trigger(void 0),200));this._register(Se(a=>{const l=this._unchangedRegions.read(a);if(!l||l.regions.some(g=>g.isDragged.read(a)))return;const c=l.originalDecorationIds.map(g=>e.original.getDecorationRange(g)).map(g=>g?ke.fromRangeInclusive(g):void 0),d=l.modifiedDecorationIds.map(g=>e.modified.getDecorationRange(g)).map(g=>g?ke.fromRangeInclusive(g):void 0),h=l.regions.map((g,m)=>!c[m]||!d[m]?void 0:new Vh(c[m].startLineNumber,d[m].startLineNumber,c[m].length,g.visibleLineCountTop.read(a),g.visibleLineCountBottom.read(a))).filter(sn),u=[];let f=!1;for(const g of BR(h,(m,_)=>m.getHiddenModifiedRange(a).endLineNumberExclusive===_.getHiddenModifiedRange(a).startLineNumber))if(g.length>1){f=!0;const m=g.reduce((b,C)=>b+C.lineCount,0),_=new Vh(g[0].originalLineNumber,g[0].modifiedLineNumber,m,g[0].visibleLineCountTop.read(void 0),g[g.length-1].visibleLineCountBottom.read(void 0));u.push(_)}else u.push(g[0]);if(f){const g=e.original.deltaDecorations(l.originalDecorationIds,u.map(_=>({range:_.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),m=e.modified.deltaDecorations(l.modifiedDecorationIds,u.map(_=>({range:_.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));Dt(_=>{this._unchangedRegions.set({regions:u,originalDecorationIds:g,modifiedDecorationIds:m},_)})}}));const r=(a,l,c)=>{const d=Vh.fromDiffs(a.changes,e.original.getLineCount(),e.modified.getLineCount(),this._options.hideUnchangedRegionsMinimumLineCount.read(c),this._options.hideUnchangedRegionsContextLineCount.read(c));let h;const u=this._unchangedRegions.get();if(u){const _=u.originalDecorationIds.map(v=>e.original.getDecorationRange(v)).map(v=>v?ke.fromRangeInclusive(v):void 0),b=u.modifiedDecorationIds.map(v=>e.modified.getDecorationRange(v)).map(v=>v?ke.fromRangeInclusive(v):void 0);let w=bCe(u.regions.map((v,S)=>{if(!_[S]||!b[S])return;const L=_[S].length;return new Vh(_[S].startLineNumber,b[S].startLineNumber,L,Math.min(v.visibleLineCountTop.get(),L),Math.min(v.visibleLineCountBottom.get(),L-v.visibleLineCountTop.get()))}).filter(sn),(v,S)=>!S||v.modifiedLineNumber>=S.modifiedLineNumber+S.lineCount&&v.originalLineNumber>=S.originalLineNumber+S.lineCount).map(v=>new ds(v.getHiddenOriginalRange(c),v.getHiddenModifiedRange(c)));w=ds.clip(w,ke.ofLength(1,e.original.getLineCount()),ke.ofLength(1,e.modified.getLineCount())),h=ds.inverse(w,e.original.getLineCount(),e.modified.getLineCount())}const f=[];if(h)for(const _ of d){const b=h.filter(C=>C.original.intersectsStrict(_.originalUnchangedRange)&&C.modified.intersectsStrict(_.modifiedUnchangedRange));f.push(..._.setVisibleRanges(b,l))}else f.push(...d);const g=e.original.deltaDecorations(u?.originalDecorationIds||[],f.map(_=>({range:_.originalUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}}))),m=e.modified.deltaDecorations(u?.modifiedDecorationIds||[],f.map(_=>({range:_.modifiedUnchangedRange.toInclusiveRange(),options:{description:"unchanged"}})));this._unchangedRegions.set({regions:f,originalDecorationIds:g,modifiedDecorationIds:m},l)};this._register(e.modified.onDidChangeContent(a=>{if(this._diff.get()){const c=Kc.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(e.original.onDidChangeContent(a=>{if(this._diff.get()){const c=Kc.fromModelContentChanges(a.changes);this._lastDiff,e.original,e.modified}this._isDiffUpToDate.set(!1,void 0),s.schedule()})),this._register(Bn(async(a,l)=>{this._options.hideUnchangedRegionsMinimumLineCount.read(a),this._options.hideUnchangedRegionsContextLineCount.read(a),s.cancel(),n.read(a);const c=this._diffProvider.read(a);c.onChangeSignal.read(a),this._isDiffUpToDate.set(!1,void 0);let d=[];l.add(e.original.onDidChangeContent(f=>{const g=Kc.fromModelContentChanges(f.changes);d=px(d,g)}));let h=[];l.add(e.modified.onDidChangeContent(f=>{const g=Kc.fromModelContentChanges(f.changes);h=px(h,g)}));let u=await c.diffProvider.computeDiff(e.original,e.modified,{ignoreTrimWhitespace:this._options.ignoreTrimWhitespace.read(a),maxComputationTimeMs:this._options.maxComputationTimeMs.read(a),computeMoves:this._options.showMoves.read(a)},this._cancellationTokenSource.token);this._cancellationTokenSource.token.isCancellationRequested||e.original.isDisposed()||e.modified.isDisposed()||(u=a1e(u,e.original,e.modified),u=(e.original,e.modified,void 0)??u,u=(e.original,e.modified,void 0)??u,Dt(f=>{r(u,f),this._lastDiff=u;const g=gO.fromDiffResult(u);this._diff.set(g,f),this._isDiffUpToDate.set(!0,f);const m=this.movedTextToCompare.read(void 0);this.movedTextToCompare.set(m?this._lastDiff.moves.find(_=>_.lineRangeMapping.modified.intersect(m.lineRangeMapping.modified)):void 0,f)}))}))}ensureModifiedLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const n=this._unchangedRegions.get()?.regions||[];for(const s of n)if(s.getHiddenModifiedRange(void 0).contains(e)){s.showModifiedLine(e,t,i);return}}ensureOriginalLineIsVisible(e,t,i){if(this.diff.get()?.mappings.length===0)return;const n=this._unchangedRegions.get()?.regions||[];for(const s of n)if(s.getHiddenOriginalRange(void 0).contains(e)){s.showOriginalLine(e,t,i);return}}async waitForDiff(){await H6(this.isDiffUpToDate,e=>e)}serializeState(){return{collapsedRegions:this._unchangedRegions.get()?.regions.map(t=>({range:t.getHiddenModifiedRange(void 0).serialize()}))}}restoreSerializedState(e){const t=e.collapsedRegions?.map(n=>ke.deserialize(n.range)),i=this._unchangedRegions.get();!i||!t||Dt(n=>{for(const s of i.regions)for(const r of t)if(s.modifiedUnchangedRange.intersect(r)){s.setHiddenModifiedRange(r,n);break}})}};fO=o1e([r1e(2,Pq)],fO);function a1e(o,e,t){return{changes:o.changes.map(i=>new qo(i.original,i.modified,i.innerChanges?i.innerChanges.map(n=>l1e(n,e,t)):void 0)),moves:o.moves,identical:o.identical,quitEarly:o.quitEarly}}function l1e(o,e,t){let i=o.originalRange,n=o.modifiedRange;return i.startColumn===1&&n.startColumn===1&&(i.endColumn!==1||n.endColumn!==1)&&i.endColumn===e.getLineMaxColumn(i.endLineNumber)&&n.endColumn===t.getLineMaxColumn(n.endLineNumber)&&i.endLineNumber<e.getLineCount()&&n.endLineNumber<t.getLineCount()&&(i=i.setEndPosition(i.endLineNumber+1,1),n=n.setEndPosition(n.endLineNumber+1,1)),new Is(i,n)}class gO{static fromDiffResult(e){return new gO(e.changes.map(t=>new Gq(t)),e.moves||[],e.identical,e.quitEarly)}constructor(e,t,i,n){this.mappings=e,this.movedTexts=t,this.identical=i,this.quitEarly=n}}class Gq{constructor(e){this.lineRangeMapping=e}}class Vh{static fromDiffs(e,t,i,n,s){const r=qo.inverse(e,t,i),a=[];for(const l of r){let c=l.original.startLineNumber,d=l.modified.startLineNumber,h=l.original.length;const u=c===1&&d===1,f=c+h===t+1&&d+h===i+1;(u||f)&&h>=s+n?(u&&!f&&(h-=s),f&&!u&&(c+=s,d+=s,h-=s),a.push(new Vh(c,d,h,0,0))):h>=s*2+n&&(c+=s,d+=s,h-=s*2,a.push(new Vh(c,d,h,0,0)))}return a}get originalUnchangedRange(){return ke.ofLength(this.originalLineNumber,this.lineCount)}get modifiedUnchangedRange(){return ke.ofLength(this.modifiedLineNumber,this.lineCount)}constructor(e,t,i,n,s){this.originalLineNumber=e,this.modifiedLineNumber=t,this.lineCount=i,this._visibleLineCountTop=Le(this,0),this.visibleLineCountTop=this._visibleLineCountTop,this._visibleLineCountBottom=Le(this,0),this.visibleLineCountBottom=this._visibleLineCountBottom,this._shouldHideControls=j(this,l=>this.visibleLineCountTop.read(l)+this.visibleLineCountBottom.read(l)===this.lineCount&&!this.isDragged.read(l)),this.isDragged=Le(this,void 0);const r=Math.max(Math.min(n,this.lineCount),0),a=Math.max(Math.min(s,this.lineCount-n),0);RB(n===r),RB(s===a),this._visibleLineCountTop.set(r,void 0),this._visibleLineCountBottom.set(a,void 0)}setVisibleRanges(e,t){const i=[],n=new Tr(e.map(l=>l.modified)).subtractFrom(this.modifiedUnchangedRange);let s=this.originalLineNumber,r=this.modifiedLineNumber;const a=this.modifiedLineNumber+this.lineCount;if(n.ranges.length===0)this.showAll(t),i.push(this);else{let l=0;for(const c of n.ranges){const d=l===n.ranges.length-1;l++;const h=(d?a:c.endLineNumberExclusive)-r,u=new Vh(s,r,h,0,0);u.setHiddenModifiedRange(c,t),i.push(u),s=u.originalUnchangedRange.endLineNumberExclusive,r=u.modifiedUnchangedRange.endLineNumberExclusive}}return i}shouldHideControls(e){return this._shouldHideControls.read(e)}getHiddenOriginalRange(e){return ke.ofLength(this.originalLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}getHiddenModifiedRange(e){return ke.ofLength(this.modifiedLineNumber+this._visibleLineCountTop.read(e),this.lineCount-this._visibleLineCountTop.read(e)-this._visibleLineCountBottom.read(e))}setHiddenModifiedRange(e,t){const i=e.startLineNumber-this.modifiedLineNumber,n=this.modifiedLineNumber+this.lineCount-e.endLineNumberExclusive;this.setState(i,n,t)}getMaxVisibleLineCountTop(){return this.lineCount-this._visibleLineCountBottom.get()}getMaxVisibleLineCountBottom(){return this.lineCount-this._visibleLineCountTop.get()}showMoreAbove(e=10,t){const i=this.getMaxVisibleLineCountTop();this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+e,i),t)}showMoreBelow(e=10,t){const i=this.lineCount-this._visibleLineCountTop.get();this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+e,i),t)}showAll(e){this._visibleLineCountBottom.set(this.lineCount-this._visibleLineCountTop.get(),e)}showModifiedLine(e,t,i){const n=e+1-(this.modifiedLineNumber+this._visibleLineCountTop.get()),s=this.modifiedLineNumber-this._visibleLineCountBottom.get()+this.lineCount-e;t===0&&n<s||t===1?this._visibleLineCountTop.set(this._visibleLineCountTop.get()+n,i):this._visibleLineCountBottom.set(this._visibleLineCountBottom.get()+s,i)}showOriginalLine(e,t,i){const n=e-this.originalLineNumber,s=this.originalLineNumber+this.lineCount-e;t===0&&n<s||t===1?this._visibleLineCountTop.set(Math.min(this._visibleLineCountTop.get()+s-n,this.getMaxVisibleLineCountTop()),i):this._visibleLineCountBottom.set(Math.min(this._visibleLineCountBottom.get()+n-s,this.getMaxVisibleLineCountBottom()),i)}collapseAll(e){this._visibleLineCountTop.set(0,e),this._visibleLineCountBottom.set(0,e)}setState(e,t,i){e=Math.max(Math.min(e,this.lineCount),0),t=Math.max(Math.min(t,this.lineCount-e),0),this._visibleLineCountTop.set(e,i),this._visibleLineCountBottom.set(t,i)}}function S5e(o,e,t,i){}function y5e(o,e,t,i){}class c1e extends A{get visibility(){return this._visibility}set visibility(e){this._visibility!==e&&(this._visibility=e,this._diffActions.style.visibility=e?"visible":"hidden")}constructor(e,t,i,n,s,r,a,l,c){super(),this._getViewZoneId=e,this._marginDomNode=t,this._modifiedEditor=i,this._diff=n,this._editor=s,this._viewLineCounts=r,this._originalTextModel=a,this._contextMenuService=l,this._clipboardService=c,this._visibility=!1,this._marginDomNode.style.zIndex="10",this._diffActions=document.createElement("div"),this._diffActions.className=ve.asClassName(Y.lightBulb)+" lightbulb-glyph",this._diffActions.style.position="absolute";const d=this._modifiedEditor.getOption(75);this._diffActions.style.right="0px",this._diffActions.style.visibility="hidden",this._diffActions.style.height=`${d}px`,this._diffActions.style.lineHeight=`${d}px`,this._marginDomNode.appendChild(this._diffActions);let h=0;const u=i.getOption(144)&&!ur,f=(g,m)=>{this._contextMenuService.showContextMenu({domForShadowRoot:u?i.getDomNode()??void 0:void 0,getAnchor:()=>({x:g,y:m}),getActions:()=>{const _=[],b=n.modified.isEmpty;return _.push(new Mo("diff.clipboard.copyDeletedContent",b?n.original.length>1?p(109,"Copy deleted lines"):p(110,"Copy deleted line"):n.original.length>1?p(111,"Copy changed lines"):p(112,"Copy changed line"),void 0,!0,async()=>{const w=this._originalTextModel.getValueInRange(n.original.toExclusiveRange());await this._clipboardService.writeText(w)})),n.original.length>1&&_.push(new Mo("diff.clipboard.copyDeletedLineContent",b?p(113,"Copy deleted line ({0})",n.original.startLineNumber+h):p(114,"Copy changed line ({0})",n.original.startLineNumber+h),void 0,!0,async()=>{let w=this._originalTextModel.getLineContent(n.original.startLineNumber+h);w===""&&(w=this._originalTextModel.getEndOfLineSequence()===0?`
`:`\r
`),await this._clipboardService.writeText(w)})),i.getOption(104)||_.push(new Mo("diff.inline.revertChange",p(115,"Revert this change"),void 0,!0,async()=>{this._editor.revert(this._diff)})),_},autoSelectFirstItem:!0})};this._register(Si(this._diffActions,"mousedown",g=>{if(!g.leftButton)return;const{top:m,height:_}=mi(this._diffActions),b=Math.floor(d/3);g.preventDefault(),f(g.posx,m+_+b)})),this._register(i.onMouseMove(g=>{(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()?(h=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,d),this.visibility=!0):this.visibility=!1})),this._register(i.onMouseDown(g=>{g.event.leftButton&&(g.target.type===8||g.target.type===5)&&g.target.detail.viewZoneId===this._getViewZoneId()&&(g.event.preventDefault(),h=this._updateLightBulbPosition(this._marginDomNode,g.event.browserEvent.y,d),f(g.event.posx,g.event.posy+d))}))}_updateLightBulbPosition(e,t,i){const{top:n}=mi(e),s=t-n,r=Math.floor(s/i),a=r*i;if(this._diffActions.style.top=`${a}px`,this._viewLineCounts){let l=0;for(let c=0;c<this._viewLineCounts.length;c++)if(l+=this._viewLineCounts[c],r<l)return c}return r}}const Zq=Sl("diffEditorWidget",{createHTML:o=>o});function hw(o,e,t,i,n=!1){dn(i,e.fontInfo);const s=t.length>0,r=new uh(1e4);let a=0,l=0;const c=[];for(let f=0;f<o.lineTokens.length;f++){const g=f+1,m=o.lineTokens[f],_=o.lineBreakData[f],b=os.filter(t,g,1,Number.MAX_SAFE_INTEGER);if(_){let C=0;for(const w of _.breakOffsets){const v=m.sliceAndInflate(C,w,0);a=Math.max(a,Yq(l,v,os.extractWrapped(b,C,w),s,o.mightContainNonBasicASCII,o.mightContainRTL,e,r,n)),l++,C=w}c.push(_.breakOffsets.length)}else c.push(1),a=Math.max(a,Yq(l,m,b,s,o.mightContainNonBasicASCII,o.mightContainRTL,e,r,n)),l++}a+=e.scrollBeyondLastColumn;const d=r.build(),h=Zq?Zq.createHTML(d):d;i.innerHTML=h;const u=a*e.typicalHalfwidthCharacterWidth;return{heightInLines:l,minWidthInPx:u,viewLineCounts:c}}class uw{constructor(e,t=e.map(s=>null),i=!0,n=!0){this.lineTokens=e,this.lineBreakData=t,this.mightContainNonBasicASCII=i,this.mightContainRTL=n}}class dd{static fromEditor(e){const t=e.getOptions(),i=t.get(59),n=t.get(165);return new dd(e.getModel()?.getOptions().tabSize||0,i,t.get(40),i.typicalHalfwidthCharacterWidth,t.get(118),t.get(75),n.decorationsWidth,t.get(133),t.get(113),t.get(108),t.get(60),t.get(117).verticalScrollbarSize)}constructor(e,t,i,n,s,r,a,l,c,d,h,u,f=!0){this.tabSize=e,this.fontInfo=t,this.disableMonospaceOptimizations=i,this.typicalHalfwidthCharacterWidth=n,this.scrollBeyondLastColumn=s,this.lineHeight=r,this.lineDecorationsWidth=a,this.stopRenderingLineAfter=l,this.renderWhitespace=c,this.renderControlCharacters=d,this.fontLigatures=h,this.verticalScrollbarSize=u,this.setWidth=f}withSetWidth(e){return new dd(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,this.scrollBeyondLastColumn,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,e)}withScrollBeyondLastColumn(e){return new dd(this.tabSize,this.fontInfo,this.disableMonospaceOptimizations,this.typicalHalfwidthCharacterWidth,e,this.lineHeight,this.lineDecorationsWidth,this.stopRenderingLineAfter,this.renderWhitespace,this.renderControlCharacters,this.fontLigatures,this.verticalScrollbarSize,this.setWidth)}}function Yq(o,e,t,i,n,s,r,a,l){a.appendString('<div class="view-line'),!l&&!i&&a.appendString(" char-delete"),a.appendString('" style="top:'),a.appendString(String(o*r.lineHeight)),r.setWidth?a.appendString('px;width:1000000px;">'):a.appendString('px;">');const c=e.getLineContent(),d=Vo.isBasicASCII(c,n),h=Vo.containsRTL(c,d,s),u=h_(new Vc(r.fontInfo.isMonospace&&!r.disableMonospaceOptimizations,r.fontInfo.canUseHalfwidthRightwardsArrow,c,!1,d,h,0,e,t,r.tabSize,0,r.fontInfo.spaceWidth,r.fontInfo.middotWidth,r.fontInfo.wsmiddotWidth,r.stopRenderingLineAfter,r.renderWhitespace,r.renderControlCharacters,r.fontLigatures!==Fc.OFF,null,null,r.verticalScrollbarSize),a);return a.appendString("</div>"),u.characterMapping.getHorizontalOffset(u.characterMapping.length)}const Wa=We("clipboardService"),hd=We("contextViewService"),Ko=We("contextMenuService");var d1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Xq=function(o,e){return function(t,i){e(t,i,o)}};let pO=class extends A{constructor(e,t,i,n,s,r,a,l,c,d){super(),this._targetWindow=e,this._editors=t,this._diffModel=i,this._options=n,this._diffEditorWidget=s,this._canIgnoreViewZoneUpdateEvent=r,this._origViewZonesToIgnore=a,this._modViewZonesToIgnore=l,this._clipboardService=c,this._contextMenuService=d,this._originalTopPadding=Le(this,0),this._originalScrollOffset=Le(this,0),this._originalScrollOffsetAnimated=mq(this._targetWindow,this._originalScrollOffset,this._store),this._modifiedTopPadding=Le(this,0),this._modifiedScrollOffset=Le(this,0),this._modifiedScrollOffsetAnimated=mq(this._targetWindow,this._modifiedScrollOffset,this._store);const h=Le("invalidateAlignmentsState",0),u=this._register(new wt(()=>{h.set(h.get()+1,void 0)},0));this._register(this._editors.original.onDidChangeViewZones(w=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.modified.onDidChangeViewZones(w=>{this._canIgnoreViewZoneUpdateEvent()||u.schedule()})),this._register(this._editors.original.onDidChangeConfiguration(w=>{(w.hasChanged(166)||w.hasChanged(75))&&u.schedule()})),this._register(this._editors.modified.onDidChangeConfiguration(w=>{(w.hasChanged(166)||w.hasChanged(75))&&u.schedule()}));const f=this._diffModel.map(w=>w?rt(this,w.model.original.onDidChangeTokens,()=>w.model.original.tokenization.backgroundTokenizationState===2):void 0).map((w,v)=>w?.read(v)),g=j(w=>{const v=this._diffModel.read(w),S=v?.diff.read(w);if(!v||!S)return null;h.read(w);const x=this._options.renderSideBySide.read(w);return Qq(this._editors.original,this._editors.modified,S.mappings,this._origViewZonesToIgnore,this._modViewZonesToIgnore,x)}),m=j(w=>{const v=this._diffModel.read(w)?.movedTextToCompare.read(w);if(!v)return null;h.read(w);const S=v.changes.map(L=>new Gq(L));return Qq(this._editors.original,this._editors.modified,S,this._origViewZonesToIgnore,this._modViewZonesToIgnore,!0)});function _(){const w=document.createElement("div");return w.className="diagonal-fill",w}const b=this._register(new U);this.viewZones=j(this,w=>{b.clear();const v=g.read(w)||[],S=[],L=[],x=this._modifiedTopPadding.read(w);x>0&&L.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:x,showInHiddenAreas:!0,suppressMouseDown:!0});const I=this._originalTopPadding.read(w);I>0&&S.push({afterLineNumber:0,domNode:document.createElement("div"),heightInPx:I,showInHiddenAreas:!0,suppressMouseDown:!0});const D=this._options.renderSideBySide.read(w),R=D?void 0:this._editors.modified._getViewModel()?.createLineBreaksComputer();if(R){const oe=this._editors.original.getModel();for(const fe of v)if(fe.diff)for(let Ie=fe.originalRange.startLineNumber;Ie<fe.originalRange.endLineNumberExclusive;Ie++){if(Ie>oe.getLineCount())return{orig:S,mod:L};R?.addRequest(oe.getLineContent(Ie),null,null)}}const F=R?.finalize()??[];let O=0;const B=this._editors.modified.getOption(75),V=this._diffModel.read(w)?.movedTextToCompare.read(w),z=this._editors.original.getModel()?.mightContainNonBasicASCII()??!1,ee=this._editors.original.getModel()?.mightContainRTL()??!1,se=dd.fromEditor(this._editors.modified);for(const oe of v)if(oe.diff&&!D&&(!this._options.useTrueInlineDiffRendering.read(w)||!mO(oe.diff))){if(!oe.originalRange.isEmpty){f.read(w);const Ie=document.createElement("div");Ie.classList.add("view-lines","line-delete","monaco-mouse-cursor-text");const Ae=this._editors.original.getModel();if(oe.originalRange.endLineNumberExclusive-1>Ae.getLineCount())return{orig:S,mod:L};const tt=new uw(oe.originalRange.mapToLineArray(Mi=>Ae.tokenization.getLineTokens(Mi)),oe.originalRange.mapToLineArray(Mi=>F[O++]),z,ee),Ke=[];for(const Mi of oe.diff.innerChanges||[])Ke.push(new tg(Mi.originalRange.delta(-(oe.diff.original.startLineNumber-1)),aO.className,0));const At=hw(tt,se,Ke,Ie),_t=document.createElement("div");if(_t.className="inline-deleted-margin-view-zone",dn(_t,se.fontInfo),this._options.renderIndicators.read(w))for(let Mi=0;Mi<At.heightInLines;Mi++){const As=document.createElement("div");As.className=`delete-sign ${ve.asClassName(Iq)}`,As.setAttribute("style",`position:absolute;top:${Mi*B}px;width:${se.lineDecorationsWidth}px;height:${B}px;right:0;`),_t.appendChild(As)}let tn;b.add(new c1e(()=>Qd(tn),_t,this._editors.modified,oe.diff,this._diffEditorWidget,At.viewLineCounts,this._editors.original.getModel(),this._contextMenuService,this._clipboardService));for(let Mi=0;Mi<At.viewLineCounts.length;Mi++){const As=At.viewLineCounts[Mi];As>1&&S.push({afterLineNumber:oe.originalRange.startLineNumber+Mi,domNode:_(),heightInPx:(As-1)*B,showInHiddenAreas:!0,suppressMouseDown:!0})}L.push({afterLineNumber:oe.modifiedRange.startLineNumber-1,domNode:Ie,heightInPx:At.heightInLines*B,minWidthInPx:At.minWidthInPx,marginDomNode:_t,setZoneId(Mi){tn=Mi},showInHiddenAreas:!0,suppressMouseDown:!0})}const fe=document.createElement("div");fe.className="gutter-delete",S.push({afterLineNumber:oe.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:oe.modifiedHeightInPx,marginDomNode:fe,showInHiddenAreas:!0,suppressMouseDown:!0})}else{const fe=oe.modifiedHeightInPx-oe.originalHeightInPx;if(fe>0){if(V?.lineRangeMapping.original.delta(-1).deltaLength(2).contains(oe.originalRange.endLineNumberExclusive-1))continue;S.push({afterLineNumber:oe.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:fe,showInHiddenAreas:!0,suppressMouseDown:!0})}else{let Ie=function(){const tt=document.createElement("div");return tt.className="arrow-revert-change "+ve.asClassName(Y.arrowRight),w.store.add(W(tt,"mousedown",Ke=>Ke.stopPropagation())),w.store.add(W(tt,"click",Ke=>{Ke.stopPropagation(),s.revert(oe.diff)})),Q("div",{},tt)};if(V?.lineRangeMapping.modified.delta(-1).deltaLength(2).contains(oe.modifiedRange.endLineNumberExclusive-1))continue;let Ae;oe.diff&&oe.diff.modified.isEmpty&&this._options.shouldRenderOldRevertArrows.read(w)&&(Ae=Ie()),L.push({afterLineNumber:oe.modifiedRange.endLineNumberExclusive-1,domNode:_(),heightInPx:-fe,marginDomNode:Ae,showInHiddenAreas:!0,suppressMouseDown:!0})}}for(const oe of m.read(w)??[]){if(!V?.lineRangeMapping.original.intersect(oe.originalRange)||!V?.lineRangeMapping.modified.intersect(oe.modifiedRange))continue;const fe=oe.modifiedHeightInPx-oe.originalHeightInPx;fe>0?S.push({afterLineNumber:oe.originalRange.endLineNumberExclusive-1,domNode:_(),heightInPx:fe,showInHiddenAreas:!0,suppressMouseDown:!0}):L.push({afterLineNumber:oe.modifiedRange.endLineNumberExclusive-1,domNode:_(),heightInPx:-fe,showInHiddenAreas:!0,suppressMouseDown:!0})}return{orig:S,mod:L}});let C=!1;this._register(this._editors.original.onDidScrollChange(w=>{w.scrollLeftChanged&&!C&&(C=!0,this._editors.modified.setScrollLeft(w.scrollLeft),C=!1)})),this._register(this._editors.modified.onDidScrollChange(w=>{w.scrollLeftChanged&&!C&&(C=!0,this._editors.original.setScrollLeft(w.scrollLeft),C=!1)})),this._originalScrollTop=rt(this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=rt(this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._register(Se(w=>{const v=this._originalScrollTop.read(w)-(this._originalScrollOffsetAnimated.read(void 0)-this._modifiedScrollOffsetAnimated.read(w))-(this._originalTopPadding.read(void 0)-this._modifiedTopPadding.read(w));v!==this._editors.modified.getScrollTop()&&this._editors.modified.setScrollTop(v,1)})),this._register(Se(w=>{const v=this._modifiedScrollTop.read(w)-(this._modifiedScrollOffsetAnimated.read(void 0)-this._originalScrollOffsetAnimated.read(w))-(this._modifiedTopPadding.read(void 0)-this._originalTopPadding.read(w));v!==this._editors.original.getScrollTop()&&this._editors.original.setScrollTop(v,1)})),this._register(Se(w=>{const v=this._diffModel.read(w)?.movedTextToCompare.read(w);let S=0;if(v){const L=this._editors.original.getTopForLineNumber(v.lineRangeMapping.original.startLineNumber,!0)-this._originalTopPadding.read(void 0);S=this._editors.modified.getTopForLineNumber(v.lineRangeMapping.modified.startLineNumber,!0)-this._modifiedTopPadding.read(void 0)-L}S>0?(this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(S,void 0)):S<0?(this._modifiedTopPadding.set(-S,void 0),this._originalTopPadding.set(0,void 0)):setTimeout(()=>{this._modifiedTopPadding.set(0,void 0),this._originalTopPadding.set(0,void 0)},400),this._editors.modified.hasTextFocus()?this._originalScrollOffset.set(this._modifiedScrollOffset.read(void 0)-S,void 0,!0):this._modifiedScrollOffset.set(this._originalScrollOffset.read(void 0)+S,void 0,!0)}))}};pO=d1e([Xq(8,Wa),Xq(9,Ko)],pO);function Qq(o,e,t,i,n,s){const r=new Ec(Jq(o,i)),a=new Ec(Jq(e,n)),l=o.getOption(75),c=e.getOption(75),d=[];let h=0,u=0;function f(g,m){for(;;){let _=r.peek(),b=a.peek();if(_&&_.lineNumber>=g&&(_=void 0),b&&b.lineNumber>=m&&(b=void 0),!_&&!b)break;const C=_?_.lineNumber-h:Number.MAX_VALUE,w=b?b.lineNumber-u:Number.MAX_VALUE;C<w?(r.dequeue(),b={lineNumber:_.lineNumber-h+u,heightInPx:0}):C>w?(a.dequeue(),_={lineNumber:b.lineNumber-u+h,heightInPx:0}):(r.dequeue(),a.dequeue()),d.push({originalRange:ke.ofLength(_.lineNumber,1),modifiedRange:ke.ofLength(b.lineNumber,1),originalHeightInPx:l+_.heightInPx,modifiedHeightInPx:c+b.heightInPx,diff:void 0})}}for(const g of t){let w=function(v,S,L=!1){if(v<C||S<b)return;if(_)_=!1;else if(!L&&(v===C||S===b))return;const x=new ke(C,v),I=new ke(b,S);if(x.isEmpty&&I.isEmpty)return;const D=r.takeWhile(F=>F.lineNumber<v)?.reduce((F,O)=>F+O.heightInPx,0)??0,R=a.takeWhile(F=>F.lineNumber<S)?.reduce((F,O)=>F+O.heightInPx,0)??0;d.push({originalRange:x,modifiedRange:I,originalHeightInPx:x.length*l+D,modifiedHeightInPx:I.length*c+R,diff:g.lineRangeMapping}),C=v,b=S};const m=g.lineRangeMapping;f(m.original.startLineNumber,m.modified.startLineNumber);let _=!0,b=m.modified.startLineNumber,C=m.original.startLineNumber;if(s)for(const v of m.innerChanges||[]){v.originalRange.startColumn>1&&v.modifiedRange.startColumn>1&&w(v.originalRange.startLineNumber,v.modifiedRange.startLineNumber);const S=o.getModel(),L=v.originalRange.endLineNumber<=S.getLineCount()?S.getLineMaxColumn(v.originalRange.endLineNumber):Number.MAX_SAFE_INTEGER;v.originalRange.endColumn<L&&w(v.originalRange.endLineNumber,v.modifiedRange.endLineNumber)}w(m.original.endLineNumberExclusive,m.modified.endLineNumberExclusive,!0),h=m.original.endLineNumberExclusive,u=m.modified.endLineNumberExclusive}return f(Number.MAX_VALUE,Number.MAX_VALUE),d}function Jq(o,e){const t=[],i=[],n=o.getOption(166).wrappingColumn!==-1,s=o._getViewModel().coordinatesConverter,r=o.getOption(75);if(n)for(let l=1;l<=o.getModel().getLineCount();l++){const c=s.getModelLineViewLineCount(l);c>1&&i.push({lineNumber:l,heightInPx:r*(c-1)})}for(const l of o.getWhitespaces()){if(e.has(l.id))continue;const c=l.afterLineNumber===0?0:s.convertViewPositionToModelPosition(new M(l.afterLineNumber,1)).lineNumber;t.push({lineNumber:c,heightInPx:l.height})}return fCe(t,i,l=>l.lineNumber,(l,c)=>({lineNumber:l.lineNumber,heightInPx:l.heightInPx+c.heightInPx}))}function mO(o){return o.innerChanges?o.innerChanges.every(e=>ok(e.modifiedRange)&&ok(e.originalRange)||e.originalRange.equalsRange(new k(1,1,1,1))):!1}function ok(o){return o.startLineNumber===o.endLineNumber}const ES=class ES extends A{constructor(e,t,i,n,s){super(),this._rootElement=e,this._diffModel=t,this._originalEditorLayoutInfo=i,this._modifiedEditorLayoutInfo=n,this._editors=s,this._originalScrollTop=rt(this,this._editors.original.onDidScrollChange,()=>this._editors.original.getScrollTop()),this._modifiedScrollTop=rt(this,this._editors.modified.onDidScrollChange,()=>this._editors.modified.getScrollTop()),this._viewZonesChanged=co("onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this.width=Le(this,0),this._modifiedViewZonesChangedSignal=co("modified.onDidChangeViewZones",this._editors.modified.onDidChangeViewZones),this._originalViewZonesChangedSignal=co("original.onDidChangeViewZones",this._editors.original.onDidChangeViewZones),this._state=j(this,d=>{this._element.replaceChildren();const h=this._diffModel.read(d),u=h?.diff.read(d)?.movedTexts;if(!u||u.length===0){this.width.set(0,void 0);return}this._viewZonesChanged.read(d);const f=this._originalEditorLayoutInfo.read(d),g=this._modifiedEditorLayoutInfo.read(d);if(!f||!g){this.width.set(0,void 0);return}this._modifiedViewZonesChangedSignal.read(d),this._originalViewZonesChangedSignal.read(d);const m=u.map(L=>{function x(ee,se){const oe=se.getTopForLineNumber(ee.startLineNumber,!0),fe=se.getTopForLineNumber(ee.endLineNumberExclusive,!0);return(oe+fe)/2}const I=x(L.lineRangeMapping.original,this._editors.original),D=this._originalScrollTop.read(d),R=x(L.lineRangeMapping.modified,this._editors.modified),F=this._modifiedScrollTop.read(d),O=I-D,B=R-F,V=Math.min(I,R),z=Math.max(I,R);return{range:new pe(V,z),from:O,to:B,fromWithoutScroll:I,toWithoutScroll:R,move:L}});m.sort(vne(kn(L=>L.fromWithoutScroll>L.toWithoutScroll,T6),kn(L=>L.fromWithoutScroll>L.toWithoutScroll?L.fromWithoutScroll:-L.toWithoutScroll,lo)));const _=_O.compute(m.map(L=>L.range)),b=10,C=f.verticalScrollbarWidth,w=(_.getTrackCount()-1)*10+b*2,v=C+w+(g.contentLeft-ES.movedCodeBlockPadding);let S=0;for(const L of m){const x=_.getTrack(S),I=C+b+x*10,D=15,R=15,F=v,O=g.glyphMarginWidth+g.lineNumbersWidth,B=18,V=document.createElementNS("http://www.w3.org/2000/svg","rect");V.classList.add("arrow-rectangle"),V.setAttribute("x",`${F-O}`),V.setAttribute("y",`${L.to-B/2}`),V.setAttribute("width",`${O}`),V.setAttribute("height",`${B}`),this._element.appendChild(V);const z=document.createElementNS("http://www.w3.org/2000/svg","g"),ee=document.createElementNS("http://www.w3.org/2000/svg","path");ee.setAttribute("d",`M 0 ${L.from} L ${I} ${L.from} L ${I} ${L.to} L ${F-R} ${L.to}`),ee.setAttribute("fill","none"),z.appendChild(ee);const se=document.createElementNS("http://www.w3.org/2000/svg","polygon");se.classList.add("arrow"),d.store.add(Se(oe=>{ee.classList.toggle("currentMove",L.move===h.activeMovedText.read(oe)),se.classList.toggle("currentMove",L.move===h.activeMovedText.read(oe))})),se.setAttribute("points",`${F-R},${L.to-D/2} ${F},${L.to} ${F-R},${L.to+D/2}`),z.appendChild(se),this._element.appendChild(z),S++}this.width.set(w,void 0)}),this._element=document.createElementNS("http://www.w3.org/2000/svg","svg"),this._element.setAttribute("class","moved-blocks-lines"),this._rootElement.appendChild(this._element),this._register(ue(()=>this._element.remove())),this._register(Se(d=>{const h=this._originalEditorLayoutInfo.read(d),u=this._modifiedEditorLayoutInfo.read(d);!h||!u||(this._element.style.left=`${h.width-h.verticalScrollbarWidth}px`,this._element.style.height=`${h.height}px`,this._element.style.width=`${h.verticalScrollbarWidth+h.contentLeft-ES.movedCodeBlockPadding+this.width.read(d)}px`)})),this._register(Fm(this._state));const r=j(d=>{const u=this._diffModel.read(d)?.diff.read(d);return u?u.movedTexts.map(f=>({move:f,original:new $_(Et(f.lineRangeMapping.original.startLineNumber-1),18),modified:new $_(Et(f.lineRangeMapping.modified.startLineNumber-1),18)})):[]});this._register(Jx(this._editors.original,r.map(d=>d.map(h=>h.original)))),this._register(Jx(this._editors.modified,r.map(d=>d.map(h=>h.modified)))),this._register(Bn((d,h)=>{const u=r.read(d);for(const f of u)h.add(new eK(this._editors.original,f.original,f.move,"original",this._diffModel.get())),h.add(new eK(this._editors.modified,f.modified,f.move,"modified",this._diffModel.get()))}));const a=co("original.onDidFocusEditorWidget",d=>this._editors.original.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0))),l=co("modified.onDidFocusEditorWidget",d=>this._editors.modified.onDidFocusEditorWidget(()=>setTimeout(()=>d(void 0),0)));let c="modified";this._register(Om({changeTracker:{createChangeSummary:()=>{},handleChange:(d,h)=>(d.didChange(a)&&(c="original"),d.didChange(l)&&(c="modified"),!0)}},d=>{a.read(d),l.read(d);const h=this._diffModel.read(d);if(!h)return;const u=h.diff.read(d);let f;if(u&&c==="original"){const g=this._editors.originalCursor.read(d);g&&(f=u.movedTexts.find(m=>m.lineRangeMapping.original.contains(g.lineNumber)))}if(u&&c==="modified"){const g=this._editors.modifiedCursor.read(d);g&&(f=u.movedTexts.find(m=>m.lineRangeMapping.modified.contains(g.lineNumber)))}f!==h.movedTextToCompare.read(void 0)&&h.movedTextToCompare.set(void 0,void 0),h.setActiveMovedText(f)}))}};ES.movedCodeBlockPadding=4;let K_=ES;class _O{static compute(e){const t=[],i=[];for(const n of e){let s=t.findIndex(r=>!r.intersectsStrict(n));s===-1&&(t.length>=6?s=Dhe(t,kn(a=>a.intersectWithRangeLength(n),lo)):(s=t.length,t.push(new M2))),t[s].addRange(n),i.push(s)}return new _O(t.length,i)}constructor(e,t){this._trackCount=e,this.trackPerLineIdx=t}getTrack(e){return this.trackPerLineIdx[e]}getTrackCount(){return this._trackCount}}class eK extends tO{constructor(e,t,i,n,s){const r=Je("div.diff-hidden-lines-widget");super(e,t,r.root),this._editor=e,this._move=i,this._kind=n,this._diffModel=s,this._nodes=Je("div.diff-moved-code-block",{style:{marginRight:"4px"}},[Je("div.text-content@textContent"),Je("div.action-bar@actionBar")]),r.root.appendChild(this._nodes.root);const a=rt(this._editor.onDidLayoutChange,()=>this._editor.getLayoutInfo());this._register(Hh(this._nodes.root,{paddingRight:a.map(u=>u.verticalScrollbarWidth)}));let l;i.changes.length>0?l=this._kind==="original"?p(128,"Code moved with changes to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):p(129,"Code moved with changes from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1):l=this._kind==="original"?p(130,"Code moved to line {0}-{1}",this._move.lineRangeMapping.modified.startLineNumber,this._move.lineRangeMapping.modified.endLineNumberExclusive-1):p(131,"Code moved from line {0}-{1}",this._move.lineRangeMapping.original.startLineNumber,this._move.lineRangeMapping.original.endLineNumberExclusive-1);const c=this._register(new Ys(this._nodes.actionBar,{highlightToggledItems:!0})),d=new Mo("",l,"",!1);c.push(d,{icon:!1,label:!0});const h=new Mo("","Compare",ve.asClassName(Y.compareChanges),!0,()=>{this._editor.focus(),this._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get()===i?void 0:this._move,void 0)});this._register(Se(u=>{const f=this._diffModel.movedTextToCompare.read(u)===i;h.checked=f})),c.push(h,{icon:!1,label:!0})}}class h1e extends A{constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._decorations=j(this,s=>{const r=this._diffModel.read(s),a=r?.diff.read(s);if(!a)return null;const l=this._diffModel.read(s).movedTextToCompare.read(s),c=this._options.renderIndicators.read(s),d=this._options.showEmptyDecorations.read(s),h=[],u=[];if(!l)for(const g of a.mappings)if(g.lineRangeMapping.original.isEmpty||h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:c?Eq:Tq}),g.lineRangeMapping.modified.isEmpty||u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:c?Dq:Nq}),g.lineRangeMapping.modified.isEmpty||g.lineRangeMapping.original.isEmpty)g.lineRangeMapping.original.isEmpty||h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:BCe}),g.lineRangeMapping.modified.isEmpty||u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:FCe});else{const m=this._options.useTrueInlineDiffRendering.read(s)&&mO(g.lineRangeMapping);for(const _ of g.lineRangeMapping.innerChanges||[])if(g.lineRangeMapping.original.contains(_.originalRange.startLineNumber)&&h.push({range:_.originalRange,options:_.originalRange.isEmpty()&&d?HCe:aO}),g.lineRangeMapping.modified.contains(_.modifiedRange.startLineNumber)&&u.push({range:_.modifiedRange,options:_.modifiedRange.isEmpty()&&d&&!m?WCe:Rq}),m){const b=r.model.original.getValueInRange(_.originalRange);u.push({range:_.modifiedRange,options:{description:"deleted-text",before:{content:b,inlineClassName:"inline-deleted-text"},zIndex:1e5,showIfCollapsed:!0}})}}if(l)for(const g of l.changes){const m=g.original.toInclusiveRange();m&&h.push({range:m,options:c?Eq:Tq});const _=g.modified.toInclusiveRange();_&&u.push({range:_,options:c?Dq:Nq});for(const b of g.innerChanges||[])h.push({range:b.originalRange,options:aO}),u.push({range:b.modifiedRange,options:Rq})}const f=this._diffModel.read(s).activeMovedText.read(s);for(const g of a.movedTexts)h.push({range:g.lineRangeMapping.original.toInclusiveRange(),options:{description:"moved",blockClassName:"movedOriginal"+(g===f?" currentMove":""),blockPadding:[K_.movedCodeBlockPadding,0,K_.movedCodeBlockPadding,K_.movedCodeBlockPadding]}}),u.push({range:g.lineRangeMapping.modified.toInclusiveRange(),options:{description:"moved",blockClassName:"movedModified"+(g===f?" currentMove":""),blockPadding:[4,0,4,4]}});return{originalDecorations:h,modifiedDecorations:u}}),this._register(Qx(this._editors.original,this._decorations.map(s=>s?.originalDecorations||[]))),this._register(Qx(this._editors.modified,this._decorations.map(s=>s?.modifiedDecorations||[])))}}class en{static equals(e,t){return e.x===t.x&&e.y===t.y}constructor(e,t){this.x=e,this.y=t}add(e){return new en(this.x+e.x,this.y+e.y)}deltaX(e){return new en(this.x+e,this.y)}deltaY(e){return new en(this.x,this.y+e)}toString(){return`(${this.x},${this.y})`}subtract(e){return new en(this.x-e.x,this.y-e.y)}scale(e){return new en(this.x*e,this.y*e)}mapComponents(e){return new en(e(this.x),e(this.y))}isZero(){return this.x===0&&this.y===0}withThreshold(e){return this.mapComponents(t=>t>e?t-e:t<-e?t+e:0)}}function ni(o){return bO.get(o)}const Lu=class Lu extends A{static get(e){let t=Lu._map.get(e);if(!t){t=new Lu(e),Lu._map.set(e,t);const i=e.onDidDispose(()=>{const n=Lu._map.get(e);n&&(Lu._map.delete(e),n.dispose(),i.dispose())})}return t}_beginUpdate(){this._updateCounter++,this._updateCounter===1&&(this._currentTransaction=new Pm(()=>{}))}_endUpdate(){if(this._updateCounter--,this._updateCounter===0){const e=this._currentTransaction;this._currentTransaction=void 0,e.finish()}}constructor(e){super(),this.editor=e,this._updateCounter=0,this._currentTransaction=void 0,this._model=Le(this,this.editor.getModel()),this.model=this._model,this.isReadonly=rt(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(104)),this._versionId=m1({owner:this,lazy:!0},this.editor.getModel()?.getVersionId()??null),this.versionId=this._versionId,this._selections=m1({owner:this,equalsFn:rf(f1(ce.selectionsEqual)),lazy:!0},this.editor.getSelections()??null),this.selections=this._selections,this.positions=In({owner:this,equalsFn:rf(f1(M.equals))},t=>this.selections.read(t)?.map(i=>i.getStartPosition())??null),this.isFocused=rt(this,t=>{const i=this.editor.onDidFocusEditorWidget(t),n=this.editor.onDidBlurEditorWidget(t);return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.hasWidgetFocus()),this.isTextFocused=rt(this,t=>{const i=this.editor.onDidFocusEditorText(t),n=this.editor.onDidBlurEditorText(t);return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.hasTextFocus()),this.inComposition=rt(this,t=>{const i=this.editor.onDidCompositionStart(()=>{t(void 0)}),n=this.editor.onDidCompositionEnd(()=>{t(void 0)});return{dispose(){i.dispose(),n.dispose()}}},()=>this.editor.inComposition),this.value=GR(this,t=>(this.versionId.read(t),this.model.read(t)?.getValue()??""),(t,i)=>{const n=this.model.get();n!==null&&t!==n.getValue()&&n.setValue(t)}),this.valueIsEmpty=j(this,t=>(this.versionId.read(t),this.editor.getModel()?.getValueLength()===0)),this.cursorSelection=In({owner:this,equalsFn:rf(ce.selectionsEqual)},t=>this.selections.read(t)?.[0]??null),this.cursorPosition=In({owner:this,equalsFn:M.equals},t=>this.selections.read(t)?.[0]?.getPosition()??null),this.cursorLineNumber=j(this,t=>this.cursorPosition.read(t)?.lineNumber??null),this.onDidType=_r(this),this.onDidPaste=_r(this),this.scrollTop=rt(this.editor.onDidScrollChange,()=>this.editor.getScrollTop()),this.scrollLeft=rt(this.editor.onDidScrollChange,()=>this.editor.getScrollLeft()),this.layoutInfo=rt(this.editor.onDidLayoutChange,()=>this.editor.getLayoutInfo()),this.layoutInfoContentLeft=this.layoutInfo.map(t=>t.contentLeft),this.layoutInfoDecorationsLeft=this.layoutInfo.map(t=>t.decorationsLeft),this.layoutInfoWidth=this.layoutInfo.map(t=>t.width),this.layoutInfoHeight=this.layoutInfo.map(t=>t.height),this.layoutInfoMinimap=this.layoutInfo.map(t=>t.minimap),this.layoutInfoVerticalScrollbarWidth=this.layoutInfo.map(t=>t.verticalScrollbarWidth),this.contentWidth=rt(this.editor.onDidContentSizeChange,()=>this.editor.getContentWidth()),this.contentHeight=rt(this.editor.onDidContentSizeChange,()=>this.editor.getContentHeight()),this._widgetCounter=0,this.openedPeekWidgets=Le(this,0),this._register(this.editor.onBeginUpdate(()=>this._beginUpdate())),this._register(this.editor.onEndUpdate(()=>this._endUpdate())),this._register(this.editor.onDidChangeModel(()=>{this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidType(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidType.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidPaste(t=>{this._beginUpdate();try{this._forceUpdate(),this.onDidPaste.trigger(this._currentTransaction,t)}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeModelContent(t=>{this._beginUpdate();try{this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this._register(this.editor.onDidChangeCursorSelection(t=>{this._beginUpdate();try{this._selections.set(this.editor.getSelections(),this._currentTransaction,t),this._forceUpdate()}finally{this._endUpdate()}})),this.domNode=j(t=>(this.model.read(t),this.editor.getDomNode()))}forceUpdate(e){this._beginUpdate();try{return this._forceUpdate(),e?e(this._currentTransaction):void 0}finally{this._endUpdate()}}_forceUpdate(){this._beginUpdate();try{this._model.set(this.editor.getModel(),this._currentTransaction),this._versionId.set(this.editor.getModel()?.getVersionId()??null,this._currentTransaction,void 0),this._selections.set(this.editor.getSelections(),this._currentTransaction,void 0)}finally{this._endUpdate()}}getOption(e,t=Gi.ofCaller()){return rt(this,i=>this.editor.onDidChangeConfiguration(n=>{n.hasChanged(e)&&i(void 0)}),()=>this.editor.getOption(e),t)}setDecorations(e){const t=new U,i=this.editor.createDecorationsCollection();return t.add(Sy({owner:this,debugName:()=>`Apply decorations from ${e.debugName}`},n=>{const s=e.read(n);i.set(s)})),t.add({dispose:()=>{i.clear()}}),t}createOverlayWidget(e){const t="observableOverlayWidget"+this._widgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow,getMinContentWidthInPx:()=>e.minContentWidthInPx.get()};this.editor.addOverlayWidget(i);const n=Se(s=>{e.position.read(s),e.minContentWidthInPx.read(s),this.editor.layoutOverlayWidget(i)});return ue(()=>{n.dispose(),this.editor.removeOverlayWidget(i)})}createContentWidget(e){const t="observableContentWidget"+this._widgetCounter++,i={getDomNode:()=>e.domNode,getPosition:()=>e.position.get(),getId:()=>t,allowEditorOverflow:e.allowEditorOverflow};this.editor.addContentWidget(i);const n=Se(s=>{e.position.read(s),this.editor.layoutContentWidget(i)});return ue(()=>{n.dispose(),this.editor.removeContentWidget(i)})}observeLineOffsetRange(e,t){const i=this.observePosition(e.map(s=>new M(s.startLineNumber,1)),t),n=this.observePosition(e.map(s=>new M(s.endLineNumberExclusive+1,1)),t);return j(s=>{i.read(s),n.read(s);const r=e.read(s),a=this.model.read(s)?.getLineCount(),l=(typeof a<"u"&&r.startLineNumber>a?this.editor.getBottomForLineNumber(a):this.editor.getTopForLineNumber(r.startLineNumber))-this.scrollTop.read(s),c=r.isEmpty?l:this.editor.getBottomForLineNumber(r.endLineNumberExclusive-1)-this.scrollTop.read(s);return new pe(l,c)})}observePosition(e,t){let i=e.get();const n=m1({owner:this,debugName:()=>`topLeftOfPosition${i?.toString()}`,equalsFn:rf(en.equals)},new en(0,0)),s="observablePositionWidget"+this._widgetCounter++,r=document.createElement("div"),a={getDomNode:()=>r,getPosition:()=>i?{preference:[0],position:e.get()}:null,getId:()=>s,allowEditorOverflow:!1,afterRender:(l,c)=>{const d=this._model.get();d&&i&&i.lineNumber>d.getLineCount()?n.set(new en(0,this.editor.getBottomForLineNumber(d.getLineCount())-this.scrollTop.get()),void 0):n.set(c?new en(c.left,c.top):null,void 0)}};return this.editor.addContentWidget(a),t.add(Se(l=>{i=e.read(l),this.editor.layoutContentWidget(a)})),t.add(ue(()=>{this.editor.removeContentWidget(a)})),n}isTargetHovered(e,t){const i=Le("isInjectedTextHovered",!1);return t.add(this.editor.onMouseMove(n=>{const s=e(n);i.set(s,void 0)})),t.add(this.editor.onMouseLeave(n=>{i.set(!1,void 0)})),i}observeLineHeightForPosition(e){return j(t=>{const i=e instanceof M?e:e.read(t);return i===null?null:(this.getOption(75).read(t),this.editor.getLineHeightForPosition(i))})}observeLineHeightForLine(e){return typeof e=="number"?this.observeLineHeightForPosition(new M(e,1)):j(t=>{const i=e.read(t);return i===null?null:this.observeLineHeightForPosition(new M(i,1)).read(t)})}observeLineHeightsForLineRange(e){return j(t=>{const i=e instanceof ke?e:e.read(t),n=[];for(let s=i.startLineNumber;s<i.endLineNumberExclusive;s++)n.push(this.observeLineHeightForLine(s).read(t));return n})}};Lu._map=new Map;let bO=Lu;var u1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},f1e=function(o,e){return function(t,i){e(t,i,o)}},Ba;let fw=(zd=class extends A{constructor(e,t,i,n,s,r,a){super(),this._editors=e,this._rootElement=t,this._diffModel=i,this._rootWidth=n,this._rootHeight=s,this._modifiedEditorLayoutInfo=r,this._themeService=a,this.width=Ba.ENTIRE_DIFF_OVERVIEW_WIDTH;const l=rt(this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme()),c=j(u=>{const f=l.read(u),g=f.getColor(rle)||(f.getColor(Df)||rM).transparent(2),m=f.getColor(ale)||(f.getColor(wh)||aM).transparent(2);return{insertColor:g,removeColor:m}}),d=lt(document.createElement("div"));d.setClassName("diffViewport"),d.setPosition("absolute");const h=Je("div.diffOverview",{style:{position:"absolute",top:"0px",width:Ba.ENTIRE_DIFF_OVERVIEW_WIDTH+"px"}}).root;this._register(U_(h,d.domNode)),this._register(Si(h,te.POINTER_DOWN,u=>{this._editors.modified.delegateVerticalScrollbarPointerDown(u)})),this._register(W(h,te.MOUSE_WHEEL,u=>{this._editors.modified.delegateScrollFromMouseWheelEvent(u)},{passive:!1})),this._register(U_(this._rootElement,h)),this._register(Bn((u,f)=>{const g=this._diffModel.read(u),m=this._editors.original.createOverviewRuler("original diffOverviewRuler");m&&(f.add(m),f.add(U_(h,m.getDomNode())));const _=this._editors.modified.createOverviewRuler("modified diffOverviewRuler");if(_&&(f.add(_),f.add(U_(h,_.getDomNode()))),!m||!_)return;const b=co("viewZoneChanged",this._editors.original.onDidChangeViewZones),C=co("viewZoneChanged",this._editors.modified.onDidChangeViewZones),w=co("hiddenRangesChanged",this._editors.original.onDidChangeHiddenAreas),v=co("hiddenRangesChanged",this._editors.modified.onDidChangeHiddenAreas);f.add(Se(S=>{b.read(S),C.read(S),w.read(S),v.read(S);const L=c.read(S),x=g?.diff.read(S)?.mappings;function I(F,O,B){const V=B._getViewModel();return V?F.filter(z=>z.length>0).map(z=>{const ee=V.coordinatesConverter.convertModelPositionToViewPosition(new M(z.startLineNumber,1)),se=V.coordinatesConverter.convertModelPositionToViewPosition(new M(z.endLineNumberExclusive,1)),oe=se.lineNumber-ee.lineNumber;return new oU(ee.lineNumber,se.lineNumber,oe,O.toString())}):[]}const D=I((x||[]).map(F=>F.lineRangeMapping.original),L.removeColor,this._editors.original),R=I((x||[]).map(F=>F.lineRangeMapping.modified),L.insertColor,this._editors.modified);m?.setZones(D),_?.setZones(R)})),f.add(Se(S=>{const L=this._rootHeight.read(S),x=this._rootWidth.read(S),I=this._modifiedEditorLayoutInfo.read(S);if(I){const D=Ba.ENTIRE_DIFF_OVERVIEW_WIDTH-2*Ba.ONE_OVERVIEW_WIDTH;m.setLayout({top:0,height:L,right:D+Ba.ONE_OVERVIEW_WIDTH,width:Ba.ONE_OVERVIEW_WIDTH}),_.setLayout({top:0,height:L,right:0,width:Ba.ONE_OVERVIEW_WIDTH});const R=this._editors.modifiedScrollTop.read(S),F=this._editors.modifiedScrollHeight.read(S),O=this._editors.modified.getOption(117),B=new m_(O.verticalHasArrows?O.arrowSize:0,O.verticalScrollbarSize,0,I.height,F,R);d.setTop(B.getSliderPosition()),d.setHeight(B.getSliderSize())}else d.setTop(0),d.setHeight(0);h.style.height=L+"px",h.style.left=x-Ba.ENTIRE_DIFF_OVERVIEW_WIDTH+"px",d.setWidth(Ba.ENTIRE_DIFF_OVERVIEW_WIDTH)}))}))}},Ba=zd,zd.ONE_OVERVIEW_WIDTH=15,zd.ENTIRE_DIFF_OVERVIEW_WIDTH=zd.ONE_OVERVIEW_WIDTH*2,zd);fw=Ba=u1e([f1e(6,li)],fw);var g1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CO=function(o,e){return function(t,i){e(t,i,o)}};let vO=class extends A{get onDidContentSizeChange(){return this._onDidContentSizeChange.event}constructor(e,t,i,n,s,r,a,l){super(),this.originalEditorElement=e,this.modifiedEditorElement=t,this._options=i,this._argCodeEditorWidgetOptions=n,this._createInnerEditor=s,this._contextKeyService=r,this._instantiationService=a,this._keybindingService=l,this.original=this._register(this._createLeftHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.originalEditor||{})),this.modified=this._register(this._createRightHandSideEditor(this._options.editorOptions.get(),this._argCodeEditorWidgetOptions.modifiedEditor||{})),this._onDidContentSizeChange=this._register(new P),this.modifiedScrollTop=rt(this,this.modified.onDidScrollChange,()=>this.modified.getScrollTop()),this.modifiedScrollHeight=rt(this,this.modified.onDidScrollChange,()=>this.modified.getScrollHeight()),this.modifiedObs=ni(this.modified),this.originalObs=ni(this.original),this.modifiedModel=this.modifiedObs.model,this.modifiedSelections=rt(this,this.modified.onDidChangeCursorSelection,()=>this.modified.getSelections()??[]),this.modifiedCursor=In({owner:this,equalsFn:M.equals},c=>this.modifiedSelections.read(c)[0]?.getPosition()??new M(1,1)),this.originalCursor=rt(this,this.original.onDidChangeCursorPosition,()=>this.original.getPosition()??new M(1,1)),this.isOriginalFocused=ni(this.original).isFocused,this.isModifiedFocused=ni(this.modified).isFocused,this.isFocused=j(this,c=>this.isOriginalFocused.read(c)||this.isModifiedFocused.read(c)),this._argCodeEditorWidgetOptions=null,this._register(Om({changeTracker:{createChangeSummary:()=>({}),handleChange:(c,d)=>(c.didChange(i.editorOptions)&&Object.assign(d,c.change.changedOptions),!0)}},(c,d)=>{i.editorOptions.read(c),this._options.renderSideBySide.read(c),this.modified.updateOptions(this._adjustOptionsForRightHandSide(c,d)),this.original.updateOptions(this._adjustOptionsForLeftHandSide(c,d))}))}_createLeftHandSideEditor(e,t){const i=this._adjustOptionsForLeftHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.originalEditorElement,i,t),s=this._contextKeyService.createKey("isInDiffLeftEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>s.set(!0))),this._register(n.onDidBlurEditorWidget(()=>s.set(!1))),n}_createRightHandSideEditor(e,t){const i=this._adjustOptionsForRightHandSide(void 0,e),n=this._constructInnerEditor(this._instantiationService,this.modifiedEditorElement,i,t),s=this._contextKeyService.createKey("isInDiffRightEditor",n.hasWidgetFocus());return this._register(n.onDidFocusEditorWidget(()=>s.set(!0))),this._register(n.onDidBlurEditorWidget(()=>s.set(!1))),n}_constructInnerEditor(e,t,i,n){const s=this._createInnerEditor(e,t,i,n);return this._register(s.onDidContentSizeChange(r=>{const a=this.original.getContentWidth()+this.modified.getContentWidth()+fw.ENTIRE_DIFF_OVERVIEW_WIDTH,l=Math.max(this.modified.getContentHeight(),this.original.getContentHeight());this._onDidContentSizeChange.fire({contentHeight:l,contentWidth:a,contentHeightChanged:r.contentHeightChanged,contentWidthChanged:r.contentWidthChanged})})),s}_adjustOptionsForLeftHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return this._options.renderSideBySide.get()?(i.unicodeHighlight=this._options.editorOptions.get().unicodeHighlight||{},i.wordWrapOverride1=this._options.diffWordWrap.get()):(i.wordWrapOverride1="off",i.wordWrapOverride2="off",i.stickyScroll={enabled:!1},i.unicodeHighlight={nonBasicASCII:!1,ambiguousCharacters:!1,invisibleCharacters:!1}),i.glyphMargin=this._options.renderSideBySide.get(),t.originalAriaLabel&&(i.ariaLabel=t.originalAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.readOnly=!this._options.originalEditable.get(),i.dropIntoEditor={enabled:!i.readOnly},i.extraEditorClassName="original-in-monaco-diff-editor",i}_adjustOptionsForRightHandSide(e,t){const i=this._adjustOptionsForSubEditor(t);return t.modifiedAriaLabel&&(i.ariaLabel=t.modifiedAriaLabel),i.ariaLabel=this._updateAriaLabel(i.ariaLabel),i.wordWrapOverride1=this._options.diffWordWrap.get(),i.revealHorizontalRightPadding=Da.revealHorizontalRightPadding.defaultValue+fw.ENTIRE_DIFF_OVERVIEW_WIDTH,i.scrollbar.verticalHasArrows=!1,i.extraEditorClassName="modified-in-monaco-diff-editor",i}_adjustOptionsForSubEditor(e){const t={...e,dimension:{height:0,width:0}};return t.inDiffEditor=!0,t.automaticLayout=!1,t.allowVariableLineHeights=!1,t.allowVariableFonts=!1,t.allowVariableFontsInAccessibilityMode=!1,t.scrollbar={...t.scrollbar||{}},t.folding=!1,t.codeLens=this._options.diffCodeLens.get(),t.fixedOverflowWidgets=!0,t.minimap={...t.minimap||{}},t.minimap.enabled=!1,this._options.hideUnchangedRegions.get()?t.stickyScroll={enabled:!1}:t.stickyScroll=this._options.editorOptions.get().stickyScroll,t}_updateAriaLabel(e){e||(e="");const t=p(108," use {0} to open the accessibility help.",this._keybindingService.lookupKeybinding("editor.action.accessibilityHelp")?.getAriaLabel());return this._options.accessibilityVerbose.get()?e+t:e?e.replaceAll(t,""):""}};vO=g1e([CO(5,xe),CO(6,ge),CO(7,ot)],vO);var G_=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};const p1e=!1;var rk;(function(o){o.North="north",o.South="south",o.East="east",o.West="west"})(rk||(rk={}));let m1e=4;const _1e=new P;let b1e=300;const C1e=new P;class wO{constructor(e){this.el=e,this.disposables=new U}get onPointerMove(){return this.disposables.add(new gt(me(this.el),"mousemove")).event}get onPointerUp(){return this.disposables.add(new gt(me(this.el),"mouseup")).event}dispose(){this.disposables.dispose()}}G_([vi],wO.prototype,"onPointerMove",null),G_([vi],wO.prototype,"onPointerUp",null);class SO{get onPointerMove(){return this.disposables.add(new gt(this.el,Pt.Change)).event}get onPointerUp(){return this.disposables.add(new gt(this.el,Pt.End)).event}constructor(e){this.el=e,this.disposables=new U}dispose(){this.disposables.dispose()}}G_([vi],SO.prototype,"onPointerMove",null),G_([vi],SO.prototype,"onPointerUp",null);class ak{get onPointerMove(){return this.factory.onPointerMove}get onPointerUp(){return this.factory.onPointerUp}constructor(e){this.factory=e}dispose(){}}G_([vi],ak.prototype,"onPointerMove",null),G_([vi],ak.prototype,"onPointerUp",null);const tK="pointer-events-disabled";class Gn extends A{get state(){return this._state}get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}set state(e){this._state!==e&&(this.el.classList.toggle("disabled",e===0),this.el.classList.toggle("minimum",e===1),this.el.classList.toggle("maximum",e===2),this._state=e,this.onDidEnablementChange.fire(e))}get onDidStart(){return this._onDidStart.event}get onDidChange(){return this._onDidChange.event}get onDidReset(){return this._onDidReset.event}get onDidEnd(){return this._onDidEnd.event}set orthogonalStartSash(e){if(this._orthogonalStartSash!==e){if(this.orthogonalStartDragHandleDisposables.clear(),this.orthogonalStartSashDisposables.clear(),e){const t=i=>{this.orthogonalStartDragHandleDisposables.clear(),i!==0&&(this._orthogonalStartDragHandle=Z(this.el,Q(".orthogonal-drag-handle.start")),this.orthogonalStartDragHandleDisposables.add(ue(()=>this._orthogonalStartDragHandle.remove())),this.orthogonalStartDragHandleDisposables.add(W(this._orthogonalStartDragHandle,"mouseenter",()=>Gn.onMouseEnter(e))),this.orthogonalStartDragHandleDisposables.add(W(this._orthogonalStartDragHandle,"mouseleave",()=>Gn.onMouseLeave(e))))};this.orthogonalStartSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalStartSash=e}}set orthogonalEndSash(e){if(this._orthogonalEndSash!==e){if(this.orthogonalEndDragHandleDisposables.clear(),this.orthogonalEndSashDisposables.clear(),e){const t=i=>{this.orthogonalEndDragHandleDisposables.clear(),i!==0&&(this._orthogonalEndDragHandle=Z(this.el,Q(".orthogonal-drag-handle.end")),this.orthogonalEndDragHandleDisposables.add(ue(()=>this._orthogonalEndDragHandle.remove())),this.orthogonalEndDragHandleDisposables.add(W(this._orthogonalEndDragHandle,"mouseenter",()=>Gn.onMouseEnter(e))),this.orthogonalEndDragHandleDisposables.add(W(this._orthogonalEndDragHandle,"mouseleave",()=>Gn.onMouseLeave(e))))};this.orthogonalEndSashDisposables.add(e.onDidEnablementChange.event(t,this)),t(e.state)}this._orthogonalEndSash=e}}constructor(e,t,i){super(),this.hoverDelay=b1e,this.hoverDelayer=this._register(new fr(this.hoverDelay)),this._state=3,this.onDidEnablementChange=this._register(new P),this._onDidStart=this._register(new P),this._onDidChange=this._register(new P),this._onDidReset=this._register(new P),this._onDidEnd=this._register(new P),this.orthogonalStartSashDisposables=this._register(new U),this.orthogonalStartDragHandleDisposables=this._register(new U),this.orthogonalEndSashDisposables=this._register(new U),this.orthogonalEndDragHandleDisposables=this._register(new U),this.linkedSash=void 0,this.el=Z(e,Q(".monaco-sash")),i.orthogonalEdge&&this.el.classList.add(`orthogonal-edge-${i.orthogonalEdge}`),ze&&this.el.classList.add("mac"),this._register(W(this.el,"mousedown",s=>this.onPointerStart(s,new wO(e)))),this._register(W(this.el,"dblclick",s=>this.onPointerDoublePress(s))),this._register(W(this.el,"mouseenter",()=>Gn.onMouseEnter(this))),this._register(W(this.el,"mouseleave",()=>Gn.onMouseLeave(this))),this._register($n.addTarget(this.el)),this._register(W(this.el,Pt.Start,s=>this.onPointerStart(s,new SO(this.el))));let n;this._register(W(this.el,Pt.Tap,s=>{if(n){clearTimeout(n),n=void 0,this.onPointerDoublePress(s);return}clearTimeout(n),n=setTimeout(()=>n=void 0,250)})),typeof i.size=="number"?(this.size=i.size,i.orientation===0?this.el.style.width=`${this.size}px`:this.el.style.height=`${this.size}px`):(this.size=m1e,this._register(_1e.event(s=>{this.size=s,this.layout()}))),this._register(C1e.event(s=>this.hoverDelay=s)),this.layoutProvider=t,this.orthogonalStartSash=i.orthogonalStartSash,this.orthogonalEndSash=i.orthogonalEndSash,this.orientation=i.orientation||0,this.orientation===1?(this.el.classList.add("horizontal"),this.el.classList.remove("vertical")):(this.el.classList.remove("horizontal"),this.el.classList.add("vertical")),this.el.classList.toggle("debug",p1e),this.layout()}onPointerStart(e,t){st.stop(e);let i=!1;if(!e.__orthogonalSashEvent){const g=this.getOrthogonalSash(e);g&&(i=!0,e.__orthogonalSashEvent=!0,g.onPointerStart(e,new ak(t)))}if(this.linkedSash&&!e.__linkedSashEvent&&(e.__linkedSashEvent=!0,this.linkedSash.onPointerStart(e,new ak(t))),!this.state)return;const n=this.el.ownerDocument.getElementsByTagName("iframe");for(const g of n)g.classList.add(tK);const s=e.pageX,r=e.pageY,a=e.altKey,l={startX:s,currentX:s,startY:r,currentY:r,altKey:a};this.el.classList.add("active"),this._onDidStart.fire(l);const c=Ir(this.el),d=()=>{let g="";i?g="all-scroll":this.orientation===1?this.state===1?g="s-resize":this.state===2?g="n-resize":g=ze?"row-resize":"ns-resize":this.state===1?g="e-resize":this.state===2?g="w-resize":g=ze?"col-resize":"ew-resize",c.textContent=`* { cursor: ${g} !important; }`},h=new U;d(),i||this.onDidEnablementChange.event(d,null,h);const u=g=>{st.stop(g,!1);const m={startX:s,currentX:g.pageX,startY:r,currentY:g.pageY,altKey:a};this._onDidChange.fire(m)},f=g=>{st.stop(g,!1),c.remove(),this.el.classList.remove("active"),this._onDidEnd.fire(),h.dispose();for(const m of n)m.classList.remove(tK)};t.onPointerMove(u,null,h),t.onPointerUp(f,null,h),h.add(t)}onPointerDoublePress(e){const t=this.getOrthogonalSash(e);t&&t._onDidReset.fire(),this.linkedSash&&this.linkedSash._onDidReset.fire(),this._onDidReset.fire()}static onMouseEnter(e,t=!1){e.el.classList.contains("active")?(e.hoverDelayer.cancel(),e.el.classList.add("hover")):e.hoverDelayer.trigger(()=>e.el.classList.add("hover"),e.hoverDelay).then(void 0,()=>{}),!t&&e.linkedSash&&Gn.onMouseEnter(e.linkedSash,!0)}static onMouseLeave(e,t=!1){e.hoverDelayer.cancel(),e.el.classList.remove("hover"),!t&&e.linkedSash&&Gn.onMouseLeave(e.linkedSash,!0)}clearSashHoverState(){Gn.onMouseLeave(this)}layout(){if(this.orientation===0){const e=this.layoutProvider;this.el.style.left=e.getVerticalSashLeft(this)-this.size/2+"px",e.getVerticalSashTop&&(this.el.style.top=e.getVerticalSashTop(this)+"px"),e.getVerticalSashHeight&&(this.el.style.height=e.getVerticalSashHeight(this)+"px")}else{const e=this.layoutProvider;this.el.style.top=e.getHorizontalSashTop(this)-this.size/2+"px",e.getHorizontalSashLeft&&(this.el.style.left=e.getHorizontalSashLeft(this)+"px"),e.getHorizontalSashWidth&&(this.el.style.width=e.getHorizontalSashWidth(this)+"px")}}getOrthogonalSash(e){const t=e.initialTarget??e.target;if(!(!t||!ai(t))&&t.classList.contains("orthogonal-drag-handle"))return t.classList.contains("start")?this.orthogonalStartSash:this.orthogonalEndSash}dispose(){super.dispose(),this.el.remove()}}class v1e{resetSash(){this._sashRatio.set(void 0,void 0)}constructor(e,t){this._options=e,this.dimensions=t,this.sashLeft=GR(this,i=>{const n=this._sashRatio.read(i)??this._options.splitViewDefaultRatio.read(i);return this._computeSashLeft(n,i)},(i,n)=>{const s=this.dimensions.width.get();this._sashRatio.set(i/s,n)}),this._sashRatio=Le(this,void 0)}_computeSashLeft(e,t){const i=this.dimensions.width.read(t),n=Math.floor(this._options.splitViewDefaultRatio.read(t)*i),s=this._options.enableSplitViewResizing.read(t)?Math.floor(e*i):n,r=100;return i<=r*2?n:s<r?r:s>i-r?i-r:s}}class iK extends A{constructor(e,t,i,n,s,r){super(),this._domNode=e,this._dimensions=t,this._enabled=i,this._boundarySashes=n,this.sashLeft=s,this._resetSash=r,this._sash=this._register(new Gn(this._domNode,{getVerticalSashTop:a=>0,getVerticalSashLeft:a=>this.sashLeft.get(),getVerticalSashHeight:a=>this._dimensions.height.get()},{orientation:0})),this._startSashPosition=void 0,this._register(this._sash.onDidStart(()=>{this._startSashPosition=this.sashLeft.get()})),this._register(this._sash.onDidChange(a=>{this.sashLeft.set(this._startSashPosition+(a.currentX-a.startX),void 0)})),this._register(this._sash.onDidEnd(()=>this._sash.layout())),this._register(this._sash.onDidReset(()=>this._resetSash())),this._register(Se(a=>{const l=this._boundarySashes.read(a);l&&(this._sash.orthogonalEndSash=l.bottom)})),this._register(Se(a=>{const l=this._enabled.read(a);this._sash.state=l?3:0,this.sashLeft.read(a),this._dimensions.height.read(a),this._sash.layout()}))}}const SN=class SN extends A{constructor(){super(...arguments),this._id=++SN.idCounter,this._onDidDispose=this._register(new P),this.onDidDispose=this._onDidDispose.event}getId(){return this.getEditorType()+":v2:"+this._id}getVisibleColumnFromPosition(e){return this._targetEditor.getVisibleColumnFromPosition(e)}getPosition(){return this._targetEditor.getPosition()}setPosition(e,t="api"){this._targetEditor.setPosition(e,t)}revealLine(e,t=0){this._targetEditor.revealLine(e,t)}revealLineInCenter(e,t=0){this._targetEditor.revealLineInCenter(e,t)}revealLineInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealLineInCenterIfOutsideViewport(e,t)}revealLineNearTop(e,t=0){this._targetEditor.revealLineNearTop(e,t)}revealPosition(e,t=0){this._targetEditor.revealPosition(e,t)}revealPositionInCenter(e,t=0){this._targetEditor.revealPositionInCenter(e,t)}revealPositionInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealPositionInCenterIfOutsideViewport(e,t)}revealPositionNearTop(e,t=0){this._targetEditor.revealPositionNearTop(e,t)}getSelection(){return this._targetEditor.getSelection()}getSelections(){return this._targetEditor.getSelections()}setSelection(e,t="api"){this._targetEditor.setSelection(e,t)}setSelections(e,t="api"){this._targetEditor.setSelections(e,t)}revealLines(e,t,i=0){this._targetEditor.revealLines(e,t,i)}revealLinesInCenter(e,t,i=0){this._targetEditor.revealLinesInCenter(e,t,i)}revealLinesInCenterIfOutsideViewport(e,t,i=0){this._targetEditor.revealLinesInCenterIfOutsideViewport(e,t,i)}revealLinesNearTop(e,t,i=0){this._targetEditor.revealLinesNearTop(e,t,i)}revealRange(e,t=0,i=!1,n=!0){this._targetEditor.revealRange(e,t,i,n)}revealRangeInCenter(e,t=0){this._targetEditor.revealRangeInCenter(e,t)}revealRangeInCenterIfOutsideViewport(e,t=0){this._targetEditor.revealRangeInCenterIfOutsideViewport(e,t)}revealRangeNearTop(e,t=0){this._targetEditor.revealRangeNearTop(e,t)}revealRangeNearTopIfOutsideViewport(e,t=0){this._targetEditor.revealRangeNearTopIfOutsideViewport(e,t)}revealRangeAtTop(e,t=0){this._targetEditor.revealRangeAtTop(e,t)}getSupportedActions(){return this._targetEditor.getSupportedActions()}focus(){this._targetEditor.focus()}trigger(e,t,i){this._targetEditor.trigger(e,t,i)}createDecorationsCollection(e){return this._targetEditor.createDecorationsCollection(e)}changeDecorations(e){return this._targetEditor.changeDecorations(e)}};SN.idCounter=0;let yO=SN;const Mn={enableSplitViewResizing:!0,renderSideBySide:!0,renderMarginRevertIcon:!0,renderGutterMenu:!0,maxComputationTime:5e3,maxFileSize:50,ignoreTrimWhitespace:!0,renderIndicators:!0,originalEditable:!1,diffCodeLens:!1,renderOverviewRuler:!0,diffWordWrap:"inherit",diffAlgorithm:"advanced",accessibilityVerbose:!1,experimental:{showMoves:!1,showEmptyDecorations:!0,useTrueInlineView:!1},hideUnchangedRegions:{enabled:!1,contextLineCount:3,minimumLineCount:3,revealLineCount:20},isInEmbeddedEditor:!1,onlyShowAccessibleDiffViewer:!1,renderSideBySideInlineBreakpoint:900,useInlineViewWhenSpaceIsLimited:!0,compactMode:!1};var w1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},S1e=function(o,e){return function(t,i){e(t,i,o)}};let LO=class{get editorOptions(){return this._options}constructor(e,t){this._accessibilityService=t,this._diffEditorWidth=Le(this,0),this._screenReaderMode=rt(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this.couldShowInlineViewBecauseOfSize=j(this,n=>this._options.read(n).renderSideBySide&&this._diffEditorWidth.read(n)<=this._options.read(n).renderSideBySideInlineBreakpoint),this.renderOverviewRuler=j(this,n=>this._options.read(n).renderOverviewRuler),this.renderSideBySide=j(this,n=>this.compactMode.read(n)&&this.shouldRenderInlineViewInSmartMode.read(n)?!1:this._options.read(n).renderSideBySide&&!(this._options.read(n).useInlineViewWhenSpaceIsLimited&&this.couldShowInlineViewBecauseOfSize.read(n)&&!this._screenReaderMode.read(n))),this.readOnly=j(this,n=>this._options.read(n).readOnly),this.shouldRenderOldRevertArrows=j(this,n=>!(!this._options.read(n).renderMarginRevertIcon||!this.renderSideBySide.read(n)||this.readOnly.read(n)||this.shouldRenderGutterMenu.read(n))),this.shouldRenderGutterMenu=j(this,n=>this._options.read(n).renderGutterMenu),this.renderIndicators=j(this,n=>this._options.read(n).renderIndicators),this.enableSplitViewResizing=j(this,n=>this._options.read(n).enableSplitViewResizing),this.splitViewDefaultRatio=j(this,n=>this._options.read(n).splitViewDefaultRatio),this.ignoreTrimWhitespace=j(this,n=>this._options.read(n).ignoreTrimWhitespace),this.maxComputationTimeMs=j(this,n=>this._options.read(n).maxComputationTime),this.showMoves=j(this,n=>this._options.read(n).experimental.showMoves&&this.renderSideBySide.read(n)),this.isInEmbeddedEditor=j(this,n=>this._options.read(n).isInEmbeddedEditor),this.diffWordWrap=j(this,n=>this._options.read(n).diffWordWrap),this.originalEditable=j(this,n=>this._options.read(n).originalEditable),this.diffCodeLens=j(this,n=>this._options.read(n).diffCodeLens),this.accessibilityVerbose=j(this,n=>this._options.read(n).accessibilityVerbose),this.diffAlgorithm=j(this,n=>this._options.read(n).diffAlgorithm),this.showEmptyDecorations=j(this,n=>this._options.read(n).experimental.showEmptyDecorations),this.onlyShowAccessibleDiffViewer=j(this,n=>this._options.read(n).onlyShowAccessibleDiffViewer),this.compactMode=j(this,n=>this._options.read(n).compactMode),this.trueInlineDiffRenderingEnabled=j(this,n=>this._options.read(n).experimental.useTrueInlineView),this.useTrueInlineDiffRendering=j(this,n=>!this.renderSideBySide.read(n)&&this.trueInlineDiffRenderingEnabled.read(n)),this.hideUnchangedRegions=j(this,n=>this._options.read(n).hideUnchangedRegions.enabled),this.hideUnchangedRegionsRevealLineCount=j(this,n=>this._options.read(n).hideUnchangedRegions.revealLineCount),this.hideUnchangedRegionsContextLineCount=j(this,n=>this._options.read(n).hideUnchangedRegions.contextLineCount),this.hideUnchangedRegionsMinimumLineCount=j(this,n=>this._options.read(n).hideUnchangedRegions.minimumLineCount),this._model=Le(this,void 0),this.shouldRenderInlineViewInSmartMode=this._model.map(this,n=>Hne(this,s=>{const r=n?.diff.read(s);return r?y1e(r,this.trueInlineDiffRenderingEnabled.read(s)):void 0})).flatten().map(this,n=>!!n),this.inlineViewHideOriginalLineNumbers=this.compactMode;const i={...e,...nK(e,Mn)};this._options=Le(this,i)}updateOptions(e){const t=nK(e,this._options.get()),i={...this._options.get(),...e,...t};this._options.set(i,void 0,{changedOptions:e})}setWidth(e){this._diffEditorWidth.set(e,void 0)}setModel(e){this._model.set(e,void 0)}};LO=w1e([S1e(1,bn)],LO);function y1e(o,e){return o.mappings.every(t=>L1e(t.lineRangeMapping)||x1e(t.lineRangeMapping)||e&&mO(t.lineRangeMapping))}function L1e(o){return o.original.length===0}function x1e(o){return o.modified.length===0}function nK(o,e){return{enableSplitViewResizing:_e(o.enableSplitViewResizing,e.enableSplitViewResizing),splitViewDefaultRatio:Rre(o.splitViewDefaultRatio,.5,.1,.9),renderSideBySide:_e(o.renderSideBySide,e.renderSideBySide),renderMarginRevertIcon:_e(o.renderMarginRevertIcon,e.renderMarginRevertIcon),maxComputationTime:kf(o.maxComputationTime,e.maxComputationTime,0,1073741824),maxFileSize:kf(o.maxFileSize,e.maxFileSize,0,1073741824),ignoreTrimWhitespace:_e(o.ignoreTrimWhitespace,e.ignoreTrimWhitespace),renderIndicators:_e(o.renderIndicators,e.renderIndicators),originalEditable:_e(o.originalEditable,e.originalEditable),diffCodeLens:_e(o.diffCodeLens,e.diffCodeLens),renderOverviewRuler:_e(o.renderOverviewRuler,e.renderOverviewRuler),diffWordWrap:Ot(o.diffWordWrap,e.diffWordWrap,["off","on","inherit"]),diffAlgorithm:Ot(o.diffAlgorithm,e.diffAlgorithm,["legacy","advanced"],{smart:"legacy",experimental:"advanced"}),accessibilityVerbose:_e(o.accessibilityVerbose,e.accessibilityVerbose),experimental:{showMoves:_e(o.experimental?.showMoves,e.experimental.showMoves),showEmptyDecorations:_e(o.experimental?.showEmptyDecorations,e.experimental.showEmptyDecorations),useTrueInlineView:_e(o.experimental?.useTrueInlineView,e.experimental.useTrueInlineView)},hideUnchangedRegions:{enabled:_e(o.hideUnchangedRegions?.enabled??o.experimental?.collapseUnchangedRegions,e.hideUnchangedRegions.enabled),contextLineCount:kf(o.hideUnchangedRegions?.contextLineCount,e.hideUnchangedRegions.contextLineCount,0,1073741824),minimumLineCount:kf(o.hideUnchangedRegions?.minimumLineCount,e.hideUnchangedRegions.minimumLineCount,0,1073741824),revealLineCount:kf(o.hideUnchangedRegions?.revealLineCount,e.hideUnchangedRegions.revealLineCount,0,1073741824)},isInEmbeddedEditor:_e(o.isInEmbeddedEditor,e.isInEmbeddedEditor),onlyShowAccessibleDiffViewer:_e(o.onlyShowAccessibleDiffViewer,e.onlyShowAccessibleDiffViewer),renderSideBySideInlineBreakpoint:kf(o.renderSideBySideInlineBreakpoint,e.renderSideBySideInlineBreakpoint,0,1073741824),useInlineViewWhenSpaceIsLimited:_e(o.useInlineViewWhenSpaceIsLimited,e.useInlineViewWhenSpaceIsLimited),renderGutterMenu:_e(o.renderGutterMenu,e.renderGutterMenu),compactMode:_e(o.compactMode,e.compactMode)}}class k1e extends hf{constructor(e,t){super(),this._onDidChangeVisibility=this._register(new P),this.onDidChangeVisibility=this._onDidChangeVisibility.event,this._element=Z(e,Q(".monaco-dropdown")),this._label=Z(this._element,Q(".dropdown-label"));let i=t.labelRenderer;i||(i=s=>(s.textContent=t.label||"",null));for(const s of[te.CLICK,te.MOUSE_DOWN,Pt.Tap])this._register(W(this.element,s,r=>st.stop(r,!0)));for(const s of[te.MOUSE_DOWN,Pt.Tap])this._register(W(this._label,s,r=>{i2(r)&&r.button!==0||(this.visible?this.hide():this.show())}));this._register(W(this._label,te.KEY_DOWN,s=>{const r=new St(s);(r.equals(3)||r.equals(10))&&(st.stop(s,!0),this.visible?this.hide():this.show())}));const n=i(this._label);n&&this._register(n),this._register($n.addTarget(this._label))}get element(){return this._element}show(){this.visible||(this.visible=!0,this._onDidChangeVisibility.fire(!0))}hide(){this.visible&&(this.visible=!1,this._onDidChangeVisibility.fire(!1))}dispose(){super.dispose(),this.hide(),this.boxContainer&&(this.boxContainer.remove(),this.boxContainer=void 0),this.contents&&(this.contents.remove(),this.contents=void 0),this._label&&(this._label.remove(),this._label=void 0)}}class I1e extends k1e{constructor(e,t){super(e,t),this._options=t,this._actions=[],this.actions=t.actions||[]}set menuOptions(e){this._menuOptions=e}get menuOptions(){return this._menuOptions}get actions(){return this._options.actionProvider?this._options.actionProvider.getActions():this._actions}set actions(e){this._actions=e}show(){super.show(),this.element.classList.add("active"),this._options.contextMenuProvider.showContextMenu({getAnchor:()=>this.element,getActions:()=>this.actions,getActionsContext:()=>this.menuOptions?this.menuOptions.context:null,getActionViewItem:(e,t)=>this.menuOptions&&this.menuOptions.actionViewItemProvider?this.menuOptions.actionViewItemProvider(e,t):void 0,getKeyBinding:e=>this.menuOptions&&this.menuOptions.getKeyBinding?this.menuOptions.getKeyBinding(e):void 0,getMenuClassName:()=>this._options.menuClassName||"",onHide:()=>this.onHide(),actionRunner:this.menuOptions?this.menuOptions.actionRunner:void 0,anchorAlignment:this.menuOptions?this.menuOptions.anchorAlignment:0,domForShadowRoot:this._options.menuAsChild?this.element:void 0,skipTelemetry:this._options.skipTelemetry})}hide(){super.hide()}onHide(){this.hide(),this.element.classList.remove("active")}}class lk extends Fa{get onDidChangeVisibility(){return this._onDidChangeVisibility.event}constructor(e,t,i,n=Object.create(null)){super(null,e,n),this.actionItem=null,this._onDidChangeVisibility=this._register(new P),this.menuActionsOrProvider=t,this.contextMenuProvider=i,this.options=n,this.options.actionRunner&&(this.actionRunner=this.options.actionRunner)}render(e){this.actionItem=e;const t=s=>(this.element=Z(s,Q("a.action-label")),this.renderLabel(this.element)),i=Array.isArray(this.menuActionsOrProvider),n={contextMenuProvider:this.contextMenuProvider,labelRenderer:t,menuAsChild:this.options.menuAsChild,actions:i?this.menuActionsOrProvider:void 0,actionProvider:i?void 0:this.menuActionsOrProvider,skipTelemetry:this.options.skipTelemetry};if(this.dropdownMenu=this._register(new I1e(e,n)),this._register(this.dropdownMenu.onDidChangeVisibility(s=>{this.element?.setAttribute("aria-expanded",`${s}`),this._onDidChangeVisibility.fire(s)})),this.dropdownMenu.menuOptions={actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,getKeyBinding:this.options.keybindingProvider,context:this._context},this.options.anchorAlignmentProvider){const s=this;this.dropdownMenu.menuOptions={...this.dropdownMenu.menuOptions,get anchorAlignment(){return s.options.anchorAlignmentProvider()}}}this.updateTooltip(),this.updateEnabled()}renderLabel(e){let t=[];return typeof this.options.classNames=="string"?t=this.options.classNames.split(/\s+/g).filter(i=>!!i):this.options.classNames&&(t=this.options.classNames),t.find(i=>i==="icon")||t.push("codicon"),e.classList.add(...t),this._action.label&&this._register(ta().setupManagedHover(this.options.hoverDelegate??Zs("mouse"),e,this._action.label)),null}getTooltip(){let e=null;return this.action.tooltip?e=this.action.tooltip:this.action.label&&(e=this.action.label),e??void 0}setActionContext(e){super.setActionContext(e),this.dropdownMenu&&(this.dropdownMenu.menuOptions?this.dropdownMenu.menuOptions.context=e:this.dropdownMenu.menuOptions={context:e})}show(){this.dropdownMenu?.show()}updateEnabled(){const e=!this.action.enabled;this.actionItem?.classList.toggle("disabled",e),this.element?.classList.toggle("disabled",e)}}class D1e extends A{get onDidChangeDropdownVisibility(){return this._onDidChangeDropdownVisibility.event}constructor(e,t,i={orientation:0}){super(),this.submenuActionViewItems=[],this.hasSecondaryActions=!1,this._onDidChangeDropdownVisibility=this._register(new uie),this.disposables=this._register(new U),i.hoverDelegate=i.hoverDelegate??this._register(W_()),this.options=i,this.toggleMenuAction=this._register(new gw(()=>this.toggleMenuActionViewItem?.show(),i.toggleMenuTitle)),this.element=document.createElement("div"),this.element.className="monaco-toolbar",e.appendChild(this.element),this.actionBar=this._register(new Ys(this.element,{orientation:i.orientation,ariaLabel:i.ariaLabel,actionRunner:i.actionRunner,allowContextMenu:i.allowContextMenu,highlightToggledItems:i.highlightToggledItems,hoverDelegate:i.hoverDelegate,actionViewItemProvider:(n,s)=>{if(n.id===gw.ID)return this.toggleMenuActionViewItem=new lk(n,n.menuActions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:ve.asClassNameArray(i.moreIcon??Y.toolBarMore),anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,isMenu:!0,hoverDelegate:this.options.hoverDelegate}),this.toggleMenuActionViewItem.setActionContext(this.actionBar.context),this.disposables.add(this._onDidChangeDropdownVisibility.add(this.toggleMenuActionViewItem.onDidChangeVisibility)),this.toggleMenuActionViewItem;if(i.actionViewItemProvider){const r=i.actionViewItemProvider(n,s);if(r)return r}if(n instanceof Bm){const r=new lk(n,n.actions,t,{actionViewItemProvider:this.options.actionViewItemProvider,actionRunner:this.actionRunner,keybindingProvider:this.options.getKeyBinding,classNames:n.class,anchorAlignmentProvider:this.options.anchorAlignmentProvider,menuAsChild:!!this.options.renderDropdownAsChildElement,skipTelemetry:this.options.skipTelemetry,hoverDelegate:this.options.hoverDelegate});return r.setActionContext(this.actionBar.context),this.submenuActionViewItems.push(r),this.disposables.add(this._onDidChangeDropdownVisibility.add(r.onDidChangeVisibility)),r}}}))}set actionRunner(e){this.actionBar.actionRunner=e}get actionRunner(){return this.actionBar.actionRunner}set context(e){this.actionBar.context=e,this.toggleMenuActionViewItem?.setActionContext(e);for(const t of this.submenuActionViewItems)t.setActionContext(e)}getElement(){return this.element}getItemAction(e){return this.actionBar.getAction(e)}setActions(e,t){this.clear();const i=e?e.slice(0):[];this.hasSecondaryActions=!!(t&&t.length>0),this.hasSecondaryActions&&t&&(this.toggleMenuAction.menuActions=t.slice(0),i.push(this.toggleMenuAction)),i.forEach(n=>{this.actionBar.push(n,{icon:this.options.icon??!0,label:this.options.label??!1,keybinding:this.getKeybindingLabel(n)})})}getKeybindingLabel(e){return this.options.getKeyBinding?.(e)?.getLabel()??void 0}clear(){this.submenuActionViewItems=[],this.disposables.clear(),this.actionBar.clear()}dispose(){this.clear(),this.disposables.dispose(),super.dispose()}}const yN=class yN extends Mo{constructor(e,t){t=t||p(17,"More Actions..."),super(yN.ID,t,void 0,!0),this._menuActions=[],this.toggleDropdownMenu=e}async run(){this.toggleDropdownMenu()}get menuActions(){return this._menuActions}set menuActions(e){this._menuActions=e}};yN.ID="toolbar.toggle.more";let gw=yN;class ck{constructor(e,t,i=t){this.modifierLabels=[null],this.modifierLabels[2]=e,this.modifierLabels[1]=t,this.modifierLabels[3]=i}toLabel(e,t,i){if(t.length===0)return null;const n=[];for(let s=0,r=t.length;s<r;s++){const a=t[s],l=i(a);if(l===null)return null;n[s]=R1e(a,l,this.modifierLabels[e])}return n.join(" ")}}const xO=new ck({ctrlKey:"⌃",shiftKey:"⇧",altKey:"⌥",metaKey:"⌘",separator:""},{ctrlKey:p(35,"Ctrl"),shiftKey:p(36,"Shift"),altKey:p(37,"Alt"),metaKey:p(38,"Windows"),separator:"+"},{ctrlKey:p(39,"Ctrl"),shiftKey:p(40,"Shift"),altKey:p(41,"Alt"),metaKey:p(42,"Super"),separator:"+"}),E1e=new ck({ctrlKey:p(43,"Control"),shiftKey:p(44,"Shift"),altKey:p(45,"Option"),metaKey:p(46,"Command"),separator:"+"},{ctrlKey:p(47,"Control"),shiftKey:p(48,"Shift"),altKey:p(49,"Alt"),metaKey:p(50,"Windows"),separator:"+"},{ctrlKey:p(51,"Control"),shiftKey:p(52,"Shift"),altKey:p(53,"Alt"),metaKey:p(54,"Super"),separator:"+"}),N1e=new ck({ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Cmd",separator:"+"},{ctrlKey:"Ctrl",shiftKey:"Shift",altKey:"Alt",metaKey:"Super",separator:"+"}),T1e=new ck({ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"cmd",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"win",separator:"+"},{ctrlKey:"ctrl",shiftKey:"shift",altKey:"alt",metaKey:"meta",separator:"+"});function R1e(o,e,t){if(e===null)return"";const i=[];return o.ctrlKey&&i.push(t.ctrlKey),o.shiftKey&&i.push(t.shiftKey),o.altKey&&i.push(t.altKey),o.metaKey&&i.push(t.metaKey),e!==""&&i.push(e),i.join(t.separator)}function M1e(o){return o&&typeof o=="object"&&typeof o.original=="string"&&typeof o.value=="string"}function P1e(o){return o?o.condition!==void 0:!1}var Z_;(function(o){o[o.STORAGE_DOES_NOT_EXIST=0]="STORAGE_DOES_NOT_EXIST",o[o.STORAGE_IN_MEMORY=1]="STORAGE_IN_MEMORY"})(Z_||(Z_={}));var Cg;(function(o){o[o.None=0]="None",o[o.Initialized=1]="Initialized",o[o.Closed=2]="Closed"})(Cg||(Cg={}));const LN=class LN extends A{constructor(e,t=Object.create(null)){super(),this.database=e,this.options=t,this._onDidChangeStorage=this._register(new Qu),this.onDidChangeStorage=this._onDidChangeStorage.event,this.state=Cg.None,this.cache=new Map,this.flushDelayer=this._register(new GB(LN.DEFAULT_FLUSH_DELAY)),this.pendingDeletes=new Set,this.pendingInserts=new Map,this.pendingClose=void 0,this.whenFlushedCallbacks=[],this.registerListeners()}registerListeners(){this._register(this.database.onDidChangeItemsExternal(e=>this.onDidChangeItemsExternal(e)))}onDidChangeItemsExternal(e){this._onDidChangeStorage.pause();try{e.changed?.forEach((t,i)=>this.acceptExternal(i,t)),e.deleted?.forEach(t=>this.acceptExternal(t,void 0))}finally{this._onDidChangeStorage.resume()}}acceptExternal(e,t){if(this.state===Cg.Closed)return;let i=!1;hr(t)?i=this.cache.delete(e):this.cache.get(e)!==t&&(this.cache.set(e,t),i=!0),i&&this._onDidChangeStorage.fire({key:e,external:!0})}get(e,t){const i=this.cache.get(e);return hr(i)?t:i}getBoolean(e,t){const i=this.get(e);return hr(i)?t:i==="true"}getNumber(e,t){const i=this.get(e);return hr(i)?t:parseInt(i,10)}async set(e,t,i=!1){if(this.state===Cg.Closed)return;if(hr(t))return this.delete(e,i);const n=nn(t)||Array.isArray(t)?O_e(t):String(t);if(this.cache.get(e)!==n)return this.cache.set(e,n),this.pendingInserts.set(e,n),this.pendingDeletes.delete(e),this._onDidChangeStorage.fire({key:e,external:i}),this.doFlush()}async delete(e,t=!1){if(!(this.state===Cg.Closed||!this.cache.delete(e)))return this.pendingDeletes.has(e)||this.pendingDeletes.add(e),this.pendingInserts.delete(e),this._onDidChangeStorage.fire({key:e,external:t}),this.doFlush()}get hasPending(){return this.pendingInserts.size>0||this.pendingDeletes.size>0}async flushPending(){if(!this.hasPending)return;const e={insert:this.pendingInserts,delete:this.pendingDeletes};return this.pendingDeletes=new Set,this.pendingInserts=new Map,this.database.updateItems(e).finally(()=>{if(!this.hasPending)for(;this.whenFlushedCallbacks.length;)this.whenFlushedCallbacks.pop()?.()})}async flush(e){if(!(this.state===Cg.Closed||this.pendingClose))return this.doFlush(e)}async doFlush(e){return this.options.hint===Z_.STORAGE_IN_MEMORY?this.flushPending():this.flushDelayer.trigger(()=>this.flushPending(),e)}async whenFlushed(){if(this.hasPending)return new Promise(e=>this.whenFlushedCallbacks.push(e))}};LN.DEFAULT_FLUSH_DELAY=100;let pw=LN;class kO{constructor(){this.onDidChangeItemsExternal=ie.None,this.items=new Map}async updateItems(e){e.insert?.forEach((t,i)=>this.items.set(i,t)),e.delete?.forEach(t=>this.items.delete(t))}}const dk="__$__targetStorageMarker",Es=We("storageService");var zh;(function(o){o[o.NONE=0]="NONE",o[o.SHUTDOWN=1]="SHUTDOWN"})(zh||(zh={}));function A1e(o){const e=o.get(dk);if(e)try{return JSON.parse(e)}catch{}return Object.create(null)}const xN=class xN extends A{constructor(e={flushInterval:xN.DEFAULT_FLUSH_INTERVAL}){super(),this._onDidChangeValue=this._register(new Qu),this._onDidChangeTarget=this._register(new Qu),this._onWillSaveState=this._register(new P),this.onWillSaveState=this._onWillSaveState.event,this.runFlushWhenIdle=this._register(new ct),this._workspaceKeyTargets=void 0,this._profileKeyTargets=void 0,this._applicationKeyTargets=void 0,this.flushWhenIdleScheduler=this._register(new wt(()=>this.doFlushWhenIdle(),e.flushInterval))}onDidChangeValue(e,t,i){return ie.filter(this._onDidChangeValue.event,n=>n.scope===e&&(t===void 0||n.key===t),i)}doFlushWhenIdle(){this.runFlushWhenIdle.value=fR(()=>{this.shouldFlushWhenIdle()&&this.flush(),this.flushWhenIdleScheduler.schedule()})}shouldFlushWhenIdle(){return!0}emitDidChangeValue(e,t){const{key:i,external:n}=t;if(i===dk){switch(e){case-1:this._applicationKeyTargets=void 0;break;case 0:this._profileKeyTargets=void 0;break;case 1:this._workspaceKeyTargets=void 0;break}this._onDidChangeTarget.fire({scope:e})}else this._onDidChangeValue.fire({scope:e,key:i,target:this.getKeyTargets(e)[i],external:n})}get(e,t,i){return this.getStorage(t)?.get(e,i)}getBoolean(e,t,i){return this.getStorage(t)?.getBoolean(e,i)}getNumber(e,t,i){return this.getStorage(t)?.getNumber(e,i)}store(e,t,i,n,s=!1){if(hr(t)){this.remove(e,i,s);return}this.withPausedEmitters(()=>{this.updateKeyTarget(e,i,n),this.getStorage(i)?.set(e,t,s)})}remove(e,t,i=!1){this.withPausedEmitters(()=>{this.updateKeyTarget(e,t,void 0),this.getStorage(t)?.delete(e,i)})}withPausedEmitters(e){this._onDidChangeValue.pause(),this._onDidChangeTarget.pause();try{e()}finally{this._onDidChangeValue.resume(),this._onDidChangeTarget.resume()}}updateKeyTarget(e,t,i,n=!1){const s=this.getKeyTargets(t);typeof i=="number"?s[e]!==i&&(s[e]=i,this.getStorage(t)?.set(dk,JSON.stringify(s),n)):typeof s[e]=="number"&&(delete s[e],this.getStorage(t)?.set(dk,JSON.stringify(s),n))}get workspaceKeyTargets(){return this._workspaceKeyTargets||(this._workspaceKeyTargets=this.loadKeyTargets(1)),this._workspaceKeyTargets}get profileKeyTargets(){return this._profileKeyTargets||(this._profileKeyTargets=this.loadKeyTargets(0)),this._profileKeyTargets}get applicationKeyTargets(){return this._applicationKeyTargets||(this._applicationKeyTargets=this.loadKeyTargets(-1)),this._applicationKeyTargets}getKeyTargets(e){switch(e){case-1:return this.applicationKeyTargets;case 0:return this.profileKeyTargets;default:return this.workspaceKeyTargets}}loadKeyTargets(e){const t=this.getStorage(e);return t?A1e(t):Object.create(null)}async flush(e=zh.NONE){this._onWillSaveState.fire({reason:e});const t=this.getStorage(-1),i=this.getStorage(0),n=this.getStorage(1);switch(e){case zh.NONE:await o1.settled([t?.whenFlushed()??Promise.resolve(),i?.whenFlushed()??Promise.resolve(),n?.whenFlushed()??Promise.resolve()]);break;case zh.SHUTDOWN:await o1.settled([t?.flush(0)??Promise.resolve(),i?.flush(0)??Promise.resolve(),n?.flush(0)??Promise.resolve()]);break}}};xN.DEFAULT_FLUSH_INTERVAL=60*1e3;let IO=xN;class O1e extends IO{constructor(){super(),this.applicationStorage=this._register(new pw(new kO,{hint:Z_.STORAGE_IN_MEMORY})),this.profileStorage=this._register(new pw(new kO,{hint:Z_.STORAGE_IN_MEMORY})),this.workspaceStorage=this._register(new pw(new kO,{hint:Z_.STORAGE_IN_MEMORY})),this._register(this.workspaceStorage.onDidChangeStorage(e=>this.emitDidChangeValue(1,e))),this._register(this.profileStorage.onDidChangeStorage(e=>this.emitDidChangeValue(0,e))),this._register(this.applicationStorage.onDidChangeStorage(e=>this.emitDidChangeValue(-1,e)))}getStorage(e){switch(e){case-1:return this.applicationStorage;case 0:return this.profileStorage;default:return this.workspaceStorage}}shouldFlushWhenIdle(){return!1}}function F1e(o,e){const t={...e};for(const i in o){const n=o[i];t[i]=n!==void 0?J(n):void 0}return t}const sK={keybindingLabelBackground:J(Ule),keybindingLabelForeground:J($le),keybindingLabelBorder:J(jle),keybindingLabelBottomBorder:J(qle),keybindingLabelShadow:J(a_)},W1e={buttonForeground:J(NL),buttonSeparator:J(Nle),buttonBackground:J(Ef),buttonHoverBackground:J(Tle),buttonSecondaryForeground:J(ez),buttonSecondaryBackground:J(TL),buttonSecondaryHoverBackground:J(Mle),buttonBorder:J(Rle)},B1e={progressBarBackground:J(qae)},hk={inputActiveOptionBorder:J(IL),inputActiveOptionForeground:J(DL),inputActiveOptionBackground:J(U1)};J($1),J(Ple),J(Ale),J(Ole),J(Fle),J(Wle),J(Ble);const DO={checkboxBackground:J(bM),checkboxBorder:J(Hle),checkboxForeground:J(CM),checkboxDisabledBackground:J(Vle),checkboxDisabledForeground:J(zle)};J(Ho),J(SL),J(a_),J(lM),J(hle),J(ule),J(fle),J($ae);const uk={inputBackground:J(pM),inputForeground:J(QV),inputBorder:J(JV),inputValidationInfoBorder:J(Sle),inputValidationInfoBackground:J(vle),inputValidationInfoForeground:J(wle),inputValidationWarningBorder:J(xle),inputValidationWarningBackground:J(yle),inputValidationWarningForeground:J(Lle),inputValidationErrorBorder:J(Dle),inputValidationErrorBackground:J(kle),inputValidationErrorForeground:J(Ile)},H1e={listFilterWidgetBackground:J(oce),listFilterWidgetOutline:J(rce),listFilterWidgetNoMatchesOutline:J(ace),listFilterWidgetShadow:J(lce),inputBoxStyles:uk,toggleStyles:hk},oK={badgeBackground:J(vL),badgeForeground:J(jae),badgeBorder:J(Ze)};J(cle),J(lle),J(jV),J(jV),J(dle);const Y_={listBackground:void 0,listInactiveFocusForeground:void 0,listFocusBackground:J(Kle),listFocusForeground:J(Gle),listFocusOutline:J(Zle),listActiveSelectionBackground:J(Nf),listActiveSelectionForeground:J(j1),listActiveSelectionIconForeground:J(tz),listFocusAndSelectionOutline:J(Yle),listFocusAndSelectionBackground:J(Nf),listFocusAndSelectionForeground:J(j1),listInactiveSelectionBackground:J(Xle),listInactiveSelectionIconForeground:J(Jle),listInactiveSelectionForeground:J(Qle),listInactiveFocusBackground:J(ece),listInactiveFocusOutline:J(tce),listHoverBackground:J(iz),listHoverForeground:J(nz),listDropOverBackground:J(ice),listDropBetweenBackground:J(nce),listSelectionOutline:J(jt),listHoverOutline:J(jt),treeIndentGuidesStroke:J(sz),treeInactiveIndentGuidesStroke:J(cce),treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:J(wL),tableColumnsBorder:J(dce),tableOddRowsBackgroundColor:J(hce)};function vg(o){return F1e(o,Y_)}const V1e={selectBackground:J(EL),selectListBackground:J(Ele),selectForeground:J(mM),decoratorRightForeground:J(oz),selectBorder:J(_M),focusBorder:J(_l),listFocusBackground:J(K1),listInactiveSelectionIconForeground:J(wM),listFocusForeground:J(q1),listFocusOutline:RV(jt,$.transparent.toString()),listHoverBackground:J(iz),listHoverForeground:J(nz),listHoverOutline:J(jt),selectListBorder:J(tM),listBackground:void 0,listActiveSelectionBackground:void 0,listActiveSelectionForeground:void 0,listActiveSelectionIconForeground:void 0,listFocusAndSelectionBackground:void 0,listDropOverBackground:void 0,listDropBetweenBackground:void 0,listInactiveSelectionBackground:void 0,listInactiveSelectionForeground:void 0,listInactiveFocusBackground:void 0,listInactiveFocusOutline:void 0,listSelectionOutline:void 0,listFocusAndSelectionForeground:void 0,listFocusAndSelectionOutline:void 0,listInactiveFocusForeground:void 0,tableColumnsBorder:void 0,tableOddRowsBackgroundColor:void 0,treeIndentGuidesStroke:void 0,treeInactiveIndentGuidesStroke:void 0,treeStickyScrollBackground:void 0,treeStickyScrollBorder:void 0,treeStickyScrollShadow:void 0},z1e={shadowColor:J(a_),borderColor:J(fce),foregroundColor:J(gce),backgroundColor:J(pce),selectionForegroundColor:J(mce),selectionBackgroundColor:J(_ce),selectionBorderColor:J(bce),separatorColor:J(Cce),scrollbarShadow:J(wL),scrollbarSliderBackground:J(BV),scrollbarSliderHoverBackground:J(HV),scrollbarSliderActiveBackground:J(VV)};function U1e(o,e){if(ol)return!1;const t=$1e(o,e),i=o.getValue("window");return i?.menuStyle==="native"?!(!ze&&!t):i?.menuStyle==="custom"?!1:t}function $1e(o,e){return e||(e=rK(o)),e==="native"}function rK(o){if(ol)return"custom";const e=o.getValue("window");if(e){if(ze&&e.nativeTabs===!0||ze&&e.nativeFullScreen===!1)return"native";const n=e.titleBarStyle;if(n==="native"||n==="custom")return n}return"custom"}function j1e(o){if(ol||ze||rK(o)==="native")return"native";const t=o.getValue("window")?.controlsStyle;return t==="custom"||t==="hidden"?t:"native"}var fk=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ns=function(o,e){return function(t,i){e(t,i,o)}};function q1e(o,e){const t=[];return K1e(o,t),t}function K1e(o,e,t){const i=Pc.getInstance(),n=i.keyStatus.altKey||(gn||Ws)&&i.keyStatus.shiftKey;cK(o,e,n,s=>s==="navigation")}function aK(o,e,t,i){const n={primary:[],secondary:[]};return lK(o,n,e,t,i),n}function G1e(o,e,t,i){const n=[];return lK(o,n,e,t,i),n}function lK(o,e,t,i,n){cK(o,e,!1,typeof t=="string"?r=>r===t:t,i,n)}function cK(o,e,t,i=r=>r==="navigation",n=()=>!1,s=!1){let r,a;Array.isArray(e)?(r=e,a=e):(r=e.primary,a=e.secondary);const l=new Set;for(const[c,d]of o){let h;i(c)?(h=r,h.length>0&&s&&h.push(new Xi)):(h=a,h.length>0&&h.push(new Xi));for(let u of d){t&&(u=u instanceof Po&&u.alt?u.alt:u);const f=h.push(u);u instanceof Bm&&l.add({group:c,action:u,index:f-1})}}for(const{group:c,action:d,index:h}of l){const u=i(c)?r:a,f=d.actions;n(d,c,u.length)&&u.splice(h,1,...f)}}let Uh=class extends z_{constructor(e,t,i,n,s,r,a,l){super(void 0,e,{icon:!!(e.class||e.item.icon),label:!e.class&&!e.item.icon,draggable:t?.draggable,keybinding:t?.keybinding,hoverDelegate:t?.hoverDelegate,keybindingNotRenderedWithLabel:t?.keybindingNotRenderedWithLabel}),this._options=t,this._keybindingService=i,this._notificationService=n,this._contextKeyService=s,this._themeService=r,this._contextMenuService=a,this._accessibilityService=l,this._wantsAltCommand=!1,this._itemClassDispose=this._register(new ct),this._altKey=Pc.getInstance()}get _menuItemAction(){return this._action}get _commandAction(){return this._wantsAltCommand&&this._menuItemAction.alt||this._menuItemAction}async onClick(e){e.preventDefault(),e.stopPropagation();try{await this.actionRunner.run(this._commandAction,this._context)}catch(t){this._notificationService.error(t)}}render(e){if(super.render(e),e.classList.add("menu-entry"),this.options.icon&&this._updateItemClass(this._menuItemAction.item),this._menuItemAction.alt){let t=!1;const i=()=>{const n=!!this._menuItemAction.alt?.enabled&&(!this._accessibilityService.isMotionReduced()||t)&&(this._altKey.keyStatus.altKey||this._altKey.keyStatus.shiftKey&&t);n!==this._wantsAltCommand&&(this._wantsAltCommand=n,this.updateLabel(),this.updateTooltip(),this.updateClass())};this._register(this._altKey.event(i)),this._register(W(e,"mouseleave",n=>{t=!1,i()})),this._register(W(e,"mouseenter",n=>{t=!0,i()})),i()}}updateLabel(){this.options.label&&this.label&&(this.label.textContent=this._commandAction.label)}getTooltip(){const e=this._keybindingService.lookupKeybinding(this._commandAction.id,this._contextKeyService),t=e&&e.getLabel(),i=this._commandAction.tooltip||this._commandAction.label;let n=t?p(1629,"{0} ({1})",i,t):i;if(!this._wantsAltCommand&&this._menuItemAction.alt?.enabled){const s=this._menuItemAction.alt.tooltip||this._menuItemAction.alt.label,r=this._keybindingService.lookupKeybinding(this._menuItemAction.alt.id,this._contextKeyService),a=r&&r.getLabel(),l=a?p(1630,"{0} ({1})",s,a):s;n=p(1631,`{0}
[{1}] {2}`,n,xO.modifierLabels[so].altKey,l)}return n}updateClass(){this.options.icon&&(this._commandAction!==this._menuItemAction?this._menuItemAction.alt&&this._updateItemClass(this._menuItemAction.alt.item):this._updateItemClass(this._menuItemAction.item))}_updateItemClass(e){this._itemClassDispose.value=void 0;const{element:t,label:i}=this;if(!t||!i)return;const n=this._commandAction.checked&&P1e(e.toggled)&&e.toggled.icon?e.toggled.icon:e.icon;if(n)if(ve.isThemeIcon(n)){const s=ve.asClassNameArray(n);i.classList.add(...s),this._itemClassDispose.value=ue(()=>{i.classList.remove(...s)})}else i.style.backgroundImage=Rf(this._themeService.getColorTheme().type)?Nl(n.dark):Nl(n.light),i.classList.add("icon"),this._itemClassDispose.value=jr(ue(()=>{i.style.backgroundImage="",i.classList.remove("icon")}),this._themeService.onDidColorThemeChange(()=>{this.updateClass()}))}};Uh=fk([Ns(2,ot),Ns(3,hi),Ns(4,xe),Ns(5,li),Ns(6,Ko),Ns(7,bn)],Uh);class EO extends Uh{render(e){this.options.label=!0,this.options.icon=!1,super.render(e),e.classList.add("text-only"),e.classList.toggle("use-comma",this._options?.useComma??!1)}updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService);if(!e)return super.updateLabel();if(this.label){const t=EO._symbolPrintEnter(e);this._options?.conversational?this.label.textContent=p(1632,"{1} to {0}",this._action.label,t):this.label.textContent=p(1633,"{0} ({1})",this._action.label,t)}}static _symbolPrintEnter(e){return e.getLabel()?.replace(/\benter\b/gi,"⏎").replace(/\bEscape\b/gi,"Esc")}}let NO=class extends lk{constructor(e,t,i,n,s){const r={...t,menuAsChild:t?.menuAsChild??!1,classNames:t?.classNames??(ve.isThemeIcon(e.item.icon)?ve.asClassName(e.item.icon):void 0),keybindingProvider:t?.keybindingProvider??(a=>i.lookupKeybinding(a.id))};super(e,{getActions:()=>e.actions},n,r),this._keybindingService=i,this._contextMenuService=n,this._themeService=s}render(e){super.render(e),it(this.element),e.classList.add("menu-entry");const t=this._action,{icon:i}=t.item;if(i&&!ve.isThemeIcon(i)){this.element.classList.add("icon");const n=()=>{this.element&&(this.element.style.backgroundImage=Rf(this._themeService.getColorTheme().type)?Nl(i.dark):Nl(i.light))};n(),this._register(this._themeService.onDidColorThemeChange(()=>{n()}))}}};NO=fk([Ns(2,ot),Ns(3,Ko),Ns(4,li)],NO);let TO=class extends Fa{constructor(e,t,i,n,s,r,a,l){super(null,e),this._keybindingService=i,this._notificationService=n,this._contextMenuService=s,this._menuService=r,this._instaService=a,this._storageService=l,this._defaultActionDisposables=this._register(new U),this._container=null,this._options=t,this._storageKey=`${e.item.submenu.id}_lastActionId`;let c;const d=t?.persistLastActionId?l.get(this._storageKey,1):void 0;d&&(c=e.actions.find(u=>d===u.id)),c||(c=e.actions[0]),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(Uh,c,{keybinding:this._getDefaultActionKeybindingLabel(c)}));const h={keybindingProvider:u=>this._keybindingService.lookupKeybinding(u.id),...t,menuAsChild:t?.menuAsChild??!0,classNames:t?.classNames??["codicon","codicon-chevron-down"],actionRunner:t?.actionRunner??this._register(new hf)};this._dropdown=this._register(new lk(e,e.actions,this._contextMenuService,h)),this._register(this._dropdown.actionRunner.onDidRun(u=>{u.action instanceof Po&&this.update(u.action)}))}update(e){this._options?.persistLastActionId&&this._storageService.store(this._storageKey,e.id,1,1),this._defaultActionDisposables.clear(),this._defaultAction=this._defaultActionDisposables.add(this._instaService.createInstance(Uh,e,{keybinding:this._getDefaultActionKeybindingLabel(e)})),this._defaultAction.actionRunner=this._defaultActionDisposables.add(new class extends hf{async runAction(t,i){await t.run(void 0)}}),this._container&&this._defaultAction.render(Dy(this._container,Q(".action-container")))}_getDefaultActionKeybindingLabel(e){let t;if(this._options?.renderKeybindingWithDefaultActionLabel){const i=this._keybindingService.lookupKeybinding(e.id);i&&(t=`(${i.getLabel()})`)}return t}setActionContext(e){super.setActionContext(e),this._defaultAction.setActionContext(e),this._dropdown.setActionContext(e)}render(e){this._container=e,super.render(this._container),this._container.classList.add("monaco-dropdown-with-default");const t=Q(".action-container");this._defaultAction.render(Z(this._container,t)),this._register(W(t,te.KEY_DOWN,n=>{const s=new St(n);s.equals(17)&&(this._defaultAction.element.tabIndex=-1,this._dropdown.focus(),s.stopPropagation())}));const i=Q(".dropdown-action-container");this._dropdown.render(Z(this._container,i)),this._register(W(i,te.KEY_DOWN,n=>{const s=new St(n);s.equals(15)&&(this._defaultAction.element.tabIndex=0,this._dropdown.setFocusable(!1),this._defaultAction.element?.focus(),s.stopPropagation())}))}focus(e){e?this._dropdown.focus():(this._defaultAction.element.tabIndex=0,this._defaultAction.element.focus())}blur(){this._defaultAction.element.tabIndex=-1,this._dropdown.blur(),this._container.blur()}setFocusable(e){e?this._defaultAction.element.tabIndex=0:(this._defaultAction.element.tabIndex=-1,this._dropdown.setFocusable(!1))}};TO=fk([Ns(2,ot),Ns(3,hi),Ns(4,Ko),Ns(5,Cr),Ns(6,ge),Ns(7,Es)],TO);let RO=class extends uCe{constructor(e,t,i){super(null,e,e.actions.map(n=>({text:n.id===Xi.ID?"─────────":n.label,isDisabled:!n.enabled})),0,t,V1e,{ariaLabel:e.tooltip,optionsAsChildren:!0,useCustomDrawn:!U1e(i)}),this.select(Math.max(0,e.actions.findIndex(n=>n.checked)))}render(e){super.render(e),e.style.borderColor=J(_M)}runAction(e,t){const i=this.action.actions[t];i&&this.actionRunner.run(i)}};RO=fk([Ns(1,hd),Ns(2,Me)],RO);function MO(o,e,t){return e instanceof Po?o.createInstance(Uh,e,t):e instanceof bf?e.item.isSelection?o.createInstance(RO,e):e.item.rememberDefaultAction?o.createInstance(TO,e,{...t,persistLastActionId:!0}):o.createInstance(NO,e,t):void 0}var gk=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Wl=function(o,e){return function(t,i){e(t,i,o)}},X_,mw;let PO=class{constructor(e,t,i){this._commandService=e,this._keybindingService=t,this._hiddenStates=new AO(i)}createMenu(e,t,i){return new pk(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t)}getMenuActions(e,t,i){const n=new pk(e,this._hiddenStates,{emitEventsForSubmenuChanges:!1,eventDebounceDelay:50,...i},this._commandService,this._keybindingService,t),s=n.getActions(i);return n.dispose(),s}resetHiddenStates(e){this._hiddenStates.reset(e)}};PO=gk([Wl(0,Tt),Wl(1,ot),Wl(2,Es)],PO);let AO=(Dp=class{constructor(e){this._storageService=e,this._disposables=new U,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._ignoreChangeEvent=!1,this._hiddenByDefaultCache=new Map;try{const t=e.get(X_._key,0,"{}");this._data=JSON.parse(t)}catch{this._data=Object.create(null)}this._disposables.add(e.onDidChangeValue(0,X_._key,this._disposables)(()=>{if(!this._ignoreChangeEvent)try{const t=e.get(X_._key,0,"{}");this._data=JSON.parse(t)}catch(t){console.log("FAILED to read storage after UPDATE",t)}this._onDidChange.fire()}))}dispose(){this._onDidChange.dispose(),this._disposables.dispose()}_isHiddenByDefault(e,t){return this._hiddenByDefaultCache.get(`${e.id}/${t}`)??!1}setDefaultState(e,t,i){this._hiddenByDefaultCache.set(`${e.id}/${t}`,i)}isHidden(e,t){const i=this._isHiddenByDefault(e,t),n=this._data[e.id]?.includes(t)??!1;return i?!n:n}updateHidden(e,t,i){this._isHiddenByDefault(e,t)&&(i=!i);const s=this._data[e.id];if(i)s?s.indexOf(t)<0&&s.push(t):this._data[e.id]=[t];else if(s){const r=s.indexOf(t);r>=0&&_ne(s,r),s.length===0&&delete this._data[e.id]}this._persist()}reset(e){if(e===void 0)this._data=Object.create(null),this._persist();else{for(const{id:t}of e)this._data[t]&&delete this._data[t];this._persist()}}_persist(){try{this._ignoreChangeEvent=!0;const e=JSON.stringify(this._data);this._storageService.store(X_._key,e,0,0)}finally{this._ignoreChangeEvent=!1}}},X_=Dp,Dp._key="menu.hiddenCommands",Dp);AO=X_=gk([Wl(0,Es)],AO);class _w{constructor(e,t){this._id=e,this._collectContextKeysForSubmenus=t,this._menuGroups=[],this._allMenuIds=new Set,this._structureContextKeys=new Set,this._preconditionContextKeys=new Set,this._toggledContextKeys=new Set,this.refresh()}get allMenuIds(){return this._allMenuIds}get structureContextKeys(){return this._structureContextKeys}get preconditionContextKeys(){return this._preconditionContextKeys}get toggledContextKeys(){return this._toggledContextKeys}refresh(){this._menuGroups.length=0,this._allMenuIds.clear(),this._structureContextKeys.clear(),this._preconditionContextKeys.clear(),this._toggledContextKeys.clear();const e=this._sort(an.getMenuItems(this._id));let t;for(const i of e){const n=i.group||"";(!t||t[0]!==n)&&(t=[n,[]],this._menuGroups.push(t)),t[1].push(i),this._collectContextKeysAndSubmenuIds(i)}this._allMenuIds.add(this._id)}_sort(e){return e}_collectContextKeysAndSubmenuIds(e){if(_w._fillInKbExprKeys(e.when,this._structureContextKeys),Vm(e)){if(e.command.precondition&&_w._fillInKbExprKeys(e.command.precondition,this._preconditionContextKeys),e.command.toggled){const t=e.command.toggled.condition||e.command.toggled;_w._fillInKbExprKeys(t,this._toggledContextKeys)}}else this._collectContextKeysForSubmenus&&(an.getMenuItems(e.submenu).forEach(this._collectContextKeysAndSubmenuIds,this),this._allMenuIds.add(e.submenu))}static _fillInKbExprKeys(e,t){if(e)for(const i of e.keys())t.add(i)}}let OO=mw=class extends _w{constructor(e,t,i,n,s,r){super(e,i),this._hiddenStates=t,this._commandService=n,this._keybindingService=s,this._contextKeyService=r,this.refresh()}createActionGroups(e){const t=[];for(const i of this._menuGroups){const[n,s]=i;let r;for(const a of s)if(this._contextKeyService.contextMatchesRules(a.when)){const l=Vm(a);l&&this._hiddenStates.setDefaultState(this._id,a.command.id,!!a.isHiddenByDefault);const c=Z1e(this._id,l?a.command:a,this._hiddenStates);if(l){const d=dK(this._commandService,this._keybindingService,a.command.id,a.when);(r??=[]).push(new Po(a.command,a.alt,e,c,d,this._contextKeyService,this._commandService))}else{const d=new mw(a.submenu,this._hiddenStates,this._collectContextKeysForSubmenus,this._commandService,this._keybindingService,this._contextKeyService).createActionGroups(e),h=Xi.join(...d.map(u=>u[1]));h.length>0&&(r??=[]).push(new bf(a,c,h))}}r&&r.length>0&&t.push([n,r])}return t}_sort(e){return e.sort(mw._compareMenuItems)}static _compareMenuItems(e,t){const i=e.group,n=t.group;if(i!==n){if(i){if(!n)return-1}else return 1;if(i==="navigation")return-1;if(n==="navigation")return 1;const a=i.localeCompare(n);if(a!==0)return a}const s=e.order||0,r=t.order||0;return s<r?-1:s>r?1:mw._compareTitles(Vm(e)?e.command.title:e.title,Vm(t)?t.command.title:t.title)}static _compareTitles(e,t){const i=typeof e=="string"?e:e.original,n=typeof t=="string"?t:t.original;return i.localeCompare(n)}};OO=mw=gk([Wl(3,Tt),Wl(4,ot),Wl(5,xe)],OO);let pk=class{constructor(e,t,i,n,s,r){this._disposables=new U,this._menuInfo=new OO(e,t,i.emitEventsForSubmenuChanges,n,s,r);const a=new wt(()=>{this._menuInfo.refresh(),this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!0,isToggleChange:!0})},i.eventDebounceDelay);this._disposables.add(a),this._disposables.add(an.onDidChangeMenu(h=>{for(const u of this._menuInfo.allMenuIds)if(h.has(u)){a.schedule();break}}));const l=this._disposables.add(new U),c=h=>{let u=!1,f=!1,g=!1;for(const m of h)if(u=u||m.isStructuralChange,f=f||m.isEnablementChange,g=g||m.isToggleChange,u&&f&&g)break;return{menu:this,isStructuralChange:u,isEnablementChange:f,isToggleChange:g}},d=()=>{l.add(r.onDidChangeContext(h=>{const u=h.affectsSome(this._menuInfo.structureContextKeys),f=h.affectsSome(this._menuInfo.preconditionContextKeys),g=h.affectsSome(this._menuInfo.toggledContextKeys);(u||f||g)&&this._onDidChange.fire({menu:this,isStructuralChange:u,isEnablementChange:f,isToggleChange:g})})),l.add(t.onDidChange(h=>{this._onDidChange.fire({menu:this,isStructuralChange:!0,isEnablementChange:!1,isToggleChange:!1})}))};this._onDidChange=new jB({onWillAddFirstListener:d,onDidRemoveLastListener:l.clear.bind(l),delay:i.eventDebounceDelay,merge:c}),this.onDidChange=this._onDidChange.event}getActions(e){return this._menuInfo.createActionGroups(e)}dispose(){this._disposables.dispose(),this._onDidChange.dispose()}};pk=gk([Wl(3,Tt),Wl(4,ot),Wl(5,xe)],pk);function Z1e(o,e,t){const i=Fse(e)?e.submenu.id:e.id,n=typeof e.title=="string"?e.title:e.title.value,s=uf({id:`hide/${o.id}/${i}`,label:p(1636,"Hide '{0}'",n),run(){t.updateHidden(o,i,!0)}}),r=uf({id:`toggle/${o.id}/${i}`,label:n,get checked(){return!t.isHidden(o,i)},run(){t.updateHidden(o,i,!!this.checked)}});return{hide:s,toggle:r,get isHidden(){return!r.checked}}}function dK(o,e,t,i=void 0,n=!0){return uf({id:`configureKeybinding/${t}`,label:p(1637,"Configure Keybinding"),enabled:n,run(){const r=!!!e.lookupKeybinding(t)&&i?i.serialize():void 0;o.executeCommand("workbench.action.openGlobalKeybindings",`@command:${t}`+(r?` +when:${r}`:""))}})}const hK=We("IActionViewItemService");class Y1e{constructor(){this._providers=new Map,this._onDidChange=new P,this.onDidChange=this._onDidChange.event}dispose(){this._onDidChange.dispose()}lookUp(e,t){return this._providers.get(this._makeKey(e,t))}_makeKey(e,t){return`${e.id}/${t instanceof de?t.id:t}`}}je(hK,Y1e,1);var uK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Go=function(o,e){return function(t,i){e(t,i,o)}};let mk=class extends D1e{constructor(e,t,i,n,s,r,a,l){super(e,s,{getKeyBinding:d=>r.lookupKeybinding(d.id)??void 0,...t,allowContextMenu:!0,skipTelemetry:typeof t?.telemetrySource=="string"}),this._options=t,this._menuService=i,this._contextKeyService=n,this._contextMenuService=s,this._keybindingService=r,this._commandService=a,this._sessionDisposables=this._store.add(new U);const c=t?.telemetrySource;c&&this._store.add(this.actionBar.onDidRun(d=>l.publicLog2("workbenchActionExecuted",{id:d.action.id,from:c})))}setActions(e,t=[],i){this._sessionDisposables.clear();const n=e.slice(),s=t.slice(),r=[];let a=0;const l=[];let c=!1;if(this._options?.hiddenItemStrategy!==-1)for(let d=0;d<n.length;d++){const h=n[d];!(h instanceof Po)&&!(h instanceof bf)||h.hideActions&&(r.push(h.hideActions.toggle),h.hideActions.toggle.checked&&a++,h.hideActions.isHidden&&(c=!0,n[d]=void 0,this._options?.hiddenItemStrategy!==0&&(l[d]=h)))}if(this._options?.overflowBehavior!==void 0){const d=L$(new Set(this._options.overflowBehavior.exempted),Ye.map(n,f=>f?.id)),h=this._options.overflowBehavior.maxItems-d.size;let u=0;for(let f=0;f<n.length;f++){const g=n[f];g&&(u++,!d.has(g.id)&&u>=h&&(n[f]=void 0,l[f]=g))}}D6(n),D6(l),super.setActions(n,Xi.join(l,s)),(r.length>0||n.length>0)&&this._sessionDisposables.add(W(this.getElement(),"contextmenu",d=>{const h=new yn(me(this.getElement()),d),u=this.getItemAction(h.target);if(!u)return;h.preventDefault(),h.stopPropagation();const f=[];if(u instanceof Po&&u.menuKeybinding)f.push(u.menuKeybinding);else if(!(u instanceof bf||u instanceof gw)){const m=!!this._keybindingService.lookupKeybinding(u.id);f.push(dK(this._commandService,this._keybindingService,u.id,void 0,m))}if(r.length>0){let m=!1;if(a===1&&this._options?.hiddenItemStrategy===0){m=!0;for(let _=0;_<r.length;_++)if(r[_].checked){r[_]=uf({id:u.id,label:u.label,checked:!0,enabled:!1,run(){}});break}}if(!m&&(u instanceof Po||u instanceof bf)){if(!u.hideActions)return;f.push(u.hideActions.hide)}else f.push(uf({id:"label",label:p(1634,"Hide"),enabled:!1,run(){}}))}const g=Xi.join(f,r);this._options?.resetMenu&&!i&&(i=[this._options.resetMenu]),c&&i&&(g.push(new Xi),g.push(uf({id:"resetThisMenu",label:p(1635,"Reset Menu"),run:()=>this._menuService.resetHiddenStates(i)}))),g.length!==0&&this._contextMenuService.showContextMenu({getAnchor:()=>h,getActions:()=>g,menuId:this._options?.contextMenu,menuActionOptions:{renderShortTitle:!0,...this._options?.menuOptions},skipTelemetry:typeof this._options?.telemetrySource=="string",contextKeyService:this._contextKeyService})}))}};mk=uK([Go(2,Cr),Go(3,xe),Go(4,Ko),Go(5,ot),Go(6,Tt),Go(7,Vn)],mk);let bw=class extends mk{get onDidChangeMenuItems(){return this._onDidChangeMenuItems.event}constructor(e,t,i,n,s,r,a,l,c,d,h){super(e,{resetMenu:t,...i,actionViewItemProvider:(g,m)=>{let _=d.lookUp(t,g instanceof bf?g.item.submenu.id:g.id);_||(_=i?.actionViewItemProvider);const b=_?.(g,m,h,me(e).vscodeWindowId);return b||MO(h,g,m)}},n,s,r,a,l,c),this._onDidChangeMenuItems=this._store.add(new P);const u=this._store.add(n.createMenu(t,s,{emitEventsForSubmenuChanges:!0,eventDebounceDelay:i?.eventDebounceDelay})),f=()=>{const{primary:g,secondary:m}=aK(u.getActions(i?.menuOptions),i?.toolbarOptions?.primaryGroup,i?.toolbarOptions?.shouldInlineSubmenu,i?.toolbarOptions?.useSeparatorsInPrimaryActions);e.classList.toggle("has-no-actions",g.length===0&&m.length===0),super.setActions(g,m)};this._store.add(u.onDidChange(()=>{f(),this._onDidChangeMenuItems.fire(this)})),this._store.add(d.onDidChange(g=>{g===t&&f()})),f()}setActions(){throw new Ce("This toolbar is populated from a menu.")}};bw=uK([Go(3,Cr),Go(4,xe),Go(5,Ko),Go(6,ot),Go(7,Tt),Go(8,Vn),Go(9,hK),Go(10,ge)],bw);var X1e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fK=function(o,e){return function(t,i){e(t,i,o)}};const Qs=We("hoverService");let Q_=class extends A{get delay(){return this.isInstantlyHovering()?0:this.hoverOptions?.dynamicDelay?e=>this.hoverOptions?.dynamicDelay?.(e)??this._delay:this._delay}constructor(e,t,i={},n,s){super(),this.placement=e,this.hoverOptions=t,this.overrideOptions=i,this.configurationService=n,this.hoverService=s,this.lastHoverHideTime=0,this.timeLimit=200,this.hoverDisposables=this._register(new U),this._delay=this.configurationService.getValue("workbench.hover.delay"),this._register(this.configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration("workbench.hover.delay")&&(this._delay=this.configurationService.getValue("workbench.hover.delay"))}))}showHover(e,t){const i=typeof this.overrideOptions=="function"?this.overrideOptions(e,t):this.overrideOptions;this.hoverDisposables.clear();const n=ai(e.target)?[e.target]:e.target.targetElements;for(const r of n)this.hoverDisposables.add(Si(r,"keydown",a=>{a.equals(9)&&this.hoverService.hideHover()}));const s=ai(e.content)?void 0:typeof e.content=="string"?e.content.toString():e.content.value;return this.hoverService.showInstantHover({...e,...i,persistence:{hideOnKeyDown:!0,...i.persistence},id:s,appearance:{...e.appearance,compact:!0,skipFadeInAnimation:this.isInstantlyHovering(),...i.appearance}},t)}isInstantlyHovering(){return!!this.hoverOptions?.instantHover&&Date.now()-this.lastHoverHideTime<this.timeLimit}onDidHideHover(){this.hoverDisposables.clear(),this.hoverOptions?.instantHover&&(this.lastHoverHideTime=Date.now())}};Q_=X1e([fK(3,Me),fK(4,Qs)],Q_);const Q1e={showHover:function(){throw new Error("Native hover function not implemented.")},delay:0,showNativeHover:!0};class wg extends cP{constructor(e){super(),this._textModel=e}getValueOfRange(e){return this._textModel.getValueInRange(e)}getLineLength(e){return this._textModel.getLineLength(e)}get length(){const e=this._textModel.getLineCount(),t=this._textModel.getLineLength(e);return new $i(e-1,t)}}class gK extends hf{constructor(e){super(),this._getContext=e}runAction(e,t){const i=this._getContext();return super.runAction(e,i)}}class J1e extends A{constructor(e,t,i){super(),this._editor=e,this._domNode=t,this.itemProvider=i,this.scrollTop=rt(this,this._editor.onDidScrollChange,r=>this._editor.getScrollTop()),this.isScrollTopZero=this.scrollTop.map(r=>r===0),this.modelAttached=rt(this,this._editor.onDidChangeModel,r=>this._editor.hasModel()),this.editorOnDidChangeViewZones=co("onDidChangeViewZones",this._editor.onDidChangeViewZones),this.editorOnDidContentSizeChange=co("onDidContentSizeChange",this._editor.onDidContentSizeChange),this.domNodeSizeChanged=_r("domNodeSizeChanged"),this.views=new Map,this._domNode.className="gutter monaco-editor";const n=this._domNode.appendChild(Je("div.scroll-decoration",{role:"presentation",ariaHidden:"true",style:{width:"100%"}}).root),s=new ResizeObserver(()=>{Dt(r=>{this.domNodeSizeChanged.trigger(r)})});s.observe(this._domNode),this._register(ue(()=>s.disconnect())),this._register(Se(r=>{n.className=this.isScrollTopZero.read(r)?"":"scroll-decoration"})),this._register(Se(r=>this.render(r)))}dispose(){super.dispose(),Yi(this._domNode)}render(e){if(!this.modelAttached.read(e))return;this.domNodeSizeChanged.read(e),this.editorOnDidChangeViewZones.read(e),this.editorOnDidContentSizeChange.read(e);const t=this.scrollTop.read(e),i=this._editor.getVisibleRanges(),n=new Set(this.views.keys()),s=pe.ofStartAndLength(0,this._domNode.clientHeight);if(!s.isEmpty)for(const r of i){const a=new ke(r.startLineNumber,r.endLineNumber+1),l=this.itemProvider.getIntersectingGutterItems(a,e);Dt(c=>{for(const d of l){if(!d.range.intersect(a))continue;n.delete(d.id);let h=this.views.get(d.id);if(h)h.item.set(d,c);else{const m=document.createElement("div");this._domNode.appendChild(m);const _=Le("item",d),b=this.itemProvider.createView(_,m);h=new eve(_,b,m),this.views.set(d.id,h)}const u=d.range.startLineNumber<=this._editor.getModel().getLineCount()?this._editor.getTopForLineNumber(d.range.startLineNumber,!0)-t:d.range.startLineNumber>1?this._editor.getBottomForLineNumber(d.range.startLineNumber-1,!1)-t:0,g=(d.range.endLineNumberExclusive===1?Math.max(u,this._editor.getTopForLineNumber(d.range.startLineNumber,!1)-t):Math.max(u,this._editor.getBottomForLineNumber(d.range.endLineNumberExclusive-1,!0)-t))-u;h.domNode.style.top=`${u}px`,h.domNode.style.height=`${g}px`,h.gutterItemView.layout(pe.ofStartAndLength(u,g),s)}})}for(const r of n){const a=this.views.get(r);a.gutterItemView.dispose(),a.domNode.remove(),this.views.delete(r)}}}class eve{constructor(e,t,i){this.item=e,this.gutterItemView=t,this.domNode=i}}var pK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_k=function(o,e){return function(t,i){e(t,i,o)}};const FO=[],bk=35;let WO=class extends A{constructor(e,t,i,n,s,r,a,l,c){super(),this._diffModel=t,this._editors=i,this._options=n,this._sashLayout=s,this._boundarySashes=r,this._instantiationService=a,this._contextKeyService=l,this._menuService=c,this._menu=this._register(this._menuService.createMenu(de.DiffEditorHunkToolbar,this._contextKeyService)),this._actions=rt(this,this._menu.onDidChange,()=>this._menu.getActions()),this._hasActions=this._actions.map(h=>h.length>0),this._showSash=j(this,h=>this._options.renderSideBySide.read(h)&&this._hasActions.read(h)),this.width=j(this,h=>this._hasActions.read(h)?bk:0),this.elements=Je("div.gutter@gutter",{style:{position:"absolute",height:"100%",width:bk+"px"}},[]),this._currentDiff=j(this,h=>{const u=this._diffModel.read(h);if(!u)return;const f=u.diff.read(h)?.mappings,g=this._editors.modifiedCursor.read(h);if(g)return f?.find(m=>m.lineRangeMapping.modified.contains(g.lineNumber))}),this._selectedDiffs=j(this,h=>{const f=this._diffModel.read(h)?.diff.read(h);if(!f)return FO;const g=this._editors.modifiedSelections.read(h);if(g.every(C=>C.isEmpty()))return FO;const m=new Tr(g.map(C=>ke.fromRangeInclusive(C))),b=f.mappings.filter(C=>C.lineRangeMapping.innerChanges&&m.intersects(C.lineRangeMapping.modified)).map(C=>({mapping:C,rangeMappings:C.lineRangeMapping.innerChanges.filter(w=>g.some(v=>k.areIntersecting(w.modifiedRange,v)))}));return b.length===0||b.every(C=>C.rangeMappings.length===0)?FO:b}),this._register(gCe(e,this.elements.root)),this._register(W(this.elements.root,"click",()=>{this._editors.modified.focus()})),this._register(Hh(this.elements.root,{display:this._hasActions.map(h=>h?"block":"none")})),mr(this,h=>this._showSash.read(h)?new iK(e,this._sashLayout.dimensions,this._options.enableSplitViewResizing,this._boundarySashes,GR(this,f=>this._sashLayout.sashLeft.read(f)-bk,(f,g)=>this._sashLayout.sashLeft.set(f+bk,g)),()=>this._sashLayout.resetSash()):void 0).recomputeInitiallyAndOnChange(this._store);const d=j(this,h=>{const u=this._diffModel.read(h);if(!u)return[];const f=u.diff.read(h);if(!f)return[];const g=this._selectedDiffs.read(h);if(g.length>0){const _=qo.fromRangeMappings(g.flatMap(b=>b.rangeMappings));return[new mK(_,!0,de.DiffEditorSelectionToolbar,void 0,u.model.original.uri,u.model.modified.uri)]}const m=this._currentDiff.read(h);return f.mappings.map(_=>new mK(_.lineRangeMapping.withInnerChangesFromLineRanges(),_.lineRangeMapping===m?.lineRangeMapping,de.DiffEditorHunkToolbar,void 0,u.model.original.uri,u.model.modified.uri))});this._register(new J1e(this._editors.modified,this.elements.root,{getIntersectingGutterItems:(h,u)=>d.read(u),createView:(h,u)=>this._instantiationService.createInstance(BO,h,u,this)})),this._register(W(this.elements.gutter,te.MOUSE_WHEEL,h=>{this._editors.modified.getOption(117).handleMouseWheel&&this._editors.modified.delegateScrollFromMouseWheelEvent(h)},{passive:!1}))}computeStagedValue(e){const t=e.innerChanges??[],i=new wg(this._editors.modifiedModel.get()),n=new wg(this._editors.original.getModel());return new mo(t.map(a=>a.toTextEdit(i))).apply(n)}layout(e){this.elements.gutter.style.left=e+"px"}};WO=pK([_k(6,ge),_k(7,xe),_k(8,Cr)],WO);class mK{constructor(e,t,i,n,s,r){this.mapping=e,this.showAlways=t,this.menuId=i,this.rangeOverride=n,this.originalUri=s,this.modifiedUri=r}get id(){return this.mapping.modified.toString()}get range(){return this.rangeOverride??this.mapping.modified}}let BO=class extends A{constructor(e,t,i,n){super(),this._item=e,this._elements=Je("div.gutterItem",{style:{height:"20px",width:"34px"}},[Je("div.background@background",{},[]),Je("div.buttons@buttons",{},[])]),this._showAlways=this._item.map(this,r=>r.showAlways),this._menuId=this._item.map(this,r=>r.menuId),this._isSmall=Le(this,!1),this._lastItemRange=void 0,this._lastViewRange=void 0;const s=this._register(n.createInstance(Q_,"element",{instantHover:!0},{position:{hoverPosition:1}}));this._register(U_(t,this._elements.root)),this._register(Se(r=>{const a=this._showAlways.read(r);this._elements.root.classList.toggle("noTransition",!0),this._elements.root.classList.toggle("showAlways",a),setTimeout(()=>{this._elements.root.classList.toggle("noTransition",!1)},0)})),this._register(Bn((r,a)=>{this._elements.buttons.replaceChildren();const l=a.add(n.createInstance(bw,this._elements.buttons,this._menuId.read(r),{orientation:1,hoverDelegate:s,toolbarOptions:{primaryGroup:c=>c.startsWith("primary")},overflowBehavior:{maxItems:this._isSmall.read(r)?1:3},hiddenItemStrategy:0,actionRunner:a.add(new gK(()=>{const c=this._item.read(void 0),d=c.mapping;return{mapping:d,originalWithModifiedChanges:i.computeStagedValue(d),originalUri:c.originalUri,modifiedUri:c.modifiedUri}})),menuOptions:{shouldForwardArgs:!0}}));a.add(l.onDidChangeMenuItems(()=>{this._lastItemRange&&this.layout(this._lastItemRange,this._lastViewRange)}))}))}layout(e,t){this._lastItemRange=e,this._lastViewRange=t;let i=this._elements.buttons.clientHeight;this._isSmall.set(this._item.get().mapping.original.startLineNumber===1&&e.length<30,void 0),i=this._elements.buttons.clientHeight;const n=e.length/2-i/2,s=i;let r=e.start+n;const a=pe.tryCreate(s,t.endExclusive-s-i),l=pe.tryCreate(e.start+s,e.endExclusive-i-s);l&&a&&l.start<l.endExclusive&&(r=a.clip(r),r=l.clip(r)),this._elements.buttons.style.top=`${r-e.start}px`}};BO=pK([_k(3,ge)],BO);var tve=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ive=function(o,e){return function(t,i){e(t,i,o)}},Ck;let vk=(Ep=class extends A{static setBreadcrumbsSourceFactory(e){this._breadcrumbsSourceFactory.set(e,void 0)}get isUpdatingHiddenAreas(){return this._isUpdatingHiddenAreas}constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._instantiationService=n,this._modifiedOutlineSource=mr(this,l=>{const c=this._editors.modifiedModel.read(l),d=Ck._breadcrumbsSourceFactory.read(l);return!c||!d?void 0:d(c,this._instantiationService)}),this._isUpdatingHiddenAreas=!1,this._register(this._editors.original.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();Dt(d=>{for(const h of this._editors.original.getSelections()||[])c?.ensureOriginalLineIsVisible(h.getStartPosition().lineNumber,0,d),c?.ensureOriginalLineIsVisible(h.getEndPosition().lineNumber,0,d)})})),this._register(this._editors.modified.onDidChangeCursorPosition(l=>{if(l.reason===1)return;const c=this._diffModel.get();Dt(d=>{for(const h of this._editors.modified.getSelections()||[])c?.ensureModifiedLineIsVisible(h.getStartPosition().lineNumber,0,d),c?.ensureModifiedLineIsVisible(h.getEndPosition().lineNumber,0,d)})}));const s=this._diffModel.map((l,c)=>{const d=l?.unchangedRegions.read(c)??[];return d.length===1&&d[0].modifiedLineNumber===1&&d[0].lineCount===this._editors.modifiedModel.read(c)?.getLineCount()?[]:d});this.viewZones=j(this,l=>{const c=this._modifiedOutlineSource.read(l);if(!c)return{origViewZones:[],modViewZones:[]};const d=[],h=[],u=this._options.renderSideBySide.read(l),f=this._options.compactMode.read(l),g=s.read(l);for(let m=0;m<g.length;m++){const _=g[m];if(!_.shouldHideControls(l)&&!(f&&(m===0||m===g.length-1)))if(f){{const b=j(this,w=>_.getHiddenOriginalRange(w).startLineNumber-1),C=new $_(b,12);d.push(C),l.store.add(new _K(this._editors.original,C,_,!u))}{const b=j(this,w=>_.getHiddenModifiedRange(w).startLineNumber-1),C=new $_(b,12);h.push(C),l.store.add(new _K(this._editors.modified,C,_))}}else{{const b=j(this,w=>_.getHiddenOriginalRange(w).startLineNumber-1),C=new $_(b,24);d.push(C),l.store.add(new bK(this._editors.original,C,_,_.originalUnchangedRange,!u,c,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}{const b=j(this,w=>_.getHiddenModifiedRange(w).startLineNumber-1),C=new $_(b,24);h.push(C),l.store.add(new bK(this._editors.modified,C,_,_.modifiedUnchangedRange,!1,c,w=>this._diffModel.get().ensureModifiedLineIsVisible(w,2,void 0),this._options))}}}return{origViewZones:d,modViewZones:h}});const r={description:"unchanged lines",className:"diff-unchanged-lines",isWholeLine:!0},a={description:"Fold Unchanged",glyphMarginHoverMessage:new qn(void 0,{isTrusted:!0,supportThemeIcons:!0}).appendMarkdown(p(121,"Fold Unchanged Region")),glyphMarginClassName:"fold-unchanged "+ve.asClassName(Y.fold),zIndex:10001};this._register(Qx(this._editors.original,j(this,l=>{const c=s.read(l),d=c.map(h=>({range:h.originalUnchangedRange.toInclusiveRange(),options:r}));for(const h of c)h.shouldHideControls(l)&&d.push({range:k.fromPositions(new M(h.originalLineNumber,1)),options:a});return d}))),this._register(Qx(this._editors.modified,j(this,l=>{const c=s.read(l),d=c.map(h=>({range:h.modifiedUnchangedRange.toInclusiveRange(),options:r}));for(const h of c)h.shouldHideControls(l)&&d.push({range:ke.ofLength(h.modifiedLineNumber,1).toInclusiveRange(),options:a});return d}))),this._register(Se(l=>{const c=s.read(l);this._isUpdatingHiddenAreas=!0;try{this._editors.original.setHiddenAreas(c.map(d=>d.getHiddenOriginalRange(l).toInclusiveRange()).filter(sn)),this._editors.modified.setHiddenAreas(c.map(d=>d.getHiddenModifiedRange(l).toInclusiveRange()).filter(sn))}finally{this._isUpdatingHiddenAreas=!1}})),this._register(this._editors.modified.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,d=this._diffModel.get();if(!d)return;const h=d.unchangedRegions.get().find(u=>u.modifiedUnchangedRange.contains(c));if(!h)return;h.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}})),this._register(this._editors.original.onMouseUp(l=>{if(!l.event.rightButton&&l.target.position&&l.target.element?.className.includes("fold-unchanged")){const c=l.target.position.lineNumber,d=this._diffModel.get();if(!d)return;const h=d.unchangedRegions.get().find(u=>u.originalUnchangedRange.contains(c));if(!h)return;h.collapseAll(void 0),l.event.stopPropagation(),l.event.preventDefault()}}))}},Ck=Ep,Ep._breadcrumbsSourceFactory=Le(Ck,()=>({dispose(){},getBreadcrumbItems(e,t){return[]}})),Ep);vk=Ck=tve([ive(3,ge)],vk);class _K extends tO{constructor(e,t,i,n=!1){const s=Je("div.diff-hidden-lines-widget");super(e,t,s.root),this._unchangedRegion=i,this._hide=n,this._nodes=Je("div.diff-hidden-lines-compact",[Je("div.line-left",[]),Je("div.text@text",[]),Je("div.line-right",[])]),s.root.appendChild(this._nodes.root),this._hide&&this._nodes.root.replaceChildren(),this._register(Se(r=>{if(!this._hide){const a=this._unchangedRegion.getHiddenModifiedRange(r).length,l=p(122,"{0} hidden lines",a);this._nodes.text.innerText=l}}))}}class bK extends tO{constructor(e,t,i,n,s,r,a,l){const c=Je("div.diff-hidden-lines-widget");super(e,t,c.root),this._editor=e,this._unchangedRegion=i,this._unchangedRegionRange=n,this._hide=s,this._modifiedOutlineSource=r,this._revealModifiedHiddenLine=a,this._options=l,this._nodes=Je("div.diff-hidden-lines",[Je("div.top@top",{title:p(123,"Click or drag to show more above")}),Je("div.center@content",{style:{display:"flex"}},[Je("div@first",{style:{display:"flex",justifyContent:"center",alignItems:"center",flexShrink:"0"}},[Q("a",{title:p(124,"Show Unchanged Region"),role:"button",onclick:()=>{this._unchangedRegion.showAll(void 0)}},...Fh("$(unfold)"))]),Je("div@others",{style:{display:"flex",justifyContent:"center",alignItems:"center"}})]),Je("div.bottom@bottom",{title:p(125,"Click or drag to show more below"),role:"button"})]),c.root.appendChild(this._nodes.root),this._hide?Yi(this._nodes.first):this._register(Hh(this._nodes.first,{width:ni(this._editor).layoutInfoContentLeft})),this._register(Se(h=>{const u=this._unchangedRegion.visibleLineCountTop.read(h)+this._unchangedRegion.visibleLineCountBottom.read(h)===this._unchangedRegion.lineCount;this._nodes.bottom.classList.toggle("canMoveTop",!u),this._nodes.bottom.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0),this._nodes.top.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),this._nodes.top.classList.toggle("canMoveBottom",!u);const f=this._unchangedRegion.isDragged.read(h),g=this._editor.getDomNode();g&&(g.classList.toggle("draggingUnchangedRegion",!!f),f==="top"?(g.classList.toggle("canMoveTop",this._unchangedRegion.visibleLineCountTop.read(h)>0),g.classList.toggle("canMoveBottom",!u)):f==="bottom"?(g.classList.toggle("canMoveTop",!u),g.classList.toggle("canMoveBottom",this._unchangedRegion.visibleLineCountBottom.read(h)>0)):(g.classList.toggle("canMoveTop",!1),g.classList.toggle("canMoveBottom",!1)))}));const d=this._editor;this._register(W(this._nodes.top,"mousedown",h=>{if(h.button!==0)return;this._nodes.top.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();const u=h.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountTop.get();this._unchangedRegion.isDragged.set("top",void 0);const m=me(this._nodes.top),_=W(m,"mousemove",C=>{const v=C.clientY-u;f=f||Math.abs(v)>2;const S=Math.round(v/d.getOption(75)),L=Math.max(0,Math.min(g+S,this._unchangedRegion.getMaxVisibleLineCountTop()));this._unchangedRegion.visibleLineCountTop.set(L,void 0)}),b=W(m,"mouseup",C=>{f||this._unchangedRegion.showMoreAbove(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0),this._nodes.top.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),this._unchangedRegion.isDragged.set(void 0,void 0),_.dispose(),b.dispose()})})),this._register(W(this._nodes.bottom,"mousedown",h=>{if(h.button!==0)return;this._nodes.bottom.classList.toggle("dragging",!0),this._nodes.root.classList.toggle("dragging",!0),h.preventDefault();const u=h.clientY;let f=!1;const g=this._unchangedRegion.visibleLineCountBottom.get();this._unchangedRegion.isDragged.set("bottom",void 0);const m=me(this._nodes.bottom),_=W(m,"mousemove",C=>{const v=C.clientY-u;f=f||Math.abs(v)>2;const S=Math.round(v/d.getOption(75)),L=Math.max(0,Math.min(g-S,this._unchangedRegion.getMaxVisibleLineCountBottom())),x=this._unchangedRegionRange.endLineNumberExclusive>d.getModel().getLineCount()?d.getContentHeight():d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.visibleLineCountBottom.set(L,void 0);const I=this._unchangedRegionRange.endLineNumberExclusive>d.getModel().getLineCount()?d.getContentHeight():d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);d.setScrollTop(d.getScrollTop()+(I-x))}),b=W(m,"mouseup",C=>{if(this._unchangedRegion.isDragged.set(void 0,void 0),!f){const w=d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);this._unchangedRegion.showMoreBelow(this._options.hideUnchangedRegionsRevealLineCount.get(),void 0);const v=d.getTopForLineNumber(this._unchangedRegionRange.endLineNumberExclusive);d.setScrollTop(d.getScrollTop()+(v-w))}this._nodes.bottom.classList.toggle("dragging",!1),this._nodes.root.classList.toggle("dragging",!1),_.dispose(),b.dispose()})})),this._register(Se(h=>{const u=[];if(!this._hide){const f=i.getHiddenModifiedRange(h).length,g=p(126,"{0} hidden lines",f),m=Q("span",{title:p(127,"Double click to unfold")},g);m.addEventListener("dblclick",C=>{C.button===0&&(C.preventDefault(),this._unchangedRegion.showAll(void 0))}),u.push(m);const _=this._unchangedRegion.getHiddenModifiedRange(h),b=this._modifiedOutlineSource.getBreadcrumbItems(_,h);if(b.length>0){u.push(Q("span",void 0,"  |  "));for(let C=0;C<b.length;C++){const w=b[C],v=QL.toIcon(w.kind),S=Je("div.breadcrumb-item",{style:{display:"flex",alignItems:"center"}},[Al(v)," ",w.name,...C===b.length-1?[]:[Al(Y.chevronRight)]]).root;u.push(S),S.onclick=()=>{this._revealModifiedHiddenLine(w.startLineNumber)}}}}Yi(this._nodes.others,...u)}))}}const HO=[];class nve extends A{constructor(e,t,i,n){super(),this._editors=e,this._diffModel=t,this._options=i,this._widget=n,this._selectedDiffs=j(this,s=>{const a=this._diffModel.read(s)?.diff.read(s);if(!a)return HO;const l=this._editors.modifiedSelections.read(s);if(l.every(u=>u.isEmpty()))return HO;const c=new Tr(l.map(u=>ke.fromRangeInclusive(u))),h=a.mappings.filter(u=>u.lineRangeMapping.innerChanges&&c.intersects(u.lineRangeMapping.modified)).map(u=>({mapping:u,rangeMappings:u.lineRangeMapping.innerChanges.filter(f=>l.some(g=>k.areIntersecting(f.modifiedRange,g)))}));return h.length===0||h.every(u=>u.rangeMappings.length===0)?HO:h}),this._register(Bn((s,r)=>{if(!this._options.shouldRenderOldRevertArrows.read(s))return;const a=this._diffModel.read(s),l=a?.diff.read(s);if(!a||!l||a.movedTextToCompare.read(s))return;const c=[],d=this._selectedDiffs.read(s),h=new Set(d.map(u=>u.mapping));if(d.length>0){const u=this._editors.modifiedSelections.read(s),f=r.add(new wk(u[u.length-1].positionLineNumber,this._widget,d.flatMap(g=>g.rangeMappings),!0));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}for(const u of l.mappings)if(!h.has(u)&&!u.lineRangeMapping.modified.isEmpty&&u.lineRangeMapping.innerChanges){const f=r.add(new wk(u.lineRangeMapping.modified.startLineNumber,this._widget,u.lineRangeMapping,!1));this._editors.modified.addGlyphMarginWidget(f),c.push(f)}r.add(ue(()=>{for(const u of c)this._editors.modified.removeGlyphMarginWidget(u)}))}))}}const kN=class kN extends A{getId(){return this._id}constructor(e,t,i,n){super(),this._lineNumber=e,this._widget=t,this._diffs=i,this._revertSelection=n,this._id=`revertButton${kN.counter++}`,this._domNode=Je("div.revertButton",{title:this._revertSelection?p(132,"Revert Selected Changes"):p(133,"Revert Change")},[Al(Y.arrowRight)]).root,this._register(W(this._domNode,te.MOUSE_DOWN,s=>{s.button!==2&&(s.stopPropagation(),s.preventDefault())})),this._register(W(this._domNode,te.MOUSE_UP,s=>{s.stopPropagation(),s.preventDefault()})),this._register(W(this._domNode,te.CLICK,s=>{this._diffs instanceof ds?this._widget.revert(this._diffs):this._widget.revertRangeMappings(this._diffs),s.stopPropagation(),s.preventDefault()}))}getDomNode(){return this._domNode}getPosition(){return{lane:xa.Right,range:{startColumn:1,startLineNumber:this._lineNumber,endColumn:1,endLineNumber:this._lineNumber},zIndex:10001}}};kN.counter=0;let wk=kN;var sve=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Cw=function(o,e){return function(t,i){e(t,i,o)}};let Bl=class extends yO{get onDidContentSizeChange(){return this._editors.onDidContentSizeChange}constructor(e,t,i,n,s,r,a,l){super(),this._domElement=e,this._parentContextKeyService=n,this._parentInstantiationService=s,this._accessibilitySignalService=a,this._editorProgressService=l,this.elements=Je("div.monaco-diff-editor.side-by-side",{style:{position:"relative",height:"100%"}},[Je("div.editor.original@original",{style:{position:"absolute",height:"100%"}}),Je("div.editor.modified@modified",{style:{position:"absolute",height:"100%"}}),Je("div.accessibleDiffViewer@accessibleDiffViewer",{style:{position:"absolute",height:"100%"}})]),this._diffModelSrc=this._register(KR(this,void 0)),this._diffModel=j(this,v=>this._diffModelSrc.read(v)?.object),this.onDidChangeModel=ie.fromObservableLight(this._diffModel),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._domElement)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new O_([xe,this._contextKeyService]))),this._boundarySashes=Le(this,void 0),this._accessibleDiffViewerShouldBeVisible=Le(this,!1),this._accessibleDiffViewerVisible=j(this,v=>this._options.onlyShowAccessibleDiffViewer.read(v)?!0:this._accessibleDiffViewerShouldBeVisible.read(v)),this._movedBlocksLinesPart=Le(this,void 0),this._layoutInfo=j(this,v=>{const S=this._rootSizeObserver.width.read(v),L=this._rootSizeObserver.height.read(v);this._rootSizeObserver.automaticLayout?this.elements.root.style.height="100%":this.elements.root.style.height=L+"px";const x=this._sash.read(v),I=this._gutter.read(v),D=I?.width.read(v)??0,R=this._overviewRulerPart.read(v)?.width??0;let F,O,B,V,z;if(!!x){const se=x.sashLeft.read(v),oe=this._movedBlocksLinesPart.read(v)?.width.read(v)??0;F=0,O=se-D-oe,z=se-D,B=se,V=S-B-R}else{z=0;const se=this._options.inlineViewHideOriginalLineNumbers.read(v);F=D,se?O=0:O=Math.max(5,this._editors.originalObs.layoutInfoDecorationsLeft.read(v)),B=D+O,V=S-B-R}return this.elements.original.style.left=F+"px",this.elements.original.style.width=O+"px",this._editors.original.layout({width:O,height:L},!0),I?.layout(z),this.elements.modified.style.left=B+"px",this.elements.modified.style.width=V+"px",this._editors.modified.layout({width:V,height:L},!0),{modifiedEditor:this._editors.modified.getLayoutInfo(),originalEditor:this._editors.original.getLayoutInfo()}}),this._diffValue=this._diffModel.map((v,S)=>v?.diff.read(S)),this.onDidUpdateDiff=ie.fromObservableLight(this._diffValue),r.willCreateDiffEditor(),this._contextKeyService.createKey("isInDiffEditor",!0),this._domElement.appendChild(this.elements.root),this._register(ue(()=>this.elements.root.remove())),this._rootSizeObserver=this._register(new pq(this.elements.root,t.dimension)),this._rootSizeObserver.setAutomaticLayout(t.automaticLayout??!1),this._options=this._instantiationService.createInstance(LO,t),this._register(Se(v=>{this._options.setWidth(this._rootSizeObserver.width.read(v))})),this._contextKeyService.createKey(T.isEmbeddedDiffEditor.key,!1),this._register(El(T.isEmbeddedDiffEditor,this._contextKeyService,v=>this._options.isInEmbeddedEditor.read(v))),this._register(El(T.comparingMovedCode,this._contextKeyService,v=>!!this._diffModel.read(v)?.movedTextToCompare.read(v))),this._register(El(T.diffEditorRenderSideBySideInlineBreakpointReached,this._contextKeyService,v=>this._options.couldShowInlineViewBecauseOfSize.read(v))),this._register(El(T.diffEditorInlineMode,this._contextKeyService,v=>!this._options.renderSideBySide.read(v))),this._register(El(T.hasChanges,this._contextKeyService,v=>(this._diffModel.read(v)?.diff.read(v)?.mappings.length??0)>0)),this._editors=this._register(this._instantiationService.createInstance(vO,this.elements.original,this.elements.modified,this._options,i,(v,S,L,x)=>this._createInnerEditor(v,S,L,x))),this._register(El(T.diffEditorOriginalWritable,this._contextKeyService,v=>this._options.originalEditable.read(v))),this._register(El(T.diffEditorModifiedWritable,this._contextKeyService,v=>!this._options.readOnly.read(v))),this._register(El(T.diffEditorOriginalUri,this._contextKeyService,v=>this._diffModel.read(v)?.model.original.uri.toString()??"")),this._register(El(T.diffEditorModifiedUri,this._contextKeyService,v=>this._diffModel.read(v)?.model.modified.uri.toString()??"")),this._overviewRulerPart=mr(this,v=>this._options.renderOverviewRuler.read(v)?this._instantiationService.createInstance(id(fw),this._editors,this.elements.root,this._diffModel,this._rootSizeObserver.width,this._rootSizeObserver.height,this._layoutInfo.map(S=>S.modifiedEditor)):void 0).recomputeInitiallyAndOnChange(this._store);const c={height:this._rootSizeObserver.height,width:this._rootSizeObserver.width.map((v,S)=>v-(this._overviewRulerPart.read(S)?.width??0))};this._sashLayout=new v1e(this._options,c),this._sash=mr(this,v=>{const S=this._options.renderSideBySide.read(v);return this.elements.root.classList.toggle("side-by-side",S),S?new iK(this.elements.root,c,this._options.enableSplitViewResizing,this._boundarySashes,this._sashLayout.sashLeft,()=>this._sashLayout.resetSash()):void 0}).recomputeInitiallyAndOnChange(this._store);const d=mr(this,v=>this._instantiationService.createInstance(id(vk),this._editors,this._diffModel,this._options)).recomputeInitiallyAndOnChange(this._store);mr(this,v=>this._instantiationService.createInstance(id(h1e),this._editors,this._diffModel,this._options,this)).recomputeInitiallyAndOnChange(this._store);const h=new Set,u=new Set;let f=!1;const g=mr(this,v=>this._instantiationService.createInstance(id(pO),me(this._domElement),this._editors,this._diffModel,this._options,this,()=>f||d.read(void 0).isUpdatingHiddenAreas,h,u)).recomputeInitiallyAndOnChange(this._store),m=j(this,v=>{const S=g.read(v).viewZones.read(v).orig,L=d.read(v).viewZones.read(v).origViewZones;return S.concat(L)}),_=j(this,v=>{const S=g.read(v).viewZones.read(v).mod,L=d.read(v).viewZones.read(v).modViewZones;return S.concat(L)});this._register(Jx(this._editors.original,m,v=>{f=v},h));let b;this._register(Jx(this._editors.modified,_,v=>{f=v,f?b=Aa.capture(this._editors.modified):(b?.restore(this._editors.modified),b=void 0)},u)),this._accessibleDiffViewer=mr(this,v=>this._instantiationService.createInstance(id(_g),this.elements.accessibleDiffViewer,this._accessibleDiffViewerVisible,(S,L)=>this._accessibleDiffViewerShouldBeVisible.set(S,L),this._options.onlyShowAccessibleDiffViewer.map(S=>!S),this._rootSizeObserver.width,this._rootSizeObserver.height,this._diffModel.map((S,L)=>S?.diff.read(L)?.mappings.map(x=>x.lineRangeMapping)),new ACe(this._editors))).recomputeInitiallyAndOnChange(this._store);const C=this._accessibleDiffViewerVisible.map(v=>v?"hidden":"visible");this._register(Hh(this.elements.modified,{visibility:C})),this._register(Hh(this.elements.original,{visibility:C})),this._createDiffEditorContributions(),r.addDiffEditor(this),this._gutter=mr(this,v=>this._options.shouldRenderGutterMenu.read(v)?this._instantiationService.createInstance(id(WO),this.elements.root,this._diffModel,this._editors,this._options,this._sashLayout,this._boundarySashes):void 0),this._register(Fm(this._layoutInfo)),mr(this,v=>new(id(K_))(this.elements.root,this._diffModel,this._layoutInfo.map(S=>S.originalEditor),this._layoutInfo.map(S=>S.modifiedEditor),this._editors)).recomputeInitiallyAndOnChange(this._store,v=>{this._movedBlocksLinesPart.set(v,void 0)}),this._register(ie.runAndSubscribe(this._editors.modified.onDidChangeCursorPosition,v=>this._handleCursorPositionChange(v,!0))),this._register(ie.runAndSubscribe(this._editors.original.onDidChangeCursorPosition,v=>this._handleCursorPositionChange(v,!1)));const w=this._diffModel.map(this,(v,S)=>{if(v)return v.diff.read(S)===void 0&&!v.isDiffUpToDate.read(S)});this._register(Bn((v,S)=>{if(w.read(v)===!0){const L=this._editorProgressService.show(!0,1e3);S.add(ue(()=>L.done()))}})),this._register(Bn((v,S)=>{S.add(new(id(nve))(this._editors,this._diffModel,this._options,this))})),this._register(Bn((v,S)=>{const L=this._diffModel.read(v);if(L)for(const x of[L.model.original,L.model.modified])S.add(x.onWillDispose(I=>{Ee(new Ce("TextModel got disposed before DiffEditorWidget model got reset")),this.setModel(null)}))})),this._register(Se(v=>{this._options.setModel(this._diffModel.read(v))}))}_createInnerEditor(e,t,i,n){return e.createInstance(sg,t,i,n)}_createDiffEditorContributions(){const e=Um.getDiffEditorContributions();for(const t of e)try{this._register(this._instantiationService.createInstance(t.ctor,this))}catch(i){Ee(i)}}get _targetEditor(){return this._editors.modified}getEditorType(){return vv.IDiffEditor}layout(e){this._rootSizeObserver.observe(e)}hasTextFocus(){return this._editors.original.hasTextFocus()||this._editors.modified.hasTextFocus()}saveViewState(){const e=this._editors.original.saveViewState(),t=this._editors.modified.saveViewState();return{original:e,modified:t,modelState:this._diffModel.get()?.serializeState()}}restoreViewState(e){if(e&&e.original&&e.modified){const t=e;this._editors.original.restoreViewState(t.original),this._editors.modified.restoreViewState(t.modified),t.modelState&&this._diffModel.get()?.restoreSerializedState(t.modelState)}}handleInitialized(){this._editors.original.handleInitialized(),this._editors.modified.handleInitialized()}createViewModel(e){return this._instantiationService.createInstance(fO,e,this._options)}getModel(){return this._diffModel.get()?.model??null}setModel(e){const t=e?"model"in e?ek.create(e).createNewRef(this):ek.create(this.createViewModel(e),this):null;this.setDiffModel(t)}setDiffModel(e,t){const i=this._diffModel.get();!e&&i&&this._accessibleDiffViewer.get().close(),this._diffModel.get()!==e?.object&&lf(t,n=>{const s=e?.object;rt.batchEventsGlobally(n,()=>{this._editors.original.setModel(s?s.model.original:null),this._editors.modified.setModel(s?s.model.modified:null)});const r=this._diffModelSrc.get()?.createNewRef(this);this._diffModelSrc.set(e?.createNewRef(this),n),setTimeout(()=>{r?.dispose()},0)})}updateOptions(e){this._options.updateOptions(e)}getContainerDomNode(){return this._domElement}getOriginalEditor(){return this._editors.original}getModifiedEditor(){return this._editors.modified}getLineChanges(){const e=this._diffModel.get()?.diff.get();return e?ove(e):null}revert(e){const t=this._diffModel.get();!t||!t.isDiffUpToDate.get()||this._editors.modified.executeEdits("diffEditor",[{range:e.modified.toExclusiveRange(),text:t.model.original.getValueInRange(e.original.toExclusiveRange())}])}revertRangeMappings(e){const t=this._diffModel.get();if(!t||!t.isDiffUpToDate.get())return;const i=e.map(n=>({range:n.modifiedRange,text:t.model.original.getValueInRange(n.originalRange)}));this._editors.modified.executeEdits("diffEditor",i)}revertFocusedRangeMappings(){const e=this._diffModel.get();if(!e||!e.isDiffUpToDate.get())return;const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified;if(!i.hasTextFocus())return;const n=i.getPosition().lineNumber,s=i.getSelection(),r=ke.fromRange(s||new k(n,0,n,0)),a=t.filter(l=>l.lineRangeMapping.modified.intersect(r));i.executeEdits("diffEditor",a.map(l=>({range:l.lineRangeMapping.modified.toExclusiveRange(),text:e.model.original.getValueInRange(l.lineRangeMapping.original.toExclusiveRange())})))}_goTo(e){this._editors.modified.setPosition(new M(e.lineRangeMapping.modified.startLineNumber,1)),this._editors.modified.revealRangeInCenter(e.lineRangeMapping.modified.toExclusiveRange())}goToDiff(e){const t=this._diffModel.get()?.diff.get()?.mappings;if(!t||t.length===0)return;const i=this._editors.modified.getPosition().lineNumber;let n;e==="next"?this._editors.modified.getModel().getLineCount()===i?n=t[0]:n=t.find(r=>r.lineRangeMapping.modified.startLineNumber>i)??t[0]:n=nv(t,s=>s.lineRangeMapping.modified.startLineNumber<i)??t[t.length-1],this._goTo(n),n.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(xs.diffLineDeleted,{source:"diffEditor.goToDiff"}):n.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(xs.diffLineInserted,{source:"diffEditor.goToDiff"}):n&&this._accessibilitySignalService.playSignal(xs.diffLineModified,{source:"diffEditor.goToDiff"})}revealFirstDiff(){const e=this._diffModel.get();e&&this.waitForDiff().then(()=>{const t=e.diff.get()?.mappings;!t||t.length===0||this._goTo(t[0])})}accessibleDiffViewerNext(){this._accessibleDiffViewer.get().next()}accessibleDiffViewerPrev(){this._accessibleDiffViewer.get().prev()}async waitForDiff(){const e=this._diffModel.get();e&&await e.waitForDiff()}mapToOtherSide(){const e=this._editors.modified.hasWidgetFocus(),t=e?this._editors.modified:this._editors.original,i=e?this._editors.original:this._editors.modified;let n;const s=t.getSelection();if(s){const r=this._diffModel.get()?.diff.get()?.mappings.map(a=>e?a.lineRangeMapping.flip():a.lineRangeMapping);if(r){const a=_q(s.getStartPosition(),r),l=_q(s.getEndPosition(),r);n=k.plusRange(a,l)}}return{destination:i,destinationSelection:n}}switchSide(){const{destination:e,destinationSelection:t}=this.mapToOtherSide();e.focus(),t&&e.setSelection(t)}exitCompareMove(){const e=this._diffModel.get();e&&e.movedTextToCompare.set(void 0,void 0)}collapseAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&Dt(t=>{for(const i of e)i.collapseAll(t)})}showAllUnchangedRegions(){const e=this._diffModel.get()?.unchangedRegions.get();e&&Dt(t=>{for(const i of e)i.showAll(t)})}_handleCursorPositionChange(e,t){if(e?.reason===3){const i=this._diffModel.get()?.diff.get()?.mappings.find(n=>t?n.lineRangeMapping.modified.contains(e.position.lineNumber):n.lineRangeMapping.original.contains(e.position.lineNumber));i?.lineRangeMapping.modified.isEmpty?this._accessibilitySignalService.playSignal(xs.diffLineDeleted,{source:"diffEditor.cursorPositionChanged"}):i?.lineRangeMapping.original.isEmpty?this._accessibilitySignalService.playSignal(xs.diffLineInserted,{source:"diffEditor.cursorPositionChanged"}):i&&this._accessibilitySignalService.playSignal(xs.diffLineModified,{source:"diffEditor.cursorPositionChanged"})}}};Bl=sve([Cw(3,xe),Cw(4,ge),Cw(5,et),Cw(6,nd),Cw(7,sd)],Bl);function ove(o){return o.mappings.map(e=>{const t=e.lineRangeMapping;let i,n,s,r,a=t.innerChanges;return t.original.isEmpty?(i=t.original.startLineNumber-1,n=0,a=void 0):(i=t.original.startLineNumber,n=t.original.endLineNumberExclusive-1),t.modified.isEmpty?(s=t.modified.startLineNumber-1,r=0,a=void 0):(s=t.modified.startLineNumber,r=t.modified.endLineNumberExclusive-1),{originalStartLineNumber:i,originalEndLineNumber:n,modifiedStartLineNumber:s,modifiedEndLineNumber:r,charChanges:a?.map(l=>({originalStartLineNumber:l.originalRange.startLineNumber,originalStartColumn:l.originalRange.startColumn,originalEndLineNumber:l.originalRange.endLineNumber,originalEndColumn:l.originalRange.endColumn,modifiedStartLineNumber:l.modifiedRange.startLineNumber,modifiedStartColumn:l.modifiedRange.startColumn,modifiedEndLineNumber:l.modifiedRange.endLineNumber,modifiedEndColumn:l.modifiedRange.endColumn}))}})}class rve extends ln{constructor(){super({id:"diffEditor.toggleCollapseUnchangedRegions",title:H(82,"Toggle Collapse Unchanged Regions"),icon:Y.map,toggled:K.has("config.diffEditor.hideUnchangedRegions.enabled"),precondition:K.has("isInDiffEditor"),menu:{when:K.has("isInDiffEditor"),id:de.EditorTitle,order:22,group:"navigation"}})}run(e,...t){const i=e.get(Me),n=!i.getValue("diffEditor.hideUnchangedRegions.enabled");i.updateValue("diffEditor.hideUnchangedRegions.enabled",n)}}class CK extends ln{constructor(){super({id:"diffEditor.toggleShowMovedCodeBlocks",title:H(83,"Toggle Show Moved Code Blocks"),precondition:K.has("isInDiffEditor")})}run(e,...t){const i=e.get(Me),n=!i.getValue("diffEditor.experimental.showMoves");i.updateValue("diffEditor.experimental.showMoves",n)}}class vK extends ln{constructor(){super({id:"diffEditor.toggleUseInlineViewWhenSpaceIsLimited",title:H(84,"Toggle Use Inline View When Space Is Limited"),precondition:K.has("isInDiffEditor")})}run(e,...t){const i=e.get(Me),n=!i.getValue("diffEditor.useInlineViewWhenSpaceIsLimited");i.updateValue("diffEditor.useInlineViewWhenSpaceIsLimited",n)}}const vw=H(85,"Diff Editor");class ave extends Zr{constructor(){super({id:"diffEditor.switchSide",title:H(86,"Switch Side"),icon:Y.arrowSwap,precondition:K.has("isInDiffEditor"),f1:!0,category:vw})}runEditorCommand(e,t,i){const n=Sg(e);if(n instanceof Bl){if(i&&i.dryRun)return{destinationSelection:n.mapToOtherSide().destinationSelection};n.switchSide()}}}class lve extends Zr{constructor(){super({id:"diffEditor.exitCompareMove",title:H(87,"Exit Compare Move"),icon:Y.close,precondition:T.comparingMovedCode,f1:!1,category:vw,keybinding:{weight:1e4,primary:9}})}runEditorCommand(e,t,...i){const n=Sg(e);n instanceof Bl&&n.exitCompareMove()}}class cve extends Zr{constructor(){super({id:"diffEditor.collapseAllUnchangedRegions",title:H(88,"Collapse All Unchanged Regions"),icon:Y.fold,precondition:K.has("isInDiffEditor"),f1:!0,category:vw})}runEditorCommand(e,t,...i){const n=Sg(e);n instanceof Bl&&n.collapseAllUnchangedRegions()}}class dve extends Zr{constructor(){super({id:"diffEditor.showAllUnchangedRegions",title:H(89,"Show All Unchanged Regions"),icon:Y.unfold,precondition:K.has("isInDiffEditor"),f1:!0,category:vw})}runEditorCommand(e,t,...i){const n=Sg(e);n instanceof Bl&&n.showAllUnchangedRegions()}}class VO extends ln{constructor(){super({id:"diffEditor.revert",title:H(90,"Revert"),f1:!0,category:vw,precondition:K.has("isInDiffEditor")})}run(e,t){return t?this.runViaToolbarContext(e,t):this.runViaCursorOrSelection(e)}runViaCursorOrSelection(e){const t=Sg(e);t instanceof Bl&&t.revertFocusedRangeMappings()}runViaToolbarContext(e,t){const i=hve(e,t.originalUri,t.modifiedUri);i instanceof Bl&&i.revertRangeMappings(t.mapping.innerChanges??[])}}const wK=H(91,"Accessible Diff Viewer"),IN=class IN extends ln{constructor(){super({id:IN.id,title:H(92,"Go to Next Difference"),category:wK,precondition:K.has("isInDiffEditor"),keybinding:{primary:65,weight:100},f1:!0})}run(e){Sg(e)?.accessibleDiffViewerNext()}};IN.id="editor.action.accessibleDiffViewer.next";let ww=IN;const DN=class DN extends ln{constructor(){super({id:DN.id,title:H(93,"Go to Previous Difference"),category:wK,precondition:K.has("isInDiffEditor"),keybinding:{primary:1089,weight:100},f1:!0})}run(e){Sg(e)?.accessibleDiffViewerPrev()}};DN.id="editor.action.accessibleDiffViewer.prev";let Sk=DN;function hve(o,e,t){return o.get(et).listDiffEditors().find(s=>{const r=s.getModifiedEditor(),a=s.getOriginalEditor();return r&&r.getModel()?.uri.toString()===t.toString()&&a&&a.getModel()?.uri.toString()===e.toString()})||null}function Sg(o){const t=o.get(et).listDiffEditors(),i=Ui();if(i){for(const n of t)if(n.getContainerDomNode().contains(i))return n}return null}mt(rve),mt(CK),mt(vK),an.appendMenuItem(de.EditorTitle,{command:{id:new vK().desc.id,title:p(116,"Use Inline View When Space Is Limited"),toggled:K.has("config.diffEditor.useInlineViewWhenSpaceIsLimited"),precondition:K.has("isInDiffEditor")},order:11,group:"1_diff",when:K.and(T.diffEditorRenderSideBySideInlineBreakpointReached,K.has("isInDiffEditor"))}),an.appendMenuItem(de.EditorTitle,{command:{id:new CK().desc.id,title:p(117,"Show Moved Code Blocks"),icon:Y.move,toggled:Hm.create("config.diffEditor.experimental.showMoves",!0),precondition:K.has("isInDiffEditor")},order:10,group:"1_diff",when:K.has("isInDiffEditor")}),mt(VO);for(const o of[{icon:Y.arrowRight,key:T.diffEditorInlineMode.toNegated()},{icon:Y.discard,key:T.diffEditorInlineMode}])an.appendMenuItem(de.DiffEditorHunkToolbar,{command:{id:new VO().desc.id,title:p(118,"Revert Block"),icon:o.icon},when:K.and(T.diffEditorModifiedWritable,o.key),order:5,group:"primary"}),an.appendMenuItem(de.DiffEditorSelectionToolbar,{command:{id:new VO().desc.id,title:p(119,"Revert Selection"),icon:o.icon},when:K.and(T.diffEditorModifiedWritable,o.key),order:5,group:"primary"});mt(ave),mt(lve),mt(cve),mt(dve),an.appendMenuItem(de.EditorTitle,{command:{id:ww.id,title:p(120,"Open Accessible Diff Viewer"),precondition:K.has("isInDiffEditor")},order:10,group:"2_diff",when:K.and(T.accessibleDiffViewerVisible.negate(),K.has("isInDiffEditor"))}),Xe.registerCommandAlias("editor.action.diffReview.next",ww.id),mt(ww),Xe.registerCommandAlias("editor.action.diffReview.prev",Sk.id),mt(Sk);var uve=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},fve=function(o,e){return function(t,i){e(t,i,o)}},zO;const yk=new ae("selectionAnchorSet",!1);let $h=(Np=class{static get(e){return e.getContribution(zO.ID)}constructor(e,t){this.editor=e,this.selectionAnchorSetContextKey=yk.bindTo(t),this.modelChangeListener=e.onDidChangeModel(()=>this.selectionAnchorSetContextKey.reset())}setSelectionAnchor(){if(this.editor.hasModel()){const e=this.editor.getPosition();this.editor.changeDecorations(t=>{this.decorationId&&t.removeDecoration(this.decorationId),this.decorationId=t.addDecoration(ce.fromPositions(e,e),{description:"selection-anchor",stickiness:1,hoverMessage:new qn().appendText(p(794,"Selection Anchor")),className:"selection-anchor"})}),this.selectionAnchorSetContextKey.set(!!this.decorationId),ps(p(795,"Anchor set at {0}:{1}",e.lineNumber,e.column))}}goToSelectionAnchor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);e&&this.editor.setPosition(e.getStartPosition())}}selectFromAnchorToCursor(){if(this.editor.hasModel()&&this.decorationId){const e=this.editor.getModel().getDecorationRange(this.decorationId);if(e){const t=this.editor.getPosition();this.editor.setSelection(ce.fromPositions(e.getStartPosition(),t)),this.cancelSelectionAnchor()}}}cancelSelectionAnchor(){if(this.decorationId){const e=this.decorationId;this.editor.changeDecorations(t=>{t.removeDecoration(e),this.decorationId=void 0}),this.selectionAnchorSetContextKey.set(!1)}}dispose(){this.cancelSelectionAnchor(),this.modelChangeListener.dispose()}},zO=Np,Np.ID="editor.contrib.selectionAnchorController",Np);$h=zO=uve([fve(1,xe)],$h);class gve extends le{constructor(){super({id:"editor.action.setSelectionAnchor",label:H(796,"Set Selection Anchor"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2080),weight:100}})}async run(e,t){$h.get(t)?.setSelectionAnchor()}}class pve extends le{constructor(){super({id:"editor.action.goToSelectionAnchor",label:H(797,"Go to Selection Anchor"),precondition:yk})}async run(e,t){$h.get(t)?.goToSelectionAnchor()}}class mve extends le{constructor(){super({id:"editor.action.selectFromAnchorToCursor",label:H(798,"Select from Anchor to Cursor"),precondition:yk,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2089),weight:100}})}async run(e,t){$h.get(t)?.selectFromAnchorToCursor()}}class _ve extends le{constructor(){super({id:"editor.action.cancelSelectionAnchor",label:H(799,"Cancel Selection Anchor"),precondition:yk,kbOpts:{kbExpr:T.editorTextFocus,primary:9,weight:100}})}async run(e,t){$h.get(t)?.cancelSelectionAnchor()}}Qe($h.ID,$h,4),ne(gve),ne(pve),ne(mve),ne(_ve);const bve=N("editorOverviewRuler.bracketMatchForeground","#A0A0A0",p(800,"Overview ruler marker color for matching brackets."));class Cve extends le{constructor(){super({id:"editor.action.jumpToBracket",label:H(802,"Go to Bracket"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:3165,weight:100}})}run(e,t){yg.get(t)?.jumpToBracket()}}class vve extends le{constructor(){super({id:"editor.action.selectToBracket",label:H(803,"Select to Bracket"),precondition:void 0,metadata:{description:H(804,"Select the text inside and including the brackets or curly braces"),args:[{name:"args",schema:{type:"object",properties:{selectBrackets:{type:"boolean",default:!0}}}}]}})}run(e,t,i){let n=!0;i&&i.selectBrackets===!1&&(n=!1),yg.get(t)?.selectToBracket(n)}}class wve extends le{constructor(){super({id:"editor.action.removeBrackets",label:H(805,"Remove Brackets"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2561,weight:100}})}run(e,t){yg.get(t)?.removeBrackets(this.id)}}class Sve{constructor(e,t,i){this.position=e,this.brackets=t,this.options=i}}const xu=class xu extends A{static get(e){return e.getContribution(xu.ID)}constructor(e){super(),this._editor=e,this._lastBracketsData=[],this._lastVersionId=0,this._decorations=this._editor.createDecorationsCollection(),this._updateBracketsSoon=this._register(new wt(()=>this._updateBrackets(),50)),this._matchBrackets=this._editor.getOption(80),this._updateBracketsSoon.schedule(),this._register(e.onDidChangeCursorPosition(t=>{this._matchBrackets!=="never"&&this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelContent(t=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModel(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeModelLanguageConfiguration(t=>{this._lastBracketsData=[],this._updateBracketsSoon.schedule()})),this._register(e.onDidChangeConfiguration(t=>{t.hasChanged(80)&&(this._matchBrackets=this._editor.getOption(80),this._decorations.clear(),this._lastBracketsData=[],this._lastVersionId=0,this._updateBracketsSoon.schedule())})),this._register(e.onDidBlurEditorWidget(()=>{this._updateBracketsSoon.schedule()})),this._register(e.onDidFocusEditorWidget(()=>{this._updateBracketsSoon.schedule()}))}jumpToBracket(){if(!this._editor.hasModel())return;const e=this._editor.getModel(),t=this._editor.getSelections().map(i=>{const n=i.getStartPosition(),s=e.bracketPairs.matchBracket(n);let r=null;if(s)s[0].containsPosition(n)&&!s[1].containsPosition(n)?r=s[1].getStartPosition():s[1].containsPosition(n)&&(r=s[0].getStartPosition());else{const a=e.bracketPairs.findEnclosingBrackets(n);if(a)r=a[1].getStartPosition();else{const l=e.bracketPairs.findNextBracket(n);l&&l.range&&(r=l.range.getStartPosition())}}return r?new ce(r.lineNumber,r.column,r.lineNumber,r.column):new ce(n.lineNumber,n.column,n.lineNumber,n.column)});this._editor.setSelections(t),this._editor.revealRange(t[0])}selectToBracket(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=[];this._editor.getSelections().forEach(n=>{const s=n.getStartPosition();let r=t.bracketPairs.matchBracket(s);if(!r&&(r=t.bracketPairs.findEnclosingBrackets(s),!r)){const c=t.bracketPairs.findNextBracket(s);c&&c.range&&(r=t.bracketPairs.matchBracket(c.range.getStartPosition()))}let a=null,l=null;if(r){r.sort(k.compareRangesUsingStarts);const[c,d]=r;if(a=e?c.getStartPosition():c.getEndPosition(),l=e?d.getEndPosition():d.getStartPosition(),d.containsPosition(s)){const h=a;a=l,l=h}}a&&l&&i.push(new ce(a.lineNumber,a.column,l.lineNumber,l.column))}),i.length>0&&(this._editor.setSelections(i),this._editor.revealRange(i[0]))}removeBrackets(e){if(!this._editor.hasModel())return;const t=this._editor.getModel();this._editor.getSelections().forEach(i=>{const n=i.getPosition();let s=t.bracketPairs.matchBracket(n);s||(s=t.bracketPairs.findEnclosingBrackets(n)),s&&(this._editor.pushUndoStop(),this._editor.executeEdits(e,[{range:s[0],text:""},{range:s[1],text:""}]),this._editor.pushUndoStop())})}_updateBrackets(){if(this._matchBrackets==="never")return;this._recomputeBrackets();const e=[];let t=0;for(const i of this._lastBracketsData){const n=i.brackets;n&&(e[t++]={range:n[0],options:i.options},e[t++]={range:n[1],options:i.options})}this._decorations.set(e)}_recomputeBrackets(){if(!this._editor.hasModel()||!this._editor.hasWidgetFocus()){this._lastBracketsData=[],this._lastVersionId=0;return}const e=this._editor.getSelections();if(e.length>100){this._lastBracketsData=[],this._lastVersionId=0;return}const t=this._editor.getModel(),i=t.getVersionId();let n=[];this._lastVersionId===i&&(n=this._lastBracketsData);const s=[];let r=0;for(let h=0,u=e.length;h<u;h++){const f=e[h];f.isEmpty()&&(s[r++]=f.getStartPosition())}s.length>1&&s.sort(M.compare);const a=[];let l=0,c=0;const d=n.length;for(let h=0,u=s.length;h<u;h++){const f=s[h];for(;c<d&&n[c].position.isBefore(f);)c++;if(c<d&&n[c].position.equals(f))a[l++]=n[c];else{let g=t.bracketPairs.matchBracket(f,20),m=xu._DECORATION_OPTIONS_WITH_OVERVIEW_RULER;!g&&this._matchBrackets==="always"&&(g=t.bracketPairs.findEnclosingBrackets(f,20),m=xu._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER),a[l++]=new Sve(f,g,m)}}this._lastBracketsData=a,this._lastVersionId=i}};xu.ID="editor.contrib.bracketMatchingController",xu._DECORATION_OPTIONS_WITH_OVERVIEW_RULER=Te.register({description:"bracket-match-overview",stickiness:1,className:"bracket-match",overviewRuler:{color:ci(bve),position:Ao.Center}}),xu._DECORATION_OPTIONS_WITHOUT_OVERVIEW_RULER=Te.register({description:"bracket-match-no-overview",stickiness:1,className:"bracket-match"});let yg=xu;Qe(yg.ID,yg,1),ne(vve),ne(Cve),ne(wve),an.appendMenuItem(de.MenubarGoMenu,{group:"5_infile_nav",command:{id:"editor.action.jumpToBracket",title:p(801,"Go to &&Bracket")},order:2});class yve{constructor(e,t){this._selection=e,this._isMovingLeft=t}getEditOperations(e,t){if(this._selection.startLineNumber!==this._selection.endLineNumber||this._selection.isEmpty())return;const i=this._selection.startLineNumber,n=this._selection.startColumn,s=this._selection.endColumn;if(!(this._isMovingLeft&&n===1)&&!(!this._isMovingLeft&&s===e.getLineMaxColumn(i)))if(this._isMovingLeft){const r=new k(i,n-1,i,n),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,s,i,s),a)}else{const r=new k(i,s,i,s+1),a=e.getValueInRange(r);t.addEditOperation(r,null),t.addEditOperation(new k(i,n,i,n),a)}}computeCursorState(e,t){return this._isMovingLeft?new ce(this._selection.startLineNumber,this._selection.startColumn-1,this._selection.endLineNumber,this._selection.endColumn-1):new ce(this._selection.startLineNumber,this._selection.startColumn+1,this._selection.endLineNumber,this._selection.endColumn+1)}}class SK extends le{constructor(e,t){super(t),this.left=e}run(e,t){if(!t.hasModel())return;const i=[],n=t.getSelections();for(const s of n)i.push(new yve(s,this.left));t.pushUndoStop(),t.executeCommands(this.id,i),t.pushUndoStop()}}class Lve extends SK{constructor(){super(!0,{id:"editor.action.moveCarretLeftAction",label:H(806,"Move Selected Text Left"),precondition:T.writable})}}class xve extends SK{constructor(){super(!1,{id:"editor.action.moveCarretRightAction",label:H(807,"Move Selected Text Right"),precondition:T.writable})}}ne(Lve),ne(xve);class kve extends le{constructor(){super({id:"editor.action.transposeLetters",label:H(808,"Transpose Letters"),precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:306},weight:100}})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=[],s=t.getSelections();for(const r of s){if(!r.isEmpty())continue;const a=r.startLineNumber,l=r.startColumn,c=i.getLineMaxColumn(a);if(a===1&&(l===1||l===2&&c===2))continue;const d=l===c?r.getPosition():ht.rightPosition(i,r.getPosition().lineNumber,r.getPosition().column),h=ht.leftPosition(i,d),u=ht.leftPosition(i,h),f=i.getValueInRange(k.fromPositions(u,h)),g=i.getValueInRange(k.fromPositions(h,d)),m=k.fromPositions(u,d);n.push(new Dn(m,g+f))}n.length>0&&(t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop())}}ne(kve);const Ive=We("productService");function UO(o,e){return{id:e,asString:async()=>o,asFile:()=>{},value:typeof o=="string"?o:void 0}}function Dve(o,e,t,i){const n={id:Of(),name:o,uri:e,data:t};return{id:i,asString:async()=>"",asFile:()=>n,value:void 0}}class yK{constructor(){this._entries=new Map}get size(){let e=0;for(const t of this._entries)e++;return e}has(e){return this._entries.has(this.toKey(e))}matches(e){const t=[...this._entries.keys()];return Ye.some(this,([i,n])=>n.asFile())&&t.push("files"),xK(Lk(e),t)}get(e){return this._entries.get(this.toKey(e))?.[0]}append(e,t){const i=this._entries.get(e);i?i.push(t):this._entries.set(this.toKey(e),[t])}replace(e,t){this._entries.set(this.toKey(e),[t])}delete(e){this._entries.delete(this.toKey(e))}*[Symbol.iterator](){for(const[e,t]of this._entries)for(const i of t)yield[e,i]}toKey(e){return Lk(e)}}function Lk(o){return o.toLowerCase()}function LK(o,e){return xK(Lk(o),e.map(Lk))}function xK(o,e){if(o==="*/*")return e.length>0;if(e.includes(o))return!0;const t=o.match(/^([a-z]+)\/([a-z]+|\*)$/i);if(!t)return!1;const[i,n,s]=t;return s==="*"?e.some(r=>r.startsWith(n+"/")):!1}const xk=Object.freeze({create:o=>Dc(o.map(e=>e.toString())).join(`\r
`),split:o=>o.split(`\r
`),parse:o=>xk.split(o).filter(e=>!e.startsWith("#"))}),hc=class hc{constructor(e){this.value=e}equals(e){return this.value===e.value}contains(e){return this.equals(e)||this.value===""||e.value.startsWith(this.value+hc.sep)}intersects(e){return this.contains(e)||e.contains(this)}append(...e){return new hc((this.value?[this.value,...e]:e).join(hc.sep))}};hc.sep=".",hc.None=new hc("@@none@@"),hc.Empty=new hc("");let si=hc;const Eve={ctrlCmd:!1,alt:!1};var Sw;(function(o){o[o.Blur=1]="Blur",o[o.Gesture=2]="Gesture",o[o.Other=3]="Other"})(Sw||(Sw={}));var Ha;(function(o){o[o.NONE=0]="NONE",o[o.FIRST=1]="FIRST",o[o.SECOND=2]="SECOND",o[o.LAST=3]="LAST"})(Ha||(Ha={}));var Bt;(function(o){o[o.First=1]="First",o[o.Second=2]="Second",o[o.Last=3]="Last",o[o.Next=4]="Next",o[o.Previous=5]="Previous",o[o.NextPage=6]="NextPage",o[o.PreviousPage=7]="PreviousPage",o[o.NextSeparator=8]="NextSeparator",o[o.PreviousSeparator=9]="PreviousSeparator"})(Bt||(Bt={}));var kk;(function(o){o[o.Title=1]="Title",o[o.Inline=2]="Inline"})(kk||(kk={}));const Zn=We("quickInputService"),kK={EDITORS:"CodeEditors",FILES:"CodeFiles"};class Nve{}const Tve={DragAndDropContribution:"workbench.contributions.dragAndDrop"};ei.add(Tve.DragAndDropContribution,new Nve);const NS=class NS{constructor(){}static getInstance(){return NS.INSTANCE}hasData(e){return e&&e===this.proto}getData(e){if(this.hasData(e))return this.data}};NS.INSTANCE=new NS;let $O=NS;function IK(o){if(ma&&typeof globalThis.vscode?.webUtils?.getPathForFile=="function")return globalThis.vscode.webUtils.getPathForFile(o)}function DK(o){const e=new yK;for(const t of o.items){const i=t.type;if(t.kind==="string"){const n=new Promise(s=>t.getAsString(s));e.append(i,UO(n))}else if(t.kind==="file"){const n=t.getAsFile();n&&e.append(i,Rve(n))}}return e}function Rve(o){const e=IK(o),t=e?be.parse(e):void 0;return Dve(o.name,t,async()=>new Uint8Array(await o.arrayBuffer()))}const Mve=Object.freeze([kK.EDITORS,kK.FILES,og.RESOURCES,og.INTERNAL_URI_LIST]);function EK(o,e=!1){const t=DK(o),i=t.get(og.INTERNAL_URI_LIST);if(i)t.replace(_i.uriList,i);else if(e||!t.has(_i.uriList)){const n=[];for(const s of o.items){const r=s.getAsFile();if(r){const a=IK(r);try{a?n.push(be.file(a).toString()):n.push(be.parse(r.name,!0).toString())}catch{}}}n.length&&t.replace(_i.uriList,UO(xk.create(n)))}for(const n of Mve)t.delete(n);return t}const yw=We("IWorkspaceEditService");class jO{constructor(e){this.metadata=e}static convert(e){return e.edits.map(t=>{if(jh.is(t))return jh.lift(t);if(J_.is(t))return J_.lift(t);throw new Error("Unsupported edit")})}}class jh extends jO{static is(e){return e instanceof jh?!0:nn(e)&&be.isUri(e.resource)&&nn(e.textEdit)}static lift(e){return e instanceof jh?e:new jh(e.resource,e.textEdit,e.versionId,e.metadata)}constructor(e,t,i=void 0,n){super(n),this.resource=e,this.textEdit=t,this.versionId=i}}class J_ extends jO{static is(e){return e instanceof J_?!0:nn(e)&&(!!e.newResource||!!e.oldResource)}static lift(e){return e instanceof J_?e:new J_(e.oldResource,e.newResource,e.options,e.metadata)}constructor(e,t,i={},n){super(n),this.oldResource=e,this.newResource=t,this.options=i}}const qO=We("IEditorCancelService"),NK=new ae("cancellableOperation",!1,p(934,"Whether the editor runs a cancellable operation, e.g. like 'Peek References'"));je(qO,class{constructor(){this._tokens=new WeakMap}add(o,e){let t=this._tokens.get(o);t||(t=o.invokeWithinContext(n=>{const s=NK.bindTo(n.get(xe)),r=new Jn;return{key:s,tokens:r}}),this._tokens.set(o,t));let i;return t.key.set(!0),i=t.tokens.push(e),()=>{i&&(i(),t.key.set(!t.tokens.isEmpty()),i=void 0)}}cancel(o){const e=this._tokens.get(o);if(!e)return;const t=e.tokens.pop();t&&(t.cancel(),e.key.set(!e.tokens.isEmpty()))}},1);class Pve extends Xt{constructor(e,t){super(t),this.editor=e,this._unregister=e.invokeWithinContext(i=>i.get(qO).add(e,this))}dispose(){this._unregister(),super.dispose()}}re(new class extends Bi{constructor(){super({id:"editor.cancelOperation",kbOpts:{weight:100,primary:9},precondition:NK})}runEditorCommand(o,e){o.get(qO).cancel(e)}});let TK=class kB{constructor(e,t){if(this.flags=t,(this.flags&1)!==0){const i=e.getModel();this.modelVersionId=i?tf("{0}#{1}",i.uri.toString(),i.getVersionId()):null}else this.modelVersionId=null;(this.flags&4)!==0?this.position=e.getPosition():this.position=null,(this.flags&2)!==0?this.selection=e.getSelection():this.selection=null,(this.flags&8)!==0?(this.scrollLeft=e.getScrollLeft(),this.scrollTop=e.getScrollTop()):(this.scrollLeft=-1,this.scrollTop=-1)}_equals(e){if(!(e instanceof kB))return!1;const t=e;return!(this.modelVersionId!==t.modelVersionId||this.scrollLeft!==t.scrollLeft||this.scrollTop!==t.scrollTop||!this.position&&t.position||this.position&&!t.position||this.position&&t.position&&!this.position.equals(t.position)||!this.selection&&t.selection||this.selection&&!t.selection||this.selection&&t.selection&&!this.selection.equalsRange(t.selection))}validate(e){return this._equals(new kB(e,this.flags))}};class ud extends Pve{constructor(e,t,i,n){super(e,n),this._listener=new U,t&4&&this._listener.add(e.onDidChangeCursorPosition(s=>{(!i||!k.containsPosition(i,s.position))&&this.cancel()})),t&2&&this._listener.add(e.onDidChangeCursorSelection(s=>{(!i||!k.containsRange(i,s.selection))&&this.cancel()})),t&8&&this._listener.add(e.onDidScrollChange(s=>this.cancel())),t&1&&(this._listener.add(e.onDidChangeModel(s=>this.cancel())),this._listener.add(e.onDidChangeModelContent(s=>this.cancel())))}dispose(){this._listener.dispose(),super.dispose()}}class KO extends Xt{constructor(e,t){super(t),this._listener=e.onDidChangeContent(()=>this.cancel())}dispose(){this._listener.dispose(),super.dispose()}}var Ave=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ove=function(o,e){return function(t,i){e(t,i,o)}};const Fve=Te.register({description:"inline-progress-widget",stickiness:1,showIfCollapsed:!0,after:{content:r6,inlineClassName:"inline-editor-progress-decoration",inlineClassNameAffectsLetterSpacing:!0}}),EN=class EN extends A{constructor(e,t,i,n,s){super(),this.typeId=e,this.editor=t,this.range=i,this.delegate=s,this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this.create(n),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this)}create(e){this.domNode=Q(".inline-progress-widget"),this.domNode.role="button",this.domNode.title=e;const t=Q("span.icon");this.domNode.append(t),t.classList.add(...ve.asClassNameArray(Y.loading),"codicon-modifier-spin");const i=()=>{const n=this.editor.getOption(75);this.domNode.style.height=`${n}px`,this.domNode.style.width=`${Math.ceil(.8*n)}px`};i(),this._register(this.editor.onDidChangeConfiguration(n=>{(n.hasChanged(61)||n.hasChanged(75))&&i()})),this._register(W(this.domNode,te.CLICK,n=>{this.delegate.cancel()}))}getId(){return EN.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:{lineNumber:this.range.startLineNumber,column:this.range.startColumn},preference:[0]}}dispose(){super.dispose(),this.editor.removeContentWidget(this)}};EN.baseId="editor.widget.inlineProgressWidget";let GO=EN,Ik=class extends A{constructor(e,t,i){super(),this.id=e,this._editor=t,this._instantiationService=i,this._showDelay=500,this._showPromise=this._register(new ct),this._currentWidget=this._register(new ct),this._operationIdPool=0,this._currentDecorations=t.createDecorationsCollection()}dispose(){super.dispose(),this._currentDecorations.clear()}async showWhile(e,t,i,n,s){const r=this._operationIdPool++;this._currentOperation=r,this.clear(),this._showPromise.value=yc(()=>{const a=k.fromPositions(e);this._currentDecorations.set([{range:a,options:Fve}]).length>0&&(this._currentWidget.value=this._instantiationService.createInstance(GO,this.id,this._editor,a,t,n))},s??this._showDelay);try{return await i}finally{this._currentOperation===r&&(this.clear(),this._currentOperation=void 0)}}clear(){this._showPromise.clear(),this._currentDecorations.clear(),this._currentWidget.clear()}};Ik=Ave([Ove(2,ge)],Ik);const Js=We("openerService");function Wve(o,e){return o.with({fragment:`${e.startLineNumber},${e.startColumn}${e.endLineNumber?`-${e.endLineNumber}${e.endColumn?`,${e.endColumn}`:""}`:""}`})}function Bve(o){let e;const t=/^L?(\d+)(?:,(\d+))?(-L?(\d+)(?:,(\d+))?)?/.exec(o.fragment);return t&&(e={startLineNumber:parseInt(t[1]),startColumn:t[2]?parseInt(t[2]):1,endLineNumber:t[4]?parseInt(t[4]):void 0,endColumn:t[4]?t[5]?parseInt(t[5]):1:void 0},o=o.with({fragment:""})),{selection:e,uri:o}}var Hve=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RK=function(o,e){return function(t,i){e(t,i,o)}},ZO;let fd=(Tp=class{constructor(e,t,i){this._options=e,this._languageService=t,this._openerService=i}render(e,t,i){const n=iw(e,{codeBlockRenderer:(s,r)=>this.renderCodeBlock(s,r),actionHandler:(s,r)=>this.openMarkdownLink(s,r),...t},i);return n.element.classList.add("rendered-markdown"),n}async renderCodeBlock(e,t){let i;e?i=this._languageService.getLanguageIdByLanguageName(e):this._options.editor&&(i=this._options.editor.getModel()?.getLanguageId()),i||(i=Fo);const n=await jpe(this._languageService,t,i),s=document.createElement("span");if(s.innerHTML=ZO._ttpTokenizer?.createHTML(n)??n,this._options.editor){const r=this._options.editor.getOption(59);dn(s,r)}else this._options.codeBlockFontFamily&&(s.style.fontFamily=this._options.codeBlockFontFamily);return this._options.codeBlockFontSize!==void 0&&(s.style.fontSize=this._options.codeBlockFontSize),s}async openMarkdownLink(e,t){await YO(this._openerService,e,t.isTrusted)}},ZO=Tp,Tp._ttpTokenizer=Sl("tokenizeToString",{createHTML(e){return e}}),Tp);fd=ZO=Hve([RK(1,Mt),RK(2,Js)],fd);async function YO(o,e,t,i){try{return await o.open(e,{fromUserGesture:!0,allowContributedOpeners:!0,allowCommands:Vve(t),skipValidation:i})}catch(n){return Ee(n),!1}}function Vve(o){return o===!0?!0:o&&Array.isArray(o.enabledCommands)?o.enabledCommands:!1}var zve=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},MK=function(o,e){return function(t,i){e(t,i,o)}},Dk;let So=(ku=class{static get(e){return e.getContribution(Dk.ID)}constructor(e,t,i){this._openerService=i,this._messageWidget=new ct,this._messageListeners=new U,this._mouseOverMessage=!1,this._editor=e,this._visible=Dk.MESSAGE_VISIBLE.bindTo(t)}dispose(){this._messageListeners.dispose(),this._messageWidget.dispose(),this._visible.reset()}showMessage(e,t){if(ps(Rl(e)?e.value:e),this._visible.set(!0),this._messageWidget.clear(),this._messageListeners.clear(),Rl(e)){const n=this._messageListeners.add(iw(e,{actionHandler:(s,r)=>{this.closeMessage(),YO(this._openerService,s,r.isTrusted)}}));this._messageWidget.value=new XO(this._editor,t,n.element)}else this._messageWidget.value=new XO(this._editor,t,e);this._messageListeners.add(ie.debounce(this._editor.onDidBlurEditorText,(n,s)=>s,0)(()=>{this._mouseOverMessage||this._messageWidget.value&&Zi(Ui(),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(W(this._messageWidget.value.getDomNode(),te.MOUSE_ENTER,()=>this._mouseOverMessage=!0,!0)),this._messageListeners.add(W(this._messageWidget.value.getDomNode(),te.MOUSE_LEAVE,()=>this._mouseOverMessage=!1,!0));let i;this._messageListeners.add(this._editor.onMouseMove(n=>{n.target.position&&(i?i.containsPosition(n.target.position)||this.closeMessage():i=new k(t.lineNumber-3,1,n.target.position.lineNumber+3,1))}))}closeMessage(){this._visible.reset(),this._messageListeners.clear(),this._messageWidget.value&&this._messageListeners.add(XO.fadeOut(this._messageWidget.value))}},Dk=ku,ku.ID="editor.contrib.messageController",ku.MESSAGE_VISIBLE=new ae("messageVisible",!1,p(1277,"Whether the editor is currently showing an inline message")),ku);So=Dk=zve([MK(1,xe),MK(2,Js)],So);const Uve=Bi.bindToContribution(So.get);re(new Uve({id:"leaveEditorMessage",precondition:So.MESSAGE_VISIBLE,handler:o=>o.closeMessage(),kbOpts:{weight:130,primary:9}}));let XO=class{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 r=document.createElement("div");typeof n=="string"?(r.classList.add("message"),r.textContent=n):(n.classList.add("message"),r.appendChild(n)),this._domNode.appendChild(r);const a=document.createElement("div");a.classList.add("anchor","below"),this._domNode.appendChild(a),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",e===2)}};Qe(So.ID,So,4);class $ve{constructor(){this._value="",this._pos=0}reset(e){return this._value=e,this._pos=0,this}next(){return this._pos+=1,this}hasNext(){return this._pos<this._value.length-1}cmp(e){const t=e.charCodeAt(0),i=this._value.charCodeAt(this._pos);return t-i}value(){return this._value[this._pos]}}class jve{constructor(e=!0){this._caseSensitive=e}reset(e){return this._value=e,this._from=0,this._to=0,this.next()}hasNext(){return this._to<this._value.length}next(){this._from=this._to;let e=!0;for(;this._to<this._value.length;this._to++)if(this._value.charCodeAt(this._to)===46)if(e)this._from++;else break;else e=!1;return this}cmp(e){return this._caseSensitive?pR(e,this._value,0,e.length,this._from,this._to):l1(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class qve{constructor(e=!0,t=!0){this._splitOnBackslash=e,this._caseSensitive=t}reset(e){this._from=0,this._to=0,this._value=e,this._valueLen=e.length;for(let t=e.length-1;t>=0;t--,this._valueLen--){const i=this._value.charCodeAt(t);if(!(i===47||this._splitOnBackslash&&i===92))break}return this.next()}hasNext(){return this._to<this._valueLen}next(){this._from=this._to;let e=!0;for(;this._to<this._valueLen;this._to++){const t=this._value.charCodeAt(this._to);if(t===47||this._splitOnBackslash&&t===92)if(e)this._from++;else break;else e=!1}return this}cmp(e){return this._caseSensitive?pR(e,this._value,0,e.length,this._from,this._to):l1(e,this._value,0,e.length,this._from,this._to)}value(){return this._value.substring(this._from,this._to)}}class Kve{constructor(e,t){this._ignorePathCasing=e,this._ignoreQueryAndFragment=t,this._states=[],this._stateIdx=0}reset(e){return this._value=e,this._states=[],this._value.scheme&&this._states.push(1),this._value.authority&&this._states.push(2),this._value.path&&(this._pathIterator=new qve(!1,!this._ignorePathCasing(e)),this._pathIterator.reset(e.path),this._pathIterator.value()&&this._states.push(3)),this._ignoreQueryAndFragment(e)||(this._value.query&&this._states.push(4),this._value.fragment&&this._states.push(5)),this._stateIdx=0,this}next(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()?this._pathIterator.next():this._stateIdx+=1,this}hasNext(){return this._states[this._stateIdx]===3&&this._pathIterator.hasNext()||this._stateIdx<this._states.length-1}cmp(e){if(this._states[this._stateIdx]===1)return mR(e,this._value.scheme);if(this._states[this._stateIdx]===2)return mR(e,this._value.authority);if(this._states[this._stateIdx]===3)return this._pathIterator.cmp(e);if(this._states[this._stateIdx]===4)return a1(e,this._value.query);if(this._states[this._stateIdx]===5)return a1(e,this._value.fragment);throw new Error}value(){if(this._states[this._stateIdx]===1)return this._value.scheme;if(this._states[this._stateIdx]===2)return this._value.authority;if(this._states[this._stateIdx]===3)return this._pathIterator.value();if(this._states[this._stateIdx]===4)return this._value.query;if(this._states[this._stateIdx]===5)return this._value.fragment;throw new Error}}const TS=class TS{static wrap(e){return e===void 0?TS.Val:e}static unwrap(e){return e===TS.Val?void 0:e}};TS.Val=Symbol("undefined_placeholder");let gd=TS;class Ek{constructor(){this.height=1,this.value=void 0,this.key=void 0,this.left=void 0,this.mid=void 0,this.right=void 0}rotateLeft(){const e=this.right;return this.right=e.left,e.left=this,this.updateHeight(),e.updateHeight(),e}rotateRight(){const e=this.left;return this.left=e.right,e.right=this,this.updateHeight(),e.updateHeight(),e}updateHeight(){this.height=1+Math.max(this.heightLeft,this.heightRight)}balanceFactor(){return this.heightRight-this.heightLeft}get heightLeft(){return this.left?.height??0}get heightRight(){return this.right?.height??0}}class eb{static forUris(e=()=>!1,t=()=>!1){return new eb(new Kve(e,t))}static forStrings(){return new eb(new $ve)}static forConfigKeys(){return new eb(new jve)}constructor(e){this._iter=e}clear(){this._root=void 0}set(e,t){const i=this._iter.reset(e);let n;this._root||(this._root=new Ek,this._root.segment=i.value());const s=[];for(n=this._root;;){const a=i.cmp(n.segment);if(a>0)n.left||(n.left=new Ek,n.left.segment=i.value()),s.push([-1,n]),n=n.left;else if(a<0)n.right||(n.right=new Ek,n.right.segment=i.value()),s.push([1,n]),n=n.right;else if(i.hasNext())i.next(),n.mid||(n.mid=new Ek,n.mid.segment=i.value()),s.push([0,n]),n=n.mid;else break}const r=gd.unwrap(n.value);n.value=gd.wrap(t),n.key=e;for(let a=s.length-1;a>=0;a--){const l=s[a][1];l.updateHeight();const c=l.balanceFactor();if(c<-1||c>1){const d=s[a][0],h=s[a+1][0];if(d===1&&h===1)s[a][1]=l.rotateLeft();else if(d===-1&&h===-1)s[a][1]=l.rotateRight();else if(d===1&&h===-1)l.right=s[a+1][1]=s[a+1][1].rotateRight(),s[a][1]=l.rotateLeft();else if(d===-1&&h===1)l.left=s[a+1][1]=s[a+1][1].rotateLeft(),s[a][1]=l.rotateRight();else throw new Error;if(a>0)switch(s[a-1][0]){case-1:s[a-1][1].left=s[a][1];break;case 1:s[a-1][1].right=s[a][1];break;case 0:s[a-1][1].mid=s[a][1];break}else this._root=s[0][1]}}return r}get(e){return gd.unwrap(this._getNode(e)?.value)}_getNode(e){const t=this._iter.reset(e);let i=this._root;for(;i;){const n=t.cmp(i.segment);if(n>0)i=i.left;else if(n<0)i=i.right;else if(t.hasNext())t.next(),i=i.mid;else break}return i}has(e){const t=this._getNode(e);return!(t?.value===void 0&&t?.mid===void 0)}delete(e){return this._delete(e,!1)}deleteSuperstr(e){return this._delete(e,!0)}_delete(e,t){const i=this._iter.reset(e),n=[];let s=this._root;for(;s;){const r=i.cmp(s.segment);if(r>0)n.push([-1,s]),s=s.left;else if(r<0)n.push([1,s]),s=s.right;else if(i.hasNext())i.next(),n.push([0,s]),s=s.mid;else break}if(s){if(t?(s.left=void 0,s.mid=void 0,s.right=void 0,s.height=1):(s.key=void 0,s.value=void 0),!s.mid&&!s.value)if(s.left&&s.right){const r=[[1,s]],a=this._min(s.right,r);if(a.key){s.key=a.key,s.value=a.value,s.segment=a.segment;const l=a.right;if(r.length>1){const[d,h]=r[r.length-1];switch(d){case-1:h.left=l;break;case 0:YC(!1);case 1:YC(!1)}}else s.right=l;const c=this._balanceByStack(r);if(n.length>0){const[d,h]=n[n.length-1];switch(d){case-1:h.left=c;break;case 0:h.mid=c;break;case 1:h.right=c;break}}else this._root=c}}else{const r=s.left??s.right;if(n.length>0){const[a,l]=n[n.length-1];switch(a){case-1:l.left=r;break;case 0:l.mid=r;break;case 1:l.right=r;break}}else this._root=r}this._root=this._balanceByStack(n)??this._root}}_min(e,t){for(;e.left;)t.push([-1,e]),e=e.left;return e}_balanceByStack(e){for(let t=e.length-1;t>=0;t--){const i=e[t][1];i.updateHeight();const n=i.balanceFactor();if(n>1?(i.right.balanceFactor()>=0||(i.right=i.right.rotateRight()),e[t][1]=i.rotateLeft()):n<-1&&(i.left.balanceFactor()<=0||(i.left=i.left.rotateLeft()),e[t][1]=i.rotateRight()),t>0)switch(e[t-1][0]){case-1:e[t-1][1].left=e[t][1];break;case 1:e[t-1][1].right=e[t][1];break;case 0:e[t-1][1].mid=e[t][1];break}else return e[0][1]}}findSubstr(e){const t=this._iter.reset(e);let i=this._root,n;for(;i;){const s=t.cmp(i.segment);if(s>0)i=i.left;else if(s<0)i=i.right;else if(t.hasNext())t.next(),n=gd.unwrap(i.value)||n,i=i.mid;else break}return i&&gd.unwrap(i.value)||n}findSuperstr(e){return this._findSuperstrOrElement(e,!1)}_findSuperstrOrElement(e,t){const i=this._iter.reset(e);let n=this._root;for(;n;){const s=i.cmp(n.segment);if(s>0)n=n.left;else if(s<0)n=n.right;else if(i.hasNext())i.next(),n=n.mid;else return n.mid?this._entries(n.mid):t?gd.unwrap(n.value):void 0}}forEach(e){for(const[t,i]of this)e(i,t)}*[Symbol.iterator](){yield*this._entries(this._root)}_entries(e){const t=[];return this._dfsEntries(e,t),t[Symbol.iterator]()}_dfsEntries(e,t){e&&(e.left&&this._dfsEntries(e.left,t),e.value!==void 0&&t.push([e.key,gd.unwrap(e.value)]),e.mid&&this._dfsEntries(e.mid,t),e.right&&this._dfsEntries(e.right,t))}}const pd=We("contextService");function QO(o){const e=o;return typeof e?.id=="string"&&be.isUri(e.uri)}function Gve(o){return typeof o?.id=="string"&&!QO(o)&&!Xve(o)}const Zve={id:"empty-window"};function Yve(o,e){if(typeof o=="string"||typeof o>"u")return typeof o=="string"?{id:nh(o)}:Zve;const t=o;return t.configuration?{id:t.id,configPath:t.configuration}:t.folders.length===1?{id:t.id,uri:t.folders[0].uri}:{id:t.id}}function Xve(o){const e=o;return typeof e?.id=="string"&&be.isUri(e.configPath)}class Qve{constructor(e,t){this.raw=t,this.uri=e.uri,this.index=e.index,this.name=e.name}toJSON(){return{uri:this.uri,name:this.name,index:this.index}}}const JO="code-workspace";p(2032,"Code Workspace");const PK="4064f6ec-cb38-4ad0-af64-ee6467e63c82";function Jve(o){return o.id===PK}var e4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Lw=function(o,e){return function(t,i){e(t,i,o)}};class t4{constructor(e){this.copyMimeTypes=[],this.kind=e,this.providedDropEditKinds=[this.kind],this.providedPasteEditKinds=[this.kind]}async provideDocumentPasteEdits(e,t,i,n,s){const r=await this.getEdit(i,s);if(r)return{edits:[{insertText:r.insertText,title:r.title,kind:r.kind,handledMimeType:r.handledMimeType,yieldTo:r.yieldTo}],dispose(){}}}async provideDocumentDropEdits(e,t,i,n){const s=await this.getEdit(i,n);if(s)return{edits:[{insertText:s.insertText,title:s.title,kind:s.kind,handledMimeType:s.handledMimeType,yieldTo:s.yieldTo}],dispose(){}}}}const NN=class NN extends t4{constructor(){super(si.Empty.append("text","plain")),this.id=NN.id,this.dropMimeTypes=[_i.text],this.pasteMimeTypes=[_i.text]}async getEdit(e,t){const i=e.get(_i.text);if(!i||e.has(_i.uriList))return;const n=await i.asString();return{handledMimeType:_i.text,title:p(921,"Insert Plain Text"),insertText:n,kind:this.kind}}};NN.id="text";let Lg=NN;class AK extends t4{constructor(){super(si.Empty.append("uri","path","absolute")),this.dropMimeTypes=[_i.uriList],this.pasteMimeTypes=[_i.uriList]}async getEdit(e,t){const i=await OK(e);if(!i.length||t.isCancellationRequested)return;let n=0;const s=i.map(({uri:a,originalText:l})=>a.scheme===we.file?a.fsPath:(n++,l)).join(" ");let r;return n>0?r=i.length>1?p(922,"Insert Uris"):p(923,"Insert Uri"):r=i.length>1?p(924,"Insert Paths"):p(925,"Insert Path"),{handledMimeType:_i.uriList,insertText:s,title:r,kind:this.kind}}}let Nk=class extends t4{constructor(e){super(si.Empty.append("uri","path","relative")),this._workspaceContextService=e,this.dropMimeTypes=[_i.uriList],this.pasteMimeTypes=[_i.uriList]}async getEdit(e,t){const i=await OK(e);if(!i.length||t.isCancellationRequested)return;const n=wa(i.map(({uri:s})=>{const r=this._workspaceContextService.getWorkspaceFolder(s);return r?Yse(r.uri,s):void 0}));if(n.length)return{handledMimeType:_i.uriList,insertText:n.join(" "),title:i.length>1?p(926,"Insert Relative Paths"):p(927,"Insert Relative Path"),kind:this.kind}}};Nk=e4([Lw(0,pd)],Nk);class ewe{constructor(){this.kind=new si("html"),this.providedPasteEditKinds=[this.kind],this.copyMimeTypes=[],this.pasteMimeTypes=["text/html"],this._yieldTo=[{mimeType:_i.text}]}async provideDocumentPasteEdits(e,t,i,n,s){if(n.triggerKind!==av.PasteAs&&!n.only?.contains(this.kind))return;const a=await i.get("text/html")?.asString();if(!(!a||s.isCancellationRequested))return{dispose(){},edits:[{insertText:a,yieldTo:this._yieldTo,title:p(928,"Insert HTML"),kind:this.kind}]}}}async function OK(o){const e=o.get(_i.uriList);if(!e)return[];const t=await e.asString(),i=[];for(const n of xk.parse(t))try{i.push({uri:be.parse(n),originalText:n})}catch{}return i}const xg={scheme:"*",hasAccessToAllModels:!0};let i4=class extends A{constructor(e,t){super(),this._register(e.documentDropEditProvider.register(xg,new Lg)),this._register(e.documentDropEditProvider.register(xg,new AK)),this._register(e.documentDropEditProvider.register(xg,new Nk(t)))}};i4=e4([Lw(0,he),Lw(1,pd)],i4);let n4=class extends A{constructor(e,t){super(),this._register(e.documentPasteEditProvider.register(xg,new Lg)),this._register(e.documentPasteEditProvider.register(xg,new AK)),this._register(e.documentPasteEditProvider.register(xg,new Nk(t))),this._register(e.documentPasteEditProvider.register(xg,new ewe))}};n4=e4([Lw(0,he),Lw(1,pd)],n4);const ua=class ua{constructor(){this.value="",this.pos=0}static isDigitCharacter(e){return e>=48&&e<=57}static isVariableCharacter(e){return e===95||e>=97&&e<=122||e>=65&&e<=90}text(e){this.value=e,this.pos=0}tokenText(e){return this.value.substr(e.pos,e.len)}next(){if(this.pos>=this.value.length)return{type:14,pos:this.pos,len:0};const e=this.pos;let t=0,i=this.value.charCodeAt(e),n;if(n=ua._table[i],typeof n=="number")return this.pos+=1,{type:n,pos:e,len:1};if(ua.isDigitCharacter(i)){n=8;do t+=1,i=this.value.charCodeAt(e+t);while(ua.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}if(ua.isVariableCharacter(i)){n=9;do i=this.value.charCodeAt(e+ ++t);while(ua.isVariableCharacter(i)||ua.isDigitCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}n=10;do t+=1,i=this.value.charCodeAt(e+t);while(!isNaN(i)&&typeof ua._table[i]>"u"&&!ua.isDigitCharacter(i)&&!ua.isVariableCharacter(i));return this.pos+=t,{type:n,pos:e,len:t}}};ua._table={36:0,58:1,44:2,123:3,125:4,92:5,47:6,124:7,43:11,45:12,63:13};let s4=ua;class tb{constructor(){this._children=[]}appendChild(e){return e instanceof Ts&&this._children[this._children.length-1]instanceof Ts?this._children[this._children.length-1].value+=e.value:(e.parent=this,this._children.push(e)),this}replace(e,t){const{parent:i}=e,n=i.children.indexOf(e),s=i.children.slice(0);s.splice(n,1,...t),i._children=s,(function r(a,l){for(const c of a)c.parent=l,r(c.children,c)})(t,i)}get children(){return this._children}get rightMostDescendant(){return this._children.length>0?this._children[this._children.length-1].rightMostDescendant:this}get snippet(){let e=this;for(;;){if(!e)return;if(e instanceof kw)return e;e=e.parent}}toString(){return this.children.reduce((e,t)=>e+t.toString(),"")}len(){return 0}}class Ts extends tb{constructor(e){super(),this.value=e}toString(){return this.value}len(){return this.value.length}clone(){return new Ts(this.value)}}class FK extends tb{}class Ar extends FK{static compareByIndex(e,t){return e.index===t.index?0:e.isFinalTabstop?1:t.isFinalTabstop||e.index<t.index?-1:e.index>t.index?1:0}constructor(e){super(),this.index=e}get isFinalTabstop(){return this.index===0}get choice(){return this._children.length===1&&this._children[0]instanceof ib?this._children[0]:void 0}clone(){const e=new Ar(this.index);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}class ib extends tb{constructor(){super(...arguments),this.options=[]}appendChild(e){return e instanceof Ts&&(e.parent=this,this.options.push(e)),this}toString(){return this.options[0].value}len(){return this.options[0].len()}clone(){const e=new ib;return this.options.forEach(e.appendChild,e),e}}class o4 extends tb{constructor(){super(...arguments),this.regexp=new RegExp("")}resolve(e){const t=this;let i=!1,n=e.replace(this.regexp,function(){return i=!0,t._replace(Array.prototype.slice.call(arguments,0,-2))});return!i&&this._children.some(s=>s instanceof Va&&!!s.elseValue)&&(n=this._replace([])),n}_replace(e){let t="";for(const i of this._children)if(i instanceof Va){let n=e[i.index]||"";n=i.resolve(n),t+=n}else t+=i.toString();return t}toString(){return""}clone(){const e=new o4;return e.regexp=new RegExp(this.regexp.source,(this.regexp.ignoreCase?"i":"")+(this.regexp.global?"g":"")),e._children=this.children.map(t=>t.clone()),e}}class Va extends tb{constructor(e,t,i,n){super(),this.index=e,this.shorthandName=t,this.ifValue=i,this.elseValue=n}resolve(e){return this.shorthandName==="upcase"?e?e.toLocaleUpperCase():"":this.shorthandName==="downcase"?e?e.toLocaleLowerCase():"":this.shorthandName==="capitalize"?e?e[0].toLocaleUpperCase()+e.substr(1):"":this.shorthandName==="pascalcase"?e?this._toPascalCase(e):"":this.shorthandName==="camelcase"?e?this._toCamelCase(e):"":e&&typeof this.ifValue=="string"?this.ifValue:!e&&typeof this.elseValue=="string"?this.elseValue:e||""}_toPascalCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map(i=>i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}_toCamelCase(e){const t=e.match(/[a-z0-9]+/gi);return t?t.map((i,n)=>n===0?i.charAt(0).toLowerCase()+i.substr(1):i.charAt(0).toUpperCase()+i.substr(1)).join(""):e}clone(){return new Va(this.index,this.shorthandName,this.ifValue,this.elseValue)}}class xw extends FK{constructor(e){super(),this.name=e}resolve(e){let t=e.resolve(this);return this.transform&&(t=this.transform.resolve(t||"")),t!==void 0?(this._children=[new Ts(t)],!0):!1}clone(){const e=new xw(this.name);return this.transform&&(e.transform=this.transform.clone()),e._children=this.children.map(t=>t.clone()),e}}function WK(o,e){const t=[...o];for(;t.length>0;){const i=t.shift();if(!e(i))break;t.unshift(...i.children)}}class kw extends tb{get placeholderInfo(){if(!this._placeholders){const e=[];let t;this.walk(function(i){return i instanceof Ar&&(e.push(i),t=!t||t.index<i.index?i:t),!0}),this._placeholders={all:e,last:t}}return this._placeholders}get placeholders(){const{all:e}=this.placeholderInfo;return e}offset(e){let t=0,i=!1;return this.walk(n=>n===e?(i=!0,!1):(t+=n.len(),!0)),i?t:-1}fullLen(e){let t=0;return WK([e],i=>(t+=i.len(),!0)),t}enclosingPlaceholders(e){const t=[];let{parent:i}=e;for(;i;)i instanceof Ar&&t.push(i),i=i.parent;return t}resolveVariables(e){return this.walk(t=>(t instanceof xw&&t.resolve(e)&&(this._placeholders=void 0),!0)),this}appendChild(e){return this._placeholders=void 0,super.appendChild(e)}replace(e,t){return this._placeholders=void 0,super.replace(e,t)}clone(){const e=new kw;return this._children=this.children.map(t=>t.clone()),e}walk(e){WK(this.children,e)}}class kg{constructor(){this._scanner=new s4,this._token={type:14,pos:0,len:0}}static escape(e){return e.replace(/\$|}|\\/g,"\\$&")}static guessNeedsClipboard(e){return/\${?CLIPBOARD/.test(e)}parse(e,t,i){const n=new kw;return this.parseFragment(e,n),this.ensureFinalTabstop(n,i??!1,t??!1),n}parseFragment(e,t){const i=t.children.length;for(this._scanner.text(e),this._token=this._scanner.next();this._parse(t););const n=new Map,s=[];t.walk(l=>(l instanceof Ar&&(l.isFinalTabstop?n.set(0,void 0):!n.has(l.index)&&l.children.length>0?n.set(l.index,l.children):s.push(l)),!0));const r=(l,c)=>{const d=n.get(l.index);if(!d)return;const h=new Ar(l.index);h.transform=l.transform;for(const u of d){const f=u.clone();h.appendChild(f),f instanceof Ar&&n.has(f.index)&&!c.has(f.index)&&(c.add(f.index),r(f,c),c.delete(f.index))}t.replace(l,[h])},a=new Set;for(const l of s)r(l,a);return t.children.slice(i)}ensureFinalTabstop(e,t,i){(t||i&&e.placeholders.length>0)&&(e.placeholders.find(s=>s.index===0)||e.appendChild(new Ar(0)))}_accept(e,t){if(e===void 0||this._token.type===e){const i=t?this._scanner.tokenText(this._token):!0;return this._token=this._scanner.next(),i}return!1}_backTo(e){return this._scanner.pos=e.pos+e.len,this._token=e,!1}_until(e){const t=this._token;for(;this._token.type!==e;){if(this._token.type===14)return!1;if(this._token.type===5){const n=this._scanner.next();if(n.type!==0&&n.type!==4&&n.type!==5)return!1}this._token=this._scanner.next()}const i=this._scanner.value.substring(t.pos,this._token.pos).replace(/\\(\$|}|\\)/g,"$1");return this._token=this._scanner.next(),i}_parse(e){return this._parseEscaped(e)||this._parseTabstopOrVariableName(e)||this._parseComplexPlaceholder(e)||this._parseComplexVariable(e)||this._parseAnything(e)}_parseEscaped(e){let t;return(t=this._accept(5,!0))?(t=this._accept(0,!0)||this._accept(4,!0)||this._accept(5,!0)||t,e.appendChild(new Ts(t)),!0):!1}_parseTabstopOrVariableName(e){let t;const i=this._token;return this._accept(0)&&(t=this._accept(9,!0)||this._accept(8,!0))?(e.appendChild(/^\d+$/.test(t)?new Ar(Number(t)):new xw(t)),!0):this._backTo(i)}_parseComplexPlaceholder(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(8,!0))))return this._backTo(i);const s=new Ar(Number(t));if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Ts("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else if(s.index>0&&this._accept(7)){const r=new ib;for(;;){if(this._parseChoiceElement(r)){if(this._accept(2))continue;if(this._accept(7)&&(s.appendChild(r),this._accept(4)))return e.appendChild(s),!0}return this._backTo(i),!1}}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseChoiceElement(e){const t=this._token,i=[];for(;!(this._token.type===2||this._token.type===7);){let n;if((n=this._accept(5,!0))?n=this._accept(2,!0)||this._accept(7,!0)||this._accept(5,!0)||n:n=this._accept(void 0,!0),!n)return this._backTo(t),!1;i.push(n)}return i.length===0?(this._backTo(t),!1):(e.appendChild(new Ts(i.join(""))),!0)}_parseComplexVariable(e){let t;const i=this._token;if(!(this._accept(0)&&this._accept(3)&&(t=this._accept(9,!0))))return this._backTo(i);const s=new xw(t);if(this._accept(1))for(;;){if(this._accept(4))return e.appendChild(s),!0;if(!this._parse(s))return e.appendChild(new Ts("${"+t+":")),s.children.forEach(e.appendChild,e),!0}else return this._accept(6)?this._parseTransform(s)?(e.appendChild(s),!0):(this._backTo(i),!1):this._accept(4)?(e.appendChild(s),!0):this._backTo(i)}_parseTransform(e){const t=new o4;let i="",n="";for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(6,!0)||s,i+=s;continue}if(this._token.type!==14){i+=this._accept(void 0,!0);continue}return!1}for(;!this._accept(6);){let s;if(s=this._accept(5,!0)){s=this._accept(5,!0)||this._accept(6,!0)||s,t.appendChild(new Ts(s));continue}if(!(this._parseFormatString(t)||this._parseAnything(t)))return!1}for(;!this._accept(4);){if(this._token.type!==14){n+=this._accept(void 0,!0);continue}return!1}try{t.regexp=new RegExp(i,n)}catch{return!1}return e.transform=t,!0}_parseFormatString(e){const t=this._token;if(!this._accept(0))return!1;let i=!1;this._accept(3)&&(i=!0);const n=this._accept(8,!0);if(n)if(i){if(this._accept(4))return e.appendChild(new Va(Number(n))),!0;if(!this._accept(1))return this._backTo(t),!1}else return e.appendChild(new Va(Number(n))),!0;else return this._backTo(t),!1;if(this._accept(6)){const s=this._accept(9,!0);return!s||!this._accept(4)?(this._backTo(t),!1):(e.appendChild(new Va(Number(n),s)),!0)}else if(this._accept(11)){const s=this._until(4);if(s)return e.appendChild(new Va(Number(n),void 0,s,void 0)),!0}else if(this._accept(12)){const s=this._until(4);if(s)return e.appendChild(new Va(Number(n),void 0,void 0,s)),!0}else if(this._accept(13)){const s=this._until(1);if(s){const r=this._until(4);if(r)return e.appendChild(new Va(Number(n),void 0,s,r)),!0}}else{const s=this._until(4);if(s)return e.appendChild(new Va(Number(n),void 0,void 0,s)),!0}return this._backTo(t),!1}_parseAnything(e){return this._token.type!==14?(e.appendChild(new Ts(this._scanner.tokenText(this._token))),this._accept(void 0),!0):!1}}function BK(o,e,t){return(typeof t.insertText=="string"?t.insertText==="":t.insertText.snippet==="")?{edits:t.additionalEdit?.edits??[]}:{edits:[...e.map(i=>new jh(o,{range:i,text:typeof t.insertText=="string"?kg.escape(t.insertText)+"$0":t.insertText.snippet,insertAsSnippet:!0})),...t.additionalEdit?.edits??[]]}}function HK(o){function e(r,a){return"mimeType"in r?r.mimeType===a.handledMimeType:!!a.kind&&r.kind.contains(a.kind)}const t=new Map;for(const r of o)for(const a of r.yieldTo??[])for(const l of o)if(l!==r&&e(a,l)){let c=t.get(r);c||(c=[],t.set(r,c)),c.push(l)}if(!t.size)return Array.from(o);const i=new Set,n=[];function s(r){if(!r.length)return[];const a=r[0];if(n.includes(a))return console.warn("Yield to cycle detected",a),r;if(i.has(a))return s(r.slice(1));let l=[];const c=t.get(a);return c&&(n.push(a),l=s(c),n.pop()),i.add(a),[...l,a,...s(r.slice(1))]}return s(Array.from(o))}$.white.toString(),$.white.toString();const twe=Object.freeze({allowedTags:{override:["b","i","u","code","span"]},allowedAttributes:{override:["class"]}});class Tk extends A{get onDidClick(){return this._onDidClick.event}constructor(e,t){super(),this._label="",this._onDidClick=this._register(new P),this._onDidEscape=this._register(new P),this.options=t,this._element=document.createElement("a"),this._element.classList.add("monaco-button"),this._element.tabIndex=0,this._element.setAttribute("role","button"),this._element.classList.toggle("secondary",!!t.secondary);const i=t.secondary?t.buttonSecondaryBackground:t.buttonBackground,n=t.secondary?t.buttonSecondaryForeground:t.buttonForeground;this._element.style.color=n||"",this._element.style.backgroundColor=i||"",t.supportShortLabel&&(this._labelShortElement=document.createElement("div"),this._labelShortElement.classList.add("monaco-button-label-short"),this._element.appendChild(this._labelShortElement),this._labelElement=document.createElement("div"),this._labelElement.classList.add("monaco-button-label"),this._element.appendChild(this._labelElement),this._element.classList.add("monaco-text-button-with-short-label")),typeof t.title=="string"&&this.setTitle(t.title),typeof t.ariaLabel=="string"&&this._element.setAttribute("aria-label",t.ariaLabel),e.appendChild(this._element),this.enabled=!t.disabled,this._register($n.addTarget(this._element)),[te.CLICK,Pt.Tap].forEach(s=>{this._register(W(this._element,s,r=>{if(!this.enabled){st.stop(r);return}this._onDidClick.fire(r)}))}),this._register(W(this._element,te.KEY_DOWN,s=>{const r=new St(s);let a=!1;this.enabled&&(r.equals(3)||r.equals(10))?(this._onDidClick.fire(s),a=!0):r.equals(9)&&(this._onDidEscape.fire(s),this._element.blur(),a=!0),a&&st.stop(r,!0)})),this._register(W(this._element,te.MOUSE_OVER,s=>{this._element.classList.contains("disabled")||this.updateBackground(!0)})),this._register(W(this._element,te.MOUSE_OUT,s=>{this.updateBackground(!1)})),this.focusTracker=this._register(br(this._element)),this._register(this.focusTracker.onDidFocus(()=>{this.enabled&&this.updateBackground(!0)})),this._register(this.focusTracker.onDidBlur(()=>{this.enabled&&this.updateBackground(!1)}))}dispose(){super.dispose(),this._element.remove()}getContentElements(e){const t=[];for(let i of Fh(e))if(typeof i=="string"){if(i=i.trim(),i==="")continue;const n=document.createElement("span");n.textContent=i,t.push(n)}else t.push(i);return t}updateBackground(e){let t;this.options.secondary?t=e?this.options.buttonSecondaryHoverBackground:this.options.buttonSecondaryBackground:t=e?this.options.buttonHoverBackground:this.options.buttonBackground,t&&(this._element.style.backgroundColor=t)}get element(){return this._element}set label(e){if(this._label===e||Rl(this._label)&&Rl(e)&&e_e(this._label,e))return;this._element.classList.add("monaco-text-button");const t=this.options.supportShortLabel?this._labelElement:this._element;if(Rl(e)){const n=iw(e,void 0,document.createElement("span"));n.dispose();const s=n.element.querySelector("p")?.innerHTML;s?Xj(t,s,twe):Yi(t)}else this.options.supportIcons?Yi(t,...this.getContentElements(e)):t.textContent=e;let i="";typeof this.options.title=="string"?i=this.options.title:this.options.title&&(i=mbe(e)),this.setTitle(i),this._setAriaLabel(),this._label=e}get label(){return this._label}_setAriaLabel(){typeof this.options.ariaLabel=="string"?this._element.setAttribute("aria-label",this.options.ariaLabel):typeof this.options.title=="string"&&this._element.setAttribute("aria-label",this.options.title)}set icon(e){this._setAriaLabel();const t=Array.from(this._element.classList).filter(i=>i.startsWith("codicon-"));this._element.classList.remove(...t),this._element.classList.add(...ve.asClassNameArray(e))}set enabled(e){e?(this._element.classList.remove("disabled"),this._element.setAttribute("aria-disabled",String(!1)),this._element.tabIndex=0):(this._element.classList.add("disabled"),this._element.setAttribute("aria-disabled",String(!0)))}get enabled(){return!this._element.classList.contains("disabled")}setTitle(e){!this._hover&&e!==""?this._hover=this._register(ta().setupManagedHover(this.options.hoverDelegate??Zs("element"),this._element,e)):this._hover&&this._hover.update(e)}}function r4(o,e){return e&&(o.stack||o.stacktrace)?p(29,"{0}: {1}",zK(o),VK(o.stack)||VK(o.stacktrace)):zK(o)}function VK(o){return Array.isArray(o)?o.join(`
`):o}function zK(o){return o.code==="ERR_UNC_HOST_NOT_ALLOWED"?`${o.message}. Please update the 'security.allowedUNCHosts' setting if you want to allow this host.`:typeof o.code=="string"&&typeof o.errno=="number"&&typeof o.syscall=="string"?p(30,"A system error occurred ({0})",o.message):o.message||p(31,"An unknown error occurred. Please consult the log for more details.")}function Rk(o=null,e=!1){if(!o)return p(32,"An unknown error occurred. Please consult the log for more details.");if(Array.isArray(o)){const t=wa(o),i=Rk(t[0],e);return t.length>1?p(33,"{0} ({1} errors in total)",i,t.length):i}if(ji(o))return o;if(o.detail){const t=o.detail;if(t.error)return r4(t.error,e);if(t.exception)return r4(t.exception,e)}return o.stack?r4(o,e):o.message?o.message:p(34,"An unknown error occurred. Please consult the log for more details.")}const Mk=Q,iwe={keybindingLabelBackground:void 0,keybindingLabelForeground:void 0,keybindingLabelBorder:void 0,keybindingLabelBottomBorder:void 0,keybindingLabelShadow:void 0};class nb extends A{constructor(e,t,i){super(),this.os=t,this.keyElements=new Set,this.options=i||Object.create(null);const n=this.options.keybindingLabelForeground;this.domNode=Z(e,Mk(".monaco-keybinding")),n&&(this.domNode.style.color=n),this.hover=this._register(ta().setupManagedHover(Zs("mouse"),this.domNode,"")),this.didEverRender=!1,e.appendChild(this.domNode)}set(e,t){this.didEverRender&&this.keybinding===e&&nb.areSame(this.matches,t)||(this.keybinding=e,this.matches=t,this.render())}render(){if(this.clear(),this.keybinding){const e=this.keybinding.getChords();e[0]&&this.renderChord(this.domNode,e[0],this.matches?this.matches.firstPart:null);for(let i=1;i<e.length;i++)Z(this.domNode,Mk("span.monaco-keybinding-key-chord-separator",void 0," ")),this.renderChord(this.domNode,e[i],this.matches?this.matches.chordPart:null);const t=this.options.disableTitle??!1?void 0:this.keybinding.getAriaLabel()||void 0;this.hover.update(t),this.domNode.setAttribute("aria-label",t||"")}else this.options&&this.options.renderUnboundKeybindings&&this.renderUnbound(this.domNode);this.didEverRender=!0}clear(){pn(this.domNode),this.keyElements.clear()}renderChord(e,t,i){const n=xO.modifierLabels[this.os];t.ctrlKey&&this.renderKey(e,n.ctrlKey,!!i?.ctrlKey,n.separator),t.shiftKey&&this.renderKey(e,n.shiftKey,!!i?.shiftKey,n.separator),t.altKey&&this.renderKey(e,n.altKey,!!i?.altKey,n.separator),t.metaKey&&this.renderKey(e,n.metaKey,!!i?.metaKey,n.separator);const s=t.keyLabel;s&&this.renderKey(e,s,!!i?.keyCode,"")}renderKey(e,t,i,n){Z(e,this.createKeyElement(t,i?".highlight":"")),n&&Z(e,Mk("span.monaco-keybinding-key-separator",void 0,n))}renderUnbound(e){Z(e,this.createKeyElement(p(15,"Unbound")))}createKeyElement(e,t=""){const i=Mk("span.monaco-keybinding-key"+t,void 0,e);return this.keyElements.add(i),this.options.keybindingLabelBackground&&(i.style.backgroundColor=this.options.keybindingLabelBackground),this.options.keybindingLabelBorder&&(i.style.borderColor=this.options.keybindingLabelBorder),this.options.keybindingLabelBottomBorder&&(i.style.borderBottomColor=this.options.keybindingLabelBottomBorder),this.options.keybindingLabelShadow&&(i.style.boxShadow=`inset 0 -1px 0 ${this.options.keybindingLabelShadow}`),i}static areSame(e,t){return e===t||!e&&!t?!0:!!e&&!!t&&fo(e.firstPart,t.firstPart)&&fo(e.chordPart,t.chordPart)}}const Hl=We("layoutService");var UK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pk=function(o,e){return function(t,i){e(t,i,o)}};const $K="acceptSelectedCodeAction",jK="previewSelectedCodeAction";class nwe{get templateId(){return"header"}renderTemplate(e){e.classList.add("group-header");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){i.text.textContent=e.group?.title??e.label??""}disposeTemplate(e){}}class swe{get templateId(){return"separator"}renderTemplate(e){e.classList.add("separator");const t=document.createElement("span");return e.append(t),{container:e,text:t}}renderElement(e,t,i){i.text.textContent=e.label??""}disposeTemplate(e){}}let a4=class{get templateId(){return"action"}constructor(e,t){this._supportsPreview=e,this._keybindingService=t}renderTemplate(e){e.classList.add(this.templateId);const t=document.createElement("div");t.className="icon",e.append(t);const i=document.createElement("span");i.className="title",e.append(i);const n=document.createElement("span");n.className="description",e.append(n);const s=new nb(e,so);return{container:e,icon:t,text:i,description:n,keybinding:s}}renderElement(e,t,i){if(e.group?.icon?(i.icon.className=ve.asClassName(e.group.icon),e.group.icon.color&&(i.icon.style.color=J(e.group.icon.color.id))):(i.icon.className=ve.asClassName(Y.lightBulb),i.icon.style.color="var(--vscode-editorLightBulb-foreground)"),!e.item||!e.label)return;dse(!e.hideIcon,i.icon),i.text.textContent=Ak(e.label),e.keybinding?(i.description.textContent=e.keybinding.getLabel(),i.description.style.display="inline",i.description.style.letterSpacing="0.5px"):e.description?(i.description.textContent=Ak(e.description),i.description.style.display="inline"):(i.description.textContent="",i.description.style.display="none");const n=this._keybindingService.lookupKeybinding($K)?.getLabel(),s=this._keybindingService.lookupKeybinding(jK)?.getLabel();i.container.classList.toggle("option-disabled",e.disabled),e.tooltip?i.container.title=e.tooltip:e.disabled?i.container.title=e.label:n&&s?this._supportsPreview&&e.canPreview?i.container.title=p(1638,"{0} to Apply, {1} to Preview",n,s):i.container.title=p(1639,"{0} to Apply",n):i.container.title=""}disposeTemplate(e){e.keybinding.dispose()}};a4=UK([Pk(1,ot)],a4);class owe extends UIEvent{constructor(){super("acceptSelectedAction")}}class qK extends UIEvent{constructor(){super("previewSelectedAction")}}function rwe(o){if(o.kind==="action")return o.label}let l4=class extends A{constructor(e,t,i,n,s,r,a,l){super(),this._delegate=n,this._contextViewService=r,this._keybindingService=a,this._layoutService=l,this._actionLineHeight=28,this._headerLineHeight=28,this._separatorLineHeight=8,this.cts=this._register(new Xt),this.domNode=document.createElement("div"),this.domNode.classList.add("actionList");const c={getHeight:d=>{switch(d.kind){case"header":return this._headerLineHeight;case"separator":return this._separatorLineHeight;default:return this._actionLineHeight}},getTemplateId:d=>d.kind};this._list=this._register(new jo(e,this.domNode,c,[new a4(t,this._keybindingService),new nwe,new swe],{keyboardSupport:!1,typeNavigationEnabled:!0,keyboardNavigationLabelProvider:{getKeyboardNavigationLabel:rwe},accessibilityProvider:{getAriaLabel:d=>{if(d.kind==="action"){let h=d.label?Ak(d?.label):"";return d.description&&(h=h+", "+Ak(d.description)),d.disabled&&(h=p(1640,"{0}, Disabled Reason: {1}",h,d.disabled)),h}return null},getWidgetAriaLabel:()=>p(1641,"Action Widget"),getRole:d=>{switch(d.kind){case"action":return"option";case"separator":return"separator";default:return"separator"}},getWidgetRole:()=>"listbox",...s}})),this._list.style(Y_),this._register(this._list.onMouseClick(d=>this.onListClick(d))),this._register(this._list.onMouseOver(d=>this.onListHover(d))),this._register(this._list.onDidChangeFocus(()=>this.onFocus())),this._register(this._list.onDidChangeSelection(d=>this.onListSelection(d))),this._allMenuItems=i,this._list.splice(0,this._list.length,this._allMenuItems),this._list.length&&this.focusNext()}focusCondition(e){return!e.disabled&&e.kind==="action"}hide(e){this._delegate.onHide(e),this.cts.cancel(),this._contextViewService.hideContextView()}layout(e){const t=this._allMenuItems.filter(d=>d.kind==="header").length,i=this._allMenuItems.filter(d=>d.kind==="separator").length,r=this._allMenuItems.length*this._actionLineHeight+t*this._headerLineHeight-t*this._actionLineHeight+i*this._separatorLineHeight-i*this._actionLineHeight;this._list.layout(r);let a=e;if(this._allMenuItems.length>=50)a=380;else{const d=this._allMenuItems.map((h,u)=>{const f=this.domNode.ownerDocument.getElementById(this._list.getElementID(u));if(f){f.style.width="auto";const g=f.getBoundingClientRect().width;return f.style.width="",g}return 0});a=Math.max(...d,e)}const c=Math.min(r,this._layoutService.getContainer(me(this.domNode)).clientHeight*.7);return this._list.layout(c,a),this.domNode.style.height=`${c}px`,this._list.domFocus(),a}focusPrevious(){this._list.focusPrevious(1,!0,void 0,this.focusCondition)}focusNext(){this._list.focusNext(1,!0,void 0,this.focusCondition)}acceptSelected(e){const t=this._list.getFocus();if(t.length===0)return;const i=t[0],n=this._list.element(i);if(!this.focusCondition(n))return;const s=e?new qK:new owe;this._list.setSelection([i],s)}onListSelection(e){if(!e.elements.length)return;const t=e.elements[0];t.item&&this.focusCondition(t)?this._delegate.onSelect(t.item,e.browserEvent instanceof qK):this._list.setSelection([])}onFocus(){const e=this._list.getFocus();if(e.length===0)return;const t=e[0],i=this._list.element(t);this._delegate.onFocus?.(i.item)}async onListHover(e){const t=e.element;if(t&&t.item&&this.focusCondition(t)){if(this._delegate.onHover&&!t.disabled&&t.kind==="action"){const i=await this._delegate.onHover(t.item,this.cts.token);t.canPreview=i?i.canPreview:void 0}e.index&&this._list.splice(e.index,1,[t])}this._list.setFocus(typeof e.index=="number"?[e.index]:[])}onListClick(e){e.element&&this.focusCondition(e.element)&&this._list.setFocus([])}};l4=UK([Pk(5,hd),Pk(6,ot),Pk(7,Hl)],l4);function Ak(o){return o.replace(/\r\n|\r|\n/g," ")}var awe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},c4=function(o,e){return function(t,i){e(t,i,o)}};N("actionBar.toggledBackground",U1,p(1642,"Background color for toggled action items in action bar."));const Ig={Visible:new ae("codeActionMenuVisible",!1,p(1643,"Whether the action widget list is visible"))},qh=We("actionWidgetService");let Dg=class extends A{get isVisible(){return Ig.Visible.getValue(this._contextKeyService)||!1}constructor(e,t,i){super(),this._contextViewService=e,this._contextKeyService=t,this._instantiationService=i,this._list=this._register(new ct)}show(e,t,i,n,s,r,a,l){const c=Ig.Visible.bindTo(this._contextKeyService),d=this._instantiationService.createInstance(l4,e,t,i,n,l);this._contextViewService.showContextView({getAnchor:()=>s,render:h=>(c.set(!0),this._renderWidget(h,d,a??[])),onHide:h=>{c.reset(),this._onWidgetClosed(h)}},r,!1)}acceptSelected(e){this._list.value?.acceptSelected(e)}focusPrevious(){this._list?.value?.focusPrevious()}focusNext(){this._list?.value?.focusNext()}hide(e){this._list.value?.hide(e),this._list.clear()}_renderWidget(e,t,i){const n=document.createElement("div");if(n.classList.add("action-widget"),e.appendChild(n),this._list.value=t,this._list.value)n.appendChild(this._list.value.domNode);else throw new Error("List has no value");const s=new U,r=document.createElement("div"),a=e.appendChild(r);a.classList.add("context-view-block"),s.add(W(a,te.MOUSE_DOWN,f=>f.stopPropagation()));const l=document.createElement("div"),c=e.appendChild(l);c.classList.add("context-view-pointerBlock"),s.add(W(c,te.POINTER_MOVE,()=>c.remove())),s.add(W(c,te.MOUSE_DOWN,()=>c.remove()));let d=0;if(i.length){const f=this._createActionBar(".action-widget-action-bar",i);f&&(n.appendChild(f.getContainer().parentElement),s.add(f),d=f.getContainer().offsetWidth)}const h=this._list.value?.layout(d);n.style.width=`${h}px`;const u=s.add(br(e));return s.add(u.onDidBlur(()=>this.hide(!0))),s}_createActionBar(e,t){if(!t.length)return;const i=Q(e),n=new Ys(i);return n.push(t,{icon:!1,label:!0}),n}_onWidgetClosed(e){this._list.value?.hide(e)}};Dg=awe([c4(0,hd),c4(1,xe),c4(2,ge)],Dg),je(qh,Dg,1);const Iw=1100;mt(class extends ln{constructor(){super({id:"hideCodeActionWidget",title:H(1644,"Hide action widget"),precondition:Ig.Visible,keybinding:{weight:Iw,primary:9,secondary:[1033]}})}run(o){o.get(qh).hide(!0)}}),mt(class extends ln{constructor(){super({id:"selectPrevCodeAction",title:H(1645,"Select previous action"),precondition:Ig.Visible,keybinding:{weight:Iw,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})}run(o){const e=o.get(qh);e instanceof Dg&&e.focusPrevious()}}),mt(class extends ln{constructor(){super({id:"selectNextCodeAction",title:H(1646,"Select next action"),precondition:Ig.Visible,keybinding:{weight:Iw,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})}run(o){const e=o.get(qh);e instanceof Dg&&e.focusNext()}}),mt(class extends ln{constructor(){super({id:$K,title:H(1647,"Accept selected action"),precondition:Ig.Visible,keybinding:{weight:Iw,primary:3,secondary:[2137]}})}run(o){const e=o.get(qh);e instanceof Dg&&e.acceptSelected()}}),mt(class extends ln{constructor(){super({id:jK,title:H(1648,"Preview selected action"),precondition:Ig.Visible,keybinding:{weight:Iw,primary:2051}})}run(o){const e=o.get(qh);e instanceof Dg&&e.acceptSelected(!0)}});var KK=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sb=function(o,e){return function(t,i){e(t,i,o)}},d4;let h4=(Rp=class extends A{constructor(e,t,i,n,s,r,a,l,c,d,h){super(),this.typeId=e,this.editor=t,this.showCommand=n,this.range=s,this.edits=r,this.onSelectNewEdit=a,this.additionalActions=l,this._keybindingService=d,this._actionWidgetService=h,this.allowEditorOverflow=!0,this.suppressMouseDown=!0,this.create(),this.visibleContext=i.bindTo(c),this.visibleContext.set(!0),this._register(ue(()=>this.visibleContext.reset())),this.editor.addContentWidget(this),this.editor.layoutContentWidget(this),this._register(ue((()=>this.editor.removeContentWidget(this)))),this._register(this.editor.onDidChangeCursorPosition(u=>{this.dispose()})),this._register(ie.runAndSubscribe(d.onDidUpdateKeybindings,()=>{this._updateButtonTitle()}))}_updateButtonTitle(){const e=this._keybindingService.lookupKeybinding(this.showCommand.id)?.getLabel();this.button.element.title=this.showCommand.label+(e?` (${e})`:"")}create(){this.domNode=Q(".post-edit-widget"),this.button=this._register(new Tk(this.domNode,{supportIcons:!0})),this.button.label="$(insert)",this._register(W(this.domNode,te.CLICK,()=>this.showSelector()))}getId(){return d4.baseId+"."+this.typeId}getDomNode(){return this.domNode}getPosition(){return{position:this.range.getEndPosition(),preference:[2]}}showSelector(){const e=mi(this.button.element),t={x:e.left+e.width,y:e.top+e.height};this._actionWidgetService.show("postEditWidget",!1,this.edits.allEdits.map((i,n)=>({kind:"action",item:i,label:i.title,disabled:!1,canPreview:!1,group:{title:"",icon:ve.fromId(n===this.edits.activeEditIndex?Y.check.id:Y.blank.id)}})),{onHide:()=>{this.editor.focus()},onSelect:i=>{this._actionWidgetService.hide(!1);const n=this.edits.allEdits.findIndex(s=>s===i);if(n!==this.edits.activeEditIndex)return this.onSelectNewEdit(n)}},t,this.editor.getDomNode()??void 0,this.additionalActions)}},d4=Rp,Rp.baseId="editor.widget.postEditWidget",Rp);h4=d4=KK([sb(8,xe),sb(9,ot),sb(10,qh)],h4);let Ok=class extends A{constructor(e,t,i,n,s,r,a,l){super(),this._id=e,this._editor=t,this._visibleContext=i,this._showCommand=n,this._getAdditionalActions=s,this._instantiationService=r,this._bulkEditService=a,this._notificationService=l,this._currentWidget=this._register(new ct),this._register(ie.any(t.onDidChangeModel,t.onDidChangeModelContent)(()=>this.clear()))}async applyEditAndShowIfNeeded(e,t,i,n,s){if(!e.length||!this._editor.hasModel())return;const r=this._editor.getModel(),a=t.allEdits.at(t.activeEditIndex);if(!a)return;const l=async b=>{const C=this._editor.getModel();C&&(await C.undo(),this.applyEditAndShowIfNeeded(e,{activeEditIndex:b,allEdits:t.allEdits},i,n,s))},c=(b,C)=>{Do(b)||(this._notificationService.error(C),i&&this.show(e[0],t,l))},d=new ud(this._editor,3,void 0,s);let h;try{h=await fie(n(a,d.token),d.token)}catch(b){return c(b,p(932,`Error resolving edit '{0}':
{1}`,a.title,Rk(b)))}finally{d.dispose()}if(s.isCancellationRequested)return;const u=BK(r.uri,e,h),f=e[0],g=r.deltaDecorations([],[{range:f,options:{description:"paste-line-suffix",stickiness:0}}]);this._editor.focus();let m,_;try{m=await this._bulkEditService.apply(u,{editor:this._editor,token:s}),_=r.getDecorationRange(g[0])}catch(b){return c(b,p(933,`Error applying edit '{0}':
{1}`,a.title,Rk(b)))}finally{r.deltaDecorations(g,[])}s.isCancellationRequested||i&&m.isApplied&&t.allEdits.length>1&&this.show(_??f,t,l)}show(e,t,i){this.clear(),this._editor.hasModel()&&(this._currentWidget.value=this._instantiationService.createInstance(h4,this._id,this._editor,this._visibleContext,this._showCommand,e,t,i,this._getAdditionalActions()))}clear(){this._currentWidget.clear()}tryShowSelector(){this._currentWidget.value?.showSelector()}};Ok=KK([sb(5,ge),sb(6,yw),sb(7,hi)],Ok);var lwe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},md=function(o,e){return function(t,i){e(t,i,o)}},na;const GK="editor.changePasteType",cwe="editor.pasteAs.preferences",u4=new ae("pasteWidgetVisible",!1,p(912,"Whether the paste widget is showing")),f4="application/vnd.code.copymetadata";let _d=(Mp=class extends A{static get(e){return e.getContribution(na.ID)}constructor(e,t,i,n,s,r,a,l,c,d){super(),this._logService=i,this._bulkEditService=n,this._clipboardService=s,this._commandService=r,this._configService=a,this._languageFeaturesService=l,this._quickInputService=c,this._progressService=d,this._editor=e;const h=e.getContainerDomNode();this._register(W(h,"copy",u=>this.handleCopy(u))),this._register(W(h,"cut",u=>this.handleCopy(u))),this._register(W(h,"paste",u=>this.handlePaste(u),!0)),this._pasteProgressManager=this._register(new Ik("pasteIntoEditor",e,t)),this._postPasteWidgetManager=this._register(t.createInstance(Ok,"pasteIntoEditor",e,u4,{id:GK,label:p(913,"Show paste options...")},()=>na._configureDefaultAction?[na._configureDefaultAction]:[]))}changePasteType(){this._postPasteWidgetManager.tryShowSelector()}async pasteAs(e){this._logService.trace("CopyPasteController.pasteAs"),this._editor.focus();try{this._logService.trace("Before calling editor.action.clipboardPasteAction"),this._pasteAsActionContext={preferred:e},await this._commandService.executeCommand("editor.action.clipboardPasteAction")}finally{this._pasteAsActionContext=void 0}}clearWidgets(){this._postPasteWidgetManager.clear()}isPasteAsEnabled(){return this._editor.getOption(97).enabled}async finishedPaste(){await this._currentPasteOperation}handleCopy(e){let t=null;if(e.clipboardData){const[_,b]=Af.getTextData(e.clipboardData);t=(b||wl.INSTANCE.get(_))?.id||null,this._logService.trace("CopyPasteController#handleCopy for id : ",t," with text.length : ",_.length)}else this._logService.trace("CopyPasteController#handleCopy");if(!this._editor.hasTextFocus()||(this._clipboardService.clearInternalState?.(),!e.clipboardData||!this.isPasteAsEnabled()))return;const i=this._editor.getModel(),n=this._editor.getSelections();if(!i||!n?.length)return;const s=this._editor.getOption(45);let r=n;const a=n.length===1&&n[0].isEmpty();if(a){if(!s)return;r=[new k(r[0].startLineNumber,1,r[0].startLineNumber,1+i.getLineLength(r[0].startLineNumber))]}const l=this._editor._getViewModel()?.getPlainTextToCopy(n,s,gn),d={multicursorText:Array.isArray(l)?l:null,pasteOnNewLine:a,mode:null},h=this._languageFeaturesService.documentPasteEditProvider.ordered(i).filter(_=>!!_.prepareDocumentPaste);if(!h.length){this.setCopyMetadata(e.clipboardData,{defaultPastePayload:d});return}const u=DK(e.clipboardData),f=h.flatMap(_=>_.copyMimeTypes??[]),g=t??Of();this.setCopyMetadata(e.clipboardData,{id:g,providerCopyMimeTypes:f,defaultPastePayload:d});const m=h.map(_=>({providerMimeTypes:_.copyMimeTypes,operation:Vi(b=>_.prepareDocumentPaste(i,r,u,b).catch(C=>{console.error(C)}))}));na._currentCopyOperation?.operations.forEach(_=>_.operation.cancel()),na._currentCopyOperation={handle:g,operations:m}}async handlePaste(e){if(e.clipboardData){const[c,d]=Af.getTextData(e.clipboardData),h=d||wl.INSTANCE.get(c);this._logService.trace("CopyPasteController#handlePaste for id : ",h?.id)}else this._logService.trace("CopyPasteController#handlePaste");if(!e.clipboardData||!this._editor.hasTextFocus())return;So.get(this._editor)?.closeMessage(),this._currentPasteOperation?.cancel(),this._currentPasteOperation=void 0;const t=this._editor.getModel(),i=this._editor.getSelections();if(!i?.length||!t||this._editor.getOption(104)||!this.isPasteAsEnabled()&&!this._pasteAsActionContext)return;const n=this.fetchCopyMetadata(e);this._logService.trace("CopyPasteController#handlePaste with metadata : ",n?.id," and text.length : ",e.clipboardData.getData("text/plain").length);const s=EK(e.clipboardData);s.delete(f4);const r=Array.from(e.clipboardData.files).map(c=>c.type),a=[...e.clipboardData.types,...r,...n?.providerCopyMimeTypes??[],_i.uriList],l=this._languageFeaturesService.documentPasteEditProvider.ordered(t).filter(c=>{const d=this._pasteAsActionContext?.preferred;return d&&!this.providerMatchesPreference(c,d)?!1:c.pasteMimeTypes?.some(h=>LK(h,a))});if(!l.length){this._pasteAsActionContext?.preferred&&(this.showPasteAsNoEditMessage(i,this._pasteAsActionContext.preferred),e.preventDefault(),e.stopImmediatePropagation());return}e.preventDefault(),e.stopImmediatePropagation(),this._pasteAsActionContext?this.showPasteAsPick(this._pasteAsActionContext.preferred,l,i,s,n):this.doPasteInline(l,i,s,n,e)}showPasteAsNoEditMessage(e,t){const i="only"in t?t.only.value:"preferences"in t?t.preferences.length?t.preferences.map(n=>n.value).join(", "):p(914,"empty"):t.providerId;So.get(this._editor)?.showMessage(p(915,"No paste edits for '{0}' found",i),e[0].getStartPosition())}doPasteInline(e,t,i,n,s){this._logService.trace("CopyPasteController#doPasteInline");const r=this._editor;if(!r.hasModel())return;const a=new ud(r,3,void 0),l=Vi(async c=>{const d=this._editor;if(!d.hasModel())return;const h=d.getModel(),u=new U,f=u.add(new Xt(c));u.add(a.token.onCancellationRequested(()=>f.cancel()));const g=f.token;try{if(await this.mergeInDataFromCopy(e,i,n,g),g.isCancellationRequested)return;const m=e.filter(C=>this.isSupportedPasteProvider(C,i));if(!m.length||m.length===1&&m[0]instanceof Lg)return this.applyDefaultPasteHandler(i,n,g,s);const _={triggerKind:av.Automatic},b=await this.getPasteEdits(m,i,h,t,_,g);if(u.add(b),g.isCancellationRequested)return;if(b.edits.length===1&&b.edits[0].provider instanceof Lg)return this.applyDefaultPasteHandler(i,n,g,s);if(b.edits.length){const C=d.getOption(97).showPasteSelector==="afterPaste";return this._postPasteWidgetManager.applyEditAndShowIfNeeded(t,{activeEditIndex:this.getInitialActiveEditIndex(h,b.edits),allEdits:b.edits},C,async(w,v)=>{if(!w.provider.resolveDocumentPasteEdit)return w;const S=w.provider.resolveDocumentPasteEdit(w,v),L=new Ju,x=await this._pasteProgressManager.showWhile(t[0].getEndPosition(),p(916,"Resolving paste edit for '{0}'. Click to cancel",w.title),Em(Promise.race([L.p,S]),v),{cancel:()=>L.cancel()},0);return x&&(w.insertText=x.insertText,w.additionalEdit=x.additionalEdit),w},g)}await this.applyDefaultPasteHandler(i,n,g,s)}finally{u.dispose(),this._currentPasteOperation===l&&(this._currentPasteOperation=void 0)}});this._pasteProgressManager.showWhile(t[0].getEndPosition(),p(917,"Running paste handlers. Click to cancel and do basic paste"),l,{cancel:async()=>{l.cancel(),!a.token.isCancellationRequested&&await this.applyDefaultPasteHandler(i,n,a.token,s)}}).finally(()=>{a.dispose()}),this._currentPasteOperation=l}showPasteAsPick(e,t,i,n,s){this._logService.trace("CopyPasteController#showPasteAsPick");const r=Vi(async a=>{const l=this._editor;if(!l.hasModel())return;const c=l.getModel(),d=new U,h=d.add(new ud(l,3,void 0,a));try{if(await this.mergeInDataFromCopy(t,n,s,h.token),h.token.isCancellationRequested)return;let u=t.filter(b=>this.isSupportedPasteProvider(b,n,e));e&&(u=u.filter(b=>this.providerMatchesPreference(b,e)));const f={triggerKind:av.PasteAs,only:e&&"only"in e?e.only:void 0};let g=d.add(await this.getPasteEdits(u,n,c,i,f,h.token));if(h.token.isCancellationRequested)return;if(e&&(g={edits:g.edits.filter(b=>"only"in e?e.only.contains(b.kind):"preferences"in e?e.preferences.some(C=>C.contains(b.kind)):e.providerId===b.provider.id),dispose:g.dispose}),!g.edits.length){e&&this.showPasteAsNoEditMessage(i,e);return}let m;if(e)m=g.edits.at(0);else{const b={id:"editor.pasteAs.default",label:p(918,"Configure default paste action"),edit:void 0},C=await this._quickInputService.pick([...g.edits.map(w=>({label:w.title,description:w.kind?.value,edit:w})),...na._configureDefaultAction?[{type:"separator"},{label:na._configureDefaultAction.label,edit:void 0}]:[]],{placeHolder:p(919,"Select Paste Action")});if(C===b){na._configureDefaultAction?.run();return}m=C?.edit}if(!m)return;const _=BK(c.uri,i,m);await this._bulkEditService.apply(_,{editor:this._editor})}finally{d.dispose(),this._currentPasteOperation===r&&(this._currentPasteOperation=void 0)}});this._progressService.withProgress({location:10,title:p(920,"Running paste handlers")},()=>r)}setCopyMetadata(e,t){this._logService.trace("CopyPasteController#setCopyMetadata new id : ",t.id),e.setData(f4,JSON.stringify(t))}fetchCopyMetadata(e){if(this._logService.trace("CopyPasteController#fetchCopyMetadata"),!e.clipboardData)return;const t=e.clipboardData.getData(f4);if(t)try{return JSON.parse(t)}catch{return}const[i,n]=Af.getTextData(e.clipboardData);if(n)return{defaultPastePayload:{mode:n.mode,multicursorText:n.multicursorText??null,pasteOnNewLine:!!n.isFromEmptySelection}}}async mergeInDataFromCopy(e,t,i,n){if(this._logService.trace("CopyPasteController#mergeInDataFromCopy with metadata : ",i?.id),i?.id&&na._currentCopyOperation?.handle===i.id){const s=na._currentCopyOperation.operations.filter(a=>e.some(l=>l.pasteMimeTypes.some(c=>LK(c,a.providerMimeTypes)))).map(a=>a.operation),r=await Promise.all(s);if(n.isCancellationRequested)return;for(const a of r.reverse())if(a)for(const[l,c]of a)t.replace(l,c)}if(!t.has(_i.uriList)){const s=await this._clipboardService.readResources();if(n.isCancellationRequested)return;s.length&&t.append(_i.uriList,UO(xk.create(s)))}}async getPasteEdits(e,t,i,n,s,r){const a=new U,l=await Em(Promise.all(e.map(async d=>{try{const h=await d.provideDocumentPasteEdits?.(i,n,t,s,r);return h&&a.add(h),h?.edits?.map(u=>({...u,provider:d}))}catch(h){Do(h)||console.error(h);return}})),r),c=wa(l??[]).flat().filter(d=>!s.only||s.only.contains(d.kind));return{edits:HK(c),dispose:()=>a.dispose()}}async applyDefaultPasteHandler(e,t,i,n){const r=await(e.get(_i.text)??e.get("text"))?.asString()??"";if(i.isCancellationRequested)return;const a={clipboardEvent:n,text:r,pasteOnNewLine:t?.defaultPastePayload.pasteOnNewLine??!1,multicursorText:t?.defaultPastePayload.multicursorText??null,mode:null};this._logService.trace("CopyPasteController#applyDefaultPasteHandler for id : ",t?.id),this._editor.trigger("keyboard","paste",a)}isSupportedPasteProvider(e,t,i){return e.pasteMimeTypes?.some(n=>t.matches(n))?!i||this.providerMatchesPreference(e,i):!1}providerMatchesPreference(e,t){return"only"in t?e.providedPasteEditKinds.some(i=>t.only.contains(i)):"preferences"in t?t.preferences.some(i=>t.preferences.some(n=>n.contains(i))):e.id===t.providerId}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(cwe,{resource:e.uri});for(const n of Array.isArray(i)?i:[]){const s=new si(n),r=t.findIndex(a=>s.contains(a.kind));if(r>=0)return r}return 0}},na=Mp,Mp.ID="editor.contrib.copyPasteActionController",Mp);_d=na=lwe([md(1,ge),md(2,Rt),md(3,yw),md(4,Wa),md(5,Tt),md(6,Me),md(7,he),md(8,Zn),md(9,X$)],_d);const Eg="9_cutcopypaste",dwe=ma||document.queryCommandSupported("cut"),ZK=ma||document.queryCommandSupported("copy"),hwe=typeof navigator.clipboard>"u"||Fs?document.queryCommandSupported("paste"):!0;function g4(o){return o.register(),o}const uwe=dwe?g4(new zm({id:"editor.action.clipboardCutAction",precondition:void 0,kbOpts:ma?{primary:2102,win:{primary:2102,secondary:[1044]},weight:100}:void 0,menuOpts:[{menuId:de.MenubarEditMenu,group:"2_ccp",title:p(809,"Cu&&t"),order:1},{menuId:de.EditorContext,group:Eg,title:p(810,"Cut"),when:T.writable,order:1},{menuId:de.CommandPalette,group:"",title:p(811,"Cut"),order:1},{menuId:de.SimpleEditorContext,group:Eg,title:p(812,"Cut"),when:T.writable,order:1}]})):void 0,fwe=ZK?g4(new zm({id:"editor.action.clipboardCopyAction",precondition:void 0,kbOpts:ma?{primary:2081,win:{primary:2081,secondary:[2067]},weight:100}:void 0,menuOpts:[{menuId:de.MenubarEditMenu,group:"2_ccp",title:p(813,"&&Copy"),order:2},{menuId:de.EditorContext,group:Eg,title:p(814,"Copy"),order:2},{menuId:de.CommandPalette,group:"",title:p(815,"Copy"),order:1},{menuId:de.SimpleEditorContext,group:Eg,title:p(816,"Copy"),order:2}]})):void 0;an.appendMenuItem(de.MenubarEditMenu,{submenu:de.MenubarCopy,title:H(821,"Copy As"),group:"2_ccp",order:3}),an.appendMenuItem(de.EditorContext,{submenu:de.EditorContextCopy,title:H(822,"Copy As"),group:Eg,order:3}),an.appendMenuItem(de.EditorContext,{submenu:de.EditorContextShare,title:H(823,"Share"),group:"11_share",order:-1,when:K.and(K.notEquals("resourceScheme","output"),T.editorTextFocus)}),an.appendMenuItem(de.ExplorerContext,{submenu:de.ExplorerContextShare,title:H(824,"Share"),group:"11_share",order:-1});const p4=hwe?g4(new zm({id:"editor.action.clipboardPasteAction",precondition:void 0,kbOpts:ma?{primary:2100,win:{primary:2100,secondary:[1043]},linux:{primary:2100,secondary:[1043]},weight:100}:void 0,menuOpts:[{menuId:de.MenubarEditMenu,group:"2_ccp",title:p(817,"&&Paste"),order:4},{menuId:de.EditorContext,group:Eg,title:p(818,"Paste"),when:T.writable,order:4},{menuId:de.CommandPalette,group:"",title:p(819,"Paste"),order:1},{menuId:de.SimpleEditorContext,group:Eg,title:p(820,"Paste"),when:T.writable,order:4}]})):void 0;class gwe extends le{constructor(){super({id:"editor.action.clipboardCopyWithSyntaxHighlightingAction",label:H(825,"Copy with Syntax Highlighting"),precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,weight:100}})}run(e,t){const i=e.get(Rt);i.trace("ExecCommandCopyWithSyntaxHighlightingAction#run"),!(!t.hasModel()||!t.getOption(45)&&t.getSelection().isEmpty())&&(EM.forceCopyWithSyntaxHighlighting=!0,t.focus(),i.trace("ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)"),t.getContainerDomNode().ownerDocument.execCommand("copy"),i.trace("ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)"),EM.forceCopyWithSyntaxHighlighting=!1)}}function YK(o,e){o&&(o.addImplementation(1e4,"code-editor",(t,i)=>{const n=t.get(Rt);n.trace("registerExecCommandImpl (addImplementation code-editor for : ",e,")");const s=t.get(et).getFocusedCodeEditor();if(s&&s.hasTextFocus()){const r=s.getOption(45),a=s.getSelection();return a&&a.isEmpty()&&!r||(s.getOption(170)&&e==="cut"?(XK(s),n.trace("registerExecCommandImpl (before execCommand copy)"),s.getContainerDomNode().ownerDocument.execCommand("copy"),s.trigger(void 0,"cut",void 0),n.trace("registerExecCommandImpl (after execCommand copy)")):(XK(s),n.trace("registerExecCommandImpl (before execCommand "+e+")"),s.getContainerDomNode().ownerDocument.execCommand(e),n.trace("registerExecCommandImpl (after execCommand "+e+")"))),!0}return!1}),o.addImplementation(0,"generic-dom",(t,i)=>{const n=t.get(Rt);return n.trace("registerExecCommandImpl (addImplementation generic-dom for : ",e,")"),n.trace("registerExecCommandImpl (before execCommand "+e+")"),w1().execCommand(e),n.trace("registerExecCommandImpl (after execCommand "+e+")"),!0}))}function XK(o){if(o.getOption(170)){const t=fP.get(o.getId());t&&t.onWillCopy()}}YK(uwe,"cut"),YK(fwe,"copy"),p4&&(p4.addImplementation(1e4,"code-editor",(o,e)=>{const t=o.get(Rt);t.trace("registerExecCommandImpl (addImplementation code-editor for : paste)");const i=o.get(et),n=o.get(Wa),s=o.get(Vn),r=o.get(Ive),a=i.getFocusedCodeEditor();if(a&&a.hasModel()&&a.hasTextFocus()){if(a.getOption(170)){const h=fP.get(a.getId());h&&h.onWillPaste()}const c=Ki.create(!0);t.trace("registerExecCommandImpl (before triggerPaste)");const d=n.triggerPaste(ft().vscodeWindowId);return d?(t.trace("registerExecCommandImpl (triggerPaste defined)"),d.then(async()=>{if(t.trace("registerExecCommandImpl (after triggerPaste)"),r.quality!=="stable"){const h=c.elapsed();s.publicLog2("editorAsyncPaste",{duration:h})}return _d.get(a)?.finishedPaste()??Promise.resolve()})):(t.trace("registerExecCommandImpl (triggerPaste undefined)"),ol?(t.trace("registerExecCommandImpl (Paste handling on web)"),(async()=>{const h=await n.readText();if(h!==""){const u=wl.INSTANCE.get(h);let f=!1,g=null,m=null;u&&(f=a.getOption(45)&&!!u.isFromEmptySelection,g=typeof u.multicursorText<"u"?u.multicursorText:null,m=u.mode),t.trace("registerExecCommandImpl (clipboardText.length : ",h.length," id : ",u?.id,")"),a.trigger("keyboard","paste",{text:h,pasteOnNewLine:f,multicursorText:g,mode:m})}})()):!0)}return!1}),p4.addImplementation(0,"generic-dom",(o,e)=>(o.get(Rt).trace("registerExecCommandImpl (addImplementation generic-dom for : paste)"),o.get(Wa).triggerPaste(ft().vscodeWindowId)??!1))),ZK&&ne(gwe);const Fk=Object.freeze({id:"editor",order:5,type:"object",title:p(144,"Editor"),scope:6}),Wk={...Fk,properties:{"editor.tabSize":{type:"number",default:Un.tabSize,minimum:1,maximum:100,markdownDescription:p(145,"The number of spaces a tab is equal to. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.indentSize":{anyOf:[{type:"string",enum:["tabSize"]},{type:"number",minimum:1}],default:"tabSize",markdownDescription:p(146,'The number of spaces used for indentation or `"tabSize"` to use the value from `#editor.tabSize#`. This setting is overridden based on the file contents when `#editor.detectIndentation#` is on.')},"editor.insertSpaces":{type:"boolean",default:Un.insertSpaces,markdownDescription:p(147,"Insert spaces when pressing `Tab`. This setting is overridden based on the file contents when {0} is on.","`#editor.detectIndentation#`")},"editor.detectIndentation":{type:"boolean",default:Un.detectIndentation,markdownDescription:p(148,"Controls whether {0} and {1} will be automatically detected when a file is opened based on the file contents.","`#editor.tabSize#`","`#editor.insertSpaces#`")},"editor.trimAutoWhitespace":{type:"boolean",default:Un.trimAutoWhitespace,description:p(149,"Remove trailing auto inserted whitespace.")},"editor.largeFileOptimizations":{type:"boolean",default:Un.largeFileOptimizations,description:p(150,"Special handling for large files to disable certain memory intensive features.")},"editor.wordBasedSuggestions":{enum:["off","currentDocument","matchingDocuments","allDocuments"],default:"matchingDocuments",enumDescriptions:[p(151,"Turn off Word Based Suggestions."),p(152,"Only suggest words from the active document."),p(153,"Suggest words from all open documents of the same language."),p(154,"Suggest words from all open documents.")],description:p(155,"Controls whether completions should be computed based on words in the document and from which documents they are computed.")},"editor.semanticHighlighting.enabled":{enum:[!0,!1,"configuredByTheme"],enumDescriptions:[p(156,"Semantic highlighting enabled for all color themes."),p(157,"Semantic highlighting disabled for all color themes."),p(158,"Semantic highlighting is configured by the current color theme's `semanticHighlighting` setting.")],default:"configuredByTheme",description:p(159,"Controls whether the semanticHighlighting is shown for the languages that support it.")},"editor.stablePeek":{type:"boolean",default:!1,markdownDescription:p(160,"Keep peek editors open even when double-clicking their content or when hitting `Escape`.")},"editor.maxTokenizationLineLength":{type:"integer",default:2e4,description:p(161,"Lines above this length will not be tokenized for performance reasons")},"editor.experimental.asyncTokenization":{type:"boolean",default:!0,description:p(162,"Controls whether the tokenization should happen asynchronously on a web worker."),tags:["experimental"]},"editor.experimental.asyncTokenizationLogging":{type:"boolean",default:!1,description:p(163,"Controls whether async tokenization should be logged. For debugging only.")},"editor.experimental.asyncTokenizationVerification":{type:"boolean",default:!1,description:p(164,"Controls whether async tokenization should be verified against legacy background tokenization. Might slow down tokenization. For debugging only."),tags:["experimental"]},"editor.experimental.treeSitterTelemetry":{type:"boolean",default:!1,markdownDescription:p(165,"Controls whether tree sitter parsing should be turned on and telemetry collected. Setting `#editor.experimental.preferTreeSitter#` for specific languages will take precedence."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.css":{type:"boolean",default:!1,markdownDescription:p(166,"Controls whether tree sitter parsing should be turned on for css. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for css."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.typescript":{type:"boolean",default:!1,markdownDescription:p(167,"Controls whether tree sitter parsing should be turned on for typescript. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for typescript."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.ini":{type:"boolean",default:!1,markdownDescription:p(168,"Controls whether tree sitter parsing should be turned on for ini. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for ini."),tags:["experimental"],experiment:{mode:"auto"}},"editor.experimental.preferTreeSitter.regex":{type:"boolean",default:!1,markdownDescription:p(169,"Controls whether tree sitter parsing should be turned on for regex. This will take precedence over `#editor.experimental.treeSitterTelemetry#` for regex."),tags:["experimental"],experiment:{mode:"auto"}},"editor.language.brackets":{type:["array","null"],default:null,description:p(170,"Defines the bracket symbols that increase or decrease the indentation."),items:{type:"array",items:[{type:"string",description:p(171,"The opening bracket character or string sequence.")},{type:"string",description:p(172,"The closing bracket character or string sequence.")}]}},"editor.language.colorizedBracketPairs":{type:["array","null"],default:null,description:p(173,"Defines the bracket pairs that are colorized by their nesting level if bracket pair colorization is enabled."),items:{type:"array",items:[{type:"string",description:p(174,"The opening bracket character or string sequence.")},{type:"string",description:p(175,"The closing bracket character or string sequence.")}]}},"diffEditor.maxComputationTime":{type:"number",default:Mn.maxComputationTime,description:p(176,"Timeout in milliseconds after which diff computation is cancelled. Use 0 for no timeout.")},"diffEditor.maxFileSize":{type:"number",default:Mn.maxFileSize,description:p(177,"Maximum file size in MB for which to compute diffs. Use 0 for no limit.")},"diffEditor.renderSideBySide":{type:"boolean",default:Mn.renderSideBySide,description:p(178,"Controls whether the diff editor shows the diff side by side or inline.")},"diffEditor.renderSideBySideInlineBreakpoint":{type:"number",default:Mn.renderSideBySideInlineBreakpoint,description:p(179,"If the diff editor width is smaller than this value, the inline view is used.")},"diffEditor.useInlineViewWhenSpaceIsLimited":{type:"boolean",default:Mn.useInlineViewWhenSpaceIsLimited,description:p(180,"If enabled and the editor width is too small, the inline view is used.")},"diffEditor.renderMarginRevertIcon":{type:"boolean",default:Mn.renderMarginRevertIcon,description:p(181,"When enabled, the diff editor shows arrows in its glyph margin to revert changes.")},"diffEditor.renderGutterMenu":{type:"boolean",default:Mn.renderGutterMenu,description:p(182,"When enabled, the diff editor shows a special gutter for revert and stage actions.")},"diffEditor.ignoreTrimWhitespace":{type:"boolean",default:Mn.ignoreTrimWhitespace,description:p(183,"When enabled, the diff editor ignores changes in leading or trailing whitespace.")},"diffEditor.renderIndicators":{type:"boolean",default:Mn.renderIndicators,description:p(184,"Controls whether the diff editor shows +/- indicators for added/removed changes.")},"diffEditor.codeLens":{type:"boolean",default:Mn.diffCodeLens,description:p(185,"Controls whether the editor shows CodeLens.")},"diffEditor.wordWrap":{type:"string",enum:["off","on","inherit"],default:Mn.diffWordWrap,markdownEnumDescriptions:[p(186,"Lines will never wrap."),p(187,"Lines will wrap at the viewport width."),p(188,"Lines will wrap according to the {0} setting.","`#editor.wordWrap#`")]},"diffEditor.diffAlgorithm":{type:"string",enum:["legacy","advanced"],default:Mn.diffAlgorithm,markdownEnumDescriptions:[p(189,"Uses the legacy diffing algorithm."),p(190,"Uses the advanced diffing algorithm.")]},"diffEditor.hideUnchangedRegions.enabled":{type:"boolean",default:Mn.hideUnchangedRegions.enabled,markdownDescription:p(191,"Controls whether the diff editor shows unchanged regions.")},"diffEditor.hideUnchangedRegions.revealLineCount":{type:"integer",default:Mn.hideUnchangedRegions.revealLineCount,markdownDescription:p(192,"Controls how many lines are used for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.minimumLineCount":{type:"integer",default:Mn.hideUnchangedRegions.minimumLineCount,markdownDescription:p(193,"Controls how many lines are used as a minimum for unchanged regions."),minimum:1},"diffEditor.hideUnchangedRegions.contextLineCount":{type:"integer",default:Mn.hideUnchangedRegions.contextLineCount,markdownDescription:p(194,"Controls how many lines are used as context when comparing unchanged regions."),minimum:1},"diffEditor.experimental.showMoves":{type:"boolean",default:Mn.experimental.showMoves,markdownDescription:p(195,"Controls whether the diff editor should show detected code moves.")},"diffEditor.experimental.showEmptyDecorations":{type:"boolean",default:Mn.experimental.showEmptyDecorations,description:p(196,"Controls whether the diff editor shows empty decorations to see where characters got inserted or deleted.")},"diffEditor.experimental.useTrueInlineView":{type:"boolean",default:Mn.experimental.useTrueInlineView,description:p(197,"If enabled and the editor uses the inline view, word changes are rendered inline.")}}};function pwe(o){return typeof o.type<"u"||typeof o.anyOf<"u"}for(const o of n_){const e=o.schema;if(typeof e<"u")if(pwe(e))Wk.properties[`editor.${o.name}`]=e;else for(const t in e)Object.hasOwnProperty.call(e,t)&&(Wk.properties[t]=e[t])}let Bk=null;function QK(){return Bk===null&&(Bk=Object.create(null),Object.keys(Wk.properties).forEach(o=>{Bk[o]=!0})),Bk}function mwe(o){return QK()[`editor.${o}`]||!1}function _we(o){return QK()[`diffEditor.${o}`]||!1}ei.as(ka.Configuration).registerConfiguration(Wk);const Kt=new class{constructor(){this.QuickFix=new si("quickfix"),this.Refactor=new si("refactor"),this.RefactorExtract=this.Refactor.append("extract"),this.RefactorInline=this.Refactor.append("inline"),this.RefactorMove=this.Refactor.append("move"),this.RefactorRewrite=this.Refactor.append("rewrite"),this.Notebook=new si("notebook"),this.Source=new si("source"),this.SourceOrganizeImports=this.Source.append("organizeImports"),this.SourceFixAll=this.Source.append("fixAll"),this.SurroundWith=this.Refactor.append("surround")}};var yo;(function(o){o.Refactor="refactor",o.RefactorPreview="refactor preview",o.Lightbulb="lightbulb",o.Default="other (default)",o.SourceAction="source action",o.QuickFix="quick fix action",o.FixAll="fix all",o.OrganizeImports="organize imports",o.AutoFix="auto fix",o.QuickFixHover="quick fix hover window",o.OnSave="save participants",o.ProblemsView="problems view"})(yo||(yo={}));function bwe(o,e){return!(o.include&&!o.include.intersects(e)||o.excludes&&o.excludes.some(t=>JK(e,t,o.include))||!o.includeSourceActions&&Kt.Source.contains(e))}function Cwe(o,e){const t=e.kind?new si(e.kind):void 0;return!(o.include&&(!t||!o.include.contains(t))||o.excludes&&t&&o.excludes.some(i=>JK(t,i,o.include))||!o.includeSourceActions&&t&&Kt.Source.contains(t)||o.onlyIncludePreferredActions&&!e.isPreferred)}function JK(o,e,t){return!(!e.contains(o)||t&&e.contains(t))}class Vl{static fromUser(e,t){return!e||typeof e!="object"?new Vl(t.kind,t.apply,!1):new Vl(Vl.getKindFromUser(e,t.kind),Vl.getApplyFromUser(e,t.apply),Vl.getPreferredUser(e))}static getApplyFromUser(e,t){switch(typeof e.apply=="string"?e.apply.toLowerCase():""){case"first":return"first";case"never":return"never";case"ifsingle":return"ifSingle";default:return t}}static getKindFromUser(e,t){return typeof e.kind=="string"?new si(e.kind):t}static getPreferredUser(e){return typeof e.preferred=="boolean"?e.preferred:!1}constructor(e,t,i){this.kind=e,this.apply=t,this.preferred=i}}class vwe{constructor(e,t,i){this.action=e,this.provider=t,this.highlightRange=i}async resolve(e){if(this.provider?.resolveCodeAction&&!this.action.edit){let t;try{t=await this.provider.resolveCodeAction(this.action,e)}catch(i){Di(i)}t&&(this.action.edit=t.edit)}return this}}const eG="editor.action.codeAction",m4="editor.action.quickFix",tG="editor.action.autoFix",iG="editor.action.refactor",nG="editor.action.sourceAction",_4="editor.action.organizeImports",b4="editor.action.fixAll",wwe=1e3;class Dw extends A{static codeActionsPreferredComparator(e,t){return e.isPreferred&&!t.isPreferred?-1:!e.isPreferred&&t.isPreferred?1:0}static codeActionsComparator({action:e},{action:t}){return e.isAI&&!t.isAI?1:!e.isAI&&t.isAI?-1:is(e.diagnostics)?is(t.diagnostics)?Dw.codeActionsPreferredComparator(e,t):-1:is(t.diagnostics)?1:Dw.codeActionsPreferredComparator(e,t)}constructor(e,t,i){super(),this.documentation=t,this._register(i),this.allActions=[...e].sort(Dw.codeActionsComparator),this.validActions=this.allActions.filter(({action:n})=>!n.disabled)}get hasAutoFix(){return this.validActions.some(({action:e})=>!!e.kind&&Kt.QuickFix.contains(new si(e.kind))&&!!e.isPreferred)}get hasAIFix(){return this.validActions.some(({action:e})=>!!e.isAI)}get allAIFixes(){return this.validActions.every(({action:e})=>!!e.isAI)}}const sG={actions:[],documentation:void 0};async function ob(o,e,t,i,n,s){const r=i.filter||{},a={...r,excludes:[...r.excludes||[],Kt.Notebook]},l={only:r.include?.value,trigger:i.type},c=new KO(e,s),d=i.type===2,h=Swe(o,e,d?a:r),u=new U,f=h.map(async m=>{const _=setTimeout(()=>n.report(m),1250);try{const b=await m.provideCodeActions(e,t,l,c.token);if(c.token.isCancellationRequested)return b?.dispose(),sG;b&&u.add(b);const C=(b?.actions||[]).filter(v=>v&&Cwe(r,v)),w=Lwe(m,C,r.include);return{actions:C.map(v=>new vwe(v,m)),documentation:w}}catch(b){if(Do(b))throw b;return Di(b),sG}finally{clearTimeout(_)}}),g=o.onDidChange(()=>{const m=o.all(e);Ut(m,h)||c.cancel()});try{const m=await Promise.all(f),_=m.map(w=>w.actions).flat(),b=[...wa(m.map(w=>w.documentation)),...ywe(o,e,i,_)],C=new Dw(_,b,u);return u.add(C),C}catch(m){throw u.dispose(),m}finally{g.dispose(),c.dispose()}}function Swe(o,e,t){return o.all(e).filter(i=>i.providedCodeActionKinds?i.providedCodeActionKinds.some(n=>bwe(t,new si(n))):!0)}function*ywe(o,e,t,i){if(e&&i.length)for(const n of o.all(e))n._getAdditionalMenuItems&&(yield*n._getAdditionalMenuItems?.({trigger:t.type,only:t.filter?.include?.value},i.map(s=>s.action)))}function Lwe(o,e,t){if(!o.documentation)return;const i=o.documentation.map(n=>({kind:new si(n.kind),command:n.command}));if(t){let n;for(const s of i)s.kind.contains(t)&&(n?n.kind.contains(s.kind)&&(n=s):n=s);if(n)return n?.command}for(const n of e)if(n.kind){for(const s of i)if(s.kind.contains(new si(n.kind)))return s.command}}var Kh;(function(o){o.OnSave="onSave",o.FromProblemsView="fromProblemsView",o.FromCodeActions="fromCodeActions",o.FromAILightbulb="fromAILightbulb",o.FromProblemsHover="fromProblemsHover"})(Kh||(Kh={}));async function xwe(o,e,t,i,n=He.None){const s=o.get(yw),r=o.get(Tt),a=o.get(Vn),l=o.get(hi),c=o.get(nd);if(a.publicLog2("codeAction.applyCodeAction",{codeActionTitle:e.action.title,codeActionKind:e.action.kind,codeActionIsPreferred:!!e.action.isPreferred,reason:t}),c.playSignal(xs.codeActionTriggered),await e.resolve(n),!n.isCancellationRequested&&!(e.action.edit?.edits.length&&!(await s.apply(e.action.edit,{editor:i?.editor,label:e.action.title,quotableLabel:e.action.title,code:"undoredo.codeAction",respectAutoSaveConfig:t!==Kh.OnSave,showPreview:i?.preview,reason:jn.codeAction({kind:e.action.kind,providerId:XL.fromExtensionId(e.provider?.extensionId)})})).isApplied)){if(e.action.command)try{await r.executeCommand(e.action.command.id,...e.action.command.arguments||[])}catch(d){const h=kwe(d);l.error(typeof h=="string"?h:p(826,"An unknown error occurred while applying the code action"))}setTimeout(()=>c.playSignal(xs.codeActionApplied),wwe)}}function kwe(o){return typeof o=="string"?o:o instanceof Error&&typeof o.message=="string"?o.message:void 0}Xe.registerCommand("_executeCodeActionProvider",async function(o,e,t,i,n){if(!(e instanceof be))throw dr();const{codeActionProvider:s}=o.get(he),r=o.get(Qt).getModel(e);if(!r)throw dr();const a=ce.isISelection(t)?ce.liftSelection(t):k.isIRange(t)?r.validateRange(t):void 0;if(!a)throw dr();const l=typeof i=="string"?new si(i):void 0,c=await ob(s,r,a,{type:1,triggerAction:yo.Default,filter:{includeSourceActions:!0,include:l}},Pa.None,He.None),d=[],h=Math.min(c.validActions.length,typeof n=="number"?n:0);for(let u=0;u<h;u++)d.push(c.validActions[u].resolve(He.None));try{return await Promise.all(d),c.validActions.map(u=>u.action)}finally{setTimeout(()=>c.dispose(),100)}});var oi;(function(o){o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error"})(oi||(oi={})),(function(o){function e(l,c){return c-l}o.compare=e;const t=Object.create(null);t[o.Error]=p(1715,"Error"),t[o.Warning]=p(1716,"Warning"),t[o.Info]=p(1717,"Info");function i(l){return t[l]||""}o.toString=i;const n=Object.create(null);n[o.Error]=p(1718,"Errors"),n[o.Warning]=p(1719,"Warnings"),n[o.Info]=p(1720,"Infos");function s(l){return n[l]||""}o.toStringPlural=s;function r(l){switch(l){case ii.Error:return o.Error;case ii.Warning:return o.Warning;case ii.Info:return o.Info;case ii.Ignore:return o.Hint}}o.fromSeverity=r;function a(l){switch(l){case o.Error:return ii.Error;case o.Warning:return ii.Warning;case o.Info:return ii.Info;case o.Hint:return ii.Ignore}}o.toSeverity=a})(oi||(oi={}));var Hk;(function(o){function t(n){return i(n,!0)}o.makeKey=t;function i(n,s){const r=[""];return n.source?r.push(n.source.replace("¦","\\¦")):r.push(""),n.code?typeof n.code=="string"?r.push(n.code.replace("¦","\\¦")):r.push(n.code.value.replace("¦","\\¦")):r.push(""),n.severity!==void 0&&n.severity!==null?r.push(oi.toString(n.severity)):r.push(""),n.message&&s?r.push(n.message.replace("¦","\\¦")):r.push(""),n.startLineNumber!==void 0&&n.startLineNumber!==null?r.push(n.startLineNumber.toString()):r.push(""),n.startColumn!==void 0&&n.startColumn!==null?r.push(n.startColumn.toString()):r.push(""),n.endLineNumber!==void 0&&n.endLineNumber!==null?r.push(n.endLineNumber.toString()):r.push(""),n.endColumn!==void 0&&n.endColumn!==null?r.push(n.endColumn.toString()):r.push(""),r.push(""),r.join("¦")}o.makeKeyOptionalMessage=i})(Hk||(Hk={}));const zl=We("markerService");var Iwe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Dwe=function(o,e){return function(t,i){e(t,i,o)}},C4;let v4=(Pp=class{constructor(e){this.keybindingService=e}getResolver(){const e=new Ln(()=>this.keybindingService.getKeybindings().filter(t=>C4.codeActionCommands.indexOf(t.command)>=0).filter(t=>t.resolvedKeybinding).map(t=>{let i=t.commandArgs;return t.command===_4?i={kind:Kt.SourceOrganizeImports.value}:t.command===b4&&(i={kind:Kt.SourceFixAll.value}),{resolvedKeybinding:t.resolvedKeybinding,...Vl.fromUser(i,{kind:si.None,apply:"never"})}}));return t=>{if(t.kind)return this.bestKeybindingForCodeAction(t,e.value)?.resolvedKeybinding}}bestKeybindingForCodeAction(e,t){if(!e.kind)return;const i=new si(e.kind);return t.filter(n=>n.kind.contains(i)).filter(n=>n.preferred?e.isPreferred:!0).reduceRight((n,s)=>n?n.kind.contains(s.kind)?s:n:s,void 0)}},C4=Pp,Pp.codeActionCommands=[iG,eG,nG,_4,b4],Pp);v4=C4=Iwe([Dwe(0,ot)],v4),N("symbolIcon.arrayForeground",Ue,p(1480,"The foreground color for array symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.booleanForeground",Ue,p(1481,"The foreground color for boolean symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.classForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p(1482,"The foreground color for class symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.colorForeground",Ue,p(1483,"The foreground color for color symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.constantForeground",Ue,p(1484,"The foreground color for constant symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.constructorForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p(1485,"The foreground color for constructor symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.enumeratorForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p(1486,"The foreground color for enumerator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.enumeratorMemberForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p(1487,"The foreground color for enumerator member symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.eventForeground",{dark:"#EE9D28",light:"#D67E00",hcDark:"#EE9D28",hcLight:"#D67E00"},p(1488,"The foreground color for event symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.fieldForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p(1489,"The foreground color for field symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.fileForeground",Ue,p(1490,"The foreground color for file symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.folderForeground",Ue,p(1491,"The foreground color for folder symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.functionForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p(1492,"The foreground color for function symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.interfaceForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p(1493,"The foreground color for interface symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.keyForeground",Ue,p(1494,"The foreground color for key symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.keywordForeground",Ue,p(1495,"The foreground color for keyword symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.methodForeground",{dark:"#B180D7",light:"#652D90",hcDark:"#B180D7",hcLight:"#652D90"},p(1496,"The foreground color for method symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.moduleForeground",Ue,p(1497,"The foreground color for module symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.namespaceForeground",Ue,p(1498,"The foreground color for namespace symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.nullForeground",Ue,p(1499,"The foreground color for null symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.numberForeground",Ue,p(1500,"The foreground color for number symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.objectForeground",Ue,p(1501,"The foreground color for object symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.operatorForeground",Ue,p(1502,"The foreground color for operator symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.packageForeground",Ue,p(1503,"The foreground color for package symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.propertyForeground",Ue,p(1504,"The foreground color for property symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.referenceForeground",Ue,p(1505,"The foreground color for reference symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.snippetForeground",Ue,p(1506,"The foreground color for snippet symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.stringForeground",Ue,p(1507,"The foreground color for string symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.structForeground",Ue,p(1508,"The foreground color for struct symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.textForeground",Ue,p(1509,"The foreground color for text symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.typeParameterForeground",Ue,p(1510,"The foreground color for type parameter symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.unitForeground",Ue,p(1511,"The foreground color for unit symbols. These symbols appear in the outline, breadcrumb, and suggest widget.")),N("symbolIcon.variableForeground",{dark:"#75BEFF",light:"#007ACC",hcDark:"#75BEFF",hcLight:"#007ACC"},p(1512,"The foreground color for variable symbols. These symbols appear in the outline, breadcrumb, and suggest widget."));const oG=Object.freeze({kind:si.Empty,title:p(862,"More Actions...")}),Ewe=Object.freeze([{kind:Kt.QuickFix,title:p(863,"Quick Fix")},{kind:Kt.RefactorExtract,title:p(864,"Extract"),icon:Y.wrench},{kind:Kt.RefactorInline,title:p(865,"Inline"),icon:Y.wrench},{kind:Kt.RefactorRewrite,title:p(866,"Rewrite"),icon:Y.wrench},{kind:Kt.RefactorMove,title:p(867,"Move"),icon:Y.wrench},{kind:Kt.SurroundWith,title:p(868,"Surround With"),icon:Y.surroundWith},{kind:Kt.Source,title:p(869,"Source Action"),icon:Y.symbolFile},oG]);function Nwe(o,e,t){if(!e)return o.map(s=>({kind:"action",item:s,group:oG,disabled:!!s.action.disabled,label:s.action.disabled||s.action.title,canPreview:!!s.action.edit?.edits.length}));const i=Ewe.map(s=>({group:s,actions:[]}));for(const s of o){const r=s.action.kind?new si(s.action.kind):si.None;for(const a of i)if(a.group.kind.contains(r)){a.actions.push(s);break}}const n=[];for(const s of i)if(s.actions.length){n.push({kind:"header",group:s.group});for(const r of s.actions){const a=s.group;n.push({kind:"action",item:r,group:r.action.isAI?{title:a.title,kind:a.kind,icon:Y.sparkle}:a,label:r.action.title,disabled:!!r.action.disabled,keybinding:t(r.action)})}}return n}const rG=new ae("supportedCodeAction",""),aG="_typescript.applyFixAllCodeAction";class Twe extends A{constructor(e,t,i,n=250){super(),this._editor=e,this._markerService=t,this._signalChange=i,this._delay=n,this._autoTriggerTimer=this._register(new No),this._register(this._markerService.onMarkerChanged(s=>this._onMarkerChanges(s))),this._register(this._editor.onDidChangeCursorPosition(()=>this._tryAutoTrigger()))}trigger(e){const t=this._getRangeOfSelectionUnlessWhitespaceEnclosed(e);this._signalChange(t?{trigger:e,selection:t}:void 0)}_onMarkerChanges(e){const t=this._editor.getModel();t&&e.some(i=>ch(i,t.uri))&&this._tryAutoTrigger()}_tryAutoTrigger(){this._autoTriggerTimer.cancelAndSet(()=>{this.trigger({type:2,triggerAction:yo.Default})},this._delay)}_getRangeOfSelectionUnlessWhitespaceEnclosed(e){if(!this._editor.hasModel())return;const t=this._editor.getSelection();if(e.type===1)return t;const i=this._editor.getOption(73).enabled;if(i!==Xr.Off){{if(i===Xr.On)return t;if(i===Xr.OnCode){if(!t.isEmpty())return t;const s=this._editor.getModel(),{lineNumber:r,column:a}=t.getPosition(),l=s.getLineContent(r);if(l.length===0)return;if(a===1){if(/\s/.test(l[0]))return}else if(a===s.getLineMaxColumn(r)){if(/\s/.test(l[l.length-1]))return}else if(/\s/.test(l[a-2])&&/\s/.test(l[a-1]))return}}return t}}}var Ng;(function(o){o.Empty={type:0};class e{constructor(i,n,s){this.trigger=i,this.position=n,this._cancellablePromise=s,this.type=1,this.actions=s.catch(r=>{if(Do(r))return w4;throw r})}cancel(){this._cancellablePromise.cancel()}}o.Triggered=e})(Ng||(Ng={}));const w4=Object.freeze({allActions:[],validActions:[],dispose:()=>{},documentation:[],hasAutoFix:!1,hasAIFix:!1,allAIFixes:!1});class Rwe extends A{constructor(e,t,i,n,s,r){super(),this._editor=e,this._registry=t,this._markerService=i,this._progressService=s,this._configurationService=r,this._codeActionOracle=this._register(new ct),this._state=Ng.Empty,this._onDidChangeState=this._register(new P),this.onDidChangeState=this._onDidChangeState.event,this.codeActionsDisposable=this._register(new ct),this._disposed=!1,this._supportedCodeActions=rG.bindTo(n),this._register(this._editor.onDidChangeModel(()=>this._update())),this._register(this._editor.onDidChangeModelLanguage(()=>this._update())),this._register(this._registry.onDidChange(()=>this._update())),this._register(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(73)&&this._update()})),this._update()}dispose(){this._disposed||(this._disposed=!0,super.dispose(),this.setState(Ng.Empty,!0))}_settingEnabledNearbyQuickfixes(){const e=this._editor?.getModel();return this._configurationService?this._configurationService.getValue("editor.codeActionWidget.includeNearbyQuickFixes",{resource:e?.uri}):!1}_update(){if(this._disposed)return;this._codeActionOracle.value=void 0,this.setState(Ng.Empty);const e=this._editor.getModel();if(e&&this._registry.has(e)&&!this._editor.getOption(104)){const t=this._registry.all(e).flatMap(i=>i.providedCodeActionKinds??[]);this._supportedCodeActions.set(t.join(" ")),this._codeActionOracle.value=new Twe(this._editor,this._markerService,i=>{if(!i){this.setState(Ng.Empty);return}const n=i.selection.getStartPosition(),s=Vi(async l=>{if(this._settingEnabledNearbyQuickfixes()&&i.trigger.type===1&&(i.trigger.triggerAction===yo.QuickFix||i.trigger.filter?.include?.contains(Kt.QuickFix))){const d=await ob(this._registry,e,i.selection,i.trigger,Pa.None,l);this.codeActionsDisposable.value=d;const h=[...d.allActions];if(l.isCancellationRequested)return d.dispose(),w4;const u=d.validActions?.some(g=>g.action.kind&&Kt.QuickFix.contains(new si(g.action.kind))&&!g.action.isAI),f=this._markerService.read({resource:e.uri});if(u){for(const g of d.validActions)g.action.command?.arguments?.some(m=>typeof m=="string"&&m.includes(aG))&&(g.action.diagnostics=[...f.filter(m=>m.relatedInformation)]);return{validActions:d.validActions,allActions:h,documentation:d.documentation,hasAutoFix:d.hasAutoFix,hasAIFix:d.hasAIFix,allAIFixes:d.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=d}}}else if(!u&&f.length>0){const g=i.selection.getPosition();let m=g,_=Number.MAX_VALUE;const b=[...d.validActions];for(const w of f){const v=w.endColumn,S=w.endLineNumber,L=w.startLineNumber;if(S===g.lineNumber||L===g.lineNumber){m=new M(S,v);const x={type:i.trigger.type,triggerAction:i.trigger.triggerAction,filter:{include:i.trigger.filter?.include?i.trigger.filter?.include:Kt.QuickFix},autoApply:i.trigger.autoApply,context:{notAvailableMessage:i.trigger.context?.notAvailableMessage||"",position:m}},I=new ce(m.lineNumber,m.column,m.lineNumber,m.column),D=await ob(this._registry,e,I,x,Pa.None,l);if(l.isCancellationRequested)return D.dispose(),w4;if(D.validActions.length!==0){for(const R of D.validActions)R.action.command?.arguments?.some(F=>typeof F=="string"&&F.includes(aG))&&(R.action.diagnostics=[...f.filter(F=>F.relatedInformation)]);d.allActions.length===0&&h.push(...D.allActions),Math.abs(g.column-v)<_?b.unshift(...D.validActions):b.push(...D.validActions)}_=Math.abs(g.column-v)}}const C=b.filter((w,v,S)=>S.findIndex(L=>L.action.title===w.action.title)===v);return C.sort((w,v)=>w.action.isPreferred&&!v.action.isPreferred?-1:!w.action.isPreferred&&v.action.isPreferred||w.action.isAI&&!v.action.isAI?1:!w.action.isAI&&v.action.isAI?-1:0),{validActions:C,allActions:h,documentation:d.documentation,hasAutoFix:d.hasAutoFix,hasAIFix:d.hasAIFix,allAIFixes:d.allAIFixes,dispose:()=>{this.codeActionsDisposable.value=d}}}}if(i.trigger.type===1){const d=await ob(this._registry,e,i.selection,i.trigger,Pa.None,l);return this.codeActionsDisposable.value=d,d}const c=await ob(this._registry,e,i.selection,i.trigger,Pa.None,l);return this.codeActionsDisposable.value=c,c});i.trigger.type===1&&this._progressService?.showWhile(s,250);const r=new Ng.Triggered(i.trigger,n,s);let a=!1;this._state.type===1&&(a=this._state.trigger.type===1&&r.type===1&&r.trigger.type===2&&this._state.position!==r.position),a?setTimeout(()=>{this.setState(r)},500):this.setState(r)},void 0),this._codeActionOracle.value.trigger({type:2,triggerAction:yo.Default})}else this._supportedCodeActions.reset()}trigger(e){this._codeActionOracle.value?.trigger(e),this.codeActionsDisposable.dispose()}setState(e,t){e!==this._state&&(this._state.type===1&&this._state.cancel(),this._state=e,!t&&!this._disposed&&this._onDidChangeState.fire(e))}}var Mwe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pwe=function(o,e){return function(t,i){e(t,i,o)}},rb;const lG=Wt("gutter-lightbulb",Y.lightBulb,p(870,"Icon which spawns code actions menu from the gutter when there is no space in the editor.")),cG=Wt("gutter-lightbulb-auto-fix",Y.lightbulbAutofix,p(871,"Icon which spawns code actions menu from the gutter when there is no space in the editor and a quick fix is available.")),dG=Wt("gutter-lightbulb-sparkle",Y.lightbulbSparkle,p(872,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix is available.")),hG=Wt("gutter-lightbulb-aifix-auto-fix",Y.lightbulbSparkleAutofix,p(873,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available.")),uG=Wt("gutter-lightbulb-sparkle-filled",Y.sparkleFilled,p(874,"Icon which spawns code actions menu from the gutter when there is no space in the editor and an AI fix and a quick fix is available."));var za;(function(o){o.Hidden={type:0};class e{constructor(i,n,s,r){this.actions=i,this.trigger=n,this.editorPosition=s,this.widgetPosition=r,this.type=1}}o.Showing=e})(za||(za={}));let Ew=(Ud=class extends A{constructor(e,t){super(),this._editor=e,this._keybindingService=t,this._onClick=this._register(new P),this.onClick=this._onClick.event,this._state=za.Hidden,this._gutterState=za.Hidden,this._iconClasses=[],this.lightbulbClasses=["codicon-"+lG.id,"codicon-"+hG.id,"codicon-"+cG.id,"codicon-"+dG.id,"codicon-"+uG.id],this.gutterDecoration=rb.GUTTER_DECORATION,this._domNode=Q("div.lightBulbWidget"),this._domNode.role="listbox",this._register($n.ignoreTarget(this._domNode)),this._editor.addContentWidget(this),this._register(this._editor.onDidChangeModelContent(i=>{const n=this._editor.getModel();(this.state.type!==1||!n||this.state.editorPosition.lineNumber>=n.getLineCount())&&this.hide(),(this.gutterState.type!==1||!n||this.gutterState.editorPosition.lineNumber>=n.getLineCount())&&this.gutterHide()})),this._register(Qne(this._domNode,i=>{if(this.state.type!==1)return;this._editor.focus(),i.preventDefault();const{top:n,height:s}=mi(this._domNode),r=this._editor.getOption(75);let a=Math.floor(r/3);this.state.widgetPosition.position!==null&&this.state.widgetPosition.position.lineNumber<this.state.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.posx,y:n+s+a,actions:this.state.actions,trigger:this.state.trigger})})),this._register(W(this._domNode,"mouseenter",i=>{(i.buttons&1)===1&&this.hide()})),this._register(ie.runAndSubscribe(this._keybindingService.onDidUpdateKeybindings,()=>{this._preferredKbLabel=this._keybindingService.lookupKeybinding(tG)?.getLabel()??void 0,this._quickFixKbLabel=this._keybindingService.lookupKeybinding(m4)?.getLabel()??void 0,this._updateLightBulbTitleAndIcon()})),this._register(this._editor.onMouseDown(async i=>{if(!i.target.element||!this.lightbulbClasses.some(l=>i.target.element&&i.target.element.classList.contains(l))||this.gutterState.type!==1)return;this._editor.focus();const{top:n,height:s}=mi(i.target.element),r=this._editor.getOption(75);let a=Math.floor(r/3);this.gutterState.widgetPosition.position!==null&&this.gutterState.widgetPosition.position.lineNumber<this.gutterState.editorPosition.lineNumber&&(a+=r),this._onClick.fire({x:i.event.posx,y:n+s+a,actions:this.gutterState.actions,trigger:this.gutterState.trigger})}))}dispose(){super.dispose(),this._editor.removeContentWidget(this),this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID)}getId(){return"LightBulbWidget"}getDomNode(){return this._domNode}getPosition(){return this._state.type===1?this._state.widgetPosition:null}update(e,t,i){if(e.validActions.length<=0)return this.gutterHide(),this.hide();if(!this._editor.hasTextFocus())return this.gutterHide(),this.hide();if(!this._editor.getOptions().get(73).enabled)return this.gutterHide(),this.hide();const r=this._editor.getModel();if(!r)return this.gutterHide(),this.hide();const{lineNumber:a,column:l}=r.validatePosition(i),c=r.getOptions().tabSize,d=this._editor.getOptions().get(59),h=r.getLineContent(a),u=qL(h,c),f=d.spaceWidth*u>22,g=S=>S>2&&this._editor.getTopForLineNumber(S)===this._editor.getTopForLineNumber(S-1),m=this._editor.getLineDecorations(a);let _=!1;if(m)for(const S of m){const L=S.options.glyphMarginClassName;if(L&&!this.lightbulbClasses.some(x=>L.includes(x))){_=!0;break}}let b=a,C=1;if(!f){const S=L=>{const x=r.getLineContent(L);return/^\s*$|^\s+/.test(x)||x.length<=C};if(a>1&&!g(a-1)){const L=r.getLineCount(),x=a===L,I=a>1&&S(a-1),D=!x&&S(a+1),R=S(a),F=!D&&!I;if(!D&&!I&&!_)return this.gutterState=new za.Showing(e,t,i,{position:{lineNumber:b,column:C},preference:rb._posPref}),this.renderGutterLightbub(),this.hide();I||x||I&&!R?b-=1:(D||F&&R)&&(b+=1)}else if(a===1&&(a===r.getLineCount()||!S(a+1)&&!S(a)))if(this.gutterState=new za.Showing(e,t,i,{position:{lineNumber:b,column:C},preference:rb._posPref}),_)this.gutterHide();else return this.renderGutterLightbub(),this.hide();else if(a<r.getLineCount()&&!g(a+1))b+=1;else if(l*d.spaceWidth<22)return this.hide();C=/^\S\s*$/.test(r.getLineContent(b))?2:1}this.state=new za.Showing(e,t,i,{position:{lineNumber:b,column:C},preference:rb._posPref}),this._gutterDecorationID&&(this._removeGutterDecoration(this._gutterDecorationID),this.gutterHide());const w=e.validActions,v=e.validActions[0].action.kind;if(w.length!==1||!v){this._editor.layoutContentWidget(this);return}this._editor.layoutContentWidget(this)}hide(){this.state!==za.Hidden&&(this.state=za.Hidden,this._editor.layoutContentWidget(this))}gutterHide(){this.gutterState!==za.Hidden&&(this._gutterDecorationID&&this._removeGutterDecoration(this._gutterDecorationID),this.gutterState=za.Hidden)}get state(){return this._state}set state(e){this._state=e,this._updateLightBulbTitleAndIcon()}get gutterState(){return this._gutterState}set gutterState(e){this._gutterState=e,this._updateGutterLightBulbTitleAndIcon()}_updateLightBulbTitleAndIcon(){if(this._domNode.classList.remove(...this._iconClasses),this._iconClasses=[],this.state.type!==1)return;let e,t=!1;this.state.actions.allAIFixes?(e=Y.sparkleFilled,this.state.actions.validActions.length===1&&(t=!0)):this.state.actions.hasAutoFix?this.state.actions.hasAIFix?e=Y.lightbulbSparkleAutofix:e=Y.lightbulbAutofix:this.state.actions.hasAIFix?e=Y.lightbulbSparkle:e=Y.lightBulb,this._updateLightbulbTitle(this.state.actions.hasAutoFix,t),this._iconClasses=ve.asClassNameArray(e),this._domNode.classList.add(...this._iconClasses)}_updateGutterLightBulbTitleAndIcon(){if(this.gutterState.type!==1)return;let e,t=!1;this.gutterState.actions.allAIFixes?(e=uG,this.gutterState.actions.validActions.length===1&&(t=!0)):this.gutterState.actions.hasAutoFix?this.gutterState.actions.hasAIFix?e=hG:e=cG:this.gutterState.actions.hasAIFix?e=dG:e=lG,this._updateLightbulbTitle(this.gutterState.actions.hasAutoFix,t);const i=Te.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:ve.asClassName(e),glyphMargin:{position:xa.Left},stickiness:1});this.gutterDecoration=i}renderGutterLightbub(){const e=this._editor.getSelection();e&&(this._gutterDecorationID===void 0?this._addGutterDecoration(e.startLineNumber):this._updateGutterDecoration(this._gutterDecorationID,e.startLineNumber))}_addGutterDecoration(e){this._editor.changeDecorations(t=>{this._gutterDecorationID=t.addDecoration(new k(e,0,e,0),this.gutterDecoration)})}_removeGutterDecoration(e){this._editor.changeDecorations(t=>{t.removeDecoration(e),this._gutterDecorationID=void 0})}_updateGutterDecoration(e,t){this._editor.changeDecorations(i=>{i.changeDecoration(e,new k(t,0,t,0)),i.changeDecorationOptions(e,this.gutterDecoration)})}_updateLightbulbTitle(e,t){this.state.type===1&&(t?this.title=p(875,"Run: {0}",this.state.actions.validActions[0].action.title):e&&this._preferredKbLabel?this.title=p(876,"Show Code Actions. Preferred Quick Fix Available ({0})",this._preferredKbLabel):!e&&this._quickFixKbLabel?this.title=p(877,"Show Code Actions ({0})",this._quickFixKbLabel):e||(this.title=p(878,"Show Code Actions")))}set title(e){this._domNode.title=e}},rb=Ud,Ud.GUTTER_DECORATION=Te.register({description:"codicon-gutter-lightbulb-decoration",glyphMarginClassName:ve.asClassName(Y.lightBulb),glyphMargin:{position:xa.Left},stickiness:1}),Ud.ID="editor.contrib.lightbulbWidget",Ud._posPref=[0],Ud);Ew=rb=Mwe([Pwe(1,ot)],Ew);var Awe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ul=function(o,e){return function(t,i){e(t,i,o)}},ab;const Owe="quickfix-edit-highlight";let Tg=(Iu=class extends A{static get(e){return e.getContribution(ab.ID)}constructor(e,t,i,n,s,r,a,l,c,d,h){super(),this._commandService=a,this._configurationService=l,this._actionWidgetService=c,this._instantiationService=d,this._progressService=h,this._activeCodeActions=this._register(new ct),this._showDisabled=!1,this._disposed=!1,this._editor=e,this._model=this._register(new Rwe(this._editor,s.codeActionProvider,t,i,r,l)),this._register(this._model.onDidChangeState(u=>this.update(u))),this._lightBulbWidget=new Ln(()=>{const u=this._editor.getContribution(Ew.ID);return u&&this._register(u.onClick(f=>this.showCodeActionsFromLightbulb(f.actions,f))),u}),this._resolver=n.createInstance(v4),this._register(this._editor.onDidLayoutChange(()=>this._actionWidgetService.hide()))}dispose(){this._disposed=!0,super.dispose()}async showCodeActionsFromLightbulb(e,t){if(e.allAIFixes&&e.validActions.length===1){const i=e.validActions[0],n=i.action.command;n&&n.id==="inlineChat.start"&&n.arguments&&n.arguments.length>=1&&(n.arguments[0]={...n.arguments[0],autoSend:!1}),await this.applyCodeAction(i,!1,!1,Kh.FromAILightbulb);return}await this.showCodeActionList(e,t,{includeDisabledActions:!1,fromLightbulb:!0})}showCodeActions(e,t,i){return this.showCodeActionList(t,i,{includeDisabledActions:!1,fromLightbulb:!1})}manualTriggerAtCurrentPosition(e,t,i,n){if(!this._editor.hasModel())return;So.get(this._editor)?.closeMessage();const s=this._editor.getPosition();this._trigger({type:1,triggerAction:t,filter:i,autoApply:n,context:{notAvailableMessage:e,position:s}})}_trigger(e){return this._model.trigger(e)}async applyCodeAction(e,t,i,n){const s=this._progressService.show(!0,500);try{await this._instantiationService.invokeFunction(xwe,e,n,{preview:i,editor:this._editor})}finally{t&&this._trigger({type:2,triggerAction:yo.QuickFix,filter:{}}),s.done()}}hideLightBulbWidget(){this._lightBulbWidget.rawValue?.hide(),this._lightBulbWidget.rawValue?.gutterHide()}async update(e){if(e.type!==1){this.hideLightBulbWidget();return}let t;try{t=await e.actions}catch(n){Ee(n);return}if(!(this._disposed||this._editor.getSelection()?.startLineNumber!==e.position.lineNumber))if(this._lightBulbWidget.value?.update(t,e.trigger,e.position),e.trigger.type===1){if(e.trigger.filter?.include){const s=this.tryGetValidActionToApply(e.trigger,t);if(s){try{this.hideLightBulbWidget(),await this.applyCodeAction(s,!1,!1,Kh.FromCodeActions)}finally{t.dispose()}return}if(e.trigger.context){const r=this.getInvalidActionThatWouldHaveBeenApplied(e.trigger,t);if(r&&r.action.disabled){So.get(this._editor)?.showMessage(r.action.disabled,e.trigger.context.position),t.dispose();return}}}const n=!!e.trigger.filter?.include;if(e.trigger.context&&(!t.allActions.length||!n&&!t.validActions.length)){So.get(this._editor)?.showMessage(e.trigger.context.notAvailableMessage,e.trigger.context.position),this._activeCodeActions.value=t,t.dispose();return}this._activeCodeActions.value=t,this.showCodeActionList(t,this.toCoords(e.position),{includeDisabledActions:n,fromLightbulb:!1})}else this._actionWidgetService.isVisible?t.dispose():this._activeCodeActions.value=t}getInvalidActionThatWouldHaveBeenApplied(e,t){if(t.allActions.length&&(e.autoApply==="first"&&t.validActions.length===0||e.autoApply==="ifSingle"&&t.allActions.length===1))return t.allActions.find(({action:i})=>i.disabled)}tryGetValidActionToApply(e,t){if(t.validActions.length&&(e.autoApply==="first"&&t.validActions.length>0||e.autoApply==="ifSingle"&&t.validActions.length===1))return t.validActions[0]}async showCodeActionList(e,t,i){const n=this._editor.createDecorationsCollection(),s=this._editor.getDomNode();if(!s)return;const r=i.includeDisabledActions&&(this._showDisabled||e.validActions.length===0)?e.allActions:e.validActions;if(!r.length)return;const a=M.isIPosition(t)?this.toCoords(t):t,l={onSelect:async(c,d)=>{this.applyCodeAction(c,!0,!!d,i.fromLightbulb?Kh.FromAILightbulb:Kh.FromCodeActions),this._actionWidgetService.hide(!1),n.clear()},onHide:c=>{this._editor?.focus(),n.clear()},onHover:async(c,d)=>{if(d.isCancellationRequested)return;let h=!1;const u=c.action.kind;if(u){const f=new si(u);h=[Kt.RefactorExtract,Kt.RefactorInline,Kt.RefactorRewrite,Kt.RefactorMove,Kt.Source].some(m=>m.contains(f))}return{canPreview:h||!!c.action.edit?.edits.length}},onFocus:c=>{if(c&&c.action){const d=c.action.ranges,h=c.action.diagnostics;if(n.clear(),d&&d.length>0){const u=h&&h?.length>1?h.map(f=>({range:f,options:ab.DECORATION})):d.map(f=>({range:f,options:ab.DECORATION}));n.set(u)}else if(h&&h.length>0){const u=h.map(g=>({range:g,options:ab.DECORATION}));n.set(u);const f=h[0];if(f.startLineNumber&&f.startColumn){const g=this._editor.getModel()?.getWordAtPosition({lineNumber:f.startLineNumber,column:f.startColumn})?.word;cl(p(859,"Context: {0} at line {1} and column {2}.",g,f.startLineNumber,f.startColumn))}}}else n.clear()}};this._actionWidgetService.show("codeActionWidget",!0,Nwe(r,this._shouldShowHeaders(),this._resolver.getResolver()),l,a,s,this._getActionBarActions(e,t,i))}toCoords(e){if(!this._editor.hasModel())return{x:0,y:0};this._editor.revealPosition(e,1),this._editor.render();const t=this._editor.getScrolledVisiblePosition(e),i=mi(this._editor.getDomNode()),n=i.left+t.left,s=i.top+t.top+t.height;return{x:n,y:s}}_shouldShowHeaders(){const e=this._editor?.getModel();return this._configurationService.getValue("editor.codeActionWidget.showHeaders",{resource:e?.uri})}_getActionBarActions(e,t,i){if(i.fromLightbulb)return[];const n=e.documentation.map(s=>({id:s.id,label:s.title,tooltip:s.tooltip??"",class:void 0,enabled:!0,run:()=>this._commandService.executeCommand(s.id,...s.arguments??[])}));return i.includeDisabledActions&&e.validActions.length>0&&e.allActions.length!==e.validActions.length&&n.push(this._showDisabled?{id:"hideMoreActions",label:p(860,"Hide Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!1,this.showCodeActionList(e,t,i))}:{id:"showMoreActions",label:p(861,"Show Disabled"),enabled:!0,tooltip:"",class:void 0,run:()=>(this._showDisabled=!0,this.showCodeActionList(e,t,i))}),n}},ab=Iu,Iu.ID="editor.contrib.codeActionController",Iu.DECORATION=Te.register({description:"quickfix-highlight",className:Owe}),Iu);Tg=ab=Awe([Ul(1,zl),Ul(2,xe),Ul(3,ge),Ul(4,he),Ul(5,sd),Ul(6,Tt),Ul(7,Me),Ul(8,qh),Ul(9,ge),Ul(10,sd)],Tg),Nr((o,e)=>{((n,s)=>{s&&e.addRule(`.monaco-editor ${n} { background-color: ${s}; }`)})(".quickfix-edit-highlight",o.getColor(Bc));const i=o.getColor(vh);i&&e.addRule(`.monaco-editor .quickfix-edit-highlight { border: 1px ${Ta(o.type)?"dotted":"solid"} ${i}; box-sizing: border-box; }`)});function Nw(o){return K.regex(rG.keys()[0],new RegExp("(\\s|^)"+oo(o.value)+"\\b"))}const S4={type:"object",defaultSnippets:[{body:{kind:""}}],properties:{kind:{type:"string",description:p(827,"Kind of the code action to run.")},apply:{type:"string",description:p(828,"Controls when the returned actions are applied."),default:"ifSingle",enum:["first","ifSingle","never"],enumDescriptions:[p(829,"Always apply the first returned code action."),p(830,"Apply the first returned code action if it is the only one."),p(831,"Do not apply the returned code actions.")]},preferred:{type:"boolean",default:!1,description:p(832,"Controls if only preferred code actions should be returned.")}}};function Rg(o,e,t,i,n=yo.Default){o.hasModel()&&Tg.get(o)?.manualTriggerAtCurrentPosition(e,n,t,i)}class Fwe extends le{constructor(){super({id:m4,label:H(849,"Quick Fix..."),precondition:K.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:2137,weight:100}})}run(e,t){return Rg(t,p(833,"No code actions available"),void 0,void 0,yo.QuickFix)}}class Wwe extends Bi{constructor(){super({id:eG,precondition:K.and(T.writable,T.hasCodeActionsProvider),metadata:{description:"Trigger a code action",args:[{name:"args",schema:S4}]}})}runEditorCommand(e,t,i){const n=Vl.fromUser(i,{kind:si.Empty,apply:"ifSingle"});return Rg(t,typeof i?.kind=="string"?n.preferred?p(834,"No preferred code actions for '{0}' available",i.kind):p(835,"No code actions for '{0}' available",i.kind):n.preferred?p(836,"No preferred code actions available"):p(837,"No code actions available"),{include:n.kind,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply)}}class Bwe extends le{constructor(){super({id:iG,label:H(850,"Refactor..."),precondition:K.and(T.writable,T.hasCodeActionsProvider),kbOpts:{kbExpr:T.textInputFocus,primary:3120,mac:{primary:1328},weight:100},contextMenuOpts:{group:"1_modification",order:2,when:K.and(T.writable,Nw(Kt.Refactor))},metadata:{description:"Refactor...",args:[{name:"args",schema:S4}]}})}run(e,t,i){const n=Vl.fromUser(i,{kind:Kt.Refactor,apply:"never"});return Rg(t,typeof i?.kind=="string"?n.preferred?p(838,"No preferred refactorings for '{0}' available",i.kind):p(839,"No refactorings for '{0}' available",i.kind):n.preferred?p(840,"No preferred refactorings available"):p(841,"No refactorings available"),{include:Kt.Refactor.contains(n.kind)?n.kind:si.None,onlyIncludePreferredActions:n.preferred},n.apply,yo.Refactor)}}class Hwe extends le{constructor(){super({id:nG,label:H(851,"Source Action..."),precondition:K.and(T.writable,T.hasCodeActionsProvider),contextMenuOpts:{group:"1_modification",order:2.1,when:K.and(T.writable,Nw(Kt.Source))},metadata:{description:"Source Action...",args:[{name:"args",schema:S4}]}})}run(e,t,i){const n=Vl.fromUser(i,{kind:Kt.Source,apply:"never"});return Rg(t,typeof i?.kind=="string"?n.preferred?p(842,"No preferred source actions for '{0}' available",i.kind):p(843,"No source actions for '{0}' available",i.kind):n.preferred?p(844,"No preferred source actions available"):p(845,"No source actions available"),{include:Kt.Source.contains(n.kind)?n.kind:si.None,includeSourceActions:!0,onlyIncludePreferredActions:n.preferred},n.apply,yo.SourceAction)}}class Vwe extends le{constructor(){super({id:_4,label:H(852,"Organize Imports"),precondition:K.and(T.writable,Nw(Kt.SourceOrganizeImports)),kbOpts:{kbExpr:T.textInputFocus,primary:1581,weight:100},metadata:{description:H(853,"Organize imports in the current file. Also called 'Optimize Imports' by some tools")}})}run(e,t){return Rg(t,p(846,"No organize imports action available"),{include:Kt.SourceOrganizeImports,includeSourceActions:!0},"ifSingle",yo.OrganizeImports)}}class zwe extends le{constructor(){super({id:b4,label:H(854,"Fix All"),precondition:K.and(T.writable,Nw(Kt.SourceFixAll))})}run(e,t){return Rg(t,p(847,"No fix all action available"),{include:Kt.SourceFixAll,includeSourceActions:!0},"ifSingle",yo.FixAll)}}class Uwe extends le{constructor(){super({id:tG,label:H(855,"Auto Fix..."),precondition:K.and(T.writable,Nw(Kt.QuickFix)),kbOpts:{kbExpr:T.textInputFocus,primary:1625,mac:{primary:2649},weight:100}})}run(e,t){return Rg(t,p(848,"No auto fixes available"),{include:Kt.QuickFix,onlyIncludePreferredActions:!0},"ifSingle",yo.AutoFix)}}Qe(Tg.ID,Tg,3),Qe(Ew.ID,Ew,4),ne(Fwe),ne(Bwe),ne(Hwe),ne(Vwe),ne(Uwe),ne(zwe),re(new Wwe),ei.as(ka.Configuration).registerConfiguration({...Fk,properties:{"editor.codeActionWidget.showHeaders":{type:"boolean",scope:6,description:p(856,"Enable/disable showing group headers in the Code Action menu."),default:!0}}}),ei.as(ka.Configuration).registerConfiguration({...Fk,properties:{"editor.codeActionWidget.includeNearbyQuickFixes":{type:"boolean",scope:6,description:p(857,"Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),default:!0}}}),ei.as(ka.Configuration).registerConfiguration({...Fk,properties:{"editor.codeActions.triggerOnFocusChange":{type:"boolean",scope:6,markdownDescription:p(858,"Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.","`#editor.codeActionsOnSave#`","`#files.autoSave#`","`afterDelay`","`always`"),default:!1}}});const TN=class TN{constructor(){this.lenses=[]}dispose(){this._store?.dispose()}get isDisposed(){return this._store?.isDisposed??!1}add(e,t){Xu(e)&&(this._store??=new U,this._store.add(e));for(const i of e.lenses)this.lenses.push({symbol:i,provider:t})}};TN.Empty=new TN;let lb=TN;async function fG(o,e,t){const i=o.ordered(e),n=new Map,s=new lb,r=i.map(async(a,l)=>{n.set(a,l);try{const c=await Promise.resolve(a.provideCodeLenses(e,t));c&&s.add(c,a)}catch(c){Di(c)}});return await Promise.all(r),t.isCancellationRequested?(s.dispose(),lb.Empty):(s.lenses=s.lenses.sort((a,l)=>a.symbol.range.startLineNumber<l.symbol.range.startLineNumber?-1:a.symbol.range.startLineNumber>l.symbol.range.startLineNumber?1:n.get(a.provider)<n.get(l.provider)?-1:n.get(a.provider)>n.get(l.provider)?1:a.symbol.range.startColumn<l.symbol.range.startColumn?-1:a.symbol.range.startColumn>l.symbol.range.startColumn?1:0),s)}Xe.registerCommand("_executeCodeLensProvider",function(o,...e){let[t,i]=e;it(be.isUri(t)),it(typeof i=="number"||!i);const{codeLensProvider:n}=o.get(he),s=o.get(Qt).getModel(t);if(!s)throw dr();const r=[],a=new U;return fG(n,s,He.None).then(l=>{a.add(l);const c=[];for(const d of l.lenses)i==null||d.symbol.command?r.push(d.symbol):i-- >0&&d.provider.resolveCodeLens&&c.push(Promise.resolve(d.provider.resolveCodeLens(s,d.symbol,He.None)).then(h=>r.push(h||d.symbol)));return Promise.all(c)}).then(()=>r).finally(()=>{setTimeout(()=>a.dispose(),100)})});var $we=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jwe=function(o,e){return function(t,i){e(t,i,o)}};const gG=We("ICodeLensCache");class pG{constructor(e,t){this.lineCount=e,this.data=t}}let y4=class{constructor(e){this._fakeProvider=new class{provideCodeLenses(){throw new Error("not supported")}},this._cache=new dl(20,.75);const t="codelens/cache";v1(bt,()=>e.remove(t,1));const i="codelens/cache2",n=e.get(i,1,"{}");this._deserialize(n);const s=ie.filter(e.onWillSaveState,r=>r.reason===zh.SHUTDOWN);ie.once(s)(r=>{e.store(i,this._serialize(),1,1)})}put(e,t){const i=t.lenses.map(r=>({range:r.symbol.range,command:r.symbol.command&&{id:"",title:r.symbol.command?.title}})),n=new lb;n.add({lenses:i},this._fakeProvider);const s=new pG(e.getLineCount(),n);this._cache.set(e.uri.toString(),s)}get(e){const t=this._cache.get(e.uri.toString());return t&&t.lineCount===e.getLineCount()?t.data:void 0}delete(e){this._cache.delete(e.uri.toString())}_serialize(){const e=Object.create(null);for(const[t,i]of this._cache){const n=new Set;for(const s of i.data.lenses)n.add(s.symbol.range.startLineNumber);e[t]={lineCount:i.lineCount,lines:[...n.values()]}}return JSON.stringify(e)}_deserialize(e){try{const t=JSON.parse(e);for(const i in t){const n=t[i],s=[];for(const a of n.lines)s.push({range:new k(a,1,a,11)});const r=new lb;r.add({lenses:s},this._fakeProvider),this._cache.set(i,new pG(n.lineCount,r))}}catch{}}};y4=$we([jwe(0,Es)],y4),je(gG,y4,1);class qwe{constructor(e,t,i){this.afterColumn=1073741824,this.afterLineNumber=e,this.heightInPx=t,this._onHeight=i,this.suppressMouseDown=!0,this.domNode=document.createElement("div")}onComputedHeight(e){this._lastHeight===void 0?this._lastHeight=e:this._lastHeight!==e&&(this._lastHeight=e,this._onHeight())}isVisible(){return this._lastHeight!==0&&this.domNode.hasAttribute("monaco-visible-view-zone")}}const RS=class RS{constructor(e,t){this.allowEditorOverflow=!1,this.suppressMouseDown=!0,this._commands=new Map,this._isEmpty=!0,this._editor=e,this._id=`codelens.widget-${RS._idPool++}`,this.updatePosition(t),this._domNode=document.createElement("span"),this._domNode.className="codelens-decoration"}withCommands(e,t){this._commands.clear();const i=[];let n=!1;for(let s=0;s<e.length;s++){const r=e[s];if(r&&(n=!0,r.command)){const a=Fh(r.command.title.trim());if(r.command.id){const l=`c${RS._idPool++}`;i.push(Q("a",{id:l,title:r.command.tooltip,role:"button"},...a)),this._commands.set(l,r.command)}else i.push(Q("span",{title:r.command.tooltip},...a));s+1<e.length&&i.push(Q("span",void 0," | "))}}n?(Yi(this._domNode,...i),this._isEmpty&&t&&this._domNode.classList.add("fadein"),this._isEmpty=!1):Yi(this._domNode,Q("span",void 0,"no commands"))}getCommand(e){return e.parentElement===this._domNode?this._commands.get(e.id):void 0}getId(){return this._id}getDomNode(){return this._domNode}updatePosition(e){const t=this._editor.getModel().getLineFirstNonWhitespaceColumn(e);this._widgetPosition={position:{lineNumber:e,column:t},preference:[1]}}getPosition(){return this._widgetPosition||null}};RS._idPool=0;let L4=RS;class x4{constructor(){this._removeDecorations=[],this._addDecorations=[],this._addDecorationsCallbacks=[]}addDecoration(e,t){this._addDecorations.push(e),this._addDecorationsCallbacks.push(t)}removeDecoration(e){this._removeDecorations.push(e)}commit(e){const t=e.deltaDecorations(this._removeDecorations,this._addDecorations);for(let i=0,n=t.length;i<n;i++)this._addDecorationsCallbacks[i](t[i])}}const mG=Te.register({collapseOnReplaceEdit:!0,description:"codelens"});class _G{constructor(e,t,i,n,s,r){this._isDisposed=!1,this._editor=t,this._data=e,this._decorationIds=[];let a;const l=[];this._data.forEach((c,d)=>{c.symbol.command&&l.push(c.symbol),i.addDecoration({range:c.symbol.range,options:mG},h=>this._decorationIds[d]=h),a?a=k.plusRange(a,c.symbol.range):a=k.lift(c.symbol.range)}),this._viewZone=new qwe(a.startLineNumber-1,s,r),this._viewZoneId=n.addZone(this._viewZone),l.length>0&&(this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(l,!1))}_createContentWidgetIfNecessary(){this._contentWidget?this._editor.layoutContentWidget(this._contentWidget):(this._contentWidget=new L4(this._editor,this._viewZone.afterLineNumber+1),this._editor.addContentWidget(this._contentWidget))}dispose(e,t){this._decorationIds.forEach(e.removeDecoration,e),this._decorationIds=[],t?.removeZone(this._viewZoneId),this._contentWidget&&(this._editor.removeContentWidget(this._contentWidget),this._contentWidget=void 0),this._isDisposed=!0}isDisposed(){return this._isDisposed}isValid(){return this._decorationIds.some((e,t)=>{const i=this._editor.getModel().getDecorationRange(e),n=this._data[t].symbol;return!!(i&&k.isEmpty(n.range)===i.isEmpty())})}updateCodeLensSymbols(e,t){this._decorationIds.forEach(t.removeDecoration,t),this._decorationIds=[],this._data=e,this._data.forEach((i,n)=>{t.addDecoration({range:i.symbol.range,options:mG},s=>this._decorationIds[n]=s)})}updateHeight(e,t){this._viewZone.heightInPx=e,t.layoutZone(this._viewZoneId),this._contentWidget&&this._editor.layoutContentWidget(this._contentWidget)}computeIfNecessary(e){if(!this._viewZone.isVisible())return null;for(let t=0;t<this._decorationIds.length;t++){const i=e.getDecorationRange(this._decorationIds[t]);i&&(this._data[t].symbol.range=i)}return this._data}updateCommands(e){this._createContentWidgetIfNecessary(),this._contentWidget.withCommands(e,!0);for(let t=0;t<this._data.length;t++){const i=e[t];if(i){const{symbol:n}=this._data[t];n.command=i.command||n.command}}}getCommand(e){return this._contentWidget?.getCommand(e)}getLineNumber(){const e=this._editor.getModel().getDecorationRange(this._decorationIds[0]);return e?e.startLineNumber:-1}update(e){if(this.isValid()){const t=this._editor.getModel().getDecorationRange(this._decorationIds[0]);t&&(this._viewZone.afterLineNumber=t.startLineNumber-1,e.layoutZone(this._viewZoneId),this._contentWidget&&(this._contentWidget.updatePosition(t.startLineNumber),this._editor.layoutContentWidget(this._contentWidget)))}}}const k4=We("environmentService");var Kwe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bG=function(o,e){return function(t,i){e(t,i,o)}};const Or=We("ILanguageFeatureDebounceService");var Vk;(function(o){const e=new WeakMap;let t=0;function i(n){let s=e.get(n);return s===void 0&&(s=++t,e.set(n,s)),s}o.of=i})(Vk||(Vk={}));class Gwe{constructor(e){this._default=e}get(e){return this._default}update(e,t){return this._default}default(){return this._default}}class Zwe{constructor(e,t,i,n,s,r){this._logService=e,this._name=t,this._registry=i,this._default=n,this._min=s,this._max=r,this._cache=new dl(50,.7)}_key(e){return e.id+this._registry.all(e).reduce((t,i)=>gy(Vk.of(i),t),0)}get(e){const t=this._key(e),i=this._cache.get(t);return i?ks(i.value,this._min,this._max):this.default()}update(e,t){const i=this._key(e);let n=this._cache.get(i);n||(n=new Fbe(6),this._cache.set(i,n));const s=ks(n.update(t),this._min,this._max);return fy(e.uri,"output")||this._logService.trace(`[DEBOUNCE: ${this._name}] for ${e.uri.toString()} is ${s}ms`),s}_overall(){const e=new oq;for(const[,t]of this._cache)e.update(t.value);return e.value}default(){const e=this._overall()|0||this._default;return ks(e,this._min,this._max)}}let I4=class{constructor(e,t){this._logService=e,this._data=new Map,this._isDev=t.isExtensionDevelopment||!t.isBuilt}for(e,t,i){const n=i?.min??50,s=i?.max??n**2,r=i?.key??void 0,a=`${Vk.of(e)},${n}${r?","+r:""}`;let l=this._data.get(a);return l||(this._isDev?(this._logService.debug(`[DEBOUNCE: ${t}] is disabled in developed mode`),l=new Gwe(n*1.5)):l=new Zwe(this._logService,t,e,this._overallAverage()|0||n*1.5,n,s),this._data.set(a,l)),l}_overallAverage(){const e=new oq;for(const t of this._data.values())e.update(t.default());return e.value}};I4=Kwe([bG(0,Rt),bG(1,k4)],I4),je(Or,I4,1);var Ywe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Tw=function(o,e){return function(t,i){e(t,i,o)}};let Rw=(LC=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageFeaturesService=t,this._commandService=n,this._notificationService=s,this._codeLensCache=r,this._disposables=new U,this._localToDispose=new U,this._lenses=[],this._oldCodeLensModels=new U,this._provideCodeLensDebounce=i.for(t.codeLensProvider,"CodeLensProvide",{min:250}),this._resolveCodeLensesDebounce=i.for(t.codeLensProvider,"CodeLensResolve",{min:250,salt:"resolve"}),this._resolveCodeLensesScheduler=new wt(()=>this._resolveCodeLensesInViewport(),this._resolveCodeLensesDebounce.default()),this._disposables.add(this._editor.onDidChangeModel(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>this._onModelChange())),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{(a.hasChanged(59)||a.hasChanged(25)||a.hasChanged(24))&&this._updateLensStyle(),a.hasChanged(23)&&this._onModelChange()})),this._disposables.add(t.codeLensProvider.onDidChange(this._onModelChange,this)),this._onModelChange(),this._updateLensStyle()}dispose(){this._localDispose(),this._localToDispose.dispose(),this._disposables.dispose(),this._oldCodeLensModels.dispose(),this._currentCodeLensModel?.dispose()}_getLayoutInfo(){const e=Math.max(1.3,this._editor.getOption(75)/this._editor.getOption(61));let t=this._editor.getOption(25);return(!t||t<5)&&(t=this._editor.getOption(61)*.9|0),{fontSize:t,codeLensHeight:t*e|0}}_updateLensStyle(){const{codeLensHeight:e,fontSize:t}=this._getLayoutInfo(),i=this._editor.getOption(24),n=this._editor.getOption(59),{style:s}=this._editor.getContainerDomNode();s.setProperty("--vscode-editorCodeLens-lineHeight",`${e}px`),s.setProperty("--vscode-editorCodeLens-fontSize",`${t}px`),s.setProperty("--vscode-editorCodeLens-fontFeatureSettings",n.fontFeatureSettings),i&&(s.setProperty("--vscode-editorCodeLens-fontFamily",i),s.setProperty("--vscode-editorCodeLens-fontFamilyDefault",bs.fontFamily)),this._editor.changeViewZones(r=>{for(const a of this._lenses)a.updateHeight(e,r)})}_localDispose(){this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=void 0,this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0,this._localToDispose.clear(),this._oldCodeLensModels.clear(),this._currentCodeLensModel?.dispose()}_onModelChange(){this._localDispose();const e=this._editor.getModel();if(!e||!this._editor.getOption(23)||e.isTooLargeForTokenization())return;const t=this._codeLensCache.get(e);if(t&&this._renderCodeLensSymbols(t),!this._languageFeaturesService.codeLensProvider.has(e)){t&&yc(()=>{const n=this._codeLensCache.get(e);t===n&&(this._codeLensCache.delete(e),this._onModelChange())},30*1e3,this._localToDispose);return}for(const n of this._languageFeaturesService.codeLensProvider.all(e))if(typeof n.onDidChange=="function"){const s=n.onDidChange(()=>i.schedule());this._localToDispose.add(s)}const i=new wt(()=>{const n=Date.now();this._getCodeLensModelPromise?.cancel(),this._getCodeLensModelPromise=Vi(s=>fG(this._languageFeaturesService.codeLensProvider,e,s)),this._getCodeLensModelPromise.then(s=>{this._currentCodeLensModel&&this._oldCodeLensModels.add(this._currentCodeLensModel),this._currentCodeLensModel=s,this._codeLensCache.put(e,s);const r=this._provideCodeLensDebounce.update(e,Date.now()-n);i.delay=r,this._renderCodeLensSymbols(s),this._resolveCodeLensesInViewportSoon()},Ee)},this._provideCodeLensDebounce.get(e));this._localToDispose.add(i),this._localToDispose.add(ue(()=>this._resolveCodeLensesScheduler.cancel())),this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._editor.changeDecorations(n=>{this._editor.changeViewZones(s=>{const r=[];let a=-1;this._lenses.forEach(c=>{!c.isValid()||a===c.getLineNumber()?r.push(c):(c.update(s),a=c.getLineNumber())});const l=new x4;r.forEach(c=>{c.dispose(l,s),this._lenses.splice(this._lenses.indexOf(c),1)}),l.commit(n)})}),i.schedule(),this._resolveCodeLensesScheduler.cancel(),this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0})),this._localToDispose.add(this._editor.onDidFocusEditorText(()=>{i.schedule()})),this._localToDispose.add(this._editor.onDidBlurEditorText(()=>{i.cancel()})),this._localToDispose.add(this._editor.onDidScrollChange(n=>{n.scrollTopChanged&&this._lenses.length>0&&this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(this._editor.onDidLayoutChange(()=>{this._resolveCodeLensesInViewportSoon()})),this._localToDispose.add(ue(()=>{if(this._editor.getModel()){const n=Aa.capture(this._editor);this._editor.changeDecorations(s=>{this._editor.changeViewZones(r=>{this._disposeAllLenses(s,r)})}),n.restore(this._editor)}else this._disposeAllLenses(void 0,void 0)})),this._localToDispose.add(this._editor.onMouseDown(n=>{if(n.target.type!==9)return;let s=n.target.element;if(s?.tagName==="SPAN"&&(s=s.parentElement),s?.tagName==="A")for(const r of this._lenses){const a=r.getCommand(s);if(a){this._commandService.executeCommand(a.id,...a.arguments||[]).catch(l=>this._notificationService.error(l));break}}})),i.schedule()}_disposeAllLenses(e,t){const i=new x4;for(const n of this._lenses)n.dispose(i,t);e&&i.commit(e),this._lenses.length=0}_renderCodeLensSymbols(e){if(!this._editor.hasModel())return;const t=this._editor.getModel().getLineCount(),i=[];let n;for(const a of e.lenses){const l=a.symbol.range.startLineNumber;l<1||l>t||(n&&n[n.length-1].symbol.range.startLineNumber===l?n.push(a):(n=[a],i.push(n)))}if(!i.length&&!this._lenses.length)return;const s=Aa.capture(this._editor),r=this._getLayoutInfo();this._editor.changeDecorations(a=>{this._editor.changeViewZones(l=>{const c=new x4;let d=0,h=0;for(;h<i.length&&d<this._lenses.length;){const u=i[h][0].symbol.range.startLineNumber,f=this._lenses[d].getLineNumber();f<u?(this._lenses[d].dispose(c,l),this._lenses.splice(d,1)):f===u?(this._lenses[d].updateCodeLensSymbols(i[h],c),h++,d++):(this._lenses.splice(d,0,new _G(i[h],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),d++,h++)}for(;d<this._lenses.length;)this._lenses[d].dispose(c,l),this._lenses.splice(d,1);for(;h<i.length;)this._lenses.push(new _G(i[h],this._editor,c,l,r.codeLensHeight,()=>this._resolveCodeLensesInViewportSoon())),h++;c.commit(a)})}),s.restore(this._editor)}_resolveCodeLensesInViewportSoon(){this._editor.getModel()&&this._resolveCodeLensesScheduler.schedule()}_resolveCodeLensesInViewport(){this._resolveCodeLensesPromise?.cancel(),this._resolveCodeLensesPromise=void 0;const e=this._editor.getModel();if(!e)return;const t=[],i=[];if(this._lenses.forEach(r=>{const a=r.computeIfNecessary(e);a&&(t.push(a),i.push(r))}),t.length===0){this._oldCodeLensModels.clear();return}const n=Date.now(),s=Vi(r=>{const a=t.map((l,c)=>{const d=new Array(l.length),h=l.map((u,f)=>!u.symbol.command&&typeof u.provider.resolveCodeLens=="function"?Promise.resolve(u.provider.resolveCodeLens(e,u.symbol,r)).then(g=>{d[f]=g},Di):(d[f]=u.symbol,Promise.resolve(void 0)));return Promise.all(h).then(()=>{!r.isCancellationRequested&&!i[c].isDisposed()&&i[c].updateCommands(d)})});return Promise.all(a)});this._resolveCodeLensesPromise=s,this._resolveCodeLensesPromise.then(()=>{const r=this._resolveCodeLensesDebounce.update(e,Date.now()-n);this._resolveCodeLensesScheduler.delay=r,this._currentCodeLensModel&&this._codeLensCache.put(e,this._currentCodeLensModel),this._oldCodeLensModels.clear(),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)},r=>{Ee(r),s===this._resolveCodeLensesPromise&&(this._resolveCodeLensesPromise=void 0)})}async getModel(){return await this._getCodeLensModelPromise,await this._resolveCodeLensesPromise,this._currentCodeLensModel?.isDisposed?void 0:this._currentCodeLensModel}},LC.ID="css.editor.codeLens",LC);Rw=Ywe([Tw(1,he),Tw(2,Or),Tw(3,Tt),Tw(4,hi),Tw(5,gG)],Rw),Qe(Rw.ID,Rw,1),ne(class extends le{constructor(){super({id:"codelens.showLensesInCurrentLine",precondition:T.hasCodeLensProvider,label:H(880,"Show CodeLens Commands for Current Line")})}async run(e,t){if(!t.hasModel())return;const i=e.get(Zn),n=e.get(Tt),s=e.get(hi),r=t.getSelection().positionLineNumber,a=t.getContribution(Rw.ID);if(!a)return;const l=await a.getModel();if(!l)return;const c=[];for(const u of l.lenses)u.symbol.command&&u.symbol.range.startLineNumber===r&&c.push({label:u.symbol.command.title,command:u.symbol.command});if(c.length===0)return;const d=await i.pick(c,{canPickMany:!1,placeHolder:p(879,"Select a command")});if(!d)return;let h=d.command;if(l.isDisposed){const f=(await a.getModel())?.lenses.find(g=>g.symbol.range.startLineNumber===r&&g.symbol.command?.title===h.title);if(!f||!f.symbol.command)return;h=f.symbol.command}try{await n.executeCommand(h.id,...h.arguments||[])}catch(u){s.error(u)}}});const CG=[];function cb(o){CG.push(o)}function Xwe(){return CG.slice(0)}class D4{constructor(e,t,i,n){this.priority=e,this.range=t,this.initialMousePosX=i,this.initialMousePosY=n,this.type=1}equals(e){return e.type===1&&this.range.equalsRange(e.range)}canAdoptVisibleHover(e,t){return e.type===1&&t.lineNumber===this.range.startLineNumber}}class Mw{constructor(e,t,i,n,s,r){this.priority=e,this.owner=t,this.range=i,this.initialMousePosX=n,this.initialMousePosY=s,this.supportsMarkerHover=r,this.type=2}equals(e){return e.type===2&&this.owner===e.owner}canAdoptVisibleHover(e,t){return e.type===2&&this.owner===e.owner}}class Mg{constructor(e,t){this.renderedHoverParts=e,this.disposables=t}dispose(){for(const e of this.renderedHoverParts)e.dispose();this.disposables?.dispose()}}const Pg=new class{constructor(){this._participants=[]}register(e){this._participants.push(e)}getAll(){return this._participants}};var vG=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},E4=function(o,e){return function(t,i){e(t,i,o)}};let Pw=class{constructor(e){this._editorWorkerService=e}async provideDocumentColors(e,t){return this._editorWorkerService.computeDefaultDocumentColors(e.uri)}provideColorPresentations(e,t,i){const n=t.range,s=t.color,r=s.alpha,a=new $(new q(Math.round(255*s.red),Math.round(255*s.green),Math.round(255*s.blue),r)),l=r?$.Format.CSS.formatRGBA(a):$.Format.CSS.formatRGB(a),c=r?$.Format.CSS.formatHSLA(a):$.Format.CSS.formatHSL(a),d=r?$.Format.CSS.formatHexA(a):$.Format.CSS.formatHex(a),h=[];return h.push({label:l,textEdit:{range:n,text:l}}),h.push({label:c,textEdit:{range:n,text:c}}),h.push({label:d,textEdit:{range:n,text:d}}),h}};Pw=vG([E4(0,Xs)],Pw);let N4=class extends A{constructor(e,t){super(),this._register(e.colorProvider.register("*",new Pw(t)))}};N4=vG([E4(0,he),E4(1,Xs)],N4);async function wG(o,e,t,i="auto"){return T4(new Qwe,o,e,t,i)}function SG(o,e,t,i){return Promise.resolve(t.provideColorPresentations(o,e,i))}class Qwe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({colorInfo:r,provider:e});return Array.isArray(s)}}class Jwe{constructor(){}async compute(e,t,i,n){const s=await e.provideDocumentColors(t,i);if(Array.isArray(s))for(const r of s)n.push({range:r.range,color:[r.color.red,r.color.green,r.color.blue,r.color.alpha]});return Array.isArray(s)}}class e0e{constructor(e){this.colorInfo=e}async compute(e,t,i,n){const s=await e.provideColorPresentations(t,this.colorInfo,He.None);return Array.isArray(s)&&n.push(...s),Array.isArray(s)}}async function T4(o,e,t,i,n){let s=!1,r;const a=[],l=e.ordered(t);for(let c=l.length-1;c>=0;c--){const d=l[c];if(n!=="always"&&d instanceof Pw)r=d;else try{await o.compute(d,t,i,a)&&(s=!0)}catch(h){Di(h)}}return s?a:r&&n!=="never"?(await o.compute(r,t,i,a),a):[]}function yG(o,e){const{colorProvider:t}=o.get(he),i=o.get(Qt).getModel(e);if(!i)throw dr();const n=o.get(Me).getValue("editor.defaultColorDecorators",{resource:e});return{model:i,colorProviderRegistry:t,defaultColorDecoratorsEnablement:n}}var t0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},R4=function(o,e){return function(t,i){e(t,i,o)}},M4;const LG=Object.create({});let db=(Du=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._configurationService=t,this._languageFeaturesService=i,this._localToDispose=this._register(new U),this._decorationsIds=[],this._colorDatas=new Map,this._decoratorLimitReporter=this._register(new i0e),this._colorDecorationClassRefs=this._register(new U),this._colorDecoratorIds=this._editor.createDecorationsCollection(),this._ruleFactory=this._register(new PL(this._editor)),this._debounceInformation=n.for(i.colorProvider,"Document Colors",{min:M4.RECOMPUTE_TIME}),this._register(e.onDidChangeModel(()=>{this._isColorDecoratorsEnabled=this.isEnabled(),this.updateColors()})),this._register(e.onDidChangeModelLanguage(()=>this.updateColors())),this._register(i.colorProvider.onDidChange(()=>this.updateColors())),this._register(e.onDidChangeConfiguration(s=>{const r=this._isColorDecoratorsEnabled;this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167);const a=r!==this._isColorDecoratorsEnabled||s.hasChanged(27),l=s.hasChanged(167);(a||l)&&(this._isColorDecoratorsEnabled?this.updateColors():this.removeAllDecorations())})),this._timeoutTimer=null,this._computePromise=null,this._isColorDecoratorsEnabled=this.isEnabled(),this._defaultColorDecoratorsEnablement=this._editor.getOption(167),this.updateColors()}isEnabled(){const e=this._editor.getModel();if(!e)return!1;const t=e.getLanguageId(),i=this._configurationService.getValue(t);if(i&&typeof i=="object"){const n=i.colorDecorators;if(n&&n.enable!==void 0&&!n.enable)return n.enable}return this._editor.getOption(26)}static get(e){return e.getContribution(this.ID)}dispose(){this.stop(),this.removeAllDecorations(),super.dispose()}updateColors(){if(this.stop(),!this._isColorDecoratorsEnabled)return;const e=this._editor.getModel();!e||!this._languageFeaturesService.colorProvider.has(e)||(this._localToDispose.add(this._editor.onDidChangeModelContent(()=>{this._timeoutTimer||(this._timeoutTimer=new No,this._timeoutTimer.cancelAndSet(()=>{this._timeoutTimer=null,this.beginCompute()},this._debounceInformation.get(e)))})),this.beginCompute())}async beginCompute(){this._computePromise=Vi(async e=>{const t=this._editor.getModel();if(!t)return[];const i=new Ki(!1),n=await wG(this._languageFeaturesService.colorProvider,t,e,this._defaultColorDecoratorsEnablement);return this._debounceInformation.update(t,i.elapsed()),n});try{const e=await this._computePromise;this.updateDecorations(e),this.updateColorDecorators(e),this._computePromise=null}catch(e){Ee(e)}}stop(){this._timeoutTimer&&(this._timeoutTimer.cancel(),this._timeoutTimer=null),this._computePromise&&(this._computePromise.cancel(),this._computePromise=null),this._localToDispose.clear()}updateDecorations(e){const t=e.map(i=>({range:{startLineNumber:i.colorInfo.range.startLineNumber,startColumn:i.colorInfo.range.startColumn,endLineNumber:i.colorInfo.range.endLineNumber,endColumn:i.colorInfo.range.endColumn},options:Te.EMPTY}));this._editor.changeDecorations(i=>{this._decorationsIds=i.deltaDecorations(this._decorationsIds,t),this._colorDatas=new Map,this._decorationsIds.forEach((n,s)=>this._colorDatas.set(n,e[s]))})}updateColorDecorators(e){this._colorDecorationClassRefs.clear();const t=[],i=this._editor.getOption(27);for(let s=0;s<e.length&&t.length<i;s++){const{red:r,green:a,blue:l,alpha:c}=e[s].colorInfo.color,d=new q(Math.round(r*255),Math.round(a*255),Math.round(l*255),c),h=`rgba(${d.r}, ${d.g}, ${d.b}, ${d.a})`,u=this._colorDecorationClassRefs.add(this._ruleFactory.createClassNameRef({backgroundColor:h}));t.push({range:{startLineNumber:e[s].colorInfo.range.startLineNumber,startColumn:e[s].colorInfo.range.startColumn,endLineNumber:e[s].colorInfo.range.endLineNumber,endColumn:e[s].colorInfo.range.endColumn},options:{description:"colorDetector",before:{content:r6,inlineClassName:`${u.className} colorpicker-color-decoration`,inlineClassNameAffectsLetterSpacing:!0,attachedData:LG}}})}const n=i<e.length?i:!1;this._decoratorLimitReporter.update(e.length,n),this._colorDecoratorIds.set(t)}removeAllDecorations(){this._editor.removeDecorations(this._decorationsIds),this._decorationsIds=[],this._colorDecoratorIds.clear(),this._colorDecorationClassRefs.clear()}getColorData(e){const t=this._editor.getModel();if(!t)return null;const i=t.getDecorationsInRange(k.fromPositions(e,e)).filter(n=>this._colorDatas.has(n.id));return i.length===0?null:this._colorDatas.get(i[0].id)}isColorDecoration(e){return this._colorDecoratorIds.has(e)}},M4=Du,Du.ID="editor.contrib.colorDetector",Du.RECOMPUTE_TIME=1e3,Du);db=M4=t0e([R4(1,Me),R4(2,he),R4(3,Or)],db);class i0e extends A{constructor(){super(...arguments),this._onDidChange=this._register(new P),this._computed=0,this._limited=!1}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}const xG="editor.action.showHover",n0e="editor.action.showDefinitionPreviewHover",s0e="editor.action.hideHover",o0e="editor.action.scrollUpHover",r0e="editor.action.scrollDownHover",a0e="editor.action.scrollLeftHover",l0e="editor.action.scrollRightHover",c0e="editor.action.pageUpHover",d0e="editor.action.pageDownHover",h0e="editor.action.goToTopHover",u0e="editor.action.goToBottomHover",zk="editor.action.increaseHoverVerbosityLevel",f0e=p(1097,"Increase Hover Verbosity Level"),Uk="editor.action.decreaseHoverVerbosityLevel",g0e=p(1098,"Decrease Hover Verbosity Level"),Aw="editor.action.inlineSuggest.commit",kG="editor.action.inlineSuggest.showPrevious",IG="editor.action.inlineSuggest.showNext",p0e="editor.action.inlineSuggest.jump",DG="editor.action.inlineSuggest.hide",P4="editor.action.inlineSuggest.toggleShowCollapsed";var A4=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},sa=function(o,e){return function(t,i){e(t,i,o)}},Ow;let O4=class extends A{constructor(e,t,i){super(),this.editor=e,this.model=t,this.instantiationService=i,this.alwaysShowToolbar=rt(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).showToolbar==="always"),this.sessionPosition=void 0,this.position=j(this,n=>{const s=this.model.read(n)?.primaryGhostText.read(n);if(!this.alwaysShowToolbar.read(n)||!s||s.parts.length===0)return this.sessionPosition=void 0,null;const r=s.parts[0].column;this.sessionPosition&&this.sessionPosition.lineNumber!==s.lineNumber&&(this.sessionPosition=void 0);const a=new M(s.lineNumber,Math.min(r,this.sessionPosition?.column??Number.MAX_SAFE_INTEGER));return this.sessionPosition=a,a}),this._register(Bn((n,s)=>{const r=this.model.read(n);if(!r||!this.alwaysShowToolbar.read(n))return;const a=j(c=>{const d=c.store.add(this.instantiationService.createInstance(hb.hot.read(c),this.editor,!0,this.position,r.selectedInlineCompletionIndex,r.inlineCompletionsCount,r.activeCommands,r.warning,()=>{}));return e.addContentWidget(d),c.store.add(ue(()=>e.removeContentWidget(d))),c.store.add(Se(h=>{this.position.read(h)&&r.lastTriggerKind.read(h)!==js.Explicit&&r.triggerExplicitly()})),d}),l=Tc(this,(c,d)=>!!this.position.read(c)||!!d);s.add(Se(c=>{l.read(c)&&a.read(c)}))}))}};O4=A4([sa(2,ge)],O4);const m0e=Wt("inline-suggestion-hints-next",Y.chevronRight,p(1198,"Icon for show next parameter hint.")),_0e=Wt("inline-suggestion-hints-previous",Y.chevronLeft,p(1199,"Icon for show previous parameter hint."));let hb=($d=class extends A{static get dropDownVisible(){return this._dropDownVisible}createCommandAction(e,t,i){const n=new Mo(e,t,i,!0,()=>this._commandService.executeCommand(e)),s=this.keybindingService.lookupKeybinding(e,this._contextKeyService);let r=t;return s&&(r=p(1200,"{0} ({1})",t,s.getLabel())),n.tooltip=r,n}constructor(e,t,i,n,s,r,a,l,c,d,h,u,f){super(),this.editor=e,this.withBorder=t,this._position=i,this._currentSuggestionIdx=n,this._suggestionCount=s,this._extraCommands=r,this._warning=a,this._relayout=l,this._commandService=c,this.keybindingService=h,this._contextKeyService=u,this._menuService=f,this.id=`InlineSuggestionHintsContentWidget${Ow.id++}`,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._warningMessageContentNode=j(g=>{const m=this._warning.read(g);return m?typeof m.message=="string"?m.message:g.store.add(iw(m.message)).element:void 0}),this._warningMessageNode=Pe.div({class:"warningMessage",style:{maxWidth:400,margin:4,marginBottom:4,display:j(g=>this._warning.read(g)?"block":"none")}},[this._warningMessageContentNode]).keepUpdated(this._store),this.nodes=Je("div.inlineSuggestionsHints",{className:this.withBorder?"monaco-hover monaco-hover-content":""},[this._warningMessageNode.element,Je("div@toolBar")]),this.previousAction=this._register(this.createCommandAction(kG,p(1201,"Previous"),ve.asClassName(_0e))),this.availableSuggestionCountAction=this._register(new Mo("inlineSuggestionHints.availableSuggestionCount","",void 0,!1)),this.nextAction=this._register(this.createCommandAction(IG,p(1202,"Next"),ve.asClassName(m0e))),this.inlineCompletionsActionsMenus=this._register(this._menuService.createMenu(de.InlineCompletionsActions,this._contextKeyService)),this.clearAvailableSuggestionCountLabelDebounced=this._register(new wt(()=>{this.availableSuggestionCountAction.label=""},100)),this.disableButtonsDebounced=this._register(new wt(()=>{this.previousAction.enabled=this.nextAction.enabled=!1},100)),this._register(Se(g=>{this._warningMessageContentNode.read(g),this._warningMessageNode.readEffect(g),this._relayout()})),this.toolBar=this._register(d.createInstance(F4,this.nodes.toolBar,de.InlineSuggestionToolbar,{menuOptions:{renderShortTitle:!0},toolbarOptions:{primaryGroup:g=>g.startsWith("primary")},actionViewItemProvider:(g,m)=>{if(g instanceof Po)return d.createInstance(C0e,g,void 0);if(g===this.availableSuggestionCountAction){const _=new b0e(void 0,g,{label:!0,icon:!1});return _.setClass("availableSuggestionCount"),_}},telemetrySource:"InlineSuggestionToolbar"})),this.toolBar.setPrependedPrimaryActions([this.previousAction,this.availableSuggestionCountAction,this.nextAction]),this._register(this.toolBar.onDidChangeDropdownVisibility(g=>{Ow._dropDownVisible=g})),this._register(Se(g=>{this._position.read(g),this.editor.layoutContentWidget(this)})),this._register(Se(g=>{const m=this._suggestionCount.read(g),_=this._currentSuggestionIdx.read(g);m!==void 0?(this.clearAvailableSuggestionCountLabelDebounced.cancel(),this.availableSuggestionCountAction.label=`${_+1}/${m}`):this.clearAvailableSuggestionCountLabelDebounced.schedule(),m!==void 0&&m>1?(this.disableButtonsDebounced.cancel(),this.previousAction.enabled=this.nextAction.enabled=!0):this.disableButtonsDebounced.schedule()})),this._register(Se(g=>{const _=this._extraCommands.read(g).map(b=>({class:void 0,id:b.command.id,enabled:!0,tooltip:b.command.tooltip||"",label:b.command.title,run:C=>this._commandService.executeCommand(b.command.id)}));for(const[b,C]of this.inlineCompletionsActionsMenus.getActions())for(const w of C)w instanceof Po&&_.push(w);_.length>0&&_.unshift(new Xi),this.toolBar.setAdditionalSecondaryActions(_)}))}getId(){return this.id}getDomNode(){return this.nodes.root}getPosition(){return{position:this._position.get(),preference:[1,2],positionAffinity:3}}},Ow=$d,$d.hot=Px(Ow),$d._dropDownVisible=!1,$d.id=0,$d);hb=Ow=A4([sa(8,Tt),sa(9,ge),sa(10,ot),sa(11,xe),sa(12,Cr)],hb);class b0e extends z_{constructor(){super(...arguments),this._className=void 0}setClass(e){this._className=e}render(e){super.render(e),this._className&&e.classList.add(this._className)}updateTooltip(){}}class C0e extends Uh{updateLabel(){const e=this._keybindingService.lookupKeybinding(this._action.id,this._contextKeyService,!0);if(!e)return super.updateLabel();if(this.label){const t=Je("div.keybinding").root;this._register(new nb(t,so,{disableTitle:!0,...iwe})).set(e),this.label.textContent=this._action.label,this.label.appendChild(t),this.label.classList.add("inlineSuggestionStatusBarItemLabel")}}updateTooltip(){}}let F4=class extends mk{constructor(e,t,i,n,s,r,a,l,c){super(e,{resetMenu:t,...i},n,s,r,a,l,c),this.menuId=t,this.options2=i,this.menuService=n,this.contextKeyService=s,this.menu=this._store.add(this.menuService.createMenu(this.menuId,this.contextKeyService,{emitEventsForSubmenuChanges:!0})),this.additionalActions=[],this.prependedPrimaryActions=[],this.additionalPrimaryActions=[],this._store.add(this.menu.onDidChange(()=>this.updateToolbar())),this.updateToolbar()}updateToolbar(){const{primary:e,secondary:t}=aK(this.menu.getActions(this.options2?.menuOptions),this.options2?.toolbarOptions?.primaryGroup,this.options2?.toolbarOptions?.shouldInlineSubmenu,this.options2?.toolbarOptions?.useSeparatorsInPrimaryActions);t.push(...this.additionalActions),e.unshift(...this.prependedPrimaryActions),e.push(...this.additionalPrimaryActions),this.setActions(e,t)}setPrependedPrimaryActions(e){Ut(this.prependedPrimaryActions,e,(t,i)=>t===i)||(this.prependedPrimaryActions=e,this.updateToolbar())}setAdditionalSecondaryActions(e){Ut(this.additionalActions,e,(t,i)=>t===i)||(this.additionalActions=e,this.updateToolbar())}};F4=A4([sa(3,Cr),sa(4,xe),sa(5,Ko),sa(6,ot),sa(7,Tt),sa(8,Vn)],F4);function $k(o,e,t){const i=mi(o);return!(e<i.left||e>i.left+i.width||t<i.top||t>i.top+i.height)}class v0e{constructor(e,t,i,n){this.value=e,this.isComplete=t,this.hasLoadingMessage=i,this.options=n}}class EG extends A{constructor(e,t){super(),this._editor=e,this._computer=t,this._onResult=this._register(new P),this.onResult=this._onResult.event,this._asyncComputationScheduler=this._register(new W4(i=>this._triggerAsyncComputation(i),0)),this._syncComputationScheduler=this._register(new W4(i=>this._triggerSyncComputation(i),0)),this._loadingMessageScheduler=this._register(new W4(i=>this._triggerLoadingMessage(i),0)),this._state=0,this._asyncIterable=null,this._asyncIterableDone=!1,this._result=[]}dispose(){this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._options=void 0,super.dispose()}get _hoverTime(){return this._editor.getOption(69).delay}get _firstWaitTime(){return this._hoverTime/2}get _secondWaitTime(){return this._hoverTime-this._firstWaitTime}get _loadingMessageTime(){return 3*this._hoverTime}_setState(e,t){this._options=t,this._state=e,this._fireResult(t)}_triggerAsyncComputation(e){this._setState(2,e),this._syncComputationScheduler.schedule(e,this._secondWaitTime),this._computer.computeAsync?(this._asyncIterableDone=!1,this._asyncIterable=Cie(t=>this._computer.computeAsync(e,t)),(async()=>{try{for await(const t of this._asyncIterable)t&&(this._result.push(t),this._fireResult(e));this._asyncIterableDone=!0,(this._state===3||this._state===4)&&this._setState(0,e)}catch(t){Ee(t)}})()):this._asyncIterableDone=!0}_triggerSyncComputation(e){this._computer.computeSync&&(this._result=this._result.concat(this._computer.computeSync(e))),this._setState(this._asyncIterableDone?0:3,e)}_triggerLoadingMessage(e){this._state===3&&this._setState(4,e)}_fireResult(e){if(this._state===1||this._state===2)return;const t=this._state===0,i=this._state===4;this._onResult.fire(new v0e(this._result.slice(0),t,i,e))}start(e,t){if(e===0)this._state===0&&(this._setState(1,t),this._asyncComputationScheduler.schedule(t,this._firstWaitTime),this._loadingMessageScheduler.schedule(t,this._loadingMessageTime));else switch(this._state){case 0:this._triggerAsyncComputation(t),this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break;case 2:this._syncComputationScheduler.cancel(),this._triggerSyncComputation(t);break}}cancel(){this._asyncComputationScheduler.cancel(),this._syncComputationScheduler.cancel(),this._loadingMessageScheduler.cancel(),this._asyncIterable&&(this._asyncIterable.cancel(),this._asyncIterable=null),this._result=[],this._options=void 0,this._state=0}get options(){return this._options}}class W4 extends A{constructor(e,t){super(),this._scheduler=this._register(new wt(()=>e(this._options),t))}schedule(e,t){this._options=e,this._scheduler.schedule(t)}cancel(){this._scheduler.cancel()}}class B4{get onDidWillResize(){return this._onDidWillResize.event}get onDidResize(){return this._onDidResize.event}constructor(){this._onDidWillResize=new P,this._onDidResize=new P,this._sashListener=new U,this._size=new dt(0,0),this._minSize=new dt(0,0),this._maxSize=new dt(Number.MAX_SAFE_INTEGER,Number.MAX_SAFE_INTEGER),this.domNode=document.createElement("div"),this._eastSash=new Gn(this.domNode,{getVerticalSashLeft:()=>this._size.width},{orientation:0}),this._westSash=new Gn(this.domNode,{getVerticalSashLeft:()=>0},{orientation:0}),this._northSash=new Gn(this.domNode,{getHorizontalSashTop:()=>0},{orientation:1,orthogonalEdge:rk.North}),this._southSash=new Gn(this.domNode,{getHorizontalSashTop:()=>this._size.height},{orientation:1,orthogonalEdge:rk.South}),this._northSash.orthogonalStartSash=this._westSash,this._northSash.orthogonalEndSash=this._eastSash,this._southSash.orthogonalStartSash=this._westSash,this._southSash.orthogonalEndSash=this._eastSash;let e,t=0,i=0;this._sashListener.add(ie.any(this._northSash.onDidStart,this._eastSash.onDidStart,this._southSash.onDidStart,this._westSash.onDidStart)(()=>{e===void 0&&(this._onDidWillResize.fire(),e=this._size,t=0,i=0)})),this._sashListener.add(ie.any(this._northSash.onDidEnd,this._eastSash.onDidEnd,this._southSash.onDidEnd,this._westSash.onDidEnd)(()=>{e!==void 0&&(e=void 0,t=0,i=0,this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(this._eastSash.onDidChange(n=>{e&&(i=n.currentX-n.startX,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,east:!0}))})),this._sashListener.add(this._westSash.onDidChange(n=>{e&&(i=-(n.currentX-n.startX),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,west:!0}))})),this._sashListener.add(this._northSash.onDidChange(n=>{e&&(t=-(n.currentY-n.startY),this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,north:!0}))})),this._sashListener.add(this._southSash.onDidChange(n=>{e&&(t=n.currentY-n.startY,this.layout(e.height+t,e.width+i),this._onDidResize.fire({dimension:this._size,done:!1,south:!0}))})),this._sashListener.add(ie.any(this._eastSash.onDidReset,this._westSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._size.height,this._preferredSize.width),this._onDidResize.fire({dimension:this._size,done:!0}))})),this._sashListener.add(ie.any(this._northSash.onDidReset,this._southSash.onDidReset)(n=>{this._preferredSize&&(this.layout(this._preferredSize.height,this._size.width),this._onDidResize.fire({dimension:this._size,done:!0}))}))}dispose(){this._northSash.dispose(),this._southSash.dispose(),this._eastSash.dispose(),this._westSash.dispose(),this._sashListener.dispose(),this._onDidResize.dispose(),this._onDidWillResize.dispose(),this.domNode.remove()}enableSashes(e,t,i,n){this._northSash.state=e?3:0,this._eastSash.state=t?3:0,this._southSash.state=i?3:0,this._westSash.state=n?3:0}layout(e=this.size.height,t=this.size.width){const{height:i,width:n}=this._minSize,{height:s,width:r}=this._maxSize;e=Math.max(i,Math.min(s,e)),t=Math.max(n,Math.min(r,t));const a=new dt(t,e);dt.equals(a,this._size)||(this.domNode.style.height=e+"px",this.domNode.style.width=t+"px",this._size=a,this._northSash.layout(),this._eastSash.layout(),this._southSash.layout(),this._westSash.layout())}clearSashHoverState(){this._eastSash.clearSashHoverState(),this._westSash.clearSashHoverState(),this._northSash.clearSashHoverState(),this._southSash.clearSashHoverState()}get size(){return this._size}set maxSize(e){this._maxSize=e}get maxSize(){return this._maxSize}set minSize(e){this._minSize=e}get minSize(){return this._minSize}set preferredSize(e){this._preferredSize=e}get preferredSize(){return this._preferredSize}}const w0e=30,S0e=24;class y0e extends A{constructor(e,t=new dt(10,10)){super(),this._editor=e,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._resizableNode=this._register(new B4),this._contentPosition=null,this._isResizing=!1,this._resizableNode.domNode.style.position="absolute",this._resizableNode.minSize=dt.lift(t),this._resizableNode.layout(t.height,t.width),this._resizableNode.enableSashes(!0,!0,!0,!0),this._register(this._resizableNode.onDidResize(i=>{this._resize(new dt(i.dimension.width,i.dimension.height)),i.done&&(this._isResizing=!1)})),this._register(this._resizableNode.onDidWillResize(()=>{this._isResizing=!0}))}get isResizing(){return this._isResizing}getDomNode(){return this._resizableNode.domNode}getPosition(){return this._contentPosition}get position(){return this._contentPosition?.position?M.lift(this._contentPosition.position):void 0}_availableVerticalSpaceAbove(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);return!t||!i?void 0:mi(t).top+i.top-w0e}_availableVerticalSpaceBelow(e){const t=this._editor.getDomNode(),i=this._editor.getScrolledVisiblePosition(e);if(!t||!i)return;const n=mi(t),s=rh(t.ownerDocument.body),r=n.top+i.top+i.height;return s.height-r-S0e}_findPositionPreference(e,t){const i=Math.min(this._availableVerticalSpaceBelow(t)??1/0,e),n=Math.min(this._availableVerticalSpaceAbove(t)??1/0,e),s=Math.min(Math.max(n,i),e),r=Math.min(e,s);let a;return this._editor.getOption(69).above?a=r<=n?1:2:a=r<=i?2:1,a===1?this._resizableNode.enableSashes(!0,!0,!1,!1):this._resizableNode.enableSashes(!1,!0,!0,!1),a}_resize(e){this._resizableNode.layout(e.height,e.width)}}const jk=Q;let H4=class extends A{constructor(e){super(),this.containerDomNode=document.createElement("div"),this.containerDomNode.className="monaco-hover",this.containerDomNode.classList.toggle("fade-in",!!e),this.containerDomNode.tabIndex=0,this.containerDomNode.setAttribute("role","tooltip"),this.contentsDomNode=document.createElement("div"),this.contentsDomNode.className="monaco-hover-content",this.scrollbar=this._register(new Q1(this.contentsDomNode,{consumeMouseWheelIfScrollbarIsNeeded:!0})),this.containerDomNode.appendChild(this.scrollbar.getDomNode())}onContentsChanged(){this.scrollbar.scanDomNode()}};class qk extends A{static render(e,t,i){return new qk(e,t,i)}constructor(e,t,i){super(),this.actionLabel=t.label,this.actionKeybindingLabel=i,this.actionContainer=Z(e,jk("div.action-container")),this.actionContainer.setAttribute("tabindex","0"),this.action=Z(this.actionContainer,jk("a.action")),this.action.setAttribute("role","button"),t.iconClass&&Z(this.action,jk("span.icon")).classList.add(...t.iconClass.split(" ")),this.actionRenderedLabel=i?`${t.label} (${i})`:t.label;const n=Z(this.action,jk("span"));n.textContent=this.actionRenderedLabel,this._store.add(new TG(this.actionContainer,t.run)),this._store.add(new RG(this.actionContainer,t.run,[3,10])),this.setEnabled(!0)}setEnabled(e){e?(this.actionContainer.classList.remove("disabled"),this.actionContainer.removeAttribute("aria-disabled")):(this.actionContainer.classList.add("disabled"),this.actionContainer.setAttribute("aria-disabled","true"))}}function NG(o,e){return o&&e?p(7,"Inspect this in the accessible view with {0}.",e):o?p(8,"Inspect this in the accessible view via the command Open Accessible View which is currently not triggerable via keybinding."):""}class TG extends A{constructor(e,t){super(),this._register(W(e,te.CLICK,i=>{i.stopPropagation(),i.preventDefault(),t(e)}))}}class RG extends A{constructor(e,t,i){super(),this._register(W(e,te.KEY_DOWN,n=>{const s=new St(n);i.some(r=>s.equals(r))&&(n.stopPropagation(),n.preventDefault(),t(e))}))}}var L0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kk=function(o,e){return function(t,i){e(t,i,o)}},oa;const MG=30;let V4=(Eu=class extends y0e{get isVisibleFromKeyboard(){return this._renderedHover?.source===2}get isVisible(){return this._hoverVisibleKey.get()??!1}get isFocused(){return this._hoverFocusedKey.get()??!1}constructor(e,t,i,n,s){const r=e.getOption(75)+8,a=150,l=new dt(a,r);super(e,l),this._configurationService=i,this._accessibilityService=n,this._keybindingService=s,this._hover=this._register(new H4(!0)),this._onDidResize=this._register(new P),this.onDidResize=this._onDidResize.event,this._onDidScroll=this._register(new P),this.onDidScroll=this._onDidScroll.event,this._onContentsChanged=this._register(new P),this.onContentsChanged=this._onContentsChanged.event,this._minimumSize=l,this._hoverVisibleKey=T.hoverVisible.bindTo(t),this._hoverFocusedKey=T.hoverFocused.bindTo(t),Z(this._resizableNode.domNode,this._hover.containerDomNode),this._resizableNode.domNode.style.zIndex="50",this._resizableNode.domNode.className="monaco-resizable-hover",this._register(this._editor.onDidLayoutChange(()=>{this.isVisible&&this._updateMaxDimensions()})),this._register(this._editor.onDidChangeConfiguration(d=>{d.hasChanged(59)&&this._updateFont()}));const c=this._register(br(this._resizableNode.domNode));this._register(c.onDidFocus(()=>{this._hoverFocusedKey.set(!0)})),this._register(c.onDidBlur(()=>{this._hoverFocusedKey.set(!1)})),this._register(this._hover.scrollbar.onScroll(d=>{this._onDidScroll.fire(d)})),this._setRenderedHover(void 0),this._editor.addContentWidget(this)}dispose(){super.dispose(),this._renderedHover?.dispose(),this._editor.removeContentWidget(this)}getId(){return oa.ID}static _applyDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.width=n,e.style.height=s}_setContentsDomNodeDimensions(e,t){const i=this._hover.contentsDomNode;return oa._applyDimensions(i,e,t)}_setContainerDomNodeDimensions(e,t){const i=this._hover.containerDomNode;return oa._applyDimensions(i,e,t)}_setScrollableElementDimensions(e,t){const i=this._hover.scrollbar.getDomNode();return oa._applyDimensions(i,e,t)}_setHoverWidgetDimensions(e,t){this._setContainerDomNodeDimensions(e,t),this._setScrollableElementDimensions(e,t),this._setContentsDomNodeDimensions(e,t),this._layoutContentWidget()}static _applyMaxDimensions(e,t,i){const n=typeof t=="number"?`${t}px`:t,s=typeof i=="number"?`${i}px`:i;e.style.maxWidth=n,e.style.maxHeight=s}_setHoverWidgetMaxDimensions(e,t){oa._applyMaxDimensions(this._hover.contentsDomNode,e,t),oa._applyMaxDimensions(this._hover.scrollbar.getDomNode(),e,t),oa._applyMaxDimensions(this._hover.containerDomNode,e,t),this._hover.containerDomNode.style.setProperty("--vscode-hover-maxWidth",typeof e=="number"?`${e}px`:e),this._layoutContentWidget()}_setAdjustedHoverWidgetDimensions(e){this._setHoverWidgetMaxDimensions("none","none"),this._setHoverWidgetDimensions(e.width,e.height)}_updateResizableNodeMaxDimensions(){const e=this._findMaximumRenderingWidth()??1/0,t=this._findMaximumRenderingHeight()??1/0;this._resizableNode.maxSize=new dt(e,t),this._setHoverWidgetMaxDimensions(e,t)}_resize(e){oa._lastDimensions=new dt(e.width,e.height),this._setAdjustedHoverWidgetDimensions(e),this._resizableNode.layout(e.height,e.width),this._updateResizableNodeMaxDimensions(),this._hover.scrollbar.scanDomNode(),this._editor.layoutContentWidget(this),this._onDidResize.fire()}_findAvailableSpaceVertically(){const e=this._renderedHover?.showAtPosition;if(e)return this._positionPreference===1?this._availableVerticalSpaceAbove(e):this._availableVerticalSpaceBelow(e)}_findMaximumRenderingHeight(){const e=this._findAvailableSpaceVertically();if(!e)return;let i=this._hover.contentsDomNode.children.length-1;return Array.from(this._hover.contentsDomNode.children).forEach(n=>{i+=n.clientHeight}),Math.min(e,i)}_isHoverTextOverflowing(){this._hover.containerDomNode.style.setProperty("--vscode-hover-whiteSpace","nowrap"),this._hover.containerDomNode.style.setProperty("--vscode-hover-sourceWhiteSpace","nowrap");const e=Array.from(this._hover.contentsDomNode.children).some(t=>t.scrollWidth>t.clientWidth);return this._hover.containerDomNode.style.removeProperty("--vscode-hover-whiteSpace"),this._hover.containerDomNode.style.removeProperty("--vscode-hover-sourceWhiteSpace"),e}_findMaximumRenderingWidth(){if(!this._editor||!this._editor.hasModel())return;const e=this._isHoverTextOverflowing(),t=typeof this._contentWidth>"u"?0:this._contentWidth;return e||this._hover.containerDomNode.clientWidth<t?rh(this._hover.containerDomNode.ownerDocument.body).width-14:this._hover.containerDomNode.clientWidth}isMouseGettingCloser(e,t){if(!this._renderedHover)return!1;if(this._renderedHover.initialMousePosX===void 0||this._renderedHover.initialMousePosY===void 0)return this._renderedHover.initialMousePosX=e,this._renderedHover.initialMousePosY=t,!1;const i=mi(this.getDomNode());this._renderedHover.closestMouseDistance===void 0&&(this._renderedHover.closestMouseDistance=PG(this._renderedHover.initialMousePosX,this._renderedHover.initialMousePosY,i.left,i.top,i.width,i.height));const n=PG(e,t,i.left,i.top,i.width,i.height);return n>this._renderedHover.closestMouseDistance+4?!1:(this._renderedHover.closestMouseDistance=Math.min(this._renderedHover.closestMouseDistance,n),!0)}_setRenderedHover(e){this._renderedHover?.dispose(),this._renderedHover=e,this._hoverVisibleKey.set(!!e),this._hover.containerDomNode.classList.toggle("hidden",!e)}_updateFont(){const{fontSize:e,lineHeight:t}=this._editor.getOption(59),i=this._hover.contentsDomNode;i.style.fontSize=`${e}px`,i.style.lineHeight=`${t/e}`,Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(s=>this._editor.applyFontInfo(s))}_updateContent(e){const t=this._hover.contentsDomNode;t.style.paddingBottom="",t.textContent="",t.appendChild(e)}_layoutContentWidget(){this._editor.layoutContentWidget(this),this._hover.onContentsChanged()}_updateMaxDimensions(){const e=Math.max(this._editor.getLayoutInfo().height/4,250,oa._lastDimensions.height),t=Math.max(this._editor.getLayoutInfo().width*.66,750,oa._lastDimensions.width);this._resizableNode.maxSize=new dt(t,e),this._setHoverWidgetMaxDimensions(t,e)}_render(e){this._setRenderedHover(e),this._updateFont(),this._updateContent(e.domNode),this.handleContentsChanged(),this._editor.render()}getPosition(){return this._renderedHover?{position:this._renderedHover.showAtPosition,secondaryPosition:this._renderedHover.showAtSecondaryPosition,positionAffinity:this._renderedHover.shouldAppearBeforeContent?3:void 0,preference:[this._positionPreference??1]}:null}show(e){if(!this._editor||!this._editor.hasModel())return;this._render(e);const t=Rc(this._hover.containerDomNode),i=e.showAtPosition;this._positionPreference=this._findPositionPreference(t,i)??1,this.handleContentsChanged(),e.shouldFocus&&this._hover.containerDomNode.focus(),this._onDidResize.fire();const s=this._hover.containerDomNode.ownerDocument.activeElement===this._hover.containerDomNode&&NG(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel()??"");s&&(this._hover.contentsDomNode.ariaLabel=this._hover.contentsDomNode.textContent+", "+s)}hide(){if(!this._renderedHover)return;const e=this._renderedHover.shouldFocus||this._hoverFocusedKey.get();this._setRenderedHover(void 0),this._resizableNode.maxSize=new dt(1/0,1/0),this._resizableNode.clearSashHoverState(),this._hoverFocusedKey.set(!1),this._editor.layoutContentWidget(this),e&&this._editor.focus()}_removeConstraintsRenderNormally(){const e=this._editor.getLayoutInfo();this._resizableNode.layout(e.height,e.width),this._setHoverWidgetDimensions("auto","auto"),this._updateMaxDimensions()}setMinimumDimensions(e){this._minimumSize=new dt(Math.max(this._minimumSize.width,e.width),Math.max(this._minimumSize.height,e.height)),this._updateMinimumWidth()}_updateMinimumWidth(){const e=typeof this._contentWidth>"u"?this._minimumSize.width:Math.min(this._contentWidth,this._minimumSize.width);this._resizableNode.minSize=new dt(e,this._minimumSize.height)}handleContentsChanged(){this._removeConstraintsRenderNormally();const e=this._hover.contentsDomNode;let t=Rc(e),i=ho(e)+2;if(this._resizableNode.layout(t,i),this._setHoverWidgetDimensions(i,t),t=Rc(e),i=ho(e),this._contentWidth=i,this._updateMinimumWidth(),this._resizableNode.layout(t,i),this._renderedHover?.showAtPosition){const n=Rc(this._hover.containerDomNode);this._positionPreference=this._findPositionPreference(n,this._renderedHover.showAtPosition)}this._layoutContentWidget(),this._onContentsChanged.fire()}focus(){this._hover.containerDomNode.focus()}scrollUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e-t.lineHeight})}scrollDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._editor.getOption(59);this._hover.scrollbar.setScrollPosition({scrollTop:e+t.lineHeight})}scrollLeft(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e-MG})}scrollRight(){const e=this._hover.scrollbar.getScrollPosition().scrollLeft;this._hover.scrollbar.setScrollPosition({scrollLeft:e+MG})}pageUp(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e-t})}pageDown(){const e=this._hover.scrollbar.getScrollPosition().scrollTop,t=this._hover.scrollbar.getScrollDimensions().height;this._hover.scrollbar.setScrollPosition({scrollTop:e+t})}goToTop(){this._hover.scrollbar.setScrollPosition({scrollTop:0})}goToBottom(){this._hover.scrollbar.setScrollPosition({scrollTop:this._hover.scrollbar.getScrollDimensions().scrollHeight})}},oa=Eu,Eu.ID="editor.contrib.resizableContentHoverWidget",Eu._lastDimensions=new dt(0,0),Eu);V4=oa=L0e([Kk(1,xe),Kk(2,Me),Kk(3,bn),Kk(4,ot)],V4);function PG(o,e,t,i,n,s){const r=t+n/2,a=i+s/2,l=Math.max(Math.abs(o-r)-n/2,0),c=Math.max(Math.abs(e-a)-s/2,0);return Math.sqrt(l*l+c*c)}class Gk{constructor(e,t){this._editor=e,this._participants=t}static _getLineDecorations(e,t){if(t.type!==1&&!t.supportsMarkerHover)return[];const i=e.getModel(),n=t.range.startLineNumber;if(n>i.getLineCount())return[];const s=i.getLineMaxColumn(n);return e.getLineDecorations(n).filter(r=>{if(r.options.isWholeLine)return!0;const a=r.range.startLineNumber===n?r.range.startColumn:1,l=r.range.endLineNumber===n?r.range.endColumn:s;if(r.options.showIfCollapsed){if(a>t.range.startColumn+1||t.range.endColumn-1>l)return!1}else if(a>t.range.startColumn||t.range.endColumn>l)return!1;return!0})}computeAsync(e,t){const i=e.anchor;if(!this._editor.hasModel()||!i)return gr.EMPTY;const n=Gk._getLineDecorations(this._editor,i);return gr.merge(this._participants.map(s=>s.computeAsync?s.computeAsync(i,n,e.source,t):gr.EMPTY))}computeSync(e){if(!this._editor.hasModel())return[];const t=e.anchor,i=Gk._getLineDecorations(this._editor,t);let n=[];for(const s of this._participants)n=n.concat(s.computeSync(t,i,e.source));return wa(n)}}class AG{constructor(e,t,i){this.hoverParts=e,this.isComplete=t,this.options=i}filter(e){const t=this.hoverParts.filter(i=>i.isValidForHoverAnchor(e));return t.length===this.hoverParts.length?this:new x0e(this,t,this.isComplete,this.options)}}class x0e extends AG{constructor(e,t,i,n){super(t,i,n),this.original=e}filter(e){return this.original.filter(e)}}var k0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},OG=function(o,e){return function(t,i){e(t,i,o)}};const FG=Q;let Zk=class extends A{get hasContent(){return this._hasContent}constructor(e,t){super(),this._keybindingService=e,this._hoverService=t,this.actions=[],this._hasContent=!1,this.hoverElement=FG("div.hover-row.status-bar"),this.hoverElement.tabIndex=0,this.actionsElement=Z(this.hoverElement,FG("div.actions"))}addAction(e){const t=this._keybindingService.lookupKeybinding(e.commandId),i=t?t.getLabel():null;this._hasContent=!0;const n=this._register(qk.render(this.actionsElement,e,i));return this._register(this._hoverService.setupManagedHover(Zs("element"),n.actionContainer,n.actionRenderedLabel)),this.actions.push(n),n}append(e){const t=Z(this.actionsElement,e);return this._hasContent=!0,t}};Zk=k0e([OG(0,ot),OG(1,Qs)],Zk);class I0e{constructor(e,t,i){this.provider=e,this.hover=t,this.ordinal=i}}async function D0e(o,e,t,i,n){const s=await Promise.resolve(o.provideHover(t,i,n)).catch(Di);if(!(!s||!E0e(s)))return new I0e(o,s,e)}function z4(o,e,t,i,n=!1){const r=o.ordered(e,n).map((a,l)=>D0e(a,l,e,t,i));return gr.fromPromisesResolveOrder(r).coalesce()}async function WG(o,e,t,i,n=!1){const s=[];for await(const r of z4(o,e,t,i,n))s.push(r.hover);return s}zs("_executeHoverProvider",(o,e,t)=>{const i=o.get(he);return WG(i.hoverProvider,e,t,He.None)}),zs("_executeHoverProvider_recursive",(o,e,t)=>{const i=o.get(he);return WG(i.hoverProvider,e,t,He.None,!0)});function E0e(o){const e=typeof o.range<"u",t=typeof o.contents<"u"&&o.contents&&o.contents.length>0;return e&&t}var N0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ag=function(o,e){return function(t,i){e(t,i,o)}};const Og=Q,T0e=Wt("hover-increase-verbosity",Y.add,p(1123,"Icon for increaseing hover verbosity.")),R0e=Wt("hover-decrease-verbosity",Y.remove,p(1124,"Icon for decreasing hover verbosity."));class ra{constructor(e,t,i,n,s,r=void 0){this.owner=e,this.range=t,this.contents=i,this.isBeforeContent=n,this.ordinal=s,this.source=r}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}class BG{constructor(e,t,i){this.hover=e,this.hoverProvider=t,this.hoverPosition=i}supportsVerbosityAction(e){switch(e){case po.Increase:return this.hover.canIncreaseVerbosity??!1;case po.Decrease:return this.hover.canDecreaseVerbosity??!1}}}let Fw=class{constructor(e,t,i,n,s,r,a,l){this._editor=e,this._languageService=t,this._openerService=i,this._configurationService=n,this._languageFeaturesService=s,this._keybindingService=r,this._hoverService=a,this._commandService=l,this.hoverOrdinal=3}createLoadingMessage(e){return new ra(this,e.range,[new qn().appendText(p(1125,"Loading..."))],!1,2e3)}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=e.range.startLineNumber,s=i.getLineMaxColumn(n),r=[];let a=1e3;const l=i.getLineLength(n),c=i.getLanguageIdAtPosition(e.range.startLineNumber,e.range.startColumn),d=this._editor.getOption(133),h=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:c});let u=!1;d>=0&&l>d&&e.range.startColumn>=d&&(u=!0,r.push(new ra(this,e.range,[{value:p(1126,"Rendering paused for long line for performance reasons. This can be configured via `editor.stopRenderingLineAfter`.")}],!1,a++))),!u&&typeof h=="number"&&l>=h&&r.push(new ra(this,e.range,[{value:p(1127,"Tokenization is skipped for long lines for performance reasons. This can be configured via `editor.maxTokenizationLineLength`.")}],!1,a++));let f=!1;for(const g of t){const m=g.range.startLineNumber===n?g.range.startColumn:1,_=g.range.endLineNumber===n?g.range.endColumn:s,b=g.options.hoverMessage;if(!b||B_(b))continue;g.options.beforeContentClassName&&(f=!0);const C=new k(e.range.startLineNumber,m,e.range.startLineNumber,_);r.push(new ra(this,C,zR(b),f,a++))}return r}computeAsync(e,t,i,n){if(!this._editor.hasModel()||e.type!==1)return gr.EMPTY;const s=this._editor.getModel(),r=this._languageFeaturesService.hoverProvider;return r.has(s)?this._getMarkdownHovers(r,s,e,n):gr.EMPTY}async*_getMarkdownHovers(e,t,i,n){const s=i.range.getStartPosition(),r=z4(e,t,s,n);for await(const a of r)if(!B_(a.hover.contents)){const l=a.hover.range?k.lift(a.hover.range):i.range,c=new BG(a.hover,a.provider,s);yield new ra(this,l,a.hover.contents,!1,a.ordinal,c)}}renderHoverParts(e,t){return this._renderedHoverParts=new M0e(t,e.fragment,this,this._editor,this._languageService,this._openerService,this._commandService,this._keybindingService,this._hoverService,this._configurationService,e.onContentsChanged),this._renderedHoverParts}handleScroll(e){this._renderedHoverParts?.handleScroll(e)}updateMarkdownHoverVerbosityLevel(e,t){return Promise.resolve(this._renderedHoverParts?.updateMarkdownHoverPartVerbosityLevel(e,t))}};Fw=N0e([Ag(1,Mt),Ag(2,Js),Ag(3,Me),Ag(4,he),Ag(5,ot),Ag(6,Qs),Ag(7,Tt)],Fw);class Yk{constructor(e,t,i,n){this.hoverPart=e,this.hoverElement=t,this.disposables=i,this.actionsContainer=n}dispose(){this.disposables.dispose()}}class M0e{constructor(e,t,i,n,s,r,a,l,c,d,h){this._hoverParticipant=i,this._editor=n,this._languageService=s,this._openerService=r,this._commandService=a,this._keybindingService=l,this._hoverService=c,this._configurationService=d,this._onFinishedRendering=h,this._ongoingHoverOperations=new Map,this._disposables=new U,this.renderedHoverParts=this._renderHoverParts(e,t,this._onFinishedRendering),this._disposables.add(ue(()=>{this.renderedHoverParts.forEach(u=>{u.dispose()}),this._ongoingHoverOperations.forEach(u=>{u.tokenSource.dispose(!0)})}))}_renderHoverParts(e,t,i){return e.sort(kn(n=>n.ordinal,lo)),e.map(n=>{const s=this._renderHoverPart(n,i);return t.appendChild(s.hoverElement),s})}_renderHoverPart(e,t){const i=this._renderMarkdownHover(e,t),n=i.hoverElement,s=e.source,r=new U;if(r.add(i),!s)return new Yk(e,n,r);const a=s.supportsVerbosityAction(po.Increase),l=s.supportsVerbosityAction(po.Decrease);if(!a&&!l)return new Yk(e,n,r);const c=Og("div.verbosity-actions");n.prepend(c);const d=Og("div.verbosity-actions-inner");return c.append(d),r.add(this._renderHoverExpansionAction(d,po.Increase,a)),r.add(this._renderHoverExpansionAction(d,po.Decrease,l)),new Yk(e,n,r,d)}_renderMarkdownHover(e,t){return HG(this._editor,e,this._languageService,this._openerService,t)}_renderHoverExpansionAction(e,t,i){const n=new U,s=t===po.Increase,r=Z(e,Og(ve.asCSSSelector(s?T0e:R0e)));r.tabIndex=0;const a=new Q_("mouse",void 0,{target:e,position:{hoverPosition:0}},this._configurationService,this._hoverService);if(n.add(this._hoverService.setupManagedHover(a,r,A0e(this._keybindingService,t))),!i)return r.classList.add("disabled"),n;r.classList.add("enabled");const l=()=>this._commandService.executeCommand(t===po.Increase?zk:Uk,{focus:!0});return n.add(new TG(r,l)),n.add(new RG(r,l,[3,10])),n}handleScroll(e){this.renderedHoverParts.forEach(t=>{const i=t.actionsContainer;if(!i)return;const n=t.hoverElement,r=e.scrollTop+e.height,a=n.offsetTop,l=n.clientHeight,c=a+l,d=22;let h;c<=r||a>=r?h=l-d:h=r-a-d,i.style.top=`${h}px`})}async updateMarkdownHoverPartVerbosityLevel(e,t){const i=this._editor.getModel();if(!i)return;const n=this._getRenderedHoverPartAtIndex(t),s=n?.hoverPart.source;if(!n||!s?.supportsVerbosityAction(e))return;const r=await this._fetchHover(s,i,e);if(!r)return;const a=new BG(r,s.hoverProvider,s.hoverPosition),l=n.hoverPart,c=new ra(this._hoverParticipant,l.range,r.contents,l.isBeforeContent,l.ordinal,a),d=this._updateRenderedHoverPart(t,c);if(d)return{hoverPart:c,hoverElement:d.hoverElement}}async _fetchHover(e,t,i){let n=i===po.Increase?1:-1;const s=e.hoverProvider,r=this._ongoingHoverOperations.get(s);r&&(r.tokenSource.cancel(),n+=r.verbosityDelta);const a=new Xt;this._ongoingHoverOperations.set(s,{verbosityDelta:n,tokenSource:a});const l={verbosityRequest:{verbosityDelta:n,previousHover:e.hover}};let c;try{c=await Promise.resolve(s.provideHover(t,e.hoverPosition,a.token,l))}catch(d){Di(d)}return a.dispose(),this._ongoingHoverOperations.delete(s),c}_updateRenderedHoverPart(e,t){if(e>=this.renderedHoverParts.length||e<0)return;const i=this._renderHoverPart(t,this._onFinishedRendering),n=this.renderedHoverParts[e],s=n.hoverElement,r=i.hoverElement,a=Array.from(r.children);s.replaceChildren(...a);const l=new Yk(t,s,i.disposables,i.actionsContainer);return n.dispose(),this.renderedHoverParts[e]=l,l}_getRenderedHoverPartAtIndex(e){return this.renderedHoverParts[e]}dispose(){this._disposables.dispose()}}function P0e(o,e,t,i,n){e.sort(kn(r=>r.ordinal,lo));const s=[];for(const r of e){const a=HG(t,r,i,n,o.onContentsChanged);o.fragment.appendChild(a.hoverElement),s.push(a)}return new Mg(s)}function HG(o,e,t,i,n){const s=new U,r=Og("div.hover-row"),a=Og("div.hover-row-contents");r.appendChild(a);const l=e.contents;for(const d of l){if(B_(d))continue;const h=Og("div.markdown-hover"),u=Z(h,Og("div.hover-contents")),f=new fd({editor:o},t,i),g=s.add(f.render(d,{asyncRenderCallback:()=>{u.className="hover-contents code-hover-contents",n()}}));u.appendChild(g.element),a.appendChild(h)}return{hoverPart:e,hoverElement:r,dispose(){s.dispose()}}}function A0e(o,e){switch(e){case po.Increase:{const t=o.lookupKeybinding(zk);return t?p(1128,"Increase Hover Verbosity ({0})",t.getLabel()):p(1129,"Increase Hover Verbosity")}case po.Decrease:{const t=o.lookupKeybinding(Uk);return t?p(1130,"Decrease Hover Verbosity ({0})",t.getLabel()):p(1131,"Decrease Hover Verbosity")}}}const VG=Q;class O0e extends A{constructor(e,t,i){super(),this.model=t,this.pixelRatio=i,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new P,this.onColorFlushed=this._onColorFlushed.event,this._domNode=VG(".saturation-wrap"),Z(e,this._domNode),this._canvas=document.createElement("canvas"),this._canvas.className="saturation-box",Z(this._domNode,this._canvas),this.selection=VG(".saturation-selection"),Z(this._domNode,this.selection),this.layout(),this._register(W(this._domNode,te.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(this.model.onDidChangeColor(this.onDidChangeColor,this)),this.monitor=null}get domNode(){return this._domNode}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;this.monitor=this._register(new r_);const t=mi(this._domNode);e.target!==this.selection&&this.onDidChangePosition(e.offsetX,e.offsetY),this.monitor.startMonitoring(e.target,e.pointerId,e.buttons,n=>this.onDidChangePosition(n.pageX-t.left,n.pageY-t.top),()=>null);const i=W(e.target.ownerDocument,te.POINTER_UP,()=>{this._onColorFlushed.fire(),i.dispose(),this.monitor&&(this.monitor.stopMonitoring(!0),this.monitor=null)},!0)}onDidChangePosition(e,t){const i=Math.max(0,Math.min(1,e/this.width)),n=Math.max(0,Math.min(1,1-t/this.height));this.paintSelection(i,n),this._onDidChange.fire({s:i,v:n})}layout(){this.width=this._domNode.offsetWidth,this.height=this._domNode.offsetHeight,this._canvas.width=this.width*this.pixelRatio,this._canvas.height=this.height*this.pixelRatio,this.paint();const e=this.model.color.hsva;this.paintSelection(e.s,e.v)}paint(){const e=this.model.color.hsva,t=new $(new ml(e.h,1,1,1)),i=this._canvas.getContext("2d"),n=i.createLinearGradient(0,0,this._canvas.width,0);n.addColorStop(0,"rgba(255, 255, 255, 1)"),n.addColorStop(.5,"rgba(255, 255, 255, 0.5)"),n.addColorStop(1,"rgba(255, 255, 255, 0)");const s=i.createLinearGradient(0,0,0,this._canvas.height);s.addColorStop(0,"rgba(0, 0, 0, 0)"),s.addColorStop(1,"rgba(0, 0, 0, 1)"),i.rect(0,0,this._canvas.width,this._canvas.height),i.fillStyle=$.Format.CSS.format(t),i.fill(),i.fillStyle=n,i.fill(),i.fillStyle=s,i.fill()}paintSelection(e,t){this.selection.style.left=`${e*this.width}px`,this.selection.style.top=`${this.height-t*this.height}px`}onDidChangeColor(e){if(this.monitor&&this.monitor.isMonitoring())return;this.paint();const t=e.hsva;this.paintSelection(t.s,t.v)}}class F0e extends A{constructor(e){super(),this._onClicked=this._register(new P),this.onClicked=this._onClicked.event,this._button=Z(e,document.createElement("button")),this._button.classList.add("insert-button"),this._button.textContent="Insert",this._register(W(this._button,te.CLICK,()=>{this._onClicked.fire()}))}get button(){return this._button}}const Ww=Q;class zG extends A{constructor(e,t,i){super(),this.model=t,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._onColorFlushed=new P,this.onColorFlushed=this._onColorFlushed.event,i==="standalone"?(this.domNode=Z(e,Ww(".standalone-strip")),this.overlay=Z(this.domNode,Ww(".standalone-overlay"))):(this.domNode=Z(e,Ww(".strip")),this.overlay=Z(this.domNode,Ww(".overlay"))),this.slider=Z(this.domNode,Ww(".slider")),this.slider.style.top="0px",this._register(W(this.domNode,te.POINTER_DOWN,n=>this.onPointerDown(n))),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this.layout()}layout(){this.height=this.domNode.offsetHeight-this.slider.offsetHeight;const e=this.getValue(this.model.color);this.updateSliderPosition(e)}onDidChangeColor(e){const t=this.getValue(e);this.updateSliderPosition(t)}onPointerDown(e){if(!e.target||!(e.target instanceof Element))return;const t=this._register(new r_),i=mi(this.domNode);this.domNode.classList.add("grabbing"),e.target!==this.slider&&this.onDidChangeTop(e.offsetY),t.startMonitoring(e.target,e.pointerId,e.buttons,s=>this.onDidChangeTop(s.pageY-i.top),()=>null);const n=W(e.target.ownerDocument,te.POINTER_UP,()=>{this._onColorFlushed.fire(),n.dispose(),t.stopMonitoring(!0),this.domNode.classList.remove("grabbing")},!0)}onDidChangeTop(e){const t=Math.max(0,Math.min(1,1-e/this.height));this.updateSliderPosition(t),this._onDidChange.fire(t)}updateSliderPosition(e){this.slider.style.top=`${(1-e)*this.height}px`}}class W0e extends zG{constructor(e,t,i){super(e,t,i),this.domNode.classList.add("opacity-strip"),this.onDidChangeColor(this.model.color)}onDidChangeColor(e){super.onDidChangeColor(e);const{r:t,g:i,b:n}=e.rgba,s=new $(new q(t,i,n,1)),r=new $(new q(t,i,n,0));this.overlay.style.background=`linear-gradient(to bottom, ${s} 0%, ${r} 100%)`}getValue(e){return e.hsva.a}}class B0e extends zG{constructor(e,t,i){super(e,t,i),this.domNode.classList.add("hue-strip")}getValue(e){return 1-e.hsva.h/360}}const H0e=Q;class V0e extends A{constructor(e,t,i,n){super(),this.model=t,this.pixelRatio=i,this._insertButton=null,this._domNode=H0e(".colorpicker-body"),Z(e,this._domNode),this._saturationBox=new O0e(this._domNode,this.model,this.pixelRatio),this._register(this._saturationBox),this._register(this._saturationBox.onDidChange(this.onDidSaturationValueChange,this)),this._register(this._saturationBox.onColorFlushed(this.flushColor,this)),this._opacityStrip=new W0e(this._domNode,this.model,n),this._register(this._opacityStrip),this._register(this._opacityStrip.onDidChange(this.onDidOpacityChange,this)),this._register(this._opacityStrip.onColorFlushed(this.flushColor,this)),this._hueStrip=new B0e(this._domNode,this.model,n),this._register(this._hueStrip),this._register(this._hueStrip.onDidChange(this.onDidHueChange,this)),this._register(this._hueStrip.onColorFlushed(this.flushColor,this)),n==="standalone"&&(this._insertButton=this._register(new F0e(this._domNode)),this._domNode.classList.add("standalone-colorpicker"))}flushColor(){this.model.flushColor()}onDidSaturationValueChange({s:e,v:t}){const i=this.model.color.hsva;this.model.color=new $(new ml(i.h,e,t,i.a))}onDidOpacityChange(e){const t=this.model.color.hsva;this.model.color=new $(new ml(t.h,t.s,t.v,e))}onDidHueChange(e){const t=this.model.color.hsva,i=(1-e)*360;this.model.color=new $(new ml(i===360?0:i,t.s,t.v,t.a))}get domNode(){return this._domNode}get saturationBox(){return this._saturationBox}get enterButton(){return this._insertButton}layout(){this._saturationBox.layout(),this._opacityStrip.layout(),this._hueStrip.layout()}}const z0e=Q;class U0e extends A{constructor(e){super(),this._onClicked=this._register(new P),this.onClicked=this._onClicked.event,this._button=document.createElement("div"),this._button.classList.add("close-button"),Z(e,this._button);const t=document.createElement("div");t.classList.add("close-button-inner-div"),Z(this._button,t),Z(t,z0e(".button"+ve.asCSSSelector(Wt("color-picker-close",Y.close,p(881,"Icon to close the color picker"))))).classList.add("close-icon"),this._register(W(this._button,te.CLICK,()=>{this._onClicked.fire()}))}}const Xk=Q;class $0e extends A{constructor(e,t,i,n){super(),this.model=t,this.type=n,this._closeButton=null,this._domNode=Xk(".colorpicker-header"),Z(e,this._domNode),this._pickedColorNode=Z(this._domNode,Xk(".picked-color")),Z(this._pickedColorNode,Xk("span.codicon.codicon-color-mode")),this._pickedColorPresentation=Z(this._pickedColorNode,document.createElement("span")),this._pickedColorPresentation.classList.add("picked-color-presentation");const s=p(882,"Click to toggle color options (rgb/hsl/hex)");this._pickedColorNode.setAttribute("title",s),this._originalColorNode=Z(this._domNode,Xk(".original-color")),this._originalColorNode.style.backgroundColor=$.Format.CSS.format(this.model.originalColor)||"",this.backgroundColor=i.getColorTheme().getColor(LL)||$.white,this._register(i.onDidColorThemeChange(r=>{this.backgroundColor=r.getColor(LL)||$.white})),this._register(W(this._pickedColorNode,te.CLICK,()=>this.model.selectNextColorPresentation())),this._register(W(this._originalColorNode,te.CLICK,()=>{this.model.color=this.model.originalColor,this.model.flushColor()})),this._register(t.onDidChangeColor(this.onDidChangeColor,this)),this._register(t.onDidChangePresentation(this.onDidChangePresentation,this)),this._pickedColorNode.style.backgroundColor=$.Format.CSS.format(t.color)||"",this._pickedColorNode.classList.toggle("light",t.color.rgba.a<.5?this.backgroundColor.isLighter():t.color.isLighter()),this.onDidChangeColor(this.model.color),this.type==="standalone"&&(this._domNode.classList.add("standalone-colorpicker"),this._closeButton=this._register(new U0e(this._domNode)))}get closeButton(){return this._closeButton}get pickedColorNode(){return this._pickedColorNode}get originalColorNode(){return this._originalColorNode}onDidChangeColor(e){this._pickedColorNode.style.backgroundColor=$.Format.CSS.format(e)||"",this._pickedColorNode.classList.toggle("light",e.rgba.a<.5?this.backgroundColor.isLighter():e.isLighter()),this.onDidChangePresentation()}onDidChangePresentation(){this._pickedColorPresentation.textContent=this.model.presentation?this.model.presentation.label:""}}const j0e=Q;class UG extends go{constructor(e,t,i,n,s){super(),this.model=t,this.pixelRatio=i,this._register(A1.getInstance(me(e)).onDidChange(()=>this.layout())),this._domNode=j0e(".colorpicker-widget"),e.appendChild(this._domNode),this.header=this._register(new $0e(this._domNode,this.model,n,s)),this.body=this._register(new V0e(this._domNode,this.model,this.pixelRatio,s))}layout(){this.body.layout()}get domNode(){return this._domNode}}class q0e{get color(){return this._color}set color(e){this._color.equals(e)||(this._color=e,this._onDidChangeColor.fire(e))}get presentation(){return this.colorPresentations[this.presentationIndex]}get colorPresentations(){return this._colorPresentations}set colorPresentations(e){this._colorPresentations=e,this.presentationIndex>e.length-1&&(this.presentationIndex=0),this._onDidChangePresentation.fire(this.presentation)}constructor(e,t,i){this.presentationIndex=i,this._onColorFlushed=new P,this.onColorFlushed=this._onColorFlushed.event,this._onDidChangeColor=new P,this.onDidChangeColor=this._onDidChangeColor.event,this._onDidChangePresentation=new P,this.onDidChangePresentation=this._onDidChangePresentation.event,this.originalColor=e,this._color=e,this._colorPresentations=t}selectNextColorPresentation(){this.presentationIndex=(this.presentationIndex+1)%this.colorPresentations.length,this.flushColor(),this._onDidChangePresentation.fire(this.presentation)}guessColorPresentation(e,t){let i=-1;for(let n=0;n<this.colorPresentations.length;n++)if(t.toLowerCase()===this.colorPresentations[n].label){i=n;break}if(i===-1){const n=t.split("(")[0].toLowerCase();for(let s=0;s<this.colorPresentations.length;s++)if(this.colorPresentations[s].label.toLowerCase().startsWith(n)){i=s;break}}i!==-1&&i!==this.presentationIndex&&(this.presentationIndex=i,this._onDidChangePresentation.fire(this.presentation))}flushColor(){this._onColorFlushed.fire(this._color)}}async function $G(o,e,t){const i=o.getValueInRange(e.range),{red:n,green:s,blue:r,alpha:a}=e.color,l=new q(Math.round(n*255),Math.round(s*255),Math.round(r*255),a),c=new $(l),d=await SG(o,e,t,He.None),h=new q0e(c,[],0);return h.colorPresentations=d||[],h.guessColorPresentation(c,i),{range:k.lift(e.range),model:h,provider:t}}function jG(o,e,t){const i=[],n=t.presentation.textEdit??{range:e,text:t.presentation.label,forceMoveMarkers:!1};i.push(n),t.presentation.additionalTextEdits&&i.push(...t.presentation.additionalTextEdits);const s=k.lift(n.range),r=o.getModel()._setTrackedRange(null,s,3);return o.executeEdits("colorpicker",i),o.pushUndoStop(),o.getModel()._getTrackedRange(r)??s}async function Bw(o,e,t,i,n){const s=await SG(o,{range:i,color:{red:t.rgba.r/255,green:t.rgba.g/255,blue:t.rgba.b/255,alpha:t.rgba.a}},n.provider,He.None);e.colorPresentations=s||[]}var K0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},G0e=function(o,e){return function(t,i){e(t,i,o)}};class Qk{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n,this.forceShowAtRange=!0}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}static fromBaseColor(e,t){return new Qk(e,t.range,t.model,t.provider)}}let Jk=class{constructor(e,t){this._editor=e,this._themeService=t,this.hoverOrdinal=2}computeSync(e,t,i){return[]}computeAsync(e,t,i,n){return gr.fromPromise(this._computeAsync(e,t,i))}async _computeAsync(e,t,i){if(!this._editor.hasModel())return[];if(!this._isValidRequest(i))return[];const n=db.get(this._editor);if(!n)return[];for(const s of t){if(!n.isColorDecoration(s))continue;const r=n.getColorData(s.range.getStartPosition());if(r)return[Qk.fromBaseColor(this,await $G(this._editor.getModel(),r.colorInfo,r.provider))]}return[]}_isValidRequest(e){const t=this._editor.getOption(168);switch(e){case 0:return t==="hover"||t==="clickAndHover";case 1:return t==="click"||t==="clickAndHover";case 2:return!0}}renderHoverParts(e,t){const i=this._editor;if(t.length===0||!i.hasModel())return new Mg([]);const n=i.getOption(75)+8;e.setMinimumDimensions(new dt(302,n));const s=new U,r=t[0],a=i.getModel(),l=r.model;this._colorPicker=s.add(new UG(e.fragment,l,i.getOption(163),this._themeService,"hover"));let c=!1,d=new k(r.range.startLineNumber,r.range.startColumn,r.range.endLineNumber,r.range.endColumn);s.add(l.onColorFlushed(async u=>{await Bw(a,l,u,d,r),c=!0,d=jG(i,d,l)})),s.add(l.onDidChangeColor(u=>{Bw(a,l,u,d,r)})),s.add(i.onDidChangeModelContent(u=>{c?c=!1:(e.hide(),i.focus())}));const h={hoverPart:Qk.fromBaseColor(this,r),hoverElement:this._colorPicker.domNode,dispose(){s.dispose()}};return new Mg([h])}handleResize(){this._colorPicker?.layout()}handleContentsChanged(){this._colorPicker?.layout()}handleHide(){this._colorPicker?.dispose(),this._colorPicker=void 0}isColorPickerVisible(){return!!this._colorPicker}};Jk=K0e([G0e(1,li)],Jk);class fi{static insert(e,t){return{range:new k(e.lineNumber,e.column,e.lineNumber,e.column),text:t,forceMoveMarkers:!0}}static delete(e){return{range:e,text:null}}static replace(e,t){return{range:e,text:t}}static replaceMove(e,t){return{range:e,text:t,forceMoveMarkers:!0}}}function U4(o,e){return!!o[e]}class $4{constructor(e,t){this.target=e.target,this.isLeftClick=e.event.leftButton,this.isMiddleClick=e.event.middleButton,this.isRightClick=e.event.rightButton,this.mouseMiddleClickAction=t.mouseMiddleClickAction,this.hasTriggerModifier=U4(e.event,t.triggerModifier),this.isMiddleClick&&t.mouseMiddleClickAction==="ctrlLeftClick"&&(this.isMiddleClick=!1,this.isLeftClick=!0,this.hasTriggerModifier=!0),this.hasSideBySideModifier=U4(e.event,t.triggerSideBySideModifier),this.isNoneOrSingleMouseDown=e.event.detail<=1}}class qG{constructor(e,t){this.keyCodeIsTriggerKey=e.keyCode===t.triggerKey,this.keyCodeIsSideBySideKey=e.keyCode===t.triggerSideBySideKey,this.hasTriggerModifier=U4(e,t.triggerModifier)}}class eI{constructor(e,t,i,n,s){this.mouseMiddleClickAction=s,this.triggerKey=e,this.triggerModifier=t,this.triggerSideBySideKey=i,this.triggerSideBySideModifier=n}equals(e){return this.triggerKey===e.triggerKey&&this.triggerModifier===e.triggerModifier&&this.triggerSideBySideKey===e.triggerSideBySideKey&&this.triggerSideBySideModifier===e.triggerSideBySideModifier&&this.mouseMiddleClickAction===e.mouseMiddleClickAction}}function KG(o,e){return o==="altKey"?ze?new eI(57,"metaKey",6,"altKey",e):new eI(5,"ctrlKey",6,"altKey",e):ze?new eI(6,"altKey",57,"metaKey",e):new eI(6,"altKey",5,"ctrlKey",e)}class tI extends A{constructor(e,t){super(),this._onMouseMoveOrRelevantKeyDown=this._register(new P),this.onMouseMoveOrRelevantKeyDown=this._onMouseMoveOrRelevantKeyDown.event,this._onExecute=this._register(new P),this.onExecute=this._onExecute.event,this._onCancel=this._register(new P),this.onCancel=this._onCancel.event,this._editor=e,this._extractLineNumberFromMouseEvent=t?.extractLineNumberFromMouseEvent??(i=>i.target.position?i.target.position.lineNumber:0),this._opts=KG(this._editor.getOption(86),this._editor.getOption(87)),this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._register(this._editor.onDidChangeConfiguration(i=>{if(i.hasChanged(86)||i.hasChanged(87)){const n=KG(this._editor.getOption(86),this._editor.getOption(87));if(this._opts.equals(n))return;this._opts=n,this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._lineNumberOnMouseDown=0,this._onCancel.fire()}})),this._register(this._editor.onMouseMove(i=>this._onEditorMouseMove(new $4(i,this._opts)))),this._register(this._editor.onMouseDown(i=>this._onEditorMouseDown(new $4(i,this._opts)))),this._register(this._editor.onMouseUp(i=>this._onEditorMouseUp(new $4(i,this._opts)))),this._register(this._editor.onKeyDown(i=>this._onEditorKeyDown(new qG(i,this._opts)))),this._register(this._editor.onKeyUp(i=>this._onEditorKeyUp(new qG(i,this._opts)))),this._register(this._editor.onMouseDrag(()=>this._resetHandler())),this._register(this._editor.onDidChangeCursorSelection(i=>this._onDidChangeCursorSelection(i))),this._register(this._editor.onDidChangeModel(i=>this._resetHandler())),this._register(this._editor.onDidChangeModelContent(()=>this._resetHandler())),this._register(this._editor.onDidScrollChange(i=>{(i.scrollTopChanged||i.scrollLeftChanged)&&this._resetHandler()}))}_onDidChangeCursorSelection(e){e.selection&&e.selection.startColumn!==e.selection.endColumn&&this._resetHandler()}_onEditorMouseMove(e){this._lastMouseMoveEvent=e,this._onMouseMoveOrRelevantKeyDown.fire([e,null])}_onEditorMouseDown(e){this._hasTriggerKeyOnMouseDown=e.hasTriggerModifier,this._lineNumberOnMouseDown=this._extractLineNumberFromMouseEvent(e)}_onEditorMouseUp(e){const t=this._extractLineNumberFromMouseEvent(e);!!this._lineNumberOnMouseDown&&this._lineNumberOnMouseDown===t&&(this._hasTriggerKeyOnMouseDown||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink")&&this._onExecute.fire(e)}_onEditorKeyDown(e){this._lastMouseMoveEvent&&(e.keyCodeIsTriggerKey||e.keyCodeIsSideBySideKey&&e.hasTriggerModifier)?this._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent,e]):e.hasTriggerModifier&&this._onCancel.fire()}_onEditorKeyUp(e){e.keyCodeIsTriggerKey&&this._onCancel.fire()}_resetHandler(){this._lastMouseMoveEvent=null,this._hasTriggerKeyOnMouseDown=!1,this._onCancel.fire()}}class GG{constructor(e,t){this.range=e,this.direction=t}}class j4{constructor(e,t,i){this.hint=e,this.anchor=t,this.provider=i,this._isResolved=!1}with(e){const t=new j4(this.hint,e.anchor,this.provider);return t._isResolved=this._isResolved,t._currentResolve=this._currentResolve,t}async resolve(e){if(typeof this.provider.resolveInlayHint=="function"){if(this._currentResolve)return await this._currentResolve,e.isCancellationRequested?void 0:this.resolve(e);this._isResolved||(this._currentResolve=this._doResolve(e).finally(()=>this._currentResolve=void 0)),await this._currentResolve}}async _doResolve(e){try{const t=await Promise.resolve(this.provider.resolveInlayHint(this.hint,e));this.hint.tooltip=t?.tooltip??this.hint.tooltip,this.hint.label=t?.label??this.hint.label,this.hint.textEdits=t?.textEdits??this.hint.textEdits,this._isResolved=!0}catch(t){Di(t),this._isResolved=!1}}}const xC=class xC{static async create(e,t,i,n){const s=[],r=e.ordered(t).reverse().map(a=>i.map(async l=>{try{const c=await a.provideInlayHints(t,l,n);(c?.hints.length||a.onDidChangeInlayHints)&&s.push([c??xC._emptyInlayHintList,a])}catch(c){Di(c)}}));if(await Promise.all(r.flat()),n.isCancellationRequested||t.isDisposed())throw new cr;return new xC(i,s,t)}constructor(e,t,i){this._disposables=new U,this.ranges=e,this.provider=new Set;const n=[];for(const[s,r]of t){this._disposables.add(s),this.provider.add(r);for(const a of s.hints){const l=i.validatePosition(a.position);let c="before";const d=xC._getRangeAtPosition(i,l);let h;d.getStartPosition().isBefore(l)?(h=k.fromPositions(d.getStartPosition(),l),c="after"):(h=k.fromPositions(l,d.getEndPosition()),c="before"),n.push(new j4(a,new GG(h,c),r))}}this.items=n.sort((s,r)=>M.compare(s.hint.position,r.hint.position))}dispose(){this._disposables.dispose()}static _getRangeAtPosition(e,t){const i=t.lineNumber,n=e.getWordAtPosition(t);if(n)return new k(i,n.startColumn,i,n.endColumn);e.tokenization.tokenizeIfCheap(i);const s=e.tokenization.getLineTokens(i),r=t.column-1,a=s.findTokenIndexAtOffset(r);let l=s.getStartOffset(a),c=s.getEndOffset(a);return c-l===1&&(l===r&&a>1?(l=s.getStartOffset(a-1),c=s.getEndOffset(a-1)):c===r&&a<s.getCount()-1&&(l=s.getStartOffset(a+1),c=s.getEndOffset(a+1))),new k(i,l+1,i,c+1)}};xC._emptyInlayHintList=Object.freeze({dispose(){},hints:[]});let iI=xC;function Z0e(o){return mj(o.id,...o.arguments??[]).toString()}function $l(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===vv.ICodeEditor:!1}function q4(o){return o&&typeof o.getEditorType=="function"?o.getEditorType()===vv.IDiffEditor:!1}function Y0e(o){return!!o&&typeof o=="object"&&typeof o.onDidChangeActiveEditor=="function"}function ZG(o){return $l(o)?o:q4(o)?o.getModifiedEditor():Y0e(o)&&$l(o.activeCodeEditor)?o.activeCodeEditor:null}var X0e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bd=function(o,e){return function(t,i){e(t,i,o)}};let Cd=class extends sg{constructor(e,t,i,n,s,r,a,l,c,d,h,u,f){super(e,{...n.getRawOptions(),overflowWidgetsDomNode:n.getOverflowWidgetsDomNode()},i,s,r,a,l,c,d,h,u,f),this._parentEditor=n,this._overwriteOptions=t,super.updateOptions(this._overwriteOptions),this._register(n.onDidChangeConfiguration(g=>this._onParentConfigurationChanged(g)))}getParentEditor(){return this._parentEditor}_onParentConfigurationChanged(e){super.updateOptions(this._parentEditor.getRawOptions()),super.updateOptions(this._overwriteOptions)}updateOptions(e){Yy(this._overwriteOptions,e,!0),super.updateOptions(this._overwriteOptions)}};Cd=X0e([bd(4,ge),bd(5,et),bd(6,Tt),bd(7,xe),bd(8,li),bd(9,hi),bd(10,bn),bd(11,Jt),bd(12,he)],Cd);function YG(o){const e=o.get(et).getFocusedCodeEditor();return e instanceof Cd?e.getParentEditor():e}const XG=new $(new q(0,122,204)),Q0e={showArrow:!0,showFrame:!0,className:"",frameColor:XG,arrowColor:XG,keepEditorSelection:!1},J0e="vs.editor.contrib.zoneWidget";class eSe{constructor(e,t,i,n,s,r,a,l){this.id="",this.domNode=e,this.afterLineNumber=t,this.afterColumn=i,this.heightInLines=n,this.showInHiddenAreas=a,this.ordinal=l,this._onDomNodeTop=s,this._onComputedHeight=r}onDomNodeTop(e){this._onDomNodeTop(e)}onComputedHeight(e){this._onComputedHeight(e)}}class tSe{constructor(e,t){this._id=e,this._domNode=t}getId(){return this._id}getDomNode(){return this._domNode}getPosition(){return null}}const RN=class RN{constructor(e){this._editor=e,this._ruleName=RN._IdGenerator.nextId(),this._color=null,this._height=-1,this._decorations=this._editor.createDecorationsCollection()}dispose(){this.hide(),J2(this._ruleName)}set color(e){this._color!==e&&(this._color=e,this._updateStyle())}set height(e){this._height!==e&&(this._height=e,this._updateStyle())}_updateStyle(){J2(this._ruleName),_L(`.monaco-editor ${this._ruleName}`,`border-style: solid; border-color: transparent; border-bottom-color: ${this._color}; border-width: ${this._height}px; bottom: -${this._height}px !important; margin-left: -${this._height}px; `)}show(e){e.column===1&&(e={lineNumber:e.lineNumber,column:2}),this._decorations.set([{range:k.fromPositions(e),options:{description:"zone-widget-arrow",className:this._ruleName,stickiness:1}}])}hide(){this._decorations.clear()}};RN._IdGenerator=new EA(".arrow-decoration-");let K4=RN;class iSe{constructor(e,t={}){this._arrow=null,this._overlayWidget=null,this._resizeSash=null,this._isSashResizeHeight=!1,this._viewZone=null,this._disposables=new U,this.container=null,this._isShowing=!1,this.editor=e,this._positionMarkerId=this.editor.createDecorationsCollection(),this.options=fl(t),Yy(this.options,Q0e,!1),this.domNode=document.createElement("div"),this.options.isAccessible||(this.domNode.setAttribute("aria-hidden","true"),this.domNode.setAttribute("role","presentation")),this._disposables.add(this.editor.onDidLayoutChange(i=>{const n=this._getWidth(i);this.domNode.style.width=n+"px",this.domNode.style.left=this._getLeft(i)+"px",this._onWidth(n)}))}dispose(){this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._viewZone&&this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id),this._viewZone=null}),this._positionMarkerId.clear(),this._disposables.dispose()}create(){this.domNode.classList.add("zone-widget"),this.options.className&&this.domNode.classList.add(this.options.className),this.container=document.createElement("div"),this.container.classList.add("zone-widget-container"),this.domNode.appendChild(this.container),this.options.showArrow&&(this._arrow=new K4(this.editor),this._disposables.add(this._arrow)),this._fillContainer(this.container),this._initSash(),this._applyStyles()}style(e){e.frameColor&&(this.options.frameColor=e.frameColor),e.arrowColor&&(this.options.arrowColor=e.arrowColor),this._applyStyles()}_applyStyles(){if(this.container&&this.options.frameColor){const e=this.options.frameColor.toString();this.container.style.borderTopColor=e,this.container.style.borderBottomColor=e}if(this._arrow&&this.options.arrowColor){const e=this.options.arrowColor.toString();this._arrow.color=e}}_getWidth(e){return e.width-e.minimap.minimapWidth-e.verticalScrollbarWidth}_getLeft(e){return e.minimap.minimapWidth>0&&e.minimap.minimapLeft===0?e.minimap.minimapWidth:0}_onViewZoneTop(e){this.domNode.style.top=e+"px"}_onViewZoneHeight(e){if(this.domNode.style.height=`${e}px`,this.container){const t=e-this._decoratingElementsHeight();this.container.style.height=`${t}px`;const i=this.editor.getLayoutInfo();this._doLayout(t,this._getWidth(i))}this._resizeSash?.layout()}get position(){const e=this._positionMarkerId.getRange(0);if(e)return e.getStartPosition()}show(e,t){const i=k.isIRange(e)?k.lift(e):k.fromPositions(e);this._isShowing=!0,this._showImpl(i,t),this._isShowing=!1,this._positionMarkerId.set([{range:i,options:Te.EMPTY}])}hide(){this._viewZone&&(this.editor.changeViewZones(e=>{this._viewZone&&e.removeZone(this._viewZone.id)}),this._viewZone=null),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this._arrow?.hide(),this._positionMarkerId.clear(),this._isSashResizeHeight=!1}_decoratingElementsHeight(){const e=this.editor.getOption(75);let t=0;if(this.options.showArrow){const i=Math.round(e/3);t+=2*i}if(this.options.showFrame){const i=this.options.frameWidth??Math.round(e/9);t+=2*i}return t}_getMaximumHeightInLines(){return Math.max(12,this.editor.getLayoutInfo().height/this.editor.getOption(75)*.8)}_showImpl(e,t){const i=e.getStartPosition(),n=this.editor.getLayoutInfo(),s=this._getWidth(n);this.domNode.style.width=`${s}px`,this.domNode.style.left=this._getLeft(n)+"px";const r=document.createElement("div");r.style.overflow="hidden";const a=this.editor.getOption(75),l=this._getMaximumHeightInLines();l!==void 0&&(t=Math.min(t,l));let c=0,d=0;if(this._arrow&&this.options.showArrow&&(c=Math.round(a/3),this._arrow.height=c,this._arrow.show(i)),this.options.showFrame&&(d=Math.round(a/9)),this.editor.changeViewZones(f=>{this._viewZone&&f.removeZone(this._viewZone.id),this._overlayWidget&&(this.editor.removeOverlayWidget(this._overlayWidget),this._overlayWidget=null),this.domNode.style.top="-1000px",this._viewZone=new eSe(r,i.lineNumber,i.column,t,g=>this._onViewZoneTop(g),g=>this._onViewZoneHeight(g),this.options.showInHiddenAreas,this.options.ordinal),this._viewZone.id=f.addZone(this._viewZone),this._overlayWidget=new tSe(J0e+this._viewZone.id,this.domNode),this.editor.addOverlayWidget(this._overlayWidget)}),this._updateSashEnablement(),this.container&&this.options.showFrame){const f=this.options.frameWidth?this.options.frameWidth:d;this.container.style.borderTopWidth=f+"px",this.container.style.borderBottomWidth=f+"px"}const h=t*a-this._decoratingElementsHeight();this.container&&(this.container.style.top=c+"px",this.container.style.height=h+"px",this.container.style.overflow="hidden"),this._doLayout(h,s),this.options.keepEditorSelection||this.editor.setSelection(e);const u=this.editor.getModel();if(u){const f=u.validateRange(new k(e.startLineNumber,1,e.endLineNumber+1,1));this.revealRange(f,f.startLineNumber===u.getLineCount())}}revealRange(e,t){t?this.editor.revealLineNearTop(e.endLineNumber,0):this.editor.revealRange(e,0)}setCssClass(e,t){this.container&&(t&&this.container.classList.remove(t),this.container.classList.add(e))}_onWidth(e){}_doLayout(e,t){}_relayout(e,t){const i=this._getMaximumHeightInLines(),n=t&&i!==void 0?Math.min(i,e):e;this._viewZone&&this._viewZone.heightInLines!==n&&(this.editor.changeViewZones(s=>{this._viewZone&&(this._viewZone.heightInLines=n,s.layoutZone(this._viewZone.id))}),this._updateSashEnablement())}_initSash(){if(this._resizeSash)return;this._resizeSash=this._disposables.add(new Gn(this.domNode,this,{orientation:1})),this.options.isResizeable||(this._resizeSash.state=0);let e;this._disposables.add(this._resizeSash.onDidStart(t=>{this._viewZone&&(e={startY:t.startY,heightInLines:this._viewZone.heightInLines,...this._getResizeBounds()})})),this._disposables.add(this._resizeSash.onDidEnd(()=>{e=void 0})),this._disposables.add(this._resizeSash.onDidChange(t=>{if(e){const i=(t.currentY-e.startY)/this.editor.getOption(75),n=i<0?Math.ceil(i):Math.floor(i),s=e.heightInLines+n;s>e.minLines&&s<e.maxLines&&(this._isSashResizeHeight=!0,this._relayout(s))}}))}_updateSashEnablement(){if(this._resizeSash){const{minLines:e,maxLines:t}=this._getResizeBounds();this._resizeSash.state=e===t?0:3}}_getResizeBounds(){return{minLines:5,maxLines:35}}getHorizontalSashLeft(){return 0}getHorizontalSashTop(){return(this.domNode.style.height===null?0:parseInt(this.domNode.style.height))-this._decoratingElementsHeight()/2}getHorizontalSashWidth(){const e=this.editor.getLayoutInfo();return e.width-e.minimap.minimapWidth}}var QG=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JG=function(o,e){return function(t,i){e(t,i,o)}};const eZ=We("IPeekViewService");je(eZ,class{constructor(){this._widgets=new Map}addExclusiveWidget(o,e){const t=this._widgets.get(o);t&&(t.listener.dispose(),t.widget.dispose());const i=()=>{const n=this._widgets.get(o);n&&n.widget===e&&(n.listener.dispose(),this._widgets.delete(o))};this._widgets.set(o,{widget:e,listener:e.onDidClose(i)})}},1);var eo;(function(o){o.inPeekEditor=new ae("inReferenceSearchEditor",!0,p(1306,"Whether the current code editor is embedded inside peek")),o.notInPeekEditor=o.inPeekEditor.toNegated()})(eo||(eo={}));let nI=(kC=class{constructor(e,t){e instanceof Cd&&eo.inPeekEditor.bindTo(t)}dispose(){}},kC.ID="editor.contrib.referenceController",kC);nI=QG([JG(1,xe)],nI),Qe(nI.ID,nI,0);const nSe={headerBackgroundColor:$.white,primaryHeadingColor:$.fromHex("#333333"),secondaryHeadingColor:$.fromHex("#6c6c6cb3")};let sI=class extends iSe{constructor(e,t,i){super(e,t),this.instantiationService=i,this._onDidClose=new P,this.onDidClose=this._onDidClose.event,Yy(this.options,nSe,!1);const n=ni(this.editor);n.openedPeekWidgets.set(n.openedPeekWidgets.get()+1,void 0)}dispose(){if(!this.disposed){this.disposed=!0,super.dispose(),this._onDidClose.fire(this);const e=ni(this.editor);e.openedPeekWidgets.set(e.openedPeekWidgets.get()-1,void 0)}}style(e){const t=this.options;e.headerBackgroundColor&&(t.headerBackgroundColor=e.headerBackgroundColor),e.primaryHeadingColor&&(t.primaryHeadingColor=e.primaryHeadingColor),e.secondaryHeadingColor&&(t.secondaryHeadingColor=e.secondaryHeadingColor),super.style(e)}_applyStyles(){super._applyStyles();const e=this.options;this._headElement&&e.headerBackgroundColor&&(this._headElement.style.backgroundColor=e.headerBackgroundColor.toString()),this._primaryHeading&&e.primaryHeadingColor&&(this._primaryHeading.style.color=e.primaryHeadingColor.toString()),this._secondaryHeading&&e.secondaryHeadingColor&&(this._secondaryHeading.style.color=e.secondaryHeadingColor.toString()),this._bodyElement&&e.frameColor&&(this._bodyElement.style.borderColor=e.frameColor.toString())}_fillContainer(e){this.setCssClass("peekview-widget"),this._headElement=Q(".head"),this._bodyElement=Q(".body"),this._fillHead(this._headElement),this._fillBody(this._bodyElement),e.appendChild(this._headElement),e.appendChild(this._bodyElement)}_fillHead(e,t){this._titleElement=Q(".peekview-title"),this.options.supportOnTitleClick&&(this._titleElement.classList.add("clickable"),Si(this._titleElement,"click",s=>this._onTitleClick(s))),Z(this._headElement,this._titleElement),this._fillTitleIcon(this._titleElement),this._primaryHeading=Q("span.filename"),this._secondaryHeading=Q("span.dirname"),this._metaHeading=Q("span.meta"),Z(this._titleElement,this._primaryHeading,this._secondaryHeading,this._metaHeading);const i=Q(".peekview-actions");Z(this._headElement,i);const n=this._getActionBarOptions();this._actionbarWidget=new Ys(i,n),this._disposables.add(this._actionbarWidget),t||this._actionbarWidget.push(this._disposables.add(new Mo("peekview.close",p(1307,"Close"),ve.asClassName(Y.close),!0,()=>(this.dispose(),Promise.resolve()))),{label:!1,icon:!0})}_fillTitleIcon(e){}_getActionBarOptions(){return{actionViewItemProvider:MO.bind(void 0,this.instantiationService),orientation:0}}_onTitleClick(e){}setTitle(e,t){this._primaryHeading&&this._secondaryHeading&&(this._primaryHeading.innerText=e,this._primaryHeading.setAttribute("title",e),t?this._secondaryHeading.innerText=t:pn(this._secondaryHeading))}setMetaTitle(e){this._metaHeading&&(e?(this._metaHeading.innerText=e,uo(this._metaHeading)):gs(this._metaHeading))}_doLayout(e,t){if(!this._isShowing&&e<0){this.dispose();return}const i=Math.ceil(this.editor.getOption(75)*1.2),n=Math.round(e-(i+1));this._doLayoutHead(i,t),this._doLayoutBody(n,t)}_doLayoutHead(e,t){this._headElement&&(this._headElement.style.height=`${e}px`,this._headElement.style.lineHeight=this._headElement.style.height)}_doLayoutBody(e,t){this._bodyElement&&(this._bodyElement.style.height=`${e}px`)}};sI=QG([JG(2,ge)],sI);const sSe=N("peekViewTitle.background",{dark:"#252526",light:"#F3F3F3",hcDark:$.black,hcLight:$.white},p(1308,"Background color of the peek view title area.")),tZ=N("peekViewTitleLabel.foreground",{dark:$.white,light:$.black,hcDark:$.white,hcLight:bl},p(1309,"Color of the peek view title.")),iZ=N("peekViewTitleDescription.foreground",{dark:"#ccccccb3",light:"#616161",hcDark:"#FFFFFF99",hcLight:"#292929"},p(1310,"Color of the peek view title info.")),oSe=N("peekView.border",{dark:Cl,light:Cl,hcDark:Ze,hcLight:Ze},p(1311,"Color of the peek view borders and arrow.")),rSe=N("peekViewResult.background",{dark:"#252526",light:"#F3F3F3",hcDark:$.black,hcLight:$.white},p(1312,"Background color of the peek view result list."));N("peekViewResult.lineForeground",{dark:"#bbbbbb",light:"#646465",hcDark:$.white,hcLight:bl},p(1313,"Foreground color for line nodes in the peek view result list.")),N("peekViewResult.fileForeground",{dark:$.white,light:"#1E1E1E",hcDark:$.white,hcLight:bl},p(1314,"Foreground color for file nodes in the peek view result list.")),N("peekViewResult.selectionBackground",{dark:"#3399ff33",light:"#3399ff33",hcDark:null,hcLight:null},p(1315,"Background color of the selected entry in the peek view result list.")),N("peekViewResult.selectionForeground",{dark:$.white,light:"#6C6C6C",hcDark:$.white,hcLight:bl},p(1316,"Foreground color of the selected entry in the peek view result list."));const G4=N("peekViewEditor.background",{dark:"#001F33",light:"#F2F8FC",hcDark:$.black,hcLight:$.white},p(1317,"Background color of the peek view editor."));N("peekViewEditorGutter.background",G4,p(1318,"Background color of the gutter in the peek view editor.")),N("peekViewEditorStickyScroll.background",G4,p(1319,"Background color of sticky scroll in the peek view editor.")),N("peekViewEditorStickyScrollGutter.background",G4,p(1320,"Background color of the gutter part of sticky scroll in the peek view editor.")),N("peekViewResult.matchHighlightBackground",{dark:"#ea5c004d",light:"#ea5c004d",hcDark:null,hcLight:null},p(1321,"Match highlight color in the peek view result list.")),N("peekViewEditor.matchHighlightBackground",{dark:"#ff8f0099",light:"#f5d802de",hcDark:null,hcLight:null},p(1322,"Match highlight color in the peek view editor.")),N("peekViewEditor.matchHighlightBorder",{dark:null,light:null,hcDark:jt,hcLight:jt},p(1323,"Match highlight border in the peek view editor."));class aSe{get templateId(){return this.renderer.templateId}constructor(e,t){this.renderer=e,this.modelProvider=t}renderTemplate(e){return{data:this.renderer.renderTemplate(e),disposable:A.None}}renderElement(e,t,i,n){if(i.disposable?.dispose(),!i.data)return;const s=this.modelProvider();if(s.isResolved(e))return this.renderer.renderElement(s.get(e),e,i.data,n);const r=new Xt,a=s.resolve(e,r.token);i.disposable={dispose:()=>r.cancel()},this.renderer.renderPlaceholder(e,i.data),a.then(l=>this.renderer.renderElement(l,e,i.data,n))}disposeTemplate(e){e.disposable&&(e.disposable.dispose(),e.disposable=void 0),e.data&&(this.renderer.disposeTemplate(e.data),e.data=void 0)}}class lSe{constructor(e,t){this.modelProvider=e,this.accessibilityProvider=t}getWidgetAriaLabel(){return this.accessibilityProvider.getWidgetAriaLabel()}getAriaLabel(e){const t=this.modelProvider();return t.isResolved(e)?this.accessibilityProvider.getAriaLabel(t.get(e)):null}}function cSe(o,e){return{...e,accessibilityProvider:e.accessibilityProvider&&new lSe(o,e.accessibilityProvider)}}class dSe{constructor(e,t,i,n,s={}){const r=()=>this.model,a=n.map(l=>new aSe(l,r));this.list=new jo(e,t,i,a,cSe(r,s))}updateOptions(e){this.list.updateOptions(e)}getHTMLElement(){return this.list.getHTMLElement()}get onDidFocus(){return this.list.onDidFocus}get widget(){return this.list}get onDidDispose(){return this.list.onDidDispose}get onMouseDblClick(){return ie.map(this.list.onMouseDblClick,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onPointer(){return ie.map(this.list.onPointer,({element:e,index:t,browserEvent:i})=>({element:e===void 0?void 0:this._model.get(e),index:t,browserEvent:i}))}get onDidChangeSelection(){return ie.map(this.list.onDidChangeSelection,({elements:e,indexes:t,browserEvent:i})=>({elements:e.map(n=>this._model.get(n)),indexes:t,browserEvent:i}))}get model(){return this._model}set model(e){this._model=e,this.list.splice(0,this.list.length,Bs(e.length))}getFocus(){return this.list.getFocus()}getSelection(){return this.list.getSelection()}getSelectedElements(){return this.getSelection().map(e=>this.model.get(e))}style(e){this.list.style(e)}dispose(){this.list.dispose()}}const hSe={separatorBorder:$.transparent};class nZ{set size(e){this._size=e}get size(){return this._size}get visible(){return typeof this._cachedVisibleSize>"u"}setVisible(e,t){if(e!==this.visible){e?(this.size=ks(this._cachedVisibleSize,this.viewMinimumSize,this.viewMaximumSize),this._cachedVisibleSize=void 0):(this._cachedVisibleSize=typeof t=="number"?t:this.size,this.size=0),this.container.classList.toggle("visible",e);try{this.view.setVisible?.(e)}catch(i){console.error("Splitview: Failed to set visible view"),console.error(i)}}}get minimumSize(){return this.visible?this.view.minimumSize:0}get viewMinimumSize(){return this.view.minimumSize}get maximumSize(){return this.visible?this.view.maximumSize:0}get viewMaximumSize(){return this.view.maximumSize}get priority(){return this.view.priority}get proportionalLayout(){return this.view.proportionalLayout??!0}get snap(){return!!this.view.snap}set enabled(e){this.container.style.pointerEvents=e?"":"none"}constructor(e,t,i,n){this.container=e,this.view=t,this.disposable=n,this._cachedVisibleSize=void 0,typeof i=="number"?(this._size=i,this._cachedVisibleSize=void 0,e.classList.add("visible")):(this._size=0,this._cachedVisibleSize=i.cachedVisibleSize)}layout(e,t){this.layoutContainer(e);try{this.view.layout(this.size,e,t)}catch(i){console.error("Splitview: Failed to layout view"),console.error(i)}}dispose(){this.disposable.dispose()}}class uSe extends nZ{layoutContainer(e){this.container.style.top=`${e}px`,this.container.style.height=`${this.size}px`}}class fSe extends nZ{layoutContainer(e){this.container.style.left=`${e}px`,this.container.style.width=`${this.size}px`}}var vd;(function(o){o[o.Idle=0]="Idle",o[o.Busy=1]="Busy"})(vd||(vd={}));var oI;(function(o){o.Distribute={type:"distribute"};function e(n){return{type:"split",index:n}}o.Split=e;function t(n){return{type:"auto",index:n}}o.Auto=t;function i(n){return{type:"invisible",cachedVisibleSize:n}}o.Invisible=i})(oI||(oI={}));class sZ extends A{get orthogonalStartSash(){return this._orthogonalStartSash}get orthogonalEndSash(){return this._orthogonalEndSash}get startSnappingEnabled(){return this._startSnappingEnabled}get endSnappingEnabled(){return this._endSnappingEnabled}set orthogonalStartSash(e){for(const t of this.sashItems)t.sash.orthogonalStartSash=e;this._orthogonalStartSash=e}set orthogonalEndSash(e){for(const t of this.sashItems)t.sash.orthogonalEndSash=e;this._orthogonalEndSash=e}set startSnappingEnabled(e){this._startSnappingEnabled!==e&&(this._startSnappingEnabled=e,this.updateSashEnablement())}set endSnappingEnabled(e){this._endSnappingEnabled!==e&&(this._endSnappingEnabled=e,this.updateSashEnablement())}constructor(e,t={}){super(),this.size=0,this._contentSize=0,this.proportions=void 0,this.viewItems=[],this.sashItems=[],this.state=vd.Idle,this._onDidSashChange=this._register(new P),this._onDidSashReset=this._register(new P),this._startSnappingEnabled=!0,this._endSnappingEnabled=!0,this.onDidSashChange=this._onDidSashChange.event,this.onDidSashReset=this._onDidSashReset.event,this.orientation=t.orientation??0,this.inverseAltBehavior=t.inverseAltBehavior??!1,this.proportionalLayout=t.proportionalLayout??!0,this.getSashOrthogonalSize=t.getSashOrthogonalSize,this.el=document.createElement("div"),this.el.classList.add("monaco-split-view2"),this.el.classList.add(this.orientation===0?"vertical":"horizontal"),e.appendChild(this.el),this.sashContainer=Z(this.el,Q(".sash-container")),this.viewContainer=Q(".split-view-container"),this.scrollable=this._register(new __({forceIntegerValues:!0,smoothScrollDuration:125,scheduleAtNextAnimationFrame:n=>Hs(me(this.el),n)})),this.scrollableElement=this._register(new VL(this.viewContainer,{vertical:this.orientation===0?t.scrollbarVisibility??1:2,horizontal:this.orientation===1?t.scrollbarVisibility??1:2},this.scrollable));const i=this._register(new gt(this.viewContainer,"scroll")).event;this._register(i(n=>{const s=this.scrollableElement.getScrollPosition(),r=Math.abs(this.viewContainer.scrollLeft-s.scrollLeft)<=1?void 0:this.viewContainer.scrollLeft,a=Math.abs(this.viewContainer.scrollTop-s.scrollTop)<=1?void 0:this.viewContainer.scrollTop;(r!==void 0||a!==void 0)&&this.scrollableElement.setScrollPosition({scrollLeft:r,scrollTop:a})})),this.onDidScroll=this.scrollableElement.onScroll,this._register(this.onDidScroll(n=>{n.scrollTopChanged&&(this.viewContainer.scrollTop=n.scrollTop),n.scrollLeftChanged&&(this.viewContainer.scrollLeft=n.scrollLeft)})),Z(this.el,this.scrollableElement.getDomNode()),this.style(t.styles||hSe),t.descriptor&&(this.size=t.descriptor.size,t.descriptor.views.forEach((n,s)=>{const r=Qn(n.visible)||n.visible?n.size:{type:"invisible",cachedVisibleSize:n.size},a=n.view;this.doAddView(a,r,s,!0)}),this._contentSize=this.viewItems.reduce((n,s)=>n+s.size,0),this.saveProportions())}style(e){e.separatorBorder.isTransparent()?(this.el.classList.remove("separator-border"),this.el.style.removeProperty("--separator-border")):(this.el.classList.add("separator-border"),this.el.style.setProperty("--separator-border",e.separatorBorder.toString()))}addView(e,t,i=this.viewItems.length,n){this.doAddView(e,t,i,n)}layout(e,t){const i=Math.max(this.size,this._contentSize);if(this.size=e,this.layoutContext=t,this.proportions){let n=0;for(let s=0;s<this.viewItems.length;s++){const r=this.viewItems[s],a=this.proportions[s];typeof a=="number"?n+=a:e-=r.size}for(let s=0;s<this.viewItems.length;s++){const r=this.viewItems[s],a=this.proportions[s];typeof a=="number"&&n>0&&(r.size=ks(Math.round(a*e/n),r.minimumSize,r.maximumSize))}}else{const n=Bs(this.viewItems.length),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);this.resize(this.viewItems.length-1,e-i,void 0,s,r)}this.distributeEmptySpace(),this.layoutViews()}saveProportions(){this.proportionalLayout&&this._contentSize>0&&(this.proportions=this.viewItems.map(e=>e.proportionalLayout&&e.visible?e.size/this._contentSize:void 0))}onSashStart({sash:e,start:t,alt:i}){for(const a of this.viewItems)a.enabled=!1;const n=this.sashItems.findIndex(a=>a.sash===e),s=jr(W(this.el.ownerDocument.body,"keydown",a=>r(this.sashDragState.current,a.altKey)),W(this.el.ownerDocument.body,"keyup",()=>r(this.sashDragState.current,!1))),r=(a,l)=>{const c=this.viewItems.map(g=>g.size);let d=Number.NEGATIVE_INFINITY,h=Number.POSITIVE_INFINITY;if(this.inverseAltBehavior&&(l=!l),l)if(n===this.sashItems.length-1){const m=this.viewItems[n];d=(m.minimumSize-m.size)/2,h=(m.maximumSize-m.size)/2}else{const m=this.viewItems[n+1];d=(m.size-m.maximumSize)/2,h=(m.size-m.minimumSize)/2}let u,f;if(!l){const g=Bs(n,-1),m=Bs(n+1,this.viewItems.length),_=g.reduce((I,D)=>I+(this.viewItems[D].minimumSize-c[D]),0),b=g.reduce((I,D)=>I+(this.viewItems[D].viewMaximumSize-c[D]),0),C=m.length===0?Number.POSITIVE_INFINITY:m.reduce((I,D)=>I+(c[D]-this.viewItems[D].minimumSize),0),w=m.length===0?Number.NEGATIVE_INFINITY:m.reduce((I,D)=>I+(c[D]-this.viewItems[D].viewMaximumSize),0),v=Math.max(_,w),S=Math.min(C,b),L=this.findFirstSnapIndex(g),x=this.findFirstSnapIndex(m);if(typeof L=="number"){const I=this.viewItems[L],D=Math.floor(I.viewMinimumSize/2);u={index:L,limitDelta:I.visible?v-D:v+D,size:I.size}}if(typeof x=="number"){const I=this.viewItems[x],D=Math.floor(I.viewMinimumSize/2);f={index:x,limitDelta:I.visible?S+D:S-D,size:I.size}}}this.sashDragState={start:a,current:a,index:n,sizes:c,minDelta:d,maxDelta:h,alt:l,snapBefore:u,snapAfter:f,disposable:s}};r(t,i)}onSashChange({current:e}){const{index:t,start:i,sizes:n,alt:s,minDelta:r,maxDelta:a,snapBefore:l,snapAfter:c}=this.sashDragState;this.sashDragState.current=e;const d=e-i,h=this.resize(t,d,n,void 0,void 0,r,a,l,c);if(s){const u=t===this.sashItems.length-1,f=this.viewItems.map(w=>w.size),g=u?t:t+1,m=this.viewItems[g],_=m.size-m.maximumSize,b=m.size-m.minimumSize,C=u?t-1:t+1;this.resize(C,-h,f,void 0,void 0,_,b)}this.distributeEmptySpace(),this.layoutViews()}onSashEnd(e){this._onDidSashChange.fire(e),this.sashDragState.disposable.dispose(),this.saveProportions();for(const t of this.viewItems)t.enabled=!0}onViewChange(e,t){const i=this.viewItems.indexOf(e);i<0||i>=this.viewItems.length||(t=typeof t=="number"?t:e.size,t=ks(t,e.minimumSize,e.maximumSize),this.inverseAltBehavior&&i>0?(this.resize(i-1,Math.floor((e.size-t)/2)),this.distributeEmptySpace(),this.layoutViews()):(e.size=t,this.relayout([i],void 0)))}resizeView(e,t){if(!(e<0||e>=this.viewItems.length)){if(this.state!==vd.Idle)throw new Error("Cant modify splitview");this.state=vd.Busy;try{const i=Bs(this.viewItems.length).filter(a=>a!==e),n=[...i.filter(a=>this.viewItems[a].priority===1),e],s=i.filter(a=>this.viewItems[a].priority===2),r=this.viewItems[e];t=Math.round(t),t=ks(t,r.minimumSize,Math.min(r.maximumSize,this.size)),r.size=t,this.relayout(n,s)}finally{this.state=vd.Idle}}}distributeViewSizes(){const e=[];let t=0;for(const a of this.viewItems)a.maximumSize-a.minimumSize>0&&(e.push(a),t+=a.size);const i=Math.floor(t/e.length);for(const a of e)a.size=ks(i,a.minimumSize,a.maximumSize);const n=Bs(this.viewItems.length),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);this.relayout(s,r)}getViewSize(e){return e<0||e>=this.viewItems.length?-1:this.viewItems[e].size}doAddView(e,t,i=this.viewItems.length,n){if(this.state!==vd.Idle)throw new Error("Cant modify splitview");this.state=vd.Busy;try{const s=Q(".split-view-view");i===this.viewItems.length?this.viewContainer.appendChild(s):this.viewContainer.insertBefore(s,this.viewContainer.children.item(i));const r=e.onDidChange(u=>this.onViewChange(d,u)),a=ue(()=>s.remove()),l=jr(r,a);let c;typeof t=="number"?c=t:(t.type==="auto"&&(this.areViewsDistributed()?t={type:"distribute"}:t={type:"split",index:t.index}),t.type==="split"?c=this.getViewSize(t.index)/2:t.type==="invisible"?c={cachedVisibleSize:t.cachedVisibleSize}:c=e.minimumSize);const d=this.orientation===0?new uSe(s,e,c,l):new fSe(s,e,c,l);if(this.viewItems.splice(i,0,d),this.viewItems.length>1){const u={orthogonalStartSash:this.orthogonalStartSash,orthogonalEndSash:this.orthogonalEndSash},f=this.orientation===0?new Gn(this.sashContainer,{getHorizontalSashTop:I=>this.getSashPosition(I),getHorizontalSashWidth:this.getSashOrthogonalSize},{...u,orientation:1}):new Gn(this.sashContainer,{getVerticalSashLeft:I=>this.getSashPosition(I),getVerticalSashHeight:this.getSashOrthogonalSize},{...u,orientation:0}),g=this.orientation===0?I=>({sash:f,start:I.startY,current:I.currentY,alt:I.altKey}):I=>({sash:f,start:I.startX,current:I.currentX,alt:I.altKey}),_=ie.map(f.onDidStart,g)(this.onSashStart,this),C=ie.map(f.onDidChange,g)(this.onSashChange,this),v=ie.map(f.onDidEnd,()=>this.sashItems.findIndex(I=>I.sash===f))(this.onSashEnd,this),S=f.onDidReset(()=>{const I=this.sashItems.findIndex(B=>B.sash===f),D=Bs(I,-1),R=Bs(I+1,this.viewItems.length),F=this.findFirstSnapIndex(D),O=this.findFirstSnapIndex(R);typeof F=="number"&&!this.viewItems[F].visible||typeof O=="number"&&!this.viewItems[O].visible||this._onDidSashReset.fire(I)}),L=jr(_,C,v,S,f),x={sash:f,disposable:L};this.sashItems.splice(i-1,0,x)}s.appendChild(e.element);let h;typeof t!="number"&&t.type==="split"&&(h=[t.index]),n||this.relayout([i],h),!n&&typeof t!="number"&&t.type==="distribute"&&this.distributeViewSizes()}finally{this.state=vd.Idle}}relayout(e,t){const i=this.viewItems.reduce((n,s)=>n+s.size,0);this.resize(this.viewItems.length-1,this.size-i,void 0,e,t),this.distributeEmptySpace(),this.layoutViews(),this.saveProportions()}resize(e,t,i=this.viewItems.map(d=>d.size),n,s,r=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY,l,c){if(e<0||e>=this.viewItems.length)return 0;const d=Bs(e,-1),h=Bs(e+1,this.viewItems.length);if(s)for(const x of s)HR(d,x),HR(h,x);if(n)for(const x of n)_y(d,x),_y(h,x);const u=d.map(x=>this.viewItems[x]),f=d.map(x=>i[x]),g=h.map(x=>this.viewItems[x]),m=h.map(x=>i[x]),_=d.reduce((x,I)=>x+(this.viewItems[I].minimumSize-i[I]),0),b=d.reduce((x,I)=>x+(this.viewItems[I].maximumSize-i[I]),0),C=h.length===0?Number.POSITIVE_INFINITY:h.reduce((x,I)=>x+(i[I]-this.viewItems[I].minimumSize),0),w=h.length===0?Number.NEGATIVE_INFINITY:h.reduce((x,I)=>x+(i[I]-this.viewItems[I].maximumSize),0),v=Math.max(_,w,r),S=Math.min(C,b,a);let L=!1;if(l){const x=this.viewItems[l.index],I=t>=l.limitDelta;L=I!==x.visible,x.setVisible(I,l.size)}if(!L&&c){const x=this.viewItems[c.index],I=t<c.limitDelta;L=I!==x.visible,x.setVisible(I,c.size)}if(L)return this.resize(e,t,i,n,s,r,a);t=ks(t,v,S);for(let x=0,I=t;x<u.length;x++){const D=u[x],R=ks(f[x]+I,D.minimumSize,D.maximumSize),F=R-f[x];I-=F,D.size=R}for(let x=0,I=t;x<g.length;x++){const D=g[x],R=ks(m[x]-I,D.minimumSize,D.maximumSize),F=R-m[x];I+=F,D.size=R}return t}distributeEmptySpace(e){const t=this.viewItems.reduce((a,l)=>a+l.size,0);let i=this.size-t;const n=Bs(this.viewItems.length-1,-1),s=n.filter(a=>this.viewItems[a].priority===1),r=n.filter(a=>this.viewItems[a].priority===2);for(const a of r)HR(n,a);for(const a of s)_y(n,a);typeof e=="number"&&_y(n,e);for(let a=0;i!==0&&a<n.length;a++){const l=this.viewItems[n[a]],c=ks(l.size+i,l.minimumSize,l.maximumSize),d=c-l.size;i-=d,l.size=c}}layoutViews(){this._contentSize=this.viewItems.reduce((t,i)=>t+i.size,0);let e=0;for(const t of this.viewItems)t.layout(e,this.layoutContext),e+=t.size;this.sashItems.forEach(t=>t.sash.layout()),this.updateSashEnablement(),this.updateScrollableElement()}updateScrollableElement(){this.orientation===0?this.scrollableElement.setScrollDimensions({height:this.size,scrollHeight:this._contentSize}):this.scrollableElement.setScrollDimensions({width:this.size,scrollWidth:this._contentSize})}updateSashEnablement(){let e=!1;const t=this.viewItems.map(l=>e=l.size-l.minimumSize>0||e);e=!1;const i=this.viewItems.map(l=>e=l.maximumSize-l.size>0||e),n=[...this.viewItems].reverse();e=!1;const s=n.map(l=>e=l.size-l.minimumSize>0||e).reverse();e=!1;const r=n.map(l=>e=l.maximumSize-l.size>0||e).reverse();let a=0;for(let l=0;l<this.sashItems.length;l++){const{sash:c}=this.sashItems[l],d=this.viewItems[l];a+=d.size;const h=!(t[l]&&r[l+1]),u=!(i[l]&&s[l+1]);if(h&&u){const f=Bs(l,-1),g=Bs(l+1,this.viewItems.length),m=this.findFirstSnapIndex(f),_=this.findFirstSnapIndex(g),b=typeof m=="number"&&!this.viewItems[m].visible,C=typeof _=="number"&&!this.viewItems[_].visible;b&&s[l]&&(a>0||this.startSnappingEnabled)?c.state=1:C&&t[l]&&(a<this._contentSize||this.endSnappingEnabled)?c.state=2:c.state=0}else h&&!u?c.state=1:!h&&u?c.state=2:c.state=3}}getSashPosition(e){let t=0;for(let i=0;i<this.sashItems.length;i++)if(t+=this.viewItems[i].size,this.sashItems[i].sash===e)return t;return 0}findFirstSnapIndex(e){for(const t of e){const i=this.viewItems[t];if(i.visible&&i.snap)return t}for(const t of e){const i=this.viewItems[t];if(i.visible&&i.maximumSize-i.minimumSize>0)return;if(!i.visible&&i.snap)return t}}areViewsDistributed(){let e,t;for(const i of this.viewItems)if(e=e===void 0?i.size:Math.min(e,i.size),t=t===void 0?i.size:Math.max(t,i.size),t-e>2)return!1;return!0}dispose(){this.sashDragState?.disposable.dispose(),pt(this.viewItems),this.viewItems=[],this.sashItems.forEach(e=>e.disposable.dispose()),this.sashItems=[],super.dispose()}}const MN=class MN{constructor(e,t,i){this.columns=e,this.getColumnSize=i,this.templateId=MN.TemplateId,this.renderedTemplates=new Set;const n=new Map(t.map(s=>[s.templateId,s]));this.renderers=[];for(const s of e){const r=n.get(s.templateId);if(!r)throw new Error(`Table cell renderer for template id ${s.templateId} not found.`);this.renderers.push(r)}}renderTemplate(e){const t=Z(e,Q(".monaco-table-tr")),i=[],n=[];for(let r=0;r<this.columns.length;r++){const a=this.renderers[r],l=Z(t,Q(".monaco-table-td",{"data-col-index":r}));l.style.width=`${this.getColumnSize(r)}px`,i.push(l),n.push(a.renderTemplate(l))}const s={container:e,cellContainers:i,cellTemplateData:n};return this.renderedTemplates.add(s),s}renderElement(e,t,i,n){for(let s=0;s<this.columns.length;s++){const a=this.columns[s].project(e);this.renderers[s].renderElement(a,t,i.cellTemplateData[s],n)}}disposeElement(e,t,i,n){for(let s=0;s<this.columns.length;s++){const r=this.renderers[s];if(r.disposeElement){const l=this.columns[s].project(e);r.disposeElement(l,t,i.cellTemplateData[s],n)}}}disposeTemplate(e){for(let t=0;t<this.columns.length;t++)this.renderers[t].disposeTemplate(e.cellTemplateData[t]);pn(e.container),this.renderedTemplates.delete(e)}layoutColumn(e,t){for(const{cellContainers:i}of this.renderedTemplates)i[e].style.width=`${t}px`}};MN.TemplateId="row";let rI=MN;function gSe(o){return{getHeight(e){return o.getHeight(e)},getTemplateId(){return rI.TemplateId}}}class pSe extends A{get minimumSize(){return this.column.minimumWidth??120}get maximumSize(){return this.column.maximumWidth??Number.POSITIVE_INFINITY}get onDidChange(){return this.column.onDidChangeWidthConstraints??ie.None}constructor(e,t){super(),this.column=e,this.index=t,this._onDidLayout=new P,this.onDidLayout=this._onDidLayout.event,this.element=Q(".monaco-table-th",{"data-col-index":t},e.label),e.tooltip&&this._register(ta().setupManagedHover(Zs("mouse"),this.element,e.tooltip))}layout(e){this._onDidLayout.fire([this.index,e])}}const PN=class PN{get onDidChangeFocus(){return this.list.onDidChangeFocus}get onDidChangeSelection(){return this.list.onDidChangeSelection}get onDidScroll(){return this.list.onDidScroll}get onMouseDblClick(){return this.list.onMouseDblClick}get onPointer(){return this.list.onPointer}get onDidFocus(){return this.list.onDidFocus}get scrollTop(){return this.list.scrollTop}set scrollTop(e){this.list.scrollTop=e}get scrollHeight(){return this.list.scrollHeight}get renderHeight(){return this.list.renderHeight}get onDidDispose(){return this.list.onDidDispose}constructor(e,t,i,n,s,r){this.virtualDelegate=i,this.columns=n,this.domId=`table_id_${++PN.InstanceCount}`,this.disposables=new U,this.cachedWidth=0,this.cachedHeight=0,this.domNode=Z(t,Q(`.monaco-table.${this.domId}`));const a=n.map((d,h)=>this.disposables.add(new pSe(d,h))),l={size:a.reduce((d,h)=>d+h.column.weight,0),views:a.map(d=>({size:d.column.weight,view:d}))};this.splitview=this.disposables.add(new sZ(this.domNode,{orientation:1,scrollbarVisibility:2,getSashOrthogonalSize:()=>this.cachedHeight,descriptor:l})),this.splitview.el.style.height=`${i.headerRowHeight}px`,this.splitview.el.style.lineHeight=`${i.headerRowHeight}px`;const c=new rI(n,s,d=>this.splitview.getViewSize(d));this.list=this.disposables.add(new jo(e,this.domNode,gSe(i),[c],r)),ie.any(...a.map(d=>d.onDidLayout))(([d,h])=>c.layoutColumn(d,h),null,this.disposables),this.splitview.onDidSashReset(d=>{const h=n.reduce((f,g)=>f+g.weight,0),u=n[d].weight/h*this.cachedWidth;this.splitview.resizeView(d,u)},null,this.disposables),this.styleElement=Ir(this.domNode),this.style(iCe)}updateOptions(e){this.list.updateOptions(e)}splice(e,t,i=[]){this.list.splice(e,t,i)}getHTMLElement(){return this.domNode}style(e){const t=[];t.push(`.monaco-table.${this.domId} > .monaco-split-view2 .monaco-sash.vertical::before {
top: ${this.virtualDelegate.headerRowHeight+1}px;
height: calc(100% - ${this.virtualDelegate.headerRowHeight}px);
}`),this.styleElement.textContent=t.join(`
`),this.list.style(e)}getSelectedElements(){return this.list.getSelectedElements()}getSelection(){return this.list.getSelection()}getFocus(){return this.list.getFocus()}dispose(){this.disposables.dispose()}};PN.InstanceCount=0;let Z4=PN;const oZ={inputActiveOptionBorder:"#007ACC00",inputActiveOptionForeground:"#FFFFFF",inputActiveOptionBackground:"#0E639C50"};class Gh extends go{get onChange(){return this._onChange.event}get onKeyDown(){return this._onKeyDown.event}constructor(e){super(),this._onChange=this._register(new P),this._onKeyDown=this._register(new P),this._opts=e,this._checked=this._opts.isChecked;const t=["monaco-custom-toggle"];this._opts.icon&&(this._icon=this._opts.icon,t.push(...ve.asClassNameArray(this._icon))),this._opts.actionClassName&&t.push(...this._opts.actionClassName.split(" ")),this._checked&&t.push("checked"),this.domNode=document.createElement("div"),this._hover=this._register(ta().setupManagedHover(e.hoverDelegate??Zs("mouse"),this.domNode,this._opts.title)),this.domNode.classList.add(...t),this._opts.notFocusable||(this.domNode.tabIndex=0),this.domNode.setAttribute("role","checkbox"),this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.setAttribute("aria-label",this._opts.title),this.applyStyles(),this.onclick(this.domNode,i=>{this.enabled&&(this.checked=!this._checked,this._onChange.fire(!1),i.preventDefault())}),this._register(this.ignoreGesture(this.domNode)),this.onkeydown(this.domNode,i=>{if(this.enabled){if(i.keyCode===10||i.keyCode===3){this.checked=!this._checked,this._onChange.fire(!0),i.preventDefault(),i.stopPropagation();return}this._onKeyDown.fire(i)}})}get enabled(){return this.domNode.getAttribute("aria-disabled")!=="true"}focus(){this.domNode.focus()}get checked(){return this._checked}set checked(e){this._checked=e,this.domNode.setAttribute("aria-checked",String(this._checked)),this.domNode.classList.toggle("checked",this._checked),this.applyStyles()}setIcon(e){this._icon&&this.domNode.classList.remove(...ve.asClassNameArray(this._icon)),this._icon=e,this._icon&&this.domNode.classList.add(...ve.asClassNameArray(this._icon))}width(){return 22}applyStyles(){this.domNode&&(this.domNode.style.borderColor=this._checked&&this._opts.inputActiveOptionBorder||"",this.domNode.style.color=this._checked&&this._opts.inputActiveOptionForeground||"inherit",this.domNode.style.backgroundColor=this._checked&&this._opts.inputActiveOptionBackground||"")}enable(){this.domNode.setAttribute("aria-disabled",String(!1)),this.domNode.classList.remove("disabled")}disable(){this.domNode.setAttribute("aria-disabled",String(!0)),this.domNode.classList.add("disabled")}setTitle(e){this._hover.update(e),this.domNode.setAttribute("aria-label",e)}}const cB=class cB extends go{constructor(e,t,i){super(),this.checkbox=e,this.domNode=t,this.styles=i,this._onChange=this._register(new P),this.onChange=this._onChange.event,this.applyStyles()}get enabled(){return this.checkbox.enabled}enable(){this.checkbox.enable(),this.applyStyles(!0)}disable(){this.checkbox.disable(),this.applyStyles(!1)}setTitle(e){this.checkbox.setTitle(e)}applyStyles(e=this.enabled){this.domNode.style.color=(e?this.styles.checkboxForeground:this.styles.checkboxDisabledForeground)||"",this.domNode.style.backgroundColor=(e?this.styles.checkboxBackground:this.styles.checkboxDisabledBackground)||"",this.domNode.style.borderColor=(e?this.styles.checkboxBorder:this.styles.checkboxDisabledBackground)||"";const t=this.styles.size||18;this.domNode.style.width=this.domNode.style.height=this.domNode.style.fontSize=`${t}px`,this.domNode.style.fontSize=`${t-2}px`}};cB.CLASS_NAME="monaco-checkbox";let Hw=cB;class rZ extends Hw{constructor(e,t,i){const n=new Gh({title:e,isChecked:t,icon:Y.check,actionClassName:Hw.CLASS_NAME,hoverDelegate:i.hoverDelegate,...oZ});super(n,n.domNode,i),this._register(n),this._register(this.checkbox.onChange(s=>{this.applyStyles(),this._onChange.fire(s)}))}get checked(){return this.checkbox.checked}set checked(e){this.checkbox.checked=e,this.applyStyles()}applyStyles(e){this.checkbox.checked?this.checkbox.setIcon(Y.check):this.checkbox.setIcon(void 0),super.applyStyles(e)}}class aZ extends Hw{constructor(e,t,i){let n;switch(t){case!0:n=Y.check;break;case"partial":n=Y.dash;break;case!1:n=void 0;break}const s=new Gh({title:e,isChecked:t===!0,icon:n,actionClassName:rZ.CLASS_NAME,hoverDelegate:i.hoverDelegate,...oZ});super(s,s.domNode,i),this._state=t,this._register(s),this._register(this.checkbox.onChange(r=>{this._state=this.checkbox.checked,this.applyStyles(),this._onChange.fire(r)}))}get checked(){return this._state}set checked(e){this._state!==e&&(this._state=e,this.checkbox.checked=e===!0,this.applyStyles())}applyStyles(e){switch(this._state){case!0:this.checkbox.setIcon(Y.check);break;case"partial":this.checkbox.setIcon(Y.dash);break;case!1:this.checkbox.setIcon(void 0);break}super.applyStyles(e)}}const mSe=p(2,"Match Case"),_Se=p(3,"Match Whole Word"),bSe=p(4,"Use Regular Expression");class lZ extends Gh{constructor(e){super({icon:Y.caseSensitive,title:mSe+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Zs("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class cZ extends Gh{constructor(e){super({icon:Y.wholeWord,title:_Se+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Zs("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class dZ extends Gh{constructor(e){super({icon:Y.regex,title:bSe+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Zs("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}function CSe(o,e,t){const i=t??document.createElement("div");return i.textContent=o,i}function vSe(o,e,t){const i=t??document.createElement("div");return i.textContent="",hZ(i,SSe(o),e?.actionHandler,e?.renderCodeSegments),i}class wSe{constructor(e){this.source=e,this.index=0}eos(){return this.index>=this.source.length}next(){const e=this.peek();return this.advance(),e}peek(){return this.source[this.index]}advance(){this.index++}}function hZ(o,e,t,i){let n;if(e.type===2)n=document.createTextNode(e.content||"");else if(e.type===3)n=document.createElement("b");else if(e.type===4)n=document.createElement("i");else if(e.type===7&&i)n=document.createElement("code");else if(e.type===5&&t){const s=document.createElement("a");t.disposables.add(Si(s,"click",r=>{t.callback(String(e.index),r)})),n=s}else e.type===8?n=document.createElement("br"):e.type===1&&(n=o);n&&o!==n&&o.appendChild(n),n&&Array.isArray(e.children)&&e.children.forEach(s=>{hZ(n,s,t,i)})}function SSe(o,e){const t={type:1,children:[]};let i=0,n=t;const s=[],r=new wSe(o);for(;!r.eos();){let a=r.next();const l=a==="\\"&&Y4(r.peek())!==0;if(l&&(a=r.next()),!l&&ySe(a)&&a===r.peek()){r.advance(),n.type===2&&(n=s.pop());const c=Y4(a);if(n.type===c||n.type===5&&c===6)n=s.pop();else{const d={type:c,children:[]};c===5&&(d.index=i,i++),n.children.push(d),s.push(n),n=d}}else if(a===`
`)n.type===2&&(n=s.pop()),n.children.push({type:8});else if(n.type!==2){const c={type:2,content:a};n.children.push(c),s.push(n),n=c}else n.content+=a}return n.type===2&&(n=s.pop()),t}function ySe(o,e){return Y4(o)!==0}function Y4(o,e){switch(o){case"*":return 3;case"_":return 4;case"[":return 5;case"]":return 6;case"`":return 0;default:return 0}}class LSe{constructor(e,t=0,i=e.length,n=t-1){this.items=e,this.start=t,this.end=i,this.index=n}current(){return this.index===this.start-1||this.index===this.end?null:this.items[this.index]}next(){return this.index=Math.min(this.index+1,this.end),this.current()}previous(){return this.index=Math.max(this.index-1,this.start-1),this.current()}first(){return this.index=this.start,this.current()}last(){return this.index=this.end-1,this.current()}}class xSe{constructor(e=new Set,t=10){this._history=e,this._limit=t,this._onChange(),this._history.onDidChange&&(this._disposable=this._history.onDidChange(()=>this._onChange()))}getHistory(){return this._elements}add(e){this._history.delete(e),this._history.add(e),this._onChange()}next(){return this._navigator.next()}previous(){return this._currentPosition()!==0?this._navigator.previous():null}current(){return this._navigator.current()}first(){return this._navigator.first()}last(){return this._navigator.last()}isLast(){return this._currentPosition()>=this._elements.length-1}isNowhere(){return this._navigator.current()===null}has(e){return this._history.has(e)}_onChange(){this._reduceToLimit();const e=this._elements;this._navigator=new LSe(e,0,e.length,e.length)}_reduceToLimit(){const e=this._elements;if(e.length>this._limit){const t=e.slice(e.length-this._limit);this._history.replace?this._history.replace(t):this._history=new Set(t)}}_currentPosition(){const e=this._navigator.current();return e?this._elements.indexOf(e):-1}get _elements(){const e=[];return this._history.forEach(t=>e.push(t)),e}dispose(){this._disposable&&(this._disposable.dispose(),this._disposable=void 0)}}const ub=Q;let kSe=class extends go{get onDidChange(){return this._onDidChange.event}get onDidHeightChange(){return this._onDidHeightChange.event}constructor(e,t,i){super(),this.state="idle",this.maxHeight=Number.POSITIVE_INFINITY,this.hover=this._register(new ct),this._onDidChange=this._register(new P),this._onDidHeightChange=this._register(new P),this.contextViewProvider=t,this.options=i,this.message=null,this.placeholder=this.options.placeholder||"",this.tooltip=this.options.tooltip??(this.placeholder||""),this.ariaLabel=this.options.ariaLabel||"",this.options.validationOptions&&(this.validation=this.options.validationOptions.validation),this.element=Z(e,ub(".monaco-inputbox.idle"));const n=this.options.flexibleHeight?"textarea":"input",s=Z(this.element,ub(".ibwrapper"));if(this.input=Z(s,ub(n+".input.empty")),this.input.setAttribute("autocorrect","off"),this.input.setAttribute("autocapitalize","off"),this.input.setAttribute("spellcheck","false"),this.onfocus(this.input,()=>this.element.classList.add("synthetic-focus")),this.onblur(this.input,()=>this.element.classList.remove("synthetic-focus")),this.options.flexibleHeight){this.maxHeight=typeof this.options.flexibleMaxHeight=="number"?this.options.flexibleMaxHeight:Number.POSITIVE_INFINITY,this.mirror=Z(s,ub("div.mirror")),this.mirror.innerText=" ",this.scrollableElement=new vz(this.element,{vertical:1}),this.options.flexibleWidth&&(this.input.setAttribute("wrap","off"),this.mirror.style.whiteSpace="pre",this.mirror.style.wordWrap="initial"),Z(e,this.scrollableElement.getDomNode()),this._register(this.scrollableElement),this._register(this.scrollableElement.onScroll(l=>this.input.scrollTop=l.scrollTop));const r=this._register(new gt(e.ownerDocument,"selectionchange")),a=ie.filter(r.event,()=>e.ownerDocument.getSelection()?.anchorNode===s);this._register(a(this.updateScrollDimensions,this)),this._register(this.onDidHeightChange(this.updateScrollDimensions,this))}else this.input.type=this.options.type||"text",this.input.setAttribute("wrap","off");this.ariaLabel&&this.input.setAttribute("aria-label",this.ariaLabel),this.placeholder&&!this.options.showPlaceholderOnFocus&&this.setPlaceHolder(this.placeholder),this.tooltip&&this.setTooltip(this.tooltip),this.oninput(this.input,()=>this.onValueChange()),this.onblur(this.input,()=>this.onBlur()),this.onfocus(this.input,()=>this.onFocus()),this._register(this.ignoreGesture(this.input)),setTimeout(()=>this.updateMirror(),0),this.options.actions&&(this.actionbar=this._register(new Ys(this.element)),this.actionbar.push(this.options.actions,{icon:!0,label:!1})),this.applyStyles()}onBlur(){this._hideMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder","")}onFocus(){this._showMessage(),this.options.showPlaceholderOnFocus&&this.input.setAttribute("placeholder",this.placeholder||"")}setPlaceHolder(e){this.placeholder=e,this.input.setAttribute("placeholder",e)}setTooltip(e){this.tooltip=e,this.hover.value||(this.hover.value=this._register(ta().setupDelayedHoverAtMouse(this.input,()=>({content:this.tooltip,appearance:{compact:!0}}))))}get inputElement(){return this.input}get value(){return this.input.value}set value(e){this.input.value!==e&&(this.input.value=e,this.onValueChange())}get height(){return typeof this.cachedHeight=="number"?this.cachedHeight:Rc(this.element)}focus(){this.input.focus()}blur(){this.input.blur()}hasFocus(){return Iy(this.input)}select(e=null){this.input.select(),e&&(this.input.setSelectionRange(e.start,e.end),e.end===this.input.value.length&&(this.input.scrollLeft=this.input.scrollWidth))}isSelectionAtEnd(){return this.input.selectionEnd===this.input.value.length&&this.input.selectionStart===this.input.selectionEnd}getSelection(){const e=this.input.selectionStart;if(e===null)return null;const t=this.input.selectionEnd??e;return{start:e,end:t}}enable(){this.input.removeAttribute("disabled")}disable(){this.blur(),this.input.disabled=!0,this._hideMessage()}set paddingRight(e){this.input.style.width=`calc(100% - ${e}px)`,this.mirror&&(this.mirror.style.paddingRight=e+"px")}updateScrollDimensions(){if(typeof this.cachedContentHeight!="number"||typeof this.cachedHeight!="number"||!this.scrollableElement)return;const e=this.cachedContentHeight,t=this.cachedHeight,i=this.input.scrollTop;this.scrollableElement.setScrollDimensions({scrollHeight:e,height:t}),this.scrollableElement.setScrollPosition({scrollTop:i})}showMessage(e,t){if(this.state==="open"&&fo(this.message,e))return;this.message=e,this.element.classList.remove("idle"),this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add(this.classForType(e.type));const i=this.stylesForType(this.message.type);this.element.style.border=`1px solid ${od(i.border,"transparent")}`,this.message.content&&(this.hasFocus()||t)&&this._showMessage()}hideMessage(){this.message=null,this.element.classList.remove("info"),this.element.classList.remove("warning"),this.element.classList.remove("error"),this.element.classList.add("idle"),this._hideMessage(),this.applyStyles()}validate(){let e=null;return this.validation&&(e=this.validation(this.value),e?(this.inputElement.setAttribute("aria-invalid","true"),this.showMessage(e)):this.inputElement.hasAttribute("aria-invalid")&&(this.inputElement.removeAttribute("aria-invalid"),this.hideMessage())),e?.type}stylesForType(e){const t=this.options.inputBoxStyles;switch(e){case 1:return{border:t.inputValidationInfoBorder,background:t.inputValidationInfoBackground,foreground:t.inputValidationInfoForeground};case 2:return{border:t.inputValidationWarningBorder,background:t.inputValidationWarningBackground,foreground:t.inputValidationWarningForeground};default:return{border:t.inputValidationErrorBorder,background:t.inputValidationErrorBackground,foreground:t.inputValidationErrorForeground}}}classForType(e){switch(e){case 1:return"info";case 2:return"warning";default:return"error"}}_showMessage(){if(!this.contextViewProvider||!this.message)return;let e;const t=()=>e.style.width=ho(this.element)+"px";this.contextViewProvider.showContextView({getAnchor:()=>this.element,anchorAlignment:1,render:n=>{if(!this.message)return null;e=Z(n,ub(".monaco-inputbox-container")),t();const s=ub("span.monaco-inputbox-message");this.message.formatContent?vSe(this.message.content,void 0,s):CSe(this.message.content,void 0,s),s.classList.add(this.classForType(this.message.type));const r=this.stylesForType(this.message.type);return s.style.backgroundColor=r.background??"",s.style.color=r.foreground??"",s.style.border=r.border?`1px solid ${r.border}`:"",Z(e,s),null},onHide:()=>{this.state="closed"},layout:t});let i;this.message.type===3?i=p(9,"Error: {0}",this.message.content):this.message.type===2?i=p(10,"Warning: {0}",this.message.content):i=p(11,"Info: {0}",this.message.content),ps(i),this.state="open"}_hideMessage(){this.contextViewProvider&&(this.state==="open"&&this.contextViewProvider.hideContextView(),this.state="idle")}onValueChange(){this._onDidChange.fire(this.value),this.validate(),this.updateMirror(),this.input.classList.toggle("empty",!this.value),this.state==="open"&&this.contextViewProvider&&this.contextViewProvider.layout()}updateMirror(){if(!this.mirror)return;const e=this.value,i=e.charCodeAt(e.length-1)===10?" ":"";(e+i).replace(/\u000c/g,"")?this.mirror.textContent=e+i:this.mirror.innerText=" ",this.layout()}applyStyles(){const e=this.options.inputBoxStyles,t=e.inputBackground??"",i=e.inputForeground??"",n=e.inputBorder??"";this.element.style.backgroundColor=t,this.element.style.color=i,this.input.style.backgroundColor="inherit",this.input.style.color=i,this.element.style.border=`1px solid ${od(n,"transparent")}`}layout(){if(!this.mirror)return;const e=this.cachedContentHeight;this.cachedContentHeight=Rc(this.mirror),e!==this.cachedContentHeight&&(this.cachedHeight=Math.min(this.cachedContentHeight,this.maxHeight),this.input.style.height=this.cachedHeight+"px",this._onDidHeightChange.fire(this.cachedContentHeight))}insertAtCursor(e){const t=this.inputElement,i=t.selectionStart,n=t.selectionEnd,s=t.value;i!==null&&n!==null&&(this.value=s.substr(0,i)+e+s.substr(n),t.setSelectionRange(i+1,i+1),this.layout())}dispose(){this._hideMessage(),this.message=null,this.actionbar?.dispose(),super.dispose()}};class uZ extends kSe{constructor(e,t,i){const n=p(12," or {0} for history","⇅"),s=p(13," ({0} for history)","⇅");super(e,t,i),this._onDidFocus=this._register(new P),this.onDidFocus=this._onDidFocus.event,this._onDidBlur=this._register(new P),this.onDidBlur=this._onDidBlur.event,this.history=this._register(new xSe(i.history,100));const r=()=>{if(i.showHistoryHint&&i.showHistoryHint()&&!this.placeholder.endsWith(n)&&!this.placeholder.endsWith(s)&&this.history.getHistory().length){const a=this.placeholder.endsWith(")")?n:s,l=this.placeholder+a;i.showPlaceholderOnFocus&&!Iy(this.input)?this.placeholder=l:this.setPlaceHolder(l)}};this.observer=new MutationObserver((a,l)=>{a.forEach(c=>{c.target.textContent||r()})}),this.observer.observe(this.input,{attributeFilter:["class"]}),this.onfocus(this.input,()=>r()),this.onblur(this.input,()=>{const a=l=>{if(this.placeholder.endsWith(l)){const c=this.placeholder.slice(0,this.placeholder.length-l.length);return i.showPlaceholderOnFocus?this.placeholder=c:this.setPlaceHolder(c),!0}else return!1};a(s)||a(n)})}dispose(){super.dispose(),this.observer&&(this.observer.disconnect(),this.observer=void 0)}addToHistory(e){this.value&&(e||this.value!==this.getCurrentValue())&&this.history.add(this.value)}isAtLastInHistory(){return this.history.isLast()}isNowhereInHistory(){return this.history.isNowhere()}showNextValue(){this.history.has(this.value)||this.addToHistory();let e=this.getNextValue();e&&(e=e===this.value?this.getNextValue():e),this.value=e??"",cl(this.value?this.value:p(14,"Cleared Input"))}showPreviousValue(){this.history.has(this.value)||this.addToHistory();let e=this.getPreviousValue();e&&(e=e===this.value?this.getPreviousValue():e),e&&(this.value=e,cl(this.value))}setPlaceHolder(e){super.setPlaceHolder(e),this.setTooltip(e)}onBlur(){super.onBlur(),this._onDidBlur.fire()}onFocus(){super.onFocus(),this._onDidFocus.fire()}getCurrentValue(){let e=this.history.current();return e||(e=this.history.last(),this.history.next()),e}getPreviousValue(){return this.history.previous()||this.history.first()}getNextValue(){return this.history.next()}}const ISe=p(1,"input");class fZ extends go{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onMouseDown(){return this._onMouseDown.event}get onCaseSensitiveKeyDown(){return this._onCaseSensitiveKeyDown.event}get onRegexKeyDown(){return this._onRegexKeyDown.event}constructor(e,t,i){super(),this.fixFocusOnOptionClickEnabled=!0,this.imeSessionInProgress=!1,this.additionalTogglesDisposables=this._register(new ct),this.additionalToggles=[],this._onDidOptionChange=this._register(new P),this._onKeyDown=this._register(new P),this._onMouseDown=this._register(new P),this._onInput=this._register(new P),this._onKeyUp=this._register(new P),this._onCaseSensitiveKeyDown=this._register(new P),this._onRegexKeyDown=this._register(new P),this._lastHighlightFindOptions=0,this.placeholder=i.placeholder||"",this.validation=i.validation,this.label=i.label||ISe,this.showCommonFindToggles=!!i.showCommonFindToggles;const n=i.appendCaseSensitiveLabel||"",s=i.appendWholeWordsLabel||"",r=i.appendRegexLabel||"",a=!!i.flexibleHeight,l=!!i.flexibleWidth,c=i.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new uZ(this.domNode,t,{placeholder:this.placeholder||"",ariaLabel:this.label||"",validationOptions:{validation:this.validation},showHistoryHint:i.showHistoryHint,flexibleHeight:a,flexibleWidth:l,flexibleMaxHeight:c,inputBoxStyles:i.inputBoxStyles,history:i.history}));const d=this._register(W_());if(this.showCommonFindToggles){this.regex=this._register(new dZ({appendTitle:r,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.regex.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.regex.onKeyDown(u=>{this._onRegexKeyDown.fire(u)})),this.wholeWords=this._register(new cZ({appendTitle:s,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.wholeWords.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this.caseSensitive=this._register(new lZ({appendTitle:n,isChecked:!1,hoverDelegate:d,...i.toggleStyles})),this._register(this.caseSensitive.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.caseSensitive.onKeyDown(u=>{this._onCaseSensitiveKeyDown.fire(u)}));const h=[this.caseSensitive.domNode,this.wholeWords.domNode,this.regex.domNode];this.onkeydown(this.domNode,u=>{if(u.equals(15)||u.equals(17)||u.equals(9)){const f=h.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let g=-1;u.equals(17)?g=(f+1)%h.length:u.equals(15)&&(f===0?g=h.length-1:g=f-1),u.equals(9)?(h[f].blur(),this.inputBox.focus()):g>=0&&h[g].focus(),st.stop(u,!0)}}})}this.controls=document.createElement("div"),this.controls.className="controls",this.controls.style.display=this.showCommonFindToggles?"":"none",this.caseSensitive&&this.controls.append(this.caseSensitive.domNode),this.wholeWords&&this.controls.appendChild(this.wholeWords.domNode),this.regex&&this.controls.appendChild(this.regex.domNode),this.setAdditionalToggles(i?.additionalToggles),this.controls&&this.domNode.appendChild(this.controls),e?.appendChild(this.domNode),this._register(W(this.inputBox.inputElement,"compositionstart",h=>{this.imeSessionInProgress=!0})),this._register(W(this.inputBox.inputElement,"compositionend",h=>{this.imeSessionInProgress=!1,this._onInput.fire()})),this.onkeydown(this.inputBox.inputElement,h=>this._onKeyDown.fire(h)),this.onkeyup(this.inputBox.inputElement,h=>this._onKeyUp.fire(h)),this.oninput(this.inputBox.inputElement,h=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,h=>this._onMouseDown.fire(h))}get onDidChange(){return this.inputBox.onDidChange}layout(e){this.inputBox.layout(),this.updateInputBoxPadding(e.collapsedFindWidget)}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.regex?.enable(),this.wholeWords?.enable(),this.caseSensitive?.enable();for(const e of this.additionalToggles)e.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.regex?.disable(),this.wholeWords?.disable(),this.caseSensitive?.disable();for(const e of this.additionalToggles)e.disable()}setFocusInputOnOptionClick(e){this.fixFocusOnOptionClickEnabled=e}setEnabled(e){e?this.enable():this.disable()}setAdditionalToggles(e){for(const t of this.additionalToggles)t.domNode.remove();this.additionalToggles=[],this.additionalTogglesDisposables.value=new U;for(const t of e??[])this.additionalTogglesDisposables.value.add(t),this.controls.appendChild(t.domNode),this.additionalTogglesDisposables.value.add(t.onChange(i=>{this._onDidOptionChange.fire(i),!i&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus()})),this.additionalToggles.push(t);this.additionalToggles.length>0&&(this.controls.style.display=""),this.updateInputBoxPadding()}updateInputBoxPadding(e=!1){e?this.inputBox.paddingRight=0:this.inputBox.paddingRight=(this.caseSensitive?.width()??0)+(this.wholeWords?.width()??0)+(this.regex?.width()??0)+this.additionalToggles.reduce((t,i)=>t+i.width(),0)}getValue(){return this.inputBox.value}setValue(e){this.inputBox.value!==e&&(this.inputBox.value=e)}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getCaseSensitive(){return this.caseSensitive?.checked??!1}setCaseSensitive(e){this.caseSensitive&&(this.caseSensitive.checked=e)}getWholeWords(){return this.wholeWords?.checked??!1}setWholeWords(e){this.wholeWords&&(this.wholeWords.checked=e)}getRegex(){return this.regex?.checked??!1}setRegex(e){this.regex&&(this.regex.checked=e,this.validate())}focusOnCaseSensitive(){this.caseSensitive?.focus()}highlightFindOptions(){this.domNode.classList.remove("highlight-"+this._lastHighlightFindOptions),this._lastHighlightFindOptions=1-this._lastHighlightFindOptions,this.domNode.classList.add("highlight-"+this._lastHighlightFindOptions)}validate(){this.inputBox.validate()}showMessage(e){this.inputBox.showMessage(e)}clearMessage(){this.inputBox.hideMessage()}}var Zo;(function(o){o[o.Expanded=0]="Expanded",o[o.Collapsed=1]="Collapsed",o[o.PreserveOrExpanded=2]="PreserveOrExpanded",o[o.PreserveOrCollapsed=3]="PreserveOrCollapsed"})(Zo||(Zo={}));var Fg;(function(o){o[o.Unknown=0]="Unknown",o[o.Twistie=1]="Twistie",o[o.Element=2]="Element",o[o.Filter=3]="Filter"})(Fg||(Fg={}));class Yo extends Error{constructor(e,t){super(`TreeError [${e}] ${t}`)}}class X4{constructor(e){this.fn=e,this._map=new WeakMap}map(e){let t=this._map.get(e);return t||(t=this.fn(e),this._map.set(e,t)),t}}class Zh{constructor(e,t,i,n){this.originalStart=e,this.originalLength=t,this.modifiedStart=i,this.modifiedLength=n}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}}class gZ{constructor(e){this.source=e}getElements(){const e=this.source,t=new Int32Array(e.length);for(let i=0,n=e.length;i<n;i++)t[i]=e.charCodeAt(i);return t}}function DSe(o,e,t){return new jl(new gZ(o),new gZ(e)).ComputeDiff(t).changes}class fb{static Assert(e,t){if(!e)throw new Error(t)}}class gb{static Copy(e,t,i,n,s){for(let r=0;r<s;r++)i[n+r]=e[t+r]}static Copy2(e,t,i,n,s){for(let r=0;r<s;r++)i[n+r]=e[t+r]}}class pZ{constructor(){this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new Zh(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}}class jl{constructor(e,t,i=null){this.ContinueProcessingPredicate=i,this._originalSequence=e,this._modifiedSequence=t;const[n,s,r]=jl._getElements(e),[a,l,c]=jl._getElements(t);this._hasStrings=r&&c,this._originalStringElements=n,this._originalElementsOrHash=s,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(e){return e.length>0&&typeof e[0]=="string"}static _getElements(e){const t=e.getElements();if(jl._isStringArray(t)){const i=new Int32Array(t.length);for(let n=0,s=t.length;n<s;n++)i[n]=RR(t[n],0);return[t,i,!0]}return t instanceof Int32Array?[[],t,!1]:[[],new Int32Array(t),!1]}ElementsAreEqual(e,t){return this._originalElementsOrHash[e]!==this._modifiedElementsOrHash[t]?!1:this._hasStrings?this._originalStringElements[e]===this._modifiedStringElements[t]:!0}ElementsAreStrictEqual(e,t){if(!this.ElementsAreEqual(e,t))return!1;const i=jl._getStrictElement(this._originalSequence,e),n=jl._getStrictElement(this._modifiedSequence,t);return i===n}static _getStrictElement(e,t){return typeof e.getStrictElement=="function"?e.getStrictElement(t):null}OriginalElementsAreEqual(e,t){return this._originalElementsOrHash[e]!==this._originalElementsOrHash[t]?!1:this._hasStrings?this._originalStringElements[e]===this._originalStringElements[t]:!0}ModifiedElementsAreEqual(e,t){return this._modifiedElementsOrHash[e]!==this._modifiedElementsOrHash[t]?!1:this._hasStrings?this._modifiedStringElements[e]===this._modifiedStringElements[t]:!0}ComputeDiff(e){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,e)}_ComputeDiff(e,t,i,n,s){const r=[!1];let a=this.ComputeDiffRecursive(e,t,i,n,r);return s&&(a=this.PrettifyChanges(a)),{quitEarly:r[0],changes:a}}ComputeDiffRecursive(e,t,i,n,s){for(s[0]=!1;e<=t&&i<=n&&this.ElementsAreEqual(e,i);)e++,i++;for(;t>=e&&n>=i&&this.ElementsAreEqual(t,n);)t--,n--;if(e>t||i>n){let h;return i<=n?(fb.Assert(e===t+1,"originalStart should only be one more than originalEnd"),h=[new Zh(e,0,i,n-i+1)]):e<=t?(fb.Assert(i===n+1,"modifiedStart should only be one more than modifiedEnd"),h=[new Zh(e,t-e+1,i,0)]):(fb.Assert(e===t+1,"originalStart should only be one more than originalEnd"),fb.Assert(i===n+1,"modifiedStart should only be one more than modifiedEnd"),h=[]),h}const r=[0],a=[0],l=this.ComputeRecursionPoint(e,t,i,n,r,a,s),c=r[0],d=a[0];if(l!==null)return l;if(!s[0]){const h=this.ComputeDiffRecursive(e,c,i,d,s);let u=[];return s[0]?u=[new Zh(c+1,t-(c+1)+1,d+1,n-(d+1)+1)]:u=this.ComputeDiffRecursive(c+1,t,d+1,n,s),this.ConcatenateChanges(h,u)}return[new Zh(e,t-e+1,i,n-i+1)]}WALKTRACE(e,t,i,n,s,r,a,l,c,d,h,u,f,g,m,_,b,C){let w=null,v=null,S=new pZ,L=t,x=i,I=f[0]-_[0]-n,D=-1073741824,R=this.m_forwardHistory.length-1;do{const F=I+e;F===L||F<x&&c[F-1]<c[F+1]?(h=c[F+1],g=h-I-n,h<D&&S.MarkNextChange(),D=h,S.AddModifiedElement(h+1,g),I=F+1-e):(h=c[F-1]+1,g=h-I-n,h<D&&S.MarkNextChange(),D=h-1,S.AddOriginalElement(h,g+1),I=F-1-e),R>=0&&(c=this.m_forwardHistory[R],e=c[0],L=1,x=c.length-1)}while(--R>=-1);if(w=S.getReverseChanges(),C[0]){let F=f[0]+1,O=_[0]+1;if(w!==null&&w.length>0){const B=w[w.length-1];F=Math.max(F,B.getOriginalEnd()),O=Math.max(O,B.getModifiedEnd())}v=[new Zh(F,u-F+1,O,m-O+1)]}else{S=new pZ,L=r,x=a,I=f[0]-_[0]-l,D=1073741824,R=b?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const F=I+s;F===L||F<x&&d[F-1]>=d[F+1]?(h=d[F+1]-1,g=h-I-l,h>D&&S.MarkNextChange(),D=h+1,S.AddOriginalElement(h+1,g+1),I=F+1-s):(h=d[F-1],g=h-I-l,h>D&&S.MarkNextChange(),D=h,S.AddModifiedElement(h+1,g+1),I=F-1-s),R>=0&&(d=this.m_reverseHistory[R],s=d[0],L=1,x=d.length-1)}while(--R>=-1);v=S.getChanges()}return this.ConcatenateChanges(w,v)}ComputeRecursionPoint(e,t,i,n,s,r,a){let l=0,c=0,d=0,h=0,u=0,f=0;e--,i--,s[0]=0,r[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const g=t-e+(n-i),m=g+1,_=new Int32Array(m),b=new Int32Array(m),C=n-i,w=t-e,v=e-i,S=t-n,x=(w-C)%2===0;_[C]=e,b[w]=t,a[0]=!1;for(let I=1;I<=g/2+1;I++){let D=0,R=0;d=this.ClipDiagonalBound(C-I,I,C,m),h=this.ClipDiagonalBound(C+I,I,C,m);for(let O=d;O<=h;O+=2){O===d||O<h&&_[O-1]<_[O+1]?l=_[O+1]:l=_[O-1]+1,c=l-(O-C)-v;const B=l;for(;l<t&&c<n&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(_[O]=l,l+c>D+R&&(D=l,R=c),!x&&Math.abs(O-w)<=I-1&&l>=b[O])return s[0]=l,r[0]=c,B<=b[O]&&I<=1448?this.WALKTRACE(C,d,h,v,w,u,f,S,_,b,l,t,s,c,n,r,x,a):null}const F=(D-e+(R-i)-I)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(D,F))return a[0]=!0,s[0]=D,r[0]=R,F>0&&I<=1448?this.WALKTRACE(C,d,h,v,w,u,f,S,_,b,l,t,s,c,n,r,x,a):(e++,i++,[new Zh(e,t-e+1,i,n-i+1)]);u=this.ClipDiagonalBound(w-I,I,w,m),f=this.ClipDiagonalBound(w+I,I,w,m);for(let O=u;O<=f;O+=2){O===u||O<f&&b[O-1]>=b[O+1]?l=b[O+1]-1:l=b[O-1],c=l-(O-w)-S;const B=l;for(;l>e&&c>i&&this.ElementsAreEqual(l,c);)l--,c--;if(b[O]=l,x&&Math.abs(O-C)<=I&&l<=_[O])return s[0]=l,r[0]=c,B>=_[O]&&I<=1448?this.WALKTRACE(C,d,h,v,w,u,f,S,_,b,l,t,s,c,n,r,x,a):null}if(I<=1447){let O=new Int32Array(h-d+2);O[0]=C-d+1,gb.Copy2(_,d,O,1,h-d+1),this.m_forwardHistory.push(O),O=new Int32Array(f-u+2),O[0]=w-u+1,gb.Copy2(b,u,O,1,f-u+1),this.m_reverseHistory.push(O)}}return this.WALKTRACE(C,d,h,v,w,u,f,S,_,b,l,t,s,c,n,r,x,a)}PrettifyChanges(e){for(let t=0;t<e.length;t++){const i=e[t],n=t<e.length-1?e[t+1].originalStart:this._originalElementsOrHash.length,s=t<e.length-1?e[t+1].modifiedStart:this._modifiedElementsOrHash.length,r=i.originalLength>0,a=i.modifiedLength>0;for(;i.originalStart+i.originalLength<n&&i.modifiedStart+i.modifiedLength<s&&(!r||this.OriginalElementsAreEqual(i.originalStart,i.originalStart+i.originalLength))&&(!a||this.ModifiedElementsAreEqual(i.modifiedStart,i.modifiedStart+i.modifiedLength));){const c=this.ElementsAreStrictEqual(i.originalStart,i.modifiedStart);if(this.ElementsAreStrictEqual(i.originalStart+i.originalLength,i.modifiedStart+i.modifiedLength)&&!c)break;i.originalStart++,i.modifiedStart++}const l=[null];if(t<e.length-1&&this.ChangesOverlap(e[t],e[t+1],l)){e[t]=l[0],e.splice(t+1,1),t--;continue}}for(let t=e.length-1;t>=0;t--){const i=e[t];let n=0,s=0;if(t>0){const h=e[t-1];n=h.originalStart+h.originalLength,s=h.modifiedStart+h.modifiedLength}const r=i.originalLength>0,a=i.modifiedLength>0;let l=0,c=this._boundaryScore(i.originalStart,i.originalLength,i.modifiedStart,i.modifiedLength);for(let h=1;;h++){const u=i.originalStart-h,f=i.modifiedStart-h;if(u<n||f<s||r&&!this.OriginalElementsAreEqual(u,u+i.originalLength)||a&&!this.ModifiedElementsAreEqual(f,f+i.modifiedLength))break;const m=(u===n&&f===s?5:0)+this._boundaryScore(u,i.originalLength,f,i.modifiedLength);m>c&&(c=m,l=h)}i.originalStart-=l,i.modifiedStart-=l;const d=[null];if(t>0&&this.ChangesOverlap(e[t-1],e[t],d)){e[t-1]=d[0],e.splice(t,1),t++;continue}}if(this._hasStrings)for(let t=1,i=e.length;t<i;t++){const n=e[t-1],s=e[t],r=s.originalStart-n.originalStart-n.originalLength,a=n.originalStart,l=s.originalStart+s.originalLength,c=l-a,d=n.modifiedStart,h=s.modifiedStart+s.modifiedLength,u=h-d;if(r<5&&c<20&&u<20){const f=this._findBetterContiguousSequence(a,c,d,u,r);if(f){const[g,m]=f;(g!==n.originalStart+n.originalLength||m!==n.modifiedStart+n.modifiedLength)&&(n.originalLength=g-n.originalStart,n.modifiedLength=m-n.modifiedStart,s.originalStart=g+r,s.modifiedStart=m+r,s.originalLength=l-s.originalStart,s.modifiedLength=h-s.modifiedStart)}}}return e}_findBetterContiguousSequence(e,t,i,n,s){if(t<s||n<s)return null;const r=e+t-s+1,a=i+n-s+1;let l=0,c=0,d=0;for(let h=e;h<r;h++)for(let u=i;u<a;u++){const f=this._contiguousSequenceScore(h,u,s);f>0&&f>l&&(l=f,c=h,d=u)}return l>0?[c,d]:null}_contiguousSequenceScore(e,t,i){let n=0;for(let s=0;s<i;s++){if(!this.ElementsAreEqual(e+s,t+s))return 0;n+=this._originalStringElements[e+s].length}return n}_OriginalIsBoundary(e){return e<=0||e>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[e])}_OriginalRegionIsBoundary(e,t){if(this._OriginalIsBoundary(e)||this._OriginalIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._OriginalIsBoundary(i-1)||this._OriginalIsBoundary(i))return!0}return!1}_ModifiedIsBoundary(e){return e<=0||e>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[e])}_ModifiedRegionIsBoundary(e,t){if(this._ModifiedIsBoundary(e)||this._ModifiedIsBoundary(e-1))return!0;if(t>0){const i=e+t;if(this._ModifiedIsBoundary(i-1)||this._ModifiedIsBoundary(i))return!0}return!1}_boundaryScore(e,t,i,n){const s=this._OriginalRegionIsBoundary(e,t)?1:0,r=this._ModifiedRegionIsBoundary(i,n)?1:0;return s+r}ConcatenateChanges(e,t){const i=[];if(e.length===0||t.length===0)return t.length>0?t:e;if(this.ChangesOverlap(e[e.length-1],t[0],i)){const n=new Array(e.length+t.length-1);return gb.Copy(e,0,n,0,e.length-1),n[e.length-1]=i[0],gb.Copy(t,1,n,e.length,t.length-1),n}else{const n=new Array(e.length+t.length);return gb.Copy(e,0,n,0,e.length),gb.Copy(t,0,n,e.length,t.length),n}}ChangesOverlap(e,t,i){if(fb.Assert(e.originalStart<=t.originalStart,"Left change is not less than or equal to right change"),fb.Assert(e.modifiedStart<=t.modifiedStart,"Left change is not less than or equal to right change"),e.originalStart+e.originalLength>=t.originalStart||e.modifiedStart+e.modifiedLength>=t.modifiedStart){const n=e.originalStart;let s=e.originalLength;const r=e.modifiedStart;let a=e.modifiedLength;return e.originalStart+e.originalLength>=t.originalStart&&(s=t.originalStart+t.originalLength-e.originalStart),e.modifiedStart+e.modifiedLength>=t.modifiedStart&&(a=t.modifiedStart+t.modifiedLength-e.modifiedStart),i[0]=new Zh(n,s,r,a),!0}else return i[0]=null,!1}ClipDiagonalBound(e,t,i,n){if(e>=0&&e<n)return e;const s=i,r=n-i-1,a=t%2===0;if(e<0){const l=s%2===0;return a===l?0:1}else{const l=r%2===0;return a===l?n-1:n-2}}}function Vw(o){return!!o&&o.visibility!==void 0}function Wg(o){switch(o){case!0:return 1;case!1:return 0;default:return o}}function Q4(o){return typeof o.collapsible=="boolean"}class ESe{constructor(e,t,i={}){this.user=e,this.rootRef=[],this.eventBufferer=new i1,this._onDidSpliceModel=new P,this.onDidSpliceModel=this._onDidSpliceModel.event,this._onDidSpliceRenderedNodes=new P,this.onDidSpliceRenderedNodes=this._onDidSpliceRenderedNodes.event,this._onDidChangeCollapseState=new P,this.onDidChangeCollapseState=this.eventBufferer.wrapEvent(this._onDidChangeCollapseState.event),this._onDidChangeRenderNodeCount=new P,this.onDidChangeRenderNodeCount=this.eventBufferer.wrapEvent(this._onDidChangeRenderNodeCount.event),this.refilterDelayer=new fr(KB),this.collapseByDefault=typeof i.collapseByDefault>"u"?!1:i.collapseByDefault,this.allowNonCollapsibleParents=i.allowNonCollapsibleParents??!1,this.filter=i.filter,this.autoExpandSingleChildren=typeof i.autoExpandSingleChildren>"u"?!1:i.autoExpandSingleChildren,this.root={parent:void 0,element:t,children:[],depth:0,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:!1,collapsed:!1,renderNodeCount:0,visibility:1,visible:!0,filterData:void 0}}splice(e,t,i=Ye.empty(),n={}){if(e.length===0)throw new Yo(this.user,"Invalid tree location");n.diffIdentityProvider?this.spliceSmart(n.diffIdentityProvider,e,t,i,n):this.spliceSimple(e,t,i,n)}spliceSmart(e,t,i,n=Ye.empty(),s,r=s.diffDepth??0){const{parentNode:a}=this.getParentNodeWithListIndex(t);if(!a.lastDiffIds)return this.spliceSimple(t,i,n,s);const l=[...n],c=t[t.length-1],d=new jl({getElements:()=>a.lastDiffIds},{getElements:()=>[...a.children.slice(0,c),...l,...a.children.slice(c+i)].map(m=>e.getId(m.element).toString())}).ComputeDiff(!1);if(d.quitEarly)return a.lastDiffIds=void 0,this.spliceSimple(t,i,l,s);const h=t.slice(0,-1),u=(m,_,b)=>{if(r>0)for(let C=0;C<b;C++)m--,_--,this.spliceSmart(e,[...h,m,0],Number.MAX_SAFE_INTEGER,l[_].children,s,r-1)};let f=Math.min(a.children.length,c+i),g=l.length;for(const m of d.changes.sort((_,b)=>b.originalStart-_.originalStart))u(f,g,f-(m.originalStart+m.originalLength)),f=m.originalStart,g=m.modifiedStart-c,this.spliceSimple([...h,f],m.originalLength,Ye.slice(l,g,g+m.modifiedLength),s);u(f,g,f)}spliceSimple(e,t,i=Ye.empty(),{onDidCreateNode:n,onDidDeleteNode:s,diffIdentityProvider:r}){const{parentNode:a,listIndex:l,revealed:c,visible:d}=this.getParentNodeWithListIndex(e),h=[],u=Ye.map(i,S=>this.createTreeNode(S,a,a.visible?1:0,c,h,n)),f=e[e.length-1];let g=0;for(let S=f;S>=0&&S<a.children.length;S--){const L=a.children[S];if(L.visible){g=L.visibleChildIndex;break}}const m=[];let _=0,b=0;for(const S of u)m.push(S),b+=S.renderNodeCount,S.visible&&(S.visibleChildIndex=g+_++);const C=by(a.children,f,t,m);r?a.lastDiffIds?by(a.lastDiffIds,f,t,m.map(S=>r.getId(S.element).toString())):a.lastDiffIds=a.children.map(S=>r.getId(S.element).toString()):a.lastDiffIds=void 0;let w=0;for(const S of C)S.visible&&w++;if(w!==0)for(let S=f+m.length;S<a.children.length;S++){const L=a.children[S];L.visible&&(L.visibleChildIndex-=w)}if(a.visibleChildrenCount+=_-w,C.length>0&&s){const S=L=>{s(L),L.children.forEach(S)};C.forEach(S)}if(c&&d){const S=C.reduce((L,x)=>L+(x.visible?x.renderNodeCount:0),0);this._updateAncestorsRenderNodeCount(a,b-S),this._onDidSpliceRenderedNodes.fire({start:l,deleteCount:S,elements:h})}this._onDidSpliceModel.fire({insertedNodes:m,deletedNodes:C});let v=a;for(;v;){if(v.visibility===2){this.refilterDelayer.trigger(()=>this.refilter());break}v=v.parent}}rerender(e){if(e.length===0)throw new Yo(this.user,"Invalid tree location");const{node:t,listIndex:i,revealed:n}=this.getTreeNodeWithListIndex(e);t.visible&&n&&this._onDidSpliceRenderedNodes.fire({start:i,deleteCount:1,elements:[t]})}has(e){return this.hasTreeNode(e)}getListIndex(e){const{listIndex:t,visible:i,revealed:n}=this.getTreeNodeWithListIndex(e);return i&&n?t:-1}getListRenderCount(e){return this.getTreeNode(e).renderNodeCount}isCollapsible(e){return this.getTreeNode(e).collapsible}setCollapsible(e,t){const i=this.getTreeNode(e);typeof t>"u"&&(t=!i.collapsible);const n={collapsible:t};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,n))}isCollapsed(e){return this.getTreeNode(e).collapsed}setCollapsed(e,t,i){const n=this.getTreeNode(e);typeof t>"u"&&(t=!n.collapsed);const s={collapsed:t,recursive:i||!1};return this.eventBufferer.bufferEvents(()=>this._setCollapseState(e,s))}_setCollapseState(e,t){const{node:i,listIndex:n,revealed:s}=this.getTreeNodeWithListIndex(e),r=this._setListNodeCollapseState(i,n,s,t);if(i!==this.root&&this.autoExpandSingleChildren&&r&&!Q4(t)&&i.collapsible&&!i.collapsed&&!t.recursive){let a=-1;for(let l=0;l<i.children.length;l++)if(i.children[l].visible)if(a>-1){a=-1;break}else a=l;a>-1&&this._setCollapseState([...e,a],t)}return r}_setListNodeCollapseState(e,t,i,n){const s=this._setNodeCollapseState(e,n,!1);if(!i||!e.visible||!s)return s;const r=e.renderNodeCount,a=this.updateNodeAfterCollapseChange(e),l=r-(t===-1?0:1);return this._onDidSpliceRenderedNodes.fire({start:t+1,deleteCount:l,elements:a.slice(1)}),s}_setNodeCollapseState(e,t,i){let n;if(e===this.root?n=!1:(Q4(t)?(n=e.collapsible!==t.collapsible,e.collapsible=t.collapsible):e.collapsible?(n=e.collapsed!==t.collapsed,e.collapsed=t.collapsed):n=!1,n&&this._onDidChangeCollapseState.fire({node:e,deep:i})),!Q4(t)&&t.recursive)for(const s of e.children)n=this._setNodeCollapseState(s,t,!0)||n;return n}expandTo(e){this.eventBufferer.bufferEvents(()=>{let t=this.getTreeNode(e);for(;t.parent;)t=t.parent,e=e.slice(0,e.length-1),t.collapsed&&this._setCollapseState(e,{collapsed:!1,recursive:!1})})}refilter(){const e=this.root.renderNodeCount,t=this.updateNodeAfterFilterChange(this.root);this._onDidSpliceRenderedNodes.fire({start:0,deleteCount:e,elements:t}),this.refilterDelayer.cancel()}createTreeNode(e,t,i,n,s,r){const a={parent:t,element:e.element,children:[],depth:t.depth+1,visibleChildrenCount:0,visibleChildIndex:-1,collapsible:typeof e.collapsible=="boolean"?e.collapsible:typeof e.collapsed<"u",collapsed:typeof e.collapsed>"u"?this.collapseByDefault:e.collapsed,renderNodeCount:1,visibility:1,visible:!0,filterData:void 0},l=this._filterNode(a,i);a.visibility=l,n&&s.push(a);const c=e.children||Ye.empty(),d=n&&l!==0&&!a.collapsed;let h=0,u=1;for(const f of c){const g=this.createTreeNode(f,a,l,d,s,r);a.children.push(g),u+=g.renderNodeCount,g.visible&&(g.visibleChildIndex=h++)}return this.allowNonCollapsibleParents||(a.collapsible=a.collapsible||a.children.length>0),a.visibleChildrenCount=h,a.visible=l===2?h>0:l===1,a.visible?a.collapsed||(a.renderNodeCount=u):(a.renderNodeCount=0,n&&s.pop()),r?.(a),a}updateNodeAfterCollapseChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterCollapseChange(e,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterCollapseChange(e,t){if(e.visible===!1)return 0;if(t.push(e),e.renderNodeCount=1,!e.collapsed)for(const i of e.children)e.renderNodeCount+=this._updateNodeAfterCollapseChange(i,t);return this._onDidChangeRenderNodeCount.fire(e),e.renderNodeCount}updateNodeAfterFilterChange(e){const t=e.renderNodeCount,i=[];return this._updateNodeAfterFilterChange(e,e.visible?1:0,i),this._updateAncestorsRenderNodeCount(e.parent,i.length-t),i}_updateNodeAfterFilterChange(e,t,i,n=!0){let s;if(e!==this.root){if(s=this._filterNode(e,t),s===0)return e.visible=!1,e.renderNodeCount=0,!1;n&&i.push(e)}const r=i.length;e.renderNodeCount=e===this.root?0:1;let a=!1;if(!e.collapsed||s!==0){let l=0;for(const c of e.children)a=this._updateNodeAfterFilterChange(c,s,i,n&&!e.collapsed)||a,c.visible&&(c.visibleChildIndex=l++);e.visibleChildrenCount=l}else e.visibleChildrenCount=0;return e!==this.root&&(e.visible=s===2?a:s===1,e.visibility=s),e.visible?e.collapsed||(e.renderNodeCount+=i.length-r):(e.renderNodeCount=0,n&&i.pop()),this._onDidChangeRenderNodeCount.fire(e),e.visible}_updateAncestorsRenderNodeCount(e,t){if(t!==0)for(;e;)e.renderNodeCount+=t,this._onDidChangeRenderNodeCount.fire(e),e=e.parent}_filterNode(e,t){const i=this.filter?this.filter.filter(e.element,t):1;return typeof i=="boolean"?(e.filterData=void 0,i?1:0):Vw(i)?(e.filterData=i.data,Wg(i.visibility)):(e.filterData=void 0,Wg(i))}hasTreeNode(e,t=this.root){if(!e||e.length===0)return!0;const[i,...n]=e;return i<0||i>t.children.length?!1:this.hasTreeNode(n,t.children[i])}getTreeNode(e,t=this.root){if(!e||e.length===0)return t;const[i,...n]=e;if(i<0||i>t.children.length)throw new Yo(this.user,"Invalid tree location");return this.getTreeNode(n,t.children[i])}getTreeNodeWithListIndex(e){if(e.length===0)return{node:this.root,listIndex:-1,revealed:!0,visible:!1};const{parentNode:t,listIndex:i,revealed:n,visible:s}=this.getParentNodeWithListIndex(e),r=e[e.length-1];if(r<0||r>t.children.length)throw new Yo(this.user,"Invalid tree location");const a=t.children[r];return{node:a,listIndex:i,revealed:n,visible:s&&a.visible}}getParentNodeWithListIndex(e,t=this.root,i=0,n=!0,s=!0){const[r,...a]=e;if(r<0||r>t.children.length)throw new Yo(this.user,"Invalid tree location");for(let l=0;l<r;l++)i+=t.children[l].renderNodeCount;return n=n&&!t.collapsed,s=s&&t.visible,a.length===0?{parentNode:t,listIndex:i,revealed:n,visible:s}:this.getParentNodeWithListIndex(a,t.children[r],i+1,n,s)}getNode(e=[]){return this.getTreeNode(e)}getNodeLocation(e){const t=[];let i=e;for(;i.parent;)t.push(i.parent.children.indexOf(i)),i=i.parent;return t.reverse()}getParentNodeLocation(e){if(e.length!==0)return e.length===1?[]:mne(e)[0]}getFirstElementChild(e){const t=this.getTreeNode(e);if(t.children.length!==0)return t.children[0].element}}class NSe extends sw{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function J4(o){return o instanceof sw?new NSe(o):o}class TSe{constructor(e,t){this.modelProvider=e,this.dnd=t,this.autoExpandDisposable=A.None,this.disposables=new U}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(J4(e),t)}onDragOver(e,t,i,n,s,r=!0){const a=this.dnd.onDragOver(J4(e),t&&t.element,i,n,s),l=this.autoExpandNode!==t;if(l&&(this.autoExpandDisposable.dispose(),this.autoExpandNode=t),typeof t>"u")return a;if(l&&typeof a!="boolean"&&a.autoExpand&&(this.autoExpandDisposable=yc(()=>{const f=this.modelProvider(),g=f.getNodeLocation(t);f.isCollapsed(g)&&f.setCollapsed(g,!1),this.autoExpandNode=void 0},500,this.disposables)),typeof a=="boolean"||!a.accept||typeof a.bubble>"u"||a.feedback){if(!r){const f=typeof a=="boolean"?a:a.accept,g=typeof a=="boolean"?void 0:a.effect;return{accept:f,effect:g,feedback:[i]}}return a}if(a.bubble===1){const f=this.modelProvider(),g=f.getNodeLocation(t),m=f.getParentNodeLocation(g),_=f.getNode(m),b=m&&f.getListIndex(m);return this.onDragOver(e,_,b,n,s,!1)}const c=this.modelProvider(),d=c.getNodeLocation(t),h=c.getListIndex(d),u=c.getListRenderCount(d);return{...a,feedback:Bs(h,h+u)}}drop(e,t,i,n,s){this.autoExpandDisposable.dispose(),this.autoExpandNode=void 0,this.dnd.drop(J4(e),t&&t.element,i,n,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.disposables.dispose(),this.dnd.dispose()}}function RSe(o,e,t){return t&&{...t,identityProvider:t.identityProvider&&{getId(i){return t.identityProvider.getId(i.element)}},dnd:t.dnd&&e.add(new TSe(o,t.dnd)),multipleSelectionController:t.multipleSelectionController&&{isSelectionSingleChangeEvent(i){return t.multipleSelectionController.isSelectionSingleChangeEvent({...i,element:i.element})},isSelectionRangeChangeEvent(i){return t.multipleSelectionController.isSelectionRangeChangeEvent({...i,element:i.element})}},accessibilityProvider:t.accessibilityProvider&&{...t.accessibilityProvider,getSetSize(i){const n=o(),s=n.getNodeLocation(i),r=n.getParentNodeLocation(s);return n.getNode(r).visibleChildrenCount},getPosInSet(i){return i.visibleChildIndex+1},isChecked:t.accessibilityProvider&&t.accessibilityProvider.isChecked?i=>t.accessibilityProvider.isChecked(i.element):void 0,getRole:t.accessibilityProvider&&t.accessibilityProvider.getRole?i=>t.accessibilityProvider.getRole(i.element):()=>"treeitem",getAriaLabel(i){return t.accessibilityProvider.getAriaLabel(i.element)},getWidgetAriaLabel(){return t.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:t.accessibilityProvider&&t.accessibilityProvider.getWidgetRole?()=>t.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:t.accessibilityProvider&&t.accessibilityProvider.getAriaLevel?i=>t.accessibilityProvider.getAriaLevel(i.element):i=>i.depth,getActiveDescendantId:t.accessibilityProvider.getActiveDescendantId&&(i=>t.accessibilityProvider.getActiveDescendantId(i.element))},keyboardNavigationLabelProvider:t.keyboardNavigationLabelProvider&&{...t.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(i){return t.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(i.element)}}}}class e5{constructor(e){this.delegate=e}getHeight(e){return this.delegate.getHeight(e.element)}getTemplateId(e){return this.delegate.getTemplateId(e.element)}hasDynamicHeight(e){return!!this.delegate.hasDynamicHeight&&this.delegate.hasDynamicHeight(e.element)}setDynamicHeight(e,t){this.delegate.setDynamicHeight?.(e.element,t)}}var Bg;(function(o){o.None="none",o.OnHover="onHover",o.Always="always"})(Bg||(Bg={}));class MSe{get elements(){return this._elements}constructor(e,t=[]){this._elements=t,this.disposables=new U,this.onDidChange=ie.forEach(e,i=>this._elements=i,this.disposables)}dispose(){this.disposables.dispose()}}const IC=class IC{constructor(e,t,i,n,s,r={}){this.renderer=e,this.model=t,this.activeNodes=n,this.renderedIndentGuides=s,this.renderedElements=new Map,this.renderedNodes=new Map,this.indent=IC.DefaultIndent,this.hideTwistiesOfChildlessElements=!1,this.shouldRenderIndentGuides=!1,this.activeIndentNodes=new Set,this.indentGuidesDisposable=A.None,this.disposables=new U,this.templateId=e.templateId,this.updateOptions(r),ie.map(i,a=>a.node)(this.onDidChangeNodeTwistieState,this,this.disposables),e.onDidChangeTwistieState?.(this.onDidChangeTwistieState,this,this.disposables)}updateOptions(e={}){if(typeof e.indent<"u"){const t=ks(e.indent,0,40);if(t!==this.indent){this.indent=t;for(const[i,n]of this.renderedNodes)n.indentSize=IC.DefaultIndent+(i.depth-1)*this.indent,this.renderTreeElement(i,n)}}if(typeof e.renderIndentGuides<"u"){const t=e.renderIndentGuides!==Bg.None;if(t!==this.shouldRenderIndentGuides){this.shouldRenderIndentGuides=t;for(const[i,n]of this.renderedNodes)this._renderIndentGuides(i,n);if(this.indentGuidesDisposable.dispose(),t){const i=new U;this.activeNodes.onDidChange(this._onDidChangeActiveNodes,this,i),this.indentGuidesDisposable=i,this._onDidChangeActiveNodes(this.activeNodes.elements)}}}typeof e.hideTwistiesOfChildlessElements<"u"&&(this.hideTwistiesOfChildlessElements=e.hideTwistiesOfChildlessElements)}renderTemplate(e){const t=Z(e,Q(".monaco-tl-row")),i=Z(t,Q(".monaco-tl-indent")),n=Z(t,Q(".monaco-tl-twistie")),s=Z(t,Q(".monaco-tl-contents")),r=this.renderer.renderTemplate(s);return{container:e,indent:i,twistie:n,indentGuidesDisposable:A.None,indentSize:0,templateData:r}}renderElement(e,t,i,n){i.indentSize=IC.DefaultIndent+(e.depth-1)*this.indent,this.renderedNodes.set(e,i),this.renderedElements.set(e.element,e),this.renderTreeElement(e,i),this.renderer.renderElement(e,t,i.templateData,{...n,indent:i.indentSize})}disposeElement(e,t,i,n){i.indentGuidesDisposable.dispose(),this.renderer.disposeElement?.(e,t,i.templateData,{...n,indent:i.indentSize}),typeof n?.height=="number"&&(this.renderedNodes.delete(e),this.renderedElements.delete(e.element))}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}onDidChangeTwistieState(e){const t=this.renderedElements.get(e);t&&this.onDidChangeNodeTwistieState(t)}onDidChangeNodeTwistieState(e){const t=this.renderedNodes.get(e);t&&(this._onDidChangeActiveNodes(this.activeNodes.elements),this.renderTreeElement(e,t))}renderTreeElement(e,t){t.twistie.style.paddingLeft=`${t.indentSize}px`,t.indent.style.width=`${t.indentSize+this.indent-16}px`,e.collapsible?t.container.setAttribute("aria-expanded",String(!e.collapsed)):t.container.removeAttribute("aria-expanded"),t.twistie.classList.remove(...ve.asClassNameArray(Y.treeItemExpanded));let i=!1;this.renderer.renderTwistie&&(i=this.renderer.renderTwistie(e.element,t.twistie)),e.collapsible&&(!this.hideTwistiesOfChildlessElements||e.visibleChildrenCount>0)?(i||t.twistie.classList.add(...ve.asClassNameArray(Y.treeItemExpanded)),t.twistie.classList.add("collapsible"),t.twistie.classList.toggle("collapsed",e.collapsed)):t.twistie.classList.remove("collapsible","collapsed"),this._renderIndentGuides(e,t)}_renderIndentGuides(e,t){if(pn(t.indent),t.indentGuidesDisposable.dispose(),!this.shouldRenderIndentGuides)return;const i=new U;for(;;){const n=this.model.getNodeLocation(e),s=this.model.getParentNodeLocation(n);if(!s)break;const r=this.model.getNode(s),a=Q(".indent-guide",{style:`width: ${this.indent}px`});this.activeIndentNodes.has(r)&&a.classList.add("active"),t.indent.childElementCount===0?t.indent.appendChild(a):t.indent.insertBefore(a,t.indent.firstElementChild),this.renderedIndentGuides.add(r,a),i.add(ue(()=>this.renderedIndentGuides.delete(r,a))),e=r}t.indentGuidesDisposable=i}_onDidChangeActiveNodes(e){if(!this.shouldRenderIndentGuides)return;const t=new Set;e.forEach(i=>{const n=this.model.getNodeLocation(i);try{const s=this.model.getParentNodeLocation(n);i.collapsible&&i.children.length>0&&!i.collapsed?t.add(i):s&&t.add(this.model.getNode(s))}catch{}}),this.activeIndentNodes.forEach(i=>{t.has(i)||this.renderedIndentGuides.forEach(i,n=>n.classList.remove("active"))}),t.forEach(i=>{this.activeIndentNodes.has(i)||this.renderedIndentGuides.forEach(i,n=>n.classList.add("active"))}),this.activeIndentNodes=t}dispose(){this.renderedNodes.clear(),this.renderedElements.clear(),this.indentGuidesDisposable.dispose(),pt(this.disposables)}};IC.DefaultIndent=8;let t5=IC;function PSe(o,e){const t=e.toLowerCase().indexOf(o);let i;if(t>-1){i=[Number.MAX_SAFE_INTEGER,0];for(let n=o.length;n>0;n--)i.push(t+n-1)}return i}class mZ{get totalCount(){return this._totalCount}get matchCount(){return this._matchCount}set findMatchType(e){this._findMatchType=e}get findMatchType(){return this._findMatchType}set findMode(e){this._findMode=e}get findMode(){return this._findMode}constructor(e,t,i){this._keyboardNavigationLabelProvider=e,this._filter=t,this._defaultFindVisibility=i,this._totalCount=0,this._matchCount=0,this._findMatchType=Ua.Fuzzy,this._findMode=Xo.Highlight,this._pattern="",this._lowercasePattern="",this.disposables=new U}filter(e,t){let i=1;if(this._filter){const r=this._filter.filter(e,t);if(typeof r=="boolean"?i=r?1:0:Vw(r)?i=Wg(r.visibility):i=r,i===0)return!1}if(this._totalCount++,!this._pattern)return this._matchCount++,{data:Jr.Default,visibility:i};const n=this._keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e),s=Array.isArray(n)?n:[n];for(const r of s){const a=r&&r.toString();if(typeof a>"u")return{data:Jr.Default,visibility:i};let l;if(this._findMatchType===Ua.Contiguous?l=PSe(this._lowercasePattern,a.toLowerCase()):l=lg(this._pattern,this._lowercasePattern,0,a,a.toLowerCase(),0,{firstMatchCanBeWeak:!0,boostFullMatch:!0}),l)return this._matchCount++,s.length===1?{data:l,visibility:i}:{data:{label:a,score:l},visibility:i}}return this._findMode===Xo.Filter?typeof this._defaultFindVisibility=="number"?this._defaultFindVisibility:this._defaultFindVisibility?this._defaultFindVisibility(e):2:{data:Jr.Default,visibility:i}}reset(){this._totalCount=0,this._matchCount=0}dispose(){pt(this.disposables)}}class ASe{constructor(e){this.stateMap=new Map(e.map(t=>[t.id,{...t}]))}get(e){const t=this.stateMap.get(e);if(t===void 0)throw new Error(`No state found for toggle id ${e}`);return t.isChecked}set(e,t){const i=this.stateMap.get(e);if(i===void 0)throw new Error(`No state found for toggle id ${e}`);return i.isChecked===t?!1:(i.isChecked=t,!0)}}var Xo;(function(o){o[o.Highlight=0]="Highlight",o[o.Filter=1]="Filter"})(Xo||(Xo={}));var Ua;(function(o){o[o.Fuzzy=0]="Fuzzy",o[o.Contiguous=1]="Contiguous"})(Ua||(Ua={}));var Yh;(function(o){o.Mode="mode",o.MatchType="matchType"})(Yh||(Yh={}));class OSe{get pattern(){return this._pattern}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.widget?.setPlaceHolder(e)}constructor(e,t,i,n={}){this.tree=e,this.filter=t,this.contextViewProvider=i,this.options=n,this._pattern="",this._onDidChangePattern=new P,this._onDidChangeOpenState=new P,this.onDidChangeOpenState=this._onDidChangeOpenState.event,this.enabledDisposables=new U,this.disposables=new U,this.toggles=new ASe(n.toggles??[]),this._placeholder=n.placeholder??p(20,"Type to search")}isOpened(){return!!this.widget}updateToggleState(e,t){this.toggles.set(e,t),this.widget?.setToggleState(e,t)}renderMessage(e,t){e?this.tree.options.showNotFoundMessage??!0?this.widget?.showMessage({type:2,content:t??p(21,"No results found.")}):this.widget?.showMessage({type:2}):this.widget?.clearMessage()}alertResults(e){ps(e?p(23,"{0} results",e):p(22,"No results"))}dispose(){this._history=void 0,this._onDidChangePattern.dispose(),this.enabledDisposables.dispose(),this.disposables.dispose()}}let _Z=class extends OSe{get mode(){return this.toggles.get(Yh.Mode)?Xo.Filter:Xo.Highlight}set mode(e){if(e===this.mode)return;const t=e===Xo.Filter;this.updateToggleState(Yh.Mode,t),this.placeholder=t?p(24,"Type to filter"):p(25,"Type to search"),this.filter.findMode=e,this.tree.refilter(),this.render(),this._onDidChangeMode.fire(e)}get matchType(){return this.toggles.get(Yh.MatchType)?Ua.Fuzzy:Ua.Contiguous}set matchType(e){e!==this.matchType&&(this.updateToggleState(Yh.MatchType,e===Ua.Fuzzy),this.filter.findMatchType=e,this.tree.refilter(),this.render(),this._onDidChangeMatchType.fire(e))}constructor(e,t,i,n={}){const s=n.defaultFindMode??Xo.Highlight,r=n.defaultFindMatchType??Ua.Fuzzy,a=[{id:Yh.Mode,icon:Y.listFilter,title:p(26,"Filter"),isChecked:s===Xo.Filter},{id:Yh.MatchType,icon:Y.searchFuzzy,title:p(27,"Fuzzy Match"),isChecked:r===Ua.Fuzzy}];t.findMatchType=r,t.findMode=s,super(e,t,i,{...n,toggles:a}),this.filter=t,this._onDidChangeMode=new P,this.onDidChangeMode=this._onDidChangeMode.event,this._onDidChangeMatchType=new P,this.onDidChangeMatchType=this._onDidChangeMatchType.event,this.disposables.add(this.tree.onDidChangeModel(()=>{this.isOpened()&&(this.pattern.length!==0&&this.tree.refilter(),this.render())})),this.disposables.add(this.tree.onWillRefilter(()=>this.filter.reset()))}updateOptions(e={}){e.defaultFindMode!==void 0&&(this.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.matchType=e.defaultFindMatchType)}shouldAllowFocus(e){return!this.isOpened()||!this.pattern||this.filter.totalCount>0&&this.filter.matchCount<=1?!0:!Jr.isDefault(e.filterData)}render(){const t=this.filter.matchCount===0&&this.filter.totalCount>0&&this.pattern.length>0;this.renderMessage(t),this.pattern.length&&this.alertResults(this.filter.matchCount)}};function FSe(o,e){return o.position===e.position&&bZ(o,e)}function bZ(o,e){return o.node.element===e.node.element&&o.startIndex===e.startIndex&&o.height===e.height&&o.endIndex===e.endIndex}class WSe{constructor(e=[]){this.stickyNodes=e}get count(){return this.stickyNodes.length}equal(e){return Ut(this.stickyNodes,e.stickyNodes,FSe)}contains(e){return this.stickyNodes.some(t=>t.node.element===e.element)}lastNodePartiallyVisible(){if(this.count===0)return!1;const e=this.stickyNodes[this.count-1];if(this.count===1)return e.position!==0;const t=this.stickyNodes[this.count-2];return t.position+t.height!==e.position}animationStateChanged(e){if(!Ut(this.stickyNodes,e.stickyNodes,bZ)||this.count===0)return!1;const t=this.stickyNodes[this.count-1],i=e.stickyNodes[e.count-1];return t.position!==i.position}}class BSe{constrainStickyScrollNodes(e,t,i){for(let n=0;n<e.length;n++){const s=e[n];if(s.position+s.height>i||n>=t)return e.slice(0,n)}return e}}let CZ=class extends A{constructor(e,t,i,n,s,r={}){super(),this.tree=e,this.model=t,this.view=i,this.treeDelegate=s,this.maxWidgetViewRatio=.4;const a=this.validateStickySettings(r);this.stickyScrollMaxItemCount=a.stickyScrollMaxItemCount,this.stickyScrollDelegate=r.stickyScrollDelegate??new BSe,this.paddingTop=r.paddingTop??0,this._widget=this._register(new HSe(i.getScrollableElement(),i,e,n,s,r.accessibilityProvider)),this.onDidChangeHasFocus=this._widget.onDidChangeHasFocus,this.onContextMenu=this._widget.onContextMenu,this._register(i.onDidScroll(()=>this.update())),this._register(i.onDidChangeContentHeight(()=>this.update())),this._register(e.onDidChangeCollapseState(()=>this.update())),this._register(t.onDidSpliceRenderedNodes(l=>{const c=this._widget.state;if(!c)return;if(l.deleteCount>0&&c.stickyNodes.some(u=>!this.model.has(this.model.getNodeLocation(u.node)))){this.update();return}c.stickyNodes.some(u=>{const f=this.model.getListIndex(this.model.getNodeLocation(u.node));return f>=l.start&&f<l.start+l.deleteCount&&c.contains(u.node)})&&this._widget.rerender()})),this.update()}get height(){return this._widget.height}getNodeAtHeight(e){let t;if(e===0?t=this.view.firstVisibleIndex:t=this.view.indexAt(e+this.view.scrollTop),!(t<0||t>=this.view.length))return this.view.element(t)}update(){const e=this.getNodeAtHeight(this.paddingTop);if(!e||this.tree.scrollTop<=this.paddingTop){this._widget.setState(void 0);return}const t=this.findStickyState(e);this._widget.setState(t)}findStickyState(e){const t=[];let i=e,n=0,s=this.getNextStickyNode(i,void 0,n);for(;s&&(t.push(s),n+=s.height,!(t.length<=this.stickyScrollMaxItemCount&&(i=this.getNextVisibleNode(s),!i)));)s=this.getNextStickyNode(i,s.node,n);const r=this.constrainStickyNodes(t);return r.length?new WSe(r):void 0}getNextVisibleNode(e){return this.getNodeAtHeight(e.position+e.height)}getNextStickyNode(e,t,i){const n=this.getAncestorUnderPrevious(e,t);if(n&&!(n===e&&(!this.nodeIsUncollapsedParent(e)||this.nodeTopAlignsWithStickyNodesBottom(e,i))))return this.createStickyScrollNode(n,i)}nodeTopAlignsWithStickyNodesBottom(e,t){const i=this.getNodeIndex(e),n=this.view.getElementTop(i),s=t;return this.view.scrollTop===n-s}createStickyScrollNode(e,t){const i=this.treeDelegate.getHeight(e),{startIndex:n,endIndex:s}=this.getNodeRange(e),r=this.calculateStickyNodePosition(s,t,i);return{node:e,position:r,height:i,startIndex:n,endIndex:s}}getAncestorUnderPrevious(e,t=void 0){let i=e,n=this.getParentNode(i);for(;n;){if(n===t)return i;i=n,n=this.getParentNode(i)}if(t===void 0)return i}calculateStickyNodePosition(e,t,i){let n=this.view.getRelativeTop(e);if(n===null&&this.view.firstVisibleIndex===e&&e+1<this.view.length){const c=this.treeDelegate.getHeight(this.view.element(e)),d=this.view.getRelativeTop(e+1);n=d?d-c/this.view.renderHeight:null}if(n===null)return t;const s=this.view.element(e),r=this.treeDelegate.getHeight(s),l=n*this.view.renderHeight+r;return t+i>l&&t<=l?l-i:t}constrainStickyNodes(e){if(e.length===0)return[];const t=this.view.renderHeight*this.maxWidgetViewRatio,i=e[e.length-1];if(e.length<=this.stickyScrollMaxItemCount&&i.position+i.height<=t)return e;const n=this.stickyScrollDelegate.constrainStickyScrollNodes(e,this.stickyScrollMaxItemCount,t);if(!n.length)return[];const s=n[n.length-1];if(n.length>this.stickyScrollMaxItemCount||s.position+s.height>t)throw new Error("stickyScrollDelegate violates constraints");return n}getParentNode(e){const t=this.model.getNodeLocation(e),i=this.model.getParentNodeLocation(t);return i?this.model.getNode(i):void 0}nodeIsUncollapsedParent(e){const t=this.model.getNodeLocation(e);return this.model.getListRenderCount(t)>1}getNodeIndex(e){const t=this.model.getNodeLocation(e);return this.model.getListIndex(t)}getNodeRange(e){const t=this.model.getNodeLocation(e),i=this.model.getListIndex(t);if(i<0)throw new Error("Node not found in tree");const n=this.model.getListRenderCount(t),s=i+n-1;return{startIndex:i,endIndex:s}}nodePositionTopBelowWidget(e){const t=[];let i=this.getParentNode(e);for(;i;)t.push(i),i=this.getParentNode(i);let n=0;for(let s=0;s<t.length&&s<this.stickyScrollMaxItemCount;s++)n+=this.treeDelegate.getHeight(t[s]);return n}domFocus(){this._widget.domFocus()}focusedLast(){return this._widget.focusedLast()}updateOptions(e={}){if(e.paddingTop!==void 0&&(this.paddingTop=e.paddingTop),e.stickyScrollMaxItemCount!==void 0){const t=this.validateStickySettings(e);this.stickyScrollMaxItemCount!==t.stickyScrollMaxItemCount&&(this.stickyScrollMaxItemCount=t.stickyScrollMaxItemCount,this.update())}}validateStickySettings(e){let t=7;return typeof e.stickyScrollMaxItemCount=="number"&&(t=Math.max(e.stickyScrollMaxItemCount,1)),{stickyScrollMaxItemCount:t}}},HSe=class{get state(){return this._previousState}constructor(e,t,i,n,s,r){this.view=t,this.tree=i,this.treeRenderers=n,this.treeDelegate=s,this.accessibilityProvider=r,this._previousElements=[],this._previousStateDisposables=new U,this._rootDomNode=Q(".monaco-tree-sticky-container.empty"),e.appendChild(this._rootDomNode);const a=Q(".monaco-tree-sticky-container-shadow");this._rootDomNode.appendChild(a),this.stickyScrollFocus=new VSe(this._rootDomNode,t),this.onDidChangeHasFocus=this.stickyScrollFocus.onDidChangeHasFocus,this.onContextMenu=this.stickyScrollFocus.onContextMenu}get height(){if(!this._previousState)return 0;const e=this._previousState.stickyNodes[this._previousState.count-1];return e.position+e.height}setState(e){const t=!!this._previousState&&this._previousState.count>0,i=!!e&&e.count>0;if(!t&&!i||t&&i&&this._previousState.equal(e))return;if(t!==i&&this.setVisible(i),!i){this._previousState=void 0,this._previousElements=[],this._previousStateDisposables.clear();return}const n=e.stickyNodes[e.count-1];this._previousState&&e.animationStateChanged(this._previousState)?this._previousElements[this._previousState.count-1].style.top=`${n.position}px`:this.renderState(e),this._previousState=e,this._rootDomNode.style.height=`${n.position+n.height}px`}renderState(e){this._previousStateDisposables.clear();const t=Array(e.count);for(let i=e.count-1;i>=0;i--){const n=e.stickyNodes[i],{element:s,disposable:r}=this.createElement(n,i,e.count);t[i]=s,this._rootDomNode.appendChild(s),this._previousStateDisposables.add(r)}this.stickyScrollFocus.updateElements(t,e),this._previousElements=t}rerender(){this._previousState&&this.renderState(this._previousState)}createElement(e,t,i){const n=e.startIndex,s=document.createElement("div");s.style.top=`${e.position}px`,this.tree.options.setRowHeight!==!1&&(s.style.height=`${e.height}px`),this.tree.options.setRowLineHeight!==!1&&(s.style.lineHeight=`${e.height}px`),s.classList.add("monaco-tree-sticky-row"),s.classList.add("monaco-list-row"),s.setAttribute("data-index",`${n}`),s.setAttribute("data-parity",n%2===0?"even":"odd"),s.setAttribute("id",this.view.getElementID(n));const r=this.setAccessibilityAttributes(s,e.node.element,t,i),a=this.treeDelegate.getTemplateId(e.node),l=this.treeRenderers.find(u=>u.templateId===a);if(!l)throw new Error(`No renderer found for template id ${a}`);let c=e.node;c===this.tree.getNode(this.tree.getNodeLocation(e.node))&&(c=new Proxy(e.node,{}));const d=l.renderTemplate(s);l.renderElement(c,e.startIndex,d,{height:e.height});const h=ue(()=>{r.dispose(),l.disposeElement(c,e.startIndex,d,{height:e.height}),l.disposeTemplate(d),s.remove()});return{element:s,disposable:h}}setAccessibilityAttributes(e,t,i,n){if(!this.accessibilityProvider)return A.None;this.accessibilityProvider.getSetSize&&e.setAttribute("aria-setsize",String(this.accessibilityProvider.getSetSize(t,i,n))),this.accessibilityProvider.getPosInSet&&e.setAttribute("aria-posinset",String(this.accessibilityProvider.getPosInSet(t,i))),this.accessibilityProvider.getRole&&e.setAttribute("role",this.accessibilityProvider.getRole(t)??"treeitem");const s=this.accessibilityProvider.getAriaLabel(t),r=s&&typeof s!="string"?s:Et(s),a=Se(c=>{const d=c.readObservable(r);d?e.setAttribute("aria-label",d):e.removeAttribute("aria-label")});typeof s=="string"||s&&e.setAttribute("aria-label",s.get());const l=this.accessibilityProvider.getAriaLevel&&this.accessibilityProvider.getAriaLevel(t);return typeof l=="number"&&e.setAttribute("aria-level",`${l}`),e.setAttribute("aria-selected",String(!1)),a}setVisible(e){this._rootDomNode.classList.toggle("empty",!e),e||this.stickyScrollFocus.updateElements([],void 0)}domFocus(){this.stickyScrollFocus.domFocus()}focusedLast(){return this.stickyScrollFocus.focusedLast()}dispose(){this.stickyScrollFocus.dispose(),this._previousStateDisposables.dispose(),this._rootDomNode.remove()}};class VSe extends A{get domHasFocus(){return this._domHasFocus}set domHasFocus(e){e!==this._domHasFocus&&(this._onDidChangeHasFocus.fire(e),this._domHasFocus=e)}constructor(e,t){super(),this.container=e,this.view=t,this.focusedIndex=-1,this.elements=[],this._onDidChangeHasFocus=new P,this.onDidChangeHasFocus=this._onDidChangeHasFocus.event,this._onContextMenu=new P,this.onContextMenu=this._onContextMenu.event,this._domHasFocus=!1,this._register(W(this.container,"focus",()=>this.onFocus())),this._register(W(this.container,"blur",()=>this.onBlur())),this._register(this.view.onDidFocus(()=>this.toggleStickyScrollFocused(!1))),this._register(this.view.onKeyDown(i=>this.onKeyDown(i))),this._register(this.view.onMouseDown(i=>this.onMouseDown(i))),this._register(this.view.onContextMenu(i=>this.handleContextMenu(i)))}handleContextMenu(e){const t=e.browserEvent.target;if(!lw(t)&&!aw(t)){this.focusedLast()&&this.view.domFocus();return}if(!Mc(e.browserEvent)){if(!this.state)throw new Error("Context menu should not be triggered when state is undefined");const r=this.state.stickyNodes.findIndex(a=>a.node.element===e.element?.element);if(r===-1)throw new Error("Context menu should not be triggered when element is not in sticky scroll widget");this.container.focus(),this.setFocus(r);return}if(!this.state||this.focusedIndex<0)throw new Error("Context menu key should not be triggered when focus is not in sticky scroll widget");const n=this.state.stickyNodes[this.focusedIndex].node.element,s=this.elements[this.focusedIndex];this._onContextMenu.fire({element:n,anchor:s,browserEvent:e.browserEvent,isStickyScroll:!0})}onKeyDown(e){if(this.domHasFocus&&this.state){if(e.key==="ArrowUp")this.setFocusedElement(Math.max(0,this.focusedIndex-1)),e.preventDefault(),e.stopPropagation();else if(e.key==="ArrowDown"||e.key==="ArrowRight"){if(this.focusedIndex>=this.state.count-1){const t=this.state.stickyNodes[this.state.count-1].startIndex+1;this.view.domFocus(),this.view.setFocus([t]),this.scrollNodeUnderWidget(t,this.state)}else this.setFocusedElement(this.focusedIndex+1);e.preventDefault(),e.stopPropagation()}}}onMouseDown(e){const t=e.browserEvent.target;!lw(t)&&!aw(t)||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation())}updateElements(e,t){if(t&&t.count===0)throw new Error("Sticky scroll state must be undefined when there are no sticky nodes");if(t&&t.count!==e.length)throw new Error("Sticky scroll focus received illigel state");const i=this.focusedIndex;if(this.removeFocus(),this.elements=e,this.state=t,t){const n=ks(i,0,t.count-1);this.setFocus(n)}else this.domHasFocus&&this.view.domFocus();this.container.tabIndex=t?0:-1}setFocusedElement(e){const t=this.state;if(!t)throw new Error("Cannot set focus when state is undefined");if(this.setFocus(e),!(e<t.count-1)&&t.lastNodePartiallyVisible()){const i=t.stickyNodes[e];this.scrollNodeUnderWidget(i.endIndex+1,t)}}scrollNodeUnderWidget(e,t){const i=t.stickyNodes[t.count-1],n=t.count>1?t.stickyNodes[t.count-2]:void 0,s=this.view.getElementTop(e),r=n?n.position+n.height+i.height:i.height;this.view.scrollTop=s-r}domFocus(){if(!this.state)throw new Error("Cannot focus when state is undefined");this.container.focus()}focusedLast(){return this.state?this.view.getHTMLElement().classList.contains("sticky-scroll-focused"):!1}removeFocus(){this.focusedIndex!==-1&&(this.toggleElementFocus(this.elements[this.focusedIndex],!1),this.focusedIndex=-1)}setFocus(e){if(0>e)throw new Error("addFocus() can not remove focus");if(!this.state&&e>=0)throw new Error("Cannot set focus index when state is undefined");if(this.state&&e>=this.state.count)throw new Error("Cannot set focus index to an index that does not exist");const t=this.focusedIndex;t>=0&&this.toggleElementFocus(this.elements[t],!1),e>=0&&this.toggleElementFocus(this.elements[e],!0),this.focusedIndex=e}toggleElementFocus(e,t){this.toggleElementActiveFocus(e,t&&this.domHasFocus),this.toggleElementPassiveFocus(e,t)}toggleCurrentElementActiveFocus(e){this.focusedIndex!==-1&&this.toggleElementActiveFocus(this.elements[this.focusedIndex],e)}toggleElementActiveFocus(e,t){e.classList.toggle("focused",t)}toggleElementPassiveFocus(e,t){e.classList.toggle("passive-focused",t)}toggleStickyScrollFocused(e){this.view.getHTMLElement().classList.toggle("sticky-scroll-focused",e)}onFocus(){if(!this.state||this.elements.length===0)throw new Error("Cannot focus when state is undefined or elements are empty");this.domHasFocus=!0,this.toggleStickyScrollFocused(!0),this.toggleCurrentElementActiveFocus(!0),this.focusedIndex===-1&&this.setFocus(0)}onBlur(){this.domHasFocus=!1,this.toggleCurrentElementActiveFocus(!1)}dispose(){this.toggleStickyScrollFocused(!1),this._onDidChangeHasFocus.fire(!1),super.dispose()}}function aI(o){let e=Fg.Unknown;return t2(o.browserEvent.target,"monaco-tl-twistie","monaco-tl-row")?e=Fg.Twistie:t2(o.browserEvent.target,"monaco-tl-contents","monaco-tl-row")?e=Fg.Element:t2(o.browserEvent.target,"monaco-tree-type-filter","monaco-list")&&(e=Fg.Filter),{browserEvent:o.browserEvent,element:o.element?o.element.element:null,target:e}}function zSe(o){const e=lw(o.browserEvent.target);return{element:o.element?o.element.element:null,browserEvent:o.browserEvent,anchor:o.anchor,isStickyScroll:e}}function lI(o,e){e(o),o.children.forEach(t=>lI(t,e))}class i5{get nodeSet(){return this._nodeSet||(this._nodeSet=this.createNodeSet()),this._nodeSet}constructor(e,t){this.getFirstViewElementWithTrait=e,this.identityProvider=t,this.nodes=[],this._onDidChange=new P,this.onDidChange=this._onDidChange.event}set(e,t){!t?.__forceEvent&&Ut(this.nodes,e)||this._set(e,!1,t)}_set(e,t,i){if(this.nodes=[...e],this.elements=void 0,this._nodeSet=void 0,!t){const n=this;this._onDidChange.fire({get elements(){return n.get()},browserEvent:i})}}get(){return this.elements||(this.elements=this.nodes.map(e=>e.element)),[...this.elements]}getNodes(){return this.nodes}has(e){return this.nodeSet.has(e)}onDidModelSplice({insertedNodes:e,deletedNodes:t}){if(!this.identityProvider){const l=this.createNodeSet(),c=d=>l.delete(d);t.forEach(d=>lI(d,c)),this.set([...l.values()]);return}const i=new Set,n=l=>i.add(this.identityProvider.getId(l.element).toString());t.forEach(l=>lI(l,n));const s=new Map,r=l=>s.set(this.identityProvider.getId(l.element).toString(),l);e.forEach(l=>lI(l,r));const a=[];for(const l of this.nodes){const c=this.identityProvider.getId(l.element).toString();if(!i.has(c))a.push(l);else{const h=s.get(c);h&&h.visible&&a.push(h)}}if(this.nodes.length>0&&a.length===0){const l=this.getFirstViewElementWithTrait();l&&a.push(l)}this._set(a,!0)}createNodeSet(){const e=new Set;for(const t of this.nodes)e.add(t);return e}}class USe extends uq{constructor(e,t,i){super(e),this.tree=t,this.stickyScrollProvider=i}onViewPointer(e){if(aq(e.browserEvent.target)||ya(e.browserEvent.target)||rw(e.browserEvent.target)||e.browserEvent.isHandledByList)return;const t=e.element;if(!t)return super.onViewPointer(e);if(this.isSelectionRangeChangeEvent(e)||this.isSelectionSingleChangeEvent(e))return super.onViewPointer(e);const i=e.browserEvent.target,n=i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&e.browserEvent.offsetX<16,s=aw(e.browserEvent.target);let r=!1;if(s?r=!0:typeof this.tree.expandOnlyOnTwistieClick=="function"?r=this.tree.expandOnlyOnTwistieClick(t.element):r=!!this.tree.expandOnlyOnTwistieClick,s)this.handleStickyScrollMouseEvent(e,t);else{if(r&&!n&&e.browserEvent.detail!==2)return super.onViewPointer(e);if(!this.tree.expandOnDoubleClick&&e.browserEvent.detail===2)return super.onViewPointer(e)}if(t.collapsible&&(!s||n)){const a=this.tree.getNodeLocation(t),l=e.browserEvent.altKey;if(this.tree.setFocus([a]),this.tree.toggleCollapsed(a,l),n){e.browserEvent.isHandledByList=!0;return}}s||super.onViewPointer(e)}handleStickyScrollMouseEvent(e,t){if(Zbe(e.browserEvent.target)||Ybe(e.browserEvent.target))return;const i=this.stickyScrollProvider();if(!i)throw new Error("Sticky scroll controller not found");const n=this.list.indexOf(t),s=this.list.getElementTop(n),r=i.nodePositionTopBelowWidget(t);this.tree.scrollTop=s-r,this.list.domFocus(),this.list.setFocus([n]),this.list.setSelection([n])}onDoubleClick(e){e.browserEvent.target.classList.contains("monaco-tl-twistie")||!this.tree.expandOnDoubleClick||e.browserEvent.isHandledByList||super.onDoubleClick(e)}onMouseDown(e){const t=e.browserEvent.target;if(!lw(t)&&!aw(t)){super.onMouseDown(e);return}}onContextMenu(e){const t=e.browserEvent.target;if(!lw(t)&&!aw(t)){super.onContextMenu(e);return}}}class $Se extends jo{constructor(e,t,i,n,s,r,a,l){super(e,t,i,n,l),this.focusTrait=s,this.selectionTrait=r,this.anchorTrait=a}createMouseController(e){return new USe(this,e.tree,e.stickyScrollProvider)}splice(e,t,i=[]){if(super.splice(e,t,i),i.length===0)return;const n=[],s=[];let r;i.forEach((a,l)=>{this.focusTrait.has(a)&&n.push(e+l),this.selectionTrait.has(a)&&s.push(e+l),this.anchorTrait.has(a)&&(r=e+l)}),n.length>0&&super.setFocus(Dc([...super.getFocus(),...n])),s.length>0&&super.setSelection(Dc([...super.getSelection(),...s])),typeof r=="number"&&super.setAnchor(r)}setFocus(e,t,i=!1){super.setFocus(e,t),i||this.focusTrait.set(e.map(n=>this.element(n)),t)}setSelection(e,t,i=!1){super.setSelection(e,t),i||this.selectionTrait.set(e.map(n=>this.element(n)),t)}setAnchor(e,t=!1){super.setAnchor(e),t||(typeof e>"u"?this.anchorTrait.set([]):this.anchorTrait.set([this.element(e)]))}}class vZ{get onDidScroll(){return this.view.onDidScroll}get onDidChangeFocus(){return this.eventBufferer.wrapEvent(this.focus.onDidChange)}get onDidChangeSelection(){return this.eventBufferer.wrapEvent(this.selection.onDidChange)}get onMouseDblClick(){return ie.filter(ie.map(this.view.onMouseDblClick,aI),e=>e.target!==Fg.Filter)}get onMouseOver(){return ie.map(this.view.onMouseOver,aI)}get onMouseOut(){return ie.map(this.view.onMouseOut,aI)}get onContextMenu(){return ie.any(ie.filter(ie.map(this.view.onContextMenu,zSe),e=>!e.isStickyScroll),this.stickyScrollController?.onContextMenu??ie.None)}get onPointer(){return ie.map(this.view.onPointer,aI)}get onKeyDown(){return this.view.onKeyDown}get onDidFocus(){return this.view.onDidFocus}get onDidChangeModel(){return ie.any(this.onDidChangeModelRelay.event,this.onDidSwapModel.event)}get onDidChangeCollapseState(){return this.onDidChangeCollapseStateRelay.event}get expandOnDoubleClick(){return typeof this._options.expandOnDoubleClick>"u"?!0:this._options.expandOnDoubleClick}get expandOnlyOnTwistieClick(){return typeof this._options.expandOnlyOnTwistieClick>"u"?!0:this._options.expandOnlyOnTwistieClick}get onDidDispose(){return this.view.onDidDispose}constructor(e,t,i,n,s={}){this._user=e,this._options=s,this.eventBufferer=new i1,this.onDidChangeFindOpenState=ie.None,this.onDidChangeStickyScrollFocused=ie.None,this.disposables=new U,this.onDidSwapModel=this.disposables.add(new P),this.onDidChangeModelRelay=this.disposables.add(new n1),this.onDidSpliceModelRelay=this.disposables.add(new n1),this.onDidChangeCollapseStateRelay=this.disposables.add(new n1),this.onDidChangeRenderNodeCountRelay=this.disposables.add(new n1),this.onDidChangeActiveNodesRelay=this.disposables.add(new n1),this._onWillRefilter=new P,this.onWillRefilter=this._onWillRefilter.event,this._onDidUpdateOptions=new P,this.modelDisposables=new U,s.keyboardNavigationLabelProvider&&(s.findWidgetEnabled??!0)&&(this.findFilter=new mZ(s.keyboardNavigationLabelProvider,s.filter,s.defaultFindVisibility),s={...s,filter:this.findFilter},this.disposables.add(this.findFilter)),this.model=this.createModel(e,s),this.treeDelegate=new e5(i);const r=this.disposables.add(new MSe(this.onDidChangeActiveNodesRelay.event)),a=new kH;this.renderers=n.map(l=>new t5(l,this.model,this.onDidChangeCollapseStateRelay.event,r,a,s));for(const l of this.renderers)this.disposables.add(l);if(this.focus=new i5(()=>this.view.getFocusedElements()[0],s.identityProvider),this.selection=new i5(()=>this.view.getSelectedElements()[0],s.identityProvider),this.anchor=new i5(()=>this.view.getAnchorElement(),s.identityProvider),this.view=new $Se(e,t,this.treeDelegate,this.renderers,this.focus,this.selection,this.anchor,{...RSe(()=>this.model,this.disposables,s),tree:this,stickyScrollProvider:()=>this.stickyScrollController}),this.setupModel(this.model),s.keyboardSupport!==!1){const l=ie.chain(this.view.onKeyDown,c=>c.filter(d=>!ya(d.target)).map(d=>new St(d)));ie.chain(l,c=>c.filter(d=>d.keyCode===15))(this.onLeftArrow,this,this.disposables),ie.chain(l,c=>c.filter(d=>d.keyCode===17))(this.onRightArrow,this,this.disposables),ie.chain(l,c=>c.filter(d=>d.keyCode===10))(this.onSpace,this,this.disposables)}if((s.findWidgetEnabled??!0)&&s.keyboardNavigationLabelProvider&&s.contextViewProvider){const l={styles:s.findWidgetStyles,defaultFindMode:s.defaultFindMode,defaultFindMatchType:s.defaultFindMatchType,showNotFoundMessage:s.showNotFoundMessage};this.findController=this.disposables.add(new _Z(this,this.findFilter,s.contextViewProvider,l)),this.focusNavigationFilter=c=>this.findController.shouldAllowFocus(c),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindMode=ie.None,this.onDidChangeFindMatchType=ie.None;s.enableStickyScroll&&(this.stickyScrollController=new CZ(this,this.model,this.view,this.renderers,this.treeDelegate,s),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus),this.styleElement=Ir(this.view.getHTMLElement()),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Bg.Always)}updateOptions(e={}){this._options={...this._options,...e};for(const t of this.renderers)t.updateOptions(e);this.view.updateOptions(this._options),this.findController?.updateOptions(e),this.updateStickyScroll(e),this._onDidUpdateOptions.fire(this._options),this.getHTMLElement().classList.toggle("always",this._options.renderIndentGuides===Bg.Always)}get options(){return this._options}updateStickyScroll(e){!this.stickyScrollController&&this._options.enableStickyScroll?(this.stickyScrollController=new CZ(this,this.model,this.view,this.renderers,this.treeDelegate,this._options),this.onDidChangeStickyScrollFocused=this.stickyScrollController.onDidChangeHasFocus):this.stickyScrollController&&!this._options.enableStickyScroll&&(this.onDidChangeStickyScrollFocused=ie.None,this.stickyScrollController.dispose(),this.stickyScrollController=void 0),this.stickyScrollController?.updateOptions(e)}getHTMLElement(){return this.view.getHTMLElement()}get onDidChangeContentHeight(){return this.view.onDidChangeContentHeight}get scrollTop(){return this.view.scrollTop}set scrollTop(e){this.view.scrollTop=e}get scrollHeight(){return this.view.scrollHeight}get renderHeight(){return this.view.renderHeight}get ariaLabel(){return this.view.ariaLabel}set ariaLabel(e){this.view.ariaLabel=e}domFocus(){this.stickyScrollController?.focusedLast()?this.stickyScrollController.domFocus():this.view.domFocus()}layout(e,t){this.view.layout(e,t)}style(e){const t=`.${this.view.domId}`,i=[];e.treeIndentGuidesStroke&&(i.push(`.monaco-list${t}:hover .monaco-tl-indent > .indent-guide, .monaco-list${t}.always .monaco-tl-indent > .indent-guide { opacity: 1; border-color: ${e.treeInactiveIndentGuidesStroke}; }`),i.push(`.monaco-list${t} .monaco-tl-indent > .indent-guide.active { opacity: 1; border-color: ${e.treeIndentGuidesStroke}; }`));const n=e.treeStickyScrollBackground??e.listBackground;n&&(i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { background-color: ${n}; }`),i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-row { background-color: ${n}; }`)),e.treeStickyScrollBorder&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container { border-bottom: 1px solid ${e.treeStickyScrollBorder}; }`),e.treeStickyScrollShadow&&i.push(`.monaco-list${t} .monaco-scrollable-element .monaco-tree-sticky-container .monaco-tree-sticky-container-shadow { box-shadow: ${e.treeStickyScrollShadow} 0 6px 6px -6px inset; height: 3px; }`),e.listFocusForeground&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { color: ${e.listFocusForeground}; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { color: inherit; }`));const s=od(e.listFocusAndSelectionOutline,od(e.listSelectionOutline,e.listFocusOutline??""));s&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused.selected { outline: 1px solid ${s}; outline-offset: -1px;}`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused.selected { outline: inherit;}`)),e.listFocusOutline&&(i.push(`.monaco-list${t}.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container:focus .monaco-list-row.focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-list${t}:not(.sticky-scroll-focused) .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-scrollable-element .monaco-tree-sticky-container .monaco-list-row.passive-focused { outline: 1px solid ${e.listFocusOutline}; outline-offset: -1px; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused.sticky-scroll-focused .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`),i.push(`.monaco-workbench.context-menu-visible .monaco-list${t}.last-focused:not(.sticky-scroll-focused) .monaco-tree-sticky-container .monaco-list-rows .monaco-list-row.focused { outline: inherit; }`)),this.styleElement.textContent=i.join(`
`),this.view.style(e)}getParentElement(e){const t=this.model.getParentNodeLocation(e);return this.model.getNode(t).element}getFirstElementChild(e){return this.model.getFirstElementChild(e)}getNode(e){return this.model.getNode(e)}getNodeLocation(e){return this.model.getNodeLocation(e)}collapse(e,t=!1){return this.model.setCollapsed(e,!0,t)}expand(e,t=!1){return this.model.setCollapsed(e,!1,t)}toggleCollapsed(e,t=!1){return this.model.setCollapsed(e,void 0,t)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}refilter(){this._onWillRefilter.fire(void 0),this.model.refilter()}setSelection(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.selection.set(i,t);const n=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setSelection(n,t,!0)})}getSelection(){return this.selection.get()}setFocus(e,t){this.eventBufferer.bufferEvents(()=>{const i=e.map(s=>this.model.getNode(s));this.focus.set(i,t);const n=e.map(s=>this.model.getListIndex(s)).filter(s=>s>-1);this.view.setFocus(n,t,!0)})}focusNext(e=1,t=!1,i,n=Mc(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusNext(e,t,i,n)}focusPrevious(e=1,t=!1,i,n=Mc(i)&&i.altKey?void 0:this.focusNavigationFilter){this.view.focusPrevious(e,t,i,n)}focusNextPage(e,t=Mc(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusNextPage(e,t)}focusPreviousPage(e,t=Mc(e)&&e.altKey?void 0:this.focusNavigationFilter){return this.view.focusPreviousPage(e,t,()=>this.stickyScrollController?.height??0)}focusLast(e,t=Mc(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusLast(e,t)}focusFirst(e,t=Mc(e)&&e.altKey?void 0:this.focusNavigationFilter){this.view.focusFirst(e,t)}getFocus(){return this.focus.get()}reveal(e,t){this.model.expandTo(e);const i=this.model.getListIndex(e);if(i!==-1)if(!this.stickyScrollController)this.view.reveal(i,t);else{const n=this.stickyScrollController.nodePositionTopBelowWidget(this.getNode(e));this.view.reveal(i,t,n)}}onLeftArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!0)){const r=this.model.getParentNodeLocation(n);if(!r)return;const a=this.model.getListIndex(r);this.view.reveal(a),this.view.setFocus([a])}}onRightArrow(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i);if(!this.model.setCollapsed(n,!1)){if(!i.children.some(l=>l.visible))return;const[r]=this.view.getFocus(),a=r+1;this.view.reveal(a),this.view.setFocus([a])}}onSpace(e){e.preventDefault(),e.stopPropagation();const t=this.view.getFocusedElements();if(t.length===0)return;const i=t[0],n=this.model.getNodeLocation(i),s=e.browserEvent.altKey;this.model.setCollapsed(n,void 0,s)}setupModel(e){this.modelDisposables.clear(),this.modelDisposables.add(e.onDidSpliceRenderedNodes(({start:s,deleteCount:r,elements:a})=>this.view.splice(s,r,a)));const t=ie.forEach(e.onDidSpliceModel,s=>{this.eventBufferer.bufferEvents(()=>{this.focus.onDidModelSplice(s),this.selection.onDidModelSplice(s)})},this.modelDisposables);t(()=>null,null,this.modelDisposables);const i=this.modelDisposables.add(new P),n=this.modelDisposables.add(new fr(0));this.modelDisposables.add(ie.any(t,this.focus.onDidChange,this.selection.onDidChange)(()=>{n.trigger(()=>{const s=new Set;for(const r of this.focus.getNodes())s.add(r);for(const r of this.selection.getNodes())s.add(r);i.fire([...s.values()])})})),this.onDidChangeActiveNodesRelay.input=i.event,this.onDidChangeModelRelay.input=ie.signal(e.onDidSpliceModel),this.onDidChangeCollapseStateRelay.input=e.onDidChangeCollapseState,this.onDidChangeRenderNodeCountRelay.input=e.onDidChangeRenderNodeCount,this.onDidSpliceModelRelay.input=e.onDidSpliceModel}dispose(){pt(this.disposables),this.stickyScrollController?.dispose(),this.view.dispose(),this.modelDisposables.dispose()}}class n5{constructor(e,t={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.nodesByIdentity=new Map,this.model=new ESe(e,null,t),this.onDidSpliceModel=this.model.onDidSpliceModel,this.onDidSpliceRenderedNodes=this.model.onDidSpliceRenderedNodes,this.onDidChangeCollapseState=this.model.onDidChangeCollapseState,this.onDidChangeRenderNodeCount=this.model.onDidChangeRenderNodeCount,t.sorter&&(this.sorter={compare(i,n){return t.sorter.compare(i.element,n.element)}}),this.identityProvider=t.identityProvider}setChildren(e,t=Ye.empty(),i={}){const n=this.getElementLocation(e);this._setChildren(n,this.preserveCollapseState(t),i)}_setChildren(e,t=Ye.empty(),i){const n=new Set,s=new Set,r=l=>{if(l.element===null)return;const c=l;if(n.add(c.element),this.nodes.set(c.element,c),this.identityProvider){const d=this.identityProvider.getId(c.element).toString();s.add(d),this.nodesByIdentity.set(d,c)}i.onDidCreateNode?.(c)},a=l=>{if(l.element===null)return;const c=l;if(n.has(c.element)||this.nodes.delete(c.element),this.identityProvider){const d=this.identityProvider.getId(c.element).toString();s.has(d)||this.nodesByIdentity.delete(d)}i.onDidDeleteNode?.(c)};this.model.splice([...e,0],Number.MAX_VALUE,t,{...i,onDidCreateNode:r,onDidDeleteNode:a})}preserveCollapseState(e=Ye.empty()){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),Ye.map(e,t=>{let i=this.nodes.get(t.element);if(!i&&this.identityProvider){const r=this.identityProvider.getId(t.element).toString();i=this.nodesByIdentity.get(r)}if(!i){let r;return typeof t.collapsed>"u"?r=void 0:t.collapsed===Zo.Collapsed||t.collapsed===Zo.PreserveOrCollapsed?r=!0:t.collapsed===Zo.Expanded||t.collapsed===Zo.PreserveOrExpanded?r=!1:r=!!t.collapsed,{...t,children:this.preserveCollapseState(t.children),collapsed:r}}const n=typeof t.collapsible=="boolean"?t.collapsible:i.collapsible;let s;return typeof t.collapsed>"u"||t.collapsed===Zo.PreserveOrCollapsed||t.collapsed===Zo.PreserveOrExpanded?s=i.collapsed:t.collapsed===Zo.Collapsed?s=!0:t.collapsed===Zo.Expanded?s=!1:s=!!t.collapsed,{...t,collapsible:n,collapsed:s,children:this.preserveCollapseState(t.children)}})}rerender(e){const t=this.getElementLocation(e);this.model.rerender(t)}getFirstElementChild(e=null){const t=this.getElementLocation(e);return this.model.getFirstElementChild(t)}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getElementLocation(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getElementLocation(e);return this.model.getListRenderCount(t)}isCollapsible(e){const t=this.getElementLocation(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getElementLocation(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getElementLocation(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getElementLocation(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getElementLocation(e);this.model.expandTo(t)}refilter(){this.model.refilter()}getNode(e=null){if(e===null)return this.model.getNode(this.model.rootRef);const t=this.nodes.get(e);if(!t)throw new Yo(this.user,`Tree element not found: ${e}`);return t}getNodeLocation(e){return e.element}getParentNodeLocation(e){if(e===null)throw new Yo(this.user,"Invalid getParentNodeLocation call");const t=this.nodes.get(e);if(!t)throw new Yo(this.user,`Tree element not found: ${e}`);const i=this.model.getNodeLocation(t),n=this.model.getParentNodeLocation(i);return this.model.getNode(n).element}getElementLocation(e){if(e===null)return[];const t=this.nodes.get(e);if(!t)throw new Yo(this.user,`Tree element not found: ${e}`);return this.model.getNodeLocation(t)}}function cI(o){const e=[o.element],t=o.incompressible||!1;return{element:{elements:e,incompressible:t},children:Ye.map(Ye.from(o.children),cI),collapsible:o.collapsible,collapsed:o.collapsed}}function dI(o){const e=[o.element],t=o.incompressible||!1;let i,n;for(;[n,i]=Ye.consume(Ye.from(o.children),2),!(n.length!==1||n[0].incompressible);)o=n[0],e.push(o.element);return{element:{elements:e,incompressible:t},children:Ye.map(Ye.concat(n,i),dI),collapsible:o.collapsible,collapsed:o.collapsed}}function s5(o,e=0){let t;return e<o.element.elements.length-1?t=[s5(o,e+1)]:t=Ye.map(Ye.from(o.children),i=>s5(i,0)),e===0&&o.element.incompressible?{element:o.element.elements[e],children:t,incompressible:!0,collapsible:o.collapsible,collapsed:o.collapsed}:{element:o.element.elements[e],children:t,collapsible:o.collapsible,collapsed:o.collapsed}}function wZ(o){return s5(o,0)}function SZ(o,e,t){return o.element===e?{...o,children:t}:{...o,children:Ye.map(Ye.from(o.children),i=>SZ(i,e,t))}}const jSe=o=>({getId(e){return e.elements.map(t=>o.getId(t).toString()).join("\0")}});class qSe{get onDidSpliceRenderedNodes(){return this.model.onDidSpliceRenderedNodes}get onDidSpliceModel(){return this.model.onDidSpliceModel}get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}get onDidChangeRenderNodeCount(){return this.model.onDidChangeRenderNodeCount}constructor(e,t={}){this.user=e,this.rootRef=null,this.nodes=new Map,this.model=new n5(e,t),this.enabled=typeof t.compressionEnabled>"u"?!0:t.compressionEnabled,this.identityProvider=t.identityProvider}setChildren(e,t=Ye.empty(),i){const n=i.diffIdentityProvider&&jSe(i.diffIdentityProvider);if(e===null){const g=Ye.map(t,this.enabled?dI:cI);this._setChildren(null,g,{diffIdentityProvider:n,diffDepth:1/0});return}const s=this.nodes.get(e);if(!s)throw new Yo(this.user,"Unknown compressed tree node");const r=this.model.getNode(s),a=this.model.getParentNodeLocation(s),l=this.model.getNode(a),c=wZ(r),d=SZ(c,e,t),h=(this.enabled?dI:cI)(d),u=i.diffIdentityProvider?((g,m)=>i.diffIdentityProvider.getId(g)===i.diffIdentityProvider.getId(m)):void 0;if(Ut(h.element.elements,r.element.elements,u)){this._setChildren(s,h.children||Ye.empty(),{diffIdentityProvider:n,diffDepth:1});return}const f=l.children.map(g=>g===r?h:g);this._setChildren(l.element,f,{diffIdentityProvider:n,diffDepth:r.depth-l.depth})}isCompressionEnabled(){return this.enabled}setCompressionEnabled(e){if(e===this.enabled)return;this.enabled=e;const i=this.model.getNode().children,n=Ye.map(i,wZ),s=Ye.map(n,e?dI:cI);this._setChildren(null,s,{diffIdentityProvider:this.identityProvider,diffDepth:1/0})}_setChildren(e,t,i){const n=new Set,s=a=>{for(const l of a.element.elements)n.add(l),this.nodes.set(l,a.element)},r=a=>{for(const l of a.element.elements)n.has(l)||this.nodes.delete(l)};this.model.setChildren(e,t,{...i,onDidCreateNode:s,onDidDeleteNode:r})}has(e){return this.nodes.has(e)}getListIndex(e){const t=this.getCompressedNode(e);return this.model.getListIndex(t)}getListRenderCount(e){const t=this.getCompressedNode(e);return this.model.getListRenderCount(t)}getNode(e){if(typeof e>"u")return this.model.getNode();const t=this.getCompressedNode(e);return this.model.getNode(t)}getNodeLocation(e){const t=this.model.getNodeLocation(e);return t===null?null:t.elements[t.elements.length-1]}getParentNodeLocation(e){const t=this.getCompressedNode(e),i=this.model.getParentNodeLocation(t);return i===null?null:i.elements[i.elements.length-1]}getFirstElementChild(e){const t=this.getCompressedNode(e);return this.model.getFirstElementChild(t)}isCollapsible(e){const t=this.getCompressedNode(e);return this.model.isCollapsible(t)}setCollapsible(e,t){const i=this.getCompressedNode(e);return this.model.setCollapsible(i,t)}isCollapsed(e){const t=this.getCompressedNode(e);return this.model.isCollapsed(t)}setCollapsed(e,t,i){const n=this.getCompressedNode(e);return this.model.setCollapsed(n,t,i)}expandTo(e){const t=this.getCompressedNode(e);this.model.expandTo(t)}rerender(e){const t=this.getCompressedNode(e);this.model.rerender(t)}refilter(){this.model.refilter()}getCompressedNode(e){if(e===null)return null;const t=this.nodes.get(e);if(!t)throw new Yo(this.user,`Tree element not found: ${e}`);return t}}const KSe=o=>o[o.length-1];class o5{get element(){return this.node.element===null?null:this.unwrapper(this.node.element)}get children(){return this.node.children.map(e=>new o5(this.unwrapper,e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e,t){this.unwrapper=e,this.node=t}}function GSe(o,e){return{...e,identityProvider:e.identityProvider&&{getId(t){return e.identityProvider.getId(o(t))}},sorter:e.sorter&&{compare(t,i){return e.sorter.compare(t.elements[0],i.elements[0])}},filter:e.filter&&{filter(t,i){const n=t.elements;for(let s=0;s<n.length-1;s++){const r=e.filter.filter(n[s],i);i=Wg(Vw(r)?r.visibility:r)}return e.filter.filter(n[n.length-1],i)}}}}class ZSe{get onDidSpliceModel(){return ie.map(this.model.onDidSpliceModel,({insertedNodes:e,deletedNodes:t})=>({insertedNodes:e.map(i=>this.nodeMapper.map(i)),deletedNodes:t.map(i=>this.nodeMapper.map(i))}))}get onDidSpliceRenderedNodes(){return ie.map(this.model.onDidSpliceRenderedNodes,({start:e,deleteCount:t,elements:i})=>({start:e,deleteCount:t,elements:i.map(n=>this.nodeMapper.map(n))}))}get onDidChangeCollapseState(){return ie.map(this.model.onDidChangeCollapseState,({node:e,deep:t})=>({node:this.nodeMapper.map(e),deep:t}))}get onDidChangeRenderNodeCount(){return ie.map(this.model.onDidChangeRenderNodeCount,e=>this.nodeMapper.map(e))}constructor(e,t={}){this.rootRef=null,this.elementMapper=t.elementMapper||KSe;const i=n=>this.elementMapper(n.elements);this.nodeMapper=new X4(n=>new o5(i,n)),this.model=new qSe(e,GSe(i,t))}setChildren(e,t=Ye.empty(),i={}){this.model.setChildren(e,t,i)}isCompressionEnabled(){return this.model.isCompressionEnabled()}setCompressionEnabled(e){this.model.setCompressionEnabled(e)}has(e){return this.model.has(e)}getListIndex(e){return this.model.getListIndex(e)}getListRenderCount(e){return this.model.getListRenderCount(e)}getNode(e){return this.nodeMapper.map(this.model.getNode(e))}getNodeLocation(e){return e.element}getParentNodeLocation(e){return this.model.getParentNodeLocation(e)}getFirstElementChild(e){const t=this.model.getFirstElementChild(e);return t===null||typeof t>"u"?t:this.elementMapper(t.elements)}isCollapsible(e){return this.model.isCollapsible(e)}setCollapsible(e,t){return this.model.setCollapsible(e,t)}isCollapsed(e){return this.model.isCollapsed(e)}setCollapsed(e,t,i){return this.model.setCollapsed(e,t,i)}expandTo(e){return this.model.expandTo(e)}rerender(e){return this.model.rerender(e)}refilter(){return this.model.refilter()}getCompressedTreeNode(e=null){return this.model.getNode(e)}}var YSe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class r5 extends vZ{get onDidChangeCollapseState(){return this.model.onDidChangeCollapseState}constructor(e,t,i,n,s={}){super(e,t,i,n,s),this.user=e}setChildren(e,t=Ye.empty(),i){this.model.setChildren(e,t,i)}rerender(e){if(e===void 0){this.view.rerender();return}this.model.rerender(e)}hasElement(e){return this.model.has(e)}createModel(e,t){return new n5(e,t)}}class yZ{get compressedTreeNodeProvider(){return this._compressedTreeNodeProvider()}constructor(e,t,i){this._compressedTreeNodeProvider=e,this.stickyScrollDelegate=t,this.renderer=i,this.templateId=i.templateId,i.onDidChangeTwistieState&&(this.onDidChangeTwistieState=i.onDidChangeTwistieState)}renderTemplate(e){return{compressedTreeNode:void 0,data:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){let s=this.stickyScrollDelegate.getCompressedNode(e);s||(s=this.compressedTreeNodeProvider.getCompressedTreeNode(e.element)),s.element.elements.length===1?(i.compressedTreeNode=void 0,this.renderer.renderElement(e,t,i.data,n)):(i.compressedTreeNode=s,this.renderer.renderCompressedElements(s,t,i.data,n))}disposeElement(e,t,i,n){i.compressedTreeNode?this.renderer.disposeCompressedElements?.(i.compressedTreeNode,t,i.data,n):this.renderer.disposeElement?.(e,t,i.data,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.data)}renderTwistie(e,t){return this.renderer.renderTwistie?.(e,t)??!1}}YSe([vi],yZ.prototype,"compressedTreeNodeProvider",null);class XSe{constructor(e){this.modelProvider=e,this.compressedStickyNodes=new Map}getCompressedNode(e){return this.compressedStickyNodes.get(e)}constrainStickyScrollNodes(e,t,i){if(this.compressedStickyNodes.clear(),e.length===0)return[];for(let n=0;n<e.length;n++){const s=e[n],r=s.position+s.height;if(n+1<e.length&&r+e[n+1].height>i||n>=t-1&&t<e.length){const l=e.slice(0,n),c=e.slice(n),d=this.compressStickyNodes(c);return[...l,d]}}return e}compressStickyNodes(e){if(e.length===0)throw new Error("Can't compress empty sticky nodes");const t=this.modelProvider();if(!t.isCompressionEnabled())return e[0];const i=[];for(let c=0;c<e.length;c++){const d=e[c],h=t.getCompressedTreeNode(d.node.element);if(h.element){if(c!==0&&h.element.incompressible)break;i.push(...h.element.elements)}}if(i.length<2)return e[0];const n=e[e.length-1],s={elements:i,incompressible:!1},r={...n.node,children:[],element:s},a=new Proxy(e[0].node,{}),l={node:a,startIndex:e[0].startIndex,endIndex:n.endIndex,position:e[0].position,height:e[0].height};return this.compressedStickyNodes.set(a,r),l}}function QSe(o,e){return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{getKeyboardNavigationLabel(t){let i;try{i=o().getCompressedTreeNode(t)}catch{return e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t)}return i.element.elements.length===1?e.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(t):e.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(i.element.elements)}}}}class LZ extends r5{constructor(e,t,i,n,s={}){const r=()=>this,a=new XSe(()=>this.model),l=n.map(c=>new yZ(r,a,c));super(e,t,i,l,{...QSe(r,s),stickyScrollDelegate:a})}setChildren(e,t=Ye.empty(),i){this.model.setChildren(e,t,i)}createModel(e,t){return new ZSe(e,t)}updateOptions(e={}){super.updateOptions(e),typeof e.compressionEnabled<"u"&&this.model.setCompressionEnabled(e.compressionEnabled)}getCompressedTreeNode(e=null){return this.model.getCompressedTreeNode(e)}}function a5(o){return{...o,children:[],refreshPromise:void 0,stale:!0,slow:!1,forceExpanded:!1}}function l5(o,e){return e.parent?e.parent===o?!0:l5(o,e.parent):!1}function JSe(o,e){return o===e||l5(o,e)||l5(e,o)}class c5{get element(){return this.node.element.element}get children(){return this.node.children.map(e=>new c5(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class eye{constructor(e,t,i){this.renderer=e,this.nodeMapper=t,this.onDidChangeTwistieState=i,this.renderedNodes=new Map,this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(...ve.asClassNameArray(Y.treeItemLoading)),!0):(t.classList.remove(...ve.asClassNameArray(Y.treeItemLoading)),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear()}}function xZ(o){return{browserEvent:o.browserEvent,elements:o.elements.map(e=>e.element)}}function kZ(o){return{browserEvent:o.browserEvent,element:o.element&&o.element.element,target:o.target}}class tye extends sw{constructor(e){super(e.elements.map(t=>t.element)),this.data=e}}function d5(o){return o instanceof sw?new tye(o):o}class iye{constructor(e){this.dnd=e}getDragURI(e){return this.dnd.getDragURI(e.element)}getDragLabel(e,t){if(this.dnd.getDragLabel)return this.dnd.getDragLabel(e.map(i=>i.element),t)}onDragStart(e,t){this.dnd.onDragStart?.(d5(e),t)}onDragOver(e,t,i,n,s,r=!0){return this.dnd.onDragOver(d5(e),t&&t.element,i,n,s)}drop(e,t,i,n,s){this.dnd.drop(d5(e),t&&t.element,i,n,s)}onDragEnd(e){this.dnd.onDragEnd?.(e)}dispose(){this.dnd.dispose()}}class nye extends mZ{constructor(e,t,i){super(t,i),this.findProvider=e,this.isFindSessionActive=!1}filter(e,t){const i=super.filter(e,t);if(!this.isFindSessionActive||this.findMode===Xo.Highlight||!this.findProvider.isVisible)return i;const n=Vw(i)?i.visibility:i;return Wg(n)===0?0:this.findProvider.isVisible(e)?i:0}}class sye extends _Z{constructor(e,t,i,n,s){super(e,i,n,s),this.findProvider=t,this.filter=i,this.activeSession=!1,this.asyncWorkInProgress=!1,this.disposables.add(ue(async()=>{this.activeSession&&await this.findProvider.endSession?.()}))}render(){if(this.asyncWorkInProgress||!this.activeFindMetadata)return;const e=this.activeFindMetadata.matchCount===0&&this.pattern.length>0;this.renderMessage(e),this.pattern.length&&this.alertResults(this.activeFindMetadata.matchCount)}shouldAllowFocus(e){return this.shouldFocusWhenNavigating(e)}shouldFocusWhenNavigating(e){if(!this.activeSession||!this.activeFindMetadata)return!0;const t=e.element?.element;return t&&this.activeFindMetadata.isMatch(t)?!0:!Jr.isDefault(e.filterData)}}function IZ(o){return o&&{...o,collapseByDefault:!0,identityProvider:o.identityProvider&&{getId(e){return o.identityProvider.getId(e.element)}},dnd:o.dnd&&new iye(o.dnd),multipleSelectionController:o.multipleSelectionController&&{isSelectionSingleChangeEvent(e){return o.multipleSelectionController.isSelectionSingleChangeEvent({...e,element:e.element})},isSelectionRangeChangeEvent(e){return o.multipleSelectionController.isSelectionRangeChangeEvent({...e,element:e.element})}},accessibilityProvider:o.accessibilityProvider&&{...o.accessibilityProvider,getPosInSet:void 0,getSetSize:void 0,getRole:o.accessibilityProvider.getRole?e=>o.accessibilityProvider.getRole(e.element):()=>"treeitem",isChecked:o.accessibilityProvider.isChecked?e=>!!o.accessibilityProvider?.isChecked(e.element):void 0,getAriaLabel(e){return o.accessibilityProvider.getAriaLabel(e.element)},getWidgetAriaLabel(){return o.accessibilityProvider.getWidgetAriaLabel()},getWidgetRole:o.accessibilityProvider.getWidgetRole?()=>o.accessibilityProvider.getWidgetRole():()=>"tree",getAriaLevel:o.accessibilityProvider.getAriaLevel&&(e=>o.accessibilityProvider.getAriaLevel(e.element)),getActiveDescendantId:o.accessibilityProvider.getActiveDescendantId&&(e=>o.accessibilityProvider.getActiveDescendantId(e.element))},filter:o.filter&&{filter(e,t){return o.filter.filter(e.element,t)}},keyboardNavigationLabelProvider:o.keyboardNavigationLabelProvider&&{...o.keyboardNavigationLabelProvider,getKeyboardNavigationLabel(e){return o.keyboardNavigationLabelProvider.getKeyboardNavigationLabel(e.element)}},sorter:void 0,expandOnlyOnTwistieClick:typeof o.expandOnlyOnTwistieClick>"u"?void 0:typeof o.expandOnlyOnTwistieClick!="function"?o.expandOnlyOnTwistieClick:(e=>o.expandOnlyOnTwistieClick(e.element)),defaultFindVisibility:e=>e.hasChildren&&e.stale?1:typeof o.defaultFindVisibility=="number"?o.defaultFindVisibility:typeof o.defaultFindVisibility>"u"?2:o.defaultFindVisibility(e.element)}}function h5(o,e){e(o),o.children.forEach(t=>h5(t,e))}class DZ{get onDidScroll(){return this.tree.onDidScroll}get onDidChangeFocus(){return ie.map(this.tree.onDidChangeFocus,xZ)}get onDidChangeSelection(){return ie.map(this.tree.onDidChangeSelection,xZ)}get onMouseDblClick(){return ie.map(this.tree.onMouseDblClick,kZ)}get onPointer(){return ie.map(this.tree.onPointer,kZ)}get onDidFocus(){return this.tree.onDidFocus}get onDidChangeModel(){return this.tree.onDidChangeModel}get onDidChangeCollapseState(){return this.tree.onDidChangeCollapseState}get onDidChangeStickyScrollFocused(){return this.tree.onDidChangeStickyScrollFocused}get onDidDispose(){return this.tree.onDidDispose}constructor(e,t,i,n,s,r={}){this.user=e,this.dataSource=s,this.nodes=new Map,this.subTreeRefreshPromises=new Map,this.refreshPromises=new Map,this._onDidRender=new P,this._onDidChangeNodeSlowState=new P,this.nodeMapper=new X4(c=>new c5(c)),this.disposables=new U,this.identityProvider=r.identityProvider,this.autoExpandSingleChildren=typeof r.autoExpandSingleChildren>"u"?!1:r.autoExpandSingleChildren,this.sorter=r.sorter,this.getDefaultCollapseState=c=>r.collapseByDefault?r.collapseByDefault(c)?Zo.PreserveOrCollapsed:Zo.PreserveOrExpanded:void 0;let a=!1,l;if(r.findProvider&&(r.findWidgetEnabled??!0)&&r.keyboardNavigationLabelProvider&&r.contextViewProvider&&(a=!0,l=new nye(r.findProvider,r.keyboardNavigationLabelProvider,r.filter)),this.tree=this.createTree(e,t,i,n,{...r,findWidgetEnabled:!a,filter:l??r.filter}),this.root=a5({element:void 0,parent:null,hasChildren:!0,defaultCollapseState:void 0}),this.identityProvider&&(this.root={...this.root,id:null}),this.nodes.set(null,this.root),this.tree.onDidChangeCollapseState(this._onDidChangeCollapseState,this,this.disposables),a){const c={styles:r.findWidgetStyles,showNotFoundMessage:r.showNotFoundMessage,defaultFindMatchType:r.defaultFindMatchType,defaultFindMode:r.defaultFindMode};this.findController=this.disposables.add(new sye(this.tree,r.findProvider,l,this.tree.options.contextViewProvider,c)),this.focusNavigationFilter=d=>this.findController.shouldFocusWhenNavigating(d),this.onDidChangeFindOpenState=this.findController.onDidChangeOpenState,this.onDidChangeFindMode=this.findController.onDidChangeMode,this.onDidChangeFindMatchType=this.findController.onDidChangeMatchType}else this.onDidChangeFindOpenState=this.tree.onDidChangeFindOpenState,this.onDidChangeFindMode=this.tree.onDidChangeFindMode,this.onDidChangeFindMatchType=this.tree.onDidChangeFindMatchType}createTree(e,t,i,n,s){const r=new e5(i),a=n.map(c=>new eye(c,this.nodeMapper,this._onDidChangeNodeSlowState.event)),l=IZ(s)||{};return new r5(e,t,r,a,l)}updateOptions(e={}){this.findController&&(e.defaultFindMode!==void 0&&(this.findController.mode=e.defaultFindMode),e.defaultFindMatchType!==void 0&&(this.findController.matchType=e.defaultFindMatchType)),this.tree.updateOptions(e)}getHTMLElement(){return this.tree.getHTMLElement()}get scrollTop(){return this.tree.scrollTop}set scrollTop(e){this.tree.scrollTop=e}get scrollHeight(){return this.tree.scrollHeight}get renderHeight(){return this.tree.renderHeight}domFocus(){this.tree.domFocus()}layout(e,t){this.tree.layout(e,t)}style(e){this.tree.style(e)}getInput(){return this.root.element}async setInput(e,t){this.cancelAllRefreshPromises(),this.root.element=e;const i=t&&{viewState:t,focus:[],selection:[]};await this._updateChildren(e,!0,!1,i),i&&(this.tree.setFocus(i.focus),this.tree.setSelection(i.selection)),t&&typeof t.scrollTop=="number"&&(this.scrollTop=t.scrollTop)}cancelAllRefreshPromises(e=!1){this.refreshPromises.forEach(t=>t.cancel()),this.refreshPromises.clear(),e&&(this.subTreeRefreshPromises.forEach(t=>t.cancel()),this.subTreeRefreshPromises.clear())}async _updateChildren(e=this.root.element,t=!0,i=!1,n,s){if(typeof this.root.element>"u")throw new Yo(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event));const r=this.getDataNode(e);if(await this.refreshAndRenderNode(r,t,n,s),i)try{this.tree.rerender(r)}catch{}}rerender(e){if(e===void 0||e===this.root.element){this.tree.rerender();return}const t=this.getDataNode(e);this.tree.rerender(t)}getNode(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getNode(t===this.root?null:t);return this.nodeMapper.map(i)}collapse(e,t=!1){const i=this.getDataNode(e);return this.tree.collapse(i===this.root?null:i,t)}async expand(e,t=!1){if(typeof this.root.element>"u")throw new Yo(this.user,"Tree input not set");this.root.refreshPromise&&(await this.root.refreshPromise,await ie.toPromise(this._onDidRender.event));const i=this.getDataNode(e);if(this.tree.hasElement(i)&&!this.tree.isCollapsible(i)||(i.refreshPromise&&(await i.refreshPromise,await ie.toPromise(this._onDidRender.event)),i!==this.root&&!i.refreshPromise&&!this.tree.isCollapsed(i)))return!1;const n=this.tree.expand(i===this.root?null:i,t);return i.refreshPromise&&(await i.refreshPromise,await ie.toPromise(this._onDidRender.event)),n}setSelection(e,t){const i=e.map(n=>this.getDataNode(n));this.tree.setSelection(i,t)}getSelection(){return this.tree.getSelection().map(t=>t.element)}setFocus(e,t){const i=e.map(n=>this.getDataNode(n));this.tree.setFocus(i,t)}getFocus(){return this.tree.getFocus().map(t=>t.element)}reveal(e,t){this.tree.reveal(this.getDataNode(e),t)}getParentElement(e){const t=this.tree.getParentElement(this.getDataNode(e));return t&&t.element}getFirstElementChild(e=this.root.element){const t=this.getDataNode(e),i=this.tree.getFirstElementChild(t===this.root?null:t);return i&&i.element}getDataNode(e){const t=this.nodes.get(e===this.root.element?null:e);if(!t){const i=this.identityProvider?.getId(e).toString();throw new Yo(this.user,`Data tree node not found${i?`: ${i}`:""}`)}return t}async refreshAndRenderNode(e,t,i,n){this.disposables.isDisposed||(await this.refreshNode(e,t,i),!this.disposables.isDisposed&&this.render(e,i,n))}async refreshNode(e,t,i){let n;if(this.subTreeRefreshPromises.forEach((s,r)=>{!n&&JSe(r,e)&&(n=s.then(()=>this.refreshNode(e,t,i)))}),n)return n;if(e!==this.root&&this.tree.getNode(e).collapsed){e.hasChildren=!!this.dataSource.hasChildren(e.element),e.stale=!0,this.setChildren(e,[],t,i);return}return this.doRefreshSubTree(e,t,i)}async doRefreshSubTree(e,t,i){const n=Vi(async()=>{const s=await this.doRefreshNode(e,t,i);e.stale=!1,await o1.settled(s.map(r=>this.doRefreshSubTree(r,t,i)))});return e.refreshPromise=n,this.subTreeRefreshPromises.set(e,n),n.finally(()=>{e.refreshPromise=void 0,this.subTreeRefreshPromises.delete(e)}),n}async doRefreshNode(e,t,i){e.hasChildren=!!this.dataSource.hasChildren(e.element);let n;if(!e.hasChildren)n=Promise.resolve(Ye.empty());else{const s=this.doGetChildren(e);if(GT(s))n=Promise.resolve(s);else{const r=al(800);r.then(()=>{e.slow=!0,this._onDidChangeNodeSlowState.fire(e)},a=>null),n=s.finally(()=>r.cancel())}}try{const s=await n;return this.setChildren(e,s,t,i)}catch(s){if(e!==this.root&&this.tree.hasElement(e)&&this.tree.collapse(e),Do(s))return[];throw s}finally{e.slow&&(e.slow=!1,this._onDidChangeNodeSlowState.fire(e))}}doGetChildren(e){let t=this.refreshPromises.get(e);if(t)return t;const i=this.dataSource.getChildren(e.element);return GT(i)?this.processChildren(i):(t=Vi(async()=>this.processChildren(await i)),this.refreshPromises.set(e,t),t.finally(()=>{this.refreshPromises.delete(e)}))}_onDidChangeCollapseState({node:e,deep:t}){e.element!==null&&!e.collapsed&&e.element.stale&&(t?this.collapse(e.element.element):this.refreshAndRenderNode(e.element,!1).catch(Ee))}setChildren(e,t,i,n){const s=[...t];if(e.children.length===0&&s.length===0)return[];const r=new Map,a=new Map;for(const d of e.children)r.set(d.element,d),this.identityProvider&&a.set(d.id,{node:d,collapsed:this.tree.hasElement(d)&&this.tree.isCollapsed(d)});const l=[],c=s.map(d=>{const h=!!this.dataSource.hasChildren(d);if(!this.identityProvider){const m=a5({element:d,parent:e,hasChildren:h,defaultCollapseState:this.getDefaultCollapseState(d)});return h&&m.defaultCollapseState===Zo.PreserveOrExpanded&&l.push(m),m}const u=this.identityProvider.getId(d).toString(),f=a.get(u);if(f){const m=f.node;return r.delete(m.element),this.nodes.delete(m.element),this.nodes.set(d,m),m.element=d,m.hasChildren=h,i?f.collapsed?(m.children.forEach(_=>h5(_,b=>this.nodes.delete(b.element))),m.children.splice(0,m.children.length),m.stale=!0):l.push(m):h&&!f.collapsed&&l.push(m),m}const g=a5({element:d,parent:e,id:u,hasChildren:h,defaultCollapseState:this.getDefaultCollapseState(d)});return n&&n.viewState.focus&&n.viewState.focus.indexOf(u)>-1&&n.focus.push(g),n&&n.viewState.selection&&n.viewState.selection.indexOf(u)>-1&&n.selection.push(g),(n&&n.viewState.expanded&&n.viewState.expanded.indexOf(u)>-1||h&&g.defaultCollapseState===Zo.PreserveOrExpanded)&&l.push(g),g});for(const d of r.values())h5(d,h=>this.nodes.delete(h.element));for(const d of c)this.nodes.set(d.element,d);return by(e.children,0,e.children.length,c),e!==this.root&&this.autoExpandSingleChildren&&c.length===1&&l.length===0&&(c[0].forceExpanded=!0,l.push(c[0])),l}render(e,t,i){const n=e.children.map(r=>this.asTreeElement(r,t)),s=i&&{...i,diffIdentityProvider:i.diffIdentityProvider&&{getId(r){return i.diffIdentityProvider.getId(r.element)}}};this.tree.setChildren(e===this.root?null:e,n,s),e!==this.root&&this.tree.setCollapsible(e,e.hasChildren),this._onDidRender.fire()}asTreeElement(e,t){if(e.stale)return{element:e,collapsible:e.hasChildren,collapsed:!0};let i;return t&&t.viewState.expanded&&e.id&&t.viewState.expanded.indexOf(e.id)>-1?i=!1:e.forceExpanded?(i=!1,e.forceExpanded=!1):i=e.defaultCollapseState,{element:e,children:e.hasChildren?Ye.map(e.children,n=>this.asTreeElement(n,t)):[],collapsible:e.hasChildren,collapsed:i}}processChildren(e){return this.sorter&&(e=[...e].sort(this.sorter.compare.bind(this.sorter))),e}dispose(){this.disposables.dispose(),this.tree.dispose()}}class u5{get element(){return{elements:this.node.element.elements.map(e=>e.element),incompressible:this.node.element.incompressible}}get children(){return this.node.children.map(e=>new u5(e))}get depth(){return this.node.depth}get visibleChildrenCount(){return this.node.visibleChildrenCount}get visibleChildIndex(){return this.node.visibleChildIndex}get collapsible(){return this.node.collapsible}get collapsed(){return this.node.collapsed}get visible(){return this.node.visible}get filterData(){return this.node.filterData}constructor(e){this.node=e}}class oye{constructor(e,t,i,n){this.renderer=e,this.nodeMapper=t,this.compressibleNodeMapperProvider=i,this.onDidChangeTwistieState=n,this.renderedNodes=new Map,this.disposables=[],this.templateId=e.templateId}renderTemplate(e){return{templateData:this.renderer.renderTemplate(e)}}renderElement(e,t,i,n){this.renderer.renderElement(this.nodeMapper.map(e),t,i.templateData,n)}renderCompressedElements(e,t,i,n){this.renderer.renderCompressedElements(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}renderTwistie(e,t){return e.slow?(t.classList.add(...ve.asClassNameArray(Y.treeItemLoading)),!0):(t.classList.remove(...ve.asClassNameArray(Y.treeItemLoading)),!1)}disposeElement(e,t,i,n){this.renderer.disposeElement?.(this.nodeMapper.map(e),t,i.templateData,n)}disposeCompressedElements(e,t,i,n){this.renderer.disposeCompressedElements?.(this.compressibleNodeMapperProvider().map(e),t,i.templateData,n)}disposeTemplate(e){this.renderer.disposeTemplate(e.templateData)}dispose(){this.renderedNodes.clear(),this.disposables=pt(this.disposables)}}function rye(o){const e=o&&IZ(o);return e&&{...e,keyboardNavigationLabelProvider:e.keyboardNavigationLabelProvider&&{...e.keyboardNavigationLabelProvider,getCompressedNodeKeyboardNavigationLabel(t){return o.keyboardNavigationLabelProvider.getCompressedNodeKeyboardNavigationLabel(t.map(i=>i.element))}}}}class aye extends DZ{constructor(e,t,i,n,s,r,a={}){super(e,t,i,s,r,a),this.compressionDelegate=n,this.compressibleNodeMapper=new X4(l=>new u5(l)),this.filter=a.filter}createTree(e,t,i,n,s){const r=new e5(i),a=n.map(c=>new oye(c,this.nodeMapper,()=>this.compressibleNodeMapper,this._onDidChangeNodeSlowState.event)),l=rye(s)||{};return new LZ(e,t,r,a,l)}asTreeElement(e,t){return{incompressible:this.compressionDelegate.isIncompressible(e.element),...super.asTreeElement(e,t)}}render(e,t,i){if(!this.identityProvider)return super.render(e,t);const n=f=>this.identityProvider.getId(f).toString(),s=f=>{const g=new Set;for(const m of f){const _=this.tree.getCompressedTreeNode(m===this.root?null:m);if(_.element)for(const b of _.element.elements)g.add(n(b.element))}return g},r=s(this.tree.getSelection()),a=s(this.tree.getFocus());super.render(e,t,i);const l=this.getSelection();let c=!1;const d=this.getFocus();let h=!1;const u=f=>{const g=f.element;if(g)for(let m=0;m<g.elements.length;m++){const _=n(g.elements[m].element),b=g.elements[g.elements.length-1].element;r.has(_)&&l.indexOf(b)===-1&&(l.push(b),c=!0),a.has(_)&&d.indexOf(b)===-1&&(d.push(b),h=!0)}f.children.forEach(u)};u(this.tree.getCompressedTreeNode(e===this.root?null:e)),c&&this.setSelection(l),h&&this.setFocus(d)}processChildren(e){return this.filter&&(e=Ye.filter(e,t=>{const i=this.filter.filter(t,1),n=lye(i);if(n===2)throw new Error("Recursive tree visibility not supported in async data compressed trees");return n===1})),super.processChildren(e)}}function lye(o){return typeof o=="boolean"?o?1:0:Vw(o)?Wg(o.visibility):Wg(o)}class cye extends vZ{constructor(e,t,i,n,s,r={}){super(e,t,i,n,r),this.user=e,this.dataSource=s,this.identityProvider=r.identityProvider}createModel(e,t){return new n5(e,t)}}new ae("isMac",ze,p(1669,"Whether the operating system is macOS")),new ae("isLinux",Ws,p(1670,"Whether the operating system is Linux"));const hI=new ae("isWindows",gn,p(1671,"Whether the operating system is Windows")),EZ=new ae("isWeb",ol,p(1672,"Whether the platform is a web browser"));new ae("isMacNative",ze&&!ol,p(1673,"Whether the operating system is macOS on a non-browser platform")),new ae("isIOS",ur,p(1674,"Whether the operating system is iOS")),new ae("isMobile",FB,p(1675,"Whether the platform is a mobile web browser")),new ae("isDevelopment",!1,!0),new ae("productQualityType","",p(1676,"Quality type of VS Code"));const NZ="inputFocus",f5=new ae(NZ,!1,p(1677,"Whether keyboard focus is inside an input box"));var wd=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ht=function(o,e){return function(t,i){e(t,i,o)}};const Fr=We("listService");class dye{get lastFocusedList(){return this._lastFocusedWidget}constructor(){this.disposables=new U,this.lists=[],this._lastFocusedWidget=void 0}setLastFocusedList(e){e!==this._lastFocusedWidget&&(this._lastFocusedWidget?.getHTMLElement().classList.remove("last-focused"),this._lastFocusedWidget=e,this._lastFocusedWidget?.getHTMLElement().classList.add("last-focused"))}register(e,t){if(this.lists.some(n=>n.widget===e))throw new Error("Cannot register the same widget multiple times");const i={widget:e,extraContextKeys:t};return this.lists.push(i),Iy(e.getHTMLElement())&&this.setLastFocusedList(e),jr(e.onDidFocus(()=>this.setLastFocusedList(e)),ue(()=>this.lists.splice(this.lists.indexOf(i),1)),e.onDidDispose(()=>{this.lists=this.lists.filter(n=>n!==i),this._lastFocusedWidget===e&&this.setLastFocusedList(void 0)}))}dispose(){this.disposables.dispose()}}const zw=new ae("listScrollAtBoundary","none");K.or(zw.isEqualTo("top"),zw.isEqualTo("both")),K.or(zw.isEqualTo("bottom"),zw.isEqualTo("both"));const TZ=new ae("listFocus",!0),RZ=new ae("treestickyScrollFocused",!1),uI=new ae("listSupportsMultiselect",!0),MZ=K.and(TZ,K.not(NZ),RZ.negate()),g5=new ae("listHasSelectionOrFocus",!1),p5=new ae("listDoubleSelection",!1),m5=new ae("listMultiSelection",!1),fI=new ae("listSelectionNavigation",!1),hye=new ae("listSupportsFind",!0),_5=new ae("treeElementCanCollapse",!1),uye=new ae("treeElementHasParent",!1),b5=new ae("treeElementCanExpand",!1),fye=new ae("treeElementHasChild",!1),gye=new ae("treeFindOpen",!1),PZ="listTypeNavigationMode",AZ="listAutomaticKeyboardNavigation";function gI(o,e){const t=o.createScoped(e.getHTMLElement());return TZ.bindTo(t),t}function pI(o,e){const t=zw.bindTo(o),i=()=>{const n=e.scrollTop===0,s=e.scrollHeight-e.renderHeight-e.scrollTop<1;n&&s?t.set("both"):n?t.set("top"):s?t.set("bottom"):t.set("none")};return i(),e.onDidScroll(i)}const Hg="workbench.list.multiSelectModifier",mI="workbench.list.openMode",Wr="workbench.list.horizontalScrolling",C5="workbench.list.defaultFindMode",v5="workbench.list.typeNavigationMode",_I="workbench.list.keyboardNavigation",$a="workbench.list.scrollByPage",w5="workbench.list.defaultFindMatchType",Uw="workbench.tree.indent",bI="workbench.tree.renderIndentGuides",ja="workbench.list.smoothScrolling",ql="workbench.list.mouseWheelScrollSensitivity",Kl="workbench.list.fastScrollSensitivity",CI="workbench.tree.expandMode",vI="workbench.tree.enableStickyScroll",wI="workbench.tree.stickyScrollMaxItemCount";function Gl(o){return o.getValue(Hg)==="alt"}class pye extends A{constructor(e){super(),this.configurationService=e,this.useAltAsMultipleSelectionModifier=Gl(e),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>{e.affectsConfiguration(Hg)&&(this.useAltAsMultipleSelectionModifier=Gl(this.configurationService))}))}isSelectionSingleChangeEvent(e){return this.useAltAsMultipleSelectionModifier?e.browserEvent.altKey:cq(e)}isSelectionRangeChangeEvent(e){return dq(e)}}function SI(o,e){const t=o.get(Me),i=o.get(ot),n=new U;return[{...e,keyboardNavigationDelegate:{mightProducePrintableCharacter(r){return i.mightProducePrintableCharacter(r)}},smoothScrolling:!!t.getValue(ja),mouseWheelScrollSensitivity:t.getValue(ql),fastScrollSensitivity:t.getValue(Kl),multipleSelectionController:e.multipleSelectionController??n.add(new pye(t)),keyboardNavigationEventFilter:bye(i),scrollByPage:!!t.getValue($a)},n]}let OZ=class extends jo{constructor(e,t,i,n,s,r,a,l,c){const d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Wr),[h,u]=c.invokeFunction(SI,s);super(e,t,i,n,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables.add(u),this.contextKeyService=gI(r,this),this.disposables.add(pI(this.contextKeyService,this)),this.listSupportsMultiSelect=uI.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),fI.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this.listHasSelectionOrFocus=g5.bindTo(this.contextKeyService),this.listDoubleSelection=p5.bindTo(this.contextKeyService),this.listMultiSelection=m5.bindTo(this.contextKeyService),this.horizontalScrolling=s.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Gl(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const g=this.getSelection(),m=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(g.length>0||m.length>0),this.listMultiSelection.set(g.length>1),this.listDoubleSelection.set(g.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const g=this.getSelection(),m=this.getFocus();this.listHasSelectionOrFocus.set(g.length>0||m.length>0)})),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(Hg)&&(this._useAltAsMultipleSelectionModifier=Gl(l));let m={};if(g.affectsConfiguration(Wr)&&this.horizontalScrolling===void 0){const _=!!l.getValue(Wr);m={...m,horizontalScrolling:_}}if(g.affectsConfiguration($a)){const _=!!l.getValue($a);m={...m,scrollByPage:_}}if(g.affectsConfiguration(ja)){const _=!!l.getValue(ja);m={...m,smoothScrolling:_}}if(g.affectsConfiguration(ql)){const _=l.getValue(ql);m={...m,mouseWheelScrollSensitivity:_}}if(g.affectsConfiguration(Kl)){const _=l.getValue(Kl);m={...m,fastScrollSensitivity:_}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new BZ(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?vg(e):Y_)}};OZ=wd([Ht(5,xe),Ht(6,Fr),Ht(7,Me),Ht(8,ge)],OZ);let FZ=class extends dSe{constructor(e,t,i,n,s,r,a,l,c){const d=typeof s.horizontalScrolling<"u"?s.horizontalScrolling:!!l.getValue(Wr),[h,u]=c.invokeFunction(SI,s);super(e,t,i,n,{keyboardSupport:!1,...h,horizontalScrolling:d}),this.disposables=new U,this.disposables.add(u),this.contextKeyService=gI(r,this),this.disposables.add(pI(this.contextKeyService,this.widget)),this.horizontalScrolling=s.horizontalScrolling,this.listSupportsMultiSelect=uI.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(s.multipleSelectionSupport!==!1),fI.bindTo(this.contextKeyService).set(!!s.selectionNavigation),this._useAltAsMultipleSelectionModifier=Gl(l),this.disposables.add(this.contextKeyService),this.disposables.add(a.register(this)),this.updateStyles(s.overrideStyles),this.disposables.add(l.onDidChangeConfiguration(g=>{g.affectsConfiguration(Hg)&&(this._useAltAsMultipleSelectionModifier=Gl(l));let m={};if(g.affectsConfiguration(Wr)&&this.horizontalScrolling===void 0){const _=!!l.getValue(Wr);m={...m,horizontalScrolling:_}}if(g.affectsConfiguration($a)){const _=!!l.getValue($a);m={...m,scrollByPage:_}}if(g.affectsConfiguration(ja)){const _=!!l.getValue(ja);m={...m,smoothScrolling:_}}if(g.affectsConfiguration(ql)){const _=l.getValue(ql);m={...m,mouseWheelScrollSensitivity:_}}if(g.affectsConfiguration(Kl)){const _=l.getValue(Kl);m={...m,fastScrollSensitivity:_}}Object.keys(m).length>0&&this.updateOptions(m)})),this.navigator=new BZ(this,{configurationService:l,...s}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?vg(e):Y_)}dispose(){this.disposables.dispose(),super.dispose()}};FZ=wd([Ht(5,xe),Ht(6,Fr),Ht(7,Me),Ht(8,ge)],FZ);let WZ=class extends Z4{constructor(e,t,i,n,s,r,a,l,c,d){const h=typeof r.horizontalScrolling<"u"?r.horizontalScrolling:!!c.getValue(Wr),[u,f]=d.invokeFunction(SI,r);super(e,t,i,n,s,{keyboardSupport:!1,...u,horizontalScrolling:h}),this.disposables.add(f),this.contextKeyService=gI(a,this),this.disposables.add(pI(this.contextKeyService,this)),this.listSupportsMultiSelect=uI.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(r.multipleSelectionSupport!==!1),fI.bindTo(this.contextKeyService).set(!!r.selectionNavigation),this.listHasSelectionOrFocus=g5.bindTo(this.contextKeyService),this.listDoubleSelection=p5.bindTo(this.contextKeyService),this.listMultiSelection=m5.bindTo(this.contextKeyService),this.horizontalScrolling=r.horizontalScrolling,this._useAltAsMultipleSelectionModifier=Gl(c),this.disposables.add(this.contextKeyService),this.disposables.add(l.register(this)),this.updateStyles(r.overrideStyles),this.disposables.add(this.onDidChangeSelection(()=>{const m=this.getSelection(),_=this.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.listHasSelectionOrFocus.set(m.length>0||_.length>0),this.listMultiSelection.set(m.length>1),this.listDoubleSelection.set(m.length===2)})})),this.disposables.add(this.onDidChangeFocus(()=>{const m=this.getSelection(),_=this.getFocus();this.listHasSelectionOrFocus.set(m.length>0||_.length>0)})),this.disposables.add(c.onDidChangeConfiguration(m=>{m.affectsConfiguration(Hg)&&(this._useAltAsMultipleSelectionModifier=Gl(c));let _={};if(m.affectsConfiguration(Wr)&&this.horizontalScrolling===void 0){const b=!!c.getValue(Wr);_={..._,horizontalScrolling:b}}if(m.affectsConfiguration($a)){const b=!!c.getValue($a);_={..._,scrollByPage:b}}if(m.affectsConfiguration(ja)){const b=!!c.getValue(ja);_={..._,smoothScrolling:b}}if(m.affectsConfiguration(ql)){const b=c.getValue(ql);_={..._,mouseWheelScrollSensitivity:b}}if(m.affectsConfiguration(Kl)){const b=c.getValue(Kl);_={..._,fastScrollSensitivity:b}}Object.keys(_).length>0&&this.updateOptions(_)})),this.navigator=new mye(this,{configurationService:c,...r}),this.disposables.add(this.navigator)}updateOptions(e){super.updateOptions(e),e.overrideStyles!==void 0&&this.updateStyles(e.overrideStyles),e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyles(e){this.style(e?vg(e):Y_)}dispose(){this.disposables.dispose(),super.dispose()}};WZ=wd([Ht(6,xe),Ht(7,Fr),Ht(8,Me),Ht(9,ge)],WZ);class S5 extends A{constructor(e,t){super(),this.widget=e,this._onDidOpen=this._register(new P),this.onDidOpen=this._onDidOpen.event,this._register(ie.filter(this.widget.onDidChangeSelection,i=>Mc(i.browserEvent))(i=>this.onSelectionFromKeyboard(i))),this._register(this.widget.onPointer(i=>this.onPointer(i.element,i.browserEvent))),this._register(this.widget.onMouseDblClick(i=>this.onMouseDblClick(i.element,i.browserEvent))),typeof t?.openOnSingleClick!="boolean"&&t?.configurationService?(this.openOnSingleClick=t?.configurationService.getValue(mI)!=="doubleClick",this._register(t?.configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(mI)&&(this.openOnSingleClick=t?.configurationService.getValue(mI)!=="doubleClick")}))):this.openOnSingleClick=t?.openOnSingleClick??!0}onSelectionFromKeyboard(e){if(e.elements.length!==1)return;const t=e.browserEvent,i=typeof t.preserveFocus=="boolean"?t.preserveFocus:!0,n=typeof t.pinned=="boolean"?t.pinned:!i;this._open(this.getSelectedElement(),i,n,!1,e.browserEvent)}onPointer(e,t){if(!this.openOnSingleClick||t.detail===2)return;const n=t.button===1,s=!0,r=n,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}onMouseDblClick(e,t){if(!t)return;const i=t.target;if(i.classList.contains("monaco-tl-twistie")||i.classList.contains("monaco-icon-label")&&i.classList.contains("folder-icon")&&t.offsetX<16)return;const s=!1,r=!0,a=t.ctrlKey||t.metaKey||t.altKey;this._open(e,s,r,a,t)}_open(e,t,i,n,s){e&&this._onDidOpen.fire({editorOptions:{preserveFocus:t,pinned:i,revealIfVisible:!0},sideBySide:n,element:e,browserEvent:s})}}class BZ extends S5{constructor(e,t){super(e,t),this.widget=e}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class mye extends S5{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelectedElements()[0]}}class _ye extends S5{constructor(e,t){super(e,t)}getSelectedElement(){return this.widget.getSelection()[0]??void 0}}function bye(o){let e=!1;return t=>{if(t.toKeyCodeChord().isModifierKey())return!1;if(e)return e=!1,!1;const i=o.softDispatch(t,t.target);return i.kind===1?(e=!0,!1):(e=!1,i.kind===0)}}let yI=class extends r5{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,n,s,r,a,l,c){const{options:d,getTypeNavigationMode:h,disposable:u}=r.invokeFunction($w,s);super(e,t,i,n,d),this.disposables.add(u),this.internals=new Vg(this,s,h,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};yI=wd([Ht(5,ge),Ht(6,xe),Ht(7,Fr),Ht(8,Me)],yI);let HZ=class extends LZ{constructor(e,t,i,n,s,r,a,l,c){const{options:d,getTypeNavigationMode:h,disposable:u}=r.invokeFunction($w,s);super(e,t,i,n,d),this.disposables.add(u),this.internals=new Vg(this,s,h,s.overrideStyles,a,l,c),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};HZ=wd([Ht(5,ge),Ht(6,xe),Ht(7,Fr),Ht(8,Me)],HZ);let VZ=class extends cye{constructor(e,t,i,n,s,r,a,l,c,d){const{options:h,getTypeNavigationMode:u,disposable:f}=a.invokeFunction($w,r);super(e,t,i,n,s,h),this.disposables.add(f),this.internals=new Vg(this,r,u,r.overrideStyles,l,c,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles!==void 0&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};VZ=wd([Ht(6,ge),Ht(7,xe),Ht(8,Fr),Ht(9,Me)],VZ);let y5=class extends DZ{get onDidOpen(){return this.internals.onDidOpen}constructor(e,t,i,n,s,r,a,l,c,d){const{options:h,getTypeNavigationMode:u,disposable:f}=a.invokeFunction($w,r);super(e,t,i,n,s,h),this.disposables.add(f),this.internals=new Vg(this,r,u,r.overrideStyles,l,c,d),this.disposables.add(this.internals)}updateOptions(e={}){super.updateOptions(e),e.overrideStyles&&this.internals.updateStyleOverrides(e.overrideStyles),this.internals.updateOptions(e)}};y5=wd([Ht(6,ge),Ht(7,xe),Ht(8,Fr),Ht(9,Me)],y5);let zZ=class extends aye{constructor(e,t,i,n,s,r,a,l,c,d,h){const{options:u,getTypeNavigationMode:f,disposable:g}=l.invokeFunction($w,a);super(e,t,i,n,s,r,u),this.disposables.add(g),this.internals=new Vg(this,a,f,a.overrideStyles,c,d,h),this.disposables.add(this.internals)}updateOptions(e){super.updateOptions(e),this.internals.updateOptions(e)}};zZ=wd([Ht(7,ge),Ht(8,xe),Ht(9,Fr),Ht(10,Me)],zZ);function UZ(o){const e=o.getValue(C5);if(e==="highlight")return Xo.Highlight;if(e==="filter")return Xo.Filter;const t=o.getValue(_I);if(t==="simple"||t==="highlight")return Xo.Highlight;if(t==="filter")return Xo.Filter}function $Z(o){const e=o.getValue(w5);if(e==="fuzzy")return Ua.Fuzzy;if(e==="contiguous")return Ua.Contiguous}function $w(o,e){const t=o.get(Me),i=o.get(hd),n=o.get(xe),s=o.get(ge),r=()=>{const u=n.getContextKeyValue(PZ);if(u==="automatic")return Fl.Automatic;if(u==="trigger"||n.getContextKeyValue(AZ)===!1)return Fl.Trigger;const g=t.getValue(v5);if(g==="automatic")return Fl.Automatic;if(g==="trigger")return Fl.Trigger},a=e.horizontalScrolling!==void 0?e.horizontalScrolling:!!t.getValue(Wr),[l,c]=s.invokeFunction(SI,e),d=e.paddingBottom,h=e.renderIndentGuides!==void 0?e.renderIndentGuides:t.getValue(bI);return{getTypeNavigationMode:r,disposable:c,options:{keyboardSupport:!1,...l,indent:typeof t.getValue(Uw)=="number"?t.getValue(Uw):void 0,renderIndentGuides:h,smoothScrolling:!!t.getValue(ja),defaultFindMode:UZ(t),defaultFindMatchType:$Z(t),horizontalScrolling:a,scrollByPage:!!t.getValue($a),paddingBottom:d,hideTwistiesOfChildlessElements:e.hideTwistiesOfChildlessElements,expandOnlyOnTwistieClick:e.expandOnlyOnTwistieClick??t.getValue(CI)==="doubleClick",contextViewProvider:i,findWidgetStyles:H1e,enableStickyScroll:!!t.getValue(vI),stickyScrollMaxItemCount:Number(t.getValue(wI))}}}let Vg=class{get onDidOpen(){return this.navigator.onDidOpen}constructor(e,t,i,n,s,r,a){this.tree=e,this.disposables=[],this.contextKeyService=gI(s,e),this.disposables.push(pI(this.contextKeyService,e)),this.listSupportsMultiSelect=uI.bindTo(this.contextKeyService),this.listSupportsMultiSelect.set(t.multipleSelectionSupport!==!1),fI.bindTo(this.contextKeyService).set(!!t.selectionNavigation),this.listSupportFindWidget=hye.bindTo(this.contextKeyService),this.listSupportFindWidget.set(t.findWidgetEnabled??!0),this.hasSelectionOrFocus=g5.bindTo(this.contextKeyService),this.hasDoubleSelection=p5.bindTo(this.contextKeyService),this.hasMultiSelection=m5.bindTo(this.contextKeyService),this.treeElementCanCollapse=_5.bindTo(this.contextKeyService),this.treeElementHasParent=uye.bindTo(this.contextKeyService),this.treeElementCanExpand=b5.bindTo(this.contextKeyService),this.treeElementHasChild=fye.bindTo(this.contextKeyService),this.treeFindOpen=gye.bindTo(this.contextKeyService),this.treeStickyScrollFocused=RZ.bindTo(this.contextKeyService),this._useAltAsMultipleSelectionModifier=Gl(a),this.updateStyleOverrides(n);const c=()=>{const h=e.getFocus()[0];if(!h)return;const u=e.getNode(h);this.treeElementCanCollapse.set(u.collapsible&&!u.collapsed),this.treeElementHasParent.set(!!e.getParentElement(h)),this.treeElementCanExpand.set(u.collapsible&&u.collapsed),this.treeElementHasChild.set(!!e.getFirstElementChild(h))},d=new Set;d.add(PZ),d.add(AZ),this.disposables.push(this.contextKeyService,r.register(e),e.onDidChangeSelection(()=>{const h=e.getSelection(),u=e.getFocus();this.contextKeyService.bufferChangeEvents(()=>{this.hasSelectionOrFocus.set(h.length>0||u.length>0),this.hasMultiSelection.set(h.length>1),this.hasDoubleSelection.set(h.length===2)})}),e.onDidChangeFocus(()=>{const h=e.getSelection(),u=e.getFocus();this.hasSelectionOrFocus.set(h.length>0||u.length>0),c()}),e.onDidChangeCollapseState(c),e.onDidChangeModel(c),e.onDidChangeFindOpenState(h=>this.treeFindOpen.set(h)),e.onDidChangeStickyScrollFocused(h=>this.treeStickyScrollFocused.set(h)),a.onDidChangeConfiguration(h=>{let u={};if(h.affectsConfiguration(Hg)&&(this._useAltAsMultipleSelectionModifier=Gl(a)),h.affectsConfiguration(Uw)){const f=a.getValue(Uw);u={...u,indent:f}}if(h.affectsConfiguration(bI)&&t.renderIndentGuides===void 0){const f=a.getValue(bI);u={...u,renderIndentGuides:f}}if(h.affectsConfiguration(ja)){const f=!!a.getValue(ja);u={...u,smoothScrolling:f}}if(h.affectsConfiguration(C5)||h.affectsConfiguration(_I)){const f=UZ(a);u={...u,defaultFindMode:f}}if(h.affectsConfiguration(v5)||h.affectsConfiguration(_I)){const f=i();u={...u,typeNavigationMode:f}}if(h.affectsConfiguration(w5)){const f=$Z(a);u={...u,defaultFindMatchType:f}}if(h.affectsConfiguration(Wr)&&t.horizontalScrolling===void 0){const f=!!a.getValue(Wr);u={...u,horizontalScrolling:f}}if(h.affectsConfiguration($a)){const f=!!a.getValue($a);u={...u,scrollByPage:f}}if(h.affectsConfiguration(CI)&&t.expandOnlyOnTwistieClick===void 0&&(u={...u,expandOnlyOnTwistieClick:a.getValue(CI)==="doubleClick"}),h.affectsConfiguration(vI)){const f=a.getValue(vI);u={...u,enableStickyScroll:f}}if(h.affectsConfiguration(wI)){const f=Math.max(1,a.getValue(wI));u={...u,stickyScrollMaxItemCount:f}}if(h.affectsConfiguration(ql)){const f=a.getValue(ql);u={...u,mouseWheelScrollSensitivity:f}}if(h.affectsConfiguration(Kl)){const f=a.getValue(Kl);u={...u,fastScrollSensitivity:f}}Object.keys(u).length>0&&e.updateOptions(u)}),this.contextKeyService.onDidChangeContext(h=>{h.affectsSome(d)&&e.updateOptions({typeNavigationMode:i()})})),this.navigator=new _ye(e,{configurationService:a,...t}),this.disposables.push(this.navigator)}updateOptions(e){e.multipleSelectionSupport!==void 0&&this.listSupportsMultiSelect.set(!!e.multipleSelectionSupport)}updateStyleOverrides(e){this.tree.style(e?vg(e):Y_)}dispose(){this.disposables=pt(this.disposables)}};Vg=wd([Ht(4,xe),Ht(5,Fr),Ht(6,Me)],Vg),ei.as(ka.Configuration).registerConfiguration({id:"workbench",order:7,title:p(1688,"Workbench"),type:"object",properties:{[Hg]:{type:"string",enum:["ctrlCmd","alt"],markdownEnumDescriptions:[p(1689,"Maps to `Control` on Windows and Linux and to `Command` on macOS."),p(1690,"Maps to `Alt` on Windows and Linux and to `Option` on macOS.")],default:"ctrlCmd",description:p(1691,"The modifier to be used to add an item in trees and lists to a multi-selection with the mouse (for example in the explorer, open editors and scm view). The 'Open to Side' mouse gestures - if supported - will adapt such that they do not conflict with the multiselect modifier.")},[mI]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p(1692,"Controls how to open items in trees and lists using the mouse (if supported). Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[Wr]:{type:"boolean",default:!1,description:p(1693,"Controls whether lists and trees support horizontal scrolling in the workbench. Warning: turning on this setting has a performance implication.")},[$a]:{type:"boolean",default:!1,description:p(1694,"Controls whether clicks in the scrollbar scroll page by page.")},[Uw]:{type:"number",default:8,minimum:4,maximum:40,description:p(1695,"Controls tree indentation in pixels.")},[bI]:{type:"string",enum:["none","onHover","always"],default:"onHover",description:p(1696,"Controls whether the tree should render indent guides.")},[ja]:{type:"boolean",default:!1,description:p(1697,"Controls whether lists and trees have smooth scrolling.")},[ql]:{type:"number",default:1,markdownDescription:p(1698,"A multiplier to be used on the `deltaX` and `deltaY` of mouse wheel scroll events.")},[Kl]:{type:"number",default:5,markdownDescription:p(1699,"Scrolling speed multiplier when pressing `Alt`.")},[C5]:{type:"string",enum:["highlight","filter"],enumDescriptions:[p(1700,"Highlight elements when searching. Further up and down navigation will traverse only the highlighted elements."),p(1701,"Filter elements when searching.")],default:"highlight",description:p(1702,"Controls the default find mode for lists and trees in the workbench.")},[_I]:{type:"string",enum:["simple","highlight","filter"],enumDescriptions:[p(1703,"Simple keyboard navigation focuses elements which match the keyboard input. Matching is done only on prefixes."),p(1704,"Highlight keyboard navigation highlights elements which match the keyboard input. Further up and down navigation will traverse only the highlighted elements."),p(1705,"Filter keyboard navigation will filter out and hide all the elements which do not match the keyboard input.")],default:"highlight",description:p(1706,"Controls the keyboard navigation style for lists and trees in the workbench. Can be simple, highlight and filter."),deprecated:!0,deprecationMessage:p(1707,"Please use 'workbench.list.defaultFindMode' and 'workbench.list.typeNavigationMode' instead.")},[w5]:{type:"string",enum:["fuzzy","contiguous"],enumDescriptions:[p(1708,"Use fuzzy matching when searching."),p(1709,"Use contiguous matching when searching.")],default:"fuzzy",description:p(1710,"Controls the type of matching used when searching lists and trees in the workbench.")},[CI]:{type:"string",enum:["singleClick","doubleClick"],default:"singleClick",description:p(1711,"Controls how tree folders are expanded when clicking the folder names. Note that some trees and lists might choose to ignore this setting if it is not applicable.")},[vI]:{type:"boolean",default:!0,description:p(1712,"Controls whether sticky scrolling is enabled in trees.")},[wI]:{type:"number",minimum:1,default:7,markdownDescription:p(1713,"Controls the number of sticky elements displayed in the tree when {0} is enabled.","`#workbench.tree.enableStickyScroll#`")},[v5]:{type:"string",enum:["automatic","trigger"],default:"automatic",markdownDescription:p(1714,"Controls how type navigation works in lists and trees in the workbench. When set to `trigger`, type navigation begins once the `list.triggerTypeNavigation` command is run.")}}});class Sd{constructor(e,t,i,n){this.isProviderFirst=e,this.parent=t,this.link=i,this._rangeCallback=n,this.id=NA.nextId()}get uri(){return this.link.uri}get range(){return this._range??this.link.targetSelectionRange??this.link.range}set range(e){this._range=e,this._rangeCallback(this)}get ariaMessage(){const e=this.parent.getPreview(this)?.preview(this.range);return e?p(1083,"{0} in {1} on line {2} at column {3}",e.value,vr(this.uri),this.range.startLineNumber,this.range.startColumn):p(1082,"in {0} on line {1} at column {2}",vr(this.uri),this.range.startLineNumber,this.range.startColumn)}}class Cye{constructor(e){this._modelReference=e}dispose(){this._modelReference.dispose()}preview(e,t=8){const i=this._modelReference.object.textEditorModel;if(!i)return;const{startLineNumber:n,startColumn:s,endLineNumber:r,endColumn:a}=e,l=i.getWordUntilPosition({lineNumber:n,column:s-t}),c=new k(n,l.startColumn,n,s),d=new k(r,a,r,1073741824),h=i.getValueInRange(c).replace(/^\s+/,""),u=i.getValueInRange(e),f=i.getValueInRange(d).replace(/\s+$/,"");return{value:h+u+f,highlight:{start:h.length,end:h.length+u.length}}}}class pb{constructor(e,t){this.parent=e,this.uri=t,this.children=[],this._previews=new Li}dispose(){pt(this._previews.values()),this._previews.clear()}getPreview(e){return this._previews.get(e.uri)}get ariaMessage(){const e=this.children.length;return e===1?p(1084,"1 symbol in {0}, full path {1}",vr(this.uri),this.uri.fsPath):p(1085,"{0} symbols in {1}, full path {2}",e,vr(this.uri),this.uri.fsPath)}async resolve(e){if(this._previews.size!==0)return this;for(const t of this.children)if(!this._previews.has(t.uri))try{const i=await e.createModelReference(t.uri);this._previews.set(t.uri,new Cye(i))}catch(i){Ee(i)}return this}}class Lo{constructor(e,t){this.groups=[],this.references=[],this._onDidChangeReferenceRange=new P,this.onDidChangeReferenceRange=this._onDidChangeReferenceRange.event,this._links=e,this._title=t;const[i]=e;e.sort(Lo._compareReferences);let n;for(const s of e)if((!n||!$t.isEqual(n.uri,s.uri,!0))&&(n=new pb(this,s.uri),this.groups.push(n)),n.children.length===0||Lo._compareReferences(s,n.children[n.children.length-1])!==0){const r=new Sd(i===s,n,s,a=>this._onDidChangeReferenceRange.fire(a));this.references.push(r),n.children.push(r)}}dispose(){pt(this.groups),this._onDidChangeReferenceRange.dispose(),this.groups.length=0}clone(){return new Lo(this._links,this._title)}get title(){return this._title}get isEmpty(){return this.groups.length===0}get ariaMessage(){return this.isEmpty?p(1086,"No results found"):this.references.length===1?p(1087,"Found 1 symbol in {0}",this.references[0].uri.fsPath):this.groups.length===1?p(1088,"Found {0} symbols in {1}",this.references.length,this.groups[0].uri.fsPath):p(1089,"Found {0} symbols in {1} files",this.references.length,this.groups.length)}nextOrPreviousReference(e,t){const{parent:i}=e;let n=i.children.indexOf(e);const s=i.children.length,r=i.parent.groups.length;return r===1||t&&n+1<s||!t&&n>0?(t?n=(n+1)%s:n=(n+s-1)%s,i.children[n]):(n=i.parent.groups.indexOf(i),t?(n=(n+1)%r,i.parent.groups[n].children[0]):(n=(n+r-1)%r,i.parent.groups[n].children[i.parent.groups[n].children.length-1]))}nearestReference(e,t){const i=this.references.map((n,s)=>({idx:s,prefixLen:Gr(n.uri.toString(),e.toString()),offsetDist:Math.abs(n.range.startLineNumber-t.lineNumber)*100+Math.abs(n.range.startColumn-t.column)})).sort((n,s)=>n.prefixLen>s.prefixLen?-1:n.prefixLen<s.prefixLen?1:n.offsetDist<s.offsetDist?-1:n.offsetDist>s.offsetDist?1:0)[0];if(i)return this.references[i.idx]}referenceAt(e,t){for(const i of this.references)if(i.uri.toString()===e.toString()&&k.containsPosition(i.range,t))return i}firstReference(){for(const e of this.references)if(e.isProviderFirst)return e;return this.references[0]}static _compareReferences(e,t){return $t.compare(e.uri,t.uri)||k.compareRangesUsingStarts(e.range,t.range)}}class L5 extends A{constructor(e,t,i){super(),this.options=t,this.styles=i,this.count=0,this.hover=this._register(new ct),this.element=Z(e,Q(".monaco-count-badge")),this._register(ue(()=>e.removeChild(this.element))),this.countFormat=this.options.countFormat||"{0}",this.titleFormat=this.options.titleFormat||"",this.setCount(this.options.count||0),this.updateHover()}setCount(e){this.count=e,this.render()}setTitleFormat(e){this.titleFormat=e,this.updateHover(),this.render()}updateHover(){this.titleFormat!==""&&!this.hover.value?this.hover.value=ta().setupDelayedHoverAtMouse(this.element,()=>({content:tf(this.titleFormat,this.count),appearance:{compact:!0}})):this.titleFormat===""&&this.hover.value&&(this.hover.value=void 0)}render(){this.element.textContent=tf(this.countFormat,this.count),this.element.style.backgroundColor=this.styles.badgeBackground??"",this.element.style.color=this.styles.badgeForeground??"",this.styles.badgeBorder&&(this.element.style.border=`1px solid ${this.styles.badgeBorder}`)}}class Xh extends A{constructor(e,t){super(),this.options=t,this.text="",this.title="",this.highlights=[],this.didEverRender=!1,this.supportIcons=t?.supportIcons??!1,this.domNode=Z(e,Q("span.monaco-highlighted-label"))}get element(){return this.domNode}set(e,t=[],i="",n){e||(e=""),n&&(e=Xh.escapeNewLines(e,t)),!(this.didEverRender&&this.text===e&&this.title===i&&fo(this.highlights,t))&&(this.text=e,this.title=i,this.highlights=t,this.render())}render(){const e=[];let t=0;for(const i of this.highlights){if(i.end===i.start)continue;if(t<i.start){const r=this.text.substring(t,i.start);this.supportIcons?e.push(...Fh(r)):e.push(r),t=i.start}const n=this.text.substring(t,i.end),s=Q("span.highlight",void 0,...this.supportIcons?Fh(n):[n]);i.extraClasses&&s.classList.add(...i.extraClasses),e.push(s),t=i.end}if(t<this.text.length){const i=this.text.substring(t);this.supportIcons?e.push(...Fh(i)):e.push(i)}if(Yi(this.domNode,...e),!this.customHover&&this.title!==""){const i=this.options?.hoverDelegate??Zs("mouse");this.customHover=this._register(ta().setupManagedHover(i,this.domNode,this.title))}else this.customHover&&this.customHover.update(this.title);this.didEverRender=!0}static escapeNewLines(e,t){let i=0,n=0;return e.replace(/\r\n|\r|\n/g,(s,r)=>{n=s===`\r
`?-1:0,r+=i;for(const a of t)a.end<=r||(a.start>=r&&(a.start+=n),a.end>=r&&(a.end+=n));return i+=n,"⏎"})}}class jw{constructor(e){this._element=e}get element(){return this._element}set textContent(e){this.disposed||e===this._textContent||(this._textContent=e,this._element.textContent=e)}set classNames(e){this.disposed||fo(e,this._classNames)||(this._classNames=e,this._element.classList.value="",this._element.classList.add(...e))}set empty(e){this.disposed||e===this._empty||(this._empty=e,this._element.style.marginLeft=e?"0":"")}dispose(){this.disposed=!0}}class qw extends A{constructor(e,t){super(),this.customHovers=new Map,this.creationOptions=t,this.domNode=this._register(new jw(Z(e,Q(".monaco-icon-label")))),this.labelContainer=Z(this.domNode.element,Q(".monaco-icon-label-container")),this.nameContainer=Z(this.labelContainer,Q("span.monaco-icon-name-container")),t?.supportHighlights||t?.supportIcons?this.nameNode=this._register(new Sye(this.nameContainer,!!t.supportIcons)):this.nameNode=new vye(this.nameContainer),this.hoverDelegate=t?.hoverDelegate??Zs("mouse")}get element(){return this.domNode.element}setLabel(e,t,i){const n=["monaco-icon-label"],s=["monaco-icon-label-container"];let r="";i&&(i.extraClasses&&n.push(...i.extraClasses),i.italic&&n.push("italic"),i.strikethrough&&n.push("strikethrough"),i.disabledCommand&&s.push("disabled"),i.title&&(typeof i.title=="string"?r+=i.title:r+=e));const a=this.domNode.element.querySelector(".monaco-icon-label-iconpath");if(i?.iconPath){let l;!a||!ai(a)?(l=Q(".monaco-icon-label-iconpath"),this.domNode.element.prepend(l)):l=a,l.style.backgroundImage=Nl(i?.iconPath),l.style.backgroundRepeat="no-repeat",l.style.backgroundPosition="center",l.style.backgroundSize="contain"}else a&&a.remove();if(this.domNode.classNames=n,this.domNode.element.setAttribute("aria-label",r),this.labelContainer.classList.value="",this.labelContainer.classList.add(...s),this.setupHover(i?.descriptionTitle?this.labelContainer:this.element,i?.title),this.nameNode.setLabel(e,i),t||this.descriptionNode){const l=this.getOrCreateDescriptionNode();l instanceof Xh?(l.set(t||"",i?i.descriptionMatches:void 0,void 0,i?.labelEscapeNewLines),this.setupHover(l.element,i?.descriptionTitle)):(l.textContent=t&&i?.labelEscapeNewLines?Xh.escapeNewLines(t,[]):t||"",this.setupHover(l.element,i?.descriptionTitle||""),l.empty=!t)}if(i?.suffix||this.suffixNode){const l=this.getOrCreateSuffixNode();l.textContent=i?.suffix??""}}setupHover(e,t){const i=this.customHovers.get(e);if(i&&(i.dispose(),this.customHovers.delete(e)),!t){e.removeAttribute("title");return}let n=e;if(this.creationOptions?.hoverTargetOverride){if(!Zi(e,this.creationOptions.hoverTargetOverride))throw new Error("hoverTargetOverrride must be an ancestor of the htmlElement");n=this.creationOptions.hoverTargetOverride}const s=ta().setupManagedHover(this.hoverDelegate,n,t);s&&this.customHovers.set(e,s)}dispose(){super.dispose();for(const e of this.customHovers.values())e.dispose();this.customHovers.clear()}getOrCreateSuffixNode(){if(!this.suffixNode){const e=this._register(new jw(lse(this.nameContainer,Q("span.monaco-icon-suffix-container"))));this.suffixNode=this._register(new jw(Z(e.element,Q("span.label-suffix"))))}return this.suffixNode}getOrCreateDescriptionNode(){if(!this.descriptionNode){const e=this._register(new jw(Z(this.labelContainer,Q("span.monaco-icon-description-container"))));this.creationOptions?.supportDescriptionHighlights?this.descriptionNode=this._register(new Xh(Z(e.element,Q("span.label-description")),{supportIcons:!!this.creationOptions.supportIcons})):this.descriptionNode=this._register(new jw(Z(e.element,Q("span.label-description"))))}return this.descriptionNode}}class vye{constructor(e){this.container=e,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&fo(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=Z(this.container,Q("a.label-name",{id:t?.domId}))),this.singleLabel.textContent=e;else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;for(let i=0;i<e.length;i++){const n=e[i],s=t?.domId&&`${t?.domId}_${i}`;Z(this.container,Q("a.label-name",{id:s,"data-icon-label-count":e.length,"data-icon-label-index":i,role:"treeitem"},n)),i<e.length-1&&Z(this.container,Q("span.label-separator",void 0,t?.separator||"/"))}}}}function wye(o,e,t){if(!t)return;let i=0;return o.map(n=>{const s={start:i,end:i+n.length},r=t.map(a=>Kn.intersect(s,a)).filter(a=>!Kn.isEmpty(a)).map(({start:a,end:l})=>({start:a-i,end:l-i}));return i=s.end+e.length,r})}class Sye extends A{constructor(e,t){super(),this.container=e,this.supportIcons=t,this.label=void 0,this.singleLabel=void 0}setLabel(e,t){if(!(this.label===e&&fo(this.options,t)))if(this.label=e,this.options=t,typeof e=="string")this.singleLabel||(this.container.textContent="",this.container.classList.remove("multiple"),this.singleLabel=this._register(new Xh(Z(this.container,Q("a.label-name",{id:t?.domId})),{supportIcons:this.supportIcons}))),this.singleLabel.set(e,t?.matches,void 0,t?.labelEscapeNewLines);else{this.container.textContent="",this.container.classList.add("multiple"),this.singleLabel=void 0;const i=t?.separator||"/",n=wye(e,i,t?.matches);for(let s=0;s<e.length;s++){const r=e[s],a=n?n[s]:void 0,l=t?.domId&&`${t?.domId}_${s}`,c=Q("a.label-name",{id:l,"data-icon-label-count":e.length,"data-icon-label-index":s,role:"treeitem"});this._register(new Xh(Z(this.container,c),{supportIcons:this.supportIcons})).set(r,a,void 0,t?.labelEscapeNewLines),s<e.length-1&&Z(c,Q("span.label-separator",void 0,i))}}}}const zg=We("labelService");var LI=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xI=function(o,e){return function(t,i){e(t,i,o)}},x5;let k5=class{constructor(e){this._resolverService=e}hasChildren(e){return e instanceof Lo||e instanceof pb}getChildren(e){if(e instanceof Lo)return e.groups;if(e instanceof pb)return e.resolve(this._resolverService).then(t=>t.children);throw new Error("bad tree")}};k5=LI([xI(0,ns)],k5);class yye{getHeight(){return 23}getTemplateId(e){return e instanceof pb?kI.id:II.id}}let I5=class{constructor(e){this._keybindingService=e}getKeyboardNavigationLabel(e){if(e instanceof Sd){const t=e.parent.getPreview(e)?.preview(e.range);if(t)return t.value}return vr(e.uri)}};I5=LI([xI(0,ot)],I5);class Lye{getId(e){return e instanceof Sd?e.id:e.uri}}let D5=class extends A{constructor(e,t){super(),this._labelService=t;const i=document.createElement("div");i.classList.add("reference-file"),this.file=this._register(new qw(i,{supportHighlights:!0})),this.badge=this._register(new L5(Z(i,Q(".count")),{},oK)),e.appendChild(i)}set(e,t){const i=zy(e.uri);this.file.setLabel(this._labelService.getUriBasenameLabel(e.uri),this._labelService.getUriLabel(i,{relative:!0}),{title:this._labelService.getUriLabel(e.uri),matches:t});const n=e.children.length;this.badge.setCount(n),n>1?this.badge.setTitleFormat(p(1076,"{0} references",n)):this.badge.setTitleFormat(p(1077,"{0} reference",n))}};D5=LI([xI(1,zg)],D5);let kI=(Ap=class{constructor(e){this._instantiationService=e,this.templateId=x5.id}renderTemplate(e){return this._instantiationService.createInstance(D5,e)}renderElement(e,t,i){i.set(e.element,Vv(e.filterData))}disposeTemplate(e){e.dispose()}},x5=Ap,Ap.id="FileReferencesRenderer",Ap);kI=x5=LI([xI(0,ge)],kI);class xye extends A{constructor(e){super(),this.label=this._register(new Xh(e))}set(e,t){const i=e.parent.getPreview(e)?.preview(e.range);if(!i||!i.value)this.label.set(`${vr(e.uri)}:${e.range.startLineNumber+1}:${e.range.startColumn+1}`);else{const{value:n,highlight:s}=i;t&&!Jr.isDefault(t)?(this.label.element.classList.toggle("referenceMatch",!1),this.label.set(n,Vv(t))):(this.label.element.classList.toggle("referenceMatch",!0),this.label.set(n,[s]))}}}const AN=class AN{constructor(){this.templateId=AN.id}renderTemplate(e){return new xye(e)}renderElement(e,t,i){i.set(e.element,e.filterData)}disposeTemplate(e){e.dispose()}};AN.id="OneReferenceRenderer";let II=AN;class kye{getWidgetAriaLabel(){return p(1078,"References")}getAriaLabel(e){return e.ariaMessage}}var jZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ug=function(o,e){return function(t,i){e(t,i,o)}};const ON=class ON{constructor(e,t){this._editor=e,this._model=t,this._decorations=new Map,this._decorationIgnoreSet=new Set,this._callOnDispose=new U,this._callOnModelChange=new U,this._callOnDispose.add(this._editor.onDidChangeModel(()=>this._onModelChanged())),this._onModelChanged()}dispose(){this._callOnModelChange.dispose(),this._callOnDispose.dispose(),this.removeDecorations()}_onModelChanged(){this._callOnModelChange.clear();const e=this._editor.getModel();if(e){for(const t of this._model.references)if(t.uri.toString()===e.uri.toString()){this._addDecorations(t.parent);return}}}_addDecorations(e){if(!this._editor.hasModel())return;this._callOnModelChange.add(this._editor.getModel().onDidChangeDecorations(()=>this._onDecorationChanged()));const t=[],i=[];for(let n=0,s=e.children.length;n<s;n++){const r=e.children[n];this._decorationIgnoreSet.has(r.id)||r.uri.toString()===this._editor.getModel().uri.toString()&&(t.push({range:r.range,options:ON.DecorationOptions}),i.push(n))}this._editor.changeDecorations(n=>{const s=n.deltaDecorations([],t);for(let r=0;r<s.length;r++)this._decorations.set(s[r],e.children[i[r]])})}_onDecorationChanged(){const e=[],t=this._editor.getModel();if(t){for(const[i,n]of this._decorations){const s=t.getDecorationRange(i);if(!s)continue;let r=!1;if(!k.equalsRange(s,n.range)){if(k.spansMultipleLines(s))r=!0;else{const a=n.range.endColumn-n.range.startColumn,l=s.endColumn-s.startColumn;a!==l&&(r=!0)}r?(this._decorationIgnoreSet.add(n.id),e.push(i)):n.range=s}}for(let i=0,n=e.length;i<n;i++)this._decorations.delete(e[i]);this._editor.removeDecorations(e)}}removeDecorations(){this._editor.removeDecorations([...this._decorations.keys()]),this._decorations.clear()}};ON.DecorationOptions=Te.register({description:"reference-decoration",stickiness:1,className:"reference-decoration"});let E5=ON;class Iye{constructor(){this.ratio=.7,this.heightInLines=18}static fromJSON(e){let t,i;try{const n=JSON.parse(e);t=n.ratio,i=n.heightInLines}catch{}return{ratio:t||.7,heightInLines:i||18}}}class Dye extends y5{}let N5=class{constructor(e){this.labelService=e,this.disposables=new U}getDragURI(e){return e instanceof pb?e.uri.toString():e instanceof Sd?Wve(e.uri,e.range).toString():null}getDragLabel(e){return e.length===0?void 0:e.map(i=>this.labelService.getUriBasenameLabel(i.uri)).join(", ")}onDragStart(e,t){if(!t.dataTransfer)return;const n=e.elements.map(s=>this.getDragURI(s)).filter(Boolean);n.length&&(t.dataTransfer.setData(og.RESOURCES,JSON.stringify(n)),t.dataTransfer.setData(og.TEXT,n.join(`
`)))}onDragOver(){return!1}drop(){}dispose(){this.disposables.dispose()}};N5=jZ([Ug(0,zg)],N5);let T5=class extends sI{constructor(e,t,i,n,s,r,a,l,c){super(e,{showFrame:!1,showArrow:!0,isResizeable:!0,isAccessible:!0,supportOnTitleClick:!0},r),this._defaultTreeKeyboardSupport=t,this.layoutData=i,this._textModelResolverService=s,this._instantiationService=r,this._peekViewService=a,this._uriLabel=l,this._keybindingService=c,this._disposeOnNewModel=new U,this._callOnDispose=new U,this._onDidSelectReference=new P,this.onDidSelectReference=this._onDidSelectReference.event,this._dim=new dt(0,0),this._isClosing=!1,this._applyTheme(n.getColorTheme()),this._callOnDispose.add(n.onDidColorThemeChange(this._applyTheme.bind(this))),this._peekViewService.addExclusiveWidget(e,this),this.create()}get isClosing(){return this._isClosing}dispose(){this._isClosing=!0,this.setModel(void 0),this._callOnDispose.dispose(),this._disposeOnNewModel.dispose(),pt(this._preview),pt(this._previewNotAvailableMessage),pt(this._tree),pt(this._previewModelReference),this._splitView.dispose(),super.dispose()}_applyTheme(e){const t=e.getColor(oSe)||$.transparent;this.style({arrowColor:t,frameColor:t,headerBackgroundColor:e.getColor(sSe)||$.transparent,primaryHeadingColor:e.getColor(tZ),secondaryHeadingColor:e.getColor(iZ)})}show(e){super.show(e,this.layoutData.heightInLines||18)}focusOnReferenceTree(){this._tree.domFocus()}focusOnPreviewEditor(){this._preview.focus()}isPreviewEditorFocused(){return this._preview.hasTextFocus()}_onTitleClick(e){this._preview&&this._preview.getModel()&&this._onDidSelectReference.fire({element:this._getFocusedReference(),kind:e.ctrlKey||e.metaKey||e.altKey?"side":"open",source:"title"})}_fillBody(e){this.setCssClass("reference-zone-widget"),this._messageContainer=Z(e,Q("div.messages")),gs(this._messageContainer),this._splitView=new sZ(e,{orientation:1}),this._previewContainer=Z(e,Q("div.preview.inline"));const t={scrollBeyondLastLine:!1,scrollbar:{verticalScrollbarSize:14,horizontal:"auto",useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,alwaysConsumeMouseWheel:!0},overviewRulerLanes:2,fixedOverflowWidgets:!0,minimap:{enabled:!1}};this._preview=this._instantiationService.createInstance(Cd,this._previewContainer,t,{},this.editor),gs(this._previewContainer),this._previewNotAvailableMessage=this._instantiationService.createInstance(Jf,p(1079,"no preview available"),Fo,Jf.DEFAULT_CREATION_OPTIONS,null),this._treeContainer=Z(e,Q("div.ref-tree.inline"));const i={keyboardSupport:this._defaultTreeKeyboardSupport,accessibilityProvider:new kye,keyboardNavigationLabelProvider:this._instantiationService.createInstance(I5),identityProvider:new Lye,openOnSingleClick:!0,selectionNavigation:!0,overrideStyles:{listBackground:rSe},dnd:this._instantiationService.createInstance(N5)};this._defaultTreeKeyboardSupport&&this._callOnDispose.add(Si(this._treeContainer,"keydown",s=>{s.equals(9)&&(this._keybindingService.dispatchEvent(s,s.target),s.stopPropagation())},!0)),this._tree=this._instantiationService.createInstance(Dye,"ReferencesWidget",this._treeContainer,new yye,[this._instantiationService.createInstance(kI),this._instantiationService.createInstance(II)],this._instantiationService.createInstance(k5),i),this._splitView.addView({onDidChange:ie.None,element:this._previewContainer,minimumSize:200,maximumSize:Number.MAX_VALUE,layout:s=>{this._preview.layout({height:this._dim.height,width:s})}},oI.Distribute),this._splitView.addView({onDidChange:ie.None,element:this._treeContainer,minimumSize:100,maximumSize:Number.MAX_VALUE,layout:s=>{this._treeContainer.style.height=`${this._dim.height}px`,this._treeContainer.style.width=`${s}px`,this._tree.layout(this._dim.height,s)}},oI.Distribute),this._disposables.add(this._splitView.onDidSashChange(()=>{this._dim.width&&(this.layoutData.ratio=this._splitView.getViewSize(0)/this._dim.width)},void 0));const n=(s,r)=>{s instanceof Sd&&(r==="show"&&this._revealReference(s,!1),this._onDidSelectReference.fire({element:s,kind:r,source:"tree"}))};this._disposables.add(this._tree.onDidOpen(s=>{s.sideBySide?n(s.element,"side"):s.editorOptions.pinned?n(s.element,"goto"):n(s.element,"show")})),gs(this._treeContainer)}_onWidth(e){this._dim&&this._doLayoutBody(this._dim.height,e)}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._dim=new dt(t,e),this.layoutData.heightInLines=this._viewZone?this._viewZone.heightInLines:this.layoutData.heightInLines,this._splitView.layout(t),this._splitView.resizeView(0,t*this.layoutData.ratio)}setSelection(e){return this._revealReference(e,!0).then(()=>{this._model&&(this._tree.setSelection([e]),this._tree.setFocus([e]))})}setModel(e){return this._disposeOnNewModel.clear(),this._model=e,this._model?this._onNewModel():Promise.resolve()}_onNewModel(){return this._model?this._model.isEmpty?(this.setTitle(""),this._messageContainer.innerText=p(1080,"No results"),uo(this._messageContainer),Promise.resolve(void 0)):(gs(this._messageContainer),this._decorationsManager=new E5(this._preview,this._model),this._disposeOnNewModel.add(this._decorationsManager),this._disposeOnNewModel.add(this._model.onDidChangeReferenceRange(e=>this._tree.rerender(e))),this._disposeOnNewModel.add(this._preview.onMouseDown(e=>{const{event:t,target:i}=e;if(t.detail!==2)return;const n=this._getFocusedReference();n&&this._onDidSelectReference.fire({element:{uri:n.uri,range:i.range},kind:t.ctrlKey||t.metaKey||t.altKey?"side":"open",source:"editor"})})),this.container.classList.add("results-loaded"),uo(this._treeContainer),uo(this._previewContainer),this._splitView.layout(this._dim.width),this.focusOnReferenceTree(),this._tree.setInput(this._model.groups.length===1?this._model.groups[0]:this._model)):Promise.resolve(void 0)}_getFocusedReference(){const[e]=this._tree.getFocus();if(e instanceof Sd)return e;if(e instanceof pb&&e.children.length>0)return e.children[0]}async revealReference(e){await this._revealReference(e,!1),this._onDidSelectReference.fire({element:e,kind:"goto",source:"tree"})}async _revealReference(e,t){if(this._revealedReference===e)return;this._revealedReference=e,e.uri.scheme!==we.inMemory?this.setTitle(Kse(e.uri),this._uriLabel.getUriLabel(zy(e.uri))):this.setTitle(p(1081,"References"));const i=this._textModelResolverService.createModelReference(e.uri);this._tree.getInput()===e.parent?this._tree.reveal(e):(t&&this._tree.reveal(e.parent),await this._tree.expand(e.parent),this._tree.reveal(e));const n=await i;if(!this._model){n.dispose();return}pt(this._previewModelReference);const s=n.object;if(s){const r=this._preview.getModel()===s.textEditorModel?0:1,a=k.lift(e.range).collapseToStart();this._previewModelReference=n,this._preview.setModel(s.textEditorModel),this._preview.setSelection(a),this._preview.revealRangeInCenter(a,r)}else this._preview.setModel(this._previewNotAvailableMessage),n.dispose()}};T5=jZ([Ug(3,li),Ug(4,ns),Ug(5,ge),Ug(6,eZ),Ug(7,zg),Ug(8,ot)],T5);var Eye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mb=function(o,e){return function(t,i){e(t,i,o)}},DI;const $g=new ae("referenceSearchVisible",!1,p(1073,"Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));let jg=(Op=class{static get(e){return e.getContribution(DI.ID)}constructor(e,t,i,n,s,r,a,l){this._defaultTreeKeyboardSupport=e,this._editor=t,this._editorService=n,this._notificationService=s,this._instantiationService=r,this._storageService=a,this._configurationService=l,this._disposables=new U,this._requestIdPool=0,this._ignoreModelChangeEvent=!1,this._referenceSearchVisible=$g.bindTo(i)}dispose(){this._referenceSearchVisible.reset(),this._disposables.dispose(),this._widget?.dispose(),this._model?.dispose(),this._widget=void 0,this._model=void 0}toggleWidget(e,t,i){let n;if(this._widget&&(n=this._widget.position),this.closeWidget(),n&&e.containsPosition(n))return;this._peekMode=i,this._referenceSearchVisible.set(!0),this._disposables.add(this._editor.onDidChangeModelLanguage(()=>{this.closeWidget()})),this._disposables.add(this._editor.onDidChangeModel(()=>{this._ignoreModelChangeEvent||this.closeWidget()}));const s="peekViewLayout",r=Iye.fromJSON(this._storageService.get(s,0,"{}"));this._widget=this._instantiationService.createInstance(T5,this._editor,this._defaultTreeKeyboardSupport,r),this._widget.setTitle(p(1074,"Loading...")),this._widget.show(e),this._disposables.add(this._widget.onDidClose(()=>{t.cancel(),this._widget?(this._storageService.store(s,JSON.stringify(this._widget.layoutData),0,1),this._widget.isClosing||this.closeWidget(),this._widget=void 0):this.closeWidget()})),this._disposables.add(this._widget.onDidSelectReference(l=>{const{element:c,kind:d}=l;if(c)switch(d){case"open":(l.source!=="editor"||!this._configurationService.getValue("editor.stablePeek"))&&this.openReference(c,!1,!1);break;case"side":this.openReference(c,!0,!1);break;case"goto":i?this._gotoReference(c,!0):this.openReference(c,!1,!0);break}}));const a=++this._requestIdPool;t.then(l=>{if(a!==this._requestIdPool||!this._widget){l.dispose();return}return this._model?.dispose(),this._model=l,this._widget.setModel(this._model).then(()=>{if(this._widget&&this._model&&this._editor.hasModel()){this._model.isEmpty?this._widget.setMetaTitle(""):this._widget.setMetaTitle(p(1075,"{0} ({1})",this._model.title,this._model.references.length));const c=this._editor.getModel().uri,d=new M(e.startLineNumber,e.startColumn),h=this._model.nearestReference(c,d);if(h)return this._widget.setSelection(h).then(()=>{this._widget&&this._editor.getOption(99)==="editor"&&this._widget.focusOnPreviewEditor()})}})},l=>{this._notificationService.error(l)})}changeFocusBetweenPreviewAndReferences(){this._widget&&(this._widget.isPreviewEditorFocused()?this._widget.focusOnReferenceTree():this._widget.focusOnPreviewEditor())}async goToNextOrPreviousReference(e){if(!this._editor.hasModel()||!this._model||!this._widget)return;const t=this._widget.position;if(!t)return;const i=this._model.nearestReference(this._editor.getModel().uri,t);if(!i)return;const n=this._model.nextOrPreviousReference(i,e),s=this._editor.hasTextFocus(),r=this._widget.isPreviewEditorFocused();await this._widget.setSelection(n),await this._gotoReference(n,!1),s?this._editor.focus():this._widget&&r&&this._widget.focusOnPreviewEditor()}async revealReference(e){!this._editor.hasModel()||!this._model||!this._widget||await this._widget.revealReference(e)}closeWidget(e=!0){this._widget?.dispose(),this._model?.dispose(),this._referenceSearchVisible.reset(),this._disposables.clear(),this._widget=void 0,this._model=void 0,e&&this._editor.focus(),this._requestIdPool+=1}_gotoReference(e,t){this._widget?.hide(),this._ignoreModelChangeEvent=!0;const i=k.lift(e.range).collapseToStart();return this._editorService.openCodeEditor({resource:e.uri,options:{selection:i,selectionSource:"code.jump",pinned:t}},this._editor).then(n=>{if(this._ignoreModelChangeEvent=!1,!n||!this._widget){this.closeWidget();return}if(this._editor===n)this._widget.show(i),this._widget.focusOnReferenceTree();else{const s=DI.get(n),r=this._model.clone();this.closeWidget(),n.focus(),s?.toggleWidget(i,Vi(a=>Promise.resolve(r)),this._peekMode??!1)}},n=>{this._ignoreModelChangeEvent=!1,Ee(n)})}openReference(e,t,i){t||this.closeWidget();const{uri:n,range:s}=e;this._editorService.openCodeEditor({resource:n,options:{selection:s,selectionSource:"code.jump",pinned:i}},this._editor,t)}},DI=Op,Op.ID="editor.contrib.referencesController",Op);jg=DI=Eye([mb(2,xe),mb(3,et),mb(4,hi),mb(5,ge),mb(6,Es),mb(7,Me)],jg);function qg(o,e){const t=YG(o);if(!t)return;const i=jg.get(t);i&&e(i)}rn.registerCommandAndKeybindingRule({id:"togglePeekWidgetFocus",weight:100,primary:Ei(2089,60),when:K.or($g,eo.inPeekEditor),handler(o){qg(o,e=>{e.changeFocusBetweenPreviewAndReferences()})}}),rn.registerCommandAndKeybindingRule({id:"goToNextReference",weight:90,primary:62,secondary:[70],when:K.or($g,eo.inPeekEditor),handler(o){qg(o,e=>{e.goToNextOrPreviousReference(!0)})}}),rn.registerCommandAndKeybindingRule({id:"goToPreviousReference",weight:90,primary:1086,secondary:[1094],when:K.or($g,eo.inPeekEditor),handler(o){qg(o,e=>{e.goToNextOrPreviousReference(!1)})}}),Xe.registerCommandAlias("goToNextReferenceFromEmbeddedEditor","goToNextReference"),Xe.registerCommandAlias("goToPreviousReferenceFromEmbeddedEditor","goToPreviousReference"),Xe.registerCommandAlias("closeReferenceSearchEditor","closeReferenceSearch"),Xe.registerCommand("closeReferenceSearch",o=>qg(o,e=>e.closeWidget())),rn.registerKeybindingRule({id:"closeReferenceSearch",weight:-1,primary:9,secondary:[1033],when:K.and(eo.inPeekEditor,K.not("config.editor.stablePeek"))}),rn.registerKeybindingRule({id:"closeReferenceSearch",weight:250,primary:9,secondary:[1033],when:K.and($g,K.not("config.editor.stablePeek"),K.or(T.editorTextFocus,f5.negate()))}),rn.registerCommandAndKeybindingRule({id:"revealReference",weight:200,primary:3,mac:{primary:3,secondary:[2066]},when:K.and($g,MZ,_5.negate(),b5.negate()),handler(o){const t=o.get(Fr).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Sd&&qg(o,i=>i.revealReference(t[0]))}}),rn.registerCommandAndKeybindingRule({id:"openReferenceToSide",weight:100,primary:2051,mac:{primary:259},when:K.and($g,MZ,_5.negate(),b5.negate()),handler(o){const t=o.get(Fr).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Sd&&qg(o,i=>i.openReference(t[0],!0,!0))}}),Xe.registerCommand("openReference",o=>{const t=o.get(Fr).lastFocusedList?.getFocus();Array.isArray(t)&&t[0]instanceof Sd&&qg(o,i=>i.openReference(t[0],!1,!0))});var qZ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Kw=function(o,e){return function(t,i){e(t,i,o)}};const R5=new ae("hasSymbols",!1,p(1090,"Whether there are symbol locations that can be navigated via keyboard-only.")),EI=We("ISymbolNavigationService");let M5=class{constructor(e,t,i,n){this._editorService=t,this._notificationService=i,this._keybindingService=n,this._currentModel=void 0,this._currentIdx=-1,this._ignoreEditorChange=!1,this._ctxHasSymbols=R5.bindTo(e)}reset(){this._ctxHasSymbols.reset(),this._currentState?.dispose(),this._currentMessage?.close(),this._currentModel=void 0,this._currentIdx=-1}put(e){const t=e.parent.parent;if(t.references.length<=1){this.reset();return}this._currentModel=t,this._currentIdx=t.references.indexOf(e),this._ctxHasSymbols.set(!0),this._showMessage();const i=new P5(this._editorService),n=i.onDidChange(s=>{if(this._ignoreEditorChange)return;const r=this._editorService.getActiveCodeEditor();if(!r)return;const a=r.getModel(),l=r.getPosition();if(!a||!l)return;let c=!1,d=!1;for(const h of t.references)if(ch(h.uri,a.uri))c=!0,d=d||k.containsPosition(h.range,l);else if(c)break;(!c||!d)&&this.reset()});this._currentState=jr(i,n)}revealNext(e){if(!this._currentModel)return Promise.resolve();this._currentIdx+=1,this._currentIdx%=this._currentModel.references.length;const t=this._currentModel.references[this._currentIdx];return this._showMessage(),this._ignoreEditorChange=!0,this._editorService.openCodeEditor({resource:t.uri,options:{selection:k.collapseToStart(t.range),selectionRevealType:3}},e).finally(()=>{this._ignoreEditorChange=!1})}_showMessage(){this._currentMessage?.close();const e=this._keybindingService.lookupKeybinding("editor.gotoNextSymbolFromResult"),t=e?p(1091,"Symbol {0} of {1}, {2} for next",this._currentIdx+1,this._currentModel.references.length,e.getLabel()):p(1092,"Symbol {0} of {1}",this._currentIdx+1,this._currentModel.references.length);this._currentMessage=this._notificationService.status(t)}};M5=qZ([Kw(0,xe),Kw(1,et),Kw(2,hi),Kw(3,ot)],M5),je(EI,M5,1),re(new class extends Bi{constructor(){super({id:"editor.gotoNextSymbolFromResult",precondition:R5,kbOpts:{weight:100,primary:70}})}runEditorCommand(o,e){return o.get(EI).revealNext(e)}}),rn.registerCommandAndKeybindingRule({id:"editor.gotoNextSymbolFromResult.cancel",weight:100,when:R5,primary:9,handler(o){o.get(EI).reset()}});let P5=class{constructor(e){this._listener=new Map,this._disposables=new U,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._disposables.add(e.onCodeEditorRemove(this._onDidRemoveEditor,this)),this._disposables.add(e.onCodeEditorAdd(this._onDidAddEditor,this)),e.listCodeEditors().forEach(this._onDidAddEditor,this)}dispose(){this._disposables.dispose(),this._onDidChange.dispose(),pt(this._listener.values())}_onDidAddEditor(e){this._listener.set(e,jr(e.onDidChangeCursorPosition(t=>this._onDidChange.fire({editor:e})),e.onDidChangeModelContent(t=>this._onDidChange.fire({editor:e}))))}_onDidRemoveEditor(e){this._listener.get(e)?.dispose(),this._listener.delete(e)}};P5=qZ([Kw(0,et)],P5);function A5(o,e){return e.uri.scheme===o.uri.scheme?!0:!DR(e.uri,we.walkThroughSnippet,we.vscodeChatCodeBlock,we.vscodeChatCodeCompareBlock)}async function Gw(o,e,t,i,n){const r=t.ordered(o,i).map(l=>Promise.resolve(n(l,o,e)).then(void 0,c=>{Di(c)})),a=await Promise.all(r);return wa(a.flat()).filter(l=>A5(o,l))}function Zw(o,e,t,i,n){return Gw(e,t,o,i,(s,r,a)=>s.provideDefinition(r,a,n))}function O5(o,e,t,i,n){return Gw(e,t,o,i,(s,r,a)=>s.provideDeclaration(r,a,n))}function F5(o,e,t,i,n){return Gw(e,t,o,i,(s,r,a)=>s.provideImplementation(r,a,n))}function W5(o,e,t,i,n){return Gw(e,t,o,i,(s,r,a)=>s.provideTypeDefinition(r,a,n))}function Yw(o,e,t,i,n,s){return Gw(e,t,o,n,async(r,a,l)=>{const c=(await r.provideReferences(a,l,{includeDeclaration:!0},s))?.filter(h=>A5(a,h));if(!i||!c||c.length!==2)return c;const d=(await r.provideReferences(a,l,{includeDeclaration:!1},s))?.filter(h=>A5(a,h));return d&&d.length===1?d:c})}async function Zl(o){const e=await o(),t=new Lo(e,""),i=t.references.map(n=>n.link);return t.dispose(),i}zs("_executeDefinitionProvider",(o,e,t)=>{const i=o.get(he),n=Zw(i.definitionProvider,e,t,!1,He.None);return Zl(()=>n)}),zs("_executeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(he),n=Zw(i.definitionProvider,e,t,!0,He.None);return Zl(()=>n)}),zs("_executeTypeDefinitionProvider",(o,e,t)=>{const i=o.get(he),n=W5(i.typeDefinitionProvider,e,t,!1,He.None);return Zl(()=>n)}),zs("_executeTypeDefinitionProvider_recursive",(o,e,t)=>{const i=o.get(he),n=W5(i.typeDefinitionProvider,e,t,!0,He.None);return Zl(()=>n)}),zs("_executeDeclarationProvider",(o,e,t)=>{const i=o.get(he),n=O5(i.declarationProvider,e,t,!1,He.None);return Zl(()=>n)}),zs("_executeDeclarationProvider_recursive",(o,e,t)=>{const i=o.get(he),n=O5(i.declarationProvider,e,t,!0,He.None);return Zl(()=>n)}),zs("_executeReferenceProvider",(o,e,t)=>{const i=o.get(he),n=Yw(i.referenceProvider,e,t,!1,!1,He.None);return Zl(()=>n)}),zs("_executeReferenceProvider_recursive",(o,e,t)=>{const i=o.get(he),n=Yw(i.referenceProvider,e,t,!1,!0,He.None);return Zl(()=>n)}),zs("_executeImplementationProvider",(o,e,t)=>{const i=o.get(he),n=F5(i.implementationProvider,e,t,!1,He.None);return Zl(()=>n)}),zs("_executeImplementationProvider_recursive",(o,e,t)=>{const i=o.get(he),n=F5(i.implementationProvider,e,t,!0,He.None);return Zl(()=>n)}),an.appendMenuItem(de.EditorContext,{submenu:de.EditorContextPeek,title:p(1033,"Peek"),group:"navigation",order:100});class _b{static is(e){return!e||typeof e!="object"?!1:!!(e instanceof _b||M.isIPosition(e.position)&&e.model)}constructor(e,t){this.model=e,this.position=t}}const fa=class fa extends Zr{static all(){return fa._allSymbolNavigationCommands.values()}static _patchConfig(e){const t={...e,f1:!0};if(t.menu)for(const i of Ye.wrap(t.menu))(i.id===de.EditorContext||i.id===de.EditorContextPeek)&&(i.when=K.and(e.precondition,i.when));return t}constructor(e,t){super(fa._patchConfig(t)),this.configuration=e,fa._allSymbolNavigationCommands.set(t.id,this)}runEditorCommand(e,t,i,n){if(!t.hasModel())return Promise.resolve(void 0);const s=e.get(hi),r=e.get(et),a=e.get(sd),l=e.get(EI),c=e.get(he),d=e.get(ge),h=t.getModel(),u=t.getPosition(),f=_b.is(i)?i:new _b(h,u),g=new ud(t,5),m=Em(this._getLocationModel(c,f.model,f.position,g.token),g.token).then(async _=>{if(!_||g.token.isCancellationRequested)return;ps(_.ariaMessage);let b;if(_.referenceAt(h.uri,u)){const w=this._getAlternativeCommand(t);w!==void 0&&!fa._activeAlternativeCommands.has(w)&&fa._allSymbolNavigationCommands.has(w)&&(b=fa._allSymbolNavigationCommands.get(w))}const C=_.references.length;if(C===0){if(!this.configuration.muteMessage){const w=h.getWordAtPosition(u);So.get(t)?.showMessage(this._getNoResultFoundMessage(w),u)}}else if(C===1&&b)fa._activeAlternativeCommands.add(this.desc.id),d.invokeFunction(w=>b.runEditorCommand(w,t,i,n).finally(()=>{fa._activeAlternativeCommands.delete(this.desc.id)}));else return this._onResult(r,l,t,_,n)},_=>{s.error(_)}).finally(()=>{g.dispose()});return a.showWhile(m,250),m}async _onResult(e,t,i,n,s){const r=this._getGoToPreference(i);if(!(i instanceof Cd)&&(this.configuration.openInPeek||r==="peek"&&n.references.length>1))this._openInPeek(i,n,s);else{const a=n.firstReference(),l=n.references.length>1&&r==="gotoAndPeek",c=await this._openReference(i,e,a,this.configuration.openToSide,!l);l&&c?this._openInPeek(c,n,s):n.dispose(),r==="goto"&&t.put(a)}}async _openReference(e,t,i,n,s){let r;if(Bhe(i)&&(r=i.targetSelectionRange),r||(r=i.range),!r)return;const a=await t.openCodeEditor({resource:i.uri,options:{selection:k.collapseToStart(r),selectionRevealType:3,selectionSource:"code.jump"}},e,n);if(a){if(s){const l=a.getModel(),c=a.createDecorationsCollection([{range:r,options:{description:"symbol-navigate-action-highlight",className:"symbolHighlight"}}]);setTimeout(()=>{a.getModel()===l&&c.clear()},350)}return a}}_openInPeek(e,t,i){const n=jg.get(e);n&&e.hasModel()?n.toggleWidget(i??e.getSelection(),Vi(s=>Promise.resolve(t)),this.configuration.openInPeek):t.dispose()}};fa._allSymbolNavigationCommands=new Map,fa._activeAlternativeCommands=new Set;let yd=fa;class Xw extends yd{async _getLocationModel(e,t,i,n){return new Lo(await Zw(e.definitionProvider,t,i,!1,n),p(1034,"Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p(1035,"No definition found for '{0}'",e.word):p(1036,"No definition found")}_getAlternativeCommand(e){return e.getOption(67).alternativeDefinitionCommand}_getGoToPreference(e){return e.getOption(67).multipleDefinitions}}mt((Nu=class extends Xw{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Nu.id,title:{...H(1060,"Go to Definition"),mnemonicTitle:p(1037,"Go to &&Definition")},precondition:T.hasDefinitionProvider,keybinding:[{when:T.editorTextFocus,primary:70,weight:100},{when:K.and(T.editorTextFocus,EZ),primary:2118,weight:100}],menu:[{id:de.EditorContext,group:"navigation",order:1.1},{id:de.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:2}]}),Xe.registerCommandAlias("editor.action.goToDeclaration",Nu.id)}},Nu.id="editor.action.revealDefinition",Nu)),mt((Tu=class extends Xw{constructor(){super({openToSide:!0,openInPeek:!1,muteMessage:!1},{id:Tu.id,title:H(1061,"Open Definition to the Side"),precondition:K.and(T.hasDefinitionProvider,T.isInEmbeddedEditor.toNegated()),keybinding:[{when:T.editorTextFocus,primary:Ei(2089,70),weight:100},{when:K.and(T.editorTextFocus,EZ),primary:Ei(2089,2118),weight:100}]}),Xe.registerCommandAlias("editor.action.openDeclarationToTheSide",Tu.id)}},Tu.id="editor.action.revealDefinitionAside",Tu)),mt((Ru=class extends Xw{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Ru.id,title:H(1062,"Peek Definition"),precondition:K.and(T.hasDefinitionProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:582,linux:{primary:3140},weight:100},menu:{id:de.EditorContextPeek,group:"peek",order:2}}),Xe.registerCommandAlias("editor.action.previewDeclaration",Ru.id)}},Ru.id="editor.action.peekDefinition",Ru));class KZ extends yd{async _getLocationModel(e,t,i,n){return new Lo(await O5(e.declarationProvider,t,i,!1,n),p(1038,"Declarations"))}_getNoResultFoundMessage(e){return e&&e.word?p(1039,"No declaration found for '{0}'",e.word):p(1040,"No declaration found")}_getAlternativeCommand(e){return e.getOption(67).alternativeDeclarationCommand}_getGoToPreference(e){return e.getOption(67).multipleDeclarations}}mt((Fp=class extends KZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Fp.id,title:{...H(1063,"Go to Declaration"),mnemonicTitle:p(1041,"Go to &&Declaration")},precondition:K.and(T.hasDeclarationProvider,T.isInEmbeddedEditor.toNegated()),menu:[{id:de.EditorContext,group:"navigation",order:1.3},{id:de.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}_getNoResultFoundMessage(e){return e&&e.word?p(1042,"No declaration found for '{0}'",e.word):p(1043,"No declaration found")}},Fp.id="editor.action.revealDeclaration",Fp)),mt(class extends KZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.peekDeclaration",title:H(1064,"Peek Declaration"),precondition:K.and(T.hasDeclarationProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:de.EditorContextPeek,group:"peek",order:3}})}});class GZ extends yd{async _getLocationModel(e,t,i,n){return new Lo(await W5(e.typeDefinitionProvider,t,i,!1,n),p(1044,"Type Definitions"))}_getNoResultFoundMessage(e){return e&&e.word?p(1045,"No type definition found for '{0}'",e.word):p(1046,"No type definition found")}_getAlternativeCommand(e){return e.getOption(67).alternativeTypeDefinitionCommand}_getGoToPreference(e){return e.getOption(67).multipleTypeDefinitions}}mt((Wp=class extends GZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Wp.ID,title:{...H(1065,"Go to Type Definition"),mnemonicTitle:p(1047,"Go to &&Type Definition")},precondition:T.hasTypeDefinitionProvider,keybinding:{when:T.editorTextFocus,primary:0,weight:100},menu:[{id:de.EditorContext,group:"navigation",order:1.4},{id:de.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:3}]})}},Wp.ID="editor.action.goToTypeDefinition",Wp)),mt((Bp=class extends GZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Bp.ID,title:H(1066,"Peek Type Definition"),precondition:K.and(T.hasTypeDefinitionProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:de.EditorContextPeek,group:"peek",order:4}})}},Bp.ID="editor.action.peekTypeDefinition",Bp));class ZZ extends yd{async _getLocationModel(e,t,i,n){return new Lo(await F5(e.implementationProvider,t,i,!1,n),p(1048,"Implementations"))}_getNoResultFoundMessage(e){return e&&e.word?p(1049,"No implementation found for '{0}'",e.word):p(1050,"No implementation found")}_getAlternativeCommand(e){return e.getOption(67).alternativeImplementationCommand}_getGoToPreference(e){return e.getOption(67).multipleImplementations}}mt((Hp=class extends ZZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:Hp.ID,title:{...H(1067,"Go to Implementations"),mnemonicTitle:p(1051,"Go to &&Implementations")},precondition:T.hasImplementationProvider,keybinding:{when:T.editorTextFocus,primary:2118,weight:100},menu:[{id:de.EditorContext,group:"navigation",order:1.45},{id:de.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:4}]})}},Hp.ID="editor.action.goToImplementation",Hp)),mt((Vp=class extends ZZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:Vp.ID,title:H(1068,"Peek Implementations"),precondition:K.and(T.hasImplementationProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:3142,weight:100},menu:{id:de.EditorContextPeek,group:"peek",order:5}})}},Vp.ID="editor.action.peekImplementation",Vp));class YZ extends yd{_getNoResultFoundMessage(e){return e?p(1052,"No references found for '{0}'",e.word):p(1053,"No references found")}_getAlternativeCommand(e){return e.getOption(67).alternativeReferenceCommand}_getGoToPreference(e){return e.getOption(67).multipleReferences}}mt(class extends YZ{constructor(){super({openToSide:!1,openInPeek:!1,muteMessage:!1},{id:"editor.action.goToReferences",title:{...H(1069,"Go to References"),mnemonicTitle:p(1054,"Go to &&References")},precondition:K.and(T.hasReferenceProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),keybinding:{when:T.editorTextFocus,primary:1094,weight:100},menu:[{id:de.EditorContext,group:"navigation",order:1.45},{id:de.MenubarGoMenu,precondition:null,group:"4_symbol_nav",order:5}]})}async _getLocationModel(e,t,i,n){return new Lo(await Yw(e.referenceProvider,t,i,!0,!1,n),p(1055,"References"))}}),mt(class extends YZ{constructor(){super({openToSide:!1,openInPeek:!0,muteMessage:!1},{id:"editor.action.referenceSearch.trigger",title:H(1070,"Peek References"),precondition:K.and(T.hasReferenceProvider,eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated()),menu:{id:de.EditorContextPeek,group:"peek",order:6}})}async _getLocationModel(e,t,i,n){return new Lo(await Yw(e.referenceProvider,t,i,!1,!1,n),p(1056,"References"))}});class Nye extends yd{constructor(e,t,i){super(e,{id:"editor.action.goToLocation",title:H(1071,"Go to Any Symbol"),precondition:K.and(eo.notInPeekEditor,T.isInEmbeddedEditor.toNegated())}),this._references=t,this._gotoMultipleBehaviour=i}async _getLocationModel(e,t,i,n){return new Lo(this._references,p(1057,"Locations"))}_getNoResultFoundMessage(e){return e&&p(1058,"No results for '{0}'",e.word)||""}_getGoToPreference(e){return this._gotoMultipleBehaviour??e.getOption(67).multipleReferences}_getAlternativeCommand(){}}Xe.registerCommand({id:"editor.action.goToLocations",metadata:{description:"Go to locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:be},{name:"position",description:"The position at which to start",constraint:M.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"},{name:"noResultsMessage",description:"Human readable message that shows when locations is empty."}]},handler:async(o,e,t,i,n,s,r)=>{it(be.isUri(e)),it(M.isIPosition(t)),it(Array.isArray(i)),it(typeof n>"u"||typeof n=="string"),it(typeof r>"u"||typeof r=="boolean");const a=o.get(et),l=await a.openCodeEditor({resource:e},a.getFocusedCodeEditor());if($l(l))return l.setPosition(t),l.revealPositionInCenterIfOutsideViewport(t,0),l.invokeWithinContext(c=>{const d=new class extends Nye{_getNoResultFoundMessage(h){return s||super._getNoResultFoundMessage(h)}}({muteMessage:!s,openInPeek:!!r,openToSide:!1},i,n);c.get(ge).invokeFunction(d.run.bind(d),l)})}}),Xe.registerCommand({id:"editor.action.peekLocations",metadata:{description:"Peek locations from a position in a file",args:[{name:"uri",description:"The text document in which to start",constraint:be},{name:"position",description:"The position at which to start",constraint:M.isIPosition},{name:"locations",description:"An array of locations.",constraint:Array},{name:"multiple",description:"Define what to do when having multiple results, either `peek`, `gotoAndPeek`, or `goto`"}]},handler:async(o,e,t,i,n)=>{o.get(Tt).executeCommand("editor.action.goToLocations",e,t,i,n,void 0,!0)}}),Xe.registerCommand({id:"editor.action.findReferences",handler:(o,e,t)=>{it(be.isUri(e)),it(M.isIPosition(t));const i=o.get(he),n=o.get(et);return n.openCodeEditor({resource:e},n.getFocusedCodeEditor()).then(s=>{if(!$l(s)||!s.hasModel())return;const r=jg.get(s);if(!r)return;const a=Vi(c=>Yw(i.referenceProvider,s.getModel(),M.lift(t),!1,!1,c).then(d=>new Lo(d,p(1059,"References")))),l=new k(t.lineNumber,t.column,t.lineNumber,t.column);return Promise.resolve(r.toggleWidget(l,a,!1))})}}),Xe.registerCommandAlias("editor.action.showReferences","editor.action.peekLocations");async function Tye(o,e,t,i){const n=o.get(ns),s=o.get(Ko),r=o.get(Tt),a=o.get(ge),l=o.get(hi);if(await i.item.resolve(He.None),!i.part.location)return;const c=i.part.location,d=[],h=new Set(an.getMenuItems(de.EditorContext).map(f=>Vm(f)?f.command.id:Of()));for(const f of yd.all())h.has(f.desc.id)&&d.push(new Mo(f.desc.id,Po.label(f.desc,{renderShortTitle:!0}),void 0,!0,async()=>{const g=await n.createModelReference(c.uri);try{const m=new _b(g.object.textEditorModel,k.getStartPosition(c.range)),_=i.item.anchor.range;await a.invokeFunction(f.runEditorCommand.bind(f),e,m,_)}finally{g.dispose()}}));if(i.part.command){const{command:f}=i.part;d.push(new Xi),d.push(new Mo(f.id,f.title,void 0,!0,async()=>{try{await r.executeCommand(f.id,...f.arguments??[])}catch(g){l.notify({severity:k_.Error,source:i.item.provider.displayName,message:g})}}))}const u=e.getOption(144);s.showContextMenu({domForShadowRoot:u?e.getDomNode()??void 0:void 0,getAnchor:()=>{const f=mi(t);return{x:f.left,y:f.top+f.height+8}},getActions:()=>d,onHide:()=>{e.focus()},autoSelectFirstItem:!0})}async function XZ(o,e,t,i){const s=await o.get(ns).createModelReference(i.uri);await t.invokeWithinContext(async r=>{const a=e.hasSideBySideModifier,l=r.get(xe),c=eo.inPeekEditor.getValue(l),d=!a&&t.getOption(101)&&!c;return new Xw({openToSide:a,openInPeek:d,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(r,new _b(s.object.textEditorModel,k.getStartPosition(i.range)),k.lift(i.range))}),s.dispose()}var Rye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bb=function(o,e){return function(t,i){e(t,i,o)}},Cb;class NI{constructor(){this._entries=new dl(50)}get(e){const t=NI._key(e);return this._entries.get(t)}set(e,t){const i=NI._key(e);this._entries.set(i,t)}static _key(e){return`${e.uri.toString()}/${e.getVersionId()}`}}const QZ=We("IInlayHintsCache");je(QZ,NI,1);class B5{constructor(e,t){this.item=e,this.index=t}get part(){const e=this.item.hint.label;return typeof e=="string"?{label:e}:e[this.index]}}class Mye{constructor(e,t){this.part=e,this.hasTriggerModifier=t}}let Qw=(jd=class{static get(e){return e.getContribution(Cb.ID)??void 0}constructor(e,t,i,n,s,r,a){this._editor=e,this._languageFeaturesService=t,this._inlayHintsCache=n,this._commandService=s,this._notificationService=r,this._instaService=a,this._disposables=new U,this._sessionDisposables=new U,this._decorationsMetadata=new Map,this._activeRenderMode=0,this._ruleFactory=this._disposables.add(new PL(this._editor)),this._debounceInfo=i.for(t.inlayHintsProvider,"InlayHint",{min:25}),this._disposables.add(t.inlayHintsProvider.onDidChange(()=>this._update())),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(l=>{l.hasChanged(159)&&this._update()})),this._update()}dispose(){this._sessionDisposables.dispose(),this._removeAllDecorations(),this._disposables.dispose()}_update(){this._sessionDisposables.clear(),this._removeAllDecorations();const e=this._editor.getOption(159);if(e.enabled==="off")return;const t=this._editor.getModel();if(!t||!this._languageFeaturesService.inlayHintsProvider.has(t))return;if(e.enabled==="on")this._activeRenderMode=0;else{let l,c;e.enabled==="onUnlessPressed"?(l=0,c=1):(l=1,c=0),this._activeRenderMode=l,this._sessionDisposables.add(Pc.getInstance().event(d=>{if(!this._editor.hasModel())return;const h=d.altKey&&d.ctrlKey&&!(d.shiftKey||d.metaKey)?c:l;if(h!==this._activeRenderMode){this._activeRenderMode=h;const u=this._editor.getModel(),f=this._copyInlayHintsWithCurrentAnchor(u);this._updateHintsDecorators([u.getFullModelRange()],f),r.schedule(0)}}))}const i=this._inlayHintsCache.get(t);i&&this._updateHintsDecorators([t.getFullModelRange()],i),this._sessionDisposables.add(ue(()=>{t.isDisposed()||this._cacheHintsForFastRestore(t)}));let n;const s=new Set,r=new wt(async()=>{const l=Date.now();n?.dispose(!0),n=new Xt;const c=t.onWillDispose(()=>n?.cancel());try{const d=n.token,h=await iI.create(this._languageFeaturesService.inlayHintsProvider,t,this._getHintsRanges(),d);if(r.delay=this._debounceInfo.update(t,Date.now()-l),d.isCancellationRequested){h.dispose();return}for(const u of h.provider)typeof u.onDidChangeInlayHints=="function"&&!s.has(u)&&(s.add(u),this._sessionDisposables.add(u.onDidChangeInlayHints(()=>{r.isScheduled()||r.schedule()})));this._sessionDisposables.add(h),this._updateHintsDecorators(h.ranges,h.items),this._cacheHintsForFastRestore(t)}catch(d){Ee(d)}finally{n.dispose(),c.dispose()}},this._debounceInfo.get(t));this._sessionDisposables.add(r),this._sessionDisposables.add(ue(()=>n?.dispose(!0))),r.schedule(0),this._sessionDisposables.add(this._editor.onDidScrollChange(l=>{(l.scrollTopChanged||!r.isScheduled())&&r.schedule()}));const a=this._sessionDisposables.add(new ct);this._sessionDisposables.add(this._editor.onDidChangeModelContent(l=>{n?.cancel();const c=Math.max(r.delay,800);this._cursorInfo={position:this._editor.getPosition(),notEarlierThan:Date.now()+c},a.value=yc(()=>r.schedule(0),c),r.schedule()})),this._sessionDisposables.add(this._editor.onDidChangeConfiguration(l=>{l.hasChanged(159)&&r.schedule()})),this._sessionDisposables.add(this._installDblClickGesture(()=>r.schedule(0))),this._sessionDisposables.add(this._installLinkGesture()),this._sessionDisposables.add(this._installContextMenu())}_installLinkGesture(){const e=new U,t=e.add(new tI(this._editor)),i=new U;return e.add(i),e.add(t.onMouseMoveOrRelevantKeyDown(n=>{const[s]=n,r=this._getInlayHintLabelPart(s),a=this._editor.getModel();if(!r||!a){i.clear();return}const l=new Xt;i.add(ue(()=>l.dispose(!0))),r.item.resolve(l.token),this._activeInlayHintPart=r.part.command||r.part.location?new Mye(r,s.hasTriggerModifier):void 0;const c=a.validatePosition(r.item.hint.position).lineNumber,d=new k(c,1,c,a.getLineMaxColumn(c)),h=this._getInlineHintsForRange(d);this._updateHintsDecorators([d],h),i.add(ue(()=>{this._activeInlayHintPart=void 0,this._updateHintsDecorators([d],h)}))})),e.add(t.onCancel(()=>i.clear())),e.add(t.onExecute(async n=>{const s=this._getInlayHintLabelPart(n);if(s){const r=s.part;r.location?this._instaService.invokeFunction(XZ,n,this._editor,r.location):UM.is(r.command)&&await this._invokeCommand(r.command,s.item)}})),e}_getInlineHintsForRange(e){const t=new Set;for(const i of this._decorationsMetadata.values())e.containsRange(i.item.anchor.range)&&t.add(i.item);return Array.from(t)}_installDblClickGesture(e){return this._editor.onMouseUp(async t=>{if(t.event.detail!==2)return;const i=this._getInlayHintLabelPart(t);if(i&&(t.event.preventDefault(),await i.item.resolve(He.None),is(i.item.hint.textEdits))){const n=i.item.hint.textEdits.map(s=>fi.replace(k.lift(s.range),s.text));this._editor.executeEdits("inlayHint.default",n),e()}})}_installContextMenu(){return this._editor.onContextMenu(async e=>{if(!ai(e.event.target))return;const t=this._getInlayHintLabelPart(e);t&&await this._instaService.invokeFunction(Tye,this._editor,e.event.target,t)})}_getInlayHintLabelPart(e){if(e.target.type!==6)return;const t=e.target.detail.injectedText?.options;if(t instanceof Mh&&t?.attachedData instanceof B5)return t.attachedData}async _invokeCommand(e,t){try{await this._commandService.executeCommand(e.id,...e.arguments??[])}catch(i){this._notificationService.notify({severity:k_.Error,source:t.provider.displayName,message:i})}}_cacheHintsForFastRestore(e){const t=this._copyInlayHintsWithCurrentAnchor(e);this._inlayHintsCache.set(e,t)}_copyInlayHintsWithCurrentAnchor(e){const t=new Map;for(const[i,n]of this._decorationsMetadata){if(t.has(n.item))continue;const s=e.getDecorationRange(i);if(s){const r=new GG(s,n.item.anchor.direction),a=n.item.with({anchor:r});t.set(n.item,a)}}return Array.from(t.values())}_getHintsRanges(){const t=this._editor.getModel(),i=this._editor.getVisibleRangesPlusViewportAboveBelow(),n=[];for(const s of i.sort(k.compareRangesUsingStarts)){const r=t.validateRange(new k(s.startLineNumber-30,s.startColumn,s.endLineNumber+30,s.endColumn));n.length===0||!k.areIntersectingOrTouching(n[n.length-1],r)?n.push(r):n[n.length-1]=k.plusRange(n[n.length-1],r)}return n}_updateHintsDecorators(e,t){const i=new Map;if(this._cursorInfo&&this._cursorInfo.notEarlierThan>Date.now()&&e.some(_=>_.containsPosition(this._cursorInfo.position))){const{position:_}=this._cursorInfo;this._cursorInfo=void 0;const b=new Map;for(const S of this._editor.getLineDecorations(_.lineNumber)??[]){const L=this._decorationsMetadata.get(S.id);if(S.range.startColumn>_.column)continue;const x=L?.decoration.options[L.item.anchor.direction];if(x&&x.attachedData!==Cb._whitespaceData){const I=b.get(L.item)??0;b.set(L.item,I+x.content.length)}}const C=t.filter(S=>S.anchor.range.startLineNumber===_.lineNumber&&S.anchor.range.endColumn<=_.column),w=Array.from(b.values());let v;for(;;){const S=C.shift(),L=w.shift();if(!L&&!S)break;if(S)i.set(S,L??0),v=S;else if(v&&L){let x=i.get(v);x+=L,x+=w.reduce((I,D)=>I+D,0),w.length=0;break}}}const n=[],s=(_,b,C,w,v)=>{const S={content:C,inlineClassNameAffectsLetterSpacing:!0,inlineClassName:b.className,cursorStops:w,attachedData:v};n.push({item:_,classNameRef:b,decoration:{range:_.anchor.range,options:{description:"InlayHint",showIfCollapsed:_.anchor.range.isEmpty(),collapseOnReplaceEdit:!_.anchor.range.isEmpty(),stickiness:0,[_.anchor.direction]:this._activeRenderMode===0?S:void 0}}})},r=(_,b)=>{const C=this._ruleFactory.createClassNameRef({width:`${a/3|0}px`,display:"inline-block"});s(_,C,"",b?yr.Right:yr.None,Cb._whitespaceData)},{fontSize:a,fontFamily:l,padding:c,isUniform:d}=this._getLayoutInfo(),h=this._editor.getOption(159).maximumLength,u="--code-editorInlayHintsFontFamily";this._editor.getContainerDomNode().style.setProperty(u,l);let f={line:0,totalLen:0};for(let _=0;_<t.length;_++){const b=t[_];if(f.line!==b.anchor.range.startLineNumber&&(f={line:b.anchor.range.startLineNumber,totalLen:0}),h&&f.totalLen>h)continue;b.hint.paddingLeft&&r(b,!1);const C=typeof b.hint.label=="string"?[{label:b.hint.label}]:b.hint.label,w=i.get(b);let v=0;for(let S=0;S<C.length;S++){const L=C[S],x=S===0,I=S===C.length-1,D={fontSize:`${a}px`,fontFamily:`var(${u}), ${bs.fontFamily}`,verticalAlign:d?"baseline":"middle",unicodeBidi:"isolate"};is(b.hint.textEdits)&&(D.cursor="default"),this._fillInColors(D,b.hint),(L.command||L.location)&&this._activeInlayHintPart?.part.item===b&&this._activeInlayHintPart.part.index===S&&(D.textDecoration="underline",this._activeInlayHintPart.hasTriggerModifier&&(D.color=ci(Yae),D.cursor="pointer"));let R=L.label;f.totalLen+=R.length;let F=!1;const O=h!==0?f.totalLen-h:0;if(O>0&&(R=R.slice(0,-O)+"…",F=!0),v+=R.length,w!==void 0){const B=v-w;B>=0&&(v-=B,R=R.slice(0,-(1+B))+"…",F=!0)}if(c&&(x&&(I||F)?(D.padding=`1px ${Math.max(1,a/4)|0}px`,D.borderRadius=`${a/4|0}px`):x?(D.padding=`1px 0 1px ${Math.max(1,a/4)|0}px`,D.borderRadius=`${a/4|0}px 0 0 ${a/4|0}px`):I||F?(D.padding=`1px ${Math.max(1,a/4)|0}px 1px 0`,D.borderRadius=`0 ${a/4|0}px ${a/4|0}px 0`):D.padding="1px 0 1px 0"),s(b,this._ruleFactory.createClassNameRef(D),Pye(R),I&&!b.hint.paddingRight?yr.Right:yr.None,new B5(b,S)),F)break}if(w!==void 0&&v<w){const S=w-v;s(b,this._ruleFactory.createClassNameRef({}),"".repeat(S),yr.None)}if(b.hint.paddingRight&&r(b,!0),n.length>Cb._MAX_DECORATORS)break}const g=[];for(const[_,b]of this._decorationsMetadata){const C=this._editor.getModel()?.getDecorationRange(_);C&&e.some(w=>w.containsRange(C))&&(g.push(_),b.classNameRef.dispose(),this._decorationsMetadata.delete(_))}const m=Aa.capture(this._editor);this._editor.changeDecorations(_=>{const b=_.deltaDecorations(g,n.map(C=>C.decoration));for(let C=0;C<b.length;C++){const w=n[C];this._decorationsMetadata.set(b[C],w)}}),m.restore(this._editor)}_fillInColors(e,t){t.kind===JL.Parameter?(e.backgroundColor=ci(sle),e.color=ci(nle)):t.kind===JL.Type?(e.backgroundColor=ci(ile),e.color=ci(tle)):(e.backgroundColor=ci(oM),e.color=ci(sM))}_getLayoutInfo(){const e=this._editor.getOption(159),t=e.padding,i=this._editor.getOption(61),n=this._editor.getOption(58);let s=e.fontSize;(!s||s<5||s>i)&&(s=i);const r=e.fontFamily||n;return{fontSize:s,fontFamily:r,padding:t,isUniform:!t&&r===n&&s===i}}_removeAllDecorations(){this._editor.removeDecorations(Array.from(this._decorationsMetadata.keys()));for(const e of this._decorationsMetadata.values())e.classNameRef.dispose();this._decorationsMetadata.clear()}},Cb=jd,jd.ID="editor.contrib.InlayHints",jd._MAX_DECORATORS=1500,jd._whitespaceData={},jd);Qw=Cb=Rye([bb(1,he),bb(2,Or),bb(3,QZ),bb(4,Tt),bb(5,hi),bb(6,ge)],Qw);function Pye(o){return o.replace(/[ \t]/g," ")}Xe.registerCommand("_executeInlayHintProvider",async(o,...e)=>{const[t,i]=e;it(be.isUri(t)),it(k.isIRange(i));const{inlayHintsProvider:n}=o.get(he),s=await o.get(ns).createModelReference(t);try{const r=await iI.create(n,s.object.textEditorModel,[k.lift(i)],He.None),a=r.items.map(l=>l.hint);return setTimeout(()=>r.dispose(),0),a}finally{s.dispose()}});var Aye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qh=function(o,e){return function(t,i){e(t,i,o)}};class JZ extends Mw{constructor(e,t,i,n){super(10,t,e.item.anchor.range,i,n,!0),this.part=e}}let TI=class extends Fw{constructor(e,t,i,n,s,r,a,l,c){super(e,t,i,r,l,n,s,c),this._resolverService=a,this.hoverOrdinal=6}suggestHoverAnchor(e){if(!Qw.get(this._editor)||e.target.type!==6)return null;const i=e.target.detail.injectedText?.options;return i instanceof Mh&&i.attachedData instanceof B5?new JZ(i.attachedData,this,e.event.posx,e.event.posy):null}computeSync(){return[]}computeAsync(e,t,i,n){return e instanceof JZ?new gr(async s=>{const{part:r}=e;if(await r.item.resolve(n),n.isCancellationRequested)return;let a;typeof r.item.hint.tooltip=="string"?a=new qn().appendText(r.item.hint.tooltip):r.item.hint.tooltip&&(a=r.item.hint.tooltip),a&&s.emitOne(new ra(this,e.range,[a],!1,0)),is(r.item.hint.textEdits)&&s.emitOne(new ra(this,e.range,[new qn().appendText(p(1157,"Double-click to insert"))],!1,10001));let l;if(typeof r.part.tooltip=="string"?l=new qn().appendText(r.part.tooltip):r.part.tooltip&&(l=r.part.tooltip),l&&s.emitOne(new ra(this,e.range,[l],!1,1)),r.part.location||r.part.command){let d;const u=this._editor.getOption(86)==="altKey"?ze?p(1158,"cmd + click"):p(1159,"ctrl + click"):ze?p(1160,"option + click"):p(1161,"alt + click");r.part.location&&r.part.command?d=new qn().appendText(p(1162,"Go to Definition ({0}), right click for more",u)):r.part.location?d=new qn().appendText(p(1163,"Go to Definition ({0})",u)):r.part.command&&(d=new qn(`[${p(1164,"Execute Command")}](${Z0e(r.part.command)} "${r.part.command.title}") (${u})`,{isTrusted:!0})),d&&s.emitOne(new ra(this,e.range,[d],!1,1e4))}const c=this._resolveInlayHintLabelPartHover(r,n);for await(const d of c)s.emitOne(d)}):gr.EMPTY}async*_resolveInlayHintLabelPartHover(e,t){if(!e.part.location)return;const{uri:i,range:n}=e.part.location,s=await this._resolverService.createModelReference(i);try{const r=s.object.textEditorModel;if(!this._languageFeaturesService.hoverProvider.has(r))return;for await(const a of z4(this._languageFeaturesService.hoverProvider,r,new M(n.startLineNumber,n.startColumn),t))B_(a.hover.contents)||(yield new ra(this,e.item.anchor.range,a.hover.contents,!1,2+a.ordinal))}finally{s.dispose()}}};TI=Aye([Qh(1,Mt),Qh(2,Js),Qh(3,ot),Qh(4,Qs),Qh(5,Me),Qh(6,ns),Qh(7,he),Qh(8,Tt)],TI);var eY=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},RI=function(o,e){return function(t,i){e(t,i,o)}},H5,V5;let z5=H5=class extends A{constructor(e,t,i,n,s,r){super();const a=t.hoverParts;this._renderedHoverParts=this._register(new U5(e,i,a,n,s,r));const l=t.options,c=l.anchor,{showAtPosition:d,showAtSecondaryPosition:h}=H5.computeHoverPositions(e,c.range,a);this.shouldAppearBeforeContent=a.some(u=>u.isBeforeContent),this.showAtPosition=d,this.showAtSecondaryPosition=h,this.initialMousePosX=c.initialMousePosX,this.initialMousePosY=c.initialMousePosY,this.shouldFocus=l.shouldFocus,this.source=l.source}get domNode(){return this._renderedHoverParts.domNode}get domNodeHasChildren(){return this._renderedHoverParts.domNodeHasChildren}get focusedHoverPartIndex(){return this._renderedHoverParts.focusedHoverPartIndex}get hoverPartsCount(){return this._renderedHoverParts.hoverPartsCount}focusHoverPartWithIndex(e){this._renderedHoverParts.focusHoverPartWithIndex(e)}async updateHoverVerbosityLevel(e,t,i){this._renderedHoverParts.updateHoverVerbosityLevel(e,t,i)}isColorPickerVisible(){return this._renderedHoverParts.isColorPickerVisible()}static computeHoverPositions(e,t,i){let n=1;if(e.hasModel()){const d=e._getViewModel(),h=d.coordinatesConverter,u=h.convertModelRangeToViewRange(t),f=d.getLineMinColumn(u.startLineNumber),g=new M(u.startLineNumber,f);n=h.convertViewPositionToModelPosition(g).column}const s=t.startLineNumber;let r=t.startColumn,a;for(const d of i){const h=d.range,u=h.startLineNumber===s,f=h.endLineNumber===s;if(u&&f){const m=h.startColumn,_=Math.min(r,m);r=Math.max(_,n)}d.forceShowAtRange&&(a=h)}let l,c;if(a){const d=a.getStartPosition();l=d,c=d}else l=t.getStartPosition(),c=new M(s,r);return{showAtPosition:l,showAtSecondaryPosition:c}}};z5=H5=eY([RI(4,ot),RI(5,Qs)],z5);class Oye{constructor(e,t){this._statusBar=t,e.appendChild(this._statusBar.hoverElement)}get hoverElement(){return this._statusBar.hoverElement}get actions(){return this._statusBar.actions}dispose(){this._statusBar.dispose()}}let U5=(zp=class extends A{constructor(e,t,i,n,s,r){super(),this._renderedParts=[],this._focusedHoverPartIndex=-1,this._context=n,this._fragment=document.createDocumentFragment(),this._register(this._renderParts(t,i,n,s,r)),this._register(this._registerListenersOnRenderedParts()),this._register(this._createEditorDecorations(e,i)),this._updateMarkdownAndColorParticipantInfo(t)}_createEditorDecorations(e,t){if(t.length===0)return A.None;let i=t[0].range;for(const s of t){const r=s.range;i=k.plusRange(i,r)}const n=e.createDecorationsCollection();return n.set([{range:i,options:V5._DECORATION_OPTIONS}]),ue(()=>{n.clear()})}_renderParts(e,t,i,n,s){const r=new Zk(n,s),a={fragment:this._fragment,statusBar:r,...i},l=new U;l.add(r);for(const d of e){const h=this._renderHoverPartsForParticipant(t,d,a);l.add(h);for(const u of h.renderedHoverParts)this._renderedParts.push({type:"hoverPart",participant:d,hoverPart:u.hoverPart,hoverElement:u.hoverElement})}const c=this._renderStatusBar(this._fragment,r);return c&&(l.add(c),this._renderedParts.push({type:"statusBar",hoverElement:c.hoverElement,actions:c.actions})),l}_renderHoverPartsForParticipant(e,t,i){const n=e.filter(r=>r.owner===t);return n.length>0?t.renderHoverParts(i,n):new Mg([])}_renderStatusBar(e,t){if(t.hasContent)return new Oye(e,t)}_registerListenersOnRenderedParts(){const e=new U;return this._renderedParts.forEach((t,i)=>{const n=t.hoverElement;n.tabIndex=0,e.add(W(n,te.FOCUS_IN,s=>{s.stopPropagation(),this._focusedHoverPartIndex=i})),e.add(W(n,te.FOCUS_OUT,s=>{s.stopPropagation(),this._focusedHoverPartIndex=-1}))}),e}_updateMarkdownAndColorParticipantInfo(e){const t=e.find(i=>i instanceof Fw&&!(i instanceof TI));t&&(this._markdownHoverParticipant=t),this._colorHoverParticipant=e.find(i=>i instanceof Jk)}focusHoverPartWithIndex(e){e<0||e>=this._renderedParts.length||this._renderedParts[e].hoverElement.focus()}async updateHoverVerbosityLevel(e,t,i){if(!this._markdownHoverParticipant)return;let n;t>=0?n={start:t,endExclusive:t+1}:n=this._findRangeOfMarkdownHoverParts(this._markdownHoverParticipant);for(let s=n.start;s<n.endExclusive;s++){const r=this._normalizedIndexToMarkdownHoverIndexRange(this._markdownHoverParticipant,s);if(r===void 0)continue;const a=await this._markdownHoverParticipant.updateMarkdownHoverVerbosityLevel(e,r);a&&(this._renderedParts[s]={type:"hoverPart",participant:this._markdownHoverParticipant,hoverPart:a.hoverPart,hoverElement:a.hoverElement})}i&&(t>=0?this.focusHoverPartWithIndex(t):this._context.focus()),this._context.onContentsChanged()}isColorPickerVisible(){return this._colorHoverParticipant?.isColorPickerVisible()??!1}_normalizedIndexToMarkdownHoverIndexRange(e,t){const i=this._renderedParts[t];if(!i||i.type!=="hoverPart"||!(i.participant===e))return;const s=this._renderedParts.findIndex(r=>r.type==="hoverPart"&&r.participant===e);if(s===-1)throw new Ce;return t-s}_findRangeOfMarkdownHoverParts(e){const t=this._renderedParts.slice(),i=t.findIndex(r=>r.type==="hoverPart"&&r.participant===e),n=t.reverse().findIndex(r=>r.type==="hoverPart"&&r.participant===e),s=n>=0?t.length-n:n;return{start:i,endExclusive:s+1}}get domNode(){return this._fragment}get domNodeHasChildren(){return this._fragment.hasChildNodes()}get focusedHoverPartIndex(){return this._focusedHoverPartIndex}get hoverPartsCount(){return this._renderedParts.length}},V5=zp,zp._DECORATION_OPTIONS=Te.register({description:"content-hover-highlight",className:"hoverHighlight"}),zp);U5=V5=eY([RI(4,ot),RI(5,Qs)],U5);var Fye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$5=function(o,e){return function(t,i){e(t,i,o)}};let j5=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._instantiationService=t,this._keybindingService=i,this._hoverService=n,this._currentResult=null,this._renderedContentHover=this._register(new ct),this._onContentsChanged=this._register(new P),this.onContentsChanged=this._onContentsChanged.event,this._contentHoverWidget=this._register(this._instantiationService.createInstance(V4,this._editor)),this._participants=this._initializeHoverParticipants(),this._hoverOperation=this._register(new EG(this._editor,new Gk(this._editor,this._participants))),this._registerListeners()}_initializeHoverParticipants(){const e=[];for(const t of Pg.getAll()){const i=this._instantiationService.createInstance(t,this._editor);e.push(i)}return e.sort((t,i)=>t.hoverOrdinal-i.hoverOrdinal),this._register(this._contentHoverWidget.onDidResize(()=>{this._participants.forEach(t=>t.handleResize?.())})),this._register(this._contentHoverWidget.onDidScroll(t=>{this._participants.forEach(i=>i.handleScroll?.(t))})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._participants.forEach(t=>t.handleContentsChanged?.())})),e}_registerListeners(){this._register(this._hoverOperation.onResult(t=>{const i=t.hasLoadingMessage?this._addLoadingMessage(t):t.value;this._withResult(new AG(i,t.isComplete,t.options))}));const e=this._contentHoverWidget.getDomNode();this._register(Si(e,"keydown",t=>{t.equals(9)&&this.hide()})),this._register(Si(e,"mouseleave",t=>{this._onMouseLeave(t)})),this._register(di.onDidChange(()=>{this._contentHoverWidget.position&&this._currentResult&&this._setCurrentResult(this._currentResult)})),this._register(this._contentHoverWidget.onContentsChanged(()=>{this._onContentsChanged.fire()}))}_startShowingOrUpdateHover(e,t,i,n,s){if(!(this._contentHoverWidget.position&&this._currentResult))return e?(this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):!1;const a=this._editor.getOption(69).sticky,l=s&&this._contentHoverWidget.isMouseGettingCloser(s.event.posx,s.event.posy);return a&&l?(e&&this._startHoverOperationIfNecessary(e,t,i,n,!0),!0):e?this._currentResult&&this._currentResult.options.anchor.equals(e)?!0:this._currentResult&&e.canAdoptVisibleHover(this._currentResult.options.anchor,this._contentHoverWidget.position)?(this._currentResult&&this._setCurrentResult(this._currentResult.filter(e)),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),this._startHoverOperationIfNecessary(e,t,i,n,!1),!0):(this._setCurrentResult(null),!1)}_startHoverOperationIfNecessary(e,t,i,n,s){if(this._hoverOperation.options&&this._hoverOperation.options.anchor.equals(e))return;this._hoverOperation.cancel();const a={anchor:e,source:i,shouldFocus:n,insistOnKeepingHoverVisible:s};this._hoverOperation.start(t,a)}_setCurrentResult(e){let t=e;if(this._currentResult===t)return;t&&t.hoverParts.length===0&&(t=null),this._currentResult=t,this._currentResult?this._showHover(this._currentResult):this._hideHover()}_addLoadingMessage(e){for(const t of this._participants){if(!t.createLoadingMessage)continue;const i=t.createLoadingMessage(e.options.anchor);if(i)return e.value.slice(0).concat([i])}return e.value}_withResult(e){if(this._contentHoverWidget.position&&this._currentResult&&this._currentResult.isComplete||this._setCurrentResult(e),!e.isComplete)return;const n=e.hoverParts.length===0,s=e.options.insistOnKeepingHoverVisible;n&&s||this._setCurrentResult(e)}_showHover(e){const t=this._getHoverContext();this._renderedContentHover.value=new z5(this._editor,e,this._participants,t,this._keybindingService,this._hoverService),this._renderedContentHover.value.domNodeHasChildren?this._contentHoverWidget.show(this._renderedContentHover.value):this._renderedContentHover.clear()}_hideHover(){this._contentHoverWidget.hide(),this._participants.forEach(e=>e.handleHide?.())}_getHoverContext(){return{hide:()=>{this.hide()},onContentsChanged:()=>{this._contentHoverWidget.handleContentsChanged()},setMinimumDimensions:s=>{this._contentHoverWidget.setMinimumDimensions(s)},focus:()=>this.focus()}}showsOrWillShow(e){if(this._contentHoverWidget.isResizing)return!0;const i=this._findHoverAnchorCandidates(e);if(!(i.length>0))return this._startShowingOrUpdateHover(null,0,0,!1,e);const s=i[0];return this._startShowingOrUpdateHover(s,0,0,!1,e)}_findHoverAnchorCandidates(e){const t=[];for(const n of this._participants){if(!n.suggestHoverAnchor)continue;const s=n.suggestHoverAnchor(e);s&&t.push(s)}const i=e.target;switch(i.type){case 6:{t.push(new D4(0,i.range,e.event.posx,e.event.posy));break}case 7:{const n=this._editor.getOption(59).typicalHalfwidthCharacterWidth/2;if(!(!i.detail.isAfterLines&&typeof i.detail.horizontalDistanceToText=="number"&&i.detail.horizontalDistanceToText<n))break;t.push(new D4(0,i.range,e.event.posx,e.event.posy));break}}return t.sort((n,s)=>s.priority-n.priority),t}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!$k(t,e.x,e.y))&&this.hide()}startShowingAtRange(e,t,i,n){this._startShowingOrUpdateHover(new D4(0,e,void 0,void 0),t,i,n,null)}async updateHoverVerbosityLevel(e,t,i){this._renderedContentHover.value?.updateHoverVerbosityLevel(e,t,i)}focusedHoverPartIndex(){return this._renderedContentHover.value?.focusedHoverPartIndex??-1}containsNode(e){return e?this._contentHoverWidget.getDomNode().contains(e):!1}focus(){if(this._renderedContentHover.value?.hoverPartsCount===1){this.focusHoverPartWithIndex(0);return}this._contentHoverWidget.focus()}focusHoverPartWithIndex(e){this._renderedContentHover.value?.focusHoverPartWithIndex(e)}scrollUp(){this._contentHoverWidget.scrollUp()}scrollDown(){this._contentHoverWidget.scrollDown()}scrollLeft(){this._contentHoverWidget.scrollLeft()}scrollRight(){this._contentHoverWidget.scrollRight()}pageUp(){this._contentHoverWidget.pageUp()}pageDown(){this._contentHoverWidget.pageDown()}goToTop(){this._contentHoverWidget.goToTop()}goToBottom(){this._contentHoverWidget.goToBottom()}hide(){this._hoverOperation.cancel(),this._setCurrentResult(null)}getDomNode(){return this._contentHoverWidget.getDomNode()}get isColorPickerVisible(){return this._renderedContentHover.value?.isColorPickerVisible()??!1}get isVisibleFromKeyboard(){return this._contentHoverWidget.isVisibleFromKeyboard}get isVisible(){return this._contentHoverWidget.isVisible}get isFocused(){return this._contentHoverWidget.isFocused}get isResizing(){return this._contentHoverWidget.isResizing}get widget(){return this._contentHoverWidget}};j5=Fye([$5(1,ge),$5(2,ot),$5(3,Qs)],j5);function tY(o){const e=o.target;return!!e&&e.type===6&&e.detail.injectedText?.options.attachedData===LG}var Wye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},q5=function(o,e){return function(t,i){e(t,i,o)}},K5;let Yn=(Up=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._instantiationService=i,this._keybindingService=n,this._onHoverContentsChanged=this._register(new P),this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new U,this._isMouseDown=!1,this._ignoreMouseEvents=!1,this._reactToEditorMouseMoveRunner=this._register(new wt(()=>{this._mouseMoveEvent&&this._reactToEditorMouseMove(this._mouseMoveEvent)},0)),this._register(t.onDidShowContextMenu(()=>{this.hideContentHover(),this._ignoreMouseEvents=!0})),this._register(t.onDidHideContextMenu(()=>{this._ignoreMouseEvents=!1})),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(s=>{s.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}static get(e){return e.getContribution(K5.ID)}_hookListeners(){const e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled||this._cancelSchedulerAndHide(),this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>this._cancelSchedulerAndHide())),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelSchedulerAndHide(){this._cancelScheduler(),this.hideContentHover()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){this._ignoreMouseEvents||(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideContentHover()}_onEditorMouseDown(e){this._ignoreMouseEvents||(this._isMouseDown=!0,this._shouldKeepHoverWidgetVisible(e))||this.hideContentHover()}_shouldKeepHoverWidgetVisible(e){return this._isMouseOnContentHoverWidget(e)||this._isContentWidgetResizing()||tY(e)}_isMouseOnContentHoverWidget(e){return this._contentWidget?$k(this._contentWidget.getDomNode(),e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._ignoreMouseEvents||(this._isMouseDown=!1)}_onEditorMouseLeave(e){this._ignoreMouseEvents||this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._shouldKeepHoverWidgetVisible(e))||this.hideContentHover()}_shouldKeepCurrentHover(e){const t=this._contentWidget;if(!t)return!1;const i=this._hoverSettings.sticky,n=(d,h)=>{const u=this._isMouseOnContentHoverWidget(d);return h&&u},s=d=>{const h=t.isColorPickerVisible,u=this._isMouseOnContentHoverWidget(d),f=h&&u,g=h&&this._isMouseDown;return f||g},r=(d,h)=>{const u=d.event.browserEvent.view;return u?h&&t.containsNode(u.document.activeElement)&&!u.getSelection()?.isCollapsed:!1},a=t.isFocused,l=t.isResizing,c=this._hoverSettings.sticky&&t.isVisibleFromKeyboard;return this.shouldKeepOpenOnEditorMouseMoveOrLeave||a||l||c||n(e,i)||s(e)||r(e,i)}_onEditorMouseMove(e){if(this._ignoreMouseEvents)return;if(this._mouseMoveEvent=e,this._shouldKeepCurrentHover(e)){this._reactToEditorMouseMoveRunner.cancel();return}if(this._shouldRescheduleHoverComputation()){this._reactToEditorMouseMoveRunner.isScheduled()||this._reactToEditorMouseMoveRunner.schedule(this._hoverSettings.hidingDelay);return}this._reactToEditorMouseMove(e)}_shouldRescheduleHoverComputation(){const e=this._hoverSettings.hidingDelay;return(this._contentWidget?.isVisible??!1)&&this._hoverSettings.sticky&&e>0}_reactToEditorMouseMove(e){this._hoverSettings.enabled&&this._getOrCreateContentWidget().showsOrWillShow(e)||this.hideContentHover()}_onKeyDown(e){if(this._ignoreMouseEvents||!this._contentWidget)return;const t=this._isPotentialKeyboardShortcut(e),i=this._isModifierKeyPressed(e);t||i||this._contentWidget.isFocused&&e.keyCode===2||this.hideContentHover()}_isPotentialKeyboardShortcut(e){if(!this._editor.hasModel()||!this._contentWidget)return!1;const t=this._keybindingService.softDispatch(e,this._editor.getDomNode()),i=t.kind===1,n=t.kind===2&&(t.commandId===xG||t.commandId===zk||t.commandId===Uk)&&this._contentWidget.isVisible;return i||n}_isModifierKeyPressed(e){return e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4}hideContentHover(){hb.dropDownVisible||this._contentWidget?.hide()}_getOrCreateContentWidget(){return this._contentWidget||(this._contentWidget=this._instantiationService.createInstance(j5,this._editor),this._listenersStore.add(this._contentWidget.onContentsChanged(()=>this._onHoverContentsChanged.fire()))),this._contentWidget}showContentHover(e,t,i,n){this._getOrCreateContentWidget().startShowingAtRange(e,t,i,n)}_isContentWidgetResizing(){return this._contentWidget?.widget.isResizing||!1}focusedHoverPartIndex(){return this._getOrCreateContentWidget().focusedHoverPartIndex()}updateHoverVerbosityLevel(e,t,i){this._getOrCreateContentWidget().updateHoverVerbosityLevel(e,t,i)}focus(){this._contentWidget?.focus()}scrollUp(){this._contentWidget?.scrollUp()}scrollDown(){this._contentWidget?.scrollDown()}scrollLeft(){this._contentWidget?.scrollLeft()}scrollRight(){this._contentWidget?.scrollRight()}pageUp(){this._contentWidget?.pageUp()}pageDown(){this._contentWidget?.pageDown()}goToTop(){this._contentWidget?.goToTop()}goToBottom(){this._contentWidget?.goToBottom()}get isColorPickerVisible(){return this._contentWidget?.isColorPickerVisible}get isHoverVisible(){return this._contentWidget?.isVisible}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._contentWidget?.dispose()}},K5=Up,Up.ID="editor.contrib.contentHover",Up);Yn=K5=Wye([q5(1,Ko),q5(2,ge),q5(3,ot)],Yn);const dB=class dB extends A{constructor(e){super(),this._editor=e,this._register(e.onMouseDown(t=>this.onMouseDown(t)))}dispose(){super.dispose()}onMouseDown(e){const t=this._editor.getOption(168);if(t!=="click"&&t!=="clickAndHover"||!tY(e))return;const i=this._editor.getContribution(Yn.ID);if(!i||i.isColorPickerVisible)return;const n=e.target.range;if(!n)return;const s=new k(n.startLineNumber,n.startColumn+1,n.endLineNumber,n.endColumn+1);i.showContentHover(s,1,1,!1)}};dB.ID="editor.contrib.colorContribution";let MI=dB;var Bye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hye=function(o,e){return function(t,i){e(t,i,o)}};class G5{constructor(e,t,i,n){this.owner=e,this.range=t,this.model=i,this.provider=n}static fromBaseColor(e,t){return new G5(e,t.range,t.model,t.provider)}}class Vye extends A{constructor(e,t,i,n){super();const s=e.getModel(),r=i.model;this.color=i.model.color,this.colorPicker=this._register(new UG(t.fragment,r,e.getOption(163),n,"standalone")),this._register(r.onColorFlushed(a=>{this.color=a})),this._register(r.onDidChangeColor(a=>{Bw(s,r,a,i.range,i)})),this._register(e.onDidChangeModelContent(a=>{t.hide(),e.focus()})),Bw(s,r,this.color,i.range,i)}}let Z5=class{constructor(e,t){this._editor=e,this._themeService=t}async createColorHover(e,t,i){if(!this._editor.hasModel()||!db.get(this._editor))return null;const s=await wG(i,this._editor.getModel(),He.None);let r=null,a=null;for(const u of s){const f=u.colorInfo;k.containsRange(f.range,e.range)&&(r=f,a=u.provider)}const l=r??e,c=a??t,d=!!r;return{colorHover:G5.fromBaseColor(this,await $G(this._editor.getModel(),l,c)),foundInEditor:d}}async updateEditorModel(e){if(!this._editor.hasModel())return;const t=e.model;let i=new k(e.range.startLineNumber,e.range.startColumn,e.range.endLineNumber,e.range.endColumn);this._color&&(await Bw(this._editor.getModel(),t,this._color,i,e),i=jG(this._editor,i,t))}renderHoverParts(e,t){if(!(t.length===0||!this._editor.hasModel()))return this._setMinimumDimensions(e),this._renderedParts=new Vye(this._editor,e,t[0],this._themeService),this._renderedParts}_setMinimumDimensions(e){const t=this._editor.getOption(75)+8;e.setMinimumDimensions(new dt(302,t))}get _color(){return this._renderedParts?.color}};Z5=Bye([Hye(1,li)],Z5);var zye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jw=function(o,e){return function(t,i){e(t,i,o)}},Y5;class Uye{constructor(e,t){this.value=e,this.foundInEditor=t}}const iY=8,$ye=22;let X5=($p=class extends A{constructor(e,t,i,n,s,r,a,l){super(),this._editor=e,this._standaloneColorPickerVisible=t,this._standaloneColorPickerFocused=i,this._keybindingService=s,this._languageFeaturesService=r,this._editorWorkerService=a,this._hoverService=l,this.allowEditorOverflow=!0,this._position=void 0,this._body=document.createElement("div"),this._colorHover=null,this._selectionSetInEditor=!1,this._onResult=this._register(new P),this.onResult=this._onResult.event,this._renderedHoverParts=this._register(new ct),this._renderedStatusBar=this._register(new ct),this._standaloneColorPickerVisible.set(!0),this._standaloneColorPickerParticipant=n.createInstance(Z5,this._editor),this._position=this._editor._getViewModel()?.getPrimaryCursorState().modelState.position;const c=this._editor.getSelection(),d=c?{startLineNumber:c.startLineNumber,startColumn:c.startColumn,endLineNumber:c.endLineNumber,endColumn:c.endColumn}:{startLineNumber:0,endLineNumber:0,endColumn:0,startColumn:0},h=this._register(br(this._body));this._register(h.onDidBlur(u=>{this.hide()})),this._register(h.onDidFocus(u=>{this.focus()})),this._register(this._editor.onDidChangeCursorPosition(()=>{this._selectionSetInEditor?this._selectionSetInEditor=!1:this.hide()})),this._register(this._editor.onMouseMove(u=>{const f=u.target.element?.classList;f&&f.contains("colorpicker-color-decoration")&&this.hide()})),this._register(this.onResult(u=>{this._render(u.value,u.foundInEditor)})),this._start(d),this._body.style.zIndex="50",this._editor.addContentWidget(this)}updateEditor(){this._colorHover&&this._standaloneColorPickerParticipant.updateEditorModel(this._colorHover)}getId(){return Y5.ID}getDomNode(){return this._body}getPosition(){if(!this._position)return null;const e=this._editor.getOption(69).above;return{position:this._position,secondaryPosition:this._position,preference:e?[1,2]:[2,1],positionAffinity:2}}hide(){this.dispose(),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerFocused.set(!1),this._editor.removeContentWidget(this),this._editor.focus()}focus(){this._standaloneColorPickerFocused.set(!0),this._body.focus()}async _start(e){const t=await this._computeAsync(e);t&&this._onResult.fire(new Uye(t.result,t.foundInEditor))}async _computeAsync(e){if(!this._editor.hasModel())return null;const t={range:e,color:{red:0,green:0,blue:0,alpha:1}},i=await this._standaloneColorPickerParticipant.createColorHover(t,new Pw(this._editorWorkerService),this._languageFeaturesService.colorProvider);return i?{result:i.colorHover,foundInEditor:i.foundInEditor}:null}_render(e,t){const i=document.createDocumentFragment();this._renderedStatusBar.value=this._register(new Zk(this._keybindingService,this._hoverService));const n={fragment:i,statusBar:this._renderedStatusBar.value,onContentsChanged:()=>{},setMinimumDimensions:()=>{},hide:()=>this.hide(),focus:()=>this.focus()};if(this._colorHover=e,this._renderedHoverParts.value=this._standaloneColorPickerParticipant.renderHoverParts(n,[e]),!this._renderedHoverParts.value){this._renderedStatusBar.clear(),this._renderedHoverParts.clear();return}const s=this._renderedHoverParts.value.colorPicker;this._body.classList.add("standalone-colorpicker-body"),this._body.style.maxHeight=Math.max(this._editor.getLayoutInfo().height/4,250)+"px",this._body.style.maxWidth=Math.max(this._editor.getLayoutInfo().width*.66,500)+"px",this._body.tabIndex=0,this._body.appendChild(i),s.layout();const r=s.body,a=r.saturationBox.domNode.clientWidth,l=r.domNode.clientWidth-a-$ye-iY,c=s.body.enterButton;c?.onClicked(()=>{this.updateEditor(),this.hide()});const d=s.header,h=d.pickedColorNode;h.style.width=a+iY+"px";const u=d.originalColorNode;u.style.width=l+"px",s.header.closeButton?.onClicked(()=>{this.hide()}),t&&(c&&(c.button.textContent="Replace"),this._selectionSetInEditor=!0,this._editor.setSelection(e.range)),this._editor.layoutContentWidget(this)}},Y5=$p,$p.ID="editor.contrib.standaloneColorPickerWidget",$p);X5=Y5=zye([Jw(3,ge),Jw(4,ot),Jw(5,he),Jw(6,Xs),Jw(7,Qs)],X5);var jye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nY=function(o,e){return function(t,i){e(t,i,o)}},Q5;let Kg=(jp=class extends A{constructor(e,t,i){super(),this._editor=e,this._instantiationService=i,this._standaloneColorPickerWidget=null,this._standaloneColorPickerVisible=T.standaloneColorPickerVisible.bindTo(t),this._standaloneColorPickerFocused=T.standaloneColorPickerFocused.bindTo(t)}showOrFocus(){this._editor.hasModel()&&(this._standaloneColorPickerVisible.get()?this._standaloneColorPickerFocused.get()||this._standaloneColorPickerWidget?.focus():this._standaloneColorPickerWidget=this._instantiationService.createInstance(X5,this._editor,this._standaloneColorPickerVisible,this._standaloneColorPickerFocused))}hide(){this._standaloneColorPickerFocused.set(!1),this._standaloneColorPickerVisible.set(!1),this._standaloneColorPickerWidget?.hide(),this._editor.focus()}insertColor(){this._standaloneColorPickerWidget?.updateEditor(),this.hide()}static get(e){return e.getContribution(Q5.ID)}},Q5=jp,jp.ID="editor.contrib.standaloneColorPickerController",jp);Kg=Q5=jye([nY(1,xe),nY(2,ge)],Kg);class qye extends Zr{constructor(){super({id:"editor.action.showOrFocusStandaloneColorPicker",title:{...H(884,"Show or Focus Standalone Color Picker"),mnemonicTitle:p(883,"&&Show or Focus Standalone Color Picker")},precondition:void 0,menu:[{id:de.CommandPalette}],metadata:{description:H(885,"Show or focus a standalone color picker which uses the default color provider. It displays hex/rgb/hsl colors.")}})}runEditorCommand(e,t){Kg.get(t)?.showOrFocus()}}class Kye extends le{constructor(){super({id:"editor.action.hideColorPicker",label:H(886,"Hide the Color Picker"),precondition:T.standaloneColorPickerVisible.isEqualTo(!0),kbOpts:{primary:9,weight:100},metadata:{description:H(887,"Hide the standalone color picker.")}})}run(e,t){Kg.get(t)?.hide()}}class Gye extends le{constructor(){super({id:"editor.action.insertColorWithStandaloneColorPicker",label:H(888,"Insert Color with Standalone Color Picker"),precondition:T.standaloneColorPickerFocused.isEqualTo(!0),kbOpts:{primary:3,weight:100},metadata:{description:H(889,"Insert hex/rgb/hsl colors with the focused standalone color picker.")}})}run(e,t){Kg.get(t)?.insertColor()}}ne(Kye),ne(Gye),mt(qye),Qe(MI.ID,MI,2),Qe(Kg.ID,Kg,1),Qe(db.ID,db,1),cb(N4),Pg.register(Jk),Xe.registerCommand("_executeDocumentColorProvider",function(o,...e){const[t]=e;if(!(t instanceof be))throw dr();const{model:i,colorProviderRegistry:n,defaultColorDecoratorsEnablement:s}=yG(o,t);return T4(new Jwe,n,i,He.None,s)}),Xe.registerCommand("_executeColorPresentationProvider",function(o,...e){const[t,i]=e,{uri:n,range:s}=i;if(!(n instanceof be)||!Array.isArray(t)||t.length!==4||!k.isIRange(s))throw dr();const{model:r,colorProviderRegistry:a,defaultColorDecoratorsEnablement:l}=yG(o,n),[c,d,h,u]=t;return T4(new e0e({range:s,color:{red:c,green:d,blue:h,alpha:u}}),a,r,He.None,l)});class Jh{constructor(e,t,i){this.languageConfigurationService=i,this._selection=e,this._insertSpace=t,this._usedEndToken=null}static _haystackHasNeedleAtOffset(e,t,i){if(i<0)return!1;const n=t.length,s=e.length;if(i+n>s)return!1;for(let r=0;r<n;r++){const a=e.charCodeAt(i+r),l=t.charCodeAt(r);if(a!==l&&!(a>=65&&a<=90&&a+32===l)&&!(l>=65&&l<=90&&l+32===a))return!1}return!0}_createOperationsForBlockComment(e,t,i,n,s,r){const a=e.startLineNumber,l=e.startColumn,c=e.endLineNumber,d=e.endColumn,h=s.getLineContent(a),u=s.getLineContent(c);let f=h.lastIndexOf(t,l-1+t.length),g=u.indexOf(i,d-1-i.length);if(f!==-1&&g!==-1)if(a===c)h.substring(f+t.length,g).indexOf(i)>=0&&(f=-1,g=-1);else{const _=h.substring(f+t.length),b=u.substring(0,g);(_.indexOf(i)>=0||b.indexOf(i)>=0)&&(f=-1,g=-1)}let m;f!==-1&&g!==-1?(n&&f+t.length<h.length&&h.charCodeAt(f+t.length)===32&&(t=t+" "),n&&g>0&&u.charCodeAt(g-1)===32&&(i=" "+i,g-=1),m=Jh._createRemoveBlockCommentOperations(new k(a,f+t.length+1,c,g+1),t,i)):(m=Jh._createAddBlockCommentOperations(e,t,i,this._insertSpace),this._usedEndToken=m.length===1?i:null);for(const _ of m)r.addTrackedEditOperation(_.range,_.text)}static _createRemoveBlockCommentOperations(e,t,i){const n=[];return k.isEmpty(e)?n.push(fi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.endLineNumber,e.endColumn+i.length))):(n.push(fi.delete(new k(e.startLineNumber,e.startColumn-t.length,e.startLineNumber,e.startColumn))),n.push(fi.delete(new k(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn+i.length)))),n}static _createAddBlockCommentOperations(e,t,i,n){const s=[];return k.isEmpty(e)?s.push(fi.replace(new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),t+" "+i)):(s.push(fi.insert(new M(e.startLineNumber,e.startColumn),t+(n?" ":""))),s.push(fi.insert(new M(e.endLineNumber,e.endColumn),(n?" ":"")+i))),s}getEditOperations(e,t){const i=this._selection.startLineNumber,n=this._selection.startColumn;e.tokenization.tokenizeIfCheap(i);const s=e.getLanguageIdAtPosition(i,n),r=this.languageConfigurationService.getLanguageConfiguration(s).comments;!r||!r.blockCommentStartToken||!r.blockCommentEndToken||this._createOperationsForBlockComment(this._selection,r.blockCommentStartToken,r.blockCommentEndToken,this._insertSpace,e,t)}computeCursorState(e,t){const i=t.getInverseEditOperations();if(i.length===2){const n=i[0],s=i[1];return new ce(n.range.endLineNumber,n.range.endColumn,s.range.startLineNumber,s.range.startColumn)}else{const n=i[0].range,s=this._usedEndToken?-this._usedEndToken.length-1:0;return new ce(n.endLineNumber,n.endColumn+s,n.endLineNumber,n.endColumn+s)}}}class Ld{constructor(e,t,i,n,s,r,a){this.languageConfigurationService=e,this._selection=t,this._indentSize=i,this._type=n,this._insertSpace=s,this._selectionId=null,this._deltaColumn=0,this._moveEndPositionDown=!1,this._ignoreEmptyLines=r,this._ignoreFirstLine=a||!1}static _gatherPreflightCommentStrings(e,t,i,n){e.tokenization.tokenizeIfCheap(t);const s=e.getLanguageIdAtPosition(t,1),r=n.getLanguageConfiguration(s).comments,a=r?r.lineCommentToken:null;if(!a)return null;const l=[];for(let c=0,d=i-t+1;c<d;c++)l[c]={ignore:!1,commentStr:a,commentStrOffset:0,commentStrLength:a.length};return l}static _analyzeLines(e,t,i,n,s,r,a,l,c){let d=!0;const u=l.getLanguageConfiguration(c).comments?.lineCommentNoIndent??!1;let f;e===0?f=!0:e===1?f=!1:f=!0;for(let g=0,m=n.length;g<m;g++){const _=n[g],b=s+g;if(b===s&&a){_.ignore=!0;continue}const C=i.getLineContent(b),w=es(C);if(w===-1){_.ignore=r,_.commentStrOffset=u?0:C.length;continue}d=!1;const v=u?0:w;if(_.ignore=!1,_.commentStrOffset=v,f&&!Jh._haystackHasNeedleAtOffset(C,_.commentStr,v)&&(e===0?f=!1:e===1||(_.ignore=!0)),f&&t){const S=w+_.commentStrLength;S<C.length&&C.charCodeAt(S)===32&&(_.commentStrLength+=1)}}if(e===0&&d){f=!1;for(let g=0,m=n.length;g<m;g++)n[g].ignore=!1}return{supported:!0,shouldRemoveComments:f,lines:n}}static _gatherPreflightData(e,t,i,n,s,r,a,l){const c=Ld._gatherPreflightCommentStrings(i,n,s,l),d=i.getLanguageIdAtPosition(n,1);return c===null?{supported:!1}:Ld._analyzeLines(e,t,i,c,n,r,a,l,d)}_executeLineComments(e,t,i,n){let s;i.shouldRemoveComments?s=Ld._createRemoveLineCommentsOperations(i.lines,n.startLineNumber):(Ld._normalizeInsertionPoint(e,i.lines,n.startLineNumber,this._indentSize),s=this._createAddLineCommentsOperations(i.lines,n.startLineNumber));const r=new M(n.positionLineNumber,n.positionColumn);for(let a=0,l=s.length;a<l;a++)t.addEditOperation(s[a].range,s[a].text),k.isEmpty(s[a].range)&&k.getStartPosition(s[a].range).equals(r)&&e.getLineContent(r.lineNumber).length+1===r.column&&(this._deltaColumn=(s[a].text||"").length);this._selectionId=t.trackSelection(n)}_attemptRemoveBlockComment(e,t,i,n){let s=t.startLineNumber,r=t.endLineNumber;const a=n.length+Math.max(e.getLineFirstNonWhitespaceColumn(t.startLineNumber),t.startColumn);let l=e.getLineContent(s).lastIndexOf(i,a-1),c=e.getLineContent(r).indexOf(n,t.endColumn-1-i.length);return l!==-1&&c===-1&&(c=e.getLineContent(s).indexOf(n,l+i.length),r=s),l===-1&&c!==-1&&(l=e.getLineContent(r).lastIndexOf(i,c),s=r),t.isEmpty()&&(l===-1||c===-1)&&(l=e.getLineContent(s).indexOf(i),l!==-1&&(c=e.getLineContent(s).indexOf(n,l+i.length))),l!==-1&&e.getLineContent(s).charCodeAt(l+i.length)===32&&(i+=" "),c!==-1&&e.getLineContent(r).charCodeAt(c-1)===32&&(n=" "+n,c-=1),l!==-1&&c!==-1?Jh._createRemoveBlockCommentOperations(new k(s,l+i.length+1,r,c+1),i,n):null}_executeBlockComment(e,t,i){e.tokenization.tokenizeIfCheap(i.startLineNumber);const n=e.getLanguageIdAtPosition(i.startLineNumber,1),s=this.languageConfigurationService.getLanguageConfiguration(n).comments;if(!s||!s.blockCommentStartToken||!s.blockCommentEndToken)return;const r=s.blockCommentStartToken,a=s.blockCommentEndToken;let l=this._attemptRemoveBlockComment(e,i,r,a);if(!l){if(i.isEmpty()){const c=e.getLineContent(i.startLineNumber);let d=es(c);d===-1&&(d=c.length),l=Jh._createAddBlockCommentOperations(new k(i.startLineNumber,d+1,i.startLineNumber,c.length+1),r,a,this._insertSpace)}else l=Jh._createAddBlockCommentOperations(new k(i.startLineNumber,e.getLineFirstNonWhitespaceColumn(i.startLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),r,a,this._insertSpace);l.length===1&&(this._deltaColumn=r.length+1)}this._selectionId=t.trackSelection(i);for(const c of l)t.addEditOperation(c.range,c.text)}getEditOperations(e,t){let i=this._selection;if(this._moveEndPositionDown=!1,i.startLineNumber===i.endLineNumber&&this._ignoreFirstLine){t.addEditOperation(new k(i.startLineNumber,e.getLineMaxColumn(i.startLineNumber),i.startLineNumber+1,1),i.startLineNumber===e.getLineCount()?"":`
`),this._selectionId=t.trackSelection(i);return}i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._moveEndPositionDown=!0,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=Ld._gatherPreflightData(this._type,this._insertSpace,e,i.startLineNumber,i.endLineNumber,this._ignoreEmptyLines,this._ignoreFirstLine,this.languageConfigurationService);return n.supported?this._executeLineComments(e,t,n,i):this._executeBlockComment(e,t,i)}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),new ce(i.selectionStartLineNumber,i.selectionStartColumn+this._deltaColumn,i.positionLineNumber,i.positionColumn+this._deltaColumn)}static _createRemoveLineCommentsOperations(e,t){const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];r.ignore||i.push(fi.delete(new k(t+n,r.commentStrOffset+1,t+n,r.commentStrOffset+r.commentStrLength+1)))}return i}_createAddLineCommentsOperations(e,t){const i=[],n=this._insertSpace?" ":"";for(let s=0,r=e.length;s<r;s++){const a=e[s];a.ignore||i.push(fi.insert(new M(t+s,a.commentStrOffset+1),a.commentStr+n))}return i}static nextVisibleColumn(e,t,i,n){return i?e+(t-e%t):e+n}static _normalizeInsertionPoint(e,t,i,n){let s=1073741824,r,a;for(let l=0,c=t.length;l<c;l++){if(t[l].ignore)continue;const d=e.getLineContent(i+l);let h=0;for(let u=0,f=t[l].commentStrOffset;h<s&&u<f;u++)h=Ld.nextVisibleColumn(h,n,d.charCodeAt(u)===9,1);h<s&&(s=h)}s=Math.floor(s/n)*n;for(let l=0,c=t.length;l<c;l++){if(t[l].ignore)continue;const d=e.getLineContent(i+l);let h=0;for(r=0,a=t[l].commentStrOffset;h<s&&r<a;r++)h=Ld.nextVisibleColumn(h,n,d.charCodeAt(r)===9,1);h>s?t[l].commentStrOffset=r-1:t[l].commentStrOffset=r}}}class J5 extends le{constructor(e,t){super(t),this._type=e}run(e,t){const i=e.get(Jt);if(!t.hasModel())return;const n=t.getModel(),s=[],r=n.getOptions(),a=t.getOption(29),l=t.getSelections().map((d,h)=>({selection:d,index:h,ignoreFirstLine:!1}));l.sort((d,h)=>k.compareRangesUsingStarts(d.selection,h.selection));let c=l[0];for(let d=1;d<l.length;d++){const h=l[d];c.selection.endLineNumber===h.selection.startLineNumber&&(c.index<h.index?h.ignoreFirstLine=!0:(c.ignoreFirstLine=!0,c=h))}for(const d of l)s.push(new Ld(i,d.selection,r.indentSize,this._type,a.insertSpace,a.ignoreEmptyLines,d.ignoreFirstLine));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class Zye extends J5{constructor(){super(0,{id:"editor.action.commentLine",label:H(892,"Toggle Line Comment"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2138,weight:100},menuOpts:{menuId:de.MenubarEditMenu,group:"5_insert",title:p(890,"&&Toggle Line Comment"),order:1}})}}class Yye extends J5{constructor(){super(1,{id:"editor.action.addCommentLine",label:H(893,"Add Line Comment"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2081),weight:100}})}}class Xye extends J5{constructor(){super(2,{id:"editor.action.removeCommentLine",label:H(894,"Remove Line Comment"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2099),weight:100}})}}class Qye extends le{constructor(){super({id:"editor.action.blockComment",label:H(895,"Toggle Block Comment"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1567,linux:{primary:3103},weight:100},menuOpts:{menuId:de.MenubarEditMenu,group:"5_insert",title:p(891,"Toggle &&Block Comment"),order:2}})}run(e,t){const i=e.get(Jt);if(!t.hasModel())return;const n=t.getOption(29),s=[],r=t.getSelections();for(const a of r)s.push(new Jh(a,n.insertSpace,i));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}ne(Zye),ne(Yye),ne(Xye),ne(Qye);var Jye=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Gg=function(o,e){return function(t,i){e(t,i,o)}},eF;let e0=(qp=class{static get(e){return e.getContribution(eF.ID)}constructor(e,t,i,n,s,r,a,l){this._contextMenuService=t,this._contextViewService=i,this._contextKeyService=n,this._keybindingService=s,this._menuService=r,this._configurationService=a,this._workspaceContextService=l,this._toDispose=new U,this._contextMenuIsBeingShownCount=0,this._editor=e,this._toDispose.add(this._editor.onContextMenu(c=>this._onContextMenu(c))),this._toDispose.add(this._editor.onMouseWheel(c=>{if(this._contextMenuIsBeingShownCount>0){const d=this._contextViewService.getContextViewElement(),h=c.srcElement;h.shadowRoot&&ah(d)===h.shadowRoot||this._contextViewService.hideContextView()}})),this._toDispose.add(this._editor.onKeyDown(c=>{this._editor.getOption(30)&&c.keyCode===58&&(c.preventDefault(),c.stopPropagation(),this.showContextMenu())}))}_onContextMenu(e){if(!this._editor.hasModel())return;if(!this._editor.getOption(30)){this._editor.focus(),e.target.position&&!this._editor.getSelection().containsPosition(e.target.position)&&this._editor.setPosition(e.target.position);return}if(e.target.type===12||e.target.type===6&&e.target.detail.injectedText)return;if(e.event.preventDefault(),e.event.stopPropagation(),e.target.type===11)return this._showScrollbarContextMenu(e.event);if(e.target.type!==6&&e.target.type!==7&&e.target.type!==1)return;if(this._editor.focus(),e.target.position){let i=!1;for(const n of this._editor.getSelections())if(n.containsPosition(e.target.position)){i=!0;break}i||this._editor.setPosition(e.target.position)}let t=null;e.target.type!==1&&(t=e.event),this.showContextMenu(t)}showContextMenu(e){if(!this._editor.getOption(30)||!this._editor.hasModel())return;const t=this._getMenuActions(this._editor.getModel(),this._editor.contextMenuId);t.length>0&&this._doShowContextMenu(t,e)}_getMenuActions(e,t){const i=[],n=this._menuService.getMenuActions(t,this._contextKeyService,{arg:e.uri});for(const s of n){const[,r]=s;let a=0;for(const l of r)if(l instanceof bf){const c=this._getMenuActions(e,l.item.submenu);c.length>0&&(i.push(new Bm(l.id,l.label,c)),a++)}else i.push(l),a++;a&&i.push(new Xi)}return i.length&&i.pop(),i}_doShowContextMenu(e,t=null){if(!this._editor.hasModel())return;let i=t;if(!i){this._editor.revealPosition(this._editor.getPosition(),1),this._editor.render();const s=this._editor.getScrolledVisiblePosition(this._editor.getPosition()),r=mi(this._editor.getDomNode()),a=r.left+s.left,l=r.top+s.top+s.height;i={x:a,y:l}}const n=this._editor.getOption(144)&&!ur;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:n?this._editor.getOverflowWidgetsDomNode()??this._editor.getDomNode():void 0,getAnchor:()=>i,getActions:()=>e,getActionViewItem:s=>{const r=this._keybindingFor(s);if(r)return new z_(s,s,{label:!0,keybinding:r.getLabel(),isMenu:!0});const a=s;return typeof a.getActionViewItem=="function"?a.getActionViewItem():new z_(s,s,{icon:!0,label:!0,isMenu:!0})},getKeyBinding:s=>this._keybindingFor(s),onHide:s=>{this._contextMenuIsBeingShownCount--}})}_showScrollbarContextMenu(e){if(!this._editor.hasModel()||Jve(this._workspaceContextService.getWorkspace()))return;const t=this._editor.getOption(81);let i=0;const n=c=>({id:`menu-action-${++i}`,label:c.label,tooltip:"",class:void 0,enabled:typeof c.enabled>"u"?!0:c.enabled,checked:c.checked,run:c.run}),s=(c,d)=>new Bm(`menu-action-${++i}`,c,d,void 0),r=(c,d,h,u,f)=>{if(!d)return n({label:c,enabled:d,run:()=>{}});const g=_=>()=>{this._configurationService.updateValue(h,_)},m=[];for(const _ of f)m.push(n({label:_.label,checked:u===_.value,run:g(_.value)}));return s(c,m)},a=[];a.push(n({label:p(896,"Minimap"),checked:t.enabled,run:()=>{this._configurationService.updateValue("editor.minimap.enabled",!t.enabled)}})),a.push(new Xi),a.push(n({label:p(897,"Render Characters"),enabled:t.enabled,checked:t.renderCharacters,run:()=>{this._configurationService.updateValue("editor.minimap.renderCharacters",!t.renderCharacters)}})),a.push(r(p(898,"Vertical size"),t.enabled,"editor.minimap.size",t.size,[{label:p(899,"Proportional"),value:"proportional"},{label:p(900,"Fill"),value:"fill"},{label:p(901,"Fit"),value:"fit"}])),a.push(r(p(902,"Slider"),t.enabled,"editor.minimap.showSlider",t.showSlider,[{label:p(903,"Mouse Over"),value:"mouseover"},{label:p(904,"Always"),value:"always"}]));const l=this._editor.getOption(144)&&!ur;this._contextMenuIsBeingShownCount++,this._contextMenuService.showContextMenu({domForShadowRoot:l?this._editor.getDomNode():void 0,getAnchor:()=>e,getActions:()=>a,onHide:c=>{this._contextMenuIsBeingShownCount--,this._editor.focus()}})}_keybindingFor(e){return this._keybindingService.lookupKeybinding(e.id)}dispose(){this._contextMenuIsBeingShownCount>0&&this._contextViewService.hideContextView(),this._toDispose.dispose()}},eF=qp,qp.ID="editor.contrib.contextmenu",qp);e0=eF=Jye([Gg(1,Ko),Gg(2,hd),Gg(3,xe),Gg(4,ot),Gg(5,Cr),Gg(6,Me),Gg(7,pd)],e0);class eLe extends le{constructor(){super({id:"editor.action.showContextMenu",label:H(905,"Show Editor Context Menu"),precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:1092,weight:100}})}run(e,t){e0.get(t)?.showContextMenu()}}Qe(e0.ID,e0,2),ne(eLe);class tF{constructor(e){this.selections=e}equals(e){const t=this.selections.length,i=e.selections.length;if(t!==i)return!1;for(let n=0;n<t;n++)if(!this.selections[n].equalsSelection(e.selections[n]))return!1;return!0}}class iF{constructor(e,t,i){this.cursorState=e,this.scrollTop=t,this.scrollLeft=i}}const FN=class FN extends A{static get(e){return e.getContribution(FN.ID)}constructor(e){super(),this._editor=e,this._isCursorUndoRedo=!1,this._undoStack=[],this._redoStack=[],this._register(e.onDidChangeModel(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeModelContent(t=>{this._undoStack=[],this._redoStack=[]})),this._register(e.onDidChangeCursorSelection(t=>{if(this._isCursorUndoRedo||!t.oldSelections||t.oldModelVersionId!==t.modelVersionId)return;const i=new tF(t.oldSelections);this._undoStack.length>0&&this._undoStack[this._undoStack.length-1].cursorState.equals(i)||(this._undoStack.push(new iF(i,e.getScrollTop(),e.getScrollLeft())),this._redoStack=[],this._undoStack.length>50&&this._undoStack.shift())}))}cursorUndo(){!this._editor.hasModel()||this._undoStack.length===0||(this._redoStack.push(new iF(new tF(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._undoStack.pop()))}cursorRedo(){!this._editor.hasModel()||this._redoStack.length===0||(this._undoStack.push(new iF(new tF(this._editor.getSelections()),this._editor.getScrollTop(),this._editor.getScrollLeft())),this._applyState(this._redoStack.pop()))}_applyState(e){this._isCursorUndoRedo=!0,this._editor.setSelections(e.cursorState.selections),this._editor.setScrollPosition({scrollTop:e.scrollTop,scrollLeft:e.scrollLeft}),this._isCursorUndoRedo=!1}};FN.ID="editor.contrib.cursorUndoRedoController";let vb=FN;class tLe extends le{constructor(){super({id:"cursorUndo",label:H(906,"Cursor Undo"),precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:2099,weight:100}})}run(e,t,i){vb.get(t)?.cursorUndo()}}class iLe extends le{constructor(){super({id:"cursorRedo",label:H(907,"Cursor Redo"),precondition:void 0})}run(e,t,i){vb.get(t)?.cursorRedo()}}Qe(vb.ID,vb,0),ne(tLe),ne(iLe);class nLe{constructor(e,t,i){this.selection=e,this.targetPosition=t,this.copy=i,this.targetSelection=null}getEditOperations(e,t){const i=e.getValueInRange(this.selection);if(this.copy||t.addEditOperation(this.selection,null),t.addEditOperation(new k(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column),i),this.selection.containsPosition(this.targetPosition)&&!(this.copy&&(this.selection.getEndPosition().equals(this.targetPosition)||this.selection.getStartPosition().equals(this.targetPosition)))){this.targetSelection=this.selection;return}if(this.copy){this.targetSelection=new ce(this.targetPosition.lineNumber,this.targetPosition.column,this.selection.endLineNumber-this.selection.startLineNumber+this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber>this.selection.endLineNumber){this.targetSelection=new ce(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}if(this.targetPosition.lineNumber<this.selection.endLineNumber){this.targetSelection=new ce(this.targetPosition.lineNumber,this.targetPosition.column,this.targetPosition.lineNumber+this.selection.endLineNumber-this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column+this.selection.endColumn-this.selection.startColumn:this.selection.endColumn);return}this.selection.endColumn<=this.targetPosition.column?this.targetSelection=new ce(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column-this.selection.endColumn+this.selection.startColumn:this.targetPosition.column-this.selection.endColumn+this.selection.startColumn,this.targetPosition.lineNumber,this.selection.startLineNumber===this.selection.endLineNumber?this.targetPosition.column:this.selection.endColumn):this.targetSelection=new ce(this.targetPosition.lineNumber-this.selection.endLineNumber+this.selection.startLineNumber,this.targetPosition.column,this.targetPosition.lineNumber,this.targetPosition.column+this.selection.endColumn-this.selection.startColumn)}computeCursorState(e,t){return this.targetSelection}}function wb(o){return ze?o.altKey:o.ctrlKey}const Mu=class Mu extends A{constructor(e){super(),this._editor=e,this._dndDecorationIds=this._editor.createDecorationsCollection(),this._register(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._register(this._editor.onMouseUp(t=>this._onEditorMouseUp(t))),this._register(this._editor.onMouseDrag(t=>this._onEditorMouseDrag(t))),this._register(this._editor.onMouseDrop(t=>this._onEditorMouseDrop(t))),this._register(this._editor.onMouseDropCanceled(()=>this._onEditorMouseDropCanceled())),this._register(this._editor.onKeyDown(t=>this.onEditorKeyDown(t))),this._register(this._editor.onKeyUp(t=>this.onEditorKeyUp(t))),this._register(this._editor.onDidBlurEditorWidget(()=>this.onEditorBlur())),this._register(this._editor.onDidBlurEditorText(()=>this.onEditorBlur())),this._mouseDown=!1,this._modifierPressed=!1,this._dragSelection=null}onEditorBlur(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1}onEditorKeyDown(e){!this._editor.getOption(42)||this._editor.getOption(28)||(wb(e)&&(this._modifierPressed=!0),this._mouseDown&&wb(e)&&this._editor.updateOptions({mouseStyle:"copy"}))}onEditorKeyUp(e){!this._editor.getOption(42)||this._editor.getOption(28)||(wb(e)&&(this._modifierPressed=!1),this._mouseDown&&e.keyCode===Mu.TRIGGER_KEY_VALUE&&this._editor.updateOptions({mouseStyle:"default"}))}_onEditorMouseDown(e){this._mouseDown=!0}_onEditorMouseUp(e){this._mouseDown=!1,this._editor.updateOptions({mouseStyle:"text"})}_onEditorMouseDrag(e){const t=e.target;if(this._dragSelection===null){const n=(this._editor.getSelections()||[]).filter(s=>t.position&&s.containsPosition(t.position));if(n.length===1)this._dragSelection=n[0];else return}wb(e.event)?this._editor.updateOptions({mouseStyle:"copy"}):this._editor.updateOptions({mouseStyle:"default"}),t.position&&(this._dragSelection.containsPosition(t.position)?this._removeDecoration():this.showAt(t.position))}_onEditorMouseDropCanceled(){this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}_onEditorMouseDrop(e){if(e.target&&(this._hitContent(e.target)||this._hitMargin(e.target))&&e.target.position){const t=new M(e.target.position.lineNumber,e.target.position.column);if(this._dragSelection===null){let i=null;if(e.event.shiftKey){const n=this._editor.getSelection();if(n){const{selectionStartLineNumber:s,selectionStartColumn:r}=n;i=[new ce(s,r,t.lineNumber,t.column)]}}else i=(this._editor.getSelections()||[]).map(n=>n.containsPosition(t)?new ce(t.lineNumber,t.column,t.lineNumber,t.column):n);this._editor.setSelections(i||[],"mouse",3)}else(!this._dragSelection.containsPosition(t)||(wb(e.event)||this._modifierPressed)&&(this._dragSelection.getEndPosition().equals(t)||this._dragSelection.getStartPosition().equals(t)))&&(this._editor.pushUndoStop(),this._editor.executeCommand(Mu.ID,new nLe(this._dragSelection,t,wb(e.event)||this._modifierPressed)),this._editor.pushUndoStop())}this._editor.updateOptions({mouseStyle:"text"}),this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1}showAt(e){this._dndDecorationIds.set([{range:new k(e.lineNumber,e.column,e.lineNumber,e.column),options:Mu._DECORATION_OPTIONS}]),this._editor.revealPosition(e,1)}_removeDecoration(){this._dndDecorationIds.clear()}_hitContent(e){return e.type===6||e.type===7}_hitMargin(e){return e.type===2||e.type===3||e.type===4}dispose(){this._removeDecoration(),this._dragSelection=null,this._mouseDown=!1,this._modifierPressed=!1,super.dispose()}};Mu.ID="editor.contrib.dragAndDrop",Mu.TRIGGER_KEY_VALUE=ze?6:5,Mu._DECORATION_OPTIONS=Te.register({description:"dnd-target",className:"dnd-target"});let PI=Mu;Qe(PI.ID,PI,2);const sLe="editor.action.pasteAs";Qe(_d.ID,_d,0),cb(n4),re(new class extends Bi{constructor(){super({id:GK,precondition:u4,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e){return _d.get(e)?.changePasteType()}}),re(new class extends Bi{constructor(){super({id:"editor.hidePasteWidget",precondition:u4,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e){_d.get(e)?.clearWidgets()}}),ne((Kp=class extends le{constructor(){super({id:sLe,label:H(910,"Paste As..."),precondition:T.writable,metadata:{description:"Paste as",args:[{name:"args",schema:Kp.argsSchema}]}})}run(e,t,i){let n;return i&&("kind"in i?n={only:new si(i.kind)}:"preferences"in i&&(n={preferences:i.preferences.map(s=>new si(s))})),_d.get(t)?.pasteAs(n)}},Kp.argsSchema={oneOf:[{type:"object",required:["kind"],properties:{kind:{type:"string",description:p(908,`The kind of the paste edit to try pasting with.
If there are multiple edits for this kind, the editor will show a picker. If there are no edits of this kind, the editor will show an error message.`)}}},{type:"object",required:["preferences"],properties:{preferences:{type:"array",description:p(909,`List of preferred paste edit kind to try applying.
The first edit matching the preferences will be applied.`),items:{type:"string"}}}}]},Kp)),ne(class extends le{constructor(){super({id:"editor.action.pasteAsText",label:H(911,"Paste as Text"),precondition:T.writable})}run(o,e){return _d.get(e)?.pasteAs({providerId:Lg.id})}});class oLe{constructor(){this._dragOperations=new Map}removeDragOperationTransfer(e){if(e&&this._dragOperations.has(e)){const t=this._dragOperations.get(e);return this._dragOperations.delete(e),t}}}class sY{constructor(e){this.identifier=e}}const oY=We("treeViewsDndService");je(oY,oLe,1);var rLe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},AI=function(o,e){return function(t,i){e(t,i,o)}},xd;const aLe="editor.dropIntoEditor.preferences",rY="editor.changeDropType",nF=new ae("dropWidgetVisible",!1,p(929,"Whether the drop widget is showing"));let Sb=(Gp=class extends A{static get(e){return e.getContribution(xd.ID)}constructor(e,t,i,n,s){super(),this._configService=i,this._languageFeaturesService=n,this._treeViewsDragAndDropService=s,this.treeItemsTransfer=$O.getInstance(),this._dropProgressManager=this._register(t.createInstance(Ik,"dropIntoEditor",e)),this._postDropWidgetManager=this._register(t.createInstance(Ok,"dropIntoEditor",e,nF,{id:rY,label:p(930,"Show drop options...")},()=>xd._configureDefaultAction?[xd._configureDefaultAction]:[])),this._register(e.onDropIntoEditor(r=>this.onDropIntoEditor(e,r.position,r.event)))}clearWidgets(){this._postDropWidgetManager.clear()}changeDropType(){this._postDropWidgetManager.tryShowSelector()}async onDropIntoEditor(e,t,i){if(!i.dataTransfer||!e.hasModel())return;xd._currentDropOperation?.cancel(),e.focus(),e.setPosition(t);const n=Vi(async s=>{const r=new U,a=r.add(new ud(e,1,void 0,s));try{const l=await this.extractDataTransferData(i);if(l.size===0||a.token.isCancellationRequested)return;const c=e.getModel();if(!c)return;const d=this._languageFeaturesService.documentDropEditProvider.ordered(c).filter(u=>u.dropMimeTypes?u.dropMimeTypes.some(f=>l.matches(f)):!0),h=r.add(await this.getDropEdits(d,c,t,l,a.token));if(a.token.isCancellationRequested)return;if(h.edits.length){const u=this.getInitialActiveEditIndex(c,h.edits),f=e.getOption(43).showDropSelector==="afterDrop";await this._postDropWidgetManager.applyEditAndShowIfNeeded([k.fromPositions(t)],{activeEditIndex:u,allEdits:h.edits},f,async g=>g,s)}}finally{r.dispose(),xd._currentDropOperation===n&&(xd._currentDropOperation=void 0)}});this._dropProgressManager.showWhile(t,p(931,"Running drop handlers. Click to cancel"),n,{cancel:()=>n.cancel()}),xd._currentDropOperation=n}async getDropEdits(e,t,i,n,s){const r=new U,a=await Em(Promise.all(e.map(async c=>{try{const d=await c.provideDocumentDropEdits(t,i,n,s);return d&&r.add(d),d?.edits.map(h=>({...h,providerId:c.id}))}catch(d){Do(d)||console.error(d),console.error(d)}})),s),l=wa(a??[]).flat();return{edits:HK(l),dispose:()=>r.dispose()}}getInitialActiveEditIndex(e,t){const i=this._configService.getValue(aLe,{resource:e.uri});for(const n of Array.isArray(i)?i:[]){const s=new si(n),r=t.findIndex(a=>a.kind&&s.contains(a.kind));if(r>=0)return r}return 0}async extractDataTransferData(e){if(!e.dataTransfer)return new yK;const t=EK(e.dataTransfer);if(this.treeItemsTransfer.hasData(sY.prototype)){const i=this.treeItemsTransfer.getData(sY.prototype);if(Array.isArray(i))for(const n of i){const s=await this._treeViewsDragAndDropService.removeDragOperationTransfer(n.identifier);if(s)for(const[r,a]of s)t.replace(r,a)}}return t}},xd=Gp,Gp.ID="editor.contrib.dropIntoEditorController",Gp);Sb=xd=rLe([AI(1,ge),AI(2,Me),AI(3,he),AI(4,oY)],Sb),Qe(Sb.ID,Sb,2),cb(i4),re(new class extends Bi{constructor(){super({id:rY,precondition:nF,kbOpts:{weight:100,primary:2137}})}runEditorCommand(o,e,t){Sb.get(e)?.changeDropType()}}),re(new class extends Bi{constructor(){super({id:"editor.hideDropWidget",precondition:nF,kbOpts:{weight:100,primary:9}})}runEditorCommand(o,e,t){Sb.get(e)?.clearWidgets()}});const us=class us{constructor(e){this._editor=e,this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null,this._startPosition=this._editor.getPosition()}dispose(){this._editor.removeDecorations(this._allDecorations()),this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}reset(){this._decorations=[],this._overviewRulerApproximateDecorations=[],this._findScopeDecorationIds=[],this._rangeHighlightDecorationId=null,this._highlightedDecorationId=null}getCount(){return this._decorations.length}getFindScope(){return this._findScopeDecorationIds[0]?this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]):null}getFindScopes(){if(this._findScopeDecorationIds.length){const e=this._findScopeDecorationIds.map(t=>this._editor.getModel().getDecorationRange(t)).filter(t=>!!t);if(e.length)return e}return null}getStartPosition(){return this._startPosition}setStartPosition(e){this._startPosition=e,this.setCurrentFindMatch(null)}_getDecorationIndex(e){const t=this._decorations.indexOf(e);return t>=0?t+1:1}getDecorationRangeAt(e){const t=e<this._decorations.length?this._decorations[e]:null;return t?this._editor.getModel().getDecorationRange(t):null}getCurrentMatchesPosition(e){const t=this._editor.getModel().getDecorationsInRange(e);for(const i of t){const n=i.options;if(n===us._FIND_MATCH_DECORATION||n===us._CURRENT_FIND_MATCH_DECORATION)return this._getDecorationIndex(i.id)}return 0}setCurrentFindMatch(e){let t=null,i=0;if(e)for(let n=0,s=this._decorations.length;n<s;n++){const r=this._editor.getModel().getDecorationRange(this._decorations[n]);if(e.equalsRange(r)){t=this._decorations[n],i=n+1;break}}return(this._highlightedDecorationId!==null||t!==null)&&this._editor.changeDecorations(n=>{if(this._highlightedDecorationId!==null&&(n.changeDecorationOptions(this._highlightedDecorationId,us._FIND_MATCH_DECORATION),this._highlightedDecorationId=null),t!==null&&(this._highlightedDecorationId=t,n.changeDecorationOptions(this._highlightedDecorationId,us._CURRENT_FIND_MATCH_DECORATION)),this._rangeHighlightDecorationId!==null&&(n.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),t!==null){let s=this._editor.getModel().getDecorationRange(t);if(s.startLineNumber!==s.endLineNumber&&s.endColumn===1){const r=s.endLineNumber-1,a=this._editor.getModel().getLineMaxColumn(r);s=new k(s.startLineNumber,s.startColumn,r,a)}this._rangeHighlightDecorationId=n.addDecoration(s,us._RANGE_HIGHLIGHT_DECORATION)}}),i}set(e,t){this._editor.changeDecorations(i=>{let n=us._FIND_MATCH_DECORATION;const s=[];if(e.length>1e3){n=us._FIND_MATCH_NO_OVERVIEW_DECORATION;const a=this._editor.getModel().getLineCount(),c=this._editor.getLayoutInfo().height/a,d=Math.max(2,Math.ceil(3/c));let h=e[0].range.startLineNumber,u=e[0].range.endLineNumber;for(let f=1,g=e.length;f<g;f++){const m=e[f].range;u+d>=m.startLineNumber?m.endLineNumber>u&&(u=m.endLineNumber):(s.push({range:new k(h,1,u,1),options:us._FIND_MATCH_ONLY_OVERVIEW_DECORATION}),h=m.startLineNumber,u=m.endLineNumber)}s.push({range:new k(h,1,u,1),options:us._FIND_MATCH_ONLY_OVERVIEW_DECORATION})}const r=new Array(e.length);for(let a=0,l=e.length;a<l;a++)r[a]={range:e[a].range,options:n};this._decorations=i.deltaDecorations(this._decorations,r),this._overviewRulerApproximateDecorations=i.deltaDecorations(this._overviewRulerApproximateDecorations,s),this._rangeHighlightDecorationId&&(i.removeDecoration(this._rangeHighlightDecorationId),this._rangeHighlightDecorationId=null),this._findScopeDecorationIds.length&&(this._findScopeDecorationIds.forEach(a=>i.removeDecoration(a)),this._findScopeDecorationIds=[]),t?.length&&(this._findScopeDecorationIds=t.map(a=>i.addDecoration(a,us._FIND_SCOPE_DECORATION)))})}matchBeforePosition(e){if(this._decorations.length===0)return null;for(let t=this._decorations.length-1;t>=0;t--){const i=this._decorations[t],n=this._editor.getModel().getDecorationRange(i);if(!(!n||n.endLineNumber>e.lineNumber)){if(n.endLineNumber<e.lineNumber)return n;if(!(n.endColumn>e.column))return n}}return this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length-1])}matchAfterPosition(e){if(this._decorations.length===0)return null;for(let t=0,i=this._decorations.length;t<i;t++){const n=this._decorations[t],s=this._editor.getModel().getDecorationRange(n);if(!(!s||s.startLineNumber<e.lineNumber)){if(s.startLineNumber>e.lineNumber)return s;if(!(s.startColumn<e.column))return s}}return this._editor.getModel().getDecorationRange(this._decorations[0])}_allDecorations(){let e=[];return e=e.concat(this._decorations),e=e.concat(this._overviewRulerApproximateDecorations),this._findScopeDecorationIds.length&&e.push(...this._findScopeDecorationIds),this._rangeHighlightDecorationId&&e.push(this._rangeHighlightDecorationId),e}};us._CURRENT_FIND_MATCH_DECORATION=Te.register({description:"current-find-match",stickiness:1,zIndex:13,className:"currentFindMatch",inlineClassName:"currentFindMatchInline",showIfCollapsed:!0,overviewRuler:{color:ci(fM),position:Ao.Center},minimap:{color:ci(gM),position:1}}),us._FIND_MATCH_DECORATION=Te.register({description:"find-match",stickiness:1,zIndex:10,className:"findMatch",inlineClassName:"findMatchInline",showIfCollapsed:!0,overviewRuler:{color:ci(fM),position:Ao.Center},minimap:{color:ci(gM),position:1}}),us._FIND_MATCH_NO_OVERVIEW_DECORATION=Te.register({description:"find-match-no-overview",stickiness:1,className:"findMatch",showIfCollapsed:!0}),us._FIND_MATCH_ONLY_OVERVIEW_DECORATION=Te.register({description:"find-match-only-overview",stickiness:1,overviewRuler:{color:ci(fM),position:Ao.Center}}),us._RANGE_HIGHLIGHT_DECORATION=Te.register({description:"find-range-highlight",stickiness:1,className:"rangeHighlight",isWholeLine:!0}),us._FIND_SCOPE_DECORATION=Te.register({description:"find-scope",className:"findScope",isWholeLine:!0});let sF=us;class lLe{constructor(e,t,i){this._editorSelection=e,this._ranges=t,this._replaceStrings=i,this._trackedEditorSelectionId=null}getEditOperations(e,t){if(this._ranges.length>0){const i=[];for(let r=0;r<this._ranges.length;r++)i.push({range:this._ranges[r],text:this._replaceStrings[r]});i.sort((r,a)=>k.compareRangesUsingStarts(r.range,a.range));const n=[];let s=i[0];for(let r=1;r<i.length;r++)s.range.endLineNumber===i[r].range.startLineNumber&&s.range.endColumn===i[r].range.startColumn?(s.range=s.range.plusRange(i[r].range),s.text=s.text+i[r].text):(n.push(s),s=i[r]);n.push(s);for(const r of n)t.addEditOperation(r.range,r.text)}this._trackedEditorSelectionId=t.trackSelection(this._editorSelection)}computeCursorState(e,t){return t.getTrackedSelection(this._trackedEditorSelectionId)}}function aY(o,e){if(o&&o[0]!==""){const t=lY(o,e,"-"),i=lY(o,e,"_");return t&&!i?cY(o,e,"-"):!t&&i?cY(o,e,"_"):o[0].toUpperCase()===o[0]?e.toUpperCase():o[0].toLowerCase()===o[0]?e.toLowerCase():Rie(o[0][0])&&e.length>0?e[0].toUpperCase()+e.substr(1):o[0][0].toUpperCase()!==o[0][0]&&e.length>0?e[0].toLowerCase()+e.substr(1):e}else return e}function lY(o,e,t){return o[0].indexOf(t)!==-1&&e.indexOf(t)!==-1&&o[0].split(t).length===e.split(t).length}function cY(o,e,t){const i=e.split(t),n=o[0].split(t);let s="";return i.forEach((r,a)=>{s+=aY([n[a]],r)+t}),s.slice(0,-1)}class dY{constructor(e){this.staticValue=e,this.kind=0}}class cLe{constructor(e){this.pieces=e,this.kind=1}}class yb{static fromStaticValue(e){return new yb([Zg.staticValue(e)])}get hasReplacementPatterns(){return this._state.kind===1}constructor(e){!e||e.length===0?this._state=new dY(""):e.length===1&&e[0].staticValue!==null?this._state=new dY(e[0].staticValue):this._state=new cLe(e)}buildReplaceString(e,t){if(this._state.kind===0)return t?aY(e,this._state.staticValue):this._state.staticValue;let i="";for(let n=0,s=this._state.pieces.length;n<s;n++){const r=this._state.pieces[n];if(r.staticValue!==null){i+=r.staticValue;continue}let a=yb._substitute(r.matchIndex,e);if(r.caseOps!==null&&r.caseOps.length>0){const l=[],c=r.caseOps.length;let d=0;for(let h=0,u=a.length;h<u;h++){if(d>=c){l.push(a.slice(h));break}switch(r.caseOps[d]){case"U":l.push(a[h].toUpperCase());break;case"u":l.push(a[h].toUpperCase()),d++;break;case"L":l.push(a[h].toLowerCase());break;case"l":l.push(a[h].toLowerCase()),d++;break;default:l.push(a[h])}}a=l.join("")}i+=a}return i}static _substitute(e,t){if(t===null)return"";if(e===0)return t[0];let i="";for(;e>0;){if(e<t.length)return(t[e]||"")+i;i=String(e%10)+i,e=Math.floor(e/10)}return"$"+i}}class Zg{static staticValue(e){return new Zg(e,-1,null)}static caseOps(e,t){return new Zg(null,e,t)}constructor(e,t,i){this.staticValue=e,this.matchIndex=t,!i||i.length===0?this.caseOps=null:this.caseOps=i.slice(0)}}class dLe{constructor(e){this._source=e,this._lastCharIndex=0,this._result=[],this._resultLen=0,this._currentStaticPiece=""}emitUnchanged(e){this._emitStatic(this._source.substring(this._lastCharIndex,e)),this._lastCharIndex=e}emitStatic(e,t){this._emitStatic(e),this._lastCharIndex=t}_emitStatic(e){e.length!==0&&(this._currentStaticPiece+=e)}emitMatchIndex(e,t,i){this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Zg.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),this._result[this._resultLen++]=Zg.caseOps(e,i),this._lastCharIndex=t}finalize(){return this.emitUnchanged(this._source.length),this._currentStaticPiece.length!==0&&(this._result[this._resultLen++]=Zg.staticValue(this._currentStaticPiece),this._currentStaticPiece=""),new yb(this._result)}}function hLe(o){if(!o||o.length===0)return new yb(null);const e=[],t=new dLe(o);for(let i=0,n=o.length;i<n;i++){const s=o.charCodeAt(i);if(s===92){if(i++,i>=n)break;const r=o.charCodeAt(i);switch(r){case 92:t.emitUnchanged(i-1),t.emitStatic("\\",i+1);break;case 110:t.emitUnchanged(i-1),t.emitStatic(`
`,i+1);break;case 116:t.emitUnchanged(i-1),t.emitStatic(" ",i+1);break;case 117:case 85:case 108:case 76:t.emitUnchanged(i-1),t.emitStatic("",i+1),e.push(String.fromCharCode(r));break}continue}if(s===36){if(i++,i>=n)break;const r=o.charCodeAt(i);if(r===36){t.emitUnchanged(i-1),t.emitStatic("$",i+1);continue}if(r===48||r===38){t.emitUnchanged(i-1),t.emitMatchIndex(0,i+1,e),e.length=0;continue}if(49<=r&&r<=57){let a=r-48;if(i+1<n){const l=o.charCodeAt(i+1);if(48<=l&&l<=57){i++,a=a*10+(l-48),t.emitUnchanged(i-2),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}t.emitUnchanged(i-1),t.emitMatchIndex(a,i+1,e),e.length=0;continue}}}return t.finalize()}const kd=new ae("findWidgetVisible",!1);kd.toNegated();const OI=new ae("findInputFocussed",!1),oF=new ae("replaceInputFocussed",!1),FI={primary:545,mac:{primary:2593}},WI={primary:565,mac:{primary:2613}},BI={primary:560,mac:{primary:2608}},HI={primary:554,mac:{primary:2602}},VI={primary:558,mac:{primary:2606}},Vt={StartFindAction:"actions.find",StartFindWithSelection:"actions.findWithSelection",StartFindWithArgs:"editor.actions.findWithArgs",NextMatchFindAction:"editor.action.nextMatchFindAction",PreviousMatchFindAction:"editor.action.previousMatchFindAction",GoToMatchFindAction:"editor.action.goToMatchFindAction",NextSelectionMatchFindAction:"editor.action.nextSelectionMatchFindAction",PreviousSelectionMatchFindAction:"editor.action.previousSelectionMatchFindAction",StartFindReplaceAction:"editor.action.startFindReplaceAction",CloseFindWidgetCommand:"closeFindWidget",ToggleCaseSensitiveCommand:"toggleFindCaseSensitive",ToggleWholeWordCommand:"toggleFindWholeWord",ToggleRegexCommand:"toggleFindRegex",ToggleSearchScopeCommand:"toggleFindInSelection",TogglePreserveCaseCommand:"togglePreserveCase",ReplaceOneAction:"editor.action.replaceOne",ReplaceAllAction:"editor.action.replaceAll",SelectAllMatchesAction:"editor.action.selectAllMatches"},eu=19999,uLe=240;class t0{constructor(e,t){this._toDispose=new U,this._editor=e,this._state=t,this._isDisposed=!1,this._startSearchingTimer=new No,this._decorations=new sF(e),this._toDispose.add(this._decorations),this._updateDecorationsScheduler=new wt(()=>{if(this._editor.hasModel())return this.research(!1)},100),this._toDispose.add(this._updateDecorationsScheduler),this._toDispose.add(this._editor.onDidChangeCursorPosition(i=>{(i.reason===3||i.reason===5||i.reason===6)&&this._decorations.setStartPosition(this._editor.getPosition())})),this._ignoreModelContentChanged=!1,this._toDispose.add(this._editor.onDidChangeModelContent(i=>{this._ignoreModelContentChanged||(i.isFlush&&this._decorations.reset(),this._decorations.setStartPosition(this._editor.getPosition()),this._updateDecorationsScheduler.schedule())})),this._toDispose.add(this._state.onFindReplaceStateChange(i=>this._onStateChanged(i))),this.research(!1,this._state.searchScope)}dispose(){this._isDisposed=!0,pt(this._startSearchingTimer),this._toDispose.dispose()}_onStateChanged(e){this._isDisposed||this._editor.hasModel()&&(e.searchString||e.isReplaceRevealed||e.isRegex||e.wholeWord||e.matchCase||e.searchScope)&&(this._editor.getModel().isTooLargeForSyncing()?(this._startSearchingTimer.cancel(),this._startSearchingTimer.setIfNotSet(()=>{e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor)},uLe)):e.searchScope?this.research(e.moveCursor,this._state.searchScope):this.research(e.moveCursor))}static _getSearchRange(e,t){return t||e.getFullModelRange()}research(e,t){let i=null;typeof t<"u"?t!==null&&(Array.isArray(t)?i=t:i=[t]):i=this._decorations.getFindScopes(),i!==null&&(i=i.map(a=>{if(a.startLineNumber!==a.endLineNumber){let l=a.endLineNumber;return a.endColumn===1&&(l=l-1),new k(a.startLineNumber,1,l,this._editor.getModel().getLineMaxColumn(l))}return a}));const n=this._findMatches(i,!1,eu);this._decorations.set(n,i);const s=this._editor.getSelection();let r=this._decorations.getCurrentMatchesPosition(s);if(r===0&&n.length>0){const a=sv(n.map(l=>l.range),l=>k.compareRangesUsingStarts(l,s)>=0);r=a>0?a-1+1:r}this._state.changeMatchInfo(r,this._decorations.getCount(),void 0),e&&this._editor.getOption(50).cursorMoveOnType&&this._moveToNextMatch(this._decorations.getStartPosition())}_hasMatches(){return this._state.matchesCount>0}_cannotFind(){if(!this._hasMatches()){const e=this._decorations.getFindScope();return e&&this._editor.revealRangeInCenterIfOutsideViewport(e,0),!0}return!1}_setCurrentFindMatch(e){const t=this._decorations.setCurrentFindMatch(e);this._state.changeMatchInfo(t,this._decorations.getCount(),e),this._editor.setSelection(e),this._editor.revealRangeInCenterIfOutsideViewport(e,0)}_prevSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===1?(i===1?i=s.getLineCount():i--,n=s.getLineMaxColumn(i)):n--,new M(i,n)}_moveToPrevMatch(e,t=!1){if(!this._state.canNavigateBack()){const d=this._decorations.matchAfterPosition(e);d&&this._setCurrentFindMatch(d);return}if(this._decorations.getCount()<eu){let d=this._decorations.matchBeforePosition(e);d&&d.isEmpty()&&d.getStartPosition().equals(e)&&(e=this._prevSearchPosition(e),d=this._decorations.matchBeforePosition(e)),d&&this._setCurrentFindMatch(d);return}if(this._cannotFind())return;const i=this._decorations.getFindScope(),n=t0._getSearchRange(this._editor.getModel(),i);n.getEndPosition().isBefore(e)&&(e=n.getEndPosition()),e.isBefore(n.getStartPosition())&&(e=n.getEndPosition());const{lineNumber:s,column:r}=e,a=this._editor.getModel();let l=new M(s,r),c=a.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1);if(c&&c.range.isEmpty()&&c.range.getStartPosition().equals(l)&&(l=this._prevSearchPosition(l),c=a.findPreviousMatch(this._state.searchString,l,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,!1)),!!c){if(!t&&!n.containsRange(c.range))return this._moveToPrevMatch(c.range.getStartPosition(),!0);this._setCurrentFindMatch(c.range)}}moveToPrevMatch(){this._moveToPrevMatch(this._editor.getSelection().getStartPosition())}_nextSearchPosition(e){const t=this._state.isRegex&&(this._state.searchString.indexOf("^")>=0||this._state.searchString.indexOf("$")>=0);let{lineNumber:i,column:n}=e;const s=this._editor.getModel();return t||n===s.getLineMaxColumn(i)?(i===s.getLineCount()?i=1:i++,n=1):n++,new M(i,n)}_moveToNextMatch(e){if(!this._state.canNavigateForward()){const i=this._decorations.matchBeforePosition(e);i&&this._setCurrentFindMatch(i);return}if(this._decorations.getCount()<eu){let i=this._decorations.matchAfterPosition(e);i&&i.isEmpty()&&i.getStartPosition().equals(e)&&(e=this._nextSearchPosition(e),i=this._decorations.matchAfterPosition(e)),i&&this._setCurrentFindMatch(i);return}const t=this._getNextMatch(e,!1,!0);t&&this._setCurrentFindMatch(t.range)}_getNextMatch(e,t,i,n=!1){if(this._cannotFind())return null;const s=this._decorations.getFindScope(),r=t0._getSearchRange(this._editor.getModel(),s);r.getEndPosition().isBefore(e)&&(e=r.getStartPosition()),e.isBefore(r.getStartPosition())&&(e=r.getStartPosition());const{lineNumber:a,column:l}=e,c=this._editor.getModel();let d=new M(a,l),h=c.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t);return i&&h&&h.range.isEmpty()&&h.range.getStartPosition().equals(d)&&(d=this._nextSearchPosition(d),h=c.findNextMatch(this._state.searchString,d,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t)),h?!n&&!r.containsRange(h.range)?this._getNextMatch(h.range.getEndPosition(),t,i,!0):h:null}moveToNextMatch(){this._moveToNextMatch(this._editor.getSelection().getEndPosition())}_moveToMatch(e){const t=this._decorations.getDecorationRangeAt(e);t&&this._setCurrentFindMatch(t)}moveToMatch(e){this._moveToMatch(e)}_getReplacePattern(){return this._state.isRegex?hLe(this._state.replaceString):yb.fromStaticValue(this._state.replaceString)}replace(){if(!this._hasMatches())return;const e=this._getReplacePattern(),t=this._editor.getSelection(),i=this._getNextMatch(t.getStartPosition(),!0,!1);if(i)if(t.equalsRange(i.range)){const n=e.buildReplaceString(i.matches,this._state.preserveCase),s=new Dn(t,n);this._executeEditorCommand("replace",s),this._decorations.setStartPosition(new M(t.startLineNumber,t.startColumn+n.length)),this.research(!0)}else this._decorations.setStartPosition(this._editor.getPosition()),this._setCurrentFindMatch(i.range)}_findMatches(e,t,i){const n=(e||[null]).map(s=>t0._getSearchRange(this._editor.getModel(),s));return this._editor.getModel().findMatches(this._state.searchString,n,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null,t,i)}replaceAll(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();e===null&&this._state.matchesCount>=eu?this._largeReplaceAll():this._regularReplaceAll(e),this.research(!1)}_largeReplaceAll(){const t=new Kf(this._state.searchString,this._state.isRegex,this._state.matchCase,this._state.wholeWord?this._editor.getOption(148):null).parseSearchRequest();if(!t)return;let i=t.regex;if(!i.multiline){let h="mu";i.ignoreCase&&(h+="i"),i.global&&(h+="g"),i=new RegExp(i.source,h)}const n=this._editor.getModel(),s=n.getValue(1),r=n.getFullModelRange(),a=this._getReplacePattern();let l;const c=this._state.preserveCase;a.hasReplacementPatterns||c?l=s.replace(i,function(){return a.buildReplaceString(arguments,c)}):l=s.replace(i,a.buildReplaceString(null,c));const d=new _2(r,l,this._editor.getSelection());this._executeEditorCommand("replaceAll",d)}_regularReplaceAll(e){const t=this._getReplacePattern(),i=this._findMatches(e,t.hasReplacementPatterns||this._state.preserveCase,1073741824),n=[];for(let r=0,a=i.length;r<a;r++)n[r]=t.buildReplaceString(i[r].matches,this._state.preserveCase);const s=new lLe(this._editor.getSelection(),i.map(r=>r.range),n);this._executeEditorCommand("replaceAll",s)}selectAllMatches(){if(!this._hasMatches())return;const e=this._decorations.getFindScopes();let i=this._findMatches(e,!1,1073741824).map(s=>new ce(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn));const n=this._editor.getSelection();for(let s=0,r=i.length;s<r;s++)if(i[s].equalsRange(n)){i=[n].concat(i.slice(0,s)).concat(i.slice(s+1));break}this._editor.setSelections(i)}_executeEditorCommand(e,t){try{this._ignoreModelContentChanged=!0,this._editor.pushUndoStop(),this._editor.executeCommand(e,t),this._editor.pushUndoStop()}finally{this._ignoreModelContentChanged=!1}}}const WN=class WN extends go{constructor(e,t,i){super(),this._hideSoon=this._register(new wt(()=>this._hide(),2e3)),this._isVisible=!1,this._editor=e,this._state=t,this._keybindingService=i,this._domNode=document.createElement("div"),this._domNode.className="findOptionsWidget",this._domNode.style.display="none",this._domNode.style.top="10px",this._domNode.style.zIndex="12",this._domNode.setAttribute("role","presentation"),this._domNode.setAttribute("aria-hidden","true");const n={inputActiveOptionBorder:J(IL),inputActiveOptionForeground:J(DL),inputActiveOptionBackground:J(U1)},s=this._register(W_());this.caseSensitive=this._register(new lZ({appendTitle:this._keybindingLabelFor(Vt.ToggleCaseSensitiveCommand),isChecked:this._state.matchCase,hoverDelegate:s,...n})),this._domNode.appendChild(this.caseSensitive.domNode),this._register(this.caseSensitive.onChange(()=>{this._state.change({matchCase:this.caseSensitive.checked},!1)})),this.wholeWords=this._register(new cZ({appendTitle:this._keybindingLabelFor(Vt.ToggleWholeWordCommand),isChecked:this._state.wholeWord,hoverDelegate:s,...n})),this._domNode.appendChild(this.wholeWords.domNode),this._register(this.wholeWords.onChange(()=>{this._state.change({wholeWord:this.wholeWords.checked},!1)})),this.regex=this._register(new dZ({appendTitle:this._keybindingLabelFor(Vt.ToggleRegexCommand),isChecked:this._state.isRegex,hoverDelegate:s,...n})),this._domNode.appendChild(this.regex.domNode),this._register(this.regex.onChange(()=>{this._state.change({isRegex:this.regex.checked},!1)})),this._editor.addOverlayWidget(this),this._register(this._state.onFindReplaceStateChange(r=>{let a=!1;r.isRegex&&(this.regex.checked=this._state.isRegex,a=!0),r.wholeWord&&(this.wholeWords.checked=this._state.wholeWord,a=!0),r.matchCase&&(this.caseSensitive.checked=this._state.matchCase,a=!0),!this._state.isRevealed&&a&&this._revealTemporarily()})),this._register(W(this._domNode,te.MOUSE_LEAVE,r=>this._onMouseLeave())),this._register(W(this._domNode,"mouseover",r=>this._onMouseOver()))}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}dispose(){this._editor.removeOverlayWidget(this),super.dispose()}getId(){return WN.ID}getDomNode(){return this._domNode}getPosition(){return{preference:0}}highlightFindOptions(){this._revealTemporarily()}_revealTemporarily(){this._show(),this._hideSoon.schedule()}_onMouseLeave(){this._hideSoon.schedule()}_onMouseOver(){this._hideSoon.cancel()}_show(){this._isVisible||(this._isVisible=!0,this._domNode.style.display="block")}_hide(){this._isVisible&&(this._isVisible=!1,this._domNode.style.display="none")}};WN.ID="editor.contrib.findOptionsWidget";let rF=WN;function zI(o,e){return o===1?!0:o===2?!1:e}class fLe extends A{get searchString(){return this._searchString}get replaceString(){return this._replaceString}get isRevealed(){return this._isRevealed}get isReplaceRevealed(){return this._isReplaceRevealed}get isRegex(){return zI(this._isRegexOverride,this._isRegex)}get wholeWord(){return zI(this._wholeWordOverride,this._wholeWord)}get matchCase(){return zI(this._matchCaseOverride,this._matchCase)}get preserveCase(){return zI(this._preserveCaseOverride,this._preserveCase)}get actualIsRegex(){return this._isRegex}get actualWholeWord(){return this._wholeWord}get actualMatchCase(){return this._matchCase}get actualPreserveCase(){return this._preserveCase}get searchScope(){return this._searchScope}get matchesPosition(){return this._matchesPosition}get matchesCount(){return this._matchesCount}get currentMatch(){return this._currentMatch}constructor(){super(),this._onFindReplaceStateChange=this._register(new P),this.onFindReplaceStateChange=this._onFindReplaceStateChange.event,this._searchString="",this._replaceString="",this._isRevealed=!1,this._isReplaceRevealed=!1,this._isRegex=!1,this._isRegexOverride=0,this._wholeWord=!1,this._wholeWordOverride=0,this._matchCase=!1,this._matchCaseOverride=0,this._preserveCase=!1,this._preserveCaseOverride=0,this._searchScope=null,this._matchesPosition=0,this._matchesCount=0,this._currentMatch=null,this._loop=!0,this._isSearching=!1,this._filters=null}changeMatchInfo(e,t,i){const n={moveCursor:!1,updateHistory:!1,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;t===0&&(e=0),e>t&&(e=t),this._matchesPosition!==e&&(this._matchesPosition=e,n.matchesPosition=!0,s=!0),this._matchesCount!==t&&(this._matchesCount=t,n.matchesCount=!0,s=!0),typeof i<"u"&&(k.equalsRange(this._currentMatch,i)||(this._currentMatch=i,n.currentMatch=!0,s=!0)),s&&this._onFindReplaceStateChange.fire(n)}change(e,t,i=!0){const n={moveCursor:t,updateHistory:i,searchString:!1,replaceString:!1,isRevealed:!1,isReplaceRevealed:!1,isRegex:!1,wholeWord:!1,matchCase:!1,preserveCase:!1,searchScope:!1,matchesPosition:!1,matchesCount:!1,currentMatch:!1,loop:!1,isSearching:!1,filters:!1};let s=!1;const r=this.isRegex,a=this.wholeWord,l=this.matchCase,c=this.preserveCase;typeof e.searchString<"u"&&this._searchString!==e.searchString&&(this._searchString=e.searchString,n.searchString=!0,s=!0),typeof e.replaceString<"u"&&this._replaceString!==e.replaceString&&(this._replaceString=e.replaceString,n.replaceString=!0,s=!0),typeof e.isRevealed<"u"&&this._isRevealed!==e.isRevealed&&(this._isRevealed=e.isRevealed,n.isRevealed=!0,s=!0),typeof e.isReplaceRevealed<"u"&&this._isReplaceRevealed!==e.isReplaceRevealed&&(this._isReplaceRevealed=e.isReplaceRevealed,n.isReplaceRevealed=!0,s=!0),typeof e.isRegex<"u"&&(this._isRegex=e.isRegex),typeof e.wholeWord<"u"&&(this._wholeWord=e.wholeWord),typeof e.matchCase<"u"&&(this._matchCase=e.matchCase),typeof e.preserveCase<"u"&&(this._preserveCase=e.preserveCase),typeof e.searchScope<"u"&&(e.searchScope?.every(d=>this._searchScope?.some(h=>!k.equalsRange(h,d)))||(this._searchScope=e.searchScope,n.searchScope=!0,s=!0)),typeof e.loop<"u"&&this._loop!==e.loop&&(this._loop=e.loop,n.loop=!0,s=!0),typeof e.isSearching<"u"&&this._isSearching!==e.isSearching&&(this._isSearching=e.isSearching,n.isSearching=!0,s=!0),typeof e.filters<"u"&&(this._filters?this._filters.update(e.filters):this._filters=e.filters,n.filters=!0,s=!0),this._isRegexOverride=typeof e.isRegexOverride<"u"?e.isRegexOverride:0,this._wholeWordOverride=typeof e.wholeWordOverride<"u"?e.wholeWordOverride:0,this._matchCaseOverride=typeof e.matchCaseOverride<"u"?e.matchCaseOverride:0,this._preserveCaseOverride=typeof e.preserveCaseOverride<"u"?e.preserveCaseOverride:0,r!==this.isRegex&&(s=!0,n.isRegex=!0),a!==this.wholeWord&&(s=!0,n.wholeWord=!0),l!==this.matchCase&&(s=!0,n.matchCase=!0),c!==this.preserveCase&&(s=!0,n.preserveCase=!0),s&&this._onFindReplaceStateChange.fire(n)}canNavigateBack(){return this.canNavigateInLoop()||this.matchesPosition!==1}canNavigateForward(){return this.canNavigateInLoop()||this.matchesPosition<this.matchesCount}canNavigateInLoop(){return this._loop||this.matchesCount>=eu}}const gLe=p(5,"input"),pLe=p(6,"Preserve Case");class mLe extends Gh{constructor(e){super({icon:Y.preserveCase,title:pLe+e.appendTitle,isChecked:e.isChecked,hoverDelegate:e.hoverDelegate??Zs("element"),inputActiveOptionBorder:e.inputActiveOptionBorder,inputActiveOptionForeground:e.inputActiveOptionForeground,inputActiveOptionBackground:e.inputActiveOptionBackground})}}class _Le extends go{get onDidOptionChange(){return this._onDidOptionChange.event}get onKeyDown(){return this._onKeyDown.event}get onPreserveCaseKeyDown(){return this._onPreserveCaseKeyDown.event}constructor(e,t,i,n){super(),this._showOptionButtons=i,this.fixFocusOnOptionClickEnabled=!0,this.cachedOptionsWidth=0,this._onDidOptionChange=this._register(new P),this._onKeyDown=this._register(new P),this._onMouseDown=this._register(new P),this._onInput=this._register(new P),this._onKeyUp=this._register(new P),this._onPreserveCaseKeyDown=this._register(new P),this.contextViewProvider=t,this.placeholder=n.placeholder||"",this.validation=n.validation,this.label=n.label||gLe;const s=n.appendPreserveCaseLabel||"",r=n.history||new Set([]),a=!!n.flexibleHeight,l=!!n.flexibleWidth,c=n.flexibleMaxHeight;this.domNode=document.createElement("div"),this.domNode.classList.add("monaco-findInput"),this.inputBox=this._register(new uZ(this.domNode,this.contextViewProvider,{ariaLabel:this.label||"",placeholder:this.placeholder||"",validationOptions:{validation:this.validation},history:r,showHistoryHint:n.showHistoryHint,flexibleHeight:a,flexibleWidth:l,flexibleMaxHeight:c,inputBoxStyles:n.inputBoxStyles})),this.preserveCase=this._register(new mLe({appendTitle:s,isChecked:!1,...n.toggleStyles})),this._register(this.preserveCase.onChange(u=>{this._onDidOptionChange.fire(u),!u&&this.fixFocusOnOptionClickEnabled&&this.inputBox.focus(),this.validate()})),this._register(this.preserveCase.onKeyDown(u=>{this._onPreserveCaseKeyDown.fire(u)})),this._showOptionButtons?this.cachedOptionsWidth=this.preserveCase.width():this.cachedOptionsWidth=0;const d=[this.preserveCase.domNode];this.onkeydown(this.domNode,u=>{if(u.equals(15)||u.equals(17)||u.equals(9)){const f=d.indexOf(this.domNode.ownerDocument.activeElement);if(f>=0){let g=-1;u.equals(17)?g=(f+1)%d.length:u.equals(15)&&(f===0?g=d.length-1:g=f-1),u.equals(9)?(d[f].blur(),this.inputBox.focus()):g>=0&&d[g].focus(),st.stop(u,!0)}}});const h=document.createElement("div");h.className="controls",h.style.display=this._showOptionButtons?"block":"none",h.appendChild(this.preserveCase.domNode),this.domNode.appendChild(h),e?.appendChild(this.domNode),this.onkeydown(this.inputBox.inputElement,u=>this._onKeyDown.fire(u)),this.onkeyup(this.inputBox.inputElement,u=>this._onKeyUp.fire(u)),this.oninput(this.inputBox.inputElement,u=>this._onInput.fire()),this.onmousedown(this.inputBox.inputElement,u=>this._onMouseDown.fire(u))}enable(){this.domNode.classList.remove("disabled"),this.inputBox.enable(),this.preserveCase.enable()}disable(){this.domNode.classList.add("disabled"),this.inputBox.disable(),this.preserveCase.disable()}setEnabled(e){e?this.enable():this.disable()}select(){this.inputBox.select()}focus(){this.inputBox.focus()}getPreserveCase(){return this.preserveCase.checked}setPreserveCase(e){this.preserveCase.checked=e}focusOnPreserve(){this.preserveCase.focus()}validate(){this.inputBox?.validate()}set width(e){this.inputBox.paddingRight=this.cachedOptionsWidth,this.domNode.style.width=e+"px"}dispose(){super.dispose()}}var hY=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},uY=function(o,e){return function(t,i){e(t,i,o)}};const aF=new ae("suggestWidgetVisible",!1,p(1683,"Whether suggestion are visible")),lF="historyNavigationWidgetFocus",fY="historyNavigationForwardsEnabled",gY="historyNavigationBackwardsEnabled";let i0;const UI=[];function pY(o,e){if(UI.includes(e))throw new Error("Cannot register the same widget multiple times");UI.push(e);const t=new U,i=new ae(lF,!1).bindTo(o),n=new ae(fY,!0).bindTo(o),s=new ae(gY,!0).bindTo(o),r=()=>{i.set(!0),i0=e},a=()=>{i.set(!1),i0===e&&(i0=void 0)};return Iy(e.element)&&r(),t.add(e.onDidFocus(()=>r())),t.add(e.onDidBlur(()=>a())),t.add(ue(()=>{UI.splice(UI.indexOf(e),1),a()})),{historyNavigationForwardsEnablement:n,historyNavigationBackwardsEnablement:s,dispose(){t.dispose()}}}let cF=class extends fZ{constructor(e,t,i,n){super(e,t,i);const s=this._register(n.createScoped(this.inputBox.element));this._register(pY(s,this.inputBox))}};cF=hY([uY(3,xe)],cF);let dF=class extends _Le{constructor(e,t,i,n,s=!1){super(e,t,s,i);const r=this._register(n.createScoped(this.inputBox.element));this._register(pY(r,this.inputBox))}};dF=hY([uY(3,xe)],dF),rn.registerCommandAndKeybindingRule({id:"history.showPrevious",weight:200,when:K.and(K.has(lF),K.equals(gY,!0),K.not("isComposing"),aF.isEqualTo(!1)),primary:16,secondary:[528],handler:o=>{i0?.showPreviousValue()}}),rn.registerCommandAndKeybindingRule({id:"history.showNext",weight:200,when:K.and(K.has(lF),K.equals(fY,!0),K.not("isComposing"),aF.isEqualTo(!1)),primary:18,secondary:[530],handler:o=>{i0?.showNextValue()}});function mY(o){return o.lookupKeybinding("history.showPrevious")?.getElectronAccelerator()==="Up"&&o.lookupKeybinding("history.showNext")?.getElectronAccelerator()==="Down"}const _Y=Wt("find-collapsed",Y.chevronRight,p(951,"Icon to indicate that the editor find widget is collapsed.")),bY=Wt("find-expanded",Y.chevronDown,p(952,"Icon to indicate that the editor find widget is expanded.")),bLe=Wt("find-selection",Y.selection,p(953,"Icon for 'Find in Selection' in the editor find widget.")),CLe=Wt("find-replace",Y.replace,p(954,"Icon for 'Replace' in the editor find widget.")),vLe=Wt("find-replace-all",Y.replaceAll,p(955,"Icon for 'Replace All' in the editor find widget.")),wLe=Wt("find-previous-match",Y.arrowUp,p(956,"Icon for 'Find Previous' in the editor find widget.")),SLe=Wt("find-next-match",Y.arrowDown,p(957,"Icon for 'Find Next' in the editor find widget.")),yLe=p(958,"Find / Replace"),LLe=p(959,"Find"),xLe=p(960,"Find"),kLe=p(961,"Previous Match"),ILe=p(962,"Next Match"),DLe=p(963,"Find in Selection"),ELe=p(964,"Close"),NLe=p(965,"Replace"),TLe=p(966,"Replace"),RLe=p(967,"Replace"),MLe=p(968,"Replace All"),PLe=p(969,"Toggle Replace"),ALe=p(970,"Only the first {0} results are highlighted, but all find operations work on the entire text.",eu),OLe=p(971,"{0} of {1}"),CY=p(972,"No results"),Yl=419,FLe=275-54;let n0=69;const WLe=33,vY=ze?256:2048;class hF{constructor(e){this.afterLineNumber=e,this.heightInPx=WLe,this.suppressMouseDown=!1,this.domNode=document.createElement("div"),this.domNode.className="dock-find-viewzone"}}function wY(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionStart>0){o.stopPropagation();return}}function SY(o,e,t){const i=!!e.match(/\n/);if(t&&i&&t.selectionEnd<t.value.length){o.stopPropagation();return}}const BN=class BN extends go{constructor(e,t,i,n,s,r,a,l,c){super(),this._hoverService=a,this._findWidgetSearchHistory=l,this._replaceWidgetHistory=c,this._cachedHeight=null,this._revealTimeouts=[],this._codeEditor=e,this._controller=t,this._state=i,this._contextViewProvider=n,this._keybindingService=s,this._contextKeyService=r,this._isVisible=!1,this._isReplaceVisible=!1,this._ignoreChangeEvent=!1,this._updateHistoryDelayer=new fr(500),this._register(ue(()=>this._updateHistoryDelayer.cancel())),this._register(this._state.onFindReplaceStateChange(d=>this._onStateChanged(d))),this._buildDomNode(),this._updateButtons(),this._tryUpdateWidgetWidth(),this._findInput.inputBox.layout(),this._register(this._codeEditor.onDidChangeConfiguration(d=>{if(d.hasChanged(104)&&(this._codeEditor.getOption(104)&&this._state.change({isReplaceRevealed:!1},!1),this._updateButtons()),d.hasChanged(165)&&this._tryUpdateWidgetWidth(),d.hasChanged(2)&&this.updateAccessibilitySupport(),d.hasChanged(50)){const h=this._codeEditor.getOption(50).loop;this._state.change({loop:h},!1);const u=this._codeEditor.getOption(50).addExtraSpaceOnTop;u&&!this._viewZone&&(this._viewZone=new hF(0),this._showViewZone()),!u&&this._viewZone&&this._removeViewZone()}})),this.updateAccessibilitySupport(),this._register(this._codeEditor.onDidChangeCursorSelection(()=>{this._isVisible&&this._updateToggleSelectionFindButton()})),this._register(this._codeEditor.onDidFocusEditorWidget(async()=>{if(this._isVisible){const d=await this._controller.getGlobalBufferTerm();d&&d!==this._state.searchString&&(this._state.change({searchString:d},!1),this._findInput.select())}})),this._findInputFocused=OI.bindTo(r),this._findFocusTracker=this._register(br(this._findInput.inputBox.inputElement)),this._register(this._findFocusTracker.onDidFocus(()=>{this._findInputFocused.set(!0),this._updateSearchScope()})),this._register(this._findFocusTracker.onDidBlur(()=>{this._findInputFocused.set(!1)})),this._replaceInputFocused=oF.bindTo(r),this._replaceFocusTracker=this._register(br(this._replaceInput.inputBox.inputElement)),this._register(this._replaceFocusTracker.onDidFocus(()=>{this._replaceInputFocused.set(!0),this._updateSearchScope()})),this._register(this._replaceFocusTracker.onDidBlur(()=>{this._replaceInputFocused.set(!1)})),this._codeEditor.addOverlayWidget(this),this._codeEditor.getOption(50).addExtraSpaceOnTop&&(this._viewZone=new hF(0)),this._register(this._codeEditor.onDidChangeModel(()=>{this._isVisible&&(this._viewZoneId=void 0)})),this._register(this._codeEditor.onDidScrollChange(d=>{if(d.scrollTopChanged){this._layoutViewZone();return}setTimeout(()=>{this._layoutViewZone()},0)}))}getId(){return BN.ID}getDomNode(){return this._domNode}getPosition(){return this._isVisible?{preference:0}:null}_onStateChanged(e){if(e.searchString){try{this._ignoreChangeEvent=!0,this._findInput.setValue(this._state.searchString)}finally{this._ignoreChangeEvent=!1}this._updateButtons()}if(e.replaceString&&(this._replaceInput.inputBox.value=this._state.replaceString),e.isRevealed&&(this._state.isRevealed?this._reveal():this._hide(!0)),e.isReplaceRevealed&&(this._state.isReplaceRevealed?!this._codeEditor.getOption(104)&&!this._isReplaceVisible&&(this._isReplaceVisible=!0,this._replaceInput.width=ho(this._findInput.domNode),this._updateButtons(),this._replaceInput.inputBox.layout()):this._isReplaceVisible&&(this._isReplaceVisible=!1,this._updateButtons())),(e.isRevealed||e.isReplaceRevealed)&&(this._state.isRevealed||this._state.isReplaceRevealed)&&this._tryUpdateHeight()&&this._showViewZone(),e.isRegex&&this._findInput.setRegex(this._state.isRegex),e.wholeWord&&this._findInput.setWholeWords(this._state.wholeWord),e.matchCase&&this._findInput.setCaseSensitive(this._state.matchCase),e.preserveCase&&this._replaceInput.setPreserveCase(this._state.preserveCase),e.searchScope&&(this._state.searchScope?this._toggleSelectionFind.checked=!0:this._toggleSelectionFind.checked=!1,this._updateToggleSelectionFindButton()),e.searchString||e.matchesCount||e.matchesPosition){const t=this._state.searchString.length>0&&this._state.matchesCount===0;this._domNode.classList.toggle("no-results",t),this._updateMatchesCount(),this._updateButtons()}(e.searchString||e.currentMatch)&&this._layoutViewZone(),e.updateHistory&&this._delayedUpdateHistory(),e.loop&&this._updateButtons()}_delayedUpdateHistory(){this._updateHistoryDelayer.trigger(this._updateHistory.bind(this)).then(void 0,Ee)}_updateHistory(){this._state.searchString&&this._findInput.inputBox.addToHistory(),this._state.replaceString&&this._replaceInput.inputBox.addToHistory()}_updateMatchesCount(){this._matchesCount.style.minWidth=n0+"px",this._state.matchesCount>=eu?this._matchesCount.title=ALe:this._matchesCount.title="",this._matchesCount.firstChild?.remove();let e;if(this._state.matchesCount>0){let t=String(this._state.matchesCount);this._state.matchesCount>=eu&&(t+="+");let i=String(this._state.matchesPosition);i==="0"&&(i="?"),e=tf(OLe,i,t)}else e=CY;this._matchesCount.appendChild(document.createTextNode(e)),ps(this._getAriaLabel(e,this._state.currentMatch,this._state.searchString)),n0=Math.max(n0,this._matchesCount.clientWidth)}_getAriaLabel(e,t,i){if(e===CY)return i===""?p(973,"{0} found",e):p(974,"{0} found for '{1}'",e,i);if(t){const n=p(975,"{0} found for '{1}', at {2}",e,i,t.startLineNumber+":"+t.startColumn),s=this._codeEditor.getModel();return s&&t.startLineNumber<=s.getLineCount()&&t.startLineNumber>=1?`${s.getLineContent(t.startLineNumber)}, ${n}`:n}return p(976,"{0} found for '{1}'",e,i)}_updateToggleSelectionFindButton(){const e=this._codeEditor.getSelection(),t=e?e.startLineNumber!==e.endLineNumber||e.startColumn!==e.endColumn:!1,i=this._toggleSelectionFind.checked;this._isVisible&&(i||t)?this._toggleSelectionFind.enable():this._toggleSelectionFind.disable()}_updateButtons(){this._findInput.setEnabled(this._isVisible),this._replaceInput.setEnabled(this._isVisible&&this._isReplaceVisible),this._updateToggleSelectionFindButton(),this._closeBtn.setEnabled(this._isVisible);const e=this._state.searchString.length>0,t=!!this._state.matchesCount;this._prevBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateBack()),this._nextBtn.setEnabled(this._isVisible&&e&&t&&this._state.canNavigateForward()),this._replaceBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._replaceAllBtn.setEnabled(this._isVisible&&this._isReplaceVisible&&e),this._domNode.classList.toggle("replaceToggled",this._isReplaceVisible),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible);const i=!this._codeEditor.getOption(104);this._toggleReplaceBtn.setEnabled(this._isVisible&&i)}_reveal(){if(this._revealTimeouts.forEach(e=>{clearTimeout(e)}),this._revealTimeouts=[],!this._isVisible){this._isVisible=!0;const e=this._codeEditor.getSelection();switch(this._codeEditor.getOption(50).autoFindInSelection){case"always":this._toggleSelectionFind.checked=!0;break;case"never":this._toggleSelectionFind.checked=!1;break;case"multiline":{const i=!!e&&e.startLineNumber!==e.endLineNumber;this._toggleSelectionFind.checked=i;break}}this._tryUpdateWidgetWidth(),this._updateButtons(),this._revealTimeouts.push(setTimeout(()=>{this._domNode.classList.add("visible"),this._domNode.setAttribute("aria-hidden","false")},0)),this._revealTimeouts.push(setTimeout(()=>{this._findInput.validate()},200)),this._codeEditor.layoutOverlayWidget(this);let t=!0;if(this._codeEditor.getOption(50).seedSearchStringFromSelection&&e){const i=this._codeEditor.getDomNode();if(i){const n=mi(i),s=this._codeEditor.getScrolledVisiblePosition(e.getStartPosition()),r=n.left+(s?s.left:0),a=s?s.top:0;if(this._viewZone&&a<this._viewZone.heightInPx){e.endLineNumber>e.startLineNumber&&(t=!1);const l=J6(this._domNode).left;r>l&&(t=!1);const c=this._codeEditor.getScrolledVisiblePosition(e.getEndPosition());n.left+(c?c.left:0)>l&&(t=!1)}}}this._showViewZone(t)}}_hide(e){this._revealTimeouts.forEach(t=>{clearTimeout(t)}),this._revealTimeouts=[],this._isVisible&&(this._isVisible=!1,this._updateButtons(),this._domNode.classList.remove("visible"),this._domNode.setAttribute("aria-hidden","true"),this._findInput.clearMessage(),e&&this._codeEditor.focus(),this._codeEditor.layoutOverlayWidget(this),this._removeViewZone())}_layoutViewZone(e){if(!this._codeEditor.getOption(50).addExtraSpaceOnTop){this._removeViewZone();return}if(!this._isVisible)return;const i=this._viewZone;this._viewZoneId!==void 0||!i||this._codeEditor.changeViewZones(n=>{i.heightInPx=this._getHeight(),this._viewZoneId=n.addZone(i),this._codeEditor.setScrollTop(e||this._codeEditor.getScrollTop()+i.heightInPx)})}_showViewZone(e=!0){if(!this._isVisible||!this._codeEditor.getOption(50).addExtraSpaceOnTop)return;this._viewZone===void 0&&(this._viewZone=new hF(0));const i=this._viewZone;this._codeEditor.changeViewZones(n=>{if(this._viewZoneId!==void 0){const s=this._getHeight();if(s===i.heightInPx)return;const r=s-i.heightInPx;i.heightInPx=s,n.layoutZone(this._viewZoneId),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+r);return}else{let s=this._getHeight();if(s-=this._codeEditor.getOption(96).top,s<=0)return;i.heightInPx=s,this._viewZoneId=n.addZone(i),e&&this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()+s)}})}_removeViewZone(){this._codeEditor.changeViewZones(e=>{this._viewZoneId!==void 0&&(e.removeZone(this._viewZoneId),this._viewZoneId=void 0,this._viewZone&&(this._codeEditor.setScrollTop(this._codeEditor.getScrollTop()-this._viewZone.heightInPx),this._viewZone=void 0))})}_tryUpdateWidgetWidth(){if(!this._isVisible||!this._domNode.isConnected)return;const e=this._codeEditor.getLayoutInfo();if(e.contentWidth<=0){this._domNode.classList.add("hiddenEditor");return}else this._domNode.classList.contains("hiddenEditor")&&this._domNode.classList.remove("hiddenEditor");const i=e.width,n=e.minimap.minimapWidth;let s=!1,r=!1,a=!1;if(this._resized&&ho(this._domNode)>Yl){this._domNode.style.maxWidth=`${i-28-n-15}px`,this._replaceInput.width=ho(this._findInput.domNode);return}if(Yl+28+n>=i&&(r=!0),Yl+28+n-n0>=i&&(a=!0),Yl+28+n-n0>=i+50&&(s=!0),this._domNode.classList.toggle("collapsed-find-widget",s),this._domNode.classList.toggle("narrow-find-widget",a),this._domNode.classList.toggle("reduced-find-widget",r),!a&&!s&&(this._domNode.style.maxWidth=`${i-28-n-15}px`),this._findInput.layout({collapsedFindWidget:s,narrowFindWidget:a,reducedFindWidget:r}),this._resized){const l=this._findInput.inputBox.element.clientWidth;l>0&&(this._replaceInput.width=l)}else this._isReplaceVisible&&(this._replaceInput.width=ho(this._findInput.domNode))}_getHeight(){let e=0;return e+=4,e+=this._findInput.inputBox.height+2,this._isReplaceVisible&&(e+=4,e+=this._replaceInput.inputBox.height+2),e+=4,e}_tryUpdateHeight(){const e=this._getHeight();return this._cachedHeight!==null&&this._cachedHeight===e?!1:(this._cachedHeight=e,this._domNode.style.height=`${e}px`,!0)}focusFindInput(){this._findInput.select(),this._findInput.focus()}focusReplaceInput(){this._replaceInput.select(),this._replaceInput.focus()}highlightFindOptions(){this._findInput.highlightFindOptions()}_updateSearchScope(){if(this._codeEditor.hasModel()&&this._toggleSelectionFind.checked){const e=this._codeEditor.getSelections();e.map(t=>{t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(t.endLineNumber-1)));const i=this._state.currentMatch;return t.startLineNumber!==t.endLineNumber&&!k.equalsRange(t,i)?t:null}).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}_onFindInputMouseDown(e){e.middleButton&&e.stopPropagation()}_onFindInputKeyDown(e){if(e.equals(vY|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._findInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._isReplaceVisible?this._replaceInput.focus():this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return wY(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"));if(e.equals(18))return SY(e,this._findInput.getValue(),this._findInput.domNode.querySelector("textarea"))}_onReplaceInputKeyDown(e){if(e.equals(vY|3))if(this._keybindingService.dispatchEvent(e,e.target)){e.preventDefault();return}else{this._replaceInput.inputBox.insertAtCursor(`
`),e.preventDefault();return}if(e.equals(2)){this._findInput.focusOnCaseSensitive(),e.preventDefault();return}if(e.equals(1026)){this._findInput.focus(),e.preventDefault();return}if(e.equals(2066)){this._codeEditor.focus(),e.preventDefault();return}if(e.equals(16))return wY(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"));if(e.equals(18))return SY(e,this._replaceInput.inputBox.value,this._replaceInput.inputBox.element.querySelector("textarea"))}getVerticalSashLeft(e){return 0}_keybindingLabelFor(e){const t=this._keybindingService.lookupKeybinding(e);return t?` (${t.getLabel()})`:""}_buildDomNode(){const i=this._codeEditor.getOption(50).history,n=this._codeEditor.getOption(50).replaceHistory;this._findInput=this._register(new cF(null,this._contextViewProvider,{width:FLe,label:LLe,placeholder:xLe,appendCaseSensitiveLabel:this._keybindingLabelFor(Vt.ToggleCaseSensitiveCommand),appendWholeWordsLabel:this._keybindingLabelFor(Vt.ToggleWholeWordCommand),appendRegexLabel:this._keybindingLabelFor(Vt.ToggleRegexCommand),validation:u=>{if(u.length===0||!this._findInput.getRegex())return null;try{return new RegExp(u,"gu"),null}catch(f){return{content:f.message}}},flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showCommonFindToggles:!0,showHistoryHint:()=>mY(this._keybindingService),inputBoxStyles:uk,toggleStyles:hk,history:i==="workspace"?this._findWidgetSearchHistory:new Set([])},this._contextKeyService)),this._findInput.setRegex(!!this._state.isRegex),this._findInput.setCaseSensitive(!!this._state.matchCase),this._findInput.setWholeWords(!!this._state.wholeWord),this._register(this._findInput.onKeyDown(u=>{u.equals(3)&&!this._codeEditor.getOption(50).findOnType&&this._state.change({searchString:this._findInput.getValue()},!0),this._onFindInputKeyDown(u)})),this._register(this._findInput.inputBox.onDidChange(()=>{this._ignoreChangeEvent||!this._codeEditor.getOption(50).findOnType||this._state.change({searchString:this._findInput.getValue()},!0)})),this._register(this._findInput.onDidOptionChange(()=>{this._state.change({isRegex:this._findInput.getRegex(),wholeWord:this._findInput.getWholeWords(),matchCase:this._findInput.getCaseSensitive()},!0)})),this._register(this._findInput.onCaseSensitiveKeyDown(u=>{u.equals(1026)&&this._isReplaceVisible&&(this._replaceInput.focus(),u.preventDefault())})),this._register(this._findInput.onRegexKeyDown(u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceInput.focusOnPreserve(),u.preventDefault())})),this._register(this._findInput.inputBox.onDidHeightChange(u=>{this._tryUpdateHeight()&&this._showViewZone()})),Ws&&this._register(this._findInput.onMouseDown(u=>this._onFindInputMouseDown(u))),this._matchesCount=document.createElement("div"),this._matchesCount.className="matchesCount",this._updateMatchesCount();const s=this._register(W_());this._prevBtn=this._register(new Lb({label:kLe+this._keybindingLabelFor(Vt.PreviousMatchFindAction),icon:wLe,hoverDelegate:s,onTrigger:()=>{Qd(this._codeEditor.getAction(Vt.PreviousMatchFindAction)).run().then(void 0,Ee)}},this._hoverService)),this._nextBtn=this._register(new Lb({label:ILe+this._keybindingLabelFor(Vt.NextMatchFindAction),icon:SLe,hoverDelegate:s,onTrigger:()=>{Qd(this._codeEditor.getAction(Vt.NextMatchFindAction)).run().then(void 0,Ee)}},this._hoverService));const r=document.createElement("div");r.className="find-part",r.appendChild(this._findInput.domNode);const a=document.createElement("div");a.className="find-actions",r.appendChild(a),a.appendChild(this._matchesCount),a.appendChild(this._prevBtn.domNode),a.appendChild(this._nextBtn.domNode),this._toggleSelectionFind=this._register(new Gh({icon:bLe,title:DLe+this._keybindingLabelFor(Vt.ToggleSearchScopeCommand),isChecked:!1,hoverDelegate:s,inputActiveOptionBackground:J(U1),inputActiveOptionBorder:J(IL),inputActiveOptionForeground:J(DL)})),this._register(this._toggleSelectionFind.onChange(()=>{if(this._toggleSelectionFind.checked){if(this._codeEditor.hasModel()){let u=this._codeEditor.getSelections();u=u.map(f=>(f.endColumn===1&&f.endLineNumber>f.startLineNumber&&(f=f.setEndPosition(f.endLineNumber-1,this._codeEditor.getModel().getLineMaxColumn(f.endLineNumber-1))),f.isEmpty()?null:f)).filter(f=>!!f),u.length&&this._state.change({searchScope:u},!0)}}else this._state.change({searchScope:null},!0)})),a.appendChild(this._toggleSelectionFind.domNode),this._closeBtn=this._register(new Lb({label:ELe+this._keybindingLabelFor(Vt.CloseFindWidgetCommand),icon:kq,hoverDelegate:s,onTrigger:()=>{this._state.change({isRevealed:!1,searchScope:null},!1)},onKeyDown:u=>{u.equals(2)&&this._isReplaceVisible&&(this._replaceBtn.isEnabled()?this._replaceBtn.focus():this._codeEditor.focus(),u.preventDefault())}},this._hoverService)),this._replaceInput=this._register(new dF(null,void 0,{label:NLe,placeholder:TLe,appendPreserveCaseLabel:this._keybindingLabelFor(Vt.TogglePreserveCaseCommand),history:n==="workspace"?this._replaceWidgetHistory:new Set([]),flexibleHeight:!0,flexibleWidth:!0,flexibleMaxHeight:118,showHistoryHint:()=>mY(this._keybindingService),inputBoxStyles:uk,toggleStyles:hk},this._contextKeyService,!0)),this._replaceInput.setPreserveCase(!!this._state.preserveCase),this._register(this._replaceInput.onKeyDown(u=>this._onReplaceInputKeyDown(u))),this._register(this._replaceInput.inputBox.onDidChange(()=>{this._state.change({replaceString:this._replaceInput.inputBox.value},!1)})),this._register(this._replaceInput.inputBox.onDidHeightChange(u=>{this._isReplaceVisible&&this._tryUpdateHeight()&&this._showViewZone()})),this._register(this._replaceInput.onDidOptionChange(()=>{this._state.change({preserveCase:this._replaceInput.getPreserveCase()},!0)})),this._register(this._replaceInput.onPreserveCaseKeyDown(u=>{u.equals(2)&&(this._prevBtn.isEnabled()?this._prevBtn.focus():this._nextBtn.isEnabled()?this._nextBtn.focus():this._toggleSelectionFind.enabled?this._toggleSelectionFind.focus():this._closeBtn.isEnabled()&&this._closeBtn.focus(),u.preventDefault())}));const l=this._register(W_());this._replaceBtn=this._register(new Lb({label:RLe+this._keybindingLabelFor(Vt.ReplaceOneAction),icon:CLe,hoverDelegate:l,onTrigger:()=>{this._controller.replace()},onKeyDown:u=>{u.equals(1026)&&(this._closeBtn.focus(),u.preventDefault())}},this._hoverService)),this._replaceAllBtn=this._register(new Lb({label:MLe+this._keybindingLabelFor(Vt.ReplaceAllAction),icon:vLe,hoverDelegate:l,onTrigger:()=>{this._controller.replaceAll()}},this._hoverService));const c=document.createElement("div");c.className="replace-part",c.appendChild(this._replaceInput.domNode);const d=document.createElement("div");d.className="replace-actions",c.appendChild(d),d.appendChild(this._replaceBtn.domNode),d.appendChild(this._replaceAllBtn.domNode),this._toggleReplaceBtn=this._register(new Lb({label:PLe,className:"codicon toggle left",onTrigger:()=>{this._state.change({isReplaceRevealed:!this._isReplaceVisible},!1),this._isReplaceVisible&&(this._replaceInput.width=ho(this._findInput.domNode),this._replaceInput.inputBox.layout()),this._showViewZone()}},this._hoverService)),this._toggleReplaceBtn.setExpanded(this._isReplaceVisible),this._domNode=document.createElement("div"),this._domNode.className="editor-widget find-widget",this._domNode.setAttribute("aria-hidden","true"),this._domNode.ariaLabel=yLe,this._domNode.role="dialog",this._domNode.style.width=`${Yl}px`,this._domNode.appendChild(this._toggleReplaceBtn.domNode),this._domNode.appendChild(r),this._domNode.appendChild(this._closeBtn.domNode),this._domNode.appendChild(c),this._resizeSash=this._register(new Gn(this._domNode,this,{orientation:0,size:2})),this._resized=!1;let h=Yl;this._register(this._resizeSash.onDidStart(()=>{h=ho(this._domNode)})),this._register(this._resizeSash.onDidChange(u=>{this._resized=!0;const f=h+u.startX-u.currentX;if(f<Yl)return;const g=parseFloat(xy(this._domNode).maxWidth)||0;f>g||(this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=ho(this._findInput.domNode)),this._findInput.inputBox.layout(),this._tryUpdateHeight())})),this._register(this._resizeSash.onDidReset(()=>{const u=ho(this._domNode);if(u<Yl)return;let f=Yl;if(!this._resized||u===Yl){const g=this._codeEditor.getLayoutInfo();f=g.width-28-g.minimap.minimapWidth-15,this._resized=!0}this._domNode.style.width=`${f}px`,this._isReplaceVisible&&(this._replaceInput.width=ho(this._findInput.domNode)),this._findInput.inputBox.layout()}))}updateAccessibilitySupport(){const e=this._codeEditor.getOption(2);this._findInput.setFocusInputOnOptionClick(e!==2)}getViewState(){let e=!1;return this._viewZone&&this._viewZoneId&&(e=this._viewZone.heightInPx>this._codeEditor.getScrollTop()),{widgetViewZoneVisible:e,scrollTop:this._codeEditor.getScrollTop()}}setViewState(e){e&&e.widgetViewZoneVisible&&this._layoutViewZone(e.scrollTop)}};BN.ID="editor.contrib.findWidget";let uF=BN;class Lb extends go{constructor(e,t){super(),this._opts=e;let i="button";this._opts.className&&(i=i+" "+this._opts.className),this._opts.icon&&(i=i+" "+ve.asClassName(this._opts.icon)),this._domNode=document.createElement("div"),this._domNode.tabIndex=0,this._domNode.className=i,this._domNode.setAttribute("role","button"),this._domNode.setAttribute("aria-label",this._opts.label),this._register(t.setupManagedHover(e.hoverDelegate??Zs("element"),this._domNode,this._opts.label)),this.onclick(this._domNode,n=>{this._opts.onTrigger(),n.preventDefault()}),this.onkeydown(this._domNode,n=>{if(n.equals(10)||n.equals(3)){this._opts.onTrigger(),n.preventDefault();return}this._opts.onKeyDown?.(n)})}get domNode(){return this._domNode}isEnabled(){return this._domNode.tabIndex>=0}focus(){this._domNode.focus()}setEnabled(e){this._domNode.classList.toggle("disabled",!e),this._domNode.setAttribute("aria-disabled",String(!e)),this._domNode.tabIndex=e?0:-1}setExpanded(e){this._domNode.setAttribute("aria-expanded",String(!!e)),e?(this._domNode.classList.remove(...ve.asClassNameArray(_Y)),this._domNode.classList.add(...ve.asClassNameArray(bY))):(this._domNode.classList.remove(...ve.asClassNameArray(bY)),this._domNode.classList.add(...ve.asClassNameArray(_Y)))}}Nr((o,e)=>{const t=o.getColor(vh);t&&e.addRule(`.monaco-editor .findMatch { border: 1px ${Ta(o.type)?"dotted":"solid"} ${t}; box-sizing: border-box; }`);const i=o.getColor(ele);i&&e.addRule(`.monaco-editor .findScope { border: 1px ${Ta(o.type)?"dashed":"solid"} ${i}; }`);const n=o.getColor(Ze);n&&e.addRule(`.monaco-editor .find-widget { border: 1px solid ${n}; }`);const s=o.getColor(Qae);s&&e.addRule(`.monaco-editor .findMatchInline { color: ${s}; }`);const r=o.getColor(Jae);r&&e.addRule(`.monaco-editor .currentFindMatchInline { color: ${r}; }`)});var BLe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},HLe=function(o,e){return function(t,i){e(t,i,o)}},tu;let fF=(Pu=class{static getOrCreate(e){return tu._instance||(tu._instance=new tu(e)),tu._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new P,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){const t=this.inMemoryValues.delete(e);return this.save(),t}add(e){return this.inMemoryValues.add(e),this.save(),this}has(e){return this.inMemoryValues.has(e)}forEach(e,t){return this.load(),this.inMemoryValues.forEach(e)}replace(e){this.inMemoryValues=new Set(e),this.save()}load(){let e;const t=this.storageService.get(tu.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){const e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(tu.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}},tu=Pu,Pu.FIND_HISTORY_KEY="workbench.find.history",Pu._instance=null,Pu);fF=tu=BLe([HLe(0,Es)],fF);var VLe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zLe=function(o,e){return function(t,i){e(t,i,o)}},iu;let gF=(Au=class{static getOrCreate(e){return iu._instance||(iu._instance=new iu(e)),iu._instance}constructor(e){this.storageService=e,this.inMemoryValues=new Set,this._onDidChangeEmitter=new P,this.onDidChange=this._onDidChangeEmitter.event,this.load()}delete(e){const t=this.inMemoryValues.delete(e);return this.save(),t}add(e){return this.inMemoryValues.add(e),this.save(),this}has(e){return this.inMemoryValues.has(e)}forEach(e,t){return this.load(),this.inMemoryValues.forEach(e)}replace(e){this.inMemoryValues=new Set(e),this.save()}load(){let e;const t=this.storageService.get(iu.FIND_HISTORY_KEY,1);if(t)try{e=JSON.parse(t)}catch{}this.inMemoryValues=new Set(e||[])}save(){const e=[];return this.inMemoryValues.forEach(t=>e.push(t)),new Promise(t=>{this.storageService.store(iu.FIND_HISTORY_KEY,JSON.stringify(e),1,0),this._onDidChangeEmitter.fire(e),t()})}},iu=Au,Au.FIND_HISTORY_KEY="workbench.replace.history",Au._instance=null,Au);gF=iu=VLe([zLe(0,Es)],gF);var yY=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aa=function(o,e){return function(t,i){e(t,i,o)}},pF;const ULe=524288;function mF(o,e="single",t=!1){if(!o.hasModel())return null;const i=o.getSelection();if(e==="single"&&i.startLineNumber===i.endLineNumber||e==="multiple"){if(i.isEmpty()){const n=o.getConfiguredWordAtPosition(i.getStartPosition());if(n&&t===!1)return n.word}else if(o.getModel().getValueLengthInRange(i)<ULe)return o.getModel().getValueInRange(i)}return null}let to=(Zp=class extends A{get editor(){return this._editor}static get(e){return e.getContribution(pF.ID)}constructor(e,t,i,n,s,r){super(),this._editor=e,this._findWidgetVisible=kd.bindTo(t),this._contextKeyService=t,this._storageService=i,this._clipboardService=n,this._notificationService=s,this._hoverService=r,this._updateHistoryDelayer=new fr(500),this._state=this._register(new fLe),this.loadQueryState(),this._register(this._state.onFindReplaceStateChange(a=>this._onStateChanged(a))),this._model=null,this._register(this._editor.onDidChangeModel(()=>{const a=this._editor.getModel()&&this._state.isRevealed;this.disposeModel(),this._state.change({searchScope:null,matchCase:this._storageService.getBoolean("editor.matchCase",1,!1),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,!1),isRegex:this._storageService.getBoolean("editor.isRegex",1,!1),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,!1)},!1),a&&this._start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!1,updateSearchScope:!1,loop:this._editor.getOption(50).loop})}))}dispose(){this.disposeModel(),super.dispose()}disposeModel(){this._model&&(this._model.dispose(),this._model=null)}_onStateChanged(e){this.saveQueryState(e),e.isRevealed&&(this._state.isRevealed?this._findWidgetVisible.set(!0):(this._findWidgetVisible.reset(),this.disposeModel())),e.searchString&&this.setGlobalBufferTerm(this._state.searchString)}saveQueryState(e){e.isRegex&&this._storageService.store("editor.isRegex",this._state.actualIsRegex,1,1),e.wholeWord&&this._storageService.store("editor.wholeWord",this._state.actualWholeWord,1,1),e.matchCase&&this._storageService.store("editor.matchCase",this._state.actualMatchCase,1,1),e.preserveCase&&this._storageService.store("editor.preserveCase",this._state.actualPreserveCase,1,1)}loadQueryState(){this._state.change({matchCase:this._storageService.getBoolean("editor.matchCase",1,this._state.matchCase),wholeWord:this._storageService.getBoolean("editor.wholeWord",1,this._state.wholeWord),isRegex:this._storageService.getBoolean("editor.isRegex",1,this._state.isRegex),preserveCase:this._storageService.getBoolean("editor.preserveCase",1,this._state.preserveCase)},!1)}isFindInputFocused(){return!!OI.getValue(this._contextKeyService)}getState(){return this._state}closeFindWidget(){this._state.change({isRevealed:!1,searchScope:null},!1),this._editor.focus()}toggleCaseSensitive(){this._state.change({matchCase:!this._state.matchCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleWholeWords(){this._state.change({wholeWord:!this._state.wholeWord},!1),this._state.isRevealed||this.highlightFindOptions()}toggleRegex(){this._state.change({isRegex:!this._state.isRegex},!1),this._state.isRevealed||this.highlightFindOptions()}togglePreserveCase(){this._state.change({preserveCase:!this._state.preserveCase},!1),this._state.isRevealed||this.highlightFindOptions()}toggleSearchScope(){if(this._state.searchScope)this._state.change({searchScope:null},!0);else if(this._editor.hasModel()){let e=this._editor.getSelections();e=e.map(t=>(t.endColumn===1&&t.endLineNumber>t.startLineNumber&&(t=t.setEndPosition(t.endLineNumber-1,this._editor.getModel().getLineMaxColumn(t.endLineNumber-1))),t.isEmpty()?null:t)).filter(t=>!!t),e.length&&this._state.change({searchScope:e},!0)}}setSearchString(e){this._state.isRegex&&(e=oo(e)),this._state.change({searchString:e},!1)}highlightFindOptions(e=!1){}async _start(e,t){if(this.disposeModel(),!this._editor.hasModel())return;const i={...t,isRevealed:!0};if(e.seedSearchStringFromSelection==="single"){const n=mF(this._editor,e.seedSearchStringFromSelection,e.seedSearchStringFromNonEmptySelection);n&&(this._state.isRegex?i.searchString=oo(n):i.searchString=n)}else if(e.seedSearchStringFromSelection==="multiple"&&!e.updateSearchScope){const n=mF(this._editor,e.seedSearchStringFromSelection);n&&(i.searchString=n)}if(!i.searchString&&e.seedSearchStringFromGlobalClipboard){const n=await this.getGlobalBufferTerm();if(!this._editor.hasModel())return;n&&(i.searchString=n)}if(e.forceRevealReplace||i.isReplaceRevealed?i.isReplaceRevealed=!0:this._findWidgetVisible.get()||(i.isReplaceRevealed=!1),e.updateSearchScope){const n=this._editor.getSelections();n.some(s=>!s.isEmpty())&&(i.searchScope=n)}i.loop=e.loop,this._state.change(i,!1),this._model||(this._model=new t0(this._editor,this._state))}start(e,t){return this._start(e,t)}moveToNextMatch(){return this._model?(this._model.moveToNextMatch(),!0):!1}moveToPrevMatch(){return this._model?(this._model.moveToPrevMatch(),!0):!1}goToMatch(e){return this._model?(this._model.moveToMatch(e),!0):!1}replace(){return this._model?(this._model.replace(),!0):!1}replaceAll(){return this._model?this._editor.getModel()?.isTooLargeForHeapOperation()?(this._notificationService.warn(p(935,"The file is too large to perform a replace all operation.")),!1):(this._model.replaceAll(),!0):!1}selectAllMatches(){return this._model?(this._model.selectAllMatches(),this._editor.focus(),!0):!1}async getGlobalBufferTerm(){return this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()?this._clipboardService.readFindText():""}setGlobalBufferTerm(e){this._editor.getOption(50).globalFindClipboard&&this._editor.hasModel()&&!this._editor.getModel().isTooLargeForSyncing()&&this._clipboardService.writeFindText(e)}},pF=Zp,Zp.ID="editor.contrib.findController",Zp);to=pF=yY([aa(1,xe),aa(2,Es),aa(3,Wa),aa(4,hi),aa(5,Qs)],to);let _F=class extends to{constructor(e,t,i,n,s,r,a,l){super(e,i,r,a,s,l),this._contextViewService=t,this._keybindingService=n,this._widget=null,this._findOptionsWidget=null,this._findWidgetSearchHistory=fF.getOrCreate(r),this._replaceWidgetHistory=gF.getOrCreate(r)}async _start(e,t){this._widget||this._createFindWidget();const i=this._editor.getSelection();let n=!1;switch(this._editor.getOption(50).autoFindInSelection){case"always":n=!0;break;case"never":n=!1;break;case"multiline":{n=!!i&&i.startLineNumber!==i.endLineNumber;break}}e.updateSearchScope=e.updateSearchScope||n,await super._start(e,t),this._widget&&(e.shouldFocus===2?this._widget.focusReplaceInput():e.shouldFocus===1&&this._widget.focusFindInput())}highlightFindOptions(e=!1){this._widget||this._createFindWidget(),this._state.isRevealed&&!e?this._widget.highlightFindOptions():this._findOptionsWidget.highlightFindOptions()}_createFindWidget(){this._widget=this._register(new uF(this._editor,this,this._state,this._contextViewService,this._keybindingService,this._contextKeyService,this._hoverService,this._findWidgetSearchHistory,this._replaceWidgetHistory)),this._findOptionsWidget=this._register(new rF(this._editor,this._state,this._keybindingService))}saveViewState(){return this._widget?.getViewState()}restoreViewState(e){this._widget?.setViewState(e)}};_F=yY([aa(1,hd),aa(2,xe),aa(3,ot),aa(4,hi),aa(5,Es),aa(6,Wa),aa(7,Qs)],_F),HH(new BH({id:Vt.StartFindAction,label:H(942,"Find"),precondition:K.or(T.focus,K.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2084,weight:100},menuOpts:{menuId:de.MenubarEditMenu,group:"3_find",title:p(936,"&&Find"),order:1}})).addImplementation(0,(o,e,t)=>{const i=to.get(e);return i?i.start({forceRevealReplace:!1,seedSearchStringFromSelection:e.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).globalFindClipboard,shouldFocus:1,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop}):!1});const $Le={description:"Open a new In-Editor Find Widget.",args:[{name:"Open a new In-Editor Find Widget args",schema:{properties:{searchString:{type:"string"},replaceString:{type:"string"},isRegex:{type:"boolean"},matchWholeWord:{type:"boolean"},isCaseSensitive:{type:"boolean"},preserveCase:{type:"boolean"},findInSelection:{type:"boolean"}}}}]};class jLe extends le{constructor(){super({id:Vt.StartFindWithArgs,label:H(943,"Find with Arguments"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,weight:100},metadata:$Le})}async run(e,t,i){const n=to.get(t);if(n){const s=i?{searchString:i.searchString,replaceString:i.replaceString,isReplaceRevealed:i.replaceString!==void 0,isRegex:i.isRegex,wholeWord:i.matchWholeWord,matchCase:i.isCaseSensitive,preserveCase:i.preserveCase}:{};await n.start({forceRevealReplace:!1,seedSearchStringFromSelection:n.getState().searchString.length===0&&t.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:1,shouldAnimate:!0,updateSearchScope:i?.findInSelection||!1,loop:t.getOption(50).loop},s),n.setGlobalBufferTerm(n.getState().searchString)}}}class qLe extends le{constructor(){super({id:Vt.StartFindWithSelection,label:H(944,"Find with Selection"),precondition:void 0,kbOpts:{kbExpr:null,primary:0,mac:{primary:2083},weight:100}})}async run(e,t){const i=to.get(t);i&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"multiple",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}),i.setGlobalBufferTerm(i.getState().searchString))}}class LY extends le{async run(e,t){const i=to.get(t);i&&!this._run(i)&&(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:i.getState().searchString.length===0&&t.getOption(50).seedSearchStringFromSelection!=="never"?"single":"none",seedSearchStringFromNonEmptySelection:t.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:!0,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}),this._run(i))}}class KLe extends LY{constructor(){super({id:Vt.NextMatchFindAction,label:H(945,"Find Next"),precondition:void 0,kbOpts:[{kbExpr:T.focus,primary:61,mac:{primary:2085,secondary:[61]},weight:100},{kbExpr:K.and(T.focus,OI),primary:3,weight:100}]})}_run(e){return e.moveToNextMatch()?(e.editor.pushUndoStop(),!0):!1}}class GLe extends LY{constructor(){super({id:Vt.PreviousMatchFindAction,label:H(946,"Find Previous"),precondition:void 0,kbOpts:[{kbExpr:T.focus,primary:1085,mac:{primary:3109,secondary:[1085]},weight:100},{kbExpr:K.and(T.focus,OI),primary:1027,weight:100}]})}_run(e){return e.moveToPrevMatch()}}class ZLe extends le{constructor(){super({id:Vt.GoToMatchFindAction,label:H(947,"Go to Match..."),precondition:kd}),this._highlightDecorations=[]}run(e,t,i){const n=to.get(t);if(!n)return;const s=n.getState().matchesCount;if(s<1){e.get(hi).notify({severity:k_.Warning,message:p(937,"No matches. Try searching for something else.")});return}const r=e.get(Zn),a=new U,l=a.add(r.createInputBox());l.placeholder=p(938,"Type a number to go to a specific match (between 1 and {0})",s);const c=h=>{const u=parseInt(h);if(isNaN(u))return;const f=n.getState().matchesCount;if(u>0&&u<=f)return u-1;if(u<0&&u>=-f)return f+u},d=h=>{const u=c(h);if(typeof u=="number"){l.validationMessage=void 0,n.goToMatch(u);const f=n.getState().currentMatch;f&&this.addDecorations(t,f)}else l.validationMessage=p(939,"Please type a number between 1 and {0}",n.getState().matchesCount),this.clearDecorations(t)};a.add(l.onDidChangeValue(h=>{d(h)})),a.add(l.onDidAccept(()=>{const h=c(l.value);typeof h=="number"?(n.goToMatch(h),l.hide()):l.validationMessage=p(940,"Please type a number between 1 and {0}",n.getState().matchesCount)})),a.add(l.onDidHide(()=>{this.clearDecorations(t),a.dispose()})),l.show()}clearDecorations(e){e.changeDecorations(t=>{this._highlightDecorations=t.deltaDecorations(this._highlightDecorations,[])})}addDecorations(e,t){e.changeDecorations(i=>{this._highlightDecorations=i.deltaDecorations(this._highlightDecorations,[{range:t,options:{description:"find-match-quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"find-match-quick-access-range-highlight-overview",overviewRuler:{color:ci(Oz),position:Ao.Full}}}])})}}class xY extends le{async run(e,t){const i=to.get(t);if(!i)return;const n=mF(t,"single",!1);n&&i.setSearchString(n),this._run(i)||(await i.start({forceRevealReplace:!1,seedSearchStringFromSelection:"none",seedSearchStringFromNonEmptySelection:!1,seedSearchStringFromGlobalClipboard:!1,shouldFocus:0,shouldAnimate:!0,updateSearchScope:!1,loop:t.getOption(50).loop}),this._run(i))}}class YLe extends xY{constructor(){super({id:Vt.NextSelectionMatchFindAction,label:H(948,"Find Next Selection"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2109,weight:100}})}_run(e){return e.moveToNextMatch()}}class XLe extends xY{constructor(){super({id:Vt.PreviousSelectionMatchFindAction,label:H(949,"Find Previous Selection"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:3133,weight:100}})}_run(e){return e.moveToPrevMatch()}}HH(new BH({id:Vt.StartFindReplaceAction,label:H(950,"Replace"),precondition:K.or(T.focus,K.has("editorIsOpen")),kbOpts:{kbExpr:null,primary:2086,mac:{primary:2596},weight:100},menuOpts:{menuId:de.MenubarEditMenu,group:"3_find",title:p(941,"&&Replace"),order:2}})).addImplementation(0,(o,e,t)=>{if(!e.hasModel()||e.getOption(104))return!1;const i=to.get(e);if(!i)return!1;const n=e.getSelection(),s=i.isFindInputFocused(),r=!n.isEmpty()&&n.startLineNumber===n.endLineNumber&&e.getOption(50).seedSearchStringFromSelection!=="never"&&!s,a=s||r?2:1;return i.start({forceRevealReplace:!0,seedSearchStringFromSelection:r?"single":"none",seedSearchStringFromNonEmptySelection:e.getOption(50).seedSearchStringFromSelection==="selection",seedSearchStringFromGlobalClipboard:e.getOption(50).seedSearchStringFromSelection!=="never",shouldFocus:a,shouldAnimate:!0,updateSearchScope:!1,loop:e.getOption(50).loop})}),Qe(to.ID,_F,0),ne(jLe),ne(qLe),ne(KLe),ne(GLe),ne(ZLe),ne(YLe),ne(XLe);const qa=Bi.bindToContribution(to.get);re(new qa({id:Vt.CloseFindWidgetCommand,precondition:kd,handler:o=>o.closeFindWidget(),kbOpts:{weight:105,kbExpr:K.and(T.focus,K.not("isComposing")),primary:9,secondary:[1033]}})),re(new qa({id:Vt.ToggleCaseSensitiveCommand,precondition:void 0,handler:o=>o.toggleCaseSensitive(),kbOpts:{weight:105,kbExpr:T.focus,primary:FI.primary,mac:FI.mac,win:FI.win,linux:FI.linux}})),re(new qa({id:Vt.ToggleWholeWordCommand,precondition:void 0,handler:o=>o.toggleWholeWords(),kbOpts:{weight:105,kbExpr:T.focus,primary:WI.primary,mac:WI.mac,win:WI.win,linux:WI.linux}})),re(new qa({id:Vt.ToggleRegexCommand,precondition:void 0,handler:o=>o.toggleRegex(),kbOpts:{weight:105,kbExpr:T.focus,primary:BI.primary,mac:BI.mac,win:BI.win,linux:BI.linux}})),re(new qa({id:Vt.ToggleSearchScopeCommand,precondition:void 0,handler:o=>o.toggleSearchScope(),kbOpts:{weight:105,kbExpr:T.focus,primary:HI.primary,mac:HI.mac,win:HI.win,linux:HI.linux}})),re(new qa({id:Vt.TogglePreserveCaseCommand,precondition:void 0,handler:o=>o.togglePreserveCase(),kbOpts:{weight:105,kbExpr:T.focus,primary:VI.primary,mac:VI.mac,win:VI.win,linux:VI.linux}})),re(new qa({id:Vt.ReplaceOneAction,precondition:kd,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:T.focus,primary:3094}})),re(new qa({id:Vt.ReplaceOneAction,precondition:kd,handler:o=>o.replace(),kbOpts:{weight:105,kbExpr:K.and(T.focus,oF),primary:3}})),re(new qa({id:Vt.ReplaceAllAction,precondition:kd,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:T.focus,primary:2563}})),re(new qa({id:Vt.ReplaceAllAction,precondition:kd,handler:o=>o.replaceAll(),kbOpts:{weight:105,kbExpr:K.and(T.focus,oF),primary:void 0,mac:{primary:2051}}})),re(new qa({id:Vt.SelectAllMatchesAction,precondition:kd,handler:o=>o.selectAllMatches(),kbOpts:{weight:105,kbExpr:T.focus,primary:515}}));const QLe={0:" ",1:"u",2:"r"},kY=65535,Ka=16777215,IY=4278190080;class bF{constructor(e){const t=Math.ceil(e/32);this._states=new Uint32Array(t)}get(e){const t=e/32|0,i=e%32;return(this._states[t]&1<<i)!==0}set(e,t){const i=e/32|0,n=e%32,s=this._states[i];t?this._states[i]=s|1<<n:this._states[i]=s&~(1<<n)}}class Qo{constructor(e,t,i){if(e.length!==t.length||e.length>kY)throw new Error("invalid startIndexes or endIndexes size");this._startIndexes=e,this._endIndexes=t,this._collapseStates=new bF(e.length),this._userDefinedStates=new bF(e.length),this._recoveredStates=new bF(e.length),this._types=i,this._parentsComputed=!1}ensureParentIndices(){if(!this._parentsComputed){this._parentsComputed=!0;const e=[],t=(i,n)=>{const s=e[e.length-1];return this.getStartLineNumber(s)<=i&&this.getEndLineNumber(s)>=n};for(let i=0,n=this._startIndexes.length;i<n;i++){const s=this._startIndexes[i],r=this._endIndexes[i];if(s>Ka||r>Ka)throw new Error("startLineNumber or endLineNumber must not exceed "+Ka);for(;e.length>0&&!t(s,r);)e.pop();const a=e.length>0?e[e.length-1]:-1;e.push(i),this._startIndexes[i]=s+((a&255)<<24),this._endIndexes[i]=r+((a&65280)<<16)}}}get length(){return this._startIndexes.length}getStartLineNumber(e){return this._startIndexes[e]&Ka}getEndLineNumber(e){return this._endIndexes[e]&Ka}getType(e){return this._types?this._types[e]:void 0}hasTypes(){return!!this._types}isCollapsed(e){return this._collapseStates.get(e)}setCollapsed(e,t){this._collapseStates.set(e,t)}isUserDefined(e){return this._userDefinedStates.get(e)}setUserDefined(e,t){return this._userDefinedStates.set(e,t)}isRecovered(e){return this._recoveredStates.get(e)}setRecovered(e,t){return this._recoveredStates.set(e,t)}getSource(e){return this.isUserDefined(e)?1:this.isRecovered(e)?2:0}setSource(e,t){t===1?(this.setUserDefined(e,!0),this.setRecovered(e,!1)):t===2?(this.setUserDefined(e,!1),this.setRecovered(e,!0)):(this.setUserDefined(e,!1),this.setRecovered(e,!1))}setCollapsedAllOfType(e,t){let i=!1;if(this._types)for(let n=0;n<this._types.length;n++)this._types[n]===e&&(this.setCollapsed(n,t),i=!0);return i}toRegion(e){return new JLe(this,e)}getParentIndex(e){this.ensureParentIndices();const t=((this._startIndexes[e]&IY)>>>24)+((this._endIndexes[e]&IY)>>>16);return t===kY?-1:t}contains(e,t){return this.getStartLineNumber(e)<=t&&this.getEndLineNumber(e)>=t}findIndex(e){let t=0,i=this._startIndexes.length;if(i===0)return-1;for(;t<i;){const n=Math.floor((t+i)/2);e<this.getStartLineNumber(n)?i=n:t=n+1}return t-1}findRange(e){let t=this.findIndex(e);if(t>=0){if(this.getEndLineNumber(t)>=e)return t;for(t=this.getParentIndex(t);t!==-1;){if(this.contains(t,e))return t;t=this.getParentIndex(t)}}return-1}toString(){const e=[];for(let t=0;t<this.length;t++)e[t]=`[${QLe[this.getSource(t)]}${this.isCollapsed(t)?"+":"-"}] ${this.getStartLineNumber(t)}/${this.getEndLineNumber(t)}`;return e.join(", ")}toFoldRange(e){return{startLineNumber:this._startIndexes[e]&Ka,endLineNumber:this._endIndexes[e]&Ka,type:this._types?this._types[e]:void 0,isCollapsed:this.isCollapsed(e),source:this.getSource(e)}}static fromFoldRanges(e){const t=e.length,i=new Uint32Array(t),n=new Uint32Array(t);let s=[],r=!1;for(let l=0;l<t;l++){const c=e[l];i[l]=c.startLineNumber,n[l]=c.endLineNumber,s.push(c.type),c.type&&(r=!0)}r||(s=void 0);const a=new Qo(i,n,s);for(let l=0;l<t;l++)e[l].isCollapsed&&a.setCollapsed(l,!0),a.setSource(l,e[l].source);return a}static sanitizeAndMerge(e,t,i,n){i=i??Number.MAX_VALUE;const s=(_,b)=>Array.isArray(_)?(C=>C<b?_[C]:void 0):(C=>C<b?_.toFoldRange(C):void 0),r=s(e,e.length),a=s(t,t.length);let l=0,c=0,d=r(0),h=a(0);const u=[];let f,g=0;const m=[];for(;d||h;){let _;if(h&&(!d||d.startLineNumber>=h.startLineNumber))d&&d.startLineNumber===h.startLineNumber?(h.source===1?_=h:(_=d,_.isCollapsed=h.isCollapsed&&(d.endLineNumber===h.endLineNumber||!n?.startsInside(d.startLineNumber+1,d.endLineNumber+1)),_.source=0),d=r(++l)):(_=h,h.isCollapsed&&h.source===0&&(_.source=2)),h=a(++c);else{let b=c,C=h;for(;;){if(!C||C.startLineNumber>d.endLineNumber){_=d;break}if(C.source===1&&C.endLineNumber>d.endLineNumber)break;C=a(++b)}d=r(++l)}if(_){for(;f&&f.endLineNumber<_.startLineNumber;)f=u.pop();_.endLineNumber>_.startLineNumber&&_.startLineNumber>g&&_.endLineNumber<=i&&(!f||f.endLineNumber>=_.endLineNumber)&&(m.push(_),g=_.startLineNumber,f&&u.push(f),f=_)}}return m}}class JLe{constructor(e,t){this.ranges=e,this.index=t}get startLineNumber(){return this.ranges.getStartLineNumber(this.index)}get endLineNumber(){return this.ranges.getEndLineNumber(this.index)}get regionIndex(){return this.index}get parentIndex(){return this.ranges.getParentIndex(this.index)}get isCollapsed(){return this.ranges.isCollapsed(this.index)}containedBy(e){return e.startLineNumber<=this.startLineNumber&&e.endLineNumber>=this.endLineNumber}containsLine(e){return this.startLineNumber<=e&&e<=this.endLineNumber}}class exe{get regions(){return this._regions}get textModel(){return this._textModel}constructor(e,t){this._updateEventEmitter=new P,this.onDidChange=this._updateEventEmitter.event,this._textModel=e,this._decorationProvider=t,this._regions=new Qo(new Uint32Array(0),new Uint32Array(0)),this._editorDecorationIds=[]}toggleCollapseState(e){if(!e.length)return;e=e.sort((i,n)=>i.regionIndex-n.regionIndex);const t={};this._decorationProvider.changeDecorations(i=>{let n=0,s=-1,r=-1;const a=l=>{for(;n<l;){const c=this._regions.getEndLineNumber(n),d=this._regions.isCollapsed(n);if(c<=s){const h=this.regions.getSource(n)!==0;i.changeDecorationOptions(this._editorDecorationIds[n],this._decorationProvider.getDecorationOption(d,c<=r,h))}d&&c>r&&(r=c),n++}};for(const l of e){const c=l.regionIndex,d=this._editorDecorationIds[c];if(d&&!t[d]){t[d]=!0,a(c);const h=!this._regions.isCollapsed(c);this._regions.setCollapsed(c,h),s=Math.max(s,this._regions.getEndLineNumber(c))}}a(this._regions.length)}),this._updateEventEmitter.fire({model:this,collapseStateChanged:e})}removeManualRanges(e){const t=new Array,i=n=>{for(const s of e)if(!(s.startLineNumber>n.endLineNumber||n.startLineNumber>s.endLineNumber))return!0;return!1};for(let n=0;n<this._regions.length;n++){const s=this._regions.toFoldRange(n);(s.source===0||!i(s))&&t.push(s)}this.updatePost(Qo.fromFoldRanges(t))}update(e,t){const i=this._currentFoldedOrManualRanges(t),n=Qo.sanitizeAndMerge(e,i,this._textModel.getLineCount(),t);this.updatePost(Qo.fromFoldRanges(n))}updatePost(e){const t=[];let i=-1;for(let n=0,s=e.length;n<s;n++){const r=e.getStartLineNumber(n),a=e.getEndLineNumber(n),l=e.isCollapsed(n),c=e.getSource(n)!==0,d={startLineNumber:r,startColumn:this._textModel.getLineMaxColumn(r),endLineNumber:a,endColumn:this._textModel.getLineMaxColumn(a)+1};t.push({range:d,options:this._decorationProvider.getDecorationOption(l,a<=i,c)}),l&&a>i&&(i=a)}this._decorationProvider.changeDecorations(n=>this._editorDecorationIds=n.deltaDecorations(this._editorDecorationIds,t)),this._regions=e,this._updateEventEmitter.fire({model:this})}_currentFoldedOrManualRanges(e){const t=[];for(let i=0,n=this._regions.length;i<n;i++){let s=this.regions.isCollapsed(i);const r=this.regions.getSource(i);if(s||r!==0){const a=this._regions.toFoldRange(i),l=this._textModel.getDecorationRange(this._editorDecorationIds[i]);l&&(s&&e?.startsInside(l.startLineNumber+1,l.endLineNumber)&&(s=!1),t.push({startLineNumber:l.startLineNumber,endLineNumber:l.endLineNumber,type:a.type,isCollapsed:s,source:r}))}}return t}getMemento(){const e=this._currentFoldedOrManualRanges(),t=[],i=this._textModel.getLineCount();for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.startLineNumber>=r.endLineNumber||r.startLineNumber<1||r.endLineNumber>i)continue;const a=this._getLinesChecksum(r.startLineNumber+1,r.endLineNumber);t.push({startLineNumber:r.startLineNumber,endLineNumber:r.endLineNumber,isCollapsed:r.isCollapsed,source:r.source,checksum:a})}return t.length>0?t:void 0}applyMemento(e){if(!Array.isArray(e))return;const t=[],i=this._textModel.getLineCount();for(const s of e){if(s.startLineNumber>=s.endLineNumber||s.startLineNumber<1||s.endLineNumber>i)continue;const r=this._getLinesChecksum(s.startLineNumber+1,s.endLineNumber);(!s.checksum||r===s.checksum)&&t.push({startLineNumber:s.startLineNumber,endLineNumber:s.endLineNumber,type:void 0,isCollapsed:s.isCollapsed??!0,source:s.source??0})}const n=Qo.sanitizeAndMerge(this._regions,t,i);this.updatePost(Qo.fromFoldRanges(n))}_getLinesChecksum(e,t){return h1(this._textModel.getLineContent(e)+this._textModel.getLineContent(t))%1e6}dispose(){this._decorationProvider.removeDecorations(this._editorDecorationIds)}getAllRegionsAtLine(e,t){const i=[];if(this._regions){let n=this._regions.findRange(e),s=1;for(;n>=0;){const r=this._regions.toRegion(n);(!t||t(r,s))&&i.push(r),s++,n=r.parentIndex}}return i}getRegionAtLine(e){if(this._regions){const t=this._regions.findRange(e);if(t>=0)return this._regions.toRegion(t)}return null}getRegionsInside(e,t){const i=[],n=e?e.regionIndex+1:0,s=e?e.endLineNumber:Number.MAX_VALUE;if(t&&t.length===2){const r=[];for(let a=n,l=this._regions.length;a<l;a++){const c=this._regions.toRegion(a);if(this._regions.getStartLineNumber(a)<s){for(;r.length>0&&!c.containedBy(r[r.length-1]);)r.pop();r.push(c),t(c,r.length)&&i.push(c)}else break}}else for(let r=n,a=this._regions.length;r<a;r++){const l=this._regions.toRegion(r);if(this._regions.getStartLineNumber(r)<s)(!t||t(l))&&i.push(l);else break}return i}}function CF(o,e,t){const i=[];for(const n of t){const s=o.getRegionAtLine(n);if(s){const r=!s.isCollapsed;if(i.push(s),e>1){const a=o.getRegionsInside(s,(l,c)=>l.isCollapsed!==r&&c<e);i.push(...a)}}}o.toggleCollapseState(i)}function xb(o,e,t=Number.MAX_VALUE,i){const n=[];if(i&&i.length>0)for(const s of i){const r=o.getRegionAtLine(s);if(r&&(r.isCollapsed!==e&&n.push(r),t>1)){const a=o.getRegionsInside(r,(l,c)=>l.isCollapsed!==e&&c<t);n.push(...a)}}else{const s=o.getRegionsInside(null,(r,a)=>r.isCollapsed!==e&&a<t);n.push(...s)}o.toggleCollapseState(n)}function DY(o,e,t,i){const n=[];for(const s of i){const r=o.getAllRegionsAtLine(s,(a,l)=>a.isCollapsed!==e&&l<=t);n.push(...r)}o.toggleCollapseState(n)}function txe(o,e,t){const i=[];for(const n of t){const s=o.getAllRegionsAtLine(n,r=>r.isCollapsed!==e);s.length>0&&i.push(s[0])}o.toggleCollapseState(i)}function ixe(o,e,t,i){const n=(r,a)=>a===e&&r.isCollapsed!==t&&!i.some(l=>r.containsLine(l)),s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function EY(o,e,t){const i=[];for(const r of t){const a=o.getAllRegionsAtLine(r,void 0);a.length>0&&i.push(a[0])}const n=r=>i.every(a=>!a.containedBy(r)&&!r.containedBy(a))&&r.isCollapsed!==e,s=o.getRegionsInside(null,n);o.toggleCollapseState(s)}function vF(o,e,t){const i=o.textModel,n=o.regions,s=[];for(let r=n.length-1;r>=0;r--)if(t!==n.isCollapsed(r)){const a=n.getStartLineNumber(r);e.test(i.getLineContent(a))&&s.push(n.toRegion(r))}o.toggleCollapseState(s)}function wF(o,e,t){const i=o.regions,n=[];for(let s=i.length-1;s>=0;s--)t!==i.isCollapsed(s)&&e===i.getType(s)&&n.push(i.toRegion(s));o.toggleCollapseState(n)}function nxe(o,e){let t=null;const i=e.getRegionAtLine(o);if(i!==null&&(t=i.startLineNumber,o===t)){const n=i.parentIndex;n!==-1?t=e.regions.getStartLineNumber(n):t=null}return t}function sxe(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){if(o!==t.startLineNumber)return t.startLineNumber;{const i=t.parentIndex;let n=0;for(i!==-1&&(n=e.regions.getStartLineNumber(t.parentIndex));t!==null;)if(t.regionIndex>0){if(t=e.regions.toRegion(t.regionIndex-1),t.startLineNumber<=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}}else if(e.regions.length>0)for(t=e.regions.toRegion(e.regions.length-1);t!==null;){if(t.startLineNumber<o)return t.startLineNumber;t.regionIndex>0?t=e.regions.toRegion(t.regionIndex-1):t=null}return null}function oxe(o,e){let t=e.getRegionAtLine(o);if(t!==null&&t.startLineNumber===o){const i=t.parentIndex;let n=0;if(i!==-1)n=e.regions.getEndLineNumber(t.parentIndex);else{if(e.regions.length===0)return null;n=e.regions.getEndLineNumber(e.regions.length-1)}for(;t!==null;)if(t.regionIndex<e.regions.length){if(t=e.regions.toRegion(t.regionIndex+1),t.startLineNumber>=n)return null;if(t.parentIndex===i)return t.startLineNumber}else return null}else if(e.regions.length>0)for(t=e.regions.toRegion(0);t!==null;){if(t.startLineNumber>o)return t.startLineNumber;t.regionIndex<e.regions.length?t=e.regions.toRegion(t.regionIndex+1):t=null}return null}class rxe{get onDidChange(){return this._updateEventEmitter.event}get hiddenRanges(){return this._hiddenRanges}constructor(e){this._updateEventEmitter=new P,this._hasLineChanges=!1,this._foldingModel=e,this._foldingModelListener=e.onDidChange(t=>this.updateHiddenRanges()),this._hiddenRanges=[],e.regions.length&&this.updateHiddenRanges()}notifyChangeModelContent(e){this._hiddenRanges.length&&!this._hasLineChanges&&(this._hasLineChanges=e.changes.some(t=>t.range.endLineNumber!==t.range.startLineNumber||Dh(t.text)[0]!==0))}updateHiddenRanges(){let e=!1;const t=[];let i=0,n=0,s=Number.MAX_VALUE,r=-1;const a=this._foldingModel.regions;for(;i<a.length;i++){if(!a.isCollapsed(i))continue;const l=a.getStartLineNumber(i)+1,c=a.getEndLineNumber(i);s<=l&&c<=r||(!e&&n<this._hiddenRanges.length&&this._hiddenRanges[n].startLineNumber===l&&this._hiddenRanges[n].endLineNumber===c?(t.push(this._hiddenRanges[n]),n++):(e=!0,t.push(new k(l,1,c,1))),s=l,r=c)}(this._hasLineChanges||e||n<this._hiddenRanges.length)&&this.applyHiddenRanges(t)}applyHiddenRanges(e){this._hiddenRanges=e,this._hasLineChanges=!1,this._updateEventEmitter.fire(e)}hasRanges(){return this._hiddenRanges.length>0}isHidden(e){return NY(this._hiddenRanges,e)!==null}adjustSelections(e){let t=!1;const i=this._foldingModel.textModel;let n=null;const s=r=>((!n||!axe(r,n))&&(n=NY(this._hiddenRanges,r)),n?n.startLineNumber-1:null);for(let r=0,a=e.length;r<a;r++){let l=e[r];const c=s(l.startLineNumber);c&&(l=l.setStartPosition(c,i.getLineMaxColumn(c)),t=!0);const d=s(l.endLineNumber);d&&(l=l.setEndPosition(d,i.getLineMaxColumn(d)),t=!0),e[r]=l}return t}dispose(){this.hiddenRanges.length>0&&(this._hiddenRanges=[],this._updateEventEmitter.fire(this._hiddenRanges)),this._foldingModelListener&&(this._foldingModelListener.dispose(),this._foldingModelListener=null)}}function axe(o,e){return o>=e.startLineNumber&&o<=e.endLineNumber}function NY(o,e){const t=sv(o,i=>e<i.startLineNumber)-1;return t>=0&&o[t].endLineNumber>=e?o[t]:null}const lxe=5e3,cxe="indent";class SF{constructor(e,t,i){this.editorModel=e,this.languageConfigurationService=t,this.foldingRangesLimit=i,this.id=cxe}dispose(){}compute(e){const t=this.languageConfigurationService.getLanguageConfiguration(this.editorModel.getLanguageId()).foldingRules,i=t&&!!t.offSide,n=t&&t.markers;return Promise.resolve(uxe(this.editorModel,i,n,this.foldingRangesLimit))}}let dxe=class{constructor(e){this._startIndexes=[],this._endIndexes=[],this._indentOccurrences=[],this._length=0,this._foldingRangesLimit=e}insertFirst(e,t,i){if(e>Ka||t>Ka)return;const n=this._length;this._startIndexes[n]=e,this._endIndexes[n]=t,this._length++,i<1e3&&(this._indentOccurrences[i]=(this._indentOccurrences[i]||0)+1)}toIndentRanges(e){const t=this._foldingRangesLimit.limit;if(this._length<=t){this._foldingRangesLimit.update(this._length,!1);const i=new Uint32Array(this._length),n=new Uint32Array(this._length);for(let s=this._length-1,r=0;s>=0;s--,r++)i[r]=this._startIndexes[s],n[r]=this._endIndexes[s];return new Qo(i,n)}else{this._foldingRangesLimit.update(this._length,t);let i=0,n=this._indentOccurrences.length;for(let l=0;l<this._indentOccurrences.length;l++){const c=this._indentOccurrences[l];if(c){if(c+i>t){n=l;break}i+=c}}const s=e.getOptions().tabSize,r=new Uint32Array(t),a=new Uint32Array(t);for(let l=this._length-1,c=0;l>=0;l--){const d=this._startIndexes[l],h=e.getLineContent(d),u=qL(h,s);(u<n||u===n&&i++<t)&&(r[c]=d,a[c]=this._endIndexes[l],c++)}return new Qo(r,a)}}};const hxe={limit:lxe,update:()=>{}};function uxe(o,e,t,i=hxe){const n=o.getOptions().tabSize,s=new dxe(i);let r;t&&(r=new RegExp(`(${t.start.source})|(?:${t.end.source})`));const a=[],l=o.getLineCount()+1;a.push({indent:-1,endAbove:l,line:l});for(let c=o.getLineCount();c>0;c--){const d=o.getLineContent(c),h=qL(d,n);let u=a[a.length-1];if(h===-1){e&&(u.endAbove=c);continue}let f;if(r&&(f=d.match(r)))if(f[1]){let g=a.length-1;for(;g>0&&a[g].indent!==-2;)g--;if(g>0){a.length=g+1,u=a[g],s.insertFirst(c,u.line,h),u.line=c,u.indent=h,u.endAbove=c;continue}}else{a.push({indent:-2,endAbove:c,line:c});continue}if(u.indent>h){do a.pop(),u=a[a.length-1];while(u.indent>h);const g=u.endAbove-1;g-c>=1&&s.insertFirst(c,g,h)}u.indent===h?u.endAbove=c:a.push({indent:h,endAbove:c,line:c})}return s.toIndentRanges(o)}const fxe=N("editor.foldBackground",{light:Ne(Ch,.3),dark:Ne(Ch,.3),hcDark:null,hcLight:null},p(997,"Background color behind folded ranges. The color must not be opaque so as not to hide underlying decorations."),!0);N("editor.foldPlaceholderForeground",{light:"#808080",dark:"#808080",hcDark:null,hcLight:null},p(998,"Color of the collapsed text after the first line of a folded range.")),N("editorGutter.foldingControlForeground",CL,p(999,"Color of the folding control in the editor gutter."));const $I=Wt("folding-expanded",Y.chevronDown,p(1e3,"Icon for expanded ranges in the editor glyph margin.")),jI=Wt("folding-collapsed",Y.chevronRight,p(1001,"Icon for collapsed ranges in the editor glyph margin.")),TY=Wt("folding-manual-collapsed",jI,p(1002,"Icon for manually collapsed ranges in the editor glyph margin.")),RY=Wt("folding-manual-expanded",$I,p(1003,"Icon for manually expanded ranges in the editor glyph margin.")),yF={color:ci(fxe),position:1},kb=p(1004,"Click to expand the range."),qI=p(1005,"Click to collapse the range."),Fi=class Fi{constructor(e){this.editor=e,this.showFoldingControls="mouseover",this.showFoldingHighlights=!0}getDecorationOption(e,t,i){return t?Fi.HIDDEN_RANGE_DECORATION:this.showFoldingControls==="never"?e?this.showFoldingHighlights?Fi.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION:Fi.NO_CONTROLS_COLLAPSED_RANGE_DECORATION:Fi.NO_CONTROLS_EXPANDED_RANGE_DECORATION:e?i?this.showFoldingHighlights?Fi.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Fi.MANUALLY_COLLAPSED_VISUAL_DECORATION:this.showFoldingHighlights?Fi.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION:Fi.COLLAPSED_VISUAL_DECORATION:this.showFoldingControls==="mouseover"?i?Fi.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION:Fi.EXPANDED_AUTO_HIDE_VISUAL_DECORATION:i?Fi.MANUALLY_EXPANDED_VISUAL_DECORATION:Fi.EXPANDED_VISUAL_DECORATION}changeDecorations(e){return this.editor.changeDecorations(e)}removeDecorations(e){this.editor.removeDecorations(e)}};Fi.COLLAPSED_VISUAL_DECORATION=Te.register({description:"folding-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kb,firstLineDecorationClassName:ve.asClassName(jI)}),Fi.COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Te.register({description:"folding-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:yF,isWholeLine:!0,linesDecorationsTooltip:kb,firstLineDecorationClassName:ve.asClassName(jI)}),Fi.MANUALLY_COLLAPSED_VISUAL_DECORATION=Te.register({description:"folding-manually-collapsed-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kb,firstLineDecorationClassName:ve.asClassName(TY)}),Fi.MANUALLY_COLLAPSED_HIGHLIGHTED_VISUAL_DECORATION=Te.register({description:"folding-manually-collapsed-highlighted-visual-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:yF,isWholeLine:!0,linesDecorationsTooltip:kb,firstLineDecorationClassName:ve.asClassName(TY)}),Fi.NO_CONTROLS_COLLAPSED_RANGE_DECORATION=Te.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",isWholeLine:!0,linesDecorationsTooltip:kb}),Fi.NO_CONTROLS_COLLAPSED_HIGHLIGHTED_RANGE_DECORATION=Te.register({description:"folding-no-controls-range-decoration",stickiness:0,afterContentClassName:"inline-folded",className:"folded-background",minimap:yF,isWholeLine:!0,linesDecorationsTooltip:kb}),Fi.EXPANDED_VISUAL_DECORATION=Te.register({description:"folding-expanded-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+ve.asClassName($I),linesDecorationsTooltip:qI}),Fi.EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Te.register({description:"folding-expanded-auto-hide-visual-decoration",stickiness:1,isWholeLine:!0,firstLineDecorationClassName:ve.asClassName($I),linesDecorationsTooltip:qI}),Fi.MANUALLY_EXPANDED_VISUAL_DECORATION=Te.register({description:"folding-manually-expanded-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:"alwaysShowFoldIcons "+ve.asClassName(RY),linesDecorationsTooltip:qI}),Fi.MANUALLY_EXPANDED_AUTO_HIDE_VISUAL_DECORATION=Te.register({description:"folding-manually-expanded-auto-hide-visual-decoration",stickiness:0,isWholeLine:!0,firstLineDecorationClassName:ve.asClassName(RY),linesDecorationsTooltip:qI}),Fi.NO_CONTROLS_EXPANDED_RANGE_DECORATION=Te.register({description:"folding-no-controls-range-decoration",stickiness:0,isWholeLine:!0}),Fi.HIDDEN_RANGE_DECORATION=Te.register({description:"folding-hidden-range-decoration",stickiness:1});let LF=Fi;const gxe={},pxe="syntax";class xF{constructor(e,t,i,n,s){this.editorModel=e,this.providers=t,this.handleFoldingRangesChange=i,this.foldingRangesLimit=n,this.fallbackRangeProvider=s,this.id=pxe,this.disposables=new U,s&&this.disposables.add(s);for(const r of t)typeof r.onDidChange=="function"&&this.disposables.add(r.onDidChange(i))}compute(e){return mxe(this.providers,this.editorModel,e).then(t=>this.editorModel.isDisposed()?null:t?bxe(t,this.foldingRangesLimit):this.fallbackRangeProvider?.compute(e)??null)}dispose(){this.disposables.dispose()}}function mxe(o,e,t){let i=null;const n=o.map((s,r)=>Promise.resolve(s.provideFoldingRanges(e,gxe,t)).then(a=>{if(!t.isCancellationRequested&&Array.isArray(a)){Array.isArray(i)||(i=[]);const l=e.getLineCount();for(const c of a)c.start>0&&c.end>c.start&&c.end<=l&&i.push({start:c.start,end:c.end,rank:r,kind:c.kind})}},Di));return Promise.all(n).then(s=>i)}class _xe{constructor(e){this._startIndexes=[],this._endIndexes=[],this._nestingLevels=[],this._nestingLevelCounts=[],this._types=[],this._length=0,this._foldingRangesLimit=e}add(e,t,i,n){if(e>Ka||t>Ka)return;const s=this._length;this._startIndexes[s]=e,this._endIndexes[s]=t,this._nestingLevels[s]=n,this._types[s]=i,this._length++,n<30&&(this._nestingLevelCounts[n]=(this._nestingLevelCounts[n]||0)+1)}toIndentRanges(){const e=this._foldingRangesLimit.limit;if(this._length<=e){this._foldingRangesLimit.update(this._length,!1);const t=new Uint32Array(this._length),i=new Uint32Array(this._length);for(let n=0;n<this._length;n++)t[n]=this._startIndexes[n],i[n]=this._endIndexes[n];return new Qo(t,i,this._types)}else{this._foldingRangesLimit.update(this._length,e);let t=0,i=this._nestingLevelCounts.length;for(let a=0;a<this._nestingLevelCounts.length;a++){const l=this._nestingLevelCounts[a];if(l){if(l+t>e){i=a;break}t+=l}}const n=new Uint32Array(e),s=new Uint32Array(e),r=[];for(let a=0,l=0;a<this._length;a++){const c=this._nestingLevels[a];(c<i||c===i&&t++<e)&&(n[l]=this._startIndexes[a],s[l]=this._endIndexes[a],r[l]=this._types[a],l++)}return new Qo(n,s,r)}}}function bxe(o,e){const t=o.sort((r,a)=>{let l=r.start-a.start;return l===0&&(l=r.rank-a.rank),l}),i=new _xe(e);let n;const s=[];for(const r of t)if(!n)n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else if(r.start>n.start)if(r.end<=n.end)s.push(n),n=r,i.add(r.start,r.end,r.kind&&r.kind.value,s.length);else{if(r.start>n.end){do n=s.pop();while(n&&r.start>n.end);n&&s.push(n),n=r}i.add(r.start,r.end,r.kind&&r.kind.value,s.length)}return i.toIndentRanges()}var Cxe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},s0=function(o,e){return function(t,i){e(t,i,o)}},o0;const vn=new ae("foldingEnabled",!1);let nu=(Yp=class extends A{static get(e){return e.getContribution(o0.ID)}static getFoldingRangeProviders(e,t){const i=e.foldingRangeProvider.ordered(t);return o0._foldingRangeSelector?.(i,t)??i}constructor(e,t,i,n,s,r){super(),this.contextKeyService=t,this.languageConfigurationService=i,this.languageFeaturesService=r,this.localToDispose=this._register(new U),this.editor=e,this._foldingLimitReporter=this._register(new MY(e));const a=this.editor.getOptions();this._isEnabled=a.get(52),this._useFoldingProviders=a.get(53)!=="indentation",this._unfoldOnClickAfterEndOfLine=a.get(57),this._restoringViewState=!1,this._currentModelHasFoldedImports=!1,this._foldingImportsByDefault=a.get(55),this.updateDebounceInfo=s.for(r.foldingRangeProvider,"Folding",{min:200}),this.foldingModel=null,this.hiddenRangeModel=null,this.rangeProvider=null,this.foldingRegionPromise=null,this.foldingModelPromise=null,this.updateScheduler=null,this.cursorChangedScheduler=null,this.mouseDownInfo=null,this.foldingDecorationProvider=new LF(e),this.foldingDecorationProvider.showFoldingControls=a.get(126),this.foldingDecorationProvider.showFoldingHighlights=a.get(54),this.foldingEnabled=vn.bindTo(this.contextKeyService),this.foldingEnabled.set(this._isEnabled),this._register(this.editor.onDidChangeModel(()=>this.onModelChanged())),this._register(this.editor.onDidChangeConfiguration(l=>{if(l.hasChanged(52)&&(this._isEnabled=this.editor.getOptions().get(52),this.foldingEnabled.set(this._isEnabled),this.onModelChanged()),l.hasChanged(56)&&this.onModelChanged(),l.hasChanged(126)||l.hasChanged(54)){const c=this.editor.getOptions();this.foldingDecorationProvider.showFoldingControls=c.get(126),this.foldingDecorationProvider.showFoldingHighlights=c.get(54),this.triggerFoldingModelChanged()}l.hasChanged(53)&&(this._useFoldingProviders=this.editor.getOptions().get(53)!=="indentation",this.onFoldingStrategyChanged()),l.hasChanged(57)&&(this._unfoldOnClickAfterEndOfLine=this.editor.getOptions().get(57)),l.hasChanged(55)&&(this._foldingImportsByDefault=this.editor.getOptions().get(55))})),this.onModelChanged()}saveViewState(){const e=this.editor.getModel();if(!e||!this._isEnabled||e.isTooLargeForTokenization())return{};if(this.foldingModel){const t=this.foldingModel.getMemento(),i=this.rangeProvider?this.rangeProvider.id:void 0;return{collapsedRegions:t,lineCount:e.getLineCount(),provider:i,foldedImports:this._currentModelHasFoldedImports}}}restoreViewState(e){const t=this.editor.getModel();if(!(!t||!this._isEnabled||t.isTooLargeForTokenization()||!this.hiddenRangeModel)&&e&&(this._currentModelHasFoldedImports=!!e.foldedImports,e.collapsedRegions&&e.collapsedRegions.length>0&&this.foldingModel)){this._restoringViewState=!0;try{this.foldingModel.applyMemento(e.collapsedRegions)}finally{this._restoringViewState=!1}}}onModelChanged(){this.localToDispose.clear();const e=this.editor.getModel();!this._isEnabled||!e||e.isTooLargeForTokenization()||(this._currentModelHasFoldedImports=!1,this.foldingModel=new exe(e,this.foldingDecorationProvider),this.localToDispose.add(this.foldingModel),this.hiddenRangeModel=new rxe(this.foldingModel),this.localToDispose.add(this.hiddenRangeModel),this.localToDispose.add(this.hiddenRangeModel.onDidChange(t=>this.onHiddenRangesChanges(t))),this.updateScheduler=new fr(this.updateDebounceInfo.get(e)),this.localToDispose.add(this.updateScheduler),this.cursorChangedScheduler=new wt(()=>this.revealCursor(),200),this.localToDispose.add(this.cursorChangedScheduler),this.localToDispose.add(this.languageFeaturesService.foldingRangeProvider.onDidChange(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelLanguageConfiguration(()=>this.onFoldingStrategyChanged())),this.localToDispose.add(this.editor.onDidChangeModelContent(t=>this.onDidChangeModelContent(t))),this.localToDispose.add(this.editor.onDidChangeCursorPosition(()=>this.onCursorPositionChanged())),this.localToDispose.add(this.editor.onMouseDown(t=>this.onEditorMouseDown(t))),this.localToDispose.add(this.editor.onMouseUp(t=>this.onEditorMouseUp(t))),this.localToDispose.add({dispose:()=>{this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.updateScheduler?.cancel(),this.updateScheduler=null,this.foldingModel=null,this.foldingModelPromise=null,this.hiddenRangeModel=null,this.cursorChangedScheduler=null,this.rangeProvider?.dispose(),this.rangeProvider=null}}),this.triggerFoldingModelChanged())}onFoldingStrategyChanged(){this.rangeProvider?.dispose(),this.rangeProvider=null,this.triggerFoldingModelChanged()}getRangeProvider(e){if(this.rangeProvider)return this.rangeProvider;const t=new SF(e,this.languageConfigurationService,this._foldingLimitReporter);if(this.rangeProvider=t,this._useFoldingProviders&&this.foldingModel){const i=o0.getFoldingRangeProviders(this.languageFeaturesService,e);i.length>0&&(this.rangeProvider=new xF(e,i,()=>this.triggerFoldingModelChanged(),this._foldingLimitReporter,t))}return this.rangeProvider}getFoldingModel(){return this.foldingModelPromise}onDidChangeModelContent(e){this.hiddenRangeModel?.notifyChangeModelContent(e),this.triggerFoldingModelChanged()}triggerFoldingModelChanged(){this.updateScheduler&&(this.foldingRegionPromise&&(this.foldingRegionPromise.cancel(),this.foldingRegionPromise=null),this.foldingModelPromise=this.updateScheduler.trigger(()=>{const e=this.foldingModel;if(!e)return null;const t=new Ki,i=this.getRangeProvider(e.textModel),n=this.foldingRegionPromise=Vi(s=>i.compute(s));return n.then(s=>{if(s&&n===this.foldingRegionPromise){let r;if(this._foldingImportsByDefault&&!this._currentModelHasFoldedImports){const c=s.setCollapsedAllOfType($c.Imports.value,!0);c&&(r=Aa.capture(this.editor),this._currentModelHasFoldedImports=c)}const a=this.editor.getSelections();e.update(s,vxe(a)),r?.restore(this.editor);const l=this.updateDebounceInfo.update(e.textModel,t.elapsed());this.updateScheduler&&(this.updateScheduler.defaultDelay=l)}return e})}).then(void 0,e=>(Ee(e),null)))}onHiddenRangesChanges(e){if(this.hiddenRangeModel&&e.length&&!this._restoringViewState){const t=this.editor.getSelections();t&&this.hiddenRangeModel.adjustSelections(t)&&this.editor.setSelections(t)}this.editor.setHiddenAreas(e,this)}onCursorPositionChanged(){this.hiddenRangeModel&&this.hiddenRangeModel.hasRanges()&&this.cursorChangedScheduler.schedule()}revealCursor(){const e=this.getFoldingModel();e&&e.then(t=>{if(t){const i=this.editor.getSelections();if(i&&i.length>0){const n=[];for(const s of i){const r=s.selectionStartLineNumber;this.hiddenRangeModel&&this.hiddenRangeModel.isHidden(r)&&n.push(...t.getAllRegionsAtLine(r,a=>a.isCollapsed&&r>a.startLineNumber))}n.length&&(t.toggleCollapseState(n),this.reveal(i[0].getPosition()))}}}).then(void 0,Ee)}onEditorMouseDown(e){if(this.mouseDownInfo=null,!this.hiddenRangeModel||!e.target||!e.target.range||!e.event.leftButton&&!e.event.middleButton)return;const t=e.target.range;let i=!1;switch(e.target.type){case 4:{const n=e.target.detail,s=e.target.element.offsetLeft;if(n.offsetX-s<4)return;i=!0;break}case 7:{if(this._unfoldOnClickAfterEndOfLine&&this.hiddenRangeModel.hasRanges()&&!e.target.detail.isAfterLines)break;return}case 6:{if(this.hiddenRangeModel.hasRanges()){const n=this.editor.getModel();if(n&&t.startColumn===n.getLineMaxColumn(t.startLineNumber))break}return}default:return}this.mouseDownInfo={lineNumber:t.startLineNumber,iconClicked:i}}onEditorMouseUp(e){const t=this.foldingModel;if(!t||!this.mouseDownInfo||!e.target)return;const i=this.mouseDownInfo.lineNumber,n=this.mouseDownInfo.iconClicked,s=e.target.range;if(!s||s.startLineNumber!==i)return;if(n){if(e.target.type!==4)return}else{const a=this.editor.getModel();if(!a||s.startColumn!==a.getLineMaxColumn(i))return}const r=t.getRegionAtLine(i);if(r&&r.startLineNumber===i){const a=r.isCollapsed;if(n||a){const l=e.event.altKey;let c=[];if(l){const d=u=>!u.containedBy(r)&&!r.containedBy(u),h=t.getRegionsInside(null,d);for(const u of h)u.isCollapsed&&c.push(u);c.length===0&&(c=h)}else{const d=e.event.middleButton||e.event.shiftKey;if(d)for(const h of t.getRegionsInside(r))h.isCollapsed===a&&c.push(h);(a||!d||c.length===0)&&c.push(r)}t.toggleCollapseState(c),this.reveal({lineNumber:i,column:1})}}}reveal(e){this.editor.revealPositionInCenterIfOutsideViewport(e,0)}},o0=Yp,Yp.ID="editor.contrib.folding",Yp);nu=o0=Cxe([s0(1,xe),s0(2,Jt),s0(3,hi),s0(4,Or),s0(5,he)],nu);class MY extends A{constructor(e){super(),this.editor=e,this._onDidChange=this._register(new P),this._computed=0,this._limited=!1}get limit(){return this.editor.getOptions().get(56)}update(e,t){(e!==this._computed||t!==this._limited)&&(this._computed=e,this._limited=t,this._onDidChange.fire())}}class Pn extends le{runEditorCommand(e,t,i){const n=e.get(Jt),s=nu.get(t);if(!s)return;const r=s.getFoldingModel();if(r)return this.reportTelemetry(e,t),r.then(a=>{if(a){this.invoke(s,a,t,i,n);const l=t.getSelection();l&&s.reveal(l.getStartPosition())}})}getSelectedLines(e){const t=e.getSelections();return t?t.map(i=>i.startLineNumber):[]}getLineNumbers(e,t){return e&&e.selectionLines?e.selectionLines.map(i=>i+1):this.getSelectedLines(t)}run(e,t){}}function vxe(o){return!o||o.length===0?{startsInside:()=>!1}:{startsInside(e,t){for(const i of o){const n=i.startLineNumber;if(n>=e&&n<=t)return!0}return!1}}}function PY(o){if(!Qn(o)){if(!nn(o))return!1;const e=o;if(!Qn(e.levels)&&!bc(e.levels)||!Qn(e.direction)&&!ji(e.direction)||!Qn(e.selectionLines)&&(!Array.isArray(e.selectionLines)||!e.selectionLines.every(bc)))return!1}return!0}class wxe extends Pn{constructor(){super({id:"editor.unfold",label:H(977,"Unfold"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:3166,mac:{primary:2654},weight:100},metadata:{description:"Unfold the content in the editor",args:[{name:"Unfold editor argument",description:`Property-value pairs that can be passed through this argument:
* 'levels': Number of levels to unfold. If not set, defaults to 1.
* 'direction': If 'up', unfold given number of levels up otherwise unfolds down.
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the unfold action to. If not set, the active selection(s) will be used.
`,constraint:PY,schema:{type:"object",properties:{levels:{type:"number",default:1},direction:{type:"string",enum:["up","down"],default:"down"},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=n&&n.levels||1,r=this.getLineNumbers(n,i);n&&n.direction==="up"?DY(t,!1,s,r):xb(t,!1,s,r)}}class Sxe extends Pn{constructor(){super({id:"editor.unfoldRecursively",label:H(978,"Unfold Recursively"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2142),weight:100}})}invoke(e,t,i,n){xb(t,!1,Number.MAX_VALUE,this.getSelectedLines(i))}}class yxe extends Pn{constructor(){super({id:"editor.fold",label:H(979,"Fold"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:3164,mac:{primary:2652},weight:100},metadata:{description:"Fold the content in the editor",args:[{name:"Fold editor argument",description:`Property-value pairs that can be passed through this argument:
* 'levels': Number of levels to fold.
* 'direction': If 'up', folds given number of levels up otherwise folds down.
* 'selectionLines': Array of the start lines (0-based) of the editor selections to apply the fold action to. If not set, the active selection(s) will be used.
If no levels or direction is set, folds the region at the locations or if already collapsed, the first uncollapsed parent instead.
`,constraint:PY,schema:{type:"object",properties:{levels:{type:"number"},direction:{type:"string",enum:["up","down"]},selectionLines:{type:"array",items:{type:"number"}}}}}]}})}invoke(e,t,i,n){const s=this.getLineNumbers(n,i),r=n&&n.levels,a=n&&n.direction;typeof r!="number"&&typeof a!="string"?txe(t,!0,s):a==="up"?DY(t,!0,r||1,s):xb(t,!0,r||1,s)}}class Lxe extends Pn{constructor(){super({id:"editor.toggleFold",label:H(980,"Toggle Fold"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2090),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);CF(t,1,n)}}class xxe extends Pn{constructor(){super({id:"editor.foldRecursively",label:H(981,"Fold Recursively"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2140),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);xb(t,!0,Number.MAX_VALUE,n)}}class kxe extends Pn{constructor(){super({id:"editor.toggleFoldRecursively",label:H(982,"Toggle Fold Recursively"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,3114),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);CF(t,Number.MAX_VALUE,n)}}class Ixe extends Pn{constructor(){super({id:"editor.foldAllBlockComments",label:H(983,"Fold All Block Comments"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2138),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())wF(t,$c.Comment.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).comments;if(a&&a.blockCommentStartToken){const l=new RegExp("^\\s*"+oo(a.blockCommentStartToken));vF(t,l,!0)}}}}class Dxe extends Pn{constructor(){super({id:"editor.foldAllMarkerRegions",label:H(984,"Fold All Regions"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2077),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())wF(t,$c.Region.value,!0);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);vF(t,l,!0)}}}}class Exe extends Pn{constructor(){super({id:"editor.unfoldAllMarkerRegions",label:H(985,"Unfold All Regions"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2078),weight:100}})}invoke(e,t,i,n,s){if(t.regions.hasTypes())wF(t,$c.Region.value,!1);else{const r=i.getModel();if(!r)return;const a=s.getLanguageConfiguration(r.getLanguageId()).foldingRules;if(a&&a.markers&&a.markers.start){const l=new RegExp(a.markers.start);vF(t,l,!1)}}}}class Nxe extends Pn{constructor(){super({id:"editor.foldAllExcept",label:H(986,"Fold All Except Selected"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2136),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);EY(t,!0,n)}}class Txe extends Pn{constructor(){super({id:"editor.unfoldAllExcept",label:H(987,"Unfold All Except Selected"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2134),weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);EY(t,!1,n)}}class Rxe extends Pn{constructor(){super({id:"editor.foldAll",label:H(988,"Fold All"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2069),weight:100}})}invoke(e,t,i){xb(t,!0)}}class Mxe extends Pn{constructor(){super({id:"editor.unfoldAll",label:H(989,"Unfold All"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2088),weight:100}})}invoke(e,t,i){xb(t,!1)}}const DC=class DC extends Pn{getFoldingLevel(){return parseInt(this.id.substr(DC.ID_PREFIX.length))}invoke(e,t,i){ixe(t,this.getFoldingLevel(),!0,this.getSelectedLines(i))}};DC.ID_PREFIX="editor.foldLevel",DC.ID=e=>DC.ID_PREFIX+e;let KI=DC;class Pxe extends Pn{constructor(){super({id:"editor.gotoParentFold",label:H(990,"Go to Parent Fold"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=nxe(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class Axe extends Pn{constructor(){super({id:"editor.gotoPreviousFold",label:H(991,"Go to Previous Folding Range"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=sxe(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class Oxe extends Pn{constructor(){super({id:"editor.gotoNextFold",label:H(992,"Go to Next Folding Range"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}invoke(e,t,i){const n=this.getSelectedLines(i);if(n.length>0){const s=oxe(n[0],t);s!==null&&i.setSelection({startLineNumber:s,startColumn:1,endLineNumber:s,endColumn:1})}}}class Fxe extends Pn{constructor(){super({id:"editor.createFoldingRangeFromSelection",label:H(993,"Create Folding Range from Selection"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2135),weight:100}})}invoke(e,t,i){const n=[],s=i.getSelections();if(s){for(const r of s){let a=r.endLineNumber;r.endColumn===1&&--a,a>r.startLineNumber&&(n.push({startLineNumber:r.startLineNumber,endLineNumber:a,type:void 0,isCollapsed:!0,source:1}),i.setSelection({startLineNumber:r.startLineNumber,startColumn:1,endLineNumber:r.startLineNumber,endColumn:1}))}if(n.length>0){n.sort((a,l)=>a.startLineNumber-l.startLineNumber);const r=Qo.sanitizeAndMerge(t.regions,n,i.getModel()?.getLineCount());t.updatePost(Qo.fromFoldRanges(r))}}}}class Wxe extends Pn{constructor(){super({id:"editor.removeManualFoldingRanges",label:H(994,"Remove Manual Folding Ranges"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2137),weight:100}})}invoke(e,t,i){const n=i.getSelections();if(n){const s=[];for(const r of n){const{startLineNumber:a,endLineNumber:l}=r;s.push(l>=a?{startLineNumber:a,endLineNumber:l}:{endLineNumber:l,startLineNumber:a})}t.removeManualRanges(s),e.triggerFoldingModelChanged()}}}class Bxe extends Pn{constructor(){super({id:"editor.toggleImportFold",label:H(995,"Toggle Import Fold"),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,weight:100}})}async invoke(e,t){const i=[],n=t.regions;for(let s=n.length-1;s>=0;s--)n.getType(s)===$c.Imports.value&&i.push(n.toRegion(s));t.toggleCollapseState(i),e.triggerFoldingModelChanged()}}Qe(nu.ID,nu,0),ne(wxe),ne(Sxe),ne(yxe),ne(xxe),ne(kxe),ne(Rxe),ne(Mxe),ne(Ixe),ne(Dxe),ne(Exe),ne(Nxe),ne(Txe),ne(Lxe),ne(Pxe),ne(Axe),ne(Oxe),ne(Fxe),ne(Wxe),ne(Bxe);for(let o=1;o<=7;o++)noe(new KI({id:KI.ID(o),label:H(996,"Fold Level {0}",o),precondition:vn,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2048|21+o),weight:100}}));Xe.registerCommand("_executeFoldingRangeProvider",async function(o,...e){const[t]=e;if(!(t instanceof be))throw dr();const i=o.get(he),n=o.get(Qt).getModel(t);if(!n)throw dr();const s=o.get(Me);if(!s.getValue("editor.folding",{resource:t}))return[];const r=o.get(Jt),a=s.getValue("editor.foldingStrategy",{resource:t}),l={get limit(){return s.getValue("editor.foldingMaximumRegions",{resource:t})},update:(f,g)=>{}},c=new SF(n,r,l);let d=c;if(a!=="indentation"){const f=nu.getFoldingRangeProviders(i,n);f.length&&(d=new xF(n,f,()=>{},l,c))}const h=await d.compute(He.None),u=[];try{if(h)for(let f=0;f<h.length;f++){const g=h.getType(f);u.push({start:h.getStartLineNumber(f),end:h.getEndLineNumber(f),kind:g?$c.fromValue(g):void 0})}return u}finally{d.dispose()}});class Hxe extends le{constructor(){super({id:"editor.action.fontZoomIn",label:H(1006,"Increase Editor Font Size"),precondition:void 0})}run(e,t){xr.setZoomLevel(xr.getZoomLevel()+1)}}class Vxe extends le{constructor(){super({id:"editor.action.fontZoomOut",label:H(1007,"Decrease Editor Font Size"),precondition:void 0})}run(e,t){xr.setZoomLevel(xr.getZoomLevel()-1)}}class zxe extends le{constructor(){super({id:"editor.action.fontZoomReset",label:H(1008,"Reset Editor Font Size"),precondition:void 0})}run(e,t){xr.setZoomLevel(0)}}ne(Hxe),ne(Vxe),ne(zxe);class Ib{static _handleEolEdits(e,t){let i;const n=[];for(const s of t)typeof s.eol=="number"&&(i=s.eol),s.range&&typeof s.text=="string"&&n.push(s);return typeof i=="number"&&e.hasModel()&&e.getModel().pushEOL(i),n}static _isFullModelReplaceEdit(e,t){if(!e.hasModel())return!1;const i=e.getModel(),n=i.validateRange(t.range);return i.getFullModelRange().equalsRange(n)}static execute(e,t,i){i&&e.pushUndoStop();const n=Aa.capture(e),s=Ib._handleEolEdits(e,t);s.length===1&&Ib._isFullModelReplaceEdit(e,s[0])?e.executeEdits("formatEditsCommand",s.map(r=>fi.replace(k.lift(r.range),r.text))):e.executeEdits("formatEditsCommand",s.map(r=>fi.replaceMove(k.lift(r.range),r.text))),i&&e.pushUndoStop(),n.restoreRelativeVerticalPositionOfCursor(e)}}class AY{constructor(e){this.value=e,this._lower=e.toLowerCase()}static toKey(e){return typeof e=="string"?e.toLowerCase():e._lower}}class Uxe{constructor(e){if(this._set=new Set,e)for(const t of e)this.add(t)}add(e){this._set.add(AY.toKey(e))}has(e){return this._set.has(AY.toKey(e))}}function OY(o,e,t){const i=[],n=new Uxe,s=o.ordered(t);for(const a of s)i.push(a),a.extensionId&&n.add(a.extensionId);const r=e.ordered(t);for(const a of r){if(a.extensionId){if(n.has(a.extensionId))continue;n.add(a.extensionId)}i.push({displayName:a.displayName,extensionId:a.extensionId,provideDocumentFormattingEdits(l,c,d){return a.provideDocumentRangeFormattingEdits(l,l.getFullModelRange(),c,d)}})}return i}const MS=class MS{static setFormatterSelector(e){return{dispose:MS._selectors.unshift(e)}}static async select(e,t,i,n){if(e.length===0)return;const s=Ye.first(MS._selectors);if(s)return await s(e,t,i,n)}};MS._selectors=new Jn;let r0=MS;async function FY(o,e,t,i,n,s,r){const a=o.get(ge),{documentRangeFormattingEditProvider:l}=o.get(he),c=$l(e)?e.getModel():e,d=l.ordered(c),h=await r0.select(d,c,i,2);h&&(n.report(h),await a.invokeFunction($xe,h,e,t,s,r))}async function $xe(o,e,t,i,n,s){const r=o.get(Xs),a=o.get(Rt),l=o.get(nd);let c,d;$l(t)?(c=t.getModel(),d=new ud(t,5,void 0,n)):(c=t,d=new KO(t,n));const h=[];let u=0;for(const b of zR(i).sort(k.compareRangesUsingStarts))u>0&&k.areIntersectingOrTouching(h[u-1],b)?h[u-1]=k.fromPositions(h[u-1].getStartPosition(),b.getEndPosition()):u=h.push(b);const f=async b=>{a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,b);const C=await e.provideDocumentRangeFormattingEdits(c,b,c.getFormattingOptions(),d.token)||[];return a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,C),C},g=(b,C)=>{if(!b.length||!C.length)return!1;const w=b.reduce((v,S)=>k.plusRange(v,S.range),b[0].range);if(!C.some(v=>k.intersectRanges(w,v.range)))return!1;for(const v of b)for(const S of C)if(k.intersectRanges(v.range,S.range))return!0;return!1},m=[],_=[];try{if(typeof e.provideDocumentRangesFormattingEdits=="function"){a.trace("[format][provideDocumentRangeFormattingEdits] (request)",e.extensionId?.value,h);const b=await e.provideDocumentRangesFormattingEdits(c,h,c.getFormattingOptions(),d.token)||[];a.trace("[format][provideDocumentRangeFormattingEdits] (response)",e.extensionId?.value,b),_.push(b)}else{for(const b of h){if(d.token.isCancellationRequested)return!0;_.push(await f(b))}for(let b=0;b<h.length;++b)for(let C=b+1;C<h.length;++C){if(d.token.isCancellationRequested)return!0;if(g(_[b],_[C])){const w=k.plusRange(h[b],h[C]),v=await f(w);h.splice(C,1),h.splice(b,1),h.push(w),_.splice(C,1),_.splice(b,1),_.push(v),b=0,C=0}}}for(const b of _){if(d.token.isCancellationRequested)return!0;const C=await r.computeMoreMinimalEdits(c.uri,b);C&&m.push(...C)}if(d.token.isCancellationRequested)return!0}finally{d.dispose()}if(m.length===0)return!1;if($l(t))Ib.execute(t,m,!0),t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:b}]=m,C=new ce(b.startLineNumber,b.startColumn,b.endLineNumber,b.endColumn);c.pushEditOperations([C],m.map(w=>({text:w.text,range:k.lift(w.range),forceMoveMarkers:!0})),w=>{for(const{range:v}of w)if(k.areIntersectingOrTouching(v,C))return[new ce(v.startLineNumber,v.startColumn,v.endLineNumber,v.endColumn)];return null})}return l.playSignal(xs.format,{userGesture:s}),!0}async function jxe(o,e,t,i,n,s){const r=o.get(ge),a=o.get(he),l=$l(e)?e.getModel():e,c=OY(a.documentFormattingEditProvider,a.documentRangeFormattingEditProvider,l),d=await r0.select(c,l,t,1);d&&(i.report(d),await r.invokeFunction(qxe,d,e,t,n,s))}async function qxe(o,e,t,i,n,s){const r=o.get(Xs),a=o.get(nd);let l,c;$l(t)?(l=t.getModel(),c=new ud(t,5,void 0,n)):(l=t,c=new KO(t,n));let d;try{const h=await e.provideDocumentFormattingEdits(l,l.getFormattingOptions(),c.token);if(d=await r.computeMoreMinimalEdits(l.uri,h),c.token.isCancellationRequested)return!0}finally{c.dispose()}if(!d||d.length===0)return!1;if($l(t))Ib.execute(t,d,i!==2),i!==2&&t.revealPositionInCenterIfOutsideViewport(t.getPosition(),1);else{const[{range:h}]=d,u=new ce(h.startLineNumber,h.startColumn,h.endLineNumber,h.endColumn);l.pushEditOperations([u],d.map(f=>({text:f.text,range:k.lift(f.range),forceMoveMarkers:!0})),f=>{for(const{range:g}of f)if(k.areIntersectingOrTouching(g,u))return[new ce(g.startLineNumber,g.startColumn,g.endLineNumber,g.endColumn)];return null})}return a.playSignal(xs.format,{userGesture:s}),!0}async function Kxe(o,e,t,i,n,s){const r=e.documentRangeFormattingEditProvider.ordered(t);for(const a of r){const l=await Promise.resolve(a.provideDocumentRangeFormattingEdits(t,i,n,s)).catch(Di);if(is(l))return await o.computeMoreMinimalEdits(t.uri,l)}}async function Gxe(o,e,t,i,n){const s=OY(e.documentFormattingEditProvider,e.documentRangeFormattingEditProvider,t);for(const r of s){const a=await Promise.resolve(r.provideDocumentFormattingEdits(t,i,n)).catch(Di);if(is(a))return await o.computeMoreMinimalEdits(t.uri,a)}}function WY(o,e,t,i,n,s,r){const a=e.onTypeFormattingEditProvider.ordered(t);return a.length===0||a[0].autoFormatTriggerCharacters.indexOf(n)<0?Promise.resolve(void 0):Promise.resolve(a[0].provideOnTypeFormattingEdits(t,i,n,s,r)).catch(Di).then(l=>o.computeMoreMinimalEdits(t.uri,l))}Xe.registerCommand("_executeFormatRangeProvider",async function(o,...e){const[t,i,n]=e;it(be.isUri(t)),it(k.isIRange(i));const s=o.get(ns),r=o.get(Xs),a=o.get(he),l=await s.createModelReference(t);try{return Kxe(r,a,l.object.textEditorModel,k.lift(i),n,He.None)}finally{l.dispose()}}),Xe.registerCommand("_executeFormatDocumentProvider",async function(o,...e){const[t,i]=e;it(be.isUri(t));const n=o.get(ns),s=o.get(Xs),r=o.get(he),a=await n.createModelReference(t);try{return Gxe(s,r,a.object.textEditorModel,i,He.None)}finally{a.dispose()}}),Xe.registerCommand("_executeFormatOnTypeProvider",async function(o,...e){const[t,i,n,s]=e;it(be.isUri(t)),it(M.isIPosition(i)),it(typeof n=="string");const r=o.get(ns),a=o.get(Xs),l=o.get(he),c=await r.createModelReference(t);try{return WY(a,l,c.object.textEditorModel,M.lift(i),n,s,He.None)}finally{c.dispose()}});var BY=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},a0=function(o,e){return function(t,i){e(t,i,o)}};let GI=(EC=class{constructor(e,t,i,n){this._editor=e,this._languageFeaturesService=t,this._workerService=i,this._accessibilitySignalService=n,this._disposables=new U,this._sessionDisposables=new U,this._disposables.add(t.onTypeFormattingEditProvider.onDidChange(this._update,this)),this._disposables.add(e.onDidChangeModel(()=>this._update())),this._disposables.add(e.onDidChangeModelLanguage(()=>this._update())),this._disposables.add(e.onDidChangeConfiguration(s=>{s.hasChanged(65)&&this._update()})),this._update()}dispose(){this._disposables.dispose(),this._sessionDisposables.dispose()}_update(){if(this._sessionDisposables.clear(),!this._editor.getOption(65)||!this._editor.hasModel())return;const e=this._editor.getModel(),[t]=this._languageFeaturesService.onTypeFormattingEditProvider.ordered(e);if(!t||!t.autoFormatTriggerCharacters)return;const i=new Ky;for(const n of t.autoFormatTriggerCharacters)i.add(n.charCodeAt(0));this._sessionDisposables.add(this._editor.onDidType(n=>{const s=n.charCodeAt(n.length-1);i.has(s)&&this._trigger(String.fromCharCode(s))}))}_trigger(e){if(!this._editor.hasModel()||this._editor.getSelections().length>1||!this._editor.getSelection().isEmpty())return;const t=this._editor.getModel(),i=this._editor.getPosition(),n=new Xt,s=this._editor.onDidChangeModelContent(r=>{if(r.isFlush){n.cancel(),s.dispose();return}for(let a=0,l=r.changes.length;a<l;a++)if(r.changes[a].range.endLineNumber<=i.lineNumber){n.cancel(),s.dispose();return}});WY(this._workerService,this._languageFeaturesService,t,i,e,t.getFormattingOptions(),n.token).then(r=>{n.token.isCancellationRequested||is(r)&&(this._accessibilitySignalService.playSignal(xs.format,{userGesture:!1}),Ib.execute(this._editor,r,!0))}).finally(()=>{s.dispose()})}},EC.ID="editor.contrib.autoFormat",EC);GI=BY([a0(1,he),a0(2,Xs),a0(3,nd)],GI);let ZI=(NC=class{constructor(e,t,i){this.editor=e,this._languageFeaturesService=t,this._instantiationService=i,this._callOnDispose=new U,this._callOnModel=new U,this._callOnDispose.add(e.onDidChangeConfiguration(()=>this._update())),this._callOnDispose.add(e.onDidChangeModel(()=>this._update())),this._callOnDispose.add(e.onDidChangeModelLanguage(()=>this._update())),this._callOnDispose.add(t.documentRangeFormattingEditProvider.onDidChange(this._update,this))}dispose(){this._callOnDispose.dispose(),this._callOnModel.dispose()}_update(){this._callOnModel.clear(),this.editor.getOption(64)&&this.editor.hasModel()&&this._languageFeaturesService.documentRangeFormattingEditProvider.has(this.editor.getModel())&&this._callOnModel.add(this.editor.onDidPaste(({range:e})=>this._trigger(e)))}_trigger(e){this.editor.hasModel()&&(this.editor.getSelections().length>1||this._instantiationService.invokeFunction(FY,this.editor,e,2,Pa.None,He.None,!1).catch(Ee))}},NC.ID="editor.contrib.formatOnPaste",NC);ZI=BY([a0(1,he),a0(2,ge)],ZI);class Zxe extends le{constructor(){super({id:"editor.action.formatDocument",label:H(1009,"Format Document"),precondition:K.and(T.notInCompositeEditor,T.writable,T.hasDocumentFormattingProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:1572,linux:{primary:3111},weight:100},contextMenuOpts:{group:"1_modification",order:1.3}})}async run(e,t){if(t.hasModel()){const i=e.get(ge);await e.get(sd).showWhile(i.invokeFunction(jxe,t,1,Pa.None,He.None,!0),250)}}}class Yxe extends le{constructor(){super({id:"editor.action.formatSelection",label:H(1010,"Format Selection"),precondition:K.and(T.writable,T.hasDocumentSelectionFormattingProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2084),weight:100},contextMenuOpts:{when:T.hasNonEmptySelection,group:"1_modification",order:1.31}})}async run(e,t){if(!t.hasModel())return;const i=e.get(ge),n=t.getModel(),s=t.getSelections().map(a=>a.isEmpty()?new k(a.startLineNumber,1,a.startLineNumber,n.getLineMaxColumn(a.startLineNumber)):a);await e.get(sd).showWhile(i.invokeFunction(FY,t,s,1,Pa.None,He.None,!0),250)}}Qe(GI.ID,GI,2),Qe(ZI.ID,ZI,2),ne(Zxe),ne(Yxe),Xe.registerCommand("editor.action.format",async o=>{const e=o.get(et).getFocusedCodeEditor();if(!e||!e.hasModel())return;const t=o.get(Tt);e.getSelection().isEmpty()?await t.executeCommand("editor.action.formatDocument"):await t.executeCommand("editor.action.formatSelection")});var Xxe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},kF=function(o,e){return function(t,i){e(t,i,o)}};class Db{remove(){this.parent?.children.delete(this.id)}static findId(e,t){let i;typeof e=="string"?i=`${t.id}/${e}`:(i=`${t.id}/${e.name}`,t.children.get(i)!==void 0&&(i=`${t.id}/${e.name}_${e.range.startLineNumber}_${e.range.startColumn}`));let n=i;for(let s=0;t.children.get(n)!==void 0;s++)n=`${i}_${s}`;return n}static empty(e){return e.children.size===0}}class IF extends Db{constructor(e,t,i){super(),this.id=e,this.parent=t,this.symbol=i,this.children=new Map}}class HY extends Db{constructor(e,t,i,n){super(),this.id=e,this.parent=t,this.label=i,this.order=n,this.children=new Map}}class Id extends Db{static create(e,t,i){const n=new Xt(i),s=new Id(t.uri),r=e.ordered(t),a=r.map((c,d)=>{const h=Db.findId(`provider_${d}`,s),u=new HY(h,s,c.displayName??"Unknown Outline Provider",d);return Promise.resolve(c.provideDocumentSymbols(t,n.token)).then(f=>{for(const g of f||[])Id._makeOutlineElement(g,u);return u},f=>(Di(f),u)).then(f=>{Db.empty(f)?f.remove():s._groups.set(h,f)})}),l=e.onDidChange(()=>{const c=e.ordered(t);Ut(c,r)||n.cancel()});return Promise.all(a).then(()=>n.token.isCancellationRequested&&!i.isCancellationRequested?Id.create(e,t,i):s._compact()).finally(()=>{n.dispose(),l.dispose(),n.dispose()})}static _makeOutlineElement(e,t){const i=Db.findId(e,t),n=new IF(i,t,e);if(e.children)for(const s of e.children)Id._makeOutlineElement(s,n);t.children.set(n.id,n)}constructor(e){super(),this.uri=e,this.id="root",this.parent=void 0,this._groups=new Map,this.children=new Map,this.id="root",this.parent=void 0}_compact(){let e=0;for(const[t,i]of this._groups)i.children.size===0?this._groups.delete(t):e+=1;if(e!==1)this.children=this._groups;else{const t=Ye.first(this._groups.values());for(const[,i]of t.children)i.parent=this,this.children.set(i.id,i)}return this}getTopLevelSymbols(){const e=[];for(const t of this.children.values())t instanceof IF?e.push(t.symbol):e.push(...Ye.map(t.children.values(),i=>i.symbol));return e.sort((t,i)=>k.compareRangesUsingStarts(t.range,i.range))}asListOfDocumentSymbols(){const e=this.getTopLevelSymbols(),t=[];return Id._flattenDocumentSymbols(t,e,""),t.sort((i,n)=>M.compare(k.getStartPosition(i.range),k.getStartPosition(n.range))||M.compare(k.getEndPosition(n.range),k.getEndPosition(i.range)))}static _flattenDocumentSymbols(e,t,i){for(const n of t)e.push({kind:n.kind,tags:n.tags,name:n.name,detail:n.detail,containerName:n.containerName||i,range:n.range,selectionRange:n.selectionRange,children:void 0}),n.children&&Id._flattenDocumentSymbols(e,n.children,n.name)}}const l0=We("IOutlineModelService");let DF=class{constructor(e,t,i){this._languageFeaturesService=e,this._disposables=new U,this._cache=new dl(15,.7),this._debounceInformation=t.for(e.documentSymbolProvider,"DocumentSymbols",{min:350}),this._disposables.add(i.onModelRemoved(n=>{this._cache.delete(n.id)}))}dispose(){this._disposables.dispose()}async getOrCreate(e,t){const i=this._languageFeaturesService.documentSymbolProvider,n=i.ordered(e);let s=this._cache.get(e.id);if(!s||s.versionId!==e.getVersionId()||!Ut(s.provider,n)){const a=new Xt;s={versionId:e.getVersionId(),provider:n,promiseCnt:0,source:a,promise:Id.create(i,e,a.token),model:void 0},this._cache.set(e.id,s);const l=Date.now();s.promise.then(c=>{s.model=c,this._debounceInformation.update(e,Date.now()-l)}).catch(c=>{this._cache.delete(e.id)})}if(s.model)return s.model;s.promiseCnt+=1;const r=t.onCancellationRequested(()=>{--s.promiseCnt===0&&(s.source.cancel(),this._cache.delete(e.id))});try{return await s.promise}finally{r.dispose()}}};DF=Xxe([kF(0,he),kF(1,Or),kF(2,Qt)],DF),je(l0,DF,1),Xe.registerCommand("_executeDocumentSymbolProvider",async function(o,...e){const[t]=e;it(be.isUri(t));const i=o.get(l0),s=await o.get(ns).createModelReference(t);try{return(await i.getOrCreate(s.object.textEditorModel,He.None)).getTopLevelSymbols()}finally{s.dispose()}});const YI=new class{constructor(){this._implementations=[]}register(e){return this._implementations.push(e),{dispose:()=>{const t=this._implementations.indexOf(e);t!==-1&&this._implementations.splice(t,1)}}}getImplementations(){return this._implementations}};var Qxe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jxe=function(o,e){return function(t,i){e(t,i,o)}};function eke(o){return o instanceof VY?o._instance:o}let VY=class{constructor(e){this.instantiationService=e}init(...e){}};function tke(o){return o.get()}let zY=class extends VY{constructor(e,t){super(t),this.init(e)}};zY=Qxe([Jxe(1,ge)],zY);const Be={Visible:aF,HasFocusedSuggestion:new ae("suggestWidgetHasFocusedSuggestion",!1,p(1440,"Whether any suggestion is focused")),DetailsVisible:new ae("suggestWidgetDetailsVisible",!1,p(1441,"Whether suggestion details are visible")),MultipleSuggestions:new ae("suggestWidgetMultipleSuggestions",!1,p(1442,"Whether there are multiple suggestions to pick from")),MakesTextEdit:new ae("suggestionMakesTextEdit",!0,p(1443,"Whether inserting the current suggestion yields in a change or has everything already been typed")),AcceptSuggestionsOnEnter:new ae("acceptSuggestionOnEnter",!0,p(1444,"Whether suggestions are inserted when pressing Enter")),HasInsertAndReplaceRange:new ae("suggestionHasInsertAndReplaceRange",!1,p(1445,"Whether the current suggestion has insert and replace behaviour")),InsertMode:new ae("suggestionInsertMode",void 0,{type:"string",description:p(1446,"Whether the default behaviour is to insert or replace")}),CanResolve:new ae("suggestionCanResolve",!1,p(1447,"Whether the current suggestion supports to resolve further details"))},su=new de("suggestWidgetStatusBar");class ike{constructor(e,t,i,n){this.position=e,this.completion=t,this.container=i,this.provider=n,this.isInvalid=!1,this.score=Jr.Default,this.distance=0,this.textLabel=typeof t.label=="string"?t.label:t.label?.label,this.labelLow=this.textLabel.toLowerCase(),this.isInvalid=!this.textLabel,this.sortTextLow=t.sortText&&t.sortText.toLowerCase(),this.filterTextLow=t.filterText&&t.filterText.toLowerCase(),this.extensionId=t.extensionId,k.isIRange(t.range)?(this.editStart=new M(t.range.startLineNumber,t.range.startColumn),this.editInsertEnd=new M(t.range.endLineNumber,t.range.endColumn),this.editReplaceEnd=new M(t.range.endLineNumber,t.range.endColumn),this.isInvalid=this.isInvalid||k.spansMultipleLines(t.range)||t.range.startLineNumber!==e.lineNumber):(this.editStart=new M(t.range.insert.startLineNumber,t.range.insert.startColumn),this.editInsertEnd=new M(t.range.insert.endLineNumber,t.range.insert.endColumn),this.editReplaceEnd=new M(t.range.replace.endLineNumber,t.range.replace.endColumn),this.isInvalid=this.isInvalid||k.spansMultipleLines(t.range.insert)||k.spansMultipleLines(t.range.replace)||t.range.insert.startLineNumber!==e.lineNumber||t.range.replace.startLineNumber!==e.lineNumber||t.range.insert.startColumn!==t.range.replace.startColumn),typeof n.resolveCompletionItem!="function"&&(this._resolveCache=Promise.resolve(),this._resolveDuration=0)}get isResolved(){return this._resolveDuration!==void 0}get resolveDuration(){return this._resolveDuration!==void 0?this._resolveDuration:-1}async resolve(e){if(!this._resolveCache){const t=e.onCancellationRequested(()=>{this._resolveCache=void 0,this._resolveDuration=void 0}),i=new Ki(!0);this._resolveCache=Promise.resolve(this.provider.resolveCompletionItem(this.completion,e)).then(n=>{Object.assign(this.completion,n),this._resolveDuration=i.elapsed()},n=>{Do(n)&&(this._resolveCache=void 0,this._resolveDuration=void 0)}).finally(()=>{t.dispose()})}return this._resolveCache}}const HN=class HN{constructor(e=2,t=new Set,i=new Set,n=new Map,s=!0){this.snippetSortOrder=e,this.kindFilter=t,this.providerFilter=i,this.providerItemsToReuse=n,this.showDeprecated=s}};HN.default=new HN;let c0=HN;class nke{constructor(e,t,i,n){this.items=e,this.needsClipboard=t,this.durations=i,this.disposable=n}}async function EF(o,e,t,i=c0.default,n={triggerKind:0},s=He.None){const r=new Ki;t=t.clone();const a=e.getWordAtPosition(t),l=a?new k(t.lineNumber,a.startColumn,t.lineNumber,a.endColumn):k.fromPositions(t),c={replace:l,insert:l.setEndPosition(t.lineNumber,t.column)},d=[],h=new U,u=[];let f=!1;const g=(_,b,C)=>{let w=!1;if(!b)return w;for(const v of b.suggestions)if(!i.kindFilter.has(v.kind)){if(!i.showDeprecated&&v?.tags?.includes(1))continue;v.range||(v.range=c),v.sortText||(v.sortText=typeof v.label=="string"?v.label:v.label.label),!f&&v.insertTextRules&&v.insertTextRules&4&&(f=kg.guessNeedsClipboard(v.insertText)),d.push(new ike(t,v,b,_)),w=!0}return Xu(b)&&h.add(b),u.push({providerName:_._debugDisplayName??"unknown_provider",elapsedProvider:b.duration??-1,elapsedOverall:C.elapsed()}),w},m=(async()=>{})();for(const _ of o.orderedGroups(e)){let b=!1;if(await Promise.all(_.map(async C=>{if(i.providerItemsToReuse.has(C)){const w=i.providerItemsToReuse.get(C);w.forEach(v=>d.push(v)),b=b||w.length>0;return}if(!(i.providerFilter.size>0&&!i.providerFilter.has(C)))try{const w=new Ki,v=await C.provideCompletionItems(e,t,n,s);b=g(C,v,w)||b}catch(w){Di(w)}})),b||s.isCancellationRequested)break}return await m,s.isCancellationRequested?(h.dispose(),Promise.reject(new cr)):new nke(d.sort(rke(i.snippetSortOrder)),f,{entries:u,elapsed:r.elapsed()},h)}function NF(o,e){if(o.sortTextLow&&e.sortTextLow){if(o.sortTextLow<e.sortTextLow)return-1;if(o.sortTextLow>e.sortTextLow)return 1}return o.textLabel<e.textLabel?-1:o.textLabel>e.textLabel?1:o.completion.kind-e.completion.kind}function ske(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===28)return-1;if(e.completion.kind===28)return 1}return NF(o,e)}function oke(o,e){if(o.completion.kind!==e.completion.kind){if(o.completion.kind===28)return 1;if(e.completion.kind===28)return-1}return NF(o,e)}const XI=new Map;XI.set(0,ske),XI.set(2,oke),XI.set(1,NF);function rke(o){return XI.get(o)}Xe.registerCommand("_executeCompletionItemProvider",async(o,...e)=>{const[t,i,n,s]=e;it(be.isUri(t)),it(M.isIPosition(i)),it(typeof n=="string"||!n),it(typeof s=="number"||!s);const{completionProvider:r}=o.get(he),a=await o.get(ns).createModelReference(t);try{const l={incomplete:!1,suggestions:[]},c=[],d=a.object.textEditorModel.validatePosition(i),h=await EF(r,a.object.textEditorModel,d,void 0,{triggerCharacter:n??void 0,triggerKind:n?1:0});for(const u of h.items)c.length<(s??0)&&c.push(u.resolve(He.None)),l.incomplete=l.incomplete||u.container.incomplete,l.suggestions.push(u.completion);try{return await Promise.all(c),l}finally{setTimeout(()=>h.disposable.dispose(),100)}}finally{a.dispose()}});function ake(o,e){o.getContribution("editor.contrib.suggestController")?.triggerSuggest(new Set().add(e),void 0,!0)}class Eb{static isAllOff(e){return e.other==="off"&&e.comments==="off"&&e.strings==="off"}static isAllOn(e){return e.other==="on"&&e.comments==="on"&&e.strings==="on"}static valueFor(e,t){switch(t){case 1:return e.comments;case 2:return e.strings;default:return e.other}}}const rr=class rr{};rr.inlineSuggestionVisible=new ae("inlineSuggestionVisible",!1,p(1184,"Whether an inline suggestion is visible")),rr.inlineSuggestionHasIndentation=new ae("inlineSuggestionHasIndentation",!1,p(1185,"Whether the inline suggestion starts with whitespace")),rr.inlineSuggestionHasIndentationLessThanTabSize=new ae("inlineSuggestionHasIndentationLessThanTabSize",!0,p(1186,"Whether the inline suggestion starts with whitespace that is less than what would be inserted by tab")),rr.suppressSuggestions=new ae("inlineSuggestionSuppressSuggestions",void 0,p(1187,"Whether suggestions should be suppressed for the current suggestion")),rr.cursorBeforeGhostText=new ae("cursorBeforeGhostText",!1,p(1188,"Whether the cursor is at ghost text")),rr.cursorInIndentation=new ae("cursorInIndentation",!1,p(1189,"Whether the cursor is in indentation")),rr.hasSelection=new ae("editor.hasSelection",!1,p(1190,"Whether the editor has a selection")),rr.cursorAtInlineEdit=new ae("cursorAtInlineEdit",!1,p(1191,"Whether the cursor is at an inline edit")),rr.inlineEditVisible=new ae("inlineEditIsVisible",!1,p(1192,"Whether an inline edit is visible")),rr.tabShouldJumpToInlineEdit=new ae("tabShouldJumpToInlineEdit",!1,p(1193,"Whether tab should jump to an inline edit.")),rr.tabShouldAcceptInlineEdit=new ae("tabShouldAcceptInlineEdit",!1,p(1194,"Whether tab should accept the inline edit.")),rr.inInlineEditsPreviewEditor=new ae("inInlineEditsPreviewEditor",!0,p(1195,"Whether the current code editor is showing an inline edits preview"));let Lt=rr;const TF=We("dataChannelService");class lke{getDataChannel(e){return{sendData:()=>{}}}}var cke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},UY=function(o,e){return function(t,i){e(t,i,o)}};function dke(o){return o.sourceId+" @@ "+JSON.stringify({...o,modelUri:o.modelUri?.toString(),sourceId:void 0})}let QI=class extends A{static cast(){return this}constructor(e,t,i){super(),this._key=e,this._contextKeyService=t,this._dataChannelService=i,this._isEnabledContextKeyValue=hke("structuredLogger.enabled:"+this._key,this._contextKeyService).recomputeInitiallyAndOnChange(this._store),this.isEnabled=this._isEnabledContextKeyValue.map(n=>n!==void 0)}log(e){return this._isEnabledContextKeyValue.get()?(this._dataChannelService.getDataChannel("structuredLogger:"+this._key).sendData(e),!0):!1}};QI=cke([UY(1,xe),UY(2,TF)],QI);function hke(o,e){return rt(e.onDidChangeContext,()=>e.getContextKeyValue(o))}var uke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$Y=function(o,e){return function(t,i){e(t,i,o)}};let RF=class extends A{constructor(e,t,i){super(),this._editor=e,this._instantiationService=t,this._loggerService=i,this._structuredLogger=this._register(this._instantiationService.createInstance(QI.cast(),"editor.inlineSuggest.logChangeReason.commandId"));const n=this._loggerService?.createLogger("textModelChanges",{hidden:!1,name:"Text Model Changes Reason"}),s=rt(this,n.onDidChangeLogLevel,()=>n.getLevel());this._register(Se(r=>{OH(s.read(r),Qi.Trace)&&r.store.add(this._editor.onDidChangeModelContent(a=>{this._editor.getModel()?.uri.scheme!=="output"&&n.trace("onDidChangeModelContent: "+a.detailedReasons.map(l=>l.toKey(Number.MAX_VALUE)).join(", "))}))})),this._register(Se(r=>{this._editor instanceof sg&&this._structuredLogger.isEnabled.read(r)&&r.store.add(this._editor.onDidChangeModelContent(a=>{const l=this._editor.getModel();if(!l)return;const c=a.detailedReasons[0],d={...c.metadata,sourceId:"TextModel.setChangeReason",source:c.metadata.source,time:Date.now(),modelUri:l.uri,modelVersion:l.getVersionId()};setTimeout(()=>{this._structuredLogger.log(d)},0)}))}))}};RF=uke([$Y(1,ge),$Y(2,PH)],RF);function jY(o,e=gn){return jse(o,e)?o.charAt(0).toUpperCase()+o.slice(1):o}var fke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gke=function(o,e){return function(t,i){e(t,i,o)}};class qY{constructor(e){this._delegates=e}resolve(e){for(const t of this._delegates){const i=t.resolve(e);if(i!==void 0)return i}}}class KY{constructor(e,t,i,n){this._model=e,this._selection=t,this._selectionIdx=i,this._overtypingCapturer=n}resolve(e){const{name:t}=e;if(t==="SELECTION"||t==="TM_SELECTED_TEXT"){let i=this._model.getValueInRange(this._selection)||void 0,n=this._selection.startLineNumber!==this._selection.endLineNumber;if(!i&&this._overtypingCapturer){const s=this._overtypingCapturer.getLastOvertypedInfo(this._selectionIdx);s&&(i=s.value,n=s.multiline)}if(i&&n&&e.snippet){const s=this._model.getLineContent(this._selection.startLineNumber),r=It(s,0,this._selection.startColumn-1);let a=r;e.snippet.walk(c=>c===e?!1:(c instanceof Ts&&(a=It(ro(c.value).pop())),!0));const l=Gr(a,r);i=i.replace(/(\r\n|\r|\n)(.*)/g,(c,d,h)=>`${d}${a.substr(l)}${h}`)}return i}else{if(t==="TM_CURRENT_LINE")return this._model.getLineContent(this._selection.positionLineNumber);if(t==="TM_CURRENT_WORD"){const i=this._model.getWordAtPosition({lineNumber:this._selection.positionLineNumber,column:this._selection.positionColumn});return i&&i.word||void 0}else{if(t==="TM_LINE_INDEX")return String(this._selection.positionLineNumber-1);if(t==="TM_LINE_NUMBER")return String(this._selection.positionLineNumber);if(t==="CURSOR_INDEX")return String(this._selectionIdx);if(t==="CURSOR_NUMBER")return String(this._selectionIdx+1)}}}}class GY{constructor(e,t){this._labelService=e,this._model=t}resolve(e){const{name:t}=e;if(t==="TM_FILENAME")return nh(this._model.uri.fsPath);if(t==="TM_FILENAME_BASE"){const i=nh(this._model.uri.fsPath),n=i.lastIndexOf(".");return n<=0?i:i.slice(0,n)}else{if(t==="TM_DIRECTORY")return d6(this._model.uri.fsPath)==="."?"":this._labelService.getUriLabel(zy(this._model.uri));if(t==="TM_FILEPATH")return this._labelService.getUriLabel(this._model.uri);if(t==="RELATIVE_FILEPATH")return this._labelService.getUriLabel(this._model.uri,{relative:!0,noPrefix:!0})}}}class ZY{constructor(e,t,i,n){this._readClipboardText=e,this._selectionIdx=t,this._selectionCount=i,this._spread=n}resolve(e){if(e.name!=="CLIPBOARD")return;const t=this._readClipboardText();if(t){if(this._spread){const i=t.split(/\r\n|\n|\r/).filter(n=>!XB(n));if(i.length===this._selectionCount)return i[this._selectionIdx]}return t}}}let JI=class{constructor(e,t,i){this._model=e,this._selection=t,this._languageConfigurationService=i}resolve(e){const{name:t}=e,i=this._model.getLanguageIdAtPosition(this._selection.selectionStartLineNumber,this._selection.selectionStartColumn),n=this._languageConfigurationService.getLanguageConfiguration(i).comments;if(n){if(t==="LINE_COMMENT")return n.lineCommentToken||void 0;if(t==="BLOCK_COMMENT_START")return n.blockCommentStartToken||void 0;if(t==="BLOCK_COMMENT_END")return n.blockCommentEndToken||void 0}}};JI=fke([gke(2,Jt)],JI);const uc=class uc{constructor(){this._date=new Date}resolve(e){const{name:t}=e;if(t==="CURRENT_YEAR")return String(this._date.getFullYear());if(t==="CURRENT_YEAR_SHORT")return String(this._date.getFullYear()).slice(-2);if(t==="CURRENT_MONTH")return String(this._date.getMonth().valueOf()+1).padStart(2,"0");if(t==="CURRENT_DATE")return String(this._date.getDate().valueOf()).padStart(2,"0");if(t==="CURRENT_HOUR")return String(this._date.getHours().valueOf()).padStart(2,"0");if(t==="CURRENT_MINUTE")return String(this._date.getMinutes().valueOf()).padStart(2,"0");if(t==="CURRENT_SECOND")return String(this._date.getSeconds().valueOf()).padStart(2,"0");if(t==="CURRENT_DAY_NAME")return uc.dayNames[this._date.getDay()];if(t==="CURRENT_DAY_NAME_SHORT")return uc.dayNamesShort[this._date.getDay()];if(t==="CURRENT_MONTH_NAME")return uc.monthNames[this._date.getMonth()];if(t==="CURRENT_MONTH_NAME_SHORT")return uc.monthNamesShort[this._date.getMonth()];if(t==="CURRENT_SECONDS_UNIX")return String(Math.floor(this._date.getTime()/1e3));if(t==="CURRENT_TIMEZONE_OFFSET"){const i=this._date.getTimezoneOffset(),n=i>0?"-":"+",s=Math.trunc(Math.abs(i/60)),r=s<10?"0"+s:s,a=Math.abs(i)-s*60,l=a<10?"0"+a:a;return n+r+":"+l}}};uc.dayNames=[p(1391,"Sunday"),p(1392,"Monday"),p(1393,"Tuesday"),p(1394,"Wednesday"),p(1395,"Thursday"),p(1396,"Friday"),p(1397,"Saturday")],uc.dayNamesShort=[p(1398,"Sun"),p(1399,"Mon"),p(1400,"Tue"),p(1401,"Wed"),p(1402,"Thu"),p(1403,"Fri"),p(1404,"Sat")],uc.monthNames=[p(1405,"January"),p(1406,"February"),p(1407,"March"),p(1408,"April"),p(1409,"May"),p(1410,"June"),p(1411,"July"),p(1412,"August"),p(1413,"September"),p(1414,"October"),p(1415,"November"),p(1416,"December")],uc.monthNamesShort=[p(1417,"Jan"),p(1418,"Feb"),p(1419,"Mar"),p(1420,"Apr"),p(1421,"May"),p(1422,"Jun"),p(1423,"Jul"),p(1424,"Aug"),p(1425,"Sep"),p(1426,"Oct"),p(1427,"Nov"),p(1428,"Dec")];let eD=uc;class YY{constructor(e){this._workspaceService=e}resolve(e){if(!this._workspaceService)return;const t=Yve(this._workspaceService.getWorkspace());if(!Gve(t)){if(e.name==="WORKSPACE_NAME")return this._resolveWorkspaceName(t);if(e.name==="WORKSPACE_FOLDER")return this._resoveWorkspacePath(t)}}_resolveWorkspaceName(e){if(QO(e))return nh(e.uri.path);let t=nh(e.configPath.path);return t.endsWith(JO)&&(t=t.substr(0,t.length-JO.length-1)),t}_resoveWorkspacePath(e){if(QO(e))return jY(e.uri.fsPath);const t=nh(e.configPath.path);let i=e.configPath.fsPath;return i.endsWith(t)&&(i=i.substr(0,i.length-t.length-1)),i?jY(i):"/"}}class XY{resolve(e){const{name:t}=e;if(t==="RANDOM")return Math.random().toString().slice(-6);if(t==="RANDOM_HEX")return Math.random().toString(16).slice(-6);if(t==="UUID")return Of()}}var pke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mke=function(o,e){return function(t,i){e(t,i,o)}},Ga;const ga=class ga{constructor(e,t,i){this._editor=e,this._snippet=t,this._snippetLineLeadingWhitespace=i,this._offset=-1,this._nestingLevel=1,this._placeholderGroups=k6(t.placeholders,Ar.compareByIndex),this._placeholderGroupsIdx=-1}initialize(e){this._offset=e.newPosition}dispose(){this._placeholderDecorations&&this._editor.removeDecorations([...this._placeholderDecorations.values()]),this._placeholderGroups.length=0}_initDecorations(){if(this._offset===-1)throw new Error("Snippet not initialized!");if(this._placeholderDecorations)return;this._placeholderDecorations=new Map;const e=this._editor.getModel();this._editor.changeDecorations(t=>{for(const i of this._snippet.placeholders){const n=this._snippet.offset(i),s=this._snippet.fullLen(i),r=k.fromPositions(e.getPositionAt(this._offset+n),e.getPositionAt(this._offset+n+s)),a=i.isFinalTabstop?ga._decor.inactiveFinal:ga._decor.inactive,l=t.addDecoration(r,a);this._placeholderDecorations.set(i,l)}})}move(e){if(!this._editor.hasModel())return[];if(this._initDecorations(),this._placeholderGroupsIdx>=0){const n=[];for(const s of this._placeholderGroups[this._placeholderGroupsIdx])if(s.transform){const r=this._placeholderDecorations.get(s),a=this._editor.getModel().getDecorationRange(r),l=this._editor.getModel().getValueInRange(a),c=s.transform.resolve(l).split(/\r\n|\r|\n/);for(let d=1;d<c.length;d++)c[d]=this._editor.getModel().normalizeIndentation(this._snippetLineLeadingWhitespace+c[d]);n.push(fi.replace(a,c.join(this._editor.getModel().getEOL())))}n.length>0&&this._editor.executeEdits("snippet.placeholderTransform",n)}let t=!1;e===!0&&this._placeholderGroupsIdx<this._placeholderGroups.length-1?(this._placeholderGroupsIdx+=1,t=!0):e===!1&&this._placeholderGroupsIdx>0&&(this._placeholderGroupsIdx-=1,t=!0);const i=this._editor.getModel().changeDecorations(n=>{const s=new Set,r=[];for(const a of this._placeholderGroups[this._placeholderGroupsIdx]){const l=this._placeholderDecorations.get(a),c=this._editor.getModel().getDecorationRange(l);r.push(new ce(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn)),t=t&&this._hasPlaceholderBeenCollapsed(a),n.changeDecorationOptions(l,a.isFinalTabstop?ga._decor.activeFinal:ga._decor.active),s.add(a);for(const d of this._snippet.enclosingPlaceholders(a)){const h=this._placeholderDecorations.get(d);n.changeDecorationOptions(h,d.isFinalTabstop?ga._decor.activeFinal:ga._decor.active),s.add(d)}}for(const[a,l]of this._placeholderDecorations)s.has(a)||n.changeDecorationOptions(l,a.isFinalTabstop?ga._decor.inactiveFinal:ga._decor.inactive);return r});return t?this.move(e):i??[]}_hasPlaceholderBeenCollapsed(e){let t=e;for(;t;){if(t instanceof Ar){const i=this._placeholderDecorations.get(t);if(this._editor.getModel().getDecorationRange(i).isEmpty()&&t.toString().length>0)return!0}t=t.parent}return!1}get isAtFirstPlaceholder(){return this._placeholderGroupsIdx<=0||this._placeholderGroups.length===0}get isAtLastPlaceholder(){return this._placeholderGroupsIdx===this._placeholderGroups.length-1}get hasPlaceholder(){return this._snippet.placeholders.length>0}get isTrivialSnippet(){if(this._snippet.placeholders.length===0)return!0;if(this._snippet.placeholders.length===1){const[e]=this._snippet.placeholders;if(e.isFinalTabstop&&this._snippet.rightMostDescendant===e)return!0}return!1}computePossibleSelections(){const e=new Map;for(const t of this._placeholderGroups){let i;for(const n of t){if(n.isFinalTabstop)break;i||(i=[],e.set(n.index,i));const s=this._placeholderDecorations.get(n),r=this._editor.getModel().getDecorationRange(s);if(!r){e.delete(n.index);break}i.push(r)}}return e}get activeChoice(){if(!this._placeholderDecorations)return;const e=this._placeholderGroups[this._placeholderGroupsIdx][0];if(!e?.choice)return;const t=this._placeholderDecorations.get(e);if(!t)return;const i=this._editor.getModel().getDecorationRange(t);if(i)return{range:i,choice:e.choice}}get hasChoice(){let e=!1;return this._snippet.walk(t=>(e=t instanceof ib,!e)),e}merge(e){const t=this._editor.getModel();this._nestingLevel*=10,this._editor.changeDecorations(i=>{for(const n of this._placeholderGroups[this._placeholderGroupsIdx]){const s=e.shift();console.assert(s._offset!==-1),console.assert(!s._placeholderDecorations);const r=s._snippet.placeholderInfo.last.index;for(const l of s._snippet.placeholderInfo.all)l.isFinalTabstop?l.index=n.index+(r+1)/this._nestingLevel:l.index=n.index+l.index/this._nestingLevel;this._snippet.replace(n,s._snippet.children);const a=this._placeholderDecorations.get(n);i.removeDecoration(a),this._placeholderDecorations.delete(n);for(const l of s._snippet.placeholders){const c=s._snippet.offset(l),d=s._snippet.fullLen(l),h=k.fromPositions(t.getPositionAt(s._offset+c),t.getPositionAt(s._offset+c+d)),u=i.addDecoration(h,ga._decor.inactive);this._placeholderDecorations.set(l,u)}}this._placeholderGroups=k6(this._snippet.placeholders,Ar.compareByIndex)})}};ga._decor={active:Te.register({description:"snippet-placeholder-1",stickiness:0,className:"snippet-placeholder"}),inactive:Te.register({description:"snippet-placeholder-2",stickiness:1,className:"snippet-placeholder"}),activeFinal:Te.register({description:"snippet-placeholder-3",stickiness:1,className:"finish-snippet-placeholder"}),inactiveFinal:Te.register({description:"snippet-placeholder-4",stickiness:1,className:"finish-snippet-placeholder"})};let tD=ga;const QY={overwriteBefore:0,overwriteAfter:0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let iD=Ga=class{static adjustWhitespace(e,t,i,n,s){const r=e.getLineContent(t.lineNumber),a=It(r,0,t.column-1);let l;return n.walk(c=>{if(!(c instanceof Ts)||c.parent instanceof ib||s&&!s.has(c))return!0;const d=c.value.split(/\r\n|\r|\n/);if(i){const u=n.offset(c);if(u===0)d[0]=e.normalizeIndentation(d[0]);else{l=l??n.toString();const f=l.charCodeAt(u-1);(f===10||f===13)&&(d[0]=e.normalizeIndentation(a+d[0]))}for(let f=1;f<d.length;f++)d[f]=e.normalizeIndentation(a+d[f])}const h=d.join(e.getEOL());return h!==c.value&&(c.parent.replace(c,[new Ts(h)]),l=void 0),!0}),a}static adjustSelection(e,t,i,n){if(i!==0||n!==0){const{positionLineNumber:s,positionColumn:r}=t,a=r-i,l=r+n,c=e.validateRange({startLineNumber:s,startColumn:a,endLineNumber:s,endColumn:l});t=ce.createWithDirection(c.startLineNumber,c.startColumn,c.endLineNumber,c.endColumn,t.getDirection())}return t}static createEditsAndSnippetsFromSelections(e,t,i,n,s,r,a,l,c){const d=[],h=[];if(!e.hasModel())return{edits:d,snippets:h};const u=e.getModel(),f=e.invokeWithinContext(v=>v.get(pd)),g=e.invokeWithinContext(v=>new GY(v.get(zg),u)),m=()=>a,_=u.getValueInRange(Ga.adjustSelection(u,e.getSelection(),i,0)),b=u.getValueInRange(Ga.adjustSelection(u,e.getSelection(),0,n)),C=u.getLineFirstNonWhitespaceColumn(e.getSelection().positionLineNumber),w=e.getSelections().map((v,S)=>({selection:v,idx:S})).sort((v,S)=>k.compareRangesUsingStarts(v.selection,S.selection));for(const{selection:v,idx:S}of w){let L=Ga.adjustSelection(u,v,i,0),x=Ga.adjustSelection(u,v,0,n);_!==u.getValueInRange(L)&&(L=v),b!==u.getValueInRange(x)&&(x=v);const I=v.setStartPosition(L.startLineNumber,L.startColumn).setEndPosition(x.endLineNumber,x.endColumn),D=new kg().parse(t,!0,s),R=I.getStartPosition(),F=Ga.adjustWhitespace(u,R,r||S>0&&C!==u.getLineFirstNonWhitespaceColumn(v.positionLineNumber),D);D.resolveVariables(new qY([g,new ZY(m,S,w.length,e.getOption(88)==="spread"),new KY(u,v,S,l),new JI(u,v,c),new eD,new YY(f),new XY])),d[S]=fi.replace(I,D.toString()),d[S].identifier={major:S,minor:0},d[S]._isTracked=!0,h[S]=new tD(e,D,F)}return{edits:d,snippets:h}}static createEditsAndSnippetsFromEdits(e,t,i,n,s,r,a){if(!e.hasModel()||t.length===0)return{edits:[],snippets:[]};const l=[],c=e.getModel(),d=new kg,h=new kw,u=new qY([e.invokeWithinContext(g=>new GY(g.get(zg),c)),new ZY(()=>s,0,e.getSelections().length,e.getOption(88)==="spread"),new KY(c,e.getSelection(),0,r),new JI(c,e.getSelection(),a),new eD,new YY(e.invokeWithinContext(g=>g.get(pd))),new XY]);t=t.sort((g,m)=>k.compareRangesUsingStarts(g.range,m.range));let f=0;for(let g=0;g<t.length;g++){const{range:m,template:_,keepWhitespace:b}=t[g];if(g>0){const L=t[g-1].range,x=k.fromPositions(L.getEndPosition(),m.getStartPosition()),I=new Ts(c.getValueInRange(x));h.appendChild(I),f+=I.value.length}const C=d.parseFragment(_,h);Ga.adjustWhitespace(c,m.getStartPosition(),b!==void 0?!b:n,h,new Set(C)),h.resolveVariables(u);const w=h.toString(),v=w.slice(f);f=w.length;const S=fi.replace(m,v);S.identifier={major:g,minor:0},S._isTracked=!0,l.push(S)}return d.ensureFinalTabstop(h,i,!0),{edits:l,snippets:[new tD(e,h,"")]}}constructor(e,t,i=QY,n){this._editor=e,this._template=t,this._options=i,this._languageConfigurationService=n,this._templateMerges=[],this._snippets=[]}dispose(){pt(this._snippets)}_logInfo(){return`template="${this._template}", merged_templates="${this._templateMerges.join(" -> ")}"`}insert(e){if(!this._editor.hasModel())return;const{edits:t,snippets:i}=typeof this._template=="string"?Ga.createEditsAndSnippetsFromSelections(this._editor,this._template,this._options.overwriteBefore,this._options.overwriteAfter,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService):Ga.createEditsAndSnippetsFromEdits(this._editor,this._template,!1,this._options.adjustWhitespace,this._options.clipboardText,this._options.overtypingCapturer,this._languageConfigurationService);this._snippets=i,this._editor.executeEdits(e??jn.snippet(),t,n=>{const s=n.filter(r=>!!r.identifier);for(let r=0;r<i.length;r++)i[r].initialize(s[r].textChange);return this._snippets[0].hasPlaceholder?this._move(!0):s.map(r=>ce.fromPositions(r.range.getEndPosition()))}),this._editor.revealRange(this._editor.getSelections()[0])}merge(e,t=QY){if(!this._editor.hasModel())return;this._templateMerges.push([this._snippets[0]._nestingLevel,this._snippets[0]._placeholderGroupsIdx,e]);const{edits:i,snippets:n}=Ga.createEditsAndSnippetsFromSelections(this._editor,e,t.overwriteBefore,t.overwriteAfter,!0,t.adjustWhitespace,t.clipboardText,t.overtypingCapturer,this._languageConfigurationService);this._editor.executeEdits("snippet",i,s=>{const r=s.filter(l=>!!l.identifier);for(let l=0;l<n.length;l++)n[l].initialize(r[l].textChange);const a=n[0].isTrivialSnippet;if(!a){for(const l of this._snippets)l.merge(n);console.assert(n.length===0)}return this._snippets[0].hasPlaceholder&&!a?this._move(void 0):r.map(l=>ce.fromPositions(l.range.getEndPosition()))})}next(){const e=this._move(!0);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}prev(){const e=this._move(!1);this._editor.setSelections(e),this._editor.revealPositionInCenterIfOutsideViewport(e[0].getPosition())}_move(e){const t=[];for(const i of this._snippets){const n=i.move(e);t.push(...n)}return t}get isAtFirstPlaceholder(){return this._snippets[0].isAtFirstPlaceholder}get isAtLastPlaceholder(){return this._snippets[0].isAtLastPlaceholder}get hasPlaceholder(){return this._snippets[0].hasPlaceholder}get hasChoice(){return this._snippets[0].hasChoice}get activeChoice(){return this._snippets[0].activeChoice}isSelectionWithinPlaceholders(){if(!this.hasPlaceholder)return!1;const e=this._editor.getSelections();if(e.length<this._snippets.length)return!1;const t=new Map;for(const i of this._snippets){const n=i.computePossibleSelections();if(t.size===0)for(const[s,r]of n){r.sort(k.compareRangesUsingStarts);for(const a of e)if(r[0].containsRange(a)){t.set(s,[]);break}}if(t.size===0)return!1;t.forEach((s,r)=>{s.push(...n.get(r))})}e.sort(k.compareRangesUsingStarts);for(const[i,n]of t){if(n.length!==e.length){t.delete(i);continue}n.sort(k.compareRangesUsingStarts);for(let s=0;s<n.length;s++)if(!n[s].containsRange(e[s])){t.delete(i);continue}}return t.size>0}};iD=Ga=pke([mke(3,Jt)],iD);var _ke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nD=function(o,e){return function(t,i){e(t,i,o)}},Nb;const JY={overwriteBefore:0,overwriteAfter:0,undoStopBefore:!0,undoStopAfter:!0,adjustWhitespace:!0,clipboardText:void 0,overtypingCapturer:void 0};let hs=(fc=class{static get(e){return e.getContribution(Nb.ID)}constructor(e,t,i,n,s){this._editor=e,this._logService=t,this._languageFeaturesService=i,this._languageConfigurationService=s,this._inSnippetObservable=Le(this,!1),this._snippetListener=new U,this._modelVersionId=-1,this._inSnippet=Nb.InSnippetMode.bindTo(n),this._hasNextTabstop=Nb.HasNextTabstop.bindTo(n),this._hasPrevTabstop=Nb.HasPrevTabstop.bindTo(n)}dispose(){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._session?.dispose(),this._snippetListener.dispose()}insert(e,t){try{this._doInsert(e,typeof t>"u"?JY:{...JY,...t})}catch(i){this.cancel(),this._logService.error(i),this._logService.error("snippet_error"),this._logService.error("insert_template=",e),this._logService.error("existing_template=",this._session?this._session._logInfo():"<no_session>")}}_doInsert(e,t){if(this._editor.hasModel()){if(this._snippetListener.clear(),t.undoStopBefore&&this._editor.getModel().pushStackElement(),this._session&&typeof e!="string"&&this.cancel(),this._session?(it(typeof e=="string"),this._session.merge(e,t)):(this._modelVersionId=this._editor.getModel().getAlternativeVersionId(),this._session=new iD(this._editor,e,t,this._languageConfigurationService),this._session.insert(t.reason)),t.undoStopAfter&&this._editor.getModel().pushStackElement(),this._session?.hasChoice){const i={_debugDisplayName:"snippetChoiceCompletions",provideCompletionItems:(c,d)=>{if(!this._session||c!==this._editor.getModel()||!M.equals(this._editor.getPosition(),d))return;const{activeChoice:h}=this._session;if(!h||h.choice.options.length===0)return;const u=c.getValueInRange(h.range),f=!!h.choice.options.find(m=>m.value===u),g=[];for(let m=0;m<h.choice.options.length;m++){const _=h.choice.options[m];g.push({kind:13,label:_.value,insertText:_.value,sortText:"a".repeat(m+1),range:h.range,filterText:f?`${u}_${_.value}`:void 0,command:{id:"jumpToNextSnippetPlaceholder",title:p(1390,"Go to next placeholder...")}})}return{suggestions:g}}},n=this._editor.getModel();let s,r=!1;const a=()=>{s?.dispose(),r=!1},l=()=>{r||(s=this._languageFeaturesService.completionProvider.register({language:n.getLanguageId(),pattern:n.uri.fsPath,scheme:n.uri.scheme,exclusive:!0},i),this._snippetListener.add(s),r=!0)};this._choiceCompletions={provider:i,enable:l,disable:a}}this._updateState(),this._snippetListener.add(this._editor.onDidChangeModelContent(i=>i.isFlush&&this.cancel())),this._snippetListener.add(this._editor.onDidChangeModel(()=>this.cancel())),this._snippetListener.add(this._editor.onDidChangeCursorSelection(()=>this._updateState()))}}_updateState(){if(!(!this._session||!this._editor.hasModel())){if(this._modelVersionId===this._editor.getModel().getAlternativeVersionId())return this.cancel();if(!this._session.hasPlaceholder)return this.cancel();if(this._session.isAtLastPlaceholder||!this._session.isSelectionWithinPlaceholders())return this._editor.getModel().pushStackElement(),this.cancel();this._inSnippet.set(!0),this._inSnippetObservable.set(!0,void 0),this._hasPrevTabstop.set(!this._session.isAtFirstPlaceholder),this._hasNextTabstop.set(!this._session.isAtLastPlaceholder),this._handleChoice()}}_handleChoice(){if(!this._session||!this._editor.hasModel()){this._currentChoice=void 0;return}const{activeChoice:e}=this._session;if(!e||!this._choiceCompletions){this._choiceCompletions?.disable(),this._currentChoice=void 0;return}this._currentChoice!==e.choice&&(this._currentChoice=e.choice,this._choiceCompletions.enable(),queueMicrotask(()=>{ake(this._editor,this._choiceCompletions.provider)}))}finish(){for(;this._inSnippet.get();)this.next()}cancel(e=!1){this._inSnippet.reset(),this._inSnippetObservable.set(!1,void 0),this._hasPrevTabstop.reset(),this._hasNextTabstop.reset(),this._snippetListener.clear(),this._currentChoice=void 0,this._session?.dispose(),this._session=void 0,this._modelVersionId=-1,e&&this._editor.setSelections([this._editor.getSelection()])}prev(){this._session?.prev(),this._updateState()}next(){this._session?.next(),this._updateState()}isInSnippet(){return!!this._inSnippet.get()}get isInSnippetObservable(){return this._inSnippetObservable}},Nb=fc,fc.ID="snippetController2",fc.InSnippetMode=new ae("inSnippetMode",!1,p(1387,"Whether the editor in current in snippet mode")),fc.HasNextTabstop=new ae("hasNextTabstop",!1,p(1388,"Whether there is a next tab stop when in snippet mode")),fc.HasPrevTabstop=new ae("hasPrevTabstop",!1,p(1389,"Whether there is a previous tab stop when in snippet mode")),fc);hs=Nb=_ke([nD(1,Rt),nD(2,he),nD(3,xe),nD(4,Jt)],hs),Qe(hs.ID,hs,4);const sD=Bi.bindToContribution(hs.get);re(new sD({id:"jumpToNextSnippetPlaceholder",precondition:K.and(hs.InSnippetMode,hs.HasNextTabstop),handler:o=>o.next(),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:2}})),re(new sD({id:"jumpToPrevSnippetPlaceholder",precondition:K.and(hs.InSnippetMode,hs.HasPrevTabstop),handler:o=>o.prev(),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:1026}})),re(new sD({id:"leaveSnippet",precondition:hs.InSnippetMode,handler:o=>o.cancel(!0),kbOpts:{weight:130,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}})),re(new sD({id:"acceptSnippet",precondition:hs.InSnippetMode,handler:o=>o.finish()}));function d0(o){return new bke(o)}class bke extends SU{constructor(e){super(),this._textModel=e}getOffset(e){return this._textModel.getOffsetAt(e)}getPosition(e){return this._textModel.getPositionAt(e)}}const Cke=[];function vke(){return Cke}function eX(o){return wke(o).map(t=>t.getEndPosition())}function wke(o){const e=Cy.createSortPermutation(o,kn(n=>n.range,k.compareRangesUsingStarts)),i=new mo(e.apply(o)).getNewRanges();return e.inverse().apply(i)}function Ske(o,e){const t=d0(e),i=e.getValue();return o.map(r=>t.getStringReplacement(r)).map(r=>r.removeCommonSuffixPrefix(i)).map(r=>t.getTextReplacement(r))}function yke(o,e){const t=Le("result",[]),i=[];return e.add(Se(n=>{const s=o.read(n);Dt(r=>{if(s.length!==i.length){i.length=s.length;for(let a=0;a<i.length;a++)i[a]||(i[a]=Le("item",s[a]));t.set([...i],r)}i.forEach((a,l)=>a.set(s[l],r))})})),t}class Lke{constructor(e){this._contextKeyService=e}bind(e,t){return El(e,this._contextKeyService,t instanceof Function?t:i=>t.read(i))}}function tX(o,e){return new Promise(t=>{let i;const n=setTimeout(()=>{i&&i.dispose(),t()},o);e&&(i=e.onCancellationRequested(()=>{clearTimeout(n),i&&i.dispose(),t()}))})}class xke{constructor(e,t,i,n=kke){this.startValue=e,this.endValue=t,this.durationMs=i,this._interpolationFunction=n,this.startTimeMs=Date.now(),e===t&&(this.durationMs=0)}isFinished(){return Date.now()>=this.startTimeMs+this.durationMs}getValue(){const e=Date.now()-this.startTimeMs;return e>=this.durationMs?this.endValue:this._interpolationFunction(e,this.startValue,this.endValue-this.startValue,this.durationMs)}}function kke(o,e,t,i){return o===i?e+t:t*(-Math.pow(2,-10*o/i)+1)+e}function Ike(o,e,t,i){return t*((o=o/i-1)*o*o+1)+e}class Dke{constructor(e){this._value=Le(this,e)}getValue(e){const t=this._value.read(e);return t.isFinished()||oD.instance.invalidateOnNextAnimationFrame(e),t.getValue()}}const VN=class VN{constructor(){this._counter=_r(this),this._isScheduled=!1}invalidateOnNextAnimationFrame(e){this._counter.read(e),this._isScheduled||(this._isScheduled=!0,ft().requestAnimationFrame(()=>{this._isScheduled=!1,this._update()}))}_update(){this._counter.trigger(void 0)}};VN.instance=new VN;let oD=VN;class h0{constructor(e,t){this.lineNumber=e,this.parts=t,Xd(()=>XC(t,(i,n)=>i.column<=n.column))}equals(e){return this.lineNumber===e.lineNumber&&this.parts.length===e.parts.length&&this.parts.every((t,i)=>t.equals(e.parts[i]))}renderForScreenReader(e){if(this.parts.length===0)return"";const t=this.parts[this.parts.length-1],i=e.substr(0,t.column-1);return new mo([...this.parts.map(s=>new Oi(k.fromPositions(new M(1,s.column)),s.lines.map(r=>r.line).join(`
`)))]).applyToString(i).substring(this.parts[0].column-1)}isEmpty(){return this.parts.every(e=>e.lines.length===0)}get lineCount(){return 1+this.parts.reduce((e,t)=>e+t.lines.length-1,0)}}class rD{constructor(e,t,i,n=[]){this.column=e,this.text=t,this.preview=i,this._inlineDecorations=n,this.lines=ro(this.text).map((s,r)=>({line:s,lineDecorations:os.filter(this._inlineDecorations,r+1,1,s.length+1)}))}equals(e){return this.column===e.column&&this.lines.length===e.lines.length&&this.lines.every((t,i)=>t.line===e.lines[i].line&&os.equalsArr(t.lineDecorations,e.lines[i].lineDecorations))}}class MF{constructor(e,t,i,n=0){this.lineNumber=e,this.columnRange=t,this.text=i,this.additionalReservedLineCount=n,this.parts=[new rD(this.columnRange.endColumnExclusive,this.text,!1)],this.newLines=ro(this.text)}renderForScreenReader(e){return this.newLines.join(`
`)}get lineCount(){return this.newLines.length}isEmpty(){return this.parts.every(e=>e.lines.length===0)}equals(e){return this.lineNumber===e.lineNumber&&this.columnRange.equals(e.columnRange)&&this.newLines.length===e.newLines.length&&this.newLines.every((t,i)=>t===e.newLines[i])&&this.additionalReservedLineCount===e.additionalReservedLineCount}}function iX(o,e){return Ut(o,e,nX)}function nX(o,e){return o===e?!0:!o||!e?!1:o instanceof h0&&e instanceof h0||o instanceof MF&&e instanceof MF?o.equals(e):!1}function Dd(o,e,t){const i=t?o.range.intersectRanges(t):o.range;if(!i)return o;const n=o.text.replaceAll(`\r
`,`
`),s=e.getValueInRange(i,1),r=Gr(s,n),a=$i.ofText(s.substring(0,r)).addToPosition(o.range.getStartPosition()),l=n.substring(r),c=k.fromPositions(a,o.range.getEndPosition());return new Oi(c,l)}function sX(o,e){return o.text.startsWith(e.text)&&Eke(o.range,e.range)}function Eke(o,e){return e.getStartPosition().equals(o.getStartPosition())&&e.getEndPosition().isBeforeOrEqual(o.getEndPosition())}function oX(o,e,t,i,n=0){let s=Dd(o,e);if(s.range.endLineNumber!==s.range.startLineNumber)return;const r=e.getLineContent(s.range.startLineNumber),a=It(r).length;if(s.range.startColumn-1<=a){const g=It(s.text).length,m=r.substring(s.range.startColumn-1,a),[_,b]=[s.range.getStartPosition(),s.range.getEndPosition()],C=_.column+m.length<=b.column?_.delta(0,m.length):b,w=k.fromPositions(C,b),v=s.text.startsWith(m)?s.text.substring(m.length):s.text.substring(g);s=new Oi(w,v)}const c=e.getValueInRange(s.range),d=Nke(c,s.text);if(!d)return;const h=s.range.startLineNumber,u=new Array;if(t==="prefix"){const g=d.filter(m=>m.originalLength===0);if(g.length>1||g.length===1&&g[0].originalStart!==c.length)return}const f=s.text.length-n;for(const g of d){const m=s.range.startColumn+g.originalStart+g.originalLength;if(t==="subwordSmart"&&i&&i.lineNumber===s.range.startLineNumber&&m<i.column||g.originalLength>0)return;if(g.modifiedLength===0)continue;const _=g.modifiedStart+g.modifiedLength,b=Math.max(g.modifiedStart,Math.min(_,f)),C=s.text.substring(g.modifiedStart,b),w=s.text.substring(b,Math.max(g.modifiedStart,_));C.length>0&&u.push(new rD(m,C,!1)),w.length>0&&u.push(new rD(m,w,!0))}return new h0(h,u)}let aD;function Nke(o,e){if(aD?.originalValue===o&&aD?.newValue===e)return aD?.changes;{let t=aX(o,e,!0);if(t){const i=rX(t);if(i>0){const n=aX(o,e,!1);n&&rX(n)<i&&(t=n)}}return aD={originalValue:o,newValue:e,changes:t},t}}function rX(o){let e=0;for(const t of o)e+=t.originalLength;return e}function aX(o,e,t){if(o.length>5e3||e.length>5e3)return;function i(c){let d=0;for(let h=0,u=c.length;h<u;h++){const f=c.charCodeAt(h);f>d&&(d=f)}return d}const n=Math.max(i(o),i(e));function s(c){if(c<0)throw new Error("unexpected");return n+c+1}function r(c){let d=0,h=0;const u=new Int32Array(c.length);for(let f=0,g=c.length;f<g;f++)if(t&&c[f]==="("){const m=h*100+d;u[f]=s(2*m),d++}else if(t&&c[f]===")"){d=Math.max(d-1,0);const m=h*100+d;u[f]=s(2*m+1),d===0&&h++}else u[f]=c.charCodeAt(f);return u}const a=r(o),l=r(e);return new jl({getElements:()=>a},{getElements:()=>l}).ComputeDiff(!1).changes}function Tke(o,e){let t,i=!1;const n=new F6(new xn(o,void 0,e.update),(s,r)=>{i||(t=e.initial instanceof Function?e.initial():e.initial,i=!0);const a=e.update(s,t,r);return t=a,a},e.changeTracker,()=>{i&&(e.disposeFinal?.(t),i=!1)},e.equalityComparer??Ro,(s,r,a)=>{if(!i)throw new Ce("Can only set when there is a listener! This is to prevent leaks.");lf(r,l=>{t=s,n.setValue(s,l,a)})},Gi.ofCaller());return n}var Rke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},lX=function(o,e){return function(t,i){e(t,i,o)}};class Mke{constructor(e,t){this._baseService=e,this._intercept=t}publicLog2(e,t){this._intercept(e,t),this._baseService.publicLog2(e,t)}}let PF=class extends Mke{constructor(e,t){super(e,(i,n)=>{let s=!0;n&&AF in n&&(s=!!n[AF]),s&&t.getDataChannel("editTelemetry").sendData({eventName:i,data:n})})}};PF=Rke([lX(0,Vn),lX(1,TF)],PF);const AF=Symbol("shouldForwardToChannel");function Pke(o){return{[AF]:o}}function Ake(o){if(!o)return!1;const e=o.toLowerCase();return e==="github.copilot"||e==="github.copilot-chat"}function Oke(o){const e=o.map(i=>new Cn(pe.ofStartAndLength(i.rangeOffset,i.rangeLength),i.text));return e.reverse(),new qc(e)}function Fke(o,e){o.publicLog2("inlineCompletion.endOfLife",e)}const Wke=3;class Bke{computeDiff(e,t,i){const s=new zke(e,t,{maxComputationTime:i.maxComputationTimeMs,shouldIgnoreTrimWhitespace:i.ignoreTrimWhitespace,shouldComputeCharChanges:!0,shouldMakePrettyDiff:!0,shouldPostProcessCharChanges:!0}).computeDiff(),r=[];let a=null;for(const l of s.changes){let c;l.originalEndLineNumber===0?c=new ke(l.originalStartLineNumber+1,l.originalStartLineNumber+1):c=new ke(l.originalStartLineNumber,l.originalEndLineNumber+1);let d;l.modifiedEndLineNumber===0?d=new ke(l.modifiedStartLineNumber+1,l.modifiedStartLineNumber+1):d=new ke(l.modifiedStartLineNumber,l.modifiedEndLineNumber+1);let h=new qo(c,d,l.charChanges?.map(u=>new Is(new k(u.originalStartLineNumber,u.originalStartColumn,u.originalEndLineNumber,u.originalEndColumn),new k(u.modifiedStartLineNumber,u.modifiedStartColumn,u.modifiedEndLineNumber,u.modifiedEndColumn))));a&&(a.modified.endLineNumberExclusive===h.modified.startLineNumber||a.original.endLineNumberExclusive===h.original.startLineNumber)&&(h=new qo(a.original.join(h.original),a.modified.join(h.modified),a.innerChanges&&h.innerChanges?a.innerChanges.concat(h.innerChanges):void 0),r.pop()),r.push(h),a=h}return Xd(()=>XC(r,(l,c)=>c.original.startLineNumber-l.original.endLineNumberExclusive===c.modified.startLineNumber-l.modified.endLineNumberExclusive&&l.original.endLineNumberExclusive<c.original.startLineNumber&&l.modified.endLineNumberExclusive<c.modified.startLineNumber)),new ik(r,[],s.quitEarly)}}function cX(o,e,t,i){return new jl(o,e,t).ComputeDiff(i)}class dX{constructor(e){const t=[],i=[];for(let n=0,s=e.length;n<s;n++)t[n]=OF(e[n],1),i[n]=FF(e[n],1);this.lines=e,this._startColumns=t,this._endColumns=i}getElements(){const e=[];for(let t=0,i=this.lines.length;t<i;t++)e[t]=this.lines[t].substring(this._startColumns[t]-1,this._endColumns[t]-1);return e}getStrictElement(e){return this.lines[e]}getStartLineNumber(e){return e+1}getEndLineNumber(e){return e+1}createCharSequence(e,t,i){const n=[],s=[],r=[];let a=0;for(let l=t;l<=i;l++){const c=this.lines[l],d=e?this._startColumns[l]:1,h=e?this._endColumns[l]:c.length+1;for(let u=d;u<h;u++)n[a]=c.charCodeAt(u-1),s[a]=l+1,r[a]=u,a++;!e&&l<i&&(n[a]=10,s[a]=l+1,r[a]=c.length+1,a++)}return new Hke(n,s,r)}}class Hke{constructor(e,t,i){this._charCodes=e,this._lineNumbers=t,this._columns=i}toString(){return"["+this._charCodes.map((e,t)=>(e===10?"\\n":String.fromCharCode(e))+`-(${this._lineNumbers[t]},${this._columns[t]})`).join(", ")+"]"}_assertIndex(e,t){if(e<0||e>=t.length)throw new Error("Illegal index")}getElements(){return this._charCodes}getStartLineNumber(e){return e>0&&e===this._lineNumbers.length?this.getEndLineNumber(e-1):(this._assertIndex(e,this._lineNumbers),this._lineNumbers[e])}getEndLineNumber(e){return e===-1?this.getStartLineNumber(e+1):(this._assertIndex(e,this._lineNumbers),this._charCodes[e]===10?this._lineNumbers[e]+1:this._lineNumbers[e])}getStartColumn(e){return e>0&&e===this._columns.length?this.getEndColumn(e-1):(this._assertIndex(e,this._columns),this._columns[e])}getEndColumn(e){return e===-1?this.getStartColumn(e+1):(this._assertIndex(e,this._columns),this._charCodes[e]===10?1:this._columns[e]+1)}}class Tb{constructor(e,t,i,n,s,r,a,l){this.originalStartLineNumber=e,this.originalStartColumn=t,this.originalEndLineNumber=i,this.originalEndColumn=n,this.modifiedStartLineNumber=s,this.modifiedStartColumn=r,this.modifiedEndLineNumber=a,this.modifiedEndColumn=l}static createFromDiffChange(e,t,i){const n=t.getStartLineNumber(e.originalStart),s=t.getStartColumn(e.originalStart),r=t.getEndLineNumber(e.originalStart+e.originalLength-1),a=t.getEndColumn(e.originalStart+e.originalLength-1),l=i.getStartLineNumber(e.modifiedStart),c=i.getStartColumn(e.modifiedStart),d=i.getEndLineNumber(e.modifiedStart+e.modifiedLength-1),h=i.getEndColumn(e.modifiedStart+e.modifiedLength-1);return new Tb(n,s,r,a,l,c,d,h)}}function Vke(o){if(o.length<=1)return o;const e=[o[0]];let t=e[0];for(let i=1,n=o.length;i<n;i++){const s=o[i],r=s.originalStart-(t.originalStart+t.originalLength),a=s.modifiedStart-(t.modifiedStart+t.modifiedLength);Math.min(r,a)<Wke?(t.originalLength=s.originalStart+s.originalLength-t.originalStart,t.modifiedLength=s.modifiedStart+s.modifiedLength-t.modifiedStart):(e.push(s),t=s)}return e}class u0{constructor(e,t,i,n,s){this.originalStartLineNumber=e,this.originalEndLineNumber=t,this.modifiedStartLineNumber=i,this.modifiedEndLineNumber=n,this.charChanges=s}static createFromDiffResult(e,t,i,n,s,r,a){let l,c,d,h,u;if(t.originalLength===0?(l=i.getStartLineNumber(t.originalStart)-1,c=0):(l=i.getStartLineNumber(t.originalStart),c=i.getEndLineNumber(t.originalStart+t.originalLength-1)),t.modifiedLength===0?(d=n.getStartLineNumber(t.modifiedStart)-1,h=0):(d=n.getStartLineNumber(t.modifiedStart),h=n.getEndLineNumber(t.modifiedStart+t.modifiedLength-1)),r&&t.originalLength>0&&t.originalLength<20&&t.modifiedLength>0&&t.modifiedLength<20&&s()){const f=i.createCharSequence(e,t.originalStart,t.originalStart+t.originalLength-1),g=n.createCharSequence(e,t.modifiedStart,t.modifiedStart+t.modifiedLength-1);if(f.getElements().length>0&&g.getElements().length>0){let m=cX(f,g,s,!0).changes;a&&(m=Vke(m)),u=[];for(let _=0,b=m.length;_<b;_++)u.push(Tb.createFromDiffChange(m[_],f,g))}}return new u0(l,c,d,h,u)}}class zke{constructor(e,t,i){this.shouldComputeCharChanges=i.shouldComputeCharChanges,this.shouldPostProcessCharChanges=i.shouldPostProcessCharChanges,this.shouldIgnoreTrimWhitespace=i.shouldIgnoreTrimWhitespace,this.shouldMakePrettyDiff=i.shouldMakePrettyDiff,this.originalLines=e,this.modifiedLines=t,this.original=new dX(e),this.modified=new dX(t),this.continueLineDiff=hX(i.maxComputationTime),this.continueCharDiff=hX(i.maxComputationTime===0?0:Math.min(i.maxComputationTime,5e3))}computeDiff(){if(this.original.lines.length===1&&this.original.lines[0].length===0)return this.modified.lines.length===1&&this.modified.lines[0].length===0?{quitEarly:!1,changes:[]}:{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:1,modifiedStartLineNumber:1,modifiedEndLineNumber:this.modified.lines.length,charChanges:void 0}]};if(this.modified.lines.length===1&&this.modified.lines[0].length===0)return{quitEarly:!1,changes:[{originalStartLineNumber:1,originalEndLineNumber:this.original.lines.length,modifiedStartLineNumber:1,modifiedEndLineNumber:1,charChanges:void 0}]};const e=cX(this.original,this.modified,this.continueLineDiff,this.shouldMakePrettyDiff),t=e.changes,i=e.quitEarly;if(this.shouldIgnoreTrimWhitespace){const a=[];for(let l=0,c=t.length;l<c;l++)a.push(u0.createFromDiffResult(this.shouldIgnoreTrimWhitespace,t[l],this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges));return{quitEarly:i,changes:a}}const n=[];let s=0,r=0;for(let a=-1,l=t.length;a<l;a++){const c=a+1<l?t[a+1]:null,d=c?c.originalStart:this.originalLines.length,h=c?c.modifiedStart:this.modifiedLines.length;for(;s<d&&r<h;){const u=this.originalLines[s],f=this.modifiedLines[r];if(u!==f){{let g=OF(u,1),m=OF(f,1);for(;g>1&&m>1;){const _=u.charCodeAt(g-2),b=f.charCodeAt(m-2);if(_!==b)break;g--,m--}(g>1||m>1)&&this._pushTrimWhitespaceCharChange(n,s+1,1,g,r+1,1,m)}{let g=FF(u,1),m=FF(f,1);const _=u.length+1,b=f.length+1;for(;g<_&&m<b;){const C=u.charCodeAt(g-1),w=u.charCodeAt(m-1);if(C!==w)break;g++,m++}(g<_||m<b)&&this._pushTrimWhitespaceCharChange(n,s+1,g,_,r+1,m,b)}}s++,r++}c&&(n.push(u0.createFromDiffResult(this.shouldIgnoreTrimWhitespace,c,this.original,this.modified,this.continueCharDiff,this.shouldComputeCharChanges,this.shouldPostProcessCharChanges)),s+=c.originalLength,r+=c.modifiedLength)}return{quitEarly:i,changes:n}}_pushTrimWhitespaceCharChange(e,t,i,n,s,r,a){if(this._mergeTrimWhitespaceCharChange(e,t,i,n,s,r,a))return;let l;this.shouldComputeCharChanges&&(l=[new Tb(t,i,t,n,s,r,s,a)]),e.push(new u0(t,t,s,s,l))}_mergeTrimWhitespaceCharChange(e,t,i,n,s,r,a){const l=e.length;if(l===0)return!1;const c=e[l-1];return c.originalEndLineNumber===0||c.modifiedEndLineNumber===0?!1:c.originalEndLineNumber===t&&c.modifiedEndLineNumber===s?(this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new Tb(t,i,t,n,s,r,s,a)),!0):c.originalEndLineNumber+1===t&&c.modifiedEndLineNumber+1===s?(c.originalEndLineNumber=t,c.modifiedEndLineNumber=s,this.shouldComputeCharChanges&&c.charChanges&&c.charChanges.push(new Tb(t,i,t,n,s,r,s,a)),!0):!1}}function OF(o,e){const t=es(o);return t===-1?e:t+1}function FF(o,e){const t=Kr(o);return t===-1?e:t+2}function hX(o){if(o===0)return()=>!0;const e=Date.now();return()=>Date.now()-e<o}const WF={getLegacy:()=>new Bke,getDefault:()=>new n1e};var BF;(function(o){function e(t,i){return t.isInlineEdit?p0.create(t,i):g0.create(t,i)}o.create=e})(BF||(BF={}));class uX{constructor(e,t,i){this._data=e,this.identity=t,this.displayLocation=i}get source(){return this._data.source}get isFromExplicitRequest(){return this._data.context.triggerKind===js.Explicit}get forwardStable(){return this.source.inlineSuggestions.enableForwardStability??!1}get editRange(){return this.getSingleTextEdit().range}get targetRange(){return this.displayLocation?.range??this.editRange}get insertText(){return this.getSingleTextEdit().text}get semanticId(){return this.hash}get action(){return this._sourceInlineCompletion.action}get command(){return this._sourceInlineCompletion.command}get warning(){return this._sourceInlineCompletion.warning}get showInlineEditMenu(){return!!this._sourceInlineCompletion.showInlineEditMenu}get hash(){return JSON.stringify([this.getSingleTextEdit().text,this.getSingleTextEdit().range.getStartPosition().toString()])}get requestUuid(){return this._data.context.requestUuid}get partialAccepts(){return this._data.partialAccepts}get _sourceInlineCompletion(){return this._data.sourceInlineCompletion}addRef(){this.identity.addRef(),this.source.addRef()}removeRef(){this.identity.removeRef(),this.source.removeRef()}reportInlineEditShown(e,t,i){this._data.reportInlineEditShown(e,this.insertText,t,i)}reportPartialAccept(e,t,i){this._data.reportPartialAccept(e,t,i)}reportEndOfLife(e){this._data.reportEndOfLife(e)}setEndOfLifeReason(e){this._data.setEndOfLifeReason(e)}reportInlineEditError(e){this._data.reportInlineEditError(e)}setIsPreceeded(e){this._data.setIsPreceeded(e.partialAccepts)}setNotShownReasonIfNotSet(e){this._data.setNotShownReason(e)}getSourceCompletion(){return this._sourceInlineCompletion}}const zN=class zN{constructor(){this._onDispose=_r(this),this._refCount=1,this.id="InlineCompletionIdentity"+zN.idCounter++}addRef(){this._refCount++}removeRef(){this._refCount--,this._refCount===0&&this._onDispose.trigger(void 0)}};zN.idCounter=0;let lD=zN;class f0{static create(e){return new f0(e.range,e.label,e.kind)}constructor(e,t,i){this.range=e,this.label=t,this.kind=i}withEdit(e,t){const i=new pe(t.getOffset(this.range.getStartPosition()),t.getOffset(this.range.getEndPosition())),n=wU([i],e)[0];if(!n)return;const s=t.getRange(n);return new f0(s,this.label,this.kind)}}class g0 extends uX{static create(e,t){const i=new lD,n=d0(t),s=e.insertText.replace(/\r\n|\r|\n/g,t.getEOL()),r=$ke(new Cn(n.getOffsetRange(e.range),s),t),a=r.removeCommonSuffixAndPrefix(t.getValue()),l=n.getTextReplacement(r),c=e.displayLocation?f0.create(e.displayLocation):void 0;return new g0(r,a,l,l.range,e.snippetInfo,e.additionalTextEdits,e,i,c)}constructor(e,t,i,n,s,r,a,l,c){super(a,l,c),this._edit=e,this._trimmedEdit=t,this._textEdit=i,this._originalRange=n,this.snippetInfo=s,this.additionalTextEdits=r,this.isInlineEdit=!1}get hash(){return JSON.stringify(this._trimmedEdit.toJson())}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new g0(this._edit,this._trimmedEdit,this._textEdit,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,e,this.displayLocation)}withEdit(e,t){const i=wU([this._edit.replaceRange],e);if(i.length===0)return;const n=new Cn(i[0],this._textEdit.text),s=d0(t),r=s.getTextReplacement(n);let a=this.displayLocation;if(a&&(a=a.withEdit(e,s),!a))return;const l=n.removeCommonSuffixAndPrefix(t.getValue());return new g0(n,l,r,this._originalRange,this.snippetInfo,this.additionalTextEdits,this._data,this.identity,a)}canBeReused(e,t){const i=this._textEdit.range;return!!i&&i.containsPosition(t)&&this.isVisible(e,t)&&$i.ofRange(i).isGreaterThanOrEqualTo($i.ofRange(this._originalRange))}isVisible(e,t){const i=this.getSingleTextEdit();return fX(i,this._originalRange,e,t)}}function fX(o,e,t,i){const n=Dd(o,t),s=o.range;if(!s||e&&!e.getStartPosition().equals(s.getStartPosition())||i.lineNumber!==n.range.startLineNumber||n.isEmpty)return!1;const r=t.getValueInRange(n.range,1),a=n.text,l=Math.max(0,i.column-n.range.startColumn);let c=a.substring(0,l),d=a.substring(l),h=r.substring(0,l),u=r.substring(l);const f=t.getLineIndentColumn(n.range.startLineNumber);return n.range.startColumn<=f&&(h=h.trimStart(),h.length===0&&(u=u.trimStart()),c=c.trimStart(),c.length===0&&(d=d.trimStart())),c.startsWith(h)&&!!tj(u,d)}class p0 extends uX{static create(e,t){const i=Uke(t,e.range,e.insertText),n=new wg(t),r=mo.fromStringEdit(i,n).toReplacement(n),a=new lD,l=i.replacements.map(d=>{const h=k.fromPositions(t.getPositionAt(d.replaceRange.start),t.getPositionAt(d.replaceRange.endExclusive)),u=t.getValueInRange(h);return cD.create(d,u)}),c=e.displayLocation?f0.create(e.displayLocation):void 0;return new p0(i,r,e,a,l,c,!1,t.getVersionId())}constructor(e,t,i,n,s,r,a=!1,l){super(i,n,r),this._edit=e,this._textEdit=t,this._edits=s,this._lastChangePartOfInlineEdit=a,this._inlineEditModelVersion=l,this.snippetInfo=void 0,this.additionalTextEdits=[],this.isInlineEdit=!0}get updatedEditModelVersion(){return this._inlineEditModelVersion}get updatedEdit(){return this._edit}getSingleTextEdit(){return this._textEdit}withIdentity(e){return new p0(this._edit,this._textEdit,this._data,e,this._edits,this.displayLocation,this._lastChangePartOfInlineEdit,this._inlineEditModelVersion)}canBeReused(e,t){return this._lastChangePartOfInlineEdit&&this.updatedEditModelVersion===e.getVersionId()}withEdit(e,t){return this._applyTextModelChanges(e,this._edits,t)}_applyTextModelChanges(e,t,i){if(t=t.map(h=>h.applyTextModelChanges(e)),t.some(h=>h.edit===void 0))return;const n=i.getVersionId();let s=this._inlineEditModelVersion;const r=t.some(h=>h.lastChangeUpdatedEdit);if(r&&(s=n??-1),n===null||s+20<n||(t=t.filter(h=>!h.edit.isEmpty),t.length===0))return;const a=new qc(t.map(h=>h.edit)),l=d0(i),c=l.getTextEdit(a).toReplacement(new wg(i));let d=this.displayLocation;if(!(d&&(d=d.withEdit(e,l),!d)))return new p0(a,c,this._data,this.identity,t,d,r,s)}}function Uke(o,e,t){const i=o.getEOL(),n=o.getValueInRange(e),s=t.replace(/\r\n|\r|\n/g,i),l=WF.getDefault().computeDiff(ro(n),ro(s),{ignoreTrimWhitespace:!1,computeMoves:!1,extendToSubwords:!0,maxComputationTimeMs:500}).changes.flatMap(u=>u.innerChanges??[]);function c(u,f){const g=$i.fromPosition(f.getStartPosition());return $i.ofRange(f).createRange(g.addToPosition(u))}const d=new kh(s);return new qc(l.map(u=>{const f=c(e.getStartPosition(),u.originalRange),g=d0(o).getOffsetRange(f),m=d.getValueOfRange(u.modifiedRange),_=new Cn(g,m),b=o.getValueInRange(f);return jke(_,b,l.length,o)}))}class cD{static create(e,t){const i=Gr(e.newText,t),n=Lc(e.newText,t),s=e.newText.substring(i,e.newText.length-n);return new cD(e,s,i,n)}get edit(){return this._edit}get lastChangeUpdatedEdit(){return this._lastChangeUpdatedEdit}constructor(e,t,i,n,s=!1){this._edit=e,this._trimmedNewText=t,this._prefixLength=i,this._suffixLength=n,this._lastChangeUpdatedEdit=s}applyTextModelChanges(e){const t=this._clone();return t._applyTextModelChanges(e),t}_clone(){return new cD(this._edit,this._trimmedNewText,this._prefixLength,this._suffixLength,this._lastChangeUpdatedEdit)}_applyTextModelChanges(e){if(this._lastChangeUpdatedEdit=!1,!this._edit)throw new Ce("UpdatedInnerEdits: No edit to apply changes to");const t=this._applyChanges(this._edit,e);if(!t){this._edit=void 0;return}this._edit=t.edit,this._lastChangeUpdatedEdit=t.editHasChanged}_applyChanges(e,t){let i=e.replaceRange.start,n=e.replaceRange.endExclusive,s=e.newText,r=!1;const a=this._prefixLength>0||this._suffixLength>0;for(let l=t.replacements.length-1;l>=0;l--){const c=t.replacements[l],d=c.newText.length>0&&c.replaceRange.isEmpty;if(d&&!a&&c.replaceRange.start===i&&s.startsWith(c.newText)){i+=c.newText.length,s=s.substring(c.newText.length),n=Math.max(i,n),r=!0;continue}if(d&&a&&c.replaceRange.start===i+this._prefixLength&&this._trimmedNewText.startsWith(c.newText)){n+=c.newText.length,r=!0,this._prefixLength+=c.newText.length,this._trimmedNewText=this._trimmedNewText.substring(c.newText.length);continue}if(c.newText.length===0&&c.replaceRange.length>0&&c.replaceRange.start>=i+this._prefixLength&&c.replaceRange.endExclusive<=n-this._suffixLength){n-=c.replaceRange.length,r=!0;continue}if(c.equals(e)){r=!0,i=c.replaceRange.endExclusive,s="";continue}if(!(c.replaceRange.start>n)){if(c.replaceRange.endExclusive<i){i+=c.newText.length-c.replaceRange.length,n+=c.newText.length-c.replaceRange.length;continue}return}}return this._trimmedNewText.length===0&&i+this._prefixLength===n-this._suffixLength?{edit:new Cn(new pe(i+this._prefixLength,i+this._prefixLength),""),editHasChanged:!0}:{edit:new Cn(new pe(i,n),s),editHasChanged:r}}}function $ke(o,e){const t=e.getEOL();return o.replaceRange.isEmpty&&o.newText.includes(t)&&(o=gX(o,e)),o}function jke(o,e,t,i){const n=i.getEOL();if(o.newText.endsWith(n)&&e.endsWith(n)&&(o=new Cn(o.replaceRange.deltaEnd(-n.length),o.newText.slice(0,-n.length))),t===1&&o.replaceRange.isEmpty&&o.newText.includes(n)){const s=i.getPositionAt(o.replaceRange.start);i.getLineLength(s.lineNumber)!==0&&(o=gX(o,i))}if(t===1){const s=Gr(e,o.newText),r=Lc(e.slice(s),o.newText.slice(s));if(s+r===e.length)return new Cn(o.replaceRange.deltaStart(s).deltaEnd(-r),o.newText.substring(s,o.newText.length-r));if(s+r===o.newText.length)return new Cn(o.replaceRange.deltaStart(s).deltaEnd(-r),"")}return o}function gX(o,e){if(!o.replaceRange.isEmpty)throw new Ce("Unexpected original range");if(o.replaceRange.start===0)return o;const t=e.getEOL(),i=e.getPositionAt(o.replaceRange.start),n=i.column,s=i.lineNumber;return n===1&&s>1&&o.newText.endsWith(t)&&!o.newText.startsWith(t)?new Cn(o.replaceRange.delta(-1),t+o.newText.slice(0,-t.length)):o}function qke(o,e){const t=new AU,i=new FU(t,c=>e.getLanguageConfiguration(c)),n=new OU(new Kke([o]),i),s=kP(n,[],void 0,!0);let r="";const a=o.getLineContent();function l(c,d){if(c.kind===2)if(l(c.openingBracket,d),d=ui(d,c.openingBracket.length),c.child&&(l(c.child,d),d=ui(d,c.child.length)),c.closingBracket)l(c.closingBracket,d),d=ui(d,c.closingBracket.length);else{const u=i.getSingleLanguageBracketTokens(c.openingBracket.languageId).findClosingTokenText(c.openingBracket.bracketIds);r+=u}else if(c.kind!==3){if(c.kind===0||c.kind===1)r+=a.substring(d,ui(d,c.length));else if(c.kind===4)for(const h of c.children)l(h,d),d=ui(d,h.length)}}return l(s,ys),r}class Kke{constructor(e){this.lines=e,this.tokenization={getLineTokens:t=>this.lines[t-1]}}getLineCount(){return this.lines.length}getLineLength(e){return this.lines[e-1].getLineContent().length}}class HF{constructor(){this._nodes=new Set,this._outgoingEdges=new Map}static from(e,t){const i=new HF;for(const n of e)i._nodes.add(n);for(const n of e){const s=t(n);if(s.length>0){const r=new Set;for(const a of s)r.add(a);i._outgoingEdges.set(n,r)}}return i}removeCycles(){const e=[],t=new Set,i=new Set,n=[],s=r=>{t.add(r),i.add(r);const a=this._outgoingEdges.get(r);if(a)for(const l of a)t.has(l)?i.has(l)&&(e.push(l),n.push({from:r,to:l})):s(l);i.delete(r)};for(const r of this._nodes)t.has(r)||s(r);for(const{from:r,to:a}of n){const l=this._outgoingEdges.get(r);l&&l.delete(a)}return{foundCycles:e}}getOutgoing(e){const t=this._outgoingEdges.get(e);return t?Array.from(t):[]}}var Xn;(function(o){o.Jump="jump",o.Accept="accept",o.Inactive="inactive"})(Xn||(Xn={}));var xt;(function(o){o.GhostText="ghostText",o.Custom="custom",o.SideBySide="sideBySide",o.Deletion="deletion",o.InsertionInline="insertionInline",o.InsertionMultiLine="insertionMultiLine",o.WordReplacements="wordReplacements",o.LineReplacement="lineReplacement",o.Collapsed="collapsed"})(xt||(xt={}));function Gke(o,e,t,i,n,s){const r=Lz("icr"),a=new Xt;let l;const c={...i,requestUuid:r},d=Qke(e,t),h=Qge(o,b=>b.groupId),u=HF.from(o,b=>b.yieldsToGroupIds?.flatMap(C=>h.get(C)??[])??[]),{foundCycles:f}=u.removeCycles();f.length>0&&Di(new Error(`Inline completions: cyclic yield-to dependency detected. Path: ${f.map(b=>b.toString?b.toString():""+b).join(" -> ")}`));let g=0;const m=new gR(async b=>{try{if(g++,a.token.isCancellationRequested)return;const C=u.getOutgoing(b);for(const I of C){const D=await m.get(I);if(D)for(const R of D.inlineSuggestions.items){if(R.isInlineEdit||typeof R.insertText!="string")return;const F=new Oi(k.lift(R.range)??d,R.insertText);if(fX(F,void 0,t,e))return}}let w;const v=Date.now();try{w=await b.provideInlineCompletions(t,e,c,a.token)}catch(I){Di(I);return}const S=Date.now();if(!w)return;const L=[],x=new Xke(w,L,b);if(x.addRef(),pX(a.token,()=>x.removeRef(l)),a.token.isCancellationRequested)return;for(const I of w.items)L.push(Zke(I,x,d,t,s,c,n,{startTime:v,endTime:S}));return x}finally{g--}}),_=gr.fromPromisesResolveOrder(o.map(b=>m.get(b))).filter(sn);return{contextWithUuid:c,get didAllProvidersReturn(){return g===0},lists:_,cancelAndDispose:b=>{l===void 0&&(l=b,a.dispose(!0))}}}function pX(o,e){if(o.isCancellationRequested)return e(),A.None;{const t=o.onCancellationRequested(()=>{t.dispose(),e()});return{dispose:()=>t.dispose()}}}function Zke(o,e,t,i,n,s,r,a){let l,c,d=o.range?k.lift(o.range):t;if(typeof o.insertText=="string"){if(l=o.insertText,n&&o.completeBracketPairs){l=mX(l,d.getStartPosition(),i,n);const u=l.length-o.insertText.length;u!==0&&(d=new k(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+u))}c=void 0}else if("snippet"in o.insertText){const u=o.insertText.snippet.length;if(n&&o.completeBracketPairs){o.insertText.snippet=mX(o.insertText.snippet,d.getStartPosition(),i,n);const g=o.insertText.snippet.length-u;g!==0&&(d=new k(d.startLineNumber,d.startColumn,d.endLineNumber,d.endColumn+g))}const f=new kg().parse(o.insertText.snippet);f.children.length===1&&f.children[0]instanceof Ts?(l=f.children[0].value,c=void 0):(l=f.toString(),c={snippet:o.insertText.snippet,range:d})}else ZC(o.insertText);const h=o.displayLocation?{range:k.lift(o.displayLocation.range),label:o.displayLocation.label,kind:o.displayLocation.kind}:void 0;return new Yke(d,l,c,h,o.additionalTextEdits||vke(),o,e,s,o.isInlineEdit??!1,r,a,o.correlationId)}class Yke{constructor(e,t,i,n,s,r,a,l,c,d,h,u){this.range=e,this.insertText=t,this.snippetInfo=i,this.displayLocation=n,this.additionalTextEdits=s,this.sourceInlineCompletion=r,this.source=a,this.context=l,this.isInlineEdit=c,this._requestInfo=d,this._providerRequestInfo=h,this._correlationId=u,this._didShow=!1,this._timeUntilShown=void 0,this._showStartTime=void 0,this._shownDuration=0,this._showUncollapsedStartTime=void 0,this._showUncollapsedDuration=0,this._notShownReason=void 0,this._didReportEndOfLife=!1,this._lastSetEndOfLifeReason=void 0,this._isPreceeded=!1,this._partiallyAcceptedCount=0,this._partiallyAcceptedSinceOriginal={characters:0,ratio:0,count:0},this._viewData={editorType:d.editorType}}get showInlineEditMenu(){return this.sourceInlineCompletion.showInlineEditMenu??!1}get partialAccepts(){return this._partiallyAcceptedSinceOriginal}async reportInlineEditShown(e,t,i,n){if(this.updateShownDuration(i),this._didShow)return;this._didShow=!0,this._viewData.viewKind=i,this._viewData.renderData=n,this._timeUntilShown=Date.now()-this._requestInfo.startTime;const s=new kv(n.lineCountModified,n.lineCountOriginal,n.characterCountModified,n.characterCountOriginal);this.source.provider.handleItemDidShow?.(this.source.inlineSuggestions,this.sourceInlineCompletion,t,s),this.sourceInlineCompletion.shownCommand&&await e.executeCommand(this.sourceInlineCompletion.shownCommand.id,...this.sourceInlineCompletion.shownCommand.arguments||[])}reportPartialAccept(e,t,i){this._partiallyAcceptedCount++,this._partiallyAcceptedSinceOriginal.characters+=i.characters,this._partiallyAcceptedSinceOriginal.ratio=Math.min(this._partiallyAcceptedSinceOriginal.ratio+(1-this._partiallyAcceptedSinceOriginal.ratio)*i.ratio,1),this._partiallyAcceptedSinceOriginal.count+=i.count,this.source.provider.handlePartialAccept?.(this.source.inlineSuggestions,this.sourceInlineCompletion,e,t)}reportEndOfLife(e){if(!this._didReportEndOfLife&&(this._didReportEndOfLife=!0,this.reportInlineEditHidden(),e||(e=this._lastSetEndOfLifeReason??{kind:Bf.Ignored,userTypingDisagreed:!1,supersededBy:void 0}),e.kind===Bf.Rejected&&this.source.provider.handleRejection&&this.source.provider.handleRejection(this.source.inlineSuggestions,this.sourceInlineCompletion),this.source.provider.handleEndOfLifetime)){const t={requestUuid:this.context.requestUuid,correlationId:this._correlationId,selectedSuggestionInfo:!!this.context.selectedSuggestionInfo,partiallyAccepted:this._partiallyAcceptedCount,partiallyAcceptedCountSinceOriginal:this._partiallyAcceptedSinceOriginal.count,partiallyAcceptedRatioSinceOriginal:this._partiallyAcceptedSinceOriginal.ratio,partiallyAcceptedCharactersSinceOriginal:this._partiallyAcceptedSinceOriginal.characters,shown:this._didShow,shownDuration:this._shownDuration,shownDurationUncollapsed:this._showUncollapsedDuration,preceeded:this._isPreceeded,timeUntilShown:this._timeUntilShown,timeUntilProviderRequest:this._providerRequestInfo.startTime-this._requestInfo.startTime,timeUntilProviderResponse:this._providerRequestInfo.endTime-this._requestInfo.startTime,editorType:this._viewData.editorType,languageId:this._requestInfo.languageId,requestReason:this._requestInfo.reason,viewKind:this._viewData.viewKind,notShownReason:this._notShownReason,error:this._viewData.error,typingInterval:this._requestInfo.typingInterval,typingIntervalCharacterCount:this._requestInfo.typingIntervalCharacterCount,availableProviders:this._requestInfo.availableProviders.map(i=>i.toString()).join(","),...this._viewData.renderData};this.source.provider.handleEndOfLifetime(this.source.inlineSuggestions,this.sourceInlineCompletion,e,t)}}reportInlineEditError(e){this._viewData.error?this._viewData.error+=`; ${e}`:this._viewData.error=e}setIsPreceeded(e){this._isPreceeded=!0,(this._partiallyAcceptedSinceOriginal.characters!==0||this._partiallyAcceptedSinceOriginal.ratio!==0||this._partiallyAcceptedSinceOriginal.count!==0)&&console.warn("Expected partiallyAcceptedCountSinceOriginal to be { characters: 0, rate: 0, partialAcceptances: 0 } before setIsPreceeded."),this._partiallyAcceptedSinceOriginal=e}setNotShownReason(e){this._notShownReason??=e}setEndOfLifeReason(e){this.reportInlineEditHidden(),this._lastSetEndOfLifeReason=e}updateShownDuration(e){const t=Date.now();this._showStartTime||(this._showStartTime=t);const i=e===xt.Collapsed;!i&&this._showUncollapsedStartTime===void 0&&(this._showUncollapsedStartTime=t),i&&this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=t-this._showUncollapsedStartTime)}reportInlineEditHidden(){if(this._showStartTime===void 0)return;const e=Date.now();this._shownDuration+=e-this._showStartTime,this._showStartTime=void 0,this._showUncollapsedStartTime!==void 0&&(this._showUncollapsedDuration+=e-this._showUncollapsedStartTime,this._showUncollapsedStartTime=void 0)}}var m0;(function(o){o.TextEditor="textEditor",o.DiffEditor="diffEditor",o.Notebook="notebook"})(m0||(m0={}));class Xke{constructor(e,t,i){this.inlineSuggestions=e,this.inlineSuggestionsData=t,this.provider=i,this.refCount=0}addRef(){this.refCount++}removeRef(e={kind:"other"}){if(this.refCount--,this.refCount===0){for(const t of this.inlineSuggestionsData)t.reportEndOfLife();this.provider.disposeInlineCompletions(this.inlineSuggestions,e)}}}function Qke(o,e){const t=e.getWordAtPosition(o),i=e.getLineMaxColumn(o.lineNumber);return t?new k(o.lineNumber,t.startColumn,o.lineNumber,i):k.fromPositions(o,o.with(void 0,i))}function mX(o,e,t,i){const n=t.getLineContent(e.lineNumber),s=Cn.replace(new pe(e.column-1,n.length),o),a=t.tokenization.tokenizeLinesAt(e.lineNumber,[s.replace(n)])?.[0].sliceZeroCopy(s.getRangeAfterReplace());return a?qke(a,i):o}var Jke=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dD=function(o,e){return function(t,i){e(t,i,o)}},VF;let zF=(Xp=class extends A{constructor(e,t,i,n,s,r,a,l){super(),this._textModel=e,this._versionId=t,this._debounceValue=i,this._cursorPosition=n,this._languageConfigurationService=s,this._logService=r,this._configurationService=a,this._instantiationService=l,this._updateOperation=this._register(new ct),this._state=Tke(this,{initial:()=>({inlineCompletions:la.createEmpty(),suggestWidgetInlineCompletions:la.createEmpty()}),disposeFinal:c=>{c.inlineCompletions.dispose(),c.suggestWidgetInlineCompletions.dispose()},changeTracker:One(()=>({versionId:this._versionId})),update:(c,d,h)=>{const u=qc.compose(h.changes.map(f=>f.change?Oke(f.change.changes):qc.empty).filter(sn));if(u.isEmpty())return d;try{return{inlineCompletions:d.inlineCompletions.createStateWithAppliedEdit(u,this._textModel),suggestWidgetInlineCompletions:d.suggestWidgetInlineCompletions.createStateWithAppliedEdit(u,this._textModel)}}finally{d.inlineCompletions.dispose(),d.suggestWidgetInlineCompletions.dispose()}}}),this.inlineCompletions=this._state.map(this,c=>c.inlineCompletions),this.suggestWidgetInlineCompletions=this._state.map(this,c=>c.suggestWidgetInlineCompletions),this.clearOperationOnTextModelChange=j(this,c=>{this._versionId.read(c),this._updateOperation.clear()}),this._loadingCount=Le(this,0),this._loggingEnabled=Y$("editor.inlineSuggest.logFetch",!1,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._sendRequestData=Y$("editor.inlineSuggest.emptyResponseInformation",!0,this._configurationService).recomputeInitiallyAndOnChange(this._store),this._structuredFetchLogger=this._register(this._instantiationService.createInstance(QI.cast(),"editor.inlineSuggest.logFetch.commandId")),this.clearOperationOnTextModelChange.recomputeInitiallyAndOnChange(this._store)}_log(e){this._loggingEnabled.get()&&this._logService.info(dke(e)),this._structuredFetchLogger.log(e)}fetch(e,t,i,n,s,r,a){const l=this._cursorPosition.get(),c=new eIe(l,i,this._textModel.getVersionId(),new Set(e)),d=i.selectedSuggestionInfo?this.suggestWidgetInlineCompletions.get():this.inlineCompletions.get();if(this._updateOperation.value?.request.satisfies(c))return this._updateOperation.value.promise;if(d?.request?.satisfies(c))return Promise.resolve(!0);const h=!!this._updateOperation.value;this._updateOperation.clear();const u=new Xt,f=(async()=>{this._loadingCount.set(this._loadingCount.get()+1,void 0);const m=new U,_=e.filter(C=>C.providerId),b=new tIe(i,a,_);try{const C=this._debounceValue.get(this._textModel),w=jz(e.map(V=>V.debounceDelayMs),wne(lo))??C;if((h||s&&i.triggerKind===js.Automatic)&&await tX(w,u.token),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==c.versionId)return b.setNoSuggestionReasonIfNotSet("canceled:beforeFetch"),!1;const S=VF._requestId++;(this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get())&&this._log({sourceId:"InlineCompletions.fetch",kind:"start",requestId:S,modelUri:this._textModel.uri,modelVersion:this._textModel.getVersionId(),context:{triggerKind:i.triggerKind,suggestInfo:i.selectedSuggestionInfo?!0:void 0},time:Date.now(),provider:t});const L=new Date,x=Gke(e,this._cursorPosition.get(),this._textModel,i,a,this._languageConfigurationService);pX(u.token,()=>x.cancelAndDispose({kind:"tokenCancellation"}));let I=!1,D=!1;const R=[];for await(const V of x.lists)if(V){V.addRef(),m.add(ue(()=>V.removeRef(V.inlineSuggestionsData.length===0?{kind:"empty"}:{kind:"notTaken"})));for(const z of V.inlineSuggestionsData){if(D=!0,!i.includeInlineEdits&&(z.isInlineEdit||z.showInlineEditMenu)){z.setNotShownReason("notInlineEditRequested");continue}if(!i.includeInlineCompletions&&!(z.isInlineEdit||z.showInlineEditMenu)){z.setNotShownReason("notInlineCompletionRequested");continue}const ee=BF.create(z,this._textModel);R.push(ee),!ee.isInlineEdit&&!ee.showInlineEditMenu&&i.triggerKind===js.Automatic&&ee.isVisible(this._textModel,this._cursorPosition.get())&&(I=!0)}if(I)break}if(x.cancelAndDispose({kind:"lostRace"}),this._loggingEnabled.get()||this._structuredFetchLogger.isEnabled.get()){const V=x.didAllProvidersReturn;let z;(u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==c.versionId)&&(z="canceled");const ee=R.map(se=>({range:se.editRange.toString(),text:se.insertText,isInlineEdit:!!se.isInlineEdit,source:se.source.provider.groupId}));this._log({sourceId:"InlineCompletions.fetch",kind:"end",requestId:S,durationMs:Date.now()-L.getTime(),error:z,result:ee,time:Date.now(),didAllProvidersReturn:V})}b.setRequestUuid(x.contextWithUuid.requestUuid),D?(b.setHasProducedSuggestion(),R.length>0&&u.token.isCancellationRequested&&R.forEach(V=>V.setNotShownReasonIfNotSet("canceled:whileAwaitingOtherProviders"))):u.token.isCancellationRequested?b.setNoSuggestionReasonIfNotSet("canceled:whileFetching"):b.setNoSuggestionReasonIfNotSet("noSuggestion");const F=i.earliestShownDateTime-Date.now();if(F>0&&await tX(F,u.token),u.token.isCancellationRequested||this._store.isDisposed||this._textModel.getVersionId()!==c.versionId||r.get()){const V=u.token.isCancellationRequested?"canceled:afterMinShowDelay":this._store.isDisposed?"canceled:disposed":this._textModel.getVersionId()!==c.versionId?"canceled:documentChanged":r.get()?"canceled:userJumped":"unknown";return R.forEach(z=>z.setNotShownReasonIfNotSet(V)),!1}const O=new Date;this._debounceValue.update(this._textModel,O.getTime()-L.getTime());const B=this._cursorPosition.get();this._updateOperation.clear(),Dt(V=>{const z=this._state.get();i.selectedSuggestionInfo?this._state.set({inlineCompletions:la.createEmpty(),suggestWidgetInlineCompletions:z.suggestWidgetInlineCompletions.createStateWithAppliedResults(R,c,this._textModel,B,n)},V):this._state.set({inlineCompletions:z.inlineCompletions.createStateWithAppliedResults(R,c,this._textModel,B,n),suggestWidgetInlineCompletions:la.createEmpty()},V),z.inlineCompletions.dispose(),z.suggestWidgetInlineCompletions.dispose()})}finally{this._loadingCount.set(this._loadingCount.get()-1,void 0),m.dispose(),this.sendInlineCompletionsRequestTelemetry(b)}return!0})(),g=new nIe(c,u,f);return this._updateOperation.value=g,f}clear(e){this._updateOperation.clear();const t=this._state.get();this._state.set({inlineCompletions:la.createEmpty(),suggestWidgetInlineCompletions:la.createEmpty()},e),t.inlineCompletions.dispose(),t.suggestWidgetInlineCompletions.dispose()}seedInlineCompletionsWithSuggestWidget(){const e=this.inlineCompletions.get(),t=this.suggestWidgetInlineCompletions.get();t&&Dt(i=>{if(!e||(t.request?.versionId??-1)>(e.request?.versionId??-1)){e?.dispose();const n=this._state.get();this._state.set({inlineCompletions:t.clone(),suggestWidgetInlineCompletions:la.createEmpty()},i),n.inlineCompletions.dispose(),n.suggestWidgetInlineCompletions.dispose()}this.clearSuggestWidgetInlineCompletions(i)})}sendInlineCompletionsRequestTelemetry(e){if(!this._sendRequestData.get()||e.requestUuid===void 0||e.hasProducedSuggestion)return;const t={id:e.requestUuid,opportunityId:e.requestUuid,noSuggestionReason:e.noSuggestionReason??"unknown",extensionId:"vscode-core",extensionVersion:"0.0.0",groupId:"empty",shown:!1,editorType:e.requestInfo.editorType,requestReason:e.requestInfo.reason,typingInterval:e.requestInfo.typingInterval,typingIntervalCharacterCount:e.requestInfo.typingIntervalCharacterCount,languageId:e.requestInfo.languageId,selectedSuggestionInfo:!!e.context.selectedSuggestionInfo,availableProviders:e.providers.map(n=>n.providerId?.toString()).filter(sn).join(","),...Pke(e.providers.some(n=>Ake(n.providerId?.extensionId))),timeUntilProviderRequest:void 0,timeUntilProviderResponse:void 0,viewKind:void 0,preceeded:void 0,error:void 0,superseded:void 0,reason:void 0,correlationId:void 0,shownDuration:void 0,shownDurationUncollapsed:void 0,timeUntilShown:void 0,partiallyAccepted:void 0,partiallyAcceptedCountSinceOriginal:void 0,partiallyAcceptedRatioSinceOriginal:void 0,partiallyAcceptedCharactersSinceOriginal:void 0,cursorColumnDistance:void 0,cursorLineDistance:void 0,lineCountOriginal:void 0,lineCountModified:void 0,characterCountOriginal:void 0,characterCountModified:void 0,disjointReplacements:void 0,sameShapeReplacements:void 0,notShownReason:void 0},i=this._instantiationService.createInstance(PF);Fke(i,t)}clearSuggestWidgetInlineCompletions(e){this._updateOperation.value?.request.context.selectedSuggestionInfo&&this._updateOperation.clear()}cancelUpdate(){this._updateOperation.clear()}},VF=Xp,Xp._requestId=0,Xp);zF=VF=Jke([dD(4,Jt),dD(5,Rt),dD(6,Me),dD(7,ge)],zF);class eIe{constructor(e,t,i,n){this.position=e,this.context=t,this.versionId=i,this.providers=n}satisfies(e){return this.position.equals(e.position)&&rf(this.context.selectedSuggestionInfo,e.context.selectedSuggestionInfo,UR())&&(e.context.triggerKind===js.Automatic||this.context.triggerKind===js.Explicit)&&this.versionId===e.versionId&&iIe(e.providers,this.providers)}}class tIe{constructor(e,t,i){this.context=e,this.requestInfo=t,this.providers=i,this.hasProducedSuggestion=!1}setRequestUuid(e){this.requestUuid=e}setNoSuggestionReasonIfNotSet(e){this.noSuggestionReason??=e}setHasProducedSuggestion(){this.hasProducedSuggestion=!0}}function iIe(o,e){return[...o].every(t=>e.has(t))}class nIe{constructor(e,t,i){this.request=e,this.cancellationTokenSource=t,this.promise=i}dispose(){this.cancellationTokenSource.cancel()}}class la extends A{static createEmpty(){return new la([],void 0)}constructor(e,t){for(const i of e)i.addRef();super(),this.inlineCompletions=e,this.request=t,this._register({dispose:()=>{for(const i of this.inlineCompletions)i.removeRef()}})}_findById(e){return this.inlineCompletions.find(t=>t.identity===e)}_findByHash(e){return this.inlineCompletions.find(t=>t.hash===e)}createStateWithAppliedEdit(e,t){const i=this.inlineCompletions.map(n=>n.withEdit(e,t)).filter(sn);return new la(i,this.request)}createStateWithAppliedResults(e,t,i,n,s){let r;if(s){const c=this._findById(s);if(c&&c.canBeReused(i,t.position)){r=c;const d=e.find(h=>h.hash===c.hash);d?e=oIe(d,e):e=[c,...e]}}const a=r?!r.isInlineEdit:e.some(c=>!c.isInlineEdit&&c.isVisible(i,n));let l=[];for(const c of e){const d=this._findByHash(c.hash);let h;d&&d!==c?(h=c.withIdentity(d.identity),c.setIsPreceeded(d),d.setEndOfLifeReason({kind:Bf.Ignored,userTypingDisagreed:!1,supersededBy:c.getSourceCompletion()})):h=c,a!==h.isInlineEdit&&l.push(h)}return l.sort(kn(c=>c.showInlineEditMenu,T6)),l=sIe(l,c=>c.semanticId),new la(l,t)}clone(){return new la(this.inlineCompletions,this.request)}}function sIe(o,e){const t=new Set;return o.filter(i=>{const n=e(i);return t.has(n)?!1:(t.add(n),!0)})}function oIe(o,e){const t=e.indexOf(o);return t>-1?[o,...e.slice(0,t),...e.slice(t+1)]:e}class rIe{constructor(e,t,i){this.edit=e,this.commands=t,this.inlineCompletion=i}equals(e){return this.edit.equals(e.edit)&&this.inlineCompletion===e.inlineCompletion}}var aIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_X=function(o,e){return function(t,i){e(t,i,o)}};const hD=We("IInlineCompletionsService"),bX=new ae("inlineCompletions.snoozed",!1,p(76,"Whether inline completions are currently snoozed"));let UF=class extends A{get snoozeTimeLeft(){return this._snoozeTimeEnd===void 0?0:Math.max(0,this._snoozeTimeEnd-Date.now())}constructor(e,t){super(),this._contextKeyService=e,this._telemetryService=t,this._onDidChangeIsSnoozing=this._register(new P),this.onDidChangeIsSnoozing=this._onDidChangeIsSnoozing.event,this._snoozeTimeEnd=void 0,this._recentCompletionIds=[],this._timer=this._register(new Ly);const i=bX.bindTo(this._contextKeyService);this._register(this.onDidChangeIsSnoozing(()=>i.set(this.isSnoozing())))}setSnoozeDuration(e){if(e<0)throw new Ce(`Invalid snooze duration: ${e}. Duration must be non-negative.`);if(e===0){this.cancelSnooze();return}const t=this.isSnoozing(),i=this.snoozeTimeLeft;this._snoozeTimeEnd=Date.now()+e,t||this._onDidChangeIsSnoozing.fire(!0),this._timer.cancelAndSet(()=>{if(!this.isSnoozing())this._onDidChangeIsSnoozing.fire(!1);else throw new Ce("Snooze timer did not fire as expected")},this.snoozeTimeLeft+1),this._reportSnooze(e-i,e)}isSnoozing(){return this.snoozeTimeLeft>0}cancelSnooze(){this.isSnoozing()&&(this._reportSnooze(-this.snoozeTimeLeft,0),this._snoozeTimeEnd=void 0,this._timer.cancel(),this._onDidChangeIsSnoozing.fire(!1))}reportNewCompletion(e){this._lastCompletionId=e,this._recentCompletionIds.unshift(e),this._recentCompletionIds.length>5&&this._recentCompletionIds.pop()}_reportSnooze(e,t){const i=Math.round(e/1e3),n=Math.round(t/1e3);this._telemetryService.publicLog2("inlineCompletions.snooze",{deltaSeconds:i,totalSeconds:n,lastCompletionId:this._lastCompletionId,recentCompletionIds:this._recentCompletionIds})}};UF=aIe([_X(0,xe),_X(1,Vn)],UF),je(hD,UF,1);const lIe="editor.action.inlineSuggest.snooze",cIe="editor.action.inlineSuggest.cancelSnooze",CX="inlineCompletions.lastSnoozeDuration",UN=class UN extends ln{constructor(){super({id:UN.ID,title:H(78,"Snooze Inline Suggestions"),precondition:K.true(),f1:!0})}async run(e,...t){const i=e.get(Zn),n=e.get(hD),s=e.get(Es);let r;t.length>0&&typeof t[0]=="number"&&(r=t[0]),r||(r=await this.getDurationFromUser(i,s)),r&&n.setSnoozeDuration(r)}async getDurationFromUser(e,t){const i=t.getNumber(CX,0,3e5),n=[{label:"1 minute",id:"1",value:6e4},{label:"5 minutes",id:"5",value:3e5},{label:"10 minutes",id:"10",value:6e5},{label:"15 minutes",id:"15",value:9e5},{label:"30 minutes",id:"30",value:18e5},{label:"60 minutes",id:"60",value:36e5}],s=await e.pick(n,{placeHolder:p(77,"Select snooze duration for Code completions and NES"),activeItem:n.find(r=>r.value===i)});if(s)return t.store(CX,s.value,0,0),s.value}};UN.ID=lIe;let $F=UN;const $N=class $N extends ln{constructor(){super({id:$N.ID,title:H(79,"Cancel Snooze Inline Suggestions"),precondition:bX,f1:!0})}async run(e){e.get(hD).cancelSnooze()}};$N.ID=cIe;let jF=$N;const Ur=class Ur extends A{getTypingInterval(){return(this._cacheInvalidated||this._cachedTypingIntervalResult===null)&&(this._cachedTypingIntervalResult=this._calculateTypingInterval(),this._cacheInvalidated=!1),this._cachedTypingIntervalResult}constructor(e){super(),this._textModel=e,this._typingSessions=[],this._currentSession=null,this._lastChangeTime=0,this._cachedTypingIntervalResult=null,this._cacheInvalidated=!0,this._register(this._textModel.onDidChangeContent(t=>this._updateTypingSpeed(t)))}_updateTypingSpeed(e){const t=Date.now();if(!this._isUserTyping(e)){this._finalizeCurrentSession();return}this._currentSession&&t-this._lastChangeTime>Ur.MAX_SESSION_GAP_MS&&this._finalizeCurrentSession(),this._currentSession||(this._currentSession={startTime:t,endTime:t,characterCount:0}),this._currentSession.endTime=t,this._currentSession.characterCount+=this._getActualCharacterCount(e),this._lastChangeTime=t,this._cacheInvalidated=!0}_getActualCharacterCount(e){let t=0;for(const i of e.changes)t+=Math.max(i.text.length,i.rangeLength);return t}_isUserTyping(e){if(!e.detailedReasons||e.detailedReasons.length===0)return!1;for(const t of e.detailedReasons)if(this._isUserTypingReason(t))return!0;return!1}_isUserTypingReason(e){if(e.metadata.isUndoing||e.metadata.isRedoing)return!1;switch(e.metadata.source){case"cursor":{const t=e.metadata.kind;return t==="type"||t==="compositionType"||t==="compositionEnd"}default:return!1}}_finalizeCurrentSession(){if(!this._currentSession)return;this._currentSession.endTime-this._currentSession.startTime>=Ur.MIN_SESSION_DURATION_MS&&this._currentSession.characterCount>0&&(this._typingSessions.push(this._currentSession),this._typingSessions.length>Ur.SESSION_HISTORY_LIMIT&&this._typingSessions.shift()),this._currentSession=null}_calculateTypingInterval(){if(this._currentSession){const e={...this._currentSession};if(e.endTime-e.startTime>=Ur.MIN_SESSION_DURATION_MS&&e.characterCount>0){const i=[...this._typingSessions,e];return this._calculateSpeedFromSessions(i)}}return this._calculateSpeedFromSessions(this._typingSessions)}_calculateSpeedFromSessions(e){if(e.length===0)return{averageInterval:0,characterCount:0};const t=[...e].sort((d,h)=>h.endTime-d.endTime),i=Date.now()-Ur.TYPING_SPEED_WINDOW_MS,n=t.filter(d=>d.endTime>i),s=t.splice(n.length);let r=vy(n.map(d=>d.characterCount));for(let d=0;d<s.length&&r<Ur.MIN_CHARS_FOR_RELIABLE_SPEED;d++)n.push(s[d]),r+=s[d].characterCount;const a=vy(n.map(d=>d.endTime-d.startTime));if(a===0||r<=1)return{averageInterval:0,characterCount:r};const l=Math.max(1,r-1),c=a/l;return{averageInterval:Math.round(c),characterCount:r}}dispose(){this._finalizeCurrentSession(),super.dispose()}};Ur.MAX_SESSION_GAP_MS=3e3,Ur.MIN_SESSION_DURATION_MS=1e3,Ur.SESSION_HISTORY_LIMIT=50,Ur.TYPING_SPEED_WINDOW_MS=3e5,Ur.MIN_CHARS_FOR_RELIABLE_SPEED=20;let qF=Ur;var dIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yg=function(o,e){return function(t,i){e(t,i,o)}};let KF=class extends A{get isAcceptingPartially(){return this._isAcceptingPartially}constructor(e,t,i,n,s,r,a,l,c,d,h,u,f,g){super(),this.textModel=e,this._selectedSuggestItem=t,this._textModelVersionId=i,this._positions=n,this._debounceValue=s,this._enabled=r,this._editor=a,this._instantiationService=l,this._commandService=c,this._languageConfigurationService=d,this._accessibilityService=h,this._languageFeaturesService=u,this._codeEditorService=f,this._inlineCompletionsService=g,this._isActive=Le(this,!1),this._onlyRequestInlineEditsSignal=_r(this),this._forceUpdateExplicitlySignal=_r(this),this._noDelaySignal=_r(this),this._fetchSpecificProviderSignal=_r(this),this._selectedInlineCompletionId=Le(this,void 0),this.primaryPosition=j(this,v=>this._positions.read(v)[0]??new M(1,1)),this._isAcceptingPartially=!1,this._appearedInsideViewport=j(this,v=>{const S=this.state.read(v);if(!S||!S.inlineCompletion)return!1;const L=S.inlineCompletion.targetRange,x=this._editorObs.editor.getVisibleRanges();return x.length<1?!1:new k(x[0].startLineNumber,x[0].startColumn,x[x.length-1].endLineNumber,x[x.length-1].endColumn).containsRange(L)}),this._onDidAccept=new P,this.onDidAccept=this._onDidAccept.event,this._lastShownInlineCompletionInfo=void 0,this._lastAcceptedInlineCompletionInfo=void 0,this._didUndoInlineEdits=W6({owner:this,changeTracker:{createChangeSummary:()=>({didUndo:!1}),handleChange:(v,S)=>(S.didUndo=v.didChange(this._textModelVersionId)&&!!v.change?.isUndoing,!0)}},(v,S)=>{const L=this._textModelVersionId.read(v);return L!==null&&this._lastAcceptedInlineCompletionInfo&&this._lastAcceptedInlineCompletionInfo.textModelVersionIdAfter===L-1&&this._lastAcceptedInlineCompletionInfo.inlineCompletion.isInlineEdit&&S.didUndo?(this._lastAcceptedInlineCompletionInfo=void 0,!0):!1}),this._preserveCurrentCompletionReasons=new Set([Ed.Redo,Ed.Undo,Ed.AcceptWord]),this.dontRefetchSignal=_r(this),this._fetchInlineCompletionsPromise=W6({owner:this,changeTracker:{createChangeSummary:()=>({dontRefetch:!1,preserveCurrentCompletion:!1,inlineCompletionTriggerKind:js.Automatic,onlyRequestInlineEdits:!1,shouldDebounce:!0,provider:void 0,textChange:!1,changeReason:""}),handleChange:(v,S)=>{if(v.didChange(this._textModelVersionId)){this._preserveCurrentCompletionReasons.has(this._getReason(v.change))&&(S.preserveCurrentCompletion=!0);const L=v.change?.detailedReasons??[];S.changeReason=L.length>0?L[0].getType():"",S.textChange=!0}else v.didChange(this._forceUpdateExplicitlySignal)?(S.preserveCurrentCompletion=!0,S.inlineCompletionTriggerKind=js.Explicit):v.didChange(this.dontRefetchSignal)?S.dontRefetch=!0:v.didChange(this._onlyRequestInlineEditsSignal)?S.onlyRequestInlineEdits=!0:v.didChange(this._fetchSpecificProviderSignal)&&(S.provider=v.change);return!0}}},(v,S)=>{if(this._source.clearOperationOnTextModelChange.read(v),this._noDelaySignal.read(v),this.dontRefetchSignal.read(v),this._onlyRequestInlineEditsSignal.read(v),this._forceUpdateExplicitlySignal.read(v),this._fetchSpecificProviderSignal.read(v),!((this._enabled.read(v)&&this._selectedSuggestItem.read(v)||this._isActive.read(v))&&(!this._inlineCompletionsService.isSnoozing()||S.inlineCompletionTriggerKind===js.Explicit))){this._source.cancelUpdate();return}this._textModelVersionId.read(v);const x=this._source.suggestWidgetInlineCompletions.read(void 0);let I=this._selectedSuggestItem.read(v);if(this._shouldShowOnSuggestConflict.read(void 0)&&(I=void 0),x&&!I&&this._source.seedInlineCompletionsWithSuggestWidget(),S.dontRefetch)return Promise.resolve(!0);if(this._didUndoInlineEdits.read(v)&&S.inlineCompletionTriggerKind!==js.Explicit){Dt(oe=>{this._source.clear(oe)});return}let D="";S.provider?D+="providerOnDidChange":S.inlineCompletionTriggerKind===js.Explicit&&(D+="explicit"),S.changeReason&&(D+=D.length>0?`:${S.changeReason}`:S.changeReason);const R=this._typing.getTypingInterval(),F={editorType:this.editorType,startTime:Date.now(),languageId:this.textModel.getLanguageId(),reason:D,typingInterval:R.averageInterval,typingIntervalCharacterCount:R.characterCount,availableProviders:[]};let O={triggerKind:S.inlineCompletionTriggerKind,selectedSuggestionInfo:I?.toSelectedSuggestionInfo(),includeInlineCompletions:!S.onlyRequestInlineEdits,includeInlineEdits:this._inlineEditsEnabled.read(v),requestIssuedDateTime:F.startTime,earliestShownDateTime:F.startTime+(S.inlineCompletionTriggerKind===js.Explicit||this.inAcceptFlow.read(void 0)?0:this._minShowDelay.read(void 0))};O.triggerKind===js.Automatic&&S.textChange&&this.textModel.getAlternativeVersionId()===this._lastShownInlineCompletionInfo?.alternateTextModelVersionId&&(O={...O,includeInlineCompletions:!this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit,includeInlineEdits:this._lastShownInlineCompletionInfo.inlineCompletion.isInlineEdit});const B=this.selectedInlineCompletion.read(void 0)??this._inlineCompletionItems.read(void 0)?.inlineEdit,V=S.preserveCurrentCompletion||B?.forwardStable?B:void 0,z=this._jumpedToId.map(oe=>!!oe&&oe===this._inlineCompletionItems.read(void 0)?.inlineEdit?.semanticId),ee=S.provider?{providers:[S.provider],label:"single:"+S.provider.providerId?.toString()}:{providers:this._languageFeaturesService.inlineCompletionsProvider.all(this.textModel),label:void 0},se=this.getAvailableProviders(ee.providers);return F.availableProviders=se.map(oe=>oe.providerId).filter(sn),this._source.fetch(se,ee.label,O,V?.identity,S.shouldDebounce,z,F)}),this._inlineCompletionItems=In({owner:this},v=>{const S=this._source.inlineCompletions.read(v);if(!S)return;const L=this.primaryPosition.read(v);let x;const I=[];for(const D of S.inlineCompletions)D.isInlineEdit?x=D:D.isVisible(this.textModel,L)&&I.push(D);return I.length!==0&&(x=void 0),{inlineCompletions:I,inlineEdit:x}}),this._filteredInlineCompletionItems=In({owner:this,equalsFn:f1()},v=>this._inlineCompletionItems.read(v)?.inlineCompletions??[]),this.selectedInlineCompletionIndex=j(this,v=>{const S=this._selectedInlineCompletionId.read(v),L=this._filteredInlineCompletionItems.read(v),x=this._selectedInlineCompletionId===void 0?-1:L.findIndex(I=>I.semanticId===S);return x===-1?(this._selectedInlineCompletionId.set(void 0,void 0),0):x}),this.selectedInlineCompletion=j(this,v=>{const S=this._filteredInlineCompletionItems.read(v),L=this.selectedInlineCompletionIndex.read(v);return S[L]}),this.activeCommands=In({owner:this,equalsFn:f1()},v=>this.selectedInlineCompletion.read(v)?.source.inlineSuggestions.commands??[]),this.inlineCompletionsCount=j(this,v=>{if(this.lastTriggerKind.read(v)===js.Explicit)return this._filteredInlineCompletionItems.read(v).length}),this._hasVisiblePeekWidgets=j(this,v=>this._editorObs.openedPeekWidgets.read(v)>0),this._shouldShowOnSuggestConflict=j(this,v=>{const S=this._showOnSuggestConflict.read(v);if(S!=="never"&&!!this.selectedInlineCompletion.read(v)){const x=this._selectedSuggestItem.read(v);return x?S==="whenSuggestListIsIncomplete"?x.listIncomplete:!0:!1}return!1}),this.state=In({owner:this,equalsFn:(v,S)=>!v||!S?v===S:v.kind==="ghostText"&&S.kind==="ghostText"?iX(v.ghostTexts,S.ghostTexts)&&v.inlineCompletion===S.inlineCompletion&&v.suggestItem===S.suggestItem:v.kind==="inlineEdit"&&S.kind==="inlineEdit"?v.inlineEdit.equals(S.inlineEdit):!1},v=>{const S=this.textModel;if(this._suppressInSnippetMode.read(v)&&this._isInSnippetMode.read(v))return;const L=this._inlineCompletionItems.read(v),x=L?.inlineEdit;if(x){if(this._hasVisiblePeekWidgets.read(v))return;let D=x.getSingleTextEdit();D=Dd(D,S);const R=this.primaryPosition.map(ee=>ke.fromRangeInclusive(x.targetRange).addMargin(1,1).contains(ee.lineNumber)),F=x.source.inlineSuggestions.commands,O=new rIe(D,F??[],x),B=x.updatedEdit,V=B?mo.fromStringEdit(B,new wg(this.textModel)).replacements:[D],z=(L.inlineEdit?.command?.id==="vscode.open"||L.inlineEdit?.command?.id==="_workbench.open")&&L.inlineEdit?.command.arguments?.length?be.from(L.inlineEdit?.command.arguments[0]):void 0;return{kind:"inlineEdit",inlineEdit:O,inlineCompletion:x,edits:V,cursorAtInlineEdit:R,nextEditUri:z}}const I=this._selectedSuggestItem.read(v);if(!this._shouldShowOnSuggestConflict.read(v)&&I){const D=Dd(I.getSingleTextEdit(),S),R=this._computeAugmentation(D,v);if(!this._suggestPreviewEnabled.read(v)&&!R)return;const O=R?.edit??D,B=R?R.edit.text.length-D.text.length:0,V=this._suggestPreviewMode.read(v),z=this._positions.read(v),se=[O,...GF(this.textModel,z,O)].map((Ae,tt)=>({edit:Ae,ghostText:Ae?oX(Ae,S,V,z[tt],B):void 0})).filter(({edit:Ae,ghostText:tt})=>Ae!==void 0&&tt!==void 0),oe=se.map(({edit:Ae})=>Ae),fe=se.map(({ghostText:Ae})=>Ae),Ie=fe[0]??new h0(O.range.endLineNumber,[]);return{kind:"ghostText",edits:oe,primaryGhostText:Ie,ghostTexts:fe,inlineCompletion:R?.completion,suggestItem:I}}else{if(!this._isActive.read(v))return;const D=this.selectedInlineCompletion.read(v);if(!D)return;const R=D.getSingleTextEdit(),F=this._inlineSuggestMode.read(v),O=this._positions.read(v),V=[R,...GF(this.textModel,O,R)].map((se,oe)=>({edit:se,ghostText:se?oX(se,S,F,O[oe],0):void 0})).filter(({edit:se,ghostText:oe})=>se!==void 0&&oe!==void 0),z=V.map(({edit:se})=>se),ee=V.map(({ghostText:se})=>se);return ee[0]?{kind:"ghostText",edits:z,primaryGhostText:ee[0],ghostTexts:ee,inlineCompletion:D,suggestItem:void 0}:void 0}}),this.inlineCompletionState=j(this,v=>{const S=this.state.read(v);if(!(!S||S.kind!=="ghostText")&&!this._editorObs.inComposition.read(v))return S}),this.inlineEditState=j(this,v=>{const S=this.state.read(v);if(!(!S||S.kind!=="inlineEdit"))return S}),this.inlineEditAvailable=j(this,v=>!!this.inlineEditState.read(v)),this.warning=j(this,v=>this.inlineCompletionState.read(v)?.inlineCompletion?.warning),this.ghostTexts=In({owner:this,equalsFn:iX},v=>{const S=this.inlineCompletionState.read(v);if(S)return S.ghostTexts}),this.primaryGhostText=In({owner:this,equalsFn:nX},v=>{const S=this.inlineCompletionState.read(v);if(S)return S?.primaryGhostText}),this.showCollapsed=j(this,v=>{const S=this.state.read(v);if(!S||S.kind!=="inlineEdit"||S.inlineCompletion.displayLocation)return!1;const L=S.inlineCompletion.updatedEditModelVersion===this._textModelVersionId.read(v);return(this._inlineEditsShowCollapsedEnabled.read(v)||!L)&&this._jumpedToId.read(v)!==S.inlineCompletion.semanticId&&!this._inAcceptFlow.read(v)}),this._tabShouldIndent=j(this,v=>{if(this._inAcceptFlow.read(v))return!1;function S(I){return I.startLineNumber!==I.endLineNumber}function L(I,D){const R=I.getLineIndentColumn(D),F=I.getLineLastNonWhitespaceColumn(D),O=Math.max(F,R);return new k(D,R,D,O)}return this._editorObs.selections.read(v)?.some(I=>I.isEmpty()?this.textModel.getLineLength(I.startLineNumber)===0:S(I)||I.containsRange(L(this.textModel,I.startLineNumber)))}),this.tabShouldJumpToInlineEdit=j(this,v=>{if(this._tabShouldIndent.read(v))return!1;const S=this.inlineEditState.read(v);return S?this.showCollapsed.read(v)?!0:this._inAcceptFlow.read(v)&&this._appearedInsideViewport.read(v)?!1:!S.cursorAtInlineEdit.read(v):!1}),this.tabShouldAcceptInlineEdit=j(this,v=>{const S=this.inlineEditState.read(v);return!S||this.showCollapsed.read(v)?!1:this._inAcceptFlow.read(v)&&this._appearedInsideViewport.read(v)||S.inlineCompletion.targetRange.startLineNumber===this._editorObs.cursorLineNumber.read(v)||this._jumpedToId.read(v)===S.inlineCompletion.semanticId?!0:this._tabShouldIndent.read(v)?!1:S.cursorAtInlineEdit.read(v)}),this._jumpedToId=Le(this,void 0),this._inAcceptFlow=Le(this,!1),this.inAcceptFlow=this._inAcceptFlow,this._source=this._register(this._instantiationService.createInstance(zF,this.textModel,this._textModelVersionId,this._debounceValue,this.primaryPosition)),this.lastTriggerKind=this._source.inlineCompletions.map(this,v=>v?.request?.context.triggerKind),this._editorObs=ni(this._editor);const m=this._editorObs.getOption(134);this._suggestPreviewEnabled=m.map(v=>v.preview),this._suggestPreviewMode=m.map(v=>v.previewMode);const _=this._editorObs.getOption(71);this._inlineSuggestMode=_.map(v=>v.mode),this._suppressedInlineCompletionGroupIds=_.map(v=>new Set(v.experimental.suppressInlineSuggestions.split(","))),this._inlineEditsEnabled=_.map(v=>!!v.edits.enabled),this._inlineEditsShowCollapsedEnabled=_.map(v=>v.edits.showCollapsed),this._triggerCommandOnProviderChange=_.map(v=>v.triggerCommandOnProviderChange),this._minShowDelay=_.map(v=>v.minShowDelay),this._showOnSuggestConflict=_.map(v=>v.experimental.showOnSuggestConflict),this._suppressInSnippetMode=_.map(v=>v.suppressInSnippetMode);const b=hs.get(this._editor);this._isInSnippetMode=b?.isInSnippetObservable??Et(!1),this._typing=this._register(new qF(this.textModel)),this._register(this._inlineCompletionsService.onDidChangeIsSnoozing(v=>{v&&this.stop()}));{const v=this.textModel.uri.scheme==="vscode-notebook-cell",[S]=this._codeEditorService.listDiffEditors().filter(L=>L.getOriginalEditor().getId()===this._editor.getId()||L.getModifiedEditor().getId()===this._editor.getId());this.isInDiffEditor=!!S,this.editorType=v?m0.Notebook:this.isInDiffEditor?m0.DiffEditor:m0.TextEditor}this._register(Fm(this.state,v=>{v&&v.inlineCompletion&&this._inlineCompletionsService.reportNewCompletion(v.inlineCompletion.requestUuid)})),this._register(Fm(this._fetchInlineCompletionsPromise)),this._register(Se(v=>{this._editorObs.versionId.read(v),this._inAcceptFlow.set(!1,void 0)})),this._register(Se(v=>{this.state.map((L,x)=>!L||L.kind==="inlineEdit"&&!L.cursorAtInlineEdit.read(x)).read(v)&&this._jumpedToId.set(void 0,void 0)}));const C=this.inlineEditState.map(v=>v?.inlineCompletion.semanticId);this._register(Se(v=>{C.read(v)&&(this._editor.pushUndoStop(),this._lastShownInlineCompletionInfo={alternateTextModelVersionId:this.textModel.getAlternativeVersionId(),inlineCompletion:this.state.get().inlineCompletion})}));const w=rt(this._languageFeaturesService.inlineCompletionsProvider.onDidChange,()=>this._languageFeaturesService.inlineCompletionsProvider.all(e));ZR(this,w,(v,S)=>{v.onDidChangeInlineCompletions&&S.add(v.onDidChangeInlineCompletions(()=>{if(!this._enabled.get()||(this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor())!==this._editor)return;if(this._triggerCommandOnProviderChange.get()){this.trigger(void 0,{onlyFetchInlineEdits:!0});return}const x=this.state.get();x&&(x.inlineCompletion||x.edits)&&x.inlineCompletion?.source.provider!==v||Dt(I=>{this._fetchSpecificProviderSignal.trigger(I,v),this.trigger(I)})}))}).recomputeInitiallyAndOnChange(this._store),this._didUndoInlineEdits.recomputeInitiallyAndOnChange(this._store)}getIndentationInfo(e){let t=!1,i=!0;const n=this?.primaryGhostText.read(e);if(this?._selectedSuggestItem&&n&&n.parts.length>0){const{column:s,lines:r}=n.parts[0],a=r[0].line,l=this.textModel.getLineIndentColumn(n.lineNumber);if(s<=l){let d=es(a);d===-1&&(d=a.length-1),t=d>0;const h=this.textModel.getOptions().tabSize;i=ti.visibleColumnFromColumn(a,d+1,h)<h}}return{startsWithIndentation:t,startsWithIndentationLessThanTabSize:i}}_getReason(e){return e?.isUndoing?Ed.Undo:e?.isRedoing?Ed.Redo:this.isAcceptingPartially?Ed.AcceptWord:Ed.Other}getAvailableProviders(e){const t=this._suppressedInlineCompletionGroupIds.get(),i=e.filter(r=>!(r.groupId&&t.has(r.groupId))),n=new Set;for(const r of i)r.excludesGroupIds?.forEach(a=>n.add(a));const s=[];for(const r of i)r.groupId&&n.has(r.groupId)||s.push(r);return s}async trigger(e,t){lf(e,i=>{t?.onlyFetchInlineEdits&&this._onlyRequestInlineEditsSignal.trigger(i),t?.noDelay&&this._noDelaySignal.trigger(i),this._isActive.set(!0,i)}),await this._fetchInlineCompletionsPromise.get()}async triggerExplicitly(e,t=!1){lf(e,i=>{t&&this._onlyRequestInlineEditsSignal.trigger(i),this._isActive.set(!0,i),this._inAcceptFlow.set(!0,i),this._forceUpdateExplicitlySignal.trigger(i)}),await this._fetchInlineCompletionsPromise.get()}stop(e="automatic",t){lf(t,i=>{if(e==="explicitCancel"){const n=this.state.get()?.inlineCompletion;n&&n.reportEndOfLife({kind:Bf.Rejected})}this._isActive.set(!1,i),this._source.clear(i)})}_computeAugmentation(e,t){const i=this.textModel,n=this._source.suggestWidgetInlineCompletions.read(t),s=n?n.inlineCompletions.filter(a=>!a.isInlineEdit):[this.selectedInlineCompletion.read(t)].filter(sn);return Ehe(s,a=>{let l=a.getSingleTextEdit();return l=Dd(l,i,k.fromPositions(l.range.getStartPosition(),e.range.getEndPosition())),sX(l,e)?{completion:a,edit:l}:void 0})}async _deltaSelectedInlineCompletionIndex(e){await this.triggerExplicitly();const t=this._filteredInlineCompletionItems.get()||[];if(t.length>0){const i=(this.selectedInlineCompletionIndex.get()+e+t.length)%t.length;this._selectedInlineCompletionId.set(t[i].semanticId,void 0)}else this._selectedInlineCompletionId.set(void 0,void 0)}async next(){await this._deltaSelectedInlineCompletionIndex(1)}async previous(){await this._deltaSelectedInlineCompletionIndex(-1)}_getMetadata(e,t,i=void 0){return i?jn.inlineCompletionPartialAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t,type:i}):jn.inlineCompletionAccept({nes:e.isInlineEdit,requestUuid:e.requestUuid,providerId:e.source.provider.providerId,languageId:t})}async accept(e=this._editor){if(e.getModel()!==this.textModel)throw new Ce;let t,i=!1;const n=this.state.get();if(n?.kind==="ghostText"){if(!n||n.primaryGhostText.isEmpty()||!n.inlineCompletion)return;t=n.inlineCompletion}else if(n?.kind==="inlineEdit")t=n.inlineCompletion,i=!!n.nextEditUri;else return;t.addRef();try{if(e.pushUndoStop(),!i)if(t.snippetInfo){const s=Oi.delete(t.editRange),r=t.additionalTextEdits.map(l=>new Oi(k.lift(l.range),l.text??"")),a=mo.fromParallelReplacementsUnsorted([s,...r]);e.edit(a,this._getMetadata(t,this.textModel.getLanguageId())),e.setPosition(t.snippetInfo.range.getStartPosition(),"inlineCompletionAccept"),hs.get(e)?.insert(t.snippetInfo.snippet,{undoStopBefore:!1})}else{const s=n.edits;let r=s;n.kind==="ghostText"&&(r=Ske(s,this.textModel));const a=eX(r).map(d=>ce.fromPositions(d)),l=t.additionalTextEdits.map(d=>new Oi(k.lift(d.range),d.text??"")),c=mo.fromParallelReplacementsUnsorted([...s,...l]);if(e.edit(c,this._getMetadata(t,this.textModel.getLanguageId())),t.displayLocation===void 0&&e.setSelections(n.kind==="inlineEdit"?a.slice(-1):a,"inlineCompletionAccept"),n.kind==="inlineEdit"&&!this._accessibilityService.isMotionReduced()){const d=c.getNewRanges(),h=this._store.add(new hIe(e,d,()=>{this._store.delete(h)}))}}this._onDidAccept.fire(),this.stop(),t.command&&await this._commandService.executeCommand(t.command.id,...t.command.arguments||[]).then(void 0,Di),t.reportEndOfLife({kind:Bf.Accepted})}finally{t.removeRef(),this._inAcceptFlow.set(!0,void 0),this._lastAcceptedInlineCompletionInfo={textModelVersionIdAfter:this.textModel.getVersionId(),inlineCompletion:t}}}async acceptNextWord(){await this._acceptNext(this._editor,"word",(e,t)=>{const i=this.textModel.getLanguageIdAtPosition(e.lineNumber,e.column),n=this._languageConfigurationService.getLanguageConfiguration(i),s=new RegExp(n.wordDefinition.source,n.wordDefinition.flags.replace("g","")),r=t.match(s);let a=0;r&&r.index!==void 0?r.index===0?a=r[0].length:a=r.index:a=t.length;const c=/\s+/g.exec(t);return c&&c.index!==void 0&&c.index+c[0].length<a&&(a=c.index+c[0].length),a},0)}async acceptNextLine(){await this._acceptNext(this._editor,"line",(e,t)=>{const i=t.match(/\n/);return i&&i.index!==void 0?i.index+1:t.length},1)}async _acceptNext(e,t,i,n){if(e.getModel()!==this.textModel)throw new Ce;const s=this.inlineCompletionState.get();if(!s||s.primaryGhostText.isEmpty()||!s.inlineCompletion)return;const r=s.primaryGhostText,a=s.inlineCompletion;if(a.snippetInfo){await this.accept(e);return}const l=r.parts[0],c=new M(r.lineNumber,l.column),d=l.text,h=i(c,d);if(h===d.length&&r.parts.length===1){this.accept(e);return}const u=d.substring(0,h),f=this._positions.get(),g=f[0];a.addRef();try{this._isAcceptingPartially=!0;try{e.pushUndoStop();const C=k.fromPositions(g,c),w=e.getModel().getValueInRange(C)+u,v=new Oi(C,w),S=[v,...GF(this.textModel,f,v)].filter(sn),L=eX(S).map(x=>ce.fromPositions(x));e.edit(mo.fromParallelReplacementsUnsorted(S),this._getMetadata(a,t)),e.setSelections(L,"inlineCompletionPartialAccept"),e.revealPositionInCenterIfOutsideViewport(e.getPosition(),1)}finally{this._isAcceptingPartially=!1}const m=k.fromPositions(a.editRange.getStartPosition(),$i.ofText(u).addToPosition(c)),b=e.getModel().getValueInRange(m,1).length;a.reportPartialAccept(b,{kind:n,acceptedLength:b},{characters:h,ratio:h/d.length,count:1})}finally{a.removeRef()}}handleSuggestAccepted(e){const t=Dd(e.getSingleTextEdit(),this.textModel),i=this._computeAugmentation(t,void 0);if(!i)return;const s=this.textModel.getValueInRange(i.completion.editRange,1).length+t.text.length;i.completion.reportPartialAccept(t.text.length,{kind:2,acceptedLength:s},{characters:t.text.length,count:1,ratio:1})}extractReproSample(){const e=this.textModel.getValue(),t=this.state.get()?.inlineCompletion;return{documentValue:e,inlineCompletion:t?.getSourceCompletion()}}jump(){const e=this.inlineEditState.get();e&&Dt(t=>{this._jumpedToId.set(e.inlineCompletion.semanticId,t),this.dontRefetchSignal.trigger(t);const i=e.inlineCompletion.targetRange,n=i.getStartPosition();if(this._editor.setPosition(n,"inlineCompletions.jump"),i.isSingleLine()&&(e.inlineCompletion.displayLocation||!e.inlineCompletion.insertText.includes(`
`)))this._editor.revealPosition(n);else{const r=new k(i.startLineNumber-1,1,i.endLineNumber+1,1);this._editor.revealRange(r,1)}this._editor.focus()})}async handleInlineSuggestionShown(e,t,i){await e.reportInlineEditShown(this._commandService,t,i)}};KF=dIe([Yg(7,ge),Yg(8,Tt),Yg(9,Jt),Yg(10,bn),Yg(11,he),Yg(12,et),Yg(13,hD)],KF);var Ed;(function(o){o[o.Undo=0]="Undo",o[o.Redo=1]="Redo",o[o.AcceptWord=2]="AcceptWord",o[o.Other=3]="Other"})(Ed||(Ed={}));function GF(o,e,t){if(e.length===1)return[];const i=new wg(o),n=i.getTransformer(),s=n.getOffset(e[0]),r=e.slice(1).map(u=>n.getOffset(u));t=t.removeCommonPrefixAndSuffix(i);const a=n.getStringReplacement(t),l=a.replaceRange.start-s,c=a.replaceRange.join(pe.emptyAt(s)),d=i.getValueOfOffsetRange(c);return r.map(u=>{const f=u+l,g=f+a.replaceRange.length,m=new pe(f,g),_=m.join(pe.emptyAt(u));if(i.getValueOfOffsetRange(_)!==d)return;const C=new Cn(m,a.newText);return n.getTextReplacement(C)}).filter(sn)}class hIe extends A{constructor(e,t,i){super(),i&&this._register({dispose:()=>i()}),this._register(ni(e).setDecorations(Et(t.map(r=>({range:r,options:{description:"animation",className:"edits-fadeout-decoration",zIndex:1}})))));const n=new xke(1,0,1e3,Ike),s=new Dke(n);this._register(Se(r=>{const a=s.getValue(r);e.getContainerDomNode().style.setProperty("--animation-opacity",a.toString()),n.isFinished()&&this.dispose()}))}}var uIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},vX=function(o,e){return function(t,i){e(t,i,o)}},_0;class ZF{constructor(e){this.name=e}select(e,t,i){if(i.length===0)return 0;const n=i[0].score[0];for(let s=0;s<i.length;s++){const{score:r,completion:a}=i[s];if(r[0]!==n)break;if(a.preselect)return s}return 0}}class wX extends ZF{constructor(){super("first")}memorize(e,t,i){}toJSON(){}fromJSON(){}}class fIe extends ZF{constructor(){super("recentlyUsed"),this._cache=new dl(300,.66),this._seq=0}memorize(e,t,i){const n=`${e.getLanguageId()}/${i.textLabel}`;this._cache.set(n,{touch:this._seq++,type:i.completion.kind,insertText:i.completion.insertText})}select(e,t,i){if(i.length===0)return 0;const n=e.getLineContent(t.lineNumber).substr(t.column-10,t.column-1);if(/\s$/.test(n))return super.select(e,t,i);const s=i[0].score[0];let r=-1,a=-1,l=-1;for(let c=0;c<i.length&&i[c].score[0]===s;c++){const d=`${e.getLanguageId()}/${i[c].textLabel}`,h=this._cache.peek(d);if(h&&h.touch>l&&h.type===i[c].completion.kind&&h.insertText===i[c].completion.insertText&&(l=h.touch,a=c),i[c].completion.preselect&&r===-1)return r=c}return a!==-1?a:r!==-1?r:0}toJSON(){return this._cache.toJSON()}fromJSON(e){this._cache.clear();const t=0;for(const[i,n]of e)n.touch=t,n.type=typeof n.type=="number"?n.type:S_.fromString(n.type),this._cache.set(i,n);this._seq=this._cache.size}}class gIe extends ZF{constructor(){super("recentlyUsedByPrefix"),this._trie=eb.forStrings(),this._seq=0}memorize(e,t,i){const{word:n}=e.getWordUntilPosition(t),s=`${e.getLanguageId()}/${n}`;this._trie.set(s,{type:i.completion.kind,insertText:i.completion.insertText,touch:this._seq++})}select(e,t,i){const{word:n}=e.getWordUntilPosition(t);if(!n)return super.select(e,t,i);const s=`${e.getLanguageId()}/${n}`;let r=this._trie.get(s);if(r||(r=this._trie.findSubstr(s)),r)for(let a=0;a<i.length;a++){const{kind:l,insertText:c}=i[a].completion;if(l===r.type&&c===r.insertText)return a}return super.select(e,t,i)}toJSON(){const e=[];return this._trie.forEach((t,i)=>e.push([i,t])),e.sort((t,i)=>-(t[1].touch-i[1].touch)).forEach((t,i)=>t[1].touch=i),e.slice(0,200)}fromJSON(e){if(this._trie.clear(),e.length>0){this._seq=e[0][1].touch+1;for(const[t,i]of e)i.type=typeof i.type=="number"?i.type:S_.fromString(i.type),this._trie.set(t,i)}}}let YF=(Ou=class{constructor(e,t){this._storageService=e,this._configService=t,this._disposables=new U,this._persistSoon=new wt(()=>this._saveState(),500),this._disposables.add(e.onWillSaveState(i=>{i.reason===zh.SHUTDOWN&&this._saveState()}))}dispose(){this._disposables.dispose(),this._persistSoon.dispose()}memorize(e,t,i){this._withStrategy(e,t).memorize(e,t,i),this._persistSoon.schedule()}select(e,t,i){return this._withStrategy(e,t).select(e,t,i)}_withStrategy(e,t){const i=this._configService.getValue("editor.suggestSelection",{overrideIdentifier:e.getLanguageIdAtPosition(t.lineNumber,t.column),resource:e.uri});if(this._strategy?.name!==i){this._saveState();const n=_0._strategyCtors.get(i)||wX;this._strategy=new n;try{const r=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,a=this._storageService.get(`${_0._storagePrefix}/${i}`,r);a&&this._strategy.fromJSON(JSON.parse(a))}catch{}}return this._strategy}_saveState(){if(this._strategy){const t=this._configService.getValue("editor.suggest.shareSuggestSelections")?0:1,i=JSON.stringify(this._strategy);this._storageService.store(`${_0._storagePrefix}/${this._strategy.name}`,i,t,1)}}},_0=Ou,Ou._strategyCtors=new Map([["recentlyUsedByPrefix",gIe],["recentlyUsed",fIe],["first",wX]]),Ou._storagePrefix="suggest/memories",Ou);YF=_0=uIe([vX(0,Es),vX(1,Me)],YF);const uD=We("ISuggestMemories");je(uD,YF,1);var pIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mIe=function(o,e){return function(t,i){e(t,i,o)}},XF;let fD=(Qp=class{constructor(e,t){this._editor=e,this._enabled=!1,this._ckAtEnd=XF.AtEnd.bindTo(t),this._configListener=this._editor.onDidChangeConfiguration(i=>i.hasChanged(139)&&this._update()),this._update()}dispose(){this._configListener.dispose(),this._selectionListener?.dispose(),this._ckAtEnd.reset()}_update(){const e=this._editor.getOption(139)==="on";if(this._enabled!==e)if(this._enabled=e,this._enabled){const t=()=>{if(!this._editor.hasModel()){this._ckAtEnd.set(!1);return}const i=this._editor.getModel(),n=this._editor.getSelection(),s=i.getWordAtPosition(n.getStartPosition());if(!s){this._ckAtEnd.set(!1);return}this._ckAtEnd.set(s.endColumn===n.getStartPosition().column&&n.getStartPosition().lineNumber===n.getEndPosition().lineNumber)};this._selectionListener=this._editor.onDidChangeCursorSelection(t),t()}else this._selectionListener&&(this._ckAtEnd.reset(),this._selectionListener.dispose(),this._selectionListener=void 0)}},XF=Qp,Qp.AtEnd=new ae("atEndOfWord",!1,{type:"boolean",description:p(1479,"A context key that is true when at the end of a word. Note that this is only defined when tab-completions are enabled")}),Qp);fD=XF=pIe([mIe(1,xe)],fD);var _Ie=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bIe=function(o,e){return function(t,i){e(t,i,o)}},b0;let Rb=(Jp=class{constructor(e,t){this._editor=e,this._index=0,this._ckOtherSuggestions=b0.OtherSuggestions.bindTo(t)}dispose(){this.reset()}reset(){this._ckOtherSuggestions.reset(),this._listener?.dispose(),this._model=void 0,this._acceptNext=void 0,this._ignore=!1}set({model:e,index:t},i){if(e.items.length===0){this.reset();return}if(b0._moveIndex(!0,e,t)===t){this.reset();return}this._acceptNext=i,this._model=e,this._index=t,this._listener=this._editor.onDidChangeCursorPosition(()=>{this._ignore||this.reset()}),this._ckOtherSuggestions.set(!0)}static _moveIndex(e,t,i){let n=i;for(let s=t.items.length;s>0&&(n=(n+t.items.length+(e?1:-1))%t.items.length,!(n===i||!t.items[n].completion.additionalTextEdits));s--);return n}next(){this._move(!0)}prev(){this._move(!1)}_move(e){if(this._model)try{this._ignore=!0,this._index=b0._moveIndex(e,this._model,this._index),this._acceptNext({index:this._index,item:this._model.items[this._index],model:this._model})}finally{this._ignore=!1}}},b0=Jp,Jp.OtherSuggestions=new ae("hasOtherSuggestions",!1),Jp);Rb=b0=_Ie([bIe(1,xe)],Rb);class CIe{constructor(e,t,i,n){this._disposables=new U,this._disposables.add(i.onDidSuggest(s=>{s.completionModel.items.length===0&&this.reset()})),this._disposables.add(i.onDidCancel(s=>{this.reset()})),this._disposables.add(t.onDidShow(()=>this._onItem(t.getFocusedItem()))),this._disposables.add(t.onDidFocus(this._onItem,this)),this._disposables.add(t.onDidHide(this.reset,this)),this._disposables.add(e.onWillType(s=>{if(this._active&&!t.isFrozen()&&i.state!==0){const r=s.charCodeAt(s.length-1);this._active.acceptCharacters.has(r)&&e.getOption(0)&&n(this._active.item)}}))}_onItem(e){if(!e||!is(e.item.completion.commitCharacters)){this.reset();return}if(this._active&&this._active.item.item===e.item)return;const t=new Ky;for(const i of e.item.completion.commitCharacters)i.length>0&&t.add(i.charCodeAt(0));this._active={acceptCharacters:t,item:e}}reset(){this._active=void 0}dispose(){this._disposables.dispose()}}const $r=class $r{async provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s);const r=new Map;await new Promise(a=>$r._bracketsRightYield(a,0,e,n,r)),await new Promise(a=>$r._bracketsLeftYield(a,0,e,n,r,s))}return i}static _bracketsRightYield(e,t,i,n,s){const r=new Map,a=Date.now();for(;;){if(t>=$r._maxRounds){e();break}if(!n){e();break}const l=i.bracketPairs.findNextBracket(n);if(!l){e();break}if(Date.now()-a>$r._maxDuration){setTimeout(()=>$r._bracketsRightYield(e,t+1,i,n,s));break}if(l.bracketInfo.isOpeningBracket){const d=l.bracketInfo.bracketText,h=r.has(d)?r.get(d):0;r.set(d,h+1)}else{const d=l.bracketInfo.getOpeningBrackets()[0].bracketText;let h=r.has(d)?r.get(d):0;if(h-=1,r.set(d,Math.max(0,h)),h<0){let u=s.get(d);u||(u=new Jn,s.set(d,u)),u.push(l.range)}}n=l.range.getEndPosition()}}static _bracketsLeftYield(e,t,i,n,s,r){const a=new Map,l=Date.now();for(;;){if(t>=$r._maxRounds&&s.size===0){e();break}if(!n){e();break}const c=i.bracketPairs.findPrevBracket(n);if(!c){e();break}if(Date.now()-l>$r._maxDuration){setTimeout(()=>$r._bracketsLeftYield(e,t+1,i,n,s,r));break}if(c.bracketInfo.isOpeningBracket){const h=c.bracketInfo.bracketText;let u=a.has(h)?a.get(h):0;if(u-=1,a.set(h,Math.max(0,u)),u<0){const f=s.get(h);if(f){const g=f.shift();f.size===0&&s.delete(h);const m=k.fromPositions(c.range.getEndPosition(),g.getStartPosition()),_=k.fromPositions(c.range.getStartPosition(),g.getEndPosition());r.push({range:m}),r.push({range:_}),$r._addBracketLeading(i,_,r)}}}else{const h=c.bracketInfo.getOpeningBrackets()[0].bracketText,u=a.has(h)?a.get(h):0;a.set(h,u+1)}n=c.range.getStartPosition()}}static _addBracketLeading(e,t,i){if(t.startLineNumber===t.endLineNumber)return;const n=t.startLineNumber,s=e.getLineFirstNonWhitespaceColumn(n);s!==0&&s!==t.startColumn&&(i.push({range:k.fromPositions(new M(n,s),t.getEndPosition())}),i.push({range:k.fromPositions(new M(n,1),t.getEndPosition())}));const r=n-1;if(r>0){const a=e.getLineFirstNonWhitespaceColumn(r);a===t.startColumn&&a!==e.getLineLastNonWhitespaceColumn(r)&&(i.push({range:k.fromPositions(new M(r,a),t.getEndPosition())}),i.push({range:k.fromPositions(new M(r,1),t.getEndPosition())}))}}};$r._maxDuration=30,$r._maxRounds=2;let gD=$r;const gc=class gc{static async create(e,t){if(!t.getOption(134).localityBonus||!t.hasModel())return gc.None;const i=t.getModel(),n=t.getPosition();if(!e.canComputeWordRanges(i.uri))return gc.None;const[s]=await new gD().provideSelectionRanges(i,[n]);if(s.length===0)return gc.None;const r=await e.computeWordRanges(i.uri,s[0].range);if(!r)return gc.None;const a=i.getWordUntilPosition(n);return delete r[a.word],new class extends gc{distance(l,c){if(!n.equals(t.getPosition()))return 0;if(c.kind===17)return 2<<20;const d=typeof c.label=="string"?c.label:c.label.label,h=r[d];if(E6(h))return 2<<20;const u=py(h,k.fromPositions(l),k.compareRangesUsingStarts),f=u>=0?h[u]:h[Math.max(0,~u-1)];let g=s.length;for(const m of s){if(!k.containsRange(m.range,f))break;g-=1}return g}}}};gc.None=new class extends gc{distance(){return 0}};let pD=gc,SX=class{constructor(e,t){this.leadingLineContent=e,this.characterCountDelta=t}};class ou{constructor(e,t,i,n,s,r,a=zv.default,l=void 0){this.clipboardText=l,this._snippetCompareFn=ou._compareCompletionItems,this._items=e,this._column=t,this._wordDistance=n,this._options=s,this._refilterKind=1,this._lineContext=i,this._fuzzyScoreOptions=a,r==="top"?this._snippetCompareFn=ou._compareCompletionItemsSnippetsUp:r==="bottom"&&(this._snippetCompareFn=ou._compareCompletionItemsSnippetsDown)}get lineContext(){return this._lineContext}set lineContext(e){(this._lineContext.leadingLineContent!==e.leadingLineContent||this._lineContext.characterCountDelta!==e.characterCountDelta)&&(this._refilterKind=this._lineContext.characterCountDelta<e.characterCountDelta&&this._filteredItems?2:1,this._lineContext=e)}get items(){return this._ensureCachedState(),this._filteredItems}getItemsByProvider(){return this._ensureCachedState(),this._itemsByProvider}getIncompleteProvider(){this._ensureCachedState();const e=new Set;for(const[t,i]of this.getItemsByProvider())i.length>0&&i[0].container.incomplete&&e.add(t);return e}get stats(){return this._ensureCachedState(),this._stats}_ensureCachedState(){this._refilterKind!==0&&this._createCachedState()}_createCachedState(){this._itemsByProvider=new Map;const e=[],{leadingLineContent:t,characterCountDelta:i}=this._lineContext;let n="",s="";const r=this._refilterKind===1?this._items:this._filteredItems,a=[],l=!this._options.filterGraceful||r.length>2e3?lg:jme;for(let c=0;c<r.length;c++){const d=r[c];if(d.isInvalid)continue;const h=this._itemsByProvider.get(d.provider);h?h.push(d):this._itemsByProvider.set(d.provider,[d]);const u=d.position.column-d.editStart.column,f=u+i-(d.position.column-this._column);if(n.length!==f&&(n=f===0?"":t.slice(-f),s=n.toLowerCase()),d.word=n,f===0)d.score=Jr.Default;else{let g=0;for(;g<u;){const m=n.charCodeAt(g);if(m===32||m===9)g+=1;else break}if(g>=f)d.score=Jr.Default;else if(typeof d.completion.filterText=="string"){const m=l(n,s,g,d.completion.filterText,d.filterTextLow,0,this._fuzzyScoreOptions);if(!m)continue;mR(d.completion.filterText,d.textLabel)===0?d.score=m:(d.score=Vme(n,s,g,d.textLabel,d.labelLow,0),d.score[0]=m[0])}else{const m=l(n,s,g,d.textLabel,d.labelLow,0,this._fuzzyScoreOptions);if(!m)continue;d.score=m}}d.idx=c,d.distance=this._wordDistance.distance(d.position,d.completion),a.push(d),e.push(d.textLabel.length)}this._filteredItems=a.sort(this._snippetCompareFn),this._refilterKind=0,this._stats={pLabelLen:e.length?WR(e.length-.85,e,(c,d)=>c-d):0}}static _compareCompletionItems(e,t){return e.score[0]>t.score[0]?-1:e.score[0]<t.score[0]?1:e.distance<t.distance?-1:e.distance>t.distance?1:e.idx<t.idx?-1:e.idx>t.idx?1:0}static _compareCompletionItemsSnippetsDown(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return 1;if(t.completion.kind===28)return-1}return ou._compareCompletionItems(e,t)}static _compareCompletionItemsSnippetsUp(e,t){if(e.completion.kind!==t.completion.kind){if(e.completion.kind===28)return-1;if(t.completion.kind===28)return 1}return ou._compareCompletionItems(e,t)}}var vIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ru=function(o,e){return function(t,i){e(t,i,o)}},QF;class Xg{static shouldAutoTrigger(e){if(!e.hasModel())return!1;const t=e.getModel(),i=e.getPosition();t.tokenization.tokenizeIfCheap(i.lineNumber);const n=t.getWordAtPosition(i);return!(!n||n.endColumn!==i.column&&n.startColumn+1!==i.column||!isNaN(Number(n.word)))}constructor(e,t,i){this.leadingLineContent=e.getLineContent(t.lineNumber).substr(0,t.column-1),this.leadingWord=e.getWordUntilPosition(t),this.lineNumber=t.lineNumber,this.column=t.column,this.triggerOptions=i}}function wIe(o,e,t){if(!e.getContextKeyValue(Lt.inlineSuggestionVisible.key))return!0;const i=e.getContextKeyValue(Lt.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(71).suppressSuggestions}function SIe(o,e,t){if(!e.getContextKeyValue("inlineSuggestionVisible"))return!0;const i=e.getContextKeyValue(Lt.suppressSuggestions.key);return i!==void 0?!i:!o.getOption(71).suppressSuggestions}let mD=QF=class{constructor(e,t,i,n,s,r,a,l,c){this._editor=e,this._editorWorkerService=t,this._clipboardService=i,this._telemetryService=n,this._logService=s,this._contextKeyService=r,this._configurationService=a,this._languageFeaturesService=l,this._envService=c,this._toDispose=new U,this._triggerCharacterListener=new U,this._triggerQuickSuggest=new No,this._triggerState=void 0,this._completionDisposables=new U,this._onDidCancel=new P,this._onDidTrigger=new P,this._onDidSuggest=new P,this.onDidCancel=this._onDidCancel.event,this.onDidTrigger=this._onDidTrigger.event,this.onDidSuggest=this._onDidSuggest.event,this._currentSelection=this._editor.getSelection()||new ce(1,1,1,1),this._toDispose.add(this._editor.onDidChangeModel(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeModelLanguage(()=>{this._updateTriggerCharacters(),this.cancel()})),this._toDispose.add(this._editor.onDidChangeConfiguration(()=>{this._updateTriggerCharacters()})),this._toDispose.add(this._languageFeaturesService.completionProvider.onDidChange(()=>{this._updateTriggerCharacters(),this._updateActiveSuggestSession()}));let d=!1;this._toDispose.add(this._editor.onDidCompositionStart(()=>{d=!0})),this._toDispose.add(this._editor.onDidCompositionEnd(()=>{d=!1,this._onCompositionEnd()})),this._toDispose.add(this._editor.onDidChangeCursorSelection(h=>{d||this._onCursorChange(h)})),this._toDispose.add(this._editor.onDidChangeModelContent(()=>{!d&&this._triggerState!==void 0&&this._refilterCompletionItems()})),this._updateTriggerCharacters()}dispose(){pt(this._triggerCharacterListener),pt([this._onDidCancel,this._onDidSuggest,this._onDidTrigger,this._triggerQuickSuggest]),this._toDispose.dispose(),this._completionDisposables.dispose(),this.cancel()}_updateTriggerCharacters(){if(this._triggerCharacterListener.clear(),this._editor.getOption(104)||!this._editor.hasModel()||!this._editor.getOption(137))return;const e=new Map;for(const i of this._languageFeaturesService.completionProvider.all(this._editor.getModel()))for(const n of i.triggerCharacters||[]){let s=e.get(n);s||(s=new Set,e.set(n,s)),s.add(i)}const t=i=>{if(!SIe(this._editor,this._contextKeyService,this._configurationService)||Xg.shouldAutoTrigger(this._editor))return;if(!i){const r=this._editor.getPosition();i=this._editor.getModel().getLineContent(r.lineNumber).substr(0,r.column-1)}let n="";eh(i.charCodeAt(i.length-1))?zi(i.charCodeAt(i.length-2))&&(n=i.substr(i.length-2)):n=i.charAt(i.length-1);const s=e.get(n);if(s){const r=new Map;if(this._completionModel)for(const[a,l]of this._completionModel.getItemsByProvider())s.has(a)||r.set(a,l);this.trigger({auto:!0,triggerKind:1,triggerCharacter:n,retrigger:!!this._completionModel,clipboardText:this._completionModel?.clipboardText,completionOptions:{providerFilter:s,providerItemsToReuse:r}})}};this._triggerCharacterListener.add(this._editor.onDidType(t)),this._triggerCharacterListener.add(this._editor.onDidCompositionEnd(()=>t()))}get state(){return this._triggerState?this._triggerState.auto?2:1:0}cancel(e=!1){this._triggerState!==void 0&&(this._triggerQuickSuggest.cancel(),this._requestToken?.cancel(),this._requestToken=void 0,this._triggerState=void 0,this._completionModel=void 0,this._context=void 0,this._onDidCancel.fire({retrigger:e}))}clear(){this._completionDisposables.clear()}_updateActiveSuggestSession(){this._triggerState!==void 0&&(!this._editor.hasModel()||!this._languageFeaturesService.completionProvider.has(this._editor.getModel())?this.cancel():this.trigger({auto:this._triggerState.auto,retrigger:!0}))}_onCursorChange(e){if(!this._editor.hasModel())return;const t=this._currentSelection;if(this._currentSelection=this._editor.getSelection(),!e.selection.isEmpty()||e.reason!==0&&e.reason!==3||e.source!=="keyboard"&&e.source!=="deleteLeft"){this.cancel();return}this._triggerState===void 0&&e.reason===0?(t.containsRange(this._currentSelection)||t.getEndPosition().isBeforeOrEqual(this._currentSelection.getPosition()))&&this._doTriggerQuickSuggest():this._triggerState!==void 0&&e.reason===3&&this._refilterCompletionItems()}_onCompositionEnd(){this._triggerState===void 0?this._doTriggerQuickSuggest():this._refilterCompletionItems()}_doTriggerQuickSuggest(){Eb.isAllOff(this._editor.getOption(102))||this._editor.getOption(134).snippetsPreventQuickSuggestions&&hs.get(this._editor)?.isInSnippet()||(this.cancel(),this._triggerQuickSuggest.cancelAndSet(()=>{if(this._triggerState!==void 0||!Xg.shouldAutoTrigger(this._editor)||!this._editor.hasModel()||!this._editor.hasWidgetFocus())return;const e=this._editor.getModel(),t=this._editor.getPosition(),i=this._editor.getOption(102);if(!Eb.isAllOff(i)){if(!Eb.isAllOn(i)){e.tokenization.tokenizeIfCheap(t.lineNumber);const n=e.tokenization.getLineTokens(t.lineNumber),s=n.getStandardTokenType(n.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Eb.valueFor(i,s)!=="on")return}wIe(this._editor,this._contextKeyService,this._configurationService)&&this._languageFeaturesService.completionProvider.has(e)&&this.trigger({auto:!0})}},this._editor.getOption(103)))}_refilterCompletionItems(){it(this._editor.hasModel()),it(this._triggerState!==void 0);const e=this._editor.getModel(),t=this._editor.getPosition(),i=new Xg(e,t,{...this._triggerState,refilter:!0});this._onNewContext(i)}trigger(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=new Xg(t,this._editor.getPosition(),e);this.cancel(e.retrigger),this._triggerState=e,this._onDidTrigger.fire({auto:e.auto,shy:e.shy??!1,position:this._editor.getPosition()}),this._context=i;let n={triggerKind:e.triggerKind??0};e.triggerCharacter&&(n={triggerKind:1,triggerCharacter:e.triggerCharacter}),this._requestToken=new Xt;const s=this._editor.getOption(128);let r=1;switch(s){case"top":r=0;break;case"bottom":r=2;break}const{itemKind:a,showDeprecated:l}=QF.createSuggestFilter(this._editor),c=new c0(r,e.completionOptions?.kindFilter??a,e.completionOptions?.providerFilter,e.completionOptions?.providerItemsToReuse,l),d=pD.create(this._editorWorkerService,this._editor),h=EF(this._languageFeaturesService.completionProvider,t,this._editor.getPosition(),c,n,this._requestToken.token);Promise.all([h,d]).then(async([u,f])=>{if(this._requestToken?.dispose(),!this._editor.hasModel()){u.disposable.dispose();return}let g=e?.clipboardText;if(!g&&u.needsClipboard&&(g=await this._clipboardService.readText()),this._triggerState===void 0){u.disposable.dispose();return}const m=this._editor.getModel(),_=new Xg(m,this._editor.getPosition(),e),b={...zv.default,firstMatchCanBeWeak:!this._editor.getOption(134).matchOnWordStartOnly};if(this._completionModel=new ou(u.items,this._context.column,{leadingLineContent:_.leadingLineContent,characterCountDelta:_.column-this._context.column},f,this._editor.getOption(134),this._editor.getOption(128),b,g),this._completionDisposables.add(u.disposable),this._onNewContext(_),this._reportDurationsTelemetry(u.durations),!this._envService.isBuilt||this._envService.isExtensionDevelopment)for(const C of u.items)C.isInvalid&&this._logService.warn(`[suggest] did IGNORE invalid completion item from ${C.provider._debugDisplayName}`,C.completion)}).catch(Ee)}_reportDurationsTelemetry(e){Math.random()>1e-4||setTimeout(()=>{this._telemetryService.publicLog2("suggest.durations.json",{data:JSON.stringify(e)}),this._logService.debug("suggest.durations.json",e)})}static createSuggestFilter(e){const t=new Set;e.getOption(128)==="none"&&t.add(28);const n=e.getOption(134);return n.showMethods||t.add(0),n.showFunctions||t.add(1),n.showConstructors||t.add(2),n.showFields||t.add(3),n.showVariables||t.add(4),n.showClasses||t.add(5),n.showStructs||t.add(6),n.showInterfaces||t.add(7),n.showModules||t.add(8),n.showProperties||t.add(9),n.showEvents||t.add(10),n.showOperators||t.add(11),n.showUnits||t.add(12),n.showValues||t.add(13),n.showConstants||t.add(14),n.showEnums||t.add(15),n.showEnumMembers||t.add(16),n.showKeywords||t.add(17),n.showWords||t.add(18),n.showColors||t.add(19),n.showFiles||t.add(20),n.showReferences||t.add(21),n.showColors||t.add(22),n.showFolders||t.add(23),n.showTypeParameters||t.add(24),n.showSnippets||t.add(28),n.showUsers||t.add(25),n.showIssues||t.add(26),{itemKind:t,showDeprecated:n.showDeprecated}}_onNewContext(e){if(this._context){if(e.lineNumber!==this._context.lineNumber){this.cancel();return}if(It(e.leadingLineContent)!==It(this._context.leadingLineContent)){this.cancel();return}if(e.column<this._context.column){e.leadingWord.word?this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0}):this.cancel();return}if(this._completionModel){if(e.leadingWord.word.length!==0&&e.leadingWord.startColumn>this._context.leadingWord.startColumn){if(Xg.shouldAutoTrigger(this._editor)&&this._context){const i=this._completionModel.getItemsByProvider();this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerItemsToReuse:i}})}return}if(e.column>this._context.column&&this._completionModel.getIncompleteProvider().size>0&&e.leadingWord.word.length!==0){const t=new Map,i=new Set;for(const[n,s]of this._completionModel.getItemsByProvider())s.length>0&&s[0].container.incomplete?i.add(n):t.set(n,s);this.trigger({auto:this._context.triggerOptions.auto,triggerKind:2,retrigger:!0,clipboardText:this._completionModel.clipboardText,completionOptions:{providerFilter:i,providerItemsToReuse:t}})}else{const t=this._completionModel.lineContext;let i=!1;if(this._completionModel.lineContext={leadingLineContent:e.leadingLineContent,characterCountDelta:e.column-this._context.column},this._completionModel.items.length===0){const n=Xg.shouldAutoTrigger(this._editor);if(!this._context){this.cancel();return}if(n&&this._context.leadingWord.endColumn<e.leadingWord.startColumn){this.trigger({auto:this._context.triggerOptions.auto,retrigger:!0});return}if(this._context.triggerOptions.auto){this.cancel();return}else if(this._completionModel.lineContext=t,i=this._completionModel.items.length>0,i&&e.leadingWord.word.length===0){this.cancel();return}}this._onDidSuggest.fire({completionModel:this._completionModel,triggerOptions:e.triggerOptions,isFrozen:i})}}}}};mD=QF=vIe([ru(1,Xs),ru(2,Wa),ru(3,Vn),ru(4,Rt),ru(5,xe),ru(6,Me),ru(7,he),ru(8,k4)],mD);const jN=class jN{constructor(e,t){this._disposables=new U,this._lastOvertyped=[],this._locked=!1,this._disposables.add(e.onWillType(()=>{if(this._locked||!e.hasModel())return;const i=e.getSelections(),n=i.length;let s=!1;for(let a=0;a<n;a++)if(!i[a].isEmpty()){s=!0;break}if(!s){this._lastOvertyped.length!==0&&(this._lastOvertyped.length=0);return}this._lastOvertyped=[];const r=e.getModel();for(let a=0;a<n;a++){const l=i[a];if(r.getValueLengthInRange(l)>jN._maxSelectionLength)return;this._lastOvertyped[a]={value:r.getValueInRange(l),multiline:l.startLineNumber!==l.endLineNumber}}})),this._disposables.add(t.onDidTrigger(i=>{this._locked=!0})),this._disposables.add(t.onDidCancel(i=>{this._locked=!1}))}getLastOvertypedInfo(e){if(e>=0&&e<this._lastOvertyped.length)return this._lastOvertyped[e]}dispose(){this._disposables.dispose()}};jN._maxSelectionLength=51200;let JF=jN;var yIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},e3=function(o,e){return function(t,i){e(t,i,o)}};let t3=class{constructor(e,t,i,n,s){this._menuId=t,this._menuService=n,this._contextKeyService=s,this._menuDisposables=new U,this.element=Z(e,Q(".suggest-status-bar"));const r=(a=>a instanceof Po?i.createInstance(EO,a,{useComma:!1}):void 0);this._leftActions=new Ys(this.element,{actionViewItemProvider:r}),this._rightActions=new Ys(this.element,{actionViewItemProvider:r}),this._leftActions.domNode.classList.add("left"),this._rightActions.domNode.classList.add("right")}dispose(){this._menuDisposables.dispose(),this._leftActions.dispose(),this._rightActions.dispose(),this.element.remove()}show(){const e=this._menuService.createMenu(this._menuId,this._contextKeyService),t=()=>{const i=[],n=[];for(const[s,r]of e.getActions())s==="left"?i.push(...r):n.push(...r);this._leftActions.clear(),this._leftActions.push(i),this._rightActions.clear(),this._rightActions.push(n)};this._menuDisposables.add(e.onDidChange(()=>t())),this._menuDisposables.add(e)}hide(){this._menuDisposables.clear()}};t3=yIe([e3(2,ge),e3(3,Cr),e3(4,xe)],t3);var LIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xIe=function(o,e){return function(t,i){e(t,i,o)}};function i3(o){return!!o&&!!(o.completion.documentation||o.completion.detail&&o.completion.detail!==o.completion.label)}let n3=class{constructor(e,t){this._editor=e,this._onDidClose=new P,this.onDidClose=this._onDidClose.event,this._onDidChangeContents=new P,this.onDidChangeContents=this._onDidChangeContents.event,this._disposables=new U,this._renderDisposeable=new U,this._borderWidth=1,this._size=new dt(330,0),this.domNode=Q(".suggest-details"),this.domNode.classList.add("no-docs"),this._markdownRenderer=t.createInstance(fd,{editor:e}),this._body=Q(".body"),this._scrollbar=new Q1(this._body,{alwaysConsumeMouseWheel:!0}),Z(this.domNode,this._scrollbar.getDomNode()),this._disposables.add(this._scrollbar),this._header=Z(this._body,Q(".header")),this._close=Z(this._header,Q("span"+ve.asCSSSelector(Y.close))),this._close.title=p(1475,"Close"),this._close.role="button",this._close.tabIndex=-1,this._type=Z(this._header,Q("p.type")),this._docs=Z(this._body,Q("p.docs")),this._configureFont(),this._disposables.add(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(59)&&this._configureFont()}))}dispose(){this._disposables.dispose(),this._renderDisposeable.dispose()}_configureFont(){const e=this._editor.getOptions(),t=e.get(59),i=t.getMassagedFontFamily(),n=e.get(135)||t.fontSize,s=e.get(136)||t.lineHeight,r=t.fontWeight,a=`${n}px`,l=`${s}px`;this.domNode.style.fontSize=a,this.domNode.style.lineHeight=`${s/n}`,this.domNode.style.fontWeight=r,this.domNode.style.fontFeatureSettings=t.fontFeatureSettings,this._type.style.fontFamily=i,this._close.style.height=l,this._close.style.width=l}getLayoutInfo(){const e=this._editor.getOption(136)||this._editor.getOption(59).lineHeight,t=this._borderWidth,i=t*2;return{lineHeight:e,borderWidth:t,borderHeight:i,verticalPadding:22,horizontalPadding:14}}renderLoading(){this._type.textContent=p(1476,"Loading..."),this._docs.textContent="",this.domNode.classList.remove("no-docs","no-type"),this.layout(this.size.width,this.getLayoutInfo().lineHeight*2),this._onDidChangeContents.fire(this)}renderItem(e,t){this._renderDisposeable.clear();let{detail:i,documentation:n}=e.completion;if(t){let s="";s+=`score: ${e.score[0]}
`,s+=`prefix: ${e.word??"(no prefix)"}
`,s+=`word: ${e.completion.filterText?e.completion.filterText+" (filterText)":e.textLabel}
`,s+=`distance: ${e.distance} (localityBonus-setting)
`,s+=`index: ${e.idx}, based on ${e.completion.sortText&&`sortText: "${e.completion.sortText}"`||"label"}
`,s+=`commit_chars: ${e.completion.commitCharacters?.join("")}
`,n=new qn().appendCodeblock("empty",s),i=`Provider: ${e.provider._debugDisplayName}`}if(!t&&!i3(e)){this.clearContents();return}if(this.domNode.classList.remove("no-docs","no-type"),i){const s=i.length>1e5?`${i.substr(0,1e5)}…`:i;this._type.textContent=s,this._type.title=s,uo(this._type),this._type.classList.toggle("auto-wrap",!/\r?\n^\s+/gmi.test(s))}else pn(this._type),this._type.title="",gs(this._type),this.domNode.classList.add("no-type");if(pn(this._docs),typeof n=="string")this._docs.classList.remove("markdown-docs"),this._docs.textContent=n;else if(n){this._docs.classList.add("markdown-docs"),pn(this._docs);const s=this._markdownRenderer.render(n,{asyncRenderCallback:()=>{this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}});this._docs.appendChild(s.element),this._renderDisposeable.add(s)}this.domNode.classList.toggle("detail-and-doc",!!i&&!!n),this.domNode.style.userSelect="text",this.domNode.tabIndex=-1,this._close.onmousedown=s=>{s.preventDefault(),s.stopPropagation()},this._close.onclick=s=>{s.preventDefault(),s.stopPropagation(),this._onDidClose.fire()},this._body.scrollTop=0,this.layout(this._size.width,this._type.clientHeight+this._docs.clientHeight),this._onDidChangeContents.fire(this)}clearContents(){this.domNode.classList.add("no-docs"),this._type.textContent="",this._docs.textContent=""}get isEmpty(){return this.domNode.classList.contains("no-docs")}get size(){return this._size}layout(e,t){const i=new dt(e,t);dt.equals(i,this._size)||(this._size=i,ese(this.domNode,e,t)),this._scrollbar.scanDomNode()}scrollDown(e=8){this._body.scrollTop+=e}scrollUp(e=8){this._body.scrollTop-=e}scrollTop(){this._body.scrollTop=0}scrollBottom(){this._body.scrollTop=this._body.scrollHeight}pageDown(){this.scrollDown(80)}pageUp(){this.scrollUp(80)}set borderWidth(e){this._borderWidth=e}get borderWidth(){return this._borderWidth}focus(){this.domNode.focus()}};n3=LIe([xIe(1,ge)],n3);class kIe{constructor(e,t){this.widget=e,this._editor=t,this.allowEditorOverflow=!0,this._disposables=new U,this._added=!1,this._preferAlignAtTop=!0,this._resizable=new B4,this._resizable.domNode.classList.add("suggest-details-container"),this._resizable.domNode.appendChild(e.domNode),this._resizable.enableSashes(!1,!0,!0,!1);let i,n,s=0,r=0;this._disposables.add(this._resizable.onDidWillResize(()=>{i=this._topLeft,n=this._resizable.size})),this._disposables.add(this._resizable.onDidResize(a=>{if(i&&n){this.widget.layout(a.dimension.width,a.dimension.height);let l=!1;a.west&&(r=n.width-a.dimension.width,l=!0),a.north&&(s=n.height-a.dimension.height,l=!0),l&&this._applyTopLeft({top:i.top+s,left:i.left+r})}a.done&&(i=void 0,n=void 0,s=0,r=0,this._userSize=a.dimension)})),this._disposables.add(this.widget.onDidChangeContents(()=>{this._anchorBox&&this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,this._preferAlignAtTop)}))}dispose(){this._resizable.dispose(),this._disposables.dispose(),this.hide()}getId(){return"suggest.details"}getDomNode(){return this._resizable.domNode}getPosition(){return this._topLeft?{preference:this._topLeft}:null}show(){this._added||(this._editor.addOverlayWidget(this),this._added=!0)}hide(e=!1){this._resizable.clearSashHoverState(),this._added&&(this._editor.removeOverlayWidget(this),this._added=!1,this._anchorBox=void 0,this._topLeft=void 0),e&&(this._userSize=void 0,this.widget.clearContents())}placeAtAnchor(e,t){const i=e.getBoundingClientRect();this._anchorBox=i,this._preferAlignAtTop=t,this._placeAtAnchor(this._anchorBox,this._userSize??this.widget.size,t)}_placeAtAnchor(e,t,i){const n=rh(this.getDomNode().ownerDocument.body),s=this.widget.getLayoutInfo(),r=new dt(220,2*s.lineHeight),a=e.top,l=(function(){const S=n.width-(e.left+e.width+s.borderWidth+s.horizontalPadding),L=-s.borderWidth+e.left+e.width,x=new dt(S,n.height-e.top-s.borderHeight-s.verticalPadding),I=x.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:L,fit:S-t.width,maxSizeTop:x,maxSizeBottom:I,minSize:r.with(Math.min(S,r.width))}})(),c=(function(){const S=e.left-s.borderWidth-s.horizontalPadding,L=Math.max(s.horizontalPadding,e.left-t.width-s.borderWidth),x=new dt(S,n.height-e.top-s.borderHeight-s.verticalPadding),I=x.with(void 0,e.top+e.height-s.borderHeight-s.verticalPadding);return{top:a,left:L,fit:S-t.width,maxSizeTop:x,maxSizeBottom:I,minSize:r.with(Math.min(S,r.width))}})(),d=(function(){const S=e.left,L=-s.borderWidth+e.top+e.height,x=new dt(e.width-s.borderHeight,n.height-e.top-e.height-s.verticalPadding);return{top:L,left:S,fit:x.height-t.height,maxSizeBottom:x,maxSizeTop:x,minSize:r.with(x.width)}})(),h=[l,c,d],u=h.find(S=>S.fit>=0)??h.sort((S,L)=>L.fit-S.fit)[0],f=e.top+e.height-s.borderHeight;let g,m=t.height;const _=Math.max(u.maxSizeTop.height,u.maxSizeBottom.height);m>_&&(m=_);let b;i?m<=u.maxSizeTop.height?(g=!0,b=u.maxSizeTop):(g=!1,b=u.maxSizeBottom):m<=u.maxSizeBottom.height?(g=!1,b=u.maxSizeBottom):(g=!0,b=u.maxSizeTop);let{top:C,left:w}=u;!g&&m>e.height&&(C=f-m);const v=this._editor.getDomNode();if(v){const S=v.getBoundingClientRect();C-=S.top,w-=S.left}this._applyTopLeft({left:w,top:C}),this._resizable.enableSashes(!g,u===l,g,u!==l),this._resizable.minSize=u.minSize,this._resizable.maxSize=b,this._resizable.layout(m,Math.min(b.width,t.width)),this.widget.layout(this._resizable.size.width,this._resizable.size.height)}_applyTopLeft(e){this._topLeft=e,this._editor.layoutOverlayWidget(this)}}const yX=We("fileService");var Xl;(function(o){o[o.FILE=0]="FILE",o[o.FOLDER=1]="FOLDER",o[o.ROOT_FOLDER=2]="ROOT_FOLDER"})(Xl||(Xl={}));const IIe=/(?:\/|^)(?:([^\/]+)\/)?([^\/]+)$/;function _D(o,e,t,i,n){if(ve.isThemeIcon(n))return[`codicon-${n.id}`,"predefined-file-icon"];if(be.isUri(n))return[];const s=i===Xl.ROOT_FOLDER?["rootfolder-icon"]:i===Xl.FOLDER?["folder-icon"]:["file-icon"];if(t){let r;if(t.scheme===we.data)r=dh.parseMetaData(t).get(dh.META_DATA_LABEL);else{const a=t.path.match(IIe);a?(r=bD(a[2].toLowerCase()),a[1]&&s.push(`${bD(a[1].toLowerCase())}-name-dir-icon`)):r=bD(t.authority.toLowerCase())}if(i===Xl.ROOT_FOLDER)s.push(`${r}-root-name-folder-icon`);else if(i===Xl.FOLDER)s.push(`${r}-name-folder-icon`);else{if(r){if(s.push(`${r}-name-file-icon`),s.push("name-file-icon"),r.length<=255){const l=r.split(".");for(let c=1;c<l.length;c++)s.push(`${l.slice(c).join(".")}-ext-file-icon`)}s.push("ext-file-icon")}const a=DIe(o,e,t);a&&s.push(`${bD(a)}-lang-file-icon`)}}return s}function DIe(o,e,t){if(!t)return null;let i=null;if(t.scheme===we.data){const s=dh.parseMetaData(t).get(dh.META_DATA_MIME);s&&(i=e.getLanguageIdByMimeType(s))}else{const n=o.getModel(t);n&&(i=n.getLanguageId())}return i&&i!==Fo?i:e.guessLanguageIdByFilepathOrFirstLine(t)}function bD(o){return o.replace(/[\s]/g,"/")}var EIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},s3=function(o,e){return function(t,i){e(t,i,o)}};const NIe=Wt("suggest-more-info",Y.chevronRight,p(1477,"Icon for more information in the suggest widget.")),TIe=new(il=class{extract(e,t){if(e.textLabel.match(il._regexStrict))return t[0]=e.textLabel,!0;if(e.completion.detail&&e.completion.detail.match(il._regexStrict))return t[0]=e.completion.detail,!0;if(e.completion.documentation){const i=typeof e.completion.documentation=="string"?e.completion.documentation:e.completion.documentation.value,n=il._regexRelaxed.exec(i);if(n&&(n.index===0||n.index+n[0].length===i.length))return t[0]=n[0],!0}return!1}},il._regexRelaxed=/(#([\da-fA-F]{3}){1,2}|(rgb|hsl)a\(\s*(\d{1,3}%?\s*,\s*){3}(1|0?\.\d+)\)|(rgb|hsl)\(\s*\d{1,3}%?(\s*,\s*\d{1,3}%?){2}\s*\))/,il._regexStrict=new RegExp(`^${il._regexRelaxed.source}$`,"i"),il);let o3=class{constructor(e,t,i,n){this._editor=e,this._modelService=t,this._languageService=i,this._themeService=n,this._onDidToggleDetails=new P,this.onDidToggleDetails=this._onDidToggleDetails.event,this.templateId="suggestion"}dispose(){this._onDidToggleDetails.dispose()}renderTemplate(e){const t=new U,i=e;i.classList.add("show-file-icons");const n=Z(e,Q(".icon")),s=Z(n,Q("span.colorspan")),r=Z(e,Q(".contents")),a=Z(r,Q(".main")),l=Z(a,Q(".icon-label.codicon")),c=Z(a,Q("span.left")),d=Z(a,Q("span.right")),h=new qw(c,{supportHighlights:!0,supportIcons:!0});t.add(h);const u=Z(c,Q("span.signature-label")),f=Z(c,Q("span.qualifier-label")),g=Z(d,Q("span.details-label")),m=Z(d,Q("span.readMore"+ve.asCSSSelector(NIe)));return m.title=p(1478,"Read More"),{root:i,left:c,right:d,icon:n,colorspan:s,iconLabel:h,iconContainer:l,parametersLabel:u,qualifierLabel:f,detailsLabel:g,readMore:m,disposables:t,configureFont:()=>{const b=this._editor.getOptions(),C=b.get(59),w=C.getMassagedFontFamily(),v=C.fontFeatureSettings,S=C.fontVariationSettings,L=b.get(135)||C.fontSize,x=b.get(136)||C.lineHeight,I=C.fontWeight,D=C.letterSpacing,R=`${L}px`,F=`${x}px`,O=`${D}px`;i.style.fontSize=R,i.style.fontWeight=I,i.style.letterSpacing=O,a.style.fontFamily=w,a.style.fontFeatureSettings=v,a.style.fontVariationSettings=S,a.style.lineHeight=F,n.style.height=F,n.style.width=F,m.style.height=F,m.style.width=F}}}renderElement(e,t,i){i.configureFont();const{completion:n}=e;i.colorspan.style.backgroundColor="";const s={labelEscapeNewLines:!0,matches:Vv(e.score)},r=[];if(n.kind===19&&TIe.extract(e,r))i.icon.className="icon customcolor",i.iconContainer.className="icon hide",i.colorspan.style.backgroundColor=r[0];else if(n.kind===20&&this._themeService.getFileIconTheme().hasFileIcons){i.icon.className="icon hide",i.iconContainer.className="icon hide";const a=_D(this._modelService,this._languageService,be.from({scheme:"fake",path:e.textLabel}),Xl.FILE),l=_D(this._modelService,this._languageService,be.from({scheme:"fake",path:n.detail}),Xl.FILE);s.extraClasses=a.length>l.length?a:l}else n.kind===23&&this._themeService.getFileIconTheme().hasFolderIcons?(i.icon.className="icon hide",i.iconContainer.className="icon hide",s.extraClasses=[_D(this._modelService,this._languageService,be.from({scheme:"fake",path:e.textLabel}),Xl.FOLDER),_D(this._modelService,this._languageService,be.from({scheme:"fake",path:n.detail}),Xl.FOLDER)].flat()):(i.icon.className="icon hide",i.iconContainer.className="",i.iconContainer.classList.add("suggest-icon",...ve.asClassNameArray(S_.toIcon(n.kind))));n.tags&&n.tags.indexOf(1)>=0&&(s.extraClasses=(s.extraClasses||[]).concat(["deprecated"]),s.matches=[]),i.iconLabel.setLabel(e.textLabel,void 0,s),typeof n.label=="string"?(i.parametersLabel.textContent="",i.detailsLabel.textContent=r3(n.detail||""),i.root.classList.add("string-label")):(i.parametersLabel.textContent=r3(n.label.detail||""),i.detailsLabel.textContent=r3(n.label.description||""),i.root.classList.remove("string-label")),this._editor.getOption(134).showInlineDetails?uo(i.detailsLabel):gs(i.detailsLabel),i3(e)?(i.right.classList.add("can-expand-details"),uo(i.readMore),i.readMore.onmousedown=a=>{a.stopPropagation(),a.preventDefault()},i.readMore.onclick=a=>{a.stopPropagation(),a.preventDefault(),this._onDidToggleDetails.fire()}):(i.right.classList.remove("can-expand-details"),gs(i.readMore),i.readMore.onmousedown=null,i.readMore.onclick=null)}disposeTemplate(e){e.disposables.dispose()}};o3=EIe([s3(1,Qt),s3(2,Mt),s3(3,li)],o3);function r3(o){return o.replace(/\r\n|\r|\n/g,"")}var RIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CD=function(o,e){return function(t,i){e(t,i,o)}},Mb;N("editorSuggestWidget.background",Ho,p(1458,"Background color of the suggest widget.")),N("editorSuggestWidget.border",tM,p(1459,"Border color of the suggest widget."));const MIe=N("editorSuggestWidget.foreground",bl,p(1460,"Foreground color of the suggest widget."));N("editorSuggestWidget.selectedForeground",q1,p(1461,"Foreground color of the selected entry in the suggest widget.")),N("editorSuggestWidget.selectedIconForeground",wM,p(1462,"Icon foreground color of the selected entry in the suggest widget."));const PIe=N("editorSuggestWidget.selectedBackground",K1,p(1463,"Background color of the selected entry in the suggest widget."));N("editorSuggestWidget.highlightForeground",d_,p(1464,"Color of the match highlights in the suggest widget.")),N("editorSuggestWidget.focusHighlightForeground",sce,p(1465,"Color of the match highlights in the suggest widget when an item is focused.")),N("editorSuggestWidgetStatus.foreground",Ne(MIe,.5),p(1466,"Foreground color of the suggest widget status."));class AIe{constructor(e,t){this._service=e,this._key=`suggestWidget.size/${t.getEditorType()}/${t instanceof Cd}`}restore(){const e=this._service.get(this._key,0)??"";try{const t=JSON.parse(e);if(dt.is(t))return dt.lift(t)}catch{}}store(e){this._service.store(this._key,JSON.stringify(e),0,1)}reset(){this._service.remove(this._key,0)}}let a3=(Fu=class{constructor(e,t,i,n,s){this.editor=e,this._storageService=t,this._state=0,this._isAuto=!1,this._pendingLayout=new ct,this._pendingShowDetails=new ct,this._ignoreFocusEvents=!1,this._forceRenderingAbove=!1,this._explainMode=!1,this._showTimeout=new No,this._disposables=new U,this._onDidSelect=new Qu,this._onDidFocus=new Qu,this._onDidHide=new P,this._onDidShow=new P,this.onDidSelect=this._onDidSelect.event,this.onDidFocus=this._onDidFocus.event,this.onDidHide=this._onDidHide.event,this.onDidShow=this._onDidShow.event,this._onDetailsKeydown=new P,this.onDetailsKeyDown=this._onDetailsKeydown.event,this.element=new B4,this.element.domNode.classList.add("editor-widget","suggest-widget"),this._contentWidget=new OIe(this,e),this._persistedSize=new AIe(t,e);class r{constructor(f,g,m=!1,_=!1){this.persistedSize=f,this.currentSize=g,this.persistHeight=m,this.persistWidth=_}}let a;this._disposables.add(this.element.onDidWillResize(()=>{this._contentWidget.lockPreference(),a=new r(this._persistedSize.restore(),this.element.size)})),this._disposables.add(this.element.onDidResize(u=>{if(this._resize(u.dimension.width,u.dimension.height),a&&(a.persistHeight=a.persistHeight||!!u.north||!!u.south,a.persistWidth=a.persistWidth||!!u.east||!!u.west),!!u.done){if(a){const{itemHeight:f,defaultSize:g}=this.getLayoutInfo(),m=Math.round(f/2);let{width:_,height:b}=this.element.size;(!a.persistHeight||Math.abs(a.currentSize.height-b)<=m)&&(b=a.persistedSize?.height??g.height),(!a.persistWidth||Math.abs(a.currentSize.width-_)<=m)&&(_=a.persistedSize?.width??g.width),this._persistedSize.store(new dt(_,b))}this._contentWidget.unlockPreference(),a=void 0}})),this._messageElement=Z(this.element.domNode,Q(".message")),this._listElement=Z(this.element.domNode,Q(".tree"));const l=this._disposables.add(s.createInstance(n3,this.editor));l.onDidClose(()=>this.toggleDetails(),this,this._disposables),this._details=new kIe(l,this.editor);const c=()=>this.element.domNode.classList.toggle("no-icons",!this.editor.getOption(134).showIcons);c();const d=s.createInstance(o3,this.editor);this._disposables.add(d),this._disposables.add(d.onDidToggleDetails(()=>this.toggleDetails())),this._list=new jo("SuggestWidget",this._listElement,{getHeight:u=>this.getLayoutInfo().itemHeight,getTemplateId:u=>"suggestion"},[d],{alwaysConsumeMouseWheel:!0,useShadows:!1,mouseSupport:!1,multipleSelectionSupport:!1,accessibilityProvider:{getRole:()=>gn?"listitem":"option",getWidgetAriaLabel:()=>p(1469,"Suggest"),getWidgetRole:()=>"listbox",getAriaLabel:u=>{let f=u.textLabel;const g=S_.toLabel(u.completion.kind);if(typeof u.completion.label!="string"){const{detail:C,description:w}=u.completion.label;C&&w?f=p(1470,"{0} {1}, {2}, {3}",f,C,w,g):C?f=p(1471,"{0} {1}, {2}",f,C,g):w&&(f=p(1472,"{0}, {1}, {2}",f,w,g))}else f=p(1473,"{0}, {1}",f,g);if(!u.isResolved||!this._isDetailsVisible())return f;const{documentation:m,detail:_}=u.completion,b=tf("{0}{1}",_||"",m?typeof m=="string"?m:m.value:"");return p(1474,"{0}, docs: {1}",f,b)}}}),this._list.style(vg({listInactiveFocusBackground:PIe,listInactiveFocusOutline:jt})),this._status=s.createInstance(t3,this.element.domNode,su);const h=()=>this.element.domNode.classList.toggle("with-status-bar",this.editor.getOption(134).showStatusBar);h(),this._disposables.add(n.onDidColorThemeChange(u=>this._onThemeChange(u))),this._onThemeChange(n.getColorTheme()),this._disposables.add(this._list.onMouseDown(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onTap(u=>this._onListMouseDownOrTap(u))),this._disposables.add(this._list.onDidChangeSelection(u=>this._onListSelection(u))),this._disposables.add(this._list.onDidChangeFocus(u=>this._onListFocus(u))),this._disposables.add(this.editor.onDidChangeCursorSelection(()=>this._onCursorSelectionChanged())),this._disposables.add(this.editor.onDidChangeConfiguration(u=>{u.hasChanged(134)&&(h(),c()),this._completionModel&&(u.hasChanged(59)||u.hasChanged(135)||u.hasChanged(136))&&this._list.splice(0,this._list.length,this._completionModel.items)})),this._ctxSuggestWidgetVisible=Be.Visible.bindTo(i),this._ctxSuggestWidgetDetailsVisible=Be.DetailsVisible.bindTo(i),this._ctxSuggestWidgetMultipleSuggestions=Be.MultipleSuggestions.bindTo(i),this._ctxSuggestWidgetHasFocusedSuggestion=Be.HasFocusedSuggestion.bindTo(i),this._disposables.add(Si(this._details.widget.domNode,"keydown",u=>{this._onDetailsKeydown.fire(u)})),this._disposables.add(this.editor.onMouseDown(u=>this._onEditorMouseDown(u)))}dispose(){this._details.widget.dispose(),this._details.dispose(),this._list.dispose(),this._status.dispose(),this._disposables.dispose(),this._loadingTimeout?.dispose(),this._pendingLayout.dispose(),this._pendingShowDetails.dispose(),this._showTimeout.dispose(),this._contentWidget.dispose(),this.element.dispose()}_onEditorMouseDown(e){this._details.widget.domNode.contains(e.target.element)?this._details.widget.domNode.focus():this.element.domNode.contains(e.target.element)&&this.editor.focus()}_onCursorSelectionChanged(){this._state!==0&&this._contentWidget.layout()}_onListMouseDownOrTap(e){typeof e.element>"u"||typeof e.index>"u"||(e.browserEvent.preventDefault(),e.browserEvent.stopPropagation(),this._select(e.element,e.index))}_onListSelection(e){e.elements.length&&this._select(e.elements[0],e.indexes[0])}_select(e,t){const i=this._completionModel;i&&(this._onDidSelect.fire({item:e,index:t,model:i}),this.editor.focus())}_onThemeChange(e){this._details.widget.borderWidth=Ta(e.type)?2:1}_onListFocus(e){if(this._ignoreFocusEvents)return;if(this._state===5&&this._setState(3),!e.elements.length){this._currentSuggestionDetails&&(this._currentSuggestionDetails.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=void 0),this.editor.setAriaOptions({activeDescendant:void 0}),this._ctxSuggestWidgetHasFocusedSuggestion.set(!1);return}if(!this._completionModel)return;this._ctxSuggestWidgetHasFocusedSuggestion.set(!0);const t=e.elements[0],i=e.indexes[0];t!==this._focusedItem&&(this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._focusedItem=t,this._list.reveal(i),this._currentSuggestionDetails=Vi(async n=>{const s=yc(()=>{this._isDetailsVisible()&&this._showDetails(!0,!1)},250),r=n.onCancellationRequested(()=>s.dispose());try{return await t.resolve(n)}finally{s.dispose(),r.dispose()}}),this._currentSuggestionDetails.then(()=>{i>=this._list.length||t!==this._list.element(i)||(this._ignoreFocusEvents=!0,this._list.splice(i,1,[t]),this._list.setFocus([i]),this._ignoreFocusEvents=!1,this._isDetailsVisible()?this._showDetails(!1,!1):this.element.domNode.classList.remove("docs-side"),this.editor.setAriaOptions({activeDescendant:this._list.getElementID(i)}))}).catch(Ee)),this._onDidFocus.fire({item:t,index:i,model:this._completionModel})}_setState(e){if(this._state!==e)switch(this._state=e,this.element.domNode.classList.toggle("frozen",e===4),this.element.domNode.classList.remove("message"),e){case 0:gs(this._messageElement,this._listElement,this._status.element),this._details.hide(!0),this._status.hide(),this._contentWidget.hide(),this._ctxSuggestWidgetVisible.reset(),this._ctxSuggestWidgetMultipleSuggestions.reset(),this._ctxSuggestWidgetHasFocusedSuggestion.reset(),this._showTimeout.cancel(),this.element.domNode.classList.remove("visible"),this._list.splice(0,this._list.length),this._focusedItem=void 0,this._cappedHeight=void 0,this._explainMode=!1;break;case 1:this.element.domNode.classList.add("message"),this._messageElement.textContent=Mb.LOADING_MESSAGE,gs(this._listElement,this._status.element),uo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,cl(Mb.LOADING_MESSAGE);break;case 2:this.element.domNode.classList.add("message"),this._messageElement.textContent=Mb.NO_SUGGESTIONS_MESSAGE,gs(this._listElement,this._status.element),uo(this._messageElement),this._details.hide(),this._show(),this._focusedItem=void 0,cl(Mb.NO_SUGGESTIONS_MESSAGE);break;case 3:gs(this._messageElement),uo(this._listElement,this._status.element),this._show();break;case 4:gs(this._messageElement),uo(this._listElement,this._status.element),this._show();break;case 5:gs(this._messageElement),uo(this._listElement,this._status.element),this._details.show(),this._show(),this._details.widget.focus();break}}_show(){this._status.show(),this._contentWidget.show(),this._layout(this._persistedSize.restore()),this._ctxSuggestWidgetVisible.set(!0),this._showTimeout.cancelAndSet(()=>{this.element.domNode.classList.add("visible"),this._onDidShow.fire(this)},100)}showTriggered(e,t){this._state===0&&(this._contentWidget.setPosition(this.editor.getPosition()),this._isAuto=!!e,this._isAuto||(this._loadingTimeout=yc(()=>this._setState(1),t)))}showSuggestions(e,t,i,n,s){if(this._contentWidget.setPosition(this.editor.getPosition()),this._loadingTimeout?.dispose(),this._currentSuggestionDetails?.cancel(),this._currentSuggestionDetails=void 0,this._completionModel!==e&&(this._completionModel=e),i&&this._state!==2&&this._state!==0){this._setState(4);return}const r=this._completionModel.items.length,a=r===0;if(this._ctxSuggestWidgetMultipleSuggestions.set(r>1),a){this._setState(n?0:2),this._completionModel=void 0;return}this._focusedItem=void 0,this._onDidFocus.pause(),this._onDidSelect.pause();try{this._list.splice(0,this._list.length,this._completionModel.items),this._setState(i?4:3),this._list.reveal(t,0,t===0?0:this.getLayoutInfo().itemHeight*.33),this._list.setFocus(s?[]:[t])}finally{this._onDidFocus.resume(),this._onDidSelect.resume()}this._pendingLayout.value=yy(me(this.element.domNode),()=>{this._pendingLayout.clear(),this._layout(this.element.size),this._details.widget.domNode.classList.remove("focused")})}focusSelected(){this._list.length>0&&this._list.setFocus([0])}selectNextPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageDown(),!0;case 1:return!this._isAuto;default:return this._list.focusNextPage(),!0}}selectNext(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusNext(1,!0),!0}}selectLast(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollBottom(),!0;case 1:return!this._isAuto;default:return this._list.focusLast(),!0}}selectPreviousPage(){switch(this._state){case 0:return!1;case 5:return this._details.widget.pageUp(),!0;case 1:return!this._isAuto;default:return this._list.focusPreviousPage(),!0}}selectPrevious(){switch(this._state){case 0:return!1;case 1:return!this._isAuto;default:return this._list.focusPrevious(1,!0),!1}}selectFirst(){switch(this._state){case 0:return!1;case 5:return this._details.widget.scrollTop(),!0;case 1:return!this._isAuto;default:return this._list.focusFirst(),!0}}getFocusedItem(){if(this._state!==0&&this._state!==2&&this._state!==1&&this._completionModel&&this._list.getFocus().length>0)return{item:this._list.getFocusedElements()[0],index:this._list.getFocus()[0],model:this._completionModel}}toggleDetailsFocus(){this._state===5?(this._list.setFocus(this._list.getFocus()),this._setState(3)):this._state===3&&(this._setState(5),this._isDetailsVisible()?this._details.widget.focus():this.toggleDetails(!0))}toggleDetails(e=!1){this._isDetailsVisible()?(this._pendingShowDetails.clear(),this._ctxSuggestWidgetDetailsVisible.set(!1),this._setDetailsVisible(!1),this._details.hide(),this.element.domNode.classList.remove("shows-details")):(i3(this._list.getFocusedElements()[0])||this._explainMode)&&(this._state===3||this._state===5||this._state===4)&&(this._ctxSuggestWidgetDetailsVisible.set(!0),this._setDetailsVisible(!0),this._showDetails(!1,e))}_showDetails(e,t){this._pendingShowDetails.value=yy(me(this.element.domNode),()=>{this._pendingShowDetails.clear(),this._details.show();let i=!1;e?this._details.widget.renderLoading():this._details.widget.renderItem(this._list.getFocusedElements()[0],this._explainMode),this._details.widget.isEmpty?this._details.hide():(this._positionDetails(),this.element.domNode.classList.add("shows-details"),t&&(this._details.widget.focus(),i=!0)),i||this.editor.focus()})}toggleExplainMode(){this._list.getFocusedElements()[0]&&(this._explainMode=!this._explainMode,this._isDetailsVisible()?this._showDetails(!1,!1):this.toggleDetails())}resetPersistedSize(){this._persistedSize.reset()}hideWidget(){this._pendingLayout.clear(),this._pendingShowDetails.clear(),this._loadingTimeout?.dispose(),this._setState(0),this._onDidHide.fire(this),this.element.clearSashHoverState();const e=this._persistedSize.restore(),t=Math.ceil(this.getLayoutInfo().itemHeight*4.3);e&&e.height<t&&this._persistedSize.store(e.with(void 0,t))}isFrozen(){return this._state===4}_afterRender(e){if(e===null){this._isDetailsVisible()&&this._details.hide();return}this._state===2||this._state===1||(this._isDetailsVisible()&&!this._details.widget.isEmpty&&this._details.show(),this._positionDetails())}_layout(e){if(!this.editor.hasModel()||!this.editor.getDomNode())return;const t=rh(this.element.domNode.ownerDocument.body),i=this.getLayoutInfo();e||(e=i.defaultSize);let n=e.height,s=e.width;if(this._status.element.style.height=`${i.itemHeight}px`,this._state===2||this._state===1)n=i.itemHeight+i.borderHeight,s=i.defaultSize.width/2,this.element.enableSashes(!1,!1,!1,!1),this.element.minSize=this.element.maxSize=new dt(s,n),this._contentWidget.setPreference(2);else{const r=t.width-i.borderHeight-2*i.horizontalPadding;s>r&&(s=r);const a=this._completionModel?this._completionModel.stats.pLabelLen*i.typicalHalfwidthCharacterWidth:s,l=i.statusBarHeight+this._list.contentHeight+i.borderHeight,c=i.itemHeight+i.statusBarHeight,d=mi(this.editor.getDomNode()),h=this.editor.getScrolledVisiblePosition(this.editor.getPosition()),u=d.top+h.top+h.height,f=Math.min(t.height-u-i.verticalPadding,l),g=d.top+h.top-i.verticalPadding,m=Math.min(g,l);let _=Math.min(Math.max(m,f)+i.borderHeight,l);n===this._cappedHeight?.capped&&(n=this._cappedHeight.wanted),n<c&&(n=c),n>_&&(n=_),n>f&&m>f||this._forceRenderingAbove&&g>150?(this._contentWidget.setPreference(1),this.element.enableSashes(!0,!0,!1,!1),_=m):(this._contentWidget.setPreference(2),this.element.enableSashes(!1,!0,!0,!1),_=f),this.element.preferredSize=new dt(a,i.defaultSize.height),this.element.maxSize=new dt(r,_),this.element.minSize=new dt(220,c),this._cappedHeight=n===l?{wanted:this._cappedHeight?.wanted??e.height,capped:n}:void 0}this._resize(s,n)}_resize(e,t){const{width:i,height:n}=this.element.maxSize;e=Math.min(i,e),t=Math.min(n,t);const{statusBarHeight:s}=this.getLayoutInfo();this._list.layout(t-s,e),this._listElement.style.height=`${t-s}px`,this.element.layout(t,e),this._contentWidget.layout(),this._positionDetails()}_positionDetails(){this._isDetailsVisible()&&this._details.placeAtAnchor(this.element.domNode,this._contentWidget.getPosition()?.preference[0]===2)}getLayoutInfo(){const e=this.editor.getOption(59),t=ks(this.editor.getOption(136)||e.lineHeight,8,1e3),i=!this.editor.getOption(134).showStatusBar||this._state===2||this._state===1?0:t,n=this._details.widget.borderWidth,s=2*n;return{itemHeight:t,statusBarHeight:i,borderWidth:n,borderHeight:s,typicalHalfwidthCharacterWidth:e.typicalHalfwidthCharacterWidth,verticalPadding:22,horizontalPadding:14,defaultSize:new dt(430,i+12*t)}}_isDetailsVisible(){return this._storageService.getBoolean("expandSuggestionDocs",0,!1)}_setDetailsVisible(e){this._storageService.store("expandSuggestionDocs",e,0,0)}forceRenderingAbove(){this._forceRenderingAbove||(this._forceRenderingAbove=!0,this._layout(this._persistedSize.restore()))}stopForceRenderingAbove(){this._forceRenderingAbove=!1}},Mb=Fu,Fu.LOADING_MESSAGE=p(1467,"Loading..."),Fu.NO_SUGGESTIONS_MESSAGE=p(1468,"No suggestions."),Fu);a3=Mb=RIe([CD(1,Es),CD(2,xe),CD(3,li),CD(4,ge)],a3);class OIe{constructor(e,t){this._widget=e,this._editor=t,this.allowEditorOverflow=!0,this.suppressMouseDown=!1,this._preferenceLocked=!1,this._added=!1,this._hidden=!1}dispose(){this._added&&(this._added=!1,this._editor.removeContentWidget(this))}getId(){return"editor.widget.suggestWidget"}getDomNode(){return this._widget.element.domNode}show(){this._hidden=!1,this._added||(this._added=!0,this._editor.addContentWidget(this))}hide(){this._hidden||(this._hidden=!0,this.layout())}layout(){this._editor.layoutContentWidget(this)}getPosition(){return this._hidden||!this._position||!this._preference?null:{position:this._position,preference:[this._preference]}}beforeRender(){const{height:e,width:t}=this._widget.element.size,{borderWidth:i,horizontalPadding:n}=this._widget.getLayoutInfo();return new dt(t+2*i+n,e+2*i)}afterRender(e){this._widget._afterRender(e)}setPreference(e){this._preferenceLocked||(this._preference=e)}lockPreference(){this._preferenceLocked=!0}unlockPreference(){this._preferenceLocked=!1}setPosition(e){this._position=e}}var FIe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Pb=function(o,e){return function(t,i){e(t,i,o)}},l3;class WIe{constructor(e,t){if(this._model=e,this._position=t,this._decorationOptions=Te.register({description:"suggest-line-suffix",stickiness:1}),e.getLineMaxColumn(t.lineNumber)!==t.column){const n=e.getOffsetAt(t),s=e.getPositionAt(n+1);e.changeDecorations(r=>{this._marker&&r.removeDecoration(this._marker),this._marker=r.addDecoration(k.fromPositions(t,s),this._decorationOptions)})}}dispose(){this._marker&&!this._model.isDisposed()&&this._model.changeDecorations(e=>{e.removeDecoration(this._marker),this._marker=void 0})}delta(e){if(this._model.isDisposed()||this._position.lineNumber!==e.lineNumber)return 0;if(this._marker){const t=this._model.getDecorationRange(this._marker);return this._model.getOffsetAt(t.getStartPosition())-this._model.getOffsetAt(e)}else return this._model.getLineMaxColumn(e.lineNumber)-e.column}}let Za=(em=class{static get(e){return e.getContribution(l3.ID)}get onWillInsertSuggestItem(){return this._onWillInsertSuggestItem.event}constructor(e,t,i,n,s,r,a){this._memoryService=t,this._commandService=i,this._contextKeyService=n,this._instantiationService=s,this._logService=r,this._telemetryService=a,this._lineSuffix=new ct,this._toDispose=new U,this._selectors=new BIe(h=>h.priority),this._onWillInsertSuggestItem=new P,this._wantsForceRenderingAbove=!1,this.editor=e,this.model=s.createInstance(mD,this.editor),this._selectors.register({priority:0,select:(h,u,f)=>this._memoryService.select(h,u,f)});const l=Be.InsertMode.bindTo(n);l.set(e.getOption(134).insertMode),this._toDispose.add(this.model.onDidTrigger(()=>l.set(e.getOption(134).insertMode))),this.widget=this._toDispose.add(new QR(me(e.getDomNode()),()=>{const h=this._instantiationService.createInstance(a3,this.editor);this._toDispose.add(h),this._toDispose.add(h.onDidSelect(_=>this._insertSuggestion(_,0),this));const u=new CIe(this.editor,h,this.model,_=>this._insertSuggestion(_,2));this._toDispose.add(u);const f=Be.MakesTextEdit.bindTo(this._contextKeyService),g=Be.HasInsertAndReplaceRange.bindTo(this._contextKeyService),m=Be.CanResolve.bindTo(this._contextKeyService);return this._toDispose.add(ue(()=>{f.reset(),g.reset(),m.reset()})),this._toDispose.add(h.onDidFocus(({item:_})=>{const b=this.editor.getPosition(),C=_.editStart.column,w=b.column;let v=!0;this.editor.getOption(1)==="smart"&&this.model.state===2&&!_.completion.additionalTextEdits&&!(_.completion.insertTextRules&4)&&w-C===_.completion.insertText.length&&(v=this.editor.getModel().getValueInRange({startLineNumber:b.lineNumber,startColumn:C,endLineNumber:b.lineNumber,endColumn:w})!==_.completion.insertText),f.set(v),g.set(!M.equals(_.editInsertEnd,_.editReplaceEnd)),m.set(!!_.provider.resolveCompletionItem||!!_.completion.documentation||_.completion.detail!==_.completion.label)})),this._toDispose.add(h.onDetailsKeyDown(_=>{if(_.toKeyCodeChord().equals(new Sc(!0,!1,!1,!1,33))||ze&&_.toKeyCodeChord().equals(new Sc(!1,!1,!1,!0,33))){_.stopPropagation();return}_.toKeyCodeChord().isModifierKey()||this.editor.focus()})),this._wantsForceRenderingAbove&&h.forceRenderingAbove(),h})),this._overtypingCapturer=this._toDispose.add(new QR(me(e.getDomNode()),()=>this._toDispose.add(new JF(this.editor,this.model)))),this._alternatives=this._toDispose.add(new QR(me(e.getDomNode()),()=>this._toDispose.add(new Rb(this.editor,this._contextKeyService)))),this._toDispose.add(s.createInstance(fD,e)),this._toDispose.add(this.model.onDidTrigger(h=>{this.widget.value.showTriggered(h.auto,h.shy?250:50),this._lineSuffix.value=new WIe(this.editor.getModel(),h.position)})),this._toDispose.add(this.model.onDidSuggest(h=>{if(h.triggerOptions.shy)return;let u=-1;for(const g of this._selectors.itemsOrderedByPriorityDesc)if(u=g.select(this.editor.getModel(),this.editor.getPosition(),h.completionModel.items),u!==-1)break;if(u===-1&&(u=0),this.model.state===0)return;let f=!1;if(h.triggerOptions.auto){const g=this.editor.getOption(134);g.selectionMode==="never"||g.selectionMode==="always"?f=g.selectionMode==="never":g.selectionMode==="whenTriggerCharacter"?f=h.triggerOptions.triggerKind!==1:g.selectionMode==="whenQuickSuggestion"&&(f=h.triggerOptions.triggerKind===1&&!h.triggerOptions.refilter)}this.widget.value.showSuggestions(h.completionModel,u,h.isFrozen,h.triggerOptions.auto,f)})),this._toDispose.add(this.model.onDidCancel(h=>{h.retrigger||this.widget.value.hideWidget()})),this._toDispose.add(this.editor.onDidBlurEditorWidget(()=>{this.model.cancel(),this.model.clear()}));const c=Be.AcceptSuggestionsOnEnter.bindTo(n),d=()=>{const h=this.editor.getOption(1);c.set(h==="on"||h==="smart")};this._toDispose.add(this.editor.onDidChangeConfiguration(()=>d())),d()}dispose(){this._alternatives.dispose(),this._toDispose.dispose(),this.widget.dispose(),this.model.dispose(),this._lineSuffix.dispose(),this._onWillInsertSuggestItem.dispose()}_insertSuggestion(e,t){if(!e||!e.item){this._alternatives.value.reset(),this.model.cancel(),this.model.clear();return}if(!this.editor.hasModel())return;const i=hs.get(this.editor);if(!i)return;this._onWillInsertSuggestItem.fire({item:e.item});const n=this.editor.getModel(),s=n.getAlternativeVersionId(),{item:r}=e,a=[],l=new Xt;t&1||this.editor.pushUndoStop();const c=this.getOverwriteInfo(r,!!(t&8));this._memoryService.memorize(n,this.editor.getPosition(),r);const d=r.isResolved;let h=-1,u=-1;if(Array.isArray(r.completion.additionalTextEdits)){this.model.cancel();const g=Aa.capture(this.editor);this.editor.executeEdits("suggestController.additionalTextEdits.sync",r.completion.additionalTextEdits.map(m=>{let _=k.lift(m.range);if(_.startLineNumber===r.position.lineNumber&&_.startColumn>r.position.column){const b=this.editor.getPosition().column-r.position.column,C=b,w=k.spansMultipleLines(_)?0:b;_=new k(_.startLineNumber,_.startColumn+C,_.endLineNumber,_.endColumn+w)}return fi.replaceMove(_,m.text)})),g.restoreRelativeVerticalPositionOfCursor(this.editor)}else if(!d){const g=new Ki;let m;const _=n.onDidChangeContent(v=>{if(v.isFlush){l.cancel(),_.dispose();return}for(const S of v.changes){const L=k.getEndPosition(S.range);(!m||M.isBefore(L,m))&&(m=L)}}),b=t;t|=2;let C=!1;const w=this.editor.onWillType(()=>{w.dispose(),C=!0,b&2||this.editor.pushUndoStop()});a.push(r.resolve(l.token).then(()=>{if(!r.completion.additionalTextEdits||l.token.isCancellationRequested)return;if(m&&r.completion.additionalTextEdits.some(S=>M.isBefore(m,k.getStartPosition(S.range))))return!1;C&&this.editor.pushUndoStop();const v=Aa.capture(this.editor);return this.editor.executeEdits("suggestController.additionalTextEdits.async",r.completion.additionalTextEdits.map(S=>fi.replaceMove(k.lift(S.range),S.text))),v.restoreRelativeVerticalPositionOfCursor(this.editor),(C||!(b&2))&&this.editor.pushUndoStop(),!0}).then(v=>{this._logService.trace("[suggest] async resolving of edits DONE (ms, applied?)",g.elapsed(),v),u=v===!0?1:v===!1?0:-2}).finally(()=>{_.dispose(),w.dispose()}))}let{insertText:f}=r.completion;if(r.completion.insertTextRules&4||(f=kg.escape(f)),this.model.cancel(),i.insert(f,{overwriteBefore:c.overwriteBefore,overwriteAfter:c.overwriteAfter,undoStopBefore:!1,undoStopAfter:!1,adjustWhitespace:!(r.completion.insertTextRules&1),clipboardText:e.model.clipboardText,overtypingCapturer:this._overtypingCapturer.value,reason:jn.suggest({providerId:XL.fromExtensionId(r.extensionId?.value)})}),t&2||this.editor.pushUndoStop(),r.completion.command)if(r.completion.command.id===vD.id)this.model.trigger({auto:!0,retrigger:!0});else{const g=new Ki;a.push(this._commandService.executeCommand(r.completion.command.id,...r.completion.command.arguments?[...r.completion.command.arguments]:[]).catch(m=>{r.completion.extensionId?Di(m):Ee(m)}).finally(()=>{h=g.elapsed()}))}t&4&&this._alternatives.value.set(e,g=>{for(l.cancel();n.canUndo();){s!==n.getAlternativeVersionId()&&n.undo(),this._insertSuggestion(g,3|(t&8?8:0));break}}),this._alertCompletionItem(r),Promise.all(a).finally(()=>{this._reportSuggestionAcceptedTelemetry(r,n,d,h,u,e.index,e.model.items),this.model.clear(),l.dispose()})}_reportSuggestionAcceptedTelemetry(e,t,i,n,s,r,a){if(Math.random()>1e-4)return;const l=new Map;for(let u=0;u<Math.min(30,a.length);u++){const f=a[u].textLabel;l.has(f)?l.get(f).push(u):l.set(f,[u])}const c=l.get(e.textLabel),h=c&&c.length>1?c[0]:-1;this._telemetryService.publicLog2("suggest.acceptedSuggestion",{extensionId:e.extensionId?.value??"unknown",providerId:e.provider._debugDisplayName??"unknown",kind:e.completion.kind,basenameHash:h1(vr(t.uri)).toString(16),languageId:t.getLanguageId(),fileExtension:Gse(t.uri),resolveInfo:e.provider.resolveCompletionItem?i?1:0:-1,resolveDuration:e.resolveDuration,commandDuration:n,additionalEditsAsync:s,index:r,firstIndex:h})}getOverwriteInfo(e,t){it(this.editor.hasModel());let i=this.editor.getOption(134).insertMode==="replace";t&&(i=!i);const n=e.position.column-e.editStart.column,s=(i?e.editReplaceEnd.column:e.editInsertEnd.column)-e.position.column,r=this.editor.getPosition().column-e.position.column,a=this._lineSuffix.value?this._lineSuffix.value.delta(this.editor.getPosition()):0;return{overwriteBefore:n+r,overwriteAfter:s+a}}_alertCompletionItem(e){if(is(e.completion.additionalTextEdits)){const t=p(1448,"Accepting '{0}' made {1} additional edits",e.textLabel,e.completion.additionalTextEdits.length);ps(t)}}triggerSuggest(e,t,i){this.editor.hasModel()&&(this.model.trigger({auto:t??!1,completionOptions:{providerFilter:e,kindFilter:i?new Set:void 0}}),this.editor.revealPosition(this.editor.getPosition(),0),this.editor.focus())}triggerSuggestAndAcceptBest(e){if(!this.editor.hasModel())return;const t=this.editor.getPosition(),i=()=>{t.equals(this.editor.getPosition())&&this._commandService.executeCommand(e.fallback)},n=s=>{if(s.completion.insertTextRules&4||s.completion.additionalTextEdits)return!0;const r=this.editor.getPosition(),a=s.editStart.column,l=r.column;return l-a!==s.completion.insertText.length?!0:this.editor.getModel().getValueInRange({startLineNumber:r.lineNumber,startColumn:a,endLineNumber:r.lineNumber,endColumn:l})!==s.completion.insertText};ie.once(this.model.onDidTrigger)(s=>{const r=[];ie.any(this.model.onDidTrigger,this.model.onDidCancel)(()=>{pt(r),i()},void 0,r),this.model.onDidSuggest(({completionModel:a})=>{if(pt(r),a.items.length===0){i();return}const l=this._memoryService.select(this.editor.getModel(),this.editor.getPosition(),a.items),c=a.items[l];if(!n(c)){i();return}this.editor.pushUndoStop(),this._insertSuggestion({index:l,item:c,model:a},7)},void 0,r)}),this.model.trigger({auto:!1,shy:!0}),this.editor.revealPosition(t,0),this.editor.focus()}acceptSelectedSuggestion(e,t){const i=this.widget.value.getFocusedItem();let n=0;e&&(n|=4),t&&(n|=8),this._insertSuggestion(i,n)}acceptNextSuggestion(){this._alternatives.value.next()}acceptPrevSuggestion(){this._alternatives.value.prev()}cancelSuggestWidget(){this.model.cancel(),this.model.clear(),this.widget.value.hideWidget()}focusSuggestion(){this.widget.value.focusSelected()}selectNextSuggestion(){this.widget.value.selectNext()}selectNextPageSuggestion(){this.widget.value.selectNextPage()}selectLastSuggestion(){this.widget.value.selectLast()}selectPrevSuggestion(){this.widget.value.selectPrevious()}selectPrevPageSuggestion(){this.widget.value.selectPreviousPage()}selectFirstSuggestion(){this.widget.value.selectFirst()}toggleSuggestionDetails(){this.widget.value.toggleDetails()}toggleExplainMode(){this.widget.value.toggleExplainMode()}toggleSuggestionFocus(){this.widget.value.toggleDetailsFocus()}resetWidgetSize(){this.widget.value.resetPersistedSize()}forceRenderingAbove(){this.widget.isInitialized?this.widget.value.forceRenderingAbove():this._wantsForceRenderingAbove=!0}stopForceRenderingAbove(){this.widget.isInitialized?this.widget.value.stopForceRenderingAbove():this._wantsForceRenderingAbove=!1}registerSelector(e){return this._selectors.register(e)}},l3=em,em.ID="editor.contrib.suggestController",em);Za=l3=FIe([Pb(1,uD),Pb(2,Tt),Pb(3,xe),Pb(4,ge),Pb(5,Rt),Pb(6,Vn)],Za);class BIe{constructor(e){this.prioritySelector=e,this._items=new Array}register(e){if(this._items.indexOf(e)!==-1)throw new Error("Value is already registered");return this._items.push(e),this._items.sort((t,i)=>this.prioritySelector(i)-this.prioritySelector(t)),{dispose:()=>{const t=this._items.indexOf(e);t>=0&&this._items.splice(t,1)}}}get itemsOrderedByPriorityDesc(){return this._items}}const qN=class qN extends le{constructor(){super({id:qN.id,label:H(1456,"Trigger Suggest"),precondition:K.and(T.writable,T.hasCompletionItemProvider,Be.Visible.toNegated()),kbOpts:{kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[521,2087]},weight:100}})}run(e,t,i){const n=Za.get(t);if(!n)return;let s;i&&typeof i=="object"&&i.auto===!0&&(s=!0),n.triggerSuggest(void 0,s,void 0)}};qN.id="editor.action.triggerSuggest";let vD=qN;Qe(Za.ID,Za,2),ne(vD);const Jo=190,Rs=Bi.bindToContribution(Za.get);re(new Rs({id:"acceptSelectedSuggestion",precondition:K.and(Be.Visible,Be.HasFocusedSuggestion),handler(o){o.acceptSelectedSuggestion(!0,!1)},kbOpts:[{primary:2,kbExpr:K.and(Be.Visible,T.textInputFocus),weight:Jo},{primary:3,kbExpr:K.and(Be.Visible,T.textInputFocus,Be.AcceptSuggestionsOnEnter,Be.MakesTextEdit),weight:Jo}],menuOpts:[{menuId:su,title:p(1449,"Insert"),group:"left",order:1,when:Be.HasInsertAndReplaceRange.toNegated()},{menuId:su,title:p(1450,"Insert"),group:"left",order:1,when:K.and(Be.HasInsertAndReplaceRange,Be.InsertMode.isEqualTo("insert"))},{menuId:su,title:p(1451,"Replace"),group:"left",order:1,when:K.and(Be.HasInsertAndReplaceRange,Be.InsertMode.isEqualTo("replace"))}]})),re(new Rs({id:"acceptAlternativeSelectedSuggestion",precondition:K.and(Be.Visible,T.textInputFocus,Be.HasFocusedSuggestion),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:1027,secondary:[1026]},handler(o){o.acceptSelectedSuggestion(!1,!0)},menuOpts:[{menuId:su,group:"left",order:2,when:K.and(Be.HasInsertAndReplaceRange,Be.InsertMode.isEqualTo("insert")),title:p(1452,"Replace")},{menuId:su,group:"left",order:2,when:K.and(Be.HasInsertAndReplaceRange,Be.InsertMode.isEqualTo("replace")),title:p(1453,"Insert")}]})),Xe.registerCommandAlias("acceptSelectedSuggestionOnEnter","acceptSelectedSuggestion"),re(new Rs({id:"hideSuggestWidget",precondition:Be.Visible,handler:o=>o.cancelSuggestWidget(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:9,secondary:[1033]}})),re(new Rs({id:"selectNextSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectNextSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:18,secondary:[2066],mac:{primary:18,secondary:[2066,300]}}})),re(new Rs({id:"selectNextPageSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectNextPageSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:12,secondary:[2060]}})),re(new Rs({id:"selectLastSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectLastSuggestion()})),re(new Rs({id:"selectPrevSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:16,secondary:[2064],mac:{primary:16,secondary:[2064,302]}}})),re(new Rs({id:"selectPrevPageSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectPrevPageSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:11,secondary:[2059]}})),re(new Rs({id:"selectFirstSuggestion",precondition:K.and(Be.Visible,K.or(Be.MultipleSuggestions,Be.HasFocusedSuggestion.negate())),handler:o=>o.selectFirstSuggestion()})),re(new Rs({id:"focusSuggestion",precondition:K.and(Be.Visible,Be.HasFocusedSuggestion.negate()),handler:o=>o.focusSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}}})),re(new Rs({id:"focusAndAcceptSuggestion",precondition:K.and(Be.Visible,Be.HasFocusedSuggestion.negate()),handler:o=>{o.focusSuggestion(),o.acceptSelectedSuggestion(!0,!1)}})),re(new Rs({id:"toggleSuggestionDetails",precondition:K.and(Be.Visible,Be.HasFocusedSuggestion),handler:o=>o.toggleSuggestionDetails(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:2058,secondary:[2087],mac:{primary:266,secondary:[2087]}},menuOpts:[{menuId:su,group:"right",order:1,when:K.and(Be.DetailsVisible,Be.CanResolve),title:p(1454,"Show Less")},{menuId:su,group:"right",order:1,when:K.and(Be.DetailsVisible.toNegated(),Be.CanResolve),title:p(1455,"Show More")}]})),re(new Rs({id:"toggleExplainMode",precondition:Be.Visible,handler:o=>o.toggleExplainMode(),kbOpts:{weight:100,primary:2138}})),re(new Rs({id:"toggleSuggestionFocus",precondition:Be.Visible,handler:o=>o.toggleSuggestionFocus(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:2570,mac:{primary:778}}})),re(new Rs({id:"insertBestCompletion",precondition:K.and(T.textInputFocus,K.equals("config.editor.tabCompletion","on"),fD.AtEnd,Be.Visible.toNegated(),Rb.OtherSuggestions.toNegated(),hs.InSnippetMode.toNegated()),handler:(o,e)=>{o.triggerSuggestAndAcceptBest(nn(e)?{fallback:"tab",...e}:{fallback:"tab"})},kbOpts:{weight:Jo,primary:2}})),re(new Rs({id:"insertNextSuggestion",precondition:K.and(T.textInputFocus,K.equals("config.editor.tabCompletion","on"),Rb.OtherSuggestions,Be.Visible.toNegated(),hs.InSnippetMode.toNegated()),handler:o=>o.acceptNextSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:2}})),re(new Rs({id:"insertPrevSuggestion",precondition:K.and(T.textInputFocus,K.equals("config.editor.tabCompletion","on"),Rb.OtherSuggestions,Be.Visible.toNegated(),hs.InSnippetMode.toNegated()),handler:o=>o.acceptPrevSuggestion(),kbOpts:{weight:Jo,kbExpr:T.textInputFocus,primary:1026}})),ne(class extends le{constructor(){super({id:"editor.action.resetSuggestSize",label:H(1457,"Reset Suggest Widget Size"),precondition:void 0})}run(o,e){Za.get(e)?.resetWidgetSize()}});class HIe extends A{get selectedItem(){return this._currentSuggestItemInfo}constructor(e,t,i){super(),this.editor=e,this.suggestControllerPreselector=t,this.onWillAccept=i,this.isSuggestWidgetVisible=!1,this.isShiftKeyPressed=!1,this._isActive=!1,this._currentSuggestItemInfo=void 0,this._onDidSelectedItemChange=this._register(new P),this.onDidSelectedItemChange=this._onDidSelectedItemChange.event,this._register(e.onKeyDown(s=>{s.shiftKey&&!this.isShiftKeyPressed&&(this.isShiftKeyPressed=!0,this.update(this._isActive))})),this._register(e.onKeyUp(s=>{s.shiftKey&&this.isShiftKeyPressed&&(this.isShiftKeyPressed=!1,this.update(this._isActive))}));const n=Za.get(this.editor);if(n){this._register(n.registerSelector({priority:100,select:(a,l,c)=>{const d=this.editor.getModel();if(!d)return-1;const h=this.suggestControllerPreselector(),u=h?Dd(h,d):void 0;if(!u)return-1;const f=M.lift(l),g=c.map((_,b)=>{const C=C0.fromSuggestion(n,d,f,_,this.isShiftKeyPressed),w=Dd(C.getSingleTextEdit(),d),v=sX(u,w);return{index:b,valid:v,prefixLength:w.text.length,suggestItem:_}}).filter(_=>_&&_.valid&&_.prefixLength>0),m=FM(g,kn(_=>_.prefixLength,lo));return m?m.index:-1}}));let s=!1;const r=()=>{s||(s=!0,this._register(n.widget.value.onDidShow(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})),this._register(n.widget.value.onDidHide(()=>{this.isSuggestWidgetVisible=!1,this.update(!1)})),this._register(n.widget.value.onDidFocus(()=>{this.isSuggestWidgetVisible=!0,this.update(!0)})))};this._register(ie.once(n.model.onDidTrigger)(a=>{r()})),this._register(n.onWillInsertSuggestItem(a=>{const l=this.editor.getPosition(),c=this.editor.getModel();if(!l||!c)return;const d=C0.fromSuggestion(n,c,l,a.item,this.isShiftKeyPressed);this.onWillAccept(d)}))}this.update(this._isActive)}update(e){const t=this.getSuggestItemInfo();(this._isActive!==e||!VIe(this._currentSuggestItemInfo,t))&&(this._isActive=e,this._currentSuggestItemInfo=t,this._onDidSelectedItemChange.fire())}getSuggestItemInfo(){const e=Za.get(this.editor);if(!e||!this.isSuggestWidgetVisible)return;const t=e.widget.value.getFocusedItem(),i=this.editor.getPosition(),n=this.editor.getModel();if(!(!t||!i||!n))return C0.fromSuggestion(e,n,i,t.item,this.isShiftKeyPressed)}stopForceRenderingAbove(){Za.get(this.editor)?.stopForceRenderingAbove()}forceRenderingAbove(){Za.get(this.editor)?.forceRenderingAbove()}}class C0{static fromSuggestion(e,t,i,n,s){let{insertText:r}=n.completion,a=!1;if(n.completion.insertTextRules&4){const c=new kg().parse(r);c.children.length<100&&iD.adjustWhitespace(t,i,!0,c),r=c.toString(),a=!0}const l=e.getOverwriteInfo(n,s);return new C0(k.fromPositions(i.delta(0,-l.overwriteBefore),i.delta(0,Math.max(l.overwriteAfter,0))),r,n.completion.kind,a,n.container.incomplete??!1)}constructor(e,t,i,n,s){this.range=e,this.insertText=t,this.completionItemKind=i,this.isSnippetText=n,this.listIncomplete=s}equals(e){return this.range.equalsRange(e.range)&&this.insertText===e.insertText&&this.completionItemKind===e.completionItemKind&&this.isSnippetText===e.isSnippetText}toSelectedSuggestionInfo(){return new Zz(this.range,this.insertText,this.completionItemKind,this.isSnippetText)}getSingleTextEdit(){return new Oi(this.range,this.insertText)}}function VIe(o,e){return o===e?!0:!o||!e?!1:o.equals(e)}class zIe extends A{constructor(e,t,i){super(),this._editorObs=e,this._handleSuggestAccepted=t,this._suggestControllerPreselector=i,this._suggestWidgetAdaptor=this._register(new HIe(this._editorObs.editor,()=>(this._editorObs.forceUpdate(),this._suggestControllerPreselector()),n=>this._editorObs.forceUpdate(s=>{this._handleSuggestAccepted(n)}))),this.selectedItem=rt(this,n=>this._suggestWidgetAdaptor.onDidSelectedItemChange(()=>{this._editorObs.forceUpdate(s=>n(void 0))}),()=>this._suggestWidgetAdaptor.selectedItem)}stopForceRenderingAbove(){this._suggestWidgetAdaptor.stopForceRenderingAbove()}forceRenderingAbove(){this._suggestWidgetAdaptor.forceRenderingAbove()}}class UIe{constructor(e,t){this.lineNumber=e,this.columnRange=t}}class LX{constructor(e,t){if(this.startColumn=e,this.endColumnExclusive=t,e>t)throw new Ce(`startColumn ${e} cannot be after endColumnExclusive ${t}`)}toRange(e){return new k(e,this.startColumn,e,this.endColumnExclusive)}equals(e){return this.startColumn===e.startColumn&&this.endColumnExclusive===e.endColumnExclusive}toZeroBasedOffsetRange(){return new pe(this.startColumn-1,this.endColumnExclusive-1)}}class Qg{static fromLineTokens(e){const t=[];for(let i=0;i<e.getCount();i++)t.push(new xX(e.getTokenText(i),e.getMetadata(i)));return Qg.create(t)}static create(e){return new Qg(e)}constructor(e){this._tokenInfo=e}toLineTokens(e){return bi.createFromTextAndMetadata(this.map((t,i)=>({text:i.text,metadata:i.metadata})),e)}map(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=new pe(i,i+n.text.length);t.push(e(s,n)),i+=n.text.length}return t}slice(e){const t=[];let i=0;for(const n of this._tokenInfo){const s=i,r=s+n.text.length;if(r>e.start){if(s>=e.endExclusive)break;const a=Math.max(0,e.start-s),l=Math.max(0,r-e.endExclusive);t.push(new xX(n.text.slice(a,n.text.length-l),n.metadata))}i+=n.text.length}return Qg.create(t)}append(e){const t=this._tokenInfo.concat(e._tokenInfo);return Qg.create(t)}}class xX{constructor(e,t){this.text=e,this.metadata=t}}var $Ie=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jIe=function(o,e){return function(t,i){e(t,i,o)}},c3;const kX="ghost-text";let v0=(tm=class extends A{constructor(e,t,i,n,s,r){super(),this._editor=e,this._model=t,this._options=i,this._shouldKeepCursorStable=n,this._isClickable=s,this._languageService=r,this._isDisposed=Le(this,!1),this._editorObs=ni(this._editor),this._warningState=j(a=>{const l=this._model.ghostText.read(a);if(!l)return;const c=this._model.warning.read(a);if(c)return{lineNumber:l.lineNumber,position:new M(l.lineNumber,l.parts[0].column),icon:c.icon}}),this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._useSyntaxHighlighting=this._options.map(a=>a.syntaxHighlightingEnabled),this._extraClassNames=j(this,a=>{const l=[...this._options.read(a).extraClasses??[]];return this._useSyntaxHighlighting.read(a)&&l.push("syntax-highlighted"),this._warningState.read(a)&&l.push("warning"),l.map(d=>` ${d}`).join("")}),this.uiState=j(this,a=>{if(this._isDisposed.read(a))return;const l=this._editorObs.model.read(a);if(l!==this._model.targetTextModel.read(a))return;const c=this._model.ghostText.read(a);if(!c)return;const d=c instanceof MF?c.columnRange:void 0,h=this._useSyntaxHighlighting.read(a),u=this._extraClassNames.read(a),{inlineTexts:f,additionalLines:g,hiddenRange:m,additionalLinesOriginalSuffix:_}=qIe(c,l,kX+u),b=l.getLineContent(c.lineNumber),C=new qc(f.map(F=>Cn.insert(F.column-1,F.text))),w=h?l.tokenization.tokenizeLinesAt(c.lineNumber,[C.apply(b),...g.map(F=>F.content)]):void 0,v=C.getNewRanges(),S=f.map((F,O)=>({...F,tokens:w?.[0]?.getTokensInRange(v[O])})),L=g.map((F,O)=>{let B=w?.[O+1]??bi.createEmpty(F.content,this._languageService.languageIdCodec);if(O===g.length-1&&_){const z=Qg.fromLineTokens(l.tokenization.getLineTokens(_.lineNumber)).slice(_.columnRange.toZeroBasedOffsetRange());B=Qg.fromLineTokens(B).append(z).toLineTokens(B.languageIdCodec)}return{content:B,decorations:F.decorations}}),x=this._editor.getSelection()?.getStartPosition().column,I=S.filter(F=>F.text!==""),D=I.length!==0,R={cursorColumnDistance:(D?I[0].column:1)-x,cursorLineDistance:D?0:g.findIndex(F=>F.content!=="")+1,lineCountOriginal:D?1:0,lineCountModified:g.length+(D?1:0),characterCountOriginal:0,characterCountModified:vy(I.map(F=>F.text.length))+vy(L.map(F=>F.content.getTextLength())),disjointReplacements:I.length+(g.length>0?1:0),sameShapeReplacements:I.length>1&&L.length===0?I.every(F=>F.text===I[0].text):void 0};return this._model.handleInlineCompletionShown.read(a)?.(R),{replacedRange:d,inlineTexts:S,additionalLines:L,hiddenRange:m,lineNumber:c.lineNumber,additionalReservedLineCount:this._model.minReservedLineCount.read(a),targetTextModel:l,syntaxHighlightingEnabled:h}}),this.decorations=j(this,a=>{const l=this.uiState.read(a);if(!l)return[];const c=[],d=this._extraClassNames.read(a);l.replacedRange&&c.push({range:l.replacedRange.toRange(l.lineNumber),options:{inlineClassName:"inline-completion-text-to-replace"+d,description:"GhostTextReplacement"}}),l.hiddenRange&&c.push({range:l.hiddenRange.toRange(l.lineNumber),options:{inlineClassName:"ghost-text-hidden",description:"ghost-text-hidden"}});for(const h of l.inlineTexts)c.push({range:k.fromPositions(new M(l.lineNumber,h.column)),options:{description:"ghost-text-decoration",after:{content:h.text,tokens:h.tokens,inlineClassName:(h.preview?"ghost-text-decoration-preview":"ghost-text-decoration")+(this._isClickable?" clickable":"")+d+h.lineDecorations.map(u=>" "+u.className).join(" "),cursorStops:yr.Left,attachedData:new d3(this)},showIfCollapsed:!0}});return c}),this._additionalLinesWidget=this._register(new KIe(this._editor,j(a=>{const l=this.uiState.read(a);return l?{lineNumber:l.lineNumber,additionalLines:l.additionalLines,minReservedLineCount:l.additionalReservedLineCount,targetTextModel:l.targetTextModel}:void 0}),this._shouldKeepCursorStable,this._isClickable)),this._isInlineTextHovered=this._editorObs.isTargetHovered(a=>a.target.type===6&&a.target.detail.injectedText?.options.attachedData instanceof d3&&a.target.detail.injectedText.options.attachedData.owner===this,this._store),this.isHovered=j(this,a=>this._isDisposed.read(a)?!1:this._isInlineTextHovered.read(a)||this._additionalLinesWidget.isHovered.read(a)),this.height=j(this,a=>this._editorObs.getOption(75).read(a)+(this._additionalLinesWidget.viewZoneHeight.read(a)??0)),this._register(ue(()=>{this._isDisposed.set(!0,void 0)})),this._register(this._editorObs.setDecorations(this.decorations)),this._isClickable&&(this._register(this._additionalLinesWidget.onDidClick(a=>this._onDidClick.fire(a))),this._register(this._editor.onMouseUp(a=>{if(a.target.type!==6)return;const l=a.target.detail.injectedText?.options.attachedData;l instanceof d3&&l.owner===this&&this._onDidClick.fire(a.event)}))),this._register(Bn((a,l)=>{}))}static getWarningWidgetContext(e){const t=e.ghostTextViewWarningWidgetData;if(t)return t;if(e.parentElement)return this.getWarningWidgetContext(e.parentElement)}ownsViewZone(e){return this._additionalLinesWidget.viewZoneId===e}},c3=tm,tm.hot=Px(c3),tm);v0=c3=$Ie([jIe(5,Mt)],v0);class d3{constructor(e){this.owner=e}}function qIe(o,e,t){const i=[],n=[];function s(h,u){if(n.length>0){const f=n[n.length-1];u&&f.decorations.push(new os(f.content.length+1,f.content.length+1+h[0].line.length,u,0)),f.content+=h[0].line,h=h.slice(1)}for(const f of h)n.push({content:f.line,decorations:u?[new os(1,f.line.length+1,u,0),...f.lineDecorations]:[...f.lineDecorations]})}const r=e.getLineContent(o.lineNumber);let a,l=0;for(const h of o.parts){let u=h.lines;a===void 0?(i.push({column:h.column,text:u[0].line,preview:h.preview,lineDecorations:u[0].lineDecorations}),u=u.slice(1)):s([{line:r.substring(l,h.column-1),lineDecorations:[]}],void 0),u.length>0&&(s(u,t),a===void 0&&h.column<=r.length&&(a=h.column)),l=h.column-1}let c;a!==void 0&&(c=new UIe(o.lineNumber,new LX(l+1,r.length+1)));const d=a!==void 0?new LX(a,r.length+1):void 0;return{inlineTexts:i,additionalLines:n,hiddenRange:d,additionalLinesOriginalSuffix:c}}class KIe extends A{get viewZoneId(){return this._viewZoneInfo?.viewZoneId}get viewZoneHeight(){return this._viewZoneHeight}constructor(e,t,i,n){super(),this._editor=e,this._lines=t,this._shouldKeepCursorStable=i,this._isClickable=n,this._viewZoneHeight=Le("viewZoneHeight",void 0),this.editorOptionsChanged=co("editorOptionChanged",ie.filter(this._editor.onDidChangeConfiguration,s=>s.hasChanged(40)||s.hasChanged(133)||s.hasChanged(113)||s.hasChanged(108)||s.hasChanged(60)||s.hasChanged(59)||s.hasChanged(75))),this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._viewZoneListener=this._register(new ct),this.isHovered=ni(this._editor).isTargetHovered(s=>IX(s.target.element),this._store),this.hasBeenAccepted=!1,this._editor instanceof sg&&this._shouldKeepCursorStable&&this._register(this._editor.onBeforeExecuteEdit(s=>this.hasBeenAccepted=s.source==="inlineSuggestion.accept")),this._register(Se(s=>{const r=this._lines.read(s);this.editorOptionsChanged.read(s),r?(this.hasBeenAccepted=!1,this.updateLines(r.lineNumber,r.additionalLines,r.minReservedLineCount)):this.clear()}))}dispose(){super.dispose(),this.clear()}clear(){this._viewZoneListener.clear(),this._editor.changeViewZones(e=>{this.removeActiveViewZone(e)})}updateLines(e,t,i){const n=this._editor.getModel();if(!n)return;const{tabSize:s}=n.getOptions();this._editor.changeViewZones(r=>{const a=new U;this.removeActiveViewZone(r);const l=Math.max(t.length,i);if(l>0){const c=document.createElement("div");GIe(c,s,t,this._editor.getOptions(),this._isClickable),this._isClickable&&(a.add(W(c,"mousedown",d=>{d.preventDefault()})),a.add(W(c,"click",d=>{IX(d.target)&&this._onDidClick.fire(new yn(me(d),d))}))),this.addViewZone(r,e,l,c)}this._viewZoneListener.value=a})}addViewZone(e,t,i,n){const s=e.addZone({afterLineNumber:t,heightInLines:i,domNode:n,afterColumnAffinity:1,onComputedHeight:r=>{this._viewZoneHeight.set(r,void 0)}});this.keepCursorStable(t,i),this._viewZoneInfo={viewZoneId:s,heightInLines:i,lineNumber:t}}removeActiveViewZone(e){this._viewZoneInfo&&(e.removeZone(this._viewZoneInfo.viewZoneId),this.hasBeenAccepted||this.keepCursorStable(this._viewZoneInfo.lineNumber,-this._viewZoneInfo.heightInLines),this._viewZoneInfo=void 0,this._viewZoneHeight.set(void 0,void 0))}keepCursorStable(e,t){if(!this._shouldKeepCursorStable)return;const i=this._editor.getSelection()?.getStartPosition()?.lineNumber;i!==void 0&&e<i&&this._editor.setScrollTop(this._editor.getScrollTop()+t*this._editor.getOption(75))}}function IX(o){return ai(o)&&o.classList.contains(kX)}function GIe(o,e,t,i,n){const s=i.get(40),r=i.get(133),a="none",l=i.get(108),c=i.get(60),d=i.get(59),h=i.get(75);let u="suggest-preview-text";n&&(u+=" clickable");const f=new uh(1e4);f.appendString(`<div class="${u}">`);for(let _=0,b=t.length;_<b;_++){const C=t[_],w=C.content;f.appendString('<div class="view-line'),f.appendString('" style="top:'),f.appendString(String(_*h)),f.appendString('px;width:1000000px;">');const v=w.getLineContent(),S=c1(v),L=Tm(v);h_(new Vc(d.isMonospace&&!s,d.canUseHalfwidthRightwardsArrow,v,!1,S,L,0,w,C.decorations,e,0,d.spaceWidth,d.middotWidth,d.wsmiddotWidth,r,a,l,c!==Fc.OFF,null,null,0),f),f.appendString("</div>")}f.appendString("</div>"),dn(o,d);const g=f.build(),m=DX?DX.createHTML(g):g;o.innerHTML=m}const DX=Sl("editorGhostText",{createHTML:o=>o}),KN=class KN{constructor(e){this.replacements=e,YC(XC(e,(t,i)=>t.lineRange.endLineNumberExclusive<=i.lineRange.startLineNumber))}toString(){return this.replacements.map(e=>e.toString()).join(",")}getNewLineRanges(){const e=[];let t=0;for(const i of this.replacements)e.push(ke.ofLength(i.lineRange.startLineNumber+t,i.newLines.length)),t+=i.newLines.length-i.lineRange.length;return e}};KN.empty=new KN([]);let h3=KN;class u3{static fromSingleTextEdit(e,t){const i=ro(e.text);let n=e.range.startLineNumber;const s=t.getValueOfRange(k.fromPositions(new M(e.range.startLineNumber,1),e.range.getStartPosition()));i[0]=s+i[0];let r=e.range.endLineNumber+1;const a=t.getTransformer().getLineLength(e.range.endLineNumber)+1,l=t.getValueOfRange(k.fromPositions(e.range.getEndPosition(),new M(e.range.endLineNumber,a)));i[i.length-1]=i[i.length-1]+l;const c=e.range.startColumn===t.getTransformer().getLineLength(e.range.startLineNumber)+1,d=e.range.endColumn===1;return c&&i[0].length===s.length&&(n++,i.shift()),i.length>0&&n<r&&d&&i[i.length-1].length===l.length&&(r--,i.pop()),new u3(new ke(n,r),i)}constructor(e,t){this.lineRange=e,this.newLines=t}toString(){return`${this.lineRange}->${JSON.stringify(this.newLines)}`}toLineEdit(){return new h3([this])}}class EX{get lineEdit(){return u3.fromSingleTextEdit(this.edit.toReplacement(this.originalText),this.originalText)}get originalLineRange(){return this.lineEdit.lineRange}get modifiedLineRange(){return this.lineEdit.toLineEdit().getNewLineRanges()[0]}get displayRange(){return this.originalText.lineRange.intersect(this.originalLineRange.join(ke.ofLength(this.originalLineRange.startLineNumber,this.lineEdit.newLines.length)))}constructor(e,t,i,n,s){this.originalText=e,this.edit=t,this.cursorPosition=i,this.commands=n,this.inlineCompletion=s}}class NX{constructor(e,t,i){this._model=e,this.inlineEdit=t,this.tabAction=i,this.action=this.inlineEdit.inlineCompletion.action,this.displayName=this.inlineEdit.inlineCompletion.source.provider.displayName??p(1209,"Inline Edit"),this.extensionCommands=this.inlineEdit.inlineCompletion.source.inlineSuggestions.commands??[],this.isInDiffEditor=this._model.isInDiffEditor,this.displayLocation=this.inlineEdit.inlineCompletion.displayLocation,this.showCollapsed=this._model.showCollapsed}accept(){this._model.accept()}jump(){this._model.jump()}abort(e){console.error(e),this.inlineEdit.inlineCompletion.reportInlineEditError(e),this._model.stop()}handleInlineEditShown(e,t){this._model.handleInlineSuggestionShown(this.inlineEdit.inlineCompletion,e,t)}}class ZIe{constructor(e){this._model=e,this.onDidAccept=this._model.onDidAccept,this.inAcceptFlow=this._model.inAcceptFlow}}class YIe{constructor(e,t,i,n){this.lineRange=i;const s=ni(e),r=j(this,a=>s.isFocused.read(a)&&n.showInlineEditMenu?Xn.Accept:Xn.Inactive);this.model=new NX(t,new EX(new kh(""),new mo([n.getSingleTextEdit()]),t.primaryPosition.get(),n.source.inlineSuggestions.commands??[],n),r)}}class kt{static fromPoints(e,t){return new kt(e.x,e.y,t.x,t.y)}static fromPointSize(e,t){return new kt(e.x,e.y,e.x+t.x,e.y+t.y)}static fromLeftTopRightBottom(e,t,i,n){return new kt(e,t,i,n)}static fromLeftTopWidthHeight(e,t,i,n){return new kt(e,t,e+i,t+n)}static fromRanges(e,t){return new kt(e.start,t.start,e.endExclusive,t.endExclusive)}static hull(e){let t=Number.MAX_SAFE_INTEGER,i=Number.MAX_SAFE_INTEGER,n=Number.MIN_SAFE_INTEGER,s=Number.MIN_SAFE_INTEGER;for(const r of e)t=Math.min(t,r.left),i=Math.min(i,r.top),n=Math.max(n,r.right),s=Math.max(s,r.bottom);return new kt(t,i,n,s)}get width(){return this.right-this.left}get height(){return this.bottom-this.top}constructor(e,t,i,n){if(this.left=e,this.top=t,this.right=i,this.bottom=n,e>i)throw new Ce("Invalid arguments: Horizontally offset by "+(e-i));if(t>n)throw new Ce("Invalid arguments: Vertically offset by "+(t-n))}withMargin(e,t,i,n){let s,r,a,l;return t===void 0&&i===void 0&&n===void 0?s=r=a=l=e:i===void 0&&n===void 0?(s=r=t,a=l=e):(s=n,r=t,a=e,l=i),new kt(this.left-s,this.top-a,this.right+r,this.bottom+l)}intersectVertical(e){const t=Math.max(this.top,e.start),i=Math.min(this.bottom,e.endExclusive);return new kt(this.left,t,this.right,Math.max(t,i))}intersectHorizontal(e){const t=Math.max(this.left,e.start),i=Math.min(this.right,e.endExclusive);return new kt(t,this.top,Math.max(t,i),this.bottom)}toString(){return`Rect{(${this.left},${this.top}), (${this.right},${this.bottom})}`}intersect(e){const t=Math.max(this.left,e.left),i=Math.min(this.right,e.right),n=Math.max(this.top,e.top),s=Math.min(this.bottom,e.bottom);if(!(t>i||n>s))return new kt(t,n,i,s)}containsRect(e){return this.left<=e.left&&this.top<=e.top&&this.right>=e.right&&this.bottom>=e.bottom}containsPoint(e){return this.left<=e.x&&this.top<=e.y&&this.right>=e.x&&this.bottom>=e.y}moveToBeContainedIn(e){const t=this.width,i=this.height;let n=this.left,s=this.top;return n<e.left?n=e.left:n+t>e.right&&(n=e.right-t),s<e.top?s=e.top:s+i>e.bottom&&(s=e.bottom-i),new kt(n,s,n+t,s+i)}withWidth(e){return new kt(this.left,this.top,this.left+e,this.bottom)}withHeight(e){return new kt(this.left,this.top,this.right,this.top+e)}withTop(e){return new kt(this.left,e,this.right,this.bottom)}withLeft(e){return new kt(e,this.top,this.right,this.bottom)}translateX(e){return new kt(this.left+e,this.top,this.right+e,this.bottom)}translateY(e){return new kt(this.left,this.top+e,this.right,this.bottom+e)}getLeftBottom(){return new en(this.left,this.bottom)}getRightBottom(){return new en(this.right,this.bottom)}getRightTop(){return new en(this.right,this.top)}toStyles(){return{position:"absolute",left:`${this.left}px`,top:`${this.top}px`,width:`${this.width}px`,height:`${this.height}px`}}}class w0{constructor(e,t,i,n=null){this.startLineNumbers=e,this.endLineNumbers=t,this.lastLineRelativePosition=i,this.showEndForLine=n}equals(e){return!!e&&this.lastLineRelativePosition===e.lastLineRelativePosition&&this.showEndForLine===e.showEndForLine&&Ut(this.startLineNumbers,e.startLineNumbers)&&Ut(this.endLineNumbers,e.endLineNumbers)}static get Empty(){return new w0([],[],0)}}const TX=Sl("stickyScrollViewLayer",{createHTML:o=>o}),f3="data-sticky-line-index",RX="data-sticky-is-line",XIe="data-sticky-is-line-number",MX="data-sticky-is-folding-icon";class QIe extends A{get height(){return this._height}constructor(e){super(),this._foldingIconStore=new U,this._rootDomNode=document.createElement("div"),this._lineNumbersDomNode=document.createElement("div"),this._linesDomNodeScrollable=document.createElement("div"),this._linesDomNode=document.createElement("div"),this._renderedStickyLines=[],this._lineNumbers=[],this._lastLineRelativePosition=0,this._minContentWidthInPx=0,this._isOnGlyphMargin=!1,this._height=-1,this._onDidChangeStickyScrollHeight=this._register(new P),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._editor=e,this._lineHeight=e.getOption(75),this._lineNumbersDomNode.className="sticky-widget-line-numbers",this._lineNumbersDomNode.setAttribute("role","none"),this._linesDomNode.className="sticky-widget-lines",this._linesDomNode.setAttribute("role","list"),this._linesDomNodeScrollable.className="sticky-widget-lines-scrollable",this._linesDomNodeScrollable.appendChild(this._linesDomNode),this._rootDomNode.className="sticky-widget",this._rootDomNode.classList.toggle("peek",e instanceof Cd),this._rootDomNode.appendChild(this._lineNumbersDomNode),this._rootDomNode.appendChild(this._linesDomNodeScrollable),this._setHeight(0);const t=()=>{this._linesDomNode.style.left=this._editor.getOption(131).scrollWithEditor?`-${this._editor.getScrollLeft()}px`:"0px"};this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(131)&&t(),i.hasChanged(75)&&(this._lineHeight=this._editor.getOption(75))})),this._register(this._editor.onDidScrollChange(i=>{i.scrollLeftChanged&&t(),i.scrollWidthChanged&&this._updateWidgetWidth()})),this._register(this._editor.onDidChangeModel(()=>{t(),this._updateWidgetWidth()})),this._register(this._foldingIconStore),t(),this._register(this._editor.onDidLayoutChange(i=>{this._updateWidgetWidth()})),this._updateWidgetWidth()}get lineNumbers(){return this._lineNumbers}get lineNumberCount(){return this._lineNumbers.length}getRenderedStickyLine(e){return this._renderedStickyLines.find(t=>t.lineNumber===e)}getCurrentLines(){return this._lineNumbers}setState(e,t,i){const n=!this._state&&!e,s=this._state&&this._state.equals(e);if(i===void 0&&(n||s))return;const r=this._findRenderingData(e),a=this._lineNumbers;this._lineNumbers=r.lineNumbers,this._lastLineRelativePosition=r.lastLineRelativePosition;const l=this._findIndexToRebuildFrom(a,this._lineNumbers,i);this._renderRootNode(this._lineNumbers,this._lastLineRelativePosition,t,l),this._state=e}_findRenderingData(e){if(!e)return{lineNumbers:[],lastLineRelativePosition:0};const t=[...e.startLineNumbers];e.showEndForLine!==null&&(t[e.showEndForLine]=e.endLineNumbers[e.showEndForLine]);let i=0;for(let n=0;n<t.length;n++)i+=this._editor.getLineHeightForPosition(new M(t[n],1));return i===0?{lineNumbers:[],lastLineRelativePosition:0}:{lineNumbers:t,lastLineRelativePosition:e.lastLineRelativePosition}}_findIndexToRebuildFrom(e,t,i){if(t.length===0)return 0;if(i!==void 0)return i;const n=t.findIndex(s=>!e.includes(s));return n===-1?0:n}_updateWidgetWidth(){const e=this._editor.getLayoutInfo(),t=e.contentLeft;this._lineNumbersDomNode.style.width=`${t}px`,this._linesDomNodeScrollable.style.setProperty("--vscode-editorStickyScroll-scrollableWidth",`${this._editor.getScrollWidth()-e.verticalScrollbarWidth}px`),this._rootDomNode.style.width=`${e.width-e.verticalScrollbarWidth}px`}_useFoldingOpacityTransition(e){this._lineNumbersDomNode.style.setProperty("--vscode-editorStickyScroll-foldingOpacityTransition",`opacity ${e?.5:0}s`)}_setFoldingIconsVisibility(e){for(const t of this._renderedStickyLines){const i=t.foldingIcon;i&&i.setVisible(e?!0:i.isCollapsed)}}async _renderRootNode(e,t,i,n){const s=this._editor._getViewModel();if(!s){this._clearWidget();return}if(e.length===0){this._clearWidget();return}const r=[],a=e[e.length-1];let l=0;for(let d=0;d<this._renderedStickyLines.length;d++)if(d<n){const h=this._renderedStickyLines[d];r.push(this._updatePosition(h,l,h.lineNumber===a)),l+=h.height}else{const h=this._renderedStickyLines[d];h.lineNumberDomNode.remove(),h.lineDomNode.remove()}const c=this._editor.getLayoutInfo();for(let d=n;d<e.length;d++){const h=this._renderChildNode(s,d,e[d],l,a===e[d],i,c);l+=h.height,this._linesDomNode.appendChild(h.lineDomNode),this._lineNumbersDomNode.appendChild(h.lineNumberDomNode),r.push(h)}i&&(this._setFoldingHoverListeners(),this._useFoldingOpacityTransition(!this._isOnGlyphMargin)),this._minContentWidthInPx=Math.max(...this._renderedStickyLines.map(d=>d.scrollWidth))+c.verticalScrollbarWidth,this._renderedStickyLines=r,this._setHeight(l+t),this._editor.layoutOverlayWidget(this)}_clearWidget(){for(let e=0;e<this._renderedStickyLines.length;e++){const t=this._renderedStickyLines[e];t.lineNumberDomNode.remove(),t.lineDomNode.remove()}this._setHeight(0)}_setHeight(e){this._height!==e&&(this._height=e,this._height===0?this._rootDomNode.style.display="none":(this._rootDomNode.style.display="block",this._lineNumbersDomNode.style.height=`${this._height}px`,this._linesDomNodeScrollable.style.height=`${this._height}px`,this._rootDomNode.style.height=`${this._height}px`),this._onDidChangeStickyScrollHeight.fire({height:this._height}))}_setFoldingHoverListeners(){this._editor.getOption(126)==="mouseover"&&(this._foldingIconStore.add(W(this._lineNumbersDomNode,te.MOUSE_ENTER,()=>{this._isOnGlyphMargin=!0,this._setFoldingIconsVisibility(!0)})),this._foldingIconStore.add(W(this._lineNumbersDomNode,te.MOUSE_LEAVE,()=>{this._isOnGlyphMargin=!1,this._useFoldingOpacityTransition(!0),this._setFoldingIconsVisibility(!1)})))}_renderChildNode(e,t,i,n,s,r,a){const l=e.coordinatesConverter.convertModelPositionToViewPosition(new M(i,1)).lineNumber,c=e.getViewLineRenderingData(l),d=this._editor.getOption(76),h=this._editor.getOption(117).verticalScrollbarSize;let u;try{u=os.filter(c.inlineDecorations,l,c.minColumn,c.maxColumn)}catch{u=[]}const f=this._editor.getLineHeightForPosition(new M(i,1)),g=e.getTextDirection(i),m=new Vc(!0,!0,c.content,c.continuesWithWrappedLine,c.isBasicASCII,c.containsRTL,0,c.tokens,u,c.tabSize,c.startVisibleColumn,1,1,1,500,"none",!0,!0,null,g,h),_=new uh(2e3),b=h_(m,_);let C;TX?C=TX.createHTML(_.build()):C=_.build();const w=document.createElement("span");w.setAttribute(f3,String(t)),w.setAttribute(RX,""),w.setAttribute("role","listitem"),w.tabIndex=0,w.className="sticky-line-content",w.classList.add(`stickyLine${i}`),w.style.lineHeight=`${f}px`,w.innerHTML=C;const v=document.createElement("span");v.setAttribute(f3,String(t)),v.setAttribute(XIe,""),v.className="sticky-line-number",v.style.lineHeight=`${f}px`;const S=a.contentLeft;v.style.width=`${S}px`;const L=document.createElement("span");d.renderType===1||d.renderType===3&&i%10===0?L.innerText=i.toString():d.renderType===2&&(L.innerText=Math.abs(i-this._editor.getPosition().lineNumber).toString()),L.className="sticky-line-number-inner",L.style.width=`${a.lineNumbersWidth}px`,L.style.paddingLeft=`${a.lineNumbersLeft}px`,v.appendChild(L);const x=this._renderFoldingIconForLine(r,i);x&&(v.appendChild(x.domNode),x.domNode.style.left=`${a.lineNumbersWidth+a.lineNumbersLeft}px`,x.domNode.style.lineHeight=`${f}px`),this._editor.applyFontInfo(w),this._editor.applyFontInfo(v),v.style.lineHeight=`${f}px`,w.style.lineHeight=`${f}px`,v.style.height=`${f}px`,w.style.height=`${f}px`;const I=new JIe(t,i,w,v,x,b.characterMapping,w.scrollWidth,f);return this._updatePosition(I,n,s)}_updatePosition(e,t,i){const n=e.lineDomNode,s=e.lineNumberDomNode;if(i){n.style.zIndex="0",s.style.zIndex="0";const a=`${t+this._lastLineRelativePosition+(e.foldingIcon?.isCollapsed?1:0)}px`;n.style.top=a,s.style.top=a}else n.style.zIndex="1",s.style.zIndex="1",n.style.top=`${t}px`,s.style.top=`${t}px`;return e}_renderFoldingIconForLine(e,t){const i=this._editor.getOption(126);if(!e||i==="never")return;const n=e.regions,s=n.findRange(t),r=n.getStartLineNumber(s);if(!(t===r))return;const l=n.isCollapsed(s),c=new eDe(l,r,n.getEndLineNumber(s),this._lineHeight);return c.setVisible(this._isOnGlyphMargin?!0:l||i==="always"),c.domNode.setAttribute(MX,""),c}getId(){return"editor.contrib.stickyScrollWidget"}getDomNode(){return this._rootDomNode}getPosition(){return{preference:2,stackOridinal:10}}getMinContentWidthInPx(){return this._minContentWidthInPx}focusLineWithIndex(e){0<=e&&e<this._renderedStickyLines.length&&this._renderedStickyLines[e].lineDomNode.focus()}getEditorPositionFromNode(e){if(!e||e.children.length>0)return null;const t=this._getRenderedStickyLineFromChildDomNode(e);if(!t)return null;const i=Y1(t.characterMapping,e,0);return new M(t.lineNumber,i)}getLineNumberFromChildDomNode(e){return this._getRenderedStickyLineFromChildDomNode(e)?.lineNumber??null}_getRenderedStickyLineFromChildDomNode(e){const t=this.getLineIndexFromChildDomNode(e);return t===null||t<0||t>=this._renderedStickyLines.length?null:this._renderedStickyLines[t]}getLineIndexFromChildDomNode(e){const t=this._getAttributeValue(e,f3);return t?parseInt(t,10):null}isInStickyLine(e){return this._getAttributeValue(e,RX)!==void 0}isInFoldingIconDomNode(e){return this._getAttributeValue(e,MX)!==void 0}_getAttributeValue(e,t){for(;e&&e!==this._rootDomNode;){const i=e.getAttribute(t);if(i!==null)return i;e=e.parentElement}}}class JIe{constructor(e,t,i,n,s,r,a,l){this.index=e,this.lineNumber=t,this.lineDomNode=i,this.lineNumberDomNode=n,this.foldingIcon=s,this.characterMapping=r,this.scrollWidth=a,this.height=l}}class eDe{constructor(e,t,i,n){this.isCollapsed=e,this.foldingStartLine=t,this.foldingEndLine=i,this.dimension=n,this.domNode=document.createElement("div"),this.domNode.style.width="26px",this.domNode.style.height=`${n}px`,this.domNode.style.lineHeight=`${n}px`,this.domNode.className=ve.asClassName(e?jI:$I)}setVisible(e){this.domNode.style.cursor=e?"pointer":"default",this.domNode.style.opacity=e?"1":"0"}}class S0{constructor(e,t){this.startLineNumber=e,this.endLineNumber=t}}class wD{constructor(e,t,i){this.range=e,this.children=t,this.parent=i}}class PX{constructor(e,t,i,n){this.uri=e,this.version=t,this.element=i,this.outlineProviderId=n}}var SD=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},y0=function(o,e){return function(t,i){e(t,i,o)}},L0;(function(o){o.OUTLINE_MODEL="outlineModel",o.FOLDING_PROVIDER_MODEL="foldingProviderModel",o.INDENTATION_MODEL="indentationModel"})(L0||(L0={}));var au;(function(o){o[o.VALID=0]="VALID",o[o.INVALID=1]="INVALID",o[o.CANCELED=2]="CANCELED"})(au||(au={}));let g3=class extends A{constructor(e,t,i,n){switch(super(),this._editor=e,this._modelProviders=[],this._modelPromise=null,this._updateScheduler=this._register(new fr(300)),this._updateOperation=this._register(new U),this._editor.getOption(131).defaultModel){case L0.OUTLINE_MODEL:this._modelProviders.push(new p3(this._editor,n));case L0.FOLDING_PROVIDER_MODEL:this._modelProviders.push(new _3(this._editor,t,n));case L0.INDENTATION_MODEL:this._modelProviders.push(new m3(this._editor,i));break}}dispose(){this._modelProviders.forEach(e=>e.dispose()),this._updateOperation.clear(),this._cancelModelPromise(),super.dispose()}_cancelModelPromise(){this._modelPromise&&(this._modelPromise.cancel(),this._modelPromise=null)}async update(e){return this._updateOperation.clear(),this._updateOperation.add({dispose:()=>{this._cancelModelPromise(),this._updateScheduler.cancel()}}),this._cancelModelPromise(),await this._updateScheduler.trigger(async()=>{for(const t of this._modelProviders){const{statusPromise:i,modelPromise:n}=t.computeStickyModel(e);this._modelPromise=n;const s=await i;if(this._modelPromise!==n)return null;switch(s){case au.CANCELED:return this._updateOperation.clear(),null;case au.VALID:return t.stickyModel}}return null}).catch(t=>(Ee(t),null))}};g3=SD([y0(2,ge),y0(3,he)],g3);class AX extends A{constructor(e){super(),this._editor=e,this._stickyModel=null}get stickyModel(){return this._stickyModel}_invalid(){return this._stickyModel=null,au.INVALID}computeStickyModel(e){if(e.isCancellationRequested||!this.isProviderValid())return{statusPromise:this._invalid(),modelPromise:null};const t=Vi(i=>this.createModelFromProvider(i));return{statusPromise:t.then(i=>this.isModelValid(i)?e.isCancellationRequested?au.CANCELED:(this._stickyModel=this.createStickyModel(e,i),au.VALID):this._invalid()).then(void 0,i=>(Ee(i),au.CANCELED)),modelPromise:t}}isModelValid(e){return!0}isProviderValid(){return!0}}let p3=class extends AX{constructor(e,t){super(e),this._languageFeaturesService=t}createModelFromProvider(e){return Id.create(this._languageFeaturesService.documentSymbolProvider,this._editor.getModel(),e)}createStickyModel(e,t){const{stickyOutlineElement:i,providerID:n}=this._stickyModelFromOutlineModel(t,this._stickyModel?.outlineProviderId),s=this._editor.getModel();return new PX(s.uri,s.getVersionId(),i,n)}isModelValid(e){return e&&e.children.size>0}_stickyModelFromOutlineModel(e,t){let i;if(Ye.first(e.children.values())instanceof HY){const a=Ye.find(e.children.values(),l=>l.id===t);if(a)i=a.children;else{let l="",c=-1,d;for(const[h,u]of e.children.entries()){const f=this._findSumOfRangesOfGroup(u);f>c&&(d=u,c=f,l=u.id)}t=l,i=d.children}}else i=e.children;const n=[],s=Array.from(i.values()).sort((a,l)=>{const c=new S0(a.symbol.range.startLineNumber,a.symbol.range.endLineNumber),d=new S0(l.symbol.range.startLineNumber,l.symbol.range.endLineNumber);return this._comparator(c,d)});for(const a of s)n.push(this._stickyModelFromOutlineElement(a,a.symbol.selectionRange.startLineNumber));return{stickyOutlineElement:new wD(void 0,n,void 0),providerID:t}}_stickyModelFromOutlineElement(e,t){const i=[];for(const s of e.children.values())if(s.symbol.selectionRange.startLineNumber!==s.symbol.range.endLineNumber)if(s.symbol.selectionRange.startLineNumber!==t)i.push(this._stickyModelFromOutlineElement(s,s.symbol.selectionRange.startLineNumber));else for(const r of s.children.values())i.push(this._stickyModelFromOutlineElement(r,s.symbol.selectionRange.startLineNumber));i.sort((s,r)=>this._comparator(s.range,r.range));const n=new S0(e.symbol.selectionRange.startLineNumber,e.symbol.range.endLineNumber);return new wD(n,i,void 0)}_comparator(e,t){return e.startLineNumber!==t.startLineNumber?e.startLineNumber-t.startLineNumber:t.endLineNumber-e.endLineNumber}_findSumOfRangesOfGroup(e){let t=0;for(const i of e.children.values())t+=this._findSumOfRangesOfGroup(i);return e instanceof IF?t+e.symbol.range.endLineNumber-e.symbol.selectionRange.startLineNumber:t}};p3=SD([y0(1,he)],p3);class OX extends AX{constructor(e){super(e),this._foldingLimitReporter=this._register(new MY(e))}createStickyModel(e,t){const i=this._fromFoldingRegions(t),n=this._editor.getModel();return new PX(n.uri,n.getVersionId(),i,void 0)}isModelValid(e){return e!==null}_fromFoldingRegions(e){const t=e.length,i=[],n=new wD(void 0,[],void 0);for(let s=0;s<t;s++){const r=e.getParentIndex(s);let a;r!==-1?a=i[r]:a=n;const l=new wD(new S0(e.getStartLineNumber(s),e.getEndLineNumber(s)+1),[],a);a.children.push(l),i.push(l)}return n}}let m3=class extends OX{constructor(e,t){super(e),this._languageConfigurationService=t,this.provider=this._register(new SF(e.getModel(),this._languageConfigurationService,this._foldingLimitReporter))}async createModelFromProvider(e){return this.provider.compute(e)}};m3=SD([y0(1,Jt)],m3);let _3=class extends OX{constructor(e,t,i){super(e),this._languageFeaturesService=i,this.provider=this._register(new ct),this._register(this._languageFeaturesService.foldingRangeProvider.onDidChange(()=>{this._updateProvider(e,t)})),this._updateProvider(e,t)}_updateProvider(e,t){const i=nu.getFoldingRangeProviders(this._languageFeaturesService,e.getModel());i.length!==0&&(this.provider.value=new xF(e.getModel(),i,t,this._foldingLimitReporter,void 0))}isProviderValid(){return this.provider!==void 0}async createModelFromProvider(e){return this.provider.value?.compute(e)??null}};_3=SD([y0(2,he)],_3);var tDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},FX=function(o,e){return function(t,i){e(t,i,o)}};class iDe{constructor(e,t,i,n){this.startLineNumber=e,this.endLineNumber=t,this.top=i,this.height=n}}let b3=class extends A{constructor(e,t,i){super(),this._languageFeaturesService=t,this._languageConfigurationService=i,this._onDidChangeStickyScroll=this._register(new P),this.onDidChangeStickyScroll=this._onDidChangeStickyScroll.event,this._model=null,this._cts=null,this._stickyModelProvider=null,this._editor=e,this._sessionStore=this._register(new U),this._updateSoon=this._register(new wt(()=>this.update(),50)),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(131)&&this.readConfiguration()})),this.readConfiguration()}readConfiguration(){this._sessionStore.clear(),this._editor.getOption(131).enabled&&(this._sessionStore.add(this._editor.onDidChangeModel(()=>{this._model=null,this.updateStickyModelProvider(),this._onDidChangeStickyScroll.fire(),this.update()})),this._sessionStore.add(this._editor.onDidChangeHiddenAreas(()=>this.update())),this._sessionStore.add(this._editor.onDidChangeModelContent(()=>this._updateSoon.schedule())),this._sessionStore.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>this.update())),this._sessionStore.add(ue(()=>{this._stickyModelProvider?.dispose(),this._stickyModelProvider=null})),this.updateStickyModelProvider(),this.update())}getVersionId(){return this._model?.version}updateStickyModelProvider(){this._stickyModelProvider?.dispose(),this._stickyModelProvider=null,this._editor.hasModel()&&(this._stickyModelProvider=new g3(this._editor,()=>this._updateSoon.schedule(),this._languageConfigurationService,this._languageFeaturesService))}async update(){this._cts?.dispose(!0),this._cts=new Xt,await this.updateStickyModel(this._cts.token),this._onDidChangeStickyScroll.fire()}async updateStickyModel(e){if(!this._editor.hasModel()||!this._stickyModelProvider||this._editor.getModel().isTooLargeForTokenization()){this._model=null;return}const t=await this._stickyModelProvider.update(e);e.isCancellationRequested||(this._model=t)}getCandidateStickyLinesIntersecting(e){if(!this._model?.element)return[];const t=[];return this.getCandidateStickyLinesIntersectingFromStickyModel(e,this._model.element,t,0,0,-1),this.filterHiddenRanges(t)}getCandidateStickyLinesIntersectingFromStickyModel(e,t,i,n,s,r){const a=this._editor.getModel();if(!a||t.children.length===0)return;let l=r;const c=[];for(let u=0;u<t.children.length;u++){const f=t.children[u];f.range&&c.push(f.range.startLineNumber)}const d=this.updateIndex(py(c,e.startLineNumber,(u,f)=>u-f)),h=this.updateIndex(py(c,e.endLineNumber,(u,f)=>u-f));for(let u=d;u<=h;u++){const f=t.children[u];if(!f||!f.range)continue;const{startLineNumber:g,endLineNumber:m}=f.range;if(m>g+1&&e.startLineNumber<=m+1&&g-1<=e.endLineNumber&&g!==l&&a.isValidRange(new k(g,1,m,1))){l=g;const _=this._editor.getLineHeightForPosition(new M(g,1));i.push(new iDe(g,m-1,s,_)),this.getCandidateStickyLinesIntersectingFromStickyModel(e,f,i,n+1,s+_,g)}}}filterHiddenRanges(e){const t=this._editor._getViewModel()?.getHiddenAreas();return t?e.filter(i=>!t.some(n=>i.startLineNumber>=n.startLineNumber&&i.endLineNumber<=n.endLineNumber+1)):e}updateIndex(e){return e===-1?0:e<0?-e-2:e}};b3=tDe([FX(1,he),FX(2,Jt)],b3);var nDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ab=function(o,e){return function(t,i){e(t,i,o)}},C3;let ca=(im=class extends A{constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._contextMenuService=t,this._languageFeaturesService=i,this._instaService=n,this._contextKeyService=a,this._sessionStore=new U,this._maxStickyLines=Number.MAX_SAFE_INTEGER,this._candidateDefinitionsLength=-1,this._focusedStickyElementIndex=-1,this._enabled=!1,this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1,this._endLineNumbers=[],this._mouseTarget=null,this._onDidChangeStickyScrollHeight=this._register(new P),this.onDidChangeStickyScrollHeight=this._onDidChangeStickyScrollHeight.event,this._stickyScrollWidget=new QIe(this._editor),this._stickyLineCandidateProvider=new b3(this._editor,i,s),this._register(this._stickyScrollWidget),this._register(this._stickyLineCandidateProvider),this._widgetState=w0.Empty;const l=this._stickyScrollWidget.getDomNode();this._register(this._editor.onDidChangeLineHeight(d=>{d.changes.forEach(h=>{const u=h.lineNumber;this._widgetState.startLineNumbers.includes(u)&&this._renderStickyScroll(u)})})),this._register(this._editor.onDidChangeFont(d=>{d.changes.forEach(h=>{const u=h.lineNumber;this._widgetState.startLineNumbers.includes(u)&&this._renderStickyScroll(u)})})),this._register(this._editor.onDidChangeConfiguration(d=>{this._readConfigurationChange(d)})),this._register(W(l,te.CONTEXT_MENU,async d=>{this._onContextMenu(me(l),d)})),this._stickyScrollFocusedContextKey=T.stickyScrollFocused.bindTo(this._contextKeyService),this._stickyScrollVisibleContextKey=T.stickyScrollVisible.bindTo(this._contextKeyService);const c=this._register(br(l));this._register(c.onDidBlur(d=>{this._positionRevealed===!1&&l.clientHeight===0?(this._focusedStickyElementIndex=-1,this.focus()):this._disposeFocusStickyScrollStore()})),this._register(c.onDidFocus(d=>{this.focus()})),this._registerMouseListeners(),this._register(W(l,te.MOUSE_DOWN,d=>{this._onMouseDown=!0})),this._register(this._stickyScrollWidget.onDidChangeStickyScrollHeight(d=>{this._onDidChangeStickyScrollHeight.fire(d)})),this._onDidResize(),this._readConfiguration()}get stickyScrollWidgetHeight(){return this._stickyScrollWidget.height}static get(e){return e.getContribution(C3.ID)}_disposeFocusStickyScrollStore(){this._stickyScrollFocusedContextKey.set(!1),this._focusDisposableStore?.dispose(),this._focused=!1,this._positionRevealed=!1,this._onMouseDown=!1}isFocused(){return this._focused}focus(){if(this._onMouseDown){this._onMouseDown=!1,this._editor.focus();return}this._stickyScrollFocusedContextKey.get()!==!0&&(this._focused=!0,this._focusDisposableStore=new U,this._stickyScrollFocusedContextKey.set(!0),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumbers.length-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}focusNext(){this._focusedStickyElementIndex<this._stickyScrollWidget.lineNumberCount-1&&this._focusNav(!0)}focusPrevious(){this._focusedStickyElementIndex>0&&this._focusNav(!1)}selectEditor(){this._editor.focus()}_focusNav(e){this._focusedStickyElementIndex=e?this._focusedStickyElementIndex+1:this._focusedStickyElementIndex-1,this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex)}goToFocused(){const e=this._stickyScrollWidget.lineNumbers;this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:e[this._focusedStickyElementIndex],column:1})}_revealPosition(e){this._reveaInEditor(e,()=>this._editor.revealPosition(e))}_revealLineInCenterIfOutsideViewport(e){this._reveaInEditor(e,()=>this._editor.revealLineInCenterIfOutsideViewport(e.lineNumber,0))}_reveaInEditor(e,t){this._focused&&this._disposeFocusStickyScrollStore(),this._positionRevealed=!0,t(),this._editor.setSelection(k.fromPositions(e)),this._editor.focus()}_registerMouseListeners(){const e=this._register(new U),t=this._register(new tI(this._editor,{extractLineNumberFromMouseEvent:s=>{const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);return r?r.lineNumber:0}})),i=s=>{if(!this._editor.hasModel()||s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return null;const r=s.target.element;if(!r||r.innerText!==r.innerHTML)return null;const a=this._stickyScrollWidget.getEditorPositionFromNode(r);return a?{range:new k(a.lineNumber,a.column,a.lineNumber,a.column+r.innerText.length),textElement:r}:null},n=this._stickyScrollWidget.getDomNode();this._register(Si(n,te.CLICK,s=>{if(s.ctrlKey||s.altKey||s.metaKey||!s.leftButton)return;if(s.shiftKey){const c=this._stickyScrollWidget.getLineIndexFromChildDomNode(s.target);if(c===null)return;const d=new M(this._endLineNumbers[c],1);this._revealLineInCenterIfOutsideViewport(d);return}if(this._stickyScrollWidget.isInFoldingIconDomNode(s.target)){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);this._toggleFoldingRegionForLine(c);return}if(!this._stickyScrollWidget.isInStickyLine(s.target))return;let l=this._stickyScrollWidget.getEditorPositionFromNode(s.target);if(!l){const c=this._stickyScrollWidget.getLineNumberFromChildDomNode(s.target);if(c===null)return;l=new M(c,1)}this._revealPosition(l)})),this._register(W(bt,te.MOUSE_MOVE,s=>{this._mouseTarget=s.target,this._onMouseMoveOrKeyDown(s)})),this._register(W(bt,te.KEY_DOWN,s=>{this._onMouseMoveOrKeyDown(s)})),this._register(W(bt,te.KEY_UP,()=>{this._showEndForLine!==void 0&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._register(t.onMouseMoveOrRelevantKeyDown(([s,r])=>{const a=i(s);if(!a||!s.hasTriggerModifier||!this._editor.hasModel()){e.clear();return}const{range:l,textElement:c}=a;if(!l.equalsRange(this._stickyRangeProjectedOnEditor))this._stickyRangeProjectedOnEditor=l,e.clear();else if(c.style.textDecoration==="underline")return;const d=new Xt;e.add(ue(()=>d.dispose(!0)));let h;Zw(this._languageFeaturesService.definitionProvider,this._editor.getModel(),new M(l.startLineNumber,l.startColumn+1),!1,d.token).then((u=>{if(!d.token.isCancellationRequested)if(u.length!==0){this._candidateDefinitionsLength=u.length;const f=c;h!==f?(e.clear(),h=f,h.style.textDecoration="underline",e.add(ue(()=>{h.style.textDecoration="none"}))):h||(h=f,h.style.textDecoration="underline",e.add(ue(()=>{h.style.textDecoration="none"})))}else e.clear()}))})),this._register(t.onCancel(()=>{e.clear()})),this._register(t.onExecute(async s=>{if(s.target.type!==12||s.target.detail!==this._stickyScrollWidget.getId())return;const r=this._stickyScrollWidget.getEditorPositionFromNode(s.target.element);r&&(!this._editor.hasModel()||!this._stickyRangeProjectedOnEditor||(this._candidateDefinitionsLength>1&&(this._focused&&this._disposeFocusStickyScrollStore(),this._revealPosition({lineNumber:r.lineNumber,column:1})),this._instaService.invokeFunction(XZ,s,this._editor,{uri:this._editor.getModel().uri,range:this._stickyRangeProjectedOnEditor})))}))}_onContextMenu(e,t){const i=new yn(e,t);this._contextMenuService.showContextMenu({menuId:de.StickyScrollContext,getAnchor:()=>i})}_onMouseMoveOrKeyDown(e){if(!e.shiftKey||!this._mouseTarget||!ai(this._mouseTarget))return;const t=this._stickyScrollWidget.getLineIndexFromChildDomNode(this._mouseTarget);t===null||this._showEndForLine===t||(this._showEndForLine=t,this._renderStickyScroll())}_toggleFoldingRegionForLine(e){if(!this._foldingModel||e===null)return;const t=this._stickyScrollWidget.getRenderedStickyLine(e),i=t?.foldingIcon;if(!i)return;CF(this._foldingModel,1,[e]),i.isCollapsed=!i.isCollapsed;const n=(i.isCollapsed?this._editor.getTopForLineNumber(i.foldingEndLine):this._editor.getTopForLineNumber(i.foldingStartLine))-this._editor.getOption(75)*t.index+1;this._editor.setScrollTop(n),this._renderStickyScroll(e)}_readConfiguration(){const e=this._editor.getOption(131);if(e.enabled===!1){this._editor.removeOverlayWidget(this._stickyScrollWidget),this._resetState(),this._sessionStore.clear(),this._enabled=!1;return}else e.enabled&&!this._enabled&&(this._editor.addOverlayWidget(this._stickyScrollWidget),this._sessionStore.add(this._editor.onDidScrollChange(i=>{i.scrollTopChanged&&(this._showEndForLine=void 0,this._renderStickyScroll())})),this._sessionStore.add(this._editor.onDidLayoutChange(()=>this._onDidResize())),this._sessionStore.add(this._editor.onDidChangeModelTokens(i=>this._onTokensChange(i))),this._sessionStore.add(this._stickyLineCandidateProvider.onDidChangeStickyScroll(()=>{this._showEndForLine=void 0,this._renderStickyScroll()})),this._enabled=!0);this._editor.getOption(76).renderType===2&&this._sessionStore.add(this._editor.onDidChangeCursorPosition(()=>{this._showEndForLine=void 0,this._renderStickyScroll(0)}))}_readConfigurationChange(e){(e.hasChanged(131)||e.hasChanged(81)||e.hasChanged(75)||e.hasChanged(126)||e.hasChanged(76))&&this._readConfiguration(),(e.hasChanged(76)||e.hasChanged(52)||e.hasChanged(126))&&this._renderStickyScroll(0)}_needsUpdate(e){const t=this._stickyScrollWidget.getCurrentLines();for(const i of t)for(const n of e.ranges)if(i>=n.fromLineNumber&&i<=n.toLineNumber)return!0;return!1}_onTokensChange(e){this._needsUpdate(e)&&this._renderStickyScroll(0)}_onDidResize(){const t=this._editor.getLayoutInfo().height/this._editor.getOption(75);this._maxStickyLines=Math.round(t*.25),this._renderStickyScroll(0)}async _renderStickyScroll(e){const t=this._editor.getModel();if(!t||t.isTooLargeForTokenization()){this._resetState();return}const i=this._updateAndGetMinRebuildFromLine(e),n=this._stickyLineCandidateProvider.getVersionId();if(n===void 0||n===t.getVersionId())if(!this._focused)await this._updateState(i);else if(this._focusedStickyElementIndex===-1)await this._updateState(i),this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1,this._focusedStickyElementIndex!==-1&&this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex);else{const r=this._stickyScrollWidget.lineNumbers[this._focusedStickyElementIndex];await this._updateState(i),this._stickyScrollWidget.lineNumberCount===0?this._focusedStickyElementIndex=-1:(this._stickyScrollWidget.lineNumbers.includes(r)||(this._focusedStickyElementIndex=this._stickyScrollWidget.lineNumberCount-1),this._stickyScrollWidget.focusLineWithIndex(this._focusedStickyElementIndex))}}_updateAndGetMinRebuildFromLine(e){if(e!==void 0){const t=this._minRebuildFromLine!==void 0?this._minRebuildFromLine:1/0;this._minRebuildFromLine=Math.min(e,t)}return this._minRebuildFromLine}async _updateState(e){this._minRebuildFromLine=void 0,this._foldingModel=await nu.get(this._editor)?.getFoldingModel()??void 0,this._widgetState=this.findScrollWidgetState();const t=this._widgetState.startLineNumbers.length>0;this._stickyScrollVisibleContextKey.set(t),this._stickyScrollWidget.setState(this._widgetState,this._foldingModel,e)}async _resetState(){this._minRebuildFromLine=void 0,this._foldingModel=void 0,this._widgetState=w0.Empty,this._stickyScrollVisibleContextKey.set(!1),this._stickyScrollWidget.setState(void 0,void 0)}findScrollWidgetState(){const e=Math.min(this._maxStickyLines,this._editor.getOption(131).maxLineCount),t=this._editor.getScrollTop();let i=0;const n=[],s=[],r=this._editor.getVisibleRanges();if(r.length!==0){const a=new S0(r[0].startLineNumber,r[r.length-1].endLineNumber),l=this._stickyLineCandidateProvider.getCandidateStickyLinesIntersecting(a);for(const c of l){const d=c.startLineNumber,h=c.endLineNumber,u=c.top,f=u+c.height,g=this._editor.getTopForLineNumber(d)-t,m=this._editor.getBottomForLineNumber(h)-t;if(u>g&&u<=m&&(n.push(d),s.push(h+1),f>m&&(i=m-f)),n.length===e)break}}return this._endLineNumbers=s,new w0(n,s,i,this._showEndForLine)}dispose(){super.dispose(),this._sessionStore.dispose()}},C3=im,im.ID="store.contrib.stickyScrollController",im);ca=C3=nDe([Ab(1,Ko),Ab(2,he),Ab(3,ge),Ab(4,Jt),Ab(5,Or),Ab(6,xe)],ca);const x0=N("inlineEdit.originalBackground",Ne(wh,.2),p(1210,"Background color for the original text in inline edits."),!0),WX=N("inlineEdit.modifiedBackground",Ne(Df,.3),p(1211,"Background color for the modified text in inline edits."),!0);N("inlineEdit.originalChangedLineBackground",Ne(wh,.8),p(1212,"Background color for the changed lines in the original text of inline edits."),!0);const sDe=N("inlineEdit.originalChangedTextBackground",Ne(wh,.8),p(1213,"Overlay color for the changed text in the original text of inline edits."),!0),oDe=N("inlineEdit.modifiedChangedLineBackground",{light:Ne(xL,.7),dark:Ne(xL,.7),hcDark:xL,hcLight:xL},p(1214,"Background color for the changed lines in the modified text of inline edits."),!0),rDe=N("inlineEdit.modifiedChangedTextBackground",Ne(Df,.7),p(1215,"Overlay color for the changed text in the modified text of inline edits."),!0),aDe=N("inlineEdit.gutterIndicator.primaryForeground",NL,p(1216,"Foreground color for the primary inline edit gutter indicator.")),Ob=N("inlineEdit.gutterIndicator.primaryBorder",Ef,p(1217,"Border color for the primary inline edit gutter indicator.")),BX=N("inlineEdit.gutterIndicator.primaryBackground",{light:Ne(Ob,.5),dark:Ne(Ob,.4),hcDark:Ne(Ob,.4),hcLight:Ne(Ob,.5)},p(1218,"Background color for the primary inline edit gutter indicator.")),lDe=N("inlineEdit.gutterIndicator.secondaryForeground",ez,p(1219,"Foreground color for the secondary inline edit gutter indicator.")),HX=N("inlineEdit.gutterIndicator.secondaryBorder",TL,p(1220,"Border color for the secondary inline edit gutter indicator.")),VX=N("inlineEdit.gutterIndicator.secondaryBackground",HX,p(1221,"Background color for the secondary inline edit gutter indicator.")),cDe=N("inlineEdit.gutterIndicator.successfulForeground",NL,p(1222,"Foreground color for the successful inline edit gutter indicator.")),zX=N("inlineEdit.gutterIndicator.successfulBorder",Ef,p(1223,"Border color for the successful inline edit gutter indicator.")),UX=N("inlineEdit.gutterIndicator.successfulBackground",zX,p(1224,"Background color for the successful inline edit gutter indicator.")),dDe=N("inlineEdit.gutterIndicator.background",{hcDark:Ne("tab.inactiveBackground",.5),hcLight:Ne("tab.inactiveBackground",.5),dark:Ne("tab.inactiveBackground",.5),light:"#5f5f5f18"},p(1225,"Background color for the inline edit gutter indicator.")),k0=N("inlineEdit.originalBorder",{light:wh,dark:wh,hcDark:wh,hcLight:wh},p(1226,"Border color for the original text in inline edits.")),I0=N("inlineEdit.modifiedBorder",{light:$s(Df,.6),dark:Df,hcDark:Df,hcLight:Df},p(1227,"Border color for the modified text in inline edits.")),hDe=N("inlineEdit.tabWillAcceptModifiedBorder",{light:$s(I0,0),dark:$s(I0,0),hcDark:$s(I0,0),hcLight:$s(I0,0)},p(1228,"Modified border color for the inline edits widget when tab will accept it.")),uDe=N("inlineEdit.tabWillAcceptOriginalBorder",{light:$s(k0,0),dark:$s(k0,0),hcDark:$s(k0,0),hcLight:$s(k0,0)},p(1229,"Original border color for the inline edits widget over the original text when tab will accept it."));function D0(o){return o.map(e=>e===Xn.Accept?hDe:I0)}function yD(o){return o.map(e=>e===Xn.Accept?uDe:k0)}function Br(o,e){let t;typeof o=="string"?t=v3(o,e):t=o.map((n,s)=>v3(n,e).read(s));const i=v3(xi,e);return t.map((n,s)=>n.makeOpaque(i.read(s)))}function v3(o,e){return V6({owner:{observeColor:o},equalsFn:(t,i)=>t.equals(i),debugName:()=>`observeColor(${o})`},e.onDidColorThemeChange,()=>{const t=e.getColorTheme().getColor(o);if(!t)throw new Ce(`Missing color: ${o}`);return t})}function lu(o,e,t){o.layoutInfo.read(t),o.value.read(t);const i=o.model.read(t);if(!i)return 0;let n=0;o.scrollTop.read(t);for(let r=e.startLineNumber;r<e.endLineNumberExclusive;r++){const a=i.getLineMaxColumn(r);let l=o.editor.getOffsetForColumn(r,a);if(l===-1){const c=o.editor.getOption(59).typicalHalfwidthCharacterWidth;l=a*c}n=Math.max(n,l)}const s=e.mapToLineArray(r=>i.getLineContent(r));return n<5&&s.some(r=>r.length>0)&&i.uri.scheme!=="file"&&console.error("unexpected width"),n}function fDe(o,e,t){return o.layoutInfo.read(t),o.value.read(t),o.model.read(t)?(o.scrollTop.read(t),o.editor.getOffsetForColumn(e.lineNumber,e.column)):0}function w3(o,e,t,i){const n=i.getModel();if(!n)return{prefixTrim:0,prefixLeftOffset:0};const s=o.map(h=>h.isSingleLine()?h.startColumn-1:0),r=e.mapToLineArray(h=>XP(n.getLineContent(h))),a=t.filter(h=>h!=="").map(h=>XP(h)),l=Math.min(...s,...r,...a);let c;if(n.getLineIndentColumn(e.startLineNumber)>=l+1)c=i.getOffsetForColumn(e.startLineNumber,l+1);else if(t.length>0)c=S3(t[0].slice(0,l),i,n);else return{prefixTrim:0,prefixLeftOffset:0};return{prefixTrim:l,prefixLeftOffset:c}}function S3(o,e,t){const i=e.getOption(59).typicalHalfwidthCharacterWidth,n=t.getOptions().tabSize*i,s=o.split(" ").length-1;return(o.length-s)*i+s*n}function y3(o){const e=o.layoutInfoContentLeft,t=j({name:"editor.validOverlay.width"},n=>{const s=o.layoutInfoMinimap.read(n).minimapLeft!==0,r=o.layoutInfoWidth.read(n)-e.read(n);if(s){const a=o.layoutInfoMinimap.read(n).minimapWidth+o.layoutInfoVerticalScrollbarWidth.read(n);return r-a}return r}),i=j({name:"editor.validOverlay.height"},n=>o.layoutInfoHeight.read(n)+o.contentHeight.read(n));return j({name:"editor.validOverlay"},n=>kt.fromLeftTopWidthHeight(e.read(n),0,t.read(n),i.read(n)))}function gDe(o,e){const t=[];for(const i of o){const n=e.mapRange(i.modifiedRange);t.push(new Is(i.originalRange,n))}return t}function L3(...o){return o.filter(e=>typeof e=="string").join(" ")}function pDe(o,e){return new k(e.lineNumber,e.column+o.start,e.lineNumber,e.column+o.endExclusive)}function mDe(o,e){let t=0;e:for(let i=0,n=o.length;i<n;i++)switch(o.charCodeAt(i)){case 9:t+=e;break;case 32:t++;break;default:break e}return t-t%e}function _De(o,e,t){let i=e-e%t,n=0;for(;n<o.length&&i!==0;n++)switch(o.charCodeAt(n)){case 9:i-=t;break;case 32:i--;break;default:throw new Ce("Unexpected character found while calculating indent length")}return n}function bDe(o,e,t){const i=ro(o),n=[],s=qz(e.mapToLineArray(r=>mDe(i[r-1],t)),lo);return e.forEach(r=>{const a=_De(i[r-1],s,t);n.push(new Oi(pDe(new pe(0,a),new M(r,1)),""))}),new mo(n)}class x3{constructor(){this._data=""}moveTo(e){return this._data+=`M ${e.x} ${e.y} `,this}lineTo(e){return this._data+=`L ${e.x} ${e.y} `,this}build(){return this._data}}function Ql(o){const e=Tc(void 0,(t,i)=>o.read(t)||i);return In({debugName:()=>`${o.debugName}.mapOutFalsy`},t=>{if(e.read(t),!!o.read(t))return e})}function Hr(o){return{left:j({name:"editor.validOverlay.left"},e=>o(e).left),top:j({name:"editor.validOverlay.top"},e=>o(e).top),width:j({name:"editor.validOverlay.width"},e=>o(e).right-o(e).left),height:j({name:"editor.validOverlay.height"},e=>o(e).bottom-o(e).top)}}var CDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},k3=function(o,e){return function(t,i){e(t,i,o)}};let I3=class{constructor(e,t,i,n,s,r){this._model=e,this._close=t,this._editorObs=i,this._contextKeyService=n,this._keybindingService=s,this._commandService=r,this._inlineEditsShowCollapsed=this._editorObs.getOption(71).map(a=>a.edits.showCollapsed)}toDisposableLiveElement(){return this._createHoverContent().toDisposableLiveElement()}_createHoverContent(){const e=Le("active",void 0),t=h=>({title:h.title,icon:h.icon,keybinding:typeof h.commandId=="string"?this._getKeybinding(h.commandArgs?void 0:h.commandId):j(this,u=>typeof h.commandId=="string"?void 0:this._getKeybinding(h.commandArgs?void 0:h.commandId.read(u)).read(u)),isActive:e.map(u=>u===h.id),onHoverChange:u=>e.set(u?h.id:void 0,void 0),onAction:()=>(this._close(!0),this._commandService.executeCommand(typeof h.commandId=="string"?h.commandId:h.commandId.get(),...h.commandArgs??[]))}),i=wDe(this._model.displayName),n=Fb(t({id:"gotoAndAccept",title:`${p(1203,"Go To")} / ${p(1204,"Accept")}`,icon:Y.check,commandId:Aw})),s=Fb(t({id:"reject",title:p(1205,"Reject"),icon:Y.close,commandId:DG})),r=this._model.extensionCommands.map((h,u)=>Fb(t({id:h.command.id+"_"+u,title:h.command.title,icon:h.icon??Y.symbolEvent,commandId:h.command.id,commandArgs:h.command.arguments}))),a=this._inlineEditsShowCollapsed.map(h=>Fb(t(h?{id:"showExpanded",title:p(1206,"Show Expanded"),icon:Y.expandAll,commandId:P4}:{id:"showCollapsed",title:p(1207,"Show Collapsed"),icon:Y.collapseAll,commandId:P4}))),l=Fb(t({id:"settings",title:p(1208,"Settings"),icon:Y.gear,commandId:"workbench.action.openSettings",commandArgs:["@tag:nextEditSuggestions"]})),c=this._model.action?[this._model.action]:[],d=c.length>0?SDe(c.map(h=>({id:h.id,label:h.title+"...",enabled:!0,run:()=>this._commandService.executeCommand(h.id,...h.arguments??[]),class:void 0,tooltip:h.tooltip??h.title})),{hoverDelegate:Q1e}):void 0;return vDe([i,n,s,a,r.length?$X():void 0,l,...r,d?$X():void 0,d])}_getKeybinding(e){return e?rt(this._contextKeyService.onDidChangeContext,()=>this._keybindingService.lookupKeybinding(e)):Et(void 0)}};I3=CDe([k3(3,xe),k3(4,ot),k3(5,Tt)],I3);function vDe(o){return Pe.div({class:"content",style:{margin:4,minWidth:180}},o)}function wDe(o){return Pe.div({class:"header",style:{color:J(WV),fontSize:"13px",fontWeight:"600",padding:"0 4px",lineHeight:28}},[o])}function Fb(o){return j({name:"inlineEdits.option"},e=>Pe.div({class:["monaco-menu-option",o.isActive?.map(t=>t&&"active")],onmouseenter:()=>o.onHoverChange?.(!0),onmouseleave:()=>o.onHoverChange?.(!1),onclick:o.onAction,onkeydown:t=>{t.key==="Enter"&&o.onAction?.()},tabIndex:0,style:{borderRadius:3}},[Pe.elem("span",{style:{fontSize:16,display:"flex"}},[ve.isThemeIcon(o.icon)?Al(o.icon):o.icon.map(t=>Al(t))]),Pe.elem("span",{},[o.title]),Pe.div({style:{marginLeft:"auto"},ref:t=>{const i=e.store.add(new nb(t,so,{disableTitle:!0,...sK,keybindingLabelShadow:void 0,keybindingLabelForeground:J(WV),keybindingLabelBackground:"transparent",keybindingLabelBorder:"transparent",keybindingLabelBottomBorder:void 0}));e.store.add(Se(n=>{i.set(o.keybinding.read(n))}))}})]))}function SDe(o,e){return j({name:"inlineEdits.actionBar"},t=>Pe.div({class:["action-widget-action-bar"],style:{padding:"3px 24px"}},[Pe.div({ref:i=>{t.store.add(new Ys(i,e)).push(o,{icon:!1,label:!0})}})]))}function $X(){return Pe.div({id:"inline-edit-gutter-indicator-menu-separator",class:"menu-separator",style:{color:J(uce),padding:"2px 0"}},Pe.div({style:{borderBottom:`1px solid ${J(nM)}`}}))}var yDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},LD=function(o,e){return function(t,i){e(t,i,o)}};let D3=class extends A{get model(){const e=this._model.get();if(!e)throw new Ce("Inline Edit Model not available");return e}constructor(e,t,i,n,s,r,a,l,c,d){super(),this._editorObs=e,this._originalRange=t,this._verticalOffset=i,this._model=n,this._isHoveringOverInlineEdit=s,this._focusIsInMenu=r,this._hoverService=a,this._instantiationService=l,this._accessibilityService=c,this._tabAction=j(this,h=>{const u=this._model.read(h);return u?u.tabAction.read(h):Xn.Inactive}),this._hoverVisible=Le(this,!1),this.isHoverVisible=this._hoverVisible,this._isHoveredOverIcon=Le(this,!1),this._isHoveredOverIconDebounced=U6(this._isHoveredOverIcon,100),this.isHoveredOverIcon=this._isHoveredOverIconDebounced,this._isHoveredOverInlineEditDebounced=U6(this._isHoveringOverInlineEdit,100),this._gutterIndicatorStyles=this._tabAction.map(this,(h,u)=>{switch(h){case Xn.Inactive:return{background:Br(VX,d).read(u).toString(),foreground:Br(lDe,d).read(u).toString(),border:Br(HX,d).read(u).toString()};case Xn.Jump:return{background:Br(BX,d).read(u).toString(),foreground:Br(aDe,d).read(u).toString(),border:Br(Ob,d).read(u).toString()};case Xn.Accept:return{background:Br(UX,d).read(u).toString(),foreground:Br(cDe,d).read(u).toString(),border:Br(zX,d).read(u).toString()};default:ZC()}}),this._originalRangeObs=Ql(this._originalRange),this._state=j(this,h=>{const u=this._originalRangeObs.read(h);if(u)return{range:u,lineOffsetRange:this._editorObs.observeLineOffsetRange(u,this._store)}}),this._stickyScrollController=ca.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?rt(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Et(0),this._lineNumberToRender=j(this,h=>{if(this._verticalOffset.read(h)!==0)return"";const u=this._originalRange.read(h)?.startLineNumber,f=this._editorObs.getOption(76).read(h);if(u===void 0||f.renderType===0)return"";if(f.renderType===3){const g=this._editorObs.cursorPosition.read(h);return u%10===0||g&&g.lineNumber===u?u.toString():""}if(f.renderType===2){const g=this._editorObs.cursorPosition.read(h);if(!g)return"";const m=Math.abs(u-g.lineNumber);return m===0?u.toString():m.toString()}return f.renderType===4?f.renderFn?f.renderFn(u):"":u.toString()}),this._availableWidthForIcon=j(this,h=>{const u=this._editorObs.editor.getModel(),f=this._editorObs.editor,g=this._editorObs.layoutInfo.read(h),m=g.decorationsLeft+g.decorationsWidth-g.glyphMarginLeft;if(!u||m<=0)return()=>0;if(g.lineNumbersLeft===0)return()=>m;const _=this._editorObs.getOption(76).read(h);if(_.renderType===2||_.renderType===0)return()=>m;const b=f.getOption(59).typicalHalfwidthCharacterWidth,C=g.lineNumbersLeft+g.lineNumbersWidth,v=(u.getLineCount()+1).toString().length,S=[];for(let L=1;L<=v;L++){const x=10**(L-1),I=f.getTopForLineNumber(x),D=L*b,R=Math.min(m,Math.max(0,C-D-g.glyphMarginLeft));S.push({firstLineNumberWithDigitCount:x,topOfLineNumber:I,usableWidthLeftOfLineNumber:R})}return L=>{for(let x=S.length-1;x>=0;x--)if(L>=S[x].topOfLineNumber)return S[x].usableWidthLeftOfLineNumber;throw new Ce("Could not find avilable width for icon")}}),this._layout=j(this,h=>{const u=this._state.read(h);if(!u)return;const f=this._editorObs.layoutInfo.read(h),g=this._editorObs.observeLineHeightForLine(u.range.map(tt=>tt.startLineNumber)).read(h),m=2,_=f.decorationsLeft+f.decorationsWidth-f.glyphMarginLeft-2*m,b=f.height-2*m,C=kt.fromLeftTopWidthHeight(m,m,_,b),w=C.withTop(this._stickyScrollHeight.read(h)),v=C.withTop(w.top+m),S=u.lineOffsetRange.read(h),L=kt.fromRanges(pe.fromTo(v.left,v.right),S),x=g,I=this._verticalOffset.read(h),D=L.withHeight(x).translateY(I),R=w.containsRect(D),F=this._tabAction.map(tt=>tt===Xn.Accept?Y.keyboardTab:Y.arrowRight),O=j(this,tt=>{if(this._isHoveredOverIconDebounced.read(tt)||this._isHoveredOverInlineEditDebounced.read(tt))return Y.check;if(this._tabAction.read(tt)===Xn.Accept)return Y.keyboardTab;const Ke=this._editorObs.cursorLineNumber.read(tt)??0,At=u.range.read(tt).startLineNumber;return Ke<=At?Y.keyboardTabAbove:Y.keyboardTabBelow}),B=22,V=16,z=tt=>{const Ke=this._availableWidthForIcon.read(void 0)(tt.bottom+this._editorObs.editor.getScrollTop())-m;return Math.max(Math.min(Ke,B),V)};if(R){const tt=D;let Ke;f.lineNumbersWidth===0?Ke=Math.min(Math.max(f.lineNumbersLeft-C.left,0),tt.width-B):Ke=Math.max(f.lineNumbersLeft+f.lineNumbersWidth-C.left,0);const At=tt.withWidth(Ke),_t=Math.max(Math.min(f.decorationsWidth,B),V),tn=tt.withWidth(_t).translateX(Ke);return{gutterEditArea:L,icon:O,iconDirection:"right",iconRect:tn,pillRect:tt,lineNumberRect:At}}const ee=C.intersect(L);if(ee&&ee.height>=x){const tt=D.moveToBeContainedIn(v).moveToBeContainedIn(ee),Ke=tt.withWidth(z(tt));return{gutterEditArea:L,icon:O,iconDirection:"right",iconRect:Ke,pillRect:Ke}}const oe=D.moveToBeContainedIn(C),fe=oe.withWidth(z(oe)),Ie=fe,Ae=fe.top<D.top?"top":"bottom";return{gutterEditArea:L,icon:F,iconDirection:Ae,iconRect:Ie,pillRect:fe}}),this._iconRef=Pe.ref(),this.isVisible=this._layout.map(h=>!!h),this._indicator=Pe.div({class:"inline-edits-view-gutter-indicator",onclick:()=>{const u=this._layout.get()?.icon.get()===Y.check;this._editorObs.editor.focus(),u?this.model.accept():this.model.jump()},tabIndex:0,style:{position:"absolute",overflow:"visible"}},Ql(this._layout).map(h=>h?[Pe.div({style:{position:"absolute",background:J(dDe),borderRadius:"4px",...Hr(u=>h.read(u).gutterEditArea)}}),Pe.div({class:"icon",ref:this._iconRef,onmouseenter:()=>{this._showHover()},style:{cursor:"pointer",zIndex:"20",position:"absolute",backgroundColor:this._gutterIndicatorStyles.map(u=>u.background),"--vscodeIconForeground":this._gutterIndicatorStyles.map(u=>u.foreground),border:this._gutterIndicatorStyles.map(u=>`1px solid ${u.border}`),boxSizing:"border-box",borderRadius:"4px",display:"flex",justifyContent:"flex-end",transition:"background-color 0.2s ease-in-out, width 0.2s ease-in-out",...Hr(u=>h.read(u).pillRect)}},[Pe.div({className:"line-number",style:{lineHeight:h.map(u=>u.lineNumberRect?u.lineNumberRect.height:0),display:h.map(u=>u.lineNumberRect?"flex":"none"),alignItems:"center",justifyContent:"flex-end",width:h.map(u=>u.lineNumberRect?u.lineNumberRect.width:0),height:"100%",color:this._gutterIndicatorStyles.map(u=>u.foreground)}},this._lineNumberToRender),Pe.div({style:{rotate:h.map(u=>`${LDe(u.iconDirection)}deg`),transition:"rotate 0.2s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",height:"100%",marginRight:h.map(u=>u.pillRect.width-u.iconRect.width-(u.lineNumberRect?.width??0)),width:h.map(u=>u.iconRect.width)}},[h.map((u,f)=>Al(u.icon.read(f)))])])]:[])).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._indicator.element,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:Et(0)})),this._register(this._editorObs.editor.onMouseMove(h=>{if(this._state.get()===void 0)return;const g=this._iconRef.element.getBoundingClientRect(),m=kt.fromLeftTopWidthHeight(g.left,g.top,g.width,g.height),_=new en(h.event.posx,h.event.posy);this._isHoveredOverIcon.set(m.containsPoint(_),void 0)})),this._register(this._editorObs.editor.onDidScrollChange(()=>{this._isHoveredOverIcon.set(!1,void 0)})),this._register(Sa(this._isHoveredOverInlineEditDebounced,h=>{h&&this.triggerAnimation()})),this._register(Se(h=>{this._indicator.readEffect(h),this._indicator.element&&this._editorObs.editor.applyFontInfo(this._indicator.element)}))}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{outline:`2px solid ${this._gutterIndicatorStyles.map(t=>t.border).get()}`,outlineOffset:"-1px",offset:0},{outline:"2px solid transparent",outlineOffset:"10px",offset:1}],{duration:500}).finished}_showHover(){if(this._hoverVisible.get())return;const e=new U,t=e.add(this._instantiationService.createInstance(I3,this.model,s=>{s&&this._editorObs.editor.focus(),n?.dispose()},this._editorObs).toDisposableLiveElement()),i=e.add(br(t.element));e.add(i.onDidBlur(()=>this._focusIsInMenu.set(!1,void 0))),e.add(i.onDidFocus(()=>this._focusIsInMenu.set(!0,void 0))),e.add(ue(()=>this._focusIsInMenu.set(!1,void 0)));const n=this._hoverService.showInstantHover({target:this._iconRef.element,content:t.element});n?(this._hoverVisible.set(!0,void 0),e.add(this._editorObs.editor.onDidScrollChange(()=>n.dispose())),e.add(n.onDispose(()=>{this._hoverVisible.set(!1,void 0),e.dispose()}))):e.dispose()}};D3=yDe([LD(6,Qs),LD(7,ge),LD(8,bn),LD(9,li)],D3);function LDe(o){switch(o){case"top":return 90;case"bottom":return-90;case"right":return 0}}var xDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jX=function(o,e){return function(t,i){e(t,i,o)}},er;(function(o){o.FirstTime="firstTime",o.SecondTime="secondTime",o.Active="active"})(er||(er={}));let E3=class extends A{constructor(e,t,i,n,s,r){super(),this._host=e,this._model=t,this._indicator=i,this._collapsedView=n,this._storageService=s,this._configurationService=r,this._disposables=this._register(new ct),this._setupDone=Le({name:"setupDone"},!1),this._activeCompletionId=j(a=>{const l=this._model.read(a);if(!l||!this._setupDone.read(a))return;const c=this._indicator.read(a);if(!(!c||!c.isVisible.read(a)))return l.inlineEdit.inlineCompletion.identity.id}),this._register(this._initializeDebugSetting()),this._disposables.value=this.setupNewUserExperience(),this._setupDone.set(!0,void 0)}setupNewUserExperience(){if(this.getNewUserType()===er.Active)return;const e=new U;let t=!1,i=!1,n=0,s=0;return e.add(Bne(this._activeCompletionId,async(r,a,l,c)=>{if(r===void 0)return;let d=this.getNewUserType();switch(d){case er.FirstTime:{(n++>=5||t)&&(d=er.SecondTime,this.setNewUserType(d));break}case er.SecondTime:{s++>=3&&i&&(d=er.Active,this.setNewUserType(d));break}}switch(d){case er.FirstTime:{for(let h=0;h<3&&!c.isCancellationRequested;h++)await this._indicator.get()?.triggerAnimation(),await al(500);break}case er.SecondTime:{this._indicator.get()?.triggerAnimation();break}}})),e.add(Se(r=>{this._collapsedView.isVisible.read(r)&&this.getNewUserType()!==er.Active&&this._collapsedView.triggerAnimation()})),e.add(Bn((r,a)=>{const l=this._indicator.read(r);l&&a.add(Sa(l.isHoveredOverIcon,async c=>{c&&(t=!0)}))})),e.add(Bn((r,a)=>{const l=this._host.read(r);l&&a.add(l.onDidAccept(()=>{i=!0}))})),e}getNewUserType(){return this._storageService.get("inlineEditsGutterIndicatorUserKind",-1,er.FirstTime)}setNewUserType(e){switch(e){case er.FirstTime:throw new Ce("UserKind should not be set to first time");case er.SecondTime:break;case er.Active:this._disposables.clear();break}this._storageService.store("inlineEditsGutterIndicatorUserKind",e,-1,0)}_initializeDebugSetting(){const e="editor.inlineSuggest.edits.resetNewUserExperience";return this._configurationService.getValue(e)&&this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._configurationService.onDidChangeConfiguration(i=>{i.affectsConfiguration(e)&&this._configurationService.getValue(e)&&(this._storageService.remove("inlineEditsGutterIndicatorUserKind",-1),this._disposables.value=this.setupNewUserExperience())})}};E3=xDe([jX(4,Es),jX(5,Me)],E3);var kDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IDe=function(o,e){return function(t,i){e(t,i,o)}};let N3=class extends A{constructor(e,t,i){super(),this._editor=e,this._edit=t,this._accessibilityService=i,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._iconRef=Pe.ref(),this.isHovered=Et(!1),this._editorObs=ni(this._editor);const s=this._edit.map(c=>c?.edit.replacements[0]??null).map(c=>c?Dd(c,this._editor.getModel()).range.getStartPosition():null),r=this._editorObs.observePosition(s,this._store),a=j(c=>{const d=r.read(c);if(!d)return null;const h=this._editorObs.layoutInfoContentLeft.read(c),u=this._editorObs.scrollLeft.read(c);return new en(h+d.x-u,d.y)}),l=Pe.div({class:"inline-edits-collapsed-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[[this.getCollapsedIndicator(a)]]).keepUpdated(this._store).element;this._register(this._editorObs.createOverlayWidget({domNode:l,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:Et(0)})),this.isVisible=this._edit.map((c,d)=>!!c&&a.read(d)!==null)}triggerAnimation(){return this._accessibilityService.isMotionReduced()?new Animation(null,null).finished:this._iconRef.element.animate([{offset:0,transform:"translateY(-3px)"},{offset:.2,transform:"translateY(1px)"},{offset:.36,transform:"translateY(-1px)"},{offset:.52,transform:"translateY(1px)"},{offset:.68,transform:"translateY(-1px)"},{offset:.84,transform:"translateY(1px)"},{offset:1,transform:"translateY(0px)"}],{duration:2e3}).finished}getCollapsedIndicator(e){const t=this._editorObs.layoutInfoContentLeft,i=e.map((s,r)=>s?s.deltaX(-t.read(r)):null),n=this.createIconPath(i);return Pe.svg({class:"collapsedView",ref:this._iconRef,style:{position:"absolute",...Hr(s=>y3(this._editorObs).read(s)),overflow:"hidden",pointerEvents:"none"}},[Pe.svgElem("path",{class:"collapsedViewPath",d:n,fill:J(Ob)})])}createIconPath(e){return e.map(s=>{if(!s)return new x3().build();const r=s.deltaX(-6/2).deltaY(-1),a=r.deltaX(6),l=r.deltaY(1),c=a.deltaY(1),d=l.deltaX(6/2).deltaY(3);return new x3().moveTo(r).lineTo(a).lineTo(c).lineTo(d).lineTo(l).lineTo(r).build()})}};N3=kDe([IDe(2,bn)],N3);var DDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qX=function(o,e){return function(t,i){e(t,i,o)}};const xD=14,T3=0,Nd=4,kD=4,KX=2;let R3=class extends A{constructor(e,t,i,n,s){super(),this._editor=e,this._languageService=s,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._isHovered=Le(this,!1),this.isHovered=this._isHovered,this._viewRef=Pe.ref(),this._editorObs=ni(this._editor);const r=i.map((d,h)=>{let u;switch(d){case Xn.Inactive:u=VX;break;case Xn.Jump:u=BX;break;case Xn.Accept:u=UX;break}return{border:Br(u,n).read(h).toString(),background:J(xi)}}),a=t.map(d=>d?this.getState(d):void 0),l=a.map(d=>d?this.getRendering(d,r):void 0);this.minEditorScrollHeight=j(this,d=>{const h=a.read(d);return h?h.rect.read(d).bottom+this._editor.getScrollTop():0});const c=Pe.div({class:"inline-edits-custom-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:"block"}},[l]).keepUpdated(this._store);this._register(this._editorObs.createOverlayWidget({domNode:c.element,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:Tc(this,(d,h)=>{const u=a.read(d);if(!u)return h??0;const f=u.rect.map(g=>g.right).read(d)+this._editorObs.layoutInfoVerticalScrollbarWidth.read(d)+Nd-this._editorObs.layoutInfoContentLeft.read(d);return Math.max(h??0,f)}).recomputeInitiallyAndOnChange(this._store)})),this._register(Se(d=>{if(!l.read(d)){this._isHovered.set(!1,void 0);return}this._isHovered.set(c.isHovered.read(d),void 0)}))}fitsInsideViewport(e,t,i){const n=this._editorObs.layoutInfoWidth.read(i),s=this._editorObs.layoutInfoContentLeft.read(i),r=this._editor.getLayoutInfo().verticalScrollbarWidth,a=this._editorObs.layoutInfoMinimap.read(i).minimapLeft!==0?this._editorObs.layoutInfoMinimap.read(i).minimapWidth:0,l=lu(this._editorObs,e,void 0),c=S3(t,this._editor,this._editor.getModel()),d=Nd+xD;return l+c+d<n-s-r-a}getState(e){const t=j(this,a=>{const l=e.range.startLineNumber,c=e.range.endLineNumber,d=e.range.startColumn,h=e.range.endColumn,u=this._editor.getModel()?.getLineCount()??0,f=lu(this._editorObs,new ke(l,l+1),a),g=l+1<=u?lu(this._editorObs,new ke(l+1,l+2),a):void 0,m=l-1>=1?lu(this._editorObs,new ke(l-1,l),a):void 0,_=this._editor.getOffsetForColumn(l,d),b=this._editor.getOffsetForColumn(c,h);return{lineWidth:f,lineWidthBelow:g,lineWidthAbove:m,startContentLeftOffset:_,endContentLeftOffset:b}}),i=e.range.startLineNumber,n=e.range.endLineNumber,s=this.fitsInsideViewport(new ke(i,n+1),e.label,void 0);return{rect:j(this,a=>{const l=this._editorObs.getOption(59).read(a).typicalHalfwidthCharacterWidth,{lineWidth:c,lineWidthBelow:d,lineWidthAbove:h,startContentLeftOffset:u,endContentLeftOffset:f}=t.read(a),g=this._editorObs.layoutInfoContentLeft.read(a),m=this._editorObs.observeLineHeightForLine(i).recomputeInitiallyAndOnChange(a.store).read(a),_=this._editorObs.scrollTop.read(a),b=this._editorObs.scrollLeft.read(a);let C;i===n&&f+5*l>=c&&s?C="end":d!==void 0&&d+xD-kD-Nd<u?C="below":h!==void 0&&h+xD-kD-Nd<u?C="above":C="end";let w,v,S=0,L=0;switch(C){case"end":{w=this._editorObs.editor.getTopForLineNumber(i),v=c,S=Nd+xD;break}case"below":{w=this._editorObs.editor.getTopForLineNumber(i+1),v=u,S=Nd+kD,L=T3+KX;break}case"above":{w=this._editorObs.editor.getTopForLineNumber(i-1),v=u,S=Nd+kD,L=-T3+KX;break}}return kt.fromLeftTopWidthHeight(g+v-b,w-_,l*e.label.length,m).withMargin(T3,Nd).translateX(S).translateY(L)}),label:e.label,kind:e.kind}}getRendering(e,t){const i=document.createElement("div"),n=this._editor.getModel().tokenization.tokenizeLinesAt(1,[e.label])?.[0];let s;n&&e.kind===VM.Code?s=Oc.fromLineTokens(n).toLineTokens(e.label,this._languageService.languageIdCodec):s=bi.createEmpty(e.label,this._languageService.languageIdCodec);const r=hw(new uw([s]),dd.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],i,!0);i.style.width=`${r.minWidthInPx}px`;const a=e.rect.map(l=>l.withMargin(0,Nd));return Pe.div({class:"collapsedView",ref:this._viewRef,style:{position:"absolute",...Hr(l=>a.read(l)),overflow:"hidden",boxSizing:"border-box",cursor:"pointer",border:t.map(l=>`1px solid ${l.border}`),borderRadius:"4px",backgroundColor:t.map(l=>l.background),display:"flex",alignItems:"center",justifyContent:"center",whiteSpace:"nowrap"},onmousedown:l=>{l.preventDefault()},onclick:l=>{this._onDidClick.fire(new yn(me(l),l))}},[i])}};R3=DDe([qX(3,li),qX(4,Mt)],R3);const EDe=0,NDe=0,M3=1,TDe=1,RDe=3,P3=4;class MDe extends A{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._uiState=i,this._tabAction=n,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._display=j(this,a=>this._uiState.read(a)?"block":"none"),this._editorMaxContentWidthInRange=j(this,a=>{const l=this._originalDisplayRange.read(a);return l?(this._editorObs.versionId.read(a),Tc(this,(c,d)=>{const h=lu(this._editorObs,l,c);return Math.max(h,d??0)})):Et(0)}).map((a,l)=>a.read(l)),this._maxPrefixTrim=j(this,a=>{const l=this._uiState.read(a);return l?w3(l.deletions,l.originalRange,[],this._editor):{prefixTrim:0,prefixLeftOffset:0}}),this._editorLayoutInfo=j(this,a=>{const l=this._edit.read(a);if(!l||!this._uiState.read(a))return null;const d=this._editorObs.layoutInfo.read(a),h=this._editorObs.scrollLeft.read(a),u=this._editorObs.getOption(59).map(w=>w.typicalHalfwidthCharacterWidth).read(a),f=d.contentLeft+Math.max(this._editorMaxContentWidthInRange.read(a),u)-h,g=l.originalLineRange,m=this._originalVerticalStartPosition.read(a)??this._editor.getTopForLineNumber(g.startLineNumber)-this._editorObs.scrollTop.read(a),_=this._originalVerticalEndPosition.read(a)??this._editor.getTopForLineNumber(g.endLineNumberExclusive)-this._editorObs.scrollTop.read(a),b=d.contentLeft+this._maxPrefixTrim.read(a).prefixLeftOffset-h;return f<=b?null:{codeRect:kt.fromLeftTopRightBottom(b,m,f,_).withMargin(NDe,EDe),contentLeft:d.contentLeft}}).recomputeInitiallyAndOnChange(this._store),this._originalOverlay=Pe.div({style:{pointerEvents:"none"}},j(this,a=>{const l=Ql(this._editorLayoutInfo).read(a);if(!l)return;const c=l.map(f=>kt.fromLeftTopRightBottom(f.contentLeft-P3-M3,f.codeRect.top,f.contentLeft,f.codeRect.bottom)),d=j(this,f=>{const g=l.read(f).codeRect,m=c.read(f);return g.intersectHorizontal(new pe(m.left,Number.MAX_SAFE_INTEGER))}),h=this._uiState.map(f=>f?.inDiffEditor?RDe:TDe).read(a),u=d.map(f=>f.withMargin(h,h));return[Pe.div({class:"originalSeparatorDeletion",style:{...u.read(a).toStyles(),borderRadius:`${P3}px`,border:`${M3+h}px solid ${J(xi)}`,boxSizing:"border-box"}}),Pe.div({class:"originalOverlayDeletion",style:{...d.read(a).toStyles(),borderRadius:`${P3}px`,border:yD(this._tabAction).map(f=>`${M3}px solid ${J(f)}`),boxSizing:"border-box",backgroundColor:J(x0)}}),Pe.div({class:"originalOverlayHiderDeletion",style:{...c.read(a).toStyles(),backgroundColor:J(xi)}})]})).keepUpdated(this._store),this._nonOverflowView=Pe.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._originalOverlay]]).keepUpdated(this._store),this.isHovered=Et(!1),this._editorObs=ni(this._editor);const s=j(this,a=>{const l=this._edit.read(a);return l?new M(l.originalLineRange.startLineNumber,1):null}),r=j(this,a=>{const l=this._edit.read(a);return l?new M(l.originalLineRange.endLineNumberExclusive,1):null});this._originalDisplayRange=this._uiState.map(a=>a?.originalRange),this._originalVerticalStartPosition=this._editorObs.observePosition(s,this._store).map(a=>a?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(r,this._store).map(a=>a?.y),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:j(this,a=>{const l=this._editorLayoutInfo.read(a);return l===null?0:l.codeRect.width})}))}}var PDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},GX=function(o,e){return function(t,i){e(t,i,o)}};const E0=1,ADe=1,ODe=3,A3=4;let O3=class extends A{constructor(e,t,i,n,s){super(),this._editor=e,this._input=t,this._tabAction=i,this._languageService=s,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._state=j(this,r=>{const a=this._input.read(r);if(!a)return;const l=this._editor.getModel(),c=l.getEOL();if(a.startColumn===1&&a.lineNumber>1&&l.getLineLength(a.lineNumber)!==0&&a.text.endsWith(c)&&!a.text.startsWith(c)){const d=l.getLineLength(a.lineNumber-1)+1;return{lineNumber:a.lineNumber-1,column:d,text:c+a.text.slice(0,-c.length)}}return{lineNumber:a.lineNumber,column:a.startColumn,text:a.text}}),this._trimVertically=j(this,r=>{const a=this._state.read(r),l=a?.text;if(!l||l.trim()==="")return{topOffset:0,bottomOffset:0,linesTop:0,linesBottom:0};const c=this._editor.getLineHeightForPosition(new M(a.lineNumber,1)),d=this._editor.getModel().getEOL();let h=0,u=0,f=0;for(;f<l.length&&l.startsWith(d,f);f+=d.length)h+=1;for(let g=l.length;g>f&&l.endsWith(d,g);g-=d.length)u+=1;return{topOffset:h*c,bottomOffset:u*c,linesTop:h,linesBottom:u}}),this._maxPrefixTrim=j(this,r=>{const a=this._state.read(r);if(!a)return{prefixLeftOffset:0,prefixTrim:0};const l=this._editor.getModel(),c=l.getEOL(),d=this._trimVertically.read(r),h=a.text.split(c),u=h.slice(d.linesTop,h.length-d.linesBottom);d.linesTop===0&&(u[0]=l.getLineContent(a.lineNumber)+u[0]);const f=new ke(a.lineNumber,a.lineNumber+(d.linesTop>0?0:1));return w3([],f,u,this._editor)}),this._ghostText=j(r=>{const a=this._state.read(r),l=this._maxPrefixTrim.read(r);if(!a)return;const d=this._editor.getModel().getEOL(),u=a.text.split(d).map((f,g)=>new tg(new k(g+1,g===0?1:l.prefixTrim+1,g+1,f.length+1),"modified-background",0));return new h0(a.lineNumber,[new rD(a.column,a.text,!1,u)])}),this._display=j(this,r=>this._state.read(r)?"block":"none"),this._editorMaxContentWidthInRange=j(this,r=>{const a=this._state.read(r);if(!a)return 0;this._editorObs.versionId.read(r);const l=this._editor.getModel(),c=l.getEOL(),d=a.text.startsWith(c)?"":l.getValueInRange(new k(a.lineNumber,1,a.lineNumber,a.column)),h=l.getValueInRange(new k(a.lineNumber,a.column,a.lineNumber,l.getLineLength(a.lineNumber)+1)),f=(d+a.text+h).split(c),g=dd.fromEditor(this._editor).withSetWidth(!1).withScrollBeyondLastColumn(0),m=f.map(_=>{const b=l.tokenization.tokenizeLinesAt(a.lineNumber,[_])?.[0];let C;return b?C=Oc.fromLineTokens(b).toLineTokens(_,this._languageService.languageIdCodec):C=bi.createEmpty(_,this._languageService.languageIdCodec),hw(new uw([C]),g,[],Q("div"),!0).minWidthInPx});return Math.max(...m)}),this.startLineOffset=this._trimVertically.map(r=>r.topOffset),this.originalLines=this._state.map(r=>r?new ke(r.lineNumber,Math.min(r.lineNumber+2,this._editor.getModel().getLineCount()+1)):void 0),this._overlayLayout=j(this,r=>{this._ghostText.read(r);const a=this._state.read(r);if(!a)return null;this._editorObs.observePosition(Le(this,new M(a.lineNumber,a.column)),r.store).read(r);const l=this._editorObs.layoutInfo.read(r),c=this._editorObs.scrollLeft.read(r),d=this._editorObs.layoutInfoVerticalScrollbarWidth.read(r),h=l.contentLeft+this._editorMaxContentWidthInRange.read(r)-c,u=this._maxPrefixTrim.read(r).prefixLeftOffset??0,f=l.contentLeft+u-c;if(h<=f)return null;const{topOffset:g,bottomOffset:m}=this._trimVertically.read(r),_=this._editorObs.scrollTop.read(r),b=this._ghostTextView.height.read(r)-g-m,C=this._editor.getTopForLineNumber(a.lineNumber)-_+g,w=C+b,v=new kt(f,C,h,w);return{overlay:v,startsAtContentLeft:u===0,contentLeft:l.contentLeft,minContentWidthRequired:u+v.width+d}}).recomputeInitiallyAndOnChange(this._store),this._modifiedOverlay=Pe.div({style:{pointerEvents:"none"}},j(this,r=>{const a=Ql(this._overlayLayout).read(r);if(!a)return;const l=a.map(u=>kt.fromLeftTopRightBottom(u.contentLeft-A3-E0,u.overlay.top,u.contentLeft,u.overlay.bottom)).read(r),c=this._input.map(u=>u?.inDiffEditor?ODe:ADe).read(r),d=a.map(u=>u.overlay.withMargin(0,E0,0,u.startsAtContentLeft?0:E0).intersectHorizontal(new pe(l.left,Number.MAX_SAFE_INTEGER))),h=d.map(u=>u.withMargin(c,c));return[Pe.div({class:"originalUnderlayInsertion",style:{...h.read(r).toStyles(),borderRadius:A3,border:`${E0+c}px solid ${J(xi)}`,boxSizing:"border-box"}}),Pe.div({class:"originalOverlayInsertion",style:{...d.read(r).toStyles(),borderRadius:A3,border:D0(this._tabAction).map(u=>`${E0}px solid ${J(u)}`),boxSizing:"border-box",backgroundColor:J(WX)}}),Pe.div({class:"originalOverlayHiderInsertion",style:{...l.toStyles(),backgroundColor:J(xi)}})]})).keepUpdated(this._store),this._view=Pe.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[[this._modifiedOverlay]]).keepUpdated(this._store),this._editorObs=ni(this._editor),this._ghostTextView=this._register(n.createInstance(v0,this._editor,{ghostText:this._ghostText,minReservedLineCount:Et(0),targetTextModel:this._editorObs.model.map(r=>r??void 0),warning:Et(void 0),handleInlineCompletionShown:Et(()=>{})},Le(this,{syntaxHighlightingEnabled:!0,extraClasses:["inline-edit"]}),!0,!0)),this.isHovered=this._ghostTextView.isHovered,this._register(this._ghostTextView.onDidClick(r=>{this._onDidClick.fire(r)})),this._register(this._editorObs.createOverlayWidget({domNode:this._view.element,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:j(this,r=>{const a=this._overlayLayout.read(r);return a===null?0:a.minContentWidthRequired})}))}};O3=PDe([GX(3,ge),GX(4,Mt)],O3);var FDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZX=function(o,e){return function(t,i){e(t,i,o)}};let F3=class extends A{constructor(e,t,i,n,s,r){super(),this._editor=e,this._edit=t,this._isInDiffEditor=i,this._tabAction=n,this._languageService=s,this._themeService=r,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._maxPrefixTrim=this._edit.map(a=>a?w3(a.replacements.flatMap(l=>[l.originalRange,l.modifiedRange]),a.originalRange,a.modifiedLines,this._editor.editor):void 0),this._modifiedLineElements=j(this,a=>{const l=[];let c=0;const d=this._maxPrefixTrim.read(a),h=this._edit.read(a);if(!h||!d)return;const u=d.prefixTrim,f=WDe(h.replacements.map(_=>_.modifiedRange)).map(_=>new k(_.startLineNumber,_.startColumn-u,_.endLineNumber,_.endColumn-u)),g=this._editor.model.get(),m=h.modifiedRange.startLineNumber;for(let _=0;_<h.modifiedRange.length;_++){const b=document.createElement("div"),C=m+_,w=h.modifiedLines[_].slice(u),v=g.tokenization.tokenizeLinesAt(C,[w])?.[0];let S;v?S=Oc.fromLineTokens(v).toLineTokens(w,this._languageService.languageIdCodec):S=bi.createEmpty(w,this._languageService.languageIdCodec);const L=[];for(const I of f.filter(D=>D.startLineNumber===C)){const D=Math.min(I.endColumn,w.length+1);L.push(new tg(new k(1,I.startColumn,1,D),"inlineCompletions-modified-bubble",0))}const x=hw(new uw([S]),dd.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),L,b,!0);this._editor.getOption(59).read(a),c=Math.max(c,x.minWidthInPx),l.push(b)}return{lines:l,requiredWidth:c}}),this._layout=j(this,a=>{const l=this._modifiedLineElements.read(a),c=this._maxPrefixTrim.read(a),d=this._edit.read(a);if(!l||!c||!d)return;const{prefixLeftOffset:h}=c,{requiredWidth:u}=l,f=this._editor.observeLineHeightsForLineRange(d.originalRange).read(a),g=(()=>{const ee=f.slice(0,d.modifiedRange.length);for(;ee.length<d.modifiedRange.length;)ee.push(f[f.length-1]);return ee})(),m=this._editor.layoutInfoContentLeft.read(a),_=this._editor.layoutInfoVerticalScrollbarWidth.read(a),b=this._editor.scrollLeft.read(a),C=this._editor.scrollTop.read(a),w=m-b,v=this._editor.editor.getModel(),S=d.originalRange.mapToLineArray(ee=>this._editor.editor.getOffsetForColumn(ee,v.getLineMaxColumn(ee))-h),L=Math.max(...S,u),x=d.originalRange.startLineNumber,I=d.originalRange.endLineNumberExclusive-1,D=this._editor.editor.getTopForLineNumber(x)-C,R=this._editor.editor.getBottomForLineNumber(I)-C,F=kt.fromLeftTopWidthHeight(w+h,D,L,R-D),O=kt.fromLeftTopWidthHeight(F.left,F.bottom,F.width,g.reduce((ee,se)=>ee+se,0)),B=kt.hull([F,O]),V=B.intersectVertical(new pe(F.bottom,Number.MAX_SAFE_INTEGER)),z=new kt(V.left,V.top,V.right,V.bottom);return{originalLinesOverlay:F,modifiedLinesOverlay:O,background:B,lowerBackground:V,lowerText:z,modifiedLineHeights:g,minContentWidthRequired:h+L+_}}),this._viewZoneInfo=j(a=>{if(!this._editor.getOption(71).map(f=>f.edits.allowCodeShifting==="always").read(a))return;const c=this._layout.read(a),d=this._edit.read(a);if(!c||!d)return;const h=c.lowerBackground.height,u=d.originalRange.endLineNumberExclusive;return{height:h,lineNumber:u}}),this.minEditorScrollHeight=j(this,a=>{const l=Ql(this._layout).read(a);return!l||this._viewZoneInfo.read(a)!==void 0?0:l.read(a).lowerText.bottom+this._editor.editor.getScrollTop()}),this._div=Pe.div({class:"line-replacement"},[j(this,a=>{const l=Ql(this._layout).read(a),c=this._modifiedLineElements.read(a);if(!l||!c)return[];const d=l.read(a),h=this._editor.layoutInfoContentLeft.read(a),u=this._isInDiffEditor.read(a)?3:1;c.lines.forEach((m,_)=>{m.style.width=`${d.lowerText.width}px`,m.style.height=`${d.modifiedLineHeights[_]}px`,m.style.position="relative"});const f=D0(this._tabAction).read(a),g=yD(this._tabAction).read(a);return[Pe.div({style:{position:"absolute",...Hr(m=>y3(this._editor).read(m)),overflow:"hidden",pointerEvents:"none"}},[Pe.div({class:"borderAroundLineReplacement",style:{position:"absolute",...Hr(m=>l.read(m).background.translateX(-h).withMargin(u)),borderRadius:"4px",border:`${u+1}px solid ${J(xi)}`,boxSizing:"border-box",pointerEvents:"none"}}),Pe.div({class:"originalOverlayLineReplacement",style:{position:"absolute",...Hr(m=>l.read(m).background.translateX(-h)),borderRadius:"4px",border:Br(g,this._themeService).map(m=>`1px solid ${m.toString()}`),pointerEvents:"none",boxSizing:"border-box",background:J(x0)}}),Pe.div({class:"modifiedOverlayLineReplacement",style:{position:"absolute",...Hr(m=>l.read(m).lowerBackground.translateX(-h)),borderRadius:"0 0 4px 4px",background:J(xi),boxShadow:`${J(wL)} 0 6px 6px -6px`,border:`1px solid ${J(f)}`,boxSizing:"border-box",overflow:"hidden",cursor:"pointer",pointerEvents:"auto"},onmousedown:m=>{m.preventDefault()},onclick:m=>this._onDidClick.fire(new yn(me(m),m))},[Pe.div({style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",background:J(oDe)}})]),Pe.div({class:"modifiedLinesLineReplacement",style:{position:"absolute",boxSizing:"border-box",...Hr(m=>l.read(m).lowerText.translateX(-h)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",whiteSpace:"nowrap",borderRadius:"0 0 4px 4px",overflow:"hidden"}},[...c.lines])])]})]).keepUpdated(this._store),this.isHovered=this._editor.isTargetHovered(a=>this._isMouseOverWidget(a),this._store),this._previousViewZoneInfo=void 0,this._register(ue(()=>this._editor.editor.changeViewZones(a=>this.removePreviousViewZone(a)))),this._register(Tne(this._viewZoneInfo,({lastValue:a,newValue:l})=>{a===l||a?.height===l?.height&&a?.lineNumber===l?.lineNumber||this._editor.editor.changeViewZones(c=>{this.removePreviousViewZone(c),l&&this.addViewZone(l,c)})})),this._register(this._editor.createOverlayWidget({domNode:this._div.element,minContentWidthInPx:j(this,a=>this._layout.read(a)?.minContentWidthRequired??0),position:Et({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}_isMouseOverWidget(e){const t=this._layout.get();return!t||!(e.event instanceof Hc)?!1:t.lowerBackground.containsPoint(new en(e.event.relativePos.x,e.event.relativePos.y))}removePreviousViewZone(e){if(!this._previousViewZoneInfo)return;e.removeZone(this._previousViewZoneInfo.id);const t=this._editor.cursorLineNumber.get();t!==null&&t>=this._previousViewZoneInfo.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()-this._previousViewZoneInfo.height),this._previousViewZoneInfo=void 0}addViewZone(e,t){const i=t.addZone({afterLineNumber:e.lineNumber-1,heightInPx:e.height,domNode:Q("div")});this._previousViewZoneInfo={height:e.height,lineNumber:e.lineNumber,id:i};const n=this._editor.cursorLineNumber.get();n!==null&&n>=e.lineNumber&&this._editor.editor.setScrollTop(this._editor.scrollTop.get()+e.height)}};F3=FDe([ZX(4,Mt),ZX(5,li)],F3);function WDe(o){const e=[];for(;o.length;){let t=o.shift();t.startLineNumber!==t.endLineNumber&&(o.push(new k(t.startLineNumber+1,1,t.endLineNumber,t.endColumn)),t=new k(t.startLineNumber,t.startColumn,t.startLineNumber,Number.MAX_SAFE_INTEGER)),e.push(t)}return e}var BDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YX=function(o,e){return function(t,i){e(t,i,o)}};const Wb=0,N0=0,Ya=1,HDe=1,VDe=3,Td=4,W3=20,XX=12;let ID=class extends A{static fitsInsideViewport(e,t,i,n){const s=ni(e),r=s.layoutInfoWidth.read(n),a=s.layoutInfoContentLeft.read(n),l=e.getLayoutInfo().verticalScrollbarWidth,c=s.layoutInfoMinimap.read(n).minimapLeft!==0?s.layoutInfoMinimap.read(n).minimapWidth:0,d=lu(s,i.displayRange,void 0),h=i.lineEdit.newLines.reduce((g,m)=>Math.max(g,S3(m,e,t)),0),u=W3,f=XX+2*Ya;return d+h+u+f<r-a-l-c}constructor(e,t,i,n,s,r,a){super(),this._editor=e,this._edit=t,this._previewTextModel=i,this._uiState=n,this._tabAction=s,this._instantiationService=r,this._themeService=a,this._editorObs=ni(this._editor),this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._display=j(this,c=>this._uiState.read(c)?"block":"none"),this.previewRef=Pe.ref();const l=this._uiState.map(c=>c?.isInDiffEditor?VDe:HDe);this._editorContainer=Pe.div({class:["editorContainer"],style:{position:"absolute",overflow:"hidden",cursor:"pointer"},onmousedown:c=>{c.preventDefault()},onclick:c=>{this._onDidClick.fire(new yn(me(c),c))}},[Pe.div({class:"preview",style:{pointerEvents:"none"},ref:this.previewRef})]).keepUpdated(this._store),this.isHovered=this._editorContainer.didMouseMoveDuringHover,this.previewEditor=this._register(this._instantiationService.createInstance(Cd,this.previewRef.element,{glyphMargin:!1,lineNumbers:"off",minimap:{enabled:!1},guides:{indentation:!1,bracketPairs:!1,bracketPairsHorizontal:!1,highlightActiveIndentation:!1},rulers:[],padding:{top:0,bottom:0},folding:!1,selectOnLineNumbers:!1,selectionHighlight:!1,columnSelection:!1,overviewRulerBorder:!1,overviewRulerLanes:0,lineDecorationsWidth:0,lineNumbersMinChars:0,revealHorizontalRightPadding:0,bracketPairColorization:{enabled:!0,independentColorPoolPerBracketType:!1},scrollBeyondLastLine:!1,scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1},readOnly:!0,wordWrap:"off",wordWrapOverride1:"off",wordWrapOverride2:"off"},{contextKeyValues:{[Lt.inInlineEditsPreviewEditor.key]:!0},contributions:[]},this._editor)),this._previewEditorObs=ni(this.previewEditor),this._activeViewZones=[],this._updatePreviewEditor=j(this,c=>{this._editorContainer.readEffect(c),this._previewEditorObs.model.read(c),this._display.read(c),this._nonOverflowView&&(this._nonOverflowView.element.style.display=this._display.read(c));const d=this._uiState.read(c),h=this._edit.read(c);if(!d||!h)return;const u=h.originalLineRange,f=[];u.startLineNumber>1&&f.push(new k(1,1,u.startLineNumber-1,1)),u.startLineNumber+d.newTextLineCount<this._previewTextModel.getLineCount()+1&&f.push(new k(u.startLineNumber+d.newTextLineCount,1,this._previewTextModel.getLineCount()+1,1)),this.previewEditor.setHiddenAreas(f,void 0,!0);const g=[...this._activeViewZones];this._activeViewZones=[];const m=u.endLineNumberExclusive-u.startLineNumber-d.newTextLineCount;this.previewEditor.changeViewZones(_=>{g.forEach(b=>_.removeZone(b)),m>0&&this._activeViewZones.push(_.addZone({afterLineNumber:u.startLineNumber+d.newTextLineCount-1,heightInLines:m,showInHiddenAreas:!0,domNode:Q("div.diagonal-fill.inline-edits-view-zone")}))})}),this._previewEditorWidth=j(this,c=>{const d=this._edit.read(c);return d?(this._updatePreviewEditor.read(c),lu(this._previewEditorObs,d.modifiedLineRange,c)):0}),this._cursorPosIfTouchesEdit=j(this,c=>{const d=this._editorObs.cursorPosition.read(c),h=this._edit.read(c);if(!(!h||!d))return h.modifiedLineRange.contains(d.lineNumber)?d:void 0}),this._originalStartPosition=j(this,c=>{const d=this._edit.read(c);return d?new M(d.originalLineRange.startLineNumber,1):null}),this._originalEndPosition=j(this,c=>{const d=this._edit.read(c);return d?new M(d.originalLineRange.endLineNumberExclusive,1):null}),this._originalVerticalStartPosition=this._editorObs.observePosition(this._originalStartPosition,this._store).map(c=>c?.y),this._originalVerticalEndPosition=this._editorObs.observePosition(this._originalEndPosition,this._store).map(c=>c?.y),this._originalDisplayRange=this._edit.map(c=>c?.displayRange),this._editorMaxContentWidthInRange=j(this,c=>{const d=this._originalDisplayRange.read(c);return d?(this._editorObs.versionId.read(c),Tc(this,(h,u)=>{const f=lu(this._editorObs,d,h);return Math.max(f,u??0)})):Et(0)}).map((c,d)=>c.read(d)),this._previewEditorLayoutInfo=j(this,c=>{const d=this._edit.read(c);if(!d||!this._uiState.read(c))return null;const u=d.originalLineRange,f=this._editorObs.scrollLeft.read(c),g=this._editorMaxContentWidthInRange.read(c),m=this._editorObs.layoutInfo.read(c),_=this._previewEditorWidth.read(c),b=m.contentWidth-m.verticalScrollbarWidth,C=this._editor.getContainerDomNode().getBoundingClientRect(),w=m.contentLeft+m.contentWidth+C.left,v=me(this._editor.getContainerDomNode()).innerWidth-w,S=me(this._editor.getContainerDomNode()).innerWidth-C.right,L=Math.min(m.contentWidth*.3,_,100),x=0,I=x+v,D=this._cursorPosIfTouchesEdit.read(c),R=Math.max(b+f-x-Math.max(0,L-I),Math.min(D?fDe(this._editorObs,D,c)+50:0,b+f)),F=Math.min(g+W3,R),O=g+W3+_+70,B=R-F;let V,z;F>f?(V=0,z=m.contentLeft+F-f):(V=f-F,z=m.contentLeft);const ee=this._originalVerticalStartPosition.read(c)??this._editor.getTopForLineNumber(u.startLineNumber)-this._editorObs.scrollTop.read(c),se=this._originalVerticalEndPosition.read(c)??this._editor.getBottomForLineNumber(u.endLineNumberExclusive-1)-this._editorObs.scrollTop.read(c),oe=m.contentLeft-f;let fe=kt.fromLeftTopRightBottom(oe,ee,z,se);const Ie=fe.height===0;Ie||(fe=fe.withMargin(N0,Wb));const tt=this._previewEditorObs.observeLineHeightsForLineRange(d.modifiedLineRange).read(c).reduce((zS,AT)=>zS+AT,0),Ke=se-ee,At=Math.max(Ke,tt),_t=B===0,tn=0,Mi=Math.min(_+XX,S+m.width-m.contentLeft-tn);let As=kt.fromLeftTopWidthHeight(fe.right+tn,ee,Mi,At);return Ie?As=As.withMargin(N0,Wb).translateY(N0):As=As.withMargin(N0,Wb).translateX(Wb+Ya),{codeRect:fe,editRect:As,codeScrollLeft:f,contentLeft:m.contentLeft,isInsertion:Ie,maxContentWidth:O,shouldShowShadow:_t,desiredPreviewEditorScrollLeft:V,previewEditorWidth:Mi}}),this._stickyScrollController=ca.get(this._editorObs.editor),this._stickyScrollHeight=this._stickyScrollController?rt(this._stickyScrollController.onDidChangeStickyScrollHeight,()=>this._stickyScrollController.stickyScrollWidgetHeight):Et(0),this._shouldOverflow=j(this,c=>!1),this._originalBackgroundColor=rt(this,this._themeService.onDidColorThemeChange,()=>this._themeService.getColorTheme().getColor(x0)??$.transparent),this._backgroundSvg=Pe.svg({transform:"translate(-0.5 -0.5)",style:{overflow:"visible",pointerEvents:"none",position:"absolute"}},[Pe.svgElem("path",{class:"rightOfModifiedBackgroundCoverUp",d:j(this,c=>{const d=this._previewEditorLayoutInfo.read(c);if(!(!d||this._originalBackgroundColor.read(c).isTransparent()))return new x3().moveTo(d.codeRect.getRightTop()).lineTo(d.codeRect.getRightTop().deltaX(1e3)).lineTo(d.codeRect.getRightBottom().deltaX(1e3)).lineTo(d.codeRect.getRightBottom()).build()}),style:{fill:RV(xi,"transparent")}})]).keepUpdated(this._store),this._originalOverlay=Pe.div({style:{pointerEvents:"none",display:this._previewEditorLayoutInfo.map(c=>c?.isInsertion?"none":"block")}},j(this,c=>{const d=Ql(this._previewEditorLayoutInfo).read(c);if(!d)return;const h=l.read(c),u=yD(this._tabAction).map(L=>`${Ya}px solid ${J(L)}`),f=`${Ya+h}px solid ${J(xi)}`,g=d.read(c).codeScrollLeft!==0,m=d.map(L=>L.codeRect.bottom<L.editRect.bottom),_=Td*2+Ya*2,b=d.map(L=>kt.fromLeftTopRightBottom(L.contentLeft-Td-Ya,L.codeRect.top,L.contentLeft,L.codeRect.bottom+_)).read(c),C=new pe(b.left,Number.MAX_SAFE_INTEGER),w=d.map(L=>L.codeRect.intersectHorizontal(C)),v=w.map(L=>L.withMargin(h,0,h,h).intersectHorizontal(C)),S=w.map(L=>kt.fromLeftTopWidthHeight(L.right-_+Ya,L.bottom-Ya,_,_).intersectHorizontal(C));return[Pe.div({class:"originalSeparatorSideBySide",style:{...v.read(c).toStyles(),boxSizing:"border-box",borderRadius:`${Td}px 0 0 ${Td}px`,borderTop:f,borderBottom:f,borderLeft:g?"none":f}}),Pe.div({class:"originalOverlaySideBySide",style:{...w.read(c).toStyles(),boxSizing:"border-box",borderRadius:`${Td}px 0 0 ${Td}px`,borderTop:u,borderBottom:u,borderLeft:g?"none":u,backgroundColor:J(x0)}}),Pe.div({class:"originalCornerCutoutSideBySide",style:{pointerEvents:"none",display:m.map(L=>L?"block":"none"),...S.read(c).toStyles()}},[Pe.div({class:"originalCornerCutoutBackground",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",backgroundColor:Br(x0,this._themeService).map(L=>L.toString())}}),Pe.div({class:"originalCornerCutoutBorder",style:{position:"absolute",top:"0px",left:"0px",width:"100%",height:"100%",boxSizing:"border-box",borderTop:u,borderRight:u,borderRadius:"0 100% 0 0",backgroundColor:J(xi)}})]),Pe.div({class:"originalOverlaySideBySideHider",style:{...b.toStyles(),backgroundColor:J(xi)}})]})).keepUpdated(this._store),this._modifiedOverlay=Pe.div({style:{pointerEvents:"none"}},j(this,c=>{const d=Ql(this._previewEditorLayoutInfo).read(c);if(!d)return;const h=d.map(w=>w.codeRect.bottom<w.editRect.bottom),u=l.read(c),f=h.map(w=>`0 ${Td}px ${Td}px ${w?Td:0}px`),g=Br(D0(this._tabAction),this._themeService).map(w=>`1px solid ${w.toString()}`),m=`${Ya+u}px solid ${J(xi)}`,_=d.map(w=>w.editRect.withMargin(0,Ya)),b=_.map(w=>w.withMargin(u,u,u,0)),C=j(this,w=>{const v=_.read(w),S=d.read(w);return!S.isInsertion||S.contentLeft>=v.left?kt.fromLeftTopWidthHeight(v.left,v.top,0,0):new kt(S.contentLeft,v.top,v.left,v.top+Ya*2)});return[Pe.div({class:"modifiedInsertionSideBySide",style:{...C.read(c).toStyles(),backgroundColor:D0(this._tabAction).map(w=>J(w))}}),Pe.div({class:"modifiedSeparatorSideBySide",style:{...b.read(c).toStyles(),borderRadius:f,borderTop:m,borderBottom:m,borderRight:m,boxSizing:"border-box"}}),Pe.div({class:"modifiedOverlaySideBySide",style:{..._.read(c).toStyles(),borderRadius:f,border:g,boxSizing:"border-box",backgroundColor:J(WX)}})]})).keepUpdated(this._store),this._nonOverflowView=Pe.div({class:"inline-edits-view",style:{position:"absolute",overflow:"visible",top:"0px",left:"0px",display:this._display}},[this._backgroundSvg,j(this,c=>this._shouldOverflow.read(c)?[]:[this._editorContainer,this._originalOverlay,this._modifiedOverlay])]).keepUpdated(this._store),this._register(this._editorObs.createOverlayWidget({domNode:this._nonOverflowView.element,position:Et(null),allowEditorOverflow:!1,minContentWidthInPx:j(this,c=>{const d=this._previewEditorLayoutInfo.read(c)?.maxContentWidth;return d===void 0?0:d})})),this.previewEditor.setModel(this._previewTextModel),this._register(Se(c=>{const d=this._previewEditorLayoutInfo.read(c);if(!d)return;const h=d.editRect.withMargin(-N0,-Wb);this.previewEditor.layout({height:h.height,width:d.previewEditorWidth+15}),this._editorContainer.element.style.top=`${h.top}px`,this._editorContainer.element.style.left=`${h.left}px`,this._editorContainer.element.style.width=`${d.previewEditorWidth+Wb}px`})),this._register(Se(c=>{const d=this._previewEditorLayoutInfo.read(c);d&&this._previewEditorObs.editor.setScrollLeft(d.desiredPreviewEditorScrollLeft)})),this._updatePreviewEditor.recomputeInitiallyAndOnChange(this._store)}};ID=BDe([YX(5,ge),YX(6,li)],ID);var zDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},UDe=function(o,e){return function(t,i){e(t,i,o)}};const Rd=1;let Bb=(TC=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._edit=t,this._tabAction=i,this._languageService=n,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this._start=this._editor.observePosition(Et(this._edit.range.getStartPosition()),this._store),this._end=this._editor.observePosition(Et(this._edit.range.getEndPosition()),this._store),this._line=document.createElement("div"),this._hoverableElement=Le(this,null),this.isHovered=this._hoverableElement.map((r,a)=>r?.didMouseMoveDuringHover.read(a)??!1),this._renderTextEffect=j(this,r=>{const a=this._editor.model.get(),l=a.getLineContent(this._edit.range.startLineNumber),c=Cn.replace(new pe(this._edit.range.startColumn-1,this._edit.range.endColumn-1),this._edit.text),d=c.replace(l),h=a.tokenization.tokenizeLinesAt(this._edit.range.startLineNumber,[d])?.[0];let u;h?u=Oc.fromLineTokens(h).slice(c.getRangeAfterReplace()).toLineTokens(this._edit.text,this._languageService.languageIdCodec):u=bi.createEmpty(this._edit.text,this._languageService.languageIdCodec);const f=hw(new uw([u]),dd.fromEditor(this._editor.editor).withSetWidth(!1).withScrollBeyondLastColumn(0),[],this._line,!0);this._line.style.width=`${f.minWidthInPx}px`});const s=this._editor.observeLineHeightForPosition(this._edit.range.getStartPosition());this._layout=j(this,r=>{this._renderTextEffect.read(r);const a=this._start.read(r),l=this._end.read(r);if(!a||!l||a.x>l.x||a.y>l.y)return;const c=s.read(r),d=this._editor.scrollLeft.read(r),h=this._editor.getOption(59).read(r).typicalHalfwidthCharacterWidth,u=3*h,f=4,g=new en(u,f),m=kt.fromPoints(a,l).withHeight(c).translateX(-d),_=kt.fromPointSize(m.getLeftBottom().add(g),new en(this._edit.text.length*h,m.height)),b=_.withLeft(m.left);return{originalLine:m,modifiedLine:_,lowerBackground:b,lineHeight:c}}),this.minEditorScrollHeight=j(this,r=>{const a=Ql(this._layout).read(r);return a?a.read(r).modifiedLine.bottom+Rd+this._editor.editor.getScrollTop():0}),this._root=Pe.div({class:"word-replacement"},[j(this,r=>{const a=Ql(this._layout).read(r);if(!a)return[];const l=yD(this._tabAction).map(d=>J(d)).read(r),c=D0(this._tabAction).map(d=>J(d)).read(r);return[Pe.div({style:{position:"absolute",...Hr(d=>y3(this._editor).read(d)),overflow:"hidden",pointerEvents:"none"}},[Pe.div({style:{position:"absolute",...Hr(d=>a.read(d).lowerBackground.withMargin(Rd,2*Rd,Rd,0)),background:J(xi),cursor:"pointer",pointerEvents:"auto"},onmousedown:d=>{d.preventDefault()},onmouseup:d=>this._onDidClick.fire(new yn(me(d),d)),obsRef:d=>{this._hoverableElement.set(d,void 0)}}),Pe.div({style:{position:"absolute",...Hr(d=>a.read(d).modifiedLine.withMargin(Rd,2*Rd)),fontFamily:this._editor.getOption(58),fontSize:this._editor.getOption(61),fontWeight:this._editor.getOption(62),pointerEvents:"none",boxSizing:"border-box",borderRadius:"4px",border:`${Rd}px solid ${c}`,background:J(rDe),display:"flex",justifyContent:"center",alignItems:"center",outline:`2px solid ${J(xi)}`}},[this._line]),Pe.div({style:{position:"absolute",...Hr(d=>a.read(d).originalLine.withMargin(Rd)),boxSizing:"border-box",borderRadius:"4px",border:`${Rd}px solid ${l}`,background:J(sDe),pointerEvents:"none"}},[]),Pe.svg({width:11,height:14,viewBox:"0 0 11 14",fill:"none",style:{position:"absolute",left:a.map(d=>d.modifiedLine.left-16),top:a.map(d=>d.modifiedLine.top+Math.round((d.lineHeight-14-5)/2))}},[Pe.svgElem("path",{d:"M1 0C1 2.98966 1 5.92087 1 8.49952C1 9.60409 1.89543 10.5 3 10.5H10.5",stroke:J(UV)}),Pe.svgElem("path",{d:"M6 7.5L9.99999 10.49998L6 13.5",stroke:J(UV)})])])]})]).keepUpdated(this._store),this._register(this._editor.createOverlayWidget({domNode:this._root.element,minContentWidthInPx:Et(0),position:Et({preference:{top:0,left:0}}),allowEditorOverflow:!1}))}},TC.MAX_LENGTH=100,TC);Bb=zDe([UDe(3,Mt)],Bb);class $De extends A{constructor(e,t,i){super(),this._originalEditor=e,this._state=t,this._modifiedTextModel=i,this._onDidClick=this._register(new P),this.onDidClick=this._onDidClick.event,this.isHovered=ni(this._originalEditor).isTargetHovered(s=>s.target.type===6&&s.target.detail.injectedText?.options.attachedData instanceof B3&&s.target.detail.injectedText.options.attachedData.owner===this,this._store),this._tokenizationFinished=KDe(this._modifiedTextModel),this._decorations=j(this,s=>{const r=this._state.read(s);if(!r)return;const a=r.modifiedText,l=r.mode==="insertionInline",c=r.diff.length===1&&r.diff[0].innerChanges?.length===1,d=!0,h=[],u=[],f=Te.register({className:"inlineCompletions-line-insert",description:"line-insert",isWholeLine:!0,marginClassName:"gutter-insert"}),g=Te.register({className:"inlineCompletions-line-delete",description:"line-delete",isWholeLine:!0,marginClassName:"gutter-delete"}),m=Te.register({className:"inlineCompletions-char-delete",description:"char-delete",isWholeLine:!1,zIndex:1}),_=Te.register({className:"inlineCompletions-char-insert",description:"char-insert",isWholeLine:!0}),b=Te.register({className:"inlineCompletions-char-insert",description:"char-insert",shouldFillLineOnLineBreak:!0}),C=Te.register({className:"inlineCompletions-char-insert diff-range-empty",description:"char-insert diff-range-empty"}),w=Te.register({className:"inlineCompletions-original-lines",description:"inlineCompletions-original-lines",isWholeLine:!1,shouldFillLineOnLineBreak:!0}),v=r.mode!=="sideBySide"&&r.mode!=="deletion"&&r.mode!=="insertionInline"&&r.mode!=="lineReplacement",S=r.mode==="lineReplacement";for(const L of r.diff)if(v&&(L.original.isEmpty||h.push({range:L.original.toInclusiveRange(),options:g}),L.modified.isEmpty||u.push({range:L.modified.toInclusiveRange(),options:f})),L.modified.isEmpty||L.original.isEmpty)L.original.isEmpty||h.push({range:L.original.toInclusiveRange(),options:m}),L.modified.isEmpty||u.push({range:L.modified.toInclusiveRange(),options:_});else{const x=l&&jDe(L);for(const I of L.innerChanges||[]){if(L.original.contains(I.originalRange.startLineNumber)&&!(S&&I.originalRange.isEmpty())){const D=this._originalEditor.getModel()?.getValueInRange(I.originalRange,1);h.push({range:I.originalRange,options:{description:"char-delete",shouldFillLineOnLineBreak:!1,className:L3("inlineCompletions-char-delete",I.originalRange.isSingleLine()&&r.mode==="insertionInline"&&"single-line-inline",I.originalRange.isEmpty()&&"empty",(I.originalRange.isEmpty()&&c||r.mode==="deletion"&&D===`
`)&&d&&!x&&"diff-range-empty"),inlineClassName:x?L3("strike-through","inlineCompletions"):null,zIndex:1}})}if(L.modified.contains(I.modifiedRange.startLineNumber)&&u.push({range:I.modifiedRange,options:I.modifiedRange.isEmpty()&&d&&!x&&c?C:b}),x){const D=a.getValueOfRange(I.modifiedRange),R=D.length>3?[{text:D.slice(0,1),extraClasses:["start"],offsetRange:new pe(I.modifiedRange.startColumn-1,I.modifiedRange.startColumn)},{text:D.slice(1,-1),extraClasses:[],offsetRange:new pe(I.modifiedRange.startColumn,I.modifiedRange.endColumn-2)},{text:D.slice(-1),extraClasses:["end"],offsetRange:new pe(I.modifiedRange.endColumn-2,I.modifiedRange.endColumn-1)}]:[{text:D,extraClasses:["start","end"],offsetRange:new pe(I.modifiedRange.startColumn-1,I.modifiedRange.endColumn)}];this._tokenizationFinished.read(s);const F=this._modifiedTextModel.tokenization.getLineTokens(I.modifiedRange.startLineNumber);for(const{text:O,extraClasses:B,offsetRange:V}of R)h.push({range:k.fromPositions(I.originalRange.getEndPosition()),options:{description:"inserted-text",before:{tokens:F.getTokensInRange(V),content:O,inlineClassName:L3("inlineCompletions-char-insert",I.modifiedRange.isSingleLine()&&r.mode==="insertionInline"&&"single-line-inline",...B),cursorStops:yr.None,attachedData:new B3(this)},zIndex:2,showIfCollapsed:!0}})}}}if(r.isInDiffEditor)for(const L of r.diff)L.original.isEmpty||h.push({range:L.original.toExclusiveRange(),options:w});return{originalDecorations:h,modifiedDecorations:u}}),this._register(ni(this._originalEditor).setDecorations(this._decorations.map(s=>s?.originalDecorations??[])));const n=this._state.map(s=>s?.modifiedCodeEditor);this._register(Bn((s,r)=>{const a=n.read(s);a&&r.add(ni(a).setDecorations(this._decorations.map(l=>l?.modifiedDecorations??[])))})),this._register(this._originalEditor.onMouseUp(s=>{if(s.target.type!==6)return;const r=s.target.detail.injectedText?.options.attachedData;r instanceof B3&&r.owner===this&&this._onDidClick.fire(s.event)}))}}class B3{constructor(e){this.owner=e}}function jDe(o){return o.innerChanges?o.innerChanges.every(e=>ok(e.modifiedRange)&&ok(e.originalRange)):!1}let qDe=0;function KDe(o){return rt(o.onDidChangeTokens,()=>qDe++)}var GDe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ZDe=function(o,e){return function(t,i){e(t,i,o)}};let H3=class extends A{constructor(e,t,i,n,s,r){super(),this._editor=e,this._host=t,this._model=i,this._ghostTextIndicator=n,this._focusIsInMenu=s,this._instantiationService=r,this._editorObs=ni(this._editor),this._tabAction=j(d=>this._model.read(d)?.tabAction.read(d)??Xn.Inactive),this._constructorDone=Le(this,!1),this._uiState=j(this,d=>{const h=this._model.read(d);if(!h||!this._constructorDone.read(d))return;const u=h.inlineEdit;let f=Is.fromEdit(u.edit),g=u.edit.apply(u.originalText),m=tk(f,u.originalText,new kh(g)),_=this.determineRenderState(h,d,m,new kh(g));if(!_){h.abort(`unable to determine view: tried to render ${this._previousView?.view}`);return}if(_.kind===xt.SideBySide){const C=bDe(g,u.modifiedLineRange,l.getOptions().tabSize);g=C.applyToString(g),f=gDe(f,C),m=tk(f,u.originalText,new kh(g))}return this._previewTextModel.setLanguage(this._editor.getModel().getLanguageId()),this._previewTextModel.getValue()!==g&&this._previewTextModel.setValue(g),h.showCollapsed.read(d)&&!this._indicator.read(d)?.isHoverVisible.read(d)&&(_={kind:xt.Collapsed,viewData:_.viewData}),h.handleInlineEditShown(_.kind,_.viewData),{state:_,diff:m,edit:u,newText:g,newTextLineCount:u.modifiedLineRange.length,isInDiffEditor:h.isInDiffEditor}}),this._previewTextModel=this._register(this._instantiationService.createInstance(Jf,"",this._editor.getModel().getLanguageId(),{...Jf.DEFAULT_CREATION_OPTIONS,bracketPairColorizationOptions:{enabled:!0,independentColorPoolPerBracketType:!1}},null)),this._indicatorCyclicDependencyCircuitBreaker=Le(this,!1),this._indicator=j(this,d=>{if(!this._indicatorCyclicDependencyCircuitBreaker.read(d))return;const h=In({owner:this,equalsFn:rf(UR())},f=>{const g=this._ghostTextIndicator.read(f);if(g)return g.lineRange;const m=this._uiState.read(f);if(m){if(m.state?.kind==="custom"){const _=m.state.displayLocation?.range;if(!_)throw new Ce("custom view should have a range");return new ke(_.startLineNumber,_.endLineNumber)}return m.state?.kind==="insertionMultiLine"?this._insertion.originalLines.read(f):m.edit.displayRange}}),u=j(this,f=>{const g=this._model.read(f);if(g)return g;const m=this._ghostTextIndicator.read(f);return m?m.model:g});return d.store.add(this._instantiationService.createInstance(D3,this._editorObs,h,this._gutterIndicatorOffset,u,this._inlineEditsIsHovered,this._focusIsInMenu))}),this._inlineEditsIsHovered=j(this,d=>this._sideBySide.isHovered.read(d)||this._wordReplacementViews.read(d).some(h=>h.isHovered.read(d))||this._deletion.isHovered.read(d)||this._inlineDiffView.isHovered.read(d)||this._lineReplacementView.isHovered.read(d)||this._insertion.isHovered.read(d)||this._customView.isHovered.read(d)),this._gutterIndicatorOffset=j(this,d=>{if(this._uiState.read(d)?.state?.kind==="insertionMultiLine")return this._insertion.startLineOffset.read(d);const h=this._ghostTextIndicator.read(d);return h?QDe(h,this._editor):0}),this._sideBySide=this._register(this._instantiationService.createInstance(ID,this._editor,this._model.map(d=>d?.inlineEdit),this._previewTextModel,this._uiState.map(d=>d&&d.state?.kind===xt.SideBySide?{newTextLineCount:d.newTextLineCount,isInDiffEditor:d.isInDiffEditor}:void 0),this._tabAction)),this._deletion=this._register(this._instantiationService.createInstance(MDe,this._editor,this._model.map(d=>d?.inlineEdit),this._uiState.map(d=>d&&d.state?.kind===xt.Deletion?{originalRange:d.state.originalRange,deletions:d.state.deletions,inDiffEditor:d.isInDiffEditor}:void 0),this._tabAction)),this._insertion=this._register(this._instantiationService.createInstance(O3,this._editor,this._uiState.map(d=>d&&d.state?.kind===xt.InsertionMultiLine?{lineNumber:d.state.lineNumber,startColumn:d.state.column,text:d.state.text,inDiffEditor:d.isInDiffEditor}:void 0),this._tabAction)),this._inlineDiffViewState=j(this,d=>{const h=this._uiState.read(d);if(!(!h||!h.state)&&!(h.state.kind==="wordReplacements"||h.state.kind==="insertionMultiLine"||h.state.kind==="collapsed"||h.state.kind==="custom"))return{modifiedText:new kh(h.newText),diff:h.diff,mode:h.state.kind,modifiedCodeEditor:this._sideBySide.previewEditor,isInDiffEditor:h.isInDiffEditor}}),this._inlineCollapsedView=this._register(this._instantiationService.createInstance(N3,this._editor,this._model.map((d,h)=>this._uiState.read(h)?.state?.kind==="collapsed"?d?.inlineEdit:void 0))),this._customView=this._register(this._instantiationService.createInstance(R3,this._editor,this._model.map((d,h)=>this._uiState.read(h)?.state?.kind==="custom"?d?.displayLocation:void 0),this._tabAction)),this._inlineDiffView=this._register(new $De(this._editor,this._inlineDiffViewState,this._previewTextModel)),this._wordReplacementViews=ZR(this,this._uiState.map(d=>d?.state?.kind==="wordReplacements"?d.state.replacements:[]),(d,h)=>h.add(this._instantiationService.createInstance(Bb,this._editorObs,d,this._tabAction))),this._lineReplacementView=this._register(this._instantiationService.createInstance(F3,this._editorObs,this._uiState.map(d=>d?.state?.kind===xt.LineReplacement?{originalRange:d.state.originalRange,modifiedRange:d.state.modifiedRange,modifiedLines:d.state.modifiedLines,replacements:d.state.replacements}:void 0),this._uiState.map(d=>d?.isInDiffEditor??!1),this._tabAction)),this._useCodeShifting=this._editorObs.getOption(71).map(d=>d.edits.allowCodeShifting),this._renderSideBySide=this._editorObs.getOption(71).map(d=>d.edits.renderSideBySide),this._register(Bn((d,h)=>{const u=this._model.read(d);u&&h.add(ie.any(this._sideBySide.onDidClick,this._deletion.onDidClick,this._lineReplacementView.onDidClick,this._insertion.onDidClick,...this._wordReplacementViews.read(d).map(f=>f.onDidClick),this._inlineDiffView.onDidClick,this._customView.onDidClick)(f=>{this._viewHasBeenShownLongerThan(350)&&(f.preventDefault(),u.accept())}))})),this._indicator.recomputeInitiallyAndOnChange(this._store),this._wordReplacementViews.recomputeInitiallyAndOnChange(this._store),this._indicatorCyclicDependencyCircuitBreaker.set(!0,void 0),this._register(this._instantiationService.createInstance(E3,this._host,this._model,this._indicator,this._inlineCollapsedView));const a=j(this,d=>Math.max(...this._wordReplacementViews.read(d).map(h=>h.minEditorScrollHeight.read(d)),this._lineReplacementView.minEditorScrollHeight.read(d),this._customView.minEditorScrollHeight.read(d))).recomputeInitiallyAndOnChange(this._store),l=this._editor.getModel();let c;this._register(Se(d=>{const h=a.read(d);this._editor.changeViewZones(u=>{const f=this._editor.getScrollHeight(),g=h-f+1;g!==0&&c&&(u.removeZone(c),c=void 0),!(g<=0)&&(c=u.addZone({afterLineNumber:l.getLineCount(),heightInPx:g,domNode:Q("div.minScrollHeightViewZone")}))})})),this._constructorDone.set(!0,void 0)}getCacheId(e){return e.inlineEdit.inlineCompletion.identity.id}determineView(e,t,i,n){const s=e.inlineEdit,r=this._previousView?.id===this.getCacheId(e),a=this._previousView?.editorWidth!==this._editorObs.layoutInfoWidth.read(t)&&(this._previousView?.view===xt.SideBySide||this._previousView?.view===xt.LineReplacement);if(r&&!a)return this._previousView.view;if(e.displayLocation)return xt.Custom;const l=s.originalLineRange.length,c=s.modifiedLineRange.length,d=i.flatMap(u=>u.innerChanges??[]),h=d.length===1;if(!e.isInDiffEditor){if(h&&this._useCodeShifting.read(t)!=="never"&&QX(i))return YDe(i,s.cursorPosition)?xt.InsertionInline:xt.LineReplacement;if(eQ(d,s,n))return xt.Deletion;if(JX(i)&&this._useCodeShifting.read(t)==="always")return xt.InsertionMultiLine;if(d.every(f=>$i.ofRange(f.originalRange).columnCount<Bb.MAX_LENGTH&&$i.ofRange(f.modifiedRange).columnCount<Bb.MAX_LENGTH)&&h&&l===1&&c===1){const f=d.map(m=>n.getValueOfRange(m.modifiedRange)),g=d.map(m=>e.inlineEdit.originalText.getValueOfRange(m.originalRange));if(!f.some(m=>m.includes(" "))&&!g.some(m=>m.includes(" "))&&(!d.some(m=>m.originalRange.isEmpty())||!tQ(d.map(m=>new Oi(m.originalRange,"")),s.originalText).some(m=>m.range.isEmpty()&&$i.ofRange(m.range).columnCount<Bb.MAX_LENGTH)))return xt.WordReplacements}}if(l>0&&c>0)return l===1&&c===1&&!e.isInDiffEditor?xt.LineReplacement:this._renderSideBySide.read(t)!=="never"&&ID.fitsInsideViewport(this._editor,this._previewTextModel,s,t)?xt.SideBySide:xt.LineReplacement;if(e.isInDiffEditor){if(eQ(d,s,n))return xt.Deletion;if(JX(i)&&this._useCodeShifting.read(t)==="always")return xt.InsertionMultiLine}return xt.SideBySide}determineRenderState(e,t,i,n){const s=e.inlineEdit,r=this.determineView(e,t,i,n);this._previousView={id:this.getCacheId(e),view:r,editorWidth:this._editor.getLayoutInfo().width,timestamp:Date.now()};const a=i.flatMap(g=>g.innerChanges??[]),l=this._editor.getModel(),c=a.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange,original:l.getValueInRange(g.originalRange),modified:n.getValueOfRange(g.modifiedRange)})),d=s.cursorPosition,h=c[0].modified.startsWith(l.getEOL()),u={cursorColumnDistance:s.edit.replacements[0].range.getStartPosition().column-d.column,cursorLineDistance:s.lineEdit.lineRange.startLineNumber-d.lineNumber+(h&&s.lineEdit.lineRange.startLineNumber>=d.lineNumber?1:0),lineCountOriginal:s.lineEdit.lineRange.length,lineCountModified:s.lineEdit.newLines.length,characterCountOriginal:c.reduce((g,m)=>g+m.original.length,0),characterCountModified:c.reduce((g,m)=>g+m.modified.length,0),disjointReplacements:c.length,sameShapeReplacements:c.every(g=>g.original===c[0].original&&g.modified===c[0].modified)};switch(r){case xt.InsertionInline:return{kind:xt.InsertionInline,viewData:u};case xt.SideBySide:return{kind:xt.SideBySide,viewData:u};case xt.Collapsed:return{kind:xt.Collapsed,viewData:u};case xt.Custom:return{kind:xt.Custom,displayLocation:e.displayLocation,viewData:u}}if(r===xt.Deletion)return{kind:xt.Deletion,originalRange:s.originalLineRange,deletions:a.map(g=>g.originalRange),viewData:u};if(r===xt.InsertionMultiLine){const g=a[0];return{kind:xt.InsertionMultiLine,lineNumber:g.originalRange.startLineNumber,column:g.originalRange.startColumn,text:n.getValueOfRange(g.modifiedRange),viewData:u}}const f=c.map(g=>new Oi(g.originalRange,g.modified));if(f.length!==0){if(r===xt.WordReplacements){let g=XDe(f,s.originalText);return g.some(m=>m.range.isEmpty())&&(g=tQ(f,s.originalText)),{kind:xt.WordReplacements,replacements:g,viewData:u}}if(r===xt.LineReplacement)return{kind:xt.LineReplacement,originalRange:s.originalLineRange,modifiedRange:s.modifiedLineRange,modifiedLines:s.modifiedLineRange.mapToLineArray(g=>n.getLineAt(g)),replacements:a.map(g=>({originalRange:g.originalRange,modifiedRange:g.modifiedRange})),viewData:u}}}_viewHasBeenShownLongerThan(e){const t=this._previousView?.timestamp;if(!t)throw new Ce("viewHasBeenShownLongThan called before a view has been shown");return Date.now()-t>=e}};H3=GDe([ZDe(5,ge)],H3);function QX(o){return o.every(t=>t.innerChanges.every(i=>e(i)));function e(t){return!(!t.originalRange.isEmpty()||!(t.modifiedRange.startLineNumber===t.modifiedRange.endLineNumber))}}function YDe(o,e){if(!e||!QX(o))return!1;const t=e;return o.every(n=>n.innerChanges.every(s=>i(s)));function i(n){const s=n.originalRange.getStartPosition();return!!(t.isBeforeOrEqual(s)||s.lineNumber<t.lineNumber)}}function JX(o){const e=o.flatMap(i=>i.innerChanges??[]);if(e.length!==1)return!1;const t=e[0];return!(!t.originalRange.isEmpty()||t.modifiedRange.startLineNumber===t.modifiedRange.endLineNumber)}function eQ(o,e,t){return o.map(n=>({original:e.originalText.getValueOfRange(n.originalRange),modified:t.getValueOfRange(n.modifiedRange)})).every(({original:n,modified:s})=>s.trim()===""&&n.length>0&&(n.length>s.length||n.trim()!==""))}function XDe(o,e){return iQ(o,e,t=>/^[a-zA-Z]$/.test(t))}function tQ(o,e){return iQ(o,e,t=>!/^\s$/.test(t))}function iQ(o,e,t){const i=[];o.sort((s,r)=>k.compareRangesUsingStarts(s.range,r.range));for(const s of o){let r=s.range.startColumn-1,a=s.range.endColumn-2,l="",c="";const d=e.getLineAt(s.range.startLineNumber),h=e.getLineAt(s.range.endLineNumber);if(n(d[r]))for(;n(d[r-1]);)l=d[r-1]+l,r--;if(n(h[a])||a<r)for(;n(h[a+1]);)c+=h[a+1],a++;let u=new Oi(new k(s.range.startLineNumber,r+1,s.range.endLineNumber,a+2),l+s.text+c);i.length>0&&k.areIntersectingOrTouching(i[i.length-1].range,u.range)&&(u=Oi.joinReplacements([i.pop(),u],e)),i.push(u)}function n(s){return s===void 0?!1:t(s)}return i}function QDe(o,e){const t=o.model.inlineEdit.edit.replacements;if(t.length!==1)return 0;const i=e.getModel();if(!i)return 0;const n=i.getEOL(),s=t[0];if(s.range.isEmpty()&&s.text.startsWith(n)){const r=e.getLineHeightForPosition(s.range.getStartPosition());return JDe(s.text,n)*r}return 0}function JDe(o,e){if(!e.length)return 0;let t=0,i=0;for(;o.startsWith(e,i);)t++,i+=e.length;return t}var eEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tEe=function(o,e){return function(t,i){e(t,i,o)}},V3;let z3=(nm=class extends A{constructor(e,t,i,n,s){super(),this._editor=e,this._edit=t,this._model=i,this._focusIsInMenu=n,this._inlineEdit=j(this,r=>{const a=this._model.read(r);if(!a)return;const l=this._edit.read(r);if(!l)return;const c=this._editor.getModel();if(!c)return;const d=a.inlineEditState.read(void 0)?.inlineCompletion.updatedEdit;if(!d)return;const h=d.replacements.map(g=>{const m=k.fromPositions(c.getPositionAt(g.replaceRange.start),c.getPositionAt(g.replaceRange.endExclusive));return new Oi(m,g.newText)}),u=new mo(h),f=new wg(c);return new EX(f,u,a.primaryPosition.read(void 0),l.commands,l.inlineCompletion)}),this._inlineEditModel=j(this,r=>{const a=this._model.read(r);if(!a)return;const l=this._inlineEdit.read(r);if(!l)return;const c=j(this,d=>{if(this._editorObs.isFocused.read(d)){if(a.tabShouldJumpToInlineEdit.read(d))return Xn.Jump;if(a.tabShouldAcceptInlineEdit.read(d))return Xn.Accept}return Xn.Inactive});return new NX(a,l,c)}),this._inlineEditHost=j(this,r=>{const a=this._model.read(r);if(a)return new ZIe(a)}),this._ghostTextIndicator=j(this,r=>{const a=this._model.read(r);if(!a)return;const l=a.inlineCompletionState.read(r);if(!l)return;const c=l.inlineCompletion;if(!c||!c.showInlineEditMenu)return;const d=ke.ofLength(l.primaryGhostText.lineNumber,1);return new YIe(this._editor,a,d,c)}),this._editorObs=ni(this._editor),this._register(s.createInstance(H3,this._editor,this._inlineEditHost,this._inlineEditModel,this._ghostTextIndicator,this._focusIsInMenu))}},V3=nm,nm.hot=Px(V3),nm);z3=V3=eEe([tEe(4,ge)],z3);var iEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nEe=function(o,e){return function(t,i){e(t,i,o)}};let U3=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._model=t,this._focusIsInMenu=i,this._instantiationService=n,this._ghostTexts=j(this,s=>this._model.read(s)?.ghostTexts.read(s)??[]),this._stablizedGhostTexts=yke(this._ghostTexts,this._store),this._editorObs=ni(this._editor),this._ghostTextWidgets=ZR(this,this._stablizedGhostTexts,(s,r)=>mr(a=>this._instantiationService.createInstance(v0.hot.read(a),this._editor,{ghostText:s,warning:this._model.map((l,c)=>{const d=l?.warning?.read(c);return d?{icon:d.icon}:void 0}),minReservedLineCount:Et(0),targetTextModel:this._model.map(l=>l?.textModel),handleInlineCompletionShown:this._model.map((l,c)=>{const d=l?.inlineCompletionState.read(c)?.inlineCompletion;return d?h=>l.handleInlineSuggestionShown(d,xt.GhostText,h):()=>{}})},this._editorObs.getOption(71).map(l=>({syntaxHighlightingEnabled:l.syntaxHighlightingEnabled})),!1,!1)).recomputeInitiallyAndOnChange(r)).recomputeInitiallyAndOnChange(this._store),this._inlineEdit=j(this,s=>this._model.read(s)?.inlineEditState.read(s)?.inlineEdit),this._everHadInlineEdit=Tc(this,(s,r)=>r||!!this._inlineEdit.read(s)||!!this._model.read(s)?.inlineCompletionState.read(s)?.inlineCompletion?.showInlineEditMenu),this._inlineEditWidget=mr(s=>{if(this._everHadInlineEdit.read(s))return this._instantiationService.createInstance(z3.hot.read(s),this._editor,this._inlineEdit,this._model,this._focusIsInMenu)}).recomputeInitiallyAndOnChange(this._store),this._fontFamily=this._editorObs.getOption(71).map(s=>s.fontFamily),this._register(Wae(j(s=>`
.monaco-editor .ghost-text-decoration,
.monaco-editor .ghost-text-decoration-preview,
.monaco-editor .ghost-text {
font-family: ${this._fontFamily.read(s)};
}`))),this._register(new O4(this._editor,this._model,this._instantiationService))}shouldShowHoverAtViewZone(e){return this._ghostTextWidgets.get()[0]?.get().ownsViewZone(e)??!1}};U3=iEe([nEe(3,ge)],U3);var sEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Md=function(o,e){return function(t,i){e(t,i,o)}},Xa;let Ms=(qd=class extends A{static getInFocusedEditorOrParent(e){const t=YG(e);return t?Xa.get(t):null}static get(e){return eke(e.getContribution(Xa.ID))}constructor(e,t,i,n,s,r,a,l,c,d){super(),this.editor=e,this._instantiationService=t,this._contextKeyService=i,this._configurationService=n,this._commandService=s,this._debounceService=r,this._languageFeaturesService=a,this._accessibilitySignalService=l,this._keybindingService=c,this._accessibilityService=d,this._editorObs=ni(this.editor),this._positions=j(this,g=>this._editorObs.selections.read(g)?.map(m=>m.getEndPosition())??[new M(1,1)]),this._suggestWidgetAdapter=this._register(new zIe(this._editorObs,g=>this.model.get()?.handleSuggestAccepted(g),()=>this.model.get()?.selectedInlineCompletion.get()?.getSingleTextEdit())),this._enabledInConfig=rt(this,this.editor.onDidChangeConfiguration,()=>this.editor.getOption(71).enabled),this._isScreenReaderEnabled=rt(this,this._accessibilityService.onDidChangeScreenReaderOptimized,()=>this._accessibilityService.isScreenReaderOptimized()),this._editorDictationInProgress=rt(this,this._contextKeyService.onDidChangeContext,()=>this._contextKeyService.getContext(this.editor.getDomNode()).getValue("editorDictation.inProgress")===!0),this._enabled=j(this,g=>this._enabledInConfig.read(g)&&(!this._isScreenReaderEnabled.read(g)||!this._editorDictationInProgress.read(g))),this._debounceValue=this._debounceService.for(this._languageFeaturesService.inlineCompletionsProvider,"InlineCompletionsDebounce",{min:50,max:50}),this._focusIsInMenu=Le(this,!1),this._focusIsInEditorOrMenu=j(this,g=>{const m=this._editorObs.isFocused.read(g),_=this._focusIsInMenu.read(g);return m||_}),this._cursorIsInIndentation=j(this,g=>{const m=this._editorObs.cursorPosition.read(g);if(m===null)return!1;const _=this._editorObs.model.read(g);if(!_)return!1;this._editorObs.versionId.read(g);const b=_.getLineIndentColumn(m.lineNumber);return m.column<=b}),this.model=mr(this,g=>{if(this._editorObs.isReadonly.read(g))return;const m=this._editorObs.model.read(g);return m?this._instantiationService.createInstance(KF,m,this._suggestWidgetAdapter.selectedItem,this._editorObs.versionId,this._positions,this._debounceValue,this._enabled,this.editor):void 0}).recomputeInitiallyAndOnChange(this._store),this._playAccessibilitySignal=_r(this),this._hideInlineEditOnSelectionChange=this._editorObs.getOption(71).map(g=>!0),this._view=this._register(this._instantiationService.createInstance(U3,this.editor,this.model,this._focusIsInMenu)),Xa._instances.add(this),this._register(ue(()=>Xa._instances.delete(this))),this._register(Se(g=>{const m=this.model.read(g);if(!m)return;const _=m.state.read(g);if(!_||!this._focusIsInEditorOrMenu.read(void 0))return;const b=_.kind==="inlineEdit"?_.nextEditUri:void 0;for(const C of Xa._instances)C!==this&&(b&&ch(b,C.editor.getModel()?.uri)?C.model.read(void 0)?.trigger():C.reject())})),this._register(Se(g=>{const m=this.model.read(g),_=this.editor.getModel()?.uri;!m||!_||g.store.add(m.onDidAccept(()=>{for(const b of Xa._instances){if(b===this)continue;const C=b.model.read(void 0)?.state.read(void 0);C?.kind==="inlineEdit"&&ch(C.nextEditUri,_)&&b.model.read(void 0)?.stop("automatic")}}))})),this._register(Sa(this._editorObs.onDidType,(g,m)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(Sa(this._editorObs.onDidPaste,(g,m)=>{this._enabled.get()&&this.model.get()?.trigger()})),this._register(this._commandService.onDidExecuteCommand(g=>{if(new Set([Jm.Tab.id,Jm.DeleteLeft.id,Jm.DeleteRight.id,Aw,"acceptSelectedSuggestion"]).has(g.commandId)&&e.hasTextFocus()&&this._enabled.get()){let _=!1;g.commandId===Aw&&(_=!0),this._editorObs.forceUpdate(b=>{this.model.get()?.trigger(b,{noDelay:_})})}})),this._register(Sa(this._editorObs.selections,(g,m,_)=>{if(_.some(b=>b.reason===3||b.source==="api")){if(!this._hideInlineEditOnSelectionChange.get()&&this.model.get()?.state.get()?.kind==="inlineEdit")return;const b=this.model.get();if(!b)return;b.state.get()?.kind==="ghostText"&&this.model.get()?.stop()}})),this._register(Se(g=>{const m=this._focusIsInEditorOrMenu.read(g),_=this.model.read(void 0);if(m){const b=_?.state.read(void 0);(!b||b.kind!=="inlineEdit"||!b.nextEditUri)&&Dt(C=>{for(const w of Xa._instances)w!==this&&w.model.read(void 0)?.stop("automatic",C)});return}this._contextKeyService.getContextKeyValue("accessibleViewIsShown")||this._configurationService.getValue("editor.inlineSuggest.keepOnBlur")||e.getOption(71).keepOnBlur||hb.dropDownVisible||_&&(_.state.read(void 0)?.inlineCompletion?.isFromExplicitRequest&&_.inlineEditAvailable.read(void 0)||Dt(b=>{_.stop("automatic",b)}))})),this._register(Se(g=>{const m=this.model.read(g)?.inlineCompletionState.read(g);m?.suggestItem?m.primaryGhostText.lineCount>=2&&this._suggestWidgetAdapter.forceRenderingAbove():this._suggestWidgetAdapter.stopForceRenderingAbove()})),this._register(ue(()=>{this._suggestWidgetAdapter.stopForceRenderingAbove()}));const h=Tc(this,(g,m)=>{const b=this.model.read(g)?.state.read(g);return this._suggestWidgetAdapter.selectedItem.get()?m:b?.inlineCompletion?.semanticId});this._register(j6(j(g=>(this._playAccessibilitySignal.read(g),h.read(g),{})),async(g,m,_,b)=>{let C=this.model.get(),w=C?.state.get();if(!w||!C||(await al(50,cR(b)),await H6(this._suggestWidgetAdapter.selectedItem,Qn,()=>!1,cR(b)),C=this.model.get(),w=C?.state.get(),!w||!C))return;const v=w.kind==="ghostText"?C.textModel.getLineContent(w.primaryGhostText.lineNumber):"";this._accessibilitySignalService.playSignal(w.kind==="ghostText"?xs.inlineSuggestion:xs.nextEditSuggestion),this.editor.getOption(12)&&(w.kind==="ghostText"?this._provideScreenReaderUpdate(w.primaryGhostText.renderForScreenReader(v)):this._provideScreenReaderUpdate(""))})),this._register(this._configurationService.onDidChangeConfiguration(g=>{g.affectsConfiguration("accessibility.verbosity.inlineCompletions")&&this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")})})),this.editor.updateOptions({inlineCompletionsAccessibilityVerbose:this._configurationService.getValue("accessibility.verbosity.inlineCompletions")});const u=new Lke(this._contextKeyService);this._register(u.bind(Lt.cursorInIndentation,this._cursorIsInIndentation)),this._register(u.bind(Lt.hasSelection,g=>!this._editorObs.cursorSelection.read(g)?.isEmpty())),this._register(u.bind(Lt.cursorAtInlineEdit,this.model.map((g,m)=>g?.inlineEditState?.read(m)?.cursorAtInlineEdit.read(m)))),this._register(u.bind(Lt.tabShouldAcceptInlineEdit,this.model.map((g,m)=>!!g?.tabShouldAcceptInlineEdit.read(m)))),this._register(u.bind(Lt.tabShouldJumpToInlineEdit,this.model.map((g,m)=>!!g?.tabShouldJumpToInlineEdit.read(m)))),this._register(u.bind(Lt.inlineEditVisible,g=>this.model.read(g)?.inlineEditState.read(g)!==void 0)),this._register(u.bind(Lt.inlineSuggestionHasIndentation,g=>this.model.read(g)?.getIndentationInfo(g)?.startsWithIndentation)),this._register(u.bind(Lt.inlineSuggestionHasIndentationLessThanTabSize,g=>this.model.read(g)?.getIndentationInfo(g)?.startsWithIndentationLessThanTabSize)),this._register(u.bind(Lt.suppressSuggestions,g=>{const _=this.model.read(g)?.inlineCompletionState.read(g);return _?.primaryGhostText&&_?.inlineCompletion?_.inlineCompletion.source.inlineSuggestions.suppressSuggestions:void 0})),this._register(u.bind(Lt.inlineSuggestionVisible,g=>{const _=this.model.read(g)?.inlineCompletionState.read(g);return!!_?.inlineCompletion&&_?.primaryGhostText!==void 0&&!_?.primaryGhostText.isEmpty()}));const f=j(this,g=>{const b=this.model.read(g)?.inlineCompletionState.read(g)?.primaryGhostText;return!b||b.isEmpty()?void 0:new M(b.lineNumber,b.parts[0].column)});this._register(u.bind(Lt.cursorBeforeGhostText,g=>{const m=f.read(g);if(!m)return!1;const _=this._editorObs.cursorPosition.read(g);return _?m.equals(_):!1})),this._register(this._instantiationService.createInstance(RF,this.editor))}playAccessibilitySignal(e){this._playAccessibilitySignal.trigger(e)}_provideScreenReaderUpdate(e){const t=this._contextKeyService.getContextKeyValue("accessibleViewIsShown"),i=this._keybindingService.lookupKeybinding("editor.action.accessibleView");let n;!t&&i&&this.editor.getOption(169)&&(n=p(1196,"Inspect this in the accessible view ({0})",i.getAriaLabel())),ps(n?e+", "+n:e)}shouldShowHoverAt(e){const t=this.model.get()?.primaryGhostText.get();return t?t.parts.some(i=>e.containsPosition(new M(t.lineNumber,i.column))):!1}shouldShowHoverAtViewZone(e){return this._view.shouldShowHoverAtViewZone(e)}reject(){Dt(e=>{const t=this.model.get();if(t&&(t.stop("explicitCancel",e),this._focusIsInEditorOrMenu.get()))for(const i of Xa._instances)i!==this&&i.model.get()?.stop("automatic",e)})}jump(){const e=this.model.get();e&&e.jump()}},Xa=qd,qd._instances=new Set,qd.hot=Px(Xa),qd.ID="editor.contrib.inlineCompletionsController",qd);Ms=Xa=sEe([Md(1,ge),Md(2,xe),Md(3,Me),Md(4,Tt),Md(5,Or),Md(6,he),Md(7,nd),Md(8,ot),Md(9,bn)],Ms);const GN=class GN extends le{constructor(){super({id:GN.ID,label:H(1174,"Show Next Inline Suggestion"),precondition:K.and(T.writable,Lt.inlineSuggestionVisible),kbOpts:{weight:100,primary:606}})}async run(e,t){Ms.get(t)?.model.get()?.next()}};GN.ID=IG;let $3=GN;const ZN=class ZN extends le{constructor(){super({id:ZN.ID,label:H(1175,"Show Previous Inline Suggestion"),precondition:K.and(T.writable,Lt.inlineSuggestionVisible),kbOpts:{weight:100,primary:604}})}async run(e,t){Ms.get(t)?.model.get()?.previous()}};ZN.ID=kG;let j3=ZN;class oEe extends le{constructor(){super({id:"editor.action.inlineSuggest.trigger",label:H(1176,"Trigger Inline Suggestion"),precondition:T.writable})}async run(e,t){const i=Ms.get(t);await yne(async n=>{await i?.model.get()?.triggerExplicitly(n),i?.playAccessibilitySignal(n)})}}class rEe extends le{constructor(){super({id:"editor.action.inlineSuggest.triggerInlineEditExplicit",label:H(1177,"Trigger Next Edit Suggestion"),precondition:T.writable})}async run(e,t){const i=e.get(hi),n=Ms.get(t);await n?.model.get()?.triggerExplicitly(void 0,!0),n?.model.get()?.inlineEditAvailable.get()||i.notify({severity:k_.Info,message:p(1165,"No inline edit is available.")})}}class aEe extends Bi{constructor(){super({id:"editor.action.inlineSuggest.triggerInlineEdit",precondition:T.writable})}async runEditorCommand(e,t,i){await Ms.get(t)?.model.get()?.trigger(void 0,{onlyFetchInlineEdits:!0})}}class lEe extends le{constructor(){super({id:"editor.action.inlineSuggest.acceptNextWord",label:H(1178,"Accept Next Word Of Inline Suggestion"),precondition:K.and(T.writable,Lt.inlineSuggestionVisible),kbOpts:{weight:101,primary:2065,kbExpr:K.and(T.writable,Lt.inlineSuggestionVisible,Lt.cursorBeforeGhostText,o_.negate())},menuOpts:[{menuId:de.InlineSuggestionToolbar,title:p(1166,"Accept Word"),group:"primary",order:2}]})}async run(e,t){await Ms.get(t)?.model.get()?.acceptNextWord()}}class cEe extends le{constructor(){super({id:"editor.action.inlineSuggest.acceptNextLine",label:H(1179,"Accept Next Line Of Inline Suggestion"),precondition:K.and(T.writable,Lt.inlineSuggestionVisible),kbOpts:{weight:101},menuOpts:[{menuId:de.InlineSuggestionToolbar,title:p(1167,"Accept Line"),group:"secondary",order:2}]})}async run(e,t){await Ms.get(t)?.model.get()?.acceptNextLine()}}class dEe extends le{constructor(){super({id:Aw,label:H(1180,"Accept Inline Suggestion"),precondition:K.or(Lt.inlineSuggestionVisible,Lt.inlineEditVisible),menuOpts:[{menuId:de.InlineSuggestionToolbar,title:p(1168,"Accept"),group:"primary",order:2},{menuId:de.InlineEditsActions,title:p(1169,"Accept"),group:"primary",order:2}],kbOpts:[{primary:2,weight:200,kbExpr:K.or(K.and(Lt.inlineSuggestionVisible,T.tabMovesFocus.toNegated(),Be.Visible.toNegated(),T.hoverFocused.toNegated(),Lt.hasSelection.toNegated(),Lt.inlineSuggestionHasIndentationLessThanTabSize),K.and(Lt.inlineEditVisible,T.tabMovesFocus.toNegated(),Be.Visible.toNegated(),T.hoverFocused.toNegated(),Lt.tabShouldAcceptInlineEdit))}]})}async run(e,t){const i=Ms.getInFocusedEditorOrParent(e);i&&(i.model.get()?.accept(i.editor),i.editor.focus())}}rn.registerKeybindingRule({id:Aw,weight:202,primary:2,when:K.and(Lt.inInlineEditsPreviewEditor)});class hEe extends le{constructor(){super({id:p0e,label:H(1181,"Jump to next inline edit"),precondition:Lt.inlineEditVisible,menuOpts:[{menuId:de.InlineEditsActions,title:p(1170,"Jump"),group:"primary",order:1,when:Lt.cursorAtInlineEdit.toNegated()}],kbOpts:{primary:2,weight:201,kbExpr:K.and(Lt.inlineEditVisible,T.tabMovesFocus.toNegated(),Be.Visible.toNegated(),T.hoverFocused.toNegated(),Lt.tabShouldJumpToInlineEdit)}})}async run(e,t){const i=Ms.get(t);i&&i.jump()}}const YN=class YN extends le{constructor(){super({id:YN.ID,label:H(1182,"Hide Inline Suggestion"),precondition:K.or(Lt.inlineSuggestionVisible,Lt.inlineEditVisible),kbOpts:{weight:190,primary:9},menuOpts:[{menuId:de.InlineEditsActions,title:p(1171,"Reject"),group:"primary",order:3}]})}async run(e,t){const i=Ms.getInFocusedEditorOrParent(e);Dt(n=>{i?.model.get()?.stop("explicitCancel",n)}),i?.editor.focus()}};YN.ID=DG;let DD=YN;const XN=class XN extends le{constructor(){super({id:XN.ID,label:H(1183,"Toggle Inline Suggestions Show Collapsed"),precondition:K.true()})}async run(e,t){const i=e.get(Me),n=i.getValue("editor.inlineSuggest.edits.showCollapsed");i.updateValue("editor.inlineSuggest.edits.showCollapsed",!n)}};XN.ID=P4;let q3=XN;rn.registerKeybindingRule({id:DD.ID,weight:-1,primary:9,secondary:[1033],when:K.and(Lt.inInlineEditsPreviewEditor)});const QN=class QN extends ln{constructor(){super({id:QN.ID,title:p(1172,"Always Show Toolbar"),f1:!1,precondition:void 0,menu:[{id:de.InlineSuggestionToolbar,group:"secondary",order:10}],toggled:K.equals("config.editor.inlineSuggest.showToolbar","always")})}async run(e){const t=e.get(Me),n=t.getValue("editor.inlineSuggest.showToolbar")==="always"?"onHover":"always";t.updateValue("editor.inlineSuggest.showToolbar",n)}};QN.ID="editor.action.inlineSuggest.toggleAlwaysShowToolbar";let K3=QN;class uEe extends le{constructor(){super({id:"editor.action.inlineSuggest.dev.extractRepro",label:p(1173,"Developer: Extract Inline Suggest State"),alias:"Developer: Inline Suggest Extract Repro",precondition:K.or(Lt.inlineEditVisible,Lt.inlineSuggestionVisible)})}async run(e,t){const i=e.get(Wa),s=Ms.get(t)?.model.get();if(!s)return;const r=s.extractReproSample(),l=ro(JSON.stringify({inlineCompletion:r.inlineCompletion},null,4)).map(d=>"// "+d).join(`
`),c=`${r.documentValue}
// <json>
${l}
// </json>
`;return await i.writeText(c),{reproCase:c}}}var fEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},T0=function(o,e){return function(t,i){e(t,i,o)}};class gEe{constructor(e,t,i){this.owner=e,this.range=t,this.controller=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}let G3=class{constructor(e,t,i,n,s,r){this._editor=e,this._languageService=t,this._openerService=i,this.accessibilityService=n,this._instantiationService=s,this._telemetryService=r,this.hoverOrdinal=4}suggestHoverAnchor(e){const t=Ms.get(this._editor);if(!t)return null;const i=e.target;if(i.type===8){const n=i.detail;if(t.shouldShowHoverAtViewZone(n.viewZoneId))return new Mw(1e3,this,k.fromPositions(this._editor.getModel().validatePosition(n.positionBefore||n.position)),e.event.posx,e.event.posy,!1)}if(i.type===7&&t.shouldShowHoverAt(i.range))return new Mw(1e3,this,i.range,e.event.posx,e.event.posy,!1);if(i.type===6&&i.detail.mightBeForeignElement&&t.shouldShowHoverAt(i.range))return new Mw(1e3,this,i.range,e.event.posx,e.event.posy,!1);if(i.type===9&&i.element){const n=v0.getWarningWidgetContext(i.element);if(n&&t.shouldShowHoverAt(n.range))return new Mw(1e3,this,n.range,e.event.posx,e.event.posy,!1)}return null}computeSync(e,t){if(this._editor.getOption(71).showToolbar!=="onHover")return[];const i=Ms.get(this._editor);return i&&i.shouldShowHoverAt(e.range)?[new gEe(this,e.range,i)]:[]}renderHoverParts(e,t){const i=new U,n=t[0];this._telemetryService.publicLog2("inlineCompletionHover.shown"),this.accessibilityService.isScreenReaderOptimized()&&!this._editor.getOption(12)&&i.add(this.renderScreenReaderText(e,n));const s=n.controller.model.get(),r=document.createElement("div");e.fragment.appendChild(r),i.add(Bn((l,c)=>{const d=c.add(this._instantiationService.createInstance(hb.hot.read(l),this._editor,!1,Et(null),s.selectedInlineCompletionIndex,s.inlineCompletionsCount,s.activeCommands,s.warning,()=>{e.onContentsChanged()}));r.replaceChildren(d.getDomNode())})),s.triggerExplicitly();const a={hoverPart:n,hoverElement:r,dispose(){i.dispose()}};return new Mg([a])}renderScreenReaderText(e,t){const i=new U,n=Q,s=n("div.hover-row.markdown-hover"),r=Z(s,n("div.hover-contents",{"aria-live":"assertive"})),a=new fd({editor:this._editor},this._languageService,this._openerService),l=c=>{const d=p(1197,"Suggestion:"),h=i.add(a.render(new qn().appendText(d).appendCodeblock("text",c),{asyncRenderCallback:()=>{r.className="hover-contents code-hover-contents",e.onContentsChanged()}}));r.replaceChildren(h.element)};return i.add(Se(c=>{const d=t.controller.model.read(c)?.primaryGhostText.read(c);if(d){const h=this._editor.getModel().getLineContent(d.lineNumber);l(d.renderForScreenReader(h))}else Yi(r)})),e.fragment.appendChild(s),i}};G3=fEe([T0(1,Mt),T0(2,Js),T0(3,bn),T0(4,ge),T0(5,Vn)],G3);class pEe{}Qe(Ms.ID,tke(Ms.hot),3),ne(oEe),ne(rEe),re(new aEe),ne($3),ne(j3),ne(lEe),ne(cEe),ne(dEe),ne(q3),ne(DD),ne(hEe),mt(K3),ne(uEe),mt($F),mt(jF),Pg.register(G3),YI.register(new pEe);var mEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Z3=function(o,e){return function(t,i){e(t,i,o)}},R0;let M0=(Wu=class{constructor(e,t,i,n){this.textModelResolverService=t,this.languageService=i,this.languageFeaturesService=n,this.toUnhook=new U,this.toUnhookForKeyboard=new U,this.currentWordAtPosition=null,this.previousPromise=null,this.editor=e,this.linkDecorations=this.editor.createDecorationsCollection();const s=new tI(e);this.toUnhook.add(s),this.toUnhook.add(s.onMouseMoveOrRelevantKeyDown(([r,a])=>{this.startFindDefinitionFromMouse(r,a??void 0)})),this.toUnhook.add(s.onExecute(r=>{this.isEnabled(r)&&this.gotoDefinition(r.target.position,r.hasSideBySideModifier).catch(a=>{Ee(a)}).finally(()=>{this.removeLinkDecorations()})})),this.toUnhook.add(s.onCancel(()=>{this.removeLinkDecorations(),this.currentWordAtPosition=null}))}static get(e){return e.getContribution(R0.ID)}async startFindDefinitionFromCursor(e){await this.startFindDefinition(e),this.toUnhookForKeyboard.add(this.editor.onDidChangeCursorPosition(()=>{this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear()})),this.toUnhookForKeyboard.add(this.editor.onKeyDown(t=>{t&&(this.currentWordAtPosition=null,this.removeLinkDecorations(),this.toUnhookForKeyboard.clear())}))}startFindDefinitionFromMouse(e,t){if(e.target.type===9&&this.linkDecorations.length>0)return;if(!this.editor.hasModel()||!this.isEnabled(e,t)){this.currentWordAtPosition=null,this.removeLinkDecorations();return}const i=e.target.position;this.startFindDefinition(i)}async startFindDefinition(e){this.toUnhookForKeyboard.clear();const t=e?this.editor.getModel()?.getWordAtPosition(e):null;if(!t){this.currentWordAtPosition=null,this.removeLinkDecorations();return}if(this.currentWordAtPosition&&this.currentWordAtPosition.startColumn===t.startColumn&&this.currentWordAtPosition.endColumn===t.endColumn&&this.currentWordAtPosition.word===t.word)return;this.currentWordAtPosition=t;const i=new TK(this.editor,15);this.previousPromise&&(this.previousPromise.cancel(),this.previousPromise=null),this.previousPromise=Vi(r=>this.findDefinition(e,r));let n;try{n=await this.previousPromise}catch(r){Ee(r);return}if(!n||!n.length||!i.validate(this.editor)){this.removeLinkDecorations();return}const s=n[0].originSelectionRange?k.lift(n[0].originSelectionRange):new k(e.lineNumber,t.startColumn,e.lineNumber,t.endColumn);if(n.length>1){let r=s;for(const{originSelectionRange:a}of n)a&&(r=k.plusRange(r,a));this.addDecoration(r,new qn().appendText(p(1072,"Click to show {0} definitions.",n.length)))}else{const r=n[0];return r.uri?this.textModelResolverService.createModelReference(r.uri).then(a=>{if(!a.object||!a.object.textEditorModel){a.dispose();return}const{object:{textEditorModel:l}}=a,{startLineNumber:c}=r.range;if(c<1||c>l.getLineCount()){a.dispose();return}const d=this.getPreviewValue(l,c,r),h=this.languageService.guessLanguageIdByFilepathOrFirstLine(l.uri);this.addDecoration(s,d?new qn().appendCodeblock(h||"",d):void 0),a.dispose()}):void 0}}getPreviewValue(e,t,i){let n=i.range;return n.endLineNumber-n.startLineNumber>=R0.MAX_SOURCE_PREVIEW_LINES&&(n=this.getPreviewRangeBasedOnIndentation(e,t)),n=e.validateRange(n),this.stripIndentationFromPreviewRange(e,t,n)}stripIndentationFromPreviewRange(e,t,i){let s=e.getLineFirstNonWhitespaceColumn(t);for(let a=t+1;a<i.endLineNumber;a++){const l=e.getLineFirstNonWhitespaceColumn(a);s=Math.min(s,l)}return e.getValueInRange(i).replace(new RegExp(`^\\s{${s-1}}`,"gm"),"").trim()}getPreviewRangeBasedOnIndentation(e,t){const i=e.getLineFirstNonWhitespaceColumn(t),n=Math.min(e.getLineCount(),t+R0.MAX_SOURCE_PREVIEW_LINES);let s=t+1;for(;s<n;s++){const r=e.getLineFirstNonWhitespaceColumn(s);if(i===r)break}return new k(t,1,s+1,1)}addDecoration(e,t){const i={range:e,options:{description:"goto-definition-link",inlineClassName:"goto-definition-link",hoverMessage:t}};this.linkDecorations.set([i])}removeLinkDecorations(){this.linkDecorations.clear()}isEnabled(e,t){return this.editor.hasModel()&&e.isLeftClick&&e.isNoneOrSingleMouseDown&&e.target.type===6&&!(e.target.detail.injectedText?.options instanceof Mh)&&(e.hasTriggerModifier||(t?t.keyCodeIsTriggerKey:!1))&&this.languageFeaturesService.definitionProvider.has(this.editor.getModel())}findDefinition(e,t){const i=this.editor.getModel();return i?Zw(this.languageFeaturesService.definitionProvider,i,e,!1,t):Promise.resolve(null)}gotoDefinition(e,t){return this.editor.setPosition(e),this.editor.invokeWithinContext(i=>{const n=!t&&this.editor.getOption(101)&&!this.isInPeekEditor(i);return new Xw({openToSide:t,openInPeek:n,muteMessage:!0},{title:{value:"",original:""},id:"",precondition:void 0}).run(i)})}isInPeekEditor(e){const t=e.get(xe);return eo.inPeekEditor.getValue(t)}dispose(){this.toUnhook.dispose(),this.toUnhookForKeyboard.dispose()}},R0=Wu,Wu.ID="editor.contrib.gotodefinitionatposition",Wu.MAX_SOURCE_PREVIEW_LINES=8,Wu);M0=R0=mEe([Z3(1,ns),Z3(2,Mt),Z3(3,he)],M0),Qe(M0.ID,M0,2);var nQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ED=function(o,e){return function(t,i){e(t,i,o)}};class sQ{constructor(e,t,i){this.marker=e,this.index=t,this.total=i}}let Y3=class{constructor(e,t,i){this._markerService=t,this._configService=i,this._onDidChange=new P,this.onDidChange=this._onDidChange.event,this._dispoables=new U,this._markers=[],this._nextIdx=-1,be.isUri(e)?this._resourceFilter=a=>a.toString()===e.toString():e&&(this._resourceFilter=e);const n=this._configService.getValue("problems.sortOrder"),s=(a,l)=>{let c=a1(a.resource.toString(),l.resource.toString());return c===0&&(n==="position"?c=k.compareRangesUsingStarts(a,l)||oi.compare(a.severity,l.severity):c=oi.compare(a.severity,l.severity)||k.compareRangesUsingStarts(a,l)),c},r=()=>{let a=this._markerService.read({resource:be.isUri(e)?e:void 0,severities:oi.Error|oi.Warning|oi.Info});return typeof e=="function"&&(a=a.filter(l=>this._resourceFilter(l.resource))),a.sort(s),Ut(a,this._markers,(l,c)=>l.resource.toString()===c.resource.toString()&&l.startLineNumber===c.startLineNumber&&l.startColumn===c.startColumn&&l.endLineNumber===c.endLineNumber&&l.endColumn===c.endColumn&&l.severity===c.severity&&l.message===c.message)?!1:(this._markers=a,!0)};r(),this._dispoables.add(t.onMarkerChanged(a=>{(!this._resourceFilter||a.some(l=>this._resourceFilter(l)))&&r()&&(this._nextIdx=-1,this._onDidChange.fire())}))}dispose(){this._dispoables.dispose(),this._onDidChange.dispose()}matches(e){return!this._resourceFilter&&!e?!0:!this._resourceFilter||!e?!1:this._resourceFilter(e)}get selected(){const e=this._markers[this._nextIdx];return e&&new sQ(e,this._nextIdx+1,this._markers.length)}_initIdx(e,t,i){let n=this._markers.findIndex(s=>ch(s.resource,e.uri));if(n<0)n=FR(this._markers.length,s=>a1(this._markers[s].resource.toString(),e.uri.toString())),n<0&&(n=~n),i?this._nextIdx=n:this._nextIdx=(this._markers.length+n-1)%this._markers.length;else{let s=!1,r=!1;for(let a=n;a<this._markers.length;a++){let l=k.lift(this._markers[a]);if(l.isEmpty()){const c=e.getWordAtPosition(l.getStartPosition());c&&(l=new k(l.startLineNumber,c.startColumn,l.startLineNumber,c.endColumn))}if(t&&(l.containsPosition(t)||t.isBeforeOrEqual(l.getStartPosition()))){this._nextIdx=a,s=!0,r=!l.containsPosition(t);break}if(this._markers[a].resource.toString()!==e.uri.toString())break}s?r&&!i&&(this._nextIdx-=1):this._nextIdx=i?0:this._markers.length-1}this._nextIdx<0&&(this._nextIdx=this._markers.length-1)}resetIndex(){this._nextIdx=-1}move(e,t,i){if(this._markers.length===0)return!1;const n=this._nextIdx;return this._nextIdx===-1?this._initIdx(t,i,e):e?this._nextIdx=(this._nextIdx+1)%this._markers.length:e||(this._nextIdx=(this._nextIdx-1+this._markers.length)%this._markers.length),n!==this._nextIdx}find(e,t){let i=this._markers.findIndex(n=>n.resource.toString()===e.toString());if(!(i<0)){for(;i<this._markers.length;i++)if(k.containsPosition(this._markers[i],t))return new sQ(this._markers[i],i+1,this._markers.length)}}};Y3=nQ([ED(1,zl),ED(2,Me)],Y3);const oQ=We("IMarkerNavigationService");let X3=class{constructor(e,t){this._markerService=e,this._configService=t,this._provider=new Jn}getMarkerList(e){for(const t of this._provider){const i=t.getMarkerList(e);if(i)return i}return new Y3(e,this._markerService,this._configService)}};X3=nQ([ED(0,zl),ED(1,Me)],X3),je(oQ,X3,1);var Q3;(function(o){function e(t){switch(t){case ii.Ignore:return"severity-ignore "+ve.asClassName(Y.info);case ii.Info:return ve.asClassName(Y.info);case ii.Warning:return ve.asClassName(Y.warning);case ii.Error:return ve.asClassName(Y.error);default:return""}}o.className=e})(Q3||(Q3={}));var _Ee=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Hb=function(o,e){return function(t,i){e(t,i,o)}},J3;class bEe{constructor(e,t,i,n,s){this._openerService=n,this._labelService=s,this._lines=0,this._longestLineLength=0,this._relatedDiagnostics=new WeakMap,this._disposables=new U,this._editor=t;const r=document.createElement("div");r.className="descriptioncontainer",this._messageBlock=document.createElement("div"),this._messageBlock.classList.add("message"),this._messageBlock.setAttribute("aria-live","assertive"),this._messageBlock.setAttribute("role","alert"),r.appendChild(this._messageBlock),this._relatedBlock=document.createElement("div"),r.appendChild(this._relatedBlock),this._disposables.add(Si(this._relatedBlock,"click",a=>{a.preventDefault();const l=this._relatedDiagnostics.get(a.target);l&&i(l)})),this._scrollable=new vz(r,{horizontal:1,vertical:1,useShadows:!1,horizontalScrollbarSize:6,verticalScrollbarSize:6}),e.appendChild(this._scrollable.getDomNode()),this._disposables.add(this._scrollable.onScroll(a=>{r.style.left=`-${a.scrollLeft}px`,r.style.top=`-${a.scrollTop}px`})),this._disposables.add(this._scrollable)}dispose(){pt(this._disposables)}update(e){const{source:t,message:i,relatedInformation:n,code:s}=e;let r=(t?.length||0)+2;s&&(typeof s=="string"?r+=s.length:r+=s.value.length);const a=ro(i);this._lines=a.length,this._longestLineLength=0;for(const u of a)this._longestLineLength=Math.max(u.length+r,this._longestLineLength);pn(this._messageBlock),this._messageBlock.setAttribute("aria-label",this.getAriaLabel(e)),this._editor.applyFontInfo(this._messageBlock);let l=this._messageBlock;for(const u of a)l=document.createElement("div"),l.innerText=u,u===""&&(l.style.height=this._messageBlock.style.lineHeight),this._messageBlock.appendChild(l);if(t||s){const u=document.createElement("span");if(u.classList.add("details"),l.appendChild(u),t){const f=document.createElement("span");f.innerText=t,f.classList.add("source"),u.appendChild(f)}if(s)if(typeof s=="string"){const f=document.createElement("span");f.innerText=`(${s})`,f.classList.add("code"),u.appendChild(f)}else{this._codeLink=Q("a.code-link"),this._codeLink.setAttribute("href",`${s.target.toString()}`),this._codeLink.onclick=g=>{this._openerService.open(s.target,{allowCommands:!0}),g.preventDefault(),g.stopPropagation()};const f=Z(this._codeLink,Q("span"));f.innerText=s.value,u.appendChild(this._codeLink)}}if(pn(this._relatedBlock),this._editor.applyFontInfo(this._relatedBlock),is(n)){const u=this._relatedBlock.appendChild(document.createElement("div"));u.style.paddingTop=`${Math.floor(this._editor.getOption(75)*.66)}px`,this._lines+=1;for(const f of n){const g=document.createElement("div"),m=document.createElement("a");m.classList.add("filename"),m.innerText=`${this._labelService.getUriBasenameLabel(f.resource)}(${f.startLineNumber}, ${f.startColumn}): `,m.title=this._labelService.getUriLabel(f.resource),this._relatedDiagnostics.set(m,f);const _=document.createElement("span");_.innerText=f.message,g.appendChild(m),g.appendChild(_),this._lines+=1,u.appendChild(g)}}const c=this._editor.getOption(59),d=Math.ceil(c.typicalFullwidthCharacterWidth*this._longestLineLength*.75),h=c.lineHeight*this._lines;this._scrollable.setScrollDimensions({scrollWidth:d,scrollHeight:h})}layout(e,t){this._scrollable.getDomNode().style.height=`${e}px`,this._scrollable.getDomNode().style.width=`${t}px`,this._scrollable.setScrollDimensions({width:t,height:e})}getHeightInLines(){return Math.min(17,this._lines)}getAriaLabel(e){let t="";switch(e.severity){case oi.Error:t=p(1019,"Error");break;case oi.Warning:t=p(1020,"Warning");break;case oi.Info:t=p(1021,"Info");break;case oi.Hint:t=p(1022,"Hint");break}let i=p(1023,"{0} at {1}. ",t,e.startLineNumber+":"+e.startColumn);const n=this._editor.getModel();return n&&e.startLineNumber<=n.getLineCount()&&e.startLineNumber>=1&&(i=`${n.getLineContent(e.startLineNumber)}, ${i}`),i}}let P0=(sm=class extends sI{constructor(e,t,i,n,s,r,a){super(e,{showArrow:!0,showFrame:!0,isAccessible:!0,frameWidth:1},s),this._themeService=t,this._openerService=i,this._menuService=n,this._contextKeyService=r,this._labelService=a,this._callOnDispose=new U,this._onDidSelectRelatedInformation=new P,this.onDidSelectRelatedInformation=this._onDidSelectRelatedInformation.event,this._severity=oi.Warning,this._backgroundColor=$.white,this._applyTheme(t.getColorTheme()),this._callOnDispose.add(t.onDidColorThemeChange(this._applyTheme.bind(this))),this.create()}_applyTheme(e){this._backgroundColor=e.getColor(SEe);let t=e7,i=CEe;this._severity===oi.Warning?(t=ND,i=vEe):this._severity===oi.Info&&(t=t7,i=wEe);const n=e.getColor(t),s=e.getColor(i);this.style({arrowColor:n,frameColor:n,headerBackgroundColor:s,primaryHeadingColor:e.getColor(tZ),secondaryHeadingColor:e.getColor(iZ)})}_applyStyles(){this._parentContainer&&(this._parentContainer.style.backgroundColor=this._backgroundColor?this._backgroundColor.toString():""),super._applyStyles()}dispose(){this._callOnDispose.dispose(),super.dispose()}_fillHead(e){super._fillHead(e),this._disposables.add(this._actionbarWidget.actionRunner.onWillRun(n=>this.editor.focus()));const t=this._menuService.getMenuActions(J3.TitleMenu,this._contextKeyService),i=G1e(t);this._actionbarWidget.push(i,{label:!1,icon:!0,index:0})}_fillTitleIcon(e){this._icon=Z(e,Q(""))}_fillBody(e){this._parentContainer=e,e.classList.add("marker-widget"),this._parentContainer.tabIndex=0,this._parentContainer.setAttribute("role","tooltip"),this._container=document.createElement("div"),e.appendChild(this._container),this._message=new bEe(this._container,this.editor,t=>this._onDidSelectRelatedInformation.fire(t),this._openerService,this._labelService),this._disposables.add(this._message)}show(){throw new Error("call showAtMarker")}showAtMarker(e,t,i){this._container.classList.remove("stale"),this._message.update(e),this._severity=e.severity,this._applyTheme(this._themeService.getColorTheme());const n=k.lift(e),s=this.editor.getPosition(),r=s&&n.containsPosition(s)?s:n.getStartPosition();super.show(r,this.computeRequiredHeight());const a=this.editor.getModel();if(a){const l=i>1?p(1024,"{0} of {1} problems",t,i):p(1025,"{0} of {1} problem",t,i);this.setTitle(vr(a.uri),l)}this._icon.className=`codicon ${Q3.className(oi.toSeverity(this._severity))}`,this.editor.revealPositionNearTop(r,0),this.editor.focus()}updateMarker(e){this._container.classList.remove("stale"),this._message.update(e)}showStale(){this._container.classList.add("stale"),this._relayout()}_doLayoutBody(e,t){super._doLayoutBody(e,t),this._heightInPixel=e,this._message.layout(e,t),this._container.style.height=`${e}px`}_onWidth(e){this._message.layout(this._heightInPixel,e)}_relayout(){super._relayout(this.computeRequiredHeight())}computeRequiredHeight(){return 3+this._message.getHeightInLines()}},J3=sm,sm.TitleMenu=new de("gotoErrorTitleMenu"),sm);P0=J3=_Ee([Hb(1,li),Hb(2,Js),Hb(3,Cr),Hb(4,ge),Hb(5,xe),Hb(6,zg)],P0);const rQ=H1(yL,Kae),aQ=H1(Wc,V1),lQ=H1(Cl,z1),e7=N("editorMarkerNavigationError.background",{dark:rQ,light:rQ,hcDark:Ze,hcLight:Ze},p(1026,"Editor marker navigation widget error color.")),CEe=N("editorMarkerNavigationError.headerBackground",{dark:Ne(e7,.1),light:Ne(e7,.1),hcDark:null,hcLight:null},p(1027,"Editor marker navigation widget error heading background.")),ND=N("editorMarkerNavigationWarning.background",{dark:aQ,light:aQ,hcDark:Ze,hcLight:Ze},p(1028,"Editor marker navigation widget warning color.")),vEe=N("editorMarkerNavigationWarning.headerBackground",{dark:Ne(ND,.1),light:Ne(ND,.1),hcDark:"#0C141F",hcLight:Ne(ND,.2)},p(1029,"Editor marker navigation widget warning heading background.")),t7=N("editorMarkerNavigationInfo.background",{dark:lQ,light:lQ,hcDark:Ze,hcLight:Ze},p(1030,"Editor marker navigation widget info color.")),wEe=N("editorMarkerNavigationInfo.headerBackground",{dark:Ne(t7,.1),light:Ne(t7,.1),hcDark:null,hcLight:null},p(1031,"Editor marker navigation widget info heading background.")),SEe=N("editorMarkerNavigation.background",xi,p(1032,"Editor marker navigation widget background."));var yEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TD=function(o,e){return function(t,i){e(t,i,o)}},A0;let Jg=(om=class{static get(e){return e.getContribution(A0.ID)}constructor(e,t,i,n,s){this._markerNavigationService=t,this._contextKeyService=i,this._editorService=n,this._instantiationService=s,this._sessionDispoables=new U,this._editor=e,this._widgetVisible=cQ.bindTo(this._contextKeyService)}dispose(){this._cleanUp(),this._sessionDispoables.dispose()}_cleanUp(){this._widgetVisible.reset(),this._sessionDispoables.clear(),this._widget=void 0,this._model=void 0}_getOrCreateModel(e){if(this._model&&this._model.matches(e))return this._model;let t=!1;return this._model&&(t=!0,this._cleanUp()),this._model=this._markerNavigationService.getMarkerList(e),t&&this._model.move(!0,this._editor.getModel(),this._editor.getPosition()),this._widget=this._instantiationService.createInstance(P0,this._editor),this._widget.onDidClose(()=>this.close(),this,this._sessionDispoables),this._widgetVisible.set(!0),this._sessionDispoables.add(this._model),this._sessionDispoables.add(this._widget),this._sessionDispoables.add(this._editor.onDidChangeCursorPosition(i=>{(!this._model?.selected||!k.containsPosition(this._model?.selected.marker,i.position))&&this._model?.resetIndex()})),this._sessionDispoables.add(this._model.onDidChange(()=>{if(!this._widget||!this._widget.position||!this._model)return;const i=this._model.find(this._editor.getModel().uri,this._widget.position);i?this._widget.updateMarker(i.marker):this._widget.showStale()})),this._sessionDispoables.add(this._widget.onDidSelectRelatedInformation(i=>{this._editorService.openCodeEditor({resource:i.resource,options:{pinned:!0,revealIfOpened:!0,selection:k.lift(i).collapseToStart()}},this._editor),this.close(!1)})),this._sessionDispoables.add(this._editor.onDidChangeModel(()=>this._cleanUp())),this._model}close(e=!0){this._cleanUp(),e&&this._editor.focus()}showAtMarker(e){if(!this._editor.hasModel())return;const t=this._editor.getModel(),i=this._getOrCreateModel(t.uri);i.resetIndex(),i.move(!0,t,new M(e.startLineNumber,e.startColumn)),i.selected&&this._widget.showAtMarker(i.selected.marker,i.selected.index,i.selected.total)}async navigate(e,t){if(!this._editor.hasModel())return;const i=this._editor.getModel(),n=this._getOrCreateModel(t?void 0:i.uri);if(n.move(e,i,this._editor.getPosition()),!!n.selected)if(n.selected.marker.resource.toString()!==i.uri.toString()){this._cleanUp();const s=await this._editorService.openCodeEditor({resource:n.selected.marker.resource,options:{pinned:!1,revealIfOpened:!0,selectionRevealType:2,selection:n.selected.marker}},this._editor);s&&(A0.get(s)?.close(),A0.get(s)?.navigate(e,t))}else this._widget.showAtMarker(n.selected.marker,n.selected.index,n.selected.total)}},A0=om,om.ID="editor.contrib.markerController",om);Jg=A0=yEe([TD(1,oQ),TD(2,xe),TD(3,et),TD(4,ge)],Jg);class RD extends le{constructor(e,t,i){super(i),this._next=e,this._multiFile=t}async run(e,t){t.hasModel()&&await Jg.get(t)?.navigate(this._next,this._multiFile)}}const rm=class rm extends RD{constructor(){super(!0,!1,{id:rm.ID,label:rm.LABEL,precondition:void 0,kbOpts:{kbExpr:T.focus,primary:578,weight:100},menuOpts:{menuId:P0.TitleMenu,title:rm.LABEL.value,icon:Wt("marker-navigation-next",Y.arrowDown,p(1011,"Icon for goto next marker.")),group:"navigation",order:1}})}};rm.ID="editor.action.marker.next",rm.LABEL=H(1015,"Go to Next Problem (Error, Warning, Info)");let MD=rm;const am=class am extends RD{constructor(){super(!1,!1,{id:am.ID,label:am.LABEL,precondition:void 0,kbOpts:{kbExpr:T.focus,primary:1602,weight:100},menuOpts:{menuId:P0.TitleMenu,title:am.LABEL.value,icon:Wt("marker-navigation-previous",Y.arrowUp,p(1012,"Icon for goto previous marker.")),group:"navigation",order:2}})}};am.ID="editor.action.marker.prev",am.LABEL=H(1016,"Go to Previous Problem (Error, Warning, Info)");let i7=am;class LEe extends RD{constructor(){super(!0,!0,{id:"editor.action.marker.nextInFiles",label:H(1017,"Go to Next Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:66,weight:100},menuOpts:{menuId:de.MenubarGoMenu,title:p(1013,"Next &&Problem"),group:"6_problem_nav",order:1}})}}class xEe extends RD{constructor(){super(!1,!0,{id:"editor.action.marker.prevInFiles",label:H(1018,"Go to Previous Problem in Files (Error, Warning, Info)"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:1090,weight:100},menuOpts:{menuId:de.MenubarGoMenu,title:p(1014,"Previous &&Problem"),group:"6_problem_nav",order:2}})}}Qe(Jg.ID,Jg,4),ne(MD),ne(i7),ne(LEe),ne(xEe);const cQ=new ae("markersNavigationVisible",!1),kEe=Bi.bindToContribution(Jg.get);re(new kEe({id:"closeMarkersNavigation",precondition:cQ,handler:o=>o.close(),kbOpts:{weight:150,kbExpr:T.focus,primary:9,secondary:[1033]}}));class IEe extends le{constructor(){super({id:"editor.action.debugEditorGpuRenderer",label:H(1096,"Developer: Debug Editor GPU Renderer"),precondition:K.true()})}async run(e,t){const i=e.get(ge),s=await e.get(Zn).pick([{label:p(1093,"Log Texture Atlas Stats"),id:"logTextureAtlasStats"},{label:p(1094,"Save Texture Atlas"),id:"saveTextureAtlas"},{label:p(1095,"Draw Glyph"),id:"drawGlyph"}],{canPickMany:!1});if(s)switch(s.id){case"logTextureAtlasStats":i.invokeFunction(r=>{const a=r.get(Rt),l=ls.atlas;if(!ls.atlas){a.error("No texture atlas found");return}const c=l.getStats();a.info(["Texture atlas stats",...c].join(`
`))});break;case"saveTextureAtlas":i.invokeFunction(async r=>{const a=r.get(pd),l=r.get(yX),c=a.getWorkspace().folders;if(c.length>0){const d=ls.atlas,h=[];for(const[u,f]of d.pages.entries())h.push(l.writeFile(be.joinPath(c[0].uri,`textureAtlasPage${u}_actual.png`),sh.wrap(new Uint8Array(await(await f.source.convertToBlob()).arrayBuffer()))),l.writeFile(be.joinPath(c[0].uri,`textureAtlasPage${u}_usage.png`),sh.wrap(new Uint8Array(await(await f.getUsagePreview()).arrayBuffer()))));await Promise.all(h)}});break;case"drawGlyph":i.invokeFunction(async r=>{const a=r.get(Me),l=r.get(yX),c=r.get(Zn),h=r.get(pd).getWorkspace().folders;if(h.length===0)return;const u=ls.atlas,f=a.getValue("editor.fontFamily"),g=a.getValue("editor.fontSize"),m=new gv(g,f,ft().devicePixelRatio,ls.decorationStyleCache);let _=await c.input({prompt:"Enter a character to draw (prefix with 0x for code point))"});if(!_)return;const b=_.match(/0x(?<codePoint>[0-9a-f]+)/i)?.groups?.codePoint;b!==void 0&&(_=String.fromCodePoint(parseInt(b,16)));const C=0,v=u.getGlyph(m,_,C,0,0);if(!v)return;const S=u.pages[v.pageIndex].source.getContext("2d")?.getImageData(v.x,v.y,v.w,v.h);if(!S)return;const L=new OffscreenCanvas(S.width,S.height);Vf(L.getContext("2d")).putImageData(S,0,0);const I=await L.convertToBlob({type:"image/png"}),D=be.joinPath(h[0].uri,`glyph_${_}_${C}_${g}px_${f.replaceAll(/[,\\\/\.'\s]/g,"_")}.png`);await l.writeFile(D,sh.wrap(new Uint8Array(await I.arrayBuffer())))});break}}}ne(IEe);var Qa;(function(o){o.NoAutoFocus="noAutoFocus",o.FocusIfVisible="focusIfVisible",o.AutoFocusImmediately="autoFocusImmediately"})(Qa||(Qa={}));class DEe extends le{constructor(){super({id:xG,label:H(1102,"Show or Focus Hover"),metadata:{description:H(1103,"Show or focus the editor hover which shows documentation, references, and other content for a symbol at the current cursor position."),args:[{name:"args",schema:{type:"object",properties:{focus:{description:"Controls if and when the hover should take focus upon being triggered by this action.",enum:[Qa.NoAutoFocus,Qa.FocusIfVisible,Qa.AutoFocusImmediately],enumDescriptions:[p(1099,"The hover will not automatically take focus."),p(1100,"The hover will take focus only if it is already visible."),p(1101,"The hover will automatically take focus when it appears.")],default:Qa.FocusIfVisible}}}}]},precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2087),weight:100}})}run(e,t,i){if(!t.hasModel())return;const n=Yn.get(t);if(!n)return;const s=i?.focus;let r=Qa.FocusIfVisible;Object.values(Qa).includes(s)?r=s:typeof s=="boolean"&&s&&(r=Qa.AutoFocusImmediately);const a=c=>{const d=t.getPosition(),h=new k(d.lineNumber,d.column,d.lineNumber,d.column);n.showContentHover(h,1,2,c)},l=t.getOption(2)===2;n.isHoverVisible?r!==Qa.NoAutoFocus?n.focus():a(l):a(l||r===Qa.AutoFocusImmediately)}}class EEe extends le{constructor(){super({id:n0e,label:H(1104,"Show Definition Preview Hover"),precondition:void 0,metadata:{description:H(1105,"Show the definition preview hover in the editor.")}})}run(e,t){const i=Yn.get(t);if(!i)return;const n=t.getPosition();if(!n)return;const s=new k(n.lineNumber,n.column,n.lineNumber,n.column),r=M0.get(t);if(!r)return;r.startFindDefinitionFromCursor(n).then(()=>{i.showContentHover(s,1,2,!0)})}}class NEe extends le{constructor(){super({id:s0e,label:H(1106,"Hide Hover"),alias:"Hide Content Hover",precondition:void 0})}run(e,t){Yn.get(t)?.hideContentHover()}}class TEe extends le{constructor(){super({id:o0e,label:H(1107,"Scroll Up Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:16,weight:100},metadata:{description:H(1108,"Scroll up the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.scrollUp()}}class REe extends le{constructor(){super({id:r0e,label:H(1109,"Scroll Down Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:18,weight:100},metadata:{description:H(1110,"Scroll down the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.scrollDown()}}class MEe extends le{constructor(){super({id:a0e,label:H(1111,"Scroll Left Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:15,weight:100},metadata:{description:H(1112,"Scroll left the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.scrollLeft()}}class PEe extends le{constructor(){super({id:l0e,label:H(1113,"Scroll Right Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:17,weight:100},metadata:{description:H(1114,"Scroll right the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.scrollRight()}}class AEe extends le{constructor(){super({id:c0e,label:H(1115,"Page Up Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:11,secondary:[528],weight:100},metadata:{description:H(1116,"Page up the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.pageUp()}}class OEe extends le{constructor(){super({id:d0e,label:H(1117,"Page Down Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:12,secondary:[530],weight:100},metadata:{description:H(1118,"Page down the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.pageDown()}}class FEe extends le{constructor(){super({id:h0e,label:H(1119,"Go To Top Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:14,secondary:[2064],weight:100},metadata:{description:H(1120,"Go to the top of the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.goToTop()}}class WEe extends le{constructor(){super({id:u0e,label:H(1121,"Go To Bottom Hover"),precondition:T.hoverFocused,kbOpts:{kbExpr:T.hoverFocused,primary:13,secondary:[2066],weight:100},metadata:{description:H(1122,"Go to the bottom of the editor hover.")}})}run(e,t){const i=Yn.get(t);i&&i.goToBottom()}}class BEe extends le{constructor(){super({id:zk,label:f0e,alias:"Increase Hover Verbosity Level",precondition:T.hoverVisible})}run(e,t,i){const n=Yn.get(t);if(!n)return;const s=i?.index!==void 0?i.index:n.focusedHoverPartIndex();n.updateHoverVerbosityLevel(po.Increase,s,i?.focus)}}class HEe extends le{constructor(){super({id:Uk,label:g0e,alias:"Decrease Hover Verbosity Level",precondition:T.hoverVisible})}run(e,t,i){const n=Yn.get(t);if(!n)return;const s=i?.index!==void 0?i.index:n.focusedHoverPartIndex();Yn.get(t)?.updateHoverVerbosityLevel(po.Decrease,s,i?.focus)}}var VEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},n7=function(o,e){return function(t,i){e(t,i,o)}};const da=Q;class zEe{constructor(e,t,i){this.owner=e,this.range=t,this.marker=i}isValidForHoverAnchor(e){return e.type===1&&this.range.startColumn<=e.range.startColumn&&this.range.endColumn>=e.range.endColumn}}const dQ={type:1,filter:{include:Kt.QuickFix},triggerAction:yo.QuickFixHover};let s7=class{constructor(e,t,i,n){this._editor=e,this._markerDecorationsService=t,this._openerService=i,this._languageFeaturesService=n,this.hoverOrdinal=1,this.recentMarkerCodeActionsInfo=void 0}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1&&!e.supportsMarkerHover)return[];const i=this._editor.getModel(),n=e.range;if(!i.isValidRange(e.range))return[];const s=n.startLineNumber,r=i.getLineMaxColumn(s),a=[];for(const l of t){const c=l.range.startLineNumber===s?l.range.startColumn:1,d=l.range.endLineNumber===s?l.range.endColumn:r,h=this._markerDecorationsService.getMarker(i.uri,l);if(!h)continue;const u=new k(e.range.startLineNumber,c,e.range.startLineNumber,d);a.push(new zEe(this,u,h))}return a}renderHoverParts(e,t){if(!t.length)return new Mg([]);const i=[];t.forEach(r=>{const a=this._renderMarkerHover(r);e.fragment.appendChild(a.hoverElement),i.push(a)});const n=t.length===1?t[0]:t.sort((r,a)=>oi.compare(r.marker.severity,a.marker.severity))[0],s=this._renderMarkerStatusbar(e,n);return new Mg(i,s)}_renderMarkerHover(e){const t=new U,i=da("div.hover-row"),n=Z(i,da("div.marker.hover-contents")),{source:s,message:r,code:a,relatedInformation:l}=e.marker;this._editor.applyFontInfo(n);const c=Z(n,da("span"));if(c.style.whiteSpace="pre-wrap",c.innerText=r,s||a)if(a&&typeof a!="string"){const h=da("span");if(s){const m=Z(h,da("span"));m.innerText=s}const u=Z(h,da("a.code-link"));u.setAttribute("href",a.target.toString(!0)),t.add(W(u,"click",m=>{this._openerService.open(a.target,{allowCommands:!0}),m.preventDefault(),m.stopPropagation()}));const f=Z(u,da("span"));f.innerText=a.value;const g=Z(n,h);g.style.opacity="0.6",g.style.paddingLeft="6px"}else{const h=Z(n,da("span"));h.style.opacity="0.6",h.style.paddingLeft="6px",h.innerText=s&&a?`${s}(${a})`:s||`(${a})`}if(is(l))for(const{message:h,resource:u,startLineNumber:f,startColumn:g}of l){const m=Z(n,da("div"));m.style.marginTop="8px";const _=Z(m,da("a"));_.innerText=`${vr(u)}(${f}, ${g}): `,_.style.cursor="pointer",t.add(W(_,"click",C=>{if(C.stopPropagation(),C.preventDefault(),this._openerService){const w={selection:{startLineNumber:f,startColumn:g}};this._openerService.open(u,{fromUserGesture:!0,editorOptions:w}).catch(Ee)}}));const b=Z(m,da("span"));b.innerText=h,this._editor.applyFontInfo(b)}return{hoverPart:e,hoverElement:i,dispose:()=>t.dispose()}}_renderMarkerStatusbar(e,t){const i=new U;if(t.marker.severity===oi.Error||t.marker.severity===oi.Warning||t.marker.severity===oi.Info){const n=Jg.get(this._editor);n&&e.statusBar.addAction({label:p(1132,"View Problem"),commandId:MD.ID,run:()=>{e.hide(),n.showAtMarker(t.marker),this._editor.focus()}})}if(!this._editor.getOption(104)){const n=e.statusBar.append(da("div"));this.recentMarkerCodeActionsInfo&&(Hk.makeKey(this.recentMarkerCodeActionsInfo.marker)===Hk.makeKey(t.marker)?this.recentMarkerCodeActionsInfo.hasCodeActions||(n.textContent=p(1133,"No quick fixes available")):this.recentMarkerCodeActionsInfo=void 0);const s=this.recentMarkerCodeActionsInfo&&!this.recentMarkerCodeActionsInfo.hasCodeActions?A.None:yc(()=>n.textContent=p(1134,"Checking for quick fixes..."),200,i);n.textContent||(n.textContent=" ");const r=this.getCodeActions(t.marker);i.add(ue(()=>r.cancel())),r.then(a=>{if(s.dispose(),this.recentMarkerCodeActionsInfo={marker:t.marker,hasCodeActions:a.validActions.length>0},!this.recentMarkerCodeActionsInfo.hasCodeActions){a.dispose(),n.textContent=p(1135,"No quick fixes available");return}n.style.display="none";let l=!1;i.add(ue(()=>{l||a.dispose()})),e.statusBar.addAction({label:p(1136,"Quick Fix..."),commandId:m4,run:d=>{l=!0;const h=Tg.get(this._editor),u=mi(d);e.hide(),h?.showCodeActions(dQ,a,{x:u.left,y:u.top,width:u.width,height:u.height})}});const c=a.validActions.find(d=>d.action.isAI);c&&e.statusBar.addAction({label:c.action.title,commandId:c.action.command?.id??"",iconClass:ve.asClassName(Y.sparkle),run:()=>{Tg.get(this._editor)?.applyCodeAction(c,!1,!1,Kh.FromProblemsHover)}}),e.onContentsChanged()},Ee)}return i}getCodeActions(e){return Vi(t=>ob(this._languageFeaturesService.codeActionProvider,this._editor.getModel(),new k(e.startLineNumber,e.startColumn,e.endLineNumber,e.endColumn),dQ,Pa.None,t))}};s7=VEe([n7(1,j2),n7(2,Js),n7(3,he)],s7);class UEe{constructor(e){this._editor=e}computeSync(e){const t=r=>({value:r}),i=this._editor.getLineDecorations(e.lineNumber),n=[],s=e.laneOrLine==="lineNo";if(!i)return n;for(const r of i){const a=r.options.glyphMargin?.position??xa.Center;if(!s&&a!==e.laneOrLine)continue;const l=s?r.options.lineNumberHoverMessage:r.options.glyphMarginHoverMessage;!l||B_(l)||n.push(...zR(l).map(t))}return n}}var $Ee=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},hQ=function(o,e){return function(t,i){e(t,i,o)}},o7;const uQ=Q;let r7=(lm=class extends A{constructor(e,t,i){super(),this._renderDisposeables=this._register(new U),this._editor=e,this._isVisible=!1,this._messages=[],this._hover=this._register(new H4(!0)),this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible),this._markdownRenderer=new fd({editor:this._editor},t,i),this._hoverOperation=this._register(new EG(this._editor,new UEe(this._editor))),this._register(this._hoverOperation.onResult(n=>this._withResult(n))),this._register(this._editor.onDidChangeModelDecorations(()=>this._onModelDecorationsChanged())),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(59)&&this._updateFont()})),this._register(Si(this._hover.containerDomNode,"mouseleave",n=>{this._onMouseLeave(n)})),this._editor.addOverlayWidget(this)}dispose(){this._hoverComputerOptions=void 0,this._editor.removeOverlayWidget(this),super.dispose()}getId(){return o7.ID}getDomNode(){return this._hover.containerDomNode}getPosition(){return null}_updateFont(){Array.prototype.slice.call(this._hover.contentsDomNode.getElementsByClassName("code")).forEach(t=>this._editor.applyFontInfo(t))}_onModelDecorationsChanged(){this._isVisible&&this._hoverComputerOptions&&(this._hoverOperation.cancel(),this._hoverOperation.start(0,this._hoverComputerOptions))}showsOrWillShow(e){const t=e.target;return t.type===2&&t.detail.glyphMarginLane?(this._startShowingAt(t.position.lineNumber,t.detail.glyphMarginLane),!0):t.type===3?(this._startShowingAt(t.position.lineNumber,"lineNo"),!0):!1}_startShowingAt(e,t){this._hoverComputerOptions&&this._hoverComputerOptions.lineNumber===e&&this._hoverComputerOptions.laneOrLine===t||(this._hoverOperation.cancel(),this.hide(),this._hoverComputerOptions={lineNumber:e,laneOrLine:t},this._hoverOperation.start(0,this._hoverComputerOptions))}hide(){this._hoverComputerOptions=void 0,this._hoverOperation.cancel(),this._isVisible&&(this._isVisible=!1,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible))}_withResult(e){this._messages=e.value,this._messages.length>0?this._renderMessages(e.options.lineNumber,e.options.laneOrLine,this._messages):this.hide()}_renderMessages(e,t,i){this._renderDisposeables.clear();const n=document.createDocumentFragment();for(const s of i){const r=uQ("div.hover-row.markdown-hover"),a=Z(r,uQ("div.hover-contents")),l=this._renderDisposeables.add(this._markdownRenderer.render(s.value));a.appendChild(l.element),n.appendChild(r)}this._updateContents(n),this._showAt(e,t)}_updateContents(e){this._hover.contentsDomNode.textContent="",this._hover.contentsDomNode.appendChild(e),this._updateFont()}_showAt(e,t){this._isVisible||(this._isVisible=!0,this._hover.containerDomNode.classList.toggle("hidden",!this._isVisible));const i=this._editor.getLayoutInfo(),n=this._editor.getTopForLineNumber(e),s=this._editor.getScrollTop(),r=this._editor.getOption(75),a=this._hover.containerDomNode.clientHeight,l=n-s-(a-r)/2,c=i.glyphMarginLeft+i.glyphMarginWidth+(t==="lineNo"?i.lineNumbersWidth:0);this._hover.containerDomNode.style.left=`${c}px`,this._hover.containerDomNode.style.top=`${Math.max(Math.round(l),0)}px`,this._hover.containerDomNode.style.zIndex="11"}_onMouseLeave(e){const t=this._editor.getDomNode();(!t||!$k(t,e.x,e.y))&&this.hide()}},o7=lm,lm.ID="editor.contrib.modesGlyphHoverWidget",lm);r7=o7=$Ee([hQ(1,Mt),hQ(2,Js)],r7);var jEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},qEe=function(o,e){return function(t,i){e(t,i,o)}};let PD=(RC=class extends A{constructor(e,t){super(),this._editor=e,this._instantiationService=t,this.shouldKeepOpenOnEditorMouseMoveOrLeave=!1,this._listenersStore=new U,this._hoverState={mouseDown:!1},this._reactToEditorMouseMoveRunner=this._register(new wt(()=>this._reactToEditorMouseMove(this._mouseMoveEvent),0)),this._hookListeners(),this._register(this._editor.onDidChangeConfiguration(i=>{i.hasChanged(69)&&(this._unhookListeners(),this._hookListeners())}))}_hookListeners(){const e=this._editor.getOption(69);this._hoverSettings={enabled:e.enabled,sticky:e.sticky,hidingDelay:e.hidingDelay},e.enabled?(this._listenersStore.add(this._editor.onMouseDown(t=>this._onEditorMouseDown(t))),this._listenersStore.add(this._editor.onMouseUp(()=>this._onEditorMouseUp())),this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))):(this._listenersStore.add(this._editor.onMouseMove(t=>this._onEditorMouseMove(t))),this._listenersStore.add(this._editor.onKeyDown(t=>this._onKeyDown(t)))),this._listenersStore.add(this._editor.onMouseLeave(t=>this._onEditorMouseLeave(t))),this._listenersStore.add(this._editor.onDidChangeModel(()=>{this._cancelScheduler(),this.hideGlyphHover()})),this._listenersStore.add(this._editor.onDidChangeModelContent(()=>this._cancelScheduler())),this._listenersStore.add(this._editor.onDidScrollChange(t=>this._onEditorScrollChanged(t)))}_unhookListeners(){this._listenersStore.clear()}_cancelScheduler(){this._mouseMoveEvent=void 0,this._reactToEditorMouseMoveRunner.cancel()}_onEditorScrollChanged(e){(e.scrollTopChanged||e.scrollLeftChanged)&&this.hideGlyphHover()}_onEditorMouseDown(e){this._hoverState.mouseDown=!0,!this._isMouseOnGlyphHoverWidget(e)&&this.hideGlyphHover()}_isMouseOnGlyphHoverWidget(e){const t=this._glyphWidget?.getDomNode();return t?$k(t,e.event.posx,e.event.posy):!1}_onEditorMouseUp(){this._hoverState.mouseDown=!1}_onEditorMouseLeave(e){this.shouldKeepOpenOnEditorMouseMoveOrLeave||(this._cancelScheduler(),this._isMouseOnGlyphHoverWidget(e))||this.hideGlyphHover()}_shouldNotRecomputeCurrentHoverWidget(e){const t=this._hoverSettings.sticky,i=this._isMouseOnGlyphHoverWidget(e);return t&&i}_onEditorMouseMove(e){if(this.shouldKeepOpenOnEditorMouseMoveOrLeave)return;if(this._mouseMoveEvent=e,this._shouldNotRecomputeCurrentHoverWidget(e)){this._reactToEditorMouseMoveRunner.cancel();return}this._reactToEditorMouseMove(e)}_reactToEditorMouseMove(e){!e||this._tryShowHoverWidget(e)||this.hideGlyphHover()}_tryShowHoverWidget(e){return this._getOrCreateGlyphWidget().showsOrWillShow(e)}_onKeyDown(e){this._editor.hasModel()&&(e.keyCode===5||e.keyCode===6||e.keyCode===57||e.keyCode===4||this.hideGlyphHover())}hideGlyphHover(){this._glyphWidget?.hide()}_getOrCreateGlyphWidget(){return this._glyphWidget||(this._glyphWidget=this._instantiationService.createInstance(r7,this._editor)),this._glyphWidget}dispose(){super.dispose(),this._unhookListeners(),this._listenersStore.dispose(),this._glyphWidget?.dispose()}},RC.ID="editor.contrib.marginHover",RC);PD=jEe([qEe(1,ge)],PD);class KEe{}class GEe{}class ZEe{}Qe(Yn.ID,Yn,2),Qe(PD.ID,PD,2),ne(DEe),ne(EEe),ne(NEe),ne(TEe),ne(REe),ne(MEe),ne(PEe),ne(AEe),ne(OEe),ne(FEe),ne(WEe),ne(BEe),ne(HEe),Pg.register(Fw),Pg.register(s7),Nr((o,e)=>{const t=o.getColor(nM);t&&(e.addRule(`.monaco-editor .monaco-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-editor .monaco-hover hr { border-bottom: 0px solid ${t.transparent(.5)}; }`))}),YI.register(new KEe),YI.register(new GEe),YI.register(new ZEe);function xo(o,e){let t=0;for(let i=0;i<o.length;i++)o.charAt(i)===" "?t+=e:t++;return t}function O0(o,e,t){o=o<0?0:o;let i="";if(!t){const n=Math.floor(o/e);o=o%e;for(let s=0;s<n;s++)i+=" "}for(let n=0;n<o;n++)i+=" ";return i}function fQ(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return[];const n=e.getLanguageConfiguration(o.getLanguageId()).indentRulesSupport;if(!n)return[];const s=new O2(o,n,e);for(i=Math.min(i,o.getLineCount());t<=i&&s.shouldIgnore(t);)t++;if(t>i-1)return[];const{tabSize:r,indentSize:a,insertSpaces:l}=o.getOptions(),c=(m,_)=>(_=_||1,Lr.shiftIndent(m,m.length+_,r,a,l)),d=(m,_)=>(_=_||1,Lr.unshiftIndent(m,m.length+_,r,a,l)),h=[],u=o.getLineContent(t);let f=It(u),g=f;s.shouldIncrease(t)?(g=c(g),f=c(f)):s.shouldIndentNextLine(t)&&(g=c(g)),t++;for(let m=t;m<=i;m++){if(YEe(o,m))continue;const _=o.getLineContent(m),b=It(_),C=g;s.shouldDecrease(m,C)&&(g=d(g),f=d(f)),b!==g&&h.push(fi.replaceMove(new ce(m,1,m,b.length+1),g2(g,a,l))),!s.shouldIgnore(m)&&(s.shouldIncrease(m,C)?(f=c(f),g=f):s.shouldIndentNextLine(m,C)?g=c(g):g=f)}return h}function YEe(o,e){return o.tokenization.isCheapToTokenize(e)?o.tokenization.getLineTokens(e).getStandardTokenType(0)===2:!1}var XEe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},QEe=function(o,e){return function(t,i){e(t,i,o)}};const JN=class JN extends le{constructor(){super({id:JN.ID,label:H(1141,"Convert Indentation to Spaces"),precondition:T.writable,metadata:{description:H(1142,"Convert the tab indentation to spaces.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new nNe(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!0})}};JN.ID="editor.action.indentationToSpaces";let a7=JN;const eT=class eT extends le{constructor(){super({id:eT.ID,label:H(1143,"Convert Indentation to Tabs"),precondition:T.writable,metadata:{description:H(1144,"Convert the spaces indentation to tabs.")}})}run(e,t){const i=t.getModel();if(!i)return;const n=i.getOptions(),s=t.getSelection();if(!s)return;const r=new sNe(s,n.tabSize);t.pushUndoStop(),t.executeCommands(this.id,[r]),t.pushUndoStop(),i.updateOptions({insertSpaces:!1})}};eT.ID="editor.action.indentationToTabs";let l7=eT;class c7 extends le{constructor(e,t,i){super(i),this.insertSpaces=e,this.displaySizeOnly=t}run(e,t){const i=e.get(Zn),n=e.get(Qt),s=t.getModel();if(!s)return;const r=n.getCreationOptions(s.getLanguageId(),s.uri,s.isForSimpleWidget),a=s.getOptions(),l=[1,2,3,4,5,6,7,8].map(d=>({id:d.toString(),label:d.toString(),description:d===r.tabSize&&d===a.tabSize?p(1137,"Configured Tab Size"):d===r.tabSize?p(1138,"Default Tab Size"):d===a.tabSize?p(1139,"Current Tab Size"):void 0})),c=Math.min(s.getOptions().tabSize-1,7);setTimeout(()=>{i.pick(l,{placeHolder:p(1140,"Select Tab Size for Current File"),activeItem:l[c]}).then(d=>{if(d&&s&&!s.isDisposed()){const h=parseInt(d.label,10);this.displaySizeOnly?s.updateOptions({tabSize:h}):s.updateOptions({tabSize:h,indentSize:h,insertSpaces:this.insertSpaces})}})},50)}}const tT=class tT extends c7{constructor(){super(!1,!1,{id:tT.ID,label:H(1145,"Indent Using Tabs"),precondition:void 0,metadata:{description:H(1146,"Use indentation with tabs.")}})}};tT.ID="editor.action.indentUsingTabs";let d7=tT;const iT=class iT extends c7{constructor(){super(!0,!1,{id:iT.ID,label:H(1147,"Indent Using Spaces"),precondition:void 0,metadata:{description:H(1148,"Use indentation with spaces.")}})}};iT.ID="editor.action.indentUsingSpaces";let h7=iT;const nT=class nT extends c7{constructor(){super(!0,!0,{id:nT.ID,label:H(1149,"Change Tab Display Size"),precondition:void 0,metadata:{description:H(1150,"Change the space size equivalent of the tab.")}})}};nT.ID="editor.action.changeTabDisplaySize";let u7=nT;const sT=class sT extends le{constructor(){super({id:sT.ID,label:H(1151,"Detect Indentation from Content"),precondition:void 0,metadata:{description:H(1152,"Detect the indentation from content.")}})}run(e,t){const i=e.get(Qt),n=t.getModel();if(!n)return;const s=i.getCreationOptions(n.getLanguageId(),n.uri,n.isForSimpleWidget);n.detectIndentation(s.insertSpaces,s.tabSize)}};sT.ID="editor.action.detectIndentation";let f7=sT;class JEe extends le{constructor(){super({id:"editor.action.reindentlines",label:H(1153,"Reindent Lines"),precondition:T.writable,metadata:{description:H(1154,"Reindent the lines of the editor.")}})}run(e,t){const i=e.get(Jt),n=t.getModel();if(!n)return;const s=fQ(n,i,1,n.getLineCount());s.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,s),t.pushUndoStop())}}class eNe extends le{constructor(){super({id:"editor.action.reindentselectedlines",label:H(1155,"Reindent Selected Lines"),precondition:T.writable,metadata:{description:H(1156,"Reindent the selected lines of the editor.")}})}run(e,t){const i=e.get(Jt),n=t.getModel();if(!n)return;const s=t.getSelections();if(s===null)return;const r=[];for(const a of s){let l=a.startLineNumber,c=a.endLineNumber;if(l!==c&&a.endColumn===1&&c--,l===1){if(l===c)continue}else l--;const d=fQ(n,i,l,c);r.push(...d)}r.length>0&&(t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop())}}class tNe{constructor(e,t){this._initialSelection=t,this._edits=[],this._selectionId=null;for(const i of e)i.range&&typeof i.text=="string"&&this._edits.push(i)}getEditOperations(e,t){for(const n of this._edits)t.addEditOperation(k.lift(n.range),n.text);let i=!1;Array.isArray(this._edits)&&this._edits.length===1&&this._initialSelection.isEmpty()&&(this._edits[0].range.startColumn===this._initialSelection.endColumn&&this._edits[0].range.startLineNumber===this._initialSelection.endLineNumber?(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!0)):this._edits[0].range.endColumn===this._initialSelection.startColumn&&this._edits[0].range.endLineNumber===this._initialSelection.startLineNumber&&(i=!0,this._selectionId=t.trackSelection(this._initialSelection,!1))),i||(this._selectionId=t.trackSelection(this._initialSelection))}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}let AD=(MC=class{constructor(e,t){this.editor=e,this._languageConfigurationService=t,this.callOnDispose=new U,this.callOnModel=new U,this.callOnDispose.add(e.onDidChangeConfiguration(()=>this.update())),this.callOnDispose.add(e.onDidChangeModel(()=>this.update())),this.callOnDispose.add(e.onDidChangeModelLanguage(()=>this.update()))}update(){this.callOnModel.clear(),!(!this.editor.getOption(17)||this.editor.getOption(16)<4)&&this.editor.hasModel()&&this.callOnModel.add(this.editor.onDidPaste(({range:e})=>{this.trigger(e)}))}trigger(e){const t=this.editor.getSelections();if(t===null||t.length>1)return;const i=this.editor.getModel();if(!i||this.rangeContainsOnlyWhitespaceCharacters(i,e)||!this.editor.getOption(18)&&iNe(i,e)||!i.tokenization.isCheapToTokenize(e.getStartPosition().lineNumber))return;const s=this.editor.getOption(16),{tabSize:r,indentSize:a,insertSpaces:l}=i.getOptions(),c=[],d={shiftIndent:g=>Lr.shiftIndent(g,g.length+1,r,a,l),unshiftIndent:g=>Lr.unshiftIndent(g,g.length+1,r,a,l)};let h=e.startLineNumber,u=i.getLineContent(h);if(!/\S/.test(u.substring(0,e.startColumn-1))){const g=P1(s,i,i.getLanguageId(),h,d,this._languageConfigurationService);if(g!==null){const m=It(u),_=xo(g,r),b=xo(m,r);if(_!==b){const C=O0(_,r,l);c.push({range:new k(h,1,h,m.length+1),text:C}),u=C+u.substring(m.length)}else{const C=mV(i,h,this._languageConfigurationService);if(C===0||C===8)return}}}const f=h;for(;h<e.endLineNumber;){if(!/\S/.test(i.getLineContent(h+1))){h++;continue}break}if(h!==e.endLineNumber){const m=P1(s,{tokenization:{getLineTokens:_=>i.tokenization.getLineTokens(_),getLanguageId:()=>i.getLanguageId(),getLanguageIdAtPosition:(_,b)=>i.getLanguageIdAtPosition(_,b)},getLineContent:_=>_===f?u:i.getLineContent(_)},i.getLanguageId(),h+1,d,this._languageConfigurationService);if(m!==null){const _=xo(m,r),b=xo(It(i.getLineContent(h+1)),r);if(_!==b){const C=_-b;for(let w=h+1;w<=e.endLineNumber;w++){const v=i.getLineContent(w),S=It(v),x=xo(S,r)+C,I=O0(x,r,l);I!==S&&c.push({range:new k(w,1,w,S.length+1),text:I})}}}}if(c.length>0){this.editor.pushUndoStop();const g=new tNe(c,this.editor.getSelection());this.editor.executeCommand("autoIndentOnPaste",g),this.editor.pushUndoStop()}}rangeContainsOnlyWhitespaceCharacters(e,t){const i=s=>s.trim().length===0;let n=!0;if(t.startLineNumber===t.endLineNumber){const r=e.getLineContent(t.startLineNumber).substring(t.startColumn-1,t.endColumn-1);n=i(r)}else for(let s=t.startLineNumber;s<=t.endLineNumber;s++){const r=e.getLineContent(s);if(s===t.startLineNumber){const a=r.substring(t.startColumn-1);n=i(a)}else if(s===t.endLineNumber){const a=r.substring(0,t.endColumn-1);n=i(a)}else n=e.getLineFirstNonWhitespaceColumn(s)===0;if(!n)break}return n}dispose(){this.callOnDispose.dispose(),this.callOnModel.dispose()}},MC.ID="editor.contrib.autoIndentOnPaste",MC);AD=XEe([QEe(1,Jt)],AD);function iNe(o,e){const t=i=>tre(o,i)===2;return t(e.getStartPosition())||t(e.getEndPosition())}function gQ(o,e,t,i){if(o.getLineCount()===1&&o.getLineMaxColumn(1)===1)return;let n="";for(let r=0;r<t;r++)n+=" ";const s=new RegExp(n,"gi");for(let r=1,a=o.getLineCount();r<=a;r++){let l=o.getLineFirstNonWhitespaceColumn(r);if(l===0&&(l=o.getLineMaxColumn(r)),l===1)continue;const c=new k(r,1,r,l),d=o.getValueInRange(c),h=i?d.replace(/\t/ig,n):d.replace(s," ");e.addEditOperation(c,h)}}class nNe{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),gQ(e,t,this.tabSize,!0)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}class sNe{constructor(e,t){this.selection=e,this.tabSize=t,this.selectionId=null}getEditOperations(e,t){this.selectionId=t.trackSelection(this.selection),gQ(e,t,this.tabSize,!1)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}}Qe(AD.ID,AD,2),ne(a7),ne(l7),ne(d7),ne(h7),ne(u7),ne(f7),ne(JEe),ne(eNe),Qe(Qw.ID,Qw,1),Pg.register(TI);class oNe{constructor(e,t,i){this._editRange=e,this._originalSelection=t,this._text=i}getEditOperations(e,t){t.addTrackedEditOperation(this._editRange,this._text)}computeCursorState(e,t){const n=t.getInverseEditOperations()[0].range;return this._originalSelection.isEmpty()?new ce(n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn),n.endLineNumber,Math.min(this._originalSelection.positionColumn,n.endColumn)):new ce(n.endLineNumber,n.endColumn-this._text.length,n.endLineNumber,n.endColumn)}}var rNe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aNe=function(o,e){return function(t,i){e(t,i,o)}},OD;let Vb=(Bu=class{static get(e){return e.getContribution(OD.ID)}constructor(e,t){this.editor=e,this.editorWorkerService=t,this.decorations=this.editor.createDecorationsCollection()}dispose(){}run(e,t){this.currentRequest?.cancel();const i=this.editor.getSelection(),n=this.editor.getModel();if(!n||!i)return;let s=i;if(s.startLineNumber!==s.endLineNumber)return;const r=new TK(this.editor,5),a=n.uri;return this.editorWorkerService.canNavigateValueSet(a)?(this.currentRequest=Vi(l=>this.editorWorkerService.navigateValueSet(a,s,t)),this.currentRequest.then(l=>{if(!l||!l.range||!l.value||!r.validate(this.editor))return;const c=k.lift(l.range);let d=l.range;const h=l.value.length-(s.endColumn-s.startColumn);d={startLineNumber:d.startLineNumber,startColumn:d.startColumn,endLineNumber:d.endLineNumber,endColumn:d.startColumn+l.value.length},h>1&&(s=new ce(s.startLineNumber,s.startColumn,s.endLineNumber,s.endColumn+h-1));const u=new oNe(c,s,l.value);this.editor.pushUndoStop(),this.editor.executeCommand(e,u),this.editor.pushUndoStop(),this.decorations.set([{range:d,options:OD.DECORATION}]),this.decorationRemover?.cancel(),this.decorationRemover=al(350),this.decorationRemover.then(()=>this.decorations.clear()).catch(Ee)}).catch(Ee)):Promise.resolve(void 0)}},OD=Bu,Bu.ID="editor.contrib.inPlaceReplaceController",Bu.DECORATION=Te.register({description:"in-place-replace",className:"valueSetReplacement"}),Bu);Vb=OD=rNe([aNe(1,Xs)],Vb);class lNe extends le{constructor(){super({id:"editor.action.inPlaceReplace.up",label:H(1230,"Replace with Previous Value"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3159,weight:100}})}run(e,t){const i=Vb.get(t);return i?i.run(this.id,!1):Promise.resolve(void 0)}}class cNe extends le{constructor(){super({id:"editor.action.inPlaceReplace.down",label:H(1231,"Replace with Next Value"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3161,weight:100}})}run(e,t){const i=Vb.get(t);return i?i.run(this.id,!0):Promise.resolve(void 0)}}Qe(Vb.ID,Vb,4),ne(lNe),ne(cNe);class dNe{constructor(e){this._selection=e,this._selectionId=null}getEditOperations(e,t){const i=hNe(e);i&&t.addEditOperation(i.range,i.text),this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function hNe(o){const e=o.getLineCount(),t=o.getLineContent(e),i=Kr(t)===-1;if(!(!e||i))return fi.insert(new M(e,o.getLineMaxColumn(e)),o.getEOL())}const oT=class oT extends le{constructor(){super({id:oT.ID,label:H(1232,"Insert Final New Line"),precondition:T.writable})}run(e,t,i){const n=t.getSelection();if(n===null)return;const s=new dNe(n);t.pushUndoStop(),t.executeCommands(this.id,[s]),t.pushUndoStop()}};oT.ID="editor.action.insertFinalNewLine";let g7=oT;ne(g7);class uNe extends le{constructor(){super({id:"expandLineSelection",label:H(1233,"Expand Line Selection"),precondition:void 0,kbOpts:{weight:0,kbExpr:T.textInputFocus,primary:2090}})}run(e,t,i){if(i=i||{},!t.hasModel())return;const n=t._getViewModel();n.model.pushStackElement(),n.setCursorStates(i.source,3,_n.expandLineSelection(n,n.getCursorStates())),n.revealAllCursors(i.source,!0)}}ne(uNe);class fNe{constructor(e,t,i){this._selection=e,this._cursors=t,this._selectionId=null,this._trimInRegexesAndStrings=i}getEditOperations(e,t){const i=gNe(e,this._cursors,this._trimInRegexesAndStrings);for(let n=0,s=i.length;n<s;n++){const r=i[n];t.addEditOperation(r.range,r.text)}this._selectionId=t.trackSelection(this._selection)}computeCursorState(e,t){return t.getTrackedSelection(this._selectionId)}}function gNe(o,e,t){e.sort((a,l)=>a.lineNumber===l.lineNumber?a.column-l.column:a.lineNumber-l.lineNumber);for(let a=e.length-2;a>=0;a--)e[a].lineNumber===e[a+1].lineNumber&&e.splice(a,1);const i=[];let n=0,s=0;const r=e.length;for(let a=1,l=o.getLineCount();a<=l;a++){const c=o.getLineContent(a),d=c.length+1;let h=0;if(s<r&&e[s].lineNumber===a&&(h=e[s].column,s++,h===d)||c.length===0)continue;const u=Kr(c);let f=0;if(u===-1)f=1;else if(u!==c.length-1)f=u+2;else continue;if(!t){if(!o.tokenization.hasAccurateTokensForLine(a))continue;const g=o.tokenization.getLineTokens(a),m=g.getStandardTokenType(g.findTokenIndexAtOffset(f));if(m===2||m===3)continue}f=Math.max(h,f),i[n++]=fi.delete(new k(a,f,a,d))}return i}class pQ{constructor(e,t,i){this._selection=e,this._isCopyingDown=t,this._noop=i||!1,this._selectionDirection=0,this._selectionId=null,this._startLineNumberDelta=0,this._endLineNumberDelta=0}getEditOperations(e,t){let i=this._selection;this._startLineNumberDelta=0,this._endLineNumberDelta=0,i.startLineNumber<i.endLineNumber&&i.endColumn===1&&(this._endLineNumberDelta=1,i=i.setEndPosition(i.endLineNumber-1,e.getLineMaxColumn(i.endLineNumber-1)));const n=[];for(let r=i.startLineNumber;r<=i.endLineNumber;r++)n.push(e.getLineContent(r));const s=n.join(`
`);s===""&&this._isCopyingDown&&(this._startLineNumberDelta++,this._endLineNumberDelta++),this._noop?t.addEditOperation(new k(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber+1,1),i.endLineNumber===e.getLineCount()?"":`
`):this._isCopyingDown?t.addEditOperation(new k(i.startLineNumber,1,i.startLineNumber,1),s+`
`):t.addEditOperation(new k(i.endLineNumber,e.getLineMaxColumn(i.endLineNumber),i.endLineNumber,e.getLineMaxColumn(i.endLineNumber)),`
`+s),this._selectionId=t.trackSelection(i),this._selectionDirection=this._selection.getDirection()}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);if(this._startLineNumberDelta!==0||this._endLineNumberDelta!==0){let n=i.startLineNumber,s=i.startColumn,r=i.endLineNumber,a=i.endColumn;this._startLineNumberDelta!==0&&(n=n+this._startLineNumberDelta,s=1),this._endLineNumberDelta!==0&&(r=r+this._endLineNumberDelta,a=1),i=ce.createWithDirection(n,s,r,a,this._selectionDirection)}return i}}var pNe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mNe=function(o,e){return function(t,i){e(t,i,o)}};let p7=class{constructor(e,t,i,n){this._languageConfigurationService=n,this._selection=e,this._isMovingDown=t,this._autoIndent=i,this._selectionId=null,this._moveEndLineSelectionShrink=!1}getEditOperations(e,t){const i=()=>e.getLanguageId(),n=(h,u)=>e.getLanguageIdAtPosition(h,u),s=e.getLineCount();if(this._isMovingDown&&this._selection.endLineNumber===s){this._selectionId=t.trackSelection(this._selection);return}if(!this._isMovingDown&&this._selection.startLineNumber===1){this._selectionId=t.trackSelection(this._selection);return}this._moveEndPositionDown=!1;let r=this._selection;r.startLineNumber<r.endLineNumber&&r.endColumn===1&&(this._moveEndPositionDown=!0,r=r.setEndPosition(r.endLineNumber-1,e.getLineMaxColumn(r.endLineNumber-1)));const{tabSize:a,indentSize:l,insertSpaces:c}=e.getOptions(),d=this.buildIndentConverter(a,l,c);if(r.startLineNumber===r.endLineNumber&&e.getLineMaxColumn(r.startLineNumber)===1){const h=r.startLineNumber,u=this._isMovingDown?h+1:h-1;e.getLineMaxColumn(u)===1?t.addEditOperation(new k(1,1,1,1),null):(t.addEditOperation(new k(h,1,h,1),e.getLineContent(u)),t.addEditOperation(new k(u,1,u,e.getLineMaxColumn(u)),null)),r=new ce(u,1,u,1)}else{let h,u;if(this._isMovingDown){h=r.endLineNumber+1,u=e.getLineContent(h),t.addEditOperation(new k(h-1,e.getLineMaxColumn(h-1),h,e.getLineMaxColumn(h)),null);let f=u;if(this.shouldAutoIndent(e,r)){const g=this.matchEnterRule(e,d,a,h,r.startLineNumber-1);if(g!==null){const _=It(e.getLineContent(h)),b=g+xo(_,a);f=O0(b,a,c)+this.trimStart(u)}else{const _={tokenization:{getLineTokens:C=>C===r.startLineNumber?e.tokenization.getLineTokens(h):e.tokenization.getLineTokens(C),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:C=>C===r.startLineNumber?e.getLineContent(h):e.getLineContent(C)},b=P1(this._autoIndent,_,e.getLanguageIdAtPosition(h,1),r.startLineNumber,d,this._languageConfigurationService);if(b!==null){const C=It(e.getLineContent(h)),w=xo(b,a),v=xo(C,a);w!==v&&(f=O0(w,a,c)+this.trimStart(u))}}t.addEditOperation(new k(r.startLineNumber,1,r.startLineNumber,1),f+`
`);const m=this.matchEnterRuleMovingDown(e,d,a,r.startLineNumber,h,f);if(m!==null)m!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,c,m);else{const _={tokenization:{getLineTokens:C=>C===r.startLineNumber?e.tokenization.getLineTokens(h):C>=r.startLineNumber+1&&C<=r.endLineNumber+1?e.tokenization.getLineTokens(C-1):e.tokenization.getLineTokens(C),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:C=>C===r.startLineNumber?f:C>=r.startLineNumber+1&&C<=r.endLineNumber+1?e.getLineContent(C-1):e.getLineContent(C)},b=P1(this._autoIndent,_,e.getLanguageIdAtPosition(h,1),r.startLineNumber+1,d,this._languageConfigurationService);if(b!==null){const C=It(e.getLineContent(r.startLineNumber)),w=xo(b,a),v=xo(C,a);if(w!==v){const S=w-v;this.getIndentEditsOfMovingBlock(e,t,r,a,c,S)}}}}else t.addEditOperation(new k(r.startLineNumber,1,r.startLineNumber,1),f+`
`)}else if(h=r.startLineNumber-1,u=e.getLineContent(h),t.addEditOperation(new k(h,1,h+1,1),null),t.addEditOperation(new k(r.endLineNumber,e.getLineMaxColumn(r.endLineNumber),r.endLineNumber,e.getLineMaxColumn(r.endLineNumber)),`
`+u),this.shouldAutoIndent(e,r)){const f={tokenization:{getLineTokens:m=>m===h?e.tokenization.getLineTokens(r.startLineNumber):e.tokenization.getLineTokens(m),getLanguageId:i,getLanguageIdAtPosition:n},getLineContent:m=>m===h?e.getLineContent(r.startLineNumber):e.getLineContent(m)},g=this.matchEnterRule(e,d,a,r.startLineNumber,r.startLineNumber-2);if(g!==null)g!==0&&this.getIndentEditsOfMovingBlock(e,t,r,a,c,g);else{const m=P1(this._autoIndent,f,e.getLanguageIdAtPosition(r.startLineNumber,1),h,d,this._languageConfigurationService);if(m!==null){const _=It(e.getLineContent(r.startLineNumber)),b=xo(m,a),C=xo(_,a);if(b!==C){const w=b-C;this.getIndentEditsOfMovingBlock(e,t,r,a,c,w)}}}}}this._selectionId=t.trackSelection(r)}buildIndentConverter(e,t,i){return{shiftIndent:n=>Lr.shiftIndent(n,n.length+1,e,t,i),unshiftIndent:n=>Lr.unshiftIndent(n,n.length+1,e,t,i)}}parseEnterResult(e,t,i,n,s){if(s){let r=s.indentation;s.indentAction===Ai.None||s.indentAction===Ai.Indent?r=s.indentation+s.appendText:s.indentAction===Ai.IndentOutdent?r=s.indentation:s.indentAction===Ai.Outdent&&(r=t.unshiftIndent(s.indentation)+s.appendText);const a=e.getLineContent(n);if(this.trimStart(a).indexOf(this.trimStart(r))>=0){const l=It(e.getLineContent(n));let c=It(r);const d=mV(e,n,this._languageConfigurationService);d!==null&&d&2&&(c=t.unshiftIndent(c));const h=xo(c,i),u=xo(l,i);return h-u}}return null}matchEnterRuleMovingDown(e,t,i,n,s,r){if(Kr(r)>=0){const a=e.getLineMaxColumn(s),l=Ym(this._autoIndent,e,new k(s,a,s,a),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,l)}else{let a=n-1;for(;a>=1;){const d=e.getLineContent(a);if(Kr(d)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=Ym(this._autoIndent,e,new k(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}}matchEnterRule(e,t,i,n,s,r){let a=s;for(;a>=1;){let d;if(a===s&&r!==void 0?d=r:d=e.getLineContent(a),Kr(d)>=0)break;a--}if(a<1||n>e.getLineCount())return null;const l=e.getLineMaxColumn(a),c=Ym(this._autoIndent,e,new k(a,l,a,l),this._languageConfigurationService);return this.parseEnterResult(e,t,i,n,c)}trimStart(e){return e.replace(/^\s+/,"")}shouldAutoIndent(e,t){if(this._autoIndent<4||!e.tokenization.isCheapToTokenize(t.startLineNumber))return!1;const i=e.getLanguageIdAtPosition(t.startLineNumber,1),n=e.getLanguageIdAtPosition(t.endLineNumber,1);return!(i!==n||this._languageConfigurationService.getLanguageConfiguration(i).indentRulesSupport===null)}getIndentEditsOfMovingBlock(e,t,i,n,s,r){for(let a=i.startLineNumber;a<=i.endLineNumber;a++){const l=e.getLineContent(a),c=It(l),h=xo(c,n)+r,u=O0(h,n,s);u!==c&&(t.addEditOperation(new k(a,1,a,c.length+1),u),a===i.endLineNumber&&i.endColumn<=c.length+1&&u===""&&(this._moveEndLineSelectionShrink=!0))}}computeCursorState(e,t){let i=t.getTrackedSelection(this._selectionId);return this._moveEndPositionDown&&(i=i.setEndPosition(i.endLineNumber+1,1)),this._moveEndLineSelectionShrink&&i.startLineNumber<i.endLineNumber&&(i=i.setEndPosition(i.endLineNumber,2)),i}};p7=pNe([mNe(3,Jt)],p7);const hB=class hB{constructor(e,t){this.selection=e,this.descending=t,this.selectionId=null}getEditOperations(e,t){const i=_Ne(e,this.selection,this.descending);i&&t.addEditOperation(i.range,i.text),this.selectionId=t.trackSelection(this.selection)}computeCursorState(e,t){return t.getTrackedSelection(this.selectionId)}static canRun(e,t,i){if(e===null)return!1;const n=mQ(e,t,i);if(!n)return!1;for(let s=0,r=n.before.length;s<r;s++)if(n.before[s]!==n.after[s])return!0;return!1}};hB._COLLATOR=Sf.Collator();let F0=hB;function mQ(o,e,t){const i=e.startLineNumber;let n=e.endLineNumber;if(e.endColumn===1&&n--,i>=n)return null;const s=[];for(let a=i;a<=n;a++)s.push(o.getLineContent(a));let r=s.slice(0);return r.sort(F0._COLLATOR.value.compare),t===!0&&(r=r.reverse()),{startLineNumber:i,endLineNumber:n,before:s,after:r}}function _Ne(o,e,t){const i=mQ(o,e,t);return i?fi.replace(new k(i.startLineNumber,1,i.endLineNumber,o.getLineMaxColumn(i.endLineNumber)),i.after.join(`
`)):null}class _Q extends le{constructor(e,t){super(t),this.down=e}run(e,t){if(!t.hasModel())return;const i=t.getSelections().map((r,a)=>({selection:r,index:a,ignore:!1}));i.sort((r,a)=>k.compareRangesUsingStarts(r.selection,a.selection));let n=i[0];for(let r=1;r<i.length;r++){const a=i[r];n.selection.endLineNumber===a.selection.startLineNumber&&(n.index<a.index?a.ignore=!0:(n.ignore=!0,n=a))}const s=[];for(const r of i)s.push(new pQ(r.selection,this.down,r.ignore));t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class bNe extends _Q{constructor(){super(!1,{id:"editor.action.copyLinesUpAction",label:H(1239,"Copy Line Up"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1552,linux:{primary:3600},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"2_line",title:p(1234,"&&Copy Line Up"),order:1}})}}class CNe extends _Q{constructor(){super(!0,{id:"editor.action.copyLinesDownAction",label:H(1240,"Copy Line Down"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:1554,linux:{primary:3602},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"2_line",title:p(1235,"Co&&py Line Down"),order:2}})}}class vNe extends le{constructor(){super({id:"editor.action.duplicateSelection",label:H(1241,"Duplicate Selection"),precondition:T.writable,menuOpts:{menuId:de.MenubarSelectionMenu,group:"2_line",title:p(1236,"&&Duplicate Selection"),order:5}})}run(e,t,i){if(!t.hasModel())return;const n=[],s=t.getSelections(),r=t.getModel();for(const a of s)if(a.isEmpty())n.push(new pQ(a,!0));else{const l=new ce(a.endLineNumber,a.endColumn,a.endLineNumber,a.endColumn);n.push(new goe(l,r.getValueInRange(a)))}t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class bQ extends le{constructor(e,t){super(t),this.down=e}run(e,t){const i=e.get(Jt),n=[],s=t.getSelections()||[],r=t.getOption(16);for(const a of s)n.push(new p7(a,this.down,r,i));t.pushUndoStop(),t.executeCommands(this.id,n),t.pushUndoStop()}}class wNe extends bQ{constructor(){super(!1,{id:"editor.action.moveLinesUpAction",label:H(1242,"Move Line Up"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:528,linux:{primary:528},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"2_line",title:p(1237,"Mo&&ve Line Up"),order:3}})}}class SNe extends bQ{constructor(){super(!0,{id:"editor.action.moveLinesDownAction",label:H(1243,"Move Line Down"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:530,linux:{primary:530},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"2_line",title:p(1238,"Move &&Line Down"),order:4}})}}class CQ extends le{constructor(e,t){super(t),this.descending=e}run(e,t){if(!t.hasModel())return;const i=t.getModel();let n=t.getSelections();n.length===1&&n[0].isEmpty()&&(n=[new ce(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);for(const r of n)if(!F0.canRun(t.getModel(),r,this.descending))return;const s=[];for(let r=0,a=n.length;r<a;r++)s[r]=new F0(n[r],this.descending);t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class yNe extends CQ{constructor(){super(!1,{id:"editor.action.sortLinesAscending",label:H(1244,"Sort Lines Ascending"),precondition:T.writable})}}class LNe extends CQ{constructor(){super(!0,{id:"editor.action.sortLinesDescending",label:H(1245,"Sort Lines Descending"),precondition:T.writable})}}class xNe extends le{constructor(){super({id:"editor.action.removeDuplicateLines",label:H(1246,"Delete Duplicate Lines"),precondition:T.writable})}run(e,t){if(!t.hasModel())return;const i=t.getModel();if(i.getLineCount()===1&&i.getLineMaxColumn(1)===1)return;const n=[],s=[];let r=0,a=!0,l=t.getSelections();l.length===1&&l[0].isEmpty()&&(l=[new ce(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))],a=!1);for(const c of l){const d=new Set,h=[];for(let m=c.startLineNumber;m<=c.endLineNumber;m++){const _=i.getLineContent(m);d.has(_)||(h.push(_),d.add(_))}const u=new ce(c.startLineNumber,1,c.endLineNumber,i.getLineMaxColumn(c.endLineNumber)),f=c.startLineNumber-r,g=new ce(f,1,f+h.length-1,h[h.length-1].length);n.push(fi.replace(u,h.join(`
`))),s.push(g),r+=c.endLineNumber-c.startLineNumber+1-h.length}t.pushUndoStop(),t.executeEdits(this.id,n,a?s:void 0),t.pushUndoStop()}}class kNe extends le{constructor(){super({id:"editor.action.reverseLines",label:H(1247,"Reverse lines"),precondition:T.writable})}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections();let s=n;s.length===1&&s[0].isEmpty()&&(s=[new ce(1,1,i.getLineCount(),i.getLineMaxColumn(i.getLineCount()))]);const r=[],a=[];for(let l=0;l<s.length;l++){const c=s[l],d=n[l];let h=c.endLineNumber;c.startLineNumber<c.endLineNumber&&c.endColumn===1&&h--;let u=new k(c.startLineNumber,1,h,i.getLineMaxColumn(h));h===i.getLineCount()&&i.getLineContent(u.endLineNumber)===""&&(u=u.setEndPosition(u.endLineNumber-1,i.getLineMaxColumn(u.endLineNumber-1)));const f=[];for(let b=u.endLineNumber;b>=u.startLineNumber;b--)f.push(i.getLineContent(b));const g=fi.replace(u,f.join(`
`));r.push(g);const m=function(b){return b<=u.endLineNumber?u.endLineNumber-b+u.startLineNumber:b},_=function(b){if(b.isEmpty())return new ce(m(b.positionLineNumber),b.positionColumn,m(b.positionLineNumber),b.positionColumn);{const C=m(b.selectionStartLineNumber),w=m(b.positionLineNumber),v=b.selectionStartColumn,S=b.positionColumn;return new ce(C,v,w,S)}};a.push(_(d))}t.pushUndoStop(),t.executeEdits(this.id,r,a),t.pushUndoStop()}}const rT=class rT extends le{constructor(){super({id:rT.ID,label:H(1248,"Trim Trailing Whitespace"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:Ei(2089,2102),weight:100}})}run(e,t,i){let n=[];i.reason==="auto-save"&&(n=(t.getSelections()||[]).map(d=>new M(d.positionLineNumber,d.positionColumn)));const s=t.getSelection();if(s===null)return;const r=e.get(Me),a=t.getModel(),l=r.getValue("files.trimTrailingWhitespaceInRegexAndStrings",{overrideIdentifier:a?.getLanguageId(),resource:a?.uri}),c=new fNe(s,n,l);t.pushUndoStop(),t.executeCommands(this.id,[c]),t.pushUndoStop()}};rT.ID="editor.action.trimTrailingWhitespace";let m7=rT;class INe extends le{constructor(){super({id:"editor.action.deleteLines",label:H(1249,"Delete Line"),precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:3113,weight:100}})}run(e,t){if(!t.hasModel())return;const i=this._getLinesToRemove(t),n=t.getModel();if(n.getLineCount()===1&&n.getLineMaxColumn(1)===1)return;let s=0;const r=[],a=[];for(let l=0,c=i.length;l<c;l++){const d=i[l];let h=d.startLineNumber,u=d.endLineNumber,f=1,g=n.getLineMaxColumn(u);u<n.getLineCount()?(u+=1,g=1):h>1&&(h-=1,f=n.getLineMaxColumn(h)),r.push(fi.replace(new ce(h,f,u,g),"")),a.push(new ce(h-s,d.positionColumn,h-s,d.positionColumn)),s+=d.endLineNumber-d.startLineNumber+1}t.pushUndoStop(),t.executeEdits(this.id,r,a),t.pushUndoStop()}_getLinesToRemove(e){const t=e.getSelections().map(s=>{let r=s.endLineNumber;return s.startLineNumber<s.endLineNumber&&s.endColumn===1&&(r-=1),{startLineNumber:s.startLineNumber,selectionStartColumn:s.selectionStartColumn,endLineNumber:r,positionColumn:s.positionColumn}});t.sort((s,r)=>s.startLineNumber===r.startLineNumber?s.endLineNumber-r.endLineNumber:s.startLineNumber-r.startLineNumber);const i=[];let n=t[0];for(let s=1;s<t.length;s++)n.endLineNumber+1>=t[s].startLineNumber?n.endLineNumber=t[s].endLineNumber:(i.push(n),n=t[s]);return i.push(n),i}}class DNe extends le{constructor(){super({id:"editor.action.indentLines",label:H(1250,"Indent Line"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2142,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,gh.indent(i.cursorConfig,t.getModel(),t.getSelections())),t.pushUndoStop())}}class ENe extends le{constructor(){super({id:"editor.action.outdentLines",label:H(1251,"Outdent Line"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2140,weight:100}})}run(e,t){Jm.Outdent.runEditorCommand(e,t,null)}}class NNe extends le{constructor(){super({id:"editor.action.insertLineBefore",label:H(1252,"Insert Line Above"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:3075,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,lL.lineInsertBefore(i.cursorConfig,t.getModel(),t.getSelections())))}}class TNe extends le{constructor(){super({id:"editor.action.insertLineAfter",label:H(1253,"Insert Line Below"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:2051,weight:100}})}run(e,t){const i=t._getViewModel();i&&(t.pushUndoStop(),t.executeCommands(this.id,lL.lineInsertAfter(i.cursorConfig,t.getModel(),t.getSelections())))}}class vQ extends le{run(e,t){if(!t.hasModel())return;const i=t.getSelection(),n=this._getRangesToDelete(t),s=[];for(let l=0,c=n.length-1;l<c;l++){const d=n[l],h=n[l+1];k.intersectRanges(d,h)===null?s.push(d):n[l+1]=k.plusRange(d,h)}s.push(n[n.length-1]);const r=this._getEndCursorState(i,s),a=s.map(l=>fi.replace(l,""));t.pushUndoStop(),t.executeEdits(this.id,a,r),t.pushUndoStop()}}class RNe extends vQ{constructor(){super({id:"deleteAllLeft",label:H(1254,"Delete All Left"),precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:2049},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];let s=0;return t.forEach(r=>{let a;if(r.endColumn===1&&s>0){const l=r.startLineNumber-s;a=new ce(l,r.startColumn,l,r.startColumn)}else a=new ce(r.startLineNumber,r.startColumn,r.startLineNumber,r.startColumn);s+=r.endLineNumber-r.startLineNumber,r.intersectRanges(e)?i=a:n.push(a)}),i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getSelections();if(t===null)return[];let i=t;const n=e.getModel();return n===null?[]:(i.sort(k.compareRangesUsingStarts),i=i.map(s=>{if(s.isEmpty())if(s.startColumn===1){const r=Math.max(1,s.startLineNumber-1),a=s.startLineNumber===1?1:n.getLineLength(r)+1;return new k(r,a,s.startLineNumber,1)}else return new k(s.startLineNumber,1,s.startLineNumber,s.startColumn);else return new k(s.startLineNumber,1,s.endLineNumber,s.endColumn)}),i)}}class MNe extends vQ{constructor(){super({id:"deleteAllRight",label:H(1255,"Delete All Right"),precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:297,secondary:[2068]},weight:100}})}_getEndCursorState(e,t){let i=null;const n=[];for(let s=0,r=t.length,a=0;s<r;s++){const l=t[s],c=new ce(l.startLineNumber-a,l.startColumn,l.startLineNumber-a,l.startColumn);l.intersectRanges(e)?i=c:n.push(c)}return i&&n.unshift(i),n}_getRangesToDelete(e){const t=e.getModel();if(t===null)return[];const i=e.getSelections();if(i===null)return[];const n=i.map(s=>{if(s.isEmpty()){const r=t.getLineMaxColumn(s.startLineNumber);return s.startColumn===r?new k(s.startLineNumber,s.startColumn,s.startLineNumber+1,1):new k(s.startLineNumber,s.startColumn,s.startLineNumber,r)}return s});return n.sort(k.compareRangesUsingStarts),n}}class PNe extends le{constructor(){super({id:"editor.action.joinLines",label:H(1256,"Join Lines"),precondition:T.writable,kbOpts:{kbExpr:T.editorTextFocus,primary:0,mac:{primary:296},weight:100}})}run(e,t){const i=t.getSelections();if(i===null)return;let n=t.getSelection();if(n===null)return;i.sort(k.compareRangesUsingStarts);const s=[],r=i.reduce((u,f)=>u.isEmpty()?u.endLineNumber===f.startLineNumber?(n.equalsSelection(u)&&(n=f),f):f.startLineNumber>u.endLineNumber+1?(s.push(u),f):new ce(u.startLineNumber,u.startColumn,f.endLineNumber,f.endColumn):f.startLineNumber>u.endLineNumber?(s.push(u),f):new ce(u.startLineNumber,u.startColumn,f.endLineNumber,f.endColumn));s.push(r);const a=t.getModel();if(a===null)return;const l=[],c=[];let d=n,h=0;for(let u=0,f=s.length;u<f;u++){const g=s[u],m=g.startLineNumber,_=1;let b=0,C,w;const v=a.getLineLength(g.endLineNumber)-g.endColumn;if(g.isEmpty()||g.startLineNumber===g.endLineNumber){const x=g.getStartPosition();x.lineNumber<a.getLineCount()?(C=m+1,w=a.getLineMaxColumn(C)):(C=x.lineNumber,w=a.getLineMaxColumn(x.lineNumber))}else C=g.endLineNumber,w=a.getLineMaxColumn(C);let S=a.getLineContent(m);for(let x=m+1;x<=C;x++){const I=a.getLineContent(x),D=a.getLineFirstNonWhitespaceColumn(x);if(D>=1){let R=!0;S===""&&(R=!1),R&&(S.charAt(S.length-1)===" "||S.charAt(S.length-1)===" ")&&(R=!1,S=S.replace(/[\s\uFEFF\xA0]+$/g," "));const F=I.substr(D-1);S+=(R?" ":"")+F,R?b=F.length+1:b=F.length}else b=0}const L=new k(m,_,C,w);if(!L.isEmpty()){let x;g.isEmpty()?(l.push(fi.replace(L,S)),x=new ce(L.startLineNumber-h,S.length-b+1,m-h,S.length-b+1)):g.startLineNumber===g.endLineNumber?(l.push(fi.replace(L,S)),x=new ce(g.startLineNumber-h,g.startColumn,g.endLineNumber-h,g.endColumn)):(l.push(fi.replace(L,S)),x=new ce(g.startLineNumber-h,g.startColumn,g.startLineNumber-h,S.length-v)),k.intersectRanges(L,n)!==null?d=x:c.push(x)}h+=L.endLineNumber-L.startLineNumber}c.unshift(d),t.pushUndoStop(),t.executeEdits(this.id,l,c),t.pushUndoStop()}}class ANe extends le{constructor(){super({id:"editor.action.transpose",label:H(1257,"Transpose Characters around the Cursor"),precondition:T.writable})}run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=[];for(let r=0,a=i.length;r<a;r++){const l=i[r];if(!l.isEmpty())continue;const c=l.getStartPosition(),d=n.getLineMaxColumn(c.lineNumber);if(c.column>=d){if(c.lineNumber===n.getLineCount())continue;const h=new k(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),u=n.getValueInRange(h).split("").reverse().join("");s.push(new Dn(new ce(c.lineNumber,Math.max(1,c.column-1),c.lineNumber+1,1),u))}else{const h=new k(c.lineNumber,Math.max(1,c.column-1),c.lineNumber,c.column+1),u=n.getValueInRange(h).split("").reverse().join("");s.push(new _2(h,u,new ce(c.lineNumber,c.column+1,c.lineNumber,c.column+1)))}}t.pushUndoStop(),t.executeCommands(this.id,s),t.pushUndoStop()}}class ep extends le{run(e,t){const i=t.getSelections();if(i===null)return;const n=t.getModel();if(n===null)return;const s=t.getOption(148),r=[];for(const a of i)if(a.isEmpty()){const l=a.getStartPosition(),c=t.getConfiguredWordAtPosition(l);if(!c)continue;const d=new k(l.lineNumber,c.startColumn,l.lineNumber,c.endColumn),h=n.getValueInRange(d);r.push(fi.replace(d,this._modifyText(h,s)))}else{const l=n.getValueInRange(a);r.push(fi.replace(a,this._modifyText(l,s)))}t.pushUndoStop(),t.executeEdits(this.id,r),t.pushUndoStop()}}class ONe extends ep{constructor(){super({id:"editor.action.transformToUppercase",label:H(1258,"Transform to Uppercase"),precondition:T.writable})}_modifyText(e,t){return e.toLocaleUpperCase()}}class FNe extends ep{constructor(){super({id:"editor.action.transformToLowercase",label:H(1259,"Transform to Lowercase"),precondition:T.writable})}_modifyText(e,t){return e.toLocaleLowerCase()}}class Ja{constructor(e,t){this._pattern=e,this._flags=t,this._actual=null,this._evaluated=!1}get(){if(!this._evaluated){this._evaluated=!0;try{this._actual=new RegExp(this._pattern,this._flags)}catch{}}return this._actual}isSupported(){return this.get()!==null}}const aT=class aT extends ep{constructor(){super({id:"editor.action.transformToTitlecase",label:H(1260,"Transform to Title Case"),precondition:T.writable})}_modifyText(e,t){const i=aT.titleBoundary.get();return i?e.toLocaleLowerCase().replace(i,n=>n.toLocaleUpperCase()):e}};aT.titleBoundary=new Ja("(^|[^\\p{L}\\p{N}']|((^|\\P{L})'))\\p{L}","gmu");let FD=aT;const PC=class PC extends ep{constructor(){super({id:"editor.action.transformToSnakecase",label:H(1261,"Transform to Snake Case"),precondition:T.writable})}_modifyText(e,t){const i=PC.caseBoundary.get(),n=PC.singleLetters.get();return!i||!n?e:e.replace(i,"$1_$2").replace(n,"$1_$2$3").toLocaleLowerCase()}};PC.caseBoundary=new Ja("(\\p{Ll})(\\p{Lu})","gmu"),PC.singleLetters=new Ja("(\\p{Lu}|\\p{N})(\\p{Lu})(\\p{Ll})","gmu");let W0=PC;const Hu=class Hu extends ep{constructor(){super({id:"editor.action.transformToCamelcase",label:H(1262,"Transform to Camel Case"),precondition:T.writable})}_modifyText(e,t){const i=/\r\n|\r|\n/.test(e)?Hu.multiLineWordBoundary.get():Hu.singleLineWordBoundary.get(),n=Hu.validWordStart.get();if(!i||!n)return e;const s=e.split(i);return s.shift()?.replace(n,a=>a.toLocaleLowerCase())+s.map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}};Hu.singleLineWordBoundary=new Ja("[_\\s-]+","gm"),Hu.multiLineWordBoundary=new Ja("[_-]+","gm"),Hu.validWordStart=new Ja("^(\\p{Lu}[^\\p{Lu}])","gmu");let B0=Hu;const AC=class AC extends ep{constructor(){super({id:"editor.action.transformToPascalcase",label:H(1263,"Transform to Pascal Case"),precondition:T.writable})}_modifyText(e,t){const i=AC.wordBoundary.get(),n=AC.wordBoundaryToMaintain.get();return!i||!n?e:e.split(n).map(a=>a.split(i)).flat().map(a=>a.substring(0,1).toLocaleUpperCase()+a.substring(1)).join("")}};AC.wordBoundary=new Ja("[_ \\t-]","gm"),AC.wordBoundaryToMaintain=new Ja("(?<=\\.)","gm");let WD=AC;const Vu=class Vu extends ep{static isSupported(){return[this.caseBoundary,this.singleLetters,this.underscoreBoundary].every(t=>t.isSupported())}constructor(){super({id:"editor.action.transformToKebabcase",label:H(1264,"Transform to Kebab Case"),precondition:T.writable})}_modifyText(e,t){const i=Vu.caseBoundary.get(),n=Vu.singleLetters.get(),s=Vu.underscoreBoundary.get();return!i||!n||!s?e:e.replace(s,"$1-$3").replace(i,"$1-$2").replace(n,"$1-$2").toLocaleLowerCase()}};Vu.caseBoundary=new Ja("(\\p{Ll})(\\p{Lu})","gmu"),Vu.singleLetters=new Ja("(\\p{Lu}|\\p{N})(\\p{Lu}\\p{Ll})","gmu"),Vu.underscoreBoundary=new Ja("(\\S)(_)(\\S)","gm");let BD=Vu;ne(bNe),ne(CNe),ne(vNe),ne(wNe),ne(SNe),ne(yNe),ne(LNe),ne(xNe),ne(m7),ne(INe),ne(DNe),ne(ENe),ne(NNe),ne(TNe),ne(RNe),ne(MNe),ne(PNe),ne(ANe),ne(ONe),ne(FNe),ne(kNe),W0.caseBoundary.isSupported()&&W0.singleLetters.isSupported()&&ne(W0),B0.singleLineWordBoundary.isSupported()&&B0.multiLineWordBoundary.isSupported()&&ne(B0),WD.wordBoundary.isSupported()&&ne(WD),FD.titleBoundary.isSupported()&&ne(FD),BD.isSupported()&&ne(BD);var WNe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},HD=function(o,e){return function(t,i){e(t,i,o)}},VD;const wQ=new ae("LinkedEditingInputVisible",!1),BNe="linked-editing-decoration";let zb=(zu=class extends A{static get(e){return e.getContribution(VD.ID)}constructor(e,t,i,n,s){super(),this.languageConfigurationService=n,this._syncRangesToken=0,this._localToDispose=this._register(new U),this._editor=e,this._providers=i.linkedEditingRangeProvider,this._enabled=!1,this._visibleContextKey=wQ.bindTo(t),this._debounceInformation=s.for(this._providers,"Linked Editing",{max:200}),this._currentDecorations=this._editor.createDecorationsCollection(),this._languageWordPattern=null,this._currentWordPattern=null,this._ignoreChangeEvent=!1,this._localToDispose=this._register(new U),this._rangeUpdateTriggerPromise=null,this._rangeSyncTriggerPromise=null,this._currentRequestCts=null,this._currentRequestPosition=null,this._currentRequestModelVersion=null,this._register(this._editor.onDidChangeModel(()=>this.reinitialize(!0))),this._register(this._editor.onDidChangeConfiguration(r=>{(r.hasChanged(78)||r.hasChanged(106))&&this.reinitialize(!1)})),this._register(this._providers.onDidChange(()=>this.reinitialize(!1))),this._register(this._editor.onDidChangeModelLanguage(()=>this.reinitialize(!0))),this.reinitialize(!0)}reinitialize(e){const t=this._editor.getModel(),i=t!==null&&(this._editor.getOption(78)||this._editor.getOption(106))&&this._providers.has(t);if(i===this._enabled&&!e||(this._enabled=i,this.clearRanges(),this._localToDispose.clear(),!i||t===null))return;this._localToDispose.add(ie.runAndSubscribe(t.onDidChangeLanguageConfiguration,()=>{this._languageWordPattern=this.languageConfigurationService.getLanguageConfiguration(t.getLanguageId()).getWordDefinition()}));const n=new fr(this._debounceInformation.get(t)),s=()=>{this._rangeUpdateTriggerPromise=n.trigger(()=>this.updateRanges(),this._debounceDuration??this._debounceInformation.get(t))},r=new fr(0),a=l=>{this._rangeSyncTriggerPromise=r.trigger(()=>this._syncRanges(l))};this._localToDispose.add(this._editor.onDidChangeCursorPosition(()=>{s()})),this._localToDispose.add(this._editor.onDidChangeModelContent(l=>{if(!this._ignoreChangeEvent&&this._currentDecorations.length>0){const c=this._currentDecorations.getRange(0);if(c&&l.changes.every(d=>c.intersectRanges(d.range))){a(this._syncRangesToken);return}}s()})),this._localToDispose.add({dispose:()=>{n.dispose(),r.dispose()}}),this.updateRanges()}_syncRanges(e){if(!this._editor.hasModel()||e!==this._syncRangesToken||this._currentDecorations.length===0)return;const t=this._editor.getModel(),i=this._currentDecorations.getRange(0);if(!i||i.startLineNumber!==i.endLineNumber)return this.clearRanges();const n=t.getValueInRange(i);if(this._currentWordPattern){const r=n.match(this._currentWordPattern);if((r?r[0].length:0)!==n.length)return this.clearRanges()}const s=[];for(let r=1,a=this._currentDecorations.length;r<a;r++){const l=this._currentDecorations.getRange(r);if(l)if(l.startLineNumber!==l.endLineNumber)s.push({range:l,text:n});else{let c=t.getValueInRange(l),d=n,h=l.startColumn,u=l.endColumn;const f=Gr(c,d);h+=f,c=c.substr(f),d=d.substr(f);const g=Lc(c,d);u-=g,c=c.substr(0,c.length-g),d=d.substr(0,d.length-g),(h!==u||d.length!==0)&&s.push({range:new k(l.startLineNumber,h,l.endLineNumber,u),text:d})}}if(s.length!==0)try{this._editor.popUndoStop(),this._ignoreChangeEvent=!0;const r=this._editor._getViewModel().getPrevEditOperationType();this._editor.executeEdits("linkedEditing",s),this._editor._getViewModel().setPrevEditOperationType(r)}finally{this._ignoreChangeEvent=!1}}dispose(){this.clearRanges(),super.dispose()}clearRanges(){this._visibleContextKey.set(!1),this._currentDecorations.clear(),this._currentRequestCts&&(this._currentRequestCts.cancel(),this._currentRequestCts=null,this._currentRequestPosition=null)}async updateRanges(e=!1){if(!this._editor.hasModel()){this.clearRanges();return}const t=this._editor.getPosition();if(!this._enabled&&!e||this._editor.getSelections().length>1){this.clearRanges();return}const i=this._editor.getModel(),n=i.getVersionId();if(this._currentRequestPosition&&this._currentRequestModelVersion===n){if(t.equals(this._currentRequestPosition))return;if(this._currentDecorations.length>0){const r=this._currentDecorations.getRange(0);if(r&&r.containsPosition(t))return}}this._currentRequestPosition?.equals(t)||this._currentDecorations.getRange(0)?.containsPosition(t)||this.clearRanges(),this._currentRequestPosition=t,this._currentRequestModelVersion=n;const s=this._currentRequestCts=new Xt;try{const r=new Ki(!1),a=await SQ(this._providers,i,t,s.token);if(this._debounceInformation.update(i,r.elapsed()),s!==this._currentRequestCts||(this._currentRequestCts=null,n!==i.getVersionId()))return;let l=[];a?.ranges&&(l=a.ranges),this._currentWordPattern=a?.wordPattern||this._languageWordPattern;let c=!1;for(let h=0,u=l.length;h<u;h++)if(k.containsPosition(l[h],t)){if(c=!0,h!==0){const f=l[h];l.splice(h,1),l.unshift(f)}break}if(!c){this.clearRanges();return}const d=l.map(h=>({range:h,options:VD.DECORATION}));this._visibleContextKey.set(!0),this._currentDecorations.set(d),this._syncRangesToken++}catch(r){Do(r)||Ee(r),(this._currentRequestCts===s||!this._currentRequestCts)&&this.clearRanges()}}},VD=zu,zu.ID="editor.contrib.linkedEditing",zu.DECORATION=Te.register({description:"linked-editing",stickiness:0,className:BNe}),zu);zb=VD=WNe([HD(1,xe),HD(2,he),HD(3,Jt),HD(4,Or)],zb);class HNe extends le{constructor(){super({id:"editor.action.linkedEditing",label:H(1266,"Start Linked Editing"),precondition:K.and(T.writable,T.hasRenameProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:3132,weight:100}})}runCommand(e,t){const i=e.get(et),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return be.isUri(n)&&M.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},Ee):super.runCommand(e,t)}run(e,t){const i=zb.get(t);return i?Promise.resolve(i.updateRanges(!0)):Promise.resolve()}}const VNe=Bi.bindToContribution(zb.get);re(new VNe({id:"cancelLinkedEditingInput",precondition:wQ,handler:o=>o.clearRanges(),kbOpts:{kbExpr:T.editorTextFocus,weight:199,primary:9,secondary:[1033]}}));function SQ(o,e,t,i){const n=o.ordered(e);return hR(n.map(s=>async()=>{try{return await s.provideLinkedEditingRanges(e,t,i)}catch(r){Di(r);return}}),s=>!!s&&is(s?.ranges))}N("editor.linkedEditingBackground",{dark:$.fromHex("#f00").transparent(.3),light:$.fromHex("#f00").transparent(.3),hcDark:$.fromHex("#f00").transparent(.3),hcLight:$.white},p(1265,"Background color when the editor auto renames on type.")),zs("_executeLinkedEditingProvider",(o,e,t)=>{const{linkedEditingRangeProvider:i}=o.get(he);return SQ(i,e,t,He.None)}),Qe(zb.ID,zb,1),ne(HNe);let zNe=class{constructor(e,t){this._link=e,this._provider=t}toJSON(){return{range:this.range,url:this.url,tooltip:this.tooltip}}get range(){return this._link.range}get url(){return this._link.url}get tooltip(){return this._link.tooltip}async resolve(e){return this._link.url?this._link.url:typeof this._provider.resolveLink=="function"?Promise.resolve(this._provider.resolveLink(this._link,e)).then(t=>(this._link=t||this._link,this._link.url?this.resolve(e):Promise.reject(new Error("missing")))):Promise.reject(new Error("missing"))}};const PS=class PS{constructor(e){this._disposables=new U;let t=[];for(const[i,n]of e){const s=i.links.map(r=>new zNe(r,n));t=PS._union(t,s),Xu(i)&&(this._disposables??=new U,this._disposables.add(i))}this.links=t}dispose(){this._disposables?.dispose(),this.links.length=0}static _union(e,t){const i=[];let n,s,r,a;for(n=0,r=0,s=e.length,a=t.length;n<s&&r<a;){const l=e[n],c=t[r];if(k.areIntersectingOrTouching(l.range,c.range)){n++;continue}k.compareRangesUsingStarts(l.range,c.range)<0?(i.push(l),n++):(i.push(c),r++)}for(;n<s;n++)i.push(e[n]);for(;r<a;r++)i.push(t[r]);return i}};PS.Empty=new PS([]);let zD=PS;async function yQ(o,e,t){const i=[],n=o.ordered(e).reverse().map(async(r,a)=>{try{const l=await r.provideLinks(e,t);l&&(i[a]=[l,r])}catch(l){Di(l)}});await Promise.all(n);let s=new zD(wa(i));return t.isCancellationRequested&&(s.dispose(),s=zD.Empty),s}Xe.registerCommand("_executeLinkProvider",async(o,...e)=>{let[t,i]=e;it(t instanceof be),typeof i!="number"&&(i=0);const{linkProvider:n}=o.get(he),s=o.get(Qt).getModel(t);if(!s)return[];const r=await yQ(n,s,He.None);if(!r)return[];for(let l=0;l<Math.min(i,r.links.length);l++)await r.links[l].resolve(He.None);const a=r.links.slice(0);return r.dispose(),a});var UNe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},UD=function(o,e){return function(t,i){e(t,i,o)}},_7;let H0=(cm=class extends A{static get(e){return e.getContribution(_7.ID)}constructor(e,t,i,n,s){super(),this.editor=e,this.openerService=t,this.notificationService=i,this.languageFeaturesService=n,this.providers=this.languageFeaturesService.linkProvider,this.debounceInformation=s.for(this.providers,"Links",{min:1e3,max:4e3}),this.computeLinks=this._register(new wt(()=>this.computeLinksNow(),1e3)),this.computePromise=null,this.activeLinksList=null,this.currentOccurrences={},this.activeLinkDecorationId=null;const r=this._register(new tI(e));this._register(r.onMouseMoveOrRelevantKeyDown(([a,l])=>{this._onEditorMouseMove(a,l)})),this._register(r.onExecute(a=>{this.onEditorMouseUp(a)})),this._register(r.onCancel(a=>{this.cleanUpActiveLinkDecoration()})),this._register(e.onDidChangeConfiguration(a=>{a.hasChanged(79)&&(this.updateDecorations([]),this.stop(),this.computeLinks.schedule(0))})),this._register(e.onDidChangeModelContent(a=>{this.editor.hasModel()&&this.computeLinks.schedule(this.debounceInformation.get(this.editor.getModel()))})),this._register(e.onDidChangeModel(a=>{this.currentOccurrences={},this.activeLinkDecorationId=null,this.stop(),this.computeLinks.schedule(0)})),this._register(e.onDidChangeModelLanguage(a=>{this.stop(),this.computeLinks.schedule(0)})),this._register(this.providers.onDidChange(a=>{this.stop(),this.computeLinks.schedule(0)})),this.computeLinks.schedule(0)}async computeLinksNow(){if(!this.editor.hasModel()||!this.editor.getOption(79))return;const e=this.editor.getModel();if(!e.isTooLargeForSyncing()&&this.providers.has(e)){this.activeLinksList&&(this.activeLinksList.dispose(),this.activeLinksList=null),this.computePromise=Vi(t=>yQ(this.providers,e,t));try{const t=new Ki(!1);if(this.activeLinksList=await this.computePromise,this.debounceInformation.update(e,t.elapsed()),e.isDisposed())return;this.updateDecorations(this.activeLinksList.links)}catch(t){Ee(t)}finally{this.computePromise=null}}}updateDecorations(e){const t=this.editor.getOption(86)==="altKey",i=[],n=Object.keys(this.currentOccurrences);for(const r of n){const a=this.currentOccurrences[r];i.push(a.decorationId)}const s=[];if(e)for(const r of e)s.push(Ub.decoration(r,t));this.editor.changeDecorations(r=>{const a=r.deltaDecorations(i,s);this.currentOccurrences={},this.activeLinkDecorationId=null;for(let l=0,c=a.length;l<c;l++){const d=new Ub(e[l],a[l]);this.currentOccurrences[d.decorationId]=d}})}_onEditorMouseMove(e,t){const i=this.editor.getOption(86)==="altKey";if(this.isEnabled(e,t)){this.cleanUpActiveLinkDecoration();const n=this.getLinkOccurrence(e.target.position);n&&this.editor.changeDecorations(s=>{n.activate(s,i),this.activeLinkDecorationId=n.decorationId})}else this.cleanUpActiveLinkDecoration()}cleanUpActiveLinkDecoration(){const e=this.editor.getOption(86)==="altKey";if(this.activeLinkDecorationId){const t=this.currentOccurrences[this.activeLinkDecorationId];t&&this.editor.changeDecorations(i=>{t.deactivate(i,e)}),this.activeLinkDecorationId=null}}onEditorMouseUp(e){if(!this.isEnabled(e))return;const t=this.getLinkOccurrence(e.target.position);t&&this.openLinkOccurrence(t,e.hasSideBySideModifier,!0)}openLinkOccurrence(e,t,i=!1){if(!this.openerService)return;const{link:n}=e;n.resolve(He.None).then(s=>{if(typeof s=="string"&&this.editor.hasModel()){const r=this.editor.getModel().uri;if(r.scheme===we.file&&s.startsWith(`${we.file}:`)){const a=be.parse(s);if(a.scheme===we.file){const l=hl(a);let c=null;l.startsWith("/./")||l.startsWith("\\.\\")?c=`.${l.substr(1)}`:(l.startsWith("//./")||l.startsWith("\\\\.\\"))&&(c=`.${l.substr(2)}`),c&&(s=NH(r,c))}}}return this.openerService.open(s,{openToSide:t,fromUserGesture:i,allowContributedOpeners:!0,allowCommands:!0,fromWorkspace:!0})},s=>{const r=s instanceof Error?s.message:s;r==="invalid"?this.notificationService.warn(p(1267,"Failed to open this link because it is not well-formed: {0}",n.url.toString())):r==="missing"?this.notificationService.warn(p(1268,"Failed to open this link because its target is missing.")):Ee(s)})}getLinkOccurrence(e){if(!this.editor.hasModel()||!e)return null;const t=this.editor.getModel().getDecorationsInRange({startLineNumber:e.lineNumber,startColumn:e.column,endLineNumber:e.lineNumber,endColumn:e.column},0,!0);for(const i of t){const n=this.currentOccurrences[i.id];if(n)return n}return null}isEnabled(e,t){return!!(e.target.type===6&&(e.hasTriggerModifier||t&&t.keyCodeIsTriggerKey||e.isMiddleClick&&e.mouseMiddleClickAction==="openLink"))}stop(){this.computeLinks.cancel(),this.activeLinksList&&(this.activeLinksList?.dispose(),this.activeLinksList=null),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop()}},_7=cm,cm.ID="editor.linkDetector",cm);H0=_7=UNe([UD(1,Js),UD(2,hi),UD(3,he),UD(4,Or)],H0);const LQ={general:Te.register({description:"detected-link",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link"}),active:Te.register({description:"detected-link-active",stickiness:1,collapseOnReplaceEdit:!0,inlineClassName:"detected-link-active"})};class Ub{static decoration(e,t){return{range:e.range,options:Ub._getOptions(e,t,!1)}}static _getOptions(e,t,i){const n={...i?LQ.active:LQ.general};return n.hoverMessage=$Ne(e,t),n}constructor(e,t){this.link=e,this.decorationId=t}activate(e,t){e.changeDecorationOptions(this.decorationId,Ub._getOptions(this.link,t,!0))}deactivate(e,t){e.changeDecorationOptions(this.decorationId,Ub._getOptions(this.link,t,!1))}}function $Ne(o,e){const t=o.url&&/^command:/i.test(o.url.toString()),i=o.tooltip?o.tooltip:t?p(1269,"Execute command"):p(1270,"Follow link"),n=e?ze?p(1271,"cmd + click"):p(1272,"ctrl + click"):ze?p(1273,"option + click"):p(1274,"alt + click");if(o.url){let s="";if(/^command:/i.test(o.url.toString())){const a=o.url.toString().match(/^command:([^?#]+)/);if(a){const l=a[1];s=p(1275,"Execute command {0}",l)}}return new qn("",!0).appendLink(o.url.toString(!0).replace(/ /g,"%20"),i,s).appendMarkdown(` (${n})`)}else return new qn().appendText(`${i} (${n})`)}class jNe extends le{constructor(){super({id:"editor.action.openLink",label:H(1276,"Open Link"),precondition:void 0})}run(e,t){const i=H0.get(t);if(!i||!t.hasModel())return;const n=t.getSelections();for(const s of n){const r=i.getLinkOccurrence(s.getEndPosition());r&&i.openLinkOccurrence(r,!1)}}}Qe(H0.ID,H0,1),ne(jNe);const uB=class uB extends A{constructor(e){super(),this._editor=e,this._register(this._editor.onMouseDown(t=>{const i=this._editor.getOption(133);i>=0&&t.target.type===6&&t.target.position.column>=i&&this._editor.updateOptions({stopRenderingLineAfter:-1})}))}};uB.ID="editor.contrib.longLinesHelper";let $D=uB;Qe($D.ID,$D,2);const fB=class fB extends A{constructor(e){super(),this._editor=e;const t=ni(this._editor),i=t.getOption(171);this._register(Se(n=>{if(!i.read(n))return;const s=t.domNode.read(n);if(!s)return;const r=n.store.add(KR("scrollingSession",void 0));n.store.add(this._editor.onMouseDown(l=>{if(r.read(void 0)){r.set(void 0,void 0);return}if(!l.event.middleButton)return;l.event.stopPropagation(),l.event.preventDefault();const d=new U,h=new en(l.event.posx,l.event.posy),f=qNe(me(s),h,d).map(_=>_.subtract(h).withThreshold(5)),g=s.getBoundingClientRect(),m=new en(h.x-g.left,h.y-g.top);r.set({mouseDeltaAfterThreshold:f,initialMousePosInEditor:m,didScroll:!1,dispose:()=>d.dispose()},void 0),d.add(this._editor.onMouseUp(_=>{const b=r.read(void 0);b&&b.didScroll&&r.set(void 0,void 0)})),d.add(this._editor.onKeyDown(_=>{r.set(void 0,void 0)}))})),n.store.add(Se(l=>{const c=r.read(l);if(!c)return;let d=Date.now();l.store.add(Se(u=>{oD.instance.invalidateOnNextAnimationFrame(u);const f=Date.now(),g=f-d;d=f;const m=c.mouseDeltaAfterThreshold.read(void 0),_=g/32,b=m.scale(_),C=new en(this._editor.getScrollLeft(),this._editor.getScrollTop());this._editor.setScrollPosition(KNe(C.add(b))),b.isZero()||(c.didScroll=!0)}));const h=j(u=>{const f=c.mouseDeltaAfterThreshold.read(u);let g="";return g+=f.y<0?"n":f.y>0?"s":"",g+=f.x<0?"w":f.x>0?"e":"",g});l.store.add(Se(u=>{s.setAttribute("data-scroll-direction",h.read(u))}))}));const a=n.store.add(Pe.div({class:["scroll-editor-on-middle-click-dot",r.map(l=>l?"":"hidden")],style:{left:r.map(l=>l?l.initialMousePosInEditor.x:0),top:r.map(l=>l?l.initialMousePosInEditor.y:0)}}).toDisposableLiveElement());n.store.add(U_(s,a.element)),n.store.add(Se(l=>{const c=r.read(l);s.classList.toggle("scroll-editor-on-middle-click-editor",!!c)}))}))}};fB.ID="editor.contrib.middleScroll";let jD=fB;function qNe(o,e,t){const i=Le("pos",e);return t.add(W(o,"mousemove",n=>{i.set(new en(n.pageX,n.pageY),void 0)})),i}function KNe(o){return{scrollLeft:o.x,scrollTop:o.y}}Qe(jD.ID,jD,2);const GNe=N("editor.wordHighlightBackground",{dark:"#575757B8",light:"#57575740",hcDark:null,hcLight:null},p(1548,"Background color of a symbol during read-access, like reading a variable. The color must not be opaque so as not to hide underlying decorations."),!0);N("editor.wordHighlightStrongBackground",{dark:"#004972B8",light:"#0e639c40",hcDark:null,hcLight:null},p(1549,"Background color of a symbol during write-access, like writing to a variable. The color must not be opaque so as not to hide underlying decorations."),!0),N("editor.wordHighlightTextBackground",GNe,p(1550,"Background color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0);const ZNe=N("editor.wordHighlightBorder",{light:null,dark:null,hcDark:jt,hcLight:jt},p(1551,"Border color of a symbol during read-access, like reading a variable."));N("editor.wordHighlightStrongBorder",{light:null,dark:null,hcDark:jt,hcLight:jt},p(1552,"Border color of a symbol during write-access, like writing to a variable.")),N("editor.wordHighlightTextBorder",ZNe,p(1553,"Border color of a textual occurrence for a symbol."));const YNe=N("editorOverviewRuler.wordHighlightForeground","#A0A0A0CC",p(1554,"Overview ruler marker color for symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),XNe=N("editorOverviewRuler.wordHighlightStrongForeground","#C0A0C0CC",p(1555,"Overview ruler marker color for write-access symbol highlights. The color must not be opaque so as not to hide underlying decorations."),!0),QNe=N("editorOverviewRuler.wordHighlightTextForeground",YV,p(1556,"Overview ruler marker color of a textual occurrence for a symbol. The color must not be opaque so as not to hide underlying decorations."),!0),JNe=Te.register({description:"word-highlight-strong",stickiness:1,className:"wordHighlightStrong",overviewRuler:{color:ci(XNe),position:Ao.Center},minimap:{color:ci(kL),position:1}}),eTe=Te.register({description:"word-highlight-text",stickiness:1,className:"wordHighlightText",overviewRuler:{color:ci(QNe),position:Ao.Center},minimap:{color:ci(kL),position:1}}),tTe=Te.register({description:"selection-highlight-overview",stickiness:1,className:"selectionHighlight",overviewRuler:{color:ci(YV),position:Ao.Center},minimap:{color:ci(kL),position:1}}),iTe=Te.register({description:"selection-highlight",stickiness:1,className:"selectionHighlight"}),nTe=Te.register({description:"word-highlight",stickiness:1,className:"wordHighlight",overviewRuler:{color:ci(YNe),position:Ao.Center},minimap:{color:ci(kL),position:1}});function sTe(o){return o===y_.Write?JNe:o===y_.Text?eTe:nTe}function oTe(o){return o?iTe:tTe}Nr((o,e)=>{const t=o.getColor(iM);t&&e.addRule(`.monaco-editor .selectionHighlight { background-color: ${t.transparent(.5)}; }`)});var rTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aTe=function(o,e){return function(t,i){e(t,i,o)}},b7;function cu(o,e){const t=e.filter(i=>!o.find(n=>n.equals(i)));if(t.length>=1){const i=t.map(s=>`line ${s.viewState.position.lineNumber} column ${s.viewState.position.column}`).join(", "),n=t.length===1?p(1278,"Cursor added: {0}",i):p(1279,"Cursors added: {0}",i);cl(n)}}class lTe extends le{constructor(){super({id:"editor.action.insertCursorAbove",label:H(1288,"Add Cursor Above"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2576,linux:{primary:1552,secondary:[3088]},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1280,"&&Add Cursor Above"),order:2}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,_n.addCursorUp(s,r,n)),s.revealTopMostCursor(i.source),cu(r,s.getCursorStates())}}class cTe extends le{constructor(){super({id:"editor.action.insertCursorBelow",label:H(1289,"Add Cursor Below"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:2578,linux:{primary:1554,secondary:[3090]},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1281,"A&&dd Cursor Below"),order:3}})}run(e,t,i){if(!t.hasModel())return;let n=!0;i&&i.logicalLine===!1&&(n=!1);const s=t._getViewModel();if(s.cursorConfig.readOnly)return;s.model.pushStackElement();const r=s.getCursorStates();s.setCursorStates(i.source,3,_n.addCursorDown(s,r,n)),s.revealBottomMostCursor(i.source),cu(r,s.getCursorStates())}}class dTe extends le{constructor(){super({id:"editor.action.insertCursorAtEndOfEachLineSelected",label:H(1290,"Add Cursors to Line Ends"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1575,weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1282,"Add C&&ursors to Line Ends"),order:4}})}getCursorsForSelection(e,t,i){if(!e.isEmpty()){for(let n=e.startLineNumber;n<e.endLineNumber;n++){const s=t.getLineMaxColumn(n);i.push(new ce(n,s,n,s))}e.endColumn>1&&i.push(new ce(e.endLineNumber,e.endColumn,e.endLineNumber,e.endColumn))}}run(e,t){if(!t.hasModel())return;const i=t.getModel(),n=t.getSelections(),s=t._getViewModel(),r=s.getCursorStates(),a=[];n.forEach(l=>this.getCursorsForSelection(l,i,a)),a.length>0&&t.setSelections(a),cu(r,s.getCursorStates())}}class hTe extends le{constructor(){super({id:"editor.action.addCursorsToBottom",label:H(1291,"Add Cursors to Bottom"),precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=t.getModel().getLineCount(),s=[];for(let l=i[0].startLineNumber;l<=n;l++)s.push(new ce(l,i[0].startColumn,l,i[0].endColumn));const r=t._getViewModel(),a=r.getCursorStates();s.length>0&&t.setSelections(s),cu(a,r.getCursorStates())}}class uTe extends le{constructor(){super({id:"editor.action.addCursorsToTop",label:H(1292,"Add Cursors to Top"),precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getSelections(),n=[];for(let a=i[0].startLineNumber;a>=1;a--)n.push(new ce(a,i[0].startColumn,a,i[0].endColumn));const s=t._getViewModel(),r=s.getCursorStates();n.length>0&&t.setSelections(n),cu(r,s.getCursorStates())}}class qD{constructor(e,t,i){this.selections=e,this.revealRange=t,this.revealScrollType=i}}class V0{static create(e,t){if(!e.hasModel())return null;const i=t.getState();if(!e.hasTextFocus()&&i.isRevealed&&i.searchString.length>0)return new V0(e,t,!1,i.searchString,i.wholeWord,i.matchCase,null);let n=!1,s,r;const a=e.getSelections();a.length===1&&a[0].isEmpty()?(n=!0,s=!0,r=!0):(s=i.wholeWord,r=i.matchCase);const l=e.getSelection();let c,d=null;if(l.isEmpty()){const h=e.getConfiguredWordAtPosition(l.getStartPosition());if(!h)return null;c=h.word,d=new ce(l.startLineNumber,h.startColumn,l.startLineNumber,h.endColumn)}else c=e.getModel().getValueInRange(l).replace(/\r\n/g,`
`);return new V0(e,t,n,c,s,r,d)}constructor(e,t,i,n,s,r,a){this._editor=e,this.findController=t,this.isDisconnectedFromFindController=i,this.searchText=n,this.wholeWord=s,this.matchCase=r,this.currentMatch=a}addSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new qD(t.concat(e),e,0)}moveSelectionToNextFindMatch(){if(!this._editor.hasModel())return null;const e=this._getNextMatch();if(!e)return null;const t=this._editor.getSelections();return new qD(t.slice(0,t.length-1).concat(e),e,0)}_getNextMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findNextMatch(this.searchText,t.getEndPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return i?new ce(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}addSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new qD(t.concat(e),e,0)}moveSelectionToPreviousFindMatch(){if(!this._editor.hasModel())return null;const e=this._getPreviousMatch();if(!e)return null;const t=this._editor.getSelections();return new qD(t.slice(0,t.length-1).concat(e),e,0)}_getPreviousMatch(){if(!this._editor.hasModel())return null;if(this.currentMatch){const n=this.currentMatch;return this.currentMatch=null,n}this.findController.highlightFindOptions();const e=this._editor.getSelections(),t=e[e.length-1],i=this._editor.getModel().findPreviousMatch(this.searchText,t.getStartPosition(),!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1);return i?new ce(i.range.startLineNumber,i.range.startColumn,i.range.endLineNumber,i.range.endColumn):null}selectAll(e){if(!this._editor.hasModel())return[];this.findController.highlightFindOptions();const t=this._editor.getModel();return e?t.findMatches(this.searchText,e,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824):t.findMatches(this.searchText,!0,!1,this.matchCase,this.wholeWord?this._editor.getOption(148):null,!1,1073741824)}}const lT=class lT extends A{static get(e){return e.getContribution(lT.ID)}constructor(e){super(),this._sessionDispose=this._register(new U),this._editor=e,this._ignoreSelectionChange=!1,this._session=null}dispose(){this._endSession(),super.dispose()}_beginSessionIfNeeded(e){if(!this._session){const t=V0.create(this._editor,e);if(!t)return;this._session=t;const i={searchString:this._session.searchText};this._session.isDisconnectedFromFindController&&(i.wholeWordOverride=1,i.matchCaseOverride=1,i.isRegexOverride=2),e.getState().change(i,!1),this._sessionDispose.add(this._editor.onDidChangeCursorSelection(n=>{this._ignoreSelectionChange||this._endSession()})),this._sessionDispose.add(this._editor.onDidBlurEditorText(()=>{this._endSession()})),this._sessionDispose.add(e.getState().onFindReplaceStateChange(n=>{(n.matchCase||n.wholeWord)&&this._endSession()}))}}_endSession(){if(this._sessionDispose.clear(),this._session&&this._session.isDisconnectedFromFindController){const e={wholeWordOverride:0,matchCaseOverride:0,isRegexOverride:0};this._session.findController.getState().change(e,!1)}this._session=null}_setSelections(e){this._ignoreSelectionChange=!0,this._editor.setSelections(e),this._ignoreSelectionChange=!1}_expandEmptyToWord(e,t){if(!t.isEmpty())return t;const i=this._editor.getConfiguredWordAtPosition(t.getStartPosition());return i?new ce(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):t}_applySessionResult(e){e&&(this._setSelections(e.selections),e.revealRange&&this._editor.revealRangeInCenterIfOutsideViewport(e.revealRange,e.revealScrollType))}getSession(e){return this._session}addSelectionToNextFindMatch(e){if(this._editor.hasModel()){if(!this._session){const t=this._editor.getSelections();if(t.length>1){const n=e.getState().matchCase;if(!xQ(this._editor.getModel(),t,n)){const r=this._editor.getModel(),a=[];for(let l=0,c=t.length;l<c;l++)a[l]=this._expandEmptyToWord(r,t[l]);this._editor.setSelections(a);return}}}this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToNextFindMatch())}}addSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.addSelectionToPreviousFindMatch())}moveSelectionToNextFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToNextFindMatch())}moveSelectionToPreviousFindMatch(e){this._beginSessionIfNeeded(e),this._session&&this._applySessionResult(this._session.moveSelectionToPreviousFindMatch())}selectAll(e){if(!this._editor.hasModel())return;let t=null;const i=e.getState();if(i.isRevealed&&i.searchString.length>0&&i.isRegex){const n=this._editor.getModel();i.searchScope?t=n.findMatches(i.searchString,i.searchScope,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(148):null,!1,1073741824):t=n.findMatches(i.searchString,!0,i.isRegex,i.matchCase,i.wholeWord?this._editor.getOption(148):null,!1,1073741824)}else{if(this._beginSessionIfNeeded(e),!this._session)return;t=this._session.selectAll(i.searchScope)}if(t.length>0){const n=this._editor.getSelection();for(let s=0,r=t.length;s<r;s++){const a=t[s];if(a.range.intersectRanges(n)){t[s]=t[0],t[0]=a;break}}this._setSelections(t.map(s=>new ce(s.range.startLineNumber,s.range.startColumn,s.range.endLineNumber,s.range.endColumn)))}}};lT.ID="editor.contrib.multiCursorController";let $b=lT;class jb extends le{run(e,t){const i=$b.get(t);if(!i)return;const n=t._getViewModel();if(n){const s=n.getCursorStates(),r=to.get(t);if(r)this._run(i,r);else{const a=e.get(ge).createInstance(to,t);this._run(i,a),a.dispose()}cu(s,n.getCursorStates())}}}class fTe extends jb{constructor(){super({id:"editor.action.addSelectionToNextFindMatch",label:H(1293,"Add Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2082,weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1283,"Add &&Next Occurrence"),order:5}})}_run(e,t){e.addSelectionToNextFindMatch(t)}}class gTe extends jb{constructor(){super({id:"editor.action.addSelectionToPreviousFindMatch",label:H(1294,"Add Selection to Previous Find Match"),precondition:void 0,menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1284,"Add P&&revious Occurrence"),order:6}})}_run(e,t){e.addSelectionToPreviousFindMatch(t)}}class pTe extends jb{constructor(){super({id:"editor.action.moveSelectionToNextFindMatch",label:H(1295,"Move Last Selection to Next Find Match"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:Ei(2089,2082),weight:100}})}_run(e,t){e.moveSelectionToNextFindMatch(t)}}class mTe extends jb{constructor(){super({id:"editor.action.moveSelectionToPreviousFindMatch",label:H(1296,"Move Last Selection to Previous Find Match"),precondition:void 0})}_run(e,t){e.moveSelectionToPreviousFindMatch(t)}}class _Te extends jb{constructor(){super({id:"editor.action.selectHighlights",label:H(1297,"Select All Occurrences of Find Match"),precondition:void 0,kbOpts:{kbExpr:T.focus,primary:3114,weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"3_multi",title:p(1285,"Select All &&Occurrences"),order:7}})}_run(e,t){e.selectAll(t)}}class bTe extends jb{constructor(){super({id:"editor.action.changeAll",label:H(1298,"Change All Occurrences"),precondition:K.and(T.writable,T.editorTextFocus),kbOpts:{kbExpr:T.editorTextFocus,primary:2108,weight:100},contextMenuOpts:{group:"1_modification",order:1.2}})}_run(e,t){e.selectAll(t)}}class CTe{constructor(e,t,i,n,s){this._model=e,this._searchText=t,this._matchCase=i,this._wordSeparators=n,this._cachedFindMatches=null,this._modelVersionId=this._model.getVersionId(),s&&this._model===s._model&&this._searchText===s._searchText&&this._matchCase===s._matchCase&&this._wordSeparators===s._wordSeparators&&this._modelVersionId===s._modelVersionId&&(this._cachedFindMatches=s._cachedFindMatches)}findMatches(){return this._cachedFindMatches===null&&(this._cachedFindMatches=this._model.findMatches(this._searchText,!0,!1,this._matchCase,this._wordSeparators,!1).map(e=>e.range),this._cachedFindMatches.sort(k.compareRangesUsingStarts)),this._cachedFindMatches}}let KD=(dm=class extends A{constructor(e,t){super(),this._languageFeaturesService=t,this.editor=e,this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123),this._decorations=e.createDecorationsCollection(),this.updateSoon=this._register(new wt(()=>this._update(),300)),this.state=null,this._register(e.onDidChangeConfiguration(n=>{this._isEnabled=e.getOption(122),this._isEnabledMultiline=e.getOption(124),this._maxLength=e.getOption(123)})),this._register(e.onDidChangeCursorSelection(n=>{this._isEnabled&&(n.selection.isEmpty()?n.reason===3?(this.state&&this._setState(null),this.updateSoon.schedule()):this._setState(null):this._update())})),this._register(e.onDidChangeModel(n=>{this._setState(null)})),this._register(e.onDidChangeModelContent(n=>{this._isEnabled&&this.updateSoon.schedule()}));const i=to.get(e);i&&this._register(i.getState().onFindReplaceStateChange(n=>{this._update()})),this.updateSoon.schedule()}_update(){this._setState(b7._createState(this.state,this._isEnabled,this._isEnabledMultiline,this._maxLength,this.editor))}static _createState(e,t,i,n,s){if(!t||!s.hasModel())return null;if(!i){const h=s.getSelection();if(h.startLineNumber!==h.endLineNumber)return null}const r=$b.get(s);if(!r)return null;const a=to.get(s);if(!a)return null;let l=r.getSession(a);if(!l){const h=s.getSelections();if(h.length>1){const f=a.getState().matchCase;if(!xQ(s.getModel(),h,f))return null}l=V0.create(s,a)}if(!l||l.currentMatch||/^[ \t]+$/.test(l.searchText)||n>0&&l.searchText.length>n)return null;const c=a.getState(),d=c.matchCase;if(c.isRevealed){let h=c.searchString;d||(h=h.toLowerCase());let u=l.searchText;if(d||(u=u.toLowerCase()),h===u&&l.matchCase===c.matchCase&&l.wholeWord===c.wholeWord&&!c.isRegex)return null}return new CTe(s.getModel(),l.searchText,l.matchCase,l.wholeWord?s.getOption(148):null,e)}_setState(e){if(this.state=e,!this.state){this._decorations.clear();return}if(!this.editor.hasModel())return;const t=this.editor.getModel();if(t.isTooLargeForTokenization())return;const i=this.state.findMatches(),n=this.editor.getSelections();n.sort(k.compareRangesUsingStarts);const s=[];for(let c=0,d=0,h=i.length,u=n.length;c<h;){const f=i[c];if(d>=u)s.push(f),c++;else{const g=k.compareRangesUsingStarts(f,n[d]);g<0?((n[d].isEmpty()||!k.areIntersecting(f,n[d]))&&s.push(f),c++):(g>0||c++,d++)}}const r=this.editor.getOption(90)!=="off",a=this._languageFeaturesService.documentHighlightProvider.has(t)&&r,l=s.map(c=>({range:c,options:oTe(a)}));this._decorations.set(l)}dispose(){this._setState(null),super.dispose()}},b7=dm,dm.ID="editor.contrib.selectionHighlighter",dm);KD=b7=rTe([aTe(1,he)],KD);function xQ(o,e,t){const i=kQ(o,e[0],!t);for(let n=1,s=e.length;n<s;n++){const r=e[n];if(r.isEmpty())return!1;const a=kQ(o,r,!t);if(i!==a)return!1}return!0}function kQ(o,e,t){const i=o.getValueInRange(e);return t?i.toLowerCase():i}class vTe extends le{constructor(){super({id:"editor.action.focusNextCursor",label:H(1299,"Focus Next Cursor"),metadata:{description:p(1286,"Focuses the next cursor"),args:[]},precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.shift();r&&(s.push(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),cu(s,n.getCursorStates()))}}class wTe extends le{constructor(){super({id:"editor.action.focusPreviousCursor",label:H(1300,"Focus Previous Cursor"),metadata:{description:p(1287,"Focuses the previous cursor"),args:[]},precondition:void 0})}run(e,t,i){if(!t.hasModel())return;const n=t._getViewModel();if(n.cursorConfig.readOnly)return;n.model.pushStackElement();const s=Array.from(n.getCursorStates()),r=s.pop();r&&(s.unshift(r),n.setCursorStates(i.source,3,s),n.revealPrimaryCursor(i.source,!0),cu(s,n.getCursorStates()))}}Qe($b.ID,$b,4),Qe(KD.ID,KD,1),ne(lTe),ne(cTe),ne(dTe),ne(fTe),ne(gTe),ne(pTe),ne(mTe),ne(_Te),ne(bTe),ne(hTe),ne(uTe),ne(vTe),ne(wTe);const tp={Visible:new ae("parameterHintsVisible",!1),MultipleSignatures:new ae("parameterHintsMultipleSignatures",!1)};async function IQ(o,e,t,i,n){const s=o.ordered(e);for(const r of s)try{const a=await r.provideSignatureHelp(e,t,n,i);if(a)return a}catch(a){Di(a)}}Xe.registerCommand("_executeSignatureHelpProvider",async(o,...e)=>{const[t,i,n]=e;it(be.isUri(t)),it(M.isIPosition(i)),it(typeof n=="string"||!n);const s=o.get(he),r=await o.get(ns).createModelReference(t);try{const a=await IQ(s.signatureHelpProvider,r.object.textEditorModel,M.lift(i),{triggerKind:yl.Invoke,isRetrigger:!1,triggerCharacter:n},He.None);return a?(setTimeout(()=>a.dispose(),0),a.value):void 0}finally{r.dispose()}});var du;(function(o){o.Default={type:0};class e{constructor(n,s){this.request=n,this.previouslyActiveHints=s,this.type=2}}o.Pending=e;class t{constructor(n){this.hints=n,this.type=1}}o.Active=t})(du||(du={}));const cT=class cT extends A{constructor(e,t,i=cT.DEFAULT_DELAY){super(),this._onChangedHints=this._register(new P),this.onChangedHints=this._onChangedHints.event,this.triggerOnType=!1,this._state=du.Default,this._pendingTriggers=[],this._lastSignatureHelpResult=this._register(new ct),this.triggerChars=new Ky,this.retriggerChars=new Ky,this.triggerId=0,this.editor=e,this.providers=t,this.throttledDelayer=new fr(i),this._register(this.editor.onDidBlurEditorWidget(()=>this.cancel())),this._register(this.editor.onDidChangeConfiguration(()=>this.onEditorConfigurationChange())),this._register(this.editor.onDidChangeModel(n=>this.onModelChanged())),this._register(this.editor.onDidChangeModelLanguage(n=>this.onModelChanged())),this._register(this.editor.onDidChangeCursorSelection(n=>this.onCursorChange(n))),this._register(this.editor.onDidChangeModelContent(n=>this.onModelContentChange())),this._register(this.providers.onDidChange(this.onModelChanged,this)),this._register(this.editor.onDidType(n=>this.onDidType(n))),this.onEditorConfigurationChange(),this.onModelChanged()}get state(){return this._state}set state(e){this._state.type===2&&this._state.request.cancel(),this._state=e}cancel(e=!1){this.state=du.Default,this.throttledDelayer.cancel(),e||this._onChangedHints.fire(void 0)}trigger(e,t){const i=this.editor.getModel();if(!i||!this.providers.has(i))return;const n=++this.triggerId;this._pendingTriggers.push(e),this.throttledDelayer.trigger(()=>this.doTrigger(n),t).catch(Ee)}next(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t%e===e-1,n=this.editor.getOption(98).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?0:t+1)}previous(){if(this.state.type!==1)return;const e=this.state.hints.signatures.length,t=this.state.hints.activeSignature,i=t===0,n=this.editor.getOption(98).cycle;if((e<2||i)&&!n){this.cancel();return}this.updateActiveSignature(i&&n?e-1:t-1)}updateActiveSignature(e){this.state.type===1&&(this.state=new du.Active({...this.state.hints,activeSignature:e}),this._onChangedHints.fire(this.state.hints))}async doTrigger(e){const t=this.state.type===1||this.state.type===2,i=this.getLastActiveHints();if(this.cancel(!0),this._pendingTriggers.length===0)return!1;const n=this._pendingTriggers.reduce(STe);this._pendingTriggers=[];const s={triggerKind:n.triggerKind,triggerCharacter:n.triggerCharacter,isRetrigger:t,activeSignatureHelp:i};if(!this.editor.hasModel())return!1;const r=this.editor.getModel(),a=this.editor.getPosition();this.state=new du.Pending(Vi(l=>IQ(this.providers,r,a,s,l)),i);try{const l=await this.state.request;return e!==this.triggerId?(l?.dispose(),!1):!l||!l.value.signatures||l.value.signatures.length===0?(l?.dispose(),this._lastSignatureHelpResult.clear(),this.cancel(),!1):(this.state=new du.Active(l.value),this._lastSignatureHelpResult.value=l,this._onChangedHints.fire(this.state.hints),!0)}catch(l){return e===this.triggerId&&(this.state=du.Default),Ee(l),!1}}getLastActiveHints(){switch(this.state.type){case 1:return this.state.hints;case 2:return this.state.previouslyActiveHints;default:return}}get isTriggered(){return this.state.type===1||this.state.type===2||this.throttledDelayer.isTriggered()}onModelChanged(){this.cancel(),this.triggerChars.clear(),this.retriggerChars.clear();const e=this.editor.getModel();if(e)for(const t of this.providers.ordered(e)){for(const i of t.signatureHelpTriggerCharacters||[])if(i.length){const n=i.charCodeAt(0);this.triggerChars.add(n),this.retriggerChars.add(n)}for(const i of t.signatureHelpRetriggerCharacters||[])i.length&&this.retriggerChars.add(i.charCodeAt(0))}}onDidType(e){if(!this.triggerOnType)return;const t=e.length-1,i=e.charCodeAt(t);(this.triggerChars.has(i)||this.isTriggered&&this.retriggerChars.has(i))&&this.trigger({triggerKind:yl.TriggerCharacter,triggerCharacter:e.charAt(t)})}onCursorChange(e){e.source==="mouse"?this.cancel():this.isTriggered&&this.trigger({triggerKind:yl.ContentChange})}onModelContentChange(){this.isTriggered&&this.trigger({triggerKind:yl.ContentChange})}onEditorConfigurationChange(){this.triggerOnType=this.editor.getOption(98).enabled,this.triggerOnType||this.cancel()}dispose(){this.cancel(!0),super.dispose()}};cT.DEFAULT_DELAY=120;let C7=cT;function STe(o,e){switch(e.triggerKind){case yl.Invoke:return e;case yl.ContentChange:return o;case yl.TriggerCharacter:default:return e}}var yTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},v7=function(o,e){return function(t,i){e(t,i,o)}},w7;const tr=Q,LTe=Wt("parameter-hints-next",Y.chevronDown,p(1302,"Icon for show next parameter hint.")),xTe=Wt("parameter-hints-previous",Y.chevronUp,p(1303,"Icon for show previous parameter hint."));let S7=(hm=class extends A{constructor(e,t,i,n,s){super(),this.editor=e,this.model=t,this.renderDisposeables=this._register(new U),this.visible=!1,this.announcedLabel=null,this.allowEditorOverflow=!0,this.markdownRenderer=new fd({editor:e},s,n),this.keyVisible=tp.Visible.bindTo(i),this.keyMultipleSignatures=tp.MultipleSignatures.bindTo(i)}createParameterHintDOMNodes(){const e=tr(".editor-widget.parameter-hints-widget"),t=Z(e,tr(".phwrapper"));t.tabIndex=-1;const i=Z(t,tr(".controls")),n=Z(i,tr(".button"+ve.asCSSSelector(xTe))),s=Z(i,tr(".overloads")),r=Z(i,tr(".button"+ve.asCSSSelector(LTe)));this._register(W(n,"click",u=>{st.stop(u),this.previous()})),this._register(W(r,"click",u=>{st.stop(u),this.next()}));const a=tr(".body"),l=new Q1(a,{alwaysConsumeMouseWheel:!0});this._register(l),t.appendChild(l.getDomNode());const c=Z(a,tr(".signature")),d=Z(a,tr(".docs"));e.style.userSelect="text",this.domNodes={element:e,signature:c,overloads:s,docs:d,scrollbar:l},this.editor.addContentWidget(this),this.hide(),this._register(this.editor.onDidChangeCursorSelection(u=>{this.visible&&this.editor.layoutContentWidget(this)}));const h=()=>{if(!this.domNodes)return;const u=this.editor.getOption(59),f=this.domNodes.element;f.style.fontSize=`${u.fontSize}px`,f.style.lineHeight=`${u.lineHeight/u.fontSize}`,f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamily",u.fontFamily),f.style.setProperty("--vscode-parameterHintsWidget-editorFontFamilyDefault",bs.fontFamily)};h(),this._register(ie.chain(this.editor.onDidChangeConfiguration.bind(this.editor),u=>u.filter(f=>f.hasChanged(59)))(h)),this._register(this.editor.onDidLayoutChange(u=>this.updateMaxHeight())),this.updateMaxHeight()}show(){this.visible||(this.domNodes||this.createParameterHintDOMNodes(),this.keyVisible.set(!0),this.visible=!0,setTimeout(()=>{this.domNodes?.element.classList.add("visible")},100),this.editor.layoutContentWidget(this))}hide(){this.renderDisposeables.clear(),this.visible&&(this.keyVisible.reset(),this.visible=!1,this.announcedLabel=null,this.domNodes?.element.classList.remove("visible"),this.editor.layoutContentWidget(this))}getPosition(){return this.visible?{position:this.editor.getPosition(),preference:[1,2]}:null}render(e){if(this.renderDisposeables.clear(),!this.domNodes)return;const t=e.signatures.length>1;this.domNodes.element.classList.toggle("multiple",t),this.keyMultipleSignatures.set(t),this.domNodes.signature.innerText="",this.domNodes.docs.innerText="";const i=e.signatures[e.activeSignature];if(!i)return;const n=Z(this.domNodes.signature,tr(".code")),s=i.parameters.length>0,r=i.activeParameter??e.activeParameter;if(s)this.renderParameters(n,i,r);else{const c=Z(n,tr("span"));c.textContent=i.label}const a=i.parameters[r];if(a?.documentation){const c=tr("span.documentation");if(typeof a.documentation=="string")c.textContent=a.documentation;else{const d=this.renderMarkdownDocs(a.documentation);c.appendChild(d.element)}Z(this.domNodes.docs,tr("p",{},c))}if(i.documentation!==void 0)if(typeof i.documentation=="string")Z(this.domNodes.docs,tr("p",{},i.documentation));else{const c=this.renderMarkdownDocs(i.documentation);Z(this.domNodes.docs,c.element)}const l=this.hasDocs(i,a);if(this.domNodes.signature.classList.toggle("has-docs",l),this.domNodes.docs.classList.toggle("empty",!l),this.domNodes.overloads.textContent=String(e.activeSignature+1).padStart(e.signatures.length.toString().length,"0")+"/"+e.signatures.length,a){let c="";const d=i.parameters[r];Array.isArray(d.label)?c=i.label.substring(d.label[0],d.label[1]):c=d.label,d.documentation&&(c+=typeof d.documentation=="string"?`, ${d.documentation}`:`, ${d.documentation.value}`),i.documentation&&(c+=typeof i.documentation=="string"?`, ${i.documentation}`:`, ${i.documentation.value}`),this.announcedLabel!==c&&(ps(p(1304,"{0}, hint",c)),this.announcedLabel=c)}this.editor.layoutContentWidget(this),this.domNodes.scrollbar.scanDomNode()}renderMarkdownDocs(e){const t=this.renderDisposeables.add(this.markdownRenderer.render(e,{asyncRenderCallback:()=>{this.domNodes?.scrollbar.scanDomNode()}}));return t.element.classList.add("markdown-docs"),t}hasDocs(e,t){return!!(t&&typeof t.documentation=="string"&&Qd(t.documentation).length>0||t&&typeof t.documentation=="object"&&Qd(t.documentation).value.length>0||e.documentation&&typeof e.documentation=="string"&&Qd(e.documentation).length>0||e.documentation&&typeof e.documentation=="object"&&Qd(e.documentation.value).length>0)}renderParameters(e,t,i){const[n,s]=this.getParameterLabelOffsets(t,i),r=document.createElement("span");r.textContent=t.label.substring(0,n);const a=document.createElement("span");a.textContent=t.label.substring(n,s),a.className="parameter active";const l=document.createElement("span");l.textContent=t.label.substring(s),Z(e,r,a,l)}getParameterLabelOffsets(e,t){const i=e.parameters[t];if(i){if(Array.isArray(i.label))return i.label;if(i.label.length){const n=new RegExp(`(\\W|^)${oo(i.label)}(?=\\W|$)`,"g");n.test(e.label);const s=n.lastIndex-i.label.length;return s>=0?[s,n.lastIndex]:[0,0]}else return[0,0]}else return[0,0]}next(){this.editor.focus(),this.model.next()}previous(){this.editor.focus(),this.model.previous()}getDomNode(){return this.domNodes||this.createParameterHintDOMNodes(),this.domNodes.element}getId(){return w7.ID}updateMaxHeight(){if(!this.domNodes)return;const t=`${Math.max(this.editor.getLayoutInfo().height/4,250)}px`;this.domNodes.element.style.maxHeight=t;const i=this.domNodes.element.getElementsByClassName("phwrapper");i.length&&(i[0].style.maxHeight=t)}},w7=hm,hm.ID="editor.widget.parameterHintsWidget",hm);S7=w7=yTe([v7(2,xe),v7(3,Js),v7(4,Mt)],S7),N("editorHoverWidget.highlightForeground",d_,p(1305,"Foreground color of the active item in the parameter hint."));var kTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},DQ=function(o,e){return function(t,i){e(t,i,o)}},y7;let qb=(um=class extends A{static get(e){return e.getContribution(y7.ID)}constructor(e,t,i){super(),this.editor=e,this.model=this._register(new C7(e,i.signatureHelpProvider)),this._register(this.model.onChangedHints(n=>{n?(this.widget.value.show(),this.widget.value.render(n)):this.widget.rawValue?.hide()})),this.widget=new Ln(()=>this._register(t.createInstance(S7,this.editor,this.model)))}cancel(){this.model.cancel()}previous(){this.widget.rawValue?.previous()}next(){this.widget.rawValue?.next()}trigger(e){this.model.trigger(e,0)}},y7=um,um.ID="editor.controller.parameterHints",um);qb=y7=kTe([DQ(1,ge),DQ(2,he)],qb);class ITe extends le{constructor(){super({id:"editor.action.triggerParameterHints",label:H(1301,"Trigger Parameter Hints"),precondition:T.hasSignatureHelpProvider,kbOpts:{kbExpr:T.editorTextFocus,primary:3082,weight:100}})}run(e,t){qb.get(t)?.trigger({triggerKind:yl.Invoke})}}Qe(qb.ID,qb,2),ne(ITe);const L7=175,x7=Bi.bindToContribution(qb.get);re(new x7({id:"closeParameterHints",precondition:tp.Visible,handler:o=>o.cancel(),kbOpts:{weight:L7,kbExpr:T.focus,primary:9,secondary:[1033]}})),re(new x7({id:"showPrevParameterHint",precondition:K.and(tp.Visible,tp.MultipleSignatures),handler:o=>o.previous(),kbOpts:{weight:L7,kbExpr:T.focus,primary:16,secondary:[528],mac:{primary:16,secondary:[528,302]}}})),re(new x7({id:"showNextParameterHint",precondition:K.and(tp.Visible,tp.MultipleSignatures),handler:o=>o.next(),kbOpts:{weight:L7,kbExpr:T.focus,primary:18,secondary:[530],mac:{primary:18,secondary:[530,300]}}}));const gB=class gB extends A{constructor(e){super(),this._editor=e,this._editorObs=ni(this._editor),this._placeholderText=this._editorObs.getOption(100),this._state=In({owner:this,equalsFn:$R},t=>{const i=this._placeholderText.read(t);if(i&&this._editorObs.valueIsEmpty.read(t))return{placeholder:i}}),this._shouldViewBeAlive=DTe(this,t=>this._state.read(t)?.placeholder!==void 0),this._view=j(t=>{if(!this._shouldViewBeAlive.read(t))return;const i=Je("div.editorPlaceholder");t.store.add(Se(n=>{const s=this._state.read(n),r=s?.placeholder!==void 0;i.root.style.display=r?"block":"none",i.root.innerText=s?.placeholder??""})),t.store.add(Se(n=>{const s=this._editorObs.layoutInfo.read(n);i.root.style.left=`${s.contentLeft}px`,i.root.style.width=s.contentWidth-s.verticalScrollbarWidth+"px",i.root.style.top=`${this._editor.getTopForLineNumber(0)}px`})),t.store.add(Se(n=>{i.root.style.fontFamily=this._editorObs.getOption(58).read(n),i.root.style.fontSize=this._editorObs.getOption(61).read(n)+"px",i.root.style.lineHeight=this._editorObs.getOption(75).read(n)+"px"})),t.store.add(this._editorObs.createOverlayWidget({allowEditorOverflow:!1,minContentWidthInPx:Et(0),position:Et(null),domNode:i.root}))}),this._view.recomputeInitiallyAndOnChange(this._store)}};gB.ID="editor.contrib.placeholderText";let GD=gB;function DTe(o,e){return Tc(o,(t,i)=>i===!0?!0:e(t))}var ETe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},NTe=function(o,e){return function(t,i){e(t,i,o)}};class TTe{constructor(e){this.instantiationService=e}init(...e){}}function RTe(o){return o()}let EQ=class extends TTe{constructor(e,t){super(t),this.init(e)}};EQ=ETe([NTe(1,ge)],EQ),Qe(GD.ID,RTe(()=>GD),0),N("editor.placeholder.foreground",Qde,p(1324,"Foreground color of the placeholder text in the editor."));const ZD=We("textResourceConfigurationService"),NQ=We("textResourcePropertiesService");var MTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},YD=function(o,e){return function(t,i){e(t,i,o)}};const Kb=new ae("renameInputVisible",!1,p(1376,"Whether the rename input widget is visible"));new ae("renameInputFocused",!1,p(1377,"Whether the rename input widget is focused"));let k7=class{constructor(e,t,i,n,s,r){this._editor=e,this._acceptKeybindings=t,this._themeService=i,this._keybindingService=n,this._logService=r,this.allowEditorOverflow=!0,this._disposables=new U,this._visibleContextKey=Kb.bindTo(s),this._isEditingRenameCandidate=!1,this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,this._candidates=new Set,this._beforeFirstInputFieldEditSW=new Ki,this._inputWithButton=new PTe,this._disposables.add(this._inputWithButton),this._editor.addContentWidget(this),this._disposables.add(this._editor.onDidChangeConfiguration(a=>{a.hasChanged(59)&&this._updateFont()})),this._disposables.add(i.onDidColorThemeChange(this._updateStyles,this))}dispose(){this._disposables.dispose(),this._editor.removeContentWidget(this)}getId(){return"__renameInputWidget"}getDomNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="monaco-editor rename-box",this._domNode.appendChild(this._inputWithButton.domNode),this._renameCandidateListView=this._disposables.add(new I7(this._domNode,{fontInfo:this._editor.getOption(59),onFocusChange:e=>{this._inputWithButton.input.value=e,this._isEditingRenameCandidate=!1},onSelectionChange:()=>{this._isEditingRenameCandidate=!1,this.acceptInput(!1)}})),this._disposables.add(this._inputWithButton.onDidInputChange(()=>{this._renameCandidateListView?.focusedCandidate!==void 0&&(this._isEditingRenameCandidate=!0),this._timeBeforeFirstInputFieldEdit??=this._beforeFirstInputFieldEditSW.elapsed(),this._renameCandidateProvidersCts?.token.isCancellationRequested===!1&&this._renameCandidateProvidersCts.cancel(),this._renameCandidateListView?.clearFocus()})),this._label=document.createElement("div"),this._label.className="rename-label",this._domNode.appendChild(this._label),this._updateFont(),this._updateStyles(this._themeService.getColorTheme())),this._domNode}_updateStyles(e){if(!this._domNode)return;const t=e.getColor(a_),i=e.getColor(lM);this._domNode.style.backgroundColor=String(e.getColor(Ho)??""),this._domNode.style.boxShadow=t?` 0 0 8px 2px ${t}`:"",this._domNode.style.border=i?`1px solid ${i}`:"",this._domNode.style.color=String(e.getColor(QV)??"");const n=e.getColor(JV);this._inputWithButton.domNode.style.backgroundColor=String(e.getColor(pM)??""),this._inputWithButton.input.style.backgroundColor=String(e.getColor(pM)??""),this._inputWithButton.domNode.style.borderWidth=n?"1px":"0px",this._inputWithButton.domNode.style.borderStyle=n?"solid":"none",this._inputWithButton.domNode.style.borderColor=n?.toString()??"none"}_updateFont(){if(this._domNode===void 0)return;it(this._label!==void 0,"RenameWidget#_updateFont: _label must not be undefined given _domNode is defined"),this._editor.applyFontInfo(this._inputWithButton.input);const e=this._editor.getOption(59);this._label.style.fontSize=`${this._computeLabelFontSize(e.fontSize)}px`}_computeLabelFontSize(e){return e*.8}getPosition(){if(!this._visible||!this._editor.hasModel()||!this._editor.getDomNode())return null;const e=rh(this.getDomNode().ownerDocument.body),t=mi(this._editor.getDomNode()),i=this._getTopForPosition();this._nPxAvailableAbove=i+t.top,this._nPxAvailableBelow=e.height-this._nPxAvailableAbove;const n=this._editor.getOption(75),{totalHeight:s}=z0.getLayoutInfo({lineHeight:n}),r=this._nPxAvailableBelow>s*6?[2,1]:[1,2];return{position:this._position,preference:r}}beforeRender(){const[e,t]=this._acceptKeybindings;return this._label.innerText=p(1378,"{0} to Rename, {1} to Preview",this._keybindingService.lookupKeybinding(e)?.getLabel(),this._keybindingService.lookupKeybinding(t)?.getLabel()),this._domNode.style.minWidth="200px",null}afterRender(e){if(e===null){this.cancelInput(!0,"afterRender (because position is null)");return}if(!this._editor.hasModel()||!this._editor.getDomNode())return;it(this._renameCandidateListView),it(this._nPxAvailableAbove!==void 0),it(this._nPxAvailableBelow!==void 0);const t=Rc(this._inputWithButton.domNode),i=Rc(this._label);let n;e===2?n=this._nPxAvailableBelow:n=this._nPxAvailableAbove,this._renameCandidateListView.layout({height:n-i-t,width:ho(this._inputWithButton.domNode)})}acceptInput(e){this._trace("invoking acceptInput"),this._currentAcceptInput?.(e)}cancelInput(e,t){this._currentCancelInput?.(e)}focusNextRenameSuggestion(){this._renameCandidateListView?.focusNext()||(this._inputWithButton.input.value=this._currentName)}focusPreviousRenameSuggestion(){this._renameCandidateListView?.focusPrevious()||(this._inputWithButton.input.value=this._currentName)}getInput(e,t,i,n,s){const{start:r,end:a}=this._getSelection(e,t);this._renameCts=s;const l=new U;this._nRenameSuggestionsInvocations=0,this._hadAutomaticRenameSuggestionsInvocation=!1,n===void 0?this._inputWithButton.button.style.display="none":(this._inputWithButton.button.style.display="flex",this._requestRenameCandidatesOnce=n,this._requestRenameCandidates(t,!1),l.add(W(this._inputWithButton.button,"click",()=>this._requestRenameCandidates(t,!0))),l.add(W(this._inputWithButton.button,te.KEY_DOWN,d=>{const h=new St(d);(h.equals(3)||h.equals(10))&&(h.stopPropagation(),h.preventDefault(),this._requestRenameCandidates(t,!0))}))),this._isEditingRenameCandidate=!1,this._domNode.classList.toggle("preview",i),this._position=new M(e.startLineNumber,e.startColumn),this._currentName=t,this._inputWithButton.input.value=t,this._inputWithButton.input.setAttribute("selectionStart",r.toString()),this._inputWithButton.input.setAttribute("selectionEnd",a.toString()),this._inputWithButton.input.size=Math.max((e.endColumn-e.startColumn)*1.1,20),this._beforeFirstInputFieldEditSW.reset(),l.add(ue(()=>{this._renameCts=void 0,s.dispose(!0)})),l.add(ue(()=>{this._renameCandidateProvidersCts!==void 0&&(this._renameCandidateProvidersCts.dispose(!0),this._renameCandidateProvidersCts=void 0)})),l.add(ue(()=>this._candidates.clear()));const c=new Ju;return c.p.finally(()=>{l.dispose(),this._hide()}),this._currentCancelInput=d=>(this._trace("invoking _currentCancelInput"),this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView?.clearCandidates(),c.complete(d),!0),this._currentAcceptInput=d=>{this._trace("invoking _currentAcceptInput"),it(this._renameCandidateListView!==void 0);const h=this._renameCandidateListView.nCandidates;let u,f;const g=this._renameCandidateListView.focusedCandidate;if(g!==void 0?(this._trace("using new name from renameSuggestion"),u=g,f={k:"renameSuggestion"}):(this._trace("using new name from inputField"),u=this._inputWithButton.input.value,f=this._isEditingRenameCandidate?{k:"userEditedRenameSuggestion"}:{k:"inputField"}),u===t||u.trim().length===0){this.cancelInput(!0,"_currentAcceptInput (because newName === value || newName.trim().length === 0)");return}this._currentAcceptInput=void 0,this._currentCancelInput=void 0,this._renameCandidateListView.clearCandidates(),c.complete({newName:u,wantsPreview:i&&d,stats:{source:f,nRenameSuggestions:h,timeBeforeFirstInputFieldEdit:this._timeBeforeFirstInputFieldEdit,nRenameSuggestionsInvocations:this._nRenameSuggestionsInvocations,hadAutomaticRenameSuggestionsInvocation:this._hadAutomaticRenameSuggestionsInvocation}})},l.add(s.token.onCancellationRequested(()=>this.cancelInput(!0,"cts.token.onCancellationRequested"))),l.add(this._editor.onDidBlurEditorWidget(()=>this.cancelInput(!this._domNode?.ownerDocument.hasFocus(),"editor.onDidBlurEditorWidget"))),this._show(),c.p}_requestRenameCandidates(e,t){if(this._requestRenameCandidatesOnce!==void 0&&(this._renameCandidateProvidersCts!==void 0&&this._renameCandidateProvidersCts.dispose(!0),it(this._renameCts),this._inputWithButton.buttonState!=="stop")){this._renameCandidateProvidersCts=new Xt;const i=t?lv.Invoke:lv.Automatic,n=this._requestRenameCandidatesOnce(i,this._renameCandidateProvidersCts.token);if(n.length===0){this._inputWithButton.setSparkleButton();return}t||(this._hadAutomaticRenameSuggestionsInvocation=!0),this._nRenameSuggestionsInvocations+=1,this._inputWithButton.setStopButton(),this._updateRenameCandidates(n,e,this._renameCts.token)}}_getSelection(e,t){it(this._editor.hasModel());const i=this._editor.getSelection();let n=0,s=t.length;return!k.isEmpty(i)&&!k.spansMultipleLines(i)&&k.containsRange(e,i)&&(n=Math.max(0,i.startColumn-e.startColumn),s=Math.min(e.endColumn,i.endColumn)-e.startColumn),{start:n,end:s}}_show(){this._trace("invoking _show"),this._editor.revealLineInCenterIfOutsideViewport(this._position.lineNumber,0),this._visible=!0,this._visibleContextKey.set(!0),this._editor.layoutContentWidget(this),setTimeout(()=>{this._inputWithButton.input.focus(),this._inputWithButton.input.setSelectionRange(parseInt(this._inputWithButton.input.getAttribute("selectionStart")),parseInt(this._inputWithButton.input.getAttribute("selectionEnd")))},100)}async _updateRenameCandidates(e,t,i){const n=(...c)=>this._trace("_updateRenameCandidates",...c);n("start");const s=await Em(Promise.allSettled(e),i);if(this._inputWithButton.setSparkleButton(),s===void 0){n("returning early - received updateRenameCandidates results - undefined");return}const r=s.flatMap(c=>c.status==="fulfilled"&&sn(c.value)?c.value:[]);n(`received updateRenameCandidates results - total (unfiltered) ${r.length} candidates.`);const a=Dc(r,c=>c.newSymbolName);n(`distinct candidates - ${a.length} candidates.`);const l=a.filter(({newSymbolName:c})=>c.trim().length>0&&c!==this._inputWithButton.input.value&&c!==t&&!this._candidates.has(c));if(n(`valid distinct candidates - ${r.length} candidates.`),l.forEach(c=>this._candidates.add(c.newSymbolName)),l.length<1){n("returning early - no valid distinct candidates");return}n("setting candidates"),this._renameCandidateListView.setCandidates(l),n("asking editor to re-layout"),this._editor.layoutContentWidget(this)}_hide(){this._trace("invoked _hide"),this._visible=!1,this._visibleContextKey.reset(),this._editor.layoutContentWidget(this)}_getTopForPosition(){const e=this._editor.getVisibleRanges();let t;return e.length>0?t=e[0].startLineNumber:(this._logService.warn("RenameWidget#_getTopForPosition: this should not happen - visibleRanges is empty"),t=Math.max(1,this._position.lineNumber-5)),this._editor.getTopForLineNumber(this._position.lineNumber)-this._editor.getTopForLineNumber(t)}_trace(...e){this._logService.trace("RenameWidget",...e)}};k7=MTe([YD(2,li),YD(3,ot),YD(4,xe),YD(5,Rt)],k7);class I7{constructor(e,t){this._disposables=new U,this._availableHeight=0,this._minimumWidth=0,this._lineHeight=t.fontInfo.lineHeight,this._typicalHalfwidthCharacterWidth=t.fontInfo.typicalHalfwidthCharacterWidth,this._listContainer=document.createElement("div"),this._listContainer.className="rename-box rename-candidate-list-container",e.appendChild(this._listContainer),this._listWidget=I7._createListWidget(this._listContainer,this._candidateViewHeight,t.fontInfo),this._disposables.add(this._listWidget.onDidChangeFocus(i=>{i.elements.length===1&&t.onFocusChange(i.elements[0].newSymbolName)},this._disposables)),this._disposables.add(this._listWidget.onDidChangeSelection(i=>{i.elements.length===1&&t.onSelectionChange()},this._disposables)),this._disposables.add(this._listWidget.onDidBlur(i=>{this._listWidget.setFocus([])})),this._listWidget.style(vg({listInactiveFocusForeground:q1,listInactiveFocusBackground:K1}))}dispose(){this._listWidget.dispose(),this._disposables.dispose()}layout({height:e,width:t}){this._availableHeight=e,this._minimumWidth=t}setCandidates(e){this._listWidget.splice(0,0,e);const t=this._pickListHeight(this._listWidget.length),i=this._pickListWidth(e);this._listWidget.layout(t,i),this._listContainer.style.height=`${t}px`,this._listContainer.style.width=`${i}px`,cl(p(1379,"Received {0} rename suggestions",e.length))}clearCandidates(){this._listContainer.style.height="0px",this._listContainer.style.width="0px",this._listWidget.splice(0,this._listWidget.length,[])}get nCandidates(){return this._listWidget.length}get focusedCandidate(){if(this._listWidget.length===0)return;const e=this._listWidget.getSelectedElements()[0];if(e!==void 0)return e.newSymbolName;const t=this._listWidget.getFocusedElements()[0];if(t!==void 0)return t.newSymbolName}focusNext(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0)return this._listWidget.focusFirst(),this._listWidget.reveal(0),!0;if(e[0]===this._listWidget.length-1)return this._listWidget.setFocus([]),this._listWidget.reveal(0),!1;{this._listWidget.focusNext();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}focusPrevious(){if(this._listWidget.length===0)return!1;const e=this._listWidget.getFocus();if(e.length===0){this._listWidget.focusLast();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}else{if(e[0]===0)return this._listWidget.setFocus([]),!1;{this._listWidget.focusPrevious();const t=this._listWidget.getFocus()[0];return this._listWidget.reveal(t),!0}}}clearFocus(){this._listWidget.setFocus([])}get _candidateViewHeight(){const{totalHeight:e}=z0.getLayoutInfo({lineHeight:this._lineHeight});return e}_pickListHeight(e){const t=this._candidateViewHeight*e;return Math.min(t,this._availableHeight,this._candidateViewHeight*7)}_pickListWidth(e){const t=Math.ceil(Math.max(...e.map(n=>n.newSymbolName.length))*this._typicalHalfwidthCharacterWidth);return Math.max(this._minimumWidth,25+t+10)}static _createListWidget(e,t,i){const n=new class{getTemplateId(r){return"candidate"}getHeight(r){return t}},s=new class{constructor(){this.templateId="candidate"}renderTemplate(r){return new z0(r,i)}renderElement(r,a,l){l.populate(r)}disposeTemplate(r){r.dispose()}};return new jo("NewSymbolNameCandidates",e,n,[s],{keyboardSupport:!1,mouseSupport:!0,multipleSelectionSupport:!1})}}class PTe{constructor(){this._buttonHoverContent="",this._onDidInputChange=new P,this.onDidInputChange=this._onDidInputChange.event,this._disposables=new U}get domNode(){return this._domNode||(this._domNode=document.createElement("div"),this._domNode.className="rename-input-with-button",this._domNode.style.display="flex",this._domNode.style.flexDirection="row",this._domNode.style.alignItems="center",this._inputNode=document.createElement("input"),this._inputNode.className="rename-input",this._inputNode.type="text",this._inputNode.style.border="none",this._inputNode.setAttribute("aria-label",p(1380,"Rename input. Type new name and press Enter to commit.")),this._domNode.appendChild(this._inputNode),this._buttonNode=document.createElement("div"),this._buttonNode.className="rename-suggestions-button",this._buttonNode.setAttribute("tabindex","0"),this._buttonGenHoverText=p(1381,"Generate new name suggestions"),this._buttonCancelHoverText=p(1382,"Cancel"),this._buttonHoverContent=this._buttonGenHoverText,this._disposables.add(ta().setupDelayedHover(this._buttonNode,()=>({content:this._buttonHoverContent,appearance:{showPointer:!0,compact:!0}}))),this._domNode.appendChild(this._buttonNode),this._disposables.add(W(this.input,te.INPUT,()=>this._onDidInputChange.fire())),this._disposables.add(W(this.input,te.KEY_DOWN,e=>{const t=new St(e);(t.keyCode===15||t.keyCode===17)&&this._onDidInputChange.fire()})),this._disposables.add(W(this.input,te.CLICK,()=>this._onDidInputChange.fire())),this._disposables.add(W(this.input,te.FOCUS,()=>{this.domNode.style.outlineWidth="1px",this.domNode.style.outlineStyle="solid",this.domNode.style.outlineOffset="-1px",this.domNode.style.outlineColor="var(--vscode-focusBorder)"})),this._disposables.add(W(this.input,te.BLUR,()=>{this.domNode.style.outline="none"}))),this._domNode}get input(){return it(this._inputNode),this._inputNode}get button(){return it(this._buttonNode),this._buttonNode}get buttonState(){return this._buttonState}setSparkleButton(){this._buttonState="sparkle",this._sparkleIcon??=Al(Y.sparkle),pn(this.button),this.button.appendChild(this._sparkleIcon),this.button.setAttribute("aria-label","Generating new name suggestions"),this._buttonHoverContent=this._buttonGenHoverText,this.input.focus()}setStopButton(){this._buttonState="stop",this._stopIcon??=Al(Y.stopCircle),pn(this.button),this.button.appendChild(this._stopIcon),this.button.setAttribute("aria-label","Cancel generating new name suggestions"),this._buttonHoverContent=this._buttonCancelHoverText,this.input.focus()}dispose(){this._disposables.dispose()}}const AS=class AS{constructor(e,t){this._domNode=document.createElement("div"),this._domNode.className="rename-box rename-candidate",this._domNode.style.display="flex",this._domNode.style.columnGap="5px",this._domNode.style.alignItems="center",this._domNode.style.height=`${t.lineHeight}px`,this._domNode.style.padding=`${AS._PADDING}px`;const i=document.createElement("div");i.style.display="flex",i.style.alignItems="center",i.style.width=i.style.height=`${t.lineHeight*.8}px`,this._domNode.appendChild(i),this._icon=Al(Y.sparkle),this._icon.style.display="none",i.appendChild(this._icon),this._label=document.createElement("div"),dn(this._label,t),this._domNode.appendChild(this._label),e.appendChild(this._domNode)}populate(e){this._updateIcon(e),this._updateLabel(e)}_updateIcon(e){const t=!!e.tags?.includes(zM.AIGenerated);this._icon.style.display=t?"inherit":"none"}_updateLabel(e){this._label.innerText=e.newSymbolName}static getLayoutInfo({lineHeight:e}){return{totalHeight:e+AS._PADDING*2}}dispose(){}};AS._PADDING=2;let z0=AS;var ATe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ip=function(o,e){return function(t,i){e(t,i,o)}},D7;class E7{constructor(e,t,i){this.model=e,this.position=t,this._providerRenameIdx=0,this._providers=i.ordered(e)}hasProvider(){return this._providers.length>0}async resolveRenameLocation(e){const t=[];for(this._providerRenameIdx=0;this._providerRenameIdx<this._providers.length;this._providerRenameIdx++){const n=this._providers[this._providerRenameIdx];if(!n.resolveRenameLocation)break;const s=await n.resolveRenameLocation(this.model,this.position,e);if(s){if(s.rejectReason){t.push(s.rejectReason);continue}return s}}this._providerRenameIdx=0;const i=this.model.getWordAtPosition(this.position);return i?{range:new k(this.position.lineNumber,i.startColumn,this.position.lineNumber,i.endColumn),text:i.word,rejectReason:t.length>0?t.join(`
`):void 0}:{range:k.fromPositions(this.position),text:"",rejectReason:t.length>0?t.join(`
`):void 0}}async provideRenameEdits(e,t){return this._provideRenameEdits(e,this._providerRenameIdx,[],t)}async _provideRenameEdits(e,t,i,n){const s=this._providers[t];if(!s)return{edits:[],rejectReason:i.join(`
`)};const r=await s.provideRenameEdits(this.model,this.position,e,n);if(r){if(r.rejectReason)return this._provideRenameEdits(e,t+1,i.concat(r.rejectReason),n)}else return this._provideRenameEdits(e,t+1,i.concat(p(1365,"No result.")),n);return r}}async function OTe(o,e,t,i){const n=new E7(e,t,o),s=await n.resolveRenameLocation(He.None);return s?.rejectReason?{edits:[],rejectReason:s.rejectReason}:n.provideRenameEdits(i,He.None)}let hu=(fm=class{static get(e){return e.getContribution(D7.ID)}constructor(e,t,i,n,s,r,a,l){this.editor=e,this._instaService=t,this._notificationService=i,this._bulkEditService=n,this._progressService=s,this._logService=r,this._configService=a,this._languageFeaturesService=l,this._disposableStore=new U,this._cts=new Xt,this._renameWidget=this._disposableStore.add(this._instaService.createInstance(k7,this.editor,["acceptRenameInput","acceptRenameInputWithPreview"]))}dispose(){this._disposableStore.dispose(),this._cts.dispose(!0)}async run(){const e=this._logService.trace.bind(this._logService,"[rename]");if(this._cts.dispose(!0),this._cts=new Xt,!this.editor.hasModel()){e("editor has no model");return}const t=this.editor.getPosition(),i=new E7(this.editor.getModel(),t,this._languageFeaturesService.renameProvider);if(!i.hasProvider()){e("skeleton has no provider");return}const n=new ud(this.editor,5,void 0,this._cts.token);let s;try{e("resolving rename location");const g=i.resolveRenameLocation(n.token);this._progressService.showWhile(g,250),s=await g,e("resolved rename location")}catch(g){g instanceof cr?e("resolve rename location cancelled",JSON.stringify(g,null," ")):(e("resolve rename location failed",g instanceof Error?g:JSON.stringify(g,null," ")),(typeof g=="string"||Rl(g))&&So.get(this.editor)?.showMessage(g||p(1366,"An unknown error occurred while resolving rename location"),t));return}finally{n.dispose()}if(!s){e("returning early - no loc");return}if(s.rejectReason){e(`returning early - rejected with reason: ${s.rejectReason}`,s.rejectReason),So.get(this.editor)?.showMessage(s.rejectReason,t);return}if(n.token.isCancellationRequested){e("returning early - cts1 cancelled");return}const r=new ud(this.editor,5,s.range,this._cts.token),a=this.editor.getModel(),l=this._languageFeaturesService.newSymbolNamesProvider.all(a),c=await Promise.all(l.map(async g=>[g,await g.supportsAutomaticNewSymbolNamesTriggerKind??!1])),d=(g,m)=>{let _=c.slice();return g===lv.Automatic&&(_=_.filter(([b,C])=>C)),_.map(([b])=>b.provideNewSymbolNames(a,s.range,g,m))};e("creating rename input field and awaiting its result");const h=this._bulkEditService.hasPreviewHandler()&&this._configService.getValue(this.editor.getModel().uri,"editor.rename.enablePreview"),u=await this._renameWidget.getInput(s.range,s.text,h,l.length>0?d:void 0,r);if(e("received response from rename input field"),typeof u=="boolean"){e(`returning early - rename input field response - ${u}`),u&&this.editor.focus(),r.dispose();return}this.editor.focus(),e("requesting rename edits");const f=Em(i.provideRenameEdits(u.newName,r.token),r.token).then(async g=>{if(!g){e("returning early - no rename edits result");return}if(!this.editor.hasModel()){e("returning early - no model after rename edits are provided");return}if(g.rejectReason){e(`returning early - rejected with reason: ${g.rejectReason}`),this._notificationService.info(g.rejectReason);return}this.editor.setSelection(k.fromPositions(this.editor.getSelection().getPosition())),e("applying edits"),this._bulkEditService.apply(g,{editor:this.editor,showPreview:u.wantsPreview,label:p(1367,"Renaming '{0}' to '{1}'",s?.text,u.newName),code:"undoredo.rename",quotableLabel:p(1368,"Renaming {0} to {1}",s?.text,u.newName),respectAutoSaveConfig:!0,reason:jn.rename()}).then(m=>{e("edits applied"),m.ariaSummary&&ps(p(1369,"Successfully renamed '{0}' to '{1}'. Summary: {2}",s.text,u.newName,m.ariaSummary))}).catch(m=>{e(`error when applying edits ${JSON.stringify(m,null," ")}`),this._notificationService.error(p(1370,"Rename failed to apply edits")),this._logService.error(m)})},g=>{e("error when providing rename edits",JSON.stringify(g,null," ")),this._notificationService.error(p(1371,"Rename failed to compute edits")),this._logService.error(g)}).finally(()=>{r.dispose()});return e("returning rename operation"),this._progressService.showWhile(f,250),f}acceptRenameInput(e){this._renameWidget.acceptInput(e)}cancelRenameInput(){this._renameWidget.cancelInput(!0,"cancelRenameInput command")}focusNextRenameSuggestion(){this._renameWidget.focusNextRenameSuggestion()}focusPreviousRenameSuggestion(){this._renameWidget.focusPreviousRenameSuggestion()}},D7=fm,fm.ID="editor.contrib.renameController",fm);hu=D7=ATe([ip(1,ge),ip(2,hi),ip(3,yw),ip(4,sd),ip(5,Rt),ip(6,ZD),ip(7,he)],hu);class FTe extends le{constructor(){super({id:"editor.action.rename",label:H(1373,"Rename Symbol"),precondition:K.and(T.writable,T.hasRenameProvider),kbOpts:{kbExpr:T.editorTextFocus,primary:60,weight:100},contextMenuOpts:{group:"1_modification",order:1.1}})}runCommand(e,t){const i=e.get(et),[n,s]=Array.isArray(t)&&t||[void 0,void 0];return be.isUri(n)&&M.isIPosition(s)?i.openCodeEditor({resource:n},i.getActiveCodeEditor()).then(r=>{r&&(r.setPosition(s),r.invokeWithinContext(a=>(this.reportTelemetry(a,r),this.run(a,r))))},Ee):super.runCommand(e,t)}run(e,t){const i=e.get(Rt),n=hu.get(t);return n?(i.trace("[RenameAction] got controller, running..."),n.run()):(i.trace("[RenameAction] returning early - controller missing"),Promise.resolve())}}Qe(hu.ID,hu,4),ne(FTe);const N7=Bi.bindToContribution(hu.get);re(new N7({id:"acceptRenameInput",precondition:Kb,handler:o=>o.acceptRenameInput(!1),kbOpts:{weight:199,kbExpr:K.and(T.focus,K.not("isComposing")),primary:3}})),re(new N7({id:"acceptRenameInputWithPreview",precondition:K.and(Kb,K.has("config.editor.rename.enablePreview")),handler:o=>o.acceptRenameInput(!0),kbOpts:{weight:199,kbExpr:K.and(T.focus,K.not("isComposing")),primary:2051}})),re(new N7({id:"cancelRenameInput",precondition:Kb,handler:o=>o.cancelRenameInput(),kbOpts:{weight:199,kbExpr:T.focus,primary:9,secondary:[1033]}})),mt(class extends ln{constructor(){super({id:"focusNextRenameSuggestion",title:{...H(1374,"Focus Next Rename Suggestion")},precondition:Kb,keybinding:[{primary:18,weight:199}]})}run(e){const t=e.get(et).getFocusedCodeEditor();if(!t)return;const i=hu.get(t);i&&i.focusNextRenameSuggestion()}}),mt(class extends ln{constructor(){super({id:"focusPreviousRenameSuggestion",title:{...H(1375,"Focus Previous Rename Suggestion")},precondition:Kb,keybinding:[{primary:16,weight:199}]})}run(e){const t=e.get(et).getFocusedCodeEditor();if(!t)return;const i=hu.get(t);i&&i.focusPreviousRenameSuggestion()}}),zs("_executeDocumentRenameProvider",function(o,e,t,...i){const[n]=i;it(typeof n=="string");const{renameProvider:s}=o.get(he);return OTe(s,e,t,n)}),zs("_executePrepareRename",async function(o,e,t){const{renameProvider:i}=o.get(he),s=await new E7(e,t,i).resolveRenameLocation(He.None);if(s?.rejectReason)throw new Error(s.rejectReason);return s}),ei.as(ka.Configuration).registerConfiguration({id:"editor",properties:{"editor.rename.enablePreview":{scope:6,description:p(1372,"Enable/disable the ability to preview changes before renaming"),default:!0,type:"boolean"}}});var WTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TQ=function(o,e){return function(t,i){e(t,i,o)}};let XD=(OC=class extends A{constructor(e,t,i){super(),this.editor=e,this.languageConfigurationService=t,this.editorWorkerService=i,this.decorations=this.editor.createDecorationsCollection(),this.options=this.createOptions(e.getOption(81)),this.computePromise=null,this.currentOccurrences={},this._register(e.onDidChangeModel(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(e.onDidChangeModelLanguage(n=>{this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0)})),this._register(t.onDidChange(n=>{const s=this.editor.getModel()?.getLanguageId();s&&n.affects(s)&&(this.currentOccurrences={},this.options=this.createOptions(e.getOption(81)),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(e.onDidChangeConfiguration(n=>{this.options&&!n.hasChanged(81)||(this.options=this.createOptions(e.getOption(81)),this.updateDecorations([]),this.stop(),this.computeSectionHeaders.schedule(0))})),this._register(this.editor.onDidChangeModelContent(n=>{this.computeSectionHeaders.schedule()})),this._register(e.onDidChangeModelTokens(n=>{this.computeSectionHeaders.isScheduled()||this.computeSectionHeaders.schedule(1e3)})),this.computeSectionHeaders=this._register(new wt(()=>{this.findSectionHeaders()},250)),this.computeSectionHeaders.schedule(0)}createOptions(e){if(!e||!this.editor.hasModel())return;const t=this.editor.getModel().getLanguageId();if(!t)return;const i=this.languageConfigurationService.getLanguageConfiguration(t).comments,n=this.languageConfigurationService.getLanguageConfiguration(t).foldingRules;if(!(!i&&!n?.markers))return{foldingRules:n,markSectionHeaderRegex:e.markSectionHeaderRegex,findMarkSectionHeaders:e.showMarkSectionHeaders,findRegionSectionHeaders:e.showRegionSectionHeaders}}findSectionHeaders(){if(!this.editor.hasModel()||!this.options?.findMarkSectionHeaders&&!this.options?.findRegionSectionHeaders)return;const e=this.editor.getModel();if(e.isDisposed()||e.isTooLargeForSyncing())return;const t=e.getVersionId();this.editorWorkerService.findSectionHeaders(e.uri,this.options).then(i=>{e.isDisposed()||e.getVersionId()!==t||this.updateDecorations(i)})}updateDecorations(e){const t=this.editor.getModel();t&&(e=e.filter(s=>{if(!s.shouldBeInComments)return!0;const r=t.validateRange(s.range),a=t.tokenization.getLineTokens(r.startLineNumber),l=a.findTokenIndexAtOffset(r.startColumn-1),c=a.getStandardTokenType(l);return a.getLanguageId(l)===t.getLanguageId()&&c===1}));const i=Object.values(this.currentOccurrences).map(s=>s.decorationId),n=e.map(s=>BTe(s));this.editor.changeDecorations(s=>{const r=s.deltaDecorations(i,n);this.currentOccurrences={};for(let a=0,l=r.length;a<l;a++){const c={sectionHeader:e[a],decorationId:r[a]};this.currentOccurrences[c.decorationId]=c}})}stop(){this.computeSectionHeaders.cancel(),this.computePromise&&(this.computePromise.cancel(),this.computePromise=null)}dispose(){super.dispose(),this.stop(),this.decorations.clear()}},OC.ID="editor.sectionHeaderDetector",OC);XD=WTe([TQ(1,Jt),TQ(2,Xs)],XD);function BTe(o){return{range:o.range,options:Te.createDynamic({description:"section-header",stickiness:3,collapseOnReplaceEdit:!0,minimap:{color:void 0,position:1,sectionHeaderStyle:o.hasSeparatorLine?2:1,sectionHeaderText:o.text}})}}Qe(XD.ID,XD,1);class HTe{constructor(e=5){this.timesPerSecond=e,this._lastRun=0,this._minimumTimeBetweenRuns=1e3/e}runIfNotLimited(e){const t=Date.now();t-this._lastRun>=this._minimumTimeBetweenRuns&&(this._lastRun=t,e())}}class U0{static create(e,t){return new U0(e,new T7(t))}get startLineNumber(){return this._startLineNumber}get endLineNumber(){return this._endLineNumber}constructor(e,t){this._startLineNumber=e,this._tokens=t,this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}toString(){return this._tokens.toString(this._startLineNumber)}_updateEndLineNumber(){this._endLineNumber=this._startLineNumber+this._tokens.getMaxDeltaLine()}isEmpty(){return this._tokens.isEmpty()}getLineTokens(e){return this._startLineNumber<=e&&e<=this._endLineNumber?this._tokens.getLineTokens(e-this._startLineNumber):null}getRange(){const e=this._tokens.getRange();return e&&new k(this._startLineNumber+e.startLineNumber,e.startColumn,this._startLineNumber+e.endLineNumber,e.endColumn)}removeTokens(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;this._startLineNumber+=this._tokens.removeTokens(t,e.startColumn-1,i,e.endColumn-1),this._updateEndLineNumber()}split(e){const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber,[n,s,r]=this._tokens.split(t,e.startColumn-1,i,e.endColumn-1);return[new U0(this._startLineNumber,n),new U0(this._startLineNumber+r,s)]}applyEdit(e,t){const[i,n,s]=Dh(t);this.acceptEdit(e,i,n,s,t.length>0?t.charCodeAt(0):0)}acceptEdit(e,t,i,n,s){this._acceptDeleteRange(e),this._acceptInsertText(new M(e.startLineNumber,e.startColumn),t,i,n,s),this._updateEndLineNumber()}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber&&e.startColumn===e.endColumn)return;const t=e.startLineNumber-this._startLineNumber,i=e.endLineNumber-this._startLineNumber;if(i<0){const s=i-t;this._startLineNumber-=s;return}const n=this._tokens.getMaxDeltaLine();if(!(t>=n+1)){if(t<0&&i>=n+1){this._startLineNumber=0,this._tokens.clear();return}if(t<0){const s=-t;this._startLineNumber-=s,this._tokens.acceptDeleteRange(e.startColumn-1,0,0,i,e.endColumn-1)}else this._tokens.acceptDeleteRange(0,t,e.startColumn-1,i,e.endColumn-1)}}_acceptInsertText(e,t,i,n,s){if(t===0&&i===0)return;const r=e.lineNumber-this._startLineNumber;if(r<0){this._startLineNumber+=t;return}const a=this._tokens.getMaxDeltaLine();r>=a+1||this._tokens.acceptInsertText(r,e.column-1,t,i,n,s)}reportIfInvalid(e){this._tokens.reportIfInvalid(e,this._startLineNumber)}}const Uu=class Uu{constructor(e){this._tokens=e,this._tokenCount=e.length/4}toString(e){const t=[];for(let i=0;i<this._tokenCount;i++)t.push(`(${this._getDeltaLine(i)+e},${this._getStartCharacter(i)}-${this._getEndCharacter(i)})`);return`[${t.join(",")}]`}getMaxDeltaLine(){const e=this._getTokenCount();return e===0?-1:this._getDeltaLine(e-1)}getRange(){const e=this._getTokenCount();if(e===0)return null;const t=this._getStartCharacter(0),i=this._getDeltaLine(e-1),n=this._getEndCharacter(e-1);return new k(0,t+1,i,n+1)}_getTokenCount(){return this._tokenCount}_getDeltaLine(e){return this._tokens[4*e]}_getStartCharacter(e){return this._tokens[4*e+1]}_getEndCharacter(e){return this._tokens[4*e+2]}isEmpty(){return this._getTokenCount()===0}getLineTokens(e){let t=0,i=this._getTokenCount()-1;for(;t<i;){const n=t+Math.floor((i-t)/2),s=this._getDeltaLine(n);if(s<e)t=n+1;else if(s>e)i=n-1;else{let r=n;for(;r>t&&this._getDeltaLine(r-1)===e;)r--;let a=n;for(;a<i&&this._getDeltaLine(a+1)===e;)a++;return new RQ(this._tokens.subarray(4*r,4*a+4))}}return this._getDeltaLine(t)===e?new RQ(this._tokens.subarray(4*t,4*t+4)):null}clear(){this._tokenCount=0}removeTokens(e,t,i,n){const s=this._tokens,r=this._tokenCount;let a=0,l=!1,c=0;for(let d=0;d<r;d++){const h=4*d,u=s[h],f=s[h+1],g=s[h+2],m=s[h+3];if((u>e||u===e&&g>=t)&&(u<i||u===i&&f<=n))l=!0;else{if(a===0&&(c=u),l){const _=4*a;s[_]=u-c,s[_+1]=f,s[_+2]=g,s[_+3]=m}a++}}return this._tokenCount=a,c}split(e,t,i,n){const s=this._tokens,r=this._tokenCount,a=[],l=[];let c=a,d=0,h=0;for(let u=0;u<r;u++){const f=4*u,g=s[f],m=s[f+1],_=s[f+2],b=s[f+3];if(g>e||g===e&&_>=t){if(g<i||g===i&&m<=n)continue;c!==l&&(c=l,d=0,h=g)}c[d++]=g-h,c[d++]=m,c[d++]=_,c[d++]=b}return[new Uu(new Uint32Array(a)),new Uu(new Uint32Array(l)),h]}acceptDeleteRange(e,t,i,n,s){const r=this._tokens,a=this._tokenCount,l=n-t;let c=0,d=!1;for(let h=0;h<a;h++){const u=4*h;let f=r[u],g=r[u+1],m=r[u+2];const _=r[u+3];if(f<t||f===t&&m<=i){c++;continue}else if(f===t&&g<i)f===n&&m>s?m-=s-i:m=i;else if(f===t&&g===i)if(f===n&&m>s)m-=s-i;else{d=!0;continue}else if(f<n||f===n&&g<s)if(f===n&&m>s)f=t,g=i,m=g+(m-s);else{d=!0;continue}else if(f>n){if(l===0&&!d){c=a;break}f-=l}else if(f===n&&g>=s)e&&f===0&&(g+=e,m+=e),f-=l,g-=s-i,m-=s-i;else throw new Error("Not possible!");const b=4*c;r[b]=f,r[b+1]=g,r[b+2]=m,r[b+3]=_,c++}this._tokenCount=c}acceptInsertText(e,t,i,n,s,r){const a=i===0&&n===1&&(r>=48&&r<=57||r>=65&&r<=90||r>=97&&r<=122),l=this._tokens,c=this._tokenCount;for(let d=0;d<c;d++){const h=4*d;let u=l[h],f=l[h+1],g=l[h+2];if(!(u<e||u===e&&g<t)){if(u===e&&g===t)if(a)g+=1;else continue;else if(u===e&&f<t&&t<g)i===0?g+=n:g=t;else{if(u===e&&f===t&&a)continue;if(u===e)if(u+=i,i===0)f+=n,g+=n;else{const m=g-f;f=s+(f-t),g=f+m}else u+=i}l[h]=u,l[h+1]=f,l[h+2]=g}}}reportIfInvalid(e,t){for(let i=0;i<this._tokenCount;i++){const n=this._getDeltaLine(i)+t;n<1?Uu._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber < 1")}):n>e.getLineCount()?Uu._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: lineNumber > model.getLineCount()")}):this._getEndCharacter(i)>e.getLineLength(n)&&Uu._rateLimiter.runIfNotLimited(()=>{console.error("Invalid Semantic Tokens Data From Extension: end character > model.getLineLength(lineNumber)")})}}};Uu._rateLimiter=new HTe(10/60);let T7=Uu;class RQ{constructor(e){this._tokens=e}getCount(){return this._tokens.length/4}getStartCharacter(e){return this._tokens[4*e+1]}getEndCharacter(e){return this._tokens[4*e+2]}getMetadata(e){return this._tokens[4*e+3]}}var VTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},R7=function(o,e){return function(t,i){e(t,i,o)}};let M7=class{constructor(e,t,i,n){this._legend=e,this._themeService=t,this._languageService=i,this._logService=n,this._hasWarnedOverlappingTokens=!1,this._hasWarnedInvalidLengthTokens=!1,this._hasWarnedInvalidEditStart=!1,this._hashTable=new P7}getMetadata(e,t,i){const n=this._languageService.languageIdCodec.encodeLanguageId(i),s=this._hashTable.get(e,t,n);let r;if(s)r=s.metadata;else{let a=this._legend.tokenTypes[e];const l=[];if(a){let c=t;for(let h=0;c>0&&h<this._legend.tokenModifiers.length;h++)c&1&&l.push(this._legend.tokenModifiers[h]),c=c>>1;const d=this._themeService.getColorTheme().getTokenStyleMetadata(a,l,i);if(typeof d>"u")r=2147483647;else{if(r=0,typeof d.italic<"u"){const h=(d.italic?1:0)<<11;r|=h|1}if(typeof d.bold<"u"){const h=(d.bold?2:0)<<11;r|=h|2}if(typeof d.underline<"u"){const h=(d.underline?4:0)<<11;r|=h|4}if(typeof d.strikethrough<"u"){const h=(d.strikethrough?8:0)<<11;r|=h|8}if(d.foreground){const h=d.foreground<<15;r|=h|16}r===0&&(r=2147483647)}}else r=2147483647,a="not-in-legend";this._hashTable.add(e,t,n,r)}return r}warnOverlappingSemanticTokens(e,t){this._hasWarnedOverlappingTokens||(this._hasWarnedOverlappingTokens=!0,this._logService.warn(`Overlapping semantic tokens detected at lineNumber ${e}, column ${t}`))}warnInvalidLengthSemanticTokens(e,t){this._hasWarnedInvalidLengthTokens||(this._hasWarnedInvalidLengthTokens=!0,this._logService.warn(`Semantic token with invalid length detected at lineNumber ${e}, column ${t}`))}warnInvalidEditStart(e,t,i,n,s){this._hasWarnedInvalidEditStart||(this._hasWarnedInvalidEditStart=!0,this._logService.warn(`Invalid semantic tokens edit detected (previousResultId: ${e}, resultId: ${t}) at edit #${i}: The provided start offset ${n} is outside the previous data (length ${s}).`))}};M7=VTe([R7(1,li),R7(2,Mt),R7(3,Rt)],M7);function MQ(o,e,t){const i=o.data,n=o.data.length/5|0,s=Math.max(Math.ceil(n/1024),400),r=[];let a=0,l=1,c=0;for(;a<n;){const d=a;let h=Math.min(d+s,n);if(h<n){let C=h;for(;C-1>d&&i[5*C]===0;)C--;if(C-1===d){let w=h;for(;w+1<n&&i[5*w]===0;)w++;h=w}else h=C}let u=new Uint32Array((h-d)*4),f=0,g=0,m=0,_=0;for(;a<h;){const C=5*a,w=i[C],v=i[C+1],S=l+w|0,L=w===0?c+v|0:v,x=i[C+2],I=L+x|0,D=i[C+3],R=i[C+4];if(I<=L)e.warnInvalidLengthSemanticTokens(S,L+1);else if(m===S&&_>L)e.warnOverlappingSemanticTokens(S,L+1);else{const F=e.getMetadata(D,R,t);F!==2147483647&&(g===0&&(g=S),u[f]=S-g,u[f+1]=L,u[f+2]=I,u[f+3]=F,f+=4,m=S,_=I)}l=S,c=L,a++}f!==u.length&&(u=u.subarray(0,f));const b=U0.create(g,u);r.push(b)}return r}class zTe{constructor(e,t,i,n){this.tokenTypeIndex=e,this.tokenModifierSet=t,this.languageId=i,this.metadata=n,this.next=null}}const Kd=class Kd{constructor(){this._elementsCount=0,this._currentLengthIndex=0,this._currentLength=Kd._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Kd._SIZES.length?2/3*this._currentLength:0),this._elements=[],Kd._nullOutEntries(this._elements,this._currentLength)}static _nullOutEntries(e,t){for(let i=0;i<t;i++)e[i]=null}_hash2(e,t){return(e<<5)-e+t|0}_hashFunc(e,t,i){return this._hash2(this._hash2(e,t),i)%this._currentLength}get(e,t,i){const n=this._hashFunc(e,t,i);let s=this._elements[n];for(;s;){if(s.tokenTypeIndex===e&&s.tokenModifierSet===t&&s.languageId===i)return s;s=s.next}return null}add(e,t,i,n){if(this._elementsCount++,this._growCount!==0&&this._elementsCount>=this._growCount){const s=this._elements;this._currentLengthIndex++,this._currentLength=Kd._SIZES[this._currentLengthIndex],this._growCount=Math.round(this._currentLengthIndex+1<Kd._SIZES.length?2/3*this._currentLength:0),this._elements=[],Kd._nullOutEntries(this._elements,this._currentLength);for(const r of s){let a=r;for(;a;){const l=a.next;a.next=null,this._add(a),a=l}}}this._add(new zTe(e,t,i,n))}_add(e){const t=this._hashFunc(e.tokenTypeIndex,e.tokenModifierSet,e.languageId);e.next=this._elements[t],this._elements[t]=e}};Kd._SIZES=[3,7,13,31,61,127,251,509,1021,2039,4093,8191,16381,32749,65521,131071,262139,524287,1048573,2097143];let P7=Kd;const QD=We("semanticTokensStylingService");function UTe(o){for(let e=0,t=o.length;e<t;e+=4){const i=o[e+0],n=o[e+1],s=o[e+2],r=o[e+3];o[e+0]=r,o[e+1]=s,o[e+2]=n,o[e+3]=i}}function $Te(o){const e=new Uint8Array(o.buffer,o.byteOffset,o.length*4);return HB()||UTe(e),sh.wrap(e)}function PQ(o){const e=new Uint32Array(jTe(o));let t=0;if(e[t++]=o.id,o.type==="full")e[t++]=1,e[t++]=o.data.length,e.set(o.data,t),t+=o.data.length;else{e[t++]=2,e[t++]=o.deltas.length;for(const i of o.deltas)e[t++]=i.start,e[t++]=i.deleteCount,i.data?(e[t++]=i.data.length,e.set(i.data,t),t+=i.data.length):e[t++]=0}return $Te(e)}function jTe(o){let e=0;if(e+=2,o.type==="full")e+=1+o.data.length;else{e+=1,e+=3*o.deltas.length;for(const t of o.deltas)t.data&&(e+=t.data.length)}return e}function JD(o){return o&&!!o.data}function AQ(o){return o&&Array.isArray(o.edits)}class qTe{constructor(e,t,i){this.provider=e,this.tokens=t,this.error=i}}function OQ(o,e){return o.has(e)}function KTe(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function FQ(o,e,t,i,n){const s=KTe(o,e),r=await Promise.all(s.map(async a=>{let l,c=null;try{l=await a.provideDocumentSemanticTokens(e,a===t?i:null,n)}catch(d){c=d,l=null}return(!l||!JD(l)&&!AQ(l))&&(l=null),new qTe(a,l,c)}));for(const a of r){if(a.error)throw a.error;if(a.tokens)return a}return r.length>0?r[0]:null}function GTe(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:null}class ZTe{constructor(e,t){this.provider=e,this.tokens=t}}function YTe(o,e){return o.has(e)}function WQ(o,e){const t=o.orderedGroups(e);return t.length>0?t[0]:[]}async function A7(o,e,t,i){const n=WQ(o,e),s=await Promise.all(n.map(async r=>{let a;try{a=await r.provideDocumentRangeSemanticTokens(e,t,i)}catch(l){Di(l),a=null}return(!a||!JD(a))&&(a=null),new ZTe(r,a)}));for(const r of s)if(r.tokens)return r;return s.length>0?s[0]:null}Xe.registerCommand("_provideDocumentSemanticTokensLegend",async(o,...e)=>{const[t]=e;it(t instanceof be);const i=o.get(Qt).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(he),s=GTe(n,i);return s?s[0].getLegend():o.get(Tt).executeCommand("_provideDocumentRangeSemanticTokensLegend",t)}),Xe.registerCommand("_provideDocumentSemanticTokens",async(o,...e)=>{const[t]=e;it(t instanceof be);const i=o.get(Qt).getModel(t);if(!i)return;const{documentSemanticTokensProvider:n}=o.get(he);if(!OQ(n,i))return o.get(Tt).executeCommand("_provideDocumentRangeSemanticTokens",t,i.getFullModelRange());const s=await FQ(n,i,null,null,He.None);if(!s)return;const{provider:r,tokens:a}=s;if(!a||!JD(a))return;const l=PQ({id:0,type:"full",data:a.data});return a.resultId&&r.releaseDocumentSemanticTokens(a.resultId),l}),Xe.registerCommand("_provideDocumentRangeSemanticTokensLegend",async(o,...e)=>{const[t,i]=e;it(t instanceof be);const n=o.get(Qt).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(he),r=WQ(s,n);if(r.length===0)return;if(r.length===1)return r[0].getLegend();if(!i||!k.isIRange(i))return console.warn("provideDocumentRangeSemanticTokensLegend might be out-of-sync with provideDocumentRangeSemanticTokens unless a range argument is passed in"),r[0].getLegend();const a=await A7(s,n,k.lift(i),He.None);if(a)return a.provider.getLegend()}),Xe.registerCommand("_provideDocumentRangeSemanticTokens",async(o,...e)=>{const[t,i]=e;it(t instanceof be),it(k.isIRange(i));const n=o.get(Qt).getModel(t);if(!n)return;const{documentRangeSemanticTokensProvider:s}=o.get(he),r=await A7(s,n,k.lift(i),He.None);if(!(!r||!r.tokens))return PQ({id:0,type:"full",data:r.tokens.data})});const O7="editor.semanticHighlighting";function eE(o,e,t){const i=t.getValue(O7,{overrideIdentifier:o.getLanguageId(),resource:o.uri})?.enabled;return typeof i=="boolean"?i:e.getColorTheme().semanticHighlighting}var BQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jl=function(o,e){return function(t,i){e(t,i,o)}},uu;let F7=class extends A{constructor(e,t,i,n,s,r){super(),this._watchers=new Li;const a=d=>{this._watchers.get(d.uri)?.dispose(),this._watchers.set(d.uri,new W7(d,e,i,s,r))},l=(d,h)=>{h.dispose(),this._watchers.delete(d.uri)},c=()=>{for(const d of t.getModels()){const h=this._watchers.get(d.uri);eE(d,i,n)?h||a(d):h&&l(d,h)}};t.getModels().forEach(d=>{eE(d,i,n)&&a(d)}),this._register(t.onModelAdded(d=>{eE(d,i,n)&&a(d)})),this._register(t.onModelRemoved(d=>{const h=this._watchers.get(d.uri);h&&l(d,h)})),this._register(n.onDidChangeConfiguration(d=>{d.affectsConfiguration(O7)&&c()})),this._register(i.onDidColorThemeChange(c))}dispose(){pt(this._watchers.values()),this._watchers.clear(),super.dispose()}};F7=BQ([Jl(0,QD),Jl(1,Qt),Jl(2,li),Jl(3,Me),Jl(4,Or),Jl(5,he)],F7);let W7=($u=class extends A{constructor(e,t,i,n,s){super(),this._semanticTokensStylingService=t,this._isDisposed=!1,this._model=e,this._provider=s.documentSemanticTokensProvider,this._debounceInformation=n.for(this._provider,"DocumentSemanticTokens",{min:uu.REQUEST_MIN_DELAY,max:uu.REQUEST_MAX_DELAY}),this._fetchDocumentSemanticTokens=this._register(new wt(()=>this._fetchDocumentSemanticTokensNow(),uu.REQUEST_MIN_DELAY)),this._currentDocumentResponse=null,this._currentDocumentRequestCancellationTokenSource=null,this._documentProvidersChangeListeners=[],this._providersChangedDuringRequest=!1,this._register(this._model.onDidChangeContent(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeAttached(()=>{this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(this._model.onDidChangeLanguage(()=>{this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(0)}));const r=()=>{pt(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[];for(const a of this._provider.all(e))typeof a.onDidChange=="function"&&this._documentProvidersChangeListeners.push(a.onDidChange(()=>{if(this._currentDocumentRequestCancellationTokenSource){this._providersChangedDuringRequest=!0;return}this._fetchDocumentSemanticTokens.schedule(0)}))};r(),this._register(this._provider.onDidChange(()=>{r(),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._register(i.onDidColorThemeChange(a=>{this._setDocumentSemanticTokens(null,null,null,[]),this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))})),this._fetchDocumentSemanticTokens.schedule(0)}dispose(){this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._currentDocumentRequestCancellationTokenSource&&(this._currentDocumentRequestCancellationTokenSource.cancel(),this._currentDocumentRequestCancellationTokenSource=null),pt(this._documentProvidersChangeListeners),this._documentProvidersChangeListeners=[],this._setDocumentSemanticTokens(null,null,null,[]),this._isDisposed=!0,super.dispose()}_fetchDocumentSemanticTokensNow(){if(this._currentDocumentRequestCancellationTokenSource)return;if(!OQ(this._provider,this._model)){this._currentDocumentResponse&&this._model.tokenization.setSemanticTokens(null,!1);return}if(!this._model.isAttachedToEditor())return;const e=new Xt,t=this._currentDocumentResponse?this._currentDocumentResponse.provider:null,i=this._currentDocumentResponse&&this._currentDocumentResponse.resultId||null,n=FQ(this._provider,this._model,t,i,e.token);this._currentDocumentRequestCancellationTokenSource=e,this._providersChangedDuringRequest=!1;const s=[],r=this._model.onDidChangeContent(l=>{s.push(l)}),a=new Ki(!1);n.then(l=>{if(this._debounceInformation.update(this._model,a.elapsed()),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),!l)this._setDocumentSemanticTokens(null,null,null,s);else{const{provider:c,tokens:d}=l,h=this._semanticTokensStylingService.getStyling(c);this._setDocumentSemanticTokens(c,d||null,h,s)}},l=>{l&&(Do(l)||typeof l.message=="string"&&l.message.indexOf("busy")!==-1)||Ee(l),this._currentDocumentRequestCancellationTokenSource=null,r.dispose(),(s.length>0||this._providersChangedDuringRequest)&&(this._fetchDocumentSemanticTokens.isScheduled()||this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model)))})}static _copy(e,t,i,n,s){s=Math.min(s,i.length-n,e.length-t);for(let r=0;r<s;r++)i[n+r]=e[t+r]}_setDocumentSemanticTokens(e,t,i,n){const s=this._currentDocumentResponse,r=()=>{(n.length>0||this._providersChangedDuringRequest)&&!this._fetchDocumentSemanticTokens.isScheduled()&&this._fetchDocumentSemanticTokens.schedule(this._debounceInformation.get(this._model))};if(this._currentDocumentResponse&&(this._currentDocumentResponse.dispose(),this._currentDocumentResponse=null),this._isDisposed){e&&t&&e.releaseDocumentSemanticTokens(t.resultId);return}if(!e||!i){this._model.tokenization.setSemanticTokens(null,!1);return}if(!t){this._model.tokenization.setSemanticTokens(null,!0),r();return}if(AQ(t)){if(!s){this._model.tokenization.setSemanticTokens(null,!0);return}if(t.edits.length===0)t={resultId:t.resultId,data:s.data};else{let a=0;for(const u of t.edits)a+=(u.data?u.data.length:0)-u.deleteCount;const l=s.data,c=new Uint32Array(l.length+a);let d=l.length,h=c.length;for(let u=t.edits.length-1;u>=0;u--){const f=t.edits[u];if(f.start>l.length){i.warnInvalidEditStart(s.resultId,t.resultId,u,f.start,l.length),this._model.tokenization.setSemanticTokens(null,!0);return}const g=d-(f.start+f.deleteCount);g>0&&(uu._copy(l,d-g,c,h-g,g),h-=g),f.data&&(uu._copy(f.data,0,c,h-f.data.length,f.data.length),h-=f.data.length),d=f.start}d>0&&uu._copy(l,0,c,0,d),t={resultId:t.resultId,data:c}}}if(JD(t)){this._currentDocumentResponse=new XTe(e,t.resultId,t.data);const a=MQ(t,i,this._model.getLanguageId());if(n.length>0)for(const l of n)for(const c of a)for(const d of l.changes)c.applyEdit(d.range,d.text);this._model.tokenization.setSemanticTokens(a,!0)}else this._model.tokenization.setSemanticTokens(null,!0);r()}},uu=$u,$u.REQUEST_MIN_DELAY=300,$u.REQUEST_MAX_DELAY=2e3,$u);W7=uu=BQ([Jl(1,QD),Jl(2,li),Jl(3,Or),Jl(4,he)],W7);class XTe{constructor(e,t,i){this.provider=e,this.resultId=t,this.data=i}dispose(){this.provider.releaseDocumentSemanticTokens(this.resultId)}}cb(F7);var QTe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$0=function(o,e){return function(t,i){e(t,i,o)}};let tE=(FC=class extends A{constructor(e,t,i,n,s,r){super(),this._semanticTokensStylingService=t,this._themeService=i,this._configurationService=n,this._editor=e,this._provider=r.documentRangeSemanticTokensProvider,this._debounceInformation=s.for(this._provider,"DocumentRangeSemanticTokens",{min:100,max:500}),this._tokenizeViewport=this._register(new wt(()=>this._tokenizeViewportNow(),100)),this._outstandingRequests=[];const a=()=>{this._editor.hasModel()&&this._tokenizeViewport.schedule(this._debounceInformation.get(this._editor.getModel()))};this._register(this._editor.onDidScrollChange(()=>{a()})),this._register(this._editor.onDidChangeModel(()=>{this._cancelAll(),a()})),this._register(this._editor.onDidChangeModelContent(l=>{this._cancelAll(),a()})),this._register(this._provider.onDidChange(()=>{this._cancelAll(),a()})),this._register(this._configurationService.onDidChangeConfiguration(l=>{l.affectsConfiguration(O7)&&(this._cancelAll(),a())})),this._register(this._themeService.onDidColorThemeChange(()=>{this._cancelAll(),a()})),a()}_cancelAll(){for(const e of this._outstandingRequests)e.cancel();this._outstandingRequests=[]}_removeOutstandingRequest(e){for(let t=0,i=this._outstandingRequests.length;t<i;t++)if(this._outstandingRequests[t]===e){this._outstandingRequests.splice(t,1);return}}_tokenizeViewportNow(){if(!this._editor.hasModel())return;const e=this._editor.getModel();if(e.tokenization.hasCompleteSemanticTokens())return;if(!eE(e,this._themeService,this._configurationService)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}if(!YTe(this._provider,e)){e.tokenization.hasSomeSemanticTokens()&&e.tokenization.setSemanticTokens(null,!1);return}const t=this._editor.getVisibleRangesPlusViewportAboveBelow();this._outstandingRequests=this._outstandingRequests.concat(t.map(i=>this._requestRange(e,i)))}_requestRange(e,t){const i=e.getVersionId(),n=Vi(r=>Promise.resolve(A7(this._provider,e,t,r))),s=new Ki(!1);return n.then(r=>{if(this._debounceInformation.update(e,s.elapsed()),!r||!r.tokens||e.isDisposed()||e.getVersionId()!==i)return;const{provider:a,tokens:l}=r,c=this._semanticTokensStylingService.getStyling(a);e.tokenization.setPartialSemanticTokens(t,MQ(l,c,e.getLanguageId()))}).then(()=>this._removeOutstandingRequest(n),()=>this._removeOutstandingRequest(n)),n}},FC.ID="editor.contrib.viewportSemanticTokens",FC);tE=QTe([$0(1,QD),$0(2,li),$0(3,Me),$0(4,Or),$0(5,he)],tE),Qe(tE.ID,tE,1);class JTe{constructor(e=!0){this.selectSubwords=e}provideSelectionRanges(e,t){const i=[];for(const n of t){const s=[];i.push(s),this.selectSubwords&&this._addInWordRanges(s,e,n),this._addWordRanges(s,e,n),this._addWhitespaceLine(s,e,n),s.push({range:e.getFullModelRange()})}return i}_addInWordRanges(e,t,i){const n=t.getWordAtPosition(i);if(!n)return;const{word:s,startColumn:r}=n,a=i.column-r;let l=a,c=a,d=0;for(;l>=0;l--){const h=s.charCodeAt(l);if(l!==a&&(h===95||h===45))break;if(Jd(h)&&ll(d))break;d=h}for(l+=1;c<s.length;c++){const h=s.charCodeAt(c);if(ll(h)&&Jd(d))break;if(h===95||h===45)break;d=h}l<c&&e.push({range:new k(i.lineNumber,r+l,i.lineNumber,r+c)})}_addWordRanges(e,t,i){const n=t.getWordAtPosition(i);n&&e.push({range:new k(i.lineNumber,n.startColumn,i.lineNumber,n.endColumn)})}_addWhitespaceLine(e,t,i){t.getLineLength(i.lineNumber)>0&&t.getLineFirstNonWhitespaceColumn(i.lineNumber)===0&&t.getLineLastNonWhitespaceColumn(i.lineNumber)===0&&e.push({range:new k(i.lineNumber,1,i.lineNumber,t.getLineMaxColumn(i.lineNumber))})}}var eRe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tRe=function(o,e){return function(t,i){e(t,i,o)}},B7;class H7{constructor(e,t){this.index=e,this.ranges=t}mov(e){const t=this.index+(e?1:-1);if(t<0||t>=this.ranges.length)return this;const i=new H7(t,this.ranges);return i.ranges[t].equalsRange(this.ranges[this.index])?i.mov(e):i}}let j0=(gm=class{static get(e){return e.getContribution(B7.ID)}constructor(e,t){this._editor=e,this._languageFeaturesService=t,this._ignoreSelection=!1}dispose(){this._selectionListener?.dispose()}async run(e){if(!this._editor.hasModel())return;const t=this._editor.getSelections(),i=this._editor.getModel();if(this._state||await VQ(this._languageFeaturesService.selectionRangeProvider,i,t.map(s=>s.getPosition()),this._editor.getOption(129),He.None).then(s=>{if(!(!is(s)||s.length!==t.length)&&!(!this._editor.hasModel()||!Ut(this._editor.getSelections(),t,(r,a)=>r.equalsSelection(a)))){for(let r=0;r<s.length;r++)s[r]=s[r].filter(a=>a.containsPosition(t[r].getStartPosition())&&a.containsPosition(t[r].getEndPosition())),s[r].unshift(t[r]);this._state=s.map(r=>new H7(0,r)),this._selectionListener?.dispose(),this._selectionListener=this._editor.onDidChangeCursorPosition(()=>{this._ignoreSelection||(this._selectionListener?.dispose(),this._state=void 0)})}}),!this._state)return;this._state=this._state.map(s=>s.mov(e));const n=this._state.map(s=>ce.fromPositions(s.ranges[s.index].getStartPosition(),s.ranges[s.index].getEndPosition()));this._ignoreSelection=!0;try{this._editor.setSelections(n)}finally{this._ignoreSelection=!1}}},B7=gm,gm.ID="editor.contrib.smartSelectController",gm);j0=B7=eRe([tRe(1,he)],j0);class HQ extends le{constructor(e,t){super(t),this._forward=e}async run(e,t){const i=j0.get(t);i&&await i.run(this._forward)}}class iRe extends HQ{constructor(){super(!0,{id:"editor.action.smartSelect.expand",label:H(1385,"Expand Selection"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1553,mac:{primary:3345,secondary:[1297]},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"1_basic",title:p(1383,"&&Expand Selection"),order:2}})}}Xe.registerCommandAlias("editor.action.smartSelect.grow","editor.action.smartSelect.expand");class nRe extends HQ{constructor(){super(!1,{id:"editor.action.smartSelect.shrink",label:H(1386,"Shrink Selection"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:1551,mac:{primary:3343,secondary:[1295]},weight:100},menuOpts:{menuId:de.MenubarSelectionMenu,group:"1_basic",title:p(1384,"&&Shrink Selection"),order:3}})}}Qe(j0.ID,j0,4),ne(iRe),ne(nRe);async function VQ(o,e,t,i,n){const s=o.all(e).concat(new JTe(i.selectSubwords));s.length===1&&s.unshift(new gD);const r=[],a=[];for(const l of s)r.push(Promise.resolve(l.provideSelectionRanges(e,t,n)).then(c=>{if(is(c)&&c.length===t.length)for(let d=0;d<t.length;d++){a[d]||(a[d]=[]);for(const h of c[d])k.isIRange(h.range)&&k.containsPosition(h.range,t[d])&&a[d].push(k.lift(h.range))}},Di));return await Promise.all(r),a.map(l=>{if(l.length===0)return[];l.sort((u,f)=>M.isBefore(u.getStartPosition(),f.getStartPosition())?1:M.isBefore(f.getStartPosition(),u.getStartPosition())||M.isBefore(u.getEndPosition(),f.getEndPosition())?-1:M.isBefore(f.getEndPosition(),u.getEndPosition())?1:0);const c=[];let d;for(const u of l)(!d||k.containsRange(u,d)&&!k.equalsRange(u,d))&&(c.push(u),d=u);if(!i.selectLeadingAndTrailingWhitespace)return c;const h=[c[0]];for(let u=1;u<c.length;u++){const f=c[u-1],g=c[u];if(g.startLineNumber!==f.startLineNumber||g.endLineNumber!==f.endLineNumber){const m=new k(f.startLineNumber,e.getLineFirstNonWhitespaceColumn(f.startLineNumber),f.endLineNumber,e.getLineLastNonWhitespaceColumn(f.endLineNumber));m.containsRange(f)&&!m.equalsRange(f)&&g.containsRange(m)&&!g.equalsRange(m)&&h.push(m);const _=new k(f.startLineNumber,1,f.endLineNumber,e.getLineMaxColumn(f.endLineNumber));_.containsRange(f)&&!_.equalsRange(m)&&g.containsRange(_)&&!g.equalsRange(_)&&h.push(_)}h.push(g)}return h})}Xe.registerCommand("_executeSelectionRangeProvider",async function(o,...e){const[t,i]=e;it(be.isUri(t));const n=o.get(he).selectionRangeProvider,s=await o.get(ns).createModelReference(t);try{return VQ(n,s.object.textEditorModel,i,{selectLeadingAndTrailingWhitespace:!0,selectSubwords:!0},He.None)}finally{s.dispose()}});const sRe=Object.freeze({View:H(1623,"View"),Help:H(1624,"Help"),Test:H(1625,"Test"),File:H(1626,"File"),Preferences:H(1627,"Preferences"),Developer:H(1628,"Developer")});class oRe extends Zr{constructor(){super({id:"editor.action.toggleStickyScroll",title:{...H(1433,"Toggle Editor Sticky Scroll"),mnemonicTitle:p(1429,"&&Toggle Editor Sticky Scroll")},metadata:{description:H(1434,"Toggle/enable the editor sticky scroll which shows the nested scopes at the top of the viewport")},category:sRe.View,toggled:{condition:K.equals("config.editor.stickyScroll.enabled",!0),title:p(1430,"Sticky Scroll"),mnemonicTitle:p(1431,"&&Sticky Scroll")},menu:[{id:de.CommandPalette},{id:de.MenubarAppearanceMenu,group:"4_editor",order:3},{id:de.StickyScrollContext}]})}async runEditorCommand(e,t){const i=e.get(Me),n=!i.getValue("editor.stickyScroll.enabled"),s=ca.get(t)?.isFocused();i.updateValue("editor.stickyScroll.enabled",n),s&&t.focus()}}const iE=100;class rRe extends Zr{constructor(){super({id:"editor.action.focusStickyScroll",title:{...H(1435,"Focus Editor Sticky Scroll"),mnemonicTitle:p(1432,"&&Focus Editor Sticky Scroll")},precondition:K.and(K.has("config.editor.stickyScroll.enabled"),T.stickyScrollVisible),menu:[{id:de.CommandPalette}]})}runEditorCommand(e,t){ca.get(t)?.focus()}}class aRe extends Zr{constructor(){super({id:"editor.action.selectNextStickyScrollLine",title:H(1436,"Select the next editor sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:iE,primary:18}})}runEditorCommand(e,t){ca.get(t)?.focusNext()}}class lRe extends Zr{constructor(){super({id:"editor.action.selectPreviousStickyScrollLine",title:H(1437,"Select the previous sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:iE,primary:16}})}runEditorCommand(e,t){ca.get(t)?.focusPrevious()}}class cRe extends Zr{constructor(){super({id:"editor.action.goToFocusedStickyScrollLine",title:H(1438,"Go to the focused sticky scroll line"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:iE,primary:3}})}runEditorCommand(e,t){ca.get(t)?.goToFocused()}}class dRe extends Zr{constructor(){super({id:"editor.action.selectEditor",title:H(1439,"Select Editor"),precondition:T.stickyScrollFocused.isEqualTo(!0),keybinding:{weight:iE,primary:9}})}runEditorCommand(e,t){ca.get(t)?.selectEditor()}}Qe(ca.ID,ca,1),mt(oRe),mt(rRe),mt(lRe),mt(aRe),mt(cRe),mt(dRe);var zQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},q0=function(o,e){return function(t,i){e(t,i,o)}};class hRe{constructor(e,t,i,n,s,r,a){this.range=e,this.insertText=t,this.filterText=i,this.additionalTextEdits=n,this.command=s,this.action=r,this.completion=a}}let V7=class extends nie{constructor(e,t,i,n,s,r){super(s.disposable),this.model=e,this.line=t,this.word=i,this.completionModel=n,this._suggestMemoryService=r}canBeReused(e,t,i){return this.model===e&&this.line===t&&this.word.word.length>0&&this.word.startColumn===i.startColumn&&this.word.endColumn<i.endColumn&&this.completionModel.getIncompleteProvider().size===0}get items(){const e=[],{items:t}=this.completionModel,i=this._suggestMemoryService.select(this.model,{lineNumber:this.line,column:this.word.endColumn+this.completionModel.lineContext.characterCountDelta},t),n=Ye.slice(t,i),s=Ye.slice(t,0,i);let r=5;for(const a of Ye.concat(n,s)){if(a.score===Jr.Default)continue;const l=new k(a.editStart.lineNumber,a.editStart.column,a.editInsertEnd.lineNumber,a.editInsertEnd.column+this.completionModel.lineContext.characterCountDelta),c=a.completion.insertTextRules&&a.completion.insertTextRules&4?{snippet:a.completion.insertText}:a.completion.insertText;e.push(new hRe(l,c,a.filterTextLow??a.labelLow,a.completion.additionalTextEdits,a.completion.command,a.completion.action,a)),r-->=0&&a.resolve(He.None)}return e}};V7=zQ([q0(5,uD)],V7);let z7=class extends A{constructor(e,t,i,n){super(),this._languageFeatureService=e,this._clipboardService=t,this._suggestMemoryService=i,this._editorService=n,this._store.add(e.inlineCompletionsProvider.register("*",this))}async provideInlineCompletions(e,t,i,n){if(i.selectedSuggestionInfo)return;let s;for(const f of this._editorService.listCodeEditors())if(f.getModel()===e){s=f;break}if(!s)return;const r=s.getOption(102);if(Eb.isAllOff(r))return;e.tokenization.tokenizeIfCheap(t.lineNumber);const a=e.tokenization.getLineTokens(t.lineNumber),l=a.getStandardTokenType(a.findTokenIndexAtOffset(Math.max(t.column-1-1,0)));if(Eb.valueFor(r,l)!=="inline")return;let c=e.getWordAtPosition(t),d;if(c?.word||(d=this._getTriggerCharacterInfo(e,t)),!c?.word&&!d||(c||(c=e.getWordUntilPosition(t)),c.endColumn!==t.column))return;let h;const u=e.getValueInRange(new k(t.lineNumber,1,t.lineNumber,t.column));if(!d&&this._lastResult?.canBeReused(e,t.lineNumber,c)){const f=new SX(u,t.column-this._lastResult.word.endColumn);this._lastResult.completionModel.lineContext=f,this._lastResult.acquire(),h=this._lastResult}else{const f=await EF(this._languageFeatureService.completionProvider,e,t,new c0(void 0,mD.createSuggestFilter(s).itemKind,d?.providers),d&&{triggerKind:1,triggerCharacter:d.ch},n);let g;f.needsClipboard&&(g=await this._clipboardService.readText());const m=new ou(f.items,t.column,new SX(u,0),pD.None,s.getOption(134),s.getOption(128),{boostFullMatch:!1,firstMatchCanBeWeak:!1},g);h=new V7(e,t.lineNumber,c,m,f,this._suggestMemoryService)}return this._lastResult=h,h}handleItemDidShow(e,t){t.completion.resolve(He.None)}disposeInlineCompletions(e){e.release()}_getTriggerCharacterInfo(e,t){const i=e.getValueInRange(k.fromPositions({lineNumber:t.lineNumber,column:t.column-1},t)),n=new Set;for(const s of this._languageFeatureService.completionProvider.all(e))s.triggerCharacters?.includes(i)&&n.add(s);if(n.size!==0)return{providers:n,ch:i}}};z7=zQ([q0(0,he),q0(1,Wa),q0(2,uD),q0(3,et)],z7),cb(z7);class uRe extends le{constructor(){super({id:"editor.action.forceRetokenize",label:H(1517,"Developer: Force Retokenize"),precondition:void 0})}run(e,t){if(!t.hasModel())return;const i=t.getModel();i.tokenization.resetTokenization();const n=new Ki;i.tokenization.forceTokenization(i.getLineCount()),n.stop(),console.log(`tokenization took ${n.elapsed()}`)}}ne(uRe);const dT=class dT extends ln{constructor(){super({id:dT.ID,title:H(1515,"Toggle Tab Key Moves Focus"),precondition:void 0,keybinding:{primary:2091,mac:{primary:1323},weight:100},metadata:{description:H(1516,"Determines whether the tab key moves focus around the workbench or inserts the tab character in the current editor. This is also called tab trapping, tab navigation, or tab focus mode.")},f1:!0})}run(){const t=!s_.getTabFocusMode();s_.setTabFocusMode(t),ps(t?p(1513,"Pressing Tab will now move focus to the next focusable element"):p(1514,"Pressing Tab will now insert the tab character"))}};dT.ID="editor.action.toggleTabFocusMode";let U7=dT;mt(U7);class $7{static computeUnicodeHighlights(e,t,i){const n=i?i.startLineNumber:1,s=i?i.endLineNumber:e.getLineCount(),r=new UQ(t),a=r.getCandidateCodePoints();let l;a==="allNonBasicAscii"?l=new RegExp("[^\\t\\n\\r\\x20-\\x7E]","g"):l=new RegExp(`${fRe(Array.from(a))}`,"g");const c=new M_(null,l),d=[];let h=!1,u,f=0,g=0,m=0;e:for(let _=n,b=s;_<=b;_++){const C=e.getLineContent(_),w=C.length;c.reset(0);do if(u=c.next(C),u){let v=u.index,S=u.index+u[0].length;if(v>0){const D=C.charCodeAt(v-1);zi(D)&&v--}if(S+1<w){const D=C.charCodeAt(S-1);zi(D)&&S++}const L=C.substring(v,S);let x=T1(v+1,S2,C,0);x&&x.endColumn<=v+1&&(x=null);const I=r.shouldHighlightNonBasicASCII(L,x?x.word:null);if(I!==0){if(I===3?f++:I===2?g++:I===1?m++:ZC(),d.length>=1e3){h=!0;break e}d.push(new k(_,v+1,_,S+1))}}while(u)}return{ranges:d,hasMore:h,ambiguousCharacterCount:f,invisibleCharacterCount:g,nonBasicAsciiCharacterCount:m}}static computeUnicodeHighlightReason(e,t){const i=new UQ(t);switch(i.shouldHighlightNonBasicASCII(e,null)){case 0:return null;case 2:return{kind:1};case 3:{const s=e.codePointAt(0),r=i.ambiguousCharacters.getPrimaryConfusable(s),a=d1.getLocales().filter(l=>!d1.getInstance(new Set([...t.allowedLocales,l])).isAmbiguous(s));return{kind:0,confusableWith:String.fromCodePoint(r),notAmbiguousInLocales:a}}case 1:return{kind:2}}}}function fRe(o,e){return`[${oo(o.map(i=>String.fromCodePoint(i)).join(""))}]`}class UQ{constructor(e){this.options=e,this.allowedCodePoints=new Set(e.allowedCodePoints),this.ambiguousCharacters=d1.getInstance(new Set(e.allowedLocales))}getCandidateCodePoints(){if(this.options.nonBasicASCII)return"allNonBasicAscii";const e=new Set;if(this.options.invisibleCharacters)for(const t of nf.codePoints)$Q(String.fromCodePoint(t))||e.add(t);if(this.options.ambiguousCharacters)for(const t of this.ambiguousCharacters.getConfusableCodePoints())e.add(t);for(const t of this.allowedCodePoints)e.delete(t);return e}shouldHighlightNonBasicASCII(e,t){const i=e.codePointAt(0);if(this.allowedCodePoints.has(i))return 0;if(this.options.nonBasicASCII)return 1;let n=!1,s=!1;if(t)for(const r of t){const a=r.codePointAt(0),l=c1(r);n=n||l,!l&&!this.ambiguousCharacters.isAmbiguous(a)&&!nf.isInvisibleCharacter(a)&&(s=!0)}return!n&&s?0:this.options.invisibleCharacters&&!$Q(e)&&nf.isInvisibleCharacter(i)?2:this.options.ambiguousCharacters&&this.ambiguousCharacters.isAmbiguous(i)?3:0}}function $Q(o){return o===" "||o===`
`||o===" "}var gRe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},jQ=function(o,e){return function(t,i){e(t,i,o)}};let j7=class extends A{get enabled(){return this._enabled}set enabled(e){e?(this.el.setAttribute("aria-disabled","false"),this.el.tabIndex=0,this.el.style.pointerEvents="auto",this.el.style.opacity="1",this.el.style.cursor="pointer",this._enabled=!1):(this.el.setAttribute("aria-disabled","true"),this.el.tabIndex=-1,this.el.style.pointerEvents="none",this.el.style.opacity="0.4",this.el.style.cursor="default",this._enabled=!0),this._enabled=e}constructor(e,t,i={},n,s){super(),this._link=t,this._hoverService=n,this._enabled=!0,this.el=Z(e,Q("a.monaco-link",{tabIndex:t.tabIndex??0,href:t.href},t.label)),this.hoverDelegate=i.hoverDelegate??Zs("mouse"),this.setTooltip(t.title),this.el.setAttribute("role","button");const r=this._register(new gt(this.el,"click")),a=this._register(new gt(this.el,"keypress")),l=ie.chain(a.event,h=>h.map(u=>new St(u)).filter(u=>u.keyCode===3)),c=this._register(new gt(this.el,Pt.Tap)).event;this._register($n.addTarget(this.el));const d=ie.any(r.event,l,c);this._register(d(h=>{this.enabled&&(st.stop(h,!0),i?.opener?i.opener(this._link.href):s.open(this._link.href,{allowCommands:!0}))})),this.enabled=!0}setTooltip(e){!this.hover&&e?this.hover=this._register(this._hoverService.setupManagedHover(this.hoverDelegate,this.el,e)):this.hover&&this.hover.update(e)}};j7=gRe([jQ(3,Qs),jQ(4,Js)],j7);var qQ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},KQ=function(o,e){return function(t,i){e(t,i,o)}};const pRe=26;let q7=class extends A{constructor(e,t){super(),this._editor=e,this.instantiationService=t,this.banner=this._register(this.instantiationService.createInstance(K7))}hide(){this._editor.setBanner(null,0),this.banner.clear()}show(e){this.banner.show({...e,onClose:()=>{this.hide(),e.onClose?.()}}),this._editor.setBanner(this.banner.element,pRe)}};q7=qQ([KQ(1,ge)],q7);let K7=class extends A{constructor(e){super(),this.instantiationService=e,this.markdownRenderer=this.instantiationService.createInstance(fd,{}),this.element=Q("div.editor-banner"),this.element.tabIndex=0}getAriaLabel(e){if(e.ariaLabel)return e.ariaLabel;if(typeof e.message=="string")return e.message}getBannerMessage(e){if(typeof e=="string"){const t=Q("span");return t.innerText=e,t}return this.markdownRenderer.render(e).element}clear(){pn(this.element)}show(e){pn(this.element);const t=this.getAriaLabel(e);t&&this.element.setAttribute("aria-label",t);const i=Z(this.element,Q("div.icon-container"));i.setAttribute("aria-hidden","true"),e.icon&&i.appendChild(Q(`div${ve.asCSSSelector(e.icon)}`));const n=Z(this.element,Q("div.message-container"));if(n.setAttribute("aria-hidden","true"),n.appendChild(this.getBannerMessage(e.message)),this.messageActionsContainer=Z(this.element,Q("div.message-actions-container")),e.actions)for(const r of e.actions)this._register(this.instantiationService.createInstance(j7,this.messageActionsContainer,{...r,tabIndex:-1},{}));const s=Z(this.element,Q("div.action-container"));this.actionBar=this._register(new Ys(s)),this.actionBar.push(this._register(new Mo("banner.close",p(1518,"Close Banner"),ve.asClassName(kq),!0,()=>{typeof e.onClose=="function"&&e.onClose()})),{icon:!0,label:!1}),this.actionBar.setFocusable(!1)}};K7=qQ([KQ(0,ge)],K7);const GQ=We("workspaceTrustManagementService");var G7=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Gb=function(o,e){return function(t,i){e(t,i,o)}};const mRe=Wt("extensions-warning-message",Y.warning,p(1519,"Icon shown with a warning message in the extensions editor."));let K0=(WC=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._editorWorkerService=t,this._workspaceTrustService=i,this._highlighter=null,this._bannerClosed=!1,this._updateState=s=>{if(s&&s.hasMore){if(this._bannerClosed)return;const r=Math.max(s.ambiguousCharacterCount,s.nonBasicAsciiCharacterCount,s.invisibleCharacterCount);let a;if(s.nonBasicAsciiCharacterCount>=r)a={message:p(1520,"This document contains many non-basic ASCII unicode characters"),command:new Z0};else if(s.ambiguousCharacterCount>=r)a={message:p(1521,"This document contains many ambiguous unicode characters"),command:new np};else if(s.invisibleCharacterCount>=r)a={message:p(1522,"This document contains many invisible unicode characters"),command:new G0};else throw new Error("Unreachable");this._bannerController.show({id:"unicodeHighlightBanner",message:a.message,icon:mRe,actions:[{label:a.command.shortLabel,href:`command:${a.command.desc.id}`}],onClose:()=>{this._bannerClosed=!0}})}else this._bannerController.hide()},this._bannerController=this._register(n.createInstance(q7,e)),this._register(this._editor.onDidChangeModel(()=>{this._bannerClosed=!1,this._updateHighlighter()})),this._options=e.getOption(142),this._register(i.onDidChangeTrust(s=>{this._updateHighlighter()})),this._register(e.onDidChangeConfiguration(s=>{s.hasChanged(142)&&(this._options=e.getOption(142),this._updateHighlighter())})),this._updateHighlighter()}dispose(){this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),super.dispose()}_updateHighlighter(){if(this._updateState(null),this._highlighter&&(this._highlighter.dispose(),this._highlighter=null),!this._editor.hasModel())return;const e=_Re(this._workspaceTrustService.isWorkspaceTrusted(),this._options);if([e.nonBasicASCII,e.ambiguousCharacters,e.invisibleCharacters].every(i=>i===!1))return;const t={nonBasicASCII:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments,includeStrings:e.includeStrings,allowedCodePoints:Object.keys(e.allowedCharacters).map(i=>i.codePointAt(0)),allowedLocales:Object.keys(e.allowedLocales).map(i=>i==="_os"?Sf.NumberFormat().value.resolvedOptions().locale:i==="_vscode"?Hte:i)};this._editorWorkerService.canComputeUnicodeHighlights(this._editor.getModel().uri)?this._highlighter=new Z7(this._editor,t,this._updateState,this._editorWorkerService):this._highlighter=new bRe(this._editor,t,this._updateState)}getDecorationInfo(e){return this._highlighter?this._highlighter.getDecorationInfo(e):null}},WC.ID="editor.contrib.unicodeHighlighter",WC);K0=G7([Gb(1,Xs),Gb(2,GQ),Gb(3,ge)],K0);function _Re(o,e){return{nonBasicASCII:e.nonBasicASCII===Bo?!o:e.nonBasicASCII,ambiguousCharacters:e.ambiguousCharacters,invisibleCharacters:e.invisibleCharacters,includeComments:e.includeComments===Bo?!o:e.includeComments,includeStrings:e.includeStrings===Bo?!o:e.includeStrings,allowedCharacters:e.allowedCharacters,allowedLocales:e.allowedLocales}}let Z7=class extends A{constructor(e,t,i,n){super(),this._editor=e,this._options=t,this._updateState=i,this._editorWorkerService=n,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new wt(()=>this._update(),250)),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._model.getVersionId();this._editorWorkerService.computedUnicodeHighlights(this._model.uri,this._options).then(t=>{if(this._model.isDisposed()||this._model.getVersionId()!==e)return;this._updateState(t);const i=[];if(!t.hasMore)for(const n of t.ranges)i.push({range:n,options:nE.instance.getDecorationFromOptions(this._options)});this._decorations.set(i)})}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel();if(!$M(t,e))return null;const i=t.getValueInRange(e.range);return{reason:YQ(i,this._options),inComment:jM(t,e),inString:qM(t,e)}}};Z7=G7([Gb(3,Xs)],Z7);class bRe extends A{constructor(e,t,i){super(),this._editor=e,this._options=t,this._updateState=i,this._model=this._editor.getModel(),this._decorations=this._editor.createDecorationsCollection(),this._updateSoon=this._register(new wt(()=>this._update(),250)),this._register(this._editor.onDidLayoutChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidScrollChange(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeHiddenAreas(()=>{this._updateSoon.schedule()})),this._register(this._editor.onDidChangeModelContent(()=>{this._updateSoon.schedule()})),this._updateSoon.schedule()}dispose(){this._decorations.clear(),super.dispose()}_update(){if(this._model.isDisposed())return;if(!this._model.mightContainNonBasicASCII()){this._decorations.clear();return}const e=this._editor.getVisibleRanges(),t=[],i={ranges:[],ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0,hasMore:!1};for(const n of e){const s=$7.computeUnicodeHighlights(this._model,this._options,n);for(const r of s.ranges)i.ranges.push(r);i.ambiguousCharacterCount+=i.ambiguousCharacterCount,i.invisibleCharacterCount+=i.invisibleCharacterCount,i.nonBasicAsciiCharacterCount+=i.nonBasicAsciiCharacterCount,i.hasMore=i.hasMore||s.hasMore}if(!i.hasMore)for(const n of i.ranges)t.push({range:n,options:nE.instance.getDecorationFromOptions(this._options)});this._updateState(i),this._decorations.set(t)}getDecorationInfo(e){if(!this._decorations.has(e))return null;const t=this._editor.getModel(),i=t.getValueInRange(e.range);return $M(t,e)?{reason:YQ(i,this._options),inComment:jM(t,e),inString:qM(t,e)}:null}}const ZQ=p(1523,"Configure Unicode Highlight Options");let Y7=class{constructor(e,t,i){this._editor=e,this._languageService=t,this._openerService=i,this.hoverOrdinal=5}computeSync(e,t){if(!this._editor.hasModel()||e.type!==1)return[];const i=this._editor.getModel(),n=this._editor.getContribution(K0.ID);if(!n)return[];const s=[],r=new Set;let a=300;for(const l of t){const c=n.getDecorationInfo(l);if(!c)continue;const h=i.getValueInRange(l.range).codePointAt(0),u=Q7(h);let f;switch(c.reason.kind){case 0:{c1(c.reason.confusableWith)?f=p(1524,"The character {0} could be confused with the ASCII character {1}, which is more common in source code.",u,Q7(c.reason.confusableWith.codePointAt(0))):f=p(1525,"The character {0} could be confused with the character {1}, which is more common in source code.",u,Q7(c.reason.confusableWith.codePointAt(0)));break}case 1:f=p(1526,"The character {0} is invisible.",u);break;case 2:f=p(1527,"The character {0} is not a basic ASCII character.",u);break}if(r.has(f))continue;r.add(f);const g={codePoint:h,reason:c.reason,inComment:c.inComment,inString:c.inString},m=p(1528,"Adjust settings"),_=mj(sE.ID,g),b=new qn("",!0).appendMarkdown(f).appendText(" ").appendLink(_,m,ZQ);s.push(new ra(this,l.range,[b],!1,a++))}return s}renderHoverParts(e,t){return P0e(e,t,this._editor,this._languageService,this._openerService)}};Y7=G7([Gb(1,Mt),Gb(2,Js)],Y7);function X7(o){return`U+${o.toString(16).padStart(4,"0")}`}function Q7(o){let e=`\`${X7(o)}\``;return nf.isInvisibleCharacter(o)||(e+=` "${`${CRe(o)}`}"`),e}function CRe(o){return o===96?"`` ` ``":"`"+String.fromCodePoint(o)+"`"}function YQ(o,e){return $7.computeUnicodeHighlightReason(o,e)}const hT=class hT{constructor(){this.map=new Map}getDecorationFromOptions(e){return this.getDecoration(!e.includeComments,!e.includeStrings)}getDecoration(e,t){const i=`${e}${t}`;let n=this.map.get(i);return n||(n=Te.createDynamic({description:"unicode-highlight",stickiness:1,className:"unicode-highlight",showIfCollapsed:!0,overviewRuler:null,minimap:null,hideInCommentTokens:e,hideInStringTokens:t}),this.map.set(i,n)),n}};hT.instance=new hT;let nE=hT;class vRe extends le{constructor(){super({id:np.ID,label:H(1537,"Disable highlighting of characters in comments"),precondition:void 0}),this.shortLabel=p(1529,"Disable Highlight In Comments")}async run(e,t,i){const n=e.get(Me);n&&this.runAction(n)}async runAction(e){await e.updateValue(Us.includeComments,!1,2)}}class wRe extends le{constructor(){super({id:np.ID,label:H(1538,"Disable highlighting of characters in strings"),precondition:void 0}),this.shortLabel=p(1530,"Disable Highlight In Strings")}async run(e,t,i){const n=e.get(Me);n&&this.runAction(n)}async runAction(e){await e.updateValue(Us.includeStrings,!1,2)}}const uT=class uT extends ln{constructor(){super({id:uT.ID,title:H(1539,"Disable highlighting of ambiguous characters"),precondition:void 0,f1:!1}),this.shortLabel=p(1531,"Disable Ambiguous Highlight")}async run(e,t,i){const n=e.get(Me);n&&this.runAction(n)}async runAction(e){await e.updateValue(Us.ambiguousCharacters,!1,2)}};uT.ID="editor.action.unicodeHighlight.disableHighlightingOfAmbiguousCharacters";let np=uT;const fT=class fT extends ln{constructor(){super({id:fT.ID,title:H(1540,"Disable highlighting of invisible characters"),precondition:void 0,f1:!1}),this.shortLabel=p(1532,"Disable Invisible Highlight")}async run(e,t,i){const n=e.get(Me);n&&this.runAction(n)}async runAction(e){await e.updateValue(Us.invisibleCharacters,!1,2)}};fT.ID="editor.action.unicodeHighlight.disableHighlightingOfInvisibleCharacters";let G0=fT;const gT=class gT extends ln{constructor(){super({id:gT.ID,title:H(1541,"Disable highlighting of non basic ASCII characters"),precondition:void 0,f1:!1}),this.shortLabel=p(1533,"Disable Non ASCII Highlight")}async run(e,t,i){const n=e.get(Me);n&&this.runAction(n)}async runAction(e){await e.updateValue(Us.nonBasicASCII,!1,2)}};gT.ID="editor.action.unicodeHighlight.disableHighlightingOfNonBasicAsciiCharacters";let Z0=gT;const pT=class pT extends ln{constructor(){super({id:pT.ID,title:H(1542,"Show Exclude Options"),precondition:void 0,f1:!1})}async run(e,t){const{codePoint:i,reason:n,inString:s,inComment:r}=t,a=String.fromCodePoint(i),l=e.get(Zn),c=e.get(Me);function d(g){return nf.isInvisibleCharacter(g)?p(1534,"Exclude {0} (invisible character) from being highlighted",X7(g)):p(1535,"Exclude {0} from being highlighted",`${X7(g)} "${a}"`)}const h=[];if(n.kind===0)for(const g of n.notAmbiguousInLocales)h.push({label:p(1536,'Allow unicode characters that are more common in the language "{0}".',g),run:async()=>{yRe(c,[g])}});if(h.push({label:d(i),run:()=>SRe(c,[i])}),r){const g=new vRe;h.push({label:g.label,run:async()=>g.runAction(c)})}else if(s){const g=new wRe;h.push({label:g.label,run:async()=>g.runAction(c)})}function u(g){return typeof g.desc.title=="string"?g.desc.title:g.desc.title.value}if(n.kind===0){const g=new np;h.push({label:u(g),run:async()=>g.runAction(c)})}else if(n.kind===1){const g=new G0;h.push({label:u(g),run:async()=>g.runAction(c)})}else if(n.kind===2){const g=new Z0;h.push({label:u(g),run:async()=>g.runAction(c)})}else LRe(n);const f=await l.pick(h,{title:ZQ});f&&await f.run()}};pT.ID="editor.action.unicodeHighlight.showExcludeOptions";let sE=pT;async function SRe(o,e){const t=o.getValue(Us.allowedCharacters);let i;typeof t=="object"&&t?i=t:i={};for(const n of e)i[String.fromCodePoint(n)]=!0;await o.updateValue(Us.allowedCharacters,i,2)}async function yRe(o,e){const t=o.inspect(Us.allowedLocales).user?.value;let i;typeof t=="object"&&t?i=Object.assign({},t):i={};for(const n of e)i[n]=!0;await o.updateValue(Us.allowedLocales,i,2)}function LRe(o){throw new Error(`Unexpected value: ${o}`)}mt(np),mt(G0),mt(Z0),mt(sE),Qe(K0.ID,K0,1),Pg.register(Y7);const Y0=We("dialogService");var xRe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},XQ=function(o,e){return function(t,i){e(t,i,o)}};const QQ="ignoreUnusualLineTerminators";function kRe(o,e,t){o.setModelProperty(e.uri,QQ,t)}function IRe(o,e){return o.getModelProperty(e.uri,QQ)}let oE=(BC=class extends A{constructor(e,t,i){super(),this._editor=e,this._dialogService=t,this._codeEditorService=i,this._isPresentingDialog=!1,this._config=this._editor.getOption(143),this._register(this._editor.onDidChangeConfiguration(n=>{n.hasChanged(143)&&(this._config=this._editor.getOption(143),this._checkForUnusualLineTerminators())})),this._register(this._editor.onDidChangeModel(()=>{this._checkForUnusualLineTerminators()})),this._register(this._editor.onDidChangeModelContent(n=>{n.isUndoing||this._checkForUnusualLineTerminators()})),this._checkForUnusualLineTerminators()}async _checkForUnusualLineTerminators(){if(this._config==="off"||!this._editor.hasModel())return;const e=this._editor.getModel();if(!e.mightContainUnusualLineTerminators()||IRe(this._codeEditorService,e)===!0||this._editor.getOption(104))return;if(this._config==="auto"){e.removeUnusualLineTerminators(this._editor.getSelections());return}if(this._isPresentingDialog)return;let i;try{this._isPresentingDialog=!0,i=await this._dialogService.confirm({title:p(1543,"Unusual Line Terminators"),message:p(1544,"Detected unusual line terminators"),detail:p(1545,"The file '{0}' contains one or more unusual line terminator characters, like Line Separator (LS) or Paragraph Separator (PS).\n\nIt is recommended to remove them from the file. This can be configured via `editor.unusualLineTerminators`.",vr(e.uri)),primaryButton:p(1546,"&&Remove Unusual Line Terminators"),cancelButton:p(1547,"Ignore")})}finally{this._isPresentingDialog=!1}if(!i.confirmed){kRe(this._codeEditorService,e,!0);return}e.removeUnusualLineTerminators(this._editor.getSelections())}},BC.ID="editor.contrib.unusualLineTerminatorsDetector",BC);oE=xRe([XQ(1,Y0),XQ(2,et)],oE),Qe(oE.ID,oE,1);const rE="**",JQ="/",aE="[/\\\\]",lE="[^/\\\\]",DRe=/\//g;function eJ(o,e){switch(o){case 0:return"";case 1:return`${lE}*?`;default:return`(?:${aE}|${lE}+${aE}${e?`|${aE}${lE}+`:""})*?`}}function tJ(o,e){if(!o)return[];const t=[];let i=!1,n=!1,s="";for(const r of o){switch(r){case e:if(!i&&!n){t.push(s),s="";continue}break;case"{":i=!0;break;case"}":i=!1;break;case"[":n=!0;break;case"]":n=!1;break}s+=r}return s&&t.push(s),t}function iJ(o){if(!o)return"";let e="";const t=tJ(o,JQ);if(t.every(i=>i===rE))e=".*";else{let i=!1;t.forEach((n,s)=>{if(n===rE){if(i)return;e+=eJ(2,s===t.length-1)}else{let r=!1,a="",l=!1,c="";for(const d of n){if(d!=="}"&&r){a+=d;continue}if(l&&(d!=="]"||!c)){let h;d==="-"?h=d:(d==="^"||d==="!")&&!c?h="^":d===JQ?h="":h=oo(d),c+=h;continue}switch(d){case"{":r=!0;continue;case"[":l=!0;continue;case"}":{const u=`(?:${tJ(a,",").map(f=>iJ(f)).join("|")})`;e+=u,r=!1,a="";break}case"]":{e+="["+c+"]",l=!1,c="";break}case"?":e+=lE;continue;case"*":e+=eJ(1);continue;default:e+=oo(d)}}s<t.length-1&&(t[s+1]!==rE||s+2<t.length)&&(e+=aE)}i=n===rE})}return e}const ERe=/^\*\*\/\*\.[\w\.-]+$/,NRe=/^\*\*\/([\w\.-]+)\/?$/,TRe=/^{\*\*\/\*?[\w\.-]+\/?(,\*\*\/\*?[\w\.-]+\/?)*}$/,RRe=/^{\*\*\/\*?[\w\.-]+(\/(\*\*)?)?(,\*\*\/\*?[\w\.-]+(\/(\*\*)?)?)*}$/,MRe=/^\*\*((\/[\w\.-]+)+)\/?$/,PRe=/^([\w\.-]+(\/[\w\.-]+)*)\/?$/,nJ=new dl(1e4),sJ=function(){return!1},ec=function(){return null};function J7(o,e){if(!o)return ec;let t;typeof o!="string"?t=o.pattern:t=o,t=t.trim();const i=`${t}_${!!e.trimForExclusions}`;let n=nJ.get(i);if(n)return oJ(n,o);let s;return ERe.test(t)?n=ARe(t.substr(4),t):(s=NRe.exec(e9(t,e)))?n=ORe(s[1],t):(e.trimForExclusions?RRe:TRe).test(t)?n=FRe(t,e):(s=MRe.exec(e9(t,e)))?n=rJ(s[1].substr(1),t,!0):(s=PRe.exec(e9(t,e)))?n=rJ(s[1],t,!1):n=WRe(t),nJ.set(i,n),oJ(n,o)}function oJ(o,e){if(typeof e=="string")return o;const t=function(i,n){return f2(i,e.base,!Ws)?o(r1(i.substr(e.base.length),_a),n):null};return t.allBasenames=o.allBasenames,t.allPaths=o.allPaths,t.basenames=o.basenames,t.patterns=o.patterns,t}function e9(o,e){return e.trimForExclusions&&o.endsWith("/**")?o.substr(0,o.length-2):o}function ARe(o,e){return function(t,i){return typeof t=="string"&&t.endsWith(o)?e:null}}function ORe(o,e){const t=`/${o}`,i=`\\${o}`,n=function(r,a){return typeof r!="string"?null:a?a===o?e:null:r===o||r.endsWith(t)||r.endsWith(i)?e:null},s=[o];return n.basenames=s,n.patterns=[e],n.allBasenames=s,n}function FRe(o,e){const t=lJ(o.slice(1,-1).split(",").map(a=>J7(a,e)).filter(a=>a!==ec),o),i=t.length;if(!i)return ec;if(i===1)return t[0];const n=function(a,l){for(let c=0,d=t.length;c<d;c++)if(t[c](a,l))return o;return null},s=t.find(a=>!!a.allBasenames);s&&(n.allBasenames=s.allBasenames);const r=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return r.length&&(n.allPaths=r),n}function rJ(o,e,t){const i=_a===Pi.sep,n=i?o:o.replace(DRe,_a),s=_a+n,r=Pi.sep+o;let a;return t?a=function(l,c){return typeof l=="string"&&(l===n||l.endsWith(s)||!i&&(l===o||l.endsWith(r)))?e:null}:a=function(l,c){return typeof l=="string"&&(l===n||!i&&l===o)?e:null},a.allPaths=[(t?"*/":"./")+o],a}function WRe(o){try{const e=new RegExp(`^${iJ(o)}$`);return function(t){return e.lastIndex=0,typeof t=="string"&&e.test(t)?o:null}}catch{return ec}}function BRe(o,e,t){return!o||typeof e!="string"?!1:aJ(o)(e,void 0,t)}function aJ(o,e={}){if(!o)return sJ;if(typeof o=="string"||HRe(o)){const t=J7(o,e);if(t===ec)return sJ;const i=function(n,s){return!!t(n,s)};return t.allBasenames&&(i.allBasenames=t.allBasenames),t.allPaths&&(i.allPaths=t.allPaths),i}return VRe(o,e)}function HRe(o){const e=o;return e?typeof e.base=="string"&&typeof e.pattern=="string":!1}function VRe(o,e){const t=lJ(Object.getOwnPropertyNames(o).map(a=>zRe(a,o[a],e)).filter(a=>a!==ec)),i=t.length;if(!i)return ec;if(!t.some(a=>!!a.requiresSiblings)){if(i===1)return t[0];const a=function(d,h){let u;for(let f=0,g=t.length;f<g;f++){const m=t[f](d,h);if(typeof m=="string")return m;dR(m)&&(u||(u=[]),u.push(m))}return u?(async()=>{for(const f of u){const g=await f;if(typeof g=="string")return g}return null})():null},l=t.find(d=>!!d.allBasenames);l&&(a.allBasenames=l.allBasenames);const c=t.reduce((d,h)=>h.allPaths?d.concat(h.allPaths):d,[]);return c.length&&(a.allPaths=c),a}const n=function(a,l,c){let d,h;for(let u=0,f=t.length;u<f;u++){const g=t[u];g.requiresSiblings&&c&&(l||(l=nh(a)),d||(d=l.substr(0,l.length-Gie(a).length)));const m=g(a,l,d,c);if(typeof m=="string")return m;dR(m)&&(h||(h=[]),h.push(m))}return h?(async()=>{for(const u of h){const f=await u;if(typeof f=="string")return f}return null})():null},s=t.find(a=>!!a.allBasenames);s&&(n.allBasenames=s.allBasenames);const r=t.reduce((a,l)=>l.allPaths?a.concat(l.allPaths):a,[]);return r.length&&(n.allPaths=r),n}function zRe(o,e,t){if(e===!1)return ec;const i=J7(o,t);if(i===ec)return ec;if(typeof e=="boolean")return i;if(e){const n=e.when;if(typeof n=="string"){const s=(r,a,l,c)=>{if(!c||!i(r,a))return null;const d=n.replace("$(basename)",()=>l),h=c(d);return dR(h)?h.then(u=>u?o:null):h?o:null};return s.requiresSiblings=!0,s}}return i}function lJ(o,e){const t=o.filter(a=>!!a.basenames);if(t.length<2)return o;const i=t.reduce((a,l)=>{const c=l.basenames;return c?a.concat(c):a},[]);let n;if(e){n=[];for(let a=0,l=i.length;a<l;a++)n.push(e)}else n=t.reduce((a,l)=>{const c=l.patterns;return c?a.concat(c):a},[]);const s=function(a,l){if(typeof a!="string")return null;if(!l){let d;for(d=a.length;d>0;d--){const h=a.charCodeAt(d-1);if(h===47||h===92)break}l=a.substr(d)}const c=i.indexOf(l);return c!==-1?n[c]:null};s.basenames=i,s.patterns=n,s.allBasenames=i;const r=o.filter(a=>!a.basenames);return r.push(s),r}function t9(o,e,t,i,n,s){if(Array.isArray(o)){let r=0;for(const a of o){const l=t9(a,e,t,i,n,s);if(l===10)return l;l>r&&(r=l)}return r}else{if(typeof o=="string")return i?o==="*"?5:o===t?10:0:0;if(o){const{language:r,pattern:a,scheme:l,hasAccessToAllModels:c,notebookType:d}=o;if(!i&&!c)return 0;d&&n&&(e=n);let h=0;if(l)if(l===e.scheme)h=10;else if(l==="*")h=5;else return 0;if(r)if(r===t)h=10;else if(r==="*")h=Math.max(h,5);else return 0;if(d)if(d===s)h=10;else if(d==="*"&&s!==void 0)h=Math.max(h,5);else return 0;if(a){let u;if(typeof a=="string"?u=a:u={...a,base:c6(a.base)},u===e.fsPath||BRe(u,e.fsPath))h=10;else return 0}return h}else return 0}}var URe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$Re=function(o,e){return function(t,i){e(t,i,o)}};class cJ{constructor(){this.selector={language:"*"}}provideDocumentHighlights(e,t,i){const n=[],s=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});return s?e.isDisposed()?void 0:e.findMatches(s.word,!0,!1,!0,Jy,!1).map(a=>({range:a.range,kind:y_.Text})):Promise.resolve(n)}provideMultiDocumentHighlights(e,t,i,n){const s=new Li,r=e.getWordAtPosition({lineNumber:t.lineNumber,column:t.column});if(!r)return Promise.resolve(s);for(const a of[e,...i]){if(a.isDisposed())continue;const c=a.findMatches(r.word,!0,!1,!0,Jy,!1).map(d=>({range:d.range,kind:y_.Text}));c&&s.set(a.uri,c)}return s}}let i9=class extends A{constructor(e){super(),this._register(e.documentHighlightProvider.register("*",new cJ)),this._register(e.multiDocumentHighlightProvider.register("*",new cJ))}};i9=URe([$Re(0,he)],i9);var dJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},tc=function(o,e){return function(t,i){e(t,i,o)}},gi,n9;const s9=new ae("hasWordHighlights",!1);function hJ(o,e,t,i){const n=o.ordered(e);return hR(n.map(s=>()=>Promise.resolve(s.provideDocumentHighlights(e,t,i)).then(void 0,Di)),s=>s!=null).then(s=>{if(s){const r=new Li;return r.set(e.uri,s),r}return new Li})}function jRe(o,e,t,i,n){const s=o.ordered(e);return hR(s.map(r=>()=>{const a=n.filter(l=>KH(l)).filter(l=>t9(r.selector,l.uri,l.getLanguageId(),!0,void 0,void 0)>0);return Promise.resolve(r.provideMultiDocumentHighlights(e,t,a,i)).then(void 0,Di)}),r=>r!=null)}class uJ{constructor(e,t,i){this._model=e,this._selection=t,this._wordSeparators=i,this._wordRange=this._getCurrentWordRange(e,t),this._result=null}get result(){return this._result||(this._result=Vi(e=>this._compute(this._model,this._selection,this._wordSeparators,e))),this._result}_getCurrentWordRange(e,t){const i=e.getWordAtPosition(t.getPosition());return i?new k(t.startLineNumber,i.startColumn,t.startLineNumber,i.endColumn):null}cancel(){this.result.cancel()}}class qRe extends uJ{constructor(e,t,i,n){super(e,t,i),this._providers=n}_compute(e,t,i,n){return hJ(this._providers,e,t.getPosition(),n).then(s=>s||new Li)}}class KRe extends uJ{constructor(e,t,i,n,s){super(e,t,i),this._providers=n,this._otherModels=s}_compute(e,t,i,n){return jRe(this._providers,e,t.getPosition(),n,this._otherModels).then(s=>s||new Li)}}function GRe(o,e,t,i){return new qRe(e,t,i,o)}function ZRe(o,e,t,i,n){return new KRe(e,t,i,o,n)}zs("_executeDocumentHighlights",async(o,e,t)=>{const i=o.get(he);return(await hJ(i.documentHighlightProvider,e,t,He.None))?.get(e.uri)});let o9=(ju=class{constructor(e,t,i,n,s,r,a,l){this.toUnhook=new U,this.workerRequestTokenId=0,this.workerRequestCompleted=!1,this.workerRequestValue=new Li,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,this.runDelayer=this.toUnhook.add(new fr(50)),this.editor=e,this.providers=t,this.multiDocumentProviders=i,this.codeEditorService=r,this.textModelService=s,this.configurationService=a,this.logService=l,this._hasWordHighlights=s9.bindTo(n),this._ignorePositionChangeEvent=!1,this.occurrencesHighlightEnablement=this.editor.getOption(90),this.occurrencesHighlightDelay=this.configurationService.getValue("editor.occurrencesHighlightDelay"),this.model=this.editor.getModel(),this.toUnhook.add(e.onDidChangeCursorPosition(c=>{this._ignorePositionChangeEvent||this.occurrencesHighlightEnablement!=="off"&&this.runDelayer.trigger(()=>{this._onPositionChanged(c)})})),this.toUnhook.add(e.onDidFocusEditorText(c=>{this.occurrencesHighlightEnablement!=="off"&&(this.workerRequest||this.runDelayer.trigger(()=>{this._run()}))})),this.toUnhook.add(e.onDidChangeModelContent(c=>{fy(this.model.uri,"output")||this._stopAll()})),this.toUnhook.add(e.onDidChangeModel(c=>{!c.newModelUrl&&c.oldModelUrl?this._stopSingular():gi.query&&this._run()})),this.toUnhook.add(e.onDidChangeConfiguration(c=>{const d=this.editor.getOption(90);if(this.occurrencesHighlightEnablement!==d)switch(this.occurrencesHighlightEnablement=d,d){case"off":this._stopAll();break;case"singleFile":this._stopAll(gi.query?.modelInfo?.modelURI);break;case"multiFile":gi.query&&this._run(!0);break;default:console.warn("Unknown occurrencesHighlight setting value:",d);break}})),this.toUnhook.add(this.configurationService.onDidChangeConfiguration(c=>{if(c.affectsConfiguration("editor.occurrencesHighlightDelay")){const d=a.getValue("editor.occurrencesHighlightDelay");this.occurrencesHighlightDelay!==d&&(this.occurrencesHighlightDelay=d)}})),this.toUnhook.add(e.onDidBlurEditorWidget(()=>{const c=this.codeEditorService.getFocusedCodeEditor();c?c.getModel()?.uri.scheme===we.vscodeNotebookCell&&this.editor.getModel()?.uri.scheme!==we.vscodeNotebookCell&&this._stopAll():this._stopAll()})),this.decorations=this.editor.createDecorationsCollection(),this.workerRequestTokenId=0,this.workerRequest=null,this.workerRequestCompleted=!1,this.lastCursorPositionChangeTime=0,this.renderDecorationsTimer=void 0,gi.query&&this._run()}hasDecorations(){return this.decorations.length>0}restore(e){this.occurrencesHighlightEnablement!=="off"&&(this.runDelayer.cancel(),this.runDelayer.trigger(()=>{this._run(!1,e)}))}stop(){this.occurrencesHighlightEnablement!=="off"&&this._stopAll()}_getSortedHighlights(){return this.decorations.getRanges().sort(k.compareRangesUsingStarts)}moveNext(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))+1)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);ps(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}moveBack(){const e=this._getSortedHighlights(),i=(e.findIndex(s=>s.containsPosition(this.editor.getPosition()))-1+e.length)%e.length,n=e[i];try{this._ignorePositionChangeEvent=!0,this.editor.setPosition(n.getStartPosition()),this.editor.revealRangeInCenterIfOutsideViewport(n);const s=this._getWord();if(s){const r=this.editor.getModel().getLineContent(n.startLineNumber);ps(`${r}, ${i+1} of ${e.length} for '${s.word}'`)}}finally{this._ignorePositionChangeEvent=!1}}_removeSingleDecorations(){if(!this.editor.hasModel())return;const e=gi.storedDecorationIDs.get(this.editor.getModel().uri);e&&(this.editor.removeDecorations(e),gi.storedDecorationIDs.delete(this.editor.getModel().uri),this.decorations.length>0&&(this.decorations.clear(),this._hasWordHighlights.set(!1)))}_removeAllDecorations(e){const t=this.codeEditorService.listCodeEditors(),i=[];for(const n of t){if(!n.hasModel()||ch(n.getModel().uri,e))continue;const s=gi.storedDecorationIDs.get(n.getModel().uri);if(!s)continue;n.removeDecorations(s),i.push(n.getModel().uri);const r=fu.get(n);r?.wordHighlighter&&r.wordHighlighter.decorations.length>0&&(r.wordHighlighter.decorations.clear(),r.wordHighlighter.workerRequest=null,r.wordHighlighter._hasWordHighlights.set(!1))}for(const n of i)gi.storedDecorationIDs.delete(n)}_stopSingular(){this._removeSingleDecorations(),this.editor.hasTextFocus()&&(this.editor.getModel()?.uri.scheme!==we.vscodeNotebookCell&&gi.query?.modelInfo?.modelURI.scheme!==we.vscodeNotebookCell?(gi.query=null,this._run()):gi.query?.modelInfo&&(gi.query.modelInfo=null)),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_stopAll(e){this._removeAllDecorations(e),this.renderDecorationsTimer!==void 0&&(clearTimeout(this.renderDecorationsTimer),this.renderDecorationsTimer=void 0),this.workerRequest!==null&&(this.workerRequest.cancel(),this.workerRequest=null),this.workerRequestCompleted||(this.workerRequestTokenId++,this.workerRequestCompleted=!0)}_onPositionChanged(e){if(this.occurrencesHighlightEnablement==="off"){this._stopAll();return}if(e.source!=="api"&&e.reason!==3){this._stopAll();return}this._run()}_getWord(){const e=this.editor.getSelection(),t=e.startLineNumber,i=e.startColumn;return this.model.isDisposed()?null:this.model.getWordAtPosition({lineNumber:t,column:i})}getOtherModelsToHighlight(e){if(!e)return[];if(e.uri.scheme===we.vscodeNotebookCell){const s=[],r=this.codeEditorService.listCodeEditors();for(const a of r){const l=a.getModel();l&&l!==e&&l.uri.scheme===we.vscodeNotebookCell&&s.push(l)}return s}const i=[],n=this.codeEditorService.listCodeEditors();for(const s of n){if(!q4(s))continue;const r=s.getModel();r&&e===r.modified&&i.push(r.modified)}if(i.length)return i;if(this.occurrencesHighlightEnablement==="singleFile")return[];for(const s of n){const r=s.getModel();r&&r!==e&&i.push(r)}return i}async _run(e,t){if(this.editor.hasTextFocus()){const n=this.editor.getSelection();if(!n||n.startLineNumber!==n.endLineNumber){gi.query=null,this._stopAll();return}const s=n.startColumn,r=n.endColumn,a=this._getWord();if(!a||a.startColumn>s||a.endColumn<r){gi.query=null,this._stopAll();return}gi.query={modelInfo:{modelURI:this.model.uri,selection:n}}}else if(!gi.query){this._stopAll();return}if(this.lastCursorPositionChangeTime=new Date().getTime(),ch(this.editor.getModel().uri,gi.query.modelInfo?.modelURI)){if(!e){const a=this.decorations.getRanges();for(const l of a)if(l.containsPosition(this.editor.getPosition()))return}this._stopAll(e?this.model.uri:void 0);const n=++this.workerRequestTokenId;this.workerRequestCompleted=!1;const s=this.getOtherModelsToHighlight(this.editor.getModel());if(!gi.query||!gi.query.modelInfo)return;const r=await this.textModelService.createModelReference(gi.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(r.object.textEditorModel,gi.query.modelInfo.selection,s),this.workerRequest?.result.then(a=>{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=a||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Ee)}catch(a){this.logService.error("Unexpected error during occurrence request. Log: ",a)}finally{r.dispose()}}else if(this.model.uri.scheme===we.vscodeNotebookCell){const n=++this.workerRequestTokenId;if(this.workerRequestCompleted=!1,!gi.query||!gi.query.modelInfo)return;const s=await this.textModelService.createModelReference(gi.query.modelInfo.modelURI);try{this.workerRequest=this.computeWithModel(s.object.textEditorModel,gi.query.modelInfo.selection,[this.model]),this.workerRequest?.result.then(r=>{n===this.workerRequestTokenId&&(this.workerRequestCompleted=!0,this.workerRequestValue=r||[],this._beginRenderDecorations(t??this.occurrencesHighlightDelay))},Ee)}catch(r){this.logService.error("Unexpected error during occurrence request. Log: ",r)}finally{s.dispose()}}}computeWithModel(e,t,i){return i.length?ZRe(this.multiDocumentProviders,e,t,this.editor.getOption(148),i):GRe(this.providers,e,t,this.editor.getOption(148))}_beginRenderDecorations(e){const t=new Date().getTime(),i=this.lastCursorPositionChangeTime+e;t>=i?(this.renderDecorationsTimer=void 0,this.renderDecorations()):this.renderDecorationsTimer=setTimeout(()=>{this.renderDecorations()},i-t)}renderDecorations(){this.renderDecorationsTimer=void 0;const e=this.codeEditorService.listCodeEditors();for(const t of e){const i=fu.get(t);if(!i)continue;const n=[],s=t.getModel()?.uri;if(s&&this.workerRequestValue.has(s)){const r=gi.storedDecorationIDs.get(s),a=this.workerRequestValue.get(s);if(a)for(const c of a)c.range&&n.push({range:c.range,options:sTe(c.kind)});let l=[];t.changeDecorations(c=>{l=c.deltaDecorations(r??[],n)}),gi.storedDecorationIDs=gi.storedDecorationIDs.set(s,l),n.length>0&&(i.wordHighlighter?.decorations.set(n),i.wordHighlighter?._hasWordHighlights.set(!0))}}this.workerRequest=null}dispose(){this._stopSingular(),this.toUnhook.dispose()}},gi=ju,ju.storedDecorationIDs=new Li,ju.query=null,ju);o9=gi=dJ([tc(4,ns),tc(5,et),tc(6,Me),tc(7,Rt)],o9);let fu=(pm=class extends A{static get(e){return e.getContribution(n9.ID)}constructor(e,t,i,n,s,r,a){super(),this._wordHighlighter=null;const l=()=>{e.hasModel()&&!e.getModel().isTooLargeForTokenization()&&e.getModel().uri.scheme!==we.accessibleView&&(this._wordHighlighter=new o9(e,i.documentHighlightProvider,i.multiDocumentHighlightProvider,t,s,n,r,a))};this._register(e.onDidChangeModel(c=>{this._wordHighlighter&&(!c.newModelUrl&&c.oldModelUrl?.scheme!==we.vscodeNotebookCell&&this.wordHighlighter?.stop(),this._wordHighlighter.dispose(),this._wordHighlighter=null),l()})),l()}get wordHighlighter(){return this._wordHighlighter}saveViewState(){return!!(this._wordHighlighter&&this._wordHighlighter.hasDecorations())}moveNext(){this._wordHighlighter?.moveNext()}moveBack(){this._wordHighlighter?.moveBack()}restoreViewState(e){this._wordHighlighter&&e&&this._wordHighlighter.restore(250)}dispose(){this._wordHighlighter&&(this._wordHighlighter.dispose(),this._wordHighlighter=null),super.dispose()}},n9=pm,pm.ID="editor.contrib.wordHighlighter",pm);fu=n9=dJ([tc(1,xe),tc(2,he),tc(3,et),tc(4,ns),tc(5,Me),tc(6,Rt)],fu);class fJ extends le{constructor(e,t){super(t),this._isNext=e}run(e,t){const i=fu.get(t);i&&(this._isNext?i.moveNext():i.moveBack())}}class YRe extends fJ{constructor(){super(!0,{id:"editor.action.wordHighlight.next",label:H(1557,"Go to Next Symbol Highlight"),precondition:s9,kbOpts:{kbExpr:T.editorTextFocus,primary:65,weight:100}})}}class XRe extends fJ{constructor(){super(!1,{id:"editor.action.wordHighlight.prev",label:H(1558,"Go to Previous Symbol Highlight"),precondition:s9,kbOpts:{kbExpr:T.editorTextFocus,primary:1089,weight:100}})}}class QRe extends le{constructor(){super({id:"editor.action.wordHighlight.trigger",label:H(1559,"Trigger Symbol Highlight"),precondition:void 0,kbOpts:{kbExpr:T.editorTextFocus,primary:0,weight:100}})}run(e,t,i){const n=fu.get(t);n&&n.restoreViewState(!0)}}Qe(fu.ID,fu,0),ne(YRe),ne(XRe),ne(QRe),cb(i9);class cE extends Bi{constructor(e){super(e),this._inSelectionMode=e.inSelectionMode,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){if(!t.hasModel())return;const n=Sr(t.getOption(148),t.getOption(147)),s=t.getModel(),r=t.getSelections(),a=r.length>1,l=r.map(c=>{const d=new M(c.positionLineNumber,c.positionColumn),h=this._move(n,s,d,this._wordNavigationType,a);return this._moveTo(c,h,this._inSelectionMode)});if(s.pushStackElement(),t._getViewModel().setCursorStates("moveWordCommand",3,l.map(c=>nt.fromModelSelection(c))),l.length===1){const c=new M(l[0].positionLineNumber,l[0].positionColumn);t.revealPosition(c,0)}}_moveTo(e,t,i){return i?new ce(e.selectionStartLineNumber,e.selectionStartColumn,t.lineNumber,t.column):new ce(t.lineNumber,t.column,t.lineNumber,t.column)}}class gu extends cE{_move(e,t,i,n,s){return ut.moveWordLeft(e,t,i,n,s)}}class pu extends cE{_move(e,t,i,n,s){return ut.moveWordRight(e,t,i,n)}}class JRe extends gu{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartLeft",precondition:void 0})}}class e2e extends gu{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndLeft",precondition:void 0})}}class t2e extends gu{constructor(){super({inSelectionMode:!1,wordNavigationType:1,id:"cursorWordLeft",precondition:void 0,kbOpts:{kbExpr:K.and(T.textInputFocus,K.and(o_,hI)?.negate()),primary:2063,mac:{primary:527},weight:100}})}}class i2e extends gu{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartLeftSelect",precondition:void 0})}}class n2e extends gu{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndLeftSelect",precondition:void 0})}}class s2e extends gu{constructor(){super({inSelectionMode:!0,wordNavigationType:1,id:"cursorWordLeftSelect",precondition:void 0,kbOpts:{kbExpr:K.and(T.textInputFocus,K.and(o_,hI)?.negate()),primary:3087,mac:{primary:1551},weight:100}})}}class o2e extends gu{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityLeft",precondition:void 0})}_move(e,t,i,n,s){return super._move(Sr(Da.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class r2e extends gu{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityLeftSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Sr(Da.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class a2e extends pu{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordStartRight",precondition:void 0})}}class l2e extends pu{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordEndRight",precondition:void 0,kbOpts:{kbExpr:K.and(T.textInputFocus,K.and(o_,hI)?.negate()),primary:2065,mac:{primary:529},weight:100}})}}class c2e extends pu{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordRight",precondition:void 0})}}class d2e extends pu{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordStartRightSelect",precondition:void 0})}}class h2e extends pu{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordEndRightSelect",precondition:void 0,kbOpts:{kbExpr:K.and(T.textInputFocus,K.and(o_,hI)?.negate()),primary:3089,mac:{primary:1553},weight:100}})}}class u2e extends pu{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordRightSelect",precondition:void 0})}}class f2e extends pu{constructor(){super({inSelectionMode:!1,wordNavigationType:3,id:"cursorWordAccessibilityRight",precondition:void 0})}_move(e,t,i,n,s){return super._move(Sr(Da.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class g2e extends pu{constructor(){super({inSelectionMode:!0,wordNavigationType:3,id:"cursorWordAccessibilityRightSelect",precondition:void 0})}_move(e,t,i,n,s){return super._move(Sr(Da.wordSeparators.defaultValue,e.intlSegmenterLocales),t,i,n,s)}}class dE extends Bi{constructor(e){super(e),this._whitespaceHeuristics=e.whitespaceHeuristics,this._wordNavigationType=e.wordNavigationType}runEditorCommand(e,t,i){const n=e?.get(Jt);if(!t.hasModel()||!n)return;const s=Sr(t.getOption(148),t.getOption(147)),r=t.getModel(),a=t.getSelections(),l=t.getOption(10),c=t.getOption(15),d=n.getLanguageConfiguration(r.getLanguageId()).getAutoClosingPairs(),h=t._getViewModel(),u=a.map(f=>{const g=this._delete({wordSeparators:s,model:r,selection:f,whitespaceHeuristics:this._whitespaceHeuristics,autoClosingDelete:t.getOption(13),autoClosingBrackets:l,autoClosingQuotes:c,autoClosingPairs:d,autoClosedCharacters:h.getCursorAutoClosedCharacters()},this._wordNavigationType);return new Dn(g,"")});t.pushUndoStop(),t.executeCommands(this.id,u),t.pushUndoStop()}}class r9 extends dE{_delete(e,t){const i=ut.deleteWordLeft(e,t);return i||new k(1,1,1,1)}}class a9 extends dE{_delete(e,t){const i=ut.deleteWordRight(e,t);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class p2e extends r9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartLeft",precondition:T.writable})}}class m2e extends r9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndLeft",precondition:T.writable})}}class _2e extends r9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordLeft",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:2049,mac:{primary:513},weight:100}})}}class b2e extends a9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:0,id:"deleteWordStartRight",precondition:T.writable})}}class C2e extends a9{constructor(){super({whitespaceHeuristics:!1,wordNavigationType:2,id:"deleteWordEndRight",precondition:T.writable})}}class v2e extends a9{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordRight",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:2068,mac:{primary:532},weight:100}})}}class w2e extends le{constructor(){super({id:"deleteInsideWord",precondition:T.writable,label:H(1560,"Delete Word")})}run(e,t,i){if(!t.hasModel())return;const n=Sr(t.getOption(148),t.getOption(147)),s=t.getModel(),a=t.getSelections().map(l=>{const c=ut.deleteInsideWord(n,s,l);return new Dn(c,"")});t.pushUndoStop(),t.executeCommands(this.id,a),t.pushUndoStop()}}re(new JRe),re(new e2e),re(new t2e),re(new i2e),re(new n2e),re(new s2e),re(new a2e),re(new l2e),re(new c2e),re(new d2e),re(new h2e),re(new u2e),re(new o2e),re(new r2e),re(new f2e),re(new g2e),re(new p2e),re(new m2e),re(new _2e),re(new b2e),re(new C2e),re(new v2e),ne(w2e);class S2e extends dE{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:0,id:"deleteWordPartLeft",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:769},weight:100}})}_delete(e,t){const i=Gy.deleteWordPartLeft(e);return i||new k(1,1,1,1)}}class y2e extends dE{constructor(){super({whitespaceHeuristics:!0,wordNavigationType:2,id:"deleteWordPartRight",precondition:T.writable,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:788},weight:100}})}_delete(e,t){const i=Gy.deleteWordPartRight(e);if(i)return i;const n=e.model.getLineCount(),s=e.model.getLineMaxColumn(n);return new k(n,s,n,s)}}class gJ extends cE{_move(e,t,i,n,s){return Gy.moveWordPartLeft(e,t,i,s)}}class L2e extends gJ{constructor(){super({inSelectionMode:!1,wordNavigationType:0,id:"cursorWordPartLeft",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:783},weight:100}})}}Xe.registerCommandAlias("cursorWordPartStartLeft","cursorWordPartLeft");class x2e extends gJ{constructor(){super({inSelectionMode:!0,wordNavigationType:0,id:"cursorWordPartLeftSelect",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:1807},weight:100}})}}Xe.registerCommandAlias("cursorWordPartStartLeftSelect","cursorWordPartLeftSelect");class pJ extends cE{_move(e,t,i,n,s){return Gy.moveWordPartRight(e,t,i)}}class k2e extends pJ{constructor(){super({inSelectionMode:!1,wordNavigationType:2,id:"cursorWordPartRight",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:785},weight:100}})}}class I2e extends pJ{constructor(){super({inSelectionMode:!0,wordNavigationType:2,id:"cursorWordPartRightSelect",precondition:void 0,kbOpts:{kbExpr:T.textInputFocus,primary:0,mac:{primary:1809},weight:100}})}}re(new S2e),re(new y2e),re(new L2e),re(new x2e),re(new k2e),re(new I2e);const pB=class pB extends A{constructor(e){super(),this.editor=e,this._register(this.editor.onDidAttemptReadOnlyEdit(()=>this._onDidAttemptReadOnlyEdit()))}_onDidAttemptReadOnlyEdit(){const e=So.get(this.editor);if(e&&this.editor.hasModel()){let t=this.editor.getOptions().get(105);t||(this.editor.isSimpleWidget?t=new qn(p(1363,"Cannot edit in read-only input")):t=new qn(p(1364,"Cannot edit in read-only editor"))),e.showMessage(t,this.editor.getPosition())}}};pB.ID="editor.contrib.readOnlyMessageController";let hE=pB;Qe(hE.ID,hE,2);var D2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mJ=function(o,e){return function(t,i){e(t,i,o)}};let l9=class extends A{constructor(e,t,i){super(),this._textModel=e,this._languageFeaturesService=t,this._outlineModelService=i,this._currentModel=Le(this,void 0);const n=co("documentSymbolProvider.onDidChange",this._languageFeaturesService.documentSymbolProvider.onDidChange),s=co("_textModel.onDidChangeContent",ie.debounce(r=>this._textModel.onDidChangeContent(r),()=>{},100));this._register(Bn(async(r,a)=>{n.read(r),s.read(r);const l=a.add(new mCe),c=await this._outlineModelService.getOrCreate(this._textModel,l.token);a.isDisposed||this._currentModel.set(c,void 0)}))}getBreadcrumbItems(e,t){const i=this._currentModel.read(t);if(!i)return[];const n=i.asListOfDocumentSymbols().filter(s=>e.contains(s.range.startLineNumber)&&!e.contains(s.range.endLineNumber));return n.sort(R6(kn(s=>s.range.endLineNumber-s.range.startLineNumber,lo))),n.map(s=>({name:s.name,kind:s.kind,startLineNumber:s.range.startLineNumber}))}};l9=D2e([mJ(1,he),mJ(2,l0)],l9),vk.setBreadcrumbsSourceFactory((o,e)=>e.createInstance(l9,o));var E2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},c9=function(o,e){return function(t,i){e(t,i,o)}};let uE=(HC=class extends A{constructor(e,t,i,n){super();const s=this._register(ni(e)),r=this._register(n.createMenu(de.EditorContent,e.contextKeyService)),a=rt(this,r.onDidChange,()=>r.getActions().length===0);this._register(Se(l=>{if(a.read(l))return;const d=Je("div.floating-menu-overlay-widget");d.root.style.height="28px";const h=t.createInstance(bw,d.root,de.EditorContent,{actionViewItemProvider:(u,f)=>{if(!(u instanceof Po))return;const g=i.lookupKeybinding(u.id);if(g)return t.createInstance(class extends Uh{updateLabel(){this.options.label&&this.label&&(this.label.textContent=`${this._commandAction.label} (${g.getLabel()})`)}},u,{...f,keybindingNotRenderedWithLabel:!0})},hiddenItemStrategy:0,menuOptions:{shouldForwardArgs:!0},telemetrySource:"editor.overlayToolbar",toolbarOptions:{primaryGroup:()=>!0,useSeparatorsInPrimaryActions:!0}});l.store.add(h),l.store.add(Se(u=>{const f=s.model.read(u);h.context=f?.uri})),l.store.add(s.createOverlayWidget({allowEditorOverflow:!1,domNode:d.root,minContentWidthInPx:Et(0),position:Et({preference:1})}))}))}},HC.ID="editor.contrib.floatingToolbar",HC);uE=E2e([c9(1,ge),c9(2,ot),c9(3,Cr)],uE),Qe(uE.ID,uE,1);var d9;(function(o){o.inspectTokensAction=p(782,"Developer: Inspect Tokens")})(d9||(d9={}));var fE;(function(o){o.gotoLineActionLabel=p(783,"Go to Line/Column...")})(fE||(fE={}));var h9;(function(o){o.helpQuickAccessActionLabel=p(784,"Show all Quick Access Providers")})(h9||(h9={}));var gE;(function(o){o.quickCommandActionLabel=p(785,"Command Palette"),o.quickCommandHelp=p(786,"Show And Run Commands")})(gE||(gE={}));var X0;(function(o){o.quickOutlineActionLabel=p(787,"Go to Symbol..."),o.quickOutlineByCategoryActionLabel=p(788,"Go to Symbol by Category...")})(X0||(X0={}));var u9;(function(o){o.editorViewAccessibleLabel=p(789,"Editor content")})(u9||(u9={}));var f9;(function(o){o.toggleHighContrast=p(790,"Toggle High Contrast Theme")})(f9||(f9={}));var g9;(function(o){o.bulkEditServiceSummary=p(791,"Made {0} edits in {1} files")})(g9||(g9={}));const mB=class mB extends A{constructor(e){super(),this.editor=e,this.widget=null,ur&&(this._register(e.onDidChangeConfiguration(()=>this.update())),this.update())}update(){const e=!this.editor.getOption(104);!this.widget&&e?this.widget=new p9(this.editor):this.widget&&!e&&(this.widget.dispose(),this.widget=null)}dispose(){super.dispose(),this.widget&&(this.widget.dispose(),this.widget=null)}};mB.ID="editor.contrib.iPadShowKeyboard";let pE=mB;const mT=class mT extends A{constructor(e){super(),this.editor=e,this._domNode=document.createElement("textarea"),this._domNode.className="iPadShowKeyboard",this._register(W(this._domNode,"touchstart",t=>{this.editor.focus()})),this._register(W(this._domNode,"focus",t=>{this.editor.focus()})),this.editor.addOverlayWidget(this)}dispose(){this.editor.removeOverlayWidget(this),super.dispose()}getId(){return mT.ID}getDomNode(){return this._domNode}getPosition(){return{preference:1}}};mT.ID="editor.contrib.ShowKeyboardWidget";let p9=mT;Qe(pE.ID,pE,3);const ir=We("themeService");var N2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},_J=function(o,e){return function(t,i){e(t,i,o)}},m9;let Q0=(mm=class extends A{static get(e){return e.getContribution(m9.ID)}constructor(e,t,i){super(),this._editor=e,this._languageService=i,this._widget=null,this._register(this._editor.onDidChangeModel(n=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(n=>this.stop())),this._register(di.onDidChange(n=>this.stop())),this._register(this._editor.onKeyUp(n=>n.keyCode===9&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&(this._widget=new _9(this._editor,this._languageService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}},m9=mm,mm.ID="editor.contrib.inspectTokens",mm);Q0=m9=N2e([_J(1,ir),_J(2,Mt)],Q0);class T2e extends le{constructor(){super({id:"editor.action.inspectTokens",label:d9.inspectTokensAction,alias:"Developer: Inspect Tokens",precondition:void 0})}run(e,t){Q0.get(t)?.launch()}}function R2e(o){let e="";for(let t=0,i=o.length;t<i;t++){const n=o.charCodeAt(t);switch(n){case 9:e+="→";break;case 32:e+="·";break;default:e+=String.fromCharCode(n)}}return e}function M2e(o,e){const t=di.get(e);if(t)return t;const i=o.encodeLanguageId(e);return{getInitialState:()=>A_,tokenize:(n,s,r)=>VP(e,r),tokenizeEncoded:(n,s,r)=>wx(i,r)}}const _T=class _T extends A{constructor(e,t){super(),this.allowEditorOverflow=!0,this._editor=e,this._languageService=t,this._model=this._editor.getModel(),this._domNode=document.createElement("div"),this._domNode.className="tokens-inspect-widget",this._tokenizationSupport=M2e(this._languageService.languageIdCodec,this._model.getLanguageId()),this._compute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(i=>this._compute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._editor.removeContentWidget(this),super.dispose()}getId(){return _T._ID}_compute(e){const t=this._getTokensAtLine(e.lineNumber);let i=0;for(let l=t.tokens1.length-1;l>=0;l--){const c=t.tokens1[l];if(e.column-1>=c.offset){i=l;break}}let n=0;for(let l=t.tokens2.length>>>1;l>=0;l--)if(e.column-1>=t.tokens2[l<<1]){n=l;break}const s=this._model.getLineContent(e.lineNumber);let r="";if(i<t.tokens1.length){const l=t.tokens1[i].offset,c=i+1<t.tokens1.length?t.tokens1[i+1].offset:s.length;r=s.substring(l,c)}Yi(this._domNode,Q("h2.tm-token",void 0,R2e(r),Q("span.tm-token-length",void 0,`${r.length} ${r.length===1?"char":"chars"}`))),Z(this._domNode,Q("hr.tokens-inspect-separator",{style:"clear:both"}));const a=(n<<1)+1<t.tokens2.length?this._decodeMetadata(t.tokens2[(n<<1)+1]):null;Z(this._domNode,Q("table.tm-metadata-table",void 0,Q("tbody",void 0,Q("tr",void 0,Q("td.tm-metadata-key",void 0,"language"),Q("td.tm-metadata-value",void 0,`${a?a.languageId:"-?-"}`)),Q("tr",void 0,Q("td.tm-metadata-key",void 0,"token type"),Q("td.tm-metadata-value",void 0,`${a?this._tokenTypeToString(a.tokenType):"-?-"}`)),Q("tr",void 0,Q("td.tm-metadata-key",void 0,"font style"),Q("td.tm-metadata-value",void 0,`${a?this._fontStyleToString(a.fontStyle):"-?-"}`)),Q("tr",void 0,Q("td.tm-metadata-key",void 0,"foreground"),Q("td.tm-metadata-value",void 0,`${a?$.Format.CSS.formatHex(a.foreground):"-?-"}`)),Q("tr",void 0,Q("td.tm-metadata-key",void 0,"background"),Q("td.tm-metadata-value",void 0,`${a?$.Format.CSS.formatHex(a.background):"-?-"}`))))),Z(this._domNode,Q("hr.tokens-inspect-separator")),i<t.tokens1.length&&Z(this._domNode,Q("span.tm-token-type",void 0,t.tokens1[i].type)),this._editor.layoutContentWidget(this)}_decodeMetadata(e){const t=di.getColorMap(),i=zn.getLanguageId(e),n=zn.getTokenType(e),s=zn.getFontStyle(e),r=zn.getForeground(e),a=zn.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(i),tokenType:n,fontStyle:s,foreground:t[r],background:t[a]}}_tokenTypeToString(e){switch(e){case 0:return"Other";case 1:return"Comment";case 2:return"String";case 3:return"RegEx";default:return"??"}}_fontStyleToString(e){let t="";return e&1&&(t+="italic "),e&2&&(t+="bold "),e&4&&(t+="underline "),e&8&&(t+="strikethrough "),t.length===0&&(t="---"),t}_getTokensAtLine(e){const t=this._getStateBeforeLine(e),i=this._tokenizationSupport.tokenize(this._model.getLineContent(e),!0,t),n=this._tokenizationSupport.tokenizeEncoded(this._model.getLineContent(e),!0,t);return{startState:t,tokens1:i.tokens,tokens2:n.tokens,endState:i.endState}}_getStateBeforeLine(e){let t=this._tokenizationSupport.getInitialState();for(let i=1;i<e;i++)t=this._tokenizationSupport.tokenize(this._model.getLineContent(i),!0,t).endState;return t}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[2,1]}}};_T._ID="editor.contrib.inspectTokensWidget";let _9=_T;Qe(Q0.ID,Q0,4),ne(T2e);var b9;(function(o){o[o.PRESERVE=0]="PRESERVE",o[o.LAST=1]="LAST"})(b9||(b9={}));const sp={Quickaccess:"workbench.contributions.quickaccess"};class P2e{constructor(){this.providers=[],this.defaultProvider=void 0}registerQuickAccessProvider(e){return e.prefix.length===0?this.defaultProvider=e:this.providers.push(e),this.providers.sort((t,i)=>i.prefix.length-t.prefix.length),ue(()=>{this.providers.splice(this.providers.indexOf(e),1),this.defaultProvider===e&&(this.defaultProvider=void 0)})}getQuickAccessProviders(){return wa([this.defaultProvider,...this.providers])}getQuickAccessProvider(e){return e&&this.providers.find(i=>e.startsWith(i.prefix))||void 0||this.defaultProvider}}ei.add(sp.Quickaccess,new P2e);var A2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bJ=function(o,e){return function(t,i){e(t,i,o)}},J0;let C9=(_m=class{constructor(e,t){this.quickInputService=e,this.keybindingService=t,this.registry=ei.as(sp.Quickaccess)}provide(e){const t=new U;return t.add(e.onDidAccept(()=>{const[i]=e.selectedItems;i&&this.quickInputService.quickAccess.show(i.prefix,{preserveValue:!0})})),t.add(e.onDidChangeValue(i=>{const n=this.registry.getQuickAccessProvider(i.substr(J0.PREFIX.length));n&&n.prefix&&n.prefix!==J0.PREFIX&&this.quickInputService.quickAccess.show(n.prefix,{preserveValue:!0})})),e.items=this.getQuickAccessProviders().filter(i=>i.prefix!==J0.PREFIX),t}getQuickAccessProviders(){return this.registry.getQuickAccessProviders().sort((t,i)=>t.prefix.localeCompare(i.prefix)).flatMap(t=>this.createPicks(t))}createPicks(e){return e.helpEntries.map(t=>{const i=t.prefix||e.prefix,n=i||"…";return{prefix:i,label:n,keybinding:t.commandId?this.keybindingService.lookupKeybinding(t.commandId):void 0,ariaLabel:p(1730,"{0}, {1}",n,t.description),description:t.description}})}},J0=_m,_m.PREFIX="?",_m);C9=J0=A2e([bJ(0,Zn),bJ(1,ot)],C9),ei.as(sp.Quickaccess).registerQuickAccessProvider({ctor:C9,prefix:"",helpEntries:[{description:h9.helpQuickAccessActionLabel}]});class CJ{constructor(e){this.options=e,this.rangeHighlightDecorationId=void 0}provide(e,t,i){const n=new U;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;const s=n.add(new ct);return s.value=this.doProvide(e,t,i),n.add(this.onDidActiveTextEditorControlChange(()=>{s.value=void 0,s.value=this.doProvide(e,t)})),n}doProvide(e,t,i){const n=new U,s=this.activeTextEditorControl;if(s&&this.canProvideWithTextEditor(s)){const r={editor:s},a=ZG(s);if(a){let l=s.saveViewState()??void 0;n.add(a.onDidChangeCursorPosition(()=>{l=s.saveViewState()??void 0})),r.restoreViewState=()=>{l&&s===this.activeTextEditorControl&&s.restoreViewState(l)},n.add(Yu(t.onCancellationRequested)(()=>r.restoreViewState?.()))}n.add(ue(()=>this.clearDecorations(s))),n.add(this.provideWithTextEditor(r,e,t,i))}else n.add(this.provideWithoutTextEditor(e,t));return n}canProvideWithTextEditor(e){return!0}gotoLocation({editor:e},t){e.setSelection(t.range,"code.jump"),e.revealRangeInCenter(t.range,0),t.preserveFocus||e.focus();const i=e.getModel();i&&"getLineContent"in i&&cl(`${i.getLineContent(t.range.startLineNumber)}`)}getModel(e){return q4(e)?e.getModel()?.modified:e.getModel()}addDecorations(e,t){e.changeDecorations(i=>{const n=[];this.rangeHighlightDecorationId&&(n.push(this.rangeHighlightDecorationId.overviewRulerDecorationId),n.push(this.rangeHighlightDecorationId.rangeHighlightId),this.rangeHighlightDecorationId=void 0);const s=[{range:t,options:{description:"quick-access-range-highlight",className:"rangeHighlight",isWholeLine:!0}},{range:t,options:{description:"quick-access-range-highlight-overview",overviewRuler:{color:ci(Oz),position:Ao.Full}}}],[r,a]=i.deltaDecorations(n,s);this.rangeHighlightDecorationId={rangeHighlightId:r,overviewRulerDecorationId:a}})}clearDecorations(e){const t=this.rangeHighlightDecorationId;t&&(e.changeDecorations(i=>{i.deltaDecorations([t.overviewRulerDecorationId,t.rangeHighlightId],[])}),this.rangeHighlightDecorationId=void 0)}}const bT=class bT extends CJ{constructor(){super({canAcceptInBackground:!0})}provideWithoutTextEditor(e){const t=p(1325,"Open a text editor first to go to a line.");return e.items=[{label:t}],e.ariaLabel=t,A.None}provideWithTextEditor(e,t,i){const n=e.editor,s=new U;s.add(t.onDidAccept(l=>{const[c]=t.selectedItems;if(c){if(!this.isValidLineNumber(n,c.lineNumber))return;this.gotoLocation(e,{range:this.toRange(c.lineNumber,c.column),keyMods:t.keyMods,preserveFocus:l.inBackground}),l.inBackground||t.hide()}}));const r=()=>{const l=this.parsePosition(n,t.value.trim().substr(bT.PREFIX.length)),c=this.getPickLabel(n,l.lineNumber,l.column);if(t.items=[{lineNumber:l.lineNumber,column:l.column,label:c}],t.ariaLabel=c,!this.isValidLineNumber(n,l.lineNumber)){this.clearDecorations(n);return}const d=this.toRange(l.lineNumber,l.column);n.revealRangeInCenter(d,0),this.addDecorations(n,d)};r(),s.add(t.onDidChangeValue(()=>r()));const a=ZG(n);return a&&a.getOptions().get(76).renderType===2&&(a.updateOptions({lineNumbers:"on"}),s.add(ue(()=>a.updateOptions({lineNumbers:"relative"})))),s}toRange(e=1,t=1){return{startLineNumber:e,startColumn:t,endLineNumber:e,endColumn:t}}parsePosition(e,t){const i=t.split(/,|:|#/).map(s=>parseInt(s,10)).filter(s=>!isNaN(s)),n=this.lineCount(e)+1;return{lineNumber:i[0]>0?i[0]:n+i[0],column:i[1]}}getPickLabel(e,t,i){if(this.isValidLineNumber(e,t))return this.isValidColumn(e,t,i)?p(1326,"Go to line {0} and character {1}.",t,i):p(1327,"Go to line {0}.",t);const n=e.getPosition()||{lineNumber:1,column:1},s=this.lineCount(e);return s>1?p(1328,"Current Line: {0}, Character: {1}. Type a line number between 1 and {2} to navigate to.",n.lineNumber,n.column,s):p(1329,"Current Line: {0}, Character: {1}. Type a line number to navigate to.",n.lineNumber,n.column)}isValidLineNumber(e,t){return!t||typeof t!="number"?!1:t>0&&t<=this.lineCount(e)}isValidColumn(e,t,i){if(!i||typeof i!="number")return!1;const n=this.getModel(e);if(!n)return!1;const s={lineNumber:t,column:i};return n.validatePosition(s).equals(s)}lineCount(e){return this.getModel(e)?.getLineCount()??0}};bT.PREFIX=":";let v9=bT;var O2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},F2e=function(o,e){return function(t,i){e(t,i,o)}};let eS=class extends v9{constructor(e){super(),this.editorService=e,this.onDidActiveTextEditorControlChange=ie.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};eS=O2e([F2e(0,et)],eS);let vJ=(bm=class extends le{constructor(){super({id:bm.ID,label:fE.gotoLineActionLabel,alias:"Go to Line/Column...",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:2085,mac:{primary:293},weight:100}})}run(e){e.get(Zn).quickAccess.show(eS.PREFIX)}},bm.ID="editor.action.gotoLine",bm);ne(vJ),ei.as(sp.Quickaccess).registerQuickAccessProvider({ctor:eS,prefix:eS.PREFIX,helpEntries:[{description:fE.gotoLineActionLabel,commandId:vJ.ID}]});const wJ=[void 0,[]];function w9(o,e,t=0,i=0){const n=e;return n.values&&n.values.length>1?W2e(o,n.values,t,i):SJ(o,e,t,i)}function W2e(o,e,t,i){let n=0;const s=[];for(const r of e){const[a,l]=SJ(o,r,t,i);if(typeof a!="number")return wJ;n+=a,s.push(...l)}return[n,B2e(s)]}function SJ(o,e,t,i){const n=lg(e.original,e.originalLowercase,t,o,o.toLowerCase(),i,{firstMatchCanBeWeak:!0,boostFullMatch:!0});return n?[n[0],Vv(n)]:wJ}function B2e(o){const e=o.sort((n,s)=>n.start-s.start),t=[];let i;for(const n of e)!i||!H2e(i,n)?(i=n,t.push(n)):(i.start=Math.min(i.start,n.start),i.end=Math.max(i.end,n.end));return t}function H2e(o,e){return!(o.end<e.start||e.end<o.start)}function yJ(o){return o.startsWith('"')&&o.endsWith('"')}const LJ=" ";function S9(o){typeof o!="string"&&(o="");const e=o.toLowerCase(),{pathNormalized:t,normalized:i,normalizedLowercase:n}=xJ(o),s=t.indexOf(_a)>=0,r=yJ(o);let a;const l=o.split(LJ);if(l.length>1)for(const c of l){const d=yJ(c),{pathNormalized:h,normalized:u,normalizedLowercase:f}=xJ(c);u&&(a||(a=[]),a.push({original:c,originalLowercase:c.toLowerCase(),pathNormalized:h,normalized:u,normalizedLowercase:f,expectContiguousMatch:d}))}return{original:o,originalLowercase:e,pathNormalized:t,normalized:i,normalizedLowercase:n,values:a,containsPathSeparator:s,expectContiguousMatch:r}}function xJ(o){let e;gn?e=o.replace(/\//g,_a):e=o.replace(/\\/g,_a);const t=e.replace(/[\*\u2026\s"]/g,"");return{pathNormalized:e,normalized:t,normalizedLowercase:t.toLowerCase()}}function kJ(o){return Array.isArray(o)?S9(o.map(e=>e.original).join(LJ)):S9(o.original)}var V2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IJ=function(o,e){return function(t,i){e(t,i,o)}},mE;let op=(nl=class extends CJ{constructor(e,t,i=Object.create(null)){super(i),this._languageFeaturesService=e,this._outlineModelService=t,this.options=i,this.options.canAcceptInBackground=!0}provideWithoutTextEditor(e){return this.provideLabelPick(e,p(1330,"To go to a symbol, first open a text editor with symbol information.")),A.None}provideWithTextEditor(e,t,i,n){const s=e.editor,r=this.getModel(s);return r?this._languageFeaturesService.documentSymbolProvider.has(r)?this.doProvideWithEditorSymbols(e,r,t,i,n):this.doProvideWithoutEditorSymbols(e,r,t,i):A.None}doProvideWithoutEditorSymbols(e,t,i,n){const s=new U;return this.provideLabelPick(i,p(1331,"The active text editor does not provide symbol information.")),(async()=>!await this.waitForLanguageSymbolRegistry(t,s)||n.isCancellationRequested||s.add(this.doProvideWithEditorSymbols(e,t,i,n)))(),s}provideLabelPick(e,t){e.items=[{label:t,index:0,kind:14}],e.ariaLabel=t}async waitForLanguageSymbolRegistry(e,t){if(this._languageFeaturesService.documentSymbolProvider.has(e))return!0;const i=new Ju,n=t.add(this._languageFeaturesService.documentSymbolProvider.onDidChange(()=>{this._languageFeaturesService.documentSymbolProvider.has(e)&&(n.dispose(),i.complete(!0))}));return t.add(ue(()=>i.complete(!1))),i.p}doProvideWithEditorSymbols(e,t,i,n,s){const r=e.editor,a=new U;a.add(i.onDidAccept(h=>{const[u]=i.selectedItems;u&&u.range&&(this.gotoLocation(e,{range:u.range.selection,keyMods:i.keyMods,preserveFocus:h.inBackground}),s?.handleAccept?.(u,h.inBackground),h.inBackground||i.hide())})),a.add(i.onDidTriggerItemButton(({item:h})=>{h&&h.range&&(this.gotoLocation(e,{range:h.range.selection,keyMods:i.keyMods,forceSideBySide:!0}),i.hide())}));const l=this.getDocumentSymbols(t,n),c=a.add(new ct),d=async h=>{c?.value?.cancel(),i.busy=!1,c.value=new Xt,i.busy=!0;try{const u=S9(i.value.substr(mE.PREFIX.length).trim()),f=await this.doGetSymbolPicks(l,u,void 0,c.value.token,t);if(n.isCancellationRequested)return;if(f.length>0){if(i.items=f,h&&u.original.length===0){const g=nv(f,m=>!!(m.type!=="separator"&&m.range&&k.containsPosition(m.range.decoration,h)));g&&(i.activeItems=[g])}}else u.original.length>0?this.provideLabelPick(i,p(1332,"No matching editor symbols")):this.provideLabelPick(i,p(1333,"No editor symbols"))}finally{n.isCancellationRequested||(i.busy=!1)}};return a.add(i.onDidChangeValue(()=>d(void 0))),d(r.getSelection()?.getPosition()),a.add(i.onDidChangeActive(()=>{const[h]=i.activeItems;h&&h.range&&(r.revealRangeInCenter(h.range.selection,0),this.addDecorations(r,h.range.decoration))})),a}async doGetSymbolPicks(e,t,i,n,s){const r=await e;if(n.isCancellationRequested)return[];const a=t.original.indexOf(mE.SCOPE_PREFIX)===0,l=a?1:0;let c,d;t.values&&t.values.length>1?(c=kJ(t.values[0]),d=kJ(t.values.slice(1))):c=t;let h;const u=this.options?.openSideBySideDirection?.();u&&(h=[{iconClass:u==="right"?ve.asClassName(Y.splitHorizontal):ve.asClassName(Y.splitVertical),tooltip:u==="right"?p(1334,"Open to the Side"):p(1335,"Open to the Bottom")}]);const f=[];for(let _=0;_<r.length;_++){const b=r[_],C=xie(b.name),w=`$(${QL.toIcon(b.kind).id}) ${C}`,v=w.length-C.length;let S=b.containerName;i?.extraContainerLabel&&(S?S=`${i.extraContainerLabel} • ${S}`:S=i.extraContainerLabel);let L,x,I,D;if(t.original.length>l){let F=!1;if(c!==t&&([L,x]=w9(w,{...t,values:void 0},l,v),typeof L=="number"&&(F=!0)),typeof L!="number"&&([L,x]=w9(w,c,l,v),typeof L!="number"))continue;if(!F&&d){if(S&&d.original.length>0&&([I,D]=w9(S,d)),typeof I!="number")continue;typeof L=="number"&&(L+=I)}}const R=b.tags&&b.tags.indexOf(1)>=0;f.push({index:_,kind:b.kind,score:L,label:w,ariaLabel:Vhe(b.name,b.kind),description:S,highlights:R?void 0:{label:x,description:D},range:{selection:k.collapseToStart(b.selectionRange),decoration:b.range},uri:s.uri,symbolName:C,strikethrough:R,buttons:h})}const g=f.sort((_,b)=>a?this.compareByKindAndScore(_,b):this.compareByScore(_,b));let m=[];if(a){let w=function(){b&&typeof _=="number"&&C>0&&(b.label=tf(L9[_]||y9,C))},_,b,C=0;for(const v of g)_!==v.kind?(w(),_=v.kind,C=1,b={type:"separator"},m.push(b)):C++,m.push(v);w()}else g.length>0&&(m=[{label:p(1336,"symbols ({0})",f.length),type:"separator"},...g]);return m}compareByScore(e,t){if(typeof e.score!="number"&&typeof t.score=="number")return 1;if(typeof e.score=="number"&&typeof t.score!="number")return-1;if(typeof e.score=="number"&&typeof t.score=="number"){if(e.score>t.score)return-1;if(e.score<t.score)return 1}return e.index<t.index?-1:e.index>t.index?1:0}compareByKindAndScore(e,t){const i=L9[e.kind]||y9,n=L9[t.kind]||y9,s=i.localeCompare(n);return s===0?this.compareByScore(e,t):s}async getDocumentSymbols(e,t){const i=await this._outlineModelService.getOrCreate(e,t);return t.isCancellationRequested?[]:i.asListOfDocumentSymbols()}},mE=nl,nl.PREFIX="@",nl.SCOPE_PREFIX=":",nl.PREFIX_BY_CATEGORY=`${nl.PREFIX}${nl.SCOPE_PREFIX}`,nl);op=mE=V2e([IJ(0,he),IJ(1,l0)],op);const y9=p(1337,"properties ({0})"),L9={5:p(1338,"methods ({0})"),11:p(1339,"functions ({0})"),8:p(1340,"constructors ({0})"),12:p(1341,"variables ({0})"),4:p(1342,"classes ({0})"),22:p(1343,"structs ({0})"),23:p(1344,"events ({0})"),24:p(1345,"operators ({0})"),10:p(1346,"interfaces ({0})"),2:p(1347,"namespaces ({0})"),3:p(1348,"packages ({0})"),25:p(1349,"type parameters ({0})"),1:p(1350,"modules ({0})"),6:p(1351,"properties ({0})"),9:p(1352,"enumerations ({0})"),21:p(1353,"enumeration members ({0})"),14:p(1354,"strings ({0})"),0:p(1355,"files ({0})"),17:p(1356,"arrays ({0})"),15:p(1357,"numbers ({0})"),16:p(1358,"booleans ({0})"),18:p(1359,"objects ({0})"),19:p(1360,"keys ({0})"),7:p(1361,"fields ({0})"),13:p(1362,"constants ({0})")};var z2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},x9=function(o,e){return function(t,i){e(t,i,o)}};let k9=class extends op{constructor(e,t,i){super(t,i),this.editorService=e,this.onDidActiveTextEditorControlChange=ie.None}get activeTextEditorControl(){return this.editorService.getFocusedCodeEditor()??void 0}};k9=z2e([x9(0,et),x9(1,he),x9(2,l0)],k9);const CT=class CT extends le{constructor(){super({id:CT.ID,label:X0.quickOutlineActionLabel,alias:"Go to Symbol...",precondition:T.hasDocumentSymbolProvider,kbOpts:{kbExpr:T.focus,primary:3117,weight:100},contextMenuOpts:{group:"navigation",order:3}})}run(e){e.get(Zn).quickAccess.show(op.PREFIX,{itemActivation:Ha.NONE})}};CT.ID="editor.action.quickOutline";let _E=CT;ne(_E),ei.as(sp.Quickaccess).registerQuickAccessProvider({ctor:k9,prefix:op.PREFIX,helpEntries:[{description:X0.quickOutlineActionLabel,prefix:op.PREFIX,commandId:_E.ID},{description:X0.quickOutlineByCategoryActionLabel,prefix:op.PREFIX_BY_CATEGORY}]});function U2e(o){const e=new Map;for(const t of o)e.set(t,(e.get(t)??0)+1);return e}class tS{constructor(){this.chunkCount=0,this.chunkOccurrences=new Map,this.documents=new Map}calculateScores(e,t){const i=this.computeEmbedding(e),n=new Map,s=[];for(const[r,a]of this.documents){if(t.isCancellationRequested)return[];for(const l of a.chunks){const c=this.computeSimilarityScore(l,i,n);c>0&&s.push({key:r,score:c})}}return s}static termFrequencies(e){return U2e(tS.splitTerms(e))}static*splitTerms(e){const t=i=>i.toLowerCase();for(const[i]of e.matchAll(new RegExp("\\b\\p{Letter}[\\p{Letter}\\d]{2,}\\b","gu"))){yield t(i);const n=i.replace(/([a-z])([A-Z])/g,"$1 $2").split(/\s+/g);if(n.length>1)for(const s of n)s.length>2&&new RegExp("\\p{Letter}{3,}","gu").test(s)&&(yield t(s))}}updateDocuments(e){for(const{key:t}of e)this.deleteDocument(t);for(const t of e){const i=[];for(const n of t.textChunks){const s=tS.termFrequencies(n);for(const r of s.keys())this.chunkOccurrences.set(r,(this.chunkOccurrences.get(r)??0)+1);i.push({text:n,tf:s})}this.chunkCount+=i.length,this.documents.set(t.key,{chunks:i})}return this}deleteDocument(e){const t=this.documents.get(e);if(t){this.documents.delete(e),this.chunkCount-=t.chunks.length;for(const i of t.chunks)for(const n of i.tf.keys()){const s=this.chunkOccurrences.get(n);if(typeof s=="number"){const r=s-1;r<=0?this.chunkOccurrences.delete(n):this.chunkOccurrences.set(n,r)}}}}computeSimilarityScore(e,t,i){let n=0;for(const[s,r]of Object.entries(t)){const a=e.tf.get(s);if(!a)continue;let l=i.get(s);typeof l!="number"&&(l=this.computeIdf(s),i.set(s,l));const c=a*l;n+=c*r}return n}computeEmbedding(e){const t=tS.termFrequencies(e);return this.computeTfidf(t)}computeIdf(e){const t=this.chunkOccurrences.get(e)??0;return t>0?Math.log((this.chunkCount+1)/t):0}computeTfidf(e){const t=Object.create(null);for(const[i,n]of e){const s=this.computeIdf(i);s>0&&(t[i]=n*s)}return t}}function $2e(o){const e=o.slice(0);e.sort((i,n)=>n.score-i.score);const t=e[0]?.score??0;if(t>0)for(const i of e)i.score/=t;return e}var Zb;(function(o){o[o.NO_ACTION=0]="NO_ACTION",o[o.CLOSE_PICKER=1]="CLOSE_PICKER",o[o.REFRESH_PICKER=2]="REFRESH_PICKER",o[o.REMOVE_ITEM=3]="REMOVE_ITEM"})(Zb||(Zb={}));function I9(o){const e=o;return Array.isArray(e.items)}function DJ(o){const e=o;return!!e.picks&&e.additionalPicks instanceof Promise}class j2e extends A{constructor(e,t){super(),this.prefix=e,this.options=t}provide(e,t,i){const n=new U;e.canAcceptInBackground=!!this.options?.canAcceptInBackground,e.matchOnLabel=e.matchOnDescription=e.matchOnDetail=e.sortByLabel=!1;let s;const r=n.add(new ct),a=async()=>{s?.dispose(!0),e.busy=!1;const c=r.value=new U;s=c.add(new Xt(t));const d=s.token;let h=e.value.substring(this.prefix.length);this.options?.shouldSkipTrimPickFilter||(h=h.trim());const u=this._getPicks(h,c,d,i),f=(m,_)=>{let b,C;if(I9(m)?(b=m.items,C=m.active):b=m,b.length===0){if(_)return!1;(h.length>0||e.hideInput)&&this.options?.noResultsPick&&(Ku(this.options.noResultsPick)?b=[this.options.noResultsPick(h)]:b=[this.options.noResultsPick])}return e.items=b,C&&(e.activeItems=[C]),!0},g=async m=>{let _=!1,b=!1;await Promise.all([(async()=>{typeof m.mergeDelay=="number"&&(await al(m.mergeDelay),d.isCancellationRequested)||b||(_=f(m.picks,!0))})(),(async()=>{e.busy=!0;try{const C=await m.additionalPicks;if(d.isCancellationRequested)return;let w,v;I9(m.picks)?(w=m.picks.items,v=m.picks.active):w=m.picks;let S,L;if(I9(C)?(S=C.items,L=C.active):S=C,S.length>0||!_){let x;if(!v&&!L){const I=e.activeItems[0];I&&w.indexOf(I)!==-1&&(x=I)}f({items:[...w,...S],active:v||L||x})}}finally{d.isCancellationRequested||(e.busy=!1),b=!0}})()])};if(u!==null)if(DJ(u))await g(u);else if(!(u instanceof Promise))f(u);else{e.busy=!0;try{const m=await u;if(d.isCancellationRequested)return;DJ(m)?await g(m):f(m)}finally{d.isCancellationRequested||(e.busy=!1)}}};n.add(e.onDidChangeValue(()=>a())),a(),n.add(e.onDidAccept(c=>{if(i?.handleAccept){c.inBackground||e.hide(),i.handleAccept?.(e.activeItems[0],c.inBackground);return}const[d]=e.selectedItems;typeof d?.accept=="function"&&(c.inBackground||e.hide(),d.accept(e.keyMods,c))}));const l=async(c,d)=>{if(typeof d.trigger!="function")return;const h=d.buttons?.indexOf(c)??-1;if(h>=0){const u=d.trigger(h,e.keyMods),f=typeof u=="number"?u:await u;if(t.isCancellationRequested)return;switch(f){case Zb.NO_ACTION:break;case Zb.CLOSE_PICKER:e.hide();break;case Zb.REFRESH_PICKER:a();break;case Zb.REMOVE_ITEM:{const g=e.items.indexOf(d);if(g!==-1){const m=e.items.slice(),_=m.splice(g,1),b=e.activeItems.filter(w=>w!==_[0]),C=e.keepScrollPosition;e.keepScrollPosition=!0,e.items=m,b&&(e.activeItems=b),e.keepScrollPosition=C}break}}}};return n.add(e.onDidTriggerItemButton(({button:c,item:d})=>l(c,d))),n.add(e.onDidTriggerSeparatorButton(({button:c,separator:d})=>l(c,d))),n}}var EJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},mu=function(o,e){return function(t,i){e(t,i,o)}},rp,Hi;let D9=(pc=class extends j2e{constructor(e,t,i,n,s,r){super(rp.PREFIX,e),this.keybindingService=i,this.commandService=n,this.telemetryService=s,this.dialogService=r,this.commandsHistory=this._register(t.createInstance(E9)),this.options=e}async _getPicks(e,t,i,n){const s=await this.getCommandPicks(i);if(i.isCancellationRequested)return[];const r=Yu(()=>{const f=new tS;f.updateDocuments(s.map(m=>({key:m.commandId,textChunks:[this.getTfIdfChunk(m)]})));const g=f.calculateScores(e,i);return $2e(g).filter(m=>m.score>rp.TFIDF_THRESHOLD).slice(0,rp.TFIDF_MAX_RESULTS)}),a=[];for(const f of s){const g=rp.WORD_FILTER(e,f.label)??void 0,m=f.commandAlias?rp.WORD_FILTER(e,f.commandAlias)??void 0:void 0;if(g||m)f.highlights={label:g,detail:this.options.showAlias?m:void 0},a.push(f);else if(e===f.commandId)a.push(f);else if(e.length>=3){const _=r();if(i.isCancellationRequested)return[];const b=_.find(C=>C.key===f.commandId);b&&(f.tfIdfScore=b.score,a.push(f))}}const l=new Map;for(const f of a){const g=l.get(f.label);g?(f.description=f.commandId,g.description=g.commandId):l.set(f.label,f)}a.sort((f,g)=>{if(f.tfIdfScore&&g.tfIdfScore)return f.tfIdfScore===g.tfIdfScore?f.label.localeCompare(g.label):g.tfIdfScore-f.tfIdfScore;if(f.tfIdfScore)return 1;if(g.tfIdfScore)return-1;const m=this.commandsHistory.peek(f.commandId),_=this.commandsHistory.peek(g.commandId);if(m&&_)return m>_?-1:1;if(m)return-1;if(_)return 1;if(this.options.suggestedCommandIds){const b=this.options.suggestedCommandIds.has(f.commandId),C=this.options.suggestedCommandIds.has(g.commandId);if(b&&C)return 0;if(b)return-1;if(C)return 1}return f.label.localeCompare(g.label)});const c=[];let d=!1,h=!0,u=!!this.options.suggestedCommandIds;for(let f=0;f<a.length;f++){const g=a[f];f===0&&this.commandsHistory.peek(g.commandId)&&(c.push({type:"separator",label:p(1723,"recently used")}),d=!0),h&&g.tfIdfScore!==void 0&&(c.push({type:"separator",label:p(1724,"similar commands")}),h=!1),u&&g.tfIdfScore===void 0&&!this.commandsHistory.peek(g.commandId)&&this.options.suggestedCommandIds?.has(g.commandId)&&(c.push({type:"separator",label:p(1725,"commonly used")}),d=!0,u=!1),d&&g.tfIdfScore===void 0&&!this.commandsHistory.peek(g.commandId)&&!this.options.suggestedCommandIds?.has(g.commandId)&&(c.push({type:"separator",label:p(1726,"other commands")}),d=!1),c.push(this.toCommandPick(g,n))}return this.hasAdditionalCommandPicks(e,i)?{picks:c,additionalPicks:(async()=>{const f=await this.getAdditionalCommandPicks(s,a,e,i);if(i.isCancellationRequested)return[];const g=f.map(m=>this.toCommandPick(m,n));return h&&g[0]?.type!=="separator"&&g.unshift({type:"separator",label:p(1727,"similar commands")}),g})()}:c}toCommandPick(e,t){if(e.type==="separator")return e;const i=this.keybindingService.lookupKeybinding(e.commandId),n=i?p(1728,"{0}, {1}",e.label,i.getAriaLabel()):e.label;return{...e,ariaLabel:n,detail:this.options.showAlias&&e.commandAlias!==e.label?e.commandAlias:void 0,keybinding:i,accept:async()=>{this.commandsHistory.push(e.commandId),this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.commandId,from:t?.from??"quick open"});try{e.args?.length?await this.commandService.executeCommand(e.commandId,...e.args):await this.commandService.executeCommand(e.commandId)}catch(s){Do(s)||this.dialogService.error(p(1729,"Command '{0}' resulted in an error",e.label),Rk(s))}}}}getTfIdfChunk({label:e,commandAlias:t,commandDescription:i}){let n=e;return t&&t!==e&&(n+=` - ${t}`),i&&i.value!==e&&(n+=` - ${i.value===i.original?i.value:`${i.value} (${i.original})`}`),n}},rp=pc,pc.PREFIX=">",pc.TFIDF_THRESHOLD=.5,pc.TFIDF_MAX_RESULTS=5,pc.WORD_FILTER=pA(Hv,Fme,ej),pc);D9=rp=EJ([mu(1,ge),mu(2,ot),mu(3,Tt),mu(4,Vn),mu(5,Y0)],D9);let E9=(sl=class extends A{constructor(e,t,i){super(),this.storageService=e,this.configurationService=t,this.logService=i,this.configuredCommandsHistoryLength=0,this.updateConfiguration(),this.load(),this.registerListeners()}registerListeners(){this._register(this.configurationService.onDidChangeConfiguration(e=>this.updateConfiguration(e))),this._register(this.storageService.onWillSaveState(e=>{e.reason===zh.SHUTDOWN&&this.saveState()}))}updateConfiguration(e){e&&!e.affectsConfiguration("workbench.commandPalette.history")||(this.configuredCommandsHistoryLength=Hi.getConfiguredCommandHistoryLength(this.configurationService),Hi.cache&&Hi.cache.limit!==this.configuredCommandsHistoryLength&&(Hi.cache.limit=this.configuredCommandsHistoryLength,Hi.hasChanges=!0))}load(){const e=this.storageService.get(Hi.PREF_KEY_CACHE,0);let t;if(e)try{t=JSON.parse(e)}catch(n){this.logService.error(`[CommandsHistory] invalid data: ${n}`)}const i=Hi.cache=new dl(this.configuredCommandsHistoryLength,1);if(t){let n;t.usesLRU?n=t.entries:n=t.entries.sort((s,r)=>s.value-r.value),n.forEach(s=>i.set(s.key,s.value))}Hi.counter=this.storageService.getNumber(Hi.PREF_KEY_COUNTER,0,Hi.counter)}push(e){Hi.cache&&(Hi.cache.set(e,Hi.counter++),Hi.hasChanges=!0)}peek(e){return Hi.cache?.peek(e)}saveState(){if(!Hi.cache||!Hi.hasChanges)return;const e={usesLRU:!0,entries:[]};Hi.cache.forEach((t,i)=>e.entries.push({key:i,value:t})),this.storageService.store(Hi.PREF_KEY_CACHE,JSON.stringify(e),0,0),this.storageService.store(Hi.PREF_KEY_COUNTER,Hi.counter,0,0),Hi.hasChanges=!1}static getConfiguredCommandHistoryLength(e){const i=e.getValue().workbench?.commandPalette?.history;return typeof i=="number"?i:Hi.DEFAULT_COMMANDS_HISTORY_LENGTH}},Hi=sl,sl.DEFAULT_COMMANDS_HISTORY_LENGTH=50,sl.PREF_KEY_CACHE="commandPalette.mru.cache",sl.PREF_KEY_COUNTER="commandPalette.mru.counter",sl.counter=1,sl.hasChanges=!1,sl);E9=Hi=EJ([mu(0,Es),mu(1,Me),mu(2,Rt)],E9);class q2e extends D9{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r)}getCodeEditorCommandPicks(){const e=this.activeTextEditorControl;if(!e)return[];const t=[];for(const i of e.getSupportedActions()){let n;i.metadata?.description&&(M1e(i.metadata.description)?n=i.metadata.description:n={original:i.metadata.description,value:i.metadata.description}),t.push({commandId:i.id,commandAlias:i.alias,commandDescription:n,label:kA(i.label)||i.id})}return t}}var K2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Yb=function(o,e){return function(t,i){e(t,i,o)}};let iS=class extends q2e{get activeTextEditorControl(){return this.codeEditorService.getFocusedCodeEditor()??void 0}constructor(e,t,i,n,s,r){super({showAlias:!1},e,i,n,s,r),this.codeEditorService=t}async getCommandPicks(){return this.getCodeEditorCommandPicks()}hasAdditionalCommandPicks(){return!1}async getAdditionalCommandPicks(){return[]}};iS=K2e([Yb(0,ge),Yb(1,et),Yb(2,ot),Yb(3,Tt),Yb(4,Vn),Yb(5,Y0)],iS);const vT=class vT extends le{constructor(){super({id:vT.ID,label:gE.quickCommandActionLabel,alias:"Command Palette",precondition:void 0,kbOpts:{kbExpr:T.focus,primary:59,weight:100},contextMenuOpts:{group:"z_commands",order:1}})}run(e){e.get(Zn).quickAccess.show(iS.PREFIX)}};vT.ID="editor.action.quickCommand";let bE=vT;ne(bE),ei.as(sp.Quickaccess).registerQuickAccessProvider({ctor:iS,prefix:iS.PREFIX,helpEntries:[{description:gE.quickCommandHelp,commandId:bE.ID}]});var G2e=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Xb=function(o,e){return function(t,i){e(t,i,o)}};let N9=class extends jg{constructor(e,t,i,n,s,r,a){super(!0,e,t,i,n,s,r,a)}};N9=G2e([Xb(1,xe),Xb(2,et),Xb(3,hi),Xb(4,ge),Xb(5,Es),Xb(6,Me)],N9),Qe(jg.ID,N9,4);class Z2e{constructor(e,t,i,n,s){this._parsedThemeRuleBrand=void 0,this.token=e,this.index=t,this.fontStyle=i,this.foreground=n,this.background=s}}function Y2e(o){if(!o||!Array.isArray(o))return[];const e=[];let t=0;for(let i=0,n=o.length;i<n;i++){const s=o[i];let r=-1;if(typeof s.fontStyle=="string"){r=0;const c=s.fontStyle.split(" ");for(let d=0,h=c.length;d<h;d++)switch(c[d]){case"italic":r=r|1;break;case"bold":r=r|2;break;case"underline":r=r|4;break;case"strikethrough":r=r|8;break}}let a=null;typeof s.foreground=="string"&&(a=s.foreground);let l=null;typeof s.background=="string"&&(l=s.background),e[t++]=new Z2e(s.token||"",i,r,a,l)}return e}function X2e(o,e){o.sort((d,h)=>{const u=iMe(d.token,h.token);return u!==0?u:d.index-h.index});let t=0,i="000000",n="ffffff";for(;o.length>=1&&o[0].token==="";){const d=o.shift();d.fontStyle!==-1&&(t=d.fontStyle),d.foreground!==null&&(i=d.foreground),d.background!==null&&(n=d.background)}const s=new J2e;for(const d of e)s.getId(d);const r=s.getId(i),a=s.getId(n),l=new T9(t,r,a),c=new R9(l);for(let d=0,h=o.length;d<h;d++){const u=o[d];c.insert(u.token,u.fontStyle,s.getId(u.foreground),s.getId(u.background))}return new NJ(s,c)}const Q2e=/^#?([0-9A-Fa-f]{6})([0-9A-Fa-f]{2})?$/;class J2e{constructor(){this._lastColorId=0,this._id2color=[],this._color2id=new Map}getId(e){if(e===null)return 0;const t=e.match(Q2e);if(!t)throw new Error("Illegal value for token color: "+e);e=t[1].toUpperCase();let i=this._color2id.get(e);return i||(i=++this._lastColorId,this._color2id.set(e,i),this._id2color[i]=$.fromHex("#"+e),i)}getColorMap(){return this._id2color.slice(0)}}class NJ{static createFromRawTokenTheme(e,t){return this.createFromParsedTokenTheme(Y2e(e),t)}static createFromParsedTokenTheme(e,t){return X2e(e,t)}constructor(e,t){this._colorMap=e,this._root=t,this._cache=new Map}getColorMap(){return this._colorMap.getColorMap()}_match(e){return this._root.match(e)}match(e,t){let i=this._cache.get(t);if(typeof i>"u"){const n=this._match(t),s=tMe(t);i=(n.metadata|s<<8)>>>0,this._cache.set(t,i)}return(i|e<<0)>>>0}}const eMe=/\b(comment|string|regex|regexp)\b/;function tMe(o){const e=o.match(eMe);if(!e)return 0;switch(e[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"regexp":return 3}throw new Error("Unexpected match for standard token type!")}function iMe(o,e){return o<e?-1:o>e?1:0}class T9{constructor(e,t,i){this._themeTrieElementRuleBrand=void 0,this._fontStyle=e,this._foreground=t,this._background=i,this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}clone(){return new T9(this._fontStyle,this._foreground,this._background)}acceptOverwrite(e,t,i){e!==-1&&(this._fontStyle=e),t!==0&&(this._foreground=t),i!==0&&(this._background=i),this.metadata=(this._fontStyle<<11|this._foreground<<15|this._background<<24)>>>0}}class R9{constructor(e){this._themeTrieElementBrand=void 0,this._mainRule=e,this._children=new Map}match(e){if(e==="")return this._mainRule;const t=e.indexOf(".");let i,n;t===-1?(i=e,n=""):(i=e.substring(0,t),n=e.substring(t+1));const s=this._children.get(i);return typeof s<"u"?s.match(n):this._mainRule}insert(e,t,i,n){if(e===""){this._mainRule.acceptOverwrite(t,i,n);return}const s=e.indexOf(".");let r,a;s===-1?(r=e,a=""):(r=e.substring(0,s),a=e.substring(s+1));let l=this._children.get(r);typeof l>"u"&&(l=new R9(this._mainRule.clone()),this._children.set(r,l)),l.insert(a,t,i,n)}}function nMe(o){const e=[];for(let t=1,i=o.length;t<i;t++){const n=o[t];e[t]=`.mtk${t} { color: ${n}; }`}return e.push(".mtki { font-style: italic; }"),e.push(".mtkb { font-weight: bold; }"),e.push(".mtku { text-decoration: underline; text-underline-position: under; }"),e.push(".mtks { text-decoration: line-through; }"),e.push(".mtks.mtku { text-decoration: underline line-through; text-underline-position: under; }"),e.join(`
`)}const sMe={base:"vs",inherit:!1,rules:[{token:"",foreground:"000000",background:"fffffe"},{token:"invalid",foreground:"cd3131"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"001188"},{token:"variable.predefined",foreground:"4864AA"},{token:"constant",foreground:"dd0000"},{token:"comment",foreground:"008000"},{token:"number",foreground:"098658"},{token:"number.hex",foreground:"3030c0"},{token:"regexp",foreground:"800000"},{token:"annotation",foreground:"808080"},{token:"type",foreground:"008080"},{token:"delimiter",foreground:"000000"},{token:"delimiter.html",foreground:"383838"},{token:"delimiter.xml",foreground:"0000FF"},{token:"tag",foreground:"800000"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"800000"},{token:"metatag",foreground:"e00000"},{token:"metatag.content.html",foreground:"FF0000"},{token:"metatag.html",foreground:"808080"},{token:"metatag.xml",foreground:"808080"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"863B00"},{token:"string.key.json",foreground:"A31515"},{token:"string.value.json",foreground:"0451A5"},{token:"attribute.name",foreground:"FF0000"},{token:"attribute.value",foreground:"0451A5"},{token:"attribute.value.number",foreground:"098658"},{token:"attribute.value.unit",foreground:"098658"},{token:"attribute.value.html",foreground:"0000FF"},{token:"attribute.value.xml",foreground:"0000FF"},{token:"string",foreground:"A31515"},{token:"string.html",foreground:"0000FF"},{token:"string.sql",foreground:"FF0000"},{token:"string.yaml",foreground:"0451A5"},{token:"keyword",foreground:"0000FF"},{token:"keyword.json",foreground:"0451A5"},{token:"keyword.flow",foreground:"AF00DB"},{token:"keyword.flow.scss",foreground:"0000FF"},{token:"operator.scss",foreground:"666666"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"666666"},{token:"predefined.sql",foreground:"C700C7"}],colors:{[xi]:"#FFFFFE",[bl]:"#000000",[zV]:"#E5EBF1",[tv]:"#D3D3D3",[iv]:"#939393",[iM]:"#ADD6FF4D"}},oMe={base:"vs-dark",inherit:!1,rules:[{token:"",foreground:"D4D4D4",background:"1E1E1E"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"74B0DF"},{token:"variable.predefined",foreground:"4864AA"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"B5CEA8"},{token:"number.hex",foreground:"5BB498"},{token:"regexp",foreground:"B46695"},{token:"annotation",foreground:"cc6666"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"DCDCDC"},{token:"delimiter.html",foreground:"808080"},{token:"delimiter.xml",foreground:"808080"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"A79873"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"DD6A6F"},{token:"metatag.content.html",foreground:"9CDCFE"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key.json",foreground:"9CDCFE"},{token:"string.value.json",foreground:"CE9178"},{token:"attribute.name",foreground:"9CDCFE"},{token:"attribute.value",foreground:"CE9178"},{token:"attribute.value.number.css",foreground:"B5CEA8"},{token:"attribute.value.unit.css",foreground:"B5CEA8"},{token:"attribute.value.hex.css",foreground:"D4D4D4"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"keyword.json",foreground:"CE9178"},{token:"keyword.flow.scss",foreground:"569CD6"},{token:"operator.scss",foreground:"909090"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[xi]:"#1E1E1E",[bl]:"#D4D4D4",[zV]:"#3A3D41",[tv]:"#404040",[iv]:"#707070",[iM]:"#ADD6FF26"}},rMe={base:"hc-black",inherit:!1,rules:[{token:"",foreground:"FFFFFF",background:"000000"},{token:"invalid",foreground:"f44747"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"1AEBFF"},{token:"variable.parameter",foreground:"9CDCFE"},{token:"constant",foreground:"569CD6"},{token:"comment",foreground:"608B4E"},{token:"number",foreground:"FFFFFF"},{token:"regexp",foreground:"C0C0C0"},{token:"annotation",foreground:"569CD6"},{token:"type",foreground:"3DC9B0"},{token:"delimiter",foreground:"FFFF00"},{token:"delimiter.html",foreground:"FFFF00"},{token:"tag",foreground:"569CD6"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta",foreground:"D4D4D4"},{token:"meta.tag",foreground:"CE9178"},{token:"metatag",foreground:"569CD6"},{token:"metatag.content.html",foreground:"1AEBFF"},{token:"metatag.html",foreground:"569CD6"},{token:"metatag.xml",foreground:"569CD6"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"9CDCFE"},{token:"string.key",foreground:"9CDCFE"},{token:"string.value",foreground:"CE9178"},{token:"attribute.name",foreground:"569CD6"},{token:"attribute.value",foreground:"3FF23F"},{token:"string",foreground:"CE9178"},{token:"string.sql",foreground:"FF0000"},{token:"keyword",foreground:"569CD6"},{token:"keyword.flow",foreground:"C586C0"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"909090"},{token:"predefined.sql",foreground:"FF00FF"}],colors:{[xi]:"#000000",[bl]:"#FFFFFF",[tv]:"#FFFFFF",[iv]:"#FFFFFF"}},aMe={base:"hc-light",inherit:!1,rules:[{token:"",foreground:"292929",background:"FFFFFF"},{token:"invalid",foreground:"B5200D"},{token:"emphasis",fontStyle:"italic"},{token:"strong",fontStyle:"bold"},{token:"variable",foreground:"264F70"},{token:"variable.predefined",foreground:"4864AA"},{token:"constant",foreground:"dd0000"},{token:"comment",foreground:"008000"},{token:"number",foreground:"098658"},{token:"number.hex",foreground:"3030c0"},{token:"regexp",foreground:"800000"},{token:"annotation",foreground:"808080"},{token:"type",foreground:"008080"},{token:"delimiter",foreground:"000000"},{token:"delimiter.html",foreground:"383838"},{token:"tag",foreground:"800000"},{token:"tag.id.pug",foreground:"4F76AC"},{token:"tag.class.pug",foreground:"4F76AC"},{token:"meta.scss",foreground:"800000"},{token:"metatag",foreground:"e00000"},{token:"metatag.content.html",foreground:"B5200D"},{token:"metatag.html",foreground:"808080"},{token:"metatag.xml",foreground:"808080"},{token:"metatag.php",fontStyle:"bold"},{token:"key",foreground:"863B00"},{token:"string.key.json",foreground:"A31515"},{token:"string.value.json",foreground:"0451A5"},{token:"attribute.name",foreground:"264F78"},{token:"attribute.value",foreground:"0451A5"},{token:"string",foreground:"A31515"},{token:"string.sql",foreground:"B5200D"},{token:"keyword",foreground:"0000FF"},{token:"keyword.flow",foreground:"AF00DB"},{token:"operator.sql",foreground:"778899"},{token:"operator.swift",foreground:"666666"},{token:"predefined.sql",foreground:"C700C7"}],colors:{[xi]:"#FFFFFF",[bl]:"#292929",[tv]:"#292929",[iv]:"#292929"}};function lMe(o){const e=new U,t=e.add(new P),i=Sq();return e.add(i.onDidChange(()=>t.fire())),o&&e.add(o.onDidProductIconThemeChange(()=>t.fire())),{dispose:()=>e.dispose(),onDidChange:t.event,getCSS(){const n=o?o.getProductIconTheme():new TJ,s={},r=new hA,a=new hA;for(const l of i.getIcons()){const c=n.getIcon(l);if(!c)continue;const d=c.font,h=Co`--vscode-icon-${Ox(l.id)}-font-family`,u=Co`--vscode-icon-${Ox(l.id)}-content`;d?(s[d.id]=d.definition,a.push(Co`${h}: ${Ph(d.id)};`,Co`${u}: ${Ph(c.fontCharacter)};`),r.push(Co`.codicon-${Ox(l.id)}:before { content: ${Ph(c.fontCharacter)}; font-family: ${Ph(d.id)}; }`)):(a.push(Co`${u}: ${Ph(c.fontCharacter)}; ${h}: 'codicon';`),r.push(Co`.codicon-${Ox(l.id)}:before { content: ${Ph(c.fontCharacter)}; }`))}for(const l in s){const c=s[l],d=c.weight?Co`font-weight: ${Q$(c.weight)};`:Co``,h=c.style?Co`font-style: ${Q$(c.style)};`:Co``,u=new hA;for(const f of c.src)u.push(Co`${Nl(f.location)} format(${Ph(f.format)})`);r.push(Co`@font-face { src: ${u.join(", ")}; font-family: ${Ph(l)};${d}${h} font-display: block; }`)}return r.push(Co`:root { ${a.join(" ")} }`),r.join(`
`)}}}class TJ{getIcon(e){const t=Sq();let i=e.defaults;for(;ve.isThemeIcon(i);){const n=t.getIcon(i.id);if(!n)return;i=n.defaults}return i}}const Pd="vs",Qb="vs-dark",ap="hc-black",lp="hc-light",RJ=ei.as(MV.ColorContribution),cMe=ei.as(Nz.ThemingContribution);class MJ{constructor(e,t){this.semanticHighlighting=!1,this.themeData=t;const i=t.base;e.length>0?(CE(e)?this.id=e:this.id=i+" "+e,this.themeName=e):(this.id=i,this.themeName=i),this.colors=null,this.defaultColors=Object.create(null),this._tokenTheme=null}get base(){return this.themeData.base}notifyBaseUpdated(){this.themeData.inherit&&(this.colors=null,this._tokenTheme=null)}getColors(){if(!this.colors){const e=new Map;for(const t in this.themeData.colors)e.set(t,$.fromHex(this.themeData.colors[t]));if(this.themeData.inherit){const t=M9(this.themeData.base);for(const i in t.colors)e.has(i)||e.set(i,$.fromHex(t.colors[i]))}this.colors=e}return this.colors}getColor(e,t){const i=this.getColors().get(e);if(i)return i;if(t!==!1)return this.getDefault(e)}getDefault(e){let t=this.defaultColors[e];return t||(t=RJ.resolveDefaultColor(e,this),this.defaultColors[e]=t,t)}defines(e){return this.getColors().has(e)}get type(){switch(this.base){case Pd:return Er.LIGHT;case ap:return Er.HIGH_CONTRAST_DARK;case lp:return Er.HIGH_CONTRAST_LIGHT;default:return Er.DARK}}get tokenTheme(){if(!this._tokenTheme){let e=[],t=[];if(this.themeData.inherit){const s=M9(this.themeData.base);e=s.rules,s.encodedTokensColors&&(t=s.encodedTokensColors)}const i=this.themeData.colors["editor.foreground"],n=this.themeData.colors["editor.background"];if(i||n){const s={token:""};i&&(s.foreground=i),n&&(s.background=n),e.push(s)}e=e.concat(this.themeData.rules),this.themeData.encodedTokensColors&&(t=this.themeData.encodedTokensColors),this._tokenTheme=NJ.createFromRawTokenTheme(e,t)}return this._tokenTheme}getTokenStyleMetadata(e,t,i){const s=this.tokenTheme._match([e].concat(t).join(".")).metadata,r=zn.getForeground(s),a=zn.getFontStyle(s);return{foreground:r,italic:!!(a&1),bold:!!(a&2),underline:!!(a&4),strikethrough:!!(a&8)}}get tokenColorMap(){return[]}}function CE(o){return o===Pd||o===Qb||o===ap||o===lp}function M9(o){switch(o){case Pd:return sMe;case Qb:return oMe;case ap:return rMe;case lp:return aMe}}function vE(o){const e=M9(o);return new MJ(o,e)}class dMe extends A{constructor(){super(),this._onColorThemeChange=this._register(new P),this.onDidColorThemeChange=this._onColorThemeChange.event,this._onProductIconThemeChange=this._register(new P),this.onDidProductIconThemeChange=this._onProductIconThemeChange.event,this._environment=Object.create(null),this._builtInProductIconTheme=new TJ,this._autoDetectHighContrast=!0,this._knownThemes=new Map,this._knownThemes.set(Pd,vE(Pd)),this._knownThemes.set(Qb,vE(Qb)),this._knownThemes.set(ap,vE(ap)),this._knownThemes.set(lp,vE(lp));const e=this._register(lMe(this));this._codiconCSS=e.getCSS(),this._themeCSS="",this._allCSS=`${this._codiconCSS}
${this._themeCSS}`,this._globalStyleElement=null,this._styleElements=[],this._colorMapOverride=null,this.setTheme(Pd),this._onOSSchemeChanged(),this._register(e.onDidChange(()=>{this._codiconCSS=e.getCSS(),this._updateCSS()})),EB(bt,"(forced-colors: active)",()=>{this._onOSSchemeChanged()})}registerEditorContainer(e){return ky(e)?this._registerShadowDomContainer(e):this._registerRegularEditorContainer()}_registerRegularEditorContainer(){return this._globalStyleElement||(this._globalStyleElement=Ir(void 0,e=>{e.className="monaco-colors",e.textContent=this._allCSS}),this._styleElements.push(this._globalStyleElement)),A.None}_registerShadowDomContainer(e){const t=Ir(e,i=>{i.className="monaco-colors",i.textContent=this._allCSS});return this._styleElements.push(t),{dispose:()=>{for(let i=0;i<this._styleElements.length;i++)if(this._styleElements[i]===t){this._styleElements.splice(i,1);return}}}}defineTheme(e,t){if(!/^[a-z0-9\-]+$/i.test(e))throw new Error("Illegal theme name!");if(!CE(t.base)&&!CE(e))throw new Error("Illegal theme base!");this._knownThemes.set(e,new MJ(e,t)),CE(e)&&this._knownThemes.forEach(i=>{i.base===e&&i.notifyBaseUpdated()}),this._theme.themeName===e&&this.setTheme(e)}getColorTheme(){return this._theme}setColorMapOverride(e){this._colorMapOverride=e,this._updateThemeOrColorMap()}setTheme(e){let t;this._knownThemes.has(e)?t=this._knownThemes.get(e):t=this._knownThemes.get(Pd),this._updateActualTheme(t)}_updateActualTheme(e){!e||this._theme===e||(this._theme=e,this._updateThemeOrColorMap())}_onOSSchemeChanged(){if(this._autoDetectHighContrast){const e=bt.matchMedia("(forced-colors: active)").matches;if(e!==Ta(this._theme.type)){let t;Rf(this._theme.type)?t=e?ap:Qb:t=e?lp:Pd,this._updateActualTheme(this._knownThemes.get(t))}}}setAutoDetectHighContrast(e){this._autoDetectHighContrast=e,this._onOSSchemeChanged()}_updateThemeOrColorMap(){const e=[],t={},i={addRule:r=>{t[r]||(e.push(r),t[r]=!0)}};cMe.getThemingParticipants().forEach(r=>r(this._theme,i,this._environment));const n=[];for(const r of RJ.getColors()){const a=this._theme.getColor(r.id,!0);a&&n.push(`${eM(r.id)}: ${a.toString()};`)}i.addRule(`.monaco-editor, .monaco-diff-editor, .monaco-component { ${n.join(`
`)} }`);const s=this._colorMapOverride||this._theme.tokenTheme.getColorMap();i.addRule(nMe(s)),i.addRule(".monaco-editor, .monaco-diff-editor, .monaco-component { forced-color-adjust: none; }"),this._themeCSS=e.join(`
`),this._updateCSS(),di.setColorMap(s),this._onColorThemeChange.fire(this._theme)}_updateCSS(){this._allCSS=`${this._codiconCSS}
${this._themeCSS}`,this._styleElements.forEach(e=>e.textContent=this._allCSS)}getFileIconTheme(){return{hasFileIcons:!1,hasFolderIcons:!1,hidesExplorerArrows:!1}}getProductIconTheme(){return this._builtInProductIconTheme}}class hMe extends le{constructor(){super({id:"editor.action.toggleHighContrast",label:f9.toggleHighContrast,alias:"Toggle High Contrast Theme",precondition:void 0}),this._originalThemeName=null}run(e,t){const i=e.get(ir),n=i.getColorTheme();Ta(n.type)?(i.setTheme(this._originalThemeName||(Rf(n.type)?Qb:Pd)),this._originalThemeName=null):(i.setTheme(Rf(n.type)?ap:lp),this._originalThemeName=n.themeName)}}ne(hMe);var P9;(function(o){o[o.Unknown=0]="Unknown",o[o.Disabled=1]="Disabled",o[o.Enabled=2]="Enabled"})(P9||(P9={}));var A9;(function(o){o[o.Invoke=1]="Invoke",o[o.Auto=2]="Auto"})(A9||(A9={}));var O9;(function(o){o[o.None=0]="None",o[o.KeepWhitespace=1]="KeepWhitespace",o[o.InsertAsSnippet=4]="InsertAsSnippet"})(O9||(O9={}));var F9;(function(o){o[o.Method=0]="Method",o[o.Function=1]="Function",o[o.Constructor=2]="Constructor",o[o.Field=3]="Field",o[o.Variable=4]="Variable",o[o.Class=5]="Class",o[o.Struct=6]="Struct",o[o.Interface=7]="Interface",o[o.Module=8]="Module",o[o.Property=9]="Property",o[o.Event=10]="Event",o[o.Operator=11]="Operator",o[o.Unit=12]="Unit",o[o.Value=13]="Value",o[o.Constant=14]="Constant",o[o.Enum=15]="Enum",o[o.EnumMember=16]="EnumMember",o[o.Keyword=17]="Keyword",o[o.Text=18]="Text",o[o.Color=19]="Color",o[o.File=20]="File",o[o.Reference=21]="Reference",o[o.Customcolor=22]="Customcolor",o[o.Folder=23]="Folder",o[o.TypeParameter=24]="TypeParameter",o[o.User=25]="User",o[o.Issue=26]="Issue",o[o.Tool=27]="Tool",o[o.Snippet=28]="Snippet"})(F9||(F9={}));var W9;(function(o){o[o.Deprecated=1]="Deprecated"})(W9||(W9={}));var B9;(function(o){o[o.Invoke=0]="Invoke",o[o.TriggerCharacter=1]="TriggerCharacter",o[o.TriggerForIncompleteCompletions=2]="TriggerForIncompleteCompletions"})(B9||(B9={}));var H9;(function(o){o[o.EXACT=0]="EXACT",o[o.ABOVE=1]="ABOVE",o[o.BELOW=2]="BELOW"})(H9||(H9={}));var V9;(function(o){o[o.NotSet=0]="NotSet",o[o.ContentFlush=1]="ContentFlush",o[o.RecoverFromMarkers=2]="RecoverFromMarkers",o[o.Explicit=3]="Explicit",o[o.Paste=4]="Paste",o[o.Undo=5]="Undo",o[o.Redo=6]="Redo"})(V9||(V9={}));var z9;(function(o){o[o.LF=1]="LF",o[o.CRLF=2]="CRLF"})(z9||(z9={}));var U9;(function(o){o[o.Text=0]="Text",o[o.Read=1]="Read",o[o.Write=2]="Write"})(U9||(U9={}));var $9;(function(o){o[o.None=0]="None",o[o.Keep=1]="Keep",o[o.Brackets=2]="Brackets",o[o.Advanced=3]="Advanced",o[o.Full=4]="Full"})($9||($9={}));var j9;(function(o){o[o.acceptSuggestionOnCommitCharacter=0]="acceptSuggestionOnCommitCharacter",o[o.acceptSuggestionOnEnter=1]="acceptSuggestionOnEnter",o[o.accessibilitySupport=2]="accessibilitySupport",o[o.accessibilityPageSize=3]="accessibilityPageSize",o[o.allowOverflow=4]="allowOverflow",o[o.allowVariableLineHeights=5]="allowVariableLineHeights",o[o.allowVariableFonts=6]="allowVariableFonts",o[o.allowVariableFontsInAccessibilityMode=7]="allowVariableFontsInAccessibilityMode",o[o.ariaLabel=8]="ariaLabel",o[o.ariaRequired=9]="ariaRequired",o[o.autoClosingBrackets=10]="autoClosingBrackets",o[o.autoClosingComments=11]="autoClosingComments",o[o.screenReaderAnnounceInlineSuggestion=12]="screenReaderAnnounceInlineSuggestion",o[o.autoClosingDelete=13]="autoClosingDelete",o[o.autoClosingOvertype=14]="autoClosingOvertype",o[o.autoClosingQuotes=15]="autoClosingQuotes",o[o.autoIndent=16]="autoIndent",o[o.autoIndentOnPaste=17]="autoIndentOnPaste",o[o.autoIndentOnPasteWithinString=18]="autoIndentOnPasteWithinString",o[o.automaticLayout=19]="automaticLayout",o[o.autoSurround=20]="autoSurround",o[o.bracketPairColorization=21]="bracketPairColorization",o[o.guides=22]="guides",o[o.codeLens=23]="codeLens",o[o.codeLensFontFamily=24]="codeLensFontFamily",o[o.codeLensFontSize=25]="codeLensFontSize",o[o.colorDecorators=26]="colorDecorators",o[o.colorDecoratorsLimit=27]="colorDecoratorsLimit",o[o.columnSelection=28]="columnSelection",o[o.comments=29]="comments",o[o.contextmenu=30]="contextmenu",o[o.copyWithSyntaxHighlighting=31]="copyWithSyntaxHighlighting",o[o.cursorBlinking=32]="cursorBlinking",o[o.cursorSmoothCaretAnimation=33]="cursorSmoothCaretAnimation",o[o.cursorStyle=34]="cursorStyle",o[o.cursorSurroundingLines=35]="cursorSurroundingLines",o[o.cursorSurroundingLinesStyle=36]="cursorSurroundingLinesStyle",o[o.cursorWidth=37]="cursorWidth",o[o.cursorHeight=38]="cursorHeight",o[o.disableLayerHinting=39]="disableLayerHinting",o[o.disableMonospaceOptimizations=40]="disableMonospaceOptimizations",o[o.domReadOnly=41]="domReadOnly",o[o.dragAndDrop=42]="dragAndDrop",o[o.dropIntoEditor=43]="dropIntoEditor",o[o.editContext=44]="editContext",o[o.emptySelectionClipboard=45]="emptySelectionClipboard",o[o.experimentalGpuAcceleration=46]="experimentalGpuAcceleration",o[o.experimentalWhitespaceRendering=47]="experimentalWhitespaceRendering",o[o.extraEditorClassName=48]="extraEditorClassName",o[o.fastScrollSensitivity=49]="fastScrollSensitivity",o[o.find=50]="find",o[o.fixedOverflowWidgets=51]="fixedOverflowWidgets",o[o.folding=52]="folding",o[o.foldingStrategy=53]="foldingStrategy",o[o.foldingHighlight=54]="foldingHighlight",o[o.foldingImportsByDefault=55]="foldingImportsByDefault",o[o.foldingMaximumRegions=56]="foldingMaximumRegions",o[o.unfoldOnClickAfterEndOfLine=57]="unfoldOnClickAfterEndOfLine",o[o.fontFamily=58]="fontFamily",o[o.fontInfo=59]="fontInfo",o[o.fontLigatures=60]="fontLigatures",o[o.fontSize=61]="fontSize",o[o.fontWeight=62]="fontWeight",o[o.fontVariations=63]="fontVariations",o[o.formatOnPaste=64]="formatOnPaste",o[o.formatOnType=65]="formatOnType",o[o.glyphMargin=66]="glyphMargin",o[o.gotoLocation=67]="gotoLocation",o[o.hideCursorInOverviewRuler=68]="hideCursorInOverviewRuler",o[o.hover=69]="hover",o[o.inDiffEditor=70]="inDiffEditor",o[o.inlineSuggest=71]="inlineSuggest",o[o.letterSpacing=72]="letterSpacing",o[o.lightbulb=73]="lightbulb",o[o.lineDecorationsWidth=74]="lineDecorationsWidth",o[o.lineHeight=75]="lineHeight",o[o.lineNumbers=76]="lineNumbers",o[o.lineNumbersMinChars=77]="lineNumbersMinChars",o[o.linkedEditing=78]="linkedEditing",o[o.links=79]="links",o[o.matchBrackets=80]="matchBrackets",o[o.minimap=81]="minimap",o[o.mouseStyle=82]="mouseStyle",o[o.mouseWheelScrollSensitivity=83]="mouseWheelScrollSensitivity",o[o.mouseWheelZoom=84]="mouseWheelZoom",o[o.multiCursorMergeOverlapping=85]="multiCursorMergeOverlapping",o[o.multiCursorModifier=86]="multiCursorModifier",o[o.mouseMiddleClickAction=87]="mouseMiddleClickAction",o[o.multiCursorPaste=88]="multiCursorPaste",o[o.multiCursorLimit=89]="multiCursorLimit",o[o.occurrencesHighlight=90]="occurrencesHighlight",o[o.occurrencesHighlightDelay=91]="occurrencesHighlightDelay",o[o.overtypeCursorStyle=92]="overtypeCursorStyle",o[o.overtypeOnPaste=93]="overtypeOnPaste",o[o.overviewRulerBorder=94]="overviewRulerBorder",o[o.overviewRulerLanes=95]="overviewRulerLanes",o[o.padding=96]="padding",o[o.pasteAs=97]="pasteAs",o[o.parameterHints=98]="parameterHints",o[o.peekWidgetDefaultFocus=99]="peekWidgetDefaultFocus",o[o.placeholder=100]="placeholder",o[o.definitionLinkOpensInPeek=101]="definitionLinkOpensInPeek",o[o.quickSuggestions=102]="quickSuggestions",o[o.quickSuggestionsDelay=103]="quickSuggestionsDelay",o[o.readOnly=104]="readOnly",o[o.readOnlyMessage=105]="readOnlyMessage",o[o.renameOnType=106]="renameOnType",o[o.renderRichScreenReaderContent=107]="renderRichScreenReaderContent",o[o.renderControlCharacters=108]="renderControlCharacters",o[o.renderFinalNewline=109]="renderFinalNewline",o[o.renderLineHighlight=110]="renderLineHighlight",o[o.renderLineHighlightOnlyWhenFocus=111]="renderLineHighlightOnlyWhenFocus",o[o.renderValidationDecorations=112]="renderValidationDecorations",o[o.renderWhitespace=113]="renderWhitespace",o[o.revealHorizontalRightPadding=114]="revealHorizontalRightPadding",o[o.roundedSelection=115]="roundedSelection",o[o.rulers=116]="rulers",o[o.scrollbar=117]="scrollbar",o[o.scrollBeyondLastColumn=118]="scrollBeyondLastColumn",o[o.scrollBeyondLastLine=119]="scrollBeyondLastLine",o[o.scrollPredominantAxis=120]="scrollPredominantAxis",o[o.selectionClipboard=121]="selectionClipboard",o[o.selectionHighlight=122]="selectionHighlight",o[o.selectionHighlightMaxLength=123]="selectionHighlightMaxLength",o[o.selectionHighlightMultiline=124]="selectionHighlightMultiline",o[o.selectOnLineNumbers=125]="selectOnLineNumbers",o[o.showFoldingControls=126]="showFoldingControls",o[o.showUnused=127]="showUnused",o[o.snippetSuggestions=128]="snippetSuggestions",o[o.smartSelect=129]="smartSelect",o[o.smoothScrolling=130]="smoothScrolling",o[o.stickyScroll=131]="stickyScroll",o[o.stickyTabStops=132]="stickyTabStops",o[o.stopRenderingLineAfter=133]="stopRenderingLineAfter",o[o.suggest=134]="suggest",o[o.suggestFontSize=135]="suggestFontSize",o[o.suggestLineHeight=136]="suggestLineHeight",o[o.suggestOnTriggerCharacters=137]="suggestOnTriggerCharacters",o[o.suggestSelection=138]="suggestSelection",o[o.tabCompletion=139]="tabCompletion",o[o.tabIndex=140]="tabIndex",o[o.trimWhitespaceOnDelete=141]="trimWhitespaceOnDelete",o[o.unicodeHighlighting=142]="unicodeHighlighting",o[o.unusualLineTerminators=143]="unusualLineTerminators",o[o.useShadowDOM=144]="useShadowDOM",o[o.useTabStops=145]="useTabStops",o[o.wordBreak=146]="wordBreak",o[o.wordSegmenterLocales=147]="wordSegmenterLocales",o[o.wordSeparators=148]="wordSeparators",o[o.wordWrap=149]="wordWrap",o[o.wordWrapBreakAfterCharacters=150]="wordWrapBreakAfterCharacters",o[o.wordWrapBreakBeforeCharacters=151]="wordWrapBreakBeforeCharacters",o[o.wordWrapColumn=152]="wordWrapColumn",o[o.wordWrapOverride1=153]="wordWrapOverride1",o[o.wordWrapOverride2=154]="wordWrapOverride2",o[o.wrappingIndent=155]="wrappingIndent",o[o.wrappingStrategy=156]="wrappingStrategy",o[o.showDeprecated=157]="showDeprecated",o[o.inertialScroll=158]="inertialScroll",o[o.inlayHints=159]="inlayHints",o[o.wrapOnEscapedLineFeeds=160]="wrapOnEscapedLineFeeds",o[o.effectiveCursorStyle=161]="effectiveCursorStyle",o[o.editorClassName=162]="editorClassName",o[o.pixelRatio=163]="pixelRatio",o[o.tabFocusMode=164]="tabFocusMode",o[o.layoutInfo=165]="layoutInfo",o[o.wrappingInfo=166]="wrappingInfo",o[o.defaultColorDecorators=167]="defaultColorDecorators",o[o.colorDecoratorsActivatedOn=168]="colorDecoratorsActivatedOn",o[o.inlineCompletionsAccessibilityVerbose=169]="inlineCompletionsAccessibilityVerbose",o[o.effectiveEditContext=170]="effectiveEditContext",o[o.scrollOnMiddleClick=171]="scrollOnMiddleClick",o[o.effectiveAllowVariableFonts=172]="effectiveAllowVariableFonts"})(j9||(j9={}));var q9;(function(o){o[o.TextDefined=0]="TextDefined",o[o.LF=1]="LF",o[o.CRLF=2]="CRLF"})(q9||(q9={}));var K9;(function(o){o[o.LF=0]="LF",o[o.CRLF=1]="CRLF"})(K9||(K9={}));var G9;(function(o){o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=3]="Right"})(G9||(G9={}));var Z9;(function(o){o[o.Increase=0]="Increase",o[o.Decrease=1]="Decrease"})(Z9||(Z9={}));var Y9;(function(o){o[o.None=0]="None",o[o.Indent=1]="Indent",o[o.IndentOutdent=2]="IndentOutdent",o[o.Outdent=3]="Outdent"})(Y9||(Y9={}));var X9;(function(o){o[o.Both=0]="Both",o[o.Right=1]="Right",o[o.Left=2]="Left",o[o.None=3]="None"})(X9||(X9={}));var Q9;(function(o){o[o.Type=1]="Type",o[o.Parameter=2]="Parameter"})(Q9||(Q9={}));var J9;(function(o){o[o.Code=1]="Code",o[o.Label=2]="Label"})(J9||(J9={}));var e8;(function(o){o[o.Accepted=0]="Accepted",o[o.Rejected=1]="Rejected",o[o.Ignored=2]="Ignored"})(e8||(e8={}));var t8;(function(o){o[o.Automatic=0]="Automatic",o[o.Explicit=1]="Explicit"})(t8||(t8={}));var i8;(function(o){o[o.DependsOnKbLayout=-1]="DependsOnKbLayout",o[o.Unknown=0]="Unknown",o[o.Backspace=1]="Backspace",o[o.Tab=2]="Tab",o[o.Enter=3]="Enter",o[o.Shift=4]="Shift",o[o.Ctrl=5]="Ctrl",o[o.Alt=6]="Alt",o[o.PauseBreak=7]="PauseBreak",o[o.CapsLock=8]="CapsLock",o[o.Escape=9]="Escape",o[o.Space=10]="Space",o[o.PageUp=11]="PageUp",o[o.PageDown=12]="PageDown",o[o.End=13]="End",o[o.Home=14]="Home",o[o.LeftArrow=15]="LeftArrow",o[o.UpArrow=16]="UpArrow",o[o.RightArrow=17]="RightArrow",o[o.DownArrow=18]="DownArrow",o[o.Insert=19]="Insert",o[o.Delete=20]="Delete",o[o.Digit0=21]="Digit0",o[o.Digit1=22]="Digit1",o[o.Digit2=23]="Digit2",o[o.Digit3=24]="Digit3",o[o.Digit4=25]="Digit4",o[o.Digit5=26]="Digit5",o[o.Digit6=27]="Digit6",o[o.Digit7=28]="Digit7",o[o.Digit8=29]="Digit8",o[o.Digit9=30]="Digit9",o[o.KeyA=31]="KeyA",o[o.KeyB=32]="KeyB",o[o.KeyC=33]="KeyC",o[o.KeyD=34]="KeyD",o[o.KeyE=35]="KeyE",o[o.KeyF=36]="KeyF",o[o.KeyG=37]="KeyG",o[o.KeyH=38]="KeyH",o[o.KeyI=39]="KeyI",o[o.KeyJ=40]="KeyJ",o[o.KeyK=41]="KeyK",o[o.KeyL=42]="KeyL",o[o.KeyM=43]="KeyM",o[o.KeyN=44]="KeyN",o[o.KeyO=45]="KeyO",o[o.KeyP=46]="KeyP",o[o.KeyQ=47]="KeyQ",o[o.KeyR=48]="KeyR",o[o.KeyS=49]="KeyS",o[o.KeyT=50]="KeyT",o[o.KeyU=51]="KeyU",o[o.KeyV=52]="KeyV",o[o.KeyW=53]="KeyW",o[o.KeyX=54]="KeyX",o[o.KeyY=55]="KeyY",o[o.KeyZ=56]="KeyZ",o[o.Meta=57]="Meta",o[o.ContextMenu=58]="ContextMenu",o[o.F1=59]="F1",o[o.F2=60]="F2",o[o.F3=61]="F3",o[o.F4=62]="F4",o[o.F5=63]="F5",o[o.F6=64]="F6",o[o.F7=65]="F7",o[o.F8=66]="F8",o[o.F9=67]="F9",o[o.F10=68]="F10",o[o.F11=69]="F11",o[o.F12=70]="F12",o[o.F13=71]="F13",o[o.F14=72]="F14",o[o.F15=73]="F15",o[o.F16=74]="F16",o[o.F17=75]="F17",o[o.F18=76]="F18",o[o.F19=77]="F19",o[o.F20=78]="F20",o[o.F21=79]="F21",o[o.F22=80]="F22",o[o.F23=81]="F23",o[o.F24=82]="F24",o[o.NumLock=83]="NumLock",o[o.ScrollLock=84]="ScrollLock",o[o.Semicolon=85]="Semicolon",o[o.Equal=86]="Equal",o[o.Comma=87]="Comma",o[o.Minus=88]="Minus",o[o.Period=89]="Period",o[o.Slash=90]="Slash",o[o.Backquote=91]="Backquote",o[o.BracketLeft=92]="BracketLeft",o[o.Backslash=93]="Backslash",o[o.BracketRight=94]="BracketRight",o[o.Quote=95]="Quote",o[o.OEM_8=96]="OEM_8",o[o.IntlBackslash=97]="IntlBackslash",o[o.Numpad0=98]="Numpad0",o[o.Numpad1=99]="Numpad1",o[o.Numpad2=100]="Numpad2",o[o.Numpad3=101]="Numpad3",o[o.Numpad4=102]="Numpad4",o[o.Numpad5=103]="Numpad5",o[o.Numpad6=104]="Numpad6",o[o.Numpad7=105]="Numpad7",o[o.Numpad8=106]="Numpad8",o[o.Numpad9=107]="Numpad9",o[o.NumpadMultiply=108]="NumpadMultiply",o[o.NumpadAdd=109]="NumpadAdd",o[o.NUMPAD_SEPARATOR=110]="NUMPAD_SEPARATOR",o[o.NumpadSubtract=111]="NumpadSubtract",o[o.NumpadDecimal=112]="NumpadDecimal",o[o.NumpadDivide=113]="NumpadDivide",o[o.KEY_IN_COMPOSITION=114]="KEY_IN_COMPOSITION",o[o.ABNT_C1=115]="ABNT_C1",o[o.ABNT_C2=116]="ABNT_C2",o[o.AudioVolumeMute=117]="AudioVolumeMute",o[o.AudioVolumeUp=118]="AudioVolumeUp",o[o.AudioVolumeDown=119]="AudioVolumeDown",o[o.BrowserSearch=120]="BrowserSearch",o[o.BrowserHome=121]="BrowserHome",o[o.BrowserBack=122]="BrowserBack",o[o.BrowserForward=123]="BrowserForward",o[o.MediaTrackNext=124]="MediaTrackNext",o[o.MediaTrackPrevious=125]="MediaTrackPrevious",o[o.MediaStop=126]="MediaStop",o[o.MediaPlayPause=127]="MediaPlayPause",o[o.LaunchMediaPlayer=128]="LaunchMediaPlayer",o[o.LaunchMail=129]="LaunchMail",o[o.LaunchApp2=130]="LaunchApp2",o[o.Clear=131]="Clear",o[o.MAX_VALUE=132]="MAX_VALUE"})(i8||(i8={}));var n8;(function(o){o[o.Hint=1]="Hint",o[o.Info=2]="Info",o[o.Warning=4]="Warning",o[o.Error=8]="Error"})(n8||(n8={}));var s8;(function(o){o[o.Unnecessary=1]="Unnecessary",o[o.Deprecated=2]="Deprecated"})(s8||(s8={}));var o8;(function(o){o[o.Inline=1]="Inline",o[o.Gutter=2]="Gutter"})(o8||(o8={}));var r8;(function(o){o[o.Normal=1]="Normal",o[o.Underlined=2]="Underlined"})(r8||(r8={}));var a8;(function(o){o[o.UNKNOWN=0]="UNKNOWN",o[o.TEXTAREA=1]="TEXTAREA",o[o.GUTTER_GLYPH_MARGIN=2]="GUTTER_GLYPH_MARGIN",o[o.GUTTER_LINE_NUMBERS=3]="GUTTER_LINE_NUMBERS",o[o.GUTTER_LINE_DECORATIONS=4]="GUTTER_LINE_DECORATIONS",o[o.GUTTER_VIEW_ZONE=5]="GUTTER_VIEW_ZONE",o[o.CONTENT_TEXT=6]="CONTENT_TEXT",o[o.CONTENT_EMPTY=7]="CONTENT_EMPTY",o[o.CONTENT_VIEW_ZONE=8]="CONTENT_VIEW_ZONE",o[o.CONTENT_WIDGET=9]="CONTENT_WIDGET",o[o.OVERVIEW_RULER=10]="OVERVIEW_RULER",o[o.SCROLLBAR=11]="SCROLLBAR",o[o.OVERLAY_WIDGET=12]="OVERLAY_WIDGET",o[o.OUTSIDE_EDITOR=13]="OUTSIDE_EDITOR"})(a8||(a8={}));var l8;(function(o){o[o.AIGenerated=1]="AIGenerated"})(l8||(l8={}));var c8;(function(o){o[o.Invoke=0]="Invoke",o[o.Automatic=1]="Automatic"})(c8||(c8={}));var d8;(function(o){o[o.TOP_RIGHT_CORNER=0]="TOP_RIGHT_CORNER",o[o.BOTTOM_RIGHT_CORNER=1]="BOTTOM_RIGHT_CORNER",o[o.TOP_CENTER=2]="TOP_CENTER"})(d8||(d8={}));var h8;(function(o){o[o.Left=1]="Left",o[o.Center=2]="Center",o[o.Right=4]="Right",o[o.Full=7]="Full"})(h8||(h8={}));var u8;(function(o){o[o.Word=0]="Word",o[o.Line=1]="Line",o[o.Suggest=2]="Suggest"})(u8||(u8={}));var f8;(function(o){o[o.Left=0]="Left",o[o.Right=1]="Right",o[o.None=2]="None",o[o.LeftOfInjectedText=3]="LeftOfInjectedText",o[o.RightOfInjectedText=4]="RightOfInjectedText"})(f8||(f8={}));var g8;(function(o){o[o.Off=0]="Off",o[o.On=1]="On",o[o.Relative=2]="Relative",o[o.Interval=3]="Interval",o[o.Custom=4]="Custom"})(g8||(g8={}));var p8;(function(o){o[o.None=0]="None",o[o.Text=1]="Text",o[o.Blocks=2]="Blocks"})(p8||(p8={}));var m8;(function(o){o[o.Smooth=0]="Smooth",o[o.Immediate=1]="Immediate"})(m8||(m8={}));var _8;(function(o){o[o.Auto=1]="Auto",o[o.Hidden=2]="Hidden",o[o.Visible=3]="Visible"})(_8||(_8={}));var b8;(function(o){o[o.LTR=0]="LTR",o[o.RTL=1]="RTL"})(b8||(b8={}));var C8;(function(o){o.Off="off",o.OnCode="onCode",o.On="on"})(C8||(C8={}));var v8;(function(o){o[o.Invoke=1]="Invoke",o[o.TriggerCharacter=2]="TriggerCharacter",o[o.ContentChange=3]="ContentChange"})(v8||(v8={}));var w8;(function(o){o[o.File=0]="File",o[o.Module=1]="Module",o[o.Namespace=2]="Namespace",o[o.Package=3]="Package",o[o.Class=4]="Class",o[o.Method=5]="Method",o[o.Property=6]="Property",o[o.Field=7]="Field",o[o.Constructor=8]="Constructor",o[o.Enum=9]="Enum",o[o.Interface=10]="Interface",o[o.Function=11]="Function",o[o.Variable=12]="Variable",o[o.Constant=13]="Constant",o[o.String=14]="String",o[o.Number=15]="Number",o[o.Boolean=16]="Boolean",o[o.Array=17]="Array",o[o.Object=18]="Object",o[o.Key=19]="Key",o[o.Null=20]="Null",o[o.EnumMember=21]="EnumMember",o[o.Struct=22]="Struct",o[o.Event=23]="Event",o[o.Operator=24]="Operator",o[o.TypeParameter=25]="TypeParameter"})(w8||(w8={}));var S8;(function(o){o[o.Deprecated=1]="Deprecated"})(S8||(S8={}));var y8;(function(o){o[o.LTR=0]="LTR",o[o.RTL=1]="RTL"})(y8||(y8={}));var L8;(function(o){o[o.Hidden=0]="Hidden",o[o.Blink=1]="Blink",o[o.Smooth=2]="Smooth",o[o.Phase=3]="Phase",o[o.Expand=4]="Expand",o[o.Solid=5]="Solid"})(L8||(L8={}));var x8;(function(o){o[o.Line=1]="Line",o[o.Block=2]="Block",o[o.Underline=3]="Underline",o[o.LineThin=4]="LineThin",o[o.BlockOutline=5]="BlockOutline",o[o.UnderlineThin=6]="UnderlineThin"})(x8||(x8={}));var k8;(function(o){o[o.AlwaysGrowsWhenTypingAtEdges=0]="AlwaysGrowsWhenTypingAtEdges",o[o.NeverGrowsWhenTypingAtEdges=1]="NeverGrowsWhenTypingAtEdges",o[o.GrowsOnlyWhenTypingBefore=2]="GrowsOnlyWhenTypingBefore",o[o.GrowsOnlyWhenTypingAfter=3]="GrowsOnlyWhenTypingAfter"})(k8||(k8={}));var I8;(function(o){o[o.None=0]="None",o[o.Same=1]="Same",o[o.Indent=2]="Indent",o[o.DeepIndent=3]="DeepIndent"})(I8||(I8={}));let uMe=(Gd=class{static chord(e,t){return Ei(e,t)}},Gd.CtrlCmd=2048,Gd.Shift=1024,Gd.Alt=512,Gd.WinCtrl=256,Gd);function PJ(){return{editor:void 0,languages:void 0,CancellationTokenSource:Xt,Emitter:P,KeyCode:i8,KeyMod:uMe,Position:M,Range:k,Selection:ce,SelectionDirection:b8,MarkerSeverity:n8,MarkerTag:s8,Uri:be,Token:rv}}const AJ="default",fMe="$initialize";let OJ=!1;function D8(o){ol&&(OJ||(OJ=!0,console.warn("Could not create web worker(s). Falling back to loading web worker code in main thread, which might cause UI freezes. Please see https://github.com/microsoft/monaco-editor#faq")),console.warn(o.message))}class gMe{constructor(e,t,i,n,s){this.vsWorker=e,this.req=t,this.channel=i,this.method=n,this.args=s,this.type=0}}class FJ{constructor(e,t,i,n){this.vsWorker=e,this.seq=t,this.res=i,this.err=n,this.type=1}}class pMe{constructor(e,t,i,n,s){this.vsWorker=e,this.req=t,this.channel=i,this.eventName=n,this.arg=s,this.type=2}}class mMe{constructor(e,t,i){this.vsWorker=e,this.req=t,this.event=i,this.type=3}}class _Me{constructor(e,t){this.vsWorker=e,this.req=t,this.type=4}}class bMe{constructor(e){this._workerId=-1,this._handler=e,this._lastSentReq=0,this._pendingReplies=Object.create(null),this._pendingEmitters=new Map,this._pendingEvents=new Map}setWorkerId(e){this._workerId=e}sendMessage(e,t,i){const n=String(++this._lastSentReq);return new Promise((s,r)=>{this._pendingReplies[n]={resolve:s,reject:r},this._send(new gMe(this._workerId,n,e,t,i))})}listen(e,t,i){let n=null;const s=new P({onWillAddFirstListener:()=>{n=String(++this._lastSentReq),this._pendingEmitters.set(n,s),this._send(new pMe(this._workerId,n,e,t,i))},onDidRemoveLastListener:()=>{this._pendingEmitters.delete(n),this._send(new _Me(this._workerId,n)),n=null}});return s.event}handleMessage(e){!e||!e.vsWorker||this._workerId!==-1&&e.vsWorker!==this._workerId||this._handleMessage(e)}createProxyToRemoteChannel(e,t){const i={get:(n,s)=>(typeof s=="string"&&!n[s]&&(BJ(s)?n[s]=r=>this.listen(e,s,r):WJ(s)?n[s]=this.listen(e,s,void 0):s.charCodeAt(0)===36&&(n[s]=async(...r)=>(await t?.(),this.sendMessage(e,s,r)))),n[s])};return new Proxy(Object.create(null),i)}_handleMessage(e){switch(e.type){case 1:return this._handleReplyMessage(e);case 0:return this._handleRequestMessage(e);case 2:return this._handleSubscribeEventMessage(e);case 3:return this._handleEventMessage(e);case 4:return this._handleUnsubscribeEventMessage(e)}}_handleReplyMessage(e){if(!this._pendingReplies[e.seq]){console.warn("Got reply to unknown seq");return}const t=this._pendingReplies[e.seq];if(delete this._pendingReplies[e.seq],e.err){let i=e.err;e.err.$isError&&(i=new Error,i.name=e.err.name,i.message=e.err.message,i.stack=e.err.stack),t.reject(i);return}t.resolve(e.res)}_handleRequestMessage(e){const t=e.req;this._handler.handleMessage(e.channel,e.method,e.args).then(n=>{this._send(new FJ(this._workerId,t,n,void 0))},n=>{n.detail instanceof Error&&(n.detail=qT(n.detail)),this._send(new FJ(this._workerId,t,void 0,qT(n)))})}_handleSubscribeEventMessage(e){const t=e.req,i=this._handler.handleEvent(e.channel,e.eventName,e.arg)(n=>{this._send(new mMe(this._workerId,t,n))});this._pendingEvents.set(t,i)}_handleEventMessage(e){if(!this._pendingEmitters.has(e.req)){console.warn("Got event for unknown req");return}this._pendingEmitters.get(e.req).fire(e.event)}_handleUnsubscribeEventMessage(e){if(!this._pendingEvents.has(e.req)){console.warn("Got unsubscribe for unknown req");return}this._pendingEvents.get(e.req).dispose(),this._pendingEvents.delete(e.req)}_send(e){const t=[];if(e.type===0)for(let i=0;i<e.args.length;i++)e.args[i]instanceof ArrayBuffer&&t.push(e.args[i]);else e.type===1&&e.res instanceof ArrayBuffer&&t.push(e.res);this._handler.sendMessage(e,t)}}class CMe extends A{constructor(e){super(),this._localChannels=new Map,this._worker=this._register(e),this._register(this._worker.onMessage(t=>{this._protocol.handleMessage(t)})),this._register(this._worker.onError(t=>{D8(t),Ee(t)})),this._protocol=new bMe({sendMessage:(t,i)=>{this._worker.postMessage(t,i)},handleMessage:(t,i,n)=>this._handleMessage(t,i,n),handleEvent:(t,i,n)=>this._handleEvent(t,i,n)}),this._protocol.setWorkerId(this._worker.getId()),this._onModuleLoaded=this._protocol.sendMessage(AJ,fMe,[this._worker.getId()]),this.proxy=this._protocol.createProxyToRemoteChannel(AJ,async()=>{await this._onModuleLoaded}),this._onModuleLoaded.catch(t=>{this._onError("Worker failed to load ",t)})}_handleMessage(e,t,i){const n=this._localChannels.get(e);if(!n)return Promise.reject(new Error(`Missing channel ${e} on main thread`));if(typeof n[t]!="function")return Promise.reject(new Error(`Missing method ${t} on main thread channel ${e}`));try{return Promise.resolve(n[t].apply(n,i))}catch(s){return Promise.reject(s)}}_handleEvent(e,t,i){const n=this._localChannels.get(e);if(!n)throw new Error(`Missing channel ${e} on main thread`);if(BJ(t)){const s=n[t].call(n,i);if(typeof s!="function")throw new Error(`Missing dynamic event ${t} on main thread channel ${e}.`);return s}if(WJ(t)){const s=n[t];if(typeof s!="function")throw new Error(`Missing event ${t} on main thread channel ${e}.`);return s}throw new Error(`Malformed event name ${t}`)}setChannel(e,t){this._localChannels.set(e,t)}_onError(e,t){console.error(e),console.info(t)}}function WJ(o){return o[0]==="o"&&o[1]==="n"&&ll(o.charCodeAt(2))}function BJ(o){return/^onDynamic/.test(o)&&ll(o.charCodeAt(9))}let Jb;typeof self=="object"&&self.constructor&&self.constructor.name==="DedicatedWorkerGlobalScope"&&globalThis.workerttPolicy!==void 0?Jb=globalThis.workerttPolicy:Jb=Sl("defaultWorkerFactory",{createScriptURL:o=>o});function vMe(o,e){const t=o.label||"anonymous"+e,i=globalThis.MonacoEnvironment;if(i){if(typeof i.getWorker=="function")return i.getWorker("workerMain.js",t);if(typeof i.getWorkerUrl=="function"){const s=i.getWorkerUrl("workerMain.js",t);return new Worker(Jb?Jb.createScriptURL(s):s,{name:t,type:"module"})}}const n=o.esmModuleLocation;if(n){const s=wMe(t,n.toString(!0)),r=new Worker(Jb?Jb.createScriptURL(s):s,{name:t,type:"module"});return SMe(r)}throw new Error("You must define a function MonacoEnvironment.getWorkerUrl or MonacoEnvironment.getWorker")}function wMe(o,e){if(!(/^((http:)|(https:)|(file:))/.test(e)&&e.substring(0,globalThis.origin.length)!==globalThis.origin)){const i=e.lastIndexOf("?"),n=e.lastIndexOf("#",i),s=i>0?new URLSearchParams(e.substring(i+1,~n?n:void 0)):new URLSearchParams;NR.addSearchParam(s,!0,!0),s.toString()?e=`${e}?${s.toString()}#${o}`:e=`${e}#${o}`}const t=new Blob([wa([`/*${o}*/`,`globalThis._VSCODE_NLS_MESSAGES = ${JSON.stringify(IB())};`,`globalThis._VSCODE_NLS_LANGUAGE = ${JSON.stringify(VT())};`,`globalThis._VSCODE_FILE_ROOT = ${JSON.stringify(globalThis._VSCODE_FILE_ROOT)};`,"const ttPolicy = globalThis.trustedTypes?.createPolicy('defaultWorkerFactory', { createScriptURL: value => value });","globalThis.workerttPolicy = ttPolicy;",`await import(ttPolicy?.createScriptURL(${JSON.stringify(e)}) ?? ${JSON.stringify(e)});`,"globalThis.postMessage({ type: 'vscode-worker-ready' });",`/*${o}*/`]).join("")],{type:"application/javascript"});return URL.createObjectURL(t)}function SMe(o){return new Promise((e,t)=>{o.onmessage=function(i){i.data.type==="vscode-worker-ready"&&(o.onmessage=null,e(o))},o.onerror=t})}function yMe(o){return!!o&&typeof o.then=="function"}const wT=class wT extends A{constructor(e){super(),this._onMessage=this._register(new P),this.onMessage=this._onMessage.event,this._onError=this._register(new P),this.onError=this._onError.event,this.id=++wT.LAST_WORKER_ID;const t=e instanceof Worker||"then"in e?e:vMe(e,this.id);yMe(t)?this.worker=t:this.worker=Promise.resolve(t),this.postMessage("-please-ignore-",[]);const i=n=>{this._onError.fire(n)};this.worker.then(n=>{n.onmessage=s=>{this._onMessage.fire(s.data)},n.onmessageerror=s=>{this._onError.fire(s)},typeof n.addEventListener=="function"&&n.addEventListener("error",i)}),this._register(ue(()=>{this.worker?.then(n=>{n.onmessage=null,n.onmessageerror=null,n.removeEventListener("error",i),n.terminate()}),this.worker=null}))}getId(){return this.id}postMessage(e,t){this.worker?.then(i=>{try{i.postMessage(e,t)}catch(n){Ee(n),Ee(new Error("FAILED to post message to worker",{cause:n}))}})}};wT.LAST_WORKER_ID=0;let E8=wT;class LMe{constructor(e,t){this.esmModuleLocation=e,this.label=t}}function xMe(o,e){const t=be.isUri(o)?new LMe(o,e):o;return new CMe(new E8(t))}class kMe{constructor(e,t,i){const n=new Uint8Array(e*t);for(let s=0,r=e*t;s<r;s++)n[s]=i;this._data=n,this.rows=e,this.cols=t}get(e,t){return this._data[e*this.cols+t]}set(e,t,i){this._data[e*this.cols+t]=i}}class IMe{constructor(e){let t=0,i=0;for(let s=0,r=e.length;s<r;s++){const[a,l,c]=e[s];l>t&&(t=l),a>i&&(i=a),c>i&&(i=c)}t++,i++;const n=new kMe(i,t,0);for(let s=0,r=e.length;s<r;s++){const[a,l,c]=e[s];n.set(a,l,c)}this._states=n,this._maxCharCode=t}nextState(e,t){return t<0||t>=this._maxCharCode?0:this._states.get(e,t)}}let N8=null;function DMe(){return N8===null&&(N8=new IMe([[1,104,2],[1,72,2],[1,102,6],[1,70,6],[2,116,3],[2,84,3],[3,116,4],[3,84,4],[4,112,5],[4,80,5],[5,115,9],[5,83,9],[5,58,10],[6,105,7],[6,73,7],[7,108,8],[7,76,8],[8,101,9],[8,69,9],[9,58,10],[10,47,11],[11,47,12]])),N8}let nS=null;function EMe(){if(nS===null){nS=new qm(0);const o=` <>'"、。。、,.:;‘〈「『〔([{「」}])〕』」〉’`~…|`;for(let t=0;t<o.length;t++)nS.set(o.charCodeAt(t),1);const e=".,;:";for(let t=0;t<e.length;t++)nS.set(e.charCodeAt(t),2)}return nS}class wE{static _createLink(e,t,i,n,s){let r=s-1;do{const a=t.charCodeAt(r);if(e.get(a)!==2)break;r--}while(r>n);if(n>0){const a=t.charCodeAt(n-1),l=t.charCodeAt(r);(a===40&&l===41||a===91&&l===93||a===123&&l===125)&&r--}return{range:{startLineNumber:i,startColumn:n+1,endLineNumber:i,endColumn:r+2},url:t.substring(n,r+1)}}static computeLinks(e,t=DMe()){const i=EMe(),n=[];for(let s=1,r=e.getLineCount();s<=r;s++){const a=e.getLineContent(s),l=a.length;let c=0,d=0,h=0,u=1,f=!1,g=!1,m=!1,_=!1;for(;c<l;){let b=!1;const C=a.charCodeAt(c);if(u===13){let w;switch(C){case 40:f=!0,w=0;break;case 41:w=f?0:1;break;case 91:m=!0,g=!0,w=0;break;case 93:m=!1,w=g?0:1;break;case 123:_=!0,w=0;break;case 125:w=_?0:1;break;case 39:case 34:case 96:h===C?w=1:h===39||h===34||h===96?w=0:w=1;break;case 42:w=h===42?1:0;break;case 32:w=m?0:1;break;default:w=i.get(C)}w===1&&(n.push(wE._createLink(i,a,s,d,c)),b=!0)}else if(u===12){let w;C===91?(g=!0,w=0):w=i.get(C),w===1?b=!0:u=13}else u=t.nextState(u,C),u===0&&(b=!0);b&&(u=1,f=!1,g=!1,_=!1,d=c+1,h=C),c++}u===13&&n.push(wE._createLink(i,a,s,d,l))}return n}}function NMe(o){return!o||typeof o.getLineCount!="function"||typeof o.getLineContent!="function"?[]:wE.computeLinks(o)}const ST=class ST{constructor(){this._defaultValueSet=[["true","false"],["True","False"],["Private","Public","Friend","ReadOnly","Partial","Protected","WriteOnly"],["public","protected","private"]]}navigateValueSet(e,t,i,n,s){if(e&&t){const r=this.doNavigateValueSet(t,s);if(r)return{range:e,value:r}}if(i&&n){const r=this.doNavigateValueSet(n,s);if(r)return{range:i,value:r}}return null}doNavigateValueSet(e,t){const i=this.numberReplace(e,t);return i!==null?i:this.textReplace(e,t)}numberReplace(e,t){const i=Math.pow(10,e.length-(e.lastIndexOf(".")+1));let n=Number(e);const s=parseFloat(e);return!isNaN(n)&&!isNaN(s)&&n===s?n===0&&!t?null:(n=Math.floor(n*i),n+=t?i:-i,String(n/i)):null}textReplace(e,t){return this.valueSetsReplace(this._defaultValueSet,e,t)}valueSetsReplace(e,t,i){let n=null;for(let s=0,r=e.length;n===null&&s<r;s++)n=this.valueSetReplace(e[s],t,i);return n}valueSetReplace(e,t,i){let n=e.indexOf(t);return n>=0?(n+=i?1:-1,n<0?n=e.length-1:n%=e.length,e[n]):null}};ST.INSTANCE=new ST;let T8=ST;function HJ(o){const e=[];for(const t of o){const i=Number(t);(i||i===0&&t.replace(/\s/g,"")!=="")&&e.push(i)}return e}function R8(o,e,t,i){return{red:o/255,blue:t/255,green:e/255,alpha:i}}function sS(o,e){const t=e.index,i=e[0].length;if(t===void 0)return;const n=o.positionAt(t);return{startLineNumber:n.lineNumber,startColumn:n.column,endLineNumber:n.lineNumber,endColumn:n.column+i}}function TMe(o,e){if(!o)return;const t=$.Format.CSS.parseHex(e);if(t)return{range:o,color:R8(t.rgba.r,t.rgba.g,t.rgba.b,t.rgba.a)}}function VJ(o,e,t){if(!o||e.length!==1)return;const n=e[0].values(),s=HJ(n);return{range:o,color:R8(s[0],s[1],s[2],t?s[3]:1)}}function zJ(o,e,t){if(!o||e.length!==1)return;const n=e[0].values(),s=HJ(n),r=new $(new Qr(s[0],s[1]/100,s[2]/100,t?s[3]:1));return{range:o,color:R8(r.rgba.r,r.rgba.g,r.rgba.b,r.rgba.a)}}function oS(o,e){return typeof o=="string"?[...o.matchAll(e)]:o.findMatches(e)}function RMe(o){const e=[],t=new RegExp(`\\b(rgb|rgba|hsl|hsla)(\\([0-9\\s,.\\%]*\\))|^(#)([A-Fa-f0-9]{3})\\b|^(#)([A-Fa-f0-9]{4})\\b|^(#)([A-Fa-f0-9]{6})\\b|^(#)([A-Fa-f0-9]{8})\\b|(?<=['"\\s])(#)([A-Fa-f0-9]{3})\\b|(?<=['"\\s])(#)([A-Fa-f0-9]{4})\\b|(?<=['"\\s])(#)([A-Fa-f0-9]{6})\\b|(?<=['"\\s])(#)([A-Fa-f0-9]{8})\\b`,"gm"),i=oS(o,t);if(i.length>0)for(const n of i){const s=n.filter(c=>c!==void 0),r=s[1],a=s[2];if(!a)continue;let l;if(r==="rgb"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*\)$/gm;l=VJ(sS(o,n),oS(a,c),!1)}else if(r==="rgba"){const c=/^\(\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]|[0-9])\s*,\s*(0[.][0-9]+|[.][0-9]+|[01][.]|[01])\s*\)$/gm;l=VJ(sS(o,n),oS(a,c),!0)}else if(r==="hsl"){const c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*\)$/gm;l=zJ(sS(o,n),oS(a,c),!1)}else if(r==="hsla"){const c=/^\(\s*((?:360(?:\.0+)?|(?:36[0]|3[0-5][0-9]|[12][0-9][0-9]|[1-9]?[0-9])(?:\.\d+)?))\s*[\s,]\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(100|\d{1,2}[.]\d*|\d{1,2})%\s*[\s,]\s*(0[.][0-9]+|[.][0-9]+|[01][.]0*|[01])\s*\)$/gm;l=zJ(sS(o,n),oS(a,c),!0)}else r==="#"&&(l=TMe(sS(o,n),r+a));l&&e.push(l)}return e}function MMe(o){return!o||typeof o.getValue!="function"||typeof o.positionAt!="function"?[]:RMe(o)}const PMe=/^-+|-+$/g,UJ=100,AMe=5;function OMe(o,e){let t=[];if(e.findRegionSectionHeaders&&e.foldingRules?.markers){const i=FMe(o,e);t=t.concat(i)}if(e.findMarkSectionHeaders){const i=WMe(o,e);t=t.concat(i)}return t}function FMe(o,e){const t=[],i=o.getLineCount();for(let n=1;n<=i;n++){const s=o.getLineContent(n),r=s.match(e.foldingRules.markers.start);if(r){const a={startLineNumber:n,startColumn:r[0].length+1,endLineNumber:n,endColumn:s.length+1};if(a.endColumn>a.startColumn){const l={range:a,...BMe(s.substring(r[0].length)),shouldBeInComments:!1};(l.text||l.hasSeparatorLine)&&t.push(l)}}}return t}function WMe(o,e){const t=[],i=o.getLineCount();if(!e.markSectionHeaderRegex||e.markSectionHeaderRegex.trim()==="")return t;const n=c$(e.markSectionHeaderRegex),s=new RegExp(e.markSectionHeaderRegex,`gdm${n?"s":""}`);if(e6(s))return t;for(let r=1;r<=i;r+=UJ-AMe){const a=Math.min(r+UJ-1,i),l=[];for(let h=r;h<=a;h++)l.push(o.getLineContent(h));const c=l.join(`
`);s.lastIndex=0;let d;for(;(d=s.exec(c))!==null;){const h=c.substring(0,d.index),u=(h.match(/\n/g)||[]).length,f=r+u,g=d[0].split(`
`),m=g.length,_=f+m-1,b=h.lastIndexOf(`
`)+1,C=d.index-b+1,w=g[g.length-1],v=m===1?C+d[0].length:w.length+1,S={startLineNumber:f,startColumn:C,endLineNumber:_,endColumn:v},L=(d.groups??{}).label??"",x=((d.groups??{}).separator??"")!=="",I={range:S,text:L,hasSeparatorLine:x,shouldBeInComments:!0};(I.text||I.hasSeparatorLine)&&(t.length===0||t[t.length-1].range.endLineNumber<I.range.startLineNumber)&&t.push(I),s.lastIndex=d.index+d[0].length}}return t}function BMe(o){o=o.trim();const e=o.startsWith("-");return o=o.replace(PMe,""),{text:o,hasSeparatorLine:e}}class HMe{constructor(e,t,i,n){this._uri=e,this._lines=t,this._eol=i,this._versionId=n,this._lineStarts=null,this._cachedTextValue=null}dispose(){this._lines.length=0}get version(){return this._versionId}getText(){return this._cachedTextValue===null&&(this._cachedTextValue=this._lines.join(this._eol)),this._cachedTextValue}onEvents(e){e.eol&&e.eol!==this._eol&&(this._eol=e.eol,this._lineStarts=null);const t=e.changes;for(const i of t)this._acceptDeleteRange(i.range),this._acceptInsertText(new M(i.range.startLineNumber,i.range.startColumn),i.text);this._versionId=e.versionId,this._cachedTextValue=null}_ensureLineStarts(){if(!this._lineStarts){const e=this._eol.length,t=this._lines.length,i=new Uint32Array(t);for(let n=0;n<t;n++)i[n]=this._lines[n].length+e;this._lineStarts=new sme(i)}}_setLineText(e,t){this._lines[e]=t,this._lineStarts&&this._lineStarts.setValue(e,this._lines[e].length+this._eol.length)}_acceptDeleteRange(e){if(e.startLineNumber===e.endLineNumber){if(e.startColumn===e.endColumn)return;this._setLineText(e.startLineNumber-1,this._lines[e.startLineNumber-1].substring(0,e.startColumn-1)+this._lines[e.startLineNumber-1].substring(e.endColumn-1));return}this._setLineText(e.startLineNumber-1,this._lines[e.startLineNumber-1].substring(0,e.startColumn-1)+this._lines[e.endLineNumber-1].substring(e.endColumn-1)),this._lines.splice(e.startLineNumber,e.endLineNumber-e.startLineNumber),this._lineStarts&&this._lineStarts.removeValues(e.startLineNumber,e.endLineNumber-e.startLineNumber)}_acceptInsertText(e,t){if(t.length===0)return;const i=ro(t);if(i.length===1){this._setLineText(e.lineNumber-1,this._lines[e.lineNumber-1].substring(0,e.column-1)+i[0]+this._lines[e.lineNumber-1].substring(e.column-1));return}i[i.length-1]+=this._lines[e.lineNumber-1].substring(e.column-1),this._setLineText(e.lineNumber-1,this._lines[e.lineNumber-1].substring(0,e.column-1)+i[0]);const n=new Uint32Array(i.length-1);for(let s=1;s<i.length;s++)this._lines.splice(e.lineNumber+s-1,0,i[s]),n[s-1]=i[s].length+this._eol.length;this._lineStarts&&this._lineStarts.insertValues(e.lineNumber,n)}}const $J=60*1e3;class VMe extends A{constructor(e,t,i=!1){if(super(),this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),this._proxy=e,this._modelService=t,!i){const n=new uR;n.cancelAndSet(()=>this._checkStopModelSync(),Math.round($J/2)),this._register(n)}}dispose(){for(const e in this._syncedModels)pt(this._syncedModels[e]);this._syncedModels=Object.create(null),this._syncedModelsLastUsedTime=Object.create(null),super.dispose()}ensureSyncedResources(e,t=!1){for(const i of e){const n=i.toString();this._syncedModels[n]||this._beginModelSync(i,t),this._syncedModels[n]&&(this._syncedModelsLastUsedTime[n]=new Date().getTime())}}_checkStopModelSync(){const e=new Date().getTime(),t=[];for(const i in this._syncedModelsLastUsedTime)e-this._syncedModelsLastUsedTime[i]>$J&&t.push(i);for(const i of t)this._stopModelSync(i)}_beginModelSync(e,t){const i=this._modelService.getModel(e);if(!i||!t&&i.isTooLargeForSyncing())return;const n=e.toString();this._proxy.$acceptNewModel({url:i.uri.toString(),lines:i.getLinesContent(),EOL:i.getEOL(),versionId:i.getVersionId()});const s=new U;s.add(i.onDidChangeContent(r=>{this._proxy.$acceptModelChanged(n.toString(),r)})),s.add(i.onWillDispose(()=>{this._stopModelSync(n)})),s.add(ue(()=>{this._proxy.$acceptRemovedModel(n)})),this._syncedModels[n]=s}_stopModelSync(e){const t=this._syncedModels[e];delete this._syncedModels[e],delete this._syncedModelsLastUsedTime[e],pt(t)}}class zMe{constructor(){this._models=Object.create(null)}getModel(e){return this._models[e]}getModels(){const e=[];return Object.keys(this._models).forEach(t=>e.push(this._models[t])),e}$acceptNewModel(e){this._models[e.url]=new UMe(be.parse(e.url),e.lines,e.EOL,e.versionId)}$acceptModelChanged(e,t){if(!this._models[e])return;this._models[e].onEvents(t)}$acceptRemovedModel(e){this._models[e]&&delete this._models[e]}}class UMe extends HMe{get uri(){return this._uri}get eol(){return this._eol}getValue(){return this.getText()}findMatches(e){const t=[];for(let i=0;i<this._lines.length;i++){const n=this._lines[i],s=this.offsetAt(new M(i+1,1)),r=n.matchAll(e);for(const a of r)(a.index||a.index===0)&&(a.index=a.index+s),t.push(a)}return t}getLinesContent(){return this._lines.slice(0)}getLineCount(){return this._lines.length}getLineContent(e){return this._lines[e-1]}getWordAtPosition(e,t){const i=T1(e.column,y2(t),this._lines[e.lineNumber-1],0);return i?new k(e.lineNumber,i.startColumn,e.lineNumber,i.endColumn):null}words(e){const t=this._lines,i=this._wordenize.bind(this);let n=0,s="",r=0,a=[];return{*[Symbol.iterator](){for(;;)if(r<a.length){const l=s.substring(a[r].start,a[r].end);r+=1,yield l}else if(n<t.length)s=t[n],a=i(s,e),r=0,n+=1;else break}}}getLineWords(e,t){const i=this._lines[e-1],n=this._wordenize(i,t),s=[];for(const r of n)s.push({word:i.substring(r.start,r.end),startColumn:r.start+1,endColumn:r.end+1});return s}_wordenize(e,t){const i=[];let n;for(t.lastIndex=0;(n=t.exec(e))&&n[0].length!==0;)i.push({start:n.index,end:n.index+n[0].length});return i}getValueInRange(e){if(e=this._validateRange(e),e.startLineNumber===e.endLineNumber)return this._lines[e.startLineNumber-1].substring(e.startColumn-1,e.endColumn-1);const t=this._eol,i=e.startLineNumber-1,n=e.endLineNumber-1,s=[];s.push(this._lines[i].substring(e.startColumn-1));for(let r=i+1;r<n;r++)s.push(this._lines[r]);return s.push(this._lines[n].substring(0,e.endColumn-1)),s.join(t)}offsetAt(e){return e=this._validatePosition(e),this._ensureLineStarts(),this._lineStarts.getPrefixSum(e.lineNumber-2)+(e.column-1)}positionAt(e){e=Math.floor(e),e=Math.max(0,e),this._ensureLineStarts();const t=this._lineStarts.getIndexOf(e),i=this._lines[t.index].length;return{lineNumber:1+t.index,column:1+Math.min(t.remainder,i)}}_validateRange(e){const t=this._validatePosition({lineNumber:e.startLineNumber,column:e.startColumn}),i=this._validatePosition({lineNumber:e.endLineNumber,column:e.endColumn});return t.lineNumber!==e.startLineNumber||t.column!==e.startColumn||i.lineNumber!==e.endLineNumber||i.column!==e.endColumn?{startLineNumber:t.lineNumber,startColumn:t.column,endLineNumber:i.lineNumber,endColumn:i.column}:e}_validatePosition(e){if(!M.isIPosition(e))throw new Error("bad position");let{lineNumber:t,column:i}=e,n=!1;if(t<1)t=1,i=1,n=!0;else if(t>this._lines.length)t=this._lines.length,i=this._lines[t-1].length+1,n=!0;else{const s=this._lines[t-1].length+1;i<1?(i=1,n=!0):i>s&&(i=s,n=!0)}return n?{lineNumber:t,column:i}:e}}const Cm=class Cm{constructor(e=null){this._foreignModule=e,this._workerTextModelSyncServer=new zMe}dispose(){}async $ping(){return"pong"}_getModel(e){return this._workerTextModelSyncServer.getModel(e)}getModels(){return this._workerTextModelSyncServer.getModels()}$acceptNewModel(e){this._workerTextModelSyncServer.$acceptNewModel(e)}$acceptModelChanged(e,t){this._workerTextModelSyncServer.$acceptModelChanged(e,t)}$acceptRemovedModel(e){this._workerTextModelSyncServer.$acceptRemovedModel(e)}async $computeUnicodeHighlights(e,t,i){const n=this._getModel(e);return n?$7.computeUnicodeHighlights(n,t,i):{ranges:[],hasMore:!1,ambiguousCharacterCount:0,invisibleCharacterCount:0,nonBasicAsciiCharacterCount:0}}async $findSectionHeaders(e,t){const i=this._getModel(e);return i?OMe(i,t):[]}async $computeDiff(e,t,i,n){const s=this._getModel(e),r=this._getModel(t);return!s||!r?null:Cm.computeDiff(s,r,i,n)}static computeDiff(e,t,i,n){const s=n==="advanced"?WF.getDefault():WF.getLegacy(),r=e.getLinesContent(),a=t.getLinesContent(),l=s.computeDiff(r,a,i),c=l.changes.length>0?!1:this._modelsAreIdentical(e,t);function d(h){return h.map(u=>[u.original.startLineNumber,u.original.endLineNumberExclusive,u.modified.startLineNumber,u.modified.endLineNumberExclusive,u.innerChanges?.map(f=>[f.originalRange.startLineNumber,f.originalRange.startColumn,f.originalRange.endLineNumber,f.originalRange.endColumn,f.modifiedRange.startLineNumber,f.modifiedRange.startColumn,f.modifiedRange.endLineNumber,f.modifiedRange.endColumn])])}return{identical:c,quitEarly:l.hitTimeout,changes:d(l.changes),moves:l.moves.map(h=>[h.lineRangeMapping.original.startLineNumber,h.lineRangeMapping.original.endLineNumberExclusive,h.lineRangeMapping.modified.startLineNumber,h.lineRangeMapping.modified.endLineNumberExclusive,d(h.changes)])}}static _modelsAreIdentical(e,t){const i=e.getLineCount(),n=t.getLineCount();if(i!==n)return!1;for(let s=1;s<=i;s++){const r=e.getLineContent(s),a=t.getLineContent(s);if(r!==a)return!1}return!0}async $computeMoreMinimalEdits(e,t,i){const n=this._getModel(e);if(!n)return t;const s=[];let r;t=t.slice(0).sort((l,c)=>{if(l.range&&c.range)return k.compareRangesUsingStarts(l.range,c.range);const d=l.range?0:1,h=c.range?0:1;return d-h});let a=0;for(let l=1;l<t.length;l++)k.getEndPosition(t[a].range).equals(k.getStartPosition(t[l].range))?(t[a].range=k.fromPositions(k.getStartPosition(t[a].range),k.getEndPosition(t[l].range)),t[a].text+=t[l].text):(a++,t[a]=t[l]);t.length=a+1;for(let{range:l,text:c,eol:d}of t){if(typeof d=="number"&&(r=d),k.isEmpty(l)&&!c)continue;const h=n.getValueInRange(l);if(c=c.replace(/\r\n|\n|\r/g,n.eol),h===c)continue;if(Math.max(c.length,h.length)>Cm._diffLimit){s.push({range:l,text:c});continue}const u=DSe(h,c,i),f=n.offsetAt(k.lift(l).getStartPosition());for(const g of u){const m=n.positionAt(f+g.originalStart),_=n.positionAt(f+g.originalStart+g.originalLength),b={text:c.substr(g.modifiedStart,g.modifiedLength),range:{startLineNumber:m.lineNumber,startColumn:m.column,endLineNumber:_.lineNumber,endColumn:_.column}};n.getValueInRange(b.range)!==b.text&&s.push(b)}}return typeof r=="number"&&s.push({eol:r,text:"",range:{startLineNumber:0,startColumn:0,endLineNumber:0,endColumn:0}}),s}async $computeLinks(e){const t=this._getModel(e);return t?NMe(t):null}async $computeDefaultDocumentColors(e){const t=this._getModel(e);return t?MMe(t):null}async $textualSuggest(e,t,i,n){const s=new Ki,r=new RegExp(i,n),a=new Set;e:for(const l of e){const c=this._getModel(l);if(c){for(const d of c.words(r))if(!(d===t||!isNaN(Number(d)))&&(a.add(d),a.size>Cm._suggestionsLimit))break e}}return{words:Array.from(a),duration:s.elapsed()}}async $computeWordRanges(e,t,i,n){const s=this._getModel(e);if(!s)return Object.create(null);const r=new RegExp(i,n),a=Object.create(null);for(let l=t.startLineNumber;l<t.endLineNumber;l++){const c=s.getLineWords(l,r);for(const d of c){if(!isNaN(Number(d.word)))continue;let h=a[d.word];h||(h=[],a[d.word]=h),h.push({startLineNumber:l,startColumn:d.startColumn,endLineNumber:l,endColumn:d.endColumn})}}return a}async $navigateValueSet(e,t,i,n,s){const r=this._getModel(e);if(!r)return null;const a=new RegExp(n,s);t.startColumn===t.endColumn&&(t={startLineNumber:t.startLineNumber,startColumn:t.startColumn,endLineNumber:t.endLineNumber,endColumn:t.endColumn+1});const l=r.getValueInRange(t),c=r.getWordAtPosition({lineNumber:t.startLineNumber,column:t.startColumn},a);if(!c)return null;const d=r.getValueInRange(c);return T8.INSTANCE.navigateValueSet(t,l,c,d,i)}$fmr(e,t){if(!this._foreignModule||typeof this._foreignModule[e]!="function")return Promise.reject(new Error("Missing requestHandler or method: "+e));try{return Promise.resolve(this._foreignModule[e].apply(this._foreignModule,t))}catch(i){return Promise.reject(i)}}};Cm._diffLimit=1e5,Cm._suggestionsLimit=1e4;let M8=Cm;typeof importScripts=="function"&&(globalThis.monaco=PJ());const OS=class OS{static getChannel(e){return e.getChannel(OS.CHANNEL_NAME)}static setChannel(e,t){e.setChannel(OS.CHANNEL_NAME,t)}};OS.CHANNEL_NAME="editorWorkerHost";let P8=OS;var A8=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},cp=function(o,e){return function(t,i){e(t,i,o)}};const jJ=300*1e3;function dp(o,e){const t=o.getModel(e);return!(!t||t.isTooLargeForSyncing())}let O8=class extends A{constructor(e,t,i,n,s,r){super(),this._languageConfigurationService=s,this._modelService=t,this._workerManager=this._register(new F8(e,this._modelService)),this._logService=n,this._register(r.linkProvider.register({language:"*",hasAccessToAllModels:!0},{provideLinks:async(a,l)=>{if(!dp(this._modelService,a.uri))return Promise.resolve({links:[]});const d=await(await this._workerWithResources([a.uri])).$computeLinks(a.uri.toString());return d&&{links:d}}})),this._register(r.completionProvider.register("*",new $Me(this._workerManager,i,this._modelService,this._languageConfigurationService,this._logService)))}dispose(){super.dispose()}canComputeUnicodeHighlights(e){return dp(this._modelService,e)}async computedUnicodeHighlights(e,t,i){return(await this._workerWithResources([e])).$computeUnicodeHighlights(e.toString(),t,i)}async computeDiff(e,t,i,n){const r=await(await this._workerWithResources([e,t],!0)).$computeDiff(e.toString(),t.toString(),i,n);if(!r)return null;return{identical:r.identical,quitEarly:r.quitEarly,changes:l(r.changes),moves:r.moves.map(c=>new Aq(new ds(new ke(c[0],c[1]),new ke(c[2],c[3])),l(c[4])))};function l(c){return c.map(d=>new qo(new ke(d[0],d[1]),new ke(d[2],d[3]),d[4]?.map(h=>new Is(new k(h[0],h[1],h[2],h[3]),new k(h[4],h[5],h[6],h[7])))))}}async computeMoreMinimalEdits(e,t,i=!1){if(is(t)){if(!dp(this._modelService,e))return Promise.resolve(t);const n=Ki.create(),s=this._workerWithResources([e]).then(r=>r.$computeMoreMinimalEdits(e.toString(),t,i));return s.finally(()=>this._logService.trace("FORMAT#computeMoreMinimalEdits",e.toString(!0),n.elapsed())),Promise.race([s,al(1e3).then(()=>t)])}else return Promise.resolve(void 0)}canNavigateValueSet(e){return dp(this._modelService,e)}async navigateValueSet(e,t,i){const n=this._modelService.getModel(e);if(!n)return null;const s=this._languageConfigurationService.getLanguageConfiguration(n.getLanguageId()).getWordDefinition(),r=s.source,a=s.flags;return(await this._workerWithResources([e])).$navigateValueSet(e.toString(),t,i,r,a)}canComputeWordRanges(e){return dp(this._modelService,e)}async computeWordRanges(e,t){const i=this._modelService.getModel(e);if(!i)return Promise.resolve(null);const n=this._languageConfigurationService.getLanguageConfiguration(i.getLanguageId()).getWordDefinition(),s=n.source,r=n.flags;return(await this._workerWithResources([e])).$computeWordRanges(e.toString(),t,s,r)}async findSectionHeaders(e,t){return(await this._workerWithResources([e])).$findSectionHeaders(e.toString(),t)}async computeDefaultDocumentColors(e){return(await this._workerWithResources([e])).$computeDefaultDocumentColors(e.toString())}async _workerWithResources(e,t=!1){return await(await this._workerManager.withWorker()).workerWithSyncedResources(e,t)}};O8=A8([cp(1,Qt),cp(2,ZD),cp(3,Rt),cp(4,Jt),cp(5,he)],O8);class $Me{constructor(e,t,i,n,s){this.languageConfigurationService=n,this.logService=s,this._debugDisplayName="wordbasedCompletions",this._workerManager=e,this._configurationService=t,this._modelService=i}async provideCompletionItems(e,t){const i=this._configurationService.getValue(e.uri,t,"editor");if(i.wordBasedSuggestions==="off")return;const n=[];if(i.wordBasedSuggestions==="currentDocument")dp(this._modelService,e.uri)&&n.push(e.uri);else for(const h of this._modelService.getModels())dp(this._modelService,h.uri)&&(h===e?n.unshift(h.uri):(i.wordBasedSuggestions==="allDocuments"||h.getLanguageId()===e.getLanguageId())&&n.push(h.uri));if(n.length===0)return;const s=this.languageConfigurationService.getLanguageConfiguration(e.getLanguageId()).getWordDefinition(),r=e.getWordAtPosition(t),a=r?new k(t.lineNumber,r.startColumn,t.lineNumber,r.endColumn):k.fromPositions(t),l=a.setEndPosition(t.lineNumber,t.column);this.logService.trace("[WordBasedCompletionItemProvider]",`word: "${r?.word||""}", wordDef: "${s}", replace: [${a.toString()}], insert: [${l.toString()}]`);const d=await(await this._workerManager.withWorker()).textualSuggest(n,r?.word,s);if(d)return{duration:d.duration,suggestions:d.words.map(h=>({kind:18,label:h,insertText:h,range:{insert:l,replace:a}}))}}}let F8=class extends A{constructor(e,t){super(),this._workerDescriptor=e,this._modelService=t,this._editorWorkerClient=null,this._lastWorkerUsedTime=new Date().getTime(),this._register(new Ly).cancelAndSet(()=>this._checkStopIdleWorker(),Math.round(jJ/2),bt),this._register(this._modelService.onModelRemoved(n=>this._checkStopEmptyWorker()))}dispose(){this._editorWorkerClient&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null),super.dispose()}_checkStopEmptyWorker(){if(!this._editorWorkerClient)return;this._modelService.getModels().length===0&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}_checkStopIdleWorker(){if(!this._editorWorkerClient)return;new Date().getTime()-this._lastWorkerUsedTime>jJ&&(this._editorWorkerClient.dispose(),this._editorWorkerClient=null)}withWorker(){return this._lastWorkerUsedTime=new Date().getTime(),this._editorWorkerClient||(this._editorWorkerClient=new SE(this._workerDescriptor,!1,this._modelService)),Promise.resolve(this._editorWorkerClient)}};F8=A8([cp(1,Qt)],F8);class jMe{constructor(e){this._instance=e,this.proxy=this._instance}dispose(){this._instance.dispose()}setChannel(e,t){throw new Error("Not supported")}}let SE=class extends A{constructor(e,t,i){super(),this._workerDescriptorOrWorker=e,this._disposed=!1,this._modelService=i,this._keepIdleModels=t,this._worker=null,this._modelManager=null}fhr(e,t){throw new Error("Not implemented!")}_getOrCreateWorker(){if(!this._worker)try{this._worker=this._register(xMe(this._workerDescriptorOrWorker)),P8.setChannel(this._worker,this._createEditorWorkerHost())}catch(e){D8(e),this._worker=this._createFallbackLocalWorker()}return this._worker}async _getProxy(){try{const e=this._getOrCreateWorker().proxy;return await e.$ping(),e}catch(e){return D8(e),this._worker=this._createFallbackLocalWorker(),this._worker.proxy}}_createFallbackLocalWorker(){return new jMe(new M8(null))}_createEditorWorkerHost(){return{$fhr:(e,t)=>this.fhr(e,t)}}_getOrCreateModelManager(e){return this._modelManager||(this._modelManager=this._register(new VMe(e,this._modelService,this._keepIdleModels))),this._modelManager}async workerWithSyncedResources(e,t=!1){if(this._disposed)return Promise.reject(Rte());const i=await this._getProxy();return this._getOrCreateModelManager(i).ensureSyncedResources(e,t),i}async textualSuggest(e,t,i){const n=await this.workerWithSyncedResources(e),s=i.source,r=i.flags;return n.$textualSuggest(e.map(a=>a.toString()),t,s,r)}dispose(){super.dispose(),this._disposed=!0}};SE=A8([cp(2,Qt)],SE);function qMe(o,e){return new KMe(o,e)}class KMe extends SE{constructor(e,t){super(t.worker,t.keepIdleModels||!1,e),this._foreignModuleHost=t.host||null,this._foreignProxy=this._getProxy().then(i=>new Proxy({},{get(n,s,r){if(s!=="then"){if(typeof s!="string")throw new Error("Not supported");return(...a)=>i.$fmr(s,a)}}}))}fhr(e,t){if(!this._foreignModuleHost||typeof this._foreignModuleHost[e]!="function")return Promise.reject(new Error("Missing method "+e+" or missing main thread foreign host."));try{return Promise.resolve(this._foreignModuleHost[e].apply(this._foreignModuleHost,t))}catch(i){return Promise.reject(i)}}getProxy(){return this._foreignProxy}withSyncedResources(e){return this.workerWithSyncedResources(e).then(t=>this.getProxy())}}function GMe(o){return Array.isArray(o)}function ZMe(o){return!GMe(o)}function qJ(o){return typeof o=="string"}function KJ(o){return!qJ(o)}function hp(o){return!o}function Ad(o,e){return o.ignoreCase&&e?e.toLowerCase():e}function GJ(o){return o.replace(/[&<>'"_]/g,"-")}function YMe(o,e){console.log(`${o.languageId}: ${e}`)}function Gt(o,e){return new Error(`${o.languageId}: ${e}`)}function _u(o,e,t,i,n){const s=/\$((\$)|(#)|(\d\d?)|[sS](\d\d?)|@(\w+))/g;let r=null;return e.replace(s,function(a,l,c,d,h,u,f,g,m){return hp(c)?hp(d)?!hp(h)&&h<i.length?Ad(o,i[h]):!hp(f)&&o&&typeof o[f]=="string"?o[f]:(r===null&&(r=n.split("."),r.unshift(n)),!hp(u)&&u<r.length?Ad(o,r[u]):""):Ad(o,t):"$"})}function XMe(o,e,t){const i=/\$[sS](\d\d?)/g;let n=null;return e.replace(i,function(s,r){return n===null&&(n=t.split("."),n.unshift(t)),!hp(r)&&r<n.length?oo(Ad(o,n[r])):""})}function yE(o,e){let t=e;for(;t&&t.length>0;){const i=o.tokenizer[t];if(i)return i;const n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return null}function QMe(o,e){let t=e;for(;t&&t.length>0;){if(o.stateNames[t])return!0;const n=t.lastIndexOf(".");n<0?t=null:t=t.substr(0,n)}return!1}var JMe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},ePe=function(o,e){return function(t,i){e(t,i,o)}},W8;const ZJ=5,yT=class yT{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(e!==null&&e.depth>=this._maxCacheDepth)return new eC(e,t);let i=eC.getStackElementId(e);i.length>0&&(i+="|"),i+=t;let n=this._entries[i];return n||(n=new eC(e,t),this._entries[i]=n,n)}};yT._INSTANCE=new yT(ZJ);let rS=yT;class eC{constructor(e,t){this.parent=e,this.state=t,this.depth=(this.parent?this.parent.depth:0)+1}static getStackElementId(e){let t="";for(;e!==null;)t.length>0&&(t+="|"),t+=e.state,e=e.parent;return t}static _equals(e,t){for(;e!==null&&t!==null;){if(e===t)return!0;if(e.state!==t.state)return!1;e=e.parent,t=t.parent}return e===null&&t===null}equals(e){return eC._equals(this,e)}push(e){return rS.create(this,e)}pop(){return this.parent}popall(){let e=this;for(;e.parent;)e=e.parent;return e}switchTo(e){return rS.create(this.parent,e)}}class tC{constructor(e,t){this.languageId=e,this.state=t}equals(e){return this.languageId===e.languageId&&this.state.equals(e.state)}clone(){return this.state.clone()===this.state?this:new tC(this.languageId,this.state)}}const LT=class LT{static create(e,t){return this._INSTANCE.create(e,t)}constructor(e){this._maxCacheDepth=e,this._entries=Object.create(null)}create(e,t){if(t!==null)return new aS(e,t);if(e!==null&&e.depth>=this._maxCacheDepth)return new aS(e,t);const i=eC.getStackElementId(e);let n=this._entries[i];return n||(n=new aS(e,null),this._entries[i]=n,n)}};LT._INSTANCE=new LT(ZJ);let bu=LT;class aS{constructor(e,t){this.stack=e,this.embeddedLanguageData=t}clone(){return(this.embeddedLanguageData?this.embeddedLanguageData.clone():null)===this.embeddedLanguageData?this:bu.create(this.stack,this.embeddedLanguageData)}equals(e){return!(e instanceof aS)||!this.stack.equals(e.stack)?!1:this.embeddedLanguageData===null&&e.embeddedLanguageData===null?!0:this.embeddedLanguageData===null||e.embeddedLanguageData===null?!1:this.embeddedLanguageData.equals(e.embeddedLanguageData)}}class tPe{constructor(){this._tokens=[],this._languageId=null,this._lastTokenType=null,this._lastTokenLanguage=null}enterLanguage(e){this._languageId=e}emit(e,t){this._lastTokenType===t&&this._lastTokenLanguage===this._languageId||(this._lastTokenType=t,this._lastTokenLanguage=this._languageId,this._tokens.push(new rv(e,t,this._languageId)))}nestedLanguageTokenize(e,t,i,n){const s=i.languageId,r=i.state,a=di.get(s);if(!a)return this.enterLanguage(s),this.emit(n,""),r;const l=a.tokenize(e,t,r);if(n!==0)for(const c of l.tokens)this._tokens.push(new rv(c.offset+n,c.type,c.language));else this._tokens=this._tokens.concat(l.tokens);return this._lastTokenType=null,this._lastTokenLanguage=null,this._languageId=null,l.endState}finalize(e){return new HM(this._tokens,e)}}class LE{constructor(e,t){this._languageService=e,this._theme=t,this._prependTokens=null,this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0}enterLanguage(e){this._currentLanguageId=this._languageService.languageIdCodec.encodeLanguageId(e)}emit(e,t){const i=this._theme.match(this._currentLanguageId,t)|1024;this._lastTokenMetadata!==i&&(this._lastTokenMetadata=i,this._tokens.push(e),this._tokens.push(i))}static _merge(e,t,i){const n=e!==null?e.length:0,s=t.length,r=i!==null?i.length:0;if(n===0&&s===0&&r===0)return new Uint32Array(0);if(n===0&&s===0)return i;if(s===0&&r===0)return e;const a=new Uint32Array(n+s+r);e!==null&&a.set(e);for(let l=0;l<s;l++)a[n+l]=t[l];return i!==null&&a.set(i,n+s),a}nestedLanguageTokenize(e,t,i,n){const s=i.languageId,r=i.state,a=di.get(s);if(!a)return this.enterLanguage(s),this.emit(n,""),r;const l=a.tokenizeEncoded(e,t,r);if(n!==0)for(let c=0,d=l.tokens.length;c<d;c+=2)l.tokens[c]+=n;return this._prependTokens=LE._merge(this._prependTokens,this._tokens,l.tokens),this._tokens=[],this._currentLanguageId=0,this._lastTokenMetadata=0,l.endState}finalize(e){return new YL(LE._merge(this._prependTokens,this._tokens,null),e)}}let lS=W8=class extends A{constructor(e,t,i,n,s){super(),this._configurationService=s,this._languageService=e,this._standaloneThemeService=t,this._languageId=i,this._lexer=n,this._embeddedLanguages=Object.create(null),this.embeddedLoaded=Promise.resolve(void 0);let r=!1;this._register(di.onDidChange(a=>{if(r)return;let l=!1;for(let c=0,d=a.changedLanguages.length;c<d;c++){const h=a.changedLanguages[c];if(this._embeddedLanguages[h]){l=!0;break}}l&&(r=!0,di.handleChange([this._languageId]),r=!1)})),this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}),this._register(this._configurationService.onDidChangeConfiguration(a=>{a.affectsConfiguration("editor.maxTokenizationLineLength")&&(this._maxTokenizationLineLength=this._configurationService.getValue("editor.maxTokenizationLineLength",{overrideIdentifier:this._languageId}))}))}getLoadStatus(){const e=[];for(const t in this._embeddedLanguages){const i=di.get(t);if(i){if(i instanceof W8){const n=i.getLoadStatus();n.loaded===!1&&e.push(n.promise)}continue}di.isResolved(t)||e.push(di.getOrCreate(t))}return e.length===0?{loaded:!0}:{loaded:!1,promise:Promise.all(e).then(t=>{})}}getInitialState(){const e=rS.create(null,this._lexer.start);return bu.create(e,null)}tokenize(e,t,i){if(e.length>=this._maxTokenizationLineLength)return VP(this._languageId,i);const n=new tPe,s=this._tokenize(e,t,i,n);return n.finalize(s)}tokenizeEncoded(e,t,i){if(e.length>=this._maxTokenizationLineLength)return wx(this._languageService.languageIdCodec.encodeLanguageId(this._languageId),i);const n=new LE(this._languageService,this._standaloneThemeService.getColorTheme().tokenTheme),s=this._tokenize(e,t,i,n);return n.finalize(s)}_tokenize(e,t,i,n){return i.embeddedLanguageData?this._nestedTokenize(e,t,i,0,n):this._myTokenize(e,t,i,0,n)}_findLeavingNestedLanguageOffset(e,t){let i=this._lexer.tokenizer[t.stack.state];if(!i&&(i=yE(this._lexer,t.stack.state),!i))throw Gt(this._lexer,"tokenizer state is not defined: "+t.stack.state);let n=-1,s=!1;for(const r of i){if(!KJ(r.action)||!(r.action.nextEmbedded==="@pop"||r.action.hasEmbeddedEndInCases))continue;s=!0;let a=r.resolveRegex(t.stack.state);const l=a.source;if(l.substr(0,4)==="^(?:"&&l.substr(l.length-1,1)===")"){const d=(a.ignoreCase?"i":"")+(a.unicode?"u":"");a=new RegExp(l.substr(4,l.length-5),d)}const c=e.search(a);c===-1||c!==0&&r.matchOnlyAtLineStart||(n===-1||c<n)&&(n=c)}if(!s)throw Gt(this._lexer,'no rule containing nextEmbedded: "@pop" in tokenizer embedded state: '+t.stack.state);return n}_nestedTokenize(e,t,i,n,s){const r=this._findLeavingNestedLanguageOffset(e,i);if(r===-1){const c=s.nestedLanguageTokenize(e,t,i.embeddedLanguageData,n);return bu.create(i.stack,new tC(i.embeddedLanguageData.languageId,c))}const a=e.substring(0,r);a.length>0&&s.nestedLanguageTokenize(a,!1,i.embeddedLanguageData,n);const l=e.substring(r);return this._myTokenize(l,t,i,n+r,s)}_safeRuleName(e){return e?e.name:"(unknown)"}_myTokenize(e,t,i,n,s){s.enterLanguage(this._languageId);const r=e.length,a=t&&this._lexer.includeLF?e+`
`:e,l=a.length;let c=i.embeddedLanguageData,d=i.stack,h=0,u=null,f=!0;for(;f||h<l;){const g=h,m=d.depth,_=u?u.groups.length:0,b=d.state;let C=null,w=null,v=null,S=null,L=null;if(u){C=u.matches;const D=u.groups.shift();w=D.matched,v=D.action,S=u.rule,u.groups.length===0&&(u=null)}else{if(!f&&h>=l)break;f=!1;let D=this._lexer.tokenizer[b];if(!D&&(D=yE(this._lexer,b),!D))throw Gt(this._lexer,"tokenizer state is not defined: "+b);const R=a.substr(h);for(const F of D)if((h===0||!F.matchOnlyAtLineStart)&&(C=R.match(F.resolveRegex(b)),C)){w=C[0],v=F.action;break}}if(C||(C=[""],w=""),v||(h<l&&(C=[a.charAt(h)],w=C[0]),v=this._lexer.defaultToken),w===null)break;for(h+=w.length;ZMe(v)&&KJ(v)&&v.test;)v=v.test(w,C,b,h===l);let x=null;if(typeof v=="string"||Array.isArray(v))x=v;else if(v.group)x=v.group;else if(v.token!==null&&v.token!==void 0){if(v.tokenSubst?x=_u(this._lexer,v.token,w,C,b):x=v.token,v.nextEmbedded)if(v.nextEmbedded==="@pop"){if(!c)throw Gt(this._lexer,"cannot pop embedded language if not inside one");c=null}else{if(c)throw Gt(this._lexer,"cannot enter embedded language from within an embedded language");L=_u(this._lexer,v.nextEmbedded,w,C,b)}if(v.goBack&&(h=Math.max(0,h-v.goBack)),v.switchTo&&typeof v.switchTo=="string"){let D=_u(this._lexer,v.switchTo,w,C,b);if(D[0]==="@"&&(D=D.substr(1)),yE(this._lexer,D))d=d.switchTo(D);else throw Gt(this._lexer,"trying to switch to a state '"+D+"' that is undefined in rule: "+this._safeRuleName(S))}else{if(v.transform&&typeof v.transform=="function")throw Gt(this._lexer,"action.transform not supported");if(v.next)if(v.next==="@push"){if(d.depth>=this._lexer.maxStack)throw Gt(this._lexer,"maximum tokenizer stack size reached: ["+d.state+","+d.parent.state+",...]");d=d.push(b)}else if(v.next==="@pop"){if(d.depth<=1)throw Gt(this._lexer,"trying to pop an empty stack in rule: "+this._safeRuleName(S));d=d.pop()}else if(v.next==="@popall")d=d.popall();else{let D=_u(this._lexer,v.next,w,C,b);if(D[0]==="@"&&(D=D.substr(1)),yE(this._lexer,D))d=d.push(D);else throw Gt(this._lexer,"trying to set a next state '"+D+"' that is undefined in rule: "+this._safeRuleName(S))}}v.log&&typeof v.log=="string"&&YMe(this._lexer,this._lexer.languageId+": "+_u(this._lexer,v.log,w,C,b))}if(x===null)throw Gt(this._lexer,"lexer rule has no well-defined action in rule: "+this._safeRuleName(S));const I=D=>{const R=this._languageService.getLanguageIdByLanguageName(D)||this._languageService.getLanguageIdByMimeType(D)||D,F=this._getNestedEmbeddedLanguageData(R);if(h<l){const O=e.substr(h);return this._nestedTokenize(O,t,bu.create(d,F),n+h,s)}else return bu.create(d,F)};if(Array.isArray(x)){if(u&&u.groups.length>0)throw Gt(this._lexer,"groups cannot be nested: "+this._safeRuleName(S));if(C.length!==x.length+1)throw Gt(this._lexer,"matched number of groups does not match the number of actions in rule: "+this._safeRuleName(S));let D=0;for(let R=1;R<C.length;R++)D+=C[R].length;if(D!==w.length)throw Gt(this._lexer,"with groups, all characters should be matched in consecutive groups in rule: "+this._safeRuleName(S));u={rule:S,matches:C,groups:[]};for(let R=0;R<x.length;R++)u.groups[R]={action:x[R],matched:C[R+1]};h-=w.length;continue}else{if(x==="@rematch"&&(h-=w.length,w="",C=null,x="",L!==null))return I(L);if(w.length===0){if(l===0||m!==d.depth||b!==d.state||(u?u.groups.length:0)!==_)continue;throw Gt(this._lexer,"no progress in tokenizer in rule: "+this._safeRuleName(S))}let D=null;if(qJ(x)&&x.indexOf("@brackets")===0){const R=x.substr(9),F=iPe(this._lexer,w);if(!F)throw Gt(this._lexer,"@brackets token returned but no bracket defined as: "+w);D=GJ(F.token+R)}else{const R=x===""?"":x+this._lexer.tokenPostfix;D=GJ(R)}g<r&&s.emit(g+n,D)}if(L!==null)return I(L)}return bu.create(d,c)}_getNestedEmbeddedLanguageData(e){if(!this._languageService.isRegisteredLanguageId(e))return new tC(e,A_);e!==this._languageId&&(this._languageService.requestBasicLanguageFeatures(e),di.getOrCreate(e),this._embeddedLanguages[e]=!0);const t=di.get(e);return t?new tC(e,t.getInitialState()):new tC(e,A_)}};lS=W8=JMe([ePe(4,Me)],lS);function iPe(o,e){if(!e)return null;e=Ad(o,e);const t=o.brackets;for(const i of t){if(i.open===e)return{token:i.token,bracketType:1};if(i.close===e)return{token:i.token,bracketType:-1}}return null}const nPe=Sl("standaloneColorizer",{createHTML:o=>o});class B8{static colorizeElement(e,t,i,n){n=n||{};const s=n.theme||"vs",r=n.mimeType||i.getAttribute("lang")||i.getAttribute("data-lang");if(!r)return console.error("Mode not detected"),Promise.resolve();const a=t.getLanguageIdByMimeType(r)||r;e.setTheme(s);const l=i.firstChild?i.firstChild.nodeValue:"";i.className+=" "+s;const c=d=>{const h=nPe?.createHTML(d)??d;i.innerHTML=h};return this.colorize(t,l||"",a,n).then(c,d=>console.error(d))}static async colorize(e,t,i,n){const s=e.languageIdCodec;let r=4;n&&typeof n.tabSize=="number"&&(r=n.tabSize),yR(t)&&(t=t.substr(1));const a=ro(t);if(!e.isRegisteredLanguageId(i))return YJ(a,r,s);const l=await di.getOrCreate(i);return l?sPe(a,r,l,s):YJ(a,r,s)}static colorizeLine(e,t,i,n,s=4){const r=Vo.isBasicASCII(e,t),a=Vo.containsRTL(e,r,i);return FL(new Vc(!1,!0,e,!1,r,a,0,n,[],s,0,0,0,0,-1,"none",!1,!1,null,null,0)).html}static colorizeModelLine(e,t,i=4){const n=e.getLineContent(t);e.tokenization.forceTokenization(t);const r=e.tokenization.getLineTokens(t).inflate();return this.colorizeLine(n,e.mightContainNonBasicASCII(),e.mightContainRTL(),r,i)}}function sPe(o,e,t,i){return new Promise((n,s)=>{const r=()=>{const a=oPe(o,e,t,i);if(t instanceof lS){const l=t.getLoadStatus();if(l.loaded===!1){l.promise.then(r,s);return}}n(a)};r()})}function YJ(o,e,t){let i=[];const s=new Uint32Array(2);s[0]=0,s[1]=33587200;for(let r=0,a=o.length;r<a;r++){const l=o[r];s[0]=l.length;const c=new bi(s,l,t),d=Vo.isBasicASCII(l,!0),h=Vo.containsRTL(l,d,!0),u=FL(new Vc(!1,!0,l,!1,d,h,0,c,[],e,0,0,0,0,-1,"none",!1,!1,null,null,0));i=i.concat(u.html),i.push("<br/>")}return i.join("")}function oPe(o,e,t,i){let n=[],s=t.getInitialState();for(let r=0,a=o.length;r<a;r++){const l=o[r],c=t.tokenizeEncoded(l,!0,s);bi.convertToEndOffset(c.tokens,l.length);const d=new bi(c.tokens,l,i),h=Vo.isBasicASCII(l,!0),u=Vo.containsRTL(l,h,!0),f=FL(new Vc(!1,!0,l,!1,h,u,0,d.inflate(),[],e,0,0,0,0,-1,"none",!1,!1,null,null,0));n=n.concat(f.html),n.push("<br/>"),s=c.endState}return n.join("")}var rPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aPe=function(o,e){return function(t,i){e(t,i,o)}};let H8=class extends A{constructor(e){super(),this._themeService=e,this._onWillCreateCodeEditor=this._register(new P),this._onCodeEditorAdd=this._register(new P),this.onCodeEditorAdd=this._onCodeEditorAdd.event,this._onCodeEditorRemove=this._register(new P),this.onCodeEditorRemove=this._onCodeEditorRemove.event,this._onWillCreateDiffEditor=this._register(new P),this._onDiffEditorAdd=this._register(new P),this.onDiffEditorAdd=this._onDiffEditorAdd.event,this._onDiffEditorRemove=this._register(new P),this.onDiffEditorRemove=this._onDiffEditorRemove.event,this._decorationOptionProviders=new Map,this._codeEditorOpenHandlers=new Jn,this._modelProperties=new Map,this._codeEditors=Object.create(null),this._diffEditors=Object.create(null),this._globalStyleSheet=null}willCreateCodeEditor(){this._onWillCreateCodeEditor.fire()}addCodeEditor(e){this._codeEditors[e.getId()]=e,this._onCodeEditorAdd.fire(e)}removeCodeEditor(e){delete this._codeEditors[e.getId()]&&this._onCodeEditorRemove.fire(e)}listCodeEditors(){return Object.keys(this._codeEditors).map(e=>this._codeEditors[e])}willCreateDiffEditor(){this._onWillCreateDiffEditor.fire()}addDiffEditor(e){this._diffEditors[e.getId()]=e,this._onDiffEditorAdd.fire(e)}listDiffEditors(){return Object.keys(this._diffEditors).map(e=>this._diffEditors[e])}getFocusedCodeEditor(){let e=null;const t=this.listCodeEditors();for(const i of t){if(i.hasTextFocus())return i;i.hasWidgetFocus()&&(e=i)}return e}removeDecorationType(e){const t=this._decorationOptionProviders.get(e);t&&(t.refCount--,t.refCount<=0&&(this._decorationOptionProviders.delete(e),t.dispose(),this.listCodeEditors().forEach(i=>i.removeDecorationsByType(e))))}setModelProperty(e,t,i){const n=e.toString();let s;this._modelProperties.has(n)?s=this._modelProperties.get(n):(s=new Map,this._modelProperties.set(n,s)),s.set(t,i)}getModelProperty(e,t){const i=e.toString();if(this._modelProperties.has(i))return this._modelProperties.get(i).get(t)}async openCodeEditor(e,t,i){for(const n of this._codeEditorOpenHandlers){const s=await n(e,t,i);if(s!==null)return s}return null}registerCodeEditorOpenHandler(e){const t=this._codeEditorOpenHandlers.unshift(e);return ue(t)}};H8=rPe([aPe(0,li)],H8);var lPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},XJ=function(o,e){return function(t,i){e(t,i,o)}};let xE=class extends H8{constructor(e,t){super(t),this._register(this.onCodeEditorAdd(()=>this._checkContextKey())),this._register(this.onCodeEditorRemove(()=>this._checkContextKey())),this._editorIsOpen=e.createKey("editorIsOpen",!1),this._activeCodeEditor=null,this._register(this.registerCodeEditorOpenHandler(async(i,n,s)=>n?this.doOpenEditor(n,i):null))}_checkContextKey(){let e=!1;for(const t of this.listCodeEditors())if(!t.isSimpleWidget){e=!0;break}this._editorIsOpen.set(e)}setActiveCodeEditor(e){this._activeCodeEditor=e}getActiveCodeEditor(){return this._activeCodeEditor}doOpenEditor(e,t){if(!this.findModel(e,t.resource)){if(t.resource){const s=t.resource.scheme;if(s===we.http||s===we.https)return aH(t.resource.toString()),e}return null}const n=t.options?t.options.selection:null;if(n)if(typeof n.endLineNumber=="number"&&typeof n.endColumn=="number")e.setSelection(n),e.revealRangeInCenter(n,1);else{const s={lineNumber:n.startLineNumber,column:n.startColumn};e.setPosition(s),e.revealPositionInCenter(s,1)}return e}findModel(e,t){const i=e.getModel();return i&&i.uri.toString()!==t.toString()?null:i}};xE=lPe([XJ(0,xe),XJ(1,li)],xE),je(et,xE,0);var QJ=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},JJ=function(o,e){return function(t,i){e(t,i,o)}};let kE=class{get mainContainer(){return this._codeEditorService.listCodeEditors().at(0)?.getContainerDomNode()??bt.document.body}get activeContainer(){return(this._codeEditorService.getFocusedCodeEditor()??this._codeEditorService.getActiveCodeEditor())?.getContainerDomNode()??this.mainContainer}get mainContainerDimension(){return rh(this.mainContainer)}get activeContainerDimension(){return rh(this.activeContainer)}get containers(){return wa(this._codeEditorService.listCodeEditors().map(e=>e.getContainerDomNode()))}getContainer(){return this.activeContainer}whenContainerStylesLoaded(){}focus(){this._codeEditorService.getFocusedCodeEditor()?.focus()}constructor(e){this._codeEditorService=e,this.onDidLayoutMainContainer=ie.None,this.onDidLayoutActiveContainer=ie.None,this.onDidLayoutContainer=ie.None,this.onDidChangeActiveContainer=ie.None,this.onDidAddContainer=ie.None,this.mainContainerOffset={top:0,quickPickTop:0},this.activeContainerOffset={top:0,quickPickTop:0}}};kE=QJ([JJ(0,et)],kE);let V8=class extends kE{get mainContainer(){return this._container}constructor(e,t){super(t),this._container=e}};V8=QJ([JJ(1,et)],V8),je(Hl,kE,1);var cPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},eee=function(o,e){return function(t,i){e(t,i,o)}};function IE(o){return o.scheme===we.file?o.fsPath:o.path}let tee=0;class DE{constructor(e,t,i,n,s,r,a){this.id=++tee,this.type=0,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabel=t,this.strResource=i,this.resourceLabels=[this.resourceLabel],this.strResources=[this.strResource],this.groupId=n,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.isValid=!0}setValid(e){this.isValid=e}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.isValid?" VALID":"INVALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class iee{constructor(e,t){this.resourceLabel=e,this.reason=t}}class nee{constructor(){this.elements=new Map}createMessage(){const e=[],t=[];for(const[,n]of this.elements)(n.reason===0?e:t).push(n.resourceLabel);const i=[];return e.length>0&&i.push(p(2012,"The following files have been closed and modified on disk: {0}.",e.join(", "))),t.length>0&&i.push(p(2013,"The following files have been modified in an incompatible way: {0}.",t.join(", "))),i.join(`
`)}get size(){return this.elements.size}has(e){return this.elements.has(e)}set(e,t){this.elements.set(e,t)}delete(e){return this.elements.delete(e)}}class dPe{constructor(e,t,i,n,s,r,a){this.id=++tee,this.type=1,this.actual=e,this.label=e.label,this.confirmBeforeUndo=e.confirmBeforeUndo||!1,this.resourceLabels=t,this.strResources=i,this.groupId=n,this.groupOrder=s,this.sourceId=r,this.sourceOrder=a,this.removedResources=null,this.invalidatedResources=null}canSplit(){return typeof this.actual.split=="function"}removeResource(e,t,i){this.removedResources||(this.removedResources=new nee),this.removedResources.has(t)||this.removedResources.set(t,new iee(e,i))}setValid(e,t,i){i?this.invalidatedResources&&(this.invalidatedResources.delete(t),this.invalidatedResources.size===0&&(this.invalidatedResources=null)):(this.invalidatedResources||(this.invalidatedResources=new nee),this.invalidatedResources.has(t)||this.invalidatedResources.set(t,new iee(e,0)))}toString(){return`[id:${this.id}] [group:${this.groupId}] [${this.invalidatedResources?"INVALID":" VALID"}] ${this.actual.constructor.name} - ${this.actual}`}}class see{constructor(e,t){this.resourceLabel=e,this.strResource=t,this._past=[],this._future=[],this.locked=!1,this.versionId=1}dispose(){for(const e of this._past)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);for(const e of this._future)e.type===1&&e.removeResource(this.resourceLabel,this.strResource,0);this.versionId++}toString(){const e=[];e.push(`* ${this.strResource}:`);for(let t=0;t<this._past.length;t++)e.push(` * [UNDO] ${this._past[t]}`);for(let t=this._future.length-1;t>=0;t--)e.push(` * [REDO] ${this._future[t]}`);return e.join(`
`)}flushAllElements(){this._past=[],this._future=[],this.versionId++}_setElementValidFlag(e,t){e.type===1?e.setValid(this.resourceLabel,this.strResource,t):e.setValid(t)}setElementsValidFlag(e,t){for(const i of this._past)t(i.actual)&&this._setElementValidFlag(i,e);for(const i of this._future)t(i.actual)&&this._setElementValidFlag(i,e)}pushElement(e){for(const t of this._future)t.type===1&&t.removeResource(this.resourceLabel,this.strResource,1);this._future=[],this._past.push(e),this.versionId++}createSnapshot(e){const t=[];for(let i=0,n=this._past.length;i<n;i++)t.push(this._past[i].id);for(let i=this._future.length-1;i>=0;i--)t.push(this._future[i].id);return new S$(e,t)}restoreSnapshot(e){const t=e.elements.length;let i=!0,n=0,s=-1;for(let a=0,l=this._past.length;a<l;a++,n++){const c=this._past[a];i&&(n>=t||c.id!==e.elements[n])&&(i=!1,s=0),!i&&c.type===1&&c.removeResource(this.resourceLabel,this.strResource,0)}let r=-1;for(let a=this._future.length-1;a>=0;a--,n++){const l=this._future[a];i&&(n>=t||l.id!==e.elements[n])&&(i=!1,r=a),!i&&l.type===1&&l.removeResource(this.resourceLabel,this.strResource,0)}s!==-1&&(this._past=this._past.slice(0,s)),r!==-1&&(this._future=this._future.slice(r+1)),this.versionId++}getElements(){const e=[],t=[];for(const i of this._past)e.push(i.actual);for(const i of this._future)t.push(i.actual);return{past:e,future:t}}getClosestPastElement(){return this._past.length===0?null:this._past[this._past.length-1]}getSecondClosestPastElement(){return this._past.length<2?null:this._past[this._past.length-2]}getClosestFutureElement(){return this._future.length===0?null:this._future[this._future.length-1]}hasPastElements(){return this._past.length>0}hasFutureElements(){return this._future.length>0}splitPastWorkspaceElement(e,t){for(let i=this._past.length-1;i>=0;i--)if(this._past[i]===e){t.has(this.strResource)?this._past[i]=t.get(this.strResource):this._past.splice(i,1);break}this.versionId++}splitFutureWorkspaceElement(e,t){for(let i=this._future.length-1;i>=0;i--)if(this._future[i]===e){t.has(this.strResource)?this._future[i]=t.get(this.strResource):this._future.splice(i,1);break}this.versionId++}moveBackward(e){this._past.pop(),this._future.push(e),this.versionId++}moveForward(e){this._future.pop(),this._past.push(e),this.versionId++}}class z8{constructor(e){this.editStacks=e,this._versionIds=[];for(let t=0,i=this.editStacks.length;t<i;t++)this._versionIds[t]=this.editStacks[t].versionId}isValid(){for(let e=0,t=this.editStacks.length;e<t;e++)if(this._versionIds[e]!==this.editStacks[e].versionId)return!1;return!0}}const oee=new see("","");oee.locked=!0;let U8=class{constructor(e,t){this._dialogService=e,this._notificationService=t,this._editStacks=new Map,this._uriComparisonKeyComputers=[]}getUriComparisonKey(e){for(const t of this._uriComparisonKeyComputers)if(t[0]===e.scheme)return t[1].getComparisonKey(e);return e.toString()}_print(e){console.log("------------------------------------"),console.log(`AFTER ${e}: `);const t=[];for(const i of this._editStacks)t.push(i[1].toString());console.log(t.join(`
`))}pushElement(e,t=YP.None,i=Xf.None){if(e.type===0){const n=IE(e.resource),s=this.getUriComparisonKey(e.resource);this._pushElement(new DE(e,n,s,t.id,t.nextOrder(),i.id,i.nextOrder()))}else{const n=new Set,s=[],r=[];for(const a of e.resources){const l=IE(a),c=this.getUriComparisonKey(a);n.has(c)||(n.add(c),s.push(l),r.push(c))}s.length===1?this._pushElement(new DE(e,s[0],r[0],t.id,t.nextOrder(),i.id,i.nextOrder())):this._pushElement(new dPe(e,s,r,t.id,t.nextOrder(),i.id,i.nextOrder()))}}_pushElement(e){for(let t=0,i=e.strResources.length;t<i;t++){const n=e.resourceLabels[t],s=e.strResources[t];let r;this._editStacks.has(s)?r=this._editStacks.get(s):(r=new see(n,s),this._editStacks.set(s,r)),r.pushElement(e)}}getLastElement(e){const t=this.getUriComparisonKey(e);if(this._editStacks.has(t)){const i=this._editStacks.get(t);if(i.hasFutureElements())return null;const n=i.getClosestPastElement();return n?n.actual:null}return null}_splitPastWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const s of i){const r=IE(s.resource),a=this.getUriComparisonKey(s.resource),l=new DE(s,r,a,0,0,0,0);n.set(l.strResource,l)}for(const s of e.strResources){if(t&&t.has(s))continue;this._editStacks.get(s).splitPastWorkspaceElement(e,n)}}_splitFutureWorkspaceElement(e,t){const i=e.actual.split(),n=new Map;for(const s of i){const r=IE(s.resource),a=this.getUriComparisonKey(s.resource),l=new DE(s,r,a,0,0,0,0);n.set(l.strResource,l)}for(const s of e.strResources){if(t&&t.has(s))continue;this._editStacks.get(s).splitFutureWorkspaceElement(e,n)}}removeElements(e){const t=typeof e=="string"?e:this.getUriComparisonKey(e);this._editStacks.has(t)&&(this._editStacks.get(t).dispose(),this._editStacks.delete(t))}setElementsValidFlag(e,t,i){const n=this.getUriComparisonKey(e);this._editStacks.has(n)&&this._editStacks.get(n).setElementsValidFlag(t,i)}createSnapshot(e){const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).createSnapshot(e):new S$(e,[])}restoreSnapshot(e){const t=this.getUriComparisonKey(e.resource);if(this._editStacks.has(t)){const i=this._editStacks.get(t);i.restoreSnapshot(e),!i.hasPastElements()&&!i.hasFutureElements()&&(i.dispose(),this._editStacks.delete(t))}}getElements(e){const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).getElements():{past:[],future:[]}}_findClosestUndoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestPastElement();r&&r.sourceId===e&&(!t||r.sourceOrder>t.sourceOrder)&&(t=r,i=n)}return[t,i]}canUndo(e){if(e instanceof Xf){const[,i]=this._findClosestUndoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasPastElements():!1}_onError(e,t){Ee(e);for(const i of t.strResources)this.removeElements(i);this._notificationService.error(e)}_acquireLocks(e){for(const t of e.editStacks)if(t.locked)throw new Error("Cannot acquire edit stack lock");for(const t of e.editStacks)t.locked=!0;return()=>{for(const t of e.editStacks)t.locked=!1}}_safeInvokeWithLocks(e,t,i,n,s){const r=this._acquireLocks(i);let a;try{a=t()}catch(l){return r(),n.dispose(),this._onError(l,e)}return a?a.then(()=>(r(),n.dispose(),s()),l=>(r(),n.dispose(),this._onError(l,e))):(r(),n.dispose(),s())}async _invokeWorkspacePrepare(e){if(typeof e.actual.prepareUndoRedo>"u")return A.None;const t=e.actual.prepareUndoRedo();return typeof t>"u"?A.None:t}_invokeResourcePrepare(e,t){if(e.actual.type!==1||typeof e.actual.prepareUndoRedo>"u")return t(A.None);const i=e.actual.prepareUndoRedo();return i?Xu(i)?t(i):i.then(n=>t(n)):t(A.None)}_getAffectedEditStacks(e){const t=[];for(const i of e.strResources)t.push(this._editStacks.get(i)||oee);return new z8(t)}_tryToSplitAndUndo(e,t,i,n){if(t.canSplit())return this._splitPastWorkspaceElement(t,i),this._notificationService.warn(n),new EE(this._undo(e,0,!0));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(n),new EE}_checkWorkspaceUndo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndUndo(e,t,t.removedResources,p(2014,"Could not undo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndUndo(e,t,t.invalidatedResources,p(2015,"Could not undo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestPastElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndUndo(e,t,null,p(2016,"Could not undo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const r=[];for(const a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndUndo(e,t,null,p(2017,"Could not undo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndUndo(e,t,null,p(2018,"Could not undo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceUndo(e,t,i){const n=this._getAffectedEditStacks(t),s=this._checkWorkspaceUndo(e,t,n,!1);return s?s.returnValue:this._confirmAndExecuteWorkspaceUndo(e,t,n,i)}_isPartOfUndoGroup(e){if(!e.groupId)return!1;for(const[,t]of this._editStacks){const i=t.getClosestPastElement();if(i){if(i===e){const n=t.getSecondClosestPastElement();if(n&&n.groupId===e.groupId)return!0}if(i.groupId===e.groupId)return!0}}return!1}async _confirmAndExecuteWorkspaceUndo(e,t,i,n){if(t.canSplit()&&!this._isPartOfUndoGroup(t)){let a;(function(d){d[d.All=0]="All",d[d.This=1]="This",d[d.Cancel=2]="Cancel"})(a||(a={}));const{result:l}=await this._dialogService.prompt({type:ii.Info,message:p(2019,"Would you like to undo '{0}' across all files?",t.label),buttons:[{label:p(2020,"&&Undo in {0} Files",i.editStacks.length),run:()=>a.All},{label:p(2021,"Undo this &&File"),run:()=>a.This}],cancelButton:{run:()=>a.Cancel}});if(l===a.Cancel)return;if(l===a.This)return this._splitPastWorkspaceElement(t,null),this._undo(e,0,!0);const c=this._checkWorkspaceUndo(e,t,i,!1);if(c)return c.returnValue;n=!0}let s;try{s=await this._invokeWorkspacePrepare(t)}catch(a){return this._onError(a,t)}const r=this._checkWorkspaceUndo(e,t,i,!0);if(r)return s.dispose(),r.returnValue;for(const a of i.editStacks)a.moveBackward(t);return this._safeInvokeWithLocks(t,()=>t.actual.undo(),i,s,()=>this._continueUndoInGroup(t.groupId,n))}_resourceUndo(e,t,i){if(!t.isValid){e.flushAllElements();return}if(e.locked){const n=p(2022,"Could not undo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(n);return}return this._invokeResourcePrepare(t,n=>(e.moveBackward(t),this._safeInvokeWithLocks(t,()=>t.actual.undo(),new z8([e]),n,()=>this._continueUndoInGroup(t.groupId,i))))}_findClosestUndoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestPastElement();r&&r.groupId===e&&(!t||r.groupOrder>t.groupOrder)&&(t=r,i=n)}return[t,i]}_continueUndoInGroup(e,t){if(!e)return;const[,i]=this._findClosestUndoElementInGroup(e);if(i)return this._undo(i,0,t)}undo(e){if(e instanceof Xf){const[,t]=this._findClosestUndoElementWithSource(e.id);return t?this._undo(t,e.id,!1):void 0}return typeof e=="string"?this._undo(e,0,!1):this._undo(this.getUriComparisonKey(e),0,!1)}_undo(e,t=0,i){if(!this._editStacks.has(e))return;const n=this._editStacks.get(e),s=n.getClosestPastElement();if(!s)return;if(s.groupId){const[a,l]=this._findClosestUndoElementInGroup(s.groupId);if(s!==a&&l)return this._undo(l,t,i)}if((s.sourceId!==t||s.confirmBeforeUndo)&&!i)return this._confirmAndContinueUndo(e,t,s);try{return s.type===1?this._workspaceUndo(e,s,i):this._resourceUndo(n,s,i)}finally{}}async _confirmAndContinueUndo(e,t,i){if((await this._dialogService.confirm({message:p(2023,"Would you like to undo '{0}'?",i.label),primaryButton:p(2024,"&&Yes"),cancelButton:p(2025,"No")})).confirmed)return this._undo(e,t,!0)}_findClosestRedoElementWithSource(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestFutureElement();r&&r.sourceId===e&&(!t||r.sourceOrder<t.sourceOrder)&&(t=r,i=n)}return[t,i]}canRedo(e){if(e instanceof Xf){const[,i]=this._findClosestRedoElementWithSource(e.id);return!!i}const t=this.getUriComparisonKey(e);return this._editStacks.has(t)?this._editStacks.get(t).hasFutureElements():!1}_tryToSplitAndRedo(e,t,i,n){if(t.canSplit())return this._splitFutureWorkspaceElement(t,i),this._notificationService.warn(n),new EE(this._redo(e));for(const s of t.strResources)this.removeElements(s);return this._notificationService.warn(n),new EE}_checkWorkspaceRedo(e,t,i,n){if(t.removedResources)return this._tryToSplitAndRedo(e,t,t.removedResources,p(2026,"Could not redo '{0}' across all files. {1}",t.label,t.removedResources.createMessage()));if(n&&t.invalidatedResources)return this._tryToSplitAndRedo(e,t,t.invalidatedResources,p(2027,"Could not redo '{0}' across all files. {1}",t.label,t.invalidatedResources.createMessage()));const s=[];for(const a of i.editStacks)a.getClosestFutureElement()!==t&&s.push(a.resourceLabel);if(s.length>0)return this._tryToSplitAndRedo(e,t,null,p(2028,"Could not redo '{0}' across all files because changes were made to {1}",t.label,s.join(", ")));const r=[];for(const a of i.editStacks)a.locked&&r.push(a.resourceLabel);return r.length>0?this._tryToSplitAndRedo(e,t,null,p(2029,"Could not redo '{0}' across all files because there is already an undo or redo operation running on {1}",t.label,r.join(", "))):i.isValid()?null:this._tryToSplitAndRedo(e,t,null,p(2030,"Could not redo '{0}' across all files because an undo or redo operation occurred in the meantime",t.label))}_workspaceRedo(e,t){const i=this._getAffectedEditStacks(t),n=this._checkWorkspaceRedo(e,t,i,!1);return n?n.returnValue:this._executeWorkspaceRedo(e,t,i)}async _executeWorkspaceRedo(e,t,i){let n;try{n=await this._invokeWorkspacePrepare(t)}catch(r){return this._onError(r,t)}const s=this._checkWorkspaceRedo(e,t,i,!0);if(s)return n.dispose(),s.returnValue;for(const r of i.editStacks)r.moveForward(t);return this._safeInvokeWithLocks(t,()=>t.actual.redo(),i,n,()=>this._continueRedoInGroup(t.groupId))}_resourceRedo(e,t){if(!t.isValid){e.flushAllElements();return}if(e.locked){const i=p(2031,"Could not redo '{0}' because there is already an undo or redo operation running.",t.label);this._notificationService.warn(i);return}return this._invokeResourcePrepare(t,i=>(e.moveForward(t),this._safeInvokeWithLocks(t,()=>t.actual.redo(),new z8([e]),i,()=>this._continueRedoInGroup(t.groupId))))}_findClosestRedoElementInGroup(e){if(!e)return[null,null];let t=null,i=null;for(const[n,s]of this._editStacks){const r=s.getClosestFutureElement();r&&r.groupId===e&&(!t||r.groupOrder<t.groupOrder)&&(t=r,i=n)}return[t,i]}_continueRedoInGroup(e){if(!e)return;const[,t]=this._findClosestRedoElementInGroup(e);if(t)return this._redo(t)}redo(e){if(e instanceof Xf){const[,t]=this._findClosestRedoElementWithSource(e.id);return t?this._redo(t):void 0}return typeof e=="string"?this._redo(e):this._redo(this.getUriComparisonKey(e))}_redo(e){if(!this._editStacks.has(e))return;const t=this._editStacks.get(e),i=t.getClosestFutureElement();if(i){if(i.groupId){const[n,s]=this._findClosestRedoElementInGroup(i.groupId);if(i!==n&&s)return this._redo(s)}try{return i.type===1?this._workspaceRedo(e,i):this._resourceRedo(t,i)}finally{}}}};U8=cPe([eee(0,Y0),eee(1,hi)],U8);class EE{constructor(e){this.returnValue=e}}je(ZP,U8,1);var hPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},$8=function(o,e){return function(t,i){e(t,i,o)}};let j8=class extends A{constructor(e,t,i){super(),this._themeService=e,this._logService=t,this._languageService=i,this._caches=new WeakMap,this._register(this._themeService.onDidColorThemeChange(()=>{this._caches=new WeakMap}))}getStyling(e){return this._caches.has(e)||this._caches.set(e,new M7(e.getLegend(),this._themeService,this._languageService,this._logService)),this._caches.get(e)}};j8=hPe([$8(0,li),$8(1,Rt),$8(2,Mt)],j8),je(QD,j8,1);function ree(o){return typeof o=="string"?!1:Array.isArray(o)?o.every(ree):!!o.exclusive}class aee{constructor(e,t,i,n,s){this.uri=e,this.languageId=t,this.notebookUri=i,this.notebookType=n,this.recursive=s}equals(e){return this.notebookType===e.notebookType&&this.languageId===e.languageId&&this.uri.toString()===e.uri.toString()&&this.notebookUri?.toString()===e.notebookUri?.toString()&&this.recursive===e.recursive}}class ri{get onDidChange(){return this._onDidChange.event}constructor(e){this._notebookInfoResolver=e,this._clock=0,this._entries=[],this._onDidChange=new P}register(e,t){let i={selector:e,provider:t,_score:-1,_time:this._clock++};return this._entries.push(i),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),ue(()=>{if(i){const n=this._entries.indexOf(i);n>=0&&(this._entries.splice(n,1),this._lastCandidate=void 0,this._onDidChange.fire(this._entries.length),i=void 0)}})}has(e){return this.all(e).length>0}all(e){if(!e)return[];this._updateScores(e,!1);const t=[];for(const i of this._entries)i._score>0&&t.push(i.provider);return t}ordered(e,t=!1){const i=[];return this._orderedForEach(e,t,n=>i.push(n.provider)),i}orderedGroups(e){const t=[];let i,n;return this._orderedForEach(e,!1,s=>{i&&n===s._score?i.push(s.provider):(n=s._score,i=[s.provider],t.push(i))}),t}_orderedForEach(e,t,i){this._updateScores(e,t);for(const n of this._entries)n._score>0&&i(n)}_updateScores(e,t){const i=this._notebookInfoResolver?.(e.uri),n=i?new aee(e.uri,e.getLanguageId(),i.uri,i.type,t):new aee(e.uri,e.getLanguageId(),void 0,void 0,t);if(!this._lastCandidate?.equals(n)){this._lastCandidate=n;for(const s of this._entries)if(s._score=t9(s.selector,n.uri,n.languageId,KH(e),n.notebookUri,n.notebookType),ree(s.selector)&&s._score>0)if(t)s._score=0;else{for(const r of this._entries)r._score=0;s._score=1e3;break}this._entries.sort(ri._compareByScoreAndTime)}}static _compareByScoreAndTime(e,t){return e._score<t._score?1:e._score>t._score?-1:cS(e.selector)&&!cS(t.selector)?1:!cS(e.selector)&&cS(t.selector)?-1:e._time<t._time?1:e._time>t._time?-1:0}}function cS(o){return typeof o=="string"?!1:Array.isArray(o)?o.some(cS):!!o.isBuiltin}class uPe{constructor(){this.referenceProvider=new ri(this._score.bind(this)),this.renameProvider=new ri(this._score.bind(this)),this.newSymbolNamesProvider=new ri(this._score.bind(this)),this.codeActionProvider=new ri(this._score.bind(this)),this.definitionProvider=new ri(this._score.bind(this)),this.typeDefinitionProvider=new ri(this._score.bind(this)),this.declarationProvider=new ri(this._score.bind(this)),this.implementationProvider=new ri(this._score.bind(this)),this.documentSymbolProvider=new ri(this._score.bind(this)),this.inlayHintsProvider=new ri(this._score.bind(this)),this.colorProvider=new ri(this._score.bind(this)),this.codeLensProvider=new ri(this._score.bind(this)),this.documentFormattingEditProvider=new ri(this._score.bind(this)),this.documentRangeFormattingEditProvider=new ri(this._score.bind(this)),this.onTypeFormattingEditProvider=new ri(this._score.bind(this)),this.signatureHelpProvider=new ri(this._score.bind(this)),this.hoverProvider=new ri(this._score.bind(this)),this.documentHighlightProvider=new ri(this._score.bind(this)),this.multiDocumentHighlightProvider=new ri(this._score.bind(this)),this.selectionRangeProvider=new ri(this._score.bind(this)),this.foldingRangeProvider=new ri(this._score.bind(this)),this.linkProvider=new ri(this._score.bind(this)),this.inlineCompletionsProvider=new ri(this._score.bind(this)),this.completionProvider=new ri(this._score.bind(this)),this.linkedEditingRangeProvider=new ri(this._score.bind(this)),this.documentRangeSemanticTokensProvider=new ri(this._score.bind(this)),this.documentSemanticTokensProvider=new ri(this._score.bind(this)),this.documentDropEditProvider=new ri(this._score.bind(this)),this.documentPasteEditProvider=new ri(this._score.bind(this))}_score(e){return this._notebookTypeResolver?.(e)}}je(he,uPe,1);var fPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},dS=function(o,e){return function(t,i){e(t,i,o)}};const ic=Q;let q8=class extends go{get _targetWindow(){return me(this._target.targetElements[0])}get _targetDocumentElement(){return me(this._target.targetElements[0]).document.documentElement}get isDisposed(){return this._isDisposed}get isMouseIn(){return this._lockMouseTracker.isMouseIn}get domNode(){return this._hover.containerDomNode}get onDispose(){return this._onDispose.event}get onRequestLayout(){return this._onRequestLayout.event}get anchor(){return this._hoverPosition===2?0:1}get x(){return this._x}get y(){return this._y}get isLocked(){return this._isLocked}set isLocked(e){this._isLocked!==e&&(this._isLocked=e,this._hoverContainer.classList.toggle("locked",this._isLocked))}constructor(e,t,i,n,s,r){super(),this._keybindingService=t,this._configurationService=i,this._openerService=n,this._instantiationService=s,this._accessibilityService=r,this._messageListeners=new U,this._isDisposed=!1,this._forcePosition=!1,this._x=0,this._y=0,this._isLocked=!1,this._enableFocusTraps=!1,this._addedFocusTrap=!1,this._maxHeightRatioRelativeToWindow=.5,this._onDispose=this._register(new P),this._onRequestLayout=this._register(new P),this._linkHandler=e.linkHandler||(f=>YO(this._openerService,f,Rl(e.content)?e.content.isTrusted:void 0)),this._target="targetElements"in e.target?e.target:new gPe(e.target),this._hoverPointer=e.appearance?.showPointer?ic("div.workbench-hover-pointer"):void 0,this._hover=this._register(new H4(!e.appearance?.skipFadeInAnimation)),this._hover.containerDomNode.classList.add("workbench-hover"),e.appearance?.compact&&this._hover.containerDomNode.classList.add("workbench-hover","compact"),e.additionalClasses&&this._hover.containerDomNode.classList.add(...e.additionalClasses),e.position?.forcePosition&&(this._forcePosition=!0),e.trapFocus&&(this._enableFocusTraps=!0);const a=e.appearance?.maxHeightRatio;a!==void 0&&a>0&&a<=1&&(this._maxHeightRatioRelativeToWindow=a),this._hoverPosition=e.position?.hoverPosition===void 0?3:bc(e.position.hoverPosition)?e.position.hoverPosition:2,this.onmousedown(this._hover.containerDomNode,f=>f.stopPropagation()),this.onkeydown(this._hover.containerDomNode,f=>{f.equals(9)&&this.dispose()}),this._register(W(this._targetWindow,"blur",()=>this.dispose()));const l=ic("div.hover-row.markdown-hover"),c=ic("div.hover-contents");if(typeof e.content=="string")c.textContent=e.content,c.style.whiteSpace="pre-wrap";else if(ai(e.content))c.appendChild(e.content),c.classList.add("html-hover-contents");else{const f=e.content,g=this._instantiationService.createInstance(fd,{codeBlockFontFamily:this._configurationService.getValue("editor").fontFamily||bs.fontFamily}),{element:m,dispose:_}=g.render(f,{actionHandler:b=>this._linkHandler(b),asyncRenderCallback:()=>{c.classList.add("code-hover-contents"),this.layout(),this._onRequestLayout.fire()}});c.appendChild(m),this._register(ue(_))}if(l.appendChild(c),this._hover.contentsDomNode.appendChild(l),e.actions&&e.actions.length>0){const f=ic("div.hover-row.status-bar"),g=ic("div.actions");e.actions.forEach(m=>{const _=this._keybindingService.lookupKeybinding(m.commandId),b=_?_.getLabel():null;this._register(qk.render(g,{label:m.label,commandId:m.commandId,run:C=>{m.run(C),this.dispose()},iconClass:m.iconClass},b))}),f.appendChild(g),this._hover.containerDomNode.appendChild(f)}this._hoverContainer=ic("div.workbench-hover-container"),this._hoverPointer&&this._hoverContainer.appendChild(this._hoverPointer),this._hoverContainer.appendChild(this._hover.containerDomNode);let d;if(e.actions&&e.actions.length>0?d=!1:e.persistence?.hideOnHover===void 0?d=typeof e.content=="string"||Rl(e.content)&&!e.content.value.includes("](")&&!e.content.value.includes("</a>"):d=e.persistence.hideOnHover,e.appearance?.showHoverHint){const f=ic("div.hover-row.status-bar"),g=ic("div.info");g.textContent=p(74,"Hold {0} key to mouse over",ze?"Option":"Alt"),f.appendChild(g),this._hover.containerDomNode.appendChild(f)}const h=[...this._target.targetElements];d||h.push(this._hoverContainer);const u=this._register(new lee(h));if(this._register(u.onMouseOut(()=>{this._isLocked||this.dispose()})),d){const f=[...this._target.targetElements,this._hoverContainer];this._lockMouseTracker=this._register(new lee(f)),this._register(this._lockMouseTracker.onMouseOut(()=>{this._isLocked||this.dispose()}))}else this._lockMouseTracker=u}addFocusTrap(){if(!this._enableFocusTraps||this._addedFocusTrap)return;this._addedFocusTrap=!0;const e=this._hover.containerDomNode,t=this.findLastFocusableChild(this._hover.containerDomNode);if(t){const i=Dy(this._hoverContainer,ic("div")),n=Z(this._hoverContainer,ic("div"));i.tabIndex=0,n.tabIndex=0,this._register(W(n,"focus",s=>{e.focus(),s.preventDefault()})),this._register(W(i,"focus",s=>{t.focus(),s.preventDefault()}))}}findLastFocusableChild(e){if(e.hasChildNodes())for(let t=0;t<e.childNodes.length;t++){const i=e.childNodes.item(e.childNodes.length-t-1);if(i.nodeType===i.ELEMENT_NODE){const s=i;if(typeof s.tabIndex=="number"&&s.tabIndex>=0)return s}const n=this.findLastFocusableChild(i);if(n)return n}}render(e){e.appendChild(this._hoverContainer);const i=this._hoverContainer.contains(this._hoverContainer.ownerDocument.activeElement)&&NG(this._configurationService.getValue("accessibility.verbosity.hover")===!0&&this._accessibilityService.isScreenReaderOptimized(),this._keybindingService.lookupKeybinding("editor.action.accessibleView")?.getAriaLabel());i&&cl(i),this.layout(),this.addFocusTrap()}layout(){this._hover.containerDomNode.classList.remove("right-aligned"),this._hover.contentsDomNode.style.maxHeight="";const e=d=>{const h=eH(d),u=d.getBoundingClientRect();return{top:u.top*h,bottom:u.bottom*h,right:u.right*h,left:u.left*h}},t=this._target.targetElements.map(d=>e(d)),{top:i,right:n,bottom:s,left:r}=t[0],a=n-r,l=s-i,c={top:i,right:n,bottom:s,left:r,width:a,height:l,center:{x:r+a/2,y:i+l/2}};if(this.adjustHorizontalHoverPosition(c),this.adjustVerticalHoverPosition(c),this.adjustHoverMaxHeight(c),this._hoverContainer.style.padding="",this._hoverContainer.style.margin="",this._hoverPointer){switch(this._hoverPosition){case 1:c.left+=3,c.right+=3,this._hoverContainer.style.paddingLeft="3px",this._hoverContainer.style.marginLeft="-3px";break;case 0:c.left-=3,c.right-=3,this._hoverContainer.style.paddingRight="3px",this._hoverContainer.style.marginRight="-3px";break;case 2:c.top+=3,c.bottom+=3,this._hoverContainer.style.paddingTop="3px",this._hoverContainer.style.marginTop="-3px";break;case 3:c.top-=3,c.bottom-=3,this._hoverContainer.style.paddingBottom="3px",this._hoverContainer.style.marginBottom="-3px";break}c.center.x=c.left+a/2,c.center.y=c.top+l/2}this.computeXCordinate(c),this.computeYCordinate(c),this._hoverPointer&&(this._hoverPointer.classList.remove("top"),this._hoverPointer.classList.remove("left"),this._hoverPointer.classList.remove("right"),this._hoverPointer.classList.remove("bottom"),this.setHoverPointerPosition(c)),this._hover.onContentsChanged()}computeXCordinate(e){const t=this._hover.containerDomNode.clientWidth+2;this._target.x!==void 0?this._x=this._target.x:this._hoverPosition===1?this._x=e.right:this._hoverPosition===0?this._x=e.left-t:(this._hoverPointer?this._x=e.center.x-this._hover.containerDomNode.clientWidth/2:this._x=e.left,this._x+t>=this._targetDocumentElement.clientWidth&&(this._hover.containerDomNode.classList.add("right-aligned"),this._x=Math.max(this._targetDocumentElement.clientWidth-t-2,this._targetDocumentElement.clientLeft))),this._x<this._targetDocumentElement.clientLeft&&(this._x=e.left+2)}computeYCordinate(e){this._target.y!==void 0?this._y=this._target.y:this._hoverPosition===3?this._y=e.top:this._hoverPosition===2?this._y=e.bottom-2:this._hoverPointer?this._y=e.center.y+this._hover.containerDomNode.clientHeight/2:this._y=e.bottom,this._y>this._targetWindow.innerHeight&&(this._y=e.bottom)}adjustHorizontalHoverPosition(e){if(this._target.x!==void 0)return;const t=this._hoverPointer?3:0;if(this._forcePosition){const i=t+2;this._hoverPosition===1?this._hover.containerDomNode.style.maxWidth=`${this._targetDocumentElement.clientWidth-e.right-i}px`:this._hoverPosition===0&&(this._hover.containerDomNode.style.maxWidth=`${e.left-i}px`);return}this._hoverPosition===1?this._targetDocumentElement.clientWidth-e.right<this._hover.containerDomNode.clientWidth+t&&(e.left>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=0:this._hoverPosition=2):this._hoverPosition===0&&(e.left<this._hover.containerDomNode.clientWidth+t&&(this._targetDocumentElement.clientWidth-e.right>=this._hover.containerDomNode.clientWidth+t?this._hoverPosition=1:this._hoverPosition=2),e.left-this._hover.containerDomNode.clientWidth-t<=this._targetDocumentElement.clientLeft&&(this._hoverPosition=1))}adjustVerticalHoverPosition(e){if(this._target.y!==void 0||this._forcePosition)return;const t=this._hoverPointer?3:0;this._hoverPosition===3?e.top-this._hover.containerDomNode.clientHeight-t<0&&(this._hoverPosition=2):this._hoverPosition===2&&e.bottom+this._hover.containerDomNode.clientHeight+t>this._targetWindow.innerHeight&&(this._hoverPosition=3)}adjustHoverMaxHeight(e){let t=this._targetWindow.innerHeight*this._maxHeightRatioRelativeToWindow;if(this._forcePosition){const i=(this._hoverPointer?3:0)+2;this._hoverPosition===3?t=Math.min(t,e.top-i):this._hoverPosition===2&&(t=Math.min(t,this._targetWindow.innerHeight-e.bottom-i))}if(this._hover.containerDomNode.style.maxHeight=`${t}px`,this._hover.contentsDomNode.clientHeight<this._hover.contentsDomNode.scrollHeight){const i=`${this._hover.scrollbar.options.verticalScrollbarSize}px`;this._hover.contentsDomNode.style.paddingRight!==i&&(this._hover.contentsDomNode.style.paddingRight=i)}}setHoverPointerPosition(e){if(this._hoverPointer)switch(this._hoverPosition){case 0:case 1:{this._hoverPointer.classList.add(this._hoverPosition===0?"right":"left");const t=this._hover.containerDomNode.clientHeight;t>e.height?this._hoverPointer.style.top=`${e.center.y-(this._y-t)-3}px`:this._hoverPointer.style.top=`${Math.round(t/2)-3}px`;break}case 3:case 2:{this._hoverPointer.classList.add(this._hoverPosition===3?"bottom":"top");const t=this._hover.containerDomNode.clientWidth;let i=Math.round(t/2)-3;const n=this._x+i;(n<e.left||n>e.right)&&(i=e.center.x-this._x-3),this._hoverPointer.style.left=`${i}px`;break}}}focus(){this._hover.containerDomNode.focus()}dispose(){this._isDisposed||(this._onDispose.fire(),this._target.dispose?.(),this._hoverContainer.remove(),this._messageListeners.dispose(),super.dispose()),this._isDisposed=!0}};q8=fPe([dS(1,ot),dS(2,Me),dS(3,Js),dS(4,ge),dS(5,bn)],q8);class lee extends go{get onMouseOut(){return this._onMouseOut.event}get isMouseIn(){return this._isMouseIn}constructor(e,t=200){super(),this._elements=e,this._eventDebounceDelay=t,this._isMouseIn=!0,this._mouseTimer=this._register(new ct),this._onMouseOut=this._register(new P);for(const i of this._elements)this.onmouseover(i,()=>this._onTargetMouseOver()),this.onmouseleave(i,()=>this._onTargetMouseLeave())}_onTargetMouseOver(){this._isMouseIn=!0,this._mouseTimer.clear()}_onTargetMouseLeave(){this._isMouseIn=!1,this._mouseTimer.value=new No(()=>this._fireIfMouseOutside(),this._eventDebounceDelay)}_fireIfMouseOutside(){this._isMouseIn||this._onMouseOut.fire()}}class gPe{constructor(e){this._element=e,this.targetElements=[this._element]}dispose(){}}function pPe(o){const e=o;return!!e&&typeof e.x=="number"&&typeof e.y=="number"}var Cu;(function(o){o[o.AVOID=0]="AVOID",o[o.ALIGN=1]="ALIGN"})(Cu||(Cu={}));function iC(o,e,t){const i=t.mode===Cu.ALIGN?t.offset:t.offset+t.size,n=t.mode===Cu.ALIGN?t.offset+t.size:t.offset;return t.position===0?e<=o-i?i:e<=n?n-e:Math.max(o-e,0):e<=n?n-e:e<=o-i?i:0}const VC=class VC extends A{constructor(e,t){super(),this.container=null,this.useFixedPosition=!1,this.useShadowDOM=!1,this.delegate=null,this.toDisposeOnClean=A.None,this.toDisposeOnSetContainer=A.None,this.shadowRoot=null,this.shadowRootHostElement=null,this.view=Q(".context-view"),gs(this.view),this.setContainer(e,t),this._register(ue(()=>this.setContainer(null,1)))}setContainer(e,t){this.useFixedPosition=t!==1;const i=this.useShadowDOM;if(this.useShadowDOM=t===3,!(e===this.container&&i===this.useShadowDOM)&&(this.container&&(this.toDisposeOnSetContainer.dispose(),this.view.remove(),this.shadowRoot&&(this.shadowRoot=null,this.shadowRootHostElement?.remove(),this.shadowRootHostElement=null),this.container=null),e)){if(this.container=e,this.useShadowDOM){this.shadowRootHostElement=Q(".shadow-root-host"),this.container.appendChild(this.shadowRootHostElement),this.shadowRoot=this.shadowRootHostElement.attachShadow({mode:"open"});const s=document.createElement("style");s.textContent=mPe,this.shadowRoot.appendChild(s),this.shadowRoot.appendChild(this.view),this.shadowRoot.appendChild(Q("slot"))}else this.container.appendChild(this.view);const n=new U;VC.BUBBLE_UP_EVENTS.forEach(s=>{n.add(Si(this.container,s,r=>{this.onDOMEvent(r,!1)}))}),VC.BUBBLE_DOWN_EVENTS.forEach(s=>{n.add(Si(this.container,s,r=>{this.onDOMEvent(r,!0)},!0))}),this.toDisposeOnSetContainer=n}}show(e){this.isVisible()&&this.hide(),pn(this.view),this.view.className="context-view monaco-component",this.view.style.top="0px",this.view.style.left="0px",this.view.style.zIndex=`${2575+(e.layer??0)}`,this.view.style.position=this.useFixedPosition?"fixed":"absolute",uo(this.view),this.toDisposeOnClean=e.render(this.view)||A.None,this.delegate=e,this.doLayout(),this.delegate.focus?.()}getViewElement(){return this.view}layout(){if(this.isVisible()){if(this.delegate.canRelayout===!1&&!(ur&&t1.pointerEvents)){this.hide();return}this.delegate?.layout?.(),this.doLayout()}}doLayout(){if(!this.isVisible())return;const e=this.delegate.getAnchor();let t;if(ai(e)){const g=mi(e),m=eH(e);t={top:g.top*m,left:g.left*m,width:g.width*m,height:g.height*m}}else pPe(e)?t={top:e.y,left:e.x,width:e.width||1,height:e.height||2}:t={top:e.posy,left:e.posx,width:2,height:2};const i=ho(this.view),n=Rc(this.view),s=this.delegate.anchorPosition??0,r=this.delegate.anchorAlignment??0,a=this.delegate.anchorAxisAlignment??0;let l,c;const d=ft();if(a===0){const g={offset:t.top-d.pageYOffset,size:t.height,position:s===0?0:1},m={offset:t.left,size:t.width,position:r===0?0:1,mode:Cu.ALIGN};l=iC(d.innerHeight,n,g)+d.pageYOffset,Kn.intersects({start:l,end:l+n},{start:g.offset,end:g.offset+g.size})&&(m.mode=Cu.AVOID),c=iC(d.innerWidth,i,m)}else{const g={offset:t.left,size:t.width,position:r===0?0:1},m={offset:t.top,size:t.height,position:s===0?0:1,mode:Cu.ALIGN};c=iC(d.innerWidth,i,g),Kn.intersects({start:c,end:c+i},{start:g.offset,end:g.offset+g.size})&&(m.mode=Cu.AVOID),l=iC(d.innerHeight,n,m)+d.pageYOffset}this.view.classList.remove("top","bottom","left","right"),this.view.classList.add(s===0?"bottom":"top"),this.view.classList.add(r===0?"left":"right"),this.view.classList.toggle("fixed",this.useFixedPosition);const h=mi(this.container),u=this.container.scrollTop||0,f=this.container.scrollLeft||0;this.view.style.top=`${l-(this.useFixedPosition?mi(this.view).top:h.top)+u}px`,this.view.style.left=`${c-(this.useFixedPosition?mi(this.view).left:h.left)+f}px`,this.view.style.width="initial"}hide(e){const t=this.delegate;this.delegate=null,t?.onHide&&t.onHide(e),this.toDisposeOnClean.dispose(),gs(this.view)}isVisible(){return!!this.delegate}onDOMEvent(e,t){this.delegate&&(this.delegate.onDOMEvent?this.delegate.onDOMEvent(e,me(e).document.activeElement):t&&!Zi(e.target,this.container)&&this.hide())}dispose(){this.hide(),super.dispose()}};VC.BUBBLE_UP_EVENTS=["click","keydown","focus","blur"],VC.BUBBLE_DOWN_EVENTS=["click"];let K8=VC;const mPe=`
:host {
all: initial; /* 1st rule so subsequent properties are reset. */
}
.codicon[class*='codicon-'] {
font: normal normal normal 16px/1 codicon;
display: inline-block;
text-decoration: none;
text-rendering: auto;
text-align: center;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
:host {
font-family: -apple-system, BlinkMacSystemFont, "Segoe WPC", "Segoe UI", "HelveticaNeue-Light", system-ui, "Ubuntu", "Droid Sans", sans-serif;
}
:host-context(.mac) { font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
:host-context(.mac:lang(zh-Hans)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif; }
:host-context(.mac:lang(zh-Hant)) { font-family: -apple-system, BlinkMacSystemFont, "PingFang TC", sans-serif; }
:host-context(.mac:lang(ja)) { font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic Pro", sans-serif; }
:host-context(.mac:lang(ko)) { font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Nanum Gothic", "AppleGothic", sans-serif; }
:host-context(.windows) { font-family: "Segoe WPC", "Segoe UI", sans-serif; }
:host-context(.windows:lang(zh-Hans)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft YaHei", sans-serif; }
:host-context(.windows:lang(zh-Hant)) { font-family: "Segoe WPC", "Segoe UI", "Microsoft Jhenghei", sans-serif; }
:host-context(.windows:lang(ja)) { font-family: "Segoe WPC", "Segoe UI", "Yu Gothic UI", "Meiryo UI", sans-serif; }
:host-context(.windows:lang(ko)) { font-family: "Segoe WPC", "Segoe UI", "Malgun Gothic", "Dotom", sans-serif; }
:host-context(.linux) { font-family: system-ui, "Ubuntu", "Droid Sans", sans-serif; }
:host-context(.linux:lang(zh-Hans)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans SC", "Source Han Sans CN", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(zh-Hant)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans TC", "Source Han Sans TW", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(ja)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans J", "Source Han Sans JP", "Source Han Sans", sans-serif; }
:host-context(.linux:lang(ko)) { font-family: system-ui, "Ubuntu", "Droid Sans", "Source Han Sans K", "Source Han Sans JR", "Source Han Sans", "UnDotum", "FBaekmuk Gulim", sans-serif; }
`;var _Pe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bPe=function(o,e){return function(t,i){e(t,i,o)}};let NE=class extends A{constructor(e){super(),this.layoutService=e,this.contextView=this._register(new K8(this.layoutService.mainContainer,1)),this.layout(),this._register(e.onDidLayoutContainer(()=>this.layout()))}showContextView(e,t,i){let n;t?t===this.layoutService.getContainer(me(t))?n=1:i?n=3:n=2:n=1,this.contextView.setContainer(t??this.layoutService.activeContainer,n),this.contextView.show(e);const s={close:()=>{this.openContextView===s&&this.hideContextView()}};return this.openContextView=s,s}layout(){this.contextView.layout()}hideContextView(e){this.contextView.hide(e),this.openContextView=void 0}};NE=_Pe([bPe(0,Hl)],NE);class CPe extends NE{getContextViewElement(){return this.contextView.getViewElement()}}function cee(o){const e=o;return typeof e=="object"&&"markdown"in e&&"markdownNotSupportedFallback"in e}class vPe{constructor(e,t,i){this.hoverDelegate=e,this.target=t,this.fadeInAnimation=i}async update(e,t,i){if(this._cancellationTokenSource&&(this._cancellationTokenSource.dispose(!0),this._cancellationTokenSource=void 0),this.isDisposed)return;let n;if(ji(e)||ai(e)||e===void 0)n=e;else{this._cancellationTokenSource=new Xt;const s=this._cancellationTokenSource.token;let r;if(cee(e)?Ku(e.markdown)?r=e.markdown(s).then(a=>a??e.markdownNotSupportedFallback):r=e.markdown??e.markdownNotSupportedFallback:r=e.element(s),r instanceof Promise?(this._hoverWidget||this.show(p(75,"Loading..."),t,i),n=await r):n=r,this.isDisposed||s.isCancellationRequested)return}this.show(n,t,i)}show(e,t,i){const n=this._hoverWidget;if(this.hasContent(e)){const s={content:e,target:this.target,actions:i?.actions,linkHandler:i?.linkHandler,trapFocus:i?.trapFocus,appearance:{showPointer:this.hoverDelegate.placement==="element",skipFadeInAnimation:!this.fadeInAnimation||!!n,showHoverHint:i?.appearance?.showHoverHint},position:{hoverPosition:2}};this._hoverWidget=this.hoverDelegate.showHover(s,t)}n?.dispose()}hasContent(e){return e?Rl(e)?!!e.value:!0:!1}get isDisposed(){return this._hoverWidget?.isDisposed}dispose(){this._hoverWidget?.dispose(),this._cancellationTokenSource?.dispose(!0),this._cancellationTokenSource=void 0}}var wPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},nC=function(o,e){return function(t,i){e(t,i,o)}};let G8=class extends A{constructor(e,t,i,n,s,r){super(),this._instantiationService=e,this._configurationService=t,this._keybindingService=n,this._layoutService=s,this._accessibilityService=r,this._currentDelayedHoverWasShown=!1,this._delayedHovers=new Map,this._managedHovers=new Map,this._register(i.onDidShowContextMenu(()=>this.hideHover())),this._contextViewHandler=this._register(new NE(this._layoutService)),this._register(rn.registerCommandAndKeybindingRule({id:"workbench.action.showHover",weight:199,when:T.editorTextFocus.negate(),primary:Ei(2089,2087),handler:()=>{this._showAndFocusHoverForActiveElement()}}))}showInstantHover(e,t,i,n){const s=this._createHover(e,i);if(s)return this._showHover(s,e,t),s}showDelayedHover(e,t){if(e.id===void 0&&(e.id=dee(e.content)),!this._currentDelayedHover||this._currentDelayedHoverWasShown){if(this._currentHover?.isLocked)return;if(vu(this._currentHoverOptions)===vu(e))return this._currentHover;if(this._currentHover&&!this._currentHover.isDisposed&&this._currentDelayedHoverGroupId!==void 0&&this._currentDelayedHoverGroupId===t?.groupId)return this.showInstantHover({...e,appearance:{...e.appearance,skipFadeInAnimation:!0}})}else if(this._currentDelayedHover&&vu(this._currentHoverOptions)===vu(e))return this._currentDelayedHover;const i=this._createHover(e,void 0);if(!i){this._currentDelayedHover=void 0,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=void 0;return}return this._currentDelayedHover=i,this._currentDelayedHoverWasShown=!1,this._currentDelayedHoverGroupId=t?.groupId,al(this._configurationService.getValue("workbench.hover.delay")).then(()=>{i&&!i.isDisposed&&(this._currentDelayedHoverWasShown=!0,this._showHover(i,e))}),i}setupDelayedHover(e,t,i){const n=()=>({...typeof t=="function"?t():t,target:e});return this._setupDelayedHover(e,n,i)}setupDelayedHoverAtMouse(e,t,i){const n=s=>({...typeof t=="function"?t():t,target:{targetElements:[e],x:s!==void 0?s.x+10:void 0}});return this._setupDelayedHover(e,n,i)}_setupDelayedHover(e,t,i){const n=new U;return n.add(W(e,te.MOUSE_OVER,s=>{this.showDelayedHover(t(s),{groupId:i?.groupId})})),i?.setupKeyboardEvents&&n.add(W(e,te.KEY_DOWN,s=>{const r=new St(s);(r.equals(10)||r.equals(3))&&this.showInstantHover(t(),!0)})),this._delayedHovers.set(e,{show:s=>{this.showInstantHover(t(),s)}}),n.add(ue(()=>this._delayedHovers.delete(e))),n}_createHover(e,t){if(this._currentDelayedHover=void 0,this._currentHover?.isLocked||(e.id===void 0&&(e.id=dee(e.content)),vu(this._currentHoverOptions)===vu(e)))return;this._currentHoverOptions=e,this._lastHoverOptions=e;const i=e.trapFocus||this._accessibilityService.isScreenReaderOptimized(),n=Ui();t||(i&&n?n.classList.contains("monaco-hover")||(this._lastFocusedElementBeforeOpen=n):this._lastFocusedElementBeforeOpen=void 0);const s=new U,r=this._instantiationService.createInstance(q8,e);if(e.persistence?.sticky&&(r.isLocked=!0),e.position?.hoverPosition&&!bc(e.position.hoverPosition)&&(e.target={targetElements:ai(e.target)?[e.target]:e.target.targetElements,x:e.position.hoverPosition.x+10}),r.onDispose(()=>{this._currentHover?.domNode&&iH(this._currentHover.domNode)&&this._lastFocusedElementBeforeOpen?.focus(),vu(this._currentHoverOptions)===vu(e)&&this.doHideHover(),s.dispose()},void 0,s),!e.container){const a=ai(e.target)?e.target:e.target.targetElements[0];e.container=this._layoutService.getContainer(me(a))}if(r.onRequestLayout(()=>this._contextViewHandler.layout(),void 0,s),e.persistence?.sticky)s.add(W(me(e.container).document,te.MOUSE_DOWN,a=>{Zi(a.target,r.domNode)||this.doHideHover()}));else{if("targetElements"in e.target)for(const l of e.target.targetElements)s.add(W(l,te.CLICK,()=>this.hideHover()));else s.add(W(e.target,te.CLICK,()=>this.hideHover()));const a=Ui();if(a){const l=me(a).document;s.add(W(a,te.KEY_DOWN,c=>this._keyDown(c,r,!!e.persistence?.hideOnKeyDown))),s.add(W(l,te.KEY_DOWN,c=>this._keyDown(c,r,!!e.persistence?.hideOnKeyDown))),s.add(W(a,te.KEY_UP,c=>this._keyUp(c,r))),s.add(W(l,te.KEY_UP,c=>this._keyUp(c,r)))}}if("IntersectionObserver"in bt){const a=new IntersectionObserver(c=>this._intersectionChange(c,r),{threshold:0}),l="targetElements"in e.target?e.target.targetElements[0]:e.target;a.observe(l),s.add(ue(()=>a.disconnect()))}return this._currentHover=r,r}_showHover(e,t,i){this._contextViewHandler.showContextView(new yPe(e,i),t.container)}hideHover(e){!e&&this._currentHover?.isLocked||!this._currentHoverOptions||this.doHideHover()}doHideHover(){this._currentHover=void 0,this._currentHoverOptions=void 0,this._contextViewHandler.hideContextView()}_intersectionChange(e,t){e[e.length-1].isIntersecting||t.dispose()}showAndFocusLastHover(){this._lastHoverOptions&&this.showInstantHover(this._lastHoverOptions,!0,!0)}_showAndFocusHoverForActiveElement(){let e=Ui();for(;e;){const t=this._delayedHovers.get(e)??this._managedHovers.get(e);if(t){t.show(!0);return}e=e.parentElement}}_keyDown(e,t,i){if(e.key==="Alt"){t.isLocked=!0;return}const n=new St(e);this._keybindingService.resolveKeyboardEvent(n).getSingleModifierDispatchChords().some(r=>!!r)||this._keybindingService.softDispatch(n,n.target).kind!==0||i&&(!this._currentHoverOptions?.trapFocus||e.key!=="Tab")&&(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus())}_keyUp(e,t){e.key==="Alt"&&(t.isLocked=!1,t.isMouseIn||(this.hideHover(),this._lastFocusedElementBeforeOpen?.focus()))}setupManagedHover(e,t,i,n){if(e.showNativeHover)return SPe(t,i);t.setAttribute("custom-hover","true"),t.title!==""&&(console.warn("HTML element already has a title attribute, which will conflict with the custom hover. Please remove the title attribute."),console.trace("Stack trace:",t.title),t.title="");let s,r;const a=(f,g)=>{const m=r!==void 0;f&&(r?.dispose(),r=void 0),g&&(s?.dispose(),s=void 0),m&&(e.onDidHideHover?.(),r=void 0)},l=(f,g,m,_)=>new No(async()=>{(!r||r.isDisposed)&&(r=new vPe(e,m||t,f>0),await r.update(typeof i=="function"?i():i,g,{...n,trapFocus:_}))},f),c=new U;let d=!1;c.add(W(t,te.MOUSE_DOWN,()=>{d=!0,a(!0,!0)},!0)),c.add(W(t,te.MOUSE_UP,()=>{d=!1},!0)),c.add(W(t,te.MOUSE_LEAVE,f=>{d=!1,a(!1,f.fromElement===t)},!0)),c.add(W(t,te.MOUSE_OVER,f=>{if(s)return;const g=new U,m={targetElements:[t],dispose:()=>{}};if(e.placement===void 0||e.placement==="mouse"){const _=b=>{m.x=b.x+10,ai(b.target)&&uee(b.target,t)!==t&&a(!0,!0)};g.add(W(t,te.MOUSE_MOVE,_,!0))}s=g,!(ai(f.target)&&uee(f.target,t)!==t)&&g.add(l(typeof e.delay=="function"?e.delay(i):e.delay,!1,m))},!0));const h=()=>{if(d||s)return;const f={targetElements:[t],dispose:()=>{}},g=new U,m=()=>a(!0,!0);g.add(W(t,te.BLUR,m,!0)),g.add(l(typeof e.delay=="function"?e.delay(i):e.delay,!1,f)),s=g};ya(t)||c.add(W(t,te.FOCUS,h,!0));const u={show:f=>{a(!1,!0),l(0,f,void 0,f)},hide:()=>{a(!0,!0)},update:async(f,g)=>{i=f,await r?.update(i,void 0,g)},dispose:()=>{this._managedHovers.delete(t),c.dispose(),a(!0,!0)}};return this._managedHovers.set(t,u),u}showManagedHover(e){const t=this._managedHovers.get(e);t&&t.show(!0)}dispose(){this._managedHovers.forEach(e=>e.dispose()),super.dispose()}};G8=wPe([nC(0,ge),nC(1,Me),nC(2,Ko),nC(3,ot),nC(4,Hl),nC(5,bn)],G8);function vu(o){if(o!==void 0)return o?.id??o}function dee(o){if(!ai(o))return typeof o=="string"?o.toString():o.value}function hee(o){const e=typeof o=="function"?o():o;if(ji(e))return kA(e);if(cee(e))return e.markdownNotSupportedFallback}function SPe(o,e){function t(i){i?o.setAttribute("title",i):o.removeAttribute("title")}return t(hee(e)),{update:i=>t(hee(i)),show:()=>{},hide:()=>{},dispose:()=>t(void 0)}}class yPe{get anchorPosition(){return this._hover.anchor}constructor(e,t=!1){this._hover=e,this._focus=t,this.layer=1}render(e){return this._hover.render(e),this._focus&&this._hover.focus(),this._hover}getAnchor(){return{x:this._hover.x,y:this._hover.y}}layout(){this._hover.layout()}}function uee(o,e){for(e=e??me(o).document.body;!o.hasAttribute("custom-hover")&&o!==e;)o=o.parentElement;return o}je(Qs,G8,1),Nr((o,e)=>{const t=o.getColor(nM);t&&(e.addRule(`.monaco-workbench .workbench-hover .hover-row:not(:first-child):not(:empty) { border-top: 1px solid ${t.transparent(.5)}; }`),e.addRule(`.monaco-workbench .workbench-hover hr { border-top: 1px solid ${t.transparent(.5)}; }`))});function TE(o){return Object.isFrozen(o)?o:_oe(o)}class wn{static createEmptyModel(e){return new wn({},[],[],void 0,e)}constructor(e,t,i,n,s){this._contents=e,this._keys=t,this._overrides=i,this.raw=n,this.logService=s,this.overrideConfigurations=new Map}get rawConfiguration(){if(!this._rawConfiguration)if(this.raw){const e=(Array.isArray(this.raw)?this.raw:[this.raw]).map(t=>{if(t instanceof wn)return t;const i=new LPe("",this.logService);return i.parseRaw(t),i.configurationModel});this._rawConfiguration=e.reduce((t,i)=>i===t?i:t.merge(i),e[0])}else this._rawConfiguration=this;return this._rawConfiguration}get contents(){return this._contents}get overrides(){return this._overrides}get keys(){return this._keys}isEmpty(){return this._keys.length===0&&Object.keys(this._contents).length===0&&this._overrides.length===0}getValue(e){return e?tV(this.contents,e):this.contents}inspect(e,t){const i=this;return{get value(){return TE(i.rawConfiguration.getValue(e))},get override(){return t?TE(i.rawConfiguration.getOverrideValue(e,t)):void 0},get merged(){return TE(t?i.rawConfiguration.override(t).getValue(e):i.rawConfiguration.getValue(e))},get overrides(){const n=[];for(const{contents:s,identifiers:r,keys:a}of i.rawConfiguration.overrides){const l=new wn(s,a,[],void 0,i.logService).getValue(e);l!==void 0&&n.push({identifiers:r,value:l})}return n.length?TE(n):void 0}}}getOverrideValue(e,t){const i=this.getContentsForOverrideIdentifer(t);return i?e?tV(i,e):i:void 0}override(e){let t=this.overrideConfigurations.get(e);return t||(t=this.createOverrideConfigurationModel(e),this.overrideConfigurations.set(e,t)),t}merge(...e){const t=fl(this.contents),i=fl(this.overrides),n=[...this.keys],s=this.raw?Array.isArray(this.raw)?[...this.raw]:[this.raw]:[this];for(const r of e)if(s.push(...r.raw?Array.isArray(r.raw)?r.raw:[r.raw]:[r]),!r.isEmpty()){this.mergeContents(t,r.contents);for(const a of r.overrides){const[l]=i.filter(c=>Ut(c.identifiers,a.identifiers));l?(this.mergeContents(l.contents,a.contents),l.keys.push(...a.keys),l.keys=Dc(l.keys)):i.push(fl(a))}for(const a of r.keys)n.indexOf(a)===-1&&n.push(a)}return new wn(t,n,i,!s.length||s.every(r=>r instanceof wn)?void 0:s,this.logService)}createOverrideConfigurationModel(e){const t=this.getContentsForOverrideIdentifer(e);if(!t||typeof t!="object"||!Object.keys(t).length)return this;const i={};for(const n of Dc([...Object.keys(this.contents),...Object.keys(t)])){let s=this.contents[n];const r=t[n];r&&(typeof s=="object"&&typeof r=="object"?(s=fl(s),this.mergeContents(s,r)):s=r),i[n]=s}return new wn(i,this.keys,this.overrides,void 0,this.logService)}mergeContents(e,t){for(const i of Object.keys(t)){if(i in e&&nn(e[i])&&nn(t[i])){this.mergeContents(e[i],t[i]);continue}e[i]=fl(t[i])}}getContentsForOverrideIdentifer(e){let t=null,i=null;const n=s=>{s&&(i?this.mergeContents(i,s):i=fl(s))};for(const s of this.overrides)s.identifiers.length===1&&s.identifiers[0]===e?t=s.contents:s.identifiers.includes(e)&&n(s.contents);return n(t),i}toJSON(){return{contents:this.contents,overrides:this.overrides,keys:this.keys}}setValue(e,t){this.updateValue(e,t,!1)}removeValue(e){const t=this.keys.indexOf(e);t!==-1&&(this.keys.splice(t,1),Ooe(this.contents,e),fh.test(e)&&this.overrides.splice(this.overrides.findIndex(i=>Ut(i.identifiers,oL(e))),1))}updateValue(e,t,i){if(JH(this.contents,e,t,n=>this.logService.error(n)),i=i||this.keys.indexOf(e)===-1,i&&this.keys.push(e),fh.test(e)){const n=oL(e),s={identifiers:n,keys:Object.keys(this.contents[e]),contents:E2(this.contents[e],a=>this.logService.error(a))},r=this.overrides.findIndex(a=>Ut(a.identifiers,n));r!==-1?this.overrides[r]=s:this.overrides.push(s)}}}class LPe{constructor(e,t){this._name=e,this.logService=t,this._raw=null,this._configurationModel=null,this._restrictedConfigurations=[]}get configurationModel(){return this._configurationModel||wn.createEmptyModel(this.logService)}parseRaw(e,t){this._raw=e;const{contents:i,keys:n,overrides:s,restricted:r,hasExcludedProperties:a}=this.doParseRaw(e,t);this._configurationModel=new wn(i,n,s,a?[e]:void 0,this.logService),this._restrictedConfigurations=r||[]}doParseRaw(e,t){const i=ei.as(ka.Configuration),n=i.getConfigurationProperties(),s=i.getExcludedConfigurationProperties(),r=this.filter(e,n,s,!0,t);e=r.raw;const a=E2(e,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`)),l=Object.keys(e),c=this.toOverrides(e,d=>this.logService.error(`Conflict in settings file ${this._name}: ${d}`));return{contents:a,keys:l,overrides:c,restricted:r.restricted,hasExcludedProperties:r.hasExcludedProperties}}filter(e,t,i,n,s){let r=!1;if(!s?.scopes&&!s?.skipRestricted&&!s?.skipUnregistered&&!s?.exclude?.length)return{raw:e,restricted:[],hasExcludedProperties:r};const a={},l=[];for(const c in e)if(fh.test(c)&&n){const d=this.filter(e[c],t,i,!1,s);a[c]=d.raw,r=r||d.hasExcludedProperties,l.push(...d.restricted)}else{const d=t[c];d?.restricted&&l.push(c),this.shouldInclude(c,d,i,s)?a[c]=e[c]:r=!0}return{raw:a,restricted:l,hasExcludedProperties:r}}shouldInclude(e,t,i,n){if(n.exclude?.includes(e))return!1;if(n.include?.includes(e))return!0;if(n.skipRestricted&&t?.restricted||n.skipUnregistered&&!t)return!1;const s=t??i[e],r=s?typeof s.scope<"u"?s.scope:4:void 0;return r===void 0||n.scopes===void 0?!0:n.scopes.includes(r)}toOverrides(e,t){const i=[];for(const n of Object.keys(e))if(fh.test(n)){const s={};for(const r in e[n])s[r]=e[n][r];i.push({identifiers:oL(n),keys:Object.keys(s),contents:E2(s,t)})}return i}}class xPe{constructor(e,t,i,n,s,r,a,l,c,d,h,u,f){this.key=e,this.overrides=t,this._value=i,this.overrideIdentifiers=n,this.defaultConfiguration=s,this.policyConfiguration=r,this.applicationConfiguration=a,this.userConfiguration=l,this.localUserConfiguration=c,this.remoteUserConfiguration=d,this.workspaceConfiguration=h,this.folderConfigurationModel=u,this.memoryConfigurationModel=f}toInspectValue(e){return e?.value!==void 0||e?.override!==void 0||e?.overrides!==void 0?e:void 0}get userInspectValue(){return this._userInspectValue||(this._userInspectValue=this.userConfiguration.inspect(this.key,this.overrides.overrideIdentifier)),this._userInspectValue}get user(){return this.toInspectValue(this.userInspectValue)}}class RE{constructor(e,t,i,n,s,r,a,l,c,d){this._defaultConfiguration=e,this._policyConfiguration=t,this._applicationConfiguration=i,this._localUserConfiguration=n,this._remoteUserConfiguration=s,this._workspaceConfiguration=r,this._folderConfigurations=a,this._memoryConfiguration=l,this._memoryConfigurationByResource=c,this.logService=d,this._workspaceConsolidatedConfiguration=null,this._foldersConsolidatedConfigurations=new Li,this._userConfiguration=null}getValue(e,t,i){return this.getConsolidatedConfigurationModel(e,t,i).getValue(e)}updateValue(e,t,i={}){let n;i.resource?(n=this._memoryConfigurationByResource.get(i.resource),n||(n=wn.createEmptyModel(this.logService),this._memoryConfigurationByResource.set(i.resource,n))):n=this._memoryConfiguration,t===void 0?n.removeValue(e):n.setValue(e,t),i.resource||(this._workspaceConsolidatedConfiguration=null)}inspect(e,t,i){const n=this.getConsolidatedConfigurationModel(e,t,i),s=this.getFolderConfigurationModelForResource(t.resource,i),r=t.resource?this._memoryConfigurationByResource.get(t.resource)||this._memoryConfiguration:this._memoryConfiguration,a=new Set;for(const l of n.overrides)for(const c of l.identifiers)n.getOverrideValue(e,c)!==void 0&&a.add(c);return new xPe(e,t,n.getValue(e),a.size?[...a]:void 0,this._defaultConfiguration,this._policyConfiguration.isEmpty()?void 0:this._policyConfiguration,this.applicationConfiguration.isEmpty()?void 0:this.applicationConfiguration,this.userConfiguration,this.localUserConfiguration,this.remoteUserConfiguration,i?this._workspaceConfiguration:void 0,s||void 0,r)}get applicationConfiguration(){return this._applicationConfiguration}get userConfiguration(){if(!this._userConfiguration)if(this._remoteUserConfiguration.isEmpty())this._userConfiguration=this._localUserConfiguration;else{const e=this._localUserConfiguration.merge(this._remoteUserConfiguration);this._userConfiguration=new wn(e.contents,e.keys,e.overrides,void 0,this.logService)}return this._userConfiguration}get localUserConfiguration(){return this._localUserConfiguration}get remoteUserConfiguration(){return this._remoteUserConfiguration}getConsolidatedConfigurationModel(e,t,i){let n=this.getConsolidatedConfigurationModelForResource(t,i);if(t.overrideIdentifier&&(n=n.override(t.overrideIdentifier)),!this._policyConfiguration.isEmpty()&&this._policyConfiguration.getValue(e)!==void 0){n=n.merge();for(const s of this._policyConfiguration.keys)n.setValue(s,this._policyConfiguration.getValue(s))}return n}getConsolidatedConfigurationModelForResource({resource:e},t){let i=this.getWorkspaceConsolidatedConfiguration();if(t&&e){const n=t.getFolder(e);n&&(i=this.getFolderConsolidatedConfiguration(n.uri)||i);const s=this._memoryConfigurationByResource.get(e);s&&(i=i.merge(s))}return i}getWorkspaceConsolidatedConfiguration(){return this._workspaceConsolidatedConfiguration||(this._workspaceConsolidatedConfiguration=this._defaultConfiguration.merge(this.applicationConfiguration,this.userConfiguration,this._workspaceConfiguration,this._memoryConfiguration)),this._workspaceConsolidatedConfiguration}getFolderConsolidatedConfiguration(e){let t=this._foldersConsolidatedConfigurations.get(e);if(!t){const i=this.getWorkspaceConsolidatedConfiguration(),n=this._folderConfigurations.get(e);n?(t=i.merge(n),this._foldersConsolidatedConfigurations.set(e,t)):t=i}return t}getFolderConfigurationModelForResource(e,t){if(t&&e){const i=t.getFolder(e);if(i)return this._folderConfigurations.get(i.uri)}}toData(){return{defaults:{contents:this._defaultConfiguration.contents,overrides:this._defaultConfiguration.overrides,keys:this._defaultConfiguration.keys},policy:{contents:this._policyConfiguration.contents,overrides:this._policyConfiguration.overrides,keys:this._policyConfiguration.keys},application:{contents:this.applicationConfiguration.contents,overrides:this.applicationConfiguration.overrides,keys:this.applicationConfiguration.keys,raw:Array.isArray(this.applicationConfiguration.raw)?void 0:this.applicationConfiguration.raw},userLocal:{contents:this.localUserConfiguration.contents,overrides:this.localUserConfiguration.overrides,keys:this.localUserConfiguration.keys,raw:Array.isArray(this.localUserConfiguration.raw)?void 0:this.localUserConfiguration.raw},userRemote:{contents:this.remoteUserConfiguration.contents,overrides:this.remoteUserConfiguration.overrides,keys:this.remoteUserConfiguration.keys,raw:Array.isArray(this.remoteUserConfiguration.raw)?void 0:this.remoteUserConfiguration.raw},workspace:{contents:this._workspaceConfiguration.contents,overrides:this._workspaceConfiguration.overrides,keys:this._workspaceConfiguration.keys},folders:[...this._folderConfigurations.keys()].reduce((e,t)=>{const{contents:i,overrides:n,keys:s}=this._folderConfigurations.get(t);return e.push([t,{contents:i,overrides:n,keys:s}]),e},[])}}static parse(e,t){const i=this.parseConfigurationModel(e.defaults,t),n=this.parseConfigurationModel(e.policy,t),s=this.parseConfigurationModel(e.application,t),r=this.parseConfigurationModel(e.userLocal,t),a=this.parseConfigurationModel(e.userRemote,t),l=this.parseConfigurationModel(e.workspace,t),c=e.folders.reduce((d,h)=>(d.set(be.revive(h[0]),this.parseConfigurationModel(h[1],t)),d),new Li);return new RE(i,n,s,r,a,l,c,wn.createEmptyModel(t),new Li,t)}static parseConfigurationModel(e,t){return new wn(e.contents,e.keys,e.overrides,e.raw,t)}}class kPe{constructor(e,t,i,n,s){this.change=e,this.previous=t,this.currentConfiguraiton=i,this.currentWorkspace=n,this.logService=s,this._marker=`
`,this._markerCode1=this._marker.charCodeAt(0),this._markerCode2=46,this.affectedKeys=new Set,this._previousConfiguration=void 0;for(const r of e.keys)this.affectedKeys.add(r);for(const[,r]of e.overrides)for(const a of r)this.affectedKeys.add(a);this._affectsConfigStr=this._marker;for(const r of this.affectedKeys)this._affectsConfigStr+=r+this._marker}get previousConfiguration(){return!this._previousConfiguration&&this.previous&&(this._previousConfiguration=RE.parse(this.previous.data,this.logService)),this._previousConfiguration}affectsConfiguration(e,t){const i=this._marker+e,n=this._affectsConfigStr.indexOf(i);if(n<0)return!1;const s=n+i.length;if(s>=this._affectsConfigStr.length)return!1;const r=this._affectsConfigStr.charCodeAt(s);if(r!==this._markerCode1&&r!==this._markerCode2)return!1;if(t){const a=this.previousConfiguration?this.previousConfiguration.getValue(e,t,this.previous?.workspace):void 0,l=this.currentConfiguraiton.getValue(e,t,this.currentWorkspace);return!fo(a,l)}return!0}}const ME={kind:0},IPe={kind:1};function DPe(o,e,t){return{kind:2,commandId:o,commandArgs:e,isBubble:t}}class hS{constructor(e,t,i){this._log=i,this._defaultKeybindings=e,this._defaultBoundCommands=new Map;for(const n of e){const s=n.command;s&&s.charAt(0)!=="-"&&this._defaultBoundCommands.set(s,!0)}this._map=new Map,this._lookupMap=new Map,this._keybindings=hS.handleRemovals([].concat(e).concat(t));for(let n=0,s=this._keybindings.length;n<s;n++){const r=this._keybindings[n];if(r.chords.length===0)continue;const a=r.when?.substituteConstants();a&&a.type===0||this._addKeyPress(r.chords[0],r)}}static _isTargetedForRemoval(e,t,i){if(t){for(let n=0;n<t.length;n++)if(t[n]!==e.chords[n])return!1}return!(i&&i.type!==1&&(!e.when||!Rse(i,e.when)))}static handleRemovals(e){const t=new Map;for(let n=0,s=e.length;n<s;n++){const r=e[n];if(r.command&&r.command.charAt(0)==="-"){const a=r.command.substring(1);t.has(a)?t.get(a).push(r):t.set(a,[r])}}if(t.size===0)return e;const i=[];for(let n=0,s=e.length;n<s;n++){const r=e[n];if(!r.command||r.command.length===0){i.push(r);continue}if(r.command.charAt(0)==="-")continue;const a=t.get(r.command);if(!a||!r.isDefault){i.push(r);continue}let l=!1;for(const c of a){const d=c.when;if(this._isTargetedForRemoval(r,c.chords,d)){l=!0;break}}if(!l){i.push(r);continue}}return i}_addKeyPress(e,t){const i=this._map.get(e);if(typeof i>"u"){this._map.set(e,[t]),this._addToLookupMap(t);return}for(let n=i.length-1;n>=0;n--){const s=i[n];if(s.command===t.command)continue;let r=!0;for(let a=1;a<s.chords.length&&a<t.chords.length;a++)if(s.chords[a]!==t.chords[a]){r=!1;break}r&&hS.whenIsEntirelyIncluded(s.when,t.when)&&this._removeFromLookupMap(s)}i.push(t),this._addToLookupMap(t)}_addToLookupMap(e){if(!e.command)return;let t=this._lookupMap.get(e.command);typeof t>"u"?(t=[e],this._lookupMap.set(e.command,t)):t.push(e)}_removeFromLookupMap(e){if(!e.command)return;const t=this._lookupMap.get(e.command);if(!(typeof t>"u")){for(let i=0,n=t.length;i<n;i++)if(t[i]===e){t.splice(i,1);return}}}static whenIsEntirelyIncluded(e,t){return!t||t.type===1?!0:!e||e.type===1?!1:h2(e,t)}getKeybindings(){return this._keybindings}lookupPrimaryKeybinding(e,t,i=!1){const n=this._lookupMap.get(e);if(typeof n>"u"||n.length===0)return null;if(n.length===1&&!i)return n[0];for(let s=n.length-1;s>=0;s--){const r=n[s];if(t.contextMatchesRules(r.when))return r}return i?null:n[n.length-1]}resolve(e,t,i){const n=[...t,i];this._log(`| Resolving ${n}`);const s=this._map.get(n[0]);if(s===void 0)return this._log("\\ No keybinding entries."),ME;let r=null;if(n.length<2)r=s;else{r=[];for(let l=0,c=s.length;l<c;l++){const d=s[l];if(n.length>d.chords.length)continue;let h=!0;for(let u=1;u<n.length;u++)if(d.chords[u]!==n[u]){h=!1;break}h&&r.push(d)}}const a=this._findCommand(e,r);return a?n.length<a.chords.length?(this._log(`\\ From ${r.length} keybinding entries, awaiting ${a.chords.length-n.length} more chord(s), when: ${fee(a.when)}, source: ${gee(a)}.`),IPe):(this._log(`\\ From ${r.length} keybinding entries, matched ${a.command}, when: ${fee(a.when)}, source: ${gee(a)}.`),DPe(a.command,a.commandArgs,a.bubble)):(this._log(`\\ From ${r.length} keybinding entries, no when clauses matched the context.`),ME)}_findCommand(e,t){for(let i=t.length-1;i>=0;i--){const n=t[i];if(hS._contextMatchesRules(e,n.when))return n}return null}static _contextMatchesRules(e,t){return t?t.evaluate(e):!0}}function fee(o){return o?`${o.serialize()}`:"no when condition"}function gee(o){return o.extensionId?o.isBuiltinExtension?`built-in extension ${o.extensionId}`:`user extension ${o.extensionId}`:o.isDefault?"built-in":"user"}const EPe=/^(cursor|delete|undo|redo|tab|editor\.action\.clipboard)/;class NPe extends A{get onDidUpdateKeybindings(){return this._onDidUpdateKeybindings?this._onDidUpdateKeybindings.event:ie.None}get inChordMode(){return this._currentChords.length>0}constructor(e,t,i,n,s){super(),this._contextKeyService=e,this._commandService=t,this._telemetryService=i,this._notificationService=n,this._logService=s,this._onDidUpdateKeybindings=this._register(new P),this._currentChords=[],this._currentChordChecker=new uR,this._currentChordStatusMessage=null,this._ignoreSingleModifiers=sC.EMPTY,this._currentSingleModifier=null,this._currentSingleModifierClearTimeout=new No,this._currentlyDispatchingCommandId=null,this._logging=!1}dispose(){super.dispose()}_log(e){this._logging&&this._logService.info(`[KeybindingService]: ${e}`)}getKeybindings(){return this._getResolver().getKeybindings()}lookupKeybinding(e,t,i=!1){const n=this._getResolver().lookupPrimaryKeybinding(e,t||this._contextKeyService,i);if(n)return n.resolvedKeybinding}dispatchEvent(e,t){return this._dispatch(e,t)}softDispatch(e,t){this._log("/ Soft dispatching keyboard event");const i=this.resolveKeyboardEvent(e);if(i.hasMultipleChords())return console.warn("keyboard event should not be mapped to multiple chords"),ME;const[n]=i.getDispatchChords();if(n===null)return this._log("\\ Keyboard event cannot be dispatched"),ME;const s=this._contextKeyService.getContext(t),r=this._currentChords.map((({keypress:a})=>a));return this._getResolver().resolve(s,r,n)}_scheduleLeaveChordMode(){const e=Date.now();this._currentChordChecker.cancelAndSet(()=>{if(!this._documentHasFocus()){this._leaveChordMode();return}Date.now()-e>5e3&&this._leaveChordMode()},500)}_expectAnotherChord(e,t){switch(this._currentChords.push({keypress:e,label:t}),this._currentChords.length){case 0:throw YS("impossible");case 1:this._currentChordStatusMessage=this._notificationService.status(p(1684,"({0}) was pressed. Waiting for second key of chord...",t));break;default:{const i=this._currentChords.map(({label:n})=>n).join(", ");this._currentChordStatusMessage=this._notificationService.status(p(1685,"({0}) was pressed. Waiting for next key of chord...",i))}}this._scheduleLeaveChordMode(),Ll.enabled&&Ll.disable()}_leaveChordMode(){this._currentChordStatusMessage&&(this._currentChordStatusMessage.close(),this._currentChordStatusMessage=null),this._currentChordChecker.cancel(),this._currentChords=[],Ll.enable()}_dispatch(e,t){return this._doDispatch(this.resolveKeyboardEvent(e),t,!1)}_singleModifierDispatch(e,t){const i=this.resolveKeyboardEvent(e),[n]=i.getSingleModifierDispatchChords();if(n)return this._ignoreSingleModifiers.has(n)?(this._log(`+ Ignoring single modifier ${n} due to it being pressed together with other keys.`),this._ignoreSingleModifiers=sC.EMPTY,this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1):(this._ignoreSingleModifiers=sC.EMPTY,this._currentSingleModifier===null?(this._log(`+ Storing single modifier for possible chord ${n}.`),this._currentSingleModifier=n,this._currentSingleModifierClearTimeout.cancelAndSet(()=>{this._log("+ Clearing single modifier due to 300ms elapsed."),this._currentSingleModifier=null},300),!1):n===this._currentSingleModifier?(this._log(`/ Dispatching single modifier chord ${n} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,this._doDispatch(i,t,!0)):(this._log(`+ Clearing single modifier due to modifier mismatch: ${this._currentSingleModifier} ${n}`),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1));const[s]=i.getChords();return this._ignoreSingleModifiers=new sC(s),this._currentSingleModifier!==null&&this._log("+ Clearing single modifier due to other key up."),this._currentSingleModifierClearTimeout.cancel(),this._currentSingleModifier=null,!1}_doDispatch(e,t,i=!1){let n=!1;if(e.hasMultipleChords())return console.warn("Unexpected keyboard event mapped to multiple chords"),!1;let s=null,r=null;if(i){const[d]=e.getSingleModifierDispatchChords();s=d,r=d?[d]:[]}else[s]=e.getDispatchChords(),r=this._currentChords.map(({keypress:d})=>d);if(s===null)return this._log("\\ Keyboard event cannot be dispatched in keydown phase."),n;const a=this._contextKeyService.getContext(t),l=e.getLabel(),c=this._getResolver().resolve(a,r,s);switch(c.kind){case 0:{if(this._logService.trace("KeybindingService#dispatch",l,"[ No matching keybinding ]"),this.inChordMode){const d=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving multi-chord mode: Nothing bound to "${d}, ${l}".`),this._notificationService.status(p(1686,"The key combination ({0}, {1}) is not a command.",d,l),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}return n}case 1:return this._logService.trace("KeybindingService#dispatch",l,"[ Several keybindings match - more chords needed ]"),n=!0,this._expectAnotherChord(s,l),this._log(this._currentChords.length===1?"+ Entering multi-chord mode...":"+ Continuing multi-chord mode..."),n;case 2:{if(this._logService.trace("KeybindingService#dispatch",l,`[ Will dispatch command ${c.commandId} ]`),c.commandId===null||c.commandId===""){if(this.inChordMode){const d=this._currentChords.map(({label:h})=>h).join(", ");this._log(`+ Leaving chord mode: Nothing bound to "${d}, ${l}".`),this._notificationService.status(p(1687,"The key combination ({0}, {1}) is not a command.",d,l),{hideAfter:10*1e3}),this._leaveChordMode(),n=!0}}else{this.inChordMode&&this._leaveChordMode(),c.isBubble||(n=!0),this._log(`+ Invoking command ${c.commandId}.`),this._currentlyDispatchingCommandId=c.commandId;try{typeof c.commandArgs>"u"?this._commandService.executeCommand(c.commandId).then(void 0,d=>this._notificationService.warn(d)):this._commandService.executeCommand(c.commandId,c.commandArgs).then(void 0,d=>this._notificationService.warn(d))}finally{this._currentlyDispatchingCommandId=null}EPe.test(c.commandId)||this._telemetryService.publicLog2("workbenchActionExecuted",{id:c.commandId,from:"keybinding",detail:e.getUserSettingsLabel()??void 0})}return n}}}mightProducePrintableCharacter(e){return e.ctrlKey||e.metaKey?!1:e.keyCode>=31&&e.keyCode<=56||e.keyCode>=21&&e.keyCode<=30}}const xT=class xT{constructor(e){this._ctrlKey=e?e.ctrlKey:!1,this._shiftKey=e?e.shiftKey:!1,this._altKey=e?e.altKey:!1,this._metaKey=e?e.metaKey:!1}has(e){switch(e){case"ctrl":return this._ctrlKey;case"shift":return this._shiftKey;case"alt":return this._altKey;case"meta":return this._metaKey}}};xT.EMPTY=new xT(null);let sC=xT;class pee{constructor(e,t,i,n,s,r,a){this._resolvedKeybindingItemBrand=void 0,this.resolvedKeybinding=e,this.chords=e?Z8(e.getDispatchChords()):[],e&&this.chords.length===0&&(this.chords=Z8(e.getSingleModifierDispatchChords())),this.bubble=t?t.charCodeAt(0)===94:!1,this.command=this.bubble?t.substr(1):t,this.commandArgs=i,this.when=n,this.isDefault=s,this.extensionId=r,this.isBuiltinExtension=a}}function Z8(o){const e=[];for(let t=0,i=o.length;t<i;t++){const n=o[t];if(!n)return[];e.push(n)}return e}class TPe extends Gte{constructor(e,t){if(super(),t.length===0)throw dr("chords");this._os=e,this._chords=t}getLabel(){return xO.toLabel(this._os,this._chords,e=>this._getLabel(e))}getAriaLabel(){return E1e.toLabel(this._os,this._chords,e=>this._getAriaLabel(e))}getElectronAccelerator(){return this._chords.length>1||this._chords[0].isDuplicateModifierCase()?null:N1e.toLabel(this._os,this._chords,e=>this._getElectronAccelerator(e))}getUserSettingsLabel(){return T1e.toLabel(this._os,this._chords,e=>this._getUserSettingsLabel(e))}hasMultipleChords(){return this._chords.length>1}getChords(){return this._chords.map(e=>this._getChord(e))}_getChord(e){return new Kte(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,this._getLabel(e),this._getAriaLabel(e))}getDispatchChords(){return this._chords.map(e=>this._getChordDispatch(e))}getSingleModifierDispatchChords(){return this._chords.map(e=>this._getSingleModifierChordDispatch(e))}}class uS extends TPe{constructor(e,t){super(t,e)}_keyCodeToUILabel(e){if(this._os===2)switch(e){case 15:return"←";case 16:return"↑";case 17:return"→";case 18:return"↓"}return wc.toString(e)}_getLabel(e){return e.isDuplicateModifierCase()?"":this._keyCodeToUILabel(e.keyCode)}_getAriaLabel(e){return e.isDuplicateModifierCase()?"":wc.toString(e.keyCode)}_getElectronAccelerator(e){return wc.toElectronAccelerator(e.keyCode)}_getUserSettingsLabel(e){if(e.isDuplicateModifierCase())return"";const t=wc.toUserSettingsUS(e.keyCode);return t&&t.toLowerCase()}_getChordDispatch(e){return uS.getDispatchStr(e)}static getDispatchStr(e){if(e.isModifierKey())return null;let t="";return e.ctrlKey&&(t+="ctrl+"),e.shiftKey&&(t+="shift+"),e.altKey&&(t+="alt+"),e.metaKey&&(t+="meta+"),t+=wc.toString(e.keyCode),t}_getSingleModifierChordDispatch(e){return e.keyCode===5&&!e.shiftKey&&!e.altKey&&!e.metaKey?"ctrl":e.keyCode===4&&!e.ctrlKey&&!e.altKey&&!e.metaKey?"shift":e.keyCode===6&&!e.ctrlKey&&!e.shiftKey&&!e.metaKey?"alt":e.keyCode===57&&!e.ctrlKey&&!e.shiftKey&&!e.altKey?"meta":null}static _scanCodeToKeyCode(e){const t=iR[e];if(t!==-1)return t;switch(e){case 10:return 31;case 11:return 32;case 12:return 33;case 13:return 34;case 14:return 35;case 15:return 36;case 16:return 37;case 17:return 38;case 18:return 39;case 19:return 40;case 20:return 41;case 21:return 42;case 22:return 43;case 23:return 44;case 24:return 45;case 25:return 46;case 26:return 47;case 27:return 48;case 28:return 49;case 29:return 50;case 30:return 51;case 31:return 52;case 32:return 53;case 33:return 54;case 34:return 55;case 35:return 56;case 36:return 22;case 37:return 23;case 38:return 24;case 39:return 25;case 40:return 26;case 41:return 27;case 42:return 28;case 43:return 29;case 44:return 30;case 45:return 21;case 51:return 88;case 52:return 86;case 53:return 92;case 54:return 94;case 55:return 93;case 56:return 0;case 57:return 85;case 58:return 95;case 59:return 91;case 60:return 87;case 61:return 89;case 62:return 90;case 106:return 97}return 0}static _toKeyCodeChord(e){if(!e)return null;if(e instanceof Sc)return e;const t=this._scanCodeToKeyCode(e.scanCode);return t===0?null:new Sc(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,t)}static resolveKeybinding(e,t){const i=Z8(e.chords.map(n=>this._toKeyCodeChord(n)));return i.length>0?[new uS(i,t)]:[]}}let oC=[],Y8=[],mee=[];function PE(o,e=!1){RPe(o,!1,e)}function RPe(o,e,t){const i=MPe(o,e);oC.push(i),i.userConfigured?mee.push(i):Y8.push(i),t&&!i.userConfigured&&oC.forEach(n=>{n.mime===i.mime||n.userConfigured||(i.extension&&n.extension===i.extension&&console.warn(`Overwriting extension <<${i.extension}>> to now point to mime <<${i.mime}>>`),i.filename&&n.filename===i.filename&&console.warn(`Overwriting filename <<${i.filename}>> to now point to mime <<${i.mime}>>`),i.filepattern&&n.filepattern===i.filepattern&&console.warn(`Overwriting filepattern <<${i.filepattern}>> to now point to mime <<${i.mime}>>`),i.firstline&&n.firstline===i.firstline&&console.warn(`Overwriting firstline <<${i.firstline}>> to now point to mime <<${i.mime}>>`))})}function MPe(o,e){return{id:o.id,mime:o.mime,filename:o.filename,extension:o.extension,filepattern:o.filepattern,firstline:o.firstline,userConfigured:e,filenameLowercase:o.filename?o.filename.toLowerCase():void 0,extensionLowercase:o.extension?o.extension.toLowerCase():void 0,filepatternLowercase:o.filepattern?aJ(o.filepattern.toLowerCase()):void 0,filepatternOnPath:o.filepattern?o.filepattern.indexOf(Pi.sep)>=0:!1}}function PPe(){oC=oC.filter(o=>o.userConfigured),Y8=[]}function APe(o,e){return OPe(o,e).map(t=>t.id)}function OPe(o,e){let t;if(o)switch(o.scheme){case we.file:t=o.fsPath;break;case we.data:{t=dh.parseMetaData(o).get(dh.META_DATA_LABEL);break}case we.vscodeNotebookCell:t=void 0;break;default:t=o.path}if(!t)return[{id:"unknown",mime:_i.unknown}];t=t.toLowerCase();const i=nh(t),n=_ee(t,i,mee);if(n)return[n,{id:Fo,mime:_i.text}];const s=_ee(t,i,Y8);if(s)return[s,{id:Fo,mime:_i.text}];if(e){const r=FPe(e);if(r)return[r,{id:Fo,mime:_i.text}]}return[{id:"unknown",mime:_i.unknown}]}function _ee(o,e,t){let i,n,s;for(let r=t.length-1;r>=0;r--){const a=t[r];if(e===a.filenameLowercase){i=a;break}if(a.filepattern&&(!n||a.filepattern.length>n.filepattern.length)){const l=a.filepatternOnPath?o:e;a.filepatternLowercase?.(l)&&(n=a)}a.extension&&(!s||a.extension.length>s.extension.length)&&e.endsWith(a.extensionLowercase)&&(s=a)}if(i)return i;if(n)return n;if(s)return s}function FPe(o){if(yR(o)&&(o=o.substr(1)),o.length>0)for(let e=oC.length-1;e>=0;e--){const t=oC[e];if(!t.firstline)continue;const i=o.match(t.firstline);if(i&&i.length>0)return t}}const AE=Object.prototype.hasOwnProperty,bee="vs.editor.nullLanguage";class WPe{constructor(){this._languageIdToLanguage=[],this._languageToLanguageId=new Map,this._register(bee,0),this._register(Fo,1),this._nextLanguageId=2}_register(e,t){this._languageIdToLanguage[t]=e,this._languageToLanguageId.set(e,t)}register(e){if(this._languageToLanguageId.has(e))return;const t=this._nextLanguageId++;this._register(e,t)}encodeLanguageId(e){return this._languageToLanguageId.get(e)||0}decodeLanguageId(e){return this._languageIdToLanguage[e]||bee}}const FS=class FS extends A{constructor(e=!0,t=!1){super(),this._onDidChange=this._register(new P),this.onDidChange=this._onDidChange.event,FS.instanceCount++,this._warnOnOverwrite=t,this.languageIdCodec=new WPe,this._dynamicLanguages=[],this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},e&&(this._initializeFromRegistry(),this._register(Gm.onDidChangeLanguages(i=>{this._initializeFromRegistry()})))}dispose(){FS.instanceCount--,super.dispose()}_initializeFromRegistry(){this._languages={},this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},PPe();const e=[].concat(Gm.getLanguages()).concat(this._dynamicLanguages);this._registerLanguages(e)}_registerLanguages(e){for(const t of e)this._registerLanguage(t);this._mimeTypesMap={},this._nameMap={},this._lowercaseNameMap={},Object.keys(this._languages).forEach(t=>{const i=this._languages[t];i.name&&(this._nameMap[i.name]=i.identifier),i.aliases.forEach(n=>{this._lowercaseNameMap[n.toLowerCase()]=i.identifier}),i.mimetypes.forEach(n=>{this._mimeTypesMap[n]=i.identifier})}),ei.as(ka.Configuration).registerOverrideIdentifiers(this.getRegisteredLanguageIds()),this._onDidChange.fire()}_registerLanguage(e){const t=e.id;let i;AE.call(this._languages,t)?i=this._languages[t]:(this.languageIdCodec.register(t),i={identifier:t,name:null,mimetypes:[],aliases:[],extensions:[],filenames:[],configurationFiles:[],icons:[]},this._languages[t]=i),this._mergeLanguage(i,e)}_mergeLanguage(e,t){const i=t.id;let n=null;if(Array.isArray(t.mimetypes)&&t.mimetypes.length>0&&(e.mimetypes.push(...t.mimetypes),n=t.mimetypes[0]),n||(n=`text/x-${i}`,e.mimetypes.push(n)),Array.isArray(t.extensions)){t.configuration?e.extensions=t.extensions.concat(e.extensions):e.extensions=e.extensions.concat(t.extensions);for(const a of t.extensions)PE({id:i,mime:n,extension:a},this._warnOnOverwrite)}if(Array.isArray(t.filenames))for(const a of t.filenames)PE({id:i,mime:n,filename:a},this._warnOnOverwrite),e.filenames.push(a);if(Array.isArray(t.filenamePatterns))for(const a of t.filenamePatterns)PE({id:i,mime:n,filepattern:a},this._warnOnOverwrite);if(typeof t.firstLine=="string"&&t.firstLine.length>0){let a=t.firstLine;a.charAt(0)!=="^"&&(a="^"+a);try{const l=new RegExp(a);e6(l)||PE({id:i,mime:n,firstline:l},this._warnOnOverwrite)}catch(l){console.warn(`[${t.id}]: Invalid regular expression \`${a}\`: `,l)}}e.aliases.push(i);let s=null;if(typeof t.aliases<"u"&&Array.isArray(t.aliases)&&(t.aliases.length===0?s=[null]:s=t.aliases),s!==null)for(const a of s)!a||a.length===0||e.aliases.push(a);const r=s!==null&&s.length>0;if(!(r&&s[0]===null)){const a=(r?s[0]:null)||i;(r||!e.name)&&(e.name=a)}t.configuration&&e.configurationFiles.push(t.configuration),t.icon&&e.icons.push(t.icon)}isRegisteredLanguageId(e){return e?AE.call(this._languages,e):!1}getRegisteredLanguageIds(){return Object.keys(this._languages)}getLanguageIdByLanguageName(e){const t=e.toLowerCase();return AE.call(this._lowercaseNameMap,t)?this._lowercaseNameMap[t]:null}getLanguageIdByMimeType(e){return e&&AE.call(this._mimeTypesMap,e)?this._mimeTypesMap[e]:null}guessLanguageIdByFilepathOrFirstLine(e,t){return!e&&!t?[]:APe(e,t)}};FS.instanceCount=0;let X8=FS;const WS=class WS extends A{constructor(e=!1){super(),this._onDidRequestBasicLanguageFeatures=this._register(new P),this.onDidRequestBasicLanguageFeatures=this._onDidRequestBasicLanguageFeatures.event,this._onDidRequestRichLanguageFeatures=this._register(new P),this.onDidRequestRichLanguageFeatures=this._onDidRequestRichLanguageFeatures.event,this._onDidChange=this._register(new P({leakWarningThreshold:200})),this.onDidChange=this._onDidChange.event,this._requestedBasicLanguages=new Set,this._requestedRichLanguages=new Set,WS.instanceCount++,this._registry=this._register(new X8(!0,e)),this.languageIdCodec=this._registry.languageIdCodec,this._register(this._registry.onDidChange(()=>this._onDidChange.fire()))}dispose(){WS.instanceCount--,super.dispose()}isRegisteredLanguageId(e){return this._registry.isRegisteredLanguageId(e)}getLanguageIdByLanguageName(e){return this._registry.getLanguageIdByLanguageName(e)}getLanguageIdByMimeType(e){return this._registry.getLanguageIdByMimeType(e)}guessLanguageIdByFilepathOrFirstLine(e,t){return this._registry.guessLanguageIdByFilepathOrFirstLine(e,t).at(0)??null}createById(e){return new Cee(this.onDidChange,()=>this._createAndGetLanguageIdentifier(e))}createByFilepathOrFirstLine(e,t){return new Cee(this.onDidChange,()=>{const i=this.guessLanguageIdByFilepathOrFirstLine(e,t);return this._createAndGetLanguageIdentifier(i)})}_createAndGetLanguageIdentifier(e){return(!e||!this.isRegisteredLanguageId(e))&&(e=Fo),e}requestBasicLanguageFeatures(e){this._requestedBasicLanguages.has(e)||(this._requestedBasicLanguages.add(e),this._onDidRequestBasicLanguageFeatures.fire(e))}requestRichLanguageFeatures(e){this._requestedRichLanguages.has(e)||(this._requestedRichLanguages.add(e),this.requestBasicLanguageFeatures(e),di.getOrCreate(e),this._onDidRequestRichLanguageFeatures.fire(e))}};WS.instanceCount=0;let Q8=WS;class Cee{constructor(e,t){this._value=rt(this,e,()=>t()),this.onDidChange=ie.fromObservable(this._value)}get languageId(){return this._value.get()}}const J8=/\(&([^\s&])\)|(^|[^&])&([^\s&])/,eW=/(&amp;)?(&amp;)([^\s&])/g;var OE;(function(o){o[o.Right=0]="Right",o[o.Left=1]="Left"})(OE||(OE={}));var tW;(function(o){o[o.Above=0]="Above",o[o.Below=1]="Below"})(tW||(tW={}));class rC extends Ys{constructor(e,t,i,n){e.classList.add("monaco-menu-container"),e.setAttribute("role","presentation");const s=document.createElement("div");s.classList.add("monaco-menu"),s.setAttribute("role","presentation"),super(s,{orientation:1,actionViewItemProvider:c=>this.doGetActionViewItem(c,i,r),context:i.context,actionRunner:i.actionRunner,ariaLabel:i.ariaLabel,ariaRole:"menu",focusOnlyEnabledItems:!0,triggerKeys:{keys:[3,...ze||Ws?[10]:[]],keyDown:!0}}),this.menuStyles=n,this.menuElement=s,this.actionsList.tabIndex=0,this.initializeOrUpdateStyleSheet(e,n),this._register($n.addTarget(s)),this._register(W(s,te.KEY_DOWN,c=>{new St(c).equals(2)&&c.preventDefault()})),i.enableMnemonics&&this._register(W(s,te.KEY_DOWN,c=>{const d=c.key.toLocaleLowerCase();if(this.mnemonics.has(d)){st.stop(c,!0);const h=this.mnemonics.get(d);if(h.length===1&&(h[0]instanceof wee&&h[0].container&&this.focusItemByElement(h[0].container),h[0].onClick(c)),h.length>1){const u=h.shift();u&&u.container&&(this.focusItemByElement(u.container),h.push(u)),this.mnemonics.set(d,h)}}})),Ws&&this._register(W(s,te.KEY_DOWN,c=>{const d=new St(c);d.equals(14)||d.equals(11)?(this.focusedItem=this.viewItems.length-1,this.focusNext(),st.stop(c,!0)):(d.equals(13)||d.equals(12))&&(this.focusedItem=0,this.focusPrevious(),st.stop(c,!0))})),this._register(W(this.domNode,te.MOUSE_OUT,c=>{const d=c.relatedTarget;Zi(d,this.domNode)||(this.focusedItem=void 0,this.updateFocus(),c.stopPropagation())})),this._register(W(this.actionsList,te.MOUSE_OVER,c=>{let d=c.target;if(!(!d||!Zi(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){const h=this.focusedItem;this.setFocusedItem(d),h!==this.focusedItem&&this.updateFocus()}}})),this._register($n.addTarget(this.actionsList)),this._register(W(this.actionsList,Pt.Tap,c=>{let d=c.initialTarget;if(!(!d||!Zi(d,this.actionsList)||d===this.actionsList)){for(;d.parentElement!==this.actionsList&&d.parentElement!==null;)d=d.parentElement;if(d.classList.contains("action-item")){const h=this.focusedItem;this.setFocusedItem(d),h!==this.focusedItem&&this.updateFocus()}}}));const r={parent:this};this.mnemonics=new Map,this.scrollableElement=this._register(new Q1(s,{alwaysConsumeMouseWheel:!0,horizontal:2,vertical:3,verticalScrollbarSize:7,handleMouseWheel:!0,useShadows:!0}));const a=this.scrollableElement.getDomNode();a.style.position="",this.styleScrollElement(a,n),this._register(W(s,Pt.Change,c=>{st.stop(c,!0);const d=this.scrollableElement.getScrollPosition().scrollTop;this.scrollableElement.setScrollPosition({scrollTop:d-c.translationY})})),this._register(W(a,te.MOUSE_UP,c=>{c.preventDefault()}));const l=me(e);s.style.maxHeight=`${Math.max(10,l.innerHeight-e.getBoundingClientRect().top-35)}px`,t=t.filter((c,d)=>i.submenuIds?.has(c.id)?(console.warn(`Found submenu cycle: ${c.id}`),!1):!(c instanceof Xi&&(d===t.length-1||d===0||t[d-1]instanceof Xi))),this.push(t,{icon:!0,label:!0,isMenu:!0}),e.appendChild(this.scrollableElement.getDomNode()),this.scrollableElement.scanDomNode(),this.viewItems.filter(c=>!(c instanceof See)).forEach((c,d,h)=>{c.updatePositionInSet(d+1,h.length)})}initializeOrUpdateStyleSheet(e,t){this.styleSheet||(ky(e)?this.styleSheet=Ir(e):(rC.globalStyleSheet||(rC.globalStyleSheet=Ir()),this.styleSheet=rC.globalStyleSheet)),this.styleSheet.textContent=HPe(t,ky(e))}styleScrollElement(e,t){const i=t.foregroundColor??"",n=t.backgroundColor??"",s=t.borderColor?`1px solid ${t.borderColor}`:"",r="5px",a=t.shadowColor?`0 2px 8px ${t.shadowColor}`:"";e.style.outline=s,e.style.borderRadius=r,e.style.color=i,e.style.backgroundColor=n,e.style.boxShadow=a}getContainer(){return this.scrollableElement.getDomNode()}get onScroll(){return this.scrollableElement.onScroll}focusItemByElement(e){const t=this.focusedItem;this.setFocusedItem(e),t!==this.focusedItem&&this.updateFocus()}setFocusedItem(e){for(let t=0;t<this.actionsList.children.length;t++){const i=this.actionsList.children[t];if(e===i){this.focusedItem=t;break}}}updateFocus(e){super.updateFocus(e,!0,!0),typeof this.focusedItem<"u"&&this.scrollableElement.setScrollPosition({scrollTop:Math.round(this.menuElement.scrollTop)})}doGetActionViewItem(e,t,i){if(e instanceof Xi)return new See(t.context,e,{icon:!0},this.menuStyles);if(e instanceof Bm){const n=new wee(e,e.actions,i,{...t,submenuIds:new Set([...t.submenuIds||[],e.id])},this.menuStyles);if(t.enableMnemonics){const s=n.getMnemonic();if(s&&n.isEnabled()){let r=[];this.mnemonics.has(s)&&(r=this.mnemonics.get(s)),r.push(n),this.mnemonics.set(s,r)}}return n}else{const n=t.getKeyBinding?.(e)?.getLabel(),s={enableMnemonics:t.enableMnemonics,useEventAsContext:t.useEventAsContext,keybinding:n},r=new vee(t.context,e,s,this.menuStyles);if(t.enableMnemonics){const a=r.getMnemonic();if(a&&r.isEnabled()){let l=[];this.mnemonics.has(a)&&(l=this.mnemonics.get(a)),l.push(r),this.mnemonics.set(a,l)}}return r}}}class vee extends Fa{constructor(e,t,i,n){if(i={...i,isMenu:!0,icon:i.icon!==void 0?i.icon:!1,label:i.label!==void 0?i.label:!0},super(t,t,i),this.menuStyle=n,this.options=i,this.cssClass="",this.options.label&&i.enableMnemonics){const s=this.action.label;if(s){const r=J8.exec(s);r&&(this.mnemonic=(r[1]?r[1]:r[3]).toLocaleLowerCase())}}this.runOnceToEnableMouseUp=new wt(()=>{this.element&&(this._register(W(this.element,te.MOUSE_UP,s=>{if(st.stop(s,!0),Fs){if(new yn(me(this.element),s).rightButton)return;this.onClick(s)}else setTimeout(()=>{this.onClick(s)},0)})),this._register(W(this.element,te.CONTEXT_MENU,s=>{st.stop(s,!0)})))},100),this._register(this.runOnceToEnableMouseUp)}render(e){super.render(e),this.element&&(this.container=e,this.item=Z(this.element,Q("a.action-menu-item")),this._action.id===Xi.ID?this.item.setAttribute("role","presentation"):(this.item.setAttribute("role","menuitem"),this.mnemonic&&this.item.setAttribute("aria-keyshortcuts",`${this.mnemonic}`)),this.check=Z(this.item,Q("span.menu-item-check"+ve.asCSSSelector(Y.menuSelection))),this.check.setAttribute("role","none"),this.label=Z(this.item,Q("span.action-label")),this.options.label&&this.options.keybinding&&(Z(this.item,Q("span.keybinding")).textContent=this.options.keybinding),this.runOnceToEnableMouseUp.schedule(),this.updateClass(),this.updateLabel(),this.updateTooltip(),this.updateEnabled(),this.updateChecked(),this.applyStyle())}blur(){super.blur(),this.applyStyle()}focus(){super.focus(),this.item?.focus(),this.applyStyle()}updatePositionInSet(e,t){this.item&&(this.item.setAttribute("aria-posinset",`${e}`),this.item.setAttribute("aria-setsize",`${t}`))}updateLabel(){if(this.label&&this.options.label){pn(this.label);let e=kA(this.action.label);if(e){const t=BPe(e);this.options.enableMnemonics||(e=t),this.label.setAttribute("aria-label",t.replace(/&&/g,"&"));const i=J8.exec(e);if(i){e=qr(e),eW.lastIndex=0;let n=eW.exec(e);for(;n&&n[1];)n=eW.exec(e);const s=r=>r.replace(/&amp;&amp;/g,"&amp;");n?this.label.append(r1(s(e.substr(0,n.index))," "),Q("u",{"aria-hidden":"true"},n[3]),QB(s(e.substr(n.index+n[0].length))," ")):this.label.textContent=s(e).trim(),this.item?.setAttribute("aria-keyshortcuts",(i[1]?i[1]:i[3]).toLocaleLowerCase())}else this.label.textContent=e.replace(/&&/g,"&").trim()}}}updateTooltip(){}updateClass(){this.cssClass&&this.item&&this.item.classList.remove(...this.cssClass.split(" ")),this.options.icon&&this.label?(this.cssClass=this.action.class||"",this.label.classList.add("icon"),this.cssClass&&this.label.classList.add(...this.cssClass.split(" ")),this.updateEnabled()):this.label&&this.label.classList.remove("icon")}updateEnabled(){this.action.enabled?(this.element&&(this.element.classList.remove("disabled"),this.element.removeAttribute("aria-disabled")),this.item&&(this.item.classList.remove("disabled"),this.item.removeAttribute("aria-disabled"),this.item.tabIndex=0)):(this.element&&(this.element.classList.add("disabled"),this.element.setAttribute("aria-disabled","true")),this.item&&(this.item.classList.add("disabled"),this.item.setAttribute("aria-disabled","true")))}updateChecked(){if(!this.item)return;const e=this.action.checked;this.item.classList.toggle("checked",!!e),e!==void 0?(this.item.setAttribute("role","menuitemcheckbox"),this.item.setAttribute("aria-checked",e?"true":"false")):(this.item.setAttribute("role","menuitem"),this.item.setAttribute("aria-checked",""))}getMnemonic(){return this.mnemonic}applyStyle(){const e=this.element&&this.element.classList.contains("focused"),t=e&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor,i=e&&this.menuStyle.selectionBackgroundColor?this.menuStyle.selectionBackgroundColor:void 0,n=e&&this.menuStyle.selectionBorderColor?`1px solid ${this.menuStyle.selectionBorderColor}`:"",s=e&&this.menuStyle.selectionBorderColor?"-1px":"";this.item&&(this.item.style.color=t??"",this.item.style.backgroundColor=i??"",this.item.style.outline=n,this.item.style.outlineOffset=s),this.check&&(this.check.style.color=t??"")}}class wee extends vee{constructor(e,t,i,n,s){super(e,e,n,s),this.submenuActions=t,this.parentData=i,this.submenuOptions=n,this.mysubmenu=null,this.submenuDisposables=this._register(new U),this.mouseOver=!1,this.expandDirection=n&&n.expandDirection!==void 0?n.expandDirection:{horizontal:OE.Right,vertical:tW.Below},this.showScheduler=new wt(()=>{this.mouseOver&&(this.cleanupExistingSubmenu(!1),this.createSubmenu(!1))},250),this.hideScheduler=new wt(()=>{this.element&&!Zi(Ui(),this.element)&&this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))},750)}render(e){super.render(e),this.element&&(this.item&&(this.item.classList.add("monaco-submenu-item"),this.item.tabIndex=0,this.item.setAttribute("aria-haspopup","true"),this.updateAriaExpanded("false"),this.submenuIndicator=Z(this.item,Q("span.submenu-indicator"+ve.asCSSSelector(Y.menuSubmenu))),this.submenuIndicator.setAttribute("aria-hidden","true")),this._register(W(this.element,te.KEY_UP,t=>{const i=new St(t);(i.equals(17)||i.equals(3))&&(st.stop(t,!0),this.createSubmenu(!0))})),this._register(W(this.element,te.KEY_DOWN,t=>{const i=new St(t);Ui()===this.item&&(i.equals(17)||i.equals(3))&&st.stop(t,!0)})),this._register(W(this.element,te.MOUSE_OVER,t=>{this.mouseOver||(this.mouseOver=!0,this.showScheduler.schedule())})),this._register(W(this.element,te.MOUSE_LEAVE,t=>{this.mouseOver=!1})),this._register(W(this.element,te.FOCUS_OUT,t=>{this.element&&!Zi(Ui(),this.element)&&this.hideScheduler.schedule()})),this._register(this.parentData.parent.onScroll(()=>{this.parentData.submenu===this.mysubmenu&&(this.parentData.parent.focus(!1),this.cleanupExistingSubmenu(!0))})))}updateEnabled(){}onClick(e){st.stop(e,!0),this.cleanupExistingSubmenu(!1),this.createSubmenu(!0)}cleanupExistingSubmenu(e){if(this.parentData.submenu&&(e||this.parentData.submenu!==this.mysubmenu)){try{this.parentData.submenu.dispose()}catch{}this.parentData.submenu=void 0,this.updateAriaExpanded("false"),this.submenuContainer&&(this.submenuDisposables.clear(),this.submenuContainer=void 0)}}calculateSubmenuMenuLayout(e,t,i,n){const s={top:0,left:0};return s.left=iC(e.width,t.width,{position:n.horizontal===OE.Right?0:1,offset:i.left,size:i.width}),s.left>=i.left&&s.left<i.left+i.width&&(i.left+10+t.width<=e.width&&(s.left=i.left+10),i.top+=10,i.height=0),s.top=iC(e.height,t.height,{position:0,offset:i.top,size:0}),s.top+t.height===i.top&&s.top+i.height+t.height<=e.height&&(s.top+=i.height),s}createSubmenu(e=!0){if(this.element)if(this.parentData.submenu)this.parentData.submenu.focus(!1);else{this.updateAriaExpanded("true"),this.submenuContainer=Z(this.element,Q("div.monaco-submenu")),this.submenuContainer.classList.add("menubar-menu-items-holder","context-view");const t=me(this.parentData.parent.domNode).getComputedStyle(this.parentData.parent.domNode),i=parseFloat(t.paddingTop||"0")||0;this.submenuContainer.style.position="fixed",this.submenuContainer.style.top="0",this.submenuContainer.style.left="0",this.submenuContainer.style.zIndex="1",this.parentData.submenu=new rC(this.submenuContainer,this.submenuActions.length?this.submenuActions:[new r2],this.submenuOptions,this.menuStyle);const n=this.element.getBoundingClientRect(),s={top:n.top-i,left:n.left,height:n.height+2*i,width:n.width},r=this.submenuContainer.getBoundingClientRect(),a=me(this.element),{top:l,left:c}=this.calculateSubmenuMenuLayout(new dt(a.innerWidth,a.innerHeight),dt.lift(r),s,this.expandDirection);this.submenuContainer.style.left=`${c-r.left}px`,this.submenuContainer.style.top=`${l-r.top}px`,this.submenuDisposables.add(W(this.submenuContainer,te.KEY_UP,d=>{new St(d).equals(15)&&(st.stop(d,!0),this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0))})),this.submenuDisposables.add(W(this.submenuContainer,te.KEY_DOWN,d=>{new St(d).equals(15)&&st.stop(d,!0)})),this.submenuDisposables.add(this.parentData.submenu.onDidCancel(()=>{this.parentData.parent.focus(),this.cleanupExistingSubmenu(!0)})),this.parentData.submenu.focus(e),this.mysubmenu=this.parentData.submenu}}updateAriaExpanded(e){this.item&&this.item?.setAttribute("aria-expanded",e)}applyStyle(){super.applyStyle();const t=this.element&&this.element.classList.contains("focused")&&this.menuStyle.selectionForegroundColor?this.menuStyle.selectionForegroundColor:this.menuStyle.foregroundColor;this.submenuIndicator&&(this.submenuIndicator.style.color=t??"")}dispose(){super.dispose(),this.hideScheduler.dispose(),this.mysubmenu&&(this.mysubmenu.dispose(),this.mysubmenu=null),this.submenuContainer&&(this.submenuContainer=void 0)}}class See extends z_{constructor(e,t,i,n){super(e,t,i),this.menuStyles=n}render(e){super.render(e),this.label&&(this.label.style.borderBottomColor=this.menuStyles.separatorColor?`${this.menuStyles.separatorColor}`:"")}}function BPe(o){const e=J8,t=e.exec(o);if(!t)return o;const i=!t[1];return o.replace(e,i?"$2$3":"").trim()}function yee(o){const e=mH()[o.id];return`.codicon-${o.id}:before { content: '\\${e.toString(16)}'; }`}function HPe(o,e){let t=`
.monaco-menu {
font-size: 13px;
border-radius: 5px;
min-width: 160px;
}
${yee(Y.menuSelection)}
${yee(Y.menuSubmenu)}
.monaco-menu .monaco-action-bar {
text-align: right;
overflow: hidden;
white-space: nowrap;
}
.monaco-menu .monaco-action-bar .actions-container {
display: flex;
margin: 0 auto;
padding: 0;
width: 100%;
justify-content: flex-end;
}
.monaco-menu .monaco-action-bar.vertical .actions-container {
display: inline-block;
}
.monaco-menu .monaco-action-bar.reverse .actions-container {
flex-direction: row-reverse;
}
.monaco-menu .monaco-action-bar .action-item {
cursor: pointer;
display: inline-block;
transition: transform 50ms ease;
position: relative; /* DO NOT REMOVE - this is the key to preventing the ghosting icon bug in Chrome 42 */
}
.monaco-menu .monaco-action-bar .action-item.disabled {
cursor: default;
}
.monaco-menu .monaco-action-bar .action-item .icon,
.monaco-menu .monaco-action-bar .action-item .codicon {
display: inline-block;
}
.monaco-menu .monaco-action-bar .action-item .codicon {
display: flex;
align-items: center;
}
.monaco-menu .monaco-action-bar .action-label {
font-size: 11px;
margin-right: 4px;
}
.monaco-menu .monaco-action-bar .action-item.disabled .action-label,
.monaco-menu .monaco-action-bar .action-item.disabled .action-label:hover {
color: var(--vscode-disabledForeground);
}
/* Vertical actions */
.monaco-menu .monaco-action-bar.vertical {
text-align: left;
}
.monaco-menu .monaco-action-bar.vertical .action-item {
display: block;
}
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
display: block;
border-bottom: 1px solid var(--vscode-menu-separatorBackground);
padding-top: 1px;
padding: 30px;
}
.monaco-menu .secondary-actions .monaco-action-bar .action-label {
margin-left: 6px;
}
/* Action Items */
.monaco-menu .monaco-action-bar .action-item.select-container {
overflow: hidden; /* somehow the dropdown overflows its container, we prevent it here to not push */
flex: 1;
max-width: 170px;
min-width: 60px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10px;
}
.monaco-menu .monaco-action-bar.vertical {
margin-left: 0;
overflow: visible;
}
.monaco-menu .monaco-action-bar.vertical .actions-container {
display: block;
}
.monaco-menu .monaco-action-bar.vertical .action-item {
padding: 0;
transform: none;
display: flex;
}
.monaco-menu .monaco-action-bar.vertical .action-item.active {
transform: none;
}
.monaco-menu .monaco-action-bar.vertical .action-menu-item {
flex: 1 1 auto;
display: flex;
height: 2em;
align-items: center;
position: relative;
margin: 0 4px;
border-radius: 4px;
}
.monaco-menu .monaco-action-bar.vertical .action-menu-item:hover .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .keybinding {
opacity: unset;
}
.monaco-menu .monaco-action-bar.vertical .action-label {
flex: 1 1 auto;
text-decoration: none;
padding: 0 1em;
background: none;
font-size: 12px;
line-height: 1;
}
.monaco-menu .monaco-action-bar.vertical .keybinding,
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
display: inline-block;
flex: 2 1 auto;
padding: 0 1em;
text-align: right;
font-size: 12px;
line-height: 1;
opacity: 0.7;
}
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
height: 100%;
}
.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon {
font-size: 16px !important;
display: flex;
align-items: center;
}
.monaco-menu .monaco-action-bar.vertical .submenu-indicator.codicon::before {
margin-left: auto;
margin-right: -20px;
}
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .keybinding,
.monaco-menu .monaco-action-bar.vertical .action-item.disabled .submenu-indicator {
opacity: 0.4;
}
.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator) {
display: inline-block;
box-sizing: border-box;
margin: 0;
}
.monaco-menu .monaco-action-bar.vertical .action-item {
position: static;
overflow: visible;
}
.monaco-menu .monaco-action-bar.vertical .action-item .monaco-submenu {
position: absolute;
}
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
width: 100%;
height: 0px !important;
opacity: 1;
}
.monaco-menu .monaco-action-bar.vertical .action-label.separator.text {
padding: 0.7em 1em 0.1em 1em;
font-weight: bold;
opacity: 1;
}
.monaco-menu .monaco-action-bar.vertical .action-label:hover {
color: inherit;
}
.monaco-menu .monaco-action-bar.vertical .menu-item-check {
position: absolute;
visibility: hidden;
width: 1em;
height: 100%;
}
.monaco-menu .monaco-action-bar.vertical .action-menu-item.checked .menu-item-check {
visibility: visible;
display: flex;
align-items: center;
justify-content: center;
}
/* Context Menu */
.context-view.monaco-menu-container {
outline: 0;
border: none;
animation: fadeIn 0.083s linear;
-webkit-app-region: no-drag;
}
.context-view.monaco-menu-container :focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical:focus,
.context-view.monaco-menu-container .monaco-action-bar.vertical :focus {
outline: 0;
}
.hc-black .context-view.monaco-menu-container,
.hc-light .context-view.monaco-menu-container,
:host-context(.hc-black) .context-view.monaco-menu-container,
:host-context(.hc-light) .context-view.monaco-menu-container {
box-shadow: none;
}
.hc-black .monaco-menu .monaco-action-bar.vertical .action-item.focused,
.hc-light .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-black) .monaco-menu .monaco-action-bar.vertical .action-item.focused,
:host-context(.hc-light) .monaco-menu .monaco-action-bar.vertical .action-item.focused {
background: none;
}
/* Vertical Action Bar Styles */
.monaco-menu .monaco-action-bar.vertical {
padding: 4px 0;
}
.monaco-menu .monaco-action-bar.vertical .action-menu-item {
height: 2em;
}
.monaco-menu .monaco-action-bar.vertical .action-label:not(.separator),
.monaco-menu .monaco-action-bar.vertical .keybinding {
font-size: inherit;
padding: 0 2em;
max-height: 100%;
}
.monaco-menu .monaco-action-bar.vertical .menu-item-check {
font-size: inherit;
width: 2em;
}
.monaco-menu .monaco-action-bar.vertical .action-label.separator {
font-size: inherit;
margin: 5px 0 !important;
padding: 0;
border-radius: 0;
}
.linux .monaco-menu .monaco-action-bar.vertical .action-label.separator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .action-label.separator {
margin-left: 0;
margin-right: 0;
}
.monaco-menu .monaco-action-bar.vertical .submenu-indicator {
font-size: 60%;
padding: 0 1.8em;
}
.linux .monaco-menu .monaco-action-bar.vertical .submenu-indicator,
:host-context(.linux) .monaco-menu .monaco-action-bar.vertical .submenu-indicator {
height: 100%;
mask-size: 10px 10px;
-webkit-mask-size: 10px 10px;
}
.monaco-menu .action-item {
cursor: default;
}`;if(e){t+=`
/* Arrows */
.monaco-scrollable-element > .scrollbar > .scra {
cursor: pointer;
font-size: 11px !important;
}
.monaco-scrollable-element > .visible {
opacity: 1;
/* Background rule added for IE9 - to allow clicks on dom node */
background:rgba(0,0,0,0);
transition: opacity 100ms linear;
}
.monaco-scrollable-element > .invisible {
opacity: 0;
pointer-events: none;
}
.monaco-scrollable-element > .invisible.fade {
transition: opacity 800ms linear;
}
/* Scrollable Content Inset Shadow */
.monaco-scrollable-element > .shadow {
position: absolute;
display: none;
}
.monaco-scrollable-element > .shadow.top {
display: block;
top: 0;
left: 3px;
height: 3px;
width: 100%;
}
.monaco-scrollable-element > .shadow.left {
display: block;
top: 3px;
left: 0;
height: 100%;
width: 3px;
}
.monaco-scrollable-element > .shadow.top-left-corner {
display: block;
top: 0;
left: 0;
height: 3px;
width: 3px;
}
/* Fix for https://github.com/microsoft/vscode/issues/103170 */
.monaco-menu .action-item .monaco-submenu {
z-index: 1;
}
`;const i=o.scrollbarShadow;i&&(t+=`
.monaco-scrollable-element > .shadow.top {
box-shadow: ${i} 0 6px 6px -6px inset;
}
.monaco-scrollable-element > .shadow.left {
box-shadow: ${i} 6px 0 6px -6px inset;
}
.monaco-scrollable-element > .shadow.top.left {
box-shadow: ${i} 6px 6px 6px -6px inset;
}
`);const n=o.scrollbarSliderBackground;n&&(t+=`
.monaco-scrollable-element > .scrollbar > .slider {
background: ${n};
}
`);const s=o.scrollbarSliderHoverBackground;s&&(t+=`
.monaco-scrollable-element > .scrollbar > .slider:hover {
background: ${s};
}
`);const r=o.scrollbarSliderActiveBackground;r&&(t+=`
.monaco-scrollable-element > .scrollbar > .slider.active {
background: ${r};
}
`)}return t}class VPe{constructor(e,t,i,n){this.contextViewService=e,this.telemetryService=t,this.notificationService=i,this.keybindingService=n,this.focusToReturn=null,this.lastContainer=null,this.block=null,this.blockDisposable=null,this.options={blockMouse:!0}}configure(e){this.options=e}showContextMenu(e){const t=e.getActions();if(!t.length)return;this.focusToReturn=Ui();let i;const n=ai(e.domForShadowRoot)?e.domForShadowRoot:void 0;this.contextViewService.showContextView({getAnchor:()=>e.getAnchor(),canRelayout:!1,anchorAlignment:e.anchorAlignment,anchorAxisAlignment:e.anchorAxisAlignment,layer:e.layer,render:s=>{this.lastContainer=s;const r=e.getMenuClassName?e.getMenuClassName():"";r&&(s.className+=" "+r),this.options.blockMouse&&(this.block=s.appendChild(Q(".context-view-block")),this.block.style.position="fixed",this.block.style.cursor="initial",this.block.style.left="0",this.block.style.top="0",this.block.style.width="100%",this.block.style.height="100%",this.block.style.zIndex="-1",this.blockDisposable?.dispose(),this.blockDisposable=W(this.block,te.MOUSE_DOWN,d=>d.stopPropagation()));const a=new U,l=e.actionRunner||a.add(new hf);l.onWillRun(d=>this.onActionRun(d,!e.skipTelemetry),this,a),l.onDidRun(this.onDidActionRun,this,a),i=new rC(s,t,{actionViewItemProvider:e.getActionViewItem,context:e.getActionsContext?e.getActionsContext():null,actionRunner:l,getKeyBinding:e.getKeyBinding?e.getKeyBinding:d=>this.keybindingService.lookupKeybinding(d.id)},z1e),i.onDidCancel(()=>this.contextViewService.hideContextView(!0),null,a),i.onDidBlur(()=>this.contextViewService.hideContextView(!0),null,a);const c=me(s);return a.add(W(c,te.BLUR,()=>this.contextViewService.hideContextView(!0))),a.add(W(c,te.MOUSE_DOWN,d=>{if(d.defaultPrevented)return;const h=new yn(c,d);let u=h.target;if(!h.rightButton){for(;u;){if(u===s)return;u=u.parentElement}this.contextViewService.hideContextView(!0)}})),jr(a,i)},focus:()=>{i?.focus(!!e.autoSelectFirstItem)},onHide:s=>{e.onHide?.(!!s),this.block&&(this.block.remove(),this.block=null),this.blockDisposable?.dispose(),this.blockDisposable=null,this.lastContainer&&(Ui()===this.lastContainer||Zi(Ui(),this.lastContainer))&&this.focusToReturn?.focus(),this.lastContainer=null}},n,!!n)}onActionRun(e,t){t&&this.telemetryService.publicLog2("workbenchActionExecuted",{id:e.action.id,from:"contextMenu"}),this.contextViewService.hideContextView(!1)}onDidActionRun(e){e.error&&!Do(e.error)&&this.notificationService.error(e.error)}}var zPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},aC=function(o,e){return function(t,i){e(t,i,o)}};let iW=class extends A{get contextMenuHandler(){return this._contextMenuHandler||(this._contextMenuHandler=new VPe(this.contextViewService,this.telemetryService,this.notificationService,this.keybindingService)),this._contextMenuHandler}constructor(e,t,i,n,s,r){super(),this.telemetryService=e,this.notificationService=t,this.contextViewService=i,this.keybindingService=n,this.menuService=s,this.contextKeyService=r,this._contextMenuHandler=void 0,this._onDidShowContextMenu=this._store.add(new P),this.onDidShowContextMenu=this._onDidShowContextMenu.event,this._onDidHideContextMenu=this._store.add(new P),this.onDidHideContextMenu=this._onDidHideContextMenu.event}configure(e){this.contextMenuHandler.configure(e)}showContextMenu(e){e=nW.transform(e,this.menuService,this.contextKeyService),this.contextMenuHandler.showContextMenu({...e,onHide:t=>{e.onHide?.(t),this._onDidHideContextMenu.fire()}}),Pc.getInstance().resetKeyStatus(),this._onDidShowContextMenu.fire()}};iW=zPe([aC(0,Vn),aC(1,hi),aC(2,hd),aC(3,ot),aC(4,Cr),aC(5,xe)],iW);var nW;(function(o){function e(i){return i&&i.menuId instanceof de}function t(i,n,s){if(!e(i))return i;const{menuId:r,menuActionOptions:a,contextKeyService:l}=i;return{...i,getActions:()=>{let c=[];if(r){const d=n.getMenuActions(r,l??s,a);c=q1e(d)}return i.getActions?Xi.join(i.getActions(),c):c}}}o.transform=t})(nW||(nW={}));var FE;(function(o){o[o.API=0]="API",o[o.USER=1]="USER"})(FE||(FE={}));var sW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},WE=function(o,e){return function(t,i){e(t,i,o)}};let oW=class{constructor(e){this._commandService=e}async open(e,t){if(!fy(e,we.command))return!1;if(!t?.allowCommands||(typeof e=="string"&&(e=be.parse(e)),Array.isArray(t.allowCommands)&&!t.allowCommands.includes(e.path)))return!0;let i=[];try{i=BA(decodeURIComponent(e.query))}catch{try{i=BA(e.query)}catch{}}return Array.isArray(i)||(i=[i]),await this._commandService.executeCommand(e.path,...i),!0}};oW=sW([WE(0,Tt)],oW);let rW=class{constructor(e){this._editorService=e}async open(e,t){typeof e=="string"&&(e=be.parse(e));const{selection:i,uri:n}=Bve(e);return e=n,e.scheme===we.file&&(e=Zse(e)),await this._editorService.openCodeEditor({resource:e,options:{selection:i,source:t?.fromUserGesture?FE.USER:FE.API,...t?.editorOptions}},this._editorService.getFocusedCodeEditor(),t?.openToSide),!0}};rW=sW([WE(0,et)],rW);let aW=class{constructor(e,t){this._openers=new Jn,this._validators=new Jn,this._resolvers=new Jn,this._resolvedUriTargets=new Li(i=>i.with({path:null,fragment:null,query:null}).toString()),this._externalOpeners=new Jn,this._defaultExternalOpener={openExternal:async i=>(DR(i,we.http,we.https)?aH(i):bt.location.href=i,!0)},this._openers.push({open:async(i,n)=>n?.openExternal||DR(i,we.mailto,we.http,we.https,we.vsls)?(await this._doOpenExternal(i,n),!0):!1}),this._openers.push(new oW(t)),this._openers.push(new rW(e))}registerOpener(e){return{dispose:this._openers.unshift(e)}}async open(e,t){if(!t?.skipValidation){const i=typeof e=="string"?be.parse(e):e,n=this._resolvedUriTargets.get(i)??e;for(const s of this._validators)if(!await s.shouldOpen(n,t))return!1}for(const i of this._openers)if(await i.open(e,t))return!0;return!1}async resolveExternalUri(e,t){for(const i of this._resolvers)try{const n=await i.resolveExternalUri(e,t);if(n)return this._resolvedUriTargets.has(n.resolved)||this._resolvedUriTargets.set(n.resolved,e),n}catch{}throw new Error("Could not resolve external URI: "+e.toString())}async _doOpenExternal(e,t){const i=typeof e=="string"?be.parse(e):e;let n;try{n=(await this.resolveExternalUri(i,t)).resolved}catch{n=i}let s;if(typeof e=="string"&&i.toString()===n.toString()?s=e:s=encodeURI(n.toString(!0)),t?.allowContributedOpeners){const r=typeof t?.allowContributedOpeners=="string"?t?.allowContributedOpeners:void 0;for(const a of this._externalOpeners)if(await a.openExternal(s,{sourceUri:i,preferredOpenerId:r},He.None))return!0}return this._defaultExternalOpener.openExternal(s,{sourceUri:i},He.None)}dispose(){this._validators.clear()}};aW=sW([WE(0,et),WE(1,Tt)],aW);var UPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Lee=function(o,e){return function(t,i){e(t,i,o)}};let lW=class extends A{constructor(e,t){super(),this._markerService=t,this._onDidChangeMarker=this._register(new P),this._suppressedRanges=new Li,this._markerDecorations=new Li,e.getModels().forEach(i=>this._onModelAdded(i)),this._register(e.onModelAdded(this._onModelAdded,this)),this._register(e.onModelRemoved(this._onModelRemoved,this)),this._register(this._markerService.onMarkerChanged(this._handleMarkerChange,this))}dispose(){super.dispose(),this._markerDecorations.forEach(e=>e.dispose()),this._markerDecorations.clear()}getMarker(e,t){const i=this._markerDecorations.get(e);return i&&i.getMarker(t)||null}_handleMarkerChange(e){e.forEach(t=>{const i=this._markerDecorations.get(t);i&&this._updateDecorations(i)})}_onModelAdded(e){const t=new $Pe(e);this._markerDecorations.set(e.uri,t),this._updateDecorations(t)}_onModelRemoved(e){const t=this._markerDecorations.get(e.uri);t&&(t.dispose(),this._markerDecorations.delete(e.uri)),(e.uri.scheme===we.inMemory||e.uri.scheme===we.internal||e.uri.scheme===we.vscode)&&this._markerService?.read({resource:e.uri}).map(i=>i.owner).forEach(i=>this._markerService.remove(i,[e.uri]))}_updateDecorations(e){let t=this._markerService.read({resource:e.model.uri,take:500});const i=this._suppressedRanges.get(e.model.uri);i&&(t=t.filter(n=>!Ye.some(i,s=>k.areIntersectingOrTouching(s,n)))),e.update(t)&&this._onDidChangeMarker.fire(e.model)}};lW=UPe([Lee(0,Qt),Lee(1,zl)],lW);class $Pe extends A{constructor(e){super(),this.model=e,this._map=new Use,this._register(ue(()=>{this.model.deltaDecorations([...this._map.values()],[]),this._map.clear()}))}update(e){const{added:t,removed:i}=Jge(new Set(this._map.keys()),new Set(e));if(t.length===0&&i.length===0)return!1;const n=i.map(a=>this._map.get(a)),s=t.map(a=>({range:this._createDecorationRange(this.model,a),options:this._createDecorationOption(a)})),r=this.model.deltaDecorations(n,s);for(const a of i)this._map.delete(a);for(let a=0;a<r.length;a++)this._map.set(t[a],r[a]);return!0}getMarker(e){return this._map.getKey(e.id)}_createDecorationRange(e,t){let i=k.lift(t);if(t.severity===oi.Hint&&!this._hasMarkerTag(t,1)&&!this._hasMarkerTag(t,2)&&(i=i.setEndPosition(i.startLineNumber,i.startColumn+2)),i=e.validateRange(i),i.isEmpty()){const n=e.getLineLastNonWhitespaceColumn(i.startLineNumber)||e.getLineMaxColumn(i.startLineNumber);if(n===1||i.endColumn>=n)return i;const s=e.getWordAtPosition(i.getStartPosition());s&&(i=new k(i.startLineNumber,s.startColumn,i.endLineNumber,s.endColumn))}else if(t.endColumn===Number.MAX_VALUE&&t.startColumn===1&&i.startLineNumber===i.endLineNumber){const n=e.getLineFirstNonWhitespaceColumn(t.startLineNumber);n<i.endColumn&&(i=new k(i.startLineNumber,n,i.endLineNumber,i.endColumn),t.startColumn=n)}return i}_createDecorationOption(e){let t,i,n,s,r;switch(e.severity){case oi.Hint:this._hasMarkerTag(e,2)?t=void 0:this._hasMarkerTag(e,1)?t="squiggly-unnecessary":t="squiggly-hint",n=0;break;case oi.Info:t="squiggly-info",i=ci(ihe),n=10,r={color:ci(gle),position:1};break;case oi.Warning:t="squiggly-warning",i=ci(the),n=20,r={color:ci(ple),position:1};break;case oi.Error:default:t="squiggly-error",i=ci(ehe),n=30,r={color:ci(mle),position:1};break}return e.tags&&(e.tags.indexOf(1)!==-1&&(s="squiggly-inline-unnecessary"),e.tags.indexOf(2)!==-1&&(s="squiggly-inline-deprecated")),{description:"marker-decoration",stickiness:1,className:t,showIfCollapsed:!0,overviewRuler:{color:i,position:Ao.Right},minimap:r,zIndex:n,inlineClassName:s}}_hasMarkerTag(e,t){return e.tags?e.tags.indexOf(t)>=0:!1}}var jPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},BE=function(o,e){return function(t,i){e(t,i,o)}},lC;function up(o){return o.toString()}class qPe{constructor(e,t,i){this.model=e,this._modelEventListeners=new U,this.model=e,this._modelEventListeners.add(e.onWillDispose(()=>t(e))),this._modelEventListeners.add(e.onDidChangeLanguage(n=>i(e,n)))}dispose(){this._modelEventListeners.dispose()}}const KPe=Ws||ze?1:2;class GPe{constructor(e,t,i,n,s,r,a,l){this.uri=e,this.initialUndoRedoSnapshot=t,this.time=i,this.sharesUndoRedoStack=n,this.heapSize=s,this.sha1=r,this.versionId=a,this.alternativeVersionId=l}}let cW=(vm=class extends A{constructor(e,t,i,n){super(),this._configurationService=e,this._resourcePropertiesService=t,this._undoRedoService=i,this._instantiationService=n,this._onModelAdded=this._register(new P),this.onModelAdded=this._onModelAdded.event,this._onModelRemoved=this._register(new P),this.onModelRemoved=this._onModelRemoved.event,this._onModelModeChanged=this._register(new P),this.onModelLanguageChanged=this._onModelModeChanged.event,this._modelCreationOptionsByLanguageAndResource=Object.create(null),this._models={},this._disposedModels=new Map,this._disposedModelsHeapSize=0,this._register(this._configurationService.onDidChangeConfiguration(s=>this._updateModelOptions(s))),this._updateModelOptions(void 0)}static _readModelOptions(e,t){let i=Un.tabSize;if(e.editor&&typeof e.editor.tabSize<"u"){const u=parseInt(e.editor.tabSize,10);isNaN(u)||(i=u),i<1&&(i=1)}let n="tabSize";if(e.editor&&typeof e.editor.indentSize<"u"&&e.editor.indentSize!=="tabSize"){const u=parseInt(e.editor.indentSize,10);isNaN(u)||(n=Math.max(u,1))}let s=Un.insertSpaces;e.editor&&typeof e.editor.insertSpaces<"u"&&(s=e.editor.insertSpaces==="false"?!1:!!e.editor.insertSpaces);let r=KPe;const a=e.eol;a===`\r
`?r=2:a===`
`&&(r=1);let l=Un.trimAutoWhitespace;e.editor&&typeof e.editor.trimAutoWhitespace<"u"&&(l=e.editor.trimAutoWhitespace==="false"?!1:!!e.editor.trimAutoWhitespace);let c=Un.detectIndentation;e.editor&&typeof e.editor.detectIndentation<"u"&&(c=e.editor.detectIndentation==="false"?!1:!!e.editor.detectIndentation);let d=Un.largeFileOptimizations;e.editor&&typeof e.editor.largeFileOptimizations<"u"&&(d=e.editor.largeFileOptimizations==="false"?!1:!!e.editor.largeFileOptimizations);let h=Un.bracketPairColorizationOptions;return e.editor?.bracketPairColorization&&typeof e.editor.bracketPairColorization=="object"&&(h={enabled:!!e.editor.bracketPairColorization.enabled,independentColorPoolPerBracketType:!!e.editor.bracketPairColorization.independentColorPoolPerBracketType}),{isForSimpleWidget:t,tabSize:i,indentSize:n,insertSpaces:s,detectIndentation:c,defaultEOL:r,trimAutoWhitespace:l,largeFileOptimizations:d,bracketPairColorizationOptions:h}}_getEOL(e,t){if(e)return this._resourcePropertiesService.getEOL(e,t);const i=this._configurationService.getValue("files.eol",{overrideIdentifier:t});return i&&typeof i=="string"&&i!=="auto"?i:so===3||so===2?`
`:`\r
`}_shouldRestoreUndoStack(){const e=this._configurationService.getValue("files.restoreUndoStack");return typeof e=="boolean"?e:!0}getCreationOptions(e,t,i){const n=typeof e=="string"?e:e.languageId;let s=this._modelCreationOptionsByLanguageAndResource[n+t];if(!s){const r=this._configurationService.getValue("editor",{overrideIdentifier:n,resource:t}),a=this._getEOL(t,n);s=lC._readModelOptions({editor:r,eol:a},i),this._modelCreationOptionsByLanguageAndResource[n+t]=s}return s}_updateModelOptions(e){const t=this._modelCreationOptionsByLanguageAndResource;this._modelCreationOptionsByLanguageAndResource=Object.create(null);const i=Object.keys(this._models);for(let n=0,s=i.length;n<s;n++){const r=i[n],a=this._models[r],l=a.model.getLanguageId(),c=a.model.uri;if(e&&!e.affectsConfiguration("editor",{overrideIdentifier:l,resource:c})&&!e.affectsConfiguration("files.eol",{overrideIdentifier:l,resource:c}))continue;const d=t[l+c],h=this.getCreationOptions(l,c,a.model.isForSimpleWidget);lC._setModelOptionsForModel(a.model,h,d)}}static _setModelOptionsForModel(e,t,i){i&&i.defaultEOL!==t.defaultEOL&&e.getLineCount()===1&&e.setEOL(t.defaultEOL===1?0:1),!(i&&i.detectIndentation===t.detectIndentation&&i.insertSpaces===t.insertSpaces&&i.tabSize===t.tabSize&&i.indentSize===t.indentSize&&i.trimAutoWhitespace===t.trimAutoWhitespace&&fo(i.bracketPairColorizationOptions,t.bracketPairColorizationOptions))&&(t.detectIndentation?(e.detectIndentation(t.insertSpaces,t.tabSize),e.updateOptions({trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions})):e.updateOptions({insertSpaces:t.insertSpaces,tabSize:t.tabSize,indentSize:t.indentSize,trimAutoWhitespace:t.trimAutoWhitespace,bracketColorizationOptions:t.bracketPairColorizationOptions}))}_insertDisposedModel(e){this._disposedModels.set(up(e.uri),e),this._disposedModelsHeapSize+=e.heapSize}_removeDisposedModel(e){const t=this._disposedModels.get(up(e));return t&&(this._disposedModelsHeapSize-=t.heapSize),this._disposedModels.delete(up(e)),t}_ensureDisposedModelsHeapSize(e){if(this._disposedModelsHeapSize>e){const t=[];for(this._disposedModels.forEach(i=>{i.sharesUndoRedoStack||t.push(i)}),t.sort((i,n)=>i.time-n.time);t.length>0&&this._disposedModelsHeapSize>e;){const i=t.shift();this._removeDisposedModel(i.uri),i.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(i.initialUndoRedoSnapshot)}}}_createModelData(e,t,i,n){const s=this.getCreationOptions(t,i,n),r=this._instantiationService.createInstance(Jf,e,t,s,i);if(i&&this._disposedModels.has(up(i))){const c=this._removeDisposedModel(i),d=this._undoRedoService.getElements(i),h=this._getSHA1Computer(),u=h.canComputeSHA1(r)?h.computeSHA1(r)===c.sha1:!1;if(u||c.sharesUndoRedoStack){for(const f of d.past)Zc(f)&&f.matchesResource(i)&&f.setModel(r);for(const f of d.future)Zc(f)&&f.matchesResource(i)&&f.setModel(r);this._undoRedoService.setElementsValidFlag(i,!0,f=>Zc(f)&&f.matchesResource(i)),u&&(r._overwriteVersionId(c.versionId),r._overwriteAlternativeVersionId(c.alternativeVersionId),r._overwriteInitialUndoRedoSnapshot(c.initialUndoRedoSnapshot))}else c.initialUndoRedoSnapshot!==null&&this._undoRedoService.restoreSnapshot(c.initialUndoRedoSnapshot)}const a=up(r.uri);if(this._models[a])throw new Error("ModelService: Cannot add model because it already exists!");const l=new qPe(r,c=>this._onWillDispose(c),(c,d)=>this._onDidChangeLanguage(c,d));return this._models[a]=l,l}createModel(e,t,i,n=!1){let s;return t?s=this._createModelData(e,t,i,n):s=this._createModelData(e,Fo,i,n),this._onModelAdded.fire(s.model),s.model}getModels(){const e=[],t=Object.keys(this._models);for(let i=0,n=t.length;i<n;i++){const s=t[i];e.push(this._models[s].model)}return e}getModel(e){const t=up(e),i=this._models[t];return i?i.model:null}_schemaShouldMaintainUndoRedoElements(e){return e.scheme===we.file||e.scheme===we.vscodeRemote||e.scheme===we.vscodeUserData||e.scheme===we.vscodeNotebookCell||e.scheme==="fake-fs"}_onWillDispose(e){const t=up(e.uri),i=this._models[t],n=this._undoRedoService.getUriComparisonKey(e.uri)!==e.uri.toString();let s=!1,r=0;if(n||this._shouldRestoreUndoStack()&&this._schemaShouldMaintainUndoRedoElements(e.uri)){const c=this._undoRedoService.getElements(e.uri);if(c.past.length>0||c.future.length>0){for(const d of c.past)Zc(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri));for(const d of c.future)Zc(d)&&d.matchesResource(e.uri)&&(s=!0,r+=d.heapSize(e.uri),d.setModel(e.uri))}}const a=lC.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK,l=this._getSHA1Computer();if(s)if(!n&&(r>a||!l.canComputeSHA1(e))){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}else this._ensureDisposedModelsHeapSize(a-r),this._undoRedoService.setElementsValidFlag(e.uri,!1,c=>Zc(c)&&c.matchesResource(e.uri)),this._insertDisposedModel(new GPe(e.uri,i.model.getInitialUndoRedoSnapshot(),Date.now(),n,r,l.computeSHA1(e),e.getVersionId(),e.getAlternativeVersionId()));else if(!n){const c=i.model.getInitialUndoRedoSnapshot();c!==null&&this._undoRedoService.restoreSnapshot(c)}delete this._models[t],i.dispose(),delete this._modelCreationOptionsByLanguageAndResource[e.getLanguageId()+e.uri],this._onModelRemoved.fire(e)}_onDidChangeLanguage(e,t){const i=t.oldLanguage,n=e.getLanguageId(),s=this.getCreationOptions(i,e.uri,e.isForSimpleWidget),r=this.getCreationOptions(n,e.uri,e.isForSimpleWidget);lC._setModelOptionsForModel(e,r,s),this._onModelModeChanged.fire({model:e,oldLanguageId:i})}_getSHA1Computer(){return new dW}},lC=vm,vm.MAX_MEMORY_FOR_CLOSED_FILES_UNDO_STACK=20*1024*1024,vm);cW=lC=jPe([BE(0,Me),BE(1,NQ),BE(2,ZP),BE(3,ge)],cW);const kT=class kT{canComputeSHA1(e){return e.getValueLength()<=kT.MAX_MODEL_SIZE}computeSHA1(e){const t=new PR,i=e.createSnapshot();let n;for(;n=i.read();)t.update(n);return t.digest()}};kT.MAX_MODEL_SIZE=10*1024*1024;let dW=kT;var ZPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},xee=function(o,e){return function(t,i){e(t,i,o)}};let hW=class extends A{constructor(e,t){super(),this.quickInputService=e,this.instantiationService=t,this.registry=ei.as(sp.Quickaccess),this.mapProviderToDescriptor=new Map,this.lastAcceptedPickerValues=new Map,this.visibleQuickAccess=void 0,this._register(ue(()=>{for(const i of this.mapProviderToDescriptor.values())Xu(i)&&i.dispose();this.visibleQuickAccess?.picker.dispose()}))}show(e="",t){this.doShowOrPick(e,!1,t)}doShowOrPick(e,t,i){const[n,s]=this.getOrInstantiateProvider(e,i?.enabledProviderPrefixes),r=this.visibleQuickAccess,a=r?.descriptor;if(r&&s&&a===s){e!==s.prefix&&!i?.preserveValue&&(r.picker.value=e),this.adjustValueSelection(r.picker,s,i);return}if(s&&!i?.preserveValue){let g;if(r&&a&&a!==s){const m=r.value.substr(a.prefix.length);m&&(g=`${s.prefix}${m}`)}if(!g){const m=n?.defaultFilterValue;m===b9.LAST?g=this.lastAcceptedPickerValues.get(s):typeof m=="string"&&(g=`${s.prefix}${m}`)}typeof g=="string"&&(e=g)}const l=r?.picker?.valueSelection,c=r?.picker?.value,d=new U,h=d.add(this.quickInputService.createQuickPick({useSeparators:!0}));h.value=e,this.adjustValueSelection(h,s,i),h.placeholder=i?.placeholder??s?.placeholder,h.quickNavigate=i?.quickNavigateConfiguration,h.hideInput=!!h.quickNavigate&&!r,(typeof i?.itemActivation=="number"||i?.quickNavigateConfiguration)&&(h.itemActivation=i?.itemActivation??Ha.SECOND),h.contextKey=s?.contextKey,h.filterValue=g=>g.substring(s?s.prefix.length:0);let u;t&&(u=new Ju,d.add(ie.once(h.onWillAccept)(g=>{g.veto(),h.hide()}))),d.add(this.registerPickerListeners(h,n,s,e,i));const f=d.add(new Xt);if(n&&d.add(n.provide(h,f.token,i?.providerOptions)),ie.once(h.onDidHide)(()=>{h.selectedItems.length===0&&f.cancel(),d.dispose(),u?.complete(h.selectedItems.slice(0))}),h.show(),l&&c===e&&(h.valueSelection=l),t)return u?.p}adjustValueSelection(e,t,i){let n;i?.preserveValue?n=[e.value.length,e.value.length]:n=[t?.prefix.length??0,e.value.length],e.valueSelection=n}registerPickerListeners(e,t,i,n,s){const r=new U,a=this.visibleQuickAccess={picker:e,descriptor:i,value:n};return r.add(ue(()=>{a===this.visibleQuickAccess&&(this.visibleQuickAccess=void 0)})),r.add(e.onDidChangeValue(l=>{const[c]=this.getOrInstantiateProvider(l,s?.enabledProviderPrefixes);c!==t?this.show(l,{enabledProviderPrefixes:s?.enabledProviderPrefixes,preserveValue:!0,providerOptions:s?.providerOptions}):a.value=l})),i&&r.add(e.onDidAccept(()=>{this.lastAcceptedPickerValues.set(i,e.value)})),r}getOrInstantiateProvider(e,t){const i=this.registry.getQuickAccessProvider(e);if(!i||t&&!t?.includes(i.prefix))return[void 0,void 0];let n=this.mapProviderToDescriptor.get(i);return n||(n=this.instantiationService.createInstance(i.ctor),this.mapProviderToDescriptor.set(i,n)),[n,i]}};hW=ZPe([xee(0,Zn),xee(1,ge)],hW);var YPe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s};class kee{constructor(e){this.nodes=e}toString(){return this.nodes.map(e=>typeof e=="string"?e:e.label).join("")}}YPe([vi],kee.prototype,"toString",null);const XPe=/\[([^\]]+)\]\(((?:https?:\/\/|command:|file:)[^\)\s]+)(?: (["'])(.+?)(\3))?\)/gi;function QPe(o){const e=[];let t=0,i;for(;i=XPe.exec(o);){i.index-t>0&&e.push(o.substring(t,i.index));const[,n,s,,r]=i;r?e.push({label:n,href:s,title:r}):e.push({label:n,href:s}),t=i.index+i[0].length}return t<o.length&&e.push(o.substring(t)),new kee(e)}const uW={},JPe=new EA("quick-input-button-icon-");function eAe(o){if(!o)return;let e;const t=o.dark.toString();return uW[t]?e=uW[t]:(e=JPe.nextId(),_L(`.${e}, .hc-light .${e}`,`background-image: ${Nl(o.light||o.dark)}`),_L(`.vs-dark .${e}, .hc-black .${e}`,`background-image: ${Nl(o.dark)}`),uW[t]=e),e}function cC(o,e,t){let i=o.iconClass||eAe(o.iconPath);return o.alwaysVisible&&(i=i?`${i} always-visible`:"always-visible"),{id:e,label:"",tooltip:o.tooltip||"",class:i,enabled:!0,run:t}}function tAe(o,e,t){Yi(e);const i=QPe(o);let n=0;for(const s of i.nodes)if(typeof s=="string")e.append(...Fh(s));else{let r=s.title;!r&&s.href.startsWith("command:")?r=p(1754,"Click to execute command '{0}'",s.href.substring(8)):r||(r=s.href);const a=Q("a",{href:s.href,title:r,tabIndex:n++},s.label);a.style.textDecoration="underline";const l=f=>{sse(f)&&st.stop(f,!0),t.callback(s.href)},c=t.disposables.add(new gt(a,te.CLICK)).event,d=t.disposables.add(new gt(a,te.KEY_DOWN)).event,h=ie.chain(d,f=>f.filter(g=>{const m=new St(g);return m.equals(10)||m.equals(3)}));t.disposables.add($n.addTarget(a));const u=t.disposables.add(new gt(a,Pt.Tap)).event;ie.any(c,u,h)(l,null,t.disposables),e.appendChild(a)}}var iAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Iee=function(o,e){return function(t,i){e(t,i,o)}};const Dee="inQuickInput",nAe=new ae(Dee,!1,p(1731,"Whether keyboard focus is inside the quick input control")),HE=K.has(Dee),sAe="quickInputAlignment",oAe=new ae(sAe,"top",p(1732,"The alignment of the quick input")),fS="quickInputType",rAe=new ae(fS,void 0,p(1733,"The type of the currently visible quick input")),Eee="cursorAtEndOfQuickInputBox",aAe=new ae(Eee,!1,p(1734,"Whether the cursor in the quick input is at the end of the input box")),lAe=K.has(Eee),fW={iconClass:ve.asClassName(Y.quickInputBack),tooltip:p(1735,"Back")},IT=class IT extends A{constructor(e){super(),this.ui=e,this._visible=Le("visible",!1),this._widgetUpdated=!1,this._enabled=!0,this._busy=!1,this._ignoreFocusOut=!1,this._leftButtons=[],this._rightButtons=[],this._inlineButtons=[],this.buttonsUpdated=!1,this._toggles=[],this.togglesUpdated=!1,this.noValidationMessage=IT.noPromptMessage,this._severity=ii.Ignore,this.onDidTriggerButtonEmitter=this._register(new P),this.onDidHideEmitter=this._register(new P),this.onWillHideEmitter=this._register(new P),this.onDisposeEmitter=this._register(new P),this.visibleDisposables=this._register(new U),this.onDidHide=this.onDidHideEmitter.event}get visible(){return this._visible.get()}get title(){return this._title}set title(e){this._title=e,this.update()}get description(){return this._description}set description(e){this._description=e,this.update()}get step(){return this._steps}set step(e){this._steps=e,this.update()}get totalSteps(){return this._totalSteps}set totalSteps(e){this._totalSteps=e,this.update()}get enabled(){return this._enabled}set enabled(e){this._enabled=e,this.update()}get contextKey(){return this._contextKey}set contextKey(e){this._contextKey=e,this.update()}get busy(){return this._busy}set busy(e){this._busy=e,this.update()}get ignoreFocusOut(){return this._ignoreFocusOut}set ignoreFocusOut(e){const t=this._ignoreFocusOut!==e&&!ur;this._ignoreFocusOut=e&&!ur,t&&this.update()}get titleButtons(){return this._leftButtons.length?[...this._leftButtons,this._rightButtons]:this._rightButtons}get buttons(){return[...this._leftButtons,...this._rightButtons,...this._inlineButtons]}set buttons(e){this._leftButtons=e.filter(t=>t===fW),this._rightButtons=e.filter(t=>t!==fW&&t.location!==kk.Inline),this._inlineButtons=e.filter(t=>t.location===kk.Inline),this.buttonsUpdated=!0,this.update()}get toggles(){return this._toggles}set toggles(e){this._toggles=e??[],this.togglesUpdated=!0,this.update()}get validationMessage(){return this._validationMessage}set validationMessage(e){this._validationMessage=e,this.update()}get severity(){return this._severity}set severity(e){this._severity=e,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.onDidTriggerButton(e=>{this.buttons.indexOf(e)!==-1&&this.onDidTriggerButtonEmitter.fire(e)})),this.ui.show(this),this._visible.set(!0,void 0),this._lastValidationMessage=void 0,this._lastSeverity=void 0,this.buttons.length&&(this.buttonsUpdated=!0),this.toggles.length&&(this.togglesUpdated=!0),this.update())}hide(){this.visible&&this.ui.hide()}didHide(e=Sw.Other){this._visible.set(!1,void 0),this.visibleDisposables.clear(),this.onDidHideEmitter.fire({reason:e})}willHide(e=Sw.Other){this.onWillHideEmitter.fire({reason:e})}update(){if(!this.visible)return;const e=this.getTitle();e&&this.ui.title.textContent!==e?this.ui.title.textContent=e:!e&&this.ui.title.innerHTML!=="&nbsp;"&&(this.ui.title.innerText=" ");const t=this.getDescription();if(this.ui.description1.textContent!==t&&(this.ui.description1.textContent=t),this.ui.description2.textContent!==t&&(this.ui.description2.textContent=t),this._widgetUpdated&&(this._widgetUpdated=!1,this._widget?Yi(this.ui.widget,this._widget):Yi(this.ui.widget)),this.busy&&!this.busyDelay&&(this.busyDelay=new No,this.busyDelay.setIfNotSet(()=>{this.visible&&this.ui.progressBar.infinite()},800)),!this.busy&&this.busyDelay&&(this.ui.progressBar.stop(),this.busyDelay.cancel(),this.busyDelay=void 0),this.buttonsUpdated){this.buttonsUpdated=!1,this.ui.leftActionBar.clear();const n=this._leftButtons.map((a,l)=>cC(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.leftActionBar.push(n,{icon:!0,label:!1}),this.ui.rightActionBar.clear();const s=this._rightButtons.map((a,l)=>cC(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.rightActionBar.push(s,{icon:!0,label:!1}),this.ui.inlineActionBar.clear();const r=this._inlineButtons.map((a,l)=>cC(a,`id-${l}`,async()=>this.onDidTriggerButtonEmitter.fire(a)));this.ui.inlineActionBar.push(r,{icon:!0,label:!1})}if(this.togglesUpdated){this.togglesUpdated=!1;const n=this.toggles?.filter(s=>s instanceof Gh)??[];this.ui.inputBox.toggles=n}this.ui.ignoreFocusOut=this.ignoreFocusOut,this.ui.setEnabled(this.enabled),this.ui.setContextKey(this.contextKey);const i=this.validationMessage||this.noValidationMessage;this._lastValidationMessage!==i&&(this._lastValidationMessage=i,Yi(this.ui.message),tAe(i,this.ui.message,{callback:n=>{this.ui.linkOpenerDelegate(n)},disposables:this.visibleDisposables})),this._lastSeverity!==this.severity&&(this._lastSeverity=this.severity,this.showMessageDecoration(this.severity))}getTitle(){return this.title&&this.step?`${this.title} (${this.getSteps()})`:this.title?this.title:this.step?this.getSteps():""}getDescription(){return this.description||""}getSteps(){return this.step&&this.totalSteps?p(1737,"{0}/{1}",this.step,this.totalSteps):this.step?String(this.step):""}showMessageDecoration(e){if(this.ui.inputBox.showDecoration(e),e!==ii.Ignore){const t=this.ui.inputBox.stylesForType(e);this.ui.message.style.color=t.foreground?`${t.foreground}`:"",this.ui.message.style.backgroundColor=t.background?`${t.background}`:"",this.ui.message.style.border=t.border?`1px solid ${t.border}`:"",this.ui.message.style.marginBottom="-2px"}else this.ui.message.style.color="",this.ui.message.style.backgroundColor="",this.ui.message.style.border="",this.ui.message.style.marginBottom=""}dispose(){this.hide(),this.onDisposeEmitter.fire(),super.dispose()}};IT.noPromptMessage=p(1736,"Press 'Enter' to confirm your input or 'Escape' to cancel");let gS=IT;const DT=class DT extends gS{constructor(){super(...arguments),this._value="",this.onDidChangeValueEmitter=this._register(new P),this.onWillAcceptEmitter=this._register(new P),this.onDidAcceptEmitter=this._register(new P),this.onDidCustomEmitter=this._register(new P),this._items=[],this.itemsUpdated=!1,this._canSelectMany=!1,this._canAcceptInBackground=!1,this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._keepScrollPosition=!1,this._itemActivation=Ha.FIRST,this._activeItems=[],this.activeItemsUpdated=!1,this.activeItemsToConfirm=[],this.onDidChangeActiveEmitter=this._register(new P),this._selectedItems=[],this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=[],this.onDidChangeSelectionEmitter=this._register(new P),this.onDidTriggerItemButtonEmitter=this._register(new P),this.onDidTriggerSeparatorButtonEmitter=this._register(new P),this.valueSelectionUpdated=!0,this._ok="default",this._customButton=!1,this._focusEventBufferer=new i1,this.type="quickPick",this.filterValue=e=>e,this.onDidChangeValue=this.onDidChangeValueEmitter.event,this.onWillAccept=this.onWillAcceptEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event,this.onDidChangeActive=this.onDidChangeActiveEmitter.event,this.onDidChangeSelection=this.onDidChangeSelectionEmitter.event,this.onDidTriggerItemButton=this.onDidTriggerItemButtonEmitter.event,this.onDidTriggerSeparatorButton=this.onDidTriggerSeparatorButtonEmitter.event}get quickNavigate(){return this._quickNavigate}set quickNavigate(e){this._quickNavigate=e,this.update()}get value(){return this._value}set value(e){this.doSetValue(e)}doSetValue(e,t){this._value!==e&&(this._value=e,t||this.update(),this.visible&&this.ui.list.filter(this.filterValue(this._value))&&this.trySelectFirst(),this.onDidChangeValueEmitter.fire(this._value))}set ariaLabel(e){this._ariaLabel=e,this.update()}get ariaLabel(){return this._ariaLabel}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get items(){return this._items}get scrollTop(){return this.ui.list.scrollTop}set scrollTop(e){this.ui.list.scrollTop=e}set items(e){this._items=e,this.itemsUpdated=!0,this.update()}get canSelectMany(){return this._canSelectMany}set canSelectMany(e){this._canSelectMany=e,this.update()}get canAcceptInBackground(){return this._canAcceptInBackground}set canAcceptInBackground(e){this._canAcceptInBackground=e}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e,this.update()}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e,this.update()}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e,this.update()}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e,this.update()}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e,this.update()}get keepScrollPosition(){return this._keepScrollPosition}set keepScrollPosition(e){this._keepScrollPosition=e}get itemActivation(){return this._itemActivation}set itemActivation(e){this._itemActivation=e}get activeItems(){return this._activeItems}set activeItems(e){this._activeItems=e,this.activeItemsUpdated=!0,this.update()}get selectedItems(){return this._selectedItems}set selectedItems(e){this._selectedItems=e,this.selectedItemsUpdated=!0,this.update()}get keyMods(){return this._quickNavigate?Eve:this.ui.keyMods}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get customButton(){return this._customButton}set customButton(e){this._customButton=e,this.update()}get customLabel(){return this._customButtonLabel}set customLabel(e){this._customButtonLabel=e,this.update()}get customHover(){return this._customButtonHover}set customHover(e){this._customButtonHover=e,this.update()}get ok(){return this._ok}set ok(e){this._ok=e,this.update()}get okLabel(){return this._okLabel??p(1739,"OK")}set okLabel(e){this._okLabel=e,this.update()}get hideInput(){return!!this._hideInput}set hideInput(e){this._hideInput=e,this.update()}trySelectFirst(){this.canSelectMany||this.ui.list.focus(Bt.First)}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{this.doSetValue(e,!0)})),this.visibleDisposables.add(this.ui.onDidAccept(()=>{this.canSelectMany?this.ui.list.getCheckedElements().length||(this._selectedItems=[],this.onDidChangeSelectionEmitter.fire(this.selectedItems)):this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(!1)})),this.visibleDisposables.add(this.ui.onDidCustom(()=>{this.onDidCustomEmitter.fire()})),this.visibleDisposables.add(this._focusEventBufferer.wrapEvent(this.ui.list.onDidChangeFocus,(e,t)=>t)(e=>{this.activeItemsUpdated||this.activeItemsToConfirm!==this._activeItems&&Ut(e,this._activeItems,(t,i)=>t===i)||(this._activeItems=e,this.onDidChangeActiveEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onDidChangeSelection(({items:e,event:t})=>{if(this.canSelectMany&&!e.some(i=>i.pickable===!1)){e.length&&this.ui.list.setSelectedElements([]);return}this.selectedItemsToConfirm!==this._selectedItems&&Ut(e,this._selectedItems,(i,n)=>i===n)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e),e.length&&this.handleAccept(i2(t)&&t.button===1))})),this.visibleDisposables.add(this.ui.list.onChangedCheckedElements(e=>{!this.canSelectMany||!this.visible||this.selectedItemsToConfirm!==this._selectedItems&&Ut(e,this._selectedItems,(t,i)=>t===i)||(this._selectedItems=e,this.onDidChangeSelectionEmitter.fire(e))})),this.visibleDisposables.add(this.ui.list.onButtonTriggered(e=>this.onDidTriggerItemButtonEmitter.fire(e))),this.visibleDisposables.add(this.ui.list.onSeparatorButtonTriggered(e=>this.onDidTriggerSeparatorButtonEmitter.fire(e))),this.visibleDisposables.add(this.registerQuickNavigation()),this.valueSelectionUpdated=!0),super.show()}handleAccept(e){let t=!1;this.onWillAcceptEmitter.fire({veto:()=>t=!0}),t||this.onDidAcceptEmitter.fire({inBackground:e})}registerQuickNavigation(){return W(this.ui.container,te.KEY_UP,e=>{if(this.canSelectMany||!this._quickNavigate)return;const t=new St(e),i=t.keyCode;this._quickNavigate.keybindings.some(r=>{const a=r.getChords();return a.length>1?!1:a[0].shiftKey&&i===4?!(t.ctrlKey||t.altKey||t.metaKey):!!(a[0].altKey&&i===6||a[0].ctrlKey&&i===5||a[0].metaKey&&i===57)})&&(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems),this.handleAccept(!1)),this._quickNavigate=void 0)})}update(){if(!this.visible)return;const e=this.keepScrollPosition?this.scrollTop:0,t=!!this.description,i={title:!!this.title||!!this.step||!!this.titleButtons.length,description:t,checkAll:this.canSelectMany&&!this._hideCheckAll,checkBox:this.canSelectMany,inputBox:!this._hideInput,progressBar:!this._hideInput||t,visibleCount:!0,count:this.canSelectMany&&!this._hideCountBadge,ok:this.ok==="default"?this.canSelectMany:this.ok,list:!0,message:!!this.validationMessage,customButton:this.customButton};this.ui.setVisibilities(i),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||"");let n=this.ariaLabel;!n&&i.inputBox&&(n=this.placeholder,this.title&&(n=n?`${n} - ${this.title}`:this.title),n||(n=DT.DEFAULT_ARIA_LABEL)),this.ui.list.ariaLabel!==n&&(this.ui.list.ariaLabel=n??null),this.ui.inputBox.ariaLabel!==n&&(this.ui.inputBox.ariaLabel=n??"input"),this.ui.list.matchOnDescription=this.matchOnDescription,this.ui.list.matchOnDetail=this.matchOnDetail,this.ui.list.matchOnLabel=this.matchOnLabel,this.ui.list.matchOnLabelMode=this.matchOnLabelMode,this.ui.list.sortByLabel=this.sortByLabel,this.itemsUpdated&&(this.itemsUpdated=!1,this._focusEventBufferer.bufferEvents(()=>{switch(this.ui.list.setElements(this.items),this.ui.list.shouldLoop=!this.canSelectMany,this.ui.list.filter(this.filterValue(this.ui.inputBox.value)),this._itemActivation){case Ha.NONE:this._itemActivation=Ha.FIRST;break;case Ha.SECOND:this.ui.list.focus(Bt.Second),this._itemActivation=Ha.FIRST;break;case Ha.LAST:this.ui.list.focus(Bt.Last),this._itemActivation=Ha.FIRST;break;default:this.trySelectFirst();break}})),this.ui.container.classList.contains("show-checkboxes")!==!!this.canSelectMany&&(this.canSelectMany?this.ui.list.clearFocus():this.trySelectFirst()),this.activeItemsUpdated&&(this.activeItemsUpdated=!1,this.activeItemsToConfirm=this._activeItems,this.ui.list.setFocusedElements(this.activeItems),this.activeItemsToConfirm===this._activeItems&&(this.activeItemsToConfirm=null)),this.selectedItemsUpdated&&(this.selectedItemsUpdated=!1,this.selectedItemsToConfirm=this._selectedItems,this.canSelectMany?this.ui.list.setCheckedElements(this.selectedItems):this.ui.list.setSelectedElements(this.selectedItems),this.selectedItemsToConfirm===this._selectedItems&&(this.selectedItemsToConfirm=null)),this.ui.ok.label=this.okLabel||"",this.ui.customButton.label=this.customLabel||"",this.ui.customButton.element.title=this.customHover||"",i.inputBox||(this.ui.list.domFocus(),this.canSelectMany&&this.ui.list.focus(Bt.First)),this.keepScrollPosition&&(this.scrollTop=e)}focus(e){this.ui.list.focus(e),this.canSelectMany&&this.ui.list.domFocus()}accept(e){e&&!this._canAcceptInBackground||(this.activeItems[0]&&(this._selectedItems=[this.activeItems[0]],this.onDidChangeSelectionEmitter.fire(this.selectedItems)),this.handleAccept(e??!1))}};DT.DEFAULT_ARIA_LABEL=p(1738,"Type to narrow down results.");let pS=DT;class cAe extends gS{constructor(){super(...arguments),this._value="",this.valueSelectionUpdated=!0,this._password=!1,this.onDidValueChangeEmitter=this._register(new P),this.onDidAcceptEmitter=this._register(new P),this.type="inputBox",this.onDidChangeValue=this.onDidValueChangeEmitter.event,this.onDidAccept=this.onDidAcceptEmitter.event}get value(){return this._value}set value(e){this._value=e||"",this.update()}get valueSelection(){const e=this.ui.inputBox.getSelection();if(e)return[e.start,e.end]}set valueSelection(e){this._valueSelection=e,this.valueSelectionUpdated=!0,this.update()}get placeholder(){return this._placeholder}set placeholder(e){this._placeholder=e,this.update()}get ariaLabel(){return this._ariaLabel}set ariaLabel(e){this._ariaLabel=e,this.update()}get password(){return this._password}set password(e){this._password=e,this.update()}get prompt(){return this._prompt}set prompt(e){this._prompt=e,this.noValidationMessage=e?p(1740,"{0} (Press 'Enter' to confirm or 'Escape' to cancel)",e):gS.noPromptMessage,this.update()}show(){this.visible||(this.visibleDisposables.add(this.ui.inputBox.onDidChange(e=>{e!==this.value&&(this._value=e,this.onDidValueChangeEmitter.fire(e))})),this.visibleDisposables.add(this.ui.onDidAccept(()=>this.onDidAcceptEmitter.fire())),this.valueSelectionUpdated=!0),super.show()}accept(){this.onDidAcceptEmitter.fire()}update(){if(!this.visible)return;this.ui.container.classList.remove("hidden-input");const e={title:!!this.title||!!this.step||!!this.titleButtons.length,description:!!this.description||!!this.step,inputBox:!0,message:!0,progressBar:!0};this.ui.setVisibilities(e),super.update(),this.ui.inputBox.value!==this.value&&(this.ui.inputBox.value=this.value),this.valueSelectionUpdated&&(this.valueSelectionUpdated=!1,this.ui.inputBox.select(this._valueSelection&&{start:this._valueSelection[0],end:this._valueSelection[1]})),this.ui.inputBox.placeholder!==(this.placeholder||"")&&(this.ui.inputBox.placeholder=this.placeholder||""),this.ui.inputBox.password!==this.password&&(this.ui.inputBox.password=this.password);let t=this.ariaLabel;!t&&e.inputBox&&(t=this.placeholder?this.title?`${this.placeholder} - ${this.title}`:this.placeholder:this.title?this.title:"input"),this.ui.inputBox.ariaLabel!==t&&(this.ui.inputBox.ariaLabel=t||"input")}}let gW=class extends Q_{constructor(e,t){super("mouse",void 0,i=>this.getOverrideOptions(i),e,t)}getOverrideOptions(e){const t=(ai(e.content)?e.content.textContent??"":typeof e.content=="string"?e.content:e.content.value).includes(`
`);return{persistence:{hideOnKeyDown:!1},appearance:{showHoverHint:t,skipFadeInAnimation:!0}}}};gW=iAe([Iee(0,Me),Iee(1,Qs)],gW);const Nee="done",Tee="active",pW="infinite",mW="infinite-long-running",Ree="discrete",ET=class ET extends A{constructor(e,t){super(),this.progressSignal=this._register(new ct),this.workedVal=0,this.showDelayedScheduler=this._register(new wt(()=>uo(this.element),0)),this.longRunningScheduler=this._register(new wt(()=>this.infiniteLongRunning(),ET.LONG_RUNNING_INFINITE_THRESHOLD)),this.create(e,t)}create(e,t){this.element=document.createElement("div"),this.element.classList.add("monaco-progress-container"),this.element.setAttribute("role","progressbar"),this.element.setAttribute("aria-valuemin","0"),e.appendChild(this.element),this.bit=document.createElement("div"),this.bit.classList.add("progress-bit"),this.bit.style.backgroundColor=t?.progressBarBackground||"#0E70C0",this.element.appendChild(this.bit)}off(){this.bit.style.width="inherit",this.bit.style.opacity="1",this.element.classList.remove(Tee,pW,mW,Ree),this.workedVal=0,this.totalWork=void 0,this.longRunningScheduler.cancel(),this.progressSignal.clear()}stop(){return this.doDone(!1)}doDone(e){return this.element.classList.add(Nee),this.element.classList.contains(pW)?(this.bit.style.opacity="0",e?setTimeout(()=>this.off(),200):this.off()):(this.bit.style.width="inherit",e?setTimeout(()=>this.off(),200):this.off()),this}infinite(){return this.bit.style.width="2%",this.bit.style.opacity="1",this.element.classList.remove(Ree,Nee,mW),this.element.classList.add(Tee,pW),this.longRunningScheduler.schedule(),this}infiniteLongRunning(){this.element.classList.add(mW)}getContainer(){return this.element}};ET.LONG_RUNNING_INFINITE_THRESHOLD=1e4;let _W=ET;const dAe=Q;class hAe extends A{constructor(e,t,i){super(),this.parent=e,this.onDidChange=s=>this.findInput.onDidChange(s),this.container=Z(this.parent,dAe(".quick-input-box")),this.findInput=this._register(new fZ(this.container,void 0,{label:"",inputBoxStyles:t,toggleStyles:i}));const n=this.findInput.inputBox.inputElement;n.role="textbox",n.ariaHasPopup="menu",n.ariaAutoComplete="list"}get onKeyDown(){return this.findInput.onKeyDown}get value(){return this.findInput.getValue()}set value(e){this.findInput.setValue(e)}select(e=null){this.findInput.inputBox.select(e)}getSelection(){return this.findInput.inputBox.getSelection()}isSelectionAtEnd(){return this.findInput.inputBox.isSelectionAtEnd()}get placeholder(){return this.findInput.inputBox.inputElement.getAttribute("placeholder")||""}set placeholder(e){this.findInput.inputBox.setPlaceHolder(e)}get password(){return this.findInput.inputBox.inputElement.type==="password"}set password(e){this.findInput.inputBox.inputElement.type=e?"password":"text"}set enabled(e){this.findInput.inputBox.inputElement.toggleAttribute("readonly",!e)}set toggles(e){this.findInput.setAdditionalToggles(e)}get ariaLabel(){return this.findInput.inputBox.inputElement.getAttribute("aria-label")||""}set ariaLabel(e){this.findInput.inputBox.inputElement.setAttribute("aria-label",e)}hasFocus(){return this.findInput.inputBox.hasFocus()}setAttribute(e,t){this.findInput.inputBox.inputElement.setAttribute(e,t)}removeAttribute(e){this.findInput.inputBox.inputElement.removeAttribute(e)}showDecoration(e){e===ii.Ignore?this.findInput.clearMessage():this.findInput.showMessage({type:e===ii.Info?1:e===ii.Warning?2:3,content:""})}stylesForType(e){return this.findInput.inputBox.stylesForType(e===ii.Info?1:e===ii.Warning?2:3)}setFocus(){this.findInput.focus()}layout(){this.findInput.inputBox.layout()}}const Mee=new Ln(()=>{const o=Sf.Collator(void 0,{numeric:!0,sensitivity:"base"}).value;return{collator:o,collatorIsNumeric:o.resolvedOptions().numeric}});new Ln(()=>({collator:Sf.Collator(void 0,{numeric:!0}).value})),new Ln(()=>({collator:Sf.Collator(void 0,{numeric:!0,sensitivity:"accent"}).value}));function uAe(o,e,t=!1){const i=o||"",n=e||"",s=Mee.value.collator.compare(i,n);return Mee.value.collatorIsNumeric&&s===0&&i!==n?i<n?-1:1:s}function fAe(o,e,t){const i=o.toLowerCase(),n=e.toLowerCase(),s=gAe(o,e,t);if(s)return s;const r=i.endsWith(t),a=n.endsWith(t);if(r!==a)return r?-1:1;const l=uAe(i,n);return l!==0?l:i.localeCompare(n)}function gAe(o,e,t){const i=o.toLowerCase(),n=e.toLowerCase(),s=i.startsWith(t),r=n.startsWith(t);if(s!==r)return s?-1:1;if(s&&r){if(i.length<n.length)return-1;if(i.length>n.length)return 1}return 0}var VE=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},bW=function(o,e){return function(t,i){e(t,i,o)}},CW;const nc=Q;class Pee{constructor(e,t,i){this.index=e,this.hasCheckbox=t,this._hidden=!1,this._init=new Ln(()=>{const n=i.label??"",s=cg(n).text.trim(),r=i.ariaLabel||[n,this.saneDescription,this.saneDetail].map(a=>pj(a)).filter(a=>!!a).join(", ");return{saneLabel:n,saneSortLabel:s,saneAriaLabel:r}}),this._saneDescription=i.description,this._saneTooltip=i.tooltip}get saneLabel(){return this._init.value.saneLabel}get saneSortLabel(){return this._init.value.saneSortLabel}get saneAriaLabel(){return this._init.value.saneAriaLabel}get element(){return this._element}set element(e){this._element=e}get hidden(){return this._hidden}set hidden(e){this._hidden=e}get saneDescription(){return this._saneDescription}set saneDescription(e){this._saneDescription=e}get saneDetail(){return this._saneDetail}set saneDetail(e){this._saneDetail=e}get saneTooltip(){return this._saneTooltip}set saneTooltip(e){this._saneTooltip=e}get labelHighlights(){return this._labelHighlights}set labelHighlights(e){this._labelHighlights=e}get descriptionHighlights(){return this._descriptionHighlights}set descriptionHighlights(e){this._descriptionHighlights=e}get detailHighlights(){return this._detailHighlights}set detailHighlights(e){this._detailHighlights=e}}class An extends Pee{constructor(e,t,i,n,s,r,a){super(e,i,r),this.childIndex=t,this.fireButtonTriggered=n,this._onChecked=s,this.item=r,this._separator=a,this._checked=!1,this.onChecked=i?ie.map(ie.filter(this._onChecked.event,l=>l.element===this),l=>l.checked):ie.None,this._saneDetail=r.detail,this._labelHighlights=r.highlights?.label,this._descriptionHighlights=r.highlights?.description,this._detailHighlights=r.highlights?.detail}get separator(){return this._separator}set separator(e){this._separator=e}get checked(){return this._checked}set checked(e){e!==this._checked&&(this._checked=e,this._onChecked.fire({element:this,checked:e}))}get checkboxDisabled(){return!!this.item.disabled}}var sc;(function(o){o[o.NONE=0]="NONE",o[o.MOUSE_HOVER=1]="MOUSE_HOVER",o[o.ACTIVE_ITEM=2]="ACTIVE_ITEM"})(sc||(sc={}));class fp extends Pee{constructor(e,t,i){super(e,!1,i),this.fireSeparatorButtonTriggered=t,this.separator=i,this.children=new Array,this.focusInsideSeparator=sc.NONE}}class pAe{getHeight(e){return e instanceof fp?30:e.saneDetail?44:22}getTemplateId(e){return e instanceof An?zE.ID:UE.ID}}class mAe{getWidgetAriaLabel(){return p(1753,"Quick Input")}getAriaLabel(e){return e.separator?.label?`${e.saneAriaLabel}, ${e.separator.label}`:e.saneAriaLabel}getWidgetRole(){return"listbox"}getRole(e){return e.hasCheckbox?"checkbox":"option"}isChecked(e){if(!(!e.hasCheckbox||!(e instanceof An)))return{get value(){return e.checked},onDidChange:t=>e.onChecked(()=>t())}}}class Aee{constructor(e){this.hoverDelegate=e}renderTemplate(e){const t=Object.create(null);t.toDisposeElement=new U,t.toDisposeTemplate=new U,t.entry=Z(e,nc(".quick-input-list-entry"));const i=Z(t.entry,nc("label.quick-input-list-label"));t.outerLabel=i,t.checkbox=t.toDisposeTemplate.add(new ct),t.toDisposeTemplate.add(Si(i,te.CLICK,c=>{if(t.checkbox.value&&!c.defaultPrevented&&t.checkbox.value.enabled){const d=!t.checkbox.value.checked;t.checkbox.value.checked=d,t.element.checked=d}}));const n=Z(i,nc(".quick-input-list-rows")),s=Z(n,nc(".quick-input-list-row")),r=Z(n,nc(".quick-input-list-row"));t.label=new qw(s,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.label),t.icon=Dy(t.label.element,nc(".quick-input-list-icon"));const a=Z(s,nc(".quick-input-list-entry-keybinding"));t.keybinding=new nb(a,so),t.toDisposeTemplate.add(t.keybinding);const l=Z(r,nc(".quick-input-list-label-meta"));return t.detail=new qw(l,{supportHighlights:!0,supportIcons:!0,hoverDelegate:this.hoverDelegate}),t.toDisposeTemplate.add(t.detail),t.separator=Z(t.entry,nc(".quick-input-list-separator")),t.actionBar=new Ys(t.entry,this.hoverDelegate?{hoverDelegate:this.hoverDelegate}:void 0),t.actionBar.domNode.classList.add("quick-input-list-entry-action-bar"),t.toDisposeTemplate.add(t.actionBar),t}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}disposeElement(e,t,i){i.toDisposeElement.clear(),i.actionBar.clear()}}let zE=(wm=class extends Aee{constructor(e,t){super(e),this.themeService=t,this._itemsWithSeparatorsFrequency=new Map}get templateId(){return CW.ID}ensureCheckbox(e,t){if(!e.hasCheckbox){t.checkbox.value?.domNode.remove(),t.checkbox.clear();return}let i=t.checkbox.value;i?i.setTitle(e.saneLabel):(i=new rZ(e.saneLabel,e.checked,{...DO,size:15}),t.checkbox.value=i,t.outerLabel.prepend(i.domNode)),e.checkboxDisabled?i.disable():i.enable(),i.checked=e.checked,t.toDisposeElement.add(e.onChecked(n=>i.checked=n)),t.toDisposeElement.add(i.onChange(()=>e.checked=i.checked))}renderElement(e,t,i){const n=e.element;i.element=n,n.element=i.entry??void 0;const s=n.item;n.element.classList.toggle("not-pickable",n.item.pickable===!1),this.ensureCheckbox(n,i);const{labelHighlights:r,descriptionHighlights:a,detailHighlights:l}=n;if(s.iconPath){const u=Rf(this.themeService.getColorTheme().type)?s.iconPath.dark:s.iconPath.light??s.iconPath.dark,f=be.revive(u);i.icon.className="quick-input-list-icon",i.icon.style.backgroundImage=Nl(f)}else i.icon.style.backgroundImage="",i.icon.className=s.iconClass?`quick-input-list-icon ${s.iconClass}`:"";let c;!n.saneTooltip&&n.saneDescription&&(c={markdown:{value:qr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});const d={matches:r||[],descriptionTitle:c,descriptionMatches:a||[],labelEscapeNewLines:!0};if(d.extraClasses=s.iconClasses,d.italic=s.italic,d.strikethrough=s.strikethrough,i.entry.classList.remove("quick-input-list-separator-as-item"),i.label.setLabel(n.saneLabel,n.saneDescription,d),i.keybinding.set(s.keybinding),n.saneDetail){let u;n.saneTooltip||(u={markdown:{value:qr(n.saneDetail),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDetail}),i.detail.element.style.display="",i.detail.setLabel(n.saneDetail,void 0,{matches:l,title:u,labelEscapeNewLines:!0})}else i.detail.element.style.display="none";n.separator?.label?(i.separator.textContent=n.separator.label,i.separator.style.display="",this.addItemWithSeparator(n)):i.separator.style.display="none",i.entry.classList.toggle("quick-input-list-separator-border",!!n.separator&&n.childIndex!==0);const h=s.buttons;h&&h.length?(i.actionBar.push(h.map((u,f)=>cC(u,`id-${f}`,()=>n.fireButtonTriggered({button:u,item:n.item}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i){this.removeItemWithSeparator(e.element),super.disposeElement(e,t,i)}isItemWithSeparatorVisible(e){return this._itemsWithSeparatorsFrequency.has(e)}addItemWithSeparator(e){this._itemsWithSeparatorsFrequency.set(e,(this._itemsWithSeparatorsFrequency.get(e)||0)+1)}removeItemWithSeparator(e){const t=this._itemsWithSeparatorsFrequency.get(e)||0;t>1?this._itemsWithSeparatorsFrequency.set(e,t-1):this._itemsWithSeparatorsFrequency.delete(e)}},CW=wm,wm.ID="quickpickitem",wm);zE=CW=VE([bW(1,li)],zE);const NT=class NT extends Aee{constructor(){super(...arguments),this._visibleSeparatorsFrequency=new Map}get templateId(){return NT.ID}get visibleSeparators(){return[...this._visibleSeparatorsFrequency.keys()]}isSeparatorVisible(e){return this._visibleSeparatorsFrequency.has(e)}renderElement(e,t,i){const n=e.element;i.element=n,n.element=i.entry??void 0,n.element.classList.toggle("focus-inside",!!n.focusInsideSeparator);const s=n.separator,{labelHighlights:r,descriptionHighlights:a}=n;i.icon.style.backgroundImage="",i.icon.className="";let l;!n.saneTooltip&&n.saneDescription&&(l={markdown:{value:qr(n.saneDescription),supportThemeIcons:!0},markdownNotSupportedFallback:n.saneDescription});const c={matches:r||[],descriptionTitle:l,descriptionMatches:a||[],labelEscapeNewLines:!0};i.entry.classList.add("quick-input-list-separator-as-item"),i.label.setLabel(n.saneLabel,n.saneDescription,c),i.separator.style.display="none",i.entry.classList.add("quick-input-list-separator-border");const d=s.buttons;d&&d.length?(i.actionBar.push(d.map((h,u)=>cC(h,`id-${u}`,()=>n.fireSeparatorButtonTriggered({button:h,separator:n.separator}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions"),this.addSeparator(n)}disposeElement(e,t,i){this.removeSeparator(e.element),this.isSeparatorVisible(e.element)||e.element.element?.classList.remove("focus-inside"),super.disposeElement(e,t,i)}addSeparator(e){this._visibleSeparatorsFrequency.set(e,(this._visibleSeparatorsFrequency.get(e)||0)+1)}removeSeparator(e){const t=this._visibleSeparatorsFrequency.get(e)||0;t>1?this._visibleSeparatorsFrequency.set(e,t-1):this._visibleSeparatorsFrequency.delete(e)}};NT.ID="quickpickseparator";let UE=NT,mS=class extends A{constructor(e,t,i,n,s,r){super(),this.parent=e,this.hoverDelegate=t,this.linkOpenerDelegate=i,this.accessibilityService=r,this._onKeyDown=new P,this._onLeave=new P,this.onLeave=this._onLeave.event,this._visibleCountObservable=Le("VisibleCount",0),this.onChangedVisibleCount=ie.fromObservable(this._visibleCountObservable,this._store),this._allVisibleCheckedObservable=Le("AllVisibleChecked",!1),this.onChangedAllVisibleChecked=ie.fromObservable(this._allVisibleCheckedObservable,this._store),this._checkedCountObservable=Le("CheckedCount",0),this.onChangedCheckedCount=ie.fromObservable(this._checkedCountObservable,this._store),this._checkedElementsObservable=m1({equalsFn:Ut},new Array),this.onChangedCheckedElements=ie.fromObservable(this._checkedElementsObservable,this._store),this._onButtonTriggered=new P,this.onButtonTriggered=this._onButtonTriggered.event,this._onSeparatorButtonTriggered=new P,this.onSeparatorButtonTriggered=this._onSeparatorButtonTriggered.event,this._elementChecked=new P,this._elementCheckedEventBufferer=new i1,this._hasCheckboxes=!1,this._inputElements=new Array,this._elementTree=new Array,this._itemElements=new Array,this._elementDisposable=this._register(new U),this._matchOnDescription=!1,this._matchOnDetail=!1,this._matchOnLabel=!0,this._matchOnLabelMode="fuzzy",this._sortByLabel=!0,this._shouldLoop=!0,this._container=Z(this.parent,nc(".quick-input-list")),this._separatorRenderer=new UE(t),this._itemRenderer=s.createInstance(zE,t),this._tree=this._register(s.createInstance(yI,"QuickInput",this._container,new pAe,[this._itemRenderer,this._separatorRenderer],{filter:{filter(a){return a.hidden?0:a instanceof fp?2:1}},sorter:{compare:(a,l)=>{if(!this.sortByLabel||!this._lastQueryString)return 0;const c=this._lastQueryString.toLowerCase();return bAe(a,l,c)}},accessibilityProvider:new mAe,setRowLineHeight:!1,multipleSelectionSupport:!1,hideTwistiesOfChildlessElements:!0,renderIndentGuides:Bg.None,findWidgetEnabled:!1,indent:0,horizontalScrolling:!1,allowNonCollapsibleParents:!0,alwaysConsumeMouseWheel:!0})),this._tree.getHTMLElement().id=n,this._registerListeners()}get onDidChangeFocus(){return ie.map(this._tree.onDidChangeFocus,e=>e.elements.filter(t=>t instanceof An).map(t=>t.item),this._store)}get onDidChangeSelection(){return ie.map(this._tree.onDidChangeSelection,e=>({items:e.elements.filter(t=>t instanceof An).map(t=>t.item),event:e.browserEvent}),this._store)}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}get scrollTop(){return this._tree.scrollTop}set scrollTop(e){this._tree.scrollTop=e}get ariaLabel(){return this._tree.ariaLabel}set ariaLabel(e){this._tree.ariaLabel=e??""}set enabled(e){this._tree.getHTMLElement().style.pointerEvents=e?"":"none"}get matchOnDescription(){return this._matchOnDescription}set matchOnDescription(e){this._matchOnDescription=e}get matchOnDetail(){return this._matchOnDetail}set matchOnDetail(e){this._matchOnDetail=e}get matchOnLabel(){return this._matchOnLabel}set matchOnLabel(e){this._matchOnLabel=e}get matchOnLabelMode(){return this._matchOnLabelMode}set matchOnLabelMode(e){this._matchOnLabelMode=e}get sortByLabel(){return this._sortByLabel}set sortByLabel(e){this._sortByLabel=e}get shouldLoop(){return this._shouldLoop}set shouldLoop(e){this._shouldLoop=e}_registerListeners(){this._registerOnKeyDown(),this._registerOnContainerClick(),this._registerOnMouseMiddleClick(),this._registerOnTreeModelChanged(),this._registerOnElementChecked(),this._registerOnContextMenu(),this._registerHoverListeners(),this._registerSelectionChangeListener(),this._registerSeparatorActionShowingListeners()}_registerOnKeyDown(){this._register(this._tree.onKeyDown(e=>{const t=new St(e);switch(t.keyCode){case 10:this.toggleCheckbox();break}this._onKeyDown.fire(t)}))}_registerOnContainerClick(){this._register(W(this._container,te.CLICK,e=>{(e.x||e.y)&&this._onLeave.fire()}))}_registerOnMouseMiddleClick(){this._register(W(this._container,te.AUXCLICK,e=>{e.button===1&&this._onLeave.fire()}))}_registerOnTreeModelChanged(){this._register(this._tree.onDidChangeModel(()=>{const e=this._itemElements.filter(t=>!t.hidden).length;this._visibleCountObservable.set(e,void 0),this._hasCheckboxes&&this._updateCheckedObservables()}))}_registerOnElementChecked(){this._register(this._elementCheckedEventBufferer.wrapEvent(this._elementChecked.event,(e,t)=>t)(e=>this._updateCheckedObservables()))}_registerOnContextMenu(){this._register(this._tree.onContextMenu(e=>{e.element&&(e.browserEvent.preventDefault(),this._tree.setSelection([e.element]))}))}_registerHoverListeners(){const e=this._register(new GB(typeof this.hoverDelegate.delay=="function"?this.hoverDelegate.delay():this.hoverDelegate.delay));this._register(this._tree.onMouseOver(async t=>{if(nH(t.browserEvent.target)){e.cancel();return}if(!(!nH(t.browserEvent.relatedTarget)&&Zi(t.browserEvent.relatedTarget,t.element?.element)))try{await e.trigger(async()=>{t.element instanceof An&&this.showHover(t.element)})}catch(i){if(!Do(i))throw i}})),this._register(this._tree.onMouseOut(t=>{Zi(t.browserEvent.relatedTarget,t.element?.element)||e.cancel()}))}_registerSeparatorActionShowingListeners(){this._register(this._tree.onDidChangeFocus(e=>{const t=e.elements[0]?this._tree.getParentElement(e.elements[0]):null;for(const i of this._separatorRenderer.visibleSeparators){const n=i===t;!!(i.focusInsideSeparator&sc.ACTIVE_ITEM)!==n&&(n?i.focusInsideSeparator|=sc.ACTIVE_ITEM:i.focusInsideSeparator&=~sc.ACTIVE_ITEM,this._tree.rerender(i))}})),this._register(this._tree.onMouseOver(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&sc.MOUSE_HOVER)||(i.focusInsideSeparator|=sc.MOUSE_HOVER,this._tree.rerender(i))}})),this._register(this._tree.onMouseOut(e=>{const t=e.element?this._tree.getParentElement(e.element):null;for(const i of this._separatorRenderer.visibleSeparators){if(i!==t)continue;!!(i.focusInsideSeparator&sc.MOUSE_HOVER)&&(i.focusInsideSeparator&=~sc.MOUSE_HOVER,this._tree.rerender(i))}}))}_registerSelectionChangeListener(){this._register(this._tree.onDidChangeSelection(e=>{const t=e.elements.filter(i=>i instanceof An);t.length!==e.elements.length&&(e.elements.length===1&&e.elements[0]instanceof fp&&(this._tree.setFocus([e.elements[0].children[0]]),this._tree.reveal(e.elements[0],0)),this._tree.setSelection(t))}))}setAllVisibleChecked(e){this._elementCheckedEventBufferer.bufferEvents(()=>{this._itemElements.forEach(t=>{!t.hidden&&!t.checkboxDisabled&&t.item.pickable!==!1&&(t.checked=e)})})}setElements(e){this._elementDisposable.clear(),this._lastQueryString=void 0,this._inputElements=e,this._hasCheckboxes=this.parent.classList.contains("show-checkboxes");let t;this._itemElements=new Array,this._elementTree=e.reduce((i,n,s)=>{let r;if(n.type==="separator"){if(!n.buttons)return i;t=new fp(s,a=>this._onSeparatorButtonTriggered.fire(a),n),r=t}else{const a=s>0?e[s-1]:void 0;let l;a&&a.type==="separator"&&!a.buttons&&(l=a);const c=new An(s,t?.children?t.children.length:s,this._hasCheckboxes&&n.pickable!==!1,d=>this._onButtonTriggered.fire(d),this._elementChecked,n,l);if(this._itemElements.push(c),t)return t.children.push(c),i;r=c}return i.push(r),i},new Array),this._setElementsToTree(this._elementTree),this.accessibilityService.isScreenReaderOptimized()&&setTimeout(()=>{const i=this._tree.getHTMLElement().querySelector(".monaco-list-row.focused"),n=i?.parentNode;if(i&&n){const s=i.nextSibling;i.remove(),n.insertBefore(i,s)}},0)}setFocusedElements(e){const t=e.map(i=>this._itemElements.find(n=>n.item===i)).filter(i=>!!i).filter(i=>!i.hidden);if(this._tree.setFocus(t),e.length>0){const i=this._tree.getFocus()[0];i&&this._tree.reveal(i)}}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}setSelectedElements(e){const t=e.map(i=>this._itemElements.find(n=>n.item===i)).filter(i=>!!i);this._tree.setSelection(t)}getCheckedElements(){return this._itemElements.filter(e=>e.checked).map(e=>e.item)}setCheckedElements(e){this._elementCheckedEventBufferer.bufferEvents(()=>{const t=new Set;for(const i of e)t.add(i);for(const i of this._itemElements)i.checked=t.has(i.item)})}focus(e){if(this._itemElements.length)switch(e===Bt.Second&&this._itemElements.length<2&&(e=Bt.First),e){case Bt.First:this._tree.scrollTop=0,this._tree.focusFirst(void 0,t=>t.element instanceof An);break;case Bt.Second:{this._tree.scrollTop=0;let t=!1;this._tree.focusFirst(void 0,i=>i.element instanceof An?t?!0:(t=!t,!1):!1);break}case Bt.Last:this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,t=>t.element instanceof An);break;case Bt.Next:{const t=this._tree.getFocus();this._tree.focusNext(void 0,this._shouldLoop,void 0,n=>n.element instanceof An?(this._tree.reveal(n.element),!0):!1);const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case Bt.Previous:{const t=this._tree.getFocus();this._tree.focusPrevious(void 0,this._shouldLoop,void 0,n=>{if(!(n.element instanceof An))return!1;const s=this._tree.getParentElement(n.element);return s===null||s.children[0]!==n.element?this._tree.reveal(n.element):this._tree.reveal(s),!0});const i=this._tree.getFocus();t.length&&t[0]===i[0]&&this._onLeave.fire();break}case Bt.NextPage:this._tree.focusNextPage(void 0,t=>t.element instanceof An?(this._tree.reveal(t.element),!0):!1);break;case Bt.PreviousPage:this._tree.focusPreviousPage(void 0,t=>{if(!(t.element instanceof An))return!1;const i=this._tree.getParentElement(t.element);return i===null||i.children[0]!==t.element?this._tree.reveal(t.element):this._tree.reveal(i),!0});break;case Bt.NextSeparator:{let t=!1;const i=this._tree.getFocus()[0];this._tree.focusNext(void 0,!0,void 0,s=>{if(t)return!0;if(s.element instanceof fp)t=!0,this._separatorRenderer.isSeparatorVisible(s.element)?this._tree.reveal(s.element.children[0]):this._tree.reveal(s.element,0);else if(s.element instanceof An){if(s.element.separator)return this._itemRenderer.isItemWithSeparatorVisible(s.element)?this._tree.reveal(s.element):this._tree.reveal(s.element,0),!0;if(s.element===this._elementTree[0])return this._tree.reveal(s.element,0),!0}return!1});const n=this._tree.getFocus()[0];i===n&&(this._tree.scrollTop=this._tree.scrollHeight,this._tree.focusLast(void 0,s=>s.element instanceof An));break}case Bt.PreviousSeparator:{let t,i=!!this._tree.getFocus()[0]?.separator;this._tree.focusPrevious(void 0,!0,void 0,n=>{if(n.element instanceof fp)i?t||(this._separatorRenderer.isSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element.children[0]):i=!0;else if(n.element instanceof An&&!t){if(n.element.separator)this._itemRenderer.isItemWithSeparatorVisible(n.element)?this._tree.reveal(n.element):this._tree.reveal(n.element,0),t=n.element;else if(n.element===this._elementTree[0])return this._tree.reveal(n.element,0),!0}return!1}),t&&this._tree.setFocus([t]);break}}}clearFocus(){this._tree.setFocus([])}domFocus(){this._tree.domFocus()}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}filter(e){if(this._lastQueryString=e,!(this._sortByLabel||this._matchOnLabel||this._matchOnDescription||this._matchOnDetail))return this._tree.layout(),!1;const t=e;if(e=e.trim(),!e||!(this.matchOnLabel||this.matchOnDescription||this.matchOnDetail))this._itemElements.forEach(i=>{i.labelHighlights=void 0,i.descriptionHighlights=void 0,i.detailHighlights=void 0,i.hidden=!1;const n=i.index&&this._inputElements[i.index-1];i.item&&(i.separator=n&&n.type==="separator"&&!n.buttons?n:void 0)});else{let i;this._itemElements.forEach(n=>{let s;this.matchOnLabelMode==="fuzzy"?s=this.matchOnLabel?Uv(e,cg(n.saneLabel))??void 0:void 0:s=this.matchOnLabel?_Ae(t,cg(n.saneLabel))??void 0:void 0;const r=this.matchOnDescription?Uv(e,cg(n.saneDescription||""))??void 0:void 0,a=this.matchOnDetail?Uv(e,cg(n.saneDetail||""))??void 0:void 0;if(s||r||a?(n.labelHighlights=s,n.descriptionHighlights=r,n.detailHighlights=a,n.hidden=!1):(n.labelHighlights=void 0,n.descriptionHighlights=void 0,n.detailHighlights=void 0,n.hidden=n.item?!n.item.alwaysShow:!0),n.item?n.separator=void 0:n.separator&&(n.hidden=!0),!this.sortByLabel){const l=n.index&&this._inputElements[n.index-1]||void 0;l?.type==="separator"&&!l.buttons&&(i=l),i&&!n.hidden&&(n.separator=i,i=void 0)}})}return this._setElementsToTree(this._sortByLabel&&e?this._itemElements:this._elementTree),this._tree.layout(),!0}toggleCheckbox(){this._elementCheckedEventBufferer.bufferEvents(()=>{const e=this._tree.getFocus().filter(i=>i instanceof An),t=this._allVisibleChecked(e);for(const i of e)i.checkboxDisabled||(i.checked=!t)})}style(e){this._tree.style(e)}toggleHover(){const e=this._tree.getFocus()[0];if(!e?.saneTooltip||!(e instanceof An))return;if(this._lastHover&&!this._lastHover.isDisposed){this._lastHover.dispose();return}this.showHover(e);const t=new U;t.add(this._tree.onDidChangeFocus(i=>{i.elements[0]instanceof An&&this.showHover(i.elements[0])})),this._lastHover&&t.add(this._lastHover),this._elementDisposable.add(t)}_setElementsToTree(e){const t=new Array;for(const i of e)i instanceof fp?t.push({element:i,collapsible:!1,collapsed:!1,children:i.children.map(n=>({element:n,collapsible:!1,collapsed:!1}))}):t.push({element:i,collapsible:!1,collapsed:!1});this._tree.setChildren(null,t)}_allVisibleChecked(e,t=!0){for(let i=0,n=e.length;i<n;i++){const s=e[i];if(!s.hidden&&s.item.pickable!==!1)if(s.checked)t=!0;else return!1}return t}_updateCheckedObservables(){Dt(e=>{this._allVisibleCheckedObservable.set(this._allVisibleChecked(this._itemElements,!1),e);const t=this._itemElements.filter(i=>i.checked).length;this._checkedCountObservable.set(t,e),this._checkedElementsObservable.set(this.getCheckedElements(),e)})}showHover(e){this._lastHover&&!this._lastHover.isDisposed&&(this.hoverDelegate.onDidHideHover?.(),this._lastHover?.dispose()),!(!e.element||!e.saneTooltip)&&(this._lastHover=this.hoverDelegate.showHover({content:e.saneTooltip,target:e.element,linkHandler:t=>{this.linkOpenerDelegate(t)},appearance:{showPointer:!0},container:this._container,position:{hoverPosition:1}},!1))}};VE([vi],mS.prototype,"onDidChangeFocus",null),VE([vi],mS.prototype,"onDidChangeSelection",null),mS=VE([bW(4,ge),bW(5,bn)],mS);function _Ae(o,e){const{text:t,iconOffsets:i}=e;if(!i||i.length===0)return Oee(o,t);const n=r1(t," "),s=t.length-n.length,r=Oee(o,n);if(r)for(const a of r){const l=i[a.start+s]+s;a.start+=l,a.end+=l}return r}function Oee(o,e){const t=e.toLowerCase().indexOf(o.toLowerCase());return t!==-1?[{start:t,end:t+o.length}]:null}function bAe(o,e,t){const i=o.labelHighlights||[],n=e.labelHighlights||[];return i.length&&!n.length?-1:!i.length&&n.length?1:i.length===0&&n.length===0?0:fAe(o.saneSortLabel,e.saneSortLabel,t)}function CAe(o,e={}){rn.registerCommandAndKeybindingRule({weight:200,when:HE,metadata:{description:p(1741,"Used while in the context of any kind of quick input. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},...o,secondary:vW(o.primary,o.secondary??[],e)})}function io(o,e={}){rn.registerCommandAndKeybindingRule({weight:200,when:K.and(K.or(K.equals(fS,"quickPick"),K.equals(fS,"quickTree")),HE),metadata:{description:p(1742,"Used while in the context of the quick pick. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},...o,secondary:vW(o.primary,o.secondary??[],e)})}const _S=ze?256:2048;function vW(o,e,t={}){return t.withAltMod&&e.push(512+o),t.withCtrlMod&&(e.push(_S+o),t.withAltMod&&e.push(512+_S+o)),t.withCmdMod&&ze&&(e.push(2048+o),t.withCtrlMod&&e.push(2304+o),t.withAltMod&&(e.push(2560+o),t.withCtrlMod&&e.push(2816+o))),e}function nr(o,e){return t=>{const i=t.get(Zn).currentQuickInput;if(i)return e&&i.quickNavigate?i.focus(e):i.focus(o)}}io({id:"quickInput.pageNext",primary:12,handler:nr(Bt.NextPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),io({id:"quickInput.pagePrevious",primary:11,handler:nr(Bt.PreviousPage)},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),io({id:"quickInput.first",primary:_S+14,handler:nr(Bt.First)},{withAltMod:!0,withCmdMod:!0}),io({id:"quickInput.last",primary:_S+13,handler:nr(Bt.Last)},{withAltMod:!0,withCmdMod:!0}),io({id:"quickInput.next",primary:18,handler:nr(Bt.Next)},{withCtrlMod:!0}),io({id:"quickInput.previous",primary:16,handler:nr(Bt.Previous)},{withCtrlMod:!0});const Fee=p(1743,"If we're in quick access mode, this will navigate to the next item. If we are not in quick access mode, this will navigate to the next separator."),Wee=p(1744,"If we're in quick access mode, this will navigate to the previous item. If we are not in quick access mode, this will navigate to the previous separator.");ze?(io({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:2066,handler:nr(Bt.NextSeparator,Bt.Next),metadata:{description:Fee}}),io({id:"quickInput.nextSeparator",primary:2578,secondary:[2322],handler:nr(Bt.NextSeparator)},{withCtrlMod:!0}),io({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:2064,handler:nr(Bt.PreviousSeparator,Bt.Previous),metadata:{description:Wee}}),io({id:"quickInput.previousSeparator",primary:2576,secondary:[2320],handler:nr(Bt.PreviousSeparator)},{withCtrlMod:!0})):(io({id:"quickInput.nextSeparatorWithQuickAccessFallback",primary:530,handler:nr(Bt.NextSeparator,Bt.Next),metadata:{description:Fee}}),io({id:"quickInput.nextSeparator",primary:2578,handler:nr(Bt.NextSeparator)}),io({id:"quickInput.previousSeparatorWithQuickAccessFallback",primary:528,handler:nr(Bt.PreviousSeparator,Bt.Previous),metadata:{description:Wee}}),io({id:"quickInput.previousSeparator",primary:2576,handler:nr(Bt.PreviousSeparator)})),rn.registerCommandAndKeybindingRule({id:"quickInput.accept",primary:3,weight:200,when:K.and(K.notEquals(fS,"quickWidget"),HE),metadata:{description:p(1745,"Used while in the context of some quick input. If you change one keybinding for this command, you should change all of the other keybindings (modifier variants) of this command as well.")},handler:o=>{o.get(Zn).currentQuickInput?.accept()},secondary:vW(3,[],{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0})}),io({id:"quickInput.acceptInBackground",when:K.and(HE,K.equals(fS,"quickPick"),K.or(f5.negate(),lAe)),primary:17,weight:250,handler:o=>{o.get(Zn).currentQuickInput?.accept(!0)}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),CAe({id:"quickInput.hide",primary:9,handler:o=>{o.get(Zn).currentQuickInput?.hide()}},{withAltMod:!0,withCtrlMod:!0,withCmdMod:!0}),io({id:"quickInput.toggleHover",primary:_S|10,handler:o=>{o.get(Zn).toggleHover()}});var vAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},wAe=function(o,e){return function(t,i){e(t,i,o)}},wW;const bS=Q;let $E=(Sm=class extends A{constructor(e,t,i,n){super(),this._hoverDelegate=e,this._buttonTriggeredEmitter=t,this.onCheckedEvent=i,this._themeService=n,this.templateId=wW.ID}renderTemplate(e){const t=new U,i=Z(e,bS(".quick-input-tree-entry")),n=t.add(new aZ("",!1,{...DO,size:15}));i.appendChild(n.domNode);const s=Z(i,bS("label.quick-input-tree-label")),r=Z(s,bS(".quick-input-tree-rows")),a=Z(r,bS(".quick-input-tree-row")),l=Dy(a,bS(".quick-input-tree-icon")),c=t.add(new qw(a,{supportHighlights:!0,supportDescriptionHighlights:!0,supportIcons:!0,hoverDelegate:this._hoverDelegate})),d=t.add(new Ys(i,this._hoverDelegate?{hoverDelegate:this._hoverDelegate}:void 0));return d.domNode.classList.add("quick-input-tree-entry-action-bar"),{toDisposeTemplate:t,entry:i,checkbox:n,icon:l,label:c,actionBar:d,toDisposeElement:new U}}renderElement(e,t,i,n){const s=i.toDisposeElement,r=e.element;if(r.pickable===!1?i.checkbox.domNode.style.display="none":(i.checkbox.domNode.style.display="",i.checkbox.checked=r.checked??!1,s.add(ie.filter(this.onCheckedEvent,h=>h.item===r)(h=>i.checkbox.checked=h.checked)),r.disabled&&i.checkbox.disable()),r.iconPath){const h=Rf(this._themeService.getColorTheme().type)?r.iconPath.dark:r.iconPath.light??r.iconPath.dark,u=be.revive(h);i.icon.className="quick-input-tree-icon",i.icon.style.backgroundImage=Nl(u)}else i.icon.style.backgroundImage="",i.icon.className=r.iconClass?`quick-input-tree-icon ${r.iconClass}`:"";const{labelHighlights:a,descriptionHighlights:l}=e.filterData||{};let c;r.description&&(c={markdown:{value:qr(r.description),supportThemeIcons:!0},markdownNotSupportedFallback:r.description}),i.label.setLabel(r.label,r.description,{matches:a,descriptionMatches:l,extraClasses:r.iconClasses,italic:r.italic,strikethrough:r.strikethrough,labelEscapeNewLines:!0,descriptionTitle:c});const d=r.buttons;d&&d.length?(i.actionBar.push(d.map((h,u)=>cC(h,`tree-${u}`,()=>this._buttonTriggeredEmitter.fire({item:r,button:h}))),{icon:!0,label:!1}),i.entry.classList.add("has-actions")):i.entry.classList.remove("has-actions")}disposeElement(e,t,i,n){i.toDisposeElement.clear(),i.actionBar.clear()}disposeTemplate(e){e.toDisposeElement.dispose(),e.toDisposeTemplate.dispose()}},wW=Sm,Sm.ID="quickInputTreeElement",Sm);$E=wW=vAe([wAe(3,li)],$E);class SAe{getHeight(e){return 22}getTemplateId(e){return $E.ID}}function yAe(o){let e=!1,t=!1,i=!1;for(const s of o){switch(s.element?.checked){case"partial":i=!0;break;case!0:e=!0;break;default:t=!0;break}if(e&&t&&i)break}return t?i||e?"partial":!1:i?"partial":e}class LAe{constructor(e){this.onCheckedEvent=e}getWidgetAriaLabel(){return p(1755,"Quick Tree")}getAriaLabel(e){return e.ariaLabel||[e.label,e.description].map(t=>pj(t)).filter(t=>!!t).join(", ")}getWidgetRole(){return"tree"}getRole(e){return"checkbox"}isChecked(e){return{get value(){return e.checked===!0},onDidChange:t=>ie.filter(this.onCheckedEvent,i=>i.item===e)(i=>t())}}}class xAe{constructor(){this.filterValue="",this.matchOnLabel=!0,this.matchOnDescription=!1}filter(e,t){if(!this.filterValue||!(this.matchOnLabel||this.matchOnDescription))return e.children?{visibility:2,data:{}}:{visibility:1,data:{}};const i=this.matchOnLabel?Uv(this.filterValue,cg(e.label))??void 0:void 0,n=this.matchOnDescription?Uv(this.filterValue,cg(e.description||""))??void 0:void 0;return{visibility:t===1||i||n?1:e.children?2:0,data:{labelHighlights:i,descriptionHighlights:n}}}}var kAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},IAe=function(o,e){return function(t,i){e(t,i,o)}};const DAe=Q;let SW=class extends A{constructor(e,t,i){super(),this.instantiationService=i,this._onDidTriggerButton=this._register(new P),this._onDidChangeCheckboxState=this._register(new P),this.onDidChangeCheckboxState=this._onDidChangeCheckboxState.event,this._onDidCheckedLeafItemsChange=this._register(new P),this._onLeave=new P,this.onLeave=this._onLeave.event,this._onDidAccept=this._register(new P),this.onDidAccept=this._onDidAccept.event,this._container=Z(e,DAe(".quick-input-tree")),this._renderer=this._register(this.instantiationService.createInstance($E,t,this._onDidTriggerButton,this.onDidChangeCheckboxState)),this._filter=this.instantiationService.createInstance(xAe),this._tree=this._register(this.instantiationService.createInstance(yI,"QuickInputTree",this._container,new SAe,[this._renderer],{accessibilityProvider:new LAe(this.onDidChangeCheckboxState),horizontalScrolling:!1,multipleSelectionSupport:!1,findWidgetEnabled:!1,alwaysConsumeMouseWheel:!0,hideTwistiesOfChildlessElements:!0,renderIndentGuides:Bg.None,expandOnDoubleClick:!0,expandOnlyOnTwistieClick:!0,disableExpandOnSpacebar:!0,sorter:{compare:(n,s)=>{if(n.label<s.label)return-1;if(n.label>s.label)return 1;if(n.description&&s.description){if(n.description<s.description)return-1;if(n.description>s.description)return 1}else{if(n.description)return-1;if(s.description)return 1}return 0}},filter:this._filter})),this.registerOnOpenListener()}get tree(){return this._tree}get displayed(){return this._container.style.display!=="none"}set displayed(e){this._container.style.display=e?"":"none"}getActiveDescendant(){return this._tree.getHTMLElement().getAttribute("aria-activedescendant")}layout(e){this._tree.getHTMLElement().style.maxHeight=e?`${Math.floor(e/44)*44+6}px`:"",this._tree.layout()}registerOnOpenListener(){this._register(this._tree.onDidOpen(e=>{const t=e.element;if(!t||t.disabled)return;if(t.pickable===!1){this._tree.setFocus([t]),this._onDidAccept.fire();return}const i=t.checked!==!0;if((t.checked??!1)===i)return;t.checked=i,this._tree.rerender(t);const n=new Set,s=[...this._tree.getNode(t).children];for(;s.length;){const a=s.shift();a?.element&&!n.has(a.element)&&(n.add(a.element),(a.element.checked??!1)!==t.checked&&(a.element.checked=t.checked,this._tree.rerender(a.element)),s.push(...a.children))}let r=this._tree.getParentElement(t);for(;r;){const a=[...this._tree.getNode(r).children],l=yAe(a);(r.checked??!1)!==l&&(r.checked=l,this._tree.rerender(r)),r=this._tree.getParentElement(r)}this._onDidChangeCheckboxState.fire({item:t,checked:t.checked??!1}),this._onDidCheckedLeafItemsChange.fire(this.getCheckedLeafItems())}))}getCheckedLeafItems(){const e=new Set,t=[...this._tree.getNode().children],i=new Array;for(;t.length;){const n=t.shift();!n?.element||e.has(n.element)||n.element.checked&&(e.add(n.element),t.push(...n.children),n.element.children||i.push(n.element))}return i}};SW=kAe([IAe(2,ge)],SW);var Bee=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},gp=function(o,e){return function(t,i){e(t,i,o)}},yW;const sr=Q,LW="workbench.quickInput.viewState";let xW=(ym=class extends A{get currentQuickInput(){return this.controller??void 0}get container(){return this._container}constructor(e,t,i,n,s){super(),this.options=e,this.layoutService=t,this.instantiationService=i,this.storageService=s,this.enabled=!0,this.onDidAcceptEmitter=this._register(new P),this.onDidCustomEmitter=this._register(new P),this.onDidTriggerButtonEmitter=this._register(new P),this.keyMods={ctrlCmd:!1,alt:!1},this.controller=null,this.onShowEmitter=this._register(new P),this.onShow=this.onShowEmitter.event,this.onHideEmitter=this._register(new P),this.onHide=this.onHideEmitter.event,this.inQuickInputContext=nAe.bindTo(n),this.quickInputTypeContext=rAe.bindTo(n),this.endOfQuickInputBoxContext=aAe.bindTo(n),this.idPrefix=e.idPrefix,this._container=e.container,this.styles=e.styles,this._register(ie.runAndSubscribe(C1,({window:r,disposables:a})=>this.registerKeyModsListeners(r,a),{window:bt,disposables:this._store})),this._register(Gne(r=>{this.ui&&me(this.ui.container)===r&&(this.reparentUI(this.layoutService.mainContainer),this.layout(this.layoutService.mainContainerDimension,this.layoutService.mainContainerOffset.quickPickTop))})),this.viewState=this.loadViewState()}registerKeyModsListeners(e,t){const i=n=>{this.keyMods.ctrlCmd=n.ctrlKey||n.metaKey,this.keyMods.alt=n.altKey};for(const n of[te.KEY_DOWN,te.KEY_UP,te.MOUSE_DOWN])t.add(W(e,n,i,!0))}getUI(e){if(this.ui)return e&&me(this._container)!==me(this.layoutService.activeContainer)&&(this.reparentUI(this.layoutService.activeContainer),this.layout(this.layoutService.activeContainerDimension,this.layoutService.activeContainerOffset.quickPickTop)),this.ui;const t=Z(this._container,sr(".quick-input-widget.show-file-icons"));t.tabIndex=-1,t.style.display="none";const i=Ir(t),n=Z(t,sr(".quick-input-titlebar")),s=this._register(new Ys(n,{hoverDelegate:this.options.hoverDelegate}));s.domNode.classList.add("quick-input-left-action-bar");const r=Z(n,sr(".quick-input-title")),a=this._register(new Ys(n,{hoverDelegate:this.options.hoverDelegate}));a.domNode.classList.add("quick-input-right-action-bar");const l=Z(t,sr(".quick-input-header")),c=this._register(new aZ(p(1746,"Toggle all checkboxes"),!1,{...DO,size:15}));Z(l,c.domNode),this._register(c.onChange(()=>{const z=c.checked;O.setAllVisibleChecked(z===!0)})),this._register(W(c.domNode,te.CLICK,z=>{(z.x||z.y)&&f.setFocus()}));const d=Z(l,sr(".quick-input-description")),h=Z(l,sr(".quick-input-and-message")),u=Z(h,sr(".quick-input-filter")),f=this._register(new hAe(u,this.styles.inputBox,this.styles.toggle));f.setAttribute("aria-describedby",`${this.idPrefix}message`);const g=Z(u,sr(".quick-input-visible-count"));g.setAttribute("aria-live","polite"),g.setAttribute("aria-atomic","true");const m=this._register(new L5(g,{countFormat:p(1747,"{0} Results")},this.styles.countBadge)),_=Z(u,sr(".quick-input-count"));_.setAttribute("aria-live","polite");const b=this._register(new L5(_,{countFormat:p(1748,"{0} Selected")},this.styles.countBadge)),C=this._register(new Ys(l,{hoverDelegate:this.options.hoverDelegate}));C.domNode.classList.add("quick-input-inline-action-bar");const w=Z(l,sr(".quick-input-action")),v=this._register(new Tk(w,this.styles.button));v.label=p(1749,"OK"),this._register(v.onDidClick(z=>{this.onDidAcceptEmitter.fire()}));const S=Z(l,sr(".quick-input-action")),L=this._register(new Tk(S,{...this.styles.button,supportIcons:!0}));L.label=p(1750,"Custom"),this._register(L.onDidClick(z=>{this.onDidCustomEmitter.fire()}));const x=Z(h,sr(`#${this.idPrefix}message.quick-input-message`)),I=this._register(new _W(t,this.styles.progressBar));I.getContainer().classList.add("quick-input-progress");const D=Z(t,sr(".quick-input-html-widget"));D.tabIndex=-1;const R=Z(t,sr(".quick-input-description")),F=this.idPrefix+"list",O=this._register(this.instantiationService.createInstance(mS,t,this.options.hoverDelegate,this.options.linkOpenerDelegate,F));f.setAttribute("aria-controls",F),this._register(O.onDidChangeFocus(()=>{f.hasFocus()&&f.setAttribute("aria-activedescendant",O.getActiveDescendant()??"")})),this._register(O.onChangedAllVisibleChecked(z=>{c.checked=z})),this._register(O.onChangedVisibleCount(z=>{m.setCount(z)})),this._register(O.onChangedCheckedCount(z=>{b.setCount(z)})),this._register(O.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),this.controller instanceof pS&&this.controller.canSelectMany&&O.clearFocus())},0)}));const B=this._register(this.instantiationService.createInstance(SW,t,this.options.hoverDelegate));this._register(B.tree.onDidChangeFocus(()=>{f.hasFocus()&&f.setAttribute("aria-activedescendant",B.getActiveDescendant()??"")})),this._register(B.onLeave(()=>{setTimeout(()=>{this.controller&&(f.setFocus(),B.tree.setFocus([]))},0)})),this._register(B.onDidAccept(()=>{this.onDidAcceptEmitter.fire()})),this._register(B.tree.onDidChangeContentHeight(()=>this.updateLayout()));const V=br(t);return this._register(V),this._register(W(t,te.FOCUS,z=>{const ee=this.getUI();if(Zi(z.relatedTarget,ee.inputContainer)){const se=ee.inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==se&&this.endOfQuickInputBoxContext.set(se)}Zi(z.relatedTarget,ee.container)||(this.inQuickInputContext.set(!0),this.previousFocusElement=ai(z.relatedTarget)?z.relatedTarget:void 0)},!0)),this._register(V.onDidBlur(()=>{!this.getUI().ignoreFocusOut&&!this.options.ignoreFocusOut()&&this.hide(Sw.Blur),this.inQuickInputContext.set(!1),this.endOfQuickInputBoxContext.set(!1),this.previousFocusElement=void 0})),this._register(f.onKeyDown(z=>{const ee=this.getUI().inputBox.isSelectionAtEnd();this.endOfQuickInputBoxContext.get()!==ee&&this.endOfQuickInputBoxContext.set(ee),f.removeAttribute("aria-activedescendant")})),this._register(W(t,te.FOCUS,z=>{f.setFocus()})),this.dndController=this._register(this.instantiationService.createInstance(kW,this._container,t,[{node:n,includeChildren:!0},{node:l,includeChildren:!1}],this.viewState)),this._register(Se(z=>{const ee=this.dndController?.dndViewState.read(z);ee&&(ee.top!==void 0&&ee.left!==void 0?this.viewState={...this.viewState,top:ee.top,left:ee.left}:this.viewState=void 0,this.updateLayout(),ee.done&&this.saveViewState(this.viewState))})),this.ui={container:t,styleSheet:i,leftActionBar:s,titleBar:n,title:r,description1:R,description2:d,widget:D,rightActionBar:a,inlineActionBar:C,checkAll:c,inputContainer:h,filterContainer:u,inputBox:f,visibleCountContainer:g,visibleCount:m,countContainer:_,count:b,okContainer:w,ok:v,message:x,customButtonContainer:S,customButton:L,list:O,tree:B,progressBar:I,onDidAccept:this.onDidAcceptEmitter.event,onDidCustom:this.onDidCustomEmitter.event,onDidTriggerButton:this.onDidTriggerButtonEmitter.event,ignoreFocusOut:!1,keyMods:this.keyMods,show:z=>this.show(z),hide:()=>this.hide(),setVisibilities:z=>this.setVisibilities(z),setEnabled:z=>this.setEnabled(z),setContextKey:z=>this.options.setContextKey(z),linkOpenerDelegate:z=>this.options.linkOpenerDelegate(z)},this.updateStyles(),this.ui}reparentUI(e){this.ui&&(this._container=e,Z(this._container,this.ui.container),this.dndController?.reparentUI(this._container))}pick(e,t={},i=He.None){return new Promise((n,s)=>{let r=d=>{r=n,t.onKeyMods?.(a.keyMods),n(d)};if(i.isCancellationRequested){r(void 0);return}const a=this.createQuickPick({useSeparators:!0});let l;const c=[a,a.onDidAccept(()=>{if(a.canSelectMany)r(a.selectedItems.slice()),a.hide();else{const d=a.activeItems[0];d&&(r(d),a.hide())}}),a.onDidChangeActive(d=>{const h=d[0];h&&t.onDidFocus&&t.onDidFocus(h)}),a.onDidChangeSelection(d=>{if(!a.canSelectMany){const h=d[0];h&&(r(h),a.hide())}}),a.onDidTriggerItemButton(d=>t.onDidTriggerItemButton&&t.onDidTriggerItemButton({...d,removeItem:()=>{const h=a.items.indexOf(d.item);if(h!==-1){const u=a.items.slice(),f=u.splice(h,1),g=a.activeItems.filter(_=>_!==f[0]),m=a.keepScrollPosition;a.keepScrollPosition=!0,a.items=u,g&&(a.activeItems=g),a.keepScrollPosition=m}}})),a.onDidTriggerSeparatorButton(d=>t.onDidTriggerSeparatorButton?.(d)),a.onDidChangeValue(d=>{l&&!d&&(a.activeItems.length!==1||a.activeItems[0]!==l)&&(a.activeItems=[l])}),i.onCancellationRequested(()=>{a.hide()}),a.onDidHide(()=>{pt(c),r(void 0)})];a.title=t.title,t.value&&(a.value=t.value),a.canSelectMany=!!t.canPickMany,a.placeholder=t.placeHolder,a.ignoreFocusOut=!!t.ignoreFocusLost,a.matchOnDescription=!!t.matchOnDescription,a.matchOnDetail=!!t.matchOnDetail,t.sortByLabel!==void 0&&(a.sortByLabel=t.sortByLabel),a.matchOnLabel=t.matchOnLabel===void 0||t.matchOnLabel,a.quickNavigate=t.quickNavigate,a.hideInput=!!t.hideInput,a.contextKey=t.contextKey,a.busy=!0,Promise.all([e,t.activeItem]).then(([d,h])=>{l=h,a.busy=!1,a.items=d,a.canSelectMany&&(a.selectedItems=d.filter(u=>u.type!=="separator"&&u.picked)),l&&(a.activeItems=[l])}),a.show(),Promise.resolve(e).then(void 0,d=>{s(d),a.hide()})})}setValidationOnInput(e,t){t&&ji(t)?(e.severity=ii.Error,e.validationMessage=t):t&&!ji(t)?(e.severity=t.severity,e.validationMessage=t.content):(e.severity=ii.Ignore,e.validationMessage=void 0)}input(e={},t=He.None){return new Promise(i=>{if(t.isCancellationRequested){i(void 0);return}const n=this.createInputBox(),s=e.validateInput||(()=>Promise.resolve(void 0)),r=ie.debounce(n.onDidChangeValue,(d,h)=>h,100);let a=e.value||"",l=Promise.resolve(s(a));const c=[n,r(d=>{d!==a&&(l=Promise.resolve(s(d)),a=d),l.then(h=>{d===a&&this.setValidationOnInput(n,h)})}),n.onDidAccept(()=>{const d=n.value;d!==a&&(l=Promise.resolve(s(d)),a=d),l.then(h=>{!h||!ji(h)&&h.severity!==ii.Error?(i(d),n.hide()):d===a&&this.setValidationOnInput(n,h)})}),t.onCancellationRequested(()=>{n.hide()}),n.onDidHide(()=>{pt(c),i(void 0)})];n.title=e.title,n.value=e.value||"",n.valueSelection=e.valueSelection,n.prompt=e.prompt,n.placeholder=e.placeHolder,n.password=!!e.password,n.ignoreFocusOut=!!e.ignoreFocusLost,n.show()})}createQuickPick(e={useSeparators:!1}){const t=this.getUI(!0);return new pS(t)}createInputBox(){const e=this.getUI(!0);return new cAe(e)}show(e){const t=this.getUI(!0);this.onShowEmitter.fire();const i=this.controller;this.controller=e,i?.didHide(),this.setEnabled(!0),t.leftActionBar.clear(),t.title.textContent="",t.description1.textContent="",t.description2.textContent="",Yi(t.widget),t.rightActionBar.clear(),t.inlineActionBar.clear(),t.checkAll.checked=!1,t.inputBox.placeholder="",t.inputBox.password=!1,t.inputBox.showDecoration(ii.Ignore),t.visibleCount.setCount(0),t.count.setCount(0),Yi(t.message),t.progressBar.stop(),t.list.setElements([]),t.list.matchOnDescription=!1,t.list.matchOnDetail=!1,t.list.matchOnLabel=!0,t.list.sortByLabel=!0,t.ignoreFocusOut=!1,t.inputBox.toggles=void 0;const n=this.options.backKeybindingLabel();fW.tooltip=n?p(1751,"Back ({0})",n):p(1752,"Back"),t.container.style.display="",this.updateLayout(),this.dndController?.layoutContainer(),t.inputBox.setFocus(),this.quickInputTypeContext.set(e.type)}isVisible(){return!!this.ui&&this.ui.container.style.display!=="none"}setVisibilities(e){const t=this.getUI();t.title.style.display=e.title?"":"none",t.description1.style.display=e.description&&(e.inputBox||e.checkAll)?"":"none",t.description2.style.display=e.description&&!(e.inputBox||e.checkAll)?"":"none",t.checkAll.domNode.style.display=e.checkAll?"":"none",t.inputContainer.style.display=e.inputBox?"":"none",t.filterContainer.style.display=e.inputBox?"":"none",t.visibleCountContainer.style.display=e.visibleCount?"":"none",t.countContainer.style.display=e.count?"":"none",t.okContainer.style.display=e.ok?"":"none",t.customButtonContainer.style.display=e.customButton?"":"none",t.message.style.display=e.message?"":"none",t.progressBar.getContainer().style.display=e.progressBar?"":"none",t.list.displayed=!!e.list,t.tree.displayed=!!e.tree,t.container.classList.toggle("show-checkboxes",!!e.checkBox),t.container.classList.toggle("hidden-input",!e.inputBox&&!e.description),this.updateLayout()}setEnabled(e){if(e!==this.enabled){this.enabled=e;const t=this.getUI();for(const i of t.leftActionBar.viewItems)i.action.enabled=e;for(const i of t.rightActionBar.viewItems)i.action.enabled=e;e?t.checkAll.enable():t.checkAll.disable(),t.inputBox.enabled=e,t.ok.enabled=e,t.list.enabled=e}}hide(e){const t=this.controller;if(!t)return;t.willHide(e);const i=this.ui?.container,n=i&&!iH(i);if(this.controller=null,this.onHideEmitter.fire(),i&&(i.style.display="none"),!n){let s=this.previousFocusElement;for(;s&&!s.offsetParent;)s=s.parentElement??void 0;s?.offsetParent?(s.focus(),this.previousFocusElement=void 0):this.options.returnFocus()}t.didHide(e)}toggleHover(){this.isVisible()&&this.controller instanceof pS&&this.getUI().list.toggleHover()}layout(e,t){this.dimension=e,this.titleBarOffset=t,this.updateLayout()}updateLayout(){if(this.ui&&this.isVisible()){const e=this.ui.container.style,t=Math.min(this.dimension.width*.62,yW.MAX_WIDTH);e.width=t+"px",e.top=`${this.viewState?.top?Math.round(this.dimension.height*this.viewState.top):this.titleBarOffset}px`,e.left=`${Math.round(this.dimension.width*(this.viewState?.left??.5)-t/2)}px`,this.ui.inputBox.layout(),this.ui.list.layout(this.dimension&&this.dimension.height*.4),this.ui.tree.layout(this.dimension&&this.dimension.height*.4)}}applyStyles(e){this.styles=e,this.updateStyles()}updateStyles(){if(this.ui){const{quickInputTitleBackground:e,quickInputBackground:t,quickInputForeground:i,widgetBorder:n,widgetShadow:s}=this.styles.widget;this.ui.titleBar.style.backgroundColor=e??"",this.ui.container.style.backgroundColor=t??"",this.ui.container.style.color=i??"",this.ui.container.style.border=n?`1px solid ${n}`:"",this.ui.container.style.boxShadow=s?`0 0 8px 2px ${s}`:"",this.ui.list.style(this.styles.list),this.ui.tree.tree.style(this.styles.list);const r=[];this.styles.pickerGroup.pickerGroupBorder&&r.push(`.quick-input-list .quick-input-list-entry { border-top-color: ${this.styles.pickerGroup.pickerGroupBorder}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(`.quick-input-list .quick-input-list-separator { color: ${this.styles.pickerGroup.pickerGroupForeground}; }`),this.styles.pickerGroup.pickerGroupForeground&&r.push(".quick-input-list .quick-input-list-separator-as-item { color: var(--vscode-descriptionForeground); }"),(this.styles.keybindingLabel.keybindingLabelBackground||this.styles.keybindingLabel.keybindingLabelBorder||this.styles.keybindingLabel.keybindingLabelBottomBorder||this.styles.keybindingLabel.keybindingLabelShadow||this.styles.keybindingLabel.keybindingLabelForeground)&&(r.push(".quick-input-list .monaco-keybinding > .monaco-keybinding-key {"),this.styles.keybindingLabel.keybindingLabelBackground&&r.push(`background-color: ${this.styles.keybindingLabel.keybindingLabelBackground};`),this.styles.keybindingLabel.keybindingLabelBorder&&r.push(`border-color: ${this.styles.keybindingLabel.keybindingLabelBorder};`),this.styles.keybindingLabel.keybindingLabelBottomBorder&&r.push(`border-bottom-color: ${this.styles.keybindingLabel.keybindingLabelBottomBorder};`),this.styles.keybindingLabel.keybindingLabelShadow&&r.push(`box-shadow: inset 0 -1px 0 ${this.styles.keybindingLabel.keybindingLabelShadow};`),this.styles.keybindingLabel.keybindingLabelForeground&&r.push(`color: ${this.styles.keybindingLabel.keybindingLabelForeground};`),r.push("}"));const a=r.join(`
`);a!==this.ui.styleSheet.textContent&&(this.ui.styleSheet.textContent=a)}}loadViewState(){try{const e=JSON.parse(this.storageService.get(LW,-1,"{}"));if(e.top!==void 0||e.left!==void 0)return e}catch{}}saveViewState(e){this.layoutService.activeContainer===this.layoutService.mainContainer&&(e!==void 0?this.storageService.store(LW,JSON.stringify(e),-1,1):this.storageService.remove(LW,-1))}},yW=ym,ym.MAX_WIDTH=600,ym);xW=yW=Bee([gp(1,Hl),gp(2,ge),gp(3,xe),gp(4,Es)],xW);let kW=class extends A{constructor(e,t,i,n,s,r,a){super(),this._container=e,this._quickInputContainer=t,this._quickInputDragAreas=i,this._layoutService=s,this.configurationService=a,this.dndViewState=Le(this,void 0),this._snapThreshold=20,this._snapLineHorizontalRatio=.25,this._quickInputAlignmentContext=oAe.bindTo(r);const l=j1e(this.configurationService)==="custom";this._controlsOnLeft=l&&XT===1,this._controlsOnRight=l&&(XT===3||XT===2),this._registerLayoutListener(),this.registerMouseListeners(),this.dndViewState.set({...n,done:!0},void 0)}reparentUI(e){this._container=e}layoutContainer(e=this._layoutService.activeContainerDimension){const t=this.dndViewState.get(),i=this._quickInputContainer.getBoundingClientRect();if(t?.top&&t?.left){const n=Math.round(t.left*100)/100,s=e.width,r=i.width,a=n*s-r/2;this._layout(t.top*e.height,a)}}_registerLayoutListener(){this._register(ie.filter(this._layoutService.onDidLayoutContainer,e=>e.container===this._container)(e=>this.layoutContainer(e.dimension)))}registerMouseListeners(){const e=this._quickInputContainer;this._register(Q6(e,t=>{const i=new yn(me(e),t);i.detail===2&&this._quickInputDragAreas.some(({node:n,includeChildren:s})=>s?Zi(i.target,n):i.target===n)&&this.dndViewState.set({top:void 0,left:void 0,done:!0},void 0)})),this._register(X6(e,t=>{const i=me(this._layoutService.activeContainer),n=new yn(i,t);if(!this._quickInputDragAreas.some(({node:h,includeChildren:u})=>u?Zi(n.target,h):n.target===h))return;const s=this._quickInputContainer.getBoundingClientRect(),r=n.browserEvent.clientX-s.left,a=n.browserEvent.clientY-s.top;let l=!1;const c=Jne(i,h=>{new yn(i,h).preventDefault(),l||(l=!0),this._layout(h.clientY-a,h.clientX-r)}),d=Q6(i,h=>{if(l){const u=this.dndViewState.get();this.dndViewState.set({top:u?.top,left:u?.left,done:!0},void 0)}c.dispose(),d.dispose()})}))}_layout(e,t){const i=this._getTopSnapValue(),n=this._getCenterYSnapValue(),s=this._getCenterXSnapValue();e=Math.max(0,Math.min(e,this._container.clientHeight-this._quickInputContainer.clientHeight)),e<this._layoutService.activeContainerOffset.top&&(this._controlsOnLeft?t=Math.max(t,80/UT(ft())):this._controlsOnRight&&(t=Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth-140/UT(ft()))));const r=Math.abs(e-i)<this._snapThreshold;e=r?i:e;const a=Math.abs(e-n)<this._snapThreshold;e=a?n:e;const l=e/this._container.clientHeight;t=Math.max(0,Math.min(t,this._container.clientWidth-this._quickInputContainer.clientWidth));const c=Math.abs(t-s)<this._snapThreshold;t=c?s:t;const d=this._container.clientWidth,h=this._quickInputContainer.clientWidth,f=(t+h/2)/d;if(this.dndViewState.set({top:l,left:f,done:!1},void 0),c){if(r){this._quickInputAlignmentContext.set("top");return}else if(a){this._quickInputAlignmentContext.set("center");return}}this._quickInputAlignmentContext.set(void 0)}_getTopSnapValue(){return this._layoutService.activeContainerOffset.quickPickTop}_getCenterYSnapValue(){return Math.round(this._container.clientHeight*this._snapLineHorizontalRatio)}_getCenterXSnapValue(){return Math.round(this._container.clientWidth/2)-Math.round(this._quickInputContainer.clientWidth/2)}};kW=Bee([gp(4,Hl),gp(5,xe),gp(6,Me)],kW);var EAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},CS=function(o,e){return function(t,i){e(t,i,o)}};let IW=class extends Nde{get controller(){return this._controller||(this._controller=this._register(this.createController())),this._controller}get hasController(){return!!this._controller}get currentQuickInput(){return this.controller.currentQuickInput}get quickAccess(){return this._quickAccess||(this._quickAccess=this._register(this.instantiationService.createInstance(hW))),this._quickAccess}constructor(e,t,i,n,s){super(i),this.instantiationService=e,this.contextKeyService=t,this.layoutService=n,this.configurationService=s,this._onShow=this._register(new P),this._onHide=this._register(new P),this.contexts=new Map}createController(e=this.layoutService,t){const i={idPrefix:"quickInput_",container:e.activeContainer,ignoreFocusOut:()=>!1,backKeybindingLabel:()=>{},setContextKey:s=>this.setContextKey(s),linkOpenerDelegate:s=>{this.instantiationService.invokeFunction(r=>{r.get(Js).open(s,{allowCommands:!0,fromUserGesture:!0})})},returnFocus:()=>e.focus(),styles:this.computeStyles(),hoverDelegate:this._register(this.instantiationService.createInstance(gW))},n=this._register(this.instantiationService.createInstance(xW,{...i,...t}));return n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop),this._register(e.onDidLayoutActiveContainer(s=>{me(e.activeContainer)===me(n.container)&&n.layout(s,e.activeContainerOffset.quickPickTop)})),this._register(e.onDidChangeActiveContainer(()=>{n.isVisible()||n.layout(e.activeContainerDimension,e.activeContainerOffset.quickPickTop)})),this._register(n.onShow(()=>{this.resetContextKeys(),this._onShow.fire()})),this._register(n.onHide(()=>{this.resetContextKeys(),this._onHide.fire()})),n}setContextKey(e){let t;e&&(t=this.contexts.get(e),t||(t=new ae(e,!1).bindTo(this.contextKeyService),this.contexts.set(e,t))),!(t&&t.get())&&(this.resetContextKeys(),t?.set(!0))}resetContextKeys(){this.contexts.forEach(e=>{e.get()&&e.reset()})}pick(e,t,i=He.None){return this.controller.pick(e,t,i)}input(e={},t=He.None){return this.controller.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.controller.createQuickPick(e)}createInputBox(){return this.controller.createInputBox()}toggleHover(){this.hasController&&this.controller.toggleHover()}updateStyles(){this.hasController&&this.controller.applyStyles(this.computeStyles())}computeStyles(){return{widget:{quickInputBackground:J(vM),quickInputForeground:J(vce),quickInputTitleBackground:J(wce),widgetBorder:J(lM),widgetShadow:J(a_)},inputBox:uk,toggle:hk,countBadge:oK,button:W1e,progressBar:B1e,keybindingLabel:sK,list:vg({listBackground:vM,listFocusBackground:K1,listFocusForeground:q1,listInactiveFocusForeground:q1,listInactiveSelectionIconForeground:wM,listInactiveFocusBackground:K1,listFocusOutline:jt,listInactiveFocusOutline:jt,treeStickyScrollBackground:vM}),pickerGroup:{pickerGroupBorder:J(Sce),pickerGroupForeground:J(oz)}}}};IW=EAe([CS(0,ge),CS(1,xe),CS(2,li),CS(3,Hl),CS(4,Me)],IW);var Hee=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},pp=function(o,e){return function(t,i){e(t,i,o)}};let DW=class extends IW{constructor(e,t,i,n,s,r){super(t,i,n,new V8(e.getContainerDomNode(),s),r),this.host=void 0;const a=vS.get(e);if(a){const l=a.widget;this.host={_serviceBrand:void 0,get mainContainer(){return l.getDomNode()},getContainer(){return l.getDomNode()},whenContainerStylesLoaded(){},get containers(){return[l.getDomNode()]},get activeContainer(){return l.getDomNode()},get mainContainerDimension(){return e.getLayoutInfo()},get activeContainerDimension(){return e.getLayoutInfo()},get onDidLayoutMainContainer(){return e.onDidLayoutChange},get onDidLayoutActiveContainer(){return e.onDidLayoutChange},get onDidLayoutContainer(){return ie.map(e.onDidLayoutChange,c=>({container:l.getDomNode(),dimension:c}))},get onDidChangeActiveContainer(){return ie.None},get onDidAddContainer(){return ie.None},get mainContainerOffset(){return{top:0,quickPickTop:0}},get activeContainerOffset(){return{top:0,quickPickTop:0}},focus:()=>e.focus()}}else this.host=void 0}createController(){return super.createController(this.host)}};DW=Hee([pp(1,ge),pp(2,xe),pp(3,li),pp(4,et),pp(5,Me)],DW);let EW=class{get activeService(){const e=this.codeEditorService.getFocusedCodeEditor();if(!e)throw new Error("Quick input service needs a focused editor to work.");let t=this.mapEditorToService.get(e);if(!t){const i=t=this.instantiationService.createInstance(DW,e);this.mapEditorToService.set(e,t),Yu(e.onDidDispose)(()=>{i.dispose(),this.mapEditorToService.delete(e)})}return t}get currentQuickInput(){return this.activeService.currentQuickInput}get quickAccess(){return this.activeService.quickAccess}constructor(e,t){this.instantiationService=e,this.codeEditorService=t,this.mapEditorToService=new Map}pick(e,t,i=He.None){return this.activeService.pick(e,t,i)}input(e,t){return this.activeService.input(e,t)}createQuickPick(e={useSeparators:!1}){return this.activeService.createQuickPick(e)}createInputBox(){return this.activeService.createInputBox()}toggleHover(){return this.activeService.toggleHover()}};EW=Hee([pp(0,ge),pp(1,et)],EW);const TT=class TT{static get(e){return e.getContribution(TT.ID)}constructor(e){this.editor=e,this.widget=new NW(this.editor)}dispose(){this.widget.dispose()}};TT.ID="editor.controller.quickInput";let vS=TT;const RT=class RT{constructor(e){this.codeEditor=e,this.domNode=document.createElement("div"),this.codeEditor.addOverlayWidget(this)}getId(){return RT.ID}getDomNode(){return this.domNode}getPosition(){return{preference:{top:0,left:0}}}dispose(){this.codeEditor.removeOverlayWidget(this)}};RT.ID="editor.contrib.quickInputWidget";let NW=RT;Qe(vS.ID,vS,4);var NAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},TW=function(o,e){return function(t,i){e(t,i,o)}};let RW=class extends A{constructor(e,t,i){super(),this._contextKeyService=e,this._layoutService=t,this._configurationService=i,this._accessibilitySupport=0,this._onDidChangeScreenReaderOptimized=new P,this._onDidChangeReducedMotion=new P,this._onDidChangeLinkUnderline=new P,this._accessibilityModeEnabledContext=o_.bindTo(this._contextKeyService);const n=()=>this._accessibilityModeEnabledContext.set(this.isScreenReaderOptimized());this._register(this._configurationService.onDidChangeConfiguration(r=>{r.affectsConfiguration("editor.accessibilitySupport")&&(n(),this._onDidChangeScreenReaderOptimized.fire()),r.affectsConfiguration("workbench.reduceMotion")&&(this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._onDidChangeReducedMotion.fire())})),n(),this._register(this.onDidChangeScreenReaderOptimized(()=>n()));const s=bt.matchMedia("(prefers-reduced-motion: reduce)");this._systemMotionReduced=s.matches,this._configMotionReduced=this._configurationService.getValue("workbench.reduceMotion"),this._linkUnderlinesEnabled=this._configurationService.getValue("accessibility.underlineLinks"),this.initReducedMotionListeners(s),this.initLinkUnderlineListeners()}initReducedMotionListeners(e){this._register(W(e,"change",()=>{this._systemMotionReduced=e.matches,this._configMotionReduced==="auto"&&this._onDidChangeReducedMotion.fire()}));const t=()=>{const i=this.isMotionReduced();this._layoutService.mainContainer.classList.toggle("reduce-motion",i),this._layoutService.mainContainer.classList.toggle("enable-motion",!i)};t(),this._register(this.onDidChangeReducedMotion(()=>t()))}initLinkUnderlineListeners(){this._register(this._configurationService.onDidChangeConfiguration(t=>{if(t.affectsConfiguration("accessibility.underlineLinks")){const i=this._configurationService.getValue("accessibility.underlineLinks");this._linkUnderlinesEnabled=i,this._onDidChangeLinkUnderline.fire()}}));const e=()=>{const t=this._linkUnderlinesEnabled;this._layoutService.mainContainer.classList.toggle("underline-links",t)};e(),this._register(this.onDidChangeLinkUnderlines(()=>e()))}onDidChangeLinkUnderlines(e){return this._onDidChangeLinkUnderline.event(e)}get onDidChangeScreenReaderOptimized(){return this._onDidChangeScreenReaderOptimized.event}isScreenReaderOptimized(){const e=this._configurationService.getValue("editor.accessibilitySupport");return e==="on"||e==="auto"&&this._accessibilitySupport===2}get onDidChangeReducedMotion(){return this._onDidChangeReducedMotion.event}isMotionReduced(){const e=this._configMotionReduced;return e==="on"||e==="auto"&&this._systemMotionReduced}getAccessibilitySupport(){return this._accessibilitySupport}};RW=NAe([TW(0,xe),TW(1,Hl),TW(2,Me)],RW);var TAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Vee=function(o,e){return function(t,i){e(t,i,o)}},MW;const zee="application/vnd.code.resources";let PW=(Lm=class extends A{constructor(e,t){super(),this.layoutService=e,this.logService=t,this.mapTextToType=new Map,this.findText="",this.resources=[],this.resourcesStateHash=void 0,(qu||NB)&&this.installWebKitWriteTextWorkaround(),this._register(ie.runAndSubscribe(C1,({window:i,disposables:n})=>{n.add(W(i.document,"copy",()=>this.clearResourcesState()))},{window:bt,disposables:this._store}))}triggerPaste(){this.logService.trace("BrowserClipboardService#triggerPaste")}installWebKitWriteTextWorkaround(){const e=()=>{const t=new Ju;this.webKitPendingClipboardWritePromise&&!this.webKitPendingClipboardWritePromise.isSettled&&this.webKitPendingClipboardWritePromise.cancel(),this.webKitPendingClipboardWritePromise=t,ft().navigator.clipboard.write([new ClipboardItem({"text/plain":t.p})]).catch(async i=>{(!(i instanceof Error)||i.name!=="NotAllowedError"||!t.isRejected)&&this.logService.error(i)})};this._register(ie.runAndSubscribe(this.layoutService.onDidAddContainer,({container:t,disposables:i})=>{i.add(W(t,"click",e)),i.add(W(t,"keydown",e))},{container:this.layoutService.mainContainer,disposables:this._store}))}async writeText(e,t){if(this.logService.trace("BrowserClipboardService#writeText called with type:",t," text.length:",e.length),this.clearResourcesState(),t){this.mapTextToType.set(t,e),this.logService.trace("BrowserClipboardService#writeText");return}if(this.webKitPendingClipboardWritePromise)return this.webKitPendingClipboardWritePromise.complete(e);try{return this.logService.trace("before navigator.clipboard.writeText"),await ft().navigator.clipboard.writeText(e)}catch(i){console.error(i)}this.fallbackWriteText(e)}fallbackWriteText(e){this.logService.trace("BrowserClipboardService#fallbackWriteText");const t=w1(),i=t.activeElement,n=t.body.appendChild(Q("textarea",{"aria-hidden":!0}));n.style.height="1px",n.style.width="1px",n.style.position="absolute",n.value=e,n.focus(),n.select(),t.execCommand("copy"),ai(i)&&i.focus(),n.remove()}async readText(e){if(this.logService.trace("BrowserClipboardService#readText called with type:",e),e){const t=this.mapTextToType.get(e)||"";return this.logService.trace("BrowserClipboardService#readText text.length:",t.length),t}try{const t=await ft().navigator.clipboard.readText();return this.logService.trace("BrowserClipboardService#readText text.length:",t.length),t}catch(t){console.error(t)}return""}async readFindText(){return this.findText}async writeFindText(e){this.findText=e}async readResources(){try{const t=await ft().navigator.clipboard.read();for(const i of t)if(i.types.includes(`web ${zee}`)){const n=await i.getType(`web ${zee}`);return JSON.parse(await n.text()).map(r=>be.from(r))}}catch{}const e=await this.computeResourcesStateHash();return this.resourcesStateHash!==e&&this.clearResourcesState(),this.resources}async computeResourcesStateHash(){if(this.resources.length===0)return;const e=await this.readText();return h1(e.substring(0,MW.MAX_RESOURCE_STATE_SOURCE_LENGTH))}clearInternalState(){this.clearResourcesState()}clearResourcesState(){this.resources=[],this.resourcesStateHash=void 0}},MW=Lm,Lm.MAX_RESOURCE_STATE_SOURCE_LENGTH=1e3,Lm);PW=MW=TAe([Vee(0,Hl),Vee(1,Rt)],PW);var RAe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},MAe=function(o,e){return function(t,i){e(t,i,o)}};const wS="data-keybinding-context";class AW{constructor(e,t){this._id=e,this._parent=t,this._value=Object.create(null),this._value._contextId=e}get value(){return{...this._value}}setValue(e,t){return this._value[e]!==t?(this._value[e]=t,!0):!1}removeValue(e){return e in this._value?(delete this._value[e],!0):!1}getValue(e){const t=this._value[e];return typeof t>"u"&&this._parent?this._parent.getValue(e):t}}const MT=class MT extends AW{constructor(){super(-1,null)}setValue(e,t){return!1}removeValue(e){return!1}getValue(e){}};MT.INSTANCE=new MT;let dC=MT;const BS=class BS extends AW{constructor(e,t,i){super(e,null),this._configurationService=t,this._values=eb.forConfigKeys(),this._listener=this._configurationService.onDidChangeConfiguration(n=>{if(n.source===7){const s=Array.from(this._values,([r])=>r);this._values.clear(),i.fire(new $ee(s))}else{const s=[];for(const r of n.affectedKeys){const a=`config.${r}`,l=this._values.findSuperstr(a);l!==void 0&&(s.push(...Ye.map(l,([c])=>c)),this._values.deleteSuperstr(a)),this._values.has(a)&&(s.push(a),this._values.delete(a))}i.fire(new $ee(s))}})}dispose(){this._listener.dispose()}getValue(e){if(e.indexOf(BS._keyPrefix)!==0)return super.getValue(e);if(this._values.has(e))return this._values.get(e);const t=e.substr(BS._keyPrefix.length),i=this._configurationService.getValue(t);let n;switch(typeof i){case"number":case"boolean":case"string":n=i;break;default:Array.isArray(i)?n=JSON.stringify(i):n=i}return this._values.set(e,n),n}setValue(e,t){return super.setValue(e,t)}removeValue(e){return super.removeValue(e)}};BS._keyPrefix="config.";let OW=BS;class PAe{constructor(e,t,i){this._service=e,this._key=t,this._defaultValue=i,this.reset()}set(e){this._service.setContext(this._key,e)}reset(){typeof this._defaultValue>"u"?this._service.removeContext(this._key):this._service.setContext(this._key,this._defaultValue)}get(){return this._service.getContextKeyValue(this._key)}}class Uee{constructor(e){this.key=e}affectsSome(e){return e.has(this.key)}allKeysContainedIn(e){return this.affectsSome(e)}}class $ee{constructor(e){this.keys=e}affectsSome(e){for(const t of this.keys)if(e.has(t))return!0;return!1}allKeysContainedIn(e){return this.keys.every(t=>e.has(t))}}class AAe{constructor(e){this.events=e}affectsSome(e){for(const t of this.events)if(t.affectsSome(e))return!0;return!1}allKeysContainedIn(e){return this.events.every(t=>t.allKeysContainedIn(e))}}function OAe(o,e){return o.allKeysContainedIn(new Set(Object.keys(e)))}class jee extends A{get onDidChangeContext(){return this._onDidChangeContext.event}constructor(e){super(),this._onDidChangeContext=this._register(new Qu({merge:t=>new AAe(t)})),this._isDisposed=!1,this._myContextId=e}createKey(e,t){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new PAe(this,e,t)}bufferChangeEvents(e){this._onDidChangeContext.pause();try{e()}finally{this._onDidChangeContext.resume()}}createScoped(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");return new FAe(this,e)}contextMatchesRules(e){if(this._isDisposed)throw new Error("AbstractContextKeyService has been disposed");const t=this.getContextValuesContainer(this._myContextId);return e?e.evaluate(t):!0}getContextKeyValue(e){if(!this._isDisposed)return this.getContextValuesContainer(this._myContextId).getValue(e)}setContext(e,t){if(this._isDisposed)return;const i=this.getContextValuesContainer(this._myContextId);i&&i.setValue(e,t)&&this._onDidChangeContext.fire(new Uee(e))}removeContext(e){this._isDisposed||this.getContextValuesContainer(this._myContextId).removeValue(e)&&this._onDidChangeContext.fire(new Uee(e))}getContext(e){return this._isDisposed?dC.INSTANCE:this.getContextValuesContainer(WAe(e))}dispose(){super.dispose(),this._isDisposed=!0}}let FW=class extends jee{constructor(e){super(0),this._contexts=new Map,this._lastContextId=0,this.inputFocusedContext=f5.bindTo(this);const t=this._register(new OW(this._myContextId,e,this._onDidChangeContext));this._contexts.set(this._myContextId,t),this._register(ie.runAndSubscribe(C1,({window:i,disposables:n})=>{const s=n.add(new ct);n.add(W(i,te.FOCUS_IN,()=>{s.value=new U,this.updateInputContextKeys(i.document,s.value)},!0))},{window:bt,disposables:this._store}))}updateInputContextKeys(e,t){function i(){return!!e.activeElement&&ya(e.activeElement)}const n=i();if(this.inputFocusedContext.set(n),n){const s=t.add(br(e.activeElement));ie.once(s.onDidBlur)(()=>{ft().document===e&&this.inputFocusedContext.set(i()),s.dispose()},void 0,t)}}getContextValuesContainer(e){return this._isDisposed?dC.INSTANCE:this._contexts.get(e)||dC.INSTANCE}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ContextKeyService has been disposed");const t=++this._lastContextId;return this._contexts.set(t,new AW(t,this.getContextValuesContainer(e))),t}disposeContext(e){this._isDisposed||this._contexts.delete(e)}};FW=RAe([MAe(0,Me)],FW);class FAe extends jee{constructor(e,t){if(super(e.createChildContext()),this._parentChangeListener=this._register(new ct),this._parent=e,this._updateParentChangeListener(),this._domNode=t,this._domNode.hasAttribute(wS)){let i="";this._domNode.classList&&(i=Array.from(this._domNode.classList.values()).join(", ")),console.error(`Element already has context attribute${i?": "+i:""}`)}this._domNode.setAttribute(wS,String(this._myContextId))}_updateParentChangeListener(){this._parentChangeListener.value=this._parent.onDidChangeContext(e=>{const i=this._parent.getContextValuesContainer(this._myContextId).value;OAe(e,i)||this._onDidChangeContext.fire(e)})}dispose(){this._isDisposed||(this._parent.disposeContext(this._myContextId),this._domNode.removeAttribute(wS),super.dispose())}getContextValuesContainer(e){return this._isDisposed?dC.INSTANCE:this._parent.getContextValuesContainer(e)}createChildContext(e=this._myContextId){if(this._isDisposed)throw new Error("ScopedContextKeyService has been disposed");return this._parent.createChildContext(e)}disposeContext(e){this._isDisposed||this._parent.disposeContext(e)}}function WAe(o){for(;o;){if(o.hasAttribute(wS)){const e=o.getAttribute(wS);return e?parseInt(e,10):NaN}o=o.parentElement}return 0}function BAe(o,e,t){o.get(xe).createKey(String(e),HAe(t))}function HAe(o){return qH(o,e=>{if(typeof e=="object"&&e.$mid===1)return be.revive(e).toString();if(e instanceof be)return e.toString()})}Xe.registerCommand("_setContext",BAe),Xe.registerCommand({id:"getContextKeyInfo",handler(){return[...ae.all()].sort((o,e)=>o.key.localeCompare(e.key))},metadata:{description:p(1659,"A command that returns information about context keys"),args:[]}}),Xe.registerCommand("_generateContextKeyInfo",function(){const o=[],e=new Set;for(const t of ae.all())e.has(t.key)||(e.add(t.key),o.push(t));o.sort((t,i)=>t.key.localeCompare(i.key)),console.log(JSON.stringify(o,void 0,2))});let VAe=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}};class qee{constructor(e){this._hashFn=e,this._nodes=new Map}roots(){const e=[];for(const t of this._nodes.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){const i=this.lookupOrInsertNode(e),n=this.lookupOrInsertNode(t);i.outgoing.set(n.key,n),n.incoming.set(i.key,i)}removeNode(e){const t=this._hashFn(e);this._nodes.delete(t);for(const i of this._nodes.values())i.outgoing.delete(t),i.incoming.delete(t)}lookupOrInsertNode(e){const t=this._hashFn(e);let i=this._nodes.get(t);return i||(i=new VAe(t,e),this._nodes.set(t,i)),i}isEmpty(){return this._nodes.size===0}toString(){const e=[];for(const[t,i]of this._nodes)e.push(`${t}
(-> incoming)[${[...i.incoming.keys()].join(", ")}]
(outgoing ->)[${[...i.outgoing.keys()].join(",")}]
`);return e.join(`
`)}findCycleSlow(){for(const[e,t]of this._nodes){const i=new Set([e]),n=this._findCycle(t,i);if(n)return n}}_findCycle(e,t){for(const[i,n]of e.outgoing){if(t.has(i))return[...t,i].join(" -> ");t.add(i);const s=this._findCycle(n,t);if(s)return s;t.delete(i)}}}const zAe=!1;class Kee extends Error{constructor(e){super("cyclic dependency between services"),this.message=e.findCycleSlow()??`UNABLE to detect cycle, dumping graph:
${e.toString()}`}}class jE{constructor(e=new O_,t=!1,i,n=zAe){this._services=e,this._strict=t,this._parent=i,this._enableTracing=n,this._isDisposed=!1,this._servicesToMaybeDispose=new Set,this._children=new Set,this._activeInstantiations=new Set,this._services.set(ge,this),this._globalGraph=n?i?._globalGraph??new qee(s=>s):void 0}dispose(){if(!this._isDisposed){this._isDisposed=!0,pt(this._children),this._children.clear();for(const e of this._servicesToMaybeDispose)Xu(e)&&e.dispose();this._servicesToMaybeDispose.clear()}}_throwIfDisposed(){if(this._isDisposed)throw new Error("InstantiationService has been disposed")}createChild(e,t){this._throwIfDisposed();const i=this,n=new class extends jE{dispose(){i._children.delete(n),super.dispose()}}(e,this._strict,this,this._enableTracing);return this._children.add(n),t?.add(n),n}invokeFunction(e,...t){this._throwIfDisposed();const i=SS.traceInvocation(this._enableTracing,e);let n=!1;try{return e({get:r=>{if(n)throw YS("service accessor is only valid during the invocation of its target method");const a=this._getOrCreateServiceInstance(r,i);if(!a)throw new Error(`[invokeFunction] unknown service '${r}'`);return a},getIfExists:r=>{if(n)throw YS("service accessor is only valid during the invocation of its target method");return this._getOrCreateServiceInstance(r,i)}},...t)}finally{n=!0,i.stop()}}createInstance(e,...t){this._throwIfDisposed();let i,n;return e instanceof gl?(i=SS.traceCreation(this._enableTracing,e.ctor),n=this._createInstance(e.ctor,e.staticArguments.concat(t),i)):(i=SS.traceCreation(this._enableTracing,e),n=this._createInstance(e,t,i)),i.stop(),n}_createInstance(e,t=[],i){const n=La.getServiceDependencies(e).sort((a,l)=>a.index-l.index),s=[];for(const a of n){const l=this._getOrCreateServiceInstance(a.id,i);l||this._throwIfStrict(`[createInstance] ${e.name} depends on UNKNOWN service ${a.id}.`,!1),s.push(l)}const r=n.length>0?n[0].index:t.length;if(t.length!==r){console.trace(`[createInstance] First service dependency of ${e.name} at position ${r+1} conflicts with ${t.length} static arguments`);const a=r-t.length;a>0?t=t.concat(new Array(a)):t=t.slice(0,r)}return Reflect.construct(e,t.concat(s))}_setCreatedServiceInstance(e,t){if(this._services.get(e)instanceof gl)this._services.set(e,t);else if(this._parent)this._parent._setCreatedServiceInstance(e,t);else throw new Error("illegalState - setting UNKNOWN service instance")}_getServiceInstanceOrDescriptor(e){const t=this._services.get(e);return!t&&this._parent?this._parent._getServiceInstanceOrDescriptor(e):t}_getOrCreateServiceInstance(e,t){this._globalGraph&&this._globalGraphImplicitDependency&&this._globalGraph.insertEdge(this._globalGraphImplicitDependency,String(e));const i=this._getServiceInstanceOrDescriptor(e);return i instanceof gl?this._safeCreateAndCacheServiceInstance(e,i,t.branch(e,!0)):(t.branch(e,!1),i)}_safeCreateAndCacheServiceInstance(e,t,i){if(this._activeInstantiations.has(e))throw new Error(`illegal state - RECURSIVELY instantiating service '${e}'`);this._activeInstantiations.add(e);try{return this._createAndCacheServiceInstance(e,t,i)}finally{this._activeInstantiations.delete(e)}}_createAndCacheServiceInstance(e,t,i){const n=new qee(l=>l.id.toString());let s=0;const r=[{id:e,desc:t,_trace:i}],a=new Set;for(;r.length;){const l=r.pop();if(!a.has(String(l.id))){if(a.add(String(l.id)),n.lookupOrInsertNode(l),s++>1e3)throw new Kee(n);for(const c of La.getServiceDependencies(l.desc.ctor)){const d=this._getServiceInstanceOrDescriptor(c.id);if(d||this._throwIfStrict(`[createInstance] ${e} depends on ${c.id} which is NOT registered.`,!0),this._globalGraph?.insertEdge(String(l.id),String(c.id)),d instanceof gl){const h={id:c.id,desc:d,_trace:l._trace.branch(c.id,!0)};n.insertEdge(l,h),r.push(h)}}}}for(;;){const l=n.roots();if(l.length===0){if(!n.isEmpty())throw new Kee(n);break}for(const{data:c}of l){if(this._getServiceInstanceOrDescriptor(c.id)instanceof gl){const h=this._createServiceInstanceWithOwner(c.id,c.desc.ctor,c.desc.staticArguments,c.desc.supportsDelayedInstantiation,c._trace);this._setCreatedServiceInstance(c.id,h)}n.removeNode(c)}}return this._getServiceInstanceOrDescriptor(e)}_createServiceInstanceWithOwner(e,t,i=[],n,s){if(this._services.get(e)instanceof gl)return this._createServiceInstance(e,t,i,n,s,this._servicesToMaybeDispose);if(this._parent)return this._parent._createServiceInstanceWithOwner(e,t,i,n,s);throw new Error(`illegalState - creating UNKNOWN service instance ${t.name}`)}_createServiceInstance(e,t,i=[],n,s,r){if(n){const a=new jE(void 0,this._strict,this,this._enableTracing);a._globalGraphImplicitDependency=String(e);const l=new Map,c=new bie(()=>{const d=a._createInstance(t,i,s);for(const[h,u]of l){const f=d[h];if(typeof f=="function")for(const g of u)g.disposable=f.apply(d,g.listener)}return l.clear(),r.add(d),d});return new Proxy(Object.create(null),{get(d,h){if(!c.isInitialized&&typeof h=="string"&&(h.startsWith("onDid")||h.startsWith("onWill"))){let g=l.get(h);return g||(g=new Jn,l.set(h,g)),(_,b,C)=>{if(c.isInitialized)return c.value[h](_,b,C);{const w={listener:[_,b,C],disposable:void 0},v=g.push(w);return ue(()=>{v(),w.disposable?.dispose()})}}}if(h in d)return d[h];const u=c.value;let f=u[h];return typeof f!="function"||(f=f.bind(u),d[h]=f),f},set(d,h,u){return c.value[h]=u,!0},getPrototypeOf(d){return t.prototype}})}else{const a=this._createInstance(t,i,s);return r.add(a),a}}_throwIfStrict(e,t){if(t&&console.warn(e),this._strict)throw new Error(e)}}const ar=class ar{static traceInvocation(e,t){return e?new ar(2,t.name||new Error().stack.split(`
`).slice(3,4).join(`
`)):ar._None}static traceCreation(e,t){return e?new ar(1,t.name):ar._None}constructor(e,t){this.type=e,this.name=t,this._start=Date.now(),this._dep=[]}branch(e,t){const i=new ar(3,e.toString());return this._dep.push([e,t,i]),i}stop(){const e=Date.now()-this._start;ar._totals+=e;let t=!1;function i(s,r){const a=[],l=new Array(s+1).join(" ");for(const[c,d,h]of r._dep)if(d&&h){t=!0,a.push(`${l}CREATES -> ${c}`);const u=i(s+1,h);u&&a.push(u)}else a.push(`${l}uses -> ${c}`);return a.join(`
`)}const n=[`${this.type===1?"CREATE":"CALL"} ${this.name}`,`${i(1,this)}`,`DONE, took ${e.toFixed(2)}ms (grand total ${ar._totals.toFixed(2)}ms)`];(e>2||t)&&ar.all.add(n.join(`
`))}};ar.all=new Set,ar._None=new class extends ar{constructor(){super(0,null)}stop(){}branch(){return this}},ar._totals=0;let SS=ar;const UAe=new Set([we.inMemory,we.vscodeSourceControl,we.walkThrough,we.walkThroughSnippet,we.vscodeChatCodeBlock,we.vscodeTerminal]);class $Ae{constructor(){this._byResource=new Li,this._byOwner=new Map}set(e,t,i){let n=this._byResource.get(e);n||(n=new Map,this._byResource.set(e,n)),n.set(t,i);let s=this._byOwner.get(t);s||(s=new Li,this._byOwner.set(t,s)),s.set(e,i)}get(e,t){return this._byResource.get(e)?.get(t)}delete(e,t){let i=!1,n=!1;const s=this._byResource.get(e);s&&(i=s.delete(t));const r=this._byOwner.get(t);if(r&&(n=r.delete(e)),i!==n)throw new Error("illegal state");return i&&n}values(e){return typeof e=="string"?this._byOwner.get(e)?.values()??Ye.empty():be.isUri(e)?this._byResource.get(e)?.values()??Ye.empty():Ye.map(Ye.concat(...this._byOwner.values()),t=>t[1])}}class jAe{constructor(e){this.errors=0,this.infos=0,this.warnings=0,this.unknowns=0,this._data=new Li,this._service=e,this._subscription=e.onMarkerChanged(this._update,this)}dispose(){this._subscription.dispose()}_update(e){for(const t of e){const i=this._data.get(t);i&&this._substract(i);const n=this._resourceStats(t);this._add(n),this._data.set(t,n)}}_resourceStats(e){const t={errors:0,warnings:0,infos:0,unknowns:0};if(UAe.has(e.scheme))return t;for(const{severity:i}of this._service.read({resource:e}))i===oi.Error?t.errors+=1:i===oi.Warning?t.warnings+=1:i===oi.Info?t.infos+=1:t.unknowns+=1;return t}_substract(e){this.errors-=e.errors,this.warnings-=e.warnings,this.infos-=e.infos,this.unknowns-=e.unknowns}_add(e){this.errors+=e.errors,this.warnings+=e.warnings,this.infos+=e.infos,this.unknowns+=e.unknowns}}class mp{constructor(){this._onMarkerChanged=new jB({delay:0,merge:mp._merge}),this.onMarkerChanged=this._onMarkerChanged.event,this._data=new $Ae,this._stats=new jAe(this),this._filteredResources=new Li}dispose(){this._stats.dispose(),this._onMarkerChanged.dispose()}remove(e,t){for(const i of t||[])this.changeOne(e,i,[])}changeOne(e,t,i){if(E6(i))this._data.delete(t,e)&&this._onMarkerChanged.fire([t]);else{const n=[];for(const s of i){const r=mp._toMarker(e,t,s);r&&n.push(r)}this._data.set(t,e,n),this._onMarkerChanged.fire([t])}}static _toMarker(e,t,i){let{code:n,severity:s,message:r,source:a,startLineNumber:l,startColumn:c,endLineNumber:d,endColumn:h,relatedInformation:u,tags:f,origin:g}=i;if(r)return l=l>0?l:1,c=c>0?c:1,d=d>=l?d:l,h=h>0?h:c,{resource:t,owner:e,code:n,severity:s,message:r,source:a,startLineNumber:l,startColumn:c,endLineNumber:d,endColumn:h,relatedInformation:u,tags:f,origin:g}}changeAll(e,t){const i=[],n=this._data.values(e);if(n)for(const s of n){const r=Ye.first(s);r&&(i.push(r.resource),this._data.delete(r.resource,e))}if(is(t)){const s=new Li;for(const{resource:r,marker:a}of t){const l=mp._toMarker(e,r,a);if(!l)continue;const c=s.get(r);c?c.push(l):(s.set(r,[l]),i.push(r))}for(const[r,a]of s)this._data.set(r,e,a)}i.length>0&&this._onMarkerChanged.fire(i)}_createFilteredMarker(e,t){const i=t.length===1?p(1721,'Problems are paused because: "{0}"',t[0]):p(1722,'Problems are paused because: "{0}" and {1} more',t[0],t.length-1);return{owner:"markersFilter",resource:e,severity:oi.Info,message:i,startLineNumber:1,startColumn:1,endLineNumber:1,endColumn:1}}read(e=Object.create(null)){let{owner:t,resource:i,severities:n,take:s}=e;if((!s||s<0)&&(s=-1),t&&i){const r=e.ignoreResourceFilters?void 0:this._filteredResources.get(i);if(r?.length)return[this._createFilteredMarker(i,r)];const a=this._data.get(i,t);if(!a)return[];const l=[];for(const c of a){if(s>0&&l.length===s)break;const d=e.ignoreResourceFilters?void 0:this._filteredResources.get(i);d?.length?l.push(this._createFilteredMarker(i,d)):mp._accept(c,n)&&l.push(c)}return l}else{const r=!t&&!i?this._data.values():this._data.values(i??t),a=[],l=new Hse;for(const c of r)for(const d of c){if(l.has(d.resource))continue;if(s>0&&a.length===s)break;const h=e.ignoreResourceFilters?void 0:this._filteredResources.get(d.resource);h?.length?(a.push(this._createFilteredMarker(d.resource,h)),l.add(d.resource)):mp._accept(d,n)&&a.push(d)}return a}}static _accept(e,t){return t===void 0||(t&e.severity)===e.severity}static _merge(e){const t=new Li;for(const i of e)for(const n of i)t.set(n,!0);return Array.from(t.keys())}}class qAe extends A{get configurationModel(){return this._configurationModel}constructor(e){super(),this.logService=e,this._configurationModel=wn.createEmptyModel(e)}reload(){return this.resetConfigurationModel(),this.configurationModel}getConfigurationDefaultOverrides(){return{}}resetConfigurationModel(){this._configurationModel=wn.createEmptyModel(this.logService);const e=ei.as(ka.Configuration).getConfigurationProperties();this.updateConfigurationModel(Object.keys(e),e)}updateConfigurationModel(e,t){const i=this.getConfigurationDefaultOverrides();for(const n of e){const s=i[n],r=t[n];s!==void 0?this._configurationModel.setValue(n,s):r?this._configurationModel.setValue(n,fl(r.default)):this._configurationModel.removeValue(n)}}}class KAe extends A{constructor(e,t=[]){super(),this.logger=new Qse([e,...t]),this._register(e.onDidChangeLogLevel(i=>this.setLevel(i)))}get onDidChangeLogLevel(){return this.logger.onDidChangeLogLevel}setLevel(e){this.logger.setLevel(e)}getLevel(){return this.logger.getLevel()}trace(e,...t){this.logger.trace(e,...t)}debug(e,...t){this.logger.debug(e,...t)}info(e,...t){this.logger.info(e,...t)}warn(e,...t){this.logger.warn(e,...t)}error(e,...t){this.logger.error(e,...t)}}class GAe{getParserClass(){throw new Error("getParserClass is not implemented in StandaloneTreeSitterLibraryService")}supportsLanguage(e,t){return!1}getLanguage(e,t){}getInjectionQueries(e,t){return null}getHighlightingQueries(e,t){return null}}var oc=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Ri=function(o,e){return function(t,i){e(t,i,o)}};class ZAe{constructor(e){this.disposed=!1,this.model=e,this._onWillDispose=new P}get textEditorModel(){return this.model}dispose(){this.disposed=!0,this._onWillDispose.fire()}}let WW=class{constructor(e){this.modelService=e}createModelReference(e){const t=this.modelService.getModel(e);return t?Promise.resolve(new sie(new ZAe(t))):Promise.reject(new Error("Model not found"))}};WW=oc([Ri(0,Qt)],WW);const PT=class PT{show(){return PT.NULL_PROGRESS_RUNNER}async showWhile(e,t){await e}};PT.NULL_PROGRESS_RUNNER={done:()=>{},total:()=>{},worked:()=>{}};let BW=PT;class YAe{withProgress(e,t,i){return t({report:()=>{}})}}class XAe{constructor(){this.isExtensionDevelopment=!1,this.isBuilt=!1}}class QAe{async confirm(e){return{confirmed:this.doConfirm(e.message,e.detail),checkboxChecked:!1}}doConfirm(e,t){let i=e;return t&&(i=i+`
`+t),bt.confirm(i)}async prompt(e){let t;if(this.doConfirm(e.message,e.detail)){const n=[...e.buttons??[]];e.cancelButton&&typeof e.cancelButton!="string"&&typeof e.cancelButton!="boolean"&&n.push(e.cancelButton),t=await n[0]?.run({checkboxChecked:!1})}return{result:t}}async error(e,t){await this.prompt({type:ii.Error,message:e,detail:t})}}const HS=class HS{info(e){return this.notify({severity:ii.Info,message:e})}warn(e){return this.notify({severity:ii.Warning,message:e})}error(e){return this.notify({severity:ii.Error,message:e})}notify(e){switch(e.severity){case ii.Error:console.error(e.message);break;case ii.Warning:console.warn(e.message);break;default:console.log(e.message);break}return HS.NO_OP}prompt(e,t,i,n){return HS.NO_OP}status(e,t){return{close:()=>{}}}};HS.NO_OP=new Lue;let HW=HS,VW=class{constructor(e){this._onWillExecuteCommand=new P,this._onDidExecuteCommand=new P,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this._instantiationService=e}executeCommand(e,...t){const i=Xe.getCommand(e);if(!i)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});const n=this._instantiationService.invokeFunction.apply(this._instantiationService,[i.handler,...t]);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}};VW=oc([Ri(0,ge)],VW);let hC=class extends NPe{constructor(e,t,i,n,s,r){super(e,t,i,n,s),this._cachedResolver=null,this._dynamicKeybindings=[],this._domNodeListeners=[];const a=f=>{const g=new U;g.add(W(f,te.KEY_DOWN,m=>{const _=new St(m);this._dispatch(_,_.target)&&(_.preventDefault(),_.stopPropagation())})),g.add(W(f,te.KEY_UP,m=>{const _=new St(m);this._singleModifierDispatch(_,_.target)&&_.preventDefault()})),this._domNodeListeners.push(new JAe(f,g))},l=f=>{for(let g=0;g<this._domNodeListeners.length;g++){const m=this._domNodeListeners[g];m.domNode===f&&(this._domNodeListeners.splice(g,1),m.dispose())}},c=f=>{f.getOption(70)||a(f.getContainerDomNode())},d=f=>{f.getOption(70)||l(f.getContainerDomNode())};this._register(r.onCodeEditorAdd(c)),this._register(r.onCodeEditorRemove(d)),r.listCodeEditors().forEach(c);const h=f=>{a(f.getContainerDomNode())},u=f=>{l(f.getContainerDomNode())};this._register(r.onDiffEditorAdd(h)),this._register(r.onDiffEditorRemove(u)),r.listDiffEditors().forEach(h)}addDynamicKeybinding(e,t,i,n){return jr(Xe.registerCommand(e,i),this.addDynamicKeybindings([{keybinding:t,command:e,when:n}]))}addDynamicKeybindings(e){const t=e.map(i=>({keybinding:nR(i.keybinding,so),command:i.command??null,commandArgs:i.commandArgs,when:i.when,weight1:1e3,weight2:0,extensionId:null,isBuiltinExtension:!1}));return this._dynamicKeybindings=this._dynamicKeybindings.concat(t),this.updateResolver(),ue(()=>{for(let i=0;i<this._dynamicKeybindings.length;i++)if(this._dynamicKeybindings[i]===t[0]){this._dynamicKeybindings.splice(i,t.length),this.updateResolver();return}})}updateResolver(){this._cachedResolver=null,this._onDidUpdateKeybindings.fire()}_getResolver(){if(!this._cachedResolver){const e=this._toNormalizedKeybindingItems(rn.getDefaultKeybindings(),!0),t=this._toNormalizedKeybindingItems(this._dynamicKeybindings,!1);this._cachedResolver=new hS(e,t,i=>this._log(i))}return this._cachedResolver}_documentHasFocus(){return bt.document.hasFocus()}_toNormalizedKeybindingItems(e,t){const i=[];let n=0;for(const s of e){const r=s.when||void 0,a=s.keybinding;if(!a)i[n++]=new pee(void 0,s.command,s.commandArgs,r,t,null,!1);else{const l=uS.resolveKeybinding(a,so);for(const c of l)i[n++]=new pee(c,s.command,s.commandArgs,r,t,null,!1)}}return i}resolveKeyboardEvent(e){const t=new Sc(e.ctrlKey,e.shiftKey,e.altKey,e.metaKey,e.keyCode);return new uS([t],so)}};hC=oc([Ri(0,xe),Ri(1,Tt),Ri(2,Vn),Ri(3,hi),Ri(4,Rt),Ri(5,et)],hC);class JAe extends A{constructor(e,t){super(),this.domNode=e,this._register(t)}}function Gee(o){return o&&typeof o=="object"&&(!o.overrideIdentifier||typeof o.overrideIdentifier=="string")&&(!o.resource||o.resource instanceof be)}let qE=class{constructor(e){this.logService=e,this._onDidChangeConfiguration=new P,this.onDidChangeConfiguration=this._onDidChangeConfiguration.event;const t=new qAe(e);this._configuration=new RE(t.reload(),wn.createEmptyModel(e),wn.createEmptyModel(e),wn.createEmptyModel(e),wn.createEmptyModel(e),wn.createEmptyModel(e),new Li,wn.createEmptyModel(e),new Li,e),t.dispose()}getValue(e,t){const i=typeof e=="string"?e:void 0,n=Gee(e)?e:Gee(t)?t:{};return this._configuration.getValue(i,n,void 0)}updateValues(e){const t={data:this._configuration.toData()},i=[];for(const n of e){const[s,r]=n;this.getValue(s)!==r&&(this._configuration.updateValue(s,r),i.push(s))}if(i.length>0){const n=new kPe({keys:i,overrides:[]},t,this._configuration,void 0,this.logService);n.source=8,this._onDidChangeConfiguration.fire(n)}return Promise.resolve()}updateValue(e,t,i,n){return this.updateValues([[e,t]])}inspect(e,t={}){return this._configuration.inspect(e,t,void 0)}};qE=oc([Ri(0,Rt)],qE);let zW=class{constructor(e,t,i){this.configurationService=e,this.modelService=t,this.languageService=i,this._onDidChangeConfiguration=new P,this.configurationService.onDidChangeConfiguration(n=>{this._onDidChangeConfiguration.fire({affectedKeys:n.affectedKeys,affectsConfiguration:(s,r)=>n.affectsConfiguration(r)})})}getValue(e,t,i){const n=M.isIPosition(t)?t:null,s=n?typeof i=="string"?i:void 0:typeof t=="string"?t:void 0,r=e?this.getLanguage(e,n):void 0;return typeof s>"u"?this.configurationService.getValue({resource:e,overrideIdentifier:r}):this.configurationService.getValue(s,{resource:e,overrideIdentifier:r})}getLanguage(e,t){const i=this.modelService.getModel(e);return i?t?i.getLanguageIdAtPosition(t.lineNumber,t.column):i.getLanguageId():this.languageService.guessLanguageIdByFilepathOrFirstLine(e)}};zW=oc([Ri(0,Me),Ri(1,Qt),Ri(2,Mt)],zW);let UW=class{constructor(e){this.configurationService=e}getEOL(e,t){const i=this.configurationService.getValue("files.eol",{overrideIdentifier:t,resource:e});return i&&typeof i=="string"&&i!=="auto"?i:Ws||ze?`
`:`\r
`}};UW=oc([Ri(0,Me)],UW);class eOe{publicLog2(){}}const VS=class VS{constructor(){const e=be.from({scheme:VS.SCHEME,authority:"model",path:"/"});this.workspace={id:PK,folders:[new Qve({uri:e,name:"",index:0})]}}getWorkspace(){return this.workspace}getWorkspaceFolder(e){return e&&e.scheme===VS.SCHEME?this.workspace.folders[0]:null}};VS.SCHEME="inmemory";let $W=VS;function KE(o,e,t){if(!e||!(o instanceof qE))return;const i=[];Object.keys(e).forEach(n=>{mwe(n)&&i.push([`editor.${n}`,e[n]]),t&&_we(n)&&i.push([`diffEditor.${n}`,e[n]])}),i.length>0&&o.updateValues(i)}let jW=class{constructor(e){this._modelService=e}hasPreviewHandler(){return!1}async apply(e,t){const i=Array.isArray(e)?e:jO.convert(e),n=new Map;for(const a of i){if(!(a instanceof jh))throw new Error("bad edit - only text edits are supported");const l=this._modelService.getModel(a.resource);if(!l)throw new Error("bad edit - model not found");if(typeof a.versionId=="number"&&l.getVersionId()!==a.versionId)throw new Error("bad state - model changed in the meantime");let c=n.get(l);c||(c=[],n.set(l,c)),c.push(fi.replaceMove(k.lift(a.textEdit.range),a.textEdit.text))}let s=0,r=0;for(const[a,l]of n)a.pushStackElement(),a.pushEditOperations([],l,()=>[]),a.pushStackElement(),r+=1,s+=l.length;return{ariaSummary:tf(g9.bulkEditServiceSummary,s,r),isApplied:s>0}}};jW=oc([Ri(0,Qt)],jW);class tOe{getUriLabel(e,t){return e.scheme==="file"?e.fsPath:e.path}getUriBasenameLabel(e){return vr(e)}}let qW=class extends CPe{constructor(e,t){super(e),this._codeEditorService=t}showContextView(e,t,i){if(!t){const n=this._codeEditorService.getFocusedCodeEditor()||this._codeEditorService.getActiveCodeEditor();n&&(t=n.getContainerDomNode())}return super.showContextView(e,t,i)}};qW=oc([Ri(0,Hl),Ri(1,et)],qW);class iOe{constructor(){this._neverEmitter=new P,this.onDidChangeTrust=this._neverEmitter.event}isWorkspaceTrusted(){return!0}}class nOe extends Q8{constructor(){super()}}class sOe extends KAe{constructor(){super(new Xse)}}let KW=class extends iW{constructor(e,t,i,n,s,r){super(e,t,i,n,s,r),this.configure({blockMouse:!1})}};KW=oc([Ri(0,Vn),Ri(1,hi),Ri(2,hd),Ri(3,ot),Ri(4,Cr),Ri(5,xe)],KW);const oOe={esmModuleLocation:void 0,label:"editorWorkerService"};let GW=class extends O8{constructor(e,t,i,n,s){super(oOe,e,t,i,n,s)}};GW=oc([Ri(0,Qt),Ri(1,ZD),Ri(2,Rt),Ri(3,Jt),Ri(4,he)],GW);class rOe{async playSignal(e,t){}}je(Rt,sOe,0),je(Me,qE,0),je(ZD,zW,0),je(NQ,UW,0),je(pd,$W,0),je(zg,tOe,0),je(Vn,eOe,0),je(Y0,QAe,0),je(k4,XAe,0),je(hi,HW,0),je(zl,mp,0),je(Mt,nOe,0),je(ir,dMe,0),je(Qt,cW,0),je(j2,lW,0),je(xe,FW,0),je(X$,YAe,0),je(sd,BW,0),je(Es,O1e,0),je(Xs,GW,0),je(yw,jW,0),je(GQ,iOe,0),je(ns,WW,0),je(bn,RW,0),je(Fr,dye,0),je(Tt,VW,0),je(ot,hC,0),je(Zn,EW,0),je(hd,qW,0),je(Js,aW,0),je(Wa,PW,0),je(Ko,KW,0),je(Cr,PO,0),je(nd,rOe,0),je(jP,GAe,0),je(PH,toe,0),je(TF,lke,0);var De;(function(o){const e=new O_;for(const[l,c]of nV())e.set(l,c);const t=new jE(e,!0);e.set(ge,t);function i(l){n||r({});const c=e.get(l);if(!c)throw new Error("Missing service "+l);return c instanceof gl?t.invokeFunction(d=>d.get(l)):c}o.get=i;let n=!1;const s=new P;function r(l){if(n)return t;n=!0;for(const[d,h]of nV())e.get(d)||e.set(d,h);for(const d in l)if(l.hasOwnProperty(d)){const h=We(d);e.get(h)instanceof gl&&e.set(h,l[d])}const c=Xwe();for(const d of c)try{t.createInstance(d)}catch(h){Ee(h)}return s.fire(),t}o.initialize=r;function a(l){if(n)return l();const c=new U,d=c.add(s.event(()=>{d.dispose(),c.add(l())}));return c}o.withServices=a})(De||(De={}));var ZW=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},zt=function(o,e){return function(t,i){e(t,i,o)}};let aOe=0,Zee=!1;function lOe(o){if(!o){if(Zee)return;Zee=!0}mse(o||bt.document.body)}let GE=class extends sg{constructor(e,t,i,n,s,r,a,l,c,d,h,u,f){const g={...t};g.ariaLabel=g.ariaLabel||u9.editorViewAccessibleLabel,super(e,g,{},i,n,s,r,c,d,h,u,f),l instanceof hC?this._standaloneKeybindingService=l:this._standaloneKeybindingService=null,lOe(g.ariaContainerElement),Eme((m,_)=>i.createInstance(Q_,m,{instantHover:_},{})),Abe(a)}addCommand(e,t,i){if(!this._standaloneKeybindingService)return console.warn("Cannot add command because the editor is configured with an unrecognized KeybindingService"),null;const n="DYNAMIC_"+ ++aOe,s=K.deserialize(i);return this._standaloneKeybindingService.addDynamicKeybinding(n,e,t,s),n}createContextKey(e,t){return this._contextKeyService.createKey(e,t)}addAction(e){if(typeof e.id!="string"||typeof e.label!="string"||typeof e.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");if(!this._standaloneKeybindingService)return console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),A.None;const t=e.id,i=e.label,n=K.and(K.equals("editorId",this.getId()),K.deserialize(e.precondition)),s=e.keybindings,r=K.and(n,K.deserialize(e.keybindingContext)),a=e.contextMenuGroupId||null,l=e.contextMenuOrder||0,c=(f,...g)=>Promise.resolve(e.run(this,...g)),d=new U,h=this.getId()+":"+t;if(d.add(Xe.registerCommand(h,c)),a){const f={command:{id:h,title:i},when:n,group:a,order:l};d.add(an.appendMenuItem(de.EditorContext,f))}if(Array.isArray(s))for(const f of s)d.add(this._standaloneKeybindingService.addDynamicKeybinding(h,f,c,r));const u=new TU(h,i,i,void 0,n,(...f)=>Promise.resolve(e.run(this,...f)),this._contextKeyService);return this._actions.set(t,u),d.add(ue(()=>{this._actions.delete(t)})),d}_triggerCommand(e,t){if(this._codeEditorService instanceof xE)try{this._codeEditorService.setActiveCodeEditor(this),super._triggerCommand(e,t)}finally{this._codeEditorService.setActiveCodeEditor(null)}else super._triggerCommand(e,t)}};GE=ZW([zt(2,ge),zt(3,et),zt(4,Tt),zt(5,xe),zt(6,Qs),zt(7,ot),zt(8,li),zt(9,hi),zt(10,bn),zt(11,Jt),zt(12,he)],GE);let YW=class extends GE{constructor(e,t,i,n,s,r,a,l,c,d,h,u,f,g,m,_){const b={...t};KE(h,b,!1);const C=c.registerEditorContainer(e);typeof b.theme=="string"&&c.setTheme(b.theme),typeof b.autoDetectHighContrast<"u"&&c.setAutoDetectHighContrast(!!b.autoDetectHighContrast);const w=b.model;delete b.model,super(e,b,i,n,s,r,a,l,c,d,u,m,_),this._configurationService=h,this._standaloneThemeService=c,this._register(C);let v;if(typeof w>"u"){const S=g.getLanguageIdByMimeType(b.language)||b.language||Fo;v=Yee(f,g,b.value||"",S,void 0),this._ownsModel=!0}else v=w,this._ownsModel=!1;if(this._attachModel(v),v){const S={oldModelUrl:null,newModelUrl:v.uri};this._onDidChangeModel.fire(S)}}dispose(){super.dispose()}updateOptions(e){KE(this._configurationService,e,!1),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_postDetachModelCleanup(e){super._postDetachModelCleanup(e),e&&this._ownsModel&&(e.dispose(),this._ownsModel=!1)}};YW=ZW([zt(2,ge),zt(3,et),zt(4,Tt),zt(5,xe),zt(6,Qs),zt(7,ot),zt(8,ir),zt(9,hi),zt(10,Me),zt(11,bn),zt(12,Qt),zt(13,Mt),zt(14,Jt),zt(15,he)],YW);let XW=class extends Bl{constructor(e,t,i,n,s,r,a,l,c,d,h,u){const f={...t};KE(l,f,!0);const g=r.registerEditorContainer(e);typeof f.theme=="string"&&r.setTheme(f.theme),typeof f.autoDetectHighContrast<"u"&&r.setAutoDetectHighContrast(!!f.autoDetectHighContrast),super(e,f,{},n,i,s,u,d),this._configurationService=l,this._standaloneThemeService=r,this._register(g)}dispose(){super.dispose()}updateOptions(e){KE(this._configurationService,e,!0),typeof e.theme=="string"&&this._standaloneThemeService.setTheme(e.theme),typeof e.autoDetectHighContrast<"u"&&this._standaloneThemeService.setAutoDetectHighContrast(!!e.autoDetectHighContrast),super.updateOptions(e)}_createInnerEditor(e,t,i){return e.createInstance(GE,t,i)}getOriginalEditor(){return super.getOriginalEditor()}getModifiedEditor(){return super.getModifiedEditor()}addCommand(e,t,i){return this.getModifiedEditor().addCommand(e,t,i)}createContextKey(e,t){return this.getModifiedEditor().createContextKey(e,t)}addAction(e){return this.getModifiedEditor().addAction(e)}};XW=ZW([zt(2,ge),zt(3,xe),zt(4,et),zt(5,ir),zt(6,hi),zt(7,Me),zt(8,Ko),zt(9,sd),zt(10,Wa),zt(11,nd)],XW);function Yee(o,e,t,i,n){if(t=t||"",!i){const s=t.indexOf(`
`);let r=t;return s!==-1&&(r=t.substring(0,s)),Xee(o,t,e.createByFilepathOrFirstLine(n||null,r),n)}return Xee(o,t,e.createById(i),n)}function Xee(o,e,t,i){return o.createModel(e,t,i)}N("multiDiffEditor.headerBackground",{dark:"#262626",light:"tab.inactiveBackground",hcDark:"tab.inactiveBackground",hcLight:"tab.inactiveBackground"},p(139,"The background color of the diff editor's header")),N("multiDiffEditor.background",xi,p(140,"The background color of the multi file diff editor")),N("multiDiffEditor.border",{dark:"sideBarSectionHeader.border",light:"#cccccc",hcDark:"sideBarSectionHeader.border",hcLight:"#cccccc"},p(141,"The border color of the multi file diff editor"));var cOe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Qee=function(o,e){return function(t,i){e(t,i,o)}};class dOe{constructor(e,t){this.viewModel=e,this.deltaScrollVertical=t}getId(){return this.viewModel}}let QW=class extends A{constructor(e,t,i,n,s){super(),this._container=e,this._overflowWidgetsDomNode=t,this._workbenchUIElementFactory=i,this._instantiationService=n,this._viewModel=Le(this,void 0),this._collapsed=j(this,l=>this._viewModel.read(l)?.collapsed.read(l)),this._editorContentHeight=Le(this,500),this.contentHeight=j(this,l=>(this._collapsed.read(l)?0:this._editorContentHeight.read(l))+this._outerEditorHeight),this._modifiedContentWidth=Le(this,0),this._modifiedWidth=Le(this,0),this._originalContentWidth=Le(this,0),this._originalWidth=Le(this,0),this.maxScroll=j(this,l=>{const c=this._modifiedContentWidth.read(l)-this._modifiedWidth.read(l),d=this._originalContentWidth.read(l)-this._originalWidth.read(l);return c>d?{maxScroll:c,width:this._modifiedWidth.read(l)}:{maxScroll:d,width:this._originalWidth.read(l)}}),this._elements=Je("div.multiDiffEntry",[Je("div.header@header",[Je("div.header-content",[Je("div.collapse-button@collapseButton"),Je("div.file-path",[Je("div.title.modified.show-file-icons@primaryPath",[]),Je("div.status.deleted@status",["R"]),Je("div.title.original.show-file-icons@secondaryPath",[])]),Je("div.actions@actions")])]),Je("div.editorParent",[Je("div.editorContainer@editor")])]),this.editor=this._register(this._instantiationService.createInstance(Bl,this._elements.editor,{overflowWidgetsDomNode:this._overflowWidgetsDomNode},{})),this.isModifedFocused=ni(this.editor.getModifiedEditor()).isFocused,this.isOriginalFocused=ni(this.editor.getOriginalEditor()).isFocused,this.isFocused=j(this,l=>this.isModifedFocused.read(l)||this.isOriginalFocused.read(l)),this._resourceLabel=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath)):void 0,this._resourceLabel2=this._workbenchUIElementFactory.createResourceLabel?this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath)):void 0,this._dataStore=this._register(new U),this._headerHeight=40,this._lastScrollTop=-1,this._isSettingScrollTop=!1;const r=new Tk(this._elements.collapseButton,{});this._register(Se(l=>{r.element.className="",r.icon=this._collapsed.read(l)?Y.chevronRight:Y.chevronDown})),this._register(r.onDidClick(()=>{this._viewModel.get()?.collapsed.set(!this._collapsed.get(),void 0)})),this._register(Se(l=>{this._elements.editor.style.display=this._collapsed.read(l)?"none":"block"})),this._register(this.editor.getModifiedEditor().onDidLayoutChange(l=>{const c=this.editor.getModifiedEditor().getLayoutInfo().contentWidth;this._modifiedWidth.set(c,void 0)})),this._register(this.editor.getOriginalEditor().onDidLayoutChange(l=>{const c=this.editor.getOriginalEditor().getLayoutInfo().contentWidth;this._originalWidth.set(c,void 0)})),this._register(this.editor.onDidContentSizeChange(l=>{g1(c=>{this._editorContentHeight.set(l.contentHeight,c),this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(),c),this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(),c)})})),this._register(this.editor.getOriginalEditor().onDidScrollChange(l=>{if(this._isSettingScrollTop||!l.scrollTopChanged||!this._data)return;const c=l.scrollTop-this._lastScrollTop;this._data.deltaScrollVertical(c)})),this._register(Se(l=>{const c=this._viewModel.read(l)?.isActive.read(l);this._elements.root.classList.toggle("active",c)})),this._container.appendChild(this._elements.root),this._outerEditorHeight=this._headerHeight,this._contextKeyService=this._register(s.createScoped(this._elements.actions));const a=this._register(this._instantiationService.createChild(new O_([xe,this._contextKeyService])));this._register(a.createInstance(bw,this._elements.actions,de.MultiDiffEditorFileToolbar,{actionRunner:this._register(new gK(()=>this._viewModel.get()?.modifiedUri)),menuOptions:{shouldForwardArgs:!0},toolbarOptions:{primaryGroup:l=>l.startsWith("navigation")},actionViewItemProvider:(l,c)=>MO(a,l,c)}))}setScrollLeft(e){this._modifiedContentWidth.get()-this._modifiedWidth.get()>this._originalContentWidth.get()-this._originalWidth.get()?this.editor.getModifiedEditor().setScrollLeft(e):this.editor.getOriginalEditor().setScrollLeft(e)}setData(e){this._data=e;function t(n){return{...n,scrollBeyondLastLine:!1,hideUnchangedRegions:{enabled:!0},scrollbar:{vertical:"hidden",horizontal:"hidden",handleMouseWheel:!1,useShadows:!1},renderOverviewRuler:!1,fixedOverflowWidgets:!0,overviewRulerBorder:!1}}if(!e){g1(n=>{this._viewModel.set(void 0,n),this.editor.setDiffModel(null,n),this._dataStore.clear()});return}const i=e.viewModel.documentDiffItem;if(g1(n=>{this._resourceLabel?.setUri(e.viewModel.modifiedUri??e.viewModel.originalUri,{strikethrough:e.viewModel.modifiedUri===void 0});let s=!1,r=!1,a=!1,l="";e.viewModel.modifiedUri&&e.viewModel.originalUri&&e.viewModel.modifiedUri.path!==e.viewModel.originalUri.path?(l="R",s=!0):e.viewModel.modifiedUri?e.viewModel.originalUri||(l="A",a=!0):(l="D",r=!0),this._elements.status.classList.toggle("renamed",s),this._elements.status.classList.toggle("deleted",r),this._elements.status.classList.toggle("added",a),this._elements.status.innerText=l,this._resourceLabel2?.setUri(s?e.viewModel.originalUri:void 0,{strikethrough:!0}),this._dataStore.clear(),this._viewModel.set(e.viewModel,n),this.editor.setDiffModel(e.viewModel.diffEditorViewModelRef,n),this.editor.updateOptions(t(i.options??{}))}),i.onOptionsDidChange&&this._dataStore.add(i.onOptionsDidChange(()=>{this.editor.updateOptions(t(i.options??{}))})),e.viewModel.isAlive.recomputeInitiallyAndOnChange(this._dataStore,n=>{n||this.setData(void 0)}),e.viewModel.documentDiffItem.contextKeys)for(const[n,s]of Object.entries(e.viewModel.documentDiffItem.contextKeys))this._contextKeyService.createKey(n,s)}render(e,t,i,n){this._elements.root.style.visibility="visible",this._elements.root.style.top=`${e.start}px`,this._elements.root.style.height=`${e.length}px`,this._elements.root.style.width=`${t}px`,this._elements.root.style.position="absolute";const s=e.length-this._headerHeight,r=Math.max(0,Math.min(n.start-e.start,s));this._elements.header.style.transform=`translateY(${r}px)`,g1(a=>{this.editor.layout({width:t-16-2,height:e.length-this._outerEditorHeight})});try{this._isSettingScrollTop=!0,this._lastScrollTop=i,this.editor.getOriginalEditor().setScrollTop(i)}finally{this._isSettingScrollTop=!1}this._elements.header.classList.toggle("shadow",r>0||i>0),this._elements.header.classList.toggle("collapsed",r===s)}hide(){this._elements.root.style.top="-100000px",this._elements.root.style.visibility="hidden"}};QW=cOe([Qee(3,ge),Qee(4,xe)],QW);class hOe{constructor(e){this._create=e,this._unused=new Set,this._used=new Set,this._itemData=new Map}getUnusedObj(e){let t;if(this._unused.size===0)t=this._create(e),this._itemData.set(t,e);else{const i=[...this._unused.values()];t=i.find(n=>this._itemData.get(n).getId()===e.getId())??i[0],this._unused.delete(t),this._itemData.set(t,e),t.setData(e)}return this._used.add(t),{object:t,dispose:()=>{this._used.delete(t),this._unused.size>5?t.dispose():this._unused.add(t)}}}dispose(){for(const e of this._used)e.dispose();for(const e of this._unused)e.dispose();this._used.clear(),this._unused.clear()}}var uOe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},Jee=function(o,e){return function(t,i){e(t,i,o)}};let JW=class extends A{constructor(e,t,i,n,s,r){super(),this._element=e,this._dimension=t,this._viewModel=i,this._workbenchUIElementFactory=n,this._parentContextKeyService=s,this._parentInstantiationService=r,this._scrollableElements=Je("div.scrollContent",[Je("div@content",{style:{overflow:"hidden"}}),Je("div.monaco-editor@overflowWidgetsDomNode",{})]),this._scrollable=this._register(new __({forceIntegerValues:!1,scheduleAtNextAnimationFrame:c=>Hs(me(this._element),c),smoothScrollDuration:100})),this._scrollableElement=this._register(new VL(this._scrollableElements.root,{vertical:1,horizontal:1,useShadows:!1},this._scrollable)),this._elements=Je("div.monaco-component.multiDiffEditor",{},[Je("div",{},[this._scrollableElement.getDomNode()]),Je("div.placeholder@placeholder",{},[Je("div")])]),this._sizeObserver=this._register(new pq(this._element,void 0)),this._objectPool=this._register(new hOe(c=>{const d=this._instantiationService.createInstance(QW,this._scrollableElements.content,this._scrollableElements.overflowWidgetsDomNode,this._workbenchUIElementFactory);return d.setData(c),d})),this.scrollTop=rt(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollTop),this.scrollLeft=rt(this,this._scrollableElement.onScroll,()=>this._scrollableElement.getScrollPosition().scrollLeft),this._viewItemsInfo=j(this,c=>{const d=this._viewModel.read(c);if(!d)return{items:[],getItem:g=>{throw new Ce}};const h=d.items.read(c),u=new Map;return{items:h.map(g=>{const m=c.store.add(new fOe(g,this._objectPool,this.scrollLeft,b=>{this._scrollableElement.setScrollPosition({scrollTop:this._scrollableElement.getScrollPosition().scrollTop+b})})),_=this._lastDocStates?.[m.getKey()];return _&&Dt(b=>{m.setViewState(_,b)}),u.set(g,m),m}),getItem:g=>u.get(g)}}),this._viewItems=this._viewItemsInfo.map(this,c=>c.items),this._spaceBetweenPx=0,this._totalHeight=this._viewItems.map(this,(c,d)=>c.reduce((h,u)=>h+u.contentHeight.read(d)+this._spaceBetweenPx,0)),this.activeControl=j(this,c=>{const d=this._viewModel.read(c)?.activeDiffItem.read(c);return d?this._viewItemsInfo.read(c).getItem(d).template.read(c)?.editor:void 0}),this._contextKeyService=this._register(this._parentContextKeyService.createScoped(this._element)),this._instantiationService=this._register(this._parentInstantiationService.createChild(new O_([xe,this._contextKeyService]))),this._lastDocStates={},this._register(Bn((c,d)=>{const h=this._viewModel.read(c);if(h&&h.contextKeys)for(const[u,f]of Object.entries(h.contextKeys)){const g=this._contextKeyService.createKey(u,void 0);g.set(f),d.add(ue(()=>g.reset()))}}));const a=this._parentContextKeyService.createKey(T.multiDiffEditorAllCollapsed.key,!1);this._register(Se(c=>{const d=this._viewModel.read(c);if(d){const h=d.items.read(c).every(u=>u.collapsed.read(c));a.set(h)}})),this._register(Se(c=>{const d=this._dimension.read(c);this._sizeObserver.observe(d)}));const l=j(c=>{if(this._viewItems.read(c).length>0)return;const h=this._viewModel.read(c);return!h||h.isLoading.read(c)?p(142,"Loading..."):p(143,"No Changed Files")});this._register(Se(c=>{const d=l.read(c);this._elements.placeholder.innerText=d??"",this._elements.placeholder.classList.toggle("visible",!!d)})),this._scrollableElements.content.style.position="relative",this._register(Se(c=>{const d=this._sizeObserver.height.read(c);this._scrollableElements.root.style.height=`${d}px`;const h=this._totalHeight.read(c);this._scrollableElements.content.style.height=`${h}px`;const u=this._sizeObserver.width.read(c);let f=u;const g=this._viewItems.read(c),m=FM(g,kn(_=>_.maxScroll.read(c).maxScroll,lo));if(m){const _=m.maxScroll.read(c);f=u+_.maxScroll}this._scrollableElement.setScrollDimensions({width:u,height:d,scrollHeight:h,scrollWidth:f})})),e.replaceChildren(this._elements.root),this._register(ue(()=>{e.replaceChildren()})),this._register(this._register(Se(c=>{g1(d=>{this.render(c)})})))}render(e){const t=this.scrollTop.read(e);let i=0,n=0,s=0;const r=this._sizeObserver.height.read(e),a=pe.ofStartAndLength(t,r),l=this._sizeObserver.width.read(e);for(const c of this._viewItems.read(e)){const d=c.contentHeight.read(e),h=Math.min(d,r),u=pe.ofStartAndLength(n,h),f=pe.ofStartAndLength(s,d);if(f.isBefore(a))i-=d-h,c.hide();else if(f.isAfter(a))c.hide();else{const g=Math.max(0,Math.min(a.start-f.start,d-h));i-=g;const m=pe.ofStartAndLength(t+i,r);c.render(u,g,l,m)}n+=h+this._spaceBetweenPx,s+=d+this._spaceBetweenPx}this._scrollableElements.content.style.transform=`translateY(${-(t+i)}px)`}};JW=uOe([Jee(4,xe),Jee(5,ge)],JW);class fOe extends A{constructor(e,t,i,n){super(),this.viewModel=e,this._objectPool=t,this._scrollLeft=i,this._deltaScrollVertical=n,this._templateRef=this._register(KR(this,void 0)),this.contentHeight=j(this,s=>this._templateRef.read(s)?.object.contentHeight?.read(s)??this.viewModel.lastTemplateData.read(s).contentHeight),this.maxScroll=j(this,s=>this._templateRef.read(s)?.object.maxScroll.read(s)??{maxScroll:0,scrollWidth:0}),this.template=j(this,s=>this._templateRef.read(s)?.object),this._isHidden=Le(this,!1),this._isFocused=j(this,s=>this.template.read(s)?.isFocused.read(s)??!1),this.viewModel.setIsFocused(this._isFocused,void 0),this._register(Se(s=>{const r=this._scrollLeft.read(s);this._templateRef.read(s)?.object.setScrollLeft(r)})),this._register(Se(s=>{const r=this._templateRef.read(s);!r||!this._isHidden.read(s)||r.object.isFocused.read(s)||this._clear()}))}dispose(){this._clear(),super.dispose()}toString(){return`VirtualViewItem(${this.viewModel.documentDiffItem.modified?.uri.toString()})`}getKey(){return this.viewModel.getKey()}setViewState(e,t){this.viewModel.collapsed.set(e.collapsed,t),this._updateTemplateData(t);const i=this.viewModel.lastTemplateData.get(),n=e.selections?.map(ce.liftSelection);this.viewModel.lastTemplateData.set({...i,selections:n},t);const s=this._templateRef.get();s&&n&&s.object.editor.setSelections(n)}_updateTemplateData(e){const t=this._templateRef.get();t&&this.viewModel.lastTemplateData.set({contentHeight:t.object.contentHeight.get(),selections:t.object.editor.getSelections()??void 0},e)}_clear(){const e=this._templateRef.get();e&&Dt(t=>{this._updateTemplateData(t),e.object.hide(),this._templateRef.set(void 0,t)})}hide(){this._isHidden.set(!0,void 0)}render(e,t,i,n){this._isHidden.set(!1,void 0);let s=this._templateRef.get();if(!s){s=this._objectPool.getUnusedObj(new dOe(this.viewModel,this._deltaScrollVertical)),this._templateRef.set(s,void 0);const r=this.viewModel.lastTemplateData.get().selections;r&&s.object.editor.setSelections(r)}s.object.render(e,i,t,n)}}var gOe=function(o,e,t,i){var n=arguments.length,s=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,r;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(o,e,t,i);else for(var a=o.length-1;a>=0;a--)(r=o[a])&&(s=(n<3?r(s):n>3?r(e,t,s):r(e,t))||s);return n>3&&s&&Object.defineProperty(e,t,s),s},pOe=function(o,e){return function(t,i){e(t,i,o)}};let eB=class extends A{constructor(e,t,i){super(),this._element=e,this._workbenchUIElementFactory=t,this._instantiationService=i,this._dimension=Le(this,void 0),this._viewModel=Le(this,void 0),this._widgetImpl=j(this,n=>n.store.add(this._instantiationService.createInstance(id(JW),this._element,this._dimension,this._viewModel,this._workbenchUIElementFactory))),this._register(Fm(this._widgetImpl))}};eB=gOe([pOe(2,ge)],eB);function mOe(o,e,t){return De.initialize(t||{}).createInstance(YW,o,e)}function _Oe(o){return De.get(et).onCodeEditorAdd(t=>{o(t)})}function bOe(o){return De.get(et).onDiffEditorAdd(t=>{o(t)})}function COe(){return De.get(et).listCodeEditors()}function vOe(){return De.get(et).listDiffEditors()}function wOe(o,e,t){return De.initialize(t||{}).createInstance(XW,o,e)}function SOe(o,e){const t=De.initialize(e||{});return new eB(o,{},t)}function yOe(o){if(typeof o.id!="string"||typeof o.run!="function")throw new Error("Invalid command descriptor, `id` and `run` are required properties!");return Xe.registerCommand(o.id,o.run)}function LOe(o){if(typeof o.id!="string"||typeof o.label!="string"||typeof o.run!="function")throw new Error("Invalid action descriptor, `id`, `label` and `run` are required properties!");const e=K.deserialize(o.precondition),t=(n,...s)=>Bi.runEditorCommand(n,s,e,(r,a,l)=>Promise.resolve(o.run(a,...l))),i=new U;if(i.add(Xe.registerCommand(o.id,t)),o.contextMenuGroupId){const n={command:{id:o.id,title:o.label},when:e,group:o.contextMenuGroupId,order:o.contextMenuOrder||0};i.add(an.appendMenuItem(de.EditorContext,n))}if(Array.isArray(o.keybindings)){const n=De.get(ot);if(!(n instanceof hC))console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService");else{const s=K.and(e,K.deserialize(o.keybindingContext));i.add(n.addDynamicKeybindings(o.keybindings.map(r=>({keybinding:r,command:o.id,when:s}))))}}return i}function xOe(o){return ete([o])}function ete(o){const e=De.get(ot);return e instanceof hC?e.addDynamicKeybindings(o.map(t=>({keybinding:t.keybinding,command:t.command,commandArgs:t.commandArgs,when:K.deserialize(t.when)}))):(console.warn("Cannot add keybinding because the editor is configured with an unrecognized KeybindingService"),A.None)}function kOe(o,e,t){const i=De.get(Mt),n=i.getLanguageIdByMimeType(e)||e;return Yee(De.get(Qt),i,o,n,t)}function IOe(o,e){const t=De.get(Mt),i=t.getLanguageIdByMimeType(e)||e||Fo;o.setLanguage(t.createById(i))}function DOe(o,e,t){o&&De.get(zl).changeOne(e,o.uri,t)}function EOe(o){De.get(zl).changeAll(o,[])}function NOe(o){return De.get(zl).read(o)}function TOe(o){return De.get(zl).onMarkerChanged(o)}function ROe(o){return De.get(Qt).getModel(o)}function MOe(){return De.get(Qt).getModels()}function POe(o){return De.get(Qt).onModelAdded(o)}function AOe(o){return De.get(Qt).onModelRemoved(o)}function OOe(o){return De.get(Qt).onModelLanguageChanged(t=>{o({model:t.model,oldLanguage:t.oldLanguageId})})}function FOe(o){return qMe(De.get(Qt),o)}function WOe(o,e){const t=De.get(Mt),i=De.get(ir);return B8.colorizeElement(i,t,o,e).then(()=>{i.registerEditorContainer(o)})}function BOe(o,e,t){const i=De.get(Mt);return De.get(ir).registerEditorContainer(bt.document.body),B8.colorize(i,o,e,t)}function HOe(o,e,t=4){return De.get(ir).registerEditorContainer(bt.document.body),B8.colorizeModelLine(o,e,t)}function VOe(o){const e=di.get(o);return e||{getInitialState:()=>A_,tokenize:(t,i,n)=>VP(o,n)}}function zOe(o,e){di.getOrCreate(e);const t=VOe(e),i=ro(o),n=[];let s=t.getInitialState();for(let r=0,a=i.length;r<a;r++){const l=i[r],c=t.tokenize(l,!0,s);n[r]=c.tokens,s=c.endState}return n}function UOe(o,e){De.get(ir).defineTheme(o,e)}function $Oe(o){De.get(ir).setTheme(o)}function jOe(){Y2.clearAllFontInfos()}function qOe(o,e){return Xe.registerCommand({id:o,handler:e})}function KOe(o){return De.get(Js).registerOpener({async open(t){return typeof t=="string"&&(t=be.parse(t)),o.open(t)}})}function GOe(o){return De.get(et).registerCodeEditorOpenHandler(async(t,i,n)=>{if(!i)return null;const s=t.options?.selection;let r;return s&&typeof s.endLineNumber=="number"&&typeof s.endColumn=="number"?r=s:s&&(r={lineNumber:s.startLineNumber,column:s.startColumn}),await o.openCodeEditor(i,t.resource,r)?i:null})}function ZOe(){return{create:mOe,getEditors:COe,getDiffEditors:vOe,onDidCreateEditor:_Oe,onDidCreateDiffEditor:bOe,createDiffEditor:wOe,addCommand:yOe,addEditorAction:LOe,addKeybindingRule:xOe,addKeybindingRules:ete,createModel:kOe,setModelLanguage:IOe,setModelMarkers:DOe,getModelMarkers:NOe,removeAllMarkers:EOe,onDidChangeMarkers:TOe,getModels:MOe,getModel:ROe,onDidCreateModel:POe,onWillDisposeModel:AOe,onDidChangeModelLanguage:OOe,createWebWorker:FOe,colorizeElement:WOe,colorize:BOe,colorizeModelLine:HOe,tokenize:zOe,defineTheme:UOe,setTheme:$Oe,remeasureFonts:jOe,registerCommand:qOe,registerLinkOpener:KOe,registerEditorOpener:GOe,AccessibilitySupport:P9,ContentWidgetPositionPreference:H9,CursorChangeReason:V9,DefaultEndOfLine:z9,EditorAutoIndentStrategy:$9,EditorOption:j9,EndOfLinePreference:q9,EndOfLineSequence:K9,MinimapPosition:o8,MinimapSectionHeaderStyle:r8,MouseTargetType:a8,OverlayWidgetPositionPreference:d8,OverviewRulerLane:h8,GlyphMarginLane:G9,RenderLineNumbersType:g8,RenderMinimap:p8,ScrollbarVisibility:_8,ScrollType:m8,TextEditorCursorBlinkingStyle:L8,TextEditorCursorStyle:x8,TrackedRangeStickiness:k8,WrappingIndent:I8,InjectedTextCursorStops:X9,PositionAffinity:f8,ShowLightbulbIconMode:C8,TextDirection:y8,ConfigurationChangedEvent:xV,BareFontInfo:If,FontInfo:Z2,TextModelResolvedOptions:Xy,FindMatch:E1,ApplyUpdateResult:O1,EditorZoom:xr,createMultiFileDiffEditor:SOe,EditorType:vv,EditorOptions:Da}}function YOe(o,e){if(!e||!Array.isArray(e))return!1;for(const t of e)if(!o(t))return!1;return!0}function ZE(o,e){return typeof o=="boolean"?o:e}function tte(o,e){return typeof o=="string"?o:e}function XOe(o){const e={};for(const t of o)e[t]=!0;return e}function ite(o,e=!1){e&&(o=o.map(function(i){return i.toLowerCase()}));const t=XOe(o);return e?function(i){return t[i.toLowerCase()]!==void 0&&t.hasOwnProperty(i.toLowerCase())}:function(i){return t[i]!==void 0&&t.hasOwnProperty(i)}}function tB(o,e,t){e=e.replace(/@@/g,"");let i=0,n;do n=!1,e=e.replace(/@(\w+)/g,function(r,a){n=!0;let l="";if(typeof o[a]=="string")l=o[a];else if(o[a]&&o[a]instanceof RegExp)l=o[a].source;else throw o[a]===void 0?Gt(o,"language definition does not contain attribute '"+a+"', used at: "+e):Gt(o,"attribute reference '"+a+"' must be a string, used at: "+e);return hp(l)?"":"(?:"+l+")"}),i++;while(n&&i<5);e=e.replace(/\x01/g,"@");const s=(o.ignoreCase?"i":"")+(o.unicode?"u":"");if(t&&e.match(/\$[sS](\d\d?)/g)){let a=null,l=null;return c=>(l&&a===c||(a=c,l=new RegExp(XMe(o,e,c),s)),l)}return new RegExp(e,s)}function QOe(o,e,t,i){if(i<0)return o;if(i<e.length)return e[i];if(i>=100){i=i-100;const n=t.split(".");if(n.unshift(t),i<n.length)return n[i]}return null}function JOe(o,e,t,i){let n=-1,s=t,r=t.match(/^\$(([sS]?)(\d\d?)|#)(.*)$/);r&&(r[3]&&(n=parseInt(r[3]),r[2]&&(n=n+100)),s=r[4]);let a="~",l=s;!s||s.length===0?(a="!=",l=""):/^\w*$/.test(l)?a="==":(r=s.match(/^(@|!@|~|!~|==|!=)(.*)$/),r&&(a=r[1],l=r[2]));let c;if((a==="~"||a==="!~")&&/^(\w|\|)*$/.test(l)){const d=ite(l.split("|"),o.ignoreCase);c=function(h){return a==="~"?d(h):!d(h)}}else if(a==="@"||a==="!@"){const d=o[l];if(!d)throw Gt(o,"the @ match target '"+l+"' is not defined, in rule: "+e);if(!YOe(function(u){return typeof u=="string"},d))throw Gt(o,"the @ match target '"+l+"' must be an array of strings, in rule: "+e);const h=ite(d,o.ignoreCase);c=function(u){return a==="@"?h(u):!h(u)}}else if(a==="~"||a==="!~")if(l.indexOf("$")<0){const d=tB(o,"^"+l+"$",!1);c=function(h){return a==="~"?d.test(h):!d.test(h)}}else c=function(d,h,u,f){return tB(o,"^"+_u(o,l,h,u,f)+"$",!1).test(d)};else if(l.indexOf("$")<0){const d=Ad(o,l);c=function(h){return a==="=="?h===d:h!==d}}else{const d=Ad(o,l);c=function(h,u,f,g,m){const _=_u(o,d,u,f,g);return a==="=="?h===_:h!==_}}return n===-1?{name:t,value:i,test:function(d,h,u,f){return c(d,d,h,u,f)}}:{name:t,value:i,test:function(d,h,u,f){const g=QOe(d,h,u,n);return c(g||"",d,h,u,f)}}}function iB(o,e,t){if(t){if(typeof t=="string")return t;if(t.token||t.token===""){if(typeof t.token!="string")throw Gt(o,"a 'token' attribute must be of type string, in rule: "+e);{const i={token:t.token};if(t.token.indexOf("$")>=0&&(i.tokenSubst=!0),typeof t.bracket=="string")if(t.bracket==="@open")i.bracket=1;else if(t.bracket==="@close")i.bracket=-1;else throw Gt(o,"a 'bracket' attribute must be either '@open' or '@close', in rule: "+e);if(t.next){if(typeof t.next!="string")throw Gt(o,"the next state must be a string value in rule: "+e);{let n=t.next;if(!/^(@pop|@push|@popall)$/.test(n)&&(n[0]==="@"&&(n=n.substr(1)),n.indexOf("$")<0&&!QMe(o,_u(o,n,"",[],""))))throw Gt(o,"the next state '"+t.next+"' is not defined in rule: "+e);i.next=n}}return typeof t.goBack=="number"&&(i.goBack=t.goBack),typeof t.switchTo=="string"&&(i.switchTo=t.switchTo),typeof t.log=="string"&&(i.log=t.log),typeof t.nextEmbedded=="string"&&(i.nextEmbedded=t.nextEmbedded,o.usesEmbedded=!0),i}}else if(Array.isArray(t)){const i=[];for(let n=0,s=t.length;n<s;n++)i[n]=iB(o,e,t[n]);return{group:i}}else if(t.cases){const i=[];let n=!1;for(const r in t.cases)if(t.cases.hasOwnProperty(r)){const a=iB(o,e,t.cases[r]);r==="@default"||r==="@"||r===""?i.push({test:void 0,value:a,name:r}):r==="@eos"?i.push({test:function(l,c,d,h){return h},value:a,name:r}):i.push(JOe(o,e,r,a)),n||(n=!ji(a)&&(a.hasEmbeddedEndInCases||["@pop","@popall"].includes(a.nextEmbedded||"")))}const s=o.defaultToken;return{hasEmbeddedEndInCases:n,test:function(r,a,l,c){for(const d of i)if(!d.test||d.test(r,a,l,c))return d.value;return s}}}else throw Gt(o,"an action must be a string, an object with a 'token' or 'cases' attribute, or an array of actions; in rule: "+e)}else return{token:""}}class e4e{constructor(e){this.regex=new RegExp(""),this.action={token:""},this.matchOnlyAtLineStart=!1,this.name="",this.name=e}setRegex(e,t){let i;if(typeof t=="string")i=t;else if(t instanceof RegExp)i=t.source;else throw Gt(e,"rules must start with a match string or regular expression: "+this.name);this.matchOnlyAtLineStart=i.length>0&&i[0]==="^",this.name=this.name+": "+i,this.regex=tB(e,"^(?:"+(this.matchOnlyAtLineStart?i.substr(1):i)+")",!0)}setAction(e,t){this.action=iB(e,this.name,t)}resolveRegex(e){return this.regex instanceof RegExp?this.regex:this.regex(e)}}function nte(o,e){if(!e||typeof e!="object")throw new Error("Monarch: expecting a language definition object");const t={languageId:o,includeLF:ZE(e.includeLF,!1),noThrow:!1,maxStack:100,start:typeof e.start=="string"?e.start:null,ignoreCase:ZE(e.ignoreCase,!1),unicode:ZE(e.unicode,!1),tokenPostfix:tte(e.tokenPostfix,"."+o),defaultToken:tte(e.defaultToken,"source"),usesEmbedded:!1,stateNames:{},tokenizer:{},brackets:[]},i=e;i.languageId=o,i.includeLF=t.includeLF,i.ignoreCase=t.ignoreCase,i.unicode=t.unicode,i.noThrow=t.noThrow,i.usesEmbedded=t.usesEmbedded,i.stateNames=e.tokenizer,i.defaultToken=t.defaultToken;function n(r,a,l){for(const c of l){let d=c.include;if(d){if(typeof d!="string")throw Gt(t,"an 'include' attribute must be a string at: "+r);if(d[0]==="@"&&(d=d.substr(1)),!e.tokenizer[d])throw Gt(t,"include target '"+d+"' is not defined at: "+r);n(r+"."+d,a,e.tokenizer[d])}else{const h=new e4e(r);if(Array.isArray(c)&&c.length>=1&&c.length<=3)if(h.setRegex(i,c[0]),c.length>=3)if(typeof c[1]=="string")h.setAction(i,{token:c[1],next:c[2]});else if(typeof c[1]=="object"){const u=c[1];u.next=c[2],h.setAction(i,u)}else throw Gt(t,"a next state as the last element of a rule can only be given if the action is either an object or a string, at: "+r);else h.setAction(i,c[1]);else{if(!c.regex)throw Gt(t,"a rule must either be an array, or an object with a 'regex' or 'include' field at: "+r);c.name&&typeof c.name=="string"&&(h.name=c.name),c.matchOnlyAtStart&&(h.matchOnlyAtLineStart=ZE(c.matchOnlyAtLineStart,!1)),h.setRegex(i,c.regex),h.setAction(i,c.action)}a.push(h)}}}if(!e.tokenizer||typeof e.tokenizer!="object")throw Gt(t,"a language definition must define the 'tokenizer' attribute as an object");t.tokenizer=[];for(const r in e.tokenizer)if(e.tokenizer.hasOwnProperty(r)){t.start||(t.start=r);const a=e.tokenizer[r];t.tokenizer[r]=new Array,n("tokenizer."+r,t.tokenizer[r],a)}if(t.usesEmbedded=i.usesEmbedded,e.brackets){if(!Array.isArray(e.brackets))throw Gt(t,"the 'brackets' attribute must be defined as an array")}else e.brackets=[{open:"{",close:"}",token:"delimiter.curly"},{open:"[",close:"]",token:"delimiter.square"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}];const s=[];for(const r of e.brackets){let a=r;if(a&&Array.isArray(a)&&a.length===3&&(a={token:a[2],open:a[0],close:a[1]}),a.open===a.close)throw Gt(t,"open and close brackets in a 'brackets' attribute must be different: "+a.open+`
hint: use the 'bracket' attribute if matching on equal brackets is required.`);if(typeof a.open=="string"&&typeof a.token=="string"&&typeof a.close=="string")s.push({token:a.token+t.tokenPostfix,open:Ad(t,a.open),close:Ad(t,a.close)});else throw Gt(t,"every element in the 'brackets' array must be a '{open,close,token}' object or array")}return t.brackets=s,t.noThrow=!0,t}function t4e(o){Gm.registerLanguage(o)}function i4e(){let o=[];return o=o.concat(Gm.getLanguages()),o}function n4e(o){return De.get(Mt).languageIdCodec.encodeLanguageId(o)}function s4e(o,e){return De.withServices(()=>{const i=De.get(Mt).onDidRequestRichLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function o4e(o,e){return De.withServices(()=>{const i=De.get(Mt).onDidRequestBasicLanguageFeatures(n=>{n===o&&(i.dispose(),e())});return i})}function r4e(o,e){if(!De.get(Mt).isRegisteredLanguageId(o))throw new Error(`Cannot set configuration for unknown language ${o}`);return De.get(Jt).register(o,e,100)}class a4e{constructor(e,t){this._languageId=e,this._actual=t}dispose(){}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,i){if(typeof this._actual.tokenize=="function")return yS.adaptTokenize(this._languageId,this._actual,e,i);throw new Error("Not supported!")}tokenizeEncoded(e,t,i){const n=this._actual.tokenizeEncoded(e,i);return new YL(n.tokens,n.endState)}}class yS{constructor(e,t,i,n){this._languageId=e,this._actual=t,this._languageService=i,this._standaloneThemeService=n}dispose(){}getInitialState(){return this._actual.getInitialState()}static _toClassicTokens(e,t){const i=[];let n=0;for(let s=0,r=e.length;s<r;s++){const a=e[s];let l=a.startIndex;s===0?l=0:l<n&&(l=n),i[s]=new rv(l,a.scopes,t),n=l}return i}static adaptTokenize(e,t,i,n){const s=t.tokenize(i,n),r=yS._toClassicTokens(s.tokens,e);let a;return s.endState.equals(n)?a=n:a=s.endState,new HM(r,a)}tokenize(e,t,i){return yS.adaptTokenize(this._languageId,this._actual,e,i)}_toBinaryTokens(e,t){const i=e.encodeLanguageId(this._languageId),n=this._standaloneThemeService.getColorTheme().tokenTheme,s=[];let r=0,a=0;for(let c=0,d=t.length;c<d;c++){const h=t[c],u=n.match(i,h.scopes)|1024;if(r>0&&s[r-1]===u)continue;let f=h.startIndex;c===0?f=0:f<a&&(f=a),s[r++]=f,s[r++]=u,a=f}const l=new Uint32Array(r);for(let c=0;c<r;c++)l[c]=s[c];return l}tokenizeEncoded(e,t,i){const n=this._actual.tokenize(e,i),s=this._toBinaryTokens(this._languageService.languageIdCodec,n.tokens);let r;return n.endState.equals(i)?r=i:r=n.endState,new YL(s,r)}}function l4e(o){return typeof o.getInitialState=="function"}function c4e(o){return"tokenizeEncoded"in o}function ste(o){return o&&typeof o.then=="function"}function d4e(o){const e=De.get(ir);if(o){const t=[null];for(let i=1,n=o.length;i<n;i++)t[i]=$.fromHex(o[i]);e.setColorMapOverride(t)}else e.setColorMapOverride(null)}function ote(o,e){return c4e(e)?new a4e(o,e):new yS(o,e,De.get(Mt),De.get(ir))}function nB(o,e){const t=new zhe(async()=>{const i=await Promise.resolve(e.create());return i?l4e(i)?ote(o,i):new lS(De.get(Mt),De.get(ir),o,nte(o,i),De.get(Me)):null});return di.registerFactory(o,t)}function h4e(o,e){if(!De.get(Mt).isRegisteredLanguageId(o))throw new Error(`Cannot set tokens provider for unknown language ${o}`);return ste(e)?nB(o,{create:()=>e}):di.register(o,ote(o,e))}function u4e(o,e){const t=i=>new lS(De.get(Mt),De.get(ir),o,nte(o,i),De.get(Me));return ste(e)?nB(o,{create:()=>e}):di.register(o,t(e))}function f4e(o,e){return De.get(he).referenceProvider.register(o,e)}function g4e(o,e){return De.get(he).renameProvider.register(o,e)}function p4e(o,e){return De.get(he).newSymbolNamesProvider.register(o,e)}function m4e(o,e){return De.get(he).signatureHelpProvider.register(o,e)}function _4e(o,e){return De.get(he).hoverProvider.register(o,{provideHover:async(i,n,s,r)=>{const a=i.getWordAtPosition(n);return Promise.resolve(e.provideHover(i,n,s,r)).then(l=>{if(l)return!l.range&&a&&(l.range=new k(n.lineNumber,a.startColumn,n.lineNumber,a.endColumn)),l.range||(l.range=new k(n.lineNumber,n.column,n.lineNumber,n.column)),l})}})}function b4e(o,e){return De.get(he).documentSymbolProvider.register(o,e)}function C4e(o,e){return De.get(he).documentHighlightProvider.register(o,e)}function v4e(o,e){return De.get(he).linkedEditingRangeProvider.register(o,e)}function w4e(o,e){return De.get(he).definitionProvider.register(o,e)}function S4e(o,e){return De.get(he).implementationProvider.register(o,e)}function y4e(o,e){return De.get(he).typeDefinitionProvider.register(o,e)}function L4e(o,e){return De.get(he).codeLensProvider.register(o,e)}function x4e(o,e,t){return De.get(he).codeActionProvider.register(o,{providedCodeActionKinds:t?.providedCodeActionKinds,documentation:t?.documentation,provideCodeActions:(n,s,r,a)=>{const c=De.get(zl).read({resource:n.uri}).filter(d=>k.areIntersectingOrTouching(d,s));return e.provideCodeActions(n,s,{markers:c,only:r.only,trigger:r.trigger},a)},resolveCodeAction:e.resolveCodeAction})}function k4e(o,e){return De.get(he).documentFormattingEditProvider.register(o,e)}function I4e(o,e){return De.get(he).documentRangeFormattingEditProvider.register(o,e)}function D4e(o,e){return De.get(he).onTypeFormattingEditProvider.register(o,e)}function E4e(o,e){return De.get(he).linkProvider.register(o,e)}function N4e(o,e){return De.get(he).completionProvider.register(o,e)}function T4e(o,e){return De.get(he).colorProvider.register(o,e)}function R4e(o,e){return De.get(he).foldingRangeProvider.register(o,e)}function M4e(o,e){return De.get(he).declarationProvider.register(o,e)}function P4e(o,e){return De.get(he).selectionRangeProvider.register(o,e)}function A4e(o,e){return De.get(he).documentSemanticTokensProvider.register(o,e)}function O4e(o,e){return De.get(he).documentRangeSemanticTokensProvider.register(o,e)}function F4e(o,e){return De.get(he).inlineCompletionsProvider.register(o,e)}function W4e(o,e){return De.get(he).inlayHintsProvider.register(o,e)}function B4e(){return{register:t4e,getLanguages:i4e,onLanguage:s4e,onLanguageEncountered:o4e,getEncodedLanguageId:n4e,setLanguageConfiguration:r4e,setColorMap:d4e,registerTokensProviderFactory:nB,setTokensProvider:h4e,setMonarchTokensProvider:u4e,registerReferenceProvider:f4e,registerRenameProvider:g4e,registerNewSymbolNameProvider:p4e,registerCompletionItemProvider:N4e,registerSignatureHelpProvider:m4e,registerHoverProvider:_4e,registerDocumentSymbolProvider:b4e,registerDocumentHighlightProvider:C4e,registerLinkedEditingRangeProvider:v4e,registerDefinitionProvider:w4e,registerImplementationProvider:S4e,registerTypeDefinitionProvider:y4e,registerCodeLensProvider:L4e,registerCodeActionProvider:x4e,registerDocumentFormattingEditProvider:k4e,registerDocumentRangeFormattingEditProvider:I4e,registerOnTypeFormattingEditProvider:D4e,registerLinkProvider:E4e,registerColorProvider:T4e,registerFoldingRangeProvider:R4e,registerDeclarationProvider:M4e,registerSelectionRangeProvider:P4e,registerDocumentSemanticTokensProvider:A4e,registerDocumentRangeSemanticTokensProvider:O4e,registerInlineCompletionsProvider:F4e,registerInlayHintsProvider:W4e,DocumentHighlightKind:U9,CompletionItemKind:F9,CompletionItemTag:W9,CompletionItemInsertTextRule:O9,SymbolKind:w8,SymbolTag:S8,IndentAction:Y9,CompletionTriggerKind:B9,SignatureHelpTriggerKind:v8,InlayHintKind:Q9,InlineCompletionTriggerKind:t8,CodeActionTriggerType:A9,NewSymbolNameTag:l8,NewSymbolNameTriggerKind:c8,PartialAcceptTriggerKind:u8,HoverVerbosityAction:Z9,InlineCompletionEndOfLifeReasonKind:e8,InlineCompletionDisplayLocationKind:J9,FoldingRangeKind:$c,SelectedSuggestionInfo:Zz,EditDeltaInfo:kv}}Da.wrappingIndent.defaultValue=0,Da.glyphMargin.defaultValue=!1,Da.autoIndent.defaultValue=3,Da.overviewRulerLanes.defaultValue=2,r0.setFormatterSelector((o,e,t)=>Promise.resolve(o[0]));const Ps=PJ();Ps.editor=ZOe(),Ps.languages=B4e();const H4e=Ps.CancellationTokenSource,V4e=Ps.Emitter,z4e=Ps.KeyCode,U4e=Ps.KeyMod,$4e=Ps.Position,j4e=Ps.Range,q4e=Ps.Selection,K4e=Ps.SelectionDirection,G4e=Ps.MarkerSeverity,Z4e=Ps.MarkerTag,Y4e=Ps.Uri,X4e=Ps.Token,Q4e=Ps.editor,J4e=Ps.languages;(globalThis.MonacoEnvironment?.globalAPI||typeof globalThis.define=="function"&&globalThis.define.amd)&&(globalThis.monaco=Ps),typeof globalThis.require<"u"&&typeof globalThis.require.config=="function"&&globalThis.require.config({ignoreDuplicateModules:["vscode-languageserver-types","vscode-languageserver-types/main","vscode-languageserver-textdocument","vscode-languageserver-textdocument/main","vscode-nls","vscode-nls/vscode-nls","jsonc-parser","jsonc-parser/main","vscode-uri","vscode-uri/index","vs/basic-languages/typescript/typescript"]}),Io.CancellationTokenSource=H4e,Io.Emitter=V4e,Io.KeyCode=z4e,Io.KeyMod=U4e,Io.MarkerSeverity=G4e,Io.MarkerTag=Z4e,Io.Position=$4e,Io.Range=j4e,Io.Selection=q4e,Io.SelectionDirection=K4e,Io.Token=X4e,Io.Uri=Y4e,Io.editor=Q4e,Io.languages=J4e}));