@lvce-editor/editor-worker 19.6.0 → 19.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10827,58 +10827,72 @@ const relaunchWorkers = async () => {
10827
10827
  await launch();
10828
10828
  };
10829
10829
 
10830
- const getWidgetName = widgetId => {
10830
+ const getWidgetHotReloadDescriptor = widgetId => {
10831
10831
  switch (widgetId) {
10832
10832
  case Find:
10833
- return `FindWidget`;
10833
+ return {
10834
+ invoke: invoke$3,
10835
+ name: 'FindWidget'
10836
+ };
10834
10837
  default:
10835
- return '';
10838
+ return undefined;
10836
10839
  }
10837
10840
  };
10838
- const saveWidgetState = async keys => {
10839
- const savedStates = Object.create(null);
10840
- for (const key of keys) {
10841
- const editor = get$7(parseInt(key));
10842
- const {
10843
- widgets
10844
- } = editor.newState;
10845
- for (const widget of widgets) {
10846
- const invoke = getWidgetInvoke(widget.id);
10847
- const fullKey = `${key}:${widget.newState.uid}`;
10848
- const name = getWidgetName(widget.id);
10849
- const savedState = await invoke(`${name}.saveState`, widget.newState.uid);
10850
- savedStates[fullKey] = savedState;
10841
+
10842
+ const restoreWidget = async (editorUid, key, widget, savedStates) => {
10843
+ if (widget?.newState) {
10844
+ const fullKey = `${key}:${widget.newState.uid}`;
10845
+ const descriptor = getWidgetHotReloadDescriptor(widget.id);
10846
+ if (descriptor && savedStates && Object.hasOwn(savedStates, fullKey)) {
10847
+ const {
10848
+ invoke,
10849
+ name
10850
+ } = descriptor;
10851
+ const savedState = savedStates[fullKey];
10852
+ await invoke(`${name}.create`, widget.newState.uid, widget.newState.x, widget.newState.y, widget.newState.width, widget.newState.height, editorUid);
10853
+ await invoke(`${name}.loadContent`, widget.newState.uid, savedState);
10854
+ const diffResult = await invoke(`${name}.diff2`, widget.newState.uid);
10855
+ const commands = await invoke(`${name}.render2`, widget.newState.uid, diffResult);
10856
+ return {
10857
+ restored: true,
10858
+ widget: {
10859
+ ...widget,
10860
+ newState: {
10861
+ ...widget.newState,
10862
+ commands
10863
+ }
10864
+ }
10865
+ };
10851
10866
  }
10852
10867
  }
10853
- return savedStates;
10868
+ return {
10869
+ restored: false,
10870
+ widget
10871
+ };
10854
10872
  };
10855
-
10856
10873
  const restoreWidgetState = async (keys, savedStates) => {
10857
10874
  const newEditors = [];
10858
10875
  for (const key of keys) {
10859
10876
  const editorUid = parseInt(key);
10860
10877
  const editor = get$7(editorUid);
10878
+ if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
10879
+ continue;
10880
+ }
10861
10881
  const {
10862
10882
  widgets
10863
10883
  } = editor.newState;
10864
10884
  const newWidgets = [];
10885
+ let hasRestoredWidget = false;
10865
10886
  for (const widget of widgets) {
10866
- const invoke = getWidgetInvoke(widget.id);
10867
- const fullKey = `${key}:${widget.newState.uid}`;
10868
- const savedState = savedStates[fullKey] || {};
10869
- const name = getWidgetName(widget.id);
10870
- await invoke(`${name}.create`, widget.newState.uid, widget.newState.x, widget.newState.y, widget.newState.width, widget.newState.height, editorUid);
10871
- await invoke(`${name}.loadContent`, widget.newState.uid, savedState);
10872
- const diffResult = await invoke(`${name}.diff2`, widget.newState.uid);
10873
- const commands = await invoke(`${name}.render2`, widget.newState.uid, diffResult);
10874
- const newWidget = {
10875
- ...widget,
10876
- newState: {
10877
- ...widget.newState,
10878
- commands
10879
- }
10880
- };
10881
- newWidgets.push(newWidget);
10887
+ const restoredWidget = await restoreWidget(editorUid, key, widget, savedStates);
10888
+ newWidgets.push(restoredWidget.widget);
10889
+ if (restoredWidget.restored) {
10890
+ hasRestoredWidget = true;
10891
+ }
10892
+ }
10893
+ if (!hasRestoredWidget) {
10894
+ newEditors.push(editor);
10895
+ continue;
10882
10896
  }
10883
10897
  newEditors.push({
10884
10898
  ...editor,
@@ -10891,6 +10905,42 @@ const restoreWidgetState = async (keys, savedStates) => {
10891
10905
  return newEditors;
10892
10906
  };
10893
10907
 
10908
+ const saveSingleWidgetState = async (savedStates, key, widget) => {
10909
+ if (!widget?.newState) {
10910
+ return;
10911
+ }
10912
+ const descriptor = getWidgetHotReloadDescriptor(widget.id);
10913
+ if (!descriptor) {
10914
+ return;
10915
+ }
10916
+ const {
10917
+ invoke,
10918
+ name
10919
+ } = descriptor;
10920
+ const {
10921
+ uid
10922
+ } = widget.newState;
10923
+ const fullKey = `${key}:${uid}`;
10924
+ const savedState = await invoke(`${name}.saveState`, uid);
10925
+ savedStates[fullKey] = savedState;
10926
+ };
10927
+ const saveWidgetState = async keys => {
10928
+ const savedStates = Object.create(null);
10929
+ for (const key of keys) {
10930
+ const editor = get$7(parseInt(key));
10931
+ if (!editor?.newState || !Array.isArray(editor.newState.widgets)) {
10932
+ continue;
10933
+ }
10934
+ const {
10935
+ widgets
10936
+ } = editor.newState;
10937
+ for (const widget of widgets) {
10938
+ await saveSingleWidgetState(savedStates, key, widget);
10939
+ }
10940
+ }
10941
+ return savedStates;
10942
+ };
10943
+
10894
10944
  const state = {
10895
10945
  isReloading: false
10896
10946
  };
@@ -10899,20 +10949,22 @@ const hotReload = async () => {
10899
10949
  return;
10900
10950
  }
10901
10951
  state.isReloading = true;
10952
+ try {
10953
+ // TODO use getEditors
10954
+ const keys = getKeys$2();
10955
+ const savedStates = await saveWidgetState(keys);
10956
+ await relaunchWorkers();
10957
+ const newEditors = await restoreWidgetState(keys, savedStates);
10958
+ for (const editor of newEditors) {
10959
+ set$8(editor.newState.uid, editor.oldState, editor.newState);
10960
+ }
10902
10961
 
10903
- // TODO use getEditors
10904
- const keys = getKeys$2();
10905
- const savedStates = await saveWidgetState(keys);
10906
- await relaunchWorkers();
10907
- const newEditors = await restoreWidgetState(keys, savedStates);
10908
- for (const editor of newEditors) {
10909
- set$8(editor.newState.uid, editor.oldState, editor.newState);
10962
+ // TODO ask renderer worker to rerender all editors
10963
+ // @ts-ignore
10964
+ await invoke$b(`Editor.rerender`);
10965
+ } finally {
10966
+ state.isReloading = false;
10910
10967
  }
10911
-
10912
- // TODO ask renderer worker to rerender all editors
10913
- // @ts-ignore
10914
- await invoke$b(`Editor.rerender`);
10915
- state.isReloading = false;
10916
10968
  };
10917
10969
 
10918
10970
  const sendMessagePortToSyntaxHighlightingWorker = async port => {
@@ -1 +1 @@
1
- const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const x=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const E="\n";const I=(t,n=undefined)=>t.indexOf(E,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=x(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const C=t=>t&&t instanceof MessagePort;const v=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const L=t=>M(t,"Socket");const A=[C,v,b,L];const P=t=>{for(const n of A){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const _=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const Y=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=Y(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=Y(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=Y(n);const{actualMessage:o,rest:s}=_(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const xt=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const Et=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){xt(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!C(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=Et(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class Ct extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const vt=t=>new Ct(t);const bt={__proto__:null,create:kt,signal:St,wrap:vt};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const Lt=Object.create(null);const At=t=>{Object.assign(Lt,t)};const Pt=t=>Lt[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const _t=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const Yt=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=Yt(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=_t(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const xn="2.0";const En=(t,n)=>({jsonrpc:xn,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:xn,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const Cn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const vn=async(t,n,e,o,s)=>{const{id:c,promise:r}=Cn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return vn(n,t,e,o,false)},invokeAndTransfer(e,...o){return vn(n,t,e,o,true)},ipc:t,send(n,...e){const o=En(n,e);t.send(o)}};return e};const Mn=()=>false;const Ln=t=>t;const An=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,Ln,An,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{At(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{At(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const _n=t=>{delete zn[t]};const Yn=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{_n(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const xe=43;const Ee=50;const Ie=52;const ke=54;const Se=58;const Ce=59;const ve=60;const be=68;const Me=87;const Le=88;const Ae=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const _e=22;const Ye=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=Yn(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=Yn(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=Yn(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=Yn(Qe);const{invoke:yo,invokeAndTransfer:xo,set:Eo}=Yn(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const Co=async()=>yo("Layout.handleWorkspaceRefresh");const vo=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Lo=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Ao=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Po=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Fo=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Lo,getPreference:Fo,handleWorkspaceRefresh:Co,invoke:yo,invokeAndTransfer:xo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:vo,sendMessagePortToExtensionManagementWorker:Po,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Ao,set:Eo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Oo}=Yn(Ke);const Bo={__proto__:null,invoke:Do,set:Oo};const No=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const Ho=async(t,n,e)=>{w(t);await Lo(t,n,e)};const zo=t=>t;const Uo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Uo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const _o=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const Yo={};const Vo=()=>{if(!Yo.workerPromise){Yo.workerPromise=_o()}return Yo.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const xs="editorType";const Es="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const Cs="insertLineBreak";const vs="lineComment";const bs="rename";const Ms="toggleBlockComment";const Ls=Object.create(null);const As=(t,n)=>{Ls[t]=n};const Ps=t=>Ls[t];const Fs=t=>Ps(t);const Ws=async(t,n,e)=>{const o=Fs(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Os="Function";const Bs="Parameter";const Ns="Type";const Hs="VariableName";const zs="Class";const Us=1;const $s=2816;const _s=2817;const Ys=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const xc=2561;const Ec=2569;const Ic=2584;const kc=256;const Sc=257;const Cc=272;const vc=t=>{switch(t){case Us:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Ns;case Ks:case Js:return Bs;case ac:case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case xc:case Ec:case Ic:return Hs;case kc:case Sc:case Cc:return zs;case $s:case _s:case Ys:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Os;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Lc={warned:[]};const Ac=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Pc=(t,n)=>{if(Lc.warned.includes(n)){return}Lc.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Fc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Pc(t,n);c.tokens=Ac(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Oc=true;const Bc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Nc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Oc,initialLineState:Dc,tokenizeLine:Bc};const Hc={enabled:false};const zc=t=>{Hc.enabled=t};const Uc=()=>Hc.enabled;const{invoke:$c,set:_c}=Bo;const Yc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(Yc.tokenizers,t);const jc=(t,n)=>{Yc.tokenizers[t]=n};const qc=t=>Yc.tokenizers[t];const Gc=(t,n)=>{Yc.tokenizePaths[t]=n};const Xc=t=>Yc.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(Yc.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Uc()){const e=await $c("Tokenizer.load",t,n);Jc(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Nc}return Nc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Nc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Nc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Fc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ir=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Fc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ir(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Uc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const Er=t=>t.includes(yr);const Ir=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const kr=(t,n,e,o)=>{const s=t.splice(n,e);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const Cr=/^\s+/;const vr=t=>{const n=t.match(Cr);if(!n){return""}return n[0]};const br=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);kr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);kr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));kr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Mr=(t,n)=>t.lines[n];const Lr=t=>Sr(t.lines);const Ar=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Pr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Fr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Tr=10;const Rr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Dr=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Or=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Br=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=vc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:x,startIndex:E}=Rr(m,l);const I=Hr(x,d,a);for(let t=E;t<p;t+=2){const n=m[t];const o=m[t+1];const s=x+o;const i=Dr(h,x,s);if(i){let t=x;while(t<s){const o=Or(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(x,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}x=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Nr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Hr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=vc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Rr(m,u);const x=Hr(p,l,d);const E=m.length;for(let n=y;n<E;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Dr(g,p,c);if(a){let n=p;while(n<c){const o=Or(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:x,lineInfo:h}};const Ur=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Nr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Br(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Er(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=Ur(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const _r=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Pr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Yr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=Yr;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await _r(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=".,;:!?";const ci={")":"(","]":"[","}":"{",">":"<"};const ri=(t,n)=>{const e=ci[n];let o=0;for(const s of t){if(s===e){o++}else if(s===n){o--}}return o<0};const ii=t=>{let n=t;while(n.length>0){const t=n.at(-1);if(!t){break}if(si.includes(t)){n=n.slice(0,-1);continue}if(t in ci&&ri(n,t)){n=n.slice(0,-1);continue}break}return n};const ai=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=ii(t[0]);if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const di=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=ai(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Us,0)}o+=t.length+1}return n};const li=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===Us&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const ui=1;const fi=Object.create(null);const hi=(t,n)=>{g(t);g(n);if(!Object.hasOwn(fi,t)){fi[t]=[]}if(!fi[t].includes(n)){fi[t].push(n)}};const gi=(t,n)=>{g(t);g(n);if(Object.hasOwn(fi,t)){const e=fi[t].indexOf(n);if(e!==-1){fi[t].splice(e,1)}}};const mi=t=>{g(t);return fi[t]||[]};const wi=async(t,n,...e)=>{g(t);w(n);const o=mi(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const pi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=jr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const yi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:xi}=Ro;const Ei=async t=>{try{await xi("Main.handleModifiedStatusChange",t,true)}catch{}};const Ii=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const ki=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const Si=/^\p{ASCII}*$/u;const Ci=t=>Si.test(t);const vi=async(t,n)=>t.length*n;const bi=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Mi=async(t,n,e,o,s,c,r)=>{if(c&&Ci(t)){return await vi(t,r)}return await bi(t,n,e,o,s,c,r)};const Li=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Er(t);const h=xr(t,f,i);const m=ki(t.slice(0,n));const y=h.slice(0,n+m);const x=await Mi(y,e,o,s,r,c,l);return x-a+u};const Ai=(t,n,e)=>(t-n)*e;const Pi=t=>`${t}px`;const Fi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Wi=t=>new Uint32Array(t);const Ti=t=>Wi(t.length);const Ri=(t,n)=>{const e=Ti(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(t,o);n(e,o,s,c,r,i)}return e};const Di=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Oi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Bi=(t,n,e,o)=>t===e&&n===o;const Ni=(t,n,e,o)=>t===e;const Hi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const zi=t=>Hi(t,Bi);const Ui=t=>Hi(t,Ni);const $i=(t,n)=>{const e=Wi(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const _i=[];const Yi=(t,n)=>{if(!n){return _i}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${Pi(o)} ${Pi(s)}`)}return e};const Vi=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(Pi(o),Pi(s),Pi(c),Pi(r))}return n};const ji=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const x=o;const E=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=Ii(w,t);if(r<g||o>h){continue}const S=r-g;const C=c[S];const v=f[r];const b=await Li(v,I,d,a,i,l,u,p,E,y,x,C);const M=Ai(r,g,m);if(Bi(o,s,r,I)&&b>0){n.push(b,M);continue}const L=Ai(o,g,m);const A=o-g;const P=c[A];if(o===r){const t=await Li(v,s,d,a,i,l,u,p,E,y,x,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,L,o,m)}else{if(o>=g){const t=f[o];const c=await Li(t,s,d,a,i,l,u,p,E,y,x,P);const r=await Li(t,t.length,d,a,i,l,u,p,E,y,x,P);const h=Ai(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=Ai(n,g,m);const s=n-g;const r=c[s];const h=await Li(t,t.length,d,a,i,l,u,p,E,y,x,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:Yi(n,r),selectionInfos:Vi(e)}};const qi=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const Gi=(t,n)=>{h(t);return{...t,selections:n}};const Xi=(t,n)=>{h(t);m(n);const e=$i(n,qi);return e};const Zi=(t,n)=>Kr(t,n);const Qi=(t,n)=>Zi(t,t.deltaY+n);const Ki=t=>t.origin===Es;const Ji=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Ki(s)){o.push(c,r+1,i,a+1)}return o};const ta=(t,n)=>Gi(t,n);const na=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Xi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Ji(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=di(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await Ei(t.uri)}try{await wi(ui,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await _r(g,w);return{...g,differences:p,textInfos:y}};const ea=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Xi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await _r(a,d);return{...a,differences:l,textInfos:u}};const oa=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await _r(r,i);return{...r,differences:a,textInfos:d}};const sa=t=>t.selections&&t.selections.length>0;const ca=(t,n,e,o,s,c)=>pi(t,{height:s,width:o,x:n,y:e},c);const ra=(t,n)=>{const e=yi(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const ia={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:ns,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const aa="ExtensionHostHover.execute";const da="ExtensionHost.executeTabCompletionProvider";const la="ExtensionHostTextDocument.syncFull";const{invoke:ua,set:fa}=ao;const ha=t=>{w(t);return t.lastIndexOf(hr)};const ga=(t,n)=>t.lastIndexOf(hr,n);const ma=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const wa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const pa=(t,n)=>{w(t);const e=ha(t);const o=t.slice(e);const s=o.toLowerCase();const c=ma(n,s);if(c){return c}const r=t.toLowerCase();const i=ga(t,e-1);const a=t.slice(i);const d=ma(n,a);if(d){return d}const l=wa(n,r);if(l){return l}return"unknown"};const ya=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const xa=async(t,n,e,o)=>await Mi("a",t,n,e,o,false,0);const Ea=async t=>{const n=await Fo(t);return n};const Ia="onDiagnostic";const ka="onHover";const Sa="onTabCompletion";const Ca=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await Ho(a,n,i);const d=await ua(s,e.uid,...t);return d};const va=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const ba=async t=>{const n=va(t);return lo("Extensions.executeDiagnosticProvider",n)};const Ma=async t=>{const n=await ba(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return Ca({args:[],assetDir:e,editor:t,event:Ia,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const La=t=>t.type;const Aa=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const x=0;const E=await Li(d[m],n,r,c,s,i,a,f,x,h,o,y);const I=Ai(m,l,u)-u;e.push({height:u,type:La(t),width:p,x:E,y:I})}return e};const Pa=(t,n)=>{const e=di(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Fa=async t=>{try{const n=Lr(t);await ua(la,t.uri,t.id,t.languageId,n);const e=await Ma(t);const o=Ko(t.id);if(!o){return t}const s=await Aa(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=Pa(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const Wa=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:x,letterSpacing:E,lineNumbers:I,lineToReveal:k,links:S,platform:C,rowHeight:v,savedDeltaY:b,savedSelections:M,tabSize:L,uri:A,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await xa(i,r,c,E);const D=await ya(C,t);const O=pa(A,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:E,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:C,primarySelectionIndex:0,redoStack:[],rowHeight:v,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:L,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:A,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=ca(B,W,T,F,d,9);const H=ra(N,o);let z;if(k&&n){const t=k*v;z=await Kr(H,t)}else{z=await Kr(H,0)}const U=di(z);const $={...z,decorations:U};const _=Qr();const{differences:Y,textInfos:V}=await _r($,_);const j={...$,differences:Y,focus:co,focused:true,textInfos:V};ts(u,ia,j);await ua(la,A,u,x,o);if(s){await Fa(j)}const q=await Ea("editor.completionsOnType");const G=Boolean(q);ts(u,ia,{...j,completionsOnType:G})};const Ta=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Ra=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Da=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Oa=6;const Ba=7;const Na=11;const Ha=12;const za=13;const Ua=(t,n)=>t.widgets===n.widgets;const $a=[Da,Ra,Ra,Ta,Ua];const _a=[Ha,Oa,Ba,Na,za];const Ya=(t,n)=>{const e=[];for(let o=0;o<$a.length;o++){const s=$a[o];if(!s(t,n)){e.push(_a[o])}}return e};const Va=t=>{const{newState:n,oldState:e}=Ko(t);const o=Ya(e,n);return o};const ja=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const qa=t=>{const{selections:n}=t;const e=ja(n);return{...t,selections:e}};const Ga=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Xa=t=>{const{lines:n,selections:e}=t;const o=Ga(e,n.length);return{...t,selections:o}};const Za=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Ar(t,{end:s,start:n});const r={deleted:c,end:s,inserted:yi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Qa=(...t)=>{console.warn(...t)};const Ka=(...t)=>{console.error(...t)};const Ja=(t,n)=>{if(!Array.isArray(n)){Qa("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=Za(t,n);return na(t,e)};const td=async(t,n)=>{h(t);m(n);return na(t,n)};const nd=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Ar(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const ed=async(t,n)=>{h(t);m(n);const e=nd(t,n);if(e.length===0){return t}return na(t,e)};const od=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const sd=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=Ii(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Ar(t,f),end:u,inserted:e,origin:o,start:l})}return s};const cd=(t,n,e)=>{const{selections:o}=t;return sd(t,o,n,e)};const rd=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Mi(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const id=()=>"Segmenter"in Intl;const ad=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const dd=async(t,n,e,o,s,c,r,i)=>{const a=ad();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Mi(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const ld=(t,n)=>{const e=Math.round(t/n);return e};const ud=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const fd=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=ld(a,r);const l=Er(t);const u=ud(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Mi(h,n,e,o,s,c,r);const y=Ci(t);if(y){if(Math.abs(a-m)<r/2){return u}return await rd(t,u,r,a,n,e,o,s,c,r)}return await dd(t,u,r,a,n,e,o,s)};const hd=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const x=n-w+s;const E=Rs(y,0,u.length-1);const I=u[E];const k=await fd(I,a,i,r,l,d,o,m,x);return{columnIndex:k,rowIndex:E}};const gd=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const md=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const wd={timeout:-1};const pd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=gd(t,n,e);const r=md(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{xd(t)};wd.timeout=setTimeout(n,3e3)}return t};const yd=async(t,n,e,o)=>pd(t,n,e,o,true);const xd=async t=>{clearTimeout(wd.timeout);wd.timeout=-1;return t};const Ed=String;const Id=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const kd=async(t,n)=>{try{const e=Fr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=Id(n);const o=n+e;const s=cd(t,[o],xs);return na(t,s)}const s=cd(t,[n],xs);return na(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return yd(t,e,Ed(n))}};const Sd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Wi(4);Oi(e,0,n[0],n[1]);return ta(t,e)};const Cd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const vd=(t,n)=>{const e=Cd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const bd=t=>t.id===Fe;const Md=t=>{const{widgets:n}=t;const e=n.findIndex(bd);if(e===-1){return t}const o=vd(n,Fe);return{...t,focused:true,widgets:o}};const Ld=t=>t.id===De;const Ad=t=>{const{widgets:n}=t;const e=n.findIndex(Ld);if(e===-1){return t}const o=vd(n,De);return{...t,focused:true,widgets:o}};const Pd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const Fd={};const Wd=()=>{if(!Fd.workerPromise){Fd.workerPromise=Pd()}return Fd.workerPromise};const Td=async(t,...n)=>{const e=await Wd();return await e.invoke(t,...n)};const Rd=t=>t.id===Be;const Dd=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Rd);if(o===-1){return t}const s=e[o];await Td("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Od=t=>t.id===Ne;const Bd=t=>{const{widgets:n}=t;const e=n.findIndex(Od);if(e===-1){return t}const o=vd(n,Ne);return{...t,widgets:o}};const Nd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Hd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Nd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:co,focused:u,widgets:l};return f};const zd=()=>Math.random();const Ud=()=>{const t=zd();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const $d=(t,n)=>qo(t,n);const _d=async t=>Hd(We,es,t,Ud,$d);const Yd={compositionText:"",isComposing:false};const Vd=(t,n)=>{Yd.isComposing=true;return t};const jd=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-Yd.compositionText.length;e.push({deleted:[Yd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const qd=(t,n)=>{const{selections:e}=t;const o=jd(e,n);Yd.compositionText=n;return na(t,o)};const Gd=(t,n)=>{const{selections:e}=t;const o=jd(e,n);Yd.isComposing=false;Yd.compositionText="";return na(t,o)};const Xd=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const Zd=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const Qd=(t,n,e,o)=>t===e&&n===o;const Kd=async t=>{if(!sa(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=Qd(o,s,c,r);const a=Zd(n,i,o,s,c,r);const d=Ar(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Xd(u);return t};const Jd=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Mr(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return na(t,s,c)};const tl=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return na(t,s)};const nl=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const el=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const ol=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const sl=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const cl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{sl(o,s,c,r,n,e);sl(o,s+2,c,r,n,e)}}else{ol(o,s,t[s],t[s+1])}}return o};const rl=(t,n)=>{const{lines:e,selections:o}=t;const s=cl(o,e,n);return ta(t,s)};const il=(t,n)=>{if(!id()){return 1}if(n>t.length){return 1}const e=ad();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const al=()=>2;const dl=(t,n)=>{if(!id()){return 1}const e=ad();const o=e.at(t,n);return o.segment.length};const ll=t=>t===pr||t===yr;const ul=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!ll(t[e])){return n-e}}return n};const fl=(t,n)=>t.length-n;const hl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const gl=/(?<![A-Z])[A-Z]+\s*$/;const ml=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const wl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const pl=/\s+$/;const yl=/[^a-zA-Z\d]+\s*$/;const xl=[gl,ml,wl,pl,yl];const El=(t,n)=>{const e=t.slice(0,n);return hl(e,xl)};const Il=/^\s*[\u{C0}-\u{17F}\w]+/iu;const kl=/^[^a-zA-Z\d]+\w*/;const Sl=[Il,kl];const Cl=(t,n)=>{const e=t.slice(n);return hl(e,Sl)};const vl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const bl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Ml=/[A-Z]+[a-z]+\d?\s*$/;const Ll=/[A-Z]+\d*\s*$/;const Al=/[a-z]+\d*\s*$/;const Pl=/[A-Z]*[a-z]+_+\s*$/;const Fl=/(?<![A-Z])[A-Z]_+\s*$/;const Wl=/[a-z]+\s*$/;const Tl=/[^a-zA-Z\d\s]+\s*$/;const Rl=[vl,bl,Ml,Ll,Al,Pl,Fl,Wl,Tl];const Dl=(t,n)=>{const e=t.slice(0,n);return hl(e,Rl)};const Ol=/^\s*[a-z]+\d?/;const Bl=/^\s*[A-Z]{2}[a-z\d]+/;const Nl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Hl=/^\s*[A-Z]+[a-z]*\d*/;const zl=/^\s*_+[a-z]*\d?/;const Ul=/^\s*[^\da-zA-Z\s]+/;const $l=[Ol,Nl,Hl,zl,Ul];const _l=[Ol,Bl,Nl,Hl,zl,Ul];const Yl=/[A-Z]/;const Vl=(t,n)=>{const e=t.slice(n);if(Yl.test(t[n-1])){return hl(e,$l)}return hl(e,_l)};const jl=t=>rl(t,il);const ql=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const Gl=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Xl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);if(c===i&&r===a){Gl(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const Zl=(t,n)=>{const{lines:e,selections:o}=t;const s=Xl(o,e,n);return ta(t,s)};const Ql=t=>Zl(t,dl);const Kl=(t,n,e,o,s,c)=>{Oi(t,n,s+1,c)};const Jl=t=>Ri(t,Kl);const tu=t=>{const{selections:n}=t;const e=Jl(n);return ta(t,e)};const nu=t=>Zl(t,fl);const eu=t=>rl(t,ul);const ou=(t,n,e)=>{h(t);g(n);g(e);const o=Fi(n,e,n,e);return ta(t,o)};const su=(t,n,e,o,s,c)=>{if(e===0){Oi(t,n,0,0)}else{Oi(t,n,e-1,o)}};const cu=t=>Ri(t,su);const ru=(t,n,e,o)=>{const{selections:s}=t;const c=cu(s);return ta(t,c)};const iu=t=>ru(t);const au=t=>rl(t,El);const du=t=>rl(t,Dl);const lu=t=>Zl(t,Vl);const uu=t=>Zl(t,Cl);const fu=async t=>{const{lines:n,selections:e}=t;const o=new Set;const s=[];for(let t=0;t<e.length;t+=4){const[n]=Ii(e,t);if(!o.has(n)){o.add(n);s.push(n)}}const c=new Uint32Array(s.length*4);const r=new Uint32Array(s.length*4);const i=[];for(let t=0;t<s.length;t++){const e=s[t];const o=n[e];const a=t*4;c[a]=e;c[a+1]=0;c[a+2]=e;c[a+3]=o.length;r[a]=e;r[a+1]=0;r[a+2]=e;r[a+3]=0;i.push(o)}const a=sd(t,c,[""],ws);await Xd(Sr(i));return na(t,a,r)};const hu=async t=>{const n=cd(t,[""],ws);const e=n.map(t=>Sr(t.deleted)).filter(t=>t.length>0);const o=Sr(e);await Xd(o);return na(t,n)};const gu=async t=>{const{selections:n}=t;if(zi(n)){return fu(t)}return hu(t)};const mu=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Ar(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return na(t,r)};const wu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=nl(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Ar({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Di(n,s);return o};const pu=(t,n,e,o,s)=>{if(!Bi(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const yu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=Ii(n,e);if(!pu(t,o,s,c,r)){return false}}return true};const xu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=wu(n,e,al);return na(t,o)};const Eu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(yu(e,s)){return xu(t)}if(zi(s)){const e=wu(o,s,n);return na(t,e)}const c=cd(t,[""],ms);return na(t,c)};const Iu=t=>Eu(t,ul);const ku=(t,n)=>{const{selections:e}=t;if(zi(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=Ii(e,c);const a={columnIndex:i,rowIndex:r};const d=ql(a,s,n);o.push({deleted:Ar(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=cd(t,[""],gs);return o};const Su=(t,n)=>{const e=ku(t,n);return na(t,e)};const Cu=t=>Su(t,fl);const vu=t=>{const n=Eu(t,il);return n};const bu=t=>Su(t,dl);const Mu=t=>{const n=Eu(t,El);return n};const Lu=t=>{const n=Eu(t,Dl);return n};const Au=t=>Su(t,Vl);const Pu=t=>Su(t,Cl);const Fu=async t=>{await yo("SideBar.show","References",true);return t};const Wu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Tu="Failed to execute formatting provider: FormattingError:";const Ru=t=>t&&t instanceof Error&&t.message.startsWith(Tu);const Du="Failed to execute formatting provider: FormattingError:";const Ou=async t=>{try{const n=await Wu(t);return Ja(t,n)}catch(n){if(Ru(n)){console.error("Formatting Error:",n.message.slice(Du.length));return t}console.error(n);const e=String(n);await pd(t,0,0,e,true);return t}};const Bu=/^[\w\-]+/;const Nu=/[\w\-]+$/;const Hu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Nu);const s=t.slice(n);const c=s.match(Bu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const zu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Nu);if(o){return o[0]}return mr};const Uu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Hu(s,e)};const $u=(t,n,e)=>{const{lines:o}=t;const s=o[n];return zu(s,e)};const _u=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Yu={};const Vu=/\{(PH\d+)\}/g;const ju=(t,n=Yu)=>{if(n===Yu){return t}const e=(t,e)=>n[e];return t.replaceAll(Vu,e)};const qu="Copy";const Gu="Cut";const Xu="Editor: Close Color Picker";const Zu="Editor: Copy Line Down";const Qu="Editor: Copy Line Up";const Ku="Editor: Format Document (forced)";const Ju="Editor: Go To Definition";const tf="Editor: Go To Type Definition";const nf="Editor: Indent";const ef="Editor: Open Color Picker";const of="Editor: Select All Occurrences";const sf="Editor: Select Down";const cf="Editor: Select Inside String";const rf="Editor: Select Next Occurrence";const af="Editor: Select Up";const df="Show Hover";const lf="Editor: Sort Lines Ascending";const uf="Editor: Toggle Comment";const ff="Editor: Unindent";const hf="Enter Code";const gf="Escape to close";const mf="Find All Implementations";const wf="Find All References";const pf="Format Document";const yf="Go to Definition";const xf="Go to Type Definition";const Ef="Move Line Down";const If="Move Line Up";const kf="No definition found";const Sf="No definition found for '{PH1}'";const Cf="No type definition found";const vf="No type definition found for '{PH1}'";const bf="Paste";const Mf="Source Action";const Lf="Toggle Block Comment";const Af=()=>ju(yf);const Pf=()=>ju(kf);const Ff=t=>ju(Sf,{PH1:t});const Wf=t=>ju(vf,{PH1:t});const Tf=()=>ju(Cf);const Rf=()=>ju(Mf);const Df=()=>ju(gf);const Of=()=>ju(hf);const Bf=()=>ju(xf);const Nf=()=>ju(wf);const Hf=()=>ju(mf);const zf=()=>ju(Gu);const Uf=()=>ju(qu);const $f=()=>ju(bf);const _f=()=>ju(Lf);const Yf=()=>ju(If);const Vf=()=>ju(Ef);const jf=()=>ju(pf);const qf=()=>ju(df);const Gf=()=>ju(Ku);const Xf=()=>ju(rf);const Zf=()=>ju(of);const Qf=()=>ju(Ju);const Kf=()=>ju(tf);const Jf=()=>ju(cf);const th=()=>ju(nf);const nh=()=>ju(ff);const eh=()=>ju(lf);const oh=()=>ju(uf);const sh=()=>ju(af);const ch=()=>ju(sf);const rh=()=>ju(ef);const ih=()=>ju(Xu);const ah=()=>ju(Zu);const dh=()=>ju(Qu);const lh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=Uu(t,r,i);const e=o(n);return pd(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return ta(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await pd(t,r,i,o,false);return t}const o=n(e);await pd(t,r,i,o,true);return t}};const uh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await _u(t,o);return s};const fh=t=>{if(t.word){return Ff(t.word)}return Pf()};const hh=String;const gh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const mh=async t=>lh({editor:t,getErrorMessage:hh,getLocation:uh,getNoLocationFoundMessage:fh,isNoProviderFoundError:gh});const wh=t=>{if(t.word){return Wf(t.word)}return Tf()};const ph=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const yh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await ph(t,o);return s};const xh=String;const Eh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const Ih=async(t,n=true)=>lh({editor:t,getErrorMessage:xh,getLocation:yh,getNoLocationFoundMessage:wh,isNoProviderFoundError:Eh});const kh=t=>{switch(t){case De:return true;default:return false}};const Sh=t=>{if(t.length===0){return t}return t.filter(kh)};const Ch=async(t,n)=>{await mo(t,n)};const vh=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Fr(t,s,o);const r=li(t,c);if(r){await Ch(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await mh(i);return a};const bh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return ta(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return ta(t,o)};const Mh=1;const Lh=2;const Ah=(t,n)=>{const e=Sh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Ph=t=>{switch(t){case Lh:return vh;case Mh:return bh;default:return Ah}};const Fh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Ph(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Wh=3;const Th=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,Wh,e,o,{menuId:Wh});return t};const Rh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Dh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Oh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Dh);const r=s.match(Rh);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Bh=(t,n,e)=>{const o=Mr(t,n);const s=Oh(o,n,e);return ta(t,s)};const Nh=async(t,n,e,o)=>{const s=await hd(t,e,o);return Bh(t,s.rowIndex,s.columnIndex)};const Hh=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const zh=1;const Uh=2;const $h=3;const _h=(t,n)=>{if(t){return Lh}if(n){return Mh}return 0};const Yh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await hd(t,e,o);return Fh(t,n,s.rowIndex,s.columnIndex)};const Vh=(t,n)=>new Uint32Array([n,0,n,t.length]);const jh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Vh(o,e);return ta(t,s)};const qh=(t,n,e,o)=>{h(t);g(e);g(o);return jh(t)};const Gh=0;const Xh=async(t,n,e,o,s,c,r)=>{if(n!==Gh){return t}const i=_h(e,o);let a;switch(r){case Uh:a=await Nh(t,i,s,c);break;case zh:a=await Yh(t,i,s,c);break;case $h:a=qh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Zh={editor:undefined,timeout:-1,x:0,y:0};const Qh=()=>Zh;const Kh=(t,n,e,o)=>{Zh.editor=t;Zh.timeout=n;Zh.x=e;Zh.y=o};const Jh=async(t,n)=>{};const tg=async()=>{const{editor:t,x:n,y:e}=Qh();await hd(t,n,e);await Jh()};const ng=300;const eg=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=Qh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(tg,ng);Kh(t,s,n,e);return t};const og=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const sg=async(t,n,e)=>{h(t);g(n);g(e);const o=await hd(t,n,e);const s=Fr(t,o.rowIndex,o.columnIndex);try{const n=await _u(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=og(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const cg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const rg=(t,n,e)=>{const o=cg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Ar(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const ig=(t,n,e)=>{const o=rg(t,n,e);return na(t,o)};const ag=(t,n)=>{const e=cg(t,n);return ta(t,e)};const dg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const lg=async(t,n,e,o,s,c,r)=>t;const ug=(t,n)=>t;const fg=async(t,n,e)=>{await hd(t,n,e)};const hg=t=>{globalThis.requestAnimationFrame(t)};const gg=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const mg=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const wg=async(t,n)=>{let e=n;if(mg(t,n)){const t=Qr();const{differences:o,textInfos:s}=await _r(n,t);e={...n,differences:o,textInfos:s}}if(!gg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await ji(e);return{...e,cursorInfos:o,selectionInfos:s}};const pg=-1;const yg=0;const xg=1;const Eg=(t,n)=>{if(t.rowIndex>n.rowIndex){return xg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return xg}if(t.columnIndex<n.columnIndex){return pg}return yg}return pg};const Ig=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const kg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const Sg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const Cg=(t,n)=>{switch(Eg(n,t)){case yg:return kg(t,n);case xg:return Sg(t,n);case pg:return Ig(t,n);default:throw new Error("unexpected comparison result")}};const vg=(t,n)=>{const e=t.selectionAnchorPosition;const o=Cg(e,n);return ta(t,o)};const bg=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Mg=async t=>{const n=Ko(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=bg(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await wg(e,r);ts(e.uid,e,i);hg(()=>Mg(t))};const Lg=async(t,n,e)=>{h(t);g(n);g(e);const o=await hd(t,n,e);const s=vg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){hg(()=>Mg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Ag=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return fg(t,n,e)}return Lg(t,n,e)};const Pg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Fg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Wg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=Fg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const Tg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=Yr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Rg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Dg=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Rg(t,c);const i=r*e;const a=await Zi(t,i);return a};const Og=Dg;const Bg=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await Zi(t,f);return{...h,handleOffset:l}};const Ng=(t,n)=>{};const Hg={deltaY:0,touchOffsetY:0};const zg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Hg.touchOffsetY=e.y;Hg.deltaY=t.deltaY};const Ug=(t,n)=>Qi(t,n);const $g=(t,n)=>Zi(t,n);const _g=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Ug(t,o)}const c=Rs(s+e,0,Infinity);return{...Ug(t,o),deltaX:c}};const Yg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Hg.deltaY+(Hg.touchOffsetY-e.y);$g(t,o)};const Vg=(t,n,e,o)=>_g(t,n,e,o);const jg=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:ks,start:{columnIndex:0,rowIndex:t}})}return n};const qg=t=>{const{selections:n}=t;const e=jg(n);return na(t,e)};const Gg=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const Xg=t=>{const{selections:n}=t;const e=Gg(n);return na(t,e)};const Zg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Qg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Kg=(t,n)=>{if(!n){return false}return n.test(t)};const Jg=(t,n,e)=>{const o=[];const s=[];const c=Qg(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=Ii(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Bi(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=vr(e);if(Kg(e,c)){o.push({deleted:Ar({lines:t},f),end:u,inserted:["",a+" ",a],origin:Cs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Ar({lines:t},f),end:u,inserted:["",a],origin:Cs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Ar({lines:t},f),end:u,inserted:["",""],origin:Cs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const tm=async t=>{const{lines:n,selections:e}=t;const o=await Zg(t);const{changes:s,selectionChanges:c}=Jg(n,e,o);return na(t,s,c)};const nm=2;const em=0;const om=()=>{const t=zd();const n={id:Fe,newState:{focused:true,focusSource:nm,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:em,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const sm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const cm=async t=>{const n=true;return Hd(Fe,ds,t,om,sm,n)};const rm=()=>{const t=zd();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:im,setFactory:am}=No(je);const dm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await im("Completions.create",o,c,r,s,e,n,a);await im("Completions.loadContent",o);const d=await im("Completions.diff2",o);const l=await im("Completions.render2",o,d);return{...t,commands:l}};const lm=async t=>{const n=false;return Hd(Te,os,t,rm,dm,n)};const um=()=>{const t=zd();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const fm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const hm=9002;const gm=async()=>{if($n(hm)){return}const t=await fm();Un(hm,t)};const mm=async(t,...n)=>{const e=$n(hm);return await e.invoke(t,...n)};const wm=async()=>{const t=$n(hm);_n(hm);if(t){await t.dispose()}};const pm=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const ym=async(t,n)=>{const{uid:e}=t;const o=pm(n);const{height:s,width:c,x:r,y:i}=o;await gm();await mm("FindWidget.create",e,r,i,c,s,n);await mm("FindWidget.loadContent",e);const a=await mm("FindWidget.diff2",e);const d=await mm("FindWidget.render2",e,a);return{...t,commands:d}};const xm=(t,n)=>ym(t,n);const Em=async t=>{const n=true;return Hd(De,cs,t,um,xm,n)};const Im=async t=>Em(t);const km=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=gd(t,e,o);const c=md(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const Sm=()=>{const t=zd();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const Cm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Td("Rename.create",o,c,r,s,e,n,a);await Td("Rename.loadContent",o);const d=await Td("Rename.diff2",o);const l=await Td("Rename.render2",o,d);return{...t,commands:l}};const vm=async t=>{const{columnIndex:n,rowIndex:e}=km(t);const{word:o}=Uu(t,e,n);if(!o){return t}const s=true;return Hd(Be,is,t,Sm,Cm,s)};const bm=async t=>{const n=await Ca({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Mm=async t=>{const n=await bm(t);return Ja(t,n)};const Lm=(t,n)=>{const e=yi(n);const o=cd(t,e,ps);return na(t,o)};const Am=async t=>{const n=await Mo();w(n);return Lm(t,n)};const Pm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return ea(o,e)};const Fm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Wm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Fm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const Tm=/\((.*):(\d+):(\d+)\)$/;const Rm=/at (.*):(\d+):(\d+)$/;const Dm=t=>{for(const n of t){if(Tm.test(n)||Rm.test(n)){return n}}return""};const Om=async t=>{try{const n=yi(t.stack);const e=Dm(n);let o=e.match(Tm);if(!o){o=e.match(Rm)}if(!o){return t}const s=Sr(n.slice(1));const c=Fm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Bm=async t=>{if(t&&t.message&&t.codeFrame){return Wm(t)}if(t&&t.stack){return Om(t)}return t};const Nm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const Hm=async t=>{const n=await Bm(t);const e=Nm(n);console.error(e);return n};const zm=async t=>{try{await Hm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Um=async t=>t;const $m=t=>t.startsWith("untitled:");const _m=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const Ym=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const Vm=async(t,n,e)=>{const o=await Ym(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await Co();await yo("Main.handleUriChange",t,o);return o};const jm=async t=>{try{const{platform:n,uri:e}=t;const o=await Um(t);const s=Lr(o);if($m(e)){const t=await Vm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await _m(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await zm(e);return t}};const qm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Fi(e,o,s,c);return ta(t,r)};const Gm=(t,n,e)=>{const o=Ti(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);sl(o,s+2,c,r,n,e);el(o,s,i,a)}return o};const Xm=(t,n)=>{const{lines:e,selections:o}=t;const s=Gm(o,e,n);return ta(t,s)};const Zm=t=>{Xm(t,ul)};const Qm=/[a-zA-Z\d]/;const Km=t=>Qm.test(t);const Jm=t=>Km(t)||t==="_";const tw=(t,n)=>{for(let e=n-1;e>=0;e--){if(!Jm(t[e])){return e+1}}return 0};const nw=(t,n)=>{for(let e=n;e<t.length;e++){if(!Jm(t[e])){return e}}return t.length};const ew=(t,n,e)=>{const o=t[n];const s=tw(o,e);const c=nw(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const ow=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const sw=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const cw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(ow(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const rw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=ew(t,c,r);if(e.start===e.end){return n}const o=sw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=sw(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=cw(t,i);return a};const iw=t=>{const{lines:n,selections:e}=t;const o=rw(n,e);return ta(t,o)};const aw=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const dw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=aw(o,e,n);return ta(t,s)};const lw=t=>dw(t,fl);const uw=t=>Xm(t,il);const fw=t=>dw(t,dl);const hw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=Ii(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const gw=t=>{const{lines:n,selections:e}=t;const o=hw(n,e);return ta(t,o)};const mw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=Ii(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const ww=t=>{const{selections:n}=t;const{lines:e}=t;const o=mw(e,n);return ta(t,o)};const pw=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const yw=async t=>{const{selections:n}=t;const e=await pw(t,n);return ta(t,e)};const xw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const Ew=t=>{const{lines:n}=t;const{selections:e}=t;if(zi(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(e,o);const a=ew(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if(Ui(t.selections)){return xw(t.lines,t.selections)}return undefined};const Iw=(t,n,e,o)=>e>=t&&o<=n;const kw=t=>{const n=Ew(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(Iw(t.minLineY,t.maxLineY,s,c)){return ta(t,o)}return na(t,[],o)};const Sw=t=>t;const Cw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=Ii(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const vw=t=>{const{lines:n,selections:e}=t;const o=Cw(n,e);return ta(t,o)};const bw=t=>Xm(t,El);const Mw=t=>dw(t,Cl);const Lw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Aw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=pm(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await _r(t,i);const l=pm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Pw=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const Fw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Ar(t,{end:c,start:s}),end:c,inserted:yi(n),origin:xs,start:s}];return na(t,r)};const Ww=()=>{const t=zd();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const Tw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Rw={};const Dw=()=>{if(!Rw.workerPromise){Rw.workerPromise=Tw()}return Rw.workerPromise};const Ow=async(t,...n)=>{const e=await Dw();return await e.invoke(t,...n)};const Bw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Ow("Hover.create",o,c,r,s,e,n,a);await Ow("Hover.loadContent",o);const d=await Ow("Hover.diff2",o);const l=await Ow("Hover.render2",o,d);return{...t,commands:l}};const Nw=async t=>{const n=false;return Hd(Oe,rs,t,Ww,Bw,n)};const Hw="EditorHover";const zw=async t=>{await yo("Viewlet.openWidget",Hw);return t};const Uw=()=>{const t=zd();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const $w=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const _w={};const Yw=()=>{if(!_w.workerPromise){_w.workerPromise=$w()}return _w.workerPromise};const Vw=async(t,...n)=>{const e=await Yw();return await e.invoke(t,...n)};const jw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Vw("SourceActions.create",o,c,r,s,e,n,a);await Vw("SourceActions.loadContent",o);const d=await Vw("SourceActions.diff2",o);const l=await Vw("SourceActions.render2",o,d);return{...t,commands:l}};const qw=async t=>Hd(Ne,as,t,Uw,jw);const Gw=(t,n)=>t.localeCompare(n);const Xw=t=>{const n=[...t];n.sort(Gw);return n};const Zw="sort-lines-ascending";const Qw=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Xw(h);s.push({deleted:Ar({lines:t},f),end:u,inserted:g,origin:Zw,start:l})}return s};const Kw=t=>{const{lines:n,selections:e}=t;const o=Qw(n,e);return na(t,o)};const Jw=async(t,n)=>Ca({args:[n],editor:t,event:Sa,method:da,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const tp=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Fr(t,e,o);return s};const np=async t=>{const n=tp(t);const e=await Jw(t,n);return e};const ep=(t,n,e)=>{const o=yi(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=Ii(n,r);if(o.length>1){const n=Mr({lines:t},i);const r=vr(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const op=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=ep(e,o,n);return na(t,s,c)};const sp=String;const cp=async t=>{try{const n=await np(t);if(!n){return t}return op(t,n)}catch(n){await zm(n);const e=t.selections[0];const o=t.selections[1];return yd(t,e,o,sp(n))}};const rp=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await Ho(`onLanguage:${t.languageId}`,e,o);const s=await ua(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Zg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const ip=/^\s+/;const ap=/\s+$/;const dp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const lp=(t,n,e,o,s,c,r)=>{if(n===o){return[dp(t,e,c),dp(t,s-c.length,r)]}return[dp(n,e,c),dp(o,s,r)]};const up=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...lp(o,u,l,r,i,a,d))}else{const t=s.match(ip);const n=s.match(ap);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const fp=async t=>{const n=tp(t);const e=await rp(t,n);if(!e){return t}const o=up(t,e);return oa(t,o)};const hp=async t=>{const n=await Zg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const gp=/^\s+/;const mp=(t,n,e)=>{const o=n.match(gp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:vs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:vs,start:{columnIndex:s,rowIndex:t}}};const wp=async t=>{const n=await hp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[mp(o,s,n)];return na(t,c)};const pp=async t=>{try{const n=await wp(t);if(t!==n){return n}return fp(t)}catch(n){Ka(n);await pd(t,0,0,String(n),true);return t}};const yp=async(t,n)=>{const e=cd(t,[n],xs);const o=await na(t,e);if(o.completionsOnType){const t=await lm(o);return t}return o};const xp="/";const Ep="{";const Ip="}";const kp="(";const Sp=")";const Cp="[";const vp="]";const bp="???";const Mp="'";const Lp='"';const Ap="`";const Pp=t=>{switch(t){case Ep:return Ip;case kp:return Sp;case Cp:return vp;default:return bp}};const Fp=(t,n)=>{const e=Pp(n);const o=n+e;const s=cd(t,[o],Es);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return na(t,s,c)};const Wp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return ta(t,e)};const Tp=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(yu(e,o)){return Wp(t)}return yp(t,n)};const Rp=(t,n)=>{const e=n+n;const o=cd(t,[e],Es);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return na(t,o,s)};const Dp=async(t,n)=>{const e=Fr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=cd(t,[n],xs);return na(t,e)}const s=cd(t,[o.inserted],xs);return na(t,s)};const Op=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case xp:if(s){return Dp(t,n)}break;case Ip:case Sp:case vp:if(e){return Tp(t,n)}break;case Ep:case kp:case Cp:if(e){return Fp(t,n)}break;case Ap:case Lp:case Mp:if(o){return Rp(t,n)}break}const c=yp(t,n);return c};const Bp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const Np=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Bp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return ea(s,o)};const Hp=t=>t;const zp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const Up=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,zp(t.id)]);c.push(...o);if(zp(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const $p=t=>{switch(t){case We:return jo;case Te:return im;case De:return mm;case Oe:return Ow;case Be:return Td;case Ne:return Vw;default:return undefined}};const _p="Close";const Yp=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const Vp=(t,n)=>{for(const e of Jo()){const o=Ko(Number(e)).newState;const s=o.widgets||[];for(const e of s){if(e.id===n&&e.newState.uid===t){return o}}}return undefined};const jp=(t,n)=>{if(t&&t.widgets){return t}const e=Ko(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return Vp(t,n)};const qp=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(_p);const c=async(c,...r)=>{const i=jp(c,e);if(!i){return c}const a=i.widgets.findIndex(o);if(a===-1){return i}const d=i.widgets[a];const l=d.newState;const{uid:u}=l;const f=$p(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=Ko(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:vd(m.widgets,e)};ts(i.uid,m,t);return t}const w={...l,commands:g};const p=Yp(m,e,w);ts(i.uid,m,p);return p};return c};const Gp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=qp(s,n,e)}return o};const Xp="Viewlet.appendToBody";const Zp="focus";const Qp="Viewlet.registerEventListeners";const Kp="Viewlet.setSelectionByName";const Jp="Viewlet.setValueByName";const ty="Viewlet.setFocusContext";const ny="setBounds";const ey="Viewlet.setBounds";const oy="Viewlet.setCss";const sy="Viewlet.setDom2";const cy="Viewlet.setUid";const ry=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const iy=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const ay=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(iy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const dy=t=>Up(t,"EditorCompletion",ay);const ly=t=>[["Viewlet.dispose",t.newState.uid]];const{close:uy,closeDetails:fy,focusFirst:hy,focusIndex:gy,focusLast:my,focusNext:wy,focusPrevious:py,handleEditorBlur:yy,handleEditorClick:xy,handleEditorDeleteLeft:Ey,handleEditorType:Iy,handlePointerDown:ky,handleWheel:Sy,openDetails:Cy,selectCurrent:vy,selectIndex:by,toggleDetails:My}=Gp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Ly={__proto__:null,add:dy,close:uy,closeDetails:fy,focusFirst:hy,focusIndex:gy,focusLast:my,focusNext:wy,focusPrevious:py,handleEditorBlur:yy,handleEditorClick:xy,handleEditorDeleteLeft:Ey,handleEditorType:Iy,handlePointerDown:ky,handleWheel:Sy,openDetails:Cy,remove:ly,render:ay,selectCurrent:vy,selectIndex:by,toggleDetails:My};const Ay=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Py=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const Fy=t=>{const n=Ay(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Py.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Wy=t=>Up(t,"FindWidget",Fy);const Ty=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ry,focusCloseButton:Dy,focusFind:Oy,focusNext:By,focusNextElement:Ny,focusNextMatchButton:Hy,focusPrevious:zy,focusPreviousElement:Uy,focusPreviousMatchButton:$y,focusReplace:_y,focusReplaceAllButton:Yy,focusReplaceButton:Vy,focusToggleReplace:jy,handleBlur:qy,handleClickButton:Gy,handleFocus:Xy,handleInput:Zy,handleReplaceFocus:Qy,handleReplaceInput:Ky,handleToggleReplaceFocus:Jy,replace:tx,replaceAll:nx,toggleMatchCase:ex,toggleMatchWholeWord:ox,togglePreserveCase:sx,toggleReplace:cx,toggleUseRegularExpression:rx}=Gp(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const ix={__proto__:null,add:Wy,close:Ry,focusCloseButton:Dy,focusFind:Oy,focusNext:By,focusNextElement:Ny,focusNextMatchButton:Hy,focusPrevious:zy,focusPreviousElement:Uy,focusPreviousMatchButton:$y,focusReplace:_y,focusReplaceAllButton:Yy,focusReplaceButton:Vy,focusToggleReplace:jy,handleBlur:qy,handleClickButton:Gy,handleFocus:Xy,handleInput:Zy,handleReplaceFocus:Qy,handleReplaceInput:Ky,handleToggleReplaceFocus:Jy,remove:Ty,render:Fy,replace:tx,replaceAll:nx,toggleMatchCase:ex,toggleMatchWholeWord:ox,togglePreserveCase:sx,toggleReplace:cx,toggleUseRegularExpression:rx};const ax=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Lr(t),uri:t.uri});const dx=async(t,n)=>{const e=ax(t);return lo("Extensions.executeHoverProvider",e,n)};const lx=async(t,n)=>{h(t);g(n);const e=await dx(t,n);if(e){return e}return Ca({args:[n],editor:t,event:ka,method:aa,noProviderFoundMessage:"No hover provider found"})};const ux=async(t,n)=>{h(t);g(n);const e=await lx(t,n);return e};const fx=async(t,n,e,o,s)=>100;const hx=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const gx=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Fc(e,r,n,a,s);const{tokens:c}=t;const d=hx(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const mx=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=yi(t);const c=gx(s,o,n);return c};const wx=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const px=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const yx="typescript";const xx=(t,n,e,o)=>{const s=gd(t,n,e);const c=t.height-md(t,n)+t.y+40;return{x:s,y:c}};const Ex=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=wx(n,s);const i=Fr(o,r,c);const a=await ux(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await mx(d,l||yx,f);const m=$u(o,r,c);const w=c-m.length;await fx();const{x:p,y:y}=xx(o,r,w);const x=o.diagnostics||[];const E=px(x,r);return{documentation:u,lineInfos:h,matchingDiagnostics:E,x:p,y:y}};const Ix=async(t,n,e)=>{const o=await Ex(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const kx=(t,n,e)=>t;const Sx=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const Cx=(t,n,e)=>t;const vx="CodeGeneratorInput";const bx="CodeGeneratorMessage";const Mx="CodeGeneratorWidget";const Lx="DiagnosticError";const Ax="DiagnosticWarning";const Px="CompletionDetailCloseButton";const Fx="CompletionDetailContent";const Wx="Diagnostic";const Tx="EditorCursor";const Rx="EditorRow";const Dx="EditorRowHighlighted";const Ox="EditorSelection";const Bx="HoverDisplayString";const Nx="HoverDocumentation";const Hx="HoverEditorRow";const zx="HoverProblem";const Ux="HoverProblemDetail";const $x="HoverProblemMessage";const _x="IconClose";const Yx="InputBox";const Vx="MaskIcon";const jx="Viewlet";const qx=1;const Gx=2;const Xx=9;const Zx=10;const Qx=11;const Kx=12;const Jx=13;const tE=14;const nE=15;const eE=18;const oE=19;const sE=20;const cE=21;const rE=22;const iE=23;const aE=26;const dE=27;const lE=28;const uE=29;const fE=30;const hE=31;const gE=32;const mE=33;const wE=4;const pE=6;const yE=8;const xE=12;const EE=62;const IE=t=>({childCount:0,text:t,type:xE});const kE=t=>{const n=[{childCount:t.length/2,className:Hx,type:wE}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:yE},IE(o))}return n};const SE=t=>{const n=t.flatMap(kE);return n};const CE={childCount:1,className:$x,type:yE};const vE={childCount:1,className:Ux,type:yE};const bE=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const ME=(t,n,e)=>{const o=[];o.push({childCount:bE(t,n,e)+1,className:"Viewlet EditorHover",type:wE});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${Bx} ${zx}`,type:wE});for(const t of e){o.push(CE,IE(t.message),vE,IE(`${t.source} (${t.code})`))}}if(t.length>0){const n=SE(t);o.push({childCount:t.length,className:Bx,type:wE},...n)}if(n){o.push({childCount:1,className:Nx,type:wE},IE(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:aE,type:wE});return o};const LE={apply(t,n){const e=ME(n.lineInfos,n.documentation,n.diagnostics);return[sy,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const AE={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const PE=[LE,AE];const FE=(t,n)=>{const e=[];for(const o of PE){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const WE=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const TE=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(WE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const RE=t=>Up(t,"EditorRename",TE);const DE=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:OE,close:BE,handleInput:NE}=Gp(["handleInput","close","accept"],"Rename",Be);const HE={__proto__:null,accept:OE,add:RE,close:BE,handleInput:NE,remove:DE,render:TE};const zE=t=>structuredClone(t);const UE=(t,n)=>{const e={...t,focusedIndex:n};return e};const $E=t=>{const n=t.focusedIndex+1;return UE(t,n)};const _E=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const YE=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const VE=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(YE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const jE=t=>Up(t,"EditorSourceActions",VE);const qE=_E;const{close:GE,closeDetails:XE,focusFirst:ZE,focusIndex:QE,focusLast:KE,focusNext:JE,focusPrevious:tI,handleWheel:nI,selectCurrent:eI,selectIndex:oI,selectItem:sI,toggleDetails:cI}=Gp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const rI={__proto__:null,add:jE,close:GE,closeDetails:XE,focusFirst:ZE,focusIndex:QE,focusLast:KE,focusNext:JE,focusPrevious:tI,handleWheel:nI,remove:qE,render:VE,selectCurrent:eI,selectIndex:oI,selectItem:sI,toggleDetails:cI};const iI=async(t,n,e,o,s,...c)=>{const r=$p(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=pm(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const x=Yp(u,s,y);return x};const aI=(t,n)=>t.filter(t=>t.languageId===n);const dI=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=aI(o,e);return s};const lI=/[\w\-]+$/;const uI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(lI);if(i){return i[0]}return""};const fI=async t=>{await yo("Focus.setFocus",t)};const hI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const gI=12;const mI=9;const wI=11;const pI=12;const yI=16;const xI=38;const EI=43;const II=46;const kI=47;const SI=48;const CI=49;const vI=50;const bI=52;const MI=t=>{const n=pm(t);return km(n)};const LI=t=>{const n=pm(t);return n.uri};const AI=t=>{const n=pm(t);return n.languageId};const PI=t=>{const n=pm(t);return tp(n)};const FI=(t,n,e)=>{const o=pm(t);const{word:s}=Uu(o,n,e);return s};const WI=t=>{const n=pm(t);const e=uI(n);return e};const TI=(t,n,e)=>{const o=pm(t);const s=$u(o,n,e);return s};const RI=t=>{const n=pm(t);const{lines:e}=n;return e};const DI=t=>{const n=pm(t);const{selections:e}=n;return e};const OI=async(t,n)=>{const e=pm(t);const o={...e,selections:n};const s=await wg(e,o);ts(t,e,s)};const BI=async(t,n,e,o)=>{const s=pm(t);const c=$p(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await wg(s,d);ts(t,s,l);await fI(pI);if(o){await hI(o)}};const NI=async t=>{await BI(t,De,"FindWidget",0)};const HI=async(t,n)=>{const e=pm(t);const o=await td(e,n);const s=await wg(e,o);ts(t,e,s)};const zI=async t=>{const n=await dI(t);return n};const UI=async t=>{const n=pm(t);const{diagnostics:e}=n;return e};const $I=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const _I=()=>[{command:"Editor.closeSourceAction",key:ee,when:xI},{command:"EditorSourceActions.focusNext",key:de,when:xI},{command:"EditorSourceActions.focusPrevious",key:ie,when:xI},{command:"EditorSourceActions.focusFirst",key:ce,when:xI},{command:"EditorSourceActions.focusLast",key:se,when:xI},{command:"EditorSourceActions.selectCurrent",key:ne,when:xI},{command:"FindWidget.focusNext",key:ne,when:yI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:yI},{command:"FindWidget.focusPrevious",key:ze|ve,when:yI},{command:"FindWidget.focusNext",key:ve,when:yI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:yI},{command:"FindWidget.focusReplace",key:te,when:yI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:EI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:EI},{command:"FindWidget.focusNextMatchButton",key:te,when:vI},{command:"FindWidget.focusReplace",key:ze|te,when:vI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:CI},{command:"FindWidget.focusCloseButton",key:te,when:CI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:SI},{command:"FindWidget.focusReplaceButton",key:te,when:SI},{command:"FindWidget.focusFind",key:ze|te,when:EI},{command:"FindWidget.focusReplaceAllButton",key:te,when:II},{command:"FindWidget.focusCloseButton",key:ze|te,when:II},{command:"FindWidget.focusReplaceButton",key:ze|te,when:kI},{command:"EditorCompletion.focusNext",key:de,when:mI},{command:"EditorCompletion.focusPrevious",key:ie,when:mI},{command:"EditorCompletion.selectCurrent",key:ne,when:mI},{command:"EditorCompletion.close",key:ee,when:mI},{command:"EditorCompletion.focusLast",key:se,when:mI},{command:"EditorCompletion.focusFirst",key:ce,when:mI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:mI},{command:"Editor.cursorWordRight",key:He|ae,when:pI},{command:"Editor.cursorWordLeft",key:He|re,when:pI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:pI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:pI},{command:"Editor.deleteWordLeft",key:He|Jn,when:pI},{command:"Editor.deleteWordRight",key:He|le,when:pI},{command:"Editor.selectNextOccurrence",key:He|he,when:pI},{command:"Editor.openColorPicker",key:He|we,when:pI},{command:"Editor.showSourceActions3",key:He|Me,when:pI},{command:"Editor.handleTab",key:te,when:pI},{command:"Editor.unindent",key:ze|te,when:pI},{command:"Editor.indentLess",key:He|Ae,when:pI},{command:"Editor.closeFind",key:ee,when:yI},{command:"Editor.openFind2",key:He|ge,when:pI},{command:"Editor.openCodeGenerator",key:He|pe,when:pI},{command:"Editor.closeCodeGenerator",key:ee,when:bI},{command:"EditorCodeGenerator.accept",key:ne,when:bI},{command:"Editor.indentMore",key:He|Pe,when:pI},{command:"Editor.selectCharacterLeft",key:ze|re,when:pI},{command:"Editor.selectWordLeft",key:He|ze|re,when:pI},{command:"Editor.selectCharacterRight",key:ze|ae,when:pI},{command:"Editor.selectWordRight",key:He|ze|ae,when:pI},{command:"Editor.selectLine",key:He|ye,when:pI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:pI},{command:"Editor.deleteAllRight",key:He|ze|le,when:pI},{command:"Editor.cancelSelection",key:ee,when:pI},{command:"Editor.undo",key:He|ke,when:pI},{command:"Editor.cursorLeft",key:re,when:pI},{command:"Editor.cursorRight",key:ae,when:pI},{command:"Editor.cursorUp",key:ie,when:pI},{command:"Editor.cursorDown",key:de,when:pI},{command:"Editor.deleteLeft",key:Jn,when:pI},{command:"Editor.deleteRight",key:le,when:pI},{command:"Editor.insertLineBreak",key:ne,when:pI},{command:"Editor.copyLineDown",key:He|ze|he,when:pI},{command:"Editor.moveLineDown",key:He|ze|de,when:pI},{command:"Editor.moveLineUp",key:He|ze|ie,when:pI},{command:"Editor.openCompletion",key:He|oe,when:pI},{command:"Editor.openRename",key:Se,when:pI},{command:"EditorRename.accept",key:ne,when:wI},{command:"Editor.closeRename",key:ee,when:wI},{command:"Editor.cursorHome",key:ce,when:pI},{command:"Editor.cursorEnd",key:se,when:pI},{command:"Editor.toggleComment",key:He|Le,when:pI},{command:"Editor.copy",key:He|fe,when:pI},{command:"Editor.selectAll",key:He|ue,when:pI},{command:"Editor.showHover2",key:He|me,when:pI},{command:"Editor.cut",key:He|Ie,when:pI},{command:"Editor.paste",key:He|Ee,when:pI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:pI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:pI},{command:"Editor.selectAllOccurrences",key:Ue|Ce,when:pI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:pI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:pI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:pI},{command:"Editor.organizeImports",key:Ue|ze|xe,when:pI},{command:"Editor.selectionGrow",key:He|ze|oe,when:gI}];const YI=()=>Jo();const VI={CommandPalette:"Command Palette"};const jI=()=>ju(VI.CommandPalette);const qI={command:"",flags:Ye,id:"separator",label:""};const GI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Af()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Bf()},qI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Nf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Hf()},qI,{command:"Editor.format",flags:Ve,id:"format",label:jf()},{command:"Editor.showSourceActions2",flags:Ve,id:_e,label:Rf()},qI,{command:"Editor.cut",flags:Ve,id:"cut",label:zf()},{command:"Editor.copy",flags:Ve,id:"copy",label:Uf()},{command:"Editor.paste",flags:Ve,id:"paste",label:$f()},qI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:jI()}];const XI=()=>[$e];const ZI=t=>Ma(t);const QI=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(ZI));const s=o.flat();return s};const KI=()=>[{id:"Editor.format",label:jf()},{id:"Editor.showHover",label:qf()},{id:"Editor.formatForced",label:Gf()},{id:"Editor.selectNextOccurrence",label:Xf()},{id:"Editor.selectAllOccurrences",label:Zf()},{id:"Editor.goToDefinition",label:Qf()},{id:"Editor.goToTypeDefinition",label:Kf()},{id:"Editor.selectInsideString",label:Jf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:th()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:nh()},{id:"Editor.sortLinesAscending",label:eh()},{id:"Editor.toggleComment",label:oh()},{id:"Editor.selectUp",label:sh()},{id:"Editor.selectDown",label:ch()},{id:"Editor.toggleBlockComment",label:_f()},{id:"Editor.openColorPicker",label:rh()},{id:"Editor.closeColorPicker",label:ih()},{id:"Editor.copyLineDown",label:ah()},{id:"Editor.copyLineUp",label:dh()},{id:"Editor.moveLineDown",label:Vf()},{id:"Editor.moveLineUp",label:Yf()},{id:"Editor.showSourceActions2",label:Rf()}];const JI=t=>{const n=pm(t);const{selections:e}=n;return e};const tk=t=>{g(t);const n=pm(t);const{lines:e}=n;return e.join(wr)};const nk="insertText";const ek=(t,n,e)=>{switch(n){case nk:return Op(t,e);default:return t}};const ok=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const sk=(t,n)=>op(t,n);const ck=async t=>{const n=await np(t);if(!n){return t}return sk(t,n)};const rk=async()=>{await wm();await gm()};const ik=t=>{switch(t){case De:return`FindWidget`;default:return""}};const ak=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));const{widgets:o}=t.newState;for(const t of o){const o=$p(t.id);const s=`${e}:${t.newState.uid}`;const c=ik(t.id);const r=await o(`${c}.saveState`,t.newState.uid);n[s]=r}}return n};const dk=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);const{widgets:c}=s.newState;const r=[];for(const e of c){const s=$p(e.id);const c=`${o}:${e.newState.uid}`;const i=n[c]||{};const a=ik(e.id);await s(`${a}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await s(`${a}.loadContent`,e.newState.uid,i);const d=await s(`${a}.diff2`,e.newState.uid);const l=await s(`${a}.render2`,e.newState.uid,d);const u={...e,newState:{...e.newState,commands:l}};r.push(u)}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const lk={isReloading:false};const uk=async()=>{if(lk.isReloading){return}lk.isReloading=true;const t=Jo();const n=await ak(t);await rk();const e=await dk(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`);lk.isReloading=false};const fk=async t=>{try{await To(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const hk=async()=>{try{const t=await Rn({commandMap:{},send:fk});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const gk=async(t,n)=>{if(t){zc(true);const t=await hk();_c(t)}if(n){Zr(true)}};const mk=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const wk=async(t,n)=>{am(mk);await gk(t,n)};const pk="editor.lineHeight";const yk="editor.fontSize";const xk="editor.fontFamily";const Ek="editor.letterSpacing";const Ik="editor.tabSize";const kk="editor.lineNumbers";const Sk="editor.diagnostics";const Ck="editor.quickSuggestions";const vk="editor.autoClosingQuotes";const bk="editor.autoclosingBrackets";const Mk="editor.fontWeight";const Lk=async()=>Boolean(await Ea(bk));const Ak=async()=>Boolean(await Ea(vk));const Pk=async()=>Boolean(await Ea(Ck));const Fk=async()=>true;const Wk=async()=>await Ea(pk)||20;const Tk=async()=>await Ea(yk)||15;const Rk=async()=>await Ea(xk)||"Fira Code";const Dk=async()=>await Ea(Ek)??.5;const Ok=async()=>await Ea(Ik)||2;const Bk=async()=>await Ea(kk)??false;const Nk=async()=>[".","/"];const Hk=async()=>await Ea(Sk)??false;const zk=async()=>await Ea(Mk)??400;const Uk=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Hk(),Rk(),Tk(),zk(),Lk(),Ak(),Fk(),Pk(),Bk(),Wk(),Ok(),Dk(),Nk()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const $k=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const _k=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k}=await Uk();const S=await xa(g,h,f,x);const C=await ya(c,e);Zc(C);const v=pa(r,C);const b=$k(C,v);await nr(v,b);const M=er(v);const L=t.tokenizerId+1;sr(L,M);const A={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:v,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k,tokenizerId:L};const P=await So(r);const F=ca(A,a,d,i,o,9);const W=ra(F,P);let T=W;const R=di(T);const D={...T,decorations:R};const O=Qr();const{differences:B,textInfos:N}=await _r(D,O);const H={...D,differences:B,focus:co,focused:true,textInfos:N};await ua(la,r,s,v,P);if(u){await Fa(H)}const z=await Ea("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const Yk=t=>t;const Vk=t=>t;const jk=(t,n)=>{g(t);g(n);hi(t,n)};const qk=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const Gk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const Xk=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=Vr(o,s,c,d);const h=jr(u,r,i);const g=Gk(e,r,u);const m=qk(a,d,f,h,g);return[eo,l,m]};const Zk=(t,n)=>{const e=".EditorInput textarea";return[no,n.uid,e]};const Qk=(t,n)=>[oo,n.uid,co];const Kk=1;const Jk=2;const tS=3;const nS=4;const eS=6;const oS=7;const sS=8;const cS=9;const rS=10;const iS=11;const aS=t=>t!=="type"&&t!=="childCount";const dS=t=>{const n=Object.keys(t).filter(aS);return n};const lS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=uS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const uS=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=uS(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const fS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:iS,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:Kk,value:n.text})}return e}const o=dS(t);const s=dS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:tS,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:nS,key:t})}}return e};const hS=t=>{const n=[t.node];for(const e of t.children){n.push(...hS(e))}return n};const gS=(t,n,e)=>{if(n===-1){t.push({type:oS,index:e});return e}if(n!==e){t.push({type:rS,index:e})}return e};const mS=(t,n)=>{if(n>=0){t.push({type:sS})}return-1};const wS=(t,n)=>{n.push({type:eS,nodes:hS(t)})};const pS=(t,n)=>{n.push({type:Jk,nodes:hS(t)})};const yS=(t,n,e,o,s)=>{const c=fS(t.node,n.node);if(c===null){const t=gS(e,o,s);pS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=gS(e,o,s);if(c.length>0){e.push(...c)}if(r){ES(t.children,n.children,e)}return i};const xS=(t,n,e)=>{const o=fS(t.node,n.node);if(o===null){pS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){ES(t.children,n.children,e)}};const ES=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=mS(e,s);wS(i,e);continue}if(!i){c.push(r);continue}s=yS(o,i,e,s,r)}mS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:cS,index:c[t]})}};const IS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){xS(t[0],n[0],e);return}ES(t,n,e)};const kS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==oS&&o.type!==sS&&o.type!==rS){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const SS=(t,n)=>{const e=lS(t);const o=lS(n);const s=[];IS(e,o,s,[]);return kS(s)};const CS=()=>[{childCount:1,className:"EditorInput",type:wE},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:qx,onBlur:Gx,onCompositionEnd:Zx,onCompositionStart:Qx,onCompositionUpdate:Kx,onCut:tE,onFocus:nE,onPaste:sE,role:"textbox",spellcheck:false,type:EE,wrap:"off"}];const vS=t=>{const n=Array.from(t,t=>({childCount:0,className:Tx,translate:t,type:wE}));return n};const bS=t=>{const n=vS([...t]);return[{childCount:t.length,className:"LayerCursor",type:wE},...n]};const MS="error";const LS="warning";const AS=t=>{switch(t){case MS:return Lx;case LS:return Ax;default:return Lx}};const PS=(...t)=>t.filter(Boolean).join(" ");const FS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=AS(e);return[{childCount:0,className:PS(Wx,r),height:n,left:s,top:c,type:wE,width:o}]};const WS=t=>{const n=t.flatMap(FS);return n};const TS=t=>{const n=WS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:wE},...n]};const RS=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=Rx;if(e===o){i+=" "+Dx}s.push({childCount:c.length/2,className:i,translate:Pi(r),type:wE});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:yE},IE(n))}}return s};const DS=(t,n,e=true,o=-1)=>{const s=RS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:eE,onPointerDown:cE,onWheel:mE,type:wE},...s]};const OS=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:Ox,height:r,left:o,top:s,type:wE,width:c})}return n};const BS=t=>{const n=OS(t);return[{childCount:t.length/4,className:"Selections",type:wE},...n]};const NS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:wE},...BS(t),...DS(n,e,o,s),...bS(c),...TS(r)];const HS=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:wE},...WS([...t])];const zS=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:Jx,onPointerDown:fE,type:wE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:wE},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:dE,type:wE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:wE}];const US=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:oE,type:wE},...CS(),...NS(r,i,e,s,o,t,n),...HS(c),...zS()];const $S=t=>[{childCount:1,className:"LineNumber",type:yE},IE(t)];const _S=t=>{const n=t.flatMap($S);return n};const YS=t=>{const n=_S([...t]);return[{childCount:t.length,className:"Gutter",type:wE},...n]};const VS=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,scrollBarDiagnostics:r=[],selectionInfos:i=[],textInfos:a})=>{const d=c?YS(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:Jx,role:"code",type:wE},...d,...US({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:r,selectionInfos:i,textInfos:a})]};const jS=new Map;const qS=t=>jS.get(t);const GS=(t,n)=>{jS.set(t,n)};const XS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return VS(t)};const ZS=(t,n)=>{const e=t.initial?XS(t):qS(n.uid)||XS(t);const o=XS(n);const s=SS(e,o);if(s.length===0){return[]}GS(n.uid,o);return[so,n.uid,s]};const QS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const KS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const JS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const tC=(t,n)=>{const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=QS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=KS(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=JS(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const nC=t=>{switch(t){case Na:return Xk;case Oa:return Zk;case Ba:return Qk;case Ha:return ZS;case za:return tC;default:throw new Error("unknown renderer")}};const eC=(t,n,e)=>{const o=[];for(const s of e){const e=nC(s);const c=e(t,n);if(c.length>0){if(s===za){o.push(...c)}else{o.push(c)}}}return o};const oC=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=eC(o,e,n);return s};const sC={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=RS(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const cC={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=vS(e);const c=OS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const rC={apply:Xk,isEqual:Ta};const iC={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const aC={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const dC={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const lC={apply(t,n){const e=WS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const uC={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=_S(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const fC={apply:tC,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const hC=[sC,cC,rC,iC,lC,uC,fC,aC,dC];const gC=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of hC){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const mC=()=>[{name:nE,params:["handleFocus"]},{name:oE,params:["handleMouseMove",Xn,Zn,qn]},{name:Gx,params:["handleBlur"]},{name:qx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:Qx,params:["compositionStart","event.data"]},{name:Kx,params:["compositionUpdate","event.data"]},{name:Zx,params:["compositionEnd","event.data"]},{name:tE,params:["cut"],preventDefault:true},{name:sE,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:eE,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:cE,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[rE,iE]},{name:rE,params:["handlePointerMove",Xn,Zn,qn]},{name:iE,params:["handlePointerUp"]},{name:mE,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:Jx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:fE,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[hE,gE]},{name:hE,params:["handleScrollBarVerticalPointerMove",Zn]},{name:gE,params:["handlePointerUp"]},{name:dE,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[lE,uE]},{name:lE,params:["handleScrollBarHorizontalMove",Xn]},{name:uE,params:["handlePointerUp"]}];const wC=(t,n)=>{const{lines:e}=t;return{lines:e}};const pC=async(t,n,e)=>{await vo(t,e)};const yC=async(t,n)=>{await Po(t,n)};const xC=(t,n)=>t;const EC=(t,n)=>{g(t);g(n);gi(t,n)};const IC=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const kC=async t=>{const n=await IC("RunAndDebug.getHighlight",t);return n};const SC=()=>{const t=Jo();return parseInt(t[0])};const CC=async t=>{const n=await kC(t);const e=SC();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const vC=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await wg(s,c);ts(n,s,r);return r};const bC={"ActivateByEvent.activateByEvent":Ho,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":vC(qa),"Editor.addCursorBelow":vC(Xa),"Editor.applyDocumentEdits":vC(Ja),"Editor.applyEdit":vC(td),"Editor.applyEdit2":HI,"Editor.applyWorkspaceEdit":vC(ed),"Editor.braceCompletion":vC(kd),"Editor.cancelSelection":vC(Sd),"Editor.closeCodeGenerator":vC(Md),"Editor.closeFind":vC(Ad),"Editor.closeFind2":NI,"Editor.closeRename":vC(Dd),"Editor.closeSourceAction":vC(Bd),"Editor.closeWidget2":BI,"Editor.compositionEnd":vC(Gd),"Editor.compositionStart":vC(Vd),"Editor.compositionUpdate":vC(qd),"Editor.contextMenu":vC(Th),"Editor.copy":vC(Kd),"Editor.copyLineDown":vC(Jd),"Editor.copyLineUp":vC(tl),"Editor.create":Wa,"Editor.create2":ls,"Editor.cursorCharacterLeft":vC(jl),"Editor.cursorCharacterRight":vC(Ql),"Editor.cursorDown":vC(tu),"Editor.cursorEnd":vC(nu),"Editor.cursorHome":vC(eu),"Editor.cursorLeft":vC(jl),"Editor.cursorRight":vC(Ql),"Editor.cursorSet":vC(ou),"Editor.cursorUp":vC(iu),"Editor.cursorWordLeft":vC(au),"Editor.cursorWordPartLeft":vC(du),"Editor.cursorWordPartRight":vC(lu),"Editor.cursorWordRight":vC(uu),"Editor.cut":vC(gu),"Editor.deleteAll":vC(mu),"Editor.deleteAllLeft":vC(Iu),"Editor.deleteAllRight":vC(Cu),"Editor.deleteCharacterLeft":vC(vu),"Editor.deleteCharacterRight":vC(bu),"Editor.deleteHorizontalRight":vC(Su),"Editor.deleteLeft":vC(vu),"Editor.deleteRight":vC(bu),"Editor.deleteWordLeft":vC(Mu),"Editor.deleteWordPartLeft":vC(Lu),"Editor.deleteWordPartRight":vC(Au),"Editor.deleteWordRight":vC(Pu),"Editor.diff2":Va,"Editor.executeWidgetCommand":vC(iI),"Editor.findAllReferences":vC(Fu),"Editor.format":vC(Ou),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":UI,"Editor.getKeyBindings":_I,"Editor.getKeys":YI,"Editor.getLanguageId":AI,"Editor.getLines2":RI,"Editor.getMenuEntries":GI,"Editor.getMenuEntries2":GI,"Editor.getMenuIds":XI,"Editor.getOffsetAtCursor":PI,"Editor.getPositionAtCursor":MI,"Editor.getProblems":QI,"Editor.getQuickPickMenuEntries":KI,"Editor.getSelections":JI,"Editor.getSelections2":DI,"Editor.getSourceActions":zI,"Editor.getText":tk,"Editor.getUri":LI,"Editor.getWordAt":Uu,"Editor.getWordAt2":FI,"Editor.getWordAtOffset2":WI,"Editor.getWordBefore":$u,"Editor.getWordBefore2":TI,"Editor.goToDefinition":vC(mh),"Editor.goToTypeDefinition":vC(Ih),"Editor.handleBeforeInput":vC(ek),"Editor.handleBeforeInputFromContentEditable":vC(ig),"Editor.handleBlur":vC(od),"Editor.handleClickAtPosition":vC(Fh),"Editor.handleContextMenu":vC(Th),"Editor.handleDoubleClick":vC(Nh),"Editor.handleFocus":vC(Hh),"Editor.handleMouseDown":vC(Xh),"Editor.handleMouseMove":vC(eg),"Editor.handleMouseMoveWithAltKey":vC(sg),"Editor.handleNativeSelectionChange":ag,"Editor.handlePointerCaptureLost":vC(dg),"Editor.handlePointerDown":vC(lg),"Editor.handlePointerMove":vC(Ag),"Editor.handlePointerUp":vC(Pg),"Editor.handleScrollBarClick":Bg,"Editor.handleScrollBarHorizontalMove":vC(Wg),"Editor.handleScrollBarHorizontalPointerDown":vC(Tg),"Editor.handleScrollBarMove":vC(Dg),"Editor.handleScrollBarPointerDown":vC(Bg),"Editor.handleScrollBarVerticalMove":vC(Og),"Editor.handleScrollBarVerticalPointerDown":vC(Bg),"Editor.handleScrollBarVerticalPointerMove":vC(Og),"Editor.handleSingleClick":vC(Yh),"Editor.handleTab":vC(ck),"Editor.handleTouchEnd":vC(Ng),"Editor.handleTouchMove":vC(Yg),"Editor.handleTouchStart":vC(zg),"Editor.handleTripleClick":vC(qh),"Editor.handleWheel":vC(Vg),"Editor.hotReload":uk,"Editor.indendLess":vC(qg),"Editor.indentMore":vC(Xg),"Editor.insertLineBreak":vC(tm),"Editor.loadContent":vC(_k),"Editor.moveLineDown":vC(Yk),"Editor.moveLineUp":vC(Vk),"Editor.moveRectangleSelection":vC(ug),"Editor.moveRectangleSelectionPx":vC(fg),"Editor.moveSelection":vC(vg),"Editor.moveSelectionPx":vC(Lg),"Editor.offsetAt":Fr,"Editor.openCodeGenerator":vC(cm),"Editor.openColorPicker":vC(_d),"Editor.openCompletion":vC(lm),"Editor.openFind":vC(Im),"Editor.openFind2":vC(Em),"Editor.openRename":vC(vm),"Editor.organizeImports":vC(Mm),"Editor.paste":vC(Am),"Editor.pasteText":vC(Lm),"Editor.redo":vC(Pm),"Editor.render":gC,"Editor.render2":oC,"Editor.renderEventListeners":mC,"Editor.replaceRange":vC(sd),"Editor.rerender":vC(zE),"Editor.save":vC(jm),"Editor.saveState":Qo(wC),"Editor.selectAll":vC(qm),"Editor.selectAllLeft":vC(Zm),"Editor.selectAllOccurrences":vC(iw),"Editor.selectAllRight":vC(lw),"Editor.selectCharacterLeft":vC(uw),"Editor.selectCharacterRight":vC(fw),"Editor.selectDown":vC(gw),"Editor.selectInsideString":vC(ww),"Editor.selectionGrow":vC(yw),"Editor.selectLine":vC(jh),"Editor.selectNextOccurrence":vC(kw),"Editor.selectPreviousOccurrence":vC(Sw),"Editor.selectUp":vC(vw),"Editor.selectWord":vC(Bh),"Editor.selectWordLeft":vC(bw),"Editor.selectWordRight":vC(Mw),"Editor.setDebugEnabled":vC(xC),"Editor.setDecorations":vC(Lw),"Editor.setDelta":vC(_g),"Editor.setDeltaY":vC(Ug),"Editor.setLanguageId":vC(Aw),"Editor.setSelections":vC(Pw),"Editor.setSelections2":OI,"Editor.setText":vC(Fw),"Editor.showHover":zw,"Editor.showHover2":Nw,"Editor.showSourceActions":qw,"Editor.showSourceActions2":qw,"Editor.showSourceActions3":qw,"Editor.sortLinesAscending":vC(Kw),"Editor.tabCompletion":vC(cp),"Editor.terminate":e,"Editor.toggleBlockComment":vC(fp),"Editor.toggleComment":vC(pp),"Editor.toggleLineComment":vC(wp),"Editor.type":vC(yp),"Editor.typeWithAutoClosing":vC(Op),"Editor.undo":vC(Np),"Editor.unIndent":vC(Hp),"Editor.updateDebugInfo":CC,"Editor.updateDiagnostics":vC(Fa),"EditorCompletion.close":uy,"EditorCompletion.closeDetails":fy,"EditorCompletion.focusFirst":hy,"EditorCompletion.focusIndex":gy,"EditorCompletion.focusNext":wy,"EditorCompletion.focusPrevious":py,"EditorCompletion.handleEditorBlur":yy,"EditorCompletion.handleEditorClick":xy,"EditorCompletion.handleEditorDeleteLeft":Ey,"EditorCompletion.handleEditorType":Iy,"EditorCompletion.handlePointerDown":ky,"EditorCompletion.handleWheel":Sy,"EditorCompletion.openDetails":Cy,"EditorCompletion.selectCurrent":vy,"EditorCompletion.selectIndex":by,"EditorCompletion.toggleDetails":My,"EditorRename.accept":OE,"EditorRename.close":BE,"EditorRename.handleInput":NE,"EditorSourceAction.close":GE,"EditorSourceAction.closeDetails":XE,"EditorSourceAction.focusFirst":ZE,"EditorSourceAction.focusIndex":QE,"EditorSourceAction.focusNext":JE,"EditorSourceAction.focusPrevious":tI,"EditorSourceAction.handleWheel":nI,"EditorSourceAction.selectCurrent":eI,"EditorSourceAction.selectIndex":oI,"EditorSourceAction.selectItem":sI,"EditorSourceAction.toggleDetails":cI,"EditorSourceActions.focusNext":$E,"ExtensionHostManagement.activateByEvent":Ho,"FindWidget.close":Ry,"FindWidget.focusCloseButton":Dy,"FindWidget.focusFind":Oy,"FindWidget.focusNext":By,"FindWidget.focusNextElement":Ny,"FindWidget.focusNextMatchButton":Hy,"FindWidget.focusPrevious":zy,"FindWidget.focusPreviousElement":Uy,"FindWidget.focusPreviousMatchButton":$y,"FindWidget.focusReplace":_y,"FindWidget.focusReplaceAllButton":Yy,"FindWidget.focusReplaceButton":Vy,"FindWidget.focusToggleReplace":jy,"FindWidget.handleBlur":qy,"FindWidget.handleClickButton":Gy,"FindWidget.handleFocus":Xy,"FindWidget.handleInput":Zy,"FindWidget.handleReplaceFocus":Qy,"FindWidget.handleReplaceInput":Ky,"FindWidget.handleToggleReplaceFocus":Jy,"FindWidget.loadContent":ym,"FindWidget.replace":tx,"FindWidget.replaceAll":nx,"FindWidget.toggleMatchCase":ex,"FindWidget.toggleMatchWholeWord":ox,"FindWidget.togglePreserveCase":sx,"FindWidget.toggleReplace":cx,"FindWidget.toggleUseRegularExpression":rx,"Font.ensure":$I,"HandleMessagePort.handleMessagePort":ok,"Hover.getHoverInfo":Ex,"Hover.handleSashPointerDown":kx,"Hover.handleSashPointerMove":Sx,"Hover.handleSashPointerUp":Cx,"Hover.loadContent":Ix,"Hover.render":FE,"Initialize.initialize":wk,"Listener.register":jk,"Listener.registerListener":hi,"Listener.unregister":EC,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":pC,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":yC};for(const[t,n]of Object.entries(bC)){if(t.startsWith("Editor.")){bC["EditorText"+t.slice("Editor".length)]=n}}const MC=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await pC(n,t,Ge)}});return n};const LC=async()=>{const t=await MC();fa(t)};const AC=async()=>{const t=await On({commandMap:{},async send(t){await Po(t,Ge)}});return t};const PC=async()=>{try{const t=await AC();uo(t)}catch{}};const FC=t=>ko(t);const WC=async()=>{const t=await On({commandMap:{},send:FC});go(t)};const TC=async()=>{const t=await Nn({commandMap:bC});Eo(t)};const RC=t=>Ao(t);const DC=async()=>{const t=await On({commandMap:{},send:RC});po(t)};const OC=async()=>{Zo(bC);await Promise.all([TC(),LC(),PC(),DC(),WC()])};const BC="CodeGeneratorInput";const NC=t=>{const n=Df();const e=Of();return[{childCount:2,className:PS(jx,Mx),type:wE},{childCount:0,className:PS(vx,Yx),name:BC,placeholder:e,type:pE},{childCount:1,className:bx,type:wE},IE(n)]};const HC={apply(t,n){const e=NC();return[sy,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const zC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const UC={apply:(t,n)=>[Zp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const $C=[HC,zC,UC];const _C=(t,n)=>{const e=[];for(const o of $C){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const YC=t=>{const n=_C(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===sy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const VC=t=>Up(t,"EditorCodeGenerator",YC);const jC=_E;const qC={__proto__:null,add:VC,remove:jC,render:YC};const GC=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const XC=[sy,oy,Xp,ey,Qp,cy];const ZC=t=>{const n=GC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(XC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const QC=t=>Up(t,"ColorPicker",ZC);const KC=_E;const JC={};const tv={__proto__:null,Commands:JC,add:QC,remove:KC,render:ZC};const nv=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:wE},{childCount:1,className:Fx,type:wE},IE(t),{childCount:1,className:Px,onClick:Xx,type:wE},{childCount:0,className:`${Vx} ${_x}`,type:wE}];return n};const ev=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const ov={apply(t,n){const e=nv(n.content);return[sy,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const sv={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const cv=[ov,sv];const rv=(t,n)=>ev(cv,t,n);const iv=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const av=t=>iv(t,Te);const dv=t=>{const n=rv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===sy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const lv=t=>Up(t,"EditorCompletionDetails",dv);const uv=_E;const fv=(t,n)=>{const e=av(t);if(!e){return t}const{x:o}=km(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const hv=(t,n)=>fv(t,n);const gv=(t,n)=>fv(t,n);const mv={__proto__:null,add:lv,handleEditorDeleteLeft:gv,handleEditorType:hv,remove:uv,render:dv};const wv=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const pv=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(wv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const yv=t=>Up(t,"EditorCompletion",pv);const xv=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ev}=Gp(["close"],"",Oe);const Iv={__proto__:null,add:yv,close:Ev,remove:xv,render:pv};const kv=()=>{As(We,tv);As(Te,Ly);As(Re,mv);As(De,ix);As(Oe,Iv);As(Be,HE);As(Ne,rI);As(Fe,qC)};const Sv=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const Cv=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const vv=t=>{t.addEventListener("error",Cv);t.addEventListener("unhandledrejection",Sv)};const bv=async()=>{vv(globalThis);await OC();kv()};bv();
1
+ const t=t=>{const n=t.indexOf(".");return t.slice(n+1)};const n=()=>{const n=Object.create(null);const e={};return{clear(){for(const t of Object.keys(n)){delete n[t]}},diff(t,e,o){const{oldState:s,scheduledState:c}=n[t];const r=[];for(let t=0;t<e.length;t++){const n=e[t];if(!n(s,c)){r.push(o[t])}}return r},dispose(t){delete n[t]},get(t){return n[t]},getCommandIds(){const n=Object.keys(e);const o=n.map(t);return o},getKeys(){return Object.keys(n).map(Number)},registerCommands(t){Object.assign(e,t)},set(t,e,o,s){n[t]={newState:o,oldState:e,scheduledState:s??o}},wrapCommand(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);if(c===r||s===r){return}const i=n[e];const a={...i.newState,...r};n[e]={newState:a,oldState:i.oldState,scheduledState:a}};return e},wrapGetter(t){const e=(e,...o)=>{const{newState:s}=n[e];return t(s,...o)};return e},wrapLoadContent(t){const e=async(e,...o)=>{const{newState:s,oldState:c}=n[e];const r=await t(s,...o);const{error:i,state:a}=r;if(c===a||s===a){return{error:i}}const d=n[e];const l={...d.newState,...a};n[e]={newState:l,oldState:d.oldState,scheduledState:l};return{error:i}};return e}}};const e=()=>{globalThis.close()};class o extends Error{constructor(t){super(t);this.name="AssertionError"}}const s=1;const c=2;const r=3;const i=4;const a=5;const d=6;const l=7;const u=8;const f=t=>{switch(typeof t){case"number":return c;case"function":return d;case"string":return i;case"object":if(t===null){return l}if(Array.isArray(t)){return r}return s;case"boolean":return a;default:return u}};const h=t=>{const n=f(t);if(n!==s){throw new o("expected value to be of type object")}};const g=t=>{const n=f(t);if(n!==c){throw new o("expected value to be of type number")}};const m=t=>{const n=f(t);if(n!==r){throw new o("expected value to be of type array")}};const w=t=>{const n=f(t);if(n!==i){throw new o("expected value to be of type string")}};const p=t=>{const n=f(t);if(n!==a){throw new o("expected value to be of type boolean")}};const y=t=>{if(t.startsWith("Error: ")){return t.slice("Error: ".length)}if(t.startsWith("VError: ")){return t.slice("VError: ".length)}return t};const x=(t,n)=>{const e=y(`${t}`);if(n){return`${n}: ${e}`}return e};const E="\n";const I=(t,n=undefined)=>t.indexOf(E,n);const k=(t,n)=>{if(!n){return t}const e=I(t);const o=I(n);if(o===-1){return t}const s=t.slice(0,e);const c=n.slice(o);const r=y(n.slice(0,o));if(s.includes(r)){return s+c}return n};class S extends Error{constructor(t,n){const e=x(t,n);super(e);this.name="VError";if(t instanceof Error){this.stack=k(this.stack,t.stack)}if(t.codeFrame){this.codeFrame=t.codeFrame}if(t.code){this.code=t.code}}}const v=t=>t&&t instanceof MessagePort;const C=t=>t&&t.constructor&&t.constructor.name==="MessagePortMain";const b=t=>typeof OffscreenCanvas!=="undefined"&&t instanceof OffscreenCanvas;const M=(t,n)=>t?.constructor?.name===n;const A=t=>M(t,"Socket");const L=[v,C,b,A];const P=t=>{for(const n of L){if(n(t)){return true}}return false};const F=(t,n,e)=>{if(!t){return}if(e(t)){n.push(t);return}if(Array.isArray(t)){for(const o of t){F(o,n,e)}return}if(typeof t==="object"){for(const o of Object.values(t)){F(o,n,e)}return}};const W=t=>{const n=[];F(t,n,P);return n};const T=t=>{const n=(...n)=>{const e=t.getData(...n);t.dispatchEvent(new MessageEvent("message",{data:e}))};t.onMessage(n);const e=n=>{t.dispatchEvent(new Event("close"))};t.onClose(e)};class R extends EventTarget{constructor(t){super();this._rawIpc=t;T(this)}}const D="E_INCOMPATIBLE_NATIVE_MODULE";const O="E_MODULES_NOT_SUPPORTED_IN_ELECTRON";const B="ERR_MODULE_NOT_FOUND";const N="\n";const H=t=>t.join(N);const z=/^\s+at/;const U=/^\s*at async Promise.all \(index \d+\)$/;const $=t=>z.test(t)&&!U.test(t);const _=t=>{const n=t.findIndex($);if(n===-1){return{actualMessage:H(t),rest:[]}}let e=n-1;while(++e<t.length){if(!$(t[e])){break}}return{actualMessage:t[n-1],rest:t.slice(n,e)}};const Y=t=>t.split(N);const V=/^Error: The module '.*'$/;const j=/^\s* at/;const q=t=>V.test(t);const G=t=>j.test(t);const X=t=>{const n=Y(t);const e=n.findIndex(q);const o=e+n.slice(e).findIndex(G,e);const s=n.slice(e,o);const c=s.join(" ").slice("Error: ".length);return c};const Z=t=>t.includes("[ERR_MODULE_NOT_FOUND]");const Q=t=>{const n=Y(t);const e=n.findIndex(Z);const o=n[e];return{code:B,message:o}};const K=t=>{if(!t){return false}return t.includes("ERR_MODULE_NOT_FOUND")};const J=t=>{if(!t){return false}return t.includes("SyntaxError: Cannot use import statement outside a module")};const tt=/^innerError Error: Cannot find module '.*.node'/;const nt=/was compiled against a different Node.js version/;const et=t=>tt.test(t)&&nt.test(t);const ot=t=>{const n=X(t);return{code:D,message:`Incompatible native node module: ${n}`}};const st=()=>({code:O,message:`ES Modules are not supported in electron`});const ct=(t,n)=>{if(et(n)){return ot(n)}if(J(n)){return st()}if(K(n)){return Q(n)}const e=Y(n);const{actualMessage:o,rest:s}=_(e);return{code:"",message:o,stack:s}};class rt extends S{constructor(t,n="",e=""){if(n||e){const{code:o,message:s,stack:c}=ct(n,e);const r=new Error(s);r.code=o;r.stack=c;super(r,t)}else{super(t)}this.name="IpcError";this.stdout=n;this.stderr=e}}const it="ready";const at=t=>t.data;const dt=()=>{if(typeof WorkerGlobalScope==="undefined"){throw new TypeError("module is not in web worker scope")}return globalThis};const lt=t=>{t.postMessage(it)};class ut extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t)}}const ft=t=>new ut(t);const ht=async t=>{const{promise:n,resolve:e}=Promise.withResolvers();t.addEventListener("message",e,{once:true});const o=await n;return o.data};const gt=async()=>{const t=dt();lt(t);const n=ft(t);const e=await ht(n);if(e.method!=="initialize"){throw new rt("unexpected first message")}const o=e.params[0];if(o==="message-port"){n.send({id:e.id,jsonrpc:"2.0",result:null});n.dispose();const t=e.params[1];return t}return globalThis};class mt extends R{getData(t){return at(t)}send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){if(this._rawIpc.close){this._rawIpc.close()}}onClose(t){}onMessage(t){this._rawIpc.addEventListener("message",t);this._rawIpc.start()}}const wt=t=>new mt(t);const pt={__proto__:null,listen:gt,wrap:wt};const yt=(t,n,e)=>{if("addEventListener"in t){t.addEventListener(n,e)}else{t.on(n,e)}};const xt=(t,n,e)=>{if("removeEventListener"in t){t.removeEventListener(n,e)}else{t.off(n,e)}};const Et=(t,n)=>{const{promise:e,resolve:o}=Promise.withResolvers();const s=Object.create(null);const c=e=>{for(const e of Object.keys(n)){xt(t,e,s[e])}o(e)};for(const[e,o]of Object.entries(n)){const n=t=>{c({event:t,type:o})};yt(t,e,n);s[e]=n}return e};const It=3;const kt=async({isMessagePortOpen:t,messagePort:n})=>{if(!v(n)){throw new rt("port must be of type MessagePort")}if(t){return n}const e=Et(n,{message:It});n.start();const{event:o,type:s}=await e;if(s!==It){throw new rt("Failed to wait for ipc message")}if(o.data!==it){throw new rt("unexpected first message")}return n};const St=t=>{t.start()};class vt extends R{getData=at;send(t){this._rawIpc.postMessage(t)}sendAndTransfer(t){const n=W(t);this._rawIpc.postMessage(t,n)}dispose(){this._rawIpc.close()}onMessage(t){this._rawIpc.addEventListener("message",t)}onClose(t){}}const Ct=t=>new vt(t);const bt={__proto__:null,create:kt,signal:St,wrap:Ct};class Mt extends Error{constructor(t){super(`Command not found ${t}`);this.name="CommandNotFoundError"}}const At=Object.create(null);const Lt=t=>{Object.assign(At,t)};const Pt=t=>At[t];const Ft=(t,...n)=>{const e=Pt(t);if(!e){throw new Mt(t)}return e(...n)};const Wt="2.0";const Tt=Object.create(null);const Rt=t=>Tt[t];const Dt=t=>{delete Tt[t]};class Ot extends Error{constructor(t){super(t);this.name="JsonRpcError"}}const Bt="\n";const Nt="DOMException";const Ht="ReferenceError";const zt="SyntaxError";const Ut="TypeError";const $t=(t,n)=>{if(n){switch(n){case Nt:return DOMException;case Ht:return ReferenceError;case zt:return SyntaxError;case Ut:return TypeError;default:return Error}}if(t.startsWith("TypeError: ")){return TypeError}if(t.startsWith("SyntaxError: ")){return SyntaxError}if(t.startsWith("ReferenceError: ")){return ReferenceError}return Error};const _t=(t,n,e)=>{const o=$t(t,n);if(o===DOMException&&e){return new o(t,e)}if(o===Error){const n=new Error(t);if(e&&e!=="VError"){n.name=e}return n}return new o(t)};const Yt=t=>t.join(Bt);const Vt=t=>t.split(Bt);const jt=()=>{const t=3;const n=Yt(Vt((new Error).stack||"").slice(t));return n};const qt=(t,n=undefined)=>t.indexOf(Bt,n);const Gt=t=>{let n=t.stack||t.data||t.message||"";if(n.startsWith(" at")){n=t.message+Bt+n}return n};const Xt=-32601;const Zt=-32001;const Qt=t=>{const n=jt();if(t&&t instanceof Error){if(typeof t.stack==="string"){t.stack=t.stack+Bt+n}return t}if(t&&t.code&&t.code===Xt){const e=new Ot(t.message);const o=Gt(t);e.stack=o+Bt+n;return e}if(t&&t.message){const e=_t(t.message,t.type,t.name);if(t.data){if(t.data.stack&&t.data.type&&t.message){e.stack=t.data.type+": "+t.message+Bt+t.data.stack+Bt+n}else if(t.data.stack){e.stack=t.data.stack}if(t.data.codeFrame){e.codeFrame=t.data.codeFrame}if(t.data.code){e.code=t.data.code}if(t.data.type){e.name=t.data.type}}else{if(t.stack){const n=e.stack||"";const o=qt(n);const s=Gt(t);e.stack=s+n.slice(o)}if(t.codeFrame){e.codeFrame=t.codeFrame}}return e}if(typeof t==="string"){return new Error(`JsonRpc Error: ${t}`)}return new Error(`JsonRpc Error: ${t}`)};const Kt=t=>{if("error"in t){const n=Qt(t.error);throw n}if("result"in t){return t.result}throw new Ot("unexpected response message")};const Jt=(...t)=>{console.warn(...t)};const tn=(t,n)=>{const e=Rt(t);if(!e){console.log(n);Jt(`callback ${t} may already be disposed`);return}e(n);Dt(t)};const nn="E_COMMAND_NOT_FOUND";const en=t=>{if(t&&t.type){return t.type}if(t&&t.constructor&&t.constructor.name){return t.constructor.name}return undefined};const on=t=>t.trim().startsWith("at ");const sn=t=>{const n=t.stack||"";const e=n.indexOf("\n");if(e!==-1&&!on(n.slice(0,e))){return n.slice(e+1)}return n};const cn=(t,n)=>{if(t&&t.code===nn){return{code:Xt,data:t.stack,message:t.message}}return{code:Zt,data:{code:n.code,codeFrame:n.codeFrame,name:n.name,stack:sn(n),type:en(n)},message:n.message}};const rn=(t,n)=>({error:n,id:t,jsonrpc:Wt});const an=(t,n,e,o)=>{const s=e(n);o(n,s);const c=cn(n,s);return rn(t,c)};const dn=(t,n)=>({id:t.id,jsonrpc:Wt,result:n??null});const ln=(t,n)=>{const e=n??null;return dn(t,e)};const un=(t,n)=>({error:{code:Zt,data:n,message:n.message},id:t,jsonrpc:Wt});const fn=async(t,n,e,o,s,c)=>{try{const o=c(t.method)?await e(t.method,n,...t.params):await e(t.method,...t.params);return ln(t,o)}catch(e){if(n.canUseSimpleErrorResponse){return un(t.id,e)}return an(t.id,e,o,s)}};const hn=t=>t;const gn=()=>{};const mn=()=>false;const wn=tn;const pn=t=>{if(t.length===1){const n=t[0];return{execute:n.execute,ipc:n.ipc,logError:n.logError||gn,message:n.message,preparePrettyError:n.preparePrettyError||hn,requiresSocket:n.requiresSocket||mn,resolve:n.resolve||wn}}return{execute:t[2],ipc:t[0],logError:t[5],message:t[1],preparePrettyError:t[4],requiresSocket:t[6],resolve:t[3]}};const yn=async(...t)=>{const n=pn(t);const{execute:e,ipc:o,logError:s,message:c,preparePrettyError:r,requiresSocket:i,resolve:a}=n;if("id"in c){if("method"in c){const t=await fn(c,o,e,r,s,i);try{o.send(t)}catch(t){const n=an(c.id,t,r,s);o.send(n)}return}a(c.id,c);return}if("method"in c){await fn(c,o,e,r,s,i);return}throw new Ot("unexpected message")};const xn="2.0";const En=(t,n)=>({jsonrpc:xn,method:t,params:n});const In=(t,n,e)=>{const o={id:t,jsonrpc:xn,method:n,params:e};return o};let kn=0;const Sn=()=>++kn;const vn=t=>{const n=Sn();const{promise:e,resolve:o}=Promise.withResolvers();t[n]=o;return{id:n,promise:e}};const Cn=async(t,n,e,o,s)=>{const{id:c,promise:r}=vn(t);const i=In(c,e,o);if(s&&n.sendAndTransfer){n.sendAndTransfer(i)}else{n.send(i)}const a=await r;return Kt(a)};const bn=t=>{const n=Object.create(null);t._resolve=(t,e)=>{const o=n[t];if(!o){console.warn(`callback ${t} may already be disposed`);return}o(e);delete n[t]};const e={async dispose(){await(t?.dispose())},invoke(e,...o){return Cn(n,t,e,o,false)},invokeAndTransfer(e,...o){return Cn(n,t,e,o,true)},ipc:t,send(n,...e){const o=En(n,e);t.send(o)}};return e};const Mn=()=>false;const An=t=>t;const Ln=()=>{};const Pn=t=>{const n=t?.target?.requiresSocket||Mn;const e=t?.target?.execute||Ft;return yn(t.target,t.data,e,t.target._resolve,An,Ln,n)};const Fn=t=>{if("addEventListener"in t){t.addEventListener("message",Pn)}else if("on"in t){t.on("message",Pn)}};const Wn=async(t,n)=>{const e=await t.listen(n);if(t.signal){t.signal(e)}const o=t.wrap(e);return o};const Tn=async({commandMap:t,isMessagePortOpen:n=true,messagePort:e})=>{Lt(t);const o=await bt.create({isMessagePortOpen:n,messagePort:e});const s=bt.wrap(o);Fn(s);const c=bn(s);e.start();return c};const Rn=async({commandMap:t,isMessagePortOpen:n,send:e})=>{const{port1:o,port2:s}=new MessageChannel;await e(o);return Tn({commandMap:t,isMessagePortOpen:n,messagePort:s})};const Dn=t=>{let n;const e=()=>{if(!n){n=t()}return n};return{async dispose(){const t=await e();await t.dispose()},async invoke(t,...n){const o=await e();return o.invoke(t,...n)},async invokeAndTransfer(t,...n){const o=await e();return o.invokeAndTransfer(t,...n)},async send(t,...n){const o=await e();o.send(t,...n)}}};const On=async({commandMap:t,isMessagePortOpen:n,send:e})=>Dn(()=>Rn({commandMap:t,isMessagePortOpen:n,send:e}));const Bn=async({commandMap:t,messagePort:n})=>Tn({commandMap:t,messagePort:n});const Nn=async({commandMap:t})=>{Lt(t);const n=await Wn(pt);Fn(n);const e=bn(n);return e};const Hn=({commandMap:t})=>{const n=[];const e=(e,...o)=>{n.push([e,...o]);const s=t[e];if(!s){throw new Error(`command ${e} not found`)}return s(...o)};const o={invocations:n,invoke:e,invokeAndTransfer:e};return o};const zn=Object.create(null);const Un=(t,n)=>{zn[t]=n};const $n=t=>zn[t];const _n=t=>{delete zn[t]};const Yn=t=>({async dispose(){const n=$n(t);await n.dispose()},invoke(n,...e){const o=$n(t);return o.invoke(n,...e)},invokeAndTransfer(n,...e){const o=$n(t);return o.invokeAndTransfer(n,...e)},registerMockRpc(n){const e=Hn({commandMap:n});Un(t,e);e[Symbol.dispose]=()=>{_n(t)};return e},set(n){Un(t,n)}});const Vn=12;const jn=100;const qn="event.altKey";const Gn="event.button";const Xn="event.clientX";const Zn="event.clientY";const Qn="event.deltaMode";const Kn="event.deltaY";const Jn=1;const te=2;const ne=3;const ee=8;const oe=9;const se=255;const ce=12;const re=13;const ie=14;const ae=15;const de=16;const le=18;const ue=29;const fe=31;const he=32;const ge=34;const me=36;const we=38;const pe=39;const ye=40;const xe=43;const Ee=50;const Ie=52;const ke=54;const Se=58;const ve=59;const Ce=60;const be=68;const Me=87;const Ae=88;const Le=90;const Pe=92;const Fe=1;const We=2;const Te=3;const Re=4;const De=5;const Oe=6;const Be=7;const Ne=8;const He=1<<11>>>0;const ze=1<<10>>>0;const Ue=1<<9>>>0;const $e=3;const _e=22;const Ye=1;const Ve=0;const je=301;const qe=55;const Ge=99;const Xe=44;const Ze=9006;const Qe=7009;const Ke=300;const Je=4561;const to=1;const no="Viewlet.focusSelector";const eo="Viewlet.setCss";const oo="Viewlet.setFocusContext";const so="Viewlet.setPatches";const co=12;const{invoke:ro,set:io}=Yn(Xe);const ao={__proto__:null,invoke:ro,set:io};const{invoke:lo,set:uo}=Yn(Ze);const fo=(t,n)=>lo("Extensions.getLanguages",t,n);const{invoke:ho,set:go}=Yn(Je);const mo=async(t,n)=>ho("Open.openUrl",t,n);const{invoke:wo,set:po}=Yn(Qe);const{invoke:yo,invokeAndTransfer:xo,set:Eo}=Yn(to);const Io=async(t,n,e,o,s)=>{g(t);g(n);g(e);g(o);await yo("ContextMenu.show2",t,n,e,o,s)};const ko=async(t,n)=>{const e="HandleMessagePort.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToOpenerWorker",t,e,n)};const So=async t=>yo("FileSystem.readFile",t);const vo=async()=>yo("Layout.handleWorkspaceRefresh");const Co=async(t,n=0)=>{const e="HandleMessagePort.handleMessagePort2";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker",t,e,n)};const bo=async t=>{await yo("ClipBoard.writeText",t)};const Mo=async()=>yo("ClipBoard.readText");const Ao=(t,n,e)=>yo("ExtensionHostManagement.activateByEvent",t,n,e);const Lo=async t=>{const n="TextMeasurement.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToTextMeasurementWorker",t,n,0)};const Po=async(t,n)=>{const e="Extensions.handleMessagePort";await xo("SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionManagementWorker",t,e,n)};const Fo=async t=>await yo("Preferences.get",t);const Wo=async(t,n,e)=>{await yo("Main.openUri",t,n,e)};const To=async t=>{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort2")};const Ro={__proto__:null,activateByEvent:Ao,getPreference:Fo,handleWorkspaceRefresh:vo,invoke:yo,invokeAndTransfer:xo,openUri:Wo,readClipBoardText:Mo,readFile:So,sendMessagePortToExtensionHostWorker:Co,sendMessagePortToExtensionManagementWorker:Po,sendMessagePortToOpenerWorker:ko,sendMessagePortToSyntaxHighlightingWorker:To,sendMessagePortToTextMeasurementWorker:Lo,set:Eo,showContextMenu2:Io,writeClipBoardText:bo};const{invoke:Do,set:Oo}=Yn(Ke);const Bo={__proto__:null,invoke:Do,set:Oo};const No=t=>{let n;let e;const o=async()=>{const n=await e();Un(t,n)};const s=async()=>{if(!n){n=o()}await n};return{async invoke(n,...e){await s();const o=$n(t);return o.invoke(n,...e)},async invokeAndTransfer(n,...e){await s();const o=$n(t);return o.invokeAndTransfer(n,...e)},setFactory(t){e=t}}};const Ho=async(t,n,e)=>{w(t);await Ao(t,n,e)};const zo=t=>t;const Uo=6;const $o=async(t,n,e)=>{const o=await Rn({commandMap:{},isMessagePortOpen:true,async send(e){await xo("IpcParent.create",{method:Uo,name:t,port:e,raw:true,url:n})}});if(e){await o.invoke(e)}return o};const _o=async()=>{const t="Color Picker Worker";const n="colorPickerWorkerMain.js";return $o(t,n)};const Yo={};const Vo=()=>{if(!Yo.workerPromise){Yo.workerPromise=_o()}return Yo.workerPromise};const jo=async(t,...n)=>{const e=await Vo();return await e.invoke(t,...n)};const qo=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;await jo("ColorPicker.create",o,c,r,s,e,n);await jo("ColorPicker.loadContent",o);const i=await jo("ColorPicker.diff2",o);const a=await jo("ColorPicker.render2",o,i);return{...t,commands:a}};const Go=n();const{getCommandIds:Xo,registerCommands:Zo,wrapGetter:Qo}=Go;const Ko=t=>Go.get(t);const Jo=()=>{const t=Go.getKeys();return t.map(String)};const ts=(t,n,e)=>{Go.set(t,n,e)};const ns=[];const es=41;const os=9;const ss=0;const cs=16;const rs=51;const is=11;const as=38;const ds=52;const ls=(t,n,e,o,s,c,r,i)=>{g(t);const a={additionalFocus:0,assetDir:i,charWidth:0,columnWidth:0,completionState:"",completionTriggerCharacters:[],completionUid:0,cursorInfos:[],cursorWidth:2,debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:false,differences:[],embeds:[],finalDeltaY:0,finalY:0,focus:0,focused:false,focusKey:ss,fontFamily:"",fontSize:0,fontWeight:0,handleOffset:0,handleOffsetX:0,hasListener:false,height:c,highlightedLine:-1,id:t,incrementalEdits:ns,initial:true,invalidStartIndex:0,isAutoClosingBracketsEnabled:false,isAutoClosingQuotesEnabled:false,isAutoClosingTagsEnabled:false,isMonospaceFont:false,isQuickSuggestionsEnabled:false,isSelecting:false,itemHeight:20,languageId:"",letterSpacing:0,lineCache:[],lineNumbers:false,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfLines:0,numberOfVisibleLines:0,platform:r,primarySelectionIndex:0,redoStack:[],rowHeight:0,savedSelections:[],scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:0,textInfos:[],tokenizerId:0,uid:t,undoStack:[],uri:n,validLines:[],visualDecorations:[],widgets:[],width:s,x:e,y:o};ts(t,a,a)};const us="compositionUpdate";const fs="contentEditableInput";const hs="delete";const gs="deleteHorizontalRight";const ms="deleteLeft";const ws="editorCut";const ps="editorPasteText";const ys="editorSnippet";const xs="editorType";const Es="editorTypeWithAutoClosing";const Is="format";const ks="indentLess";const Ss="indentMore";const vs="insertLineBreak";const Cs="lineComment";const bs="rename";const Ms="toggleBlockComment";const As=Object.create(null);const Ls=(t,n)=>{As[t]=n};const Ps=t=>As[t];const Fs=t=>Ps(t);const Ws=async(t,n,e)=>{const o=Fs(n.id);if(e.length===1&&e[0].origin===xs&&o.handleEditorType){const n=await o.handleEditorType(t);return{...n}}if(e.length===1&&e[0].origin===ms&&o.handleEditorDeleteLeft){const n=await o.handleEditorDeleteLeft(t);return{...n}}return n};const Ts=async(t,n)=>{const e=t.widgets||[];if(e.length===0){return e}let o=t;for(const s of e){o=await Ws(t,s,n)}return o};const Rs=(t,n,e)=>{g(t);g(n);g(e);return Math.min(Math.max(t,n),e)};const Ds="Link";const Os="Function";const Bs="Parameter";const Ns="Type";const Hs="VariableName";const zs="Class";const Us=1;const $s=2816;const _s=2817;const Ys=2824;const Vs=2825;const js=2956;const qs=2857;const Gs=3072;const Xs=3073;const Zs=3077;const Qs=3088;const Ks=1792;const Js=1793;const tc=512;const nc=513;const ec=769;const oc=1024;const sc=1536;const cc=1537;const rc=1544;const ic=1545;const ac=2048;const dc=2049;const lc=2056;const uc=2057;const fc=2064;const hc=2080;const gc=2081;const mc=2088;const wc=2089;const pc=2313;const yc=2560;const xc=2561;const Ec=2569;const Ic=2584;const kc=256;const Sc=257;const vc=272;const Cc=t=>{switch(t){case Us:return Ds;case oc:case sc:case cc:case rc:case ic:case tc:case nc:case ec:return Ns;case Ks:case Js:return Bs;case ac:case dc:case lc:case uc:case fc:case hc:case gc:case mc:case wc:case pc:case yc:case xc:case Ec:case Ic:return Hs;case kc:case Sc:case vc:return zs;case $s:case _s:case Ys:case Vs:case js:case qs:case Gs:case Xs:case Zs:case Qs:return Os;default:return`Unknown-${t}`}};const bc=t=>structuredClone(t);const Mc=t=>bc(t);const Ac={warned:[]};const Lc=t=>{const n=[];for(const e of t){h(e);n.push(e.type,e.length)}return n};const Pc=(t,n)=>{if(Ac.warned.includes(n)){return}Ac.warned.push(n);console.warn(`tokenizers without hasArrayReturn=false are deprecated (language ${t})`)};const Fc=(t,n,e,o,s)=>{try{const c=n(e,o);if(!c?.tokens||!c.state){throw new Error("invalid tokenization result")}if(!s){Pc(t,n);c.tokens=Lc(c.tokens)}return c}catch(t){console.error(t);return{lineState:o,tokens:[0,e.length]}}};const Wc={TopLevelContent:1};const Tc={Text:1};const Rc={[Tc.Text]:"Text"};const Dc={state:Wc.TopLevelContent};const Oc=true;const Bc=(t,n)=>({state:n.state,tokens:[Tc.Text,t.length]});const Nc={__proto__:null,State:Wc,TokenMap:Rc,TokenType:Tc,hasArrayReturn:Oc,initialLineState:Dc,tokenizeLine:Bc};const Hc={enabled:false};const zc=t=>{Hc.enabled=t};const Uc=()=>Hc.enabled;const{invoke:$c,set:_c}=Bo;const Yc={pending:Object.create(null),tokenizePaths:Object.create(null),tokenizers:Object.create(null)};const Vc=t=>Object.hasOwn(Yc.tokenizers,t);const jc=(t,n)=>{Yc.tokenizers[t]=n};const qc=t=>Yc.tokenizers[t];const Gc=(t,n)=>{Yc.tokenizePaths[t]=n};const Xc=t=>Yc.tokenizePaths[t]||"";const Zc=t=>{for(const n of t){if(n&&n.id&&n.tokenize){Gc(n.id,n.tokenize)}}};const Qc=t=>Object.hasOwn(Yc.pending,t);const Kc=Object.create(null);const Jc=(t,n)=>{Kc[t]=n};const tr=t=>Kc[t]||{};const nr=async(t,n)=>{if(!n){return}Gc(t,n);if(Uc()){const e=await $c("Tokenizer.load",t,n);Jc(t,e);return}try{const e=await import(n);if(typeof e.tokenizeLine!=="function"){console.warn(`tokenizer.tokenizeLine should be a function in "${n}"`);return}if(!e.TokenMap||typeof e.TokenMap!=="object"||Array.isArray(e.TokenMap)){console.warn(`tokenizer.TokenMap should be an object in "${n}"`);return}Jc(t,e.TokenMap);jc(t,e)}catch(t){console.error(t)}};const er=t=>{if(Vc(t)){return qc(t)}if(Qc(t)){return Nc}return Nc};const or=Object.create(null);const sr=(t,n)=>{or[t]=n};const cr=t=>or[t]||Nc;const rr=(t,n,e,o,s,c,r)=>{const i=er(e);if(o!==n.length&&i&&i!==Nc){const a=o===0&&s===n.length;const d=n.slice(o,s);const l=Fc(t,i.tokenizeLine,d,c[e]||Mc(i.initialLineState),i.hasArrayReturn);c[e]=l;if(l.embeddedLanguage){const n=rr(t,d,l.embeddedLanguage,l.embeddedLanguageStart,l.embeddedLanguageEnd,c,r);if(n?.isFull){return n}}return{isFull:a,result:l,TokenMap:i.TokenMap}}r.push(e);c[e]=undefined;return{isFull:false,result:{},TokenMap:[]}};const ir=(t,n,e,o)=>{const s=[];const c=[];const r=Object.create(null);for(const i of o){const o=e[i+1];const a=n[i];if(o.embeddedLanguage){const{embeddedLanguage:n,embeddedLanguageEnd:e,embeddedLanguageStart:i}=o;if(a.length===0){const t={tokens:[]};o.embeddedResultIndex=c.length;c.push({isFull:true,result:t,TokenMap:[]})}else{o.embeddedResultIndex=c.length;c.push(rr(t,a,n,i,e,r,s))}}else{for(const t of Object.keys(r)){r[t]=undefined}}}return{embeddedResults:c,tokenizersToLoad:s}};const ar=(t,n,e)=>t<n?n:e;const dr=(t,n,e)=>{const{invalidStartIndex:o,languageId:s,lineCache:c,lines:r,tokenizerId:i}=t;const a=cr(i);const{hasArrayReturn:d,initialLineState:l,tokenizeLine:u}=a;const f=o;const h=ar(o,e,f);const g=[];const m=[];const w=[];for(let t=f;t<h;t++){const n=t===0?Mc(l):c[t];const e=r[t];const o=Fc(s,u,e,n,d);c[t+1]=o;if(o.embeddedLanguage){o.embeddedResultIndex=w.length;w.push(t)}}const p=c.slice(n+1,e+1);if(w.length>0){const{embeddedResults:n,tokenizersToLoad:e}=ir(s,r,c,w);t.invalidStartIndex=0;return{embeddedResults:n,tokenizersToLoad:e,tokens:p}}t.invalidStartIndex=Math.max(o,h);return{embeddedResults:m,tokenizersToLoad:g,tokens:p}};const lr=Object.create(null);const ur=async(t,n,e,o)=>{if(Uc()){if(o){const{id:o,invalidStartIndex:s,languageId:c,lines:r}=t;let i=true;let a=r;if(lr[o]===r){i=false;a=[]}else{lr[o]=r}const d={invalidStartIndex:s,languageId:c};return $c("GetTokensViewport.getTokensViewport",d,n,e,i,o,a)}return $c("GetTokensViewport.getTokensViewport",t,n,e,true,t.id,t.lines)}return dr(t,n,e)};const fr=async t=>{for(const n of t){const t=Xc(n);await nr(n,t)}};const hr=".";const gr='"';const mr="";const wr="\n";const pr=" ";const yr="\t";const xr=(t,n,e)=>{if(n){return t.replaceAll(yr,()=>pr.repeat(e))}return t};const Er=t=>t.includes(yr);const Ir=(t,n,e)=>{const o=t.length;const s=e.length;t.length=o+s;for(let e=o-1;e>=n;e--){t[e+s]=t[e]}for(let o=0;o<s;o++){t[o+n]=e[o]}};const kr=(t,n,e,o)=>{const s=t.splice(n,e);Ir(t,n,o);return s};const Sr=t=>t.join("\n");const vr=/^\s+/;const Cr=t=>{const n=t.match(vr);if(!n){return""}return n[0]};const br=(t,n)=>{h(t);m(n);const e=[...t.lines];let o=0;for(const s of n){const n=s.start.rowIndex+o;const c=s.end.rowIndex+o;const r=s.start.columnIndex;const i=s.end.columnIndex;const{deleted:a,inserted:d}=s;g(n);g(c);g(r);g(i);m(d);m(a);if(n===c){const o=e[n];if(d.length===0){const t=o.slice(0,r);const s=o.slice(i);e[n]=t+s}else if(d.length===1){let t=o.slice(0,r);if(r>o.length){t+=" ".repeat(r-o.length)}const s=o.slice(i);const c=d[0];e[n]=t+c+s}else{const s=o.slice(0,r)+d[0];const c=d.at(-1)+o.slice(i);kr(e,n,a.length,[s,...d.slice(1,-1),c]);t.maxLineY=Math.min(t.numberOfVisibleLines,e.length)}}else{const o=e[n].slice(0,r)+d[0];if(d.length===1){const t=c>=e.length?"":e[c].slice(i);kr(e,n,a.length,[o+t])}else{const t=d.slice(1,-1);const s=d.at(-1)+(c>=e.length?"":e[c].slice(i));kr(e,n,a.length,[o,...t,s])}t.maxLineY=Math.min(t.numberOfVisibleLines,t.lines.length)}o+=d.length-a.length}return e};const Mr=(t,n)=>t.lines[n];const Ar=t=>Sr(t.lines);const Lr=(t,n)=>{h(t);const e=n.start.rowIndex;const o=n.start.columnIndex;const s=Math.min(n.end.rowIndex,t.lines.length-1);const c=n.end.columnIndex;if(e===s){return[t.lines[e].slice(o,c)]}const r=[t.lines[e].slice(o),...t.lines.slice(e+1,s),t.lines[s].slice(0,c)];return r};const Pr=async(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Fr=(t,n,e)=>{h(t);g(n);g(e);let o=0;let s=0;const{lines:c}=t;const r=Math.min(n,t.lines.length);while(s<r){o+=c[s].length+1;s++}o+=e;return o};const Wr=(t,n)=>{const{lines:e}=t;let o=0;let s=0;let c=0;while(o<e.length&&c<n){c+=e[o].length+1;o++}if(c>n){o--;c-=e[o].length+1;s=n-c}else{s=c-n}return{columnIndex:s,rowIndex:o}};const Tr=10;const Rr=(t,n)=>{let e=0;let o=0;let s=0;const c=t.length;for(let r=0;r<c;r+=2){const c=t[r+1];o+=c;e=o;if(e>=n){e-=c;o-=c;s=r;break}}return{end:o,start:e,startIndex:s}};const Dr=(t,n,e)=>{for(const[o,{end:s}]of t){if(o<e&&s>n){return true}}return false};const Or=(t,n)=>{for(const[e,o]of t){if(e<=n&&o.end>n){return o}}return undefined};const Br=(t,n,e,o,s,c,r,i,a,d,l,u)=>{const f=[];const h=new Map;for(let t=0;t<o.length;t+=4){const n=o[t];const c=o[t+1];const r=o[t+2];const i=n-s;const a=i+c;if(i<e.length&&a>0){const t=Cc(r);if(t){h.set(Math.max(0,i),{className:t,end:Math.min(e.length,a)})}}}const g=t[n.embeddedResultIndex];const m=g.result.tokens;const w=g.TokenMap;const p=m.length;let{end:y,start:x,startIndex:E}=Rr(m,l);const I=Hr(x,d,a);for(let t=E;t<p;t+=2){const n=m[t];const o=m[t+1];const s=x+o;const i=Dr(h,x,s);if(i){let t=x;while(t<s){const o=Or(h,t);let i;let a;let d;if(o){i=Math.min(s,o.end);a=e.slice(t,i);const c=w[n]||"Unknown";d=`Token ${c} ${o.className}`}else{let o=s;for(const[n]of h){if(n>t&&n<s){o=Math.min(o,n)}}i=o;a=e.slice(t,i);d=`Token ${w[n]||"Unknown"}`}const l=xr(a,c,r);f.push(l,d);t=i}}else{const t=e.slice(x,s);const o=`Token ${w[n]||"Unknown"}`;const i=xr(t,c,r);f.push(i,o)}x=s;y=s;if(y>=u){break}}return{difference:I,lineInfo:f}};const Nr=(t,n,e)=>{if(t===0){return{maxOffset:Math.ceil(n/e),minOffset:0}}const o=Math.ceil(t/e);const s=o+Math.ceil(n/e);return{maxOffset:s,minOffset:o}};const Hr=(t,n,e)=>{const o=t*n;const s=o-e;return s};const zr=(t,n,e,o,s,c,r,i,a,d,l,u,f)=>{const h=[];const g=new Map;for(let n=0;n<o.length;n+=4){const e=o[n];const s=o[n+1];const r=o[n+2];const i=e-c;const a=i+s;if(i<t.length&&a>0){const n=Cc(r);if(n){g.set(Math.max(0,i),{className:n,end:Math.min(t.length,a)})}}}const{tokens:m}=n;let{end:w,start:p,startIndex:y}=Rr(m,u);const x=Hr(p,l,d);const E=m.length;for(let n=y;n<E;n+=2){const e=m[n];const o=m[n+1];const c=p+o;const a=Dr(g,p,c);if(a){let n=p;while(n<c){const o=Or(g,n);let a;let d;let l;if(o){a=Math.min(c,o.end);d=t.slice(n,a);const r=s[e]||"Unknown";l=`Token ${r} ${o.className}`}else{let o=c;for(const[t]of g){if(t>n&&t<c){o=Math.min(o,t)}}a=o;d=t.slice(n,a);l=`Token ${s[e]||"Unknown"}`}const u=xr(d,r,i);h.push(u,l);n=a}}else{const n=t.slice(p,c);const o=`Token ${s[e]||"Unknown"}`;const a=xr(n,r,i);h.push(a,o)}p=c;w=c;if(w>=f){break}}return{difference:x,lineInfo:h}};const Ur=(t,n,e,o,s,c,r,i,a,d,l)=>{const{maxOffset:u,minOffset:f}=Nr(d,a,l);if(e.length>0&&n.embeddedResultIndex!==undefined){const s=e[n.embeddedResultIndex];if(s?.isFull){return Br(e,n,t,o,c,r,i,a,d,l,f,u)}}return zr(t,n,e,o,s,c,r,i,a,d,l,f,u)};const $r=(t,n,e,o,s,c,r,i,a)=>{const d=[];const l=[];const{decorations:u,languageId:f,lines:h}=t;const g=tr(f);let m=c;const w=2;for(let t=o;t<s;t++){const s=h[t];const c=Er(s);const f=[];for(let t=0;t<u.length;t+=4){const n=u[t];const e=u[t+1];const o=u[t+2];const c=u[t+3];if(n>=m&&n<m+s.length){f.push(n,e,o,c)}}const{difference:p,lineInfo:y}=Ur(s,n[t-o],e,f,g,m,c,w,r,i,a);d.push(y);l.push(p);m+=s.length+1}return{differences:l,result:d}};const _r=async(t,n)=>{const{charWidth:e,deltaX:o,lines:s,minLineY:c,numberOfVisibleLines:r,width:i}=t;const a=Math.min(c+r,s.length);let{embeddedResults:d,tokenizersToLoad:l,tokens:u}=await ur(t,c,a,n);for(let e=0;l.length>0&&e<Tr;e++){await fr(l);const e=await ur(t,c,a,n);({embeddedResults:d,tokenizersToLoad:l,tokens:u}=e)}const f=await Pr(t,c,0);const h=e;const{differences:g,result:m}=$r(t,u,d,c,a,f,i,o,h);return{differences:g,textInfos:m}};const Yr=(t,n,e,o)=>{const s=t/n*(e-o);if(!Number.isFinite(s)){return 0}return s};const Vr=Yr;const jr=(t,n,e)=>{if(t>=n){return 0}return Math.max(Math.round(t**2/n),e)};const qr=(t,n)=>{if(t>n){return 0}return t**2/n};const Gr=(t,n,e)=>{const o=n/2;if(e<=o){return{handleOffset:e,percent:0}}if(e<=t-o){return{handleOffset:o,percent:(e-o)/(t-n)}}return{handleOffset:n-t+e,percent:1}};const Xr={enabled:false};const Zr=t=>{Xr.enabled=t};const Qr=()=>Xr.enabled;const Kr=async(t,n)=>{h(t);g(n);const{deltaY:e,finalDeltaY:o,height:s,itemHeight:c,numberOfVisibleLines:r,scrollBarHeight:i}=t;const a=Rs(n,0,o);if(e===a){return t}const d=Math.floor(a/c);const l=d+r;const u=Vr(a,o,s,i);const f={...t,deltaY:a,maxLineY:l,minLineY:d,scrollBarY:u};const m=Qr();const{differences:w,textInfos:p}=await _r(f,m);const y={...f,differences:w,textInfos:p};return y};const Jr=async(t,n)=>{if(!n.undoStack){return ns}if(t.undoStack===n.undoStack){return ns}const e=n.undoStack.at(-1);if(e&&e.length===1){const o=e[0];if(o.origin===xs){const{rowIndex:e}=o.start;const{lines:s}=n;const c=t.lines[e];const r=s[e];const i=await $c("TokenizeIncremental.tokenizeIncremental",n.uid,n.languageId,c,r,e,n.minLineY);if(i&&i.length===1){return i}}}return ns};const ti=(t,n)=>t.matchAll(n).toArray();const ni=/(?:https?|ftps?|file):\/\/[^\s"']+|www\.[^\s"']+/g;const ei=/^(?:https?|ftp|ftps|file):\/\//;const oi=/^www\./;const si=".,;:!?";const ci={")":"(","]":"[","}":"{",">":"<"};const ri=(t,n)=>{const e=ci[n];let o=0;for(const s of t){if(s===e){o++}else if(s===n){o--}}return o<0};const ii=t=>{let n=t;while(n.length>0){const t=n.at(-1);if(!t){break}if(si.includes(t)){n=n.slice(0,-1);continue}if(t in ci&&ri(n,t)){n=n.slice(0,-1);continue}break}return n};const ai=t=>{const n=ti(t,ni);const e=[];for(const t of n){const n=ii(t[0]);if(ei.test(n)||oi.test(n)){e.push({length:n.length,start:t.index??0})}}return e};const di=t=>{const n=[];const{lines:e}=t;let o=0;for(const t of e){const e=ai(t);for(const t of e){const e=o+t.start;n.push(e,t.length,Us,0)}o+=t.length+1}return n};const li=(t,n)=>{const{decorations:e,lines:o}=t;for(let t=0;t<e.length;t+=4){const s=e[t];const c=e[t+1];const r=e[t+2];if(r===Us&&n>=s&&n<s+c){let t=0;for(const n of o){const e=n.length+1;if(t+e>s){const e=s-t;const o=n.slice(e,e+c);return o}t+=e}}}return undefined};const ui=1;const fi=Object.create(null);const hi=(t,n)=>{g(t);g(n);if(!Object.hasOwn(fi,t)){fi[t]=[]}if(!fi[t].includes(n)){fi[t].push(n)}};const gi=(t,n)=>{g(t);g(n);if(Object.hasOwn(fi,t)){const e=fi[t].indexOf(n);if(e!==-1){fi[t].splice(e,1)}}};const mi=t=>{g(t);return fi[t]||[]};const wi=async(t,n,...e)=>{g(t);w(n);const o=mi(t);const s=o.map(async t=>{try{const o=$n(t);if(o){await o.invoke(n,...e)}}catch(n){console.warn(`Failed to notify listener ${t}:`,n)}});await Promise.all(s)};const pi=(t,n,e=t.columnWidth)=>{const o=n.x??t.x;const s=n.y??t.y;const c=n.width??t.width;const r=n.height??t.height;const i=Math.floor(r/t.itemHeight);const a=t.lines.length;const d=Math.max(a-i,0);const l=d*t.itemHeight;const u=Math.min(t.deltaY,l);const f=Math.floor(u/t.itemHeight);const h=Math.min(f+i,a);const g=a*t.rowHeight;const m=jr(r,g,t.minimumSliderSize);return{...t,columnWidth:e,deltaY:u,finalDeltaY:l,finalY:d,height:r,maxLineY:h,minLineY:f,numberOfVisibleLines:i,scrollBarHeight:m,width:c,x:o,y:s}};const yi=t=>{if(!t){return[""]}return t.split("\n")};const{invoke:xi}=Ro;const Ei=async t=>{try{await xi("Main.handleModifiedStatusChange",t,true)}catch{}};const Ii=(t,n)=>{const e=t[n];const o=t[n+1];const s=t[n+2];const c=t[n+3];if(e>s||e===s&&o>=c){return[s,c,e,o,1]}return[e,o,s,c,0]};const ki=t=>{let n=0;for(const e of t){if(e===yr){n++}}return n};const Si=/^\p{ASCII}*$/u;const vi=t=>Si.test(t);const Ci=async(t,n)=>t.length*n;const bi=async(t,n,e,o,s,c,r)=>{const i=await wo("TextMeasurement.measureTextWidth",t,n,e,o,s,c,r);return i};const Mi=async(t,n,e,o,s,c,r)=>{if(c&&vi(t)){return await Ci(t,r)}return await bi(t,n,e,o,s,c,r)};const Ai=async(t,n,e,o,s,c,r,i,a,d,l,u=0)=>{if(!t){return 0}w(t);g(i);g(a);g(d);p(c);g(l);g(u);if(n===0){return 0}if(n*l>d){return d}const f=Er(t);const h=xr(t,f,i);const m=ki(t.slice(0,n));const y=h.slice(0,n+m);const x=await Mi(y,e,o,s,r,c,l);return x-a+u};const Li=(t,n,e)=>(t-n)*e;const Pi=t=>`${t}px`;const Fi=(t,n,e,o)=>new Uint32Array([t,n,e,o]);const Wi=t=>new Uint32Array(t);const Ti=t=>Wi(t.length);const Ri=(t,n)=>{const e=Ti(t);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(t,o);n(e,o,s,c,r,i)}return e};const Di=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n(o,s,c,r)}};const Oi=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const Bi=(t,n,e,o)=>t===e&&n===o;const Ni=(t,n,e,o)=>t===e;const Hi=(t,n)=>{for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(!n(o,s,c,r)){return false}}return true};const zi=t=>Hi(t,Bi);const Ui=t=>Hi(t,Ni);const $i=(t,n)=>{const e=Wi(t.length*4);let o=0;for(const s of t){const{end:t,start:c}=n(s);e[o++]=c.rowIndex;e[o++]=c.columnIndex;e[o++]=t.rowIndex;e[o++]=t.columnIndex}return e};const _i=[];const Yi=(t,n)=>{if(!n){return _i}const e=[];for(let n=0;n<t.length;n+=2){const o=t[n];const s=t[n+1];e.push(`${Pi(o)} ${Pi(s)}`)}return e};const Vi=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push(Pi(o),Pi(s),Pi(c),Pi(r))}return n};const ji=async t=>{const n=[];const e=[];const{charWidth:o,cursorWidth:s,differences:c,focused:r,fontFamily:i,fontSize:a,fontWeight:d,isMonospaceFont:l,letterSpacing:u,lines:f,maxLineY:h,minLineY:g,rowHeight:m,selections:w,tabSize:p,width:y}=t;const x=o;const E=s/2;for(let t=0;t<w.length;t+=4){const[o,s,r,I,k]=Ii(w,t);if(r<g||o>h){continue}const S=r-g;const v=c[S];const C=f[r];const b=await Ai(C,I,d,a,i,l,u,p,E,y,x,v);const M=Li(r,g,m);if(Bi(o,s,r,I)&&b>0){n.push(b,M);continue}const A=Li(o,g,m);const L=o-g;const P=c[L];if(o===r){const t=await Ai(C,s,d,a,i,l,u,p,E,y,x,P);if(k){n.push(t,M)}else if(b>=0){n.push(b,M)}const o=b-t;e.push(t,A,o,m)}else{if(o>=g){const t=f[o];const c=await Ai(t,s,d,a,i,l,u,p,E,y,x,P);const r=await Ai(t,t.length,d,a,i,l,u,p,E,y,x,P);const h=Li(o,g,m);const w=r-c;if(k){n.push(c,h)}e.push(c,h,w,m)}const t=Math.max(o+1,g);const w=Math.min(r,h);for(let n=t;n<w;n++){const t=f[n];const o=Li(n,g,m);const s=n-g;const r=c[s];const h=await Ai(t,t.length,d,a,i,l,u,p,E,y,x,r);e.push(0,o,h,m)}if(r<=h){const t=b;e.push(0,M,t,m);if(!k){n.push(t,M)}}}}return{cursorInfos:Yi(n,r),selectionInfos:Vi(e)}};const qi=t=>{const{inserted:n,start:e}=t;const o=e.rowIndex;const s=e.columnIndex;const c=n.length;if(c===1){const t={columnIndex:n.at(-1).length+s,rowIndex:o+c-1};return{end:t,start:t}}const r={columnIndex:s,rowIndex:o+c-1};return{end:r,start:r}};const Gi=(t,n)=>{h(t);return{...t,selections:n}};const Xi=(t,n)=>{h(t);m(n);const e=$i(n,qi);return e};const Zi=(t,n)=>Kr(t,n);const Qi=(t,n)=>Zi(t,t.deltaY+n);const Ki=t=>t.origin===Es;const Ji=(t,n)=>{const{autoClosingRanges:e=[]}=t;const o=[];const s=n[0];const c=s.start.rowIndex;const r=s.start.columnIndex;const i=s.end.rowIndex;const a=s.end.columnIndex;for(let t=0;t<e.length;t+=4){const n=e[t];const d=e[t+1];const l=e[t+2];const u=e[t+3];if(i===l&&a===u||c===n&&r>=d&&i===l&&a<=u){const t=s.inserted[0].length-s.deleted[0].length;o.push(n,d,l,u+t)}}if(Ki(s)){o.push(c,r+1,i,a+1)}return o};const ta=(t,n)=>Gi(t,n);const na=async(t,n,e=undefined)=>{h(t);m(n);if(n.length===0){return t}const o=br(t,n);const s={...t,lines:o};const c=e||Xi(s,n);const r=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const i=Ji(t,n);const a={...s,autoClosingRanges:i,invalidStartIndex:r,lines:o,modified:true,redoStack:[],selections:c,undoStack:[...t.undoStack,n]};const d=di(a);const l={...a,decorations:d};ts(t.uid,t,l);if(!t.modified){await Ei(t.uri)}try{await wi(ui,"handleEditorChanged",t.uid,t.uri,n)}catch(t){console.warn("Failed to notify editor change listeners:",t)}const u=await Jr(t,l);const f=await Ts(l,n);const g={...l,...f,incrementalEdits:u};if(u!==ns){return g}const w=Qr();const{differences:p,textInfos:y}=await _r(g,w);return{...g,differences:p,textInfos:y}};const ea=async(t,n)=>{h(t);m(n);if(n.length===0){return t}const e=br(t,n);const o={...t,lines:e};const s=Xi(o,n);const c=Math.min(t.invalidStartIndex,n[0].start.rowIndex);const r={...o,invalidStartIndex:c,lines:e,selections:s};const i=await Jr(t,r);const a={...r,incrementalEdits:i};if(i!==ns){return a}const d=Qr();const{differences:l,textInfos:u}=await _r(a,d);return{...a,differences:l,textInfos:u}};const oa=async(t,n)=>{const e=br(t,n);const o=n[0].start.rowIndex;const s={...t,invalidStartIndex:o,lines:e,redoStack:[],undoStack:[...t.undoStack,n]};const c=await Jr(t,s);const r={...s,incrementalEdits:c};if(c!==ns){return r}const i=Qr();const{differences:a,textInfos:d}=await _r(r,i);return{...r,differences:a,textInfos:d}};const sa=t=>t.selections&&t.selections.length>0;const ca=(t,n,e,o,s,c)=>pi(t,{height:s,width:o,x:n,y:e},c);const ra=(t,n)=>{const e=yi(n);const{itemHeight:o,minimumSliderSize:s,numberOfVisibleLines:c}=t;const r=e.length;const i=Math.min(c,r);const a=Math.max(r-c,0);const d=a*o;const l=e.length*t.rowHeight;const u=jr(t.height,l,s);return{...t,finalDeltaY:d,finalY:a,lines:e,maxLineY:i,scrollBarHeight:u}};const ia={cursorInfos:[],debugEnabled:false,decorations:[],deltaX:0,deltaY:0,diagnostics:[],differences:[],embeds:[],focused:false,hasListener:false,height:0,highlightedLine:-1,incrementalEdits:ns,isSelecting:false,languageId:"",lineCache:[],lines:[],longestLineWidth:0,maxLineY:0,minLineY:0,redoStack:[],scrollBarHeight:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,textInfos:[],tokenizerId:0,undoStack:[],uri:"",width:0,x:0,y:0};const aa="ExtensionHostHover.execute";const da="ExtensionHost.executeTabCompletionProvider";const la="ExtensionHostTextDocument.syncFull";const{invoke:ua,set:fa}=ao;const ha=t=>{w(t);return t.lastIndexOf(hr)};const ga=(t,n)=>t.lastIndexOf(hr,n);const ma=(t,n)=>{for(const e of t){if(e&&e.extensions&&Array.isArray(e.extensions)&&e.extensions.includes(n)){return e.id}}return""};const wa=(t,n)=>{for(const e of t){if(e&&e.fileNames&&Array.isArray(e.fileNames)&&e.fileNames.includes(n)){return e.id}}return""};const pa=(t,n)=>{w(t);const e=ha(t);const o=t.slice(e);const s=o.toLowerCase();const c=ma(n,s);if(c){return c}const r=t.toLowerCase();const i=ga(t,e-1);const a=t.slice(i);const d=ma(n,a);if(d){return d}const l=wa(n,r);if(l){return l}return"unknown"};const ya=async(t,n)=>{g(t);w(n);const e=await fo(t,n);return e};const xa=async(t,n,e,o)=>await Mi("a",t,n,e,o,false,0);const Ea=async t=>{const n=await Fo(t);return n};const Ia="onDiagnostic";const ka="onHover";const Sa="onTabCompletion";const va=async({args:t,assetDir:n,editor:e,event:o,method:s,noProviderFoundMessage:c,noProviderFoundResult:r=undefined,platform:i})=>{const a=`${o}:${e.languageId}`;await Ho(a,n,i);const d=await ua(s,e.uid,...t);return d};const Ca=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri});const ba=async t=>{const n=Ca(t);return lo("Extensions.executeDiagnosticProvider",n)};const Ma=async t=>{const n=await ba(t);if(n.length>0){return n}const{assetDir:e,platform:o}=t;return va({args:[],assetDir:e,editor:t,event:Ia,method:"ExtensionHost.executeDiagnosticProvider",noProviderFoundMessage:"no diagnostic provider found",platform:o})};const Aa=t=>t.type;const La=async(t,n)=>{const e=[];const{charWidth:o,fontFamily:s,fontSize:c,fontWeight:r,isMonospaceFont:i,letterSpacing:a,lines:d,minLineY:l,rowHeight:u,tabSize:f,width:h}=t;for(const t of n){const{columnIndex:n,endColumnIndex:g,rowIndex:m}=t;const w=g-n;const p=w*o;const y=0;const x=0;const E=await Ai(d[m],n,r,c,s,i,a,f,x,h,o,y);const I=Li(m,l,u)-u;e.push({height:u,type:Aa(t),width:p,x:E,y:I})}return e};const Pa=(t,n)=>{const e=di(t);const o=[...e,...n];const s=[];for(let t=0;t<o.length;t+=4){s.push({length:o[t+1],modifiers:o[t+3],offset:o[t],type:o[t+2]})}s.sort((t,n)=>t.offset-n.offset);const c=[];for(const t of s){c.push(t.offset,t.length,t.type,t.modifiers)}return c};const Fa=async t=>{try{const n=Ar(t);await ua(la,t.uri,t.id,t.languageId,n);const e=await Ma(t);const o=Ko(t.id);if(!o){return t}const s=await La(o.newState,e);const c=s.flatMap(t=>[t.offset,t.length,t.type,t.modifiers||0]);const r=Pa(o.newState,c);const i={...o.newState,decorations:r,diagnostics:e,visualDecorations:s};ts(t.id,o.oldState,i);await yo("Editor.rerender",t.id);return i}catch(n){if(n&&n.message.includes("No diagnostic provider found")){return t}console.error(`Failed to update diagnostics: ${n}`);return t}};const Wa=async({assetDir:t,columnToReveal:n,completionTriggerCharacters:e,content:o,diagnosticsEnabled:s,fontFamily:c,fontSize:r,fontWeight:i,formatOnSave:a,height:d,hoverEnabled:l,id:u,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,languageId:x,letterSpacing:E,lineNumbers:I,lineToReveal:k,links:S,platform:v,rowHeight:C,savedDeltaY:b,savedSelections:M,tabSize:A,uri:L,useFunctionalRendering:P,width:F,x:W,y:T})=>{g(u);w(o);const R=await xa(i,r,c,E);const D=await ya(v,t);const O=pa(L,D);const B={assetDir:t,charWidth:R,columnWidth:0,completionState:"",completionTriggerCharacters:e,completionUid:0,cursorInfos:[],cursorWidth:2,decorations:[],deltaX:0,deltaY:0,diagnostics:[],diagnosticsEnabled:s,differences:[],finalDeltaY:0,finalY:0,focused:false,focusKey:ss,fontFamily:c,fontSize:r,fontWeight:i,handleOffset:0,handleOffsetX:0,hasListener:false,height:d,id:u,incrementalEdits:ns,invalidStartIndex:0,isAutoClosingBracketsEnabled:f,isAutoClosingQuotesEnabled:h,isAutoClosingTagsEnabled:m,isMonospaceFont:p,isQuickSuggestionsEnabled:y,isSelecting:false,itemHeight:20,languageId:O,letterSpacing:E,lineCache:[],lineNumbers:I,lines:[],longestLineWidth:0,maxLineY:0,minimumSliderSize:20,minLineY:0,modified:false,numberOfVisiblelines:0,numberOfVisibleLines:0,platform:v,primarySelectionIndex:0,redoStack:[],rowHeight:C,savedSelections:M,scrollBarHeight:0,scrollBarWidth:0,selectionAnchorPosition:{columnIndex:0,rowIndex:0},selectionAutoMovePosition:{columnIndex:0,rowIndex:0},selectionInfos:[],selections:new Uint32Array,tabSize:A,textInfos:[],tokenizerId:0,uid:u,undoStack:[],uri:L,useFunctionalRendering:P,validLines:[],widgets:[],width:F,x:W,y:T};const N=ca(B,W,T,F,d,9);const H=ra(N,o);let z;if(k&&n){const t=k*C;z=await Kr(H,t)}else{z=await Kr(H,0)}const U=di(z);const $={...z,decorations:U};const _=Qr();const{differences:Y,textInfos:V}=await _r($,_);const j={...$,differences:Y,focus:co,focused:true,textInfos:V};ts(u,ia,j);await ua(la,L,u,x,o);if(s){await Fa(j)}const q=await Ea("editor.completionsOnType");const G=Boolean(q);ts(u,ia,{...j,completionsOnType:G})};const Ta=(t,n)=>t.rowHeight===n.rowHeight&&t.deltaY===n.deltaY&&t.finalDeltaY===n.finalDeltaY&&t.height===n.height&&t.deltaX===n.deltaX&&t.longestLineWidth===n.longestLineWidth&&t.minimumSliderSize===n.minimumSliderSize&&t.width===n.width&&t.scrollBarHeight===n.scrollBarHeight;const Ra=(t,n)=>{if(!n.focused){return true}return t.focused===n.focused&&t.focus===n.focus};const Da=(t,n)=>t.cursorInfos===n.cursorInfos&&t.diagnostics===n.diagnostics&&t.highlightedLine===n.highlightedLine&&t.lineNumbers===n.lineNumbers&&t.textInfos===n.textInfos&&t.differences===n.differences&&t.initial===n.initial&&t.selectionInfos===n.selectionInfos;const Oa=6;const Ba=7;const Na=11;const Ha=12;const za=13;const Ua=(t,n)=>t.widgets===n.widgets;const $a=[Da,Ra,Ra,Ta,Ua];const _a=[Ha,Oa,Ba,Na,za];const Ya=(t,n)=>{const e=[];for(let o=0;o<$a.length;o++){const s=$a[o];if(!s(t,n)){e.push(_a[o])}}return e};const Va=t=>{const{newState:n,oldState:e}=Ko(t);const o=Ya(e,n);return o};const ja=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];if(e===0&&o!==0){n.push(o-1,s,o-1,s)}n.push(o,s,c,r)}return new Uint32Array(n)};const qa=t=>{const{selections:n}=t;const e=ja(n);return{...t,selections:e}};const Ga=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];e.push(s,c,r,i);if(o===t.length-4&&r<n){e.push(r+1,i,r+1,i)}}return new Uint32Array(e)};const Xa=t=>{const{lines:n,selections:e}=t;const o=Ga(e,n.length);return{...t,selections:o}};const Za=(t,n)=>{const e=[];for(const o of n){const n=Wr(t,o.startOffset);const s=Wr(t,o.endOffset);const c=Lr(t,{end:s,start:n});const r={deleted:c,end:s,inserted:yi(o.inserted),origin:Is,start:n};if(r.inserted.length===0){r.inserted=[""]}e.push(r)}return e};const Qa=(...t)=>{console.warn(...t)};const Ka=(...t)=>{console.error(...t)};const Ja=(t,n)=>{if(!Array.isArray(n)){Qa("something is wrong with format on save",n);return t}if(n.length===0){return t}const e=Za(t,n);return na(t,e)};const td=async(t,n)=>{h(t);m(n);return na(t,n)};const nd=(t,n)=>{const e=[];for(const o of n){if(o.uri===t.uri){for(const n of o.edits){const o=Wr(t,n.offset);const s=Wr(t,n.offset+n.deleted);const c=Lr(t,{end:s,start:o});const r={deleted:c,end:s,inserted:[n.inserted],origin:bs,start:o};e.push(r)}}}return e};const ed=async(t,n)=>{h(t);m(n);const e=nd(t,n);if(e.length===0){return t}return na(t,e)};const od=t=>{if(!t.focused){return t}const n={...t,focused:false};return n};const sd=(t,n,e,o)=>{const s=[];const c=n.length;for(let r=0;r<c;r+=4){const[c,i,a,d]=Ii(n,r);const l={columnIndex:i,rowIndex:c};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};s.push({deleted:Lr(t,f),end:u,inserted:e,origin:o,start:l})}return s};const cd=(t,n,e)=>{const{selections:o}=t;return sd(t,o,n,e)};const rd=async(t,n,e,o,s,c,r,i,a,d)=>{for(let l=n;l<t.length;l++){const n=await Mi(t.slice(0,l),s,c,r,i,a,d);if(o-n<e/2){return l}}return t.length};const id=()=>"Segmenter"in Intl;const ad=()=>{const t=new Intl.Segmenter;return{at(n,e){const o=t.segment(n);return o.containing(e)},getSegments:n=>t.segment(n),modelIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(s>=e){return t.index}s++}return n.length},visualIndex(n,e){const o=t.segment(n);let s=0;for(const t of o){if(t.index>=e){return s}s++}return s}}};const dd=async(t,n,e,o,s,c,r,i)=>{const a=ad();const d=a.getSegments(t);const l=false;const u=0;for(const n of d){const a=await Mi(t.slice(0,n.index),s,c,r,i,l,u);if(o-a<e){return n.index}}return t.length};const ld=(t,n)=>{const e=Math.round(t/n);return e};const ud=(t,n,e)=>{let o=n;for(let s=0;s<n;s++){if(t[s]===yr){o-=e-1}}return o};const fd=async(t,n,e,o,s,c,r,i,a)=>{w(t);g(n);g(e);w(o);g(s);p(c);g(r);g(i);g(a);const d=ld(a,r);const l=Er(t);const u=ud(t,d,i);const f=t.slice(0,u);const h=xr(f,l,i);const m=await Mi(h,n,e,o,s,c,r);const y=vi(t);if(y){if(Math.abs(a-m)<r/2){return u}return await rd(t,u,r,a,n,e,o,s,c,r)}return await dd(t,u,r,a,n,e,o,s)};const hd=async(t,n,e)=>{h(t);g(n);g(e);const{charWidth:o,deltaX:s,deltaY:c,fontFamily:r,fontSize:i,fontWeight:a,isMonospaceFont:d,letterSpacing:l,lines:u,rowHeight:f,tabSize:m,x:w,y:p}=t;const y=Math.floor((e-p+c)/f);if(y<0){return{columnIndex:0,rowIndex:0}}const x=n-w+s;const E=Rs(y,0,u.length-1);const I=u[E];const k=await fd(I,a,i,r,l,d,o,m,x);return{columnIndex:k,rowIndex:E}};const gd=(t,n,e)=>{const{columnWidth:o,x:s}=t;const c=e*o+s;return c};const md=(t,n)=>{const{rowHeight:e,y:o}=t;const s=(n+1)*e+o;return s};const wd={timeout:-1};const pd=async(t,n,e,o,s)=>{h(t);g(n);g(e);w(o);const c=gd(t,n,e);const r=md(t,n);const i=o;await yo("Editor.showOverlayMessage",t,"Viewlet.send",t.uid,"showOverlayMessage",c,r,i);if(!s){const n=()=>{xd(t)};wd.timeout=setTimeout(n,3e3)}return t};const yd=async(t,n,e,o)=>pd(t,n,e,o,true);const xd=async t=>{clearTimeout(wd.timeout);wd.timeout=-1;return t};const Ed=String;const Id=t=>{switch(t){case"(":return")";case"[":return"]";case"{":return"}";default:return"???"}};const kd=async(t,n)=>{try{const e=Fr(t,t.cursor);const o=await yo("ExtensionHostBraceCompletion.executeBraceCompletionProvider",t,e,n);if(o){const e=Id(n);const o=n+e;const s=cd(t,[o],xs);return na(t,s)}const s=cd(t,[n],xs);return na(t,s)}catch(n){console.error(n);const e=Array.isArray(t.cursor)?t.cursor[0]:t.cursor;return yd(t,e,Ed(n))}};const Sd=t=>{const{selections:n}=t;if(n.length===4&&n[0]===n[2]&&n[1]===n[3]){return t}const e=Wi(4);Oi(e,0,n[0],n[1]);return ta(t,e)};const vd=(t,n)=>{for(const[e,o]of t.entries()){if(o.id===n){return e}}return-1};const Cd=(t,n)=>{const e=vd(t,n);const o=[...t.slice(0,e),...t.slice(e+1)];return o};const bd=t=>t.id===Fe;const Md=t=>{const{widgets:n}=t;const e=n.findIndex(bd);if(e===-1){return t}const o=Cd(n,Fe);return{...t,focused:true,widgets:o}};const Ad=t=>t.id===De;const Ld=t=>{const{widgets:n}=t;const e=n.findIndex(Ad);if(e===-1){return t}const o=Cd(n,De);return{...t,focused:true,widgets:o}};const Pd=async()=>{const t="Rename Worker";const n="renameWorkerMain.js";const e=await $o(t,n);await e.invoke("Rename.initialize");return e};const Fd={};const Wd=()=>{if(!Fd.workerPromise){Fd.workerPromise=Pd()}return Fd.workerPromise};const Td=async(t,...n)=>{const e=await Wd();return await e.invoke(t,...n)};const Rd=t=>t.id===Be;const Dd=async t=>{const{uid:n,widgets:e}=t;const o=e.findIndex(Rd);if(o===-1){return t}const s=e[o];await Td("Rename.close",s.newState.uid);const c=Ko(n);const{newState:r}=c;return r};const Od=t=>t.id===Ne;const Bd=t=>{const{widgets:n}=t;const e=n.findIndex(Od);if(e===-1){return t}const o=Cd(n,Ne);return{...t,widgets:o}};const Nd=(t,n)=>{for(const e of t){if(e.id===n){return true}}return false};const Hd=async(t,n,e,o,s,c)=>{const{widgets:r}=e;if(Nd(r,t)){return e}const i=o();i.newState.editorUid=e.uid;const a=await s(i.newState,e.uid);a.editorUid=e.uid;const d={...i,newState:a};const l=[...r,d];const u=!c;const f={...e,additionalFocus:c?0:n,focus:c?n:co,focused:u,widgets:l};return f};const zd=()=>Math.random();const Ud=()=>{const t=zd();const n={id:We,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const $d=(t,n)=>qo(t,n);const _d=async t=>Hd(We,es,t,Ud,$d);const Yd={compositionText:"",isComposing:false};const Vd=(t,n)=>{Yd.isComposing=true;return t};const jd=(t,n)=>{const e=[];for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];const r=t[o+2];const i=t[o+3];const a=c-Yd.compositionText.length;e.push({deleted:[Yd.compositionText],end:{columnIndex:i,rowIndex:r},inserted:[n],origin:us,start:{columnIndex:a,rowIndex:s}})}return e};const qd=(t,n)=>{const{selections:e}=t;const o=jd(e,n);Yd.compositionText=n;return na(t,o)};const Gd=(t,n)=>{const{selections:e}=t;const o=jd(e,n);Yd.isComposing=false;Yd.compositionText="";return na(t,o)};const Xd=async t=>{try{w(t);await bo(t)}catch(t){throw new S(t,"Failed to write text to clipboard")}};const Zd=(t,n,e,o,s,c)=>{if(n){const n=t[s].length;return{end:{columnIndex:n,rowIndex:e},start:{columnIndex:0,rowIndex:e}}}return{end:{columnIndex:c,rowIndex:s},start:{columnIndex:o,rowIndex:e}}};const Qd=(t,n,e,o)=>t===e&&n===o;const Kd=async t=>{if(!sa(t)){return t}const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=e[2];const r=e[3];const i=Qd(o,s,c,r);const a=Zd(n,i,o,s,c,r);const d=Lr(t,a);const l=Sr(d);const u=i?"\n"+l:l;await Xd(u);return t};const Jd=t=>{const{selections:n}=t;const e=[];for(let t=0;t<n.length;t+=4){const o=n[t];g(o);e.push(o)}const o=[...new Set(e)].toSorted((t,n)=>t-n);const s=o.map(n=>{const e={columnIndex:0,rowIndex:n};return{deleted:[""],end:e,inserted:[Mr(t,n),""],start:e}});const c=new Uint32Array(o.length*4);for(let t=0;t<o.length;t++){const n=o[t]+t+1;c[t*4]=n;c[t*4+1]=0;c[t*4+2]=n;c[t*4+3]=0}return na(t,s,c)};const tl=t=>{const{selections:n}=t;const e=n[0];const o={columnIndex:0,rowIndex:e};const s=[{deleted:[""],end:o,inserted:[Mr(t,e),""],start:o}];return na(t,s)};const nl=(t,n,e,o)=>{if(n===0){if(t===0){return{columnIndex:0,rowIndex:0}}return{columnIndex:e[t-1].length,rowIndex:t-1}}const s=o(e[t],n);return{columnIndex:n-s,rowIndex:t}};const el=(t,n,e,o)=>{t[n]=e;t[n+1]=o};const ol=(t,n,e,o)=>{t[n]=t[n+2]=e;t[n+1]=t[n+3]=o};const sl=(t,n,e,o,s,c)=>{if(o===0){if(e===0){t[n]=0;t[n+1]=0}else{t[n]=e-1;t[n+1]=s[e-1].length}}else{const r=c(s[e],o);t[n]=e;t[n+1]=o-r}};const cl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);if(c===i&&r===a){if(c===0&&r===0){o[s]=0;o[s+1]=0;o[s+2]=0;o[s+3]=0}else{sl(o,s,c,r,n,e);sl(o,s+2,c,r,n,e)}}else{ol(o,s,t[s],t[s+1])}}return o};const rl=(t,n)=>{const{lines:e,selections:o}=t;const s=cl(o,e,n);return ta(t,s)};const il=(t,n)=>{if(!id()){return 1}if(n>t.length){return 1}const e=ad();const o=e.at(t,n-1);if(!o){return 1}return n-o.index};const al=()=>2;const dl=(t,n)=>{if(!id()){return 1}const e=ad();const o=e.at(t,n);return o.segment.length};const ll=t=>t===pr||t===yr;const ul=(t,n)=>{if(t.length===0){return 0}for(let e=0;e<n;e++){if(!ll(t[e])){return n-e}}return n};const fl=(t,n)=>t.length-n;const hl=(t,n)=>{for(const e of n){const n=t.match(e);if(n){return n[0].length}}return 1};const gl=/(?<![A-Z])[A-Z]+\s*$/;const ml=/[\u{C0}-\u{17F}\w\-]+>?\s*$/u;const wl=/[a-zA-Z]+[^a-zA-Z\d]+\s*$/;const pl=/\s+$/;const yl=/[^a-zA-Z\d]+\s*$/;const xl=[gl,ml,wl,pl,yl];const El=(t,n)=>{const e=t.slice(0,n);return hl(e,xl)};const Il=/^\s*[\u{C0}-\u{17F}\w]+/iu;const kl=/^[^a-zA-Z\d]+\w*/;const Sl=[Il,kl];const vl=(t,n)=>{const e=t.slice(n);return hl(e,Sl)};const Cl=/(?<![A-Z])[A-Z]{2}[a-z]+$/;const bl=/(?=[A-Z]+)[A-Z][a-z]+$/;const Ml=/[A-Z]+[a-z]+\d?\s*$/;const Al=/[A-Z]+\d*\s*$/;const Ll=/[a-z]+\d*\s*$/;const Pl=/[A-Z]*[a-z]+_+\s*$/;const Fl=/(?<![A-Z])[A-Z]_+\s*$/;const Wl=/[a-z]+\s*$/;const Tl=/[^a-zA-Z\d\s]+\s*$/;const Rl=[Cl,bl,Ml,Al,Ll,Pl,Fl,Wl,Tl];const Dl=(t,n)=>{const e=t.slice(0,n);return hl(e,Rl)};const Ol=/^\s*[a-z]+\d?/;const Bl=/^\s*[A-Z]{2}[a-z\d]+/;const Nl=/^\s*[A-Z]+(?=[A-Z][a-z]+)/;const Hl=/^\s*[A-Z]+[a-z]*\d*/;const zl=/^\s*_+[a-z]*\d?/;const Ul=/^\s*[^\da-zA-Z\s]+/;const $l=[Ol,Nl,Hl,zl,Ul];const _l=[Ol,Bl,Nl,Hl,zl,Ul];const Yl=/[A-Z]/;const Vl=(t,n)=>{const e=t.slice(n);if(Yl.test(t[n-1])){return hl(e,$l)}return hl(e,_l)};const jl=t=>rl(t,il);const ql=(t,n,e)=>{const{rowIndex:o}=t;const{columnIndex:s}=t;if(s>=n[o].length){if(o>=n.length){return t}return{columnIndex:0,rowIndex:o+1}}const c=e(n[o],s);return{columnIndex:s+c,rowIndex:o}};const Gl=(t,n,e,o,s,c)=>{if(e>=s.length){return}const r=s[e];if(o>=r.length){t[n]=t[n+2]=e+1;t[n+1]=t[n+3]=0}else{const s=c(r,o);t[n]=t[n+2]=e;t[n+1]=t[n+3]=o+s}};const Xl=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);if(c===i&&r===a){Gl(o,s,c,r,n,e)}else{o[s]=o[s+2]=i;o[s+1]=o[s+3]=a}}return o};const Zl=(t,n)=>{const{lines:e,selections:o}=t;const s=Xl(o,e,n);return ta(t,s)};const Ql=t=>Zl(t,dl);const Kl=(t,n,e,o,s,c)=>{Oi(t,n,s+1,c)};const Jl=t=>Ri(t,Kl);const tu=t=>{const{selections:n}=t;const e=Jl(n);return ta(t,e)};const nu=t=>Zl(t,fl);const eu=t=>rl(t,ul);const ou=(t,n,e)=>{h(t);g(n);g(e);const o=Fi(n,e,n,e);return ta(t,o)};const su=(t,n,e,o,s,c)=>{if(e===0){Oi(t,n,0,0)}else{Oi(t,n,e-1,o)}};const cu=t=>Ri(t,su);const ru=(t,n,e,o)=>{const{selections:s}=t;const c=cu(s);return ta(t,c)};const iu=t=>ru(t);const au=t=>rl(t,El);const du=t=>rl(t,Dl);const lu=t=>Zl(t,Vl);const uu=t=>Zl(t,vl);const fu=async t=>{const{lines:n,selections:e}=t;const o=new Set;const s=[];for(let t=0;t<e.length;t+=4){const[n]=Ii(e,t);if(!o.has(n)){o.add(n);s.push(n)}}const c=new Uint32Array(s.length*4);const r=new Uint32Array(s.length*4);const i=[];for(let t=0;t<s.length;t++){const e=s[t];const o=n[e];const a=t*4;c[a]=e;c[a+1]=0;c[a+2]=e;c[a+3]=o.length;r[a]=e;r[a+1]=0;r[a+2]=e;r[a+3]=0;i.push(o)}const a=sd(t,c,[""],ws);await Xd(Sr(i));return na(t,a,r)};const hu=async t=>{const n=cd(t,[""],ws);const e=n.map(t=>Sr(t.deleted)).filter(t=>t.length>0);const o=Sr(e);await Xd(o);return na(t,n)};const gu=async t=>{const{selections:n}=t;if(zi(n)){return fu(t)}return hu(t)};const mu=t=>{const{lines:n}=t;const e=n.length-1;const o=n.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Lr(t,{end:c,start:s}),end:c,inserted:[""],origin:hs,start:s}];return na(t,r)};const wu=(t,n,e)=>{const o=[];const s=(n,s,c,r)=>{const i=nl(n,s,t,e);const a={columnIndex:r,rowIndex:c};o.push({deleted:Lr({lines:t},{end:a,start:i}),end:a,inserted:[""],origin:ms,start:i})};Di(n,s);return o};const pu=(t,n,e,o,s)=>{if(!Bi(n,e,o,s)){return false}if(e<1){return false}for(let o=0;o<t.length;o+=4){const s=t[o];const c=t[o+1];if(n===s&&e===c){return true}}return false};const yu=(t,n)=>{for(let e=0;e<n.length;e+=4){const[o,s,c,r]=Ii(n,e);if(!pu(t,o,s,c,r)){return false}}return true};const xu=t=>{const{lines:n,selections:e}=t;for(let t=0;t<e.length;t+=4){e[t+1]++;e[t+3]++}const o=wu(n,e,al);return na(t,o)};const Eu=(t,n)=>{const{autoClosingRanges:e=[],lines:o,selections:s}=t;if(yu(e,s)){return xu(t)}if(zi(s)){const e=wu(o,s,n);return na(t,e)}const c=cd(t,[""],ms);return na(t,c)};const Iu=t=>Eu(t,ul);const ku=(t,n)=>{const{selections:e}=t;if(zi(e)){const o=[];const{lines:s}=t;for(let c=0;c<e.length;c+=4){const[r,i]=Ii(e,c);const a={columnIndex:i,rowIndex:r};const d=ql(a,s,n);o.push({deleted:Lr(t,{end:d,start:a}),end:d,inserted:[""],origin:gs,start:a})}return o}const o=cd(t,[""],gs);return o};const Su=(t,n)=>{const e=ku(t,n);return na(t,e)};const vu=t=>Su(t,fl);const Cu=t=>{const n=Eu(t,il);return n};const bu=t=>Su(t,dl);const Mu=t=>{const n=Eu(t,El);return n};const Au=t=>{const n=Eu(t,Dl);return n};const Lu=t=>Su(t,Vl);const Pu=t=>Su(t,vl);const Fu=async t=>{await yo("SideBar.show","References",true);return t};const Wu=async t=>{const n={documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri};return lo("Extensions.executeFormattingProvider",n)};const Tu="Failed to execute formatting provider: FormattingError:";const Ru=t=>t&&t instanceof Error&&t.message.startsWith(Tu);const Du="Failed to execute formatting provider: FormattingError:";const Ou=async t=>{try{const n=await Wu(t);return Ja(t,n)}catch(n){if(Ru(n)){console.error("Formatting Error:",n.message.slice(Du.length));return t}console.error(n);const e=String(n);await pd(t,0,0,e,true);return t}};const Bu=/^[\w\-]+/;const Nu=/[\w\-]+$/;const Hu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Nu);const s=t.slice(n);const c=s.match(Bu);let r=mr;if(o){r+=o[0]}if(c){r+=c[0]}return{word:r}};const zu=(t,n)=>{const e=t.slice(0,n);const o=e.match(Nu);if(o){return o[0]}return mr};const Uu=(t,n,e)=>{const{lines:o}=t;const s=o[n];return Hu(s,e)};const $u=(t,n,e)=>{const{lines:o}=t;const s=o[n];return zu(s,e)};const _u=async(t,n)=>{const e=await yo("ExtensionHostDefinition.executeDefinitionProvider",t,n);return e};const Yu={};const Vu=/\{(PH\d+)\}/g;const ju=(t,n=Yu)=>{if(n===Yu){return t}const e=(t,e)=>n[e];return t.replaceAll(Vu,e)};const qu="Copy";const Gu="Cut";const Xu="Editor: Close Color Picker";const Zu="Editor: Copy Line Down";const Qu="Editor: Copy Line Up";const Ku="Editor: Format Document (forced)";const Ju="Editor: Go To Definition";const tf="Editor: Go To Type Definition";const nf="Editor: Indent";const ef="Editor: Open Color Picker";const of="Editor: Select All Occurrences";const sf="Editor: Select Down";const cf="Editor: Select Inside String";const rf="Editor: Select Next Occurrence";const af="Editor: Select Up";const df="Show Hover";const lf="Editor: Sort Lines Ascending";const uf="Editor: Toggle Comment";const ff="Editor: Unindent";const hf="Enter Code";const gf="Escape to close";const mf="Find All Implementations";const wf="Find All References";const pf="Format Document";const yf="Go to Definition";const xf="Go to Type Definition";const Ef="Move Line Down";const If="Move Line Up";const kf="No definition found";const Sf="No definition found for '{PH1}'";const vf="No type definition found";const Cf="No type definition found for '{PH1}'";const bf="Paste";const Mf="Source Action";const Af="Toggle Block Comment";const Lf=()=>ju(yf);const Pf=()=>ju(kf);const Ff=t=>ju(Sf,{PH1:t});const Wf=t=>ju(Cf,{PH1:t});const Tf=()=>ju(vf);const Rf=()=>ju(Mf);const Df=()=>ju(gf);const Of=()=>ju(hf);const Bf=()=>ju(xf);const Nf=()=>ju(wf);const Hf=()=>ju(mf);const zf=()=>ju(Gu);const Uf=()=>ju(qu);const $f=()=>ju(bf);const _f=()=>ju(Af);const Yf=()=>ju(If);const Vf=()=>ju(Ef);const jf=()=>ju(pf);const qf=()=>ju(df);const Gf=()=>ju(Ku);const Xf=()=>ju(rf);const Zf=()=>ju(of);const Qf=()=>ju(Ju);const Kf=()=>ju(tf);const Jf=()=>ju(cf);const th=()=>ju(nf);const nh=()=>ju(ff);const eh=()=>ju(lf);const oh=()=>ju(uf);const sh=()=>ju(af);const ch=()=>ju(sf);const rh=()=>ju(ef);const ih=()=>ju(Xu);const ah=()=>ju(Zu);const dh=()=>ju(Qu);const lh=async({editor:t,getErrorMessage:n,getLocation:e,getNoLocationFoundMessage:o,isNoProviderFoundError:s})=>{const{selections:c}=t;const r=c[0];const i=c[1];try{const n=await e(t,r,i);if(!n){const n=Uu(t,r,i);const e=o(n);return pd(t,r,i,e,false)}if(typeof n.uri!=="string"||typeof n.startOffset!=="number"||typeof n.endOffset!=="number"){return t}const{uri:s}=n;if(s===t.uri){const e=Wr(t,n.startOffset);const o=new Uint32Array([e.rowIndex,e.columnIndex,e.rowIndex,e.columnIndex]);return ta(t,o)}const c={endColumnIndex:n.endColumnIndex,endRowIndex:n.endRowIndex,startColumnIndex:n.startColumnIndex,startRowIndex:n.startRowIndex};await Wo(s,true,c);return t}catch(e){if(s(e)){const o=n(e);await pd(t,r,i,o,false);return t}const o=n(e);await pd(t,r,i,o,true);return t}};const uh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await _u(t,o);return s};const fh=t=>{if(t.word){return Ff(t.word)}return Pf()};const hh=String;const gh=t=>t?.message?.startsWith("Failed to execute definition provider: No definition provider found");const mh=async t=>lh({editor:t,getErrorMessage:hh,getLocation:uh,getNoLocationFoundMessage:fh,isNoProviderFoundError:gh});const wh=t=>{if(t.word){return Wf(t.word)}return Tf()};const ph=async(t,n)=>{const e=await yo("ExtensionHostTypeDefinition.executeTypeDefinitionProvider",t,n);return e};const yh=async(t,n,e)=>{const o=Fr(t,n,e);const s=await ph(t,o);return s};const xh=String;const Eh=t=>t?.message?.startsWith("Failed to execute type definition provider: No type definition provider found");const Ih=async(t,n=true)=>lh({editor:t,getErrorMessage:xh,getLocation:yh,getNoLocationFoundMessage:wh,isNoProviderFoundError:Eh});const kh=t=>{switch(t){case De:return true;default:return false}};const Sh=t=>{if(t.length===0){return t}return t.filter(kh)};const vh=async(t,n)=>{await mo(t,n)};const Ch=async(t,n)=>{const{platform:e}=t;const{columnIndex:o,rowIndex:s}=n;const c=Fr(t,s,o);const r=li(t,c);if(r){await vh(r,e);return t}const i={...t,selections:new Uint32Array([s,o,s,o])};const a=await mh(i);return a};const bh=async(t,n)=>{const{selections:e}=t;for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(e,o);if(s===n.rowIndex&&c===n.columnIndex&&r===n.rowIndex&&i===n.columnIndex){const n=new Uint32Array(e.length-4);n.set(e.subarray(0,o),0);n.set(e.subarray(o+4),o);return ta(t,n)}}const o=new Uint32Array(e.length+4);o.set(e,0);const s=e.length;o[s]=n.rowIndex;o[s+1]=n.columnIndex;o[s+2]=n.rowIndex;o[s+3]=n.columnIndex;return ta(t,o)};const Mh=1;const Ah=2;const Lh=(t,n)=>{const e=Sh(t.widgets);return{...t,focused:true,selectionAnchorPosition:n,selections:new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]),widgets:e}};const Ph=t=>{switch(t){case Ah:return Ch;case Mh:return bh;default:return Lh}};const Fh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=Ph(n);const c=await s(t,{columnIndex:o,rowIndex:e});return c};const Wh=3;const Th=async(t,n,e,o)=>{const{uid:s}=t;await Io(s,Wh,e,o,{menuId:Wh});return t};const Rh=/^[a-zA-Z\u{C0}-\u{17F}\d]+/u;const Dh=/[a-zA-Z\u{C0}-\u{17F}\d]+$/u;const Oh=(t,n,e)=>{const o=t.slice(0,e);const s=t.slice(e);const c=o.match(Dh);const r=s.match(Rh);const i=e-(c?c[0].length:0);const a=e+(r?r[0].length:0);const d=new Uint32Array([n,i,n,a]);return d};const Bh=(t,n,e)=>{const o=Mr(t,n);const s=Oh(o,n,e);return ta(t,s)};const Nh=async(t,n,e,o)=>{const s=await hd(t,e,o);return Bh(t,s.rowIndex,s.columnIndex)};const Hh=t=>{if(t.focused&&t.focus===co){return t}return{...t,additionalFocus:0,focus:co,focused:true}};const zh=1;const Uh=2;const $h=3;const _h=(t,n)=>{if(t){return Ah}if(n){return Mh}return 0};const Yh=async(t,n,e,o)=>{h(t);g(n);g(e);g(o);const s=await hd(t,e,o);return Fh(t,n,s.rowIndex,s.columnIndex)};const Vh=(t,n)=>new Uint32Array([n,0,n,t.length]);const jh=t=>{const{selections:n}=t;const e=n[t.primarySelectionIndex];const o=Mr(t,e);const s=Vh(o,e);return ta(t,s)};const qh=(t,n,e,o)=>{h(t);g(e);g(o);return jh(t)};const Gh=0;const Xh=async(t,n,e,o,s,c,r)=>{if(n!==Gh){return t}const i=_h(e,o);let a;switch(r){case Uh:a=await Nh(t,i,s,c);break;case zh:a=await Yh(t,i,s,c);break;case $h:a=qh(t,i,s,c);break;default:return t}return{...a,isSelecting:true}};const Zh={editor:undefined,timeout:-1,x:0,y:0};const Qh=()=>Zh;const Kh=(t,n,e,o)=>{Zh.editor=t;Zh.timeout=n;Zh.x=e;Zh.y=o};const Jh=async(t,n)=>{};const tg=async()=>{const{editor:t,x:n,y:e}=Qh();await hd(t,n,e);await Jh()};const ng=300;const eg=(t,n,e)=>{if(!t.hoverEnabled){return t}const o=Qh();if(o.timeout!==-1){clearTimeout(o.timeout)}const s=setTimeout(tg,ng);Kh(t,s,n,e);return t};const og=(t,n)=>{let e=0;for(let o=0;o<t.length;o++){const s=t[o];e+=s.length;if(e>=n){return o}}return-1};const sg=async(t,n,e)=>{h(t);g(n);g(e);const o=await hd(t,n,e);const s=Fr(t,o.rowIndex,o.columnIndex);try{const n=await _u(t,s);if(!n){return t}const e=Wr(t,n.startOffset);Wr(t,n.endOffset);const o=t.lineCache[e.rowIndex+1];if(!o){return t}const c=og(o.tokens,e.columnIndex);if(c===-1){return t}return t}catch(n){if(n&&n.message.startsWith("Failed to execute definition provider: No definition provider found")){return t}throw n}};const cg=(t,n)=>new Uint32Array([n.startRowIndex,n.startColumnIndex,n.endRowIndex,n.endColumnIndex]);const rg=(t,n,e)=>{const o=cg(t,e);const s={end:{columnIndex:o[3],rowIndex:o[2]},start:{columnIndex:o[1],rowIndex:o[0]}};const c=[{deleted:Lr(t,s),end:s.end,inserted:[n],origin:fs,start:s.start}];return c};const ig=(t,n,e)=>{const o=rg(t,n,e);return na(t,o)};const ag=(t,n)=>{const e=cg(t,n);return ta(t,e)};const dg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const lg=async(t,n,e,o,s,c,r)=>t;const ug=(t,n)=>t;const fg=async(t,n,e)=>{await hd(t,n,e)};const hg=t=>{globalThis.requestAnimationFrame(t)};const gg=(t,n)=>t.selections!==n.selections||t.focused!==n.focused||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.differences!==n.differences||t.charWidth!==n.charWidth||t.cursorWidth!==n.cursorWidth||t.fontFamily!==n.fontFamily||t.fontSize!==n.fontSize||t.fontWeight!==n.fontWeight||t.isMonospaceFont!==n.isMonospaceFont||t.letterSpacing!==n.letterSpacing||t.lines!==n.lines||t.rowHeight!==n.rowHeight||t.tabSize!==n.tabSize||t.width!==n.width;const mg=(t,n)=>{if(t.textInfos!==n.textInfos||t.differences!==n.differences){return false}return t.lines!==n.lines||t.tokenizerId!==n.tokenizerId||t.minLineY!==n.minLineY||t.maxLineY!==n.maxLineY||t.decorations!==n.decorations||t.embeds!==n.embeds||t.deltaX!==n.deltaX||t.width!==n.width||t.highlightedLine!==n.highlightedLine||t.debugEnabled!==n.debugEnabled};const wg=async(t,n)=>{let e=n;if(mg(t,n)){const t=Qr();const{differences:o,textInfos:s}=await _r(n,t);e={...n,differences:o,textInfos:s}}if(!gg(t,n)){return e}const{cursorInfos:o,selectionInfos:s}=await ji(e);return{...e,cursorInfos:o,selectionInfos:s}};const pg=-1;const yg=0;const xg=1;const Eg=(t,n)=>{if(t.rowIndex>n.rowIndex){return xg}if(t.rowIndex===n.rowIndex){if(t.columnIndex>n.columnIndex){return xg}if(t.columnIndex<n.columnIndex){return pg}return yg}return pg};const Ig=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const kg=(t,n)=>new Uint32Array([n.rowIndex,n.columnIndex,n.rowIndex,n.columnIndex]);const Sg=(t,n)=>new Uint32Array([t.rowIndex,t.columnIndex,n.rowIndex,n.columnIndex]);const vg=(t,n)=>{switch(Eg(n,t)){case yg:return kg(t,n);case xg:return Sg(t,n);case pg:return Ig(t,n);default:throw new Error("unexpected comparison result")}};const Cg=(t,n)=>{const e=t.selectionAnchorPosition;const o=vg(e,n);return ta(t,o)};const bg=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=e-o;if(n.rowIndex<o){const e=n.rowIndex;const o=n.rowIndex+c;const r=n.rowIndex*s;const i=t.selectionAnchorPosition;const a=new Uint32Array([n.rowIndex-1,n.columnIndex,i.rowIndex,i.columnIndex]);return{...t,deltaY:r,maxLineY:o,minLineY:e,selections:a}}if(n.rowIndex>e){const c=e-o;const r=n.rowIndex-c;const i=n.rowIndex;const a=r*s;const d=t.selectionAnchorPosition;const l=new Uint32Array([d.rowIndex,d.columnIndex,n.rowIndex+1,n.columnIndex]);return{...t,deltaY:a,maxLineY:i,minLineY:r,selections:l}}return t};const Mg=async t=>{const n=Ko(t);const e=n?.newState;if(!e||!e.hasListener||!e.isSelecting){return}const o=e.selectionAutoMovePosition;if(o.rowIndex===0){return}const s=bg(e,o);if(e===s){return}const c=o.rowIndex<e.minLineY?-1:1;const r={...s,selectionAutoMovePosition:{columnIndex:o.columnIndex,rowIndex:o.rowIndex+c}};const i=await wg(e,r);ts(e.uid,e,i);hg(()=>Mg(t))};const Ag=async(t,n,e)=>{h(t);g(n);g(e);const o=await hd(t,n,e);const s=Cg(t,o);if(!t.hasListener&&(o.rowIndex<t.minLineY||o.rowIndex>t.maxLineY)){hg(()=>Mg(t.uid));return{...s,hasListener:true,selectionAutoMovePosition:o}}return s};const Lg=async(t,n,e,o)=>{if(!t.isSelecting){return t}if(o){return fg(t,n,e)}return Ag(t,n,e)};const Pg=t=>({...t,hasListener:false,isSelecting:false,selectionAutoMovePosition:{columnIndex:0,rowIndex:0}});const Fg=(t,n,e)=>{if(e<=0){return 0}if(e<=t-n/2){return e/(t-n)}return 1};const Wg=(t,n)=>{const{handleOffsetX:e,longestLineWidth:o,width:s,x:c}=t;if(s>o){return{...t,deltaX:0,scrollBarWidth:0}}const r=20;const i=Rs(n,c,c+s);const a=i-c-e;const d=qr(s,o);const l=o-s+r;const u=Fg(s,d,a);const f=Rs(u,0,1);const h=f*l;return{...t,deltaX:h}};const Tg=(t,n)=>{const{deltaX:e,longestLineWidth:o,width:s,x:c}=t;const r=n-c;const i=qr(s,o);const a=s-i;const d=Yr(e,a,s,i);const l=r-d;if(l>=0&&l<i){return{...t,handleOffsetX:l}}const{handleOffset:u,percent:f}=Gr(s,i,r);const h=f*a;return{...t,deltaX:h,handleOffsetX:u}};const Rg=(t,n)=>{const{height:e,scrollBarHeight:o}=t;if(n<=e-o/2){return n/(e-o)}return 1};const Dg=async(t,n)=>{const{finalDeltaY:e,handleOffset:o=0,y:s}=t;const c=n-s-o;const r=Rg(t,c);const i=r*e;const a=await Zi(t,i);return a};const Og=Dg;const Bg=async(t,n)=>{const{deltaY:e,finalDeltaY:o,height:s,scrollBarHeight:c,y:r}=t;const i=n-r;const a=Vr(e,o,s,c);const d=i-a;if(d>=0&&d<c){return{...t,handleOffset:d}}const{handleOffset:l,percent:u}=Gr(s,c,i);const f=u*o;const h=await Zi(t,f);return{...h,handleOffset:l}};const Ng=(t,n)=>{};const Hg={deltaY:0,touchOffsetY:0};const zg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];Hg.touchOffsetY=e.y;Hg.deltaY=t.deltaY};const Ug=(t,n)=>Qi(t,n);const $g=(t,n)=>Zi(t,n);const _g=(t,n,e,o)=>{g(n);g(e);g(o);const{deltaX:s}=t;if(e===0){return Ug(t,o)}const c=Rs(s+e,0,Infinity);return{...Ug(t,o),deltaX:c}};const Yg=(t,n)=>{if(n.touches.length===0){return}const e=n.touches[0];const o=Hg.deltaY+(Hg.touchOffsetY-e.y);$g(t,o)};const Vg=(t,n,e,o)=>_g(t,n,e,o);const jg=t=>{const n=[];const e=[];for(let n=0;n<t.length;n+=4){const o=t[n];const s=t[n+2];for(let t=o;t<=s;t++){e.push(t)}}for(const t of e){n.push({deleted:[" "],end:{columnIndex:2,rowIndex:t},inserted:[""],origin:ks,start:{columnIndex:0,rowIndex:t}})}return n};const qg=t=>{const{selections:n}=t;const e=jg(n);return na(t,e)};const Gg=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+2];for(let t=o;t<=s;t++){n.push(t)}}const e=Array.from(n,t=>({deleted:[""],end:{columnIndex:0,rowIndex:t},inserted:[" "],origin:Ss,start:{columnIndex:0,rowIndex:t}}));return e};const Xg=t=>{const{selections:n}=t;const e=Gg(n);return na(t,e)};const Zg=async t=>yo("Languages.getLanguageConfiguration",{languageId:t.languageId,uri:t.uri});const Qg=t=>{if(t?.indentationRules?.increaseIndentPattern&&typeof t.indentationRules.increaseIndentPattern==="string"){const n=new RegExp(t.indentationRules.increaseIndentPattern);return n}return undefined};const Kg=(t,n)=>{if(!n){return false}return n.test(t)};const Jg=(t,n,e)=>{const o=[];const s=[];const c=Qg(e);for(let e=0;e<n.length;e+=4){const[r,i,a,d]=Ii(n,e);const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};if(Bi(r,i,a,d)){const n=t[r];const e=n.slice(0,i);const a=Cr(e);if(Kg(e,c)){o.push({deleted:Lr({lines:t},f),end:u,inserted:["",a+" ",a],origin:vs,start:l});s.push(r+1,a.length+2,r+1,a.length+2)}else{o.push({deleted:Lr({lines:t},f),end:u,inserted:["",a],origin:vs,start:l});s.push(r+1,a.length,r+1,a.length)}}else{o.push({deleted:Lr({lines:t},f),end:u,inserted:["",""],origin:vs,start:l});s.push(r+1,0,r+1,0)}}return{changes:o,selectionChanges:new Uint32Array(s)}};const tm=async t=>{const{lines:n,selections:e}=t;const o=await Zg(t);const{changes:s,selectionChanges:c}=Jg(n,e,o);return na(t,s,c)};const nm=2;const em=0;const om=()=>{const t=zd();const n={id:Fe,newState:{focused:true,focusSource:nm,height:0,questions:[],uid:t,width:0,x:0,y:0},oldState:{focused:false,focusSource:em,height:0,questions:[],uid:t,width:0,x:0,y:0}};return n};const sm=async t=>{const n={...t,height:45,width:150,x:100,y:100};return n};const cm=async t=>{const n=true;return Hd(Fe,ds,t,om,sm,n)};const rm=()=>{const t=zd();const n={id:Te,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const{invoke:im,setFactory:am}=No(je);const dm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await im("Completions.create",o,c,r,s,e,n,a);await im("Completions.loadContent",o);const d=await im("Completions.diff2",o);const l=await im("Completions.render2",o,d);return{...t,commands:l}};const lm=async t=>{const n=false;return Hd(Te,os,t,rm,dm,n)};const um=()=>{const t=zd();const n={id:De,newState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],editorUid:0,height:0,uid:t,width:0,x:0,y:0}};return n};const fm=async()=>{const t="Find Widget Worker";const n="findWidgetWorkerMain.js";return $o(t,n)};const hm=9002;const gm=async()=>{if($n(hm)){return}const t=await fm();Un(hm,t)};const mm=async(t,...n)=>{const e=$n(hm);return await e.invoke(t,...n)};const wm=async()=>{const t=$n(hm);_n(hm);if(t){await t.dispose()}};const pm=t=>{const n=Ko(t);if(!n){throw new Error(`editor ${t} not found`)}const{newState:e}=n;return e};const ym=async(t,n)=>{const{uid:e}=t;const o=pm(n);const{height:s,width:c,x:r,y:i}=o;await gm();await mm("FindWidget.create",e,r,i,c,s,n);await mm("FindWidget.loadContent",e);const a=await mm("FindWidget.diff2",e);const d=await mm("FindWidget.render2",e,a);return{...t,commands:d}};const xm=(t,n)=>ym(t,n);const Em=async t=>{const n=true;return Hd(De,cs,t,um,xm,n)};const Im=async t=>Em(t);const km=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=gd(t,e,o);const c=md(t,e);return{columnIndex:o,rowIndex:e,x:s,y:c}};const Sm=()=>{const t=zd();const n={id:Be,newState:{commands:[],height:0,uid:t,width:0,x:0,y:0},oldState:{commands:[],height:0,uid:t,width:0,x:0,y:0}};return n};const vm=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Td("Rename.create",o,c,r,s,e,n,a);await Td("Rename.loadContent",o);const d=await Td("Rename.diff2",o);const l=await Td("Rename.render2",o,d);return{...t,commands:l}};const Cm=async t=>{const{columnIndex:n,rowIndex:e}=km(t);const{word:o}=Uu(t,e,n);if(!o){return t}const s=true;return Hd(Be,is,t,Sm,vm,s)};const bm=async t=>{const n=await va({args:[],editor:t,event:"onLanguage",method:"ExtensionHostOrganizeImports.execute"});return n};const Mm=async t=>{const n=await bm(t);return Ja(t,n)};const Am=(t,n)=>{const e=yi(n);const o=cd(t,e,ps);return na(t,o)};const Lm=async t=>{const n=await Mo();w(n);return Am(t,n)};const Pm=t=>{const{redoStack:n=[]}=t;if(n.length===0){return t}const e=n.at(-1);const o={...t,redoStack:n.slice(0,-1),undoStack:[...t.undoStack,e]};return ea(o,e)};const Fm=t=>{if(!t){return`Error: ${t}`}let{message:n}=t;while(t.cause){t=t.cause;n+=`: ${t}`}return n};const Wm=t=>{if(!t){return{codeFrame:undefined,message:t,stack:undefined,type:"Error"}}const n=Fm(t);if(t.codeFrame){return{codeFrame:t.codeFrame,message:n,stack:t.stack,type:t.constructor.name}}return{category:t.category,codeFrame:t.originalCodeFrame,message:n,stack:t.originalStack,stderr:t.stderr}};const Tm=/\((.*):(\d+):(\d+)\)$/;const Rm=/at (.*):(\d+):(\d+)$/;const Dm=t=>{for(const n of t){if(Tm.test(n)||Rm.test(n)){return n}}return""};const Om=async t=>{try{const n=yi(t.stack);const e=Dm(n);let o=e.match(Tm);if(!o){o=e.match(Rm)}if(!o){return t}const s=Sr(n.slice(1));const c=Fm(t);return{message:c,stack:s,type:t.constructor.name}}catch(n){console.warn("ErrorHandling Error");console.warn(n);return t}};const Bm=async t=>{if(t&&t.message&&t.codeFrame){return Wm(t)}if(t&&t.stack){return Om(t)}return t};const Nm=t=>{if(t&&t.type&&t.message&&t.codeFrame){return`${t.type}: ${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.message&&t.codeFrame){return`${t.message}\n\n${t.codeFrame}\n\n${t.stack}`}if(t&&t.type&&t.message){return`${t.type}: ${t.message}\n${t.stack}`}if(t&&t.stack){return t.stack}if(t===null){return null}return String(t)};const Hm=async t=>{const n=await Bm(t);const e=Nm(n);console.error(e);return n};const zm=async t=>{try{await Hm(t)}catch(n){console.warn("ErrorHandling error");console.warn(n);console.error(t)}};const Um=async t=>t;const $m=t=>t.startsWith("untitled:");const _m=async(t,n)=>{await yo("FileSystem.writeFile",t,n)};const Ym=async t=>{const n="Save File";const{canceled:e,filePath:o}=await ho("Open.showSaveDialog",n,[],t);if(e){return""}return o};const Vm=async(t,n,e)=>{const o=await Ym(e);if(!o){return}await yo("FileSystem.writeFile",o,n);await vo();await yo("Main.handleUriChange",t,o);return o};const jm=async t=>{try{const{platform:n,uri:e}=t;const o=await Um(t);const s=Ar(o);if($m(e)){const t=await Vm(e,s,n);if(t){return{...o,modified:false,uri:t}}return o}await _m(e,s);return{...o,modified:false}}catch(n){const e=new S(n,`Failed to save file "${t.uri}"`);await zm(e);return t}};const qm=t=>{const{lines:n}=t;const e=0;const o=0;const s=n.length-1;const c=n.at(-1).length;const r=Fi(e,o,s,c);return ta(t,r)};const Gm=(t,n,e)=>{const o=Ti(t);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);sl(o,s+2,c,r,n,e);el(o,s,i,a)}return o};const Xm=(t,n)=>{const{lines:e,selections:o}=t;const s=Gm(o,e,n);return ta(t,s)};const Zm=t=>{Xm(t,ul)};const Qm=/[a-zA-Z\d]/;const Km=t=>Qm.test(t);const Jm=t=>Km(t)||t==="_";const tw=(t,n)=>{for(let e=n-1;e>=0;e--){if(!Jm(t[e])){return e+1}}return 0};const nw=(t,n)=>{for(let e=n;e<t.length;e++){if(!Jm(t[e])){return e}}return t.length};const ew=(t,n,e)=>{const o=t[n];const s=tw(o,e);const c=nw(o,e);const r=o.slice(s,c);return{end:c,start:s,word:r}};const ow=(t,n,e)=>{let o=0;if(!t[n+o].endsWith(e[o])){return false}while(++o<e.length-1){if(t[n+o]!==e[o]){return false}}return t[n+o].startsWith(e[o])};const sw=(t,n)=>{if(n.length===0){throw new Error("word length must be greater than zero")}const e=[];for(let o=0;o<t.length;o++){const s=t[o];let c=-n.length;while((c=s.indexOf(n,c+n.length))!==-1){e.push(o,c,o,c+n.length)}}return new Uint32Array(e)};const cw=(t,n)=>{const e=[];for(let o=0;o<t.length-n.length+1;o){if(ow(t,o,n)){e.push(o,t[o].length-n[0].length,o+n.length-1,n.at(-1).length);o+=n.length-1}else{o++}}return new Uint32Array(e)};const rw=(t,n)=>{if(n.length<4){throw new Error("selections must have at least one entry")}const e=0;const o=n[e];const s=n[e+1];const c=n[e+2];const r=n[e+3];if(o===c){if(s===r){const e=ew(t,c,r);if(e.start===e.end){return n}const o=sw(t,e.word);return o}const e=t[o];const i=e.slice(s,r);const a=sw(t,i);return a}const i=[];i.push(t[o].slice(s));for(let n=o+1;n<c-1;n++){i.push(t[n])}i.push(t[c].slice(0,r));const a=cw(t,i);return a};const iw=t=>{const{lines:n,selections:e}=t;const o=rw(n,e);return ta(t,o)};const aw=(t,n,e)=>{const o=new Uint32Array(t.length);for(let s=0;s<t.length;s+=4){const[c,r,i,a]=Ii(t,s);const d=n[i];o[s]=c;o[s+1]=r;if(a>=d.length){o[s+2]=i+1;o[s+3]=0}else{const t=e(d,a);o[s+2]=i;o[s+3]=a+t}}return o};const dw=(t,n)=>{const{lines:e}=t;const{selections:o}=t;const s=aw(o,e,n);return ta(t,s)};const lw=t=>dw(t,fl);const uw=t=>Xm(t,il);const fw=t=>dw(t,dl);const hw=(t,n)=>{const e=t.length-1;const o=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[s,c,r,i]=Ii(n,t);o[t]=s;o[t+1]=c;o[t+2]=Math.min(r+1,e);o[t+3]=i}return o};const gw=t=>{const{lines:n,selections:e}=t;const o=hw(n,e);return ta(t,o)};const mw=(t,n)=>{const e=new Uint32Array(n.length);for(let o=0;o<n.length;o+=4){const[s,c,r,i]=Ii(n,o);if(s===r&&c===i){const n=s;let r=c;let a=i;const d=t[n];while(r>0&&d[r]!==gr){r--}r++;while(a<d.length&&d[a]!==gr){a++}e[o]=n;e[o+1]=r;e[o+2]=n;e[o+3]=a}else{e[o]=s;e[o+1]=c;e[o+2]=r;e[o+3]=i}}return e};const ww=t=>{const{selections:n}=t;const{lines:e}=t;const o=mw(e,n);return ta(t,o)};const pw=async(t,n)=>{const e=await yo("ExtensionHostSelection.executeGrowSelection",t,n);if(e.length===0){return n}return new Uint32Array(e)};const yw=async t=>{const{selections:n}=t;const e=await pw(t,n);return ta(t,e)};const xw=(t,n)=>{const e=n.length-4;const o=n[e];const s=n[e+1];const c=n[e+3];const r=t[o];const i=r.slice(s,c);const a=r.indexOf(i,c);if(a!==-1){const t=a+i.length;const e=new Uint32Array(n.length+4);e.set(n,0);const s=n.length;e[s]=o;e[s+1]=a;e[s+2]=o;e[s+3]=t;return{revealRange:e.length-4,selectionEdits:e}}for(let e=o+1;e<t.length;e++){const o=t[e];const s=o.indexOf(i);if(s!==-1){const t=s+i.length;const o=new Uint32Array(n.length+4);o.set(n,0);const c=n.length;o[c]=e;o[c+1]=s;o[c+2]=e;o[c+3]=t;return{revealRange:o.length-4,selectionEdits:o}}}let d=0;for(let e=0;e<=o;e++){const o=t[e];let s=-i.length;while((s=o.indexOf(i,s+i.length))!==-1){let t=n[d];while(t<e&&d<n.length){d+=4;t=n[d]}if(t===e){let t=n[d+3];while(t<s&&d<n.length){d+=4;t=n[t+3]}}t=n[d];const o=n[d+1];const c=n[d+3];const r=t===e&&o<=s&&s<=c;if(!r){if(t>e){d-=4}const o=s+i.length;d+=4;const c=new Uint32Array(n.length+4);c.set(n.subarray(0,d),0);c[d]=e;c[d+1]=s;c[d+2]=e;c[d+3]=o;c.set(n.subarray(d),d+4);return{revealRange:c.length-4,selectionEdits:c}}}}return undefined};const Ew=t=>{const{lines:n}=t;const{selections:e}=t;if(zi(e)){const t=new Uint32Array(e.length);for(let o=0;o<e.length;o+=4){const[s,c,r,i]=Ii(e,o);const a=ew(n,s,c);t[o]=s;if(a.start===a.end){t[o+1]=c;t[o+2]=r;t[o+3]=i}else{t[o+1]=a.start;t[o+2]=s;t[o+3]=a.end}}return{revealRange:t.length-4,selectionEdits:t}}if(Ui(t.selections)){return xw(t.lines,t.selections)}return undefined};const Iw=(t,n,e,o)=>e>=t&&o<=n;const kw=t=>{const n=Ew(t);if(!n){return t}const{revealRange:e,selectionEdits:o}=n;const s=o[e];const c=o[e+2];if(Iw(t.minLineY,t.maxLineY,s,c)){return ta(t,o)}return na(t,[],o)};const Sw=t=>t;const vw=(t,n)=>{const e=new Uint32Array(n.length);for(let t=0;t<n.length;t+=4){const[o,s,c,r]=Ii(n,t);e[t]=Math.max(o-1,0);e[t+1]=s;e[t+2]=c;e[t+3]=r}return e};const Cw=t=>{const{lines:n,selections:e}=t;const o=vw(n,e);return ta(t,o)};const bw=t=>Xm(t,El);const Mw=t=>dw(t,vl);const Aw=(t,n,e)=>{if(t.decorations.length===0&&n.length===0){return t}return{...t,decorations:n,diagnostics:e}};const Lw=async(t,n,e)=>{const{tokenizerId:o}=t;Gc(n,e);await nr(n,e);const s=er(n);const c=o+1;sr(c,s);const r=pm(t.uid);if(!r){return t}const i=Qr();const{differences:a,textInfos:d}=await _r(t,i);const l=pm(t.uid);if(!l){return t}const u={...l,differences:a,focused:true,textInfos:d};return{...u,invalidStartIndex:0,languageId:n,tokenizerId:c}};const Pw=(t,n)=>{const{maxLineY:e,minLineY:o,rowHeight:s}=t;const c=n[0];if(c<o){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}if(c>e){const e=c*s;return{...t,deltaY:e,maxLineY:c+1,minLineY:c,selections:n}}return{...t,selections:n}};const Fw=(t,n)=>{w(n);const e=t.lines.length-1;const o=t.lines.at(-1).length;const s={columnIndex:0,rowIndex:0};const c={columnIndex:o,rowIndex:e};const r=[{deleted:Lr(t,{end:c,start:s}),end:c,inserted:yi(n),origin:xs,start:s}];return na(t,r)};const Ww=()=>{const t=zd();const n={id:Oe,newState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],content:"",diagnostics:[],documentation:"",editorUid:0,height:0,lineInfos:[],uid:t,width:0,x:0,y:0}};return n};const Tw=async()=>{const t="Hover Worker";const n="hoverWorkerMain.js";const e="Hover.initialize";const o=await $o(t,n,e);return o};const Rw={};const Dw=()=>{if(!Rw.workerPromise){Rw.workerPromise=Tw()}return Rw.workerPromise};const Ow=async(t,...n)=>{const e=await Dw();return await e.invoke(t,...n)};const Bw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Ow("Hover.create",o,c,r,s,e,n,a);await Ow("Hover.loadContent",o);const d=await Ow("Hover.diff2",o);const l=await Ow("Hover.render2",o,d);return{...t,commands:l}};const Nw=async t=>{const n=false;return Hd(Oe,rs,t,Ww,Bw,n)};const Hw="EditorHover";const zw=async t=>{await yo("Viewlet.openWidget",Hw);return t};const Uw=()=>{const t=zd();const n={id:Ne,newState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0},oldState:{commands:[],focusedIndex:0,height:0,maxHeight:0,sourceActions:[],uid:t,width:0,x:0,y:0}};return n};const $w=async()=>{const t="Source Action Worker";const n="sourceActionWorkerMain.js";const e="SourceActions.initialize";const o=await $o(t,n,e);return o};const _w={};const Yw=()=>{if(!_w.workerPromise){_w.workerPromise=$w()}return _w.workerPromise};const Vw=async(t,...n)=>{const e=await Yw();return await e.invoke(t,...n)};const jw=async(t,n)=>{const{height:e,uid:o,width:s,x:c,y:r}=t;const{newState:i}=Ko(n);const{languageId:a}=i;await Vw("SourceActions.create",o,c,r,s,e,n,a);await Vw("SourceActions.loadContent",o);const d=await Vw("SourceActions.diff2",o);const l=await Vw("SourceActions.render2",o,d);return{...t,commands:l}};const qw=async t=>Hd(Ne,as,t,Uw,jw);const Gw=(t,n)=>t.localeCompare(n);const Xw=t=>{const n=[...t];n.sort(Gw);return n};const Zw="sort-lines-ascending";const Qw=(t,n)=>{const e=n[0];const o=n[2];const s=[];for(let c=0;c<n.length;c+=4){const r=n[c];const i=n[c+1];const a=n[c+2];const d=n[c+3];const l={columnIndex:i,rowIndex:r};const u={columnIndex:d,rowIndex:a};const f={end:u,start:l};const h=t.slice(e,o+1);const g=Xw(h);s.push({deleted:Lr({lines:t},f),end:u,inserted:g,origin:Zw,start:l})}return s};const Kw=t=>{const{lines:n,selections:e}=t;const o=Qw(n,e);return na(t,o)};const Jw=async(t,n)=>va({args:[n],editor:t,event:Sa,method:da,noProviderFoundMessage:"No tab completion provider found",noProviderFoundResult:undefined});const tp=t=>{const{selections:n}=t;const e=n[0];const o=n[1];const s=Fr(t,e,o);return s};const np=async t=>{const n=tp(t);const e=await Jw(t,n);return e};const ep=(t,n,e)=>{const o=yi(e.inserted);const s=[];const c=[];for(let r=0;r<n.length;r+=4){const[i,a,d,l]=Ii(n,r);if(o.length>1){const n=Mr({lines:t},i);const r=Cr(n);const u=[o[0],...o.slice(1).map(t=>r+t)];const f=[""];s.push({deleted:f,end:{columnIndex:l,rowIndex:d},inserted:u,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}});const h=o.at(-1);c.push(d+o.length-f.length,l+h.length,d+o.length-f.length,l+h.length)}else{const t=o[0];const n=t.indexOf("$0");if(n===-1){const t=a-e.deleted;c.push(i,t,i,t);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:o,origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}else{const n=t.replace("$0","");const o=l+2;c.push(i,o,i,o);s.push({deleted:[""],end:{columnIndex:l,rowIndex:d},inserted:[n],origin:ys,start:{columnIndex:a-e.deleted,rowIndex:i}})}}}return{changes:s,selectionChanges:new Uint32Array(c)}};const op=(t,n)=>{const{lines:e,selections:o}=t;const{changes:s,selectionChanges:c}=ep(e,o,n);return na(t,s,c)};const sp=String;const cp=async t=>{try{const n=await np(t);if(!n){return t}return op(t,n)}catch(n){await zm(n);const e=t.selections[0];const o=t.selections[1];return yd(t,e,o,sp(n))}};const rp=async(t,n)=>{const{assetDir:e,platform:o}=t;try{await Ho(`onLanguage:${t.languageId}`,e,o);const s=await ua(`ExtensionHostCommment.execute`,t.uid,n);if(s){return s}}catch{}const s=await Zg(t);if(!s?.comments?.blockComment){return undefined}return s.comments.blockComment};const ip=/^\s+/;const ap=/\s+$/;const dp=(t,n,e)=>({deleted:[e],end:{columnIndex:n+e.length,rowIndex:t},inserted:[],origin:Ms,start:{columnIndex:n,rowIndex:t}});const lp=(t,n,e,o,s,c,r)=>{if(n===o){return[dp(t,e,c),dp(t,s-c.length,r)]}return[dp(n,e,c),dp(o,s,r)]};const up=(t,n)=>{const{selections:e}=t;const[o]=e;const s=Mr(t,o);const c=t.lines.length;let r=o;let i=-1;const a=n[0];const d=n[1];while(r<c){const n=Mr(t,r);i=n.indexOf(d);if(i!==-1){break}r++}let l=-1;let u=o;while(u>=0){const n=Mr(t,u);l=n.indexOf(a);if(l!==-1){break}u--}const f=[];if(l!==-1&&i!==-1){f.push(...lp(o,u,l,r,i,a,d))}else{const t=s.match(ip);const n=s.match(ap);let e=0;let c=s.length;if(t){e+=t[0].length}if(n){c-=n[0].length}const r={deleted:[],end:{columnIndex:e,rowIndex:o},inserted:[a],origin:Ms,start:{columnIndex:e,rowIndex:o}};const i={deleted:[],end:{columnIndex:c+a.length,rowIndex:o},inserted:[d],origin:Ms,start:{columnIndex:c+a.length,rowIndex:o}};f.push(r,i)}return f};const fp=async t=>{const n=tp(t);const e=await rp(t,n);if(!e){return t}const o=up(t,e);return oa(t,o)};const hp=async t=>{const n=await Zg(t);if(!n?.comments?.lineComment){return undefined}return n.comments.lineComment};const gp=/^\s+/;const mp=(t,n,e)=>{const o=n.match(gp);const s=o?o[0].length:0;if(n.slice(s).startsWith(e)){if(n[s+e.length]===" "){return{deleted:[e+" "],end:{columnIndex:s+e.length+1,rowIndex:t},inserted:[""],origin:Cs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[e],end:{columnIndex:s+e.length,rowIndex:t},inserted:[""],origin:Cs,start:{columnIndex:s,rowIndex:t}}}return{deleted:[],end:{columnIndex:s,rowIndex:t},inserted:[`${e} `],origin:Cs,start:{columnIndex:s,rowIndex:t}}};const wp=async t=>{const n=await hp(t);if(!n){return t}const e=t;const o=t.selections[0];const s=Mr(e,o);const c=[mp(o,s,n)];return na(t,c)};const pp=async t=>{try{const n=await wp(t);if(t!==n){return n}return fp(t)}catch(n){Ka(n);await pd(t,0,0,String(n),true);return t}};const yp=async(t,n)=>{const e=cd(t,[n],xs);const o=await na(t,e);if(o.completionsOnType){const t=await lm(o);return t}return o};const xp="/";const Ep="{";const Ip="}";const kp="(";const Sp=")";const vp="[";const Cp="]";const bp="???";const Mp="'";const Ap='"';const Lp="`";const Pp=t=>{switch(t){case Ep:return Ip;case kp:return Sp;case vp:return Cp;default:return bp}};const Fp=(t,n)=>{const e=Pp(n);const o=n+e;const s=cd(t,[o],Es);const c=new Uint32Array([s[0].start.rowIndex,s[0].start.columnIndex+1,s[0].end.rowIndex,s[0].end.columnIndex+1]);return na(t,s,c)};const Wp=t=>{const{selections:n}=t;const e=new Uint32Array([n[0],n[1]+1,n[2],n[3]+1]);return ta(t,e)};const Tp=(t,n)=>{const{autoClosingRanges:e=[],selections:o}=t;if(yu(e,o)){return Wp(t)}return yp(t,n)};const Rp=(t,n)=>{const e=n+n;const o=cd(t,[e],Es);const s=new Uint32Array([o[0].start.rowIndex,o[0].start.columnIndex+1,o[0].end.rowIndex,o[0].end.columnIndex+1]);return na(t,o,s)};const Dp=async(t,n)=>{const e=Fr(t,t.selections[0],t.selections[1]);const o=await yo("ExtensionHostClosingTagCompletion.executeClosingTagProvider",t,e,n);if(!o){const e=cd(t,[n],xs);return na(t,e)}const s=cd(t,[o.inserted],xs);return na(t,s)};const Op=async(t,n)=>{const{isAutoClosingBracketsEnabled:e,isAutoClosingQuotesEnabled:o,isAutoClosingTagsEnabled:s}=t;switch(n){case xp:if(s){return Dp(t,n)}break;case Ip:case Sp:case Cp:if(e){return Tp(t,n)}break;case Ep:case kp:case vp:if(e){return Fp(t,n)}break;case Lp:case Ap:case Mp:if(o){return Rp(t,n)}break}const c=yp(t,n);return c};const Bp=t=>{const n=t.end.columnIndex-t.deleted[0].length+t.inserted[0].length;return{deleted:t.inserted,end:{columnIndex:n,rowIndex:t.end.rowIndex},inserted:t.deleted,start:t.start}};const Np=t=>{const{undoStack:n}=t;if(n.length===0){return t}const e=n.at(-1);const o=e.map(Bp);const s={...t,redoStack:[...t.redoStack||[],e],undoStack:n.slice(0,-1)};return ea(s,o)};const Hp=t=>t;const zp=t=>{switch(t){case We:case Te:case De:case Oe:case Be:case Ne:return true;default:return false}};const Up=(t,n,e)=>{const o=e(t);const{uid:s}=t.newState;const c=[];c.push(["Viewlet.createFunctionalRoot",n,s,zp(t.id)]);c.push(...o);if(zp(t.id)){c.push(["Viewlet.appendToBody",s])}else{c.push(["Viewlet.send",s,"appendWidget"])}const r=c.findIndex(t=>t[2]==="focus"||t[0]==="Viewlet.focusSelector");if(r!==-1){const t=c[r];c.splice(r,1);c.push(t)}return c};const $p=t=>{switch(t){case We:return jo;case Te:return im;case De:return mm;case Oe:return Ow;case Be:return Td;case Ne:return Vw;default:return undefined}};const _p="Close";const Yp=(t,n,e)=>{const o=t=>t.id===n;const s=t.widgets.findIndex(o);if(s===-1){return t}const c=t.widgets[s];const r={...c,newState:e,oldState:c.newState};const i=[...t.widgets.slice(0,s),r,...t.widgets.slice(s+1)];return{...t,widgets:i}};const Vp=(t,n)=>{for(const e of Jo()){const o=Ko(Number(e)).newState;const s=o.widgets||[];for(const e of s){if(e.id===n&&e.newState.uid===t){return o}}}return undefined};const jp=(t,n)=>{if(t&&t.widgets){return t}const e=Ko(t);if(e&&e.newState&&e.newState.widgets){return e.newState}return Vp(t,n)};const qp=(t,n,e)=>{const o=t=>t.id===e;const s=n=>t==="close"||t==="handleClickButton"&&n.includes(_p);const c=async(c,...r)=>{const i=jp(c,e);if(!i){return c}const a=i.widgets.findIndex(o);if(a===-1){return i}const d=i.widgets[a];const l=d.newState;const{uid:u}=l;const f=$p(e);await f(`${n}.${t}`,u,...r);const h=await f(`${n}.diff2`,u);const g=await f(`${n}.render2`,u,h);const m=Ko(i.uid).newState;if(s(r)){const t={...m,focused:true,widgets:Cd(m.widgets,e)};ts(i.uid,m,t);return t}const w={...l,commands:g};const p=Yp(m,e,w);ts(i.uid,m,p);return p};return c};const Gp=(t,n,e)=>{const o=Object.create(null);for(const s of t){o[s]=qp(s,n,e)}return o};const Xp="Viewlet.appendToBody";const Zp="focus";const Qp="Viewlet.registerEventListeners";const Kp="Viewlet.setSelectionByName";const Jp="Viewlet.setValueByName";const ty="Viewlet.setFocusContext";const ny="setBounds";const ey="Viewlet.setBounds";const oy="Viewlet.setCss";const sy="Viewlet.setDom2";const cy="Viewlet.setUid";const ry=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const iy=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const ay=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(iy.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const dy=t=>Up(t,"EditorCompletion",ay);const ly=t=>[["Viewlet.dispose",t.newState.uid]];const{close:uy,closeDetails:fy,focusFirst:hy,focusIndex:gy,focusLast:my,focusNext:wy,focusPrevious:py,handleEditorBlur:yy,handleEditorClick:xy,handleEditorDeleteLeft:Ey,handleEditorType:Iy,handlePointerDown:ky,handleWheel:Sy,openDetails:vy,selectCurrent:Cy,selectIndex:by,toggleDetails:My}=Gp(["handleEditorType","focusFirst","focusNext","focusPrevious","focusLast","handleEditorDeleteLeft","openDetails","focusIndex","handleEditorBlur","handleEditorClick","openDetails","selectCurrent","selectIndex","toggleDetails","closeDetails","handleWheel","close","handlePointerDown"],"Completions",Te);const Ay={__proto__:null,add:dy,close:uy,closeDetails:fy,focusFirst:hy,focusIndex:gy,focusLast:my,focusNext:wy,focusPrevious:py,handleEditorBlur:yy,handleEditorClick:xy,handleEditorDeleteLeft:Ey,handleEditorType:Iy,handlePointerDown:ky,handleWheel:Sy,openDetails:vy,remove:ly,render:ay,selectCurrent:Cy,selectIndex:by,toggleDetails:My};const Ly=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Py=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const Fy=t=>{const n=Ly(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Py.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Wy=t=>Up(t,"FindWidget",Fy);const Ty=t=>[["Viewlet.dispose",t.newState.uid]];const{close:Ry,focusCloseButton:Dy,focusFind:Oy,focusNext:By,focusNextElement:Ny,focusNextMatchButton:Hy,focusPrevious:zy,focusPreviousElement:Uy,focusPreviousMatchButton:$y,focusReplace:_y,focusReplaceAllButton:Yy,focusReplaceButton:Vy,focusToggleReplace:jy,handleBlur:qy,handleClickButton:Gy,handleFocus:Xy,handleInput:Zy,handleReplaceFocus:Qy,handleReplaceInput:Ky,handleToggleReplaceFocus:Jy,replace:tx,replaceAll:nx,toggleMatchCase:ex,toggleMatchWholeWord:ox,togglePreserveCase:sx,toggleReplace:cx,toggleUseRegularExpression:rx}=Gp(["close","focusCloseButton","focusFind","focusNext","focusNextMatchButton","focusPrevious","focusPreviousMatchButton","focusReplace","focusReplaceAllButton","focusReplaceButton","focusToggleReplace","handleBlur","handleClickButton","handleFocus","handleInput","handleReplaceFocus","handleReplaceInput","handleToggleReplaceFocus","replace","replaceAll","toggleMatchCase","toggleMatchWholeWord","toggleReplace","toggleUseRegularExpression","focusNextElement","focusPreviousElement","togglePreserveCase"],"FindWidget",De);const ix={__proto__:null,add:Wy,close:Ry,focusCloseButton:Dy,focusFind:Oy,focusNext:By,focusNextElement:Ny,focusNextMatchButton:Hy,focusPrevious:zy,focusPreviousElement:Uy,focusPreviousMatchButton:$y,focusReplace:_y,focusReplaceAllButton:Yy,focusReplaceButton:Vy,focusToggleReplace:jy,handleBlur:qy,handleClickButton:Gy,handleFocus:Xy,handleInput:Zy,handleReplaceFocus:Qy,handleReplaceInput:Ky,handleToggleReplaceFocus:Jy,remove:Ty,render:Fy,replace:tx,replaceAll:nx,toggleMatchCase:ex,toggleMatchWholeWord:ox,togglePreserveCase:sx,toggleReplace:cx,toggleUseRegularExpression:rx};const ax=t=>({documentId:t.id||t.uid,languageId:t.languageId,text:Ar(t),uri:t.uri});const dx=async(t,n)=>{const e=ax(t);return lo("Extensions.executeHoverProvider",e,n)};const lx=async(t,n)=>{h(t);g(n);const e=await dx(t,n);if(e){return e}return va({args:[n],editor:t,event:ka,method:aa,noProviderFoundMessage:"No hover provider found"})};const ux=async(t,n)=>{h(t);g(n);const e=await lx(t,n);return e};const fx=async(t,n,e,o,s)=>100;const hx=(t,n,e)=>{const o=n.length;let s=0;let c=0;const r=[];for(let i=0;i<o;i+=2){const o=n[i];const a=n[i+1];s+=a;const d=t.slice(c,s);const l=`Token ${e[o]||"Unknown"}`;const u=d;r.push(u,l);c=s}return r};const gx=(t,n,e)=>{const o=[];const{hasArrayReturn:s,initialLineState:c,tokenizeLine:r,TokenMap:i}=n;let a=Mc(c);for(const n of t){const t=Fc(e,r,n,a,s);const{tokens:c}=t;const d=hx(n,c,i);o.push(d);a=t}console.error({lineInfos:o});return o};const mx=async(t,n,e)=>{await nr(n,e);const o=er(n);const s=yi(t);const c=gx(s,o,n);return c};const wx=(t,n)=>{if(t){return t}const e=n[0];const o=n[1];return{columnIndex:o,rowIndex:e}};const px=(t,n,e)=>{const o=[];for(const e of t){if(e.rowIndex===n){o.push(e)}}return o};const yx="typescript";const xx=(t,n,e,o)=>{const s=gd(t,n,e);const c=t.height-md(t,n)+t.y+40;return{x:s,y:c}};const Ex=async(t,n)=>{g(t);const e=Ko(t);const o=e.newState;const{selections:s}=o;const{columnIndex:c,rowIndex:r}=wx(n,s);const i=Fr(o,r,c);const a=await ux(o,i);if(!a){return undefined}const{displayString:d,displayStringLanguageId:l,documentation:u}=a;const f="";const h=await mx(d,l||yx,f);const m=$u(o,r,c);const w=c-m.length;await fx();const{x:p,y:y}=xx(o,r,w);const x=o.diagnostics||[];const E=px(x,r);return{documentation:u,lineInfos:h,matchingDiagnostics:E,x:p,y:y}};const Ix=async(t,n,e)=>{const o=await Ex(t,e);if(!o){return n}const{documentation:s,lineInfos:c,matchingDiagnostics:r,x:i,y:a}=o;return{...n,diagnostics:r,documentation:s,lineInfos:c,x:i,y:a}};const kx=(t,n,e)=>t;const Sx=(t,n,e)=>{const{x:o}=t;const s=100;const c=Math.max(n-o,s);return{...t,resizedWidth:c}};const vx=(t,n,e)=>t;const Cx="CodeGeneratorInput";const bx="CodeGeneratorMessage";const Mx="CodeGeneratorWidget";const Ax="DiagnosticError";const Lx="DiagnosticWarning";const Px="CompletionDetailCloseButton";const Fx="CompletionDetailContent";const Wx="Diagnostic";const Tx="EditorCursor";const Rx="EditorRow";const Dx="EditorRowHighlighted";const Ox="EditorSelection";const Bx="HoverDisplayString";const Nx="HoverDocumentation";const Hx="HoverEditorRow";const zx="HoverProblem";const Ux="HoverProblemDetail";const $x="HoverProblemMessage";const _x="IconClose";const Yx="InputBox";const Vx="MaskIcon";const jx="Viewlet";const qx=1;const Gx=2;const Xx=9;const Zx=10;const Qx=11;const Kx=12;const Jx=13;const tE=14;const nE=15;const eE=18;const oE=19;const sE=20;const cE=21;const rE=22;const iE=23;const aE=26;const dE=27;const lE=28;const uE=29;const fE=30;const hE=31;const gE=32;const mE=33;const wE=4;const pE=6;const yE=8;const xE=12;const EE=62;const IE=t=>({childCount:0,text:t,type:xE});const kE=t=>{const n=[{childCount:t.length/2,className:Hx,type:wE}];for(let e=0;e<t.length;e+=2){const o=t[e];const s=t[e+1];n.push({childCount:1,className:s,type:yE},IE(o))}return n};const SE=t=>{const n=t.flatMap(kE);return n};const vE={childCount:1,className:$x,type:yE};const CE={childCount:1,className:Ux,type:yE};const bE=(t,n,e)=>{const o=n?1:0;const s=e&&e.length>0?1:0;return t.length+o+s};const ME=(t,n,e)=>{const o=[];o.push({childCount:bE(t,n,e)+1,className:"Viewlet EditorHover",type:wE});if(e&&e.length>0){o.push({childCount:e.length*2,className:`${Bx} ${zx}`,type:wE});for(const t of e){o.push(vE,IE(t.message),CE,IE(`${t.source} (${t.code})`))}}if(t.length>0){const n=SE(t);o.push({childCount:t.length,className:Bx,type:wE},...n)}if(n){o.push({childCount:1,className:Nx,type:wE},IE(n))}o.push({childCount:0,className:"Sash SashVertical SashResize",onPointerDown:aE,type:wE});return o};const AE={apply(t,n){const e=ME(n.lineInfos,n.documentation,n.diagnostics);return[sy,e]},isEqual:(t,n)=>t.lineInfos===n.lineInfos&&t.documentation===n.documentation&&t.diagnostics===n.diagnostics};const LE={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y};const PE=[AE,LE];const FE=(t,n)=>{const e=[];for(const o of PE){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const WE=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const TE=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(WE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const RE=t=>Up(t,"EditorRename",TE);const DE=t=>[["Viewlet.dispose",t.newState.uid]];const{accept:OE,close:BE,handleInput:NE}=Gp(["handleInput","close","accept"],"Rename",Be);const HE={__proto__:null,accept:OE,add:RE,close:BE,handleInput:NE,remove:DE,render:TE};const zE=t=>structuredClone(t);const UE=(t,n)=>{const e={...t,focusedIndex:n};return e};const $E=t=>{const n=t.focusedIndex+1;return UE(t,n)};const _E=t=>[["Viewlet.send",t.newState.uid,"dispose"]];const YE=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const VE=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(YE.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const jE=t=>Up(t,"EditorSourceActions",VE);const qE=_E;const{close:GE,closeDetails:XE,focusFirst:ZE,focusIndex:QE,focusLast:KE,focusNext:JE,focusPrevious:tI,handleWheel:nI,selectCurrent:eI,selectIndex:oI,selectItem:sI,toggleDetails:cI}=Gp(["focusFirst","focusIndex","focusLast","focusNext","focusPrevious","selectCurrent","selectIndex","selectItem","toggleDetails","closeDetails","handleWheel","close"],"SourceActions",Ne);const rI={__proto__:null,add:jE,close:GE,closeDetails:XE,focusFirst:ZE,focusIndex:QE,focusLast:KE,focusNext:JE,focusPrevious:tI,handleWheel:nI,remove:qE,render:VE,selectCurrent:eI,selectIndex:oI,selectItem:sI,toggleDetails:cI};const iI=async(t,n,e,o,s,...c)=>{const r=$p(s);const i=e.slice(n.length+1);const a=t.widgets.find(t=>t.id===s);if(!a){return t}const{uid:d}=a.newState;g(d);await r(`${n}.${i}`,d,...c);const l=t=>t.id===s;const u=pm(t.uid);const f=u.widgets.findIndex(l);if(f===-1){return u}const h=await r(`${n}.diff2`,d);const m=await r(`${n}.render2`,d,h);const w=t.widgets.findIndex(l);if(w===-1){return u}const p=u.widgets[w];const y={...p.newState,commands:m};const x=Yp(u,s,y);return x};const aI=(t,n)=>t.filter(t=>t.languageId===n);const dI=async t=>{if(!t){return[]}const{newState:n}=Ko(t);const{languageId:e}=n;const o=await yo("GetEditorSourceActions.getEditorSourceActions");const s=aI(o,e);return s};const lI=/[\w\-]+$/;const uI=t=>{const{lines:n,selections:e}=t;const o=e[0];const s=e[1];const c=n[o];const r=c.slice(0,s);const i=r.match(lI);if(i){return i[0]}return""};const fI=async t=>{await yo("Focus.setFocus",t)};const hI=async t=>{if(!t){return}await yo("Focus.removeAdditionalFocus",t)};const gI=12;const mI=9;const wI=11;const pI=12;const yI=16;const xI=38;const EI=43;const II=46;const kI=47;const SI=48;const vI=49;const CI=50;const bI=52;const MI=t=>{const n=pm(t);return km(n)};const AI=t=>{const n=pm(t);return n.uri};const LI=t=>{const n=pm(t);return n.languageId};const PI=t=>{const n=pm(t);return tp(n)};const FI=(t,n,e)=>{const o=pm(t);const{word:s}=Uu(o,n,e);return s};const WI=t=>{const n=pm(t);const e=uI(n);return e};const TI=(t,n,e)=>{const o=pm(t);const s=$u(o,n,e);return s};const RI=t=>{const n=pm(t);const{lines:e}=n;return e};const DI=t=>{const n=pm(t);const{selections:e}=n;return e};const OI=async(t,n)=>{const e=pm(t);const o={...e,selections:n};const s=await wg(e,o);ts(t,e,s)};const BI=async(t,n,e,o)=>{const s=pm(t);const c=$p(n);const{widgets:r}=s;const i=r.findIndex(t=>t.id===n);if(i===-1){return}await c(`${e}.dispose`);const a=[...r.slice(0,i),...r.slice(i+1)];const d={...s,focused:true,widgets:a};const l=await wg(s,d);ts(t,s,l);await fI(pI);if(o){await hI(o)}};const NI=async t=>{await BI(t,De,"FindWidget",0)};const HI=async(t,n)=>{const e=pm(t);const o=await td(e,n);const s=await wg(e,o);ts(t,e,s)};const zI=async t=>{const n=await dI(t);return n};const UI=async t=>{const n=pm(t);const{diagnostics:e}=n;return e};const $I=async(t,n)=>{await wo("TextMeasurement.ensureFont",t,n)};const _I=()=>[{command:"Editor.closeSourceAction",key:ee,when:xI},{command:"EditorSourceActions.focusNext",key:de,when:xI},{command:"EditorSourceActions.focusPrevious",key:ie,when:xI},{command:"EditorSourceActions.focusFirst",key:ce,when:xI},{command:"EditorSourceActions.focusLast",key:se,when:xI},{command:"EditorSourceActions.selectCurrent",key:ne,when:xI},{command:"FindWidget.focusNext",key:ne,when:yI},{command:"FindWidget.preventDefaultBrowserFind",key:He|ge,when:yI},{command:"FindWidget.focusPrevious",key:ze|Ce,when:yI},{command:"FindWidget.focusNext",key:Ce,when:yI},{command:"FindWidget.focusToggleReplace",key:ze|te,when:yI},{command:"FindWidget.focusReplace",key:te,when:yI},{command:"FindWidget.focusPreviousMatchButton",key:te,when:EI},{command:"FindWidget.replaceAll",key:Ue|He|ne,when:EI},{command:"FindWidget.focusNextMatchButton",key:te,when:CI},{command:"FindWidget.focusReplace",key:ze|te,when:CI},{command:"FindWidget.focusPreviousMatchButton",key:ze|te,when:vI},{command:"FindWidget.focusCloseButton",key:te,when:vI},{command:"FindWidget.focusNextMatchButton",key:ze|te,when:SI},{command:"FindWidget.focusReplaceButton",key:te,when:SI},{command:"FindWidget.focusFind",key:ze|te,when:EI},{command:"FindWidget.focusReplaceAllButton",key:te,when:II},{command:"FindWidget.focusCloseButton",key:ze|te,when:II},{command:"FindWidget.focusReplaceButton",key:ze|te,when:kI},{command:"EditorCompletion.focusNext",key:de,when:mI},{command:"EditorCompletion.focusPrevious",key:ie,when:mI},{command:"EditorCompletion.selectCurrent",key:ne,when:mI},{command:"EditorCompletion.close",key:ee,when:mI},{command:"EditorCompletion.focusLast",key:se,when:mI},{command:"EditorCompletion.focusFirst",key:ce,when:mI},{command:"EditorCompletion.toggleDetails",key:He|oe,when:mI},{command:"Editor.cursorWordRight",key:He|ae,when:pI},{command:"Editor.cursorWordLeft",key:He|re,when:pI},{command:"Editor.deleteWordPartLeft",key:Ue|Jn,when:pI},{command:"Editor.deleteWordPartRight",key:Ue|le,when:pI},{command:"Editor.deleteWordLeft",key:He|Jn,when:pI},{command:"Editor.deleteWordRight",key:He|le,when:pI},{command:"Editor.selectNextOccurrence",key:He|he,when:pI},{command:"Editor.openColorPicker",key:He|we,when:pI},{command:"Editor.showSourceActions3",key:He|Me,when:pI},{command:"Editor.handleTab",key:te,when:pI},{command:"Editor.unindent",key:ze|te,when:pI},{command:"Editor.indentLess",key:He|Le,when:pI},{command:"Editor.closeFind",key:ee,when:yI},{command:"Editor.openFind2",key:He|ge,when:pI},{command:"Editor.openCodeGenerator",key:He|pe,when:pI},{command:"Editor.closeCodeGenerator",key:ee,when:bI},{command:"EditorCodeGenerator.accept",key:ne,when:bI},{command:"Editor.indentMore",key:He|Pe,when:pI},{command:"Editor.selectCharacterLeft",key:ze|re,when:pI},{command:"Editor.selectWordLeft",key:He|ze|re,when:pI},{command:"Editor.selectCharacterRight",key:ze|ae,when:pI},{command:"Editor.selectWordRight",key:He|ze|ae,when:pI},{command:"Editor.selectLine",key:He|ye,when:pI},{command:"Editor.deleteAllLeft",key:He|ze|Jn,when:pI},{command:"Editor.deleteAllRight",key:He|ze|le,when:pI},{command:"Editor.cancelSelection",key:ee,when:pI},{command:"Editor.undo",key:He|ke,when:pI},{command:"Editor.cursorLeft",key:re,when:pI},{command:"Editor.cursorRight",key:ae,when:pI},{command:"Editor.cursorUp",key:ie,when:pI},{command:"Editor.cursorDown",key:de,when:pI},{command:"Editor.deleteLeft",key:Jn,when:pI},{command:"Editor.deleteRight",key:le,when:pI},{command:"Editor.insertLineBreak",key:ne,when:pI},{command:"Editor.copyLineDown",key:He|ze|he,when:pI},{command:"Editor.moveLineDown",key:He|ze|de,when:pI},{command:"Editor.moveLineUp",key:He|ze|ie,when:pI},{command:"Editor.openCompletion",key:He|oe,when:pI},{command:"Editor.openRename",key:Se,when:pI},{command:"EditorRename.accept",key:ne,when:wI},{command:"Editor.closeRename",key:ee,when:wI},{command:"Editor.cursorHome",key:ce,when:pI},{command:"Editor.cursorEnd",key:se,when:pI},{command:"Editor.toggleComment",key:He|Ae,when:pI},{command:"Editor.copy",key:He|fe,when:pI},{command:"Editor.selectAll",key:He|ue,when:pI},{command:"Editor.showHover2",key:He|me,when:pI},{command:"Editor.cut",key:He|Ie,when:pI},{command:"Editor.paste",key:He|Ee,when:pI},{command:"Editor.cursorWordPartLeft",key:Ue|re,when:pI},{command:"Editor.cursorWordPartRight",key:Ue|ae,when:pI},{command:"Editor.selectAllOccurrences",key:Ue|ve,when:pI},{command:"Editor.addCursorAbove",key:Ue|ze|ie,when:pI},{command:"Editor.addCursorBelow",key:Ue|ze|de,when:pI},{command:"Editor.findAllReferences",key:Ue|ze|be,when:pI},{command:"Editor.organizeImports",key:Ue|ze|xe,when:pI},{command:"Editor.selectionGrow",key:He|ze|oe,when:gI}];const YI=()=>Jo();const VI={CommandPalette:"Command Palette"};const jI=()=>ju(VI.CommandPalette);const qI={command:"",flags:Ye,id:"separator",label:""};const GI=()=>[{command:"Editor.goToDefinition",flags:Ve,id:"go-to-definition",label:Lf()},{command:"Editor.goToTypeDefinition",flags:Ve,id:"go-to-type-definition",label:Bf()},qI,{args:["References",true],command:"SideBar.show",flags:Ve,id:"find-all-references",label:Nf()},{args:["Implementations",true],command:"SideBar.show",flags:Ve,id:"find-all-implementations",label:Hf()},qI,{command:"Editor.format",flags:Ve,id:"format",label:jf()},{command:"Editor.showSourceActions2",flags:Ve,id:_e,label:Rf()},qI,{command:"Editor.cut",flags:Ve,id:"cut",label:zf()},{command:"Editor.copy",flags:Ve,id:"copy",label:Uf()},{command:"Editor.paste",flags:Ve,id:"paste",label:$f()},qI,{command:"QuickPick.showEverything",flags:Ve,id:"commandPalette",label:jI()}];const XI=()=>[$e];const ZI=t=>Ma(t);const QI=async()=>{const t=Jo();const n=t.map(t=>{const n=parseInt(t);const e=Ko(n);return e});const e=n.map(t=>t.newState);const o=await Promise.all(e.map(ZI));const s=o.flat();return s};const KI=()=>[{id:"Editor.format",label:jf()},{id:"Editor.showHover",label:qf()},{id:"Editor.formatForced",label:Gf()},{id:"Editor.selectNextOccurrence",label:Xf()},{id:"Editor.selectAllOccurrences",label:Zf()},{id:"Editor.goToDefinition",label:Qf()},{id:"Editor.goToTypeDefinition",label:Kf()},{id:"Editor.selectInsideString",label:Jf()},{aliases:["Indent More","DeIndent"],id:"Editor.indent",label:th()},{aliases:["Indent Less","DeIndent"],id:"Editor.unindent",label:nh()},{id:"Editor.sortLinesAscending",label:eh()},{id:"Editor.toggleComment",label:oh()},{id:"Editor.selectUp",label:sh()},{id:"Editor.selectDown",label:ch()},{id:"Editor.toggleBlockComment",label:_f()},{id:"Editor.openColorPicker",label:rh()},{id:"Editor.closeColorPicker",label:ih()},{id:"Editor.copyLineDown",label:ah()},{id:"Editor.copyLineUp",label:dh()},{id:"Editor.moveLineDown",label:Vf()},{id:"Editor.moveLineUp",label:Yf()},{id:"Editor.showSourceActions2",label:Rf()}];const JI=t=>{const n=pm(t);const{selections:e}=n;return e};const tk=t=>{g(t);const n=pm(t);const{lines:e}=n;return e.join(wr)};const nk="insertText";const ek=(t,n,e)=>{switch(n){case nk:return Op(t,e);default:return t}};const ok=async(t,n)=>{const e=await Bn({commandMap:{},messagePort:t});if(n){Un(n,e)}};const sk=(t,n)=>op(t,n);const ck=async t=>{const n=await np(t);if(!n){return t}return sk(t,n)};const rk=async()=>{await wm();await gm()};const ik=t=>{switch(t){case De:return{invoke:mm,name:"FindWidget"};default:return undefined}};const ak=async(t,n,e,o)=>{if(e?.newState){const s=`${n}:${e.newState.uid}`;const c=ik(e.id);if(c&&o&&Object.hasOwn(o,s)){const{invoke:n,name:r}=c;const i=o[s];await n(`${r}.create`,e.newState.uid,e.newState.x,e.newState.y,e.newState.width,e.newState.height,t);await n(`${r}.loadContent`,e.newState.uid,i);const a=await n(`${r}.diff2`,e.newState.uid);const d=await n(`${r}.render2`,e.newState.uid,a);return{restored:true,widget:{...e,newState:{...e.newState,commands:d}}}}}return{restored:false,widget:e}};const dk=async(t,n)=>{const e=[];for(const o of t){const t=parseInt(o);const s=Ko(t);if(!s?.newState||!Array.isArray(s.newState.widgets)){continue}const{widgets:c}=s.newState;const r=[];let i=false;for(const e of c){const s=await ak(t,o,e,n);r.push(s.widget);if(s.restored){i=true}}if(!i){e.push(s);continue}e.push({...s,newState:{...s.newState,widgets:r}})}return e};const lk=async(t,n,e)=>{if(!e?.newState){return}const o=ik(e.id);if(!o){return}const{invoke:s,name:c}=o;const{uid:r}=e.newState;const i=`${n}:${r}`;const a=await s(`${c}.saveState`,r);t[i]=a};const uk=async t=>{const n=Object.create(null);for(const e of t){const t=Ko(parseInt(e));if(!t?.newState||!Array.isArray(t.newState.widgets)){continue}const{widgets:o}=t.newState;for(const t of o){await lk(n,e,t)}}return n};const fk={isReloading:false};const hk=async()=>{if(fk.isReloading){return}fk.isReloading=true;try{const t=Jo();const n=await uk(t);await rk();const e=await dk(t,n);for(const t of e){ts(t.newState.uid,t.oldState,t.newState)}await yo(`Editor.rerender`)}finally{fk.isReloading=false}};const gk=async t=>{try{await To(t)}catch{await xo("SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker",t,"HandleMessagePort.handleMessagePort")}};const mk=async()=>{try{const t=await Rn({commandMap:{},send:gk});return t}catch(t){throw new S(t,`Failed to create syntax highlighting worker rpc`)}};const wk=async(t,n)=>{if(t){zc(true);const t=await mk();_c(t)}if(n){Zr(true)}};const pk=async()=>{const t="Completion Worker";const n="completionWorkerMain.js";const e="Completions.initialize";const o=await $o(t,n,e);return o};const yk=async(t,n)=>{am(pk);await wk(t,n)};const xk="editor.lineHeight";const Ek="editor.fontSize";const Ik="editor.fontFamily";const kk="editor.letterSpacing";const Sk="editor.tabSize";const vk="editor.lineNumbers";const Ck="editor.diagnostics";const bk="editor.quickSuggestions";const Mk="editor.autoClosingQuotes";const Ak="editor.autoclosingBrackets";const Lk="editor.fontWeight";const Pk=async()=>Boolean(await Ea(Ak));const Fk=async()=>Boolean(await Ea(Mk));const Wk=async()=>Boolean(await Ea(bk));const Tk=async()=>true;const Rk=async()=>await Ea(xk)||20;const Dk=async()=>await Ea(Ek)||15;const Ok=async()=>await Ea(Ik)||"Fira Code";const Bk=async()=>await Ea(kk)??.5;const Nk=async()=>await Ea(Sk)||2;const Hk=async()=>await Ea(vk)??false;const zk=async()=>[".","/"];const Uk=async()=>await Ea(Ck)??false;const $k=async()=>await Ea(Lk)??400;const _k=async()=>{const[t,n,e,o,s,c,r,i,a,d,l,u,f]=await Promise.all([Uk(),Ok(),Dk(),$k(),Pk(),Fk(),Tk(),Wk(),Hk(),Rk(),Nk(),Bk(),zk()]);return{completionTriggerCharacters:f,diagnosticsEnabled:t,fontFamily:n,fontSize:e,fontWeight:o,isAutoClosingBracketsEnabled:s,isAutoClosingQuotesEnabled:c,isAutoClosingTagsEnabled:r,isQuickSuggestionsEnabled:i,letterSpacing:u,lineNumbers:a,rowHeight:d,tabSize:l}};const Yk=(t,n)=>{for(const e of t){if(e?.id===n){return e.tokenize||""}}return""};const Vk=async(t,n)=>{const{assetDir:e,height:o,id:s,platform:c,uri:r,width:i,x:a,y:d}=t;const{completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k}=await _k();const S=await xa(g,h,f,x);const v=await ya(c,e);Zc(v);const C=pa(r,v);const b=Yk(v,C);await nr(C,b);const M=er(C);const A=t.tokenizerId+1;sr(A,M);const L={...t,charWidth:S,completionTriggerCharacters:l,diagnosticsEnabled:u,fontFamily:f,fontSize:h,fontWeight:g,isAutoClosingBracketsEnabled:m,isAutoClosingQuotesEnabled:w,isAutoClosingTagsEnabled:p,isQuickSuggestionsEnabled:y,languageId:C,letterSpacing:x,lineNumbers:E,rowHeight:I,tabSize:k,tokenizerId:A};const P=await So(r);const F=ca(L,a,d,i,o,9);const W=ra(F,P);let T=W;const R=di(T);const D={...T,decorations:R};const O=Qr();const{differences:B,textInfos:N}=await _r(D,O);const H={...D,differences:B,focus:co,focused:true,textInfos:N};await ua(la,r,s,C,P);if(u){await Fa(H)}const z=await Ea("editor.completionsOnType");const U=Boolean(z);const $={...H,completionsOnType:U,initial:false};return $};const jk=t=>t;const qk=t=>t;const Gk=(t,n)=>{g(t);g(n);hi(t,n)};const Xk=(t,n,e,o,s)=>`.Editor {\n --EditorRowHeight: ${t}px;\n --ScrollBarHeight: ${n}px;\n --ScrollBarTop: ${e}px;\n --ScrollBarWidth: ${o}px;\n --ScrollBarLeft: ${s}px;\n}\n.Editor .EditorRow {\n height: var(--EditorRowHeight);\n line-height: var(--EditorRowHeight);\n}\n.Editor .ScrollBarThumbVertical {\n height: var(--ScrollBarHeight);\n translate: 0px var(--ScrollBarTop);\n}\n.Editor .ScrollBarThumbHorizontal {\n width: var(--ScrollBarWidth);\n translate: var(--ScrollBarLeft) 0px;\n}\n`;const Zk=(t,n,e)=>{const o=t/n*e;if(!Number.isFinite(o)){return 0}return o};const Qk=(t,n)=>{const{deltaX:e,deltaY:o,finalDeltaY:s,height:c,longestLineWidth:r,minimumSliderSize:i,rowHeight:a,scrollBarHeight:d,uid:l,width:u}=n;const f=Vr(o,s,c,d);const h=jr(u,r,i);const g=Zk(e,r,u);const m=Xk(a,d,f,h,g);return[eo,l,m]};const Kk=(t,n)=>{const e=".EditorInput textarea";return[no,n.uid,e]};const Jk=(t,n)=>[oo,n.uid,co];const tS=1;const nS=2;const eS=3;const oS=4;const sS=6;const cS=7;const rS=8;const iS=9;const aS=10;const dS=11;const lS=t=>t!=="type"&&t!=="childCount";const uS=t=>{const n=Object.keys(t).filter(lS);return n};const fS=t=>{const n=[];let e=0;while(e<t.length){const o=t[e];const{children:s,nodesConsumed:c}=hS(t,e+1,o.childCount||0);n.push({node:o,children:s});e+=1+c}return n};const hS=(t,n,e)=>{if(e===0){return{children:[],nodesConsumed:0}}const o=[];let s=n;let c=e;let r=0;while(c>0&&s<t.length){const n=t[s];const e=n.childCount||0;const{children:i,nodesConsumed:a}=hS(t,s+1,e);o.push({node:n,children:i});const d=1+a;s+=d;r+=d;c--}return{children:o,nodesConsumed:r}};const gS=(t,n)=>{if(t.type!==n.type){return null}const e=[];if(t.type===jn){if(t.uid!==n.uid){e.push({type:dS,uid:n.uid})}return e}if(t.type===Vn&&n.type===Vn){if(t.text!==n.text){e.push({type:tS,value:n.text})}return e}const o=uS(t);const s=uS(n);for(const o of s){if(t[o]!==n[o]){e.push({type:eS,key:o,value:n[o]})}}for(const t of o){if(!Object.hasOwn(n,t)){e.push({type:oS,key:t})}}return e};const mS=t=>{const n=[t.node];for(const e of t.children){n.push(...mS(e))}return n};const wS=(t,n,e)=>{if(n===-1){t.push({type:cS,index:e});return e}if(n!==e){t.push({type:aS,index:e})}return e};const pS=(t,n)=>{if(n>=0){t.push({type:rS})}return-1};const yS=(t,n)=>{n.push({type:sS,nodes:mS(t)})};const xS=(t,n)=>{n.push({type:nS,nodes:mS(t)})};const ES=(t,n,e,o,s)=>{const c=gS(t.node,n.node);if(c===null){const t=wS(e,o,s);xS(n,e);return t}const r=t.children.length>0||n.children.length>0;if(c.length===0&&!r){return o}const i=wS(e,o,s);if(c.length>0){e.push(...c)}if(r){kS(t.children,n.children,e)}return i};const IS=(t,n,e)=>{const o=gS(t.node,n.node);if(o===null){xS(n,e);return}if(o.length>0){e.push(...o)}if(t.children.length>0||n.children.length>0){kS(t.children,n.children,e)}};const kS=(t,n,e)=>{const o=Math.max(t.length,n.length);let s=-1;const c=[];for(let r=0;r<o;r++){const o=t[r];const i=n[r];if(!o&&!i){continue}if(!o){s=pS(e,s);yS(i,e);continue}if(!i){c.push(r);continue}s=ES(o,i,e,s,r)}pS(e,s);for(let t=c.length-1;t>=0;t--){e.push({type:iS,index:c[t]})}};const SS=(t,n,e,o)=>{if(o.length===0&&t.length===1&&n.length===1){IS(t[0],n[0],e);return}kS(t,n,e)};const vS=t=>{let n=-1;for(let e=t.length-1;e>=0;e--){const o=t[e];if(o.type!==cS&&o.type!==rS&&o.type!==aS){n=e;break}}return n===-1?[]:t.slice(0,n+1)};const CS=(t,n)=>{const e=fS(t);const o=fS(n);const s=[];SS(e,o,s,[]);return vS(s)};const bS=()=>[{childCount:1,className:"EditorInput",type:wE},{ariaAutoComplete:"list",ariaMultiLine:"true",ariaRoleDescription:"editor",autocapitalize:"off",autocomplete:"off",autocorrect:"off",childCount:0,name:"editor",onBeforeInput:qx,onBlur:Gx,onCompositionEnd:Zx,onCompositionStart:Qx,onCompositionUpdate:Kx,onCut:tE,onFocus:nE,onPaste:sE,role:"textbox",spellcheck:false,type:EE,wrap:"off"}];const MS=t=>{const n=Array.from(t,t=>({childCount:0,className:Tx,translate:t,type:wE}));return n};const AS=t=>{const n=MS([...t]);return[{childCount:t.length,className:"LayerCursor",type:wE},...n]};const LS="error";const PS="warning";const FS=t=>{switch(t){case LS:return Ax;case PS:return Lx;default:return Ax}};const WS=(...t)=>t.filter(Boolean).join(" ");const TS=t=>{const{height:n,type:e,width:o,x:s,y:c}=t;const r=FS(e);return[{childCount:0,className:WS(Wx,r),height:n,left:s,top:c,type:wE,width:o}]};const RS=t=>{const n=t.flatMap(TS);return n};const DS=t=>{const n=RS([...t]);return[{childCount:t.length,className:"LayerDiagnostics",type:wE},...n]};const OS=(t,n,e=true,o=-1)=>{const s=[];for(let e=0;e<t.length;e++){const c=t[e];const r=n[e];let i=Rx;if(e===o){i+=" "+Dx}s.push({childCount:c.length/2,className:i,translate:Pi(r),type:wE});for(let t=0;t<c.length;t+=2){const n=c[t];const e=c[t+1];s.push({childCount:1,className:e,type:yE},IE(n))}}return s};const BS=(t,n,e=true,o=-1)=>{const s=OS(t,n,e,o);return[{childCount:t.length,className:"EditorRows",onMouseDown:eE,onPointerDown:cE,onWheel:mE,type:wE},...s]};const NS=t=>{const n=[];for(let e=0;e<t.length;e+=4){const o=t[e];const s=t[e+1];const c=t[e+2];const r=t[e+3];n.push({childCount:0,className:Ox,height:r,left:o,top:s,type:wE,width:c})}return n};const HS=t=>{const n=NS(t);return[{childCount:t.length/4,className:"Selections",type:wE},...n]};const zS=(t,n,e,o=true,s=-1,c=[],r=[])=>[{childCount:4,className:"EditorLayers",type:wE},...HS(t),...BS(n,e,o,s),...AS(c),...DS(r)];const US=t=>[{childCount:t.length,className:"EditorScrollBarDiagnostics",type:wE},...RS([...t])];const $S=()=>[{childCount:1,className:"ScrollBar ScrollBarVertical",onContextMenu:Jx,onPointerDown:fE,type:wE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbVertical",type:wE},{childCount:1,className:"ScrollBar ScrollBarHorizontal",onPointerDown:dE,type:wE},{childCount:0,className:"ScrollBarThumb ScrollBarThumbHorizontal",type:wE}];const _S=({cursorInfos:t=[],diagnostics:n=[],differences:e,highlightedLine:o=-1,lineNumbers:s=true,scrollBarDiagnostics:c=[],selectionInfos:r=[],textInfos:i})=>[{childCount:5,className:"EditorContent",onMouseMove:oE,type:wE},...bS(),...zS(r,i,e,s,o,t,n),...US(c),...$S()];const YS=t=>[{childCount:1,className:"LineNumber",type:yE},IE(t)];const VS=t=>{const n=t.flatMap(YS);return n};const jS=t=>{const n=VS([...t]);return[{childCount:t.length,className:"Gutter",type:wE},...n]};const qS=({cursorInfos:t=[],diagnostics:n=[],differences:e,gutterInfos:o=[],highlightedLine:s=-1,lineNumbers:c=true,scrollBarDiagnostics:r=[],selectionInfos:i=[],textInfos:a})=>{const d=c?jS(o):[];return[{childCount:c?2:1,className:"Viewlet Editor",onContextMenu:Jx,role:"code",type:wE},...d,..._S({cursorInfos:t,diagnostics:n,differences:e,highlightedLine:s,lineNumbers:c,scrollBarDiagnostics:r,selectionInfos:i,textInfos:a})]};const GS=new Map;const XS=t=>GS.get(t);const ZS=(t,n)=>{GS.set(t,n)};const QS=t=>{const{initial:n,textInfos:e}=t;if(n&&e.length===0){return[]}return qS(t)};const KS=(t,n)=>{const e=t.initial?QS(t):XS(n.uid)||QS(t);const o=QS(n);const s=CS(e,o);if(s.length===0){return[]}ZS(n.uid,o);return[so,n.uid,s]};const JS=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.add(t)};const tv=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.render(t)};const nv=t=>{const n=Ps(t.id);if(!n){throw new Error("unsupported widget")}return n.remove(t)};const ev=(t,n)=>{const e=[];const o=[];const s=[];const c=t.widgets||[];const r=n.widgets||[];const i=Object.create(null);const a=Object.create(null);for(const t of c){i[t.id]=t}for(const t of r){a[t.id]=t}for(const t of c){if(Object.hasOwn(a,t.id)){o.push(a[t.id])}else{s.push(t)}}for(const t of r){if(Object.hasOwn(i,t.id));else{e.push(t)}}const d=[];for(const t of e){const n=JS(t);if(n.length>0){d.push(...n)}}const l=[];for(const t of o){const n=tv(t);if(n.length>0){l.push(...n)}}const u=[];for(const t of s){const n=nv(t);if(n.length>0){u.push(...n)}}const f=[...d,...l,...u];return f.filter(t=>t[0]!=="Viewlet.setFocusContext")};const ov=t=>{switch(t){case Na:return Qk;case Oa:return Kk;case Ba:return Jk;case Ha:return KS;case za:return ev;default:throw new Error("unknown renderer")}};const sv=(t,n,e)=>{const o=[];for(const s of e){const e=ov(s);const c=e(t,n);if(c.length>0){if(s===za){o.push(...c)}else{o.push(c)}}}return o};const cv=(t,n)=>{const{newState:e,oldState:o}=Ko(t);ts(t,e,e);const s=sv(o,e,n);return s};const rv={apply(t,n){const{incrementalEdits:e}=n;if(e!==ns){return["setIncrementalEdits",e]}const{differences:o,textInfos:s}=n;n.differences=o;const{highlightedLine:c,minLineY:r}=n;const i=c-r;const a=OS(s,o,true,i);return["setText",a]},isEqual:(t,n)=>t.lines===n.lines&&t.tokenizerId===n.tokenizerId&&t.minLineY===n.minLineY&&t.decorations===n.decorations&&t.embeds===n.embeds&&t.deltaX===n.deltaX&&t.width===n.width&&t.highlightedLine===n.highlightedLine&&t.debugEnabled===n.debugEnabled};const iv={apply:(t,n)=>{const{cursorInfos:e=[],selectionInfos:o=[]}=n;const s=MS(e);const c=NS(o);return["setSelections",s,c]},isEqual:(t,n)=>t.cursorInfos===n.cursorInfos&&t.selectionInfos===n.selectionInfos};const av={apply:Qk,isEqual:Ta};const dv={apply:(t,n)=>["setFocused",n.focused],isEqual:(t,n)=>t.focused===n.focused};const lv={apply:(t,n)=>[oo,n.uid,n.focus,0,n.uid,"Editor"],isEqual:(t,n)=>t.focus===n.focus};const uv={apply(t,n){if(n.additionalFocus){return["Viewlet.setAdditionalFocus",n.uid,n.additionalFocus]}return["viewlet.unsetAdditionalFocus",n.uid,n.additionalFocus]},isEqual:(t,n)=>t.additionalFocus===n.additionalFocus};const fv={apply(t,n){const e=RS(n.visualDecorations||[]);return["setDecorationsDom",e]},isEqual:(t,n)=>t.visualDecorations===n.visualDecorations};const hv={apply(t,n){const{lineNumbers:e,maxLineY:o,minLineY:s}=n;if(!e){return[]}const c=[];for(let t=s;t<o;t++){c.push(t+1)}const r=VS(c);return["renderGutter",r]},isEqual:(t,n)=>t.lineNumbers===n.lineNumbers&&t.minLineY===n.minLineY&&t.maxLineY===n.maxLineY};const gv={apply:ev,isEqual:(t,n)=>t.widgets===n.widgets,multiple:true};const mv=[rv,iv,av,dv,fv,hv,gv,lv,uv];const wv=async t=>{const n=Ko(t);if(!n){return[]}const{newState:e,oldState:o}=n;const s=[];ts(t,e,e);for(const t of mv){if(t.isEqual(o,e)){continue}const n=await t.apply(o,e);if(t.multiple){s.push(...n)}else if(n.length>0){s.push(n)}}return s};const pv=()=>[{name:nE,params:["handleFocus"]},{name:oE,params:["handleMouseMove",Xn,Zn,qn]},{name:Gx,params:["handleBlur"]},{name:qx,params:["handleBeforeInput","event.inputType","event.data"],preventDefault:true},{name:Qx,params:["compositionStart","event.data"]},{name:Kx,params:["compositionUpdate","event.data"]},{name:Zx,params:["compositionEnd","event.data"]},{name:tE,params:["cut"],preventDefault:true},{name:sE,params:["paste",'event.clipboardData ? event.clipboardData.getData("text/plain") : ""'],preventDefault:true},{name:eE,params:["handleMouseDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"]},{name:cE,params:["handlePointerDown","event.button","event.altKey","event.ctrlKey",Xn,Zn,"event.detail"],trackPointerEvents:[rE,iE]},{name:rE,params:["handlePointerMove",Xn,Zn,qn]},{name:iE,params:["handlePointerUp"]},{name:mE,params:["handleWheel",Qn,"event.deltaX",Kn],passive:true},{name:Jx,params:["handleContextMenu",Gn,Xn,Zn],preventDefault:true},{name:fE,params:["handleScrollBarVerticalPointerDown",Zn],preventDefault:true,trackPointerEvents:[hE,gE]},{name:hE,params:["handleScrollBarVerticalPointerMove",Zn]},{name:gE,params:["handlePointerUp"]},{name:dE,params:["handleScrollBarHorizontalPointerDown",Xn],trackPointerEvents:[lE,uE]},{name:lE,params:["handleScrollBarHorizontalMove",Xn]},{name:uE,params:["handlePointerUp"]}];const yv=(t,n)=>{const{lines:e}=t;return{lines:e}};const xv=async(t,n,e)=>{await Co(t,e)};const Ev=async(t,n)=>{await Po(t,n)};const Iv=(t,n)=>t;const kv=(t,n)=>{g(t);g(n);gi(t,n)};const Sv=async(t,...n)=>{const e=$n(qe);return e.invoke(t,...n)};const vv=async t=>{const n=await Sv("RunAndDebug.getHighlight",t);return n};const Cv=()=>{const t=Jo();return parseInt(t[0])};const bv=async t=>{const n=await vv(t);const e=Cv();const o=Ko(e);if(!o){return}const{newState:s,oldState:c}=o;const r={...s,highlightedLine:n.rowIndex};ts(e,c,r);await yo("Editor.rerender",e)};const Mv=t=>async(n,...e)=>{const o=Ko(n);const s=o.newState;const c=await t(s,...e);if(s===c){return c}const r=await wg(s,c);ts(n,s,r);return r};const Av={"ActivateByEvent.activateByEvent":Ho,"CodeGenerator.accept":zo,"ColorPicker.loadContent":qo,"Editor.addCursorAbove":Mv(qa),"Editor.addCursorBelow":Mv(Xa),"Editor.applyDocumentEdits":Mv(Ja),"Editor.applyEdit":Mv(td),"Editor.applyEdit2":HI,"Editor.applyWorkspaceEdit":Mv(ed),"Editor.braceCompletion":Mv(kd),"Editor.cancelSelection":Mv(Sd),"Editor.closeCodeGenerator":Mv(Md),"Editor.closeFind":Mv(Ld),"Editor.closeFind2":NI,"Editor.closeRename":Mv(Dd),"Editor.closeSourceAction":Mv(Bd),"Editor.closeWidget2":BI,"Editor.compositionEnd":Mv(Gd),"Editor.compositionStart":Mv(Vd),"Editor.compositionUpdate":Mv(qd),"Editor.contextMenu":Mv(Th),"Editor.copy":Mv(Kd),"Editor.copyLineDown":Mv(Jd),"Editor.copyLineUp":Mv(tl),"Editor.create":Wa,"Editor.create2":ls,"Editor.cursorCharacterLeft":Mv(jl),"Editor.cursorCharacterRight":Mv(Ql),"Editor.cursorDown":Mv(tu),"Editor.cursorEnd":Mv(nu),"Editor.cursorHome":Mv(eu),"Editor.cursorLeft":Mv(jl),"Editor.cursorRight":Mv(Ql),"Editor.cursorSet":Mv(ou),"Editor.cursorUp":Mv(iu),"Editor.cursorWordLeft":Mv(au),"Editor.cursorWordPartLeft":Mv(du),"Editor.cursorWordPartRight":Mv(lu),"Editor.cursorWordRight":Mv(uu),"Editor.cut":Mv(gu),"Editor.deleteAll":Mv(mu),"Editor.deleteAllLeft":Mv(Iu),"Editor.deleteAllRight":Mv(vu),"Editor.deleteCharacterLeft":Mv(Cu),"Editor.deleteCharacterRight":Mv(bu),"Editor.deleteHorizontalRight":Mv(Su),"Editor.deleteLeft":Mv(Cu),"Editor.deleteRight":Mv(bu),"Editor.deleteWordLeft":Mv(Mu),"Editor.deleteWordPartLeft":Mv(Au),"Editor.deleteWordPartRight":Mv(Lu),"Editor.deleteWordRight":Mv(Pu),"Editor.diff2":Va,"Editor.executeWidgetCommand":Mv(iI),"Editor.findAllReferences":Mv(Fu),"Editor.format":Mv(Ou),"Editor.getCommandIds":Xo,"Editor.getDiagnostics":UI,"Editor.getKeyBindings":_I,"Editor.getKeys":YI,"Editor.getLanguageId":LI,"Editor.getLines2":RI,"Editor.getMenuEntries":GI,"Editor.getMenuEntries2":GI,"Editor.getMenuIds":XI,"Editor.getOffsetAtCursor":PI,"Editor.getPositionAtCursor":MI,"Editor.getProblems":QI,"Editor.getQuickPickMenuEntries":KI,"Editor.getSelections":JI,"Editor.getSelections2":DI,"Editor.getSourceActions":zI,"Editor.getText":tk,"Editor.getUri":AI,"Editor.getWordAt":Uu,"Editor.getWordAt2":FI,"Editor.getWordAtOffset2":WI,"Editor.getWordBefore":$u,"Editor.getWordBefore2":TI,"Editor.goToDefinition":Mv(mh),"Editor.goToTypeDefinition":Mv(Ih),"Editor.handleBeforeInput":Mv(ek),"Editor.handleBeforeInputFromContentEditable":Mv(ig),"Editor.handleBlur":Mv(od),"Editor.handleClickAtPosition":Mv(Fh),"Editor.handleContextMenu":Mv(Th),"Editor.handleDoubleClick":Mv(Nh),"Editor.handleFocus":Mv(Hh),"Editor.handleMouseDown":Mv(Xh),"Editor.handleMouseMove":Mv(eg),"Editor.handleMouseMoveWithAltKey":Mv(sg),"Editor.handleNativeSelectionChange":ag,"Editor.handlePointerCaptureLost":Mv(dg),"Editor.handlePointerDown":Mv(lg),"Editor.handlePointerMove":Mv(Lg),"Editor.handlePointerUp":Mv(Pg),"Editor.handleScrollBarClick":Bg,"Editor.handleScrollBarHorizontalMove":Mv(Wg),"Editor.handleScrollBarHorizontalPointerDown":Mv(Tg),"Editor.handleScrollBarMove":Mv(Dg),"Editor.handleScrollBarPointerDown":Mv(Bg),"Editor.handleScrollBarVerticalMove":Mv(Og),"Editor.handleScrollBarVerticalPointerDown":Mv(Bg),"Editor.handleScrollBarVerticalPointerMove":Mv(Og),"Editor.handleSingleClick":Mv(Yh),"Editor.handleTab":Mv(ck),"Editor.handleTouchEnd":Mv(Ng),"Editor.handleTouchMove":Mv(Yg),"Editor.handleTouchStart":Mv(zg),"Editor.handleTripleClick":Mv(qh),"Editor.handleWheel":Mv(Vg),"Editor.hotReload":hk,"Editor.indendLess":Mv(qg),"Editor.indentMore":Mv(Xg),"Editor.insertLineBreak":Mv(tm),"Editor.loadContent":Mv(Vk),"Editor.moveLineDown":Mv(jk),"Editor.moveLineUp":Mv(qk),"Editor.moveRectangleSelection":Mv(ug),"Editor.moveRectangleSelectionPx":Mv(fg),"Editor.moveSelection":Mv(Cg),"Editor.moveSelectionPx":Mv(Ag),"Editor.offsetAt":Fr,"Editor.openCodeGenerator":Mv(cm),"Editor.openColorPicker":Mv(_d),"Editor.openCompletion":Mv(lm),"Editor.openFind":Mv(Im),"Editor.openFind2":Mv(Em),"Editor.openRename":Mv(Cm),"Editor.organizeImports":Mv(Mm),"Editor.paste":Mv(Lm),"Editor.pasteText":Mv(Am),"Editor.redo":Mv(Pm),"Editor.render":wv,"Editor.render2":cv,"Editor.renderEventListeners":pv,"Editor.replaceRange":Mv(sd),"Editor.rerender":Mv(zE),"Editor.save":Mv(jm),"Editor.saveState":Qo(yv),"Editor.selectAll":Mv(qm),"Editor.selectAllLeft":Mv(Zm),"Editor.selectAllOccurrences":Mv(iw),"Editor.selectAllRight":Mv(lw),"Editor.selectCharacterLeft":Mv(uw),"Editor.selectCharacterRight":Mv(fw),"Editor.selectDown":Mv(gw),"Editor.selectInsideString":Mv(ww),"Editor.selectionGrow":Mv(yw),"Editor.selectLine":Mv(jh),"Editor.selectNextOccurrence":Mv(kw),"Editor.selectPreviousOccurrence":Mv(Sw),"Editor.selectUp":Mv(Cw),"Editor.selectWord":Mv(Bh),"Editor.selectWordLeft":Mv(bw),"Editor.selectWordRight":Mv(Mw),"Editor.setDebugEnabled":Mv(Iv),"Editor.setDecorations":Mv(Aw),"Editor.setDelta":Mv(_g),"Editor.setDeltaY":Mv(Ug),"Editor.setLanguageId":Mv(Lw),"Editor.setSelections":Mv(Pw),"Editor.setSelections2":OI,"Editor.setText":Mv(Fw),"Editor.showHover":zw,"Editor.showHover2":Nw,"Editor.showSourceActions":qw,"Editor.showSourceActions2":qw,"Editor.showSourceActions3":qw,"Editor.sortLinesAscending":Mv(Kw),"Editor.tabCompletion":Mv(cp),"Editor.terminate":e,"Editor.toggleBlockComment":Mv(fp),"Editor.toggleComment":Mv(pp),"Editor.toggleLineComment":Mv(wp),"Editor.type":Mv(yp),"Editor.typeWithAutoClosing":Mv(Op),"Editor.undo":Mv(Np),"Editor.unIndent":Mv(Hp),"Editor.updateDebugInfo":bv,"Editor.updateDiagnostics":Mv(Fa),"EditorCompletion.close":uy,"EditorCompletion.closeDetails":fy,"EditorCompletion.focusFirst":hy,"EditorCompletion.focusIndex":gy,"EditorCompletion.focusNext":wy,"EditorCompletion.focusPrevious":py,"EditorCompletion.handleEditorBlur":yy,"EditorCompletion.handleEditorClick":xy,"EditorCompletion.handleEditorDeleteLeft":Ey,"EditorCompletion.handleEditorType":Iy,"EditorCompletion.handlePointerDown":ky,"EditorCompletion.handleWheel":Sy,"EditorCompletion.openDetails":vy,"EditorCompletion.selectCurrent":Cy,"EditorCompletion.selectIndex":by,"EditorCompletion.toggleDetails":My,"EditorRename.accept":OE,"EditorRename.close":BE,"EditorRename.handleInput":NE,"EditorSourceAction.close":GE,"EditorSourceAction.closeDetails":XE,"EditorSourceAction.focusFirst":ZE,"EditorSourceAction.focusIndex":QE,"EditorSourceAction.focusNext":JE,"EditorSourceAction.focusPrevious":tI,"EditorSourceAction.handleWheel":nI,"EditorSourceAction.selectCurrent":eI,"EditorSourceAction.selectIndex":oI,"EditorSourceAction.selectItem":sI,"EditorSourceAction.toggleDetails":cI,"EditorSourceActions.focusNext":$E,"ExtensionHostManagement.activateByEvent":Ho,"FindWidget.close":Ry,"FindWidget.focusCloseButton":Dy,"FindWidget.focusFind":Oy,"FindWidget.focusNext":By,"FindWidget.focusNextElement":Ny,"FindWidget.focusNextMatchButton":Hy,"FindWidget.focusPrevious":zy,"FindWidget.focusPreviousElement":Uy,"FindWidget.focusPreviousMatchButton":$y,"FindWidget.focusReplace":_y,"FindWidget.focusReplaceAllButton":Yy,"FindWidget.focusReplaceButton":Vy,"FindWidget.focusToggleReplace":jy,"FindWidget.handleBlur":qy,"FindWidget.handleClickButton":Gy,"FindWidget.handleFocus":Xy,"FindWidget.handleInput":Zy,"FindWidget.handleReplaceFocus":Qy,"FindWidget.handleReplaceInput":Ky,"FindWidget.handleToggleReplaceFocus":Jy,"FindWidget.loadContent":ym,"FindWidget.replace":tx,"FindWidget.replaceAll":nx,"FindWidget.toggleMatchCase":ex,"FindWidget.toggleMatchWholeWord":ox,"FindWidget.togglePreserveCase":sx,"FindWidget.toggleReplace":cx,"FindWidget.toggleUseRegularExpression":rx,"Font.ensure":$I,"HandleMessagePort.handleMessagePort":ok,"Hover.getHoverInfo":Ex,"Hover.handleSashPointerDown":kx,"Hover.handleSashPointerMove":Sx,"Hover.handleSashPointerUp":vx,"Hover.loadContent":Ix,"Hover.render":FE,"Initialize.initialize":yk,"Listener.register":Gk,"Listener.registerListener":hi,"Listener.unregister":kv,"SendMessagePortToExtensionHostWorker.sendMessagePortToExtensionHostWorker":xv,"SendMessagePortToExtensionManagementWorker.sendMessagePortToExtensionManagementWorker":Ev};for(const[t,n]of Object.entries(Av)){if(t.startsWith("Editor.")){Av["EditorText"+t.slice("Editor".length)]=n}}const Lv=async()=>{const t="HandleMessagePort.handleMessagePort2";const n=await On({commandMap:{},async send(n){await xv(n,t,Ge)}});return n};const Pv=async()=>{const t=await Lv();fa(t)};const Fv=async()=>{const t=await On({commandMap:{},async send(t){await Po(t,Ge)}});return t};const Wv=async()=>{try{const t=await Fv();uo(t)}catch{}};const Tv=t=>ko(t);const Rv=async()=>{const t=await On({commandMap:{},send:Tv});go(t)};const Dv=async()=>{const t=await Nn({commandMap:Av});Eo(t)};const Ov=t=>Lo(t);const Bv=async()=>{const t=await On({commandMap:{},send:Ov});po(t)};const Nv=async()=>{Zo(Av);await Promise.all([Dv(),Pv(),Wv(),Bv(),Rv()])};const Hv="CodeGeneratorInput";const zv=t=>{const n=Df();const e=Of();return[{childCount:2,className:WS(jx,Mx),type:wE},{childCount:0,className:WS(Cx,Yx),name:Hv,placeholder:e,type:pE},{childCount:1,className:bx,type:wE},IE(n)]};const Uv={apply(t,n){const e=zv();return[sy,n.uid,e]},isEqual:(t,n)=>t.questions===n.questions};const $v={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const _v={apply:(t,n)=>[Zp,".CodeGeneratorInput",n.focusSource],isEqual:(t,n)=>t.focused===n.focused&&t.focusSource===n.focusSource};const Yv=[Uv,$v,_v];const Vv=(t,n)=>{const e=[];for(const o of Yv){if(!o.isEqual(t,n)){e.push(o.apply(t,n))}}return e};const jv=t=>{const n=Vv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===sy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const qv=t=>Up(t,"EditorCodeGenerator",jv);const Gv=_E;const Xv={__proto__:null,add:qv,remove:Gv,render:jv};const Zv=(t,n)=>{const e=[...n.commands];n.commands=[];return e};const Qv=[sy,oy,Xp,ey,Qp,cy];const Kv=t=>{const n=Zv(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(Qv.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const Jv=t=>Up(t,"ColorPicker",Kv);const tC=_E;const nC={};const eC={__proto__:null,Commands:nC,add:Jv,remove:tC,render:Kv};const oC=t=>{const n=[{childCount:2,className:"Viewlet EditorCompletionDetails",type:wE},{childCount:1,className:Fx,type:wE},IE(t),{childCount:1,className:Px,onClick:Xx,type:wE},{childCount:0,className:`${Vx} ${_x}`,type:wE}];return n};const sC=(t,n,e)=>{const o=[];for(const s of t){if(!s.isEqual(n,e)){o.push(s.apply(n,e))}}return o};const cC={apply(t,n){const e=oC(n.content);return[sy,n.uid,e]},isEqual:(t,n)=>t.content===n.content};const rC={apply(t,n){const{height:e,width:o,x:s,y:c}=n;return[ny,s,c,o,e]},isEqual:(t,n)=>t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height};const iC=[cC,rC];const aC=(t,n)=>sC(iC,t,n);const dC=(t,n)=>{const{widgets:e}=t;for(const t of e){if(t.id===n){return t.newState}}return undefined};const lC=t=>dC(t,Te);const uC=t=>{const n=aC(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(t[0]===sy){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const fC=t=>Up(t,"EditorCompletionDetails",uC);const hC=_E;const gC=(t,n)=>{const e=lC(t);if(!e){return t}const{x:o}=km(t);const s=o+e.width-n.borderSize;return{...n,x:s}};const mC=(t,n)=>gC(t,n);const wC=(t,n)=>gC(t,n);const pC={__proto__:null,add:fC,handleEditorDeleteLeft:wC,handleEditorType:mC,remove:hC,render:uC};const yC=[sy,oy,Xp,ey,Qp,Kp,Jp,ty,cy,"Viewlet.focusSelector"];const xC=t=>{const n=ry(t.oldState,t.newState);const e=[];const{uid:o}=t.newState;for(const t of n){if(yC.includes(t[0])){e.push(t)}else{e.push(["Viewlet.send",o,...t])}}return e};const EC=t=>Up(t,"EditorCompletion",xC);const IC=t=>[["Viewlet.dispose",t.newState.uid]];const{close:kC}=Gp(["close"],"",Oe);const SC={__proto__:null,add:EC,close:kC,remove:IC,render:xC};const vC=()=>{Ls(We,eC);Ls(Te,Ay);Ls(Re,pC);Ls(De,ix);Ls(Oe,SC);Ls(Be,HE);Ls(Ne,rI);Ls(Fe,Xv)};const CC=t=>{t.preventDefault();console.error(`[editor-worker] Unhandled Rejection: ${t.reason}`)};const bC=(t,n,e,o,s)=>{console.error(`[editor-worker] Unhandled Error: ${s}`);return true};const MC=t=>{t.addEventListener("error",bC);t.addEventListener("unhandledrejection",CC)};const AC=async()=>{MC(globalThis);await Nv();vC()};AC();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.6.0",
3
+ "version": "19.7.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"