/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{a as d,b as g,c as C,d as W,e as S,f as E,g as l,h,i as c,j as u,k as f,l as _,m as F,n as w,o as k,p as v,q as D,r as P}from"./DOQVBFQ2.js";import{a}from"./CVNYRL2K.js";import"./NXRT3FAY.js";import{al as o}from"./YCOWKBW5.js";import"./ALDX5YZO.js";var L=120*1e3,m=class{constructor(s){this._defaults=s,this._worker=null,this._client=null,this._idleCheckInterval=window.setInterval(()=>this._checkIfIdle(),30*1e3),this._lastUsedTime=0,this._configChangeListener=this._defaults.onDidChange(()=>this._stopWorker())}_stopWorker(){this._worker&&(this._worker.dispose(),this._worker=null),this._client=null}dispose(){clearInterval(this._idleCheckInterval),this._configChangeListener.dispose(),this._stopWorker()}_checkIfIdle(){if(!this._worker)return;Date.now()-this._lastUsedTime>L&&this._stopWorker()}_getClient(){return this._lastUsedTime=Date.now(),this._client||(this._worker=a({moduleId:"vs/language/css/cssWorker",createWorker:()=>new Worker(new URL("css.worker.js",import.meta.url),{type:"module"}),label:this._defaults.languageId,createData:{options:this._defaults.options,languageId:this._defaults.languageId}}),this._client=this._worker.getProxy()),this._client}getLanguageServiceWorker(...s){let e;return this._getClient().then(p=>{e=p}).then(p=>{if(this._worker)return this._worker.withSyncedResources(s)}).then(p=>e)}};function tt(n){let s=[],e=[],p=new m(n);s.push(p);let r=(...t)=>p.getLanguageServiceWorker(...t);function A(){let{languageId:t,modeConfiguration:i}=n;I(e),i.completionItems&&e.push(o.registerCompletionItemProvider(t,new g(r,["/","-",":"]))),i.hovers&&e.push(o.registerHoverProvider(t,new l(r))),i.documentHighlights&&e.push(o.registerDocumentHighlightProvider(t,new h(r))),i.definitions&&e.push(o.registerDefinitionProvider(t,new c(r))),i.references&&e.push(o.registerReferenceProvider(t,new u(r))),i.documentSymbols&&e.push(o.registerDocumentSymbolProvider(t,new _(r))),i.rename&&e.push(o.registerRenameProvider(t,new f(r))),i.colors&&e.push(o.registerColorProvider(t,new v(r))),i.foldingRanges&&e.push(o.registerFoldingRangeProvider(t,new D(r))),i.diagnostics&&e.push(new d(t,r,n.onDidChange)),i.selectionRanges&&e.push(o.registerSelectionRangeProvider(t,new P(r))),i.documentFormattingEdits&&e.push(o.registerDocumentFormattingEditProvider(t,new w(r))),i.documentRangeFormattingEdits&&e.push(o.registerDocumentRangeFormattingEditProvider(t,new k(r)))}return A(),s.push(R(e)),R(s)}function R(n){return{dispose:()=>I(n)}}function I(n){for(;n.length;)n.pop().dispose()}export{g as CompletionAdapter,c as DefinitionAdapter,d as DiagnosticsAdapter,v as DocumentColorAdapter,w as DocumentFormattingEditProvider,h as DocumentHighlightAdapter,F as DocumentLinkAdapter,k as DocumentRangeFormattingEditProvider,_ as DocumentSymbolAdapter,D as FoldingRangeAdapter,l as HoverAdapter,u as ReferenceAdapter,f as RenameAdapter,P as SelectionRangeAdapter,m as WorkerManager,C as fromPosition,W as fromRange,tt as setupMode,S as toRange,E as toTextEdit};
