@xano/xanoscript-monaco-editor 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.vite/manifest.json +49 -49
- package/dist/assets/{editor-Q-H44Xk5.js → editor-CTk4XCQG.js} +1 -1
- package/dist/assets/{fileCommands._save-_f7KuzoK.js → fileCommands._save-BslznhnO.js} +3 -3
- package/dist/assets/{iconv-lite-umd-D8Xc-NRZ.js → iconv-lite-umd-vDmZu3o7.js} +1 -1
- package/dist/assets/{index-kz8GV9yO.js → index-B9LREvGB.js} +1 -1
- package/dist/assets/{index-BQHo-Z-Y.js → index-BMTVGxzX.js} +2 -2
- package/dist/assets/{index-fzRRQ7Qh.js → index-Be1WCD4s.js} +1 -1
- package/dist/assets/{index-DcZHpPDm.js → index-BfLChBOe.js} +1 -1
- package/dist/assets/{index-CQIJkuYI.js → index-BpdMCZU7.js} +1 -1
- package/dist/assets/{index-GR_3sv6M.js → index-Ca2GOtQx.js} +2 -2
- package/dist/assets/{index-CLAWxbMR.js → index-CzmSOBI6.js} +1 -1
- package/dist/assets/{index-CHwATtBn.js → index-DqIUrgd9.js} +3 -3
- package/dist/assets/{index-D9lSNsHR.js → index-GPQU4rv1.js} +3 -3
- package/dist/assets/{main-BtCp5aH0.js → main-CuAxLb8K.js} +1 -1
- package/dist/assets/{main-BnV5RNdt.js → main-kYU-Ynn2.js} +1 -1
- package/dist/assets/{tokenClassificationRegistry-BP6RVP9u.js → tokenClassificationRegistry-BA6yuF5K.js} +2 -2
- package/dist/assets/{views-Hn-QKMUh.js → views-Dck1c7fK.js} +2 -2
- package/dist/assets/workbenchThemeService.service-DlXrxy4t.js +1 -0
- package/dist/index.html +1 -1
- package/dist/logic-assistant-script.js +60 -62
- package/dist/worker.js +92 -94
- package/package.json +3 -2
- package/dist/assets/workbenchThemeService.service-CDwCNsAv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{al as M,
|
|
1
|
+
import{al as M,bX as U,cc as L,cd as Q,aq as Z,f as z,g as ee,W as te,ce as ie,cf as oe,cg as re,ao as ne,by as se,O as ae,bx as le,ch as de,ci as ce,h as ue,bA as fe,cj as pe,ck as g,cl as O,cm as V,cn as P,co as ge,cp as c,cq as k,aJ as h,U as Pe,cr as K,cs as x,ct as E,cu as we,cv as ve,cw as ye,G as me}from"./index-GPQU4rv1.js";import{cx as Ue,cy as He,cz as Ne,cA as Fe,cB as Ye,cC as Xe,cD as $e,cE as qe,cF as je,cG as Je,cH as Qe}from"./index-GPQU4rv1.js";import{g as Re,a as Se,E as Te,S as he,P as Ae,A as Ce}from"./views-Dck1c7fK.js";import{b as ze}from"./views-Dck1c7fK.js";import{M as be,a as Ee}from"./editor-CTk4XCQG.js";import"./fileCommands._save-BslznhnO.js";import"./workbenchThemeService.service-DlXrxy4t.js";function Ie(t,r,l){const p=document.createElement(r==="status"?"footer":"div");return p.classList.add("part","monaco-workbench-part",...l),p.id=t,p.setAttribute("role",r),r==="status"&&p.setAttribute("aria-live","off"),p}function Be(t){const r=t.getContainer()?.parentNode;r!=null&&t.layout(Math.max(t.minimumWidth,Math.min(t.maximumWidth,r.offsetWidth)),Math.max(t.minimumHeight,Math.min(t.maximumHeight,r.offsetHeight)),r.offsetTop,r.offsetLeft)}function Oe(t,r){t.oncontextmenu=()=>!1;function l(){Be(r)}r.onDidVisibilityChange(p=>{p&&l()}),l()}function Ve(t){return t.isConnected?t.checkVisibility!=null?t.checkVisibility({checkOpacity:!0,checkVisibilityCSS:!0}):t.offsetHeight>0&&t.offsetWidth>0:!1}function I(){const t=Z.get(L).mainPart.getContainer();return t!=null&&Ve(t)}let D=class extends Ee{constructor(r,l){super(l.createInstance(Te),!1,r,l),this.restoreGroup=(...p)=>this.delegate.restoreGroup(...p)}getId(){return"standalone"}updateStyles(){}registerPart(r){return this.delegate.registerPart(r)}bind(r,l){return this.delegate.bind(r,l)}get activePart(){return this.delegate.activePart}};D=z([ee(1,te)],D);let H=t=>t;ie(async t=>{const r=t.get(oe),l=t.get(re),p=t.get(ne),m=t.get(se),R=t.get(L),N=t.get(U),S=t.get(ae),F=t.get(le),A=t.get(de),G=t.get(ce),W=t.get(ue),Y=t.get(fe),u=t.get(pe);function X(){const e=A.options?.defaultLayout;if((e?.editors!=null&&e.editors.length>0||e?.layout?.editors!=null)&&((e.force??!1)||m.isNew(h.WORKSPACE)))return{layout:e.layout?.editors,filesToOpenOrCreate:e.editors?.map(i=>({viewColumn:i.viewColumn,fileUri:Pe.revive(i.uri),openOnlyIfExists:i.openOnlyIfExists,options:i.options}))};const{filesToOpenOrCreate:d,filesToDiff:o,filesToMerge:a}=A;if(d!=null||o!=null||a!=null)return{filesToOpenOrCreate:d,filesToDiff:o,filesToMerge:a}}function $(e,d){const o=e.options?.defaultLayout;if(o==null||!(o.force??!1)&&!d.isNew(h.WORKSPACE))return;const{views:a}=o;if(a!=null&&a.length>0)return a.map(i=>i.id)}function q(e,d){return ve(e.getWorkspace())?!1:!!(W.getValue("window.restoreWindows")==="preserve")||d===void 0}async function j(e,d){if(d!=null){const o=K(await x(d.filesToMerge,e,S));if(o.length===4&&E(o[0])&&E(o[1])&&E(o[2])&&E(o[3]))return[{editor:{input1:{resource:o[0].resource},input2:{resource:o[1].resource},base:{resource:o[2].resource},result:{resource:o[3].resource},options:{pinned:!0}}}];const a=K(await x(d.filesToDiff,e,S));if(a.length===2)return[{editor:{original:{resource:a[0].resource},modified:{resource:a[1].resource},options:{pinned:!0}}}];const i=[],f=await x(d.filesToOpenOrCreate,e,S);for(let s=0;s<f.length;s++){const w=f[s];w!=null&&i.push({editor:w,viewColumn:d.filesToOpenOrCreate?.[s].viewColumn})}return i}else if(G.getWorkbenchState()===we.EMPTY&&W.getValue("workbench.startupEditor")==="newUntitledFile")return R.mainPart.hasRestorableState?[]:[{editor:{resource:void 0}}];return[]}const T=X();T!=null&&S.info("Initial editor state",T);let n={layout:{editors:T?.layout},editor:{restoreEditors:q(G,T),editorsToOpen:j(Y,T)},views:{defaults:$(A,m),containerToRestore:{}}};function v(e){return l.getDefaultViewContainer(e)??l.getViewContainersByLocation(e)[0]}function J(){if(u.isVisible(g.SIDEBAR_PART)){let e;!A.isBuilt||p.startupKind===ye.ReloadedWindow||me?e=m.get(he.activeViewletSettingsKey,h.WORKSPACE,v(c.Sidebar)?.id):e=v(c.Sidebar)?.id,n.views.containerToRestore.sideBar=e}if(u.isVisible(g.PANEL_PART)){const e=m.get(Ae.activePanelSettingsKey,h.WORKSPACE,v(c.Panel)?.id);n.views.containerToRestore.panel=e}if(u.isVisible(g.AUXILIARYBAR_PART)){const e=m.get(Ce.activeViewSettingsKey,h.WORKSPACE,v(c.AuxiliaryBar)?.id);n.views.containerToRestore.auxiliaryBar=e}}J(),n=H(n),n.views.containerToRestore.sideBar==null&&u.setPartHidden(!0,g.SIDEBAR_PART),n.views.containerToRestore.panel==null&&u.setPartHidden(!0,g.PANEL_PART),n.views.containerToRestore.auxiliaryBar==null&&u.setPartHidden(!0,g.AUXILIARYBAR_PART);const B=document.createElement("div");B.style.display="none",document.body.append(B);for(const{id:e,role:d,classes:o,options:a,getPosition:i,onDidChangePosition:f}of[{id:g.TITLEBAR_PART,role:"none",classes:["titlebar"]},{id:g.BANNER_PART,role:"banner",classes:["banner"]},{id:g.ACTIVITYBAR_PART,role:"none",classes:["activitybar"],getPosition:()=>u.getSideBarPosition(),onDidChangePosition:u.onDidChangeSideBarPosition},{id:g.SIDEBAR_PART,role:"none",classes:["sidebar"],getPosition:()=>u.getSideBarPosition(),onDidChangePosition:u.onDidChangeSideBarPosition},{id:g.EDITOR_PART,role:"main",classes:["editor"],options:{restorePreviousState:n.editor.restoreEditors}},{id:g.PANEL_PART,role:"none",classes:["panel","basepanel"],getPosition:()=>u.getPanelPosition(),onDidChangePosition:u.onDidChangePanelPosition},{id:g.AUXILIARYBAR_PART,role:"none",classes:["auxiliarybar","basepanel"],getPosition:()=>u.getSideBarPosition()===O.LEFT?O.RIGHT:O.LEFT,onDidChangePosition:u.onDidChangeSideBarPosition},{id:g.STATUSBAR_PART,role:"status",classes:["statusbar"]}]){const s=u.getPart(e);if(s!=null){const w=Ie(e,d,o);if(s.create(w,a),Oe(w,s),s.layout(9999,9999,0,0),B.append(w),i!=null){let b=i();s.element.classList.add(V(b)),f?.(()=>{s.element.classList.remove(V(b)),b=i(),s.element.classList.add(V(b))})}}}const y=[],_=[];y.push((async()=>{P("code/willRestoreEditors"),await R.mainPart.whenReady,P("code/restoreEditors/editorGroupsReady"),n.layout?.editors!=null&&R.applyLayout(n.layout.editors);const e=await n.editor.editorsToOpen;P("code/restoreEditors/editorsToOpenResolved");let d;if(e.length>0){const o=R.getGroups(ge.GRID_APPEARANCE),a=new Map;for(const i of e){const f=o[(i.viewColumn??1)-1];let s=a.get(f.id);s==null&&(s=new Set,a.set(f.id,s)),s.add(i.editor)}d=Promise.all(Array.from(a).map(async([i,f])=>{try{await N.openEditors(Array.from(f),i,{validateTrust:!0})}catch(s){S.error(s)}}))}_.push(Promise.all([d?.finally(()=>P("code/restoreEditors/editorsOpened")),R.mainPart.whenRestored.finally(()=>P("code/restoreEditors/editorGroupsRestored"))]).finally(()=>{P("code/didRestoreEditors")}))})());const C=(async()=>{if(n.views.defaults!=null&&n.views.defaults.length>0){P("code/willOpenDefaultViews");const e=[],d=i=>{const f=l.getViewLocationById(i.id);if(f!==null){const s=l.getViewContainerByViewId(i.id);if(s!=null){i.order>=(e[f]?.order??0)&&(e[f]={id:s.id,order:i.order});const w=l.getViewContainerModel(s);return w.setCollapsed(i.id,!1),w.setVisible(i.id,!0),!0}}return!1},o=[...n.views.defaults].reverse().map((i,f)=>({id:i,order:f}));let a=o.length;for(;a>0;)a--,d(o[a])&&o.splice(a,1);if(o.length>0){await F.whenInstalledExtensionsRegistered();let i=o.length;for(;i>0;)i--,d(o[i])&&o.splice(i,1)}e[c.Sidebar]!=null&&(n.views.containerToRestore.sideBar=e[c.Sidebar].id),e[c.Panel]!=null&&(n.views.containerToRestore.panel=e[c.Panel].id),e[c.AuxiliaryBar]!=null&&(n.views.containerToRestore.auxiliaryBar=e[c.AuxiliaryBar].id),P("code/didOpenDefaultViews")}})();y.push(C),y.push((async()=>{if(await C,n.views.containerToRestore.sideBar==null)return;P("code/willRestoreViewlet"),await r.openPaneComposite(n.views.containerToRestore.sideBar,c.Sidebar)==null&&await r.openPaneComposite(v(c.Sidebar)?.id,c.Sidebar),P("code/didRestoreViewlet")})()),y.push((async()=>{if(await C,n.views.containerToRestore.panel==null)return;P("code/willRestorePanel"),await r.openPaneComposite(n.views.containerToRestore.panel,c.Panel)==null&&await r.openPaneComposite(v(c.Panel)?.id,c.Panel),P("code/didRestorePanel")})()),y.push((async()=>{if(await C,n.views.containerToRestore.auxiliaryBar==null)return;P("code/willRestoreAuxiliaryBar"),await r.openPaneComposite(n.views.containerToRestore.auxiliaryBar,c.AuxiliaryBar)==null&&await r.openPaneComposite(v(c.AuxiliaryBar)?.id,c.AuxiliaryBar),P("code/didRestoreAuxiliaryBar")})()),await k.settled(y),await k.settled(_)});function Me(t,r,l){return l!=null&&(H=typeof l=="boolean"?p=>({...p,editor:{...p.editor,restoreEditors:l}}):l),{...Se(r),...Q({isKeybindingConfigurationVisible:I,shouldUseGlobalPicker:I}),...Re({shouldUseGlobalKeybindings:I}),[L.toString()]:new M(D,[t],!1),[U.toString()]:new M(be,[t,I],!1)}}export{Ue as AbstractResourceEditorInput,He as AbstractTextResourceEditorInput,ze as ActivityService,Ne as ActivitybarPart,Fe as ConfirmResult,Ye as DomScrollableElement,Xe as EditorInput,$e as EditorInputCapabilities,qe as GroupOrientation,Ae as PanelPart,g as Parts,O as Position,je as RegisteredEditorPriority,he as SidebarPart,Je as SplitView,c as ViewContainerLocation,Qe as ViewPaneContainer,Me as default,I as isEditorPartVisible,Oe as renderPart};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-
|
|
2
|
-
import{D as P,E as xe,S as Pe,a as pe,T as N,k as ve,n as De,b as Ne,o as Ae,c as Re,C as _e,L as Oe,l as ke,_ as ie,R as oe,d as B,e as je,F as Le,U as Fe,t as Be,f as X,g as m,I as Ce,h as le,i as ge,j as he,m as Ie,p as Z,q as l,s as $e,u as Ve,v as Ge,w as te,x as Me,y as v,P as We,z as qe,A as He,B as Ue,G as Je,H as Ke,J as Te,K as Ye,M as Qe,N as W,O as Xe,Q as Ze,V as et,W as ze,X as tt,Y as nt,Z as it,$ as ot,a0 as rt,a1 as me,a2 as st,a3 as at,a4 as ct,a5 as dt,a6 as ut,a7 as Se,a8 as lt,a9 as p,aa as gt,ab as G,ac as ht,ad as ye,ae as mt,af as ft,ag as pt,ah as _t,ai as be,aj as kt,ak as Tt,al as St,am as yt,an as bt,ao as wt,ap as vt,aq as Lt}from"./index-D9lSNsHR.js";import{I as Ee}from"./workbenchThemeService.service-CDwCNsAv.js";import{t as $,g as Ct,S as It}from"./tokenClassificationRegistry-BP6RVP9u.js";class Mt extends P{constructor(e,t,n,o,i,s,r){super(),this._grammar=e,this._initialState=t,this._containsEmbeddedLanguages=n,this._createBackgroundTokenizer=o,this._backgroundTokenizerShouldOnlyVerifyTokens=i,this._reportTokenizationTime=s,this._reportSlowTokenization=r,this._seenLanguages=[],this._onDidEncounterLanguage=this._register(new xe),this.onDidEncounterLanguage=this._onDidEncounterLanguage.event}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._backgroundTokenizerShouldOnlyVerifyTokens()}getInitialState(){return this._initialState}tokenize(e,t,n){throw new Error("Not supported!")}createBackgroundTokenizer(e,t){if(this._createBackgroundTokenizer)return this._createBackgroundTokenizer(e,t)}tokenizeEncoded(e,t,n){const o=Math.random()*1e4<1,i=this._reportSlowTokenization||o,s=i?new Pe(!0):void 0,r=this._grammar.tokenizeLine2(e,n,500);if(i){const a=s.elapsed();(o||a>32)&&this._reportTokenizationTime(a,e.length,o)}if(r.stoppedEarly)return console.warn(`Time limit reached when tokenizing line: ${e.substring(0,100)}`),new pe(r.tokens,n);if(this._containsEmbeddedLanguages){const a=this._seenLanguages,u=r.tokens;for(let g=0,k=u.length>>>1;g<k;g++){const w=u[(g<<1)+1],y=N.getLanguageId(w);a[y]||(a[y]=!0,this._onDidEncounterLanguage.fire(y))}}let c;return n.equals(r.ruleStack)?c=n:c=r.ruleStack,new pe(r.tokens,c)}}class zt extends P{get backgroundTokenizerShouldOnlyVerifyTokens(){return this._actual.backgroundTokenizerShouldOnlyVerifyTokens}constructor(e,t,n,o){super(),this._encodedLanguageId=e,this._actual=t,this._maxTokenizationLineLength=o,this._register(ve(this._maxTokenizationLineLength)),this._register(n)}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,n){throw new Error("Not supported!")}tokenizeEncoded(e,t,n){return e.length>=this._maxTokenizationLineLength.get()?De(this._encodedLanguageId,n):this._actual.tokenizeEncoded(e,t,n)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}}const F=class F{static getChannel(e){return e.getChannel(F.CHANNEL_NAME)}static setChannel(e,t){e.setChannel(F.CHANNEL_NAME,t)}};F.CHANNEL_NAME="textMateWorkerHost";let re=F;class U{static fromMany(e){const t=e.map(n=>new U(n));return new Et(t)}constructor(e){this.transformation=e,this.idx=0,this.offset=0}transform(e){let t=this.transformation.replacements.at(this.idx);for(;t&&t.replaceRange.endExclusive<=e;)this.offset+=t.getLengthDelta(),this.idx++,t=this.transformation.replacements.at(this.idx);if(!(t&&t.replaceRange.start<=e))return e+this.offset}}class Et{constructor(e){this.transformers=e}transform(e){for(const t of this.transformers){const n=t.transform(e);if(n===void 0)return;e=n}return e}}const Y=class Y extends P{constructor(e,t,n,o,i,s){super(),this._model=e,this._worker=t,this._languageIdCodec=n,this._backgroundTokenizationStore=o,this._configurationService=i,this._maxTokenizationLineLength=s,this.controllerId=Y._id++,this._pendingChanges=[],this._states=new Ne,this._loggingEnabled=Ae("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(ve(this._loggingEnabled)),this._register(this._model.onDidChangeContent(a=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:ne(a.changes)}),this._worker.$acceptModelChanged(this.controllerId,a),this._pendingChanges.push(a)})),this._register(this._model.onDidChangeLanguage(a=>{const u=this._model.getLanguageId(),g=this._languageIdCodec.encodeLanguageId(u);this._worker.$acceptModelLanguageChanged(this.controllerId,u,g)}));const r=this._model.getLanguageId(),c=this._languageIdCodec.encodeLanguageId(r);this._worker.$acceptNewModel({uri:this._model.uri,versionId:this._model.getVersionId(),lines:this._model.getLinesContent(),EOL:this._model.getEOL(),languageId:r,encodedLanguageId:c,maxTokenizationLineLength:this._maxTokenizationLineLength.get(),controllerId:this.controllerId}),this._register(Re(a=>{const u=this._maxTokenizationLineLength.read(a);this._worker.$acceptMaxTokenizationLineLength(this.controllerId,u)}))}dispose(){super.dispose(),this._worker.$acceptRemovedModel(this.controllerId)}requestTokens(e,t){this._worker.$retokenize(this.controllerId,e,t)}async setTokensAndStates(e,t,n,o){if(this.controllerId!==e)return;let i=_e.deserialize(new Uint8Array(n));if(this._shouldLog&&console.log("received background tokenization result",{fileName:this._model.uri.fsPath.split("\\").pop(),updatedTokenLines:i.map(r=>r.getLineRange()).join(" & "),updatedStateLines:o.map(r=>new Oe(r.startLineNumber,r.startLineNumber+r.stateDeltas.length).toString()).join(" & ")}),this._shouldLog){const r=this._pendingChanges.filter(c=>c.versionId<=t).map(c=>c.changes).map(c=>ne(c)).join(" then ");console.log("Applying changes to local states",r)}for(;this._pendingChanges.length>0&&this._pendingChanges[0].versionId<=t;){const r=this._pendingChanges.shift();this._states.acceptChanges(r.changes)}if(this._pendingChanges.length>0){if(this._shouldLog){const a=this._pendingChanges.map(u=>u.changes).map(u=>ne(u)).join(" then ");console.log("Considering non-processed changes",a)}const r=U.fromMany(this._pendingChanges.map(a=>ke(a.changes))),c=new _e;for(const a of i)for(let u=a.startLineNumber;u<=a.endLineNumber;u++)r.transform(u-1)!==void 0&&c.add(u,a.getLineTokens(u));i=c.finalize();for(const a of this._pendingChanges)for(const u of a.changes)for(let g=0;g<i.length;g++)i[g].applyEdit(u.range,u.text)}const s=U.fromMany(this._pendingChanges.map(r=>ke(r.changes)));if(!this._applyStateStackDiffFn||!this._initialState){const{applyStateStackDiff:r,INITIAL:c}=await ie(()=>import("./main-BtCp5aH0.js").then(a=>a.m),__vite__mapDeps([0,1,2]),import.meta.url).then(a=>a.default??a);this._applyStateStackDiffFn=r,this._initialState=c}for(const r of o){let c=r.startLineNumber<=1?this._initialState:this._states.getEndState(r.startLineNumber-1);for(let a=0;a<r.stateDeltas.length;a++){const u=r.stateDeltas[a];let g;u?(g=this._applyStateStackDiffFn(c,u),this._states.setEndState(r.startLineNumber+a,g)):g=this._states.getEndState(r.startLineNumber+a);const k=s.transform(r.startLineNumber+a-1);k!==void 0&&this._backgroundTokenizationStore.setEndState(k+1,g),r.startLineNumber+a>=this._model.getLineCount()-1&&this._backgroundTokenizationStore.backgroundTokenizationFinished(),c=g}}this._backgroundTokenizationStore.setTokens(i)}get _shouldLog(){return this._loggingEnabled.get()}};Y._id=0;let se=Y;function ne(h){return h.map(e=>oe.lift(e.range).toString()+" => "+e.text).join(" & ")}var q,z;let ae=(z=class{constructor(e,t,n,o,i,s,r){this._reportTokenizationTime=e,this._shouldTokenizeAsync=t,this._extensionResourceLoaderService=n,this._configurationService=o,this._languageService=i,this._notificationService=s,this._telemetryService=r,this._workerProxyPromise=null,this._worker=null,this._workerProxy=null,this._workerTokenizerControllers=new Map,this._currentTheme=null,this._currentTokenColorMap=null,this._grammarDefinitions=[]}dispose(){this._disposeWorker()}createBackgroundTokenizer(e,t,n){if(!this._shouldTokenizeAsync()||e.isTooLargeForSyncing())return;const o=new B,i=this._getWorkerProxy().then(s=>{if(o.isDisposed||!s)return;const r={controller:void 0,worker:this._worker};return o.add(xt(e,()=>{const c=new se(e,s,this._languageService.languageIdCodec,t,this._configurationService,n);return r.controller=c,this._workerTokenizerControllers.set(c.controllerId,c),Be(()=>{r.controller=void 0,this._workerTokenizerControllers.delete(c.controllerId),c.dispose()})})),r});return{dispose(){o.dispose()},requestTokens:async(s,r)=>{const c=await i;c?.controller&&c.worker===this._worker&&c.controller.requestTokens(s,r)},reportMismatchingTokens:s=>{q._reportedMismatchingTokens||(q._reportedMismatchingTokens=!0,this._notificationService.error({message:"Async Tokenization Token Mismatch in line "+s,name:"Async Tokenization Token Mismatch"}),this._telemetryService.publicLog2("asyncTokenizationMismatchingTokens",{}))}}}setGrammarDefinitions(e){this._grammarDefinitions=e,this._disposeWorker()}acceptTheme(e,t){this._currentTheme=e,this._currentTokenColorMap=t,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap)}_getWorkerProxy(){return this._workerProxyPromise||(this._workerProxyPromise=this._createWorkerProxy()),this._workerProxyPromise}async _createWorkerProxy(){const e={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:new URL(""+new URL("onig-Du5pRr7Y.wasm",import.meta.url).href,import.meta.url).href},t=this._worker=je(Le.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),"TextMateWorker");return re.setChannel(t,{$readFile:async n=>{const o=Fe.revive(n);return this._extensionResourceLoaderService.readExtensionResource(o)},$setTokensAndStates:async(n,o,i,s)=>{const r=this._workerTokenizerControllers.get(n);r&&r.setTokensAndStates(n,o,i,s)},$reportTokenizationTime:(n,o,i,s,r)=>{this._reportTokenizationTime(n,o,i,s,r)}}),await t.proxy.$init(e),this._worker!==t?null:(this._workerProxy=t.proxy,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap),t.proxy)}_disposeWorker(){for(const e of this._workerTokenizerControllers.values())e.dispose();this._workerTokenizerControllers.clear(),this._worker&&(this._worker.dispose(),this._worker=null),this._workerProxy=null,this._workerProxyPromise=null}},q=z,z._reportedMismatchingTokens=!1,z);ae=q=X([m(2,Ce),m(3,le),m(4,ge),m(5,he),m(6,Ie)],ae);function xt(h,e){const t=new B,n=t.add(new B);function o(){h.isAttachedToEditor()?n.add(e()):n.clear()}return o(),t.add(h.onDidChangeAttached(()=>{o()})),t}class Pt{constructor(){this._scopeNameToLanguageRegistration=Object.create(null)}reset(){this._scopeNameToLanguageRegistration=Object.create(null)}register(e){this._scopeNameToLanguageRegistration[e.scopeName]=e}getGrammarDefinition(e){return this._scopeNameToLanguageRegistration[e]||null}}const H="No TM Grammar registered for this language.";class Dt extends P{constructor(e,t,n,o){super(),this._host=e,this._initialState=n.INITIAL,this._scopeRegistry=new Pt,this._injections={},this._injectedEmbeddedLanguages={},this._languageToScope=new Map,this._grammarRegistry=this._register(new n.Registry({onigLib:o,loadGrammar:async i=>{const s=this._scopeRegistry.getGrammarDefinition(i);if(!s)return this._host.logTrace(`No grammar found for scope ${i}`),null;const r=s.location;try{const c=await this._host.readFile(r);return n.parseRawGrammar(c,r.path)}catch(c){return this._host.logError(`Unable to load and parse grammar for scope ${i} from ${r}`,c),null}},getInjections:i=>{const s=i.split(".");let r=[];for(let c=1;c<=s.length;c++){const a=s.slice(0,c).join(".");r=[...r,...this._injections[a]||[]]}return r}}));for(const i of t){if(this._scopeRegistry.register(i),i.injectTo){for(const s of i.injectTo){let r=this._injections[s];r||(this._injections[s]=r=[]),r.push(i.scopeName)}if(i.embeddedLanguages)for(const s of i.injectTo){let r=this._injectedEmbeddedLanguages[s];r||(this._injectedEmbeddedLanguages[s]=r=[]),r.push(i.embeddedLanguages)}}i.language&&this._languageToScope.set(i.language,i.scopeName)}}has(e){return this._languageToScope.has(e)}setTheme(e,t){this._grammarRegistry.setTheme(e,t)}getColorMap(){return this._grammarRegistry.getColorMap()}async createGrammar(e,t){const n=this._languageToScope.get(e);if(typeof n!="string")throw new Error(H);const o=this._scopeRegistry.getGrammarDefinition(n);if(!o)throw new Error(H);const i=o.embeddedLanguages;if(this._injectedEmbeddedLanguages[n]){const c=this._injectedEmbeddedLanguages[n];for(const a of c)for(const u of Object.keys(a))i[u]=a[u]}const s=Object.keys(i).length>0;let r;try{r=await this._grammarRegistry.loadGrammarWithConfiguration(n,t,{embeddedLanguages:i,tokenTypes:o.tokenTypes,balancedBracketSelectors:o.balancedBracketSelectors,unbalancedBracketSelectors:o.unbalancedBracketSelectors})}catch(c){throw c.message&&c.message.startsWith("No grammar provided for")?new Error(H):c}return{languageId:e,grammar:r,initialState:this._initialState,containsEmbeddedLanguages:s,sourceExtensionId:o.sourceExtensionId}}}const M=Z.registerExtensionPoint({extensionPoint:"grammars",deps:[$e],jsonSchema:{description:l(13410,"Contributes textmate tokenizers."),type:"array",defaultSnippets:[{body:[{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}}],properties:{language:{description:l(13411,"Language identifier for which this syntax is contributed to."),type:"string"},scopeName:{description:l(13412,"Textmate scope name used by the tmLanguage file."),type:"string"},path:{description:l(13413,"Path of the tmLanguage file. The path is relative to the extension folder and typically starts with './syntaxes/'."),type:"string"},embeddedLanguages:{description:l(13414,"A map of scope name to language id if this grammar contains embedded languages."),type:"object"},tokenTypes:{description:l(13415,"A map of scope name to token types."),type:"object",additionalProperties:{enum:["string","comment","other"]}},injectTo:{description:l(13416,"List of language scope names to which this grammar is injected to."),type:"array",items:{type:"string"}},balancedBracketScopes:{description:l(13417,"Defines which scope names contain balanced brackets."),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:l(13418,"Defines which scope names do not contain balanced brackets."),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var A,E;let ce=(E=class extends P{constructor(e,t,n,o,i,s,r,c,a,u){super(),this._languageService=e,this._themeService=t,this._extensionResourceLoaderService=n,this._notificationService=o,this._logService=i,this._configurationService=s,this._progressService=r,this._environmentService=c,this._instantiationService=a,this._telemetryService=u,this._createdModes=[],this._encounteredLanguages=[],this._debugMode=!1,this._debugModePrintFunc=()=>{},this._grammarDefinitions=null,this._grammarFactory=null,this._tokenizersRegistrations=this._register(new B),this._currentTheme=null,this._currentTokenColorMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(ae,(g,k,w,y,T)=>this._reportTokenizationTime(g,k,w,y,!0,T),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=Ve(),this._styleElement.className="vscode-tokens-styles",M.setHandler(g=>this._handleGrammarsExtPoint(g)),this._updateTheme(this._themeService.getColorTheme(),!0),this._register(this._themeService.onDidColorThemeChange(()=>{this._updateTheme(this._themeService.getColorTheme(),!1)})),this._register(this._languageService.onDidRequestRichLanguageFeatures(g=>{this._createdModes.push(g)}))}getAsyncTokenizationEnabled(){return!!this._configurationService.getValue("editor.experimental.asyncTokenization")}getAsyncTokenizationVerification(){return!!this._configurationService.getValue("editor.experimental.asyncTokenizationVerification")}_handleGrammarsExtPoint(e){this._grammarDefinitions=null,this._grammarFactory&&(this._grammarFactory.dispose(),this._grammarFactory=null),this._tokenizersRegistrations.clear(),this._grammarDefinitions=[];for(const t of e){const n=t.value;for(const o of n){const i=this._validateGrammarDefinition(t,o);if(i&&(this._grammarDefinitions.push(i),i.language)){const s=new Ge(()=>this._createTokenizationSupport(i.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(te.registerFactory(i.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(const t of this._createdModes)te.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!Rt(e.description.extensionLocation,t,e.collector,this._languageService))return null;const n=Me(e.description.extensionLocation,t.path),o=Object.create(null);if(t.embeddedLanguages){const c=Object.keys(t.embeddedLanguages);for(let a=0,u=c.length;a<u;a++){const g=c[a],k=t.embeddedLanguages[g];typeof k=="string"&&this._languageService.isRegisteredLanguageId(k)&&(o[g]=this._languageService.languageIdCodec.encodeLanguageId(k))}}const i=Object.create(null);if(t.tokenTypes){const c=Object.keys(t.tokenTypes);for(const a of c)switch(t.tokenTypes[a]){case"string":i[a]=v.String;break;case"other":i[a]=v.Other;break;case"comment":i[a]=v.Comment;break}}const s=t.language&&this._languageService.isRegisteredLanguageId(t.language)?t.language:void 0;function r(c,a){return!Array.isArray(c)||!c.every(u=>typeof u=="string")?a:c}return{location:n,language:s,scopeName:t.scopeName,embeddedLanguages:o,tokenTypes:i,injectTo:t.injectTo,balancedBracketSelectors:r(t.balancedBracketScopes,["*"]),unbalancedBracketSelectors:r(t.unbalancedBracketScopes,[]),sourceExtensionId:e.description.id}}startDebugMode(e,t){if(this._debugMode){this._notificationService.error(l(13399,"Already Logging."));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:We.Notification,buttons:[l(13400,"Stop")]},n=>(n.report({message:l(13401,"Preparing to log TM Grammar parsing. Press Stop when finished.")}),this._getVSCodeOniguruma().then(o=>(o.setDefaultDebugCall(!0),n.report({message:l(13402,"Now logging TM Grammar parsing. Press Stop when finished.")}),new Promise((i,s)=>{})))),n=>{this._getVSCodeOniguruma().then(o=>{this._debugModePrintFunc=()=>{},this._debugMode=!1,o.setDefaultDebugCall(!1),t()})})}_canCreateGrammarFactory(){return!!this._grammarDefinitions}async _getOrCreateGrammarFactory(){if(this._grammarFactory)return this._grammarFactory;const[e,t]=await Promise.all([ie(()=>import("./main-BtCp5aH0.js").then(o=>o.m),__vite__mapDeps([0,1,2]),import.meta.url).then(o=>o.default??o),this._getVSCodeOniguruma()]),n=Promise.resolve({createOnigScanner:o=>t.createOnigScanner(o),createOnigString:o=>t.createOnigString(o)});return this._grammarFactory?this._grammarFactory:(this._grammarFactory=new Dt({logTrace:o=>this._logService.trace(o),logError:(o,i)=>this._logService.error(o,i),readFile:o=>this._extensionResourceLoaderService.readExtensionResource(o)},this._grammarDefinitions||[],e,n),this._updateTheme(this._themeService.getColorTheme(),!0),this._grammarFactory)}async _createTokenizationSupport(e){if(!this._languageService.isRegisteredLanguageId(e)||!this._canCreateGrammarFactory())return null;try{const t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;const n=this._languageService.languageIdCodec.encodeLanguageId(e),o=await t.createGrammar(e,n);if(!o.grammar)return null;const i=Ot("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new B,r=s.add(new Mt(o.grammar,o.initialState,o.containsEmbeddedLanguages,(c,a)=>this._threadedBackgroundTokenizerFactory.createBackgroundTokenizer(c,a,i),()=>this.getAsyncTokenizationVerification(),(c,a,u)=>{this._reportTokenizationTime(c,e,o.sourceExtensionId,a,!1,u)},!0));return s.add(r.onDidEncounterLanguage(c=>{if(!this._encounteredLanguages[c]){const a=this._languageService.languageIdCodec.decodeLanguageId(c);this._encounteredLanguages[c]=!0,this._languageService.requestBasicLanguageFeatures(a)}})),new zt(n,r,s,i)}catch(t){return t.message&&t.message===H||qe(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&At(this._currentTheme.settings,e.tokenColors)&&He(this._currentTokenColorMap,e.tokenColorMap))return;this._currentTheme={name:e.label,settings:e.tokenColors},this._currentTokenColorMap=e.tokenColorMap,this._grammarFactory?.setTheme(this._currentTheme,this._currentTokenColorMap);const n=Nt(this._currentTokenColorMap),o=Ue(n);this._styleElement.textContent=o,te.setColorMap(n),this._currentTheme&&this._currentTokenColorMap&&this._threadedBackgroundTokenizerFactory.acceptTheme(this._currentTheme,this._currentTokenColorMap)}async createTokenizer(e){if(!this._languageService.isRegisteredLanguageId(e))return null;const t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;const n=this._languageService.languageIdCodec.encodeLanguageId(e),{grammar:o}=await t.createGrammar(e,n);return o}_getVSCodeOniguruma(){return this._vscodeOniguruma||(this._vscodeOniguruma=(async()=>{const[e,t]=await Promise.all([ie(()=>import("./main-BnV5RNdt.js").then(n=>n.m),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>n.default??n),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:n=>{this._debugModePrintFunc(n)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Je?await(await fetch(new URL(""+new URL("onig-Du5pRr7Y.wasm",import.meta.url).href,import.meta.url).href)).arrayBuffer():await fetch(Le.asBrowserUri(`${Ke}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,n,o,i,s){const r=i?"async":"sync";A.reportTokenizationTimeCounter[r]>50||(A.reportTokenizationTimeCounter[r]===0&&setTimeout(()=>{A.reportTokenizationTimeCounter[r]=0},1e3*60*60),A.reportTokenizationTimeCounter[r]++,this._telemetryService.publicLog2("editor.tokenizedLine",{timeMs:e,languageId:t,lineLength:o,fromWorker:i,sourceExtensionId:n,isRandomSample:s,tokenizationSetting:this.getAsyncTokenizationEnabled()?this.getAsyncTokenizationVerification()?2:1:0}))}},A=E,E.reportTokenizationTimeCounter={sync:0,async:0},E);ce=A=X([m(0,ge),m(1,Ee),m(2,Ce),m(3,he),m(4,Xe),m(5,le),m(6,Ze),m(7,et),m(8,ze),m(9,Ie)],ce);function Nt(h){const e=[null];for(let t=1,n=h.length;t<n;t++)e[t]=W.fromHex(h[t]);return e}function At(h,e){if(!e||!h||e.length!==h.length)return!1;for(let t=e.length-1;t>=0;t--){const n=e[t],o=h[t];if(n.scope!==o.scope)return!1;const i=n.settings,s=o.settings;if(i&&s){if(i.fontStyle!==s.fontStyle||i.foreground!==s.foreground||i.background!==s.background)return!1}else if(!i||!s)return!1}return!0}function Rt(h,e,t,n){if(e.language&&(typeof e.language!="string"||!n.isRegisteredLanguageId(e.language)))return t.error(l(13403,"Unknown language in `contributes.{0}.language`. Provided value: {1}",M.name,String(e.language))),!1;if(!e.scopeName||typeof e.scopeName!="string")return t.error(l(13404,"Expected string in `contributes.{0}.scopeName`. Provided value: {1}",M.name,String(e.scopeName))),!1;if(!e.path||typeof e.path!="string")return t.error(l(13405,"Expected string in `contributes.{0}.path`. Provided value: {1}",M.name,String(e.path))),!1;if(e.injectTo&&(!Array.isArray(e.injectTo)||e.injectTo.some(i=>typeof i!="string")))return t.error(l(13406,"Invalid value in `contributes.{0}.injectTo`. Must be an array of language scope names. Provided value: {1}",M.name,JSON.stringify(e.injectTo))),!1;if(e.embeddedLanguages&&!Te(e.embeddedLanguages))return t.error(l(13407,"Invalid value in `contributes.{0}.embeddedLanguages`. Must be an object map from scope name to language. Provided value: {1}",M.name,JSON.stringify(e.embeddedLanguages))),!1;if(e.tokenTypes&&!Te(e.tokenTypes))return t.error(l(13408,"Invalid value in `contributes.{0}.tokenTypes`. Must be an object map from scope name to token type. Provided value: {1}",M.name,JSON.stringify(e.tokenTypes))),!1;const o=Me(h,e.path);return Ye(o,h)||t.warn(l(13409,"Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.",M.name,o.path,h.path)),!0}function Ot(h,e,t,n){return Qe(o=>n.onDidChangeConfiguration(i=>{i.affectsConfiguration(h,{overrideIdentifier:e})&&o(i)}),()=>n.getValue(h,{overrideIdentifier:e})??t)}const I=Ct(),jt=Z.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:l(13606,"Contributes semantic token types."),type:"array",items:{type:"object",properties:{id:{type:"string",description:l(13607,"The identifier of the semantic token type"),pattern:$,patternErrorMessage:l(13608,"Identifiers should be in the form letterOrDigit[_-letterOrDigit]*")},superType:{type:"string",description:l(13609,"The super type of the semantic token type"),pattern:$,patternErrorMessage:l(13610,"Super types should be in the form letterOrDigit[_-letterOrDigit]*")},description:{type:"string",description:l(13611,"The description of the semantic token type")}}}}}),Ft=Z.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:l(13612,"Contributes semantic token modifiers."),type:"array",items:{type:"object",properties:{id:{type:"string",description:l(13613,"The identifier of the semantic token modifier"),pattern:$,patternErrorMessage:l(13614,"Identifiers should be in the form letterOrDigit[_-letterOrDigit]*")},description:{type:"string",description:l(13615,"The description of the semantic token modifier")}}}}}),Bt=Z.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:l(13616,"Contributes semantic token scope maps."),type:"array",items:{type:"object",properties:{language:{description:l(13617,"Lists the languge for which the defaults are."),type:"string"},scopes:{description:l(13618,"Maps a semantic token (described by semantic token selector) to one or more textMate scopes used to represent that token."),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}});class $t{constructor(){function e(t,n,o){if(typeof t.id!="string"||t.id.length===0)return o.error(l(13619,"'configuration.{0}.id' must be defined and can not be empty",n)),!1;if(!t.id.match($))return o.error(l(13620,"'configuration.{0}.id' must follow the pattern letterOrDigit[-_letterOrDigit]*",n)),!1;const i=t.superType;return i&&!i.match($)?(o.error(l(13621,"'configuration.{0}.superType' must follow the pattern letterOrDigit[-_letterOrDigit]*",n)),!1):typeof t.description!="string"||t.id.length===0?(o.error(l(13622,"'configuration.{0}.description' must be defined and can not be empty",n)),!1):!0}jt.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13623,"'configuration.semanticTokenType' must be an array"));return}for(const r of i)e(r,"semanticTokenType",s)&&I.registerTokenType(r.id,r.description,r.superType)}for(const o of n.removed){const i=o.value;for(const s of i)I.deregisterTokenType(s.id)}}),Ft.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13624,"'configuration.semanticTokenModifier' must be an array"));return}for(const r of i)e(r,"semanticTokenModifier",s)&&I.registerTokenModifier(r.id,r.description)}for(const o of n.removed){const i=o.value;for(const s of i)I.deregisterTokenModifier(s.id)}}),Bt.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13625,"'configuration.semanticTokenScopes' must be an array"));return}for(const r of i){if(r.language&&typeof r.language!="string"){s.error(l(13626,"'configuration.semanticTokenScopes.language' must be a string"));continue}if(!r.scopes||typeof r.scopes!="object"){s.error(l(13627,"'configuration.semanticTokenScopes.scopes' must be defined as an object"));continue}for(const c in r.scopes){const a=r.scopes[c];if(!Array.isArray(a)||a.some(u=>typeof u!="string")){s.error(l(13628,"'configuration.semanticTokenScopes.scopes' values must be an array of strings"));continue}try{const u=I.parseTokenSelector(c,r.language);I.registerTokenStyleDefault(u,{scopesToProbe:a.map(g=>g.split(" "))})}catch{s.error(l(13629,"configuration.semanticTokenScopes.scopes': Problems parsing selector {0}.",c))}}}}for(const o of n.removed){const i=o.value;for(const s of i)for(const r in s.scopes){const c=s.scopes[r];try{const a=I.parseTokenSelector(r,s.language);I.registerTokenStyleDefault(a,{scopesToProbe:c.map(u=>u.split(" "))})}catch{}}}})}}var R;let J=(R=class{constructor(e){this.instantiationService=e,this.instantiationService.createInstance($t)}},R.ID="workbench.contrib.tokenClassificationExtensionPoint",R);J=X([m(0,ze)],J);tt(J.ID,J,nt.BlockStartup);const Vt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Gt(h,e,t=!0){for(let n=e.length-1;n>=0;n--){const o=e.slice(0,n),i=e[n],s=Wt(h,i,o,t);if(s)return s}return null}function Wt(h,e,t,n){let o=null;for(let i=h.tokenColors.length-1;i>=0;i--){const s=h.tokenColors[i];if(n&&!s.settings.foreground)continue;let r;if(typeof s.scope=="string")r=s.scope.split(/,/).map(c=>c.trim());else if(Array.isArray(s.scope))r=s.scope;else continue;for(let c=0,a=r.length;c<a;c++){const u=r[c],g=new K(u,s.settings);g.matches(e,t)&&g.isMoreSpecific(o)&&(o=g)}}return o}class K{constructor(e,t){this.rawSelector=e,this.settings=t;const n=this.rawSelector.split(/ /);this.scope=n[n.length-1],this.parentScopes=n.slice(0,n.length-1)}matches(e,t){return K._matches(this.scope,this.parentScopes,e,t)}static _cmp(e,t){if(e===null&&t===null)return 0;if(e===null)return-1;if(t===null)return 1;if(e.scope.length!==t.scope.length)return e.scope.length-t.scope.length;const n=e.parentScopes.length,o=t.parentScopes.length;if(n!==o)return n-o;for(let i=0;i<n;i++){const s=e.parentScopes[i].length,r=t.parentScopes[i].length;if(s!==r)return s-r}return 0}isMoreSpecific(e){return K._cmp(this,e)>0}static _matchesOne(e,t){const n=e+".";return e===t||t.substring(0,n.length)===n}static _matches(e,t,n,o){if(!this._matchesOne(e,n))return!1;let i=t.length-1,s=o.length-1;for(;i>=0&&s>=0;)this._matchesOne(t[i],o[s])&&i--,s--;return i===-1}}var de;it(Vt);const d=lt;var x;let O=(x=class extends P{static get(e){return e.getContribution(de.ID)}constructor(e,t,n,o,i,s,r){super(),this._editor=e,this._textMateService=t,this._themeService=o,this._languageService=n,this._notificationService=i,this._configurationService=s,this._languageFeaturesService=r,this._widget=null,this._register(this._editor.onDidChangeModel(c=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(c=>this.stop())),this._register(this._editor.onKeyUp(c=>c.keyCode===ot.Escape&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&this._editor.getModel().uri.scheme!==rt.vscodeNotebookCell&&(this._widget=new ue(this._editor,this._textMateService,this._languageService,this._themeService,this._notificationService,this._configurationService,this._languageFeaturesService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}toggle(){this._widget?this.stop():this.launch()}},de=x,x.ID="editor.contrib.inspectEditorTokens",x);O=de=X([m(1,me),m(2,ge),m(3,Ee),m(4,he),m(5,le),m(6,st)],O);class qt extends kt{constructor(){super({id:"editor.action.inspectTMScopes",label:Tt(5554,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(e,t){O.get(t)?.toggle()}}function we(h){h.length>40&&(h=h.substr(0,20)+"…"+h.substr(h.length-20));let e="";for(let t=0,n=h.length;t<n;t++){const o=h.charCodeAt(t);switch(o){case be.Tab:e+="→";break;case be.Space:e+="·";break;default:e+=String.fromCharCode(o)}}return e}const Q=class Q extends P{constructor(e,t,n,o,i,s,r){super(),this.allowEditorOverflow=!0,this._isDisposed=!1,this._editor=e,this._languageService=n,this._themeService=o,this._textMateService=t,this._notificationService=i,this._configurationService=s,this._languageFeaturesService=r,this._model=this._editor.getModel(),this._domNode=at("div"),this._domNode.className="token-inspect-widget",this._currentRequestCancellationTokenSource=new ct,this._beginCompute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(c=>this._beginCompute(this._editor.getPosition()))),this._register(o.onDidColorThemeChange(c=>this._beginCompute(this._editor.getPosition()))),this._register(s.onDidChangeConfiguration(c=>c.affectsConfiguration("editor.semanticHighlighting.enabled")&&this._beginCompute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._isDisposed=!0,this._editor.removeContentWidget(this),this._currentRequestCancellationTokenSource.cancel(),super.dispose()}getId(){return Q._ID}_beginCompute(e){const t=this._textMateService.createTokenizer(this._model.getLanguageId()),n=this._computeSemanticTokens(e),o=this._model.tokenization.tokens.get(),i=o instanceof _t?o:void 0;dt(this._domNode),this._domNode.appendChild(document.createTextNode(l(5555,"Loading..."))),Promise.all([t,n]).then(([s,r])=>{if(this._isDisposed)return;const c=i?.tree.get();this._compute(s,r,c,e),this._domNode.style.maxWidth=`${Math.max(this._editor.getLayoutInfo().width*.66,500)}px`,this._editor.layoutContentWidget(this)},s=>{this._notificationService.warn(s),setTimeout(()=>{O.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){const e=this._configurationService.getValue(ut,{overrideIdentifier:this._model.getLanguageId(),resource:this._model.uri})?.enabled;return typeof e=="boolean"?e:this._themeService.getColorTheme().semanticHighlighting}_compute(e,t,n,o){const i=e&&this._getTokensAtPosition(e,o),s=t&&this._getSemanticTokenAtPosition(t,o),r=n&&this._getTreeSitterTokenAtPosition(n,o);if(!i&&!s&&!r){Se(this._domNode,"No grammar or semantic tokens available.");return}const c=i?.metadata,a=s?.metadata,u=s&&we(this._model.getValueInRange(s.range)),g=i&&we(this._model.getLineContent(o.lineNumber).substring(i.token.startIndex,i.token.endIndex)),k=u||g||"";if(Se(this._domNode,d("h2.tiw-token",void 0,k,d("span.tiw-token-length",void 0,`${k.length} ${k.length===1?"char":"chars"}`))),p(this._domNode,d("hr.tiw-metadata-separator",{style:"clear:both"})),p(this._domNode,d("table.tiw-metadata-table",void 0,d("tbody",void 0,d("tr",void 0,d("td.tiw-metadata-key",void 0,"language"),d("td.tiw-metadata-value",void 0,c?.languageId||"")),d("tr",void 0,d("td.tiw-metadata-key",void 0,"standard token type"),d("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||v.Other))),...this._formatMetadata(a,c)))),s){p(this._domNode,d("hr.tiw-metadata-separator"));const w=p(this._domNode,d("table.tiw-metadata-table",void 0)),y=p(w,d("tbody",void 0,d("tr",void 0,d("td.tiw-metadata-key",void 0,"semantic token type"),d("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&p(y,d("tr",void 0,d("td.tiw-metadata-key",void 0,"modifiers"),d("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){const T=["foreground","bold","italic","underline","strikethrough"],S={},b=new Array;for(const f of T)if(s.metadata[f]!==void 0){const _=s.definitions[f],L=this._renderTokenStyleDefinition(_,f),C=L.map(V=>gt(V)?V.outerHTML:V).join();let j=S[C];j||(S[C]=j=[],b.push([L,C])),j.push(f)}for(const[f,_]of b)p(y,d("tr",void 0,d("td.tiw-metadata-key",void 0,S[_].join(", ")),d("td.tiw-metadata-value",void 0,...f)))}}if(i){const w=this._themeService.getColorTheme();p(this._domNode,d("hr.tiw-metadata-separator"));const y=p(this._domNode,d("table.tiw-metadata-table")),T=p(y,d("tbody"));g&&g!==k&&p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"textmate token"),d("td.tiw-metadata-value",void 0,`${g} (${g.length})`)));const S=new Array;for(let _=i.token.scopes.length-1;_>=0;_--)S.push(i.token.scopes[_]),_>0&&S.push(d("br"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"textmate scopes"),d("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...S)));const b=Gt(w,i.token.scopes,!1),f=s?.metadata?.foreground;if(b){if(f!==i.metadata.foreground){let _=d("code.tiw-theme-selector",void 0,b.rawSelector,d("br"),JSON.stringify(b.settings,null," "));f&&(_=d("s",void 0,_)),p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,_)))}}else f||p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,"No theme selector")))}if(r){const w=r[r.length-1];p(this._domNode,d("hr.tiw-metadata-separator"));const y=p(this._domNode,d("table.tiw-metadata-table")),T=p(y,d("tbody"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,`tree-sitter token ${w.id}`),d("td.tiw-metadata-value",void 0,`${w.text}`)));const S=new Array;let b=r.length-1,f=r[b];for(;f.parent||b>0;)S.push(f.type),f=f.parent??r[--b],f&&S.push(d("br"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"tree-sitter tree"),d("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...S)));const L=this._model.tokenization.tokens.get().tokenizationImpl.get()?.captureAtPosition(o.lineNumber,o.column);L&&L.length>0&&p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,L.map(C=>C.name).join(" "))))}}_formatMetadata(e,t){const n=new Array;function o(a){const u=e?.[a]||t?.[a];if(u!==void 0){const g=e?.[a]?"tiw-metadata-semantic":"";n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,a),d(`td.tiw-metadata-value.${g}`,void 0,u)))}return u}const i=o("foreground"),s=o("background");if(i&&s){const a=W.fromHex(s),u=W.fromHex(i);a.isOpaque()?n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"contrast ratio"),d("td.tiw-metadata-value",void 0,a.getContrastRatio(u.makeOpaque(a)).toFixed(2)))):n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),d("td.tiw-metadata-value")))}const r=new Array;function c(a){let u;e&&e[a]?u=d("span.tiw-metadata-semantic",void 0,a):t&&t[a]&&(u=a),u&&(r.length&&r.push(" "),r.push(u))}return c("bold"),c("italic"),c("underline"),c("strikethrough"),r.length&&n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"font style"),d("td.tiw-metadata-value",void 0,...r))),n}_decodeMetadata(e){const t=this._themeService.getColorTheme().tokenColorMap,n=N.getLanguageId(e),o=N.getTokenType(e),i=N.getFontStyle(e),s=N.getForeground(e),r=N.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(n),tokenType:o,bold:i&G.Bold?!0:void 0,italic:i&G.Italic?!0:void 0,underline:i&G.Underline?!0:void 0,strikethrough:i&G.Strikethrough?!0:void 0,foreground:t[s],background:t[r]}}_tokenTypeToString(e){switch(e){case v.Other:return"Other";case v.Comment:return"Comment";case v.String:return"String";case v.RegEx:return"RegEx";default:return"??"}}_getTokensAtPosition(e,t){const n=t.lineNumber,o=this._getStateBeforeLine(e,n),i=e.tokenizeLine(this._model.getLineContent(n),o),s=e.tokenizeLine2(this._model.getLineContent(n),o);let r=0;for(let a=i.tokens.length-1;a>=0;a--){const u=i.tokens[a];if(t.column-1>=u.startIndex){r=a;break}}let c=0;for(let a=s.tokens.length>>>1;a>=0;a--)if(t.column-1>=s.tokens[a<<1]){c=a;break}return{token:i.tokens[r],metadata:this._decodeMetadata(s.tokens[(c<<1)+1])}}_getStateBeforeLine(e,t){let n=null;for(let o=1;o<t;o++)n=e.tokenizeLine(this._model.getLineContent(o),n).ruleStack;return n}isSemanticTokens(e){return e&&e.data}async _computeSemanticTokens(e){if(!this._isSemanticColoringEnabled())return null;const t=this._languageFeaturesService.documentSemanticTokensProvider.ordered(this._model);if(t.length){const o=t[0],i=await Promise.resolve(o.provideDocumentSemanticTokens(this._model,null,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(i))return{tokens:i,legend:o.getLegend()}}const n=this._languageFeaturesService.documentRangeSemanticTokensProvider.ordered(this._model);if(n.length){const o=n[0],i=e.lineNumber,s=new oe(i,1,i,this._model.getLineMaxColumn(i)),r=await Promise.resolve(o.provideDocumentRangeSemanticTokens(this._model,s,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(r))return{tokens:r,legend:o.getLegend()}}return null}_getSemanticTokenAtPosition(e,t){const n=e.tokens.data,o=this._model.getLanguageId();let i=0,s=0;const r=t.lineNumber-1,c=t.column-1;for(let a=0;a<n.length;a+=5){const u=n[a],g=n[a+1],k=n[a+2],w=n[a+3],y=n[a+4],T=i+u,S=u===0?s+g:g;if(r===T&&S<=c&&c<S+k){const b=e.legend.tokenTypes[w]||"not in legend (ignored)",f=[];let _=y;for(let ee=0;_>0&&ee<e.legend.tokenModifiers.length;ee++)_&1&&f.push(e.legend.tokenModifiers[ee]),_=_>>1;_>0&&f.push("not in legend (ignored)");const L=new oe(T+1,S+1,T+1,S+1+k),C={},j=this._themeService.getColorTheme().tokenColorMap,D=this._themeService.getColorTheme().getTokenStyleMetadata(b,f,o,!0,C);let fe;return D&&(fe={languageId:void 0,tokenType:v.Other,bold:D?.bold,italic:D?.italic,underline:D?.underline,strikethrough:D?.strikethrough,foreground:j[D?.foreground||ht.None],background:void 0}),{type:b,modifiers:f,range:L,metadata:fe,definitions:C}}i=T,s=S}return null}_walkTreeforPosition(e,t){const n=this._model.getOffsetAt(t);e.gotoFirstChild();let o=!1,i=null;do e.currentNode.startIndex<=n&&n<e.currentNode.endIndex?(o=!0,i=e.currentNode):o=!1;while(o?e.gotoFirstChild():e.gotoNextSibling());return i}_getTreeSitterTokenAtPosition(e,t){const n=[];let o=e?.tree.get();for(;o;){const i=o.walk(),s=this._walkTreeforPosition(i,t);i.delete(),s?(n.push(s),e=e?.getInjectionTrees(s.startIndex,e.languageId),o=e?.tree.get()):o=void 0}return n.length>0?n:null}_renderTokenStyleDefinition(e,t){const n=new Array;if(e===void 0)return n;const o=this._themeService.getColorTheme();if(Array.isArray(e)){const i={};o.resolveScopes(e,i);const s=i[t];if(s&&i.scope){const r=d("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(const a of c)r.appendChild(d("li.tiw-metadata-value.tiw-metadata-scopes",void 0,a));return n.push(i.scope.join(" "),r,d("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null," "))),n}return n}else if(It.is(e)){const i=o.getTokenStylingRuleScope(e);return i==="setting"?(n.push(`User settings: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),n):(i==="theme"&&n.push(`Color theme: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),n)}else{const i=o.resolveTokenStyleValue(e);return n.push(`Default: ${i?this._renderStyleProperty(i,t):""}`),n}}_renderStyleProperty(e,t){return t==="foreground"?e.foreground?W.Format.CSS.formatHexA(e.foreground,!0):"":e[t]!==void 0?String(e[t]):""}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[ye.BELOW,ye.ABOVE]}}};Q._ID="editor.contrib.inspectEditorTokensWidget";let ue=Q;mt(O.ID,O,ft.Lazy);pt(qt);bt(async h=>{h.get(wt).when(vt.Ready).then(()=>{Lt.get(me)})});function Kt(){return{...yt(),[me.toString()]:new St(ce,[],!1)}}export{me as ITextMateTokenizationService,Kt as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./main-CuAxLb8K.js","./index-GPQU4rv1.js","./index-DA6HUF5p.css","./main-kYU-Ynn2.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{D as P,E as xe,S as Pe,a as pe,T as N,k as ve,n as De,b as Ne,o as Ae,c as Re,C as _e,L as Oe,l as ke,_ as ie,R as oe,d as B,e as je,F as Le,U as Fe,t as Be,f as X,g as m,I as Ce,h as le,i as ge,j as he,m as Ie,p as Z,q as $e,s as l,u as Ve,v as Ge,w as te,x as Me,y as v,P as We,z as qe,A as He,B as Ue,G as Je,H as Ke,J as Te,K as Ye,M as Qe,N as W,O as Xe,Q as Ze,V as et,W as ze,X as tt,Y as nt,Z as it,$ as ot,a0 as rt,a1 as me,a2 as st,a3 as at,a4 as ct,a5 as dt,a6 as ut,a7 as Se,a8 as p,a9 as lt,aa as G,ab as gt,ac as ye,ad as ht,ae as mt,af as ft,ag as pt,ah as be,ai as _t,aj as kt,ak as Tt,al as St,am as yt,an as bt,ao as wt,ap as vt,aq as Lt}from"./index-GPQU4rv1.js";import{I as Ee}from"./workbenchThemeService.service-DlXrxy4t.js";import{t as $,g as Ct,S as It}from"./tokenClassificationRegistry-BA6yuF5K.js";class Mt extends P{constructor(e,t,n,o,i,s,r){super(),this._grammar=e,this._initialState=t,this._containsEmbeddedLanguages=n,this._createBackgroundTokenizer=o,this._backgroundTokenizerShouldOnlyVerifyTokens=i,this._reportTokenizationTime=s,this._reportSlowTokenization=r,this._seenLanguages=[],this._onDidEncounterLanguage=this._register(new xe),this.onDidEncounterLanguage=this._onDidEncounterLanguage.event}get backgroundTokenizerShouldOnlyVerifyTokens(){return this._backgroundTokenizerShouldOnlyVerifyTokens()}getInitialState(){return this._initialState}tokenize(e,t,n){throw new Error("Not supported!")}createBackgroundTokenizer(e,t){if(this._createBackgroundTokenizer)return this._createBackgroundTokenizer(e,t)}tokenizeEncoded(e,t,n){const o=Math.random()*1e4<1,i=this._reportSlowTokenization||o,s=i?new Pe(!0):void 0,r=this._grammar.tokenizeLine2(e,n,500);if(i){const a=s.elapsed();(o||a>32)&&this._reportTokenizationTime(a,e.length,o)}if(r.stoppedEarly)return console.warn(`Time limit reached when tokenizing line: ${e.substring(0,100)}`),new pe(r.tokens,n);if(this._containsEmbeddedLanguages){const a=this._seenLanguages,u=r.tokens;for(let g=0,k=u.length>>>1;g<k;g++){const w=u[(g<<1)+1],y=N.getLanguageId(w);a[y]||(a[y]=!0,this._onDidEncounterLanguage.fire(y))}}let c;return n.equals(r.ruleStack)?c=n:c=r.ruleStack,new pe(r.tokens,c)}}class zt extends P{get backgroundTokenizerShouldOnlyVerifyTokens(){return this._actual.backgroundTokenizerShouldOnlyVerifyTokens}constructor(e,t,n,o){super(),this._encodedLanguageId=e,this._actual=t,this._maxTokenizationLineLength=o,this._register(ve(this._maxTokenizationLineLength)),this._register(n)}getInitialState(){return this._actual.getInitialState()}tokenize(e,t,n){throw new Error("Not supported!")}tokenizeEncoded(e,t,n){return e.length>=this._maxTokenizationLineLength.get()?De(this._encodedLanguageId,n):this._actual.tokenizeEncoded(e,t,n)}createBackgroundTokenizer(e,t){if(this._actual.createBackgroundTokenizer)return this._actual.createBackgroundTokenizer(e,t)}}const F=class F{static getChannel(e){return e.getChannel(F.CHANNEL_NAME)}static setChannel(e,t){e.setChannel(F.CHANNEL_NAME,t)}};F.CHANNEL_NAME="textMateWorkerHost";let re=F;class U{static fromMany(e){const t=e.map(n=>new U(n));return new Et(t)}constructor(e){this.transformation=e,this.idx=0,this.offset=0}transform(e){let t=this.transformation.replacements.at(this.idx);for(;t&&t.replaceRange.endExclusive<=e;)this.offset+=t.getLengthDelta(),this.idx++,t=this.transformation.replacements.at(this.idx);if(!(t&&t.replaceRange.start<=e))return e+this.offset}}class Et{constructor(e){this.transformers=e}transform(e){for(const t of this.transformers){const n=t.transform(e);if(n===void 0)return;e=n}return e}}const Y=class Y extends P{constructor(e,t,n,o,i,s){super(),this._model=e,this._worker=t,this._languageIdCodec=n,this._backgroundTokenizationStore=o,this._configurationService=i,this._maxTokenizationLineLength=s,this.controllerId=Y._id++,this._pendingChanges=[],this._states=new Ne,this._loggingEnabled=Ae("editor.experimental.asyncTokenizationLogging",!1,this._configurationService),this._register(ve(this._loggingEnabled)),this._register(this._model.onDidChangeContent(a=>{this._shouldLog&&console.log("model change",{fileName:this._model.uri.fsPath.split("\\").pop(),changes:ne(a.changes)}),this._worker.$acceptModelChanged(this.controllerId,a),this._pendingChanges.push(a)})),this._register(this._model.onDidChangeLanguage(a=>{const u=this._model.getLanguageId(),g=this._languageIdCodec.encodeLanguageId(u);this._worker.$acceptModelLanguageChanged(this.controllerId,u,g)}));const r=this._model.getLanguageId(),c=this._languageIdCodec.encodeLanguageId(r);this._worker.$acceptNewModel({uri:this._model.uri,versionId:this._model.getVersionId(),lines:this._model.getLinesContent(),EOL:this._model.getEOL(),languageId:r,encodedLanguageId:c,maxTokenizationLineLength:this._maxTokenizationLineLength.get(),controllerId:this.controllerId}),this._register(Re(a=>{const u=this._maxTokenizationLineLength.read(a);this._worker.$acceptMaxTokenizationLineLength(this.controllerId,u)}))}dispose(){super.dispose(),this._worker.$acceptRemovedModel(this.controllerId)}requestTokens(e,t){this._worker.$retokenize(this.controllerId,e,t)}async setTokensAndStates(e,t,n,o){if(this.controllerId!==e)return;let i=_e.deserialize(new Uint8Array(n));if(this._shouldLog&&console.log("received background tokenization result",{fileName:this._model.uri.fsPath.split("\\").pop(),updatedTokenLines:i.map(r=>r.getLineRange()).join(" & "),updatedStateLines:o.map(r=>new Oe(r.startLineNumber,r.startLineNumber+r.stateDeltas.length).toString()).join(" & ")}),this._shouldLog){const r=this._pendingChanges.filter(c=>c.versionId<=t).map(c=>c.changes).map(c=>ne(c)).join(" then ");console.log("Applying changes to local states",r)}for(;this._pendingChanges.length>0&&this._pendingChanges[0].versionId<=t;){const r=this._pendingChanges.shift();this._states.acceptChanges(r.changes)}if(this._pendingChanges.length>0){if(this._shouldLog){const a=this._pendingChanges.map(u=>u.changes).map(u=>ne(u)).join(" then ");console.log("Considering non-processed changes",a)}const r=U.fromMany(this._pendingChanges.map(a=>ke(a.changes))),c=new _e;for(const a of i)for(let u=a.startLineNumber;u<=a.endLineNumber;u++)r.transform(u-1)!==void 0&&c.add(u,a.getLineTokens(u));i=c.finalize();for(const a of this._pendingChanges)for(const u of a.changes)for(let g=0;g<i.length;g++)i[g].applyEdit(u.range,u.text)}const s=U.fromMany(this._pendingChanges.map(r=>ke(r.changes)));if(!this._applyStateStackDiffFn||!this._initialState){const{applyStateStackDiff:r,INITIAL:c}=await ie(()=>import("./main-CuAxLb8K.js").then(a=>a.m),__vite__mapDeps([0,1,2]),import.meta.url).then(a=>a.default??a);this._applyStateStackDiffFn=r,this._initialState=c}for(const r of o){let c=r.startLineNumber<=1?this._initialState:this._states.getEndState(r.startLineNumber-1);for(let a=0;a<r.stateDeltas.length;a++){const u=r.stateDeltas[a];let g;u?(g=this._applyStateStackDiffFn(c,u),this._states.setEndState(r.startLineNumber+a,g)):g=this._states.getEndState(r.startLineNumber+a);const k=s.transform(r.startLineNumber+a-1);k!==void 0&&this._backgroundTokenizationStore.setEndState(k+1,g),r.startLineNumber+a>=this._model.getLineCount()-1&&this._backgroundTokenizationStore.backgroundTokenizationFinished(),c=g}}this._backgroundTokenizationStore.setTokens(i)}get _shouldLog(){return this._loggingEnabled.get()}};Y._id=0;let se=Y;function ne(h){return h.map(e=>oe.lift(e.range).toString()+" => "+e.text).join(" & ")}var q,z;let ae=(z=class{constructor(e,t,n,o,i,s,r){this._reportTokenizationTime=e,this._shouldTokenizeAsync=t,this._extensionResourceLoaderService=n,this._configurationService=o,this._languageService=i,this._notificationService=s,this._telemetryService=r,this._workerProxyPromise=null,this._worker=null,this._workerProxy=null,this._workerTokenizerControllers=new Map,this._currentTheme=null,this._currentTokenColorMap=null,this._grammarDefinitions=[]}dispose(){this._disposeWorker()}createBackgroundTokenizer(e,t,n){if(!this._shouldTokenizeAsync()||e.isTooLargeForSyncing())return;const o=new B,i=this._getWorkerProxy().then(s=>{if(o.isDisposed||!s)return;const r={controller:void 0,worker:this._worker};return o.add(xt(e,()=>{const c=new se(e,s,this._languageService.languageIdCodec,t,this._configurationService,n);return r.controller=c,this._workerTokenizerControllers.set(c.controllerId,c),Be(()=>{r.controller=void 0,this._workerTokenizerControllers.delete(c.controllerId),c.dispose()})})),r});return{dispose(){o.dispose()},requestTokens:async(s,r)=>{const c=await i;c?.controller&&c.worker===this._worker&&c.controller.requestTokens(s,r)},reportMismatchingTokens:s=>{q._reportedMismatchingTokens||(q._reportedMismatchingTokens=!0,this._notificationService.error({message:"Async Tokenization Token Mismatch in line "+s,name:"Async Tokenization Token Mismatch"}),this._telemetryService.publicLog2("asyncTokenizationMismatchingTokens",{}))}}}setGrammarDefinitions(e){this._grammarDefinitions=e,this._disposeWorker()}acceptTheme(e,t){this._currentTheme=e,this._currentTokenColorMap=t,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap)}_getWorkerProxy(){return this._workerProxyPromise||(this._workerProxyPromise=this._createWorkerProxy()),this._workerProxyPromise}async _createWorkerProxy(){const e={grammarDefinitions:this._grammarDefinitions,onigurumaWASMUri:new URL(""+new URL("onig-Du5pRr7Y.wasm",import.meta.url).href,import.meta.url).href},t=this._worker=je(Le.asBrowserUri("vs/workbench/services/textMate/browser/backgroundTokenization/worker/textMateTokenizationWorker.workerMain.js"),"TextMateWorker");return re.setChannel(t,{$readFile:async n=>{const o=Fe.revive(n);return this._extensionResourceLoaderService.readExtensionResource(o)},$setTokensAndStates:async(n,o,i,s)=>{const r=this._workerTokenizerControllers.get(n);r&&r.setTokensAndStates(n,o,i,s)},$reportTokenizationTime:(n,o,i,s,r)=>{this._reportTokenizationTime(n,o,i,s,r)}}),await t.proxy.$init(e),this._worker!==t?null:(this._workerProxy=t.proxy,this._currentTheme&&this._currentTokenColorMap&&this._workerProxy.$acceptTheme(this._currentTheme,this._currentTokenColorMap),t.proxy)}_disposeWorker(){for(const e of this._workerTokenizerControllers.values())e.dispose();this._workerTokenizerControllers.clear(),this._worker&&(this._worker.dispose(),this._worker=null),this._workerProxy=null,this._workerProxyPromise=null}},q=z,z._reportedMismatchingTokens=!1,z);ae=q=X([m(2,Ce),m(3,le),m(4,ge),m(5,he),m(6,Ie)],ae);function xt(h,e){const t=new B,n=t.add(new B);function o(){h.isAttachedToEditor()?n.add(e()):n.clear()}return o(),t.add(h.onDidChangeAttached(()=>{o()})),t}class Pt{constructor(){this._scopeNameToLanguageRegistration=Object.create(null)}reset(){this._scopeNameToLanguageRegistration=Object.create(null)}register(e){this._scopeNameToLanguageRegistration[e.scopeName]=e}getGrammarDefinition(e){return this._scopeNameToLanguageRegistration[e]||null}}const H="No TM Grammar registered for this language.";class Dt extends P{constructor(e,t,n,o){super(),this._host=e,this._initialState=n.INITIAL,this._scopeRegistry=new Pt,this._injections={},this._injectedEmbeddedLanguages={},this._languageToScope=new Map,this._grammarRegistry=this._register(new n.Registry({onigLib:o,loadGrammar:async i=>{const s=this._scopeRegistry.getGrammarDefinition(i);if(!s)return this._host.logTrace(`No grammar found for scope ${i}`),null;const r=s.location;try{const c=await this._host.readFile(r);return n.parseRawGrammar(c,r.path)}catch(c){return this._host.logError(`Unable to load and parse grammar for scope ${i} from ${r}`,c),null}},getInjections:i=>{const s=i.split(".");let r=[];for(let c=1;c<=s.length;c++){const a=s.slice(0,c).join(".");r=[...r,...this._injections[a]||[]]}return r}}));for(const i of t){if(this._scopeRegistry.register(i),i.injectTo){for(const s of i.injectTo){let r=this._injections[s];r||(this._injections[s]=r=[]),r.push(i.scopeName)}if(i.embeddedLanguages)for(const s of i.injectTo){let r=this._injectedEmbeddedLanguages[s];r||(this._injectedEmbeddedLanguages[s]=r=[]),r.push(i.embeddedLanguages)}}i.language&&this._languageToScope.set(i.language,i.scopeName)}}has(e){return this._languageToScope.has(e)}setTheme(e,t){this._grammarRegistry.setTheme(e,t)}getColorMap(){return this._grammarRegistry.getColorMap()}async createGrammar(e,t){const n=this._languageToScope.get(e);if(typeof n!="string")throw new Error(H);const o=this._scopeRegistry.getGrammarDefinition(n);if(!o)throw new Error(H);const i=o.embeddedLanguages;if(this._injectedEmbeddedLanguages[n]){const c=this._injectedEmbeddedLanguages[n];for(const a of c)for(const u of Object.keys(a))i[u]=a[u]}const s=Object.keys(i).length>0;let r;try{r=await this._grammarRegistry.loadGrammarWithConfiguration(n,t,{embeddedLanguages:i,tokenTypes:o.tokenTypes,balancedBracketSelectors:o.balancedBracketSelectors,unbalancedBracketSelectors:o.unbalancedBracketSelectors})}catch(c){throw c.message&&c.message.startsWith("No grammar provided for")?new Error(H):c}return{languageId:e,grammar:r,initialState:this._initialState,containsEmbeddedLanguages:s,sourceExtensionId:o.sourceExtensionId}}}const M=Z.registerExtensionPoint({extensionPoint:"grammars",deps:[$e],jsonSchema:{description:l(13410,"Contributes textmate tokenizers."),type:"array",defaultSnippets:[{body:[{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}]}],items:{type:"object",defaultSnippets:[{body:{language:"${1:id}",scopeName:"source.${2:id}",path:"./syntaxes/${3:id}.tmLanguage."}}],properties:{language:{description:l(13411,"Language identifier for which this syntax is contributed to."),type:"string"},scopeName:{description:l(13412,"Textmate scope name used by the tmLanguage file."),type:"string"},path:{description:l(13413,"Path of the tmLanguage file. The path is relative to the extension folder and typically starts with './syntaxes/'."),type:"string"},embeddedLanguages:{description:l(13414,"A map of scope name to language id if this grammar contains embedded languages."),type:"object"},tokenTypes:{description:l(13415,"A map of scope name to token types."),type:"object",additionalProperties:{enum:["string","comment","other"]}},injectTo:{description:l(13416,"List of language scope names to which this grammar is injected to."),type:"array",items:{type:"string"}},balancedBracketScopes:{description:l(13417,"Defines which scope names contain balanced brackets."),type:"array",items:{type:"string"},default:["*"]},unbalancedBracketScopes:{description:l(13418,"Defines which scope names do not contain balanced brackets."),type:"array",items:{type:"string"},default:[]}},required:["scopeName","path"]}}});var A,E;let ce=(E=class extends P{constructor(e,t,n,o,i,s,r,c,a,u){super(),this._languageService=e,this._themeService=t,this._extensionResourceLoaderService=n,this._notificationService=o,this._logService=i,this._configurationService=s,this._progressService=r,this._environmentService=c,this._instantiationService=a,this._telemetryService=u,this._createdModes=[],this._encounteredLanguages=[],this._debugMode=!1,this._debugModePrintFunc=()=>{},this._grammarDefinitions=null,this._grammarFactory=null,this._tokenizersRegistrations=this._register(new B),this._currentTheme=null,this._currentTokenColorMap=null,this._threadedBackgroundTokenizerFactory=this._instantiationService.createInstance(ae,(g,k,w,y,T)=>this._reportTokenizationTime(g,k,w,y,!0,T),()=>this.getAsyncTokenizationEnabled()),this._vscodeOniguruma=null,this._styleElement=Ve(),this._styleElement.className="vscode-tokens-styles",M.setHandler(g=>this._handleGrammarsExtPoint(g)),this._updateTheme(this._themeService.getColorTheme(),!0),this._register(this._themeService.onDidColorThemeChange(()=>{this._updateTheme(this._themeService.getColorTheme(),!1)})),this._register(this._languageService.onDidRequestRichLanguageFeatures(g=>{this._createdModes.push(g)}))}getAsyncTokenizationEnabled(){return!!this._configurationService.getValue("editor.experimental.asyncTokenization")}getAsyncTokenizationVerification(){return!!this._configurationService.getValue("editor.experimental.asyncTokenizationVerification")}_handleGrammarsExtPoint(e){this._grammarDefinitions=null,this._grammarFactory&&(this._grammarFactory.dispose(),this._grammarFactory=null),this._tokenizersRegistrations.clear(),this._grammarDefinitions=[];for(const t of e){const n=t.value;for(const o of n){const i=this._validateGrammarDefinition(t,o);if(i&&(this._grammarDefinitions.push(i),i.language)){const s=new Ge(()=>this._createTokenizationSupport(i.language));this._tokenizersRegistrations.add(s),this._tokenizersRegistrations.add(te.registerFactory(i.language,s))}}}this._threadedBackgroundTokenizerFactory.setGrammarDefinitions(this._grammarDefinitions);for(const t of this._createdModes)te.getOrCreate(t)}_validateGrammarDefinition(e,t){if(!Rt(e.description.extensionLocation,t,e.collector,this._languageService))return null;const n=Me(e.description.extensionLocation,t.path),o=Object.create(null);if(t.embeddedLanguages){const c=Object.keys(t.embeddedLanguages);for(let a=0,u=c.length;a<u;a++){const g=c[a],k=t.embeddedLanguages[g];typeof k=="string"&&this._languageService.isRegisteredLanguageId(k)&&(o[g]=this._languageService.languageIdCodec.encodeLanguageId(k))}}const i=Object.create(null);if(t.tokenTypes){const c=Object.keys(t.tokenTypes);for(const a of c)switch(t.tokenTypes[a]){case"string":i[a]=v.String;break;case"other":i[a]=v.Other;break;case"comment":i[a]=v.Comment;break}}const s=t.language&&this._languageService.isRegisteredLanguageId(t.language)?t.language:void 0;function r(c,a){return!Array.isArray(c)||!c.every(u=>typeof u=="string")?a:c}return{location:n,language:s,scopeName:t.scopeName,embeddedLanguages:o,tokenTypes:i,injectTo:t.injectTo,balancedBracketSelectors:r(t.balancedBracketScopes,["*"]),unbalancedBracketSelectors:r(t.unbalancedBracketScopes,[]),sourceExtensionId:e.description.id}}startDebugMode(e,t){if(this._debugMode){this._notificationService.error(l(13399,"Already Logging."));return}this._debugModePrintFunc=e,this._debugMode=!0,this._debugMode&&this._progressService.withProgress({location:We.Notification,buttons:[l(13400,"Stop")]},n=>(n.report({message:l(13401,"Preparing to log TM Grammar parsing. Press Stop when finished.")}),this._getVSCodeOniguruma().then(o=>(o.setDefaultDebugCall(!0),n.report({message:l(13402,"Now logging TM Grammar parsing. Press Stop when finished.")}),new Promise((i,s)=>{})))),n=>{this._getVSCodeOniguruma().then(o=>{this._debugModePrintFunc=()=>{},this._debugMode=!1,o.setDefaultDebugCall(!1),t()})})}_canCreateGrammarFactory(){return!!this._grammarDefinitions}async _getOrCreateGrammarFactory(){if(this._grammarFactory)return this._grammarFactory;const[e,t]=await Promise.all([ie(()=>import("./main-CuAxLb8K.js").then(o=>o.m),__vite__mapDeps([0,1,2]),import.meta.url).then(o=>o.default??o),this._getVSCodeOniguruma()]),n=Promise.resolve({createOnigScanner:o=>t.createOnigScanner(o),createOnigString:o=>t.createOnigString(o)});return this._grammarFactory?this._grammarFactory:(this._grammarFactory=new Dt({logTrace:o=>this._logService.trace(o),logError:(o,i)=>this._logService.error(o,i),readFile:o=>this._extensionResourceLoaderService.readExtensionResource(o)},this._grammarDefinitions||[],e,n),this._updateTheme(this._themeService.getColorTheme(),!0),this._grammarFactory)}async _createTokenizationSupport(e){if(!this._languageService.isRegisteredLanguageId(e)||!this._canCreateGrammarFactory())return null;try{const t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;const n=this._languageService.languageIdCodec.encodeLanguageId(e),o=await t.createGrammar(e,n);if(!o.grammar)return null;const i=Ot("editor.maxTokenizationLineLength",e,-1,this._configurationService),s=new B,r=s.add(new Mt(o.grammar,o.initialState,o.containsEmbeddedLanguages,(c,a)=>this._threadedBackgroundTokenizerFactory.createBackgroundTokenizer(c,a,i),()=>this.getAsyncTokenizationVerification(),(c,a,u)=>{this._reportTokenizationTime(c,e,o.sourceExtensionId,a,!1,u)},!0));return s.add(r.onDidEncounterLanguage(c=>{if(!this._encounteredLanguages[c]){const a=this._languageService.languageIdCodec.decodeLanguageId(c);this._encounteredLanguages[c]=!0,this._languageService.requestBasicLanguageFeatures(a)}})),new zt(n,r,s,i)}catch(t){return t.message&&t.message===H||qe(t),null}}_updateTheme(e,t){if(!t&&this._currentTheme&&this._currentTokenColorMap&&At(this._currentTheme.settings,e.tokenColors)&&He(this._currentTokenColorMap,e.tokenColorMap))return;this._currentTheme={name:e.label,settings:e.tokenColors},this._currentTokenColorMap=e.tokenColorMap,this._grammarFactory?.setTheme(this._currentTheme,this._currentTokenColorMap);const n=Nt(this._currentTokenColorMap),o=Ue(n);this._styleElement.textContent=o,te.setColorMap(n),this._currentTheme&&this._currentTokenColorMap&&this._threadedBackgroundTokenizerFactory.acceptTheme(this._currentTheme,this._currentTokenColorMap)}async createTokenizer(e){if(!this._languageService.isRegisteredLanguageId(e))return null;const t=await this._getOrCreateGrammarFactory();if(!t.has(e))return null;const n=this._languageService.languageIdCodec.encodeLanguageId(e),{grammar:o}=await t.createGrammar(e,n);return o}_getVSCodeOniguruma(){return this._vscodeOniguruma||(this._vscodeOniguruma=(async()=>{const[e,t]=await Promise.all([ie(()=>import("./main-kYU-Ynn2.js").then(n=>n.m),__vite__mapDeps([3,1,2]),import.meta.url).then(n=>n.default??n),this._loadVSCodeOnigurumaWASM()]);return await e.loadWASM({data:t,print:n=>{this._debugModePrintFunc(n)}}),e})()),this._vscodeOniguruma}async _loadVSCodeOnigurumaWASM(){return Je?await(await fetch(new URL(""+new URL("onig-Du5pRr7Y.wasm",import.meta.url).href,import.meta.url).href)).arrayBuffer():await fetch(Le.asBrowserUri(`${Ke}/vscode-oniguruma/release/onig.wasm`).toString(!0))}_reportTokenizationTime(e,t,n,o,i,s){const r=i?"async":"sync";A.reportTokenizationTimeCounter[r]>50||(A.reportTokenizationTimeCounter[r]===0&&setTimeout(()=>{A.reportTokenizationTimeCounter[r]=0},1e3*60*60),A.reportTokenizationTimeCounter[r]++,this._telemetryService.publicLog2("editor.tokenizedLine",{timeMs:e,languageId:t,lineLength:o,fromWorker:i,sourceExtensionId:n,isRandomSample:s,tokenizationSetting:this.getAsyncTokenizationEnabled()?this.getAsyncTokenizationVerification()?2:1:0}))}},A=E,E.reportTokenizationTimeCounter={sync:0,async:0},E);ce=A=X([m(0,ge),m(1,Ee),m(2,Ce),m(3,he),m(4,Xe),m(5,le),m(6,Ze),m(7,et),m(8,ze),m(9,Ie)],ce);function Nt(h){const e=[null];for(let t=1,n=h.length;t<n;t++)e[t]=W.fromHex(h[t]);return e}function At(h,e){if(!e||!h||e.length!==h.length)return!1;for(let t=e.length-1;t>=0;t--){const n=e[t],o=h[t];if(n.scope!==o.scope)return!1;const i=n.settings,s=o.settings;if(i&&s){if(i.fontStyle!==s.fontStyle||i.foreground!==s.foreground||i.background!==s.background)return!1}else if(!i||!s)return!1}return!0}function Rt(h,e,t,n){if(e.language&&(typeof e.language!="string"||!n.isRegisteredLanguageId(e.language)))return t.error(l(13403,"Unknown language in `contributes.{0}.language`. Provided value: {1}",M.name,String(e.language))),!1;if(!e.scopeName||typeof e.scopeName!="string")return t.error(l(13404,"Expected string in `contributes.{0}.scopeName`. Provided value: {1}",M.name,String(e.scopeName))),!1;if(!e.path||typeof e.path!="string")return t.error(l(13405,"Expected string in `contributes.{0}.path`. Provided value: {1}",M.name,String(e.path))),!1;if(e.injectTo&&(!Array.isArray(e.injectTo)||e.injectTo.some(i=>typeof i!="string")))return t.error(l(13406,"Invalid value in `contributes.{0}.injectTo`. Must be an array of language scope names. Provided value: {1}",M.name,JSON.stringify(e.injectTo))),!1;if(e.embeddedLanguages&&!Te(e.embeddedLanguages))return t.error(l(13407,"Invalid value in `contributes.{0}.embeddedLanguages`. Must be an object map from scope name to language. Provided value: {1}",M.name,JSON.stringify(e.embeddedLanguages))),!1;if(e.tokenTypes&&!Te(e.tokenTypes))return t.error(l(13408,"Invalid value in `contributes.{0}.tokenTypes`. Must be an object map from scope name to token type. Provided value: {1}",M.name,JSON.stringify(e.tokenTypes))),!1;const o=Me(h,e.path);return Ye(o,h)||t.warn(l(13409,"Expected `contributes.{0}.path` ({1}) to be included inside extension's folder ({2}). This might make the extension non-portable.",M.name,o.path,h.path)),!0}function Ot(h,e,t,n){return Qe(o=>n.onDidChangeConfiguration(i=>{i.affectsConfiguration(h,{overrideIdentifier:e})&&o(i)}),()=>n.getValue(h,{overrideIdentifier:e})??t)}const I=Ct(),jt=Z.registerExtensionPoint({extensionPoint:"semanticTokenTypes",jsonSchema:{description:l(13606,"Contributes semantic token types."),type:"array",items:{type:"object",properties:{id:{type:"string",description:l(13607,"The identifier of the semantic token type"),pattern:$,patternErrorMessage:l(13608,"Identifiers should be in the form letterOrDigit[_-letterOrDigit]*")},superType:{type:"string",description:l(13609,"The super type of the semantic token type"),pattern:$,patternErrorMessage:l(13610,"Super types should be in the form letterOrDigit[_-letterOrDigit]*")},description:{type:"string",description:l(13611,"The description of the semantic token type")}}}}}),Ft=Z.registerExtensionPoint({extensionPoint:"semanticTokenModifiers",jsonSchema:{description:l(13612,"Contributes semantic token modifiers."),type:"array",items:{type:"object",properties:{id:{type:"string",description:l(13613,"The identifier of the semantic token modifier"),pattern:$,patternErrorMessage:l(13614,"Identifiers should be in the form letterOrDigit[_-letterOrDigit]*")},description:{type:"string",description:l(13615,"The description of the semantic token modifier")}}}}}),Bt=Z.registerExtensionPoint({extensionPoint:"semanticTokenScopes",jsonSchema:{description:l(13616,"Contributes semantic token scope maps."),type:"array",items:{type:"object",properties:{language:{description:l(13617,"Lists the languge for which the defaults are."),type:"string"},scopes:{description:l(13618,"Maps a semantic token (described by semantic token selector) to one or more textMate scopes used to represent that token."),type:"object",additionalProperties:{type:"array",items:{type:"string"}}}}}}});class $t{constructor(){function e(t,n,o){if(typeof t.id!="string"||t.id.length===0)return o.error(l(13619,"'configuration.{0}.id' must be defined and can not be empty",n)),!1;if(!t.id.match($))return o.error(l(13620,"'configuration.{0}.id' must follow the pattern letterOrDigit[-_letterOrDigit]*",n)),!1;const i=t.superType;return i&&!i.match($)?(o.error(l(13621,"'configuration.{0}.superType' must follow the pattern letterOrDigit[-_letterOrDigit]*",n)),!1):typeof t.description!="string"||t.id.length===0?(o.error(l(13622,"'configuration.{0}.description' must be defined and can not be empty",n)),!1):!0}jt.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13623,"'configuration.semanticTokenType' must be an array"));return}for(const r of i)e(r,"semanticTokenType",s)&&I.registerTokenType(r.id,r.description,r.superType)}for(const o of n.removed){const i=o.value;for(const s of i)I.deregisterTokenType(s.id)}}),Ft.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13624,"'configuration.semanticTokenModifier' must be an array"));return}for(const r of i)e(r,"semanticTokenModifier",s)&&I.registerTokenModifier(r.id,r.description)}for(const o of n.removed){const i=o.value;for(const s of i)I.deregisterTokenModifier(s.id)}}),Bt.setHandler((t,n)=>{for(const o of n.added){const i=o.value,s=o.collector;if(!i||!Array.isArray(i)){s.error(l(13625,"'configuration.semanticTokenScopes' must be an array"));return}for(const r of i){if(r.language&&typeof r.language!="string"){s.error(l(13626,"'configuration.semanticTokenScopes.language' must be a string"));continue}if(!r.scopes||typeof r.scopes!="object"){s.error(l(13627,"'configuration.semanticTokenScopes.scopes' must be defined as an object"));continue}for(const c in r.scopes){const a=r.scopes[c];if(!Array.isArray(a)||a.some(u=>typeof u!="string")){s.error(l(13628,"'configuration.semanticTokenScopes.scopes' values must be an array of strings"));continue}try{const u=I.parseTokenSelector(c,r.language);I.registerTokenStyleDefault(u,{scopesToProbe:a.map(g=>g.split(" "))})}catch{s.error(l(13629,"configuration.semanticTokenScopes.scopes': Problems parsing selector {0}.",c))}}}}for(const o of n.removed){const i=o.value;for(const s of i)for(const r in s.scopes){const c=s.scopes[r];try{const a=I.parseTokenSelector(r,s.language);I.registerTokenStyleDefault(a,{scopesToProbe:c.map(u=>u.split(" "))})}catch{}}}})}}var R;let J=(R=class{constructor(e){this.instantiationService=e,this.instantiationService.createInstance($t)}},R.ID="workbench.contrib.tokenClassificationExtensionPoint",R);J=X([m(0,ze)],J);tt(J.ID,J,nt.BlockStartup);const Vt=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));function Gt(h,e,t=!0){for(let n=e.length-1;n>=0;n--){const o=e.slice(0,n),i=e[n],s=Wt(h,i,o,t);if(s)return s}return null}function Wt(h,e,t,n){let o=null;for(let i=h.tokenColors.length-1;i>=0;i--){const s=h.tokenColors[i];if(n&&!s.settings.foreground)continue;let r;if(typeof s.scope=="string")r=s.scope.split(/,/).map(c=>c.trim());else if(Array.isArray(s.scope))r=s.scope;else continue;for(let c=0,a=r.length;c<a;c++){const u=r[c],g=new K(u,s.settings);g.matches(e,t)&&g.isMoreSpecific(o)&&(o=g)}}return o}class K{constructor(e,t){this.rawSelector=e,this.settings=t;const n=this.rawSelector.split(/ /);this.scope=n[n.length-1],this.parentScopes=n.slice(0,n.length-1)}matches(e,t){return K._matches(this.scope,this.parentScopes,e,t)}static _cmp(e,t){if(e===null&&t===null)return 0;if(e===null)return-1;if(t===null)return 1;if(e.scope.length!==t.scope.length)return e.scope.length-t.scope.length;const n=e.parentScopes.length,o=t.parentScopes.length;if(n!==o)return n-o;for(let i=0;i<n;i++){const s=e.parentScopes[i].length,r=t.parentScopes[i].length;if(s!==r)return s-r}return 0}isMoreSpecific(e){return K._cmp(this,e)>0}static _matchesOne(e,t){const n=e+".";return e===t||t.substring(0,n.length)===n}static _matches(e,t,n,o){if(!this._matchesOne(e,n))return!1;let i=t.length-1,s=o.length-1;for(;i>=0&&s>=0;)this._matchesOne(t[i],o[s])&&i--,s--;return i===-1}}var de;it(Vt);const d=_t;var x;let O=(x=class extends P{static get(e){return e.getContribution(de.ID)}constructor(e,t,n,o,i,s,r){super(),this._editor=e,this._textMateService=t,this._themeService=o,this._languageService=n,this._notificationService=i,this._configurationService=s,this._languageFeaturesService=r,this._widget=null,this._register(this._editor.onDidChangeModel(c=>this.stop())),this._register(this._editor.onDidChangeModelLanguage(c=>this.stop())),this._register(this._editor.onKeyUp(c=>c.keyCode===ot.Escape&&this.stop()))}dispose(){this.stop(),super.dispose()}launch(){this._widget||this._editor.hasModel()&&this._editor.getModel().uri.scheme!==rt.vscodeNotebookCell&&(this._widget=new ue(this._editor,this._textMateService,this._languageService,this._themeService,this._notificationService,this._configurationService,this._languageFeaturesService))}stop(){this._widget&&(this._widget.dispose(),this._widget=null)}toggle(){this._widget?this.stop():this.launch()}},de=x,x.ID="editor.contrib.inspectEditorTokens",x);O=de=X([m(1,me),m(2,ge),m(3,Ee),m(4,he),m(5,le),m(6,st)],O);class qt extends kt{constructor(){super({id:"editor.action.inspectTMScopes",label:Tt(5554,"Developer: Inspect Editor Tokens and Scopes"),precondition:void 0})}run(e,t){O.get(t)?.toggle()}}function we(h){h.length>40&&(h=h.substr(0,20)+"…"+h.substr(h.length-20));let e="";for(let t=0,n=h.length;t<n;t++){const o=h.charCodeAt(t);switch(o){case be.Tab:e+="→";break;case be.Space:e+="·";break;default:e+=String.fromCharCode(o)}}return e}const Q=class Q extends P{constructor(e,t,n,o,i,s,r){super(),this.allowEditorOverflow=!0,this._isDisposed=!1,this._editor=e,this._languageService=n,this._themeService=o,this._textMateService=t,this._notificationService=i,this._configurationService=s,this._languageFeaturesService=r,this._model=this._editor.getModel(),this._domNode=at("div"),this._domNode.className="token-inspect-widget",this._currentRequestCancellationTokenSource=new ct,this._beginCompute(this._editor.getPosition()),this._register(this._editor.onDidChangeCursorPosition(c=>this._beginCompute(this._editor.getPosition()))),this._register(o.onDidColorThemeChange(c=>this._beginCompute(this._editor.getPosition()))),this._register(s.onDidChangeConfiguration(c=>c.affectsConfiguration("editor.semanticHighlighting.enabled")&&this._beginCompute(this._editor.getPosition()))),this._editor.addContentWidget(this)}dispose(){this._isDisposed=!0,this._editor.removeContentWidget(this),this._currentRequestCancellationTokenSource.cancel(),super.dispose()}getId(){return Q._ID}_beginCompute(e){const t=this._textMateService.createTokenizer(this._model.getLanguageId()),n=this._computeSemanticTokens(e),o=this._model.tokenization.tokens.get(),i=o instanceof pt?o:void 0;dt(this._domNode),this._domNode.appendChild(document.createTextNode(l(5555,"Loading..."))),Promise.all([t,n]).then(([s,r])=>{if(this._isDisposed)return;const c=i?.tree.get();this._compute(s,r,c,e),this._domNode.style.maxWidth=`${Math.max(this._editor.getLayoutInfo().width*.66,500)}px`,this._editor.layoutContentWidget(this)},s=>{this._notificationService.warn(s),setTimeout(()=>{O.get(this._editor)?.stop()})})}_isSemanticColoringEnabled(){const e=this._configurationService.getValue(ut,{overrideIdentifier:this._model.getLanguageId(),resource:this._model.uri})?.enabled;return typeof e=="boolean"?e:this._themeService.getColorTheme().semanticHighlighting}_compute(e,t,n,o){const i=e&&this._getTokensAtPosition(e,o),s=t&&this._getSemanticTokenAtPosition(t,o),r=n&&this._getTreeSitterTokenAtPosition(n,o);if(!i&&!s&&!r){Se(this._domNode,"No grammar or semantic tokens available.");return}const c=i?.metadata,a=s?.metadata,u=s&&we(this._model.getValueInRange(s.range)),g=i&&we(this._model.getLineContent(o.lineNumber).substring(i.token.startIndex,i.token.endIndex)),k=u||g||"";if(Se(this._domNode,d("h2.tiw-token",void 0,k,d("span.tiw-token-length",void 0,`${k.length} ${k.length===1?"char":"chars"}`))),p(this._domNode,d("hr.tiw-metadata-separator",{style:"clear:both"})),p(this._domNode,d("table.tiw-metadata-table",void 0,d("tbody",void 0,d("tr",void 0,d("td.tiw-metadata-key",void 0,"language"),d("td.tiw-metadata-value",void 0,c?.languageId||"")),d("tr",void 0,d("td.tiw-metadata-key",void 0,"standard token type"),d("td.tiw-metadata-value",void 0,this._tokenTypeToString(c?.tokenType||v.Other))),...this._formatMetadata(a,c)))),s){p(this._domNode,d("hr.tiw-metadata-separator"));const w=p(this._domNode,d("table.tiw-metadata-table",void 0)),y=p(w,d("tbody",void 0,d("tr",void 0,d("td.tiw-metadata-key",void 0,"semantic token type"),d("td.tiw-metadata-value",void 0,s.type))));if(s.modifiers.length&&p(y,d("tr",void 0,d("td.tiw-metadata-key",void 0,"modifiers"),d("td.tiw-metadata-value",void 0,s.modifiers.join(" ")))),s.metadata){const T=["foreground","bold","italic","underline","strikethrough"],S={},b=new Array;for(const f of T)if(s.metadata[f]!==void 0){const _=s.definitions[f],L=this._renderTokenStyleDefinition(_,f),C=L.map(V=>lt(V)?V.outerHTML:V).join();let j=S[C];j||(S[C]=j=[],b.push([L,C])),j.push(f)}for(const[f,_]of b)p(y,d("tr",void 0,d("td.tiw-metadata-key",void 0,S[_].join(", ")),d("td.tiw-metadata-value",void 0,...f)))}}if(i){const w=this._themeService.getColorTheme();p(this._domNode,d("hr.tiw-metadata-separator"));const y=p(this._domNode,d("table.tiw-metadata-table")),T=p(y,d("tbody"));g&&g!==k&&p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"textmate token"),d("td.tiw-metadata-value",void 0,`${g} (${g.length})`)));const S=new Array;for(let _=i.token.scopes.length-1;_>=0;_--)S.push(i.token.scopes[_]),_>0&&S.push(d("br"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"textmate scopes"),d("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...S)));const b=Gt(w,i.token.scopes,!1),f=s?.metadata?.foreground;if(b){if(f!==i.metadata.foreground){let _=d("code.tiw-theme-selector",void 0,b.rawSelector,d("br"),JSON.stringify(b.settings,null," "));f&&(_=d("s",void 0,_)),p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,_)))}}else f||p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,"No theme selector")))}if(r){const w=r[r.length-1];p(this._domNode,d("hr.tiw-metadata-separator"));const y=p(this._domNode,d("table.tiw-metadata-table")),T=p(y,d("tbody"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,`tree-sitter token ${w.id}`),d("td.tiw-metadata-value",void 0,`${w.text}`)));const S=new Array;let b=r.length-1,f=r[b];for(;f.parent||b>0;)S.push(f.type),f=f.parent??r[--b],f&&S.push(d("br"));p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"tree-sitter tree"),d("td.tiw-metadata-value.tiw-metadata-scopes",void 0,...S)));const L=this._model.tokenization.tokens.get().tokenizationImpl.get()?.captureAtPosition(o.lineNumber,o.column);L&&L.length>0&&p(T,d("tr",void 0,d("td.tiw-metadata-key",void 0,"foreground"),d("td.tiw-metadata-value",void 0,L.map(C=>C.name).join(" "))))}}_formatMetadata(e,t){const n=new Array;function o(a){const u=e?.[a]||t?.[a];if(u!==void 0){const g=e?.[a]?"tiw-metadata-semantic":"";n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,a),d(`td.tiw-metadata-value.${g}`,void 0,u)))}return u}const i=o("foreground"),s=o("background");if(i&&s){const a=W.fromHex(s),u=W.fromHex(i);a.isOpaque()?n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"contrast ratio"),d("td.tiw-metadata-value",void 0,a.getContrastRatio(u.makeOpaque(a)).toFixed(2)))):n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"Contrast ratio cannot be precise for background colors that use transparency"),d("td.tiw-metadata-value")))}const r=new Array;function c(a){let u;e&&e[a]?u=d("span.tiw-metadata-semantic",void 0,a):t&&t[a]&&(u=a),u&&(r.length&&r.push(" "),r.push(u))}return c("bold"),c("italic"),c("underline"),c("strikethrough"),r.length&&n.push(d("tr",void 0,d("td.tiw-metadata-key",void 0,"font style"),d("td.tiw-metadata-value",void 0,...r))),n}_decodeMetadata(e){const t=this._themeService.getColorTheme().tokenColorMap,n=N.getLanguageId(e),o=N.getTokenType(e),i=N.getFontStyle(e),s=N.getForeground(e),r=N.getBackground(e);return{languageId:this._languageService.languageIdCodec.decodeLanguageId(n),tokenType:o,bold:i&G.Bold?!0:void 0,italic:i&G.Italic?!0:void 0,underline:i&G.Underline?!0:void 0,strikethrough:i&G.Strikethrough?!0:void 0,foreground:t[s],background:t[r]}}_tokenTypeToString(e){switch(e){case v.Other:return"Other";case v.Comment:return"Comment";case v.String:return"String";case v.RegEx:return"RegEx";default:return"??"}}_getTokensAtPosition(e,t){const n=t.lineNumber,o=this._getStateBeforeLine(e,n),i=e.tokenizeLine(this._model.getLineContent(n),o),s=e.tokenizeLine2(this._model.getLineContent(n),o);let r=0;for(let a=i.tokens.length-1;a>=0;a--){const u=i.tokens[a];if(t.column-1>=u.startIndex){r=a;break}}let c=0;for(let a=s.tokens.length>>>1;a>=0;a--)if(t.column-1>=s.tokens[a<<1]){c=a;break}return{token:i.tokens[r],metadata:this._decodeMetadata(s.tokens[(c<<1)+1])}}_getStateBeforeLine(e,t){let n=null;for(let o=1;o<t;o++)n=e.tokenizeLine(this._model.getLineContent(o),n).ruleStack;return n}isSemanticTokens(e){return e&&e.data}async _computeSemanticTokens(e){if(!this._isSemanticColoringEnabled())return null;const t=this._languageFeaturesService.documentSemanticTokensProvider.ordered(this._model);if(t.length){const o=t[0],i=await Promise.resolve(o.provideDocumentSemanticTokens(this._model,null,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(i))return{tokens:i,legend:o.getLegend()}}const n=this._languageFeaturesService.documentRangeSemanticTokensProvider.ordered(this._model);if(n.length){const o=n[0],i=e.lineNumber,s=new oe(i,1,i,this._model.getLineMaxColumn(i)),r=await Promise.resolve(o.provideDocumentRangeSemanticTokens(this._model,s,this._currentRequestCancellationTokenSource.token));if(this.isSemanticTokens(r))return{tokens:r,legend:o.getLegend()}}return null}_getSemanticTokenAtPosition(e,t){const n=e.tokens.data,o=this._model.getLanguageId();let i=0,s=0;const r=t.lineNumber-1,c=t.column-1;for(let a=0;a<n.length;a+=5){const u=n[a],g=n[a+1],k=n[a+2],w=n[a+3],y=n[a+4],T=i+u,S=u===0?s+g:g;if(r===T&&S<=c&&c<S+k){const b=e.legend.tokenTypes[w]||"not in legend (ignored)",f=[];let _=y;for(let ee=0;_>0&&ee<e.legend.tokenModifiers.length;ee++)_&1&&f.push(e.legend.tokenModifiers[ee]),_=_>>1;_>0&&f.push("not in legend (ignored)");const L=new oe(T+1,S+1,T+1,S+1+k),C={},j=this._themeService.getColorTheme().tokenColorMap,D=this._themeService.getColorTheme().getTokenStyleMetadata(b,f,o,!0,C);let fe;return D&&(fe={languageId:void 0,tokenType:v.Other,bold:D?.bold,italic:D?.italic,underline:D?.underline,strikethrough:D?.strikethrough,foreground:j[D?.foreground||gt.None],background:void 0}),{type:b,modifiers:f,range:L,metadata:fe,definitions:C}}i=T,s=S}return null}_walkTreeforPosition(e,t){const n=this._model.getOffsetAt(t);e.gotoFirstChild();let o=!1,i=null;do e.currentNode.startIndex<=n&&n<e.currentNode.endIndex?(o=!0,i=e.currentNode):o=!1;while(o?e.gotoFirstChild():e.gotoNextSibling());return i}_getTreeSitterTokenAtPosition(e,t){const n=[];let o=e?.tree.get();for(;o;){const i=o.walk(),s=this._walkTreeforPosition(i,t);i.delete(),s?(n.push(s),e=e?.getInjectionTrees(s.startIndex,e.languageId),o=e?.tree.get()):o=void 0}return n.length>0?n:null}_renderTokenStyleDefinition(e,t){const n=new Array;if(e===void 0)return n;const o=this._themeService.getColorTheme();if(Array.isArray(e)){const i={};o.resolveScopes(e,i);const s=i[t];if(s&&i.scope){const r=d("ul.tiw-metadata-values"),c=Array.isArray(s.scope)?s.scope:[String(s.scope)];for(const a of c)r.appendChild(d("li.tiw-metadata-value.tiw-metadata-scopes",void 0,a));return n.push(i.scope.join(" "),r,d("code.tiw-theme-selector",void 0,JSON.stringify(s.settings,null," "))),n}return n}else if(It.is(e)){const i=o.getTokenStylingRuleScope(e);return i==="setting"?(n.push(`User settings: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),n):(i==="theme"&&n.push(`Color theme: ${e.selector.id} - ${this._renderStyleProperty(e.style,t)}`),n)}else{const i=o.resolveTokenStyleValue(e);return n.push(`Default: ${i?this._renderStyleProperty(i,t):""}`),n}}_renderStyleProperty(e,t){return t==="foreground"?e.foreground?W.Format.CSS.formatHexA(e.foreground,!0):"":e[t]!==void 0?String(e[t]):""}getDomNode(){return this._domNode}getPosition(){return{position:this._editor.getPosition(),preference:[ye.BELOW,ye.ABOVE]}}};Q._ID="editor.contrib.inspectEditorTokensWidget";let ue=Q;ht(O.ID,O,mt.Lazy);ft(qt);bt(async h=>{h.get(wt).when(vt.Ready).then(()=>{Lt.get(me)})});function Kt(){return{...yt(),[me.toString()]:new St(ce,[],!1)}}export{me as ITextMateTokenizationService,Kt as default};
|