devicetree-language-server 0.8.0-beta2 → 0.8.0-beta3
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/THIRD_PARTY_LICENSES.txt +1 -1
- package/dist/server.js +40 -40
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -3,37 +3,37 @@
|
|
|
3
3
|
${JSON.stringify(Object.fromEntries(n))}`));return}let s=parseInt(i);if(isNaN(s)){this.fireError(new Error(`Content-Length value must be a number. Got ${i}`));return}this.nextMessageLength=s}let r=this.buffer.tryReadBody(this.nextMessageLength);if(r===void 0){this.setPartialMessageTimer();return}this.clearPartialMessageTimer(),this.nextMessageLength=-1,this.readSemaphore.lock(async()=>{let n=this.options.contentDecoder!==void 0?await this.options.contentDecoder.decode(r):r,i=await this.options.contentTypeDecoder.decode(n,this.options);this.callback(i)}).catch(n=>{this.fireError(n)})}}catch(r){this.fireError(r)}}clearPartialMessageTimer(){this.partialMessageTimer&&(this.partialMessageTimer.dispose(),this.partialMessageTimer=void 0)}setPartialMessageTimer(){this.clearPartialMessageTimer(),!(this._partialMessageTimeout<=0)&&(this.partialMessageTimer=(0,zg.default)().timer.setTimeout((e,r)=>{this.partialMessageTimer=void 0,e===this.messageToken&&(this.firePartialMessage({messageToken:e,waitingTime:r}),this.setPartialMessageTimer())},this._partialMessageTimeout,this.messageToken,this._partialMessageTimeout))}};Ji.ReadableStreamMessageReader=Gg});var Ik=R(Qi=>{"use strict";Object.defineProperty(Qi,"__esModule",{value:!0});Qi.WriteableStreamMessageWriter=Qi.AbstractMessageWriter=Qi.MessageWriter=void 0;var wk=Xi(),Sc=xo(),TB=Hg(),Ck=Lo(),vB="Content-Length: ",Dk=`\r
|
|
4
4
|
`,Ak;(function(t){function e(r){let n=r;return n&&Sc.func(n.dispose)&&Sc.func(n.onClose)&&Sc.func(n.onError)&&Sc.func(n.write)}t.is=e})(Ak||(Qi.MessageWriter=Ak={}));var Td=class{constructor(){this.errorEmitter=new Ck.Emitter,this.closeEmitter=new Ck.Emitter}dispose(){this.errorEmitter.dispose(),this.closeEmitter.dispose()}get onError(){return this.errorEmitter.event}fireError(e,r,n){this.errorEmitter.fire([this.asError(e),r,n])}get onClose(){return this.closeEmitter.event}fireClose(){this.closeEmitter.fire(void 0)}asError(e){return e instanceof Error?e:new Error(`Writer received error. Reason: ${Sc.string(e.message)?e.message:"unknown"}`)}};Qi.AbstractMessageWriter=Td;var Kg;(function(t){function e(r){return r===void 0||typeof r=="string"?{charset:r??"utf-8",contentTypeEncoder:(0,wk.default)().applicationJson.encoder}:{charset:r.charset??"utf-8",contentEncoder:r.contentEncoder,contentTypeEncoder:r.contentTypeEncoder??(0,wk.default)().applicationJson.encoder}}t.fromOptions=e})(Kg||(Kg={}));var Yg=class extends Td{constructor(e,r){super(),this.writable=e,this.options=Kg.fromOptions(r),this.errorCount=0,this.writeSemaphore=new TB.Semaphore(1),this.writable.onError(n=>this.fireError(n)),this.writable.onClose(()=>this.fireClose())}async write(e){return this.writeSemaphore.lock(async()=>this.options.contentTypeEncoder.encode(e,this.options).then(n=>this.options.contentEncoder!==void 0?this.options.contentEncoder.encode(n):n).then(n=>{let i=[];return i.push(vB,n.byteLength.toString(),Dk),i.push(Dk),this.doWrite(e,i,n)},n=>{throw this.fireError(n),n}))}async doWrite(e,r,n){try{return await this.writable.write(r.join(""),"ascii"),this.writable.write(n)}catch(i){return this.handleError(i,e),Promise.reject(i)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){this.writable.end()}};Qi.WriteableStreamMessageWriter=Yg});var Ok=R(vd=>{"use strict";Object.defineProperty(vd,"__esModule",{value:!0});vd.AbstractMessageBuffer=void 0;var bB=13,SB=10,_B=`\r
|
|
5
5
|
`,Xg=class{constructor(e="utf-8"){this._encoding=e,this._chunks=[],this._totalLength=0}get encoding(){return this._encoding}append(e){let r=typeof e=="string"?this.fromString(e,this._encoding):e;this._chunks.push(r),this._totalLength+=r.byteLength}tryReadHeaders(e=!1){if(this._chunks.length===0)return;let r=0,n=0,i=0,s=0;e:for(;n<this._chunks.length;){let l=this._chunks[n];for(i=0;i<l.length;){switch(l[i]){case bB:switch(r){case 0:r=1;break;case 2:r=3;break;default:r=0}break;case SB:switch(r){case 1:r=2;break;case 3:r=4,i++;break e;default:r=0}break;default:r=0}i++}s+=l.byteLength,n++}if(r!==4)return;let o=this._read(s+i),a=new Map,c=this.toString(o,"ascii").split(_B);if(c.length<2)return a;for(let l=0;l<c.length-2;l++){let u=c[l],d=u.indexOf(":");if(d===-1)throw new Error(`Message header must separate key and value using ':'
|
|
6
|
-
${u}`);let f=u.substr(0,d),p=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,p)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){let s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);r.set(o,n),n+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else r.set(s,n),n+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return r}};vd.AbstractMessageBuffer=Xg});var $k=R(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.createMessageConnection=Te.ConnectionOptions=Te.MessageStrategy=Te.CancellationStrategy=Te.CancellationSenderStrategy=Te.CancellationReceiverStrategy=Te.RequestCancellationReceiverStrategy=Te.IdCancellationReceiverStrategy=Te.ConnectionStrategy=Te.ConnectionError=Te.ConnectionErrors=Te.LogTraceNotification=Te.SetTraceNotification=Te.TraceFormat=Te.TraceValues=Te.Trace=Te.NullLogger=Te.ProgressType=Te.ProgressToken=void 0;var xk=Xi(),Nt=xo(),de=Cg(),Mk=Ag(),_c=Lo(),Jg=md(),Rc;(function(t){t.type=new de.NotificationType("$/cancelRequest")})(Rc||(Rc={}));var Qg;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(Qg||(Te.ProgressToken=Qg={}));var kc;(function(t){t.type=new de.NotificationType("$/progress")})(kc||(kc={}));var Zg=class{constructor(){}};Te.ProgressType=Zg;var ey;(function(t){function e(r){return Nt.func(r)}t.is=e})(ey||(ey={}));Te.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ge;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ge||(Te.Trace=Ge={}));var Lk;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Lk||(Te.TraceValues=Lk={}));(function(t){function e(n){if(!Nt.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(Ge||(Te.Trace=Ge={}));var Qr;(function(t){t.Text="text",t.JSON="json"})(Qr||(Te.TraceFormat=Qr={}));(function(t){function e(r){return Nt.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(Qr||(Te.TraceFormat=Qr={}));var ty;(function(t){t.type=new de.NotificationType("$/setTrace")})(ty||(Te.SetTraceNotification=ty={}));var bd;(function(t){t.type=new de.NotificationType("$/logTrace")})(bd||(Te.LogTraceNotification=bd={}));var Nc;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Nc||(Te.ConnectionErrors=Nc={}));var Bo=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Te.ConnectionError=Bo;var ry;(function(t){function e(r){let n=r;return n&&Nt.func(n.cancelUndispatched)}t.is=e})(ry||(Te.ConnectionStrategy=ry={}));var Sd;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&Nt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Nt.func(n.dispose))}t.is=e})(Sd||(Te.IdCancellationReceiverStrategy=Sd={}));var ny;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&Nt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Nt.func(n.dispose))}t.is=e})(ny||(Te.RequestCancellationReceiverStrategy=ny={}));var _d;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Jg.CancellationTokenSource}});function e(r){return Sd.is(r)||ny.is(r)}t.is=e})(_d||(Te.CancellationReceiverStrategy=_d={}));var kd;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Rc.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&Nt.func(n.sendCancellation)&&Nt.func(n.cleanup)}t.is=e})(kd||(Te.CancellationSenderStrategy=kd={}));var Nd;(function(t){t.Message=Object.freeze({receiver:_d.Message,sender:kd.Message});function e(r){let n=r;return n&&_d.is(n.receiver)&&kd.is(n.sender)}t.is=e})(Nd||(Te.CancellationStrategy=Nd={}));var Rd;(function(t){function e(r){let n=r;return n&&Nt.func(n.handleMessage)}t.is=e})(Rd||(Te.MessageStrategy=Rd={}));var qk;(function(t){function e(r){let n=r;return n&&(Nd.is(n.cancellationStrategy)||ry.is(n.connectionStrategy)||Rd.is(n.messageStrategy))}t.is=e})(qk||(Te.ConnectionOptions=qk={}));var
|
|
6
|
+
${u}`);let f=u.substr(0,d),p=u.substr(d+1).trim();a.set(e?f.toLowerCase():f,p)}return a}tryReadBody(e){if(!(this._totalLength<e))return this._read(e)}get numberOfBytes(){return this._totalLength}_read(e){if(e===0)return this.emptyBuffer();if(e>this._totalLength)throw new Error("Cannot read so many bytes!");if(this._chunks[0].byteLength===e){let s=this._chunks[0];return this._chunks.shift(),this._totalLength-=e,this.asNative(s)}if(this._chunks[0].byteLength>e){let s=this._chunks[0],o=this.asNative(s,e);return this._chunks[0]=s.slice(e),this._totalLength-=e,o}let r=this.allocNative(e),n=0,i=0;for(;e>0;){let s=this._chunks[i];if(s.byteLength>e){let o=s.slice(0,e);r.set(o,n),n+=e,this._chunks[i]=s.slice(e),this._totalLength-=e,e-=e}else r.set(s,n),n+=s.byteLength,this._chunks.shift(),this._totalLength-=s.byteLength,e-=s.byteLength}return r}};vd.AbstractMessageBuffer=Xg});var $k=R(Te=>{"use strict";Object.defineProperty(Te,"__esModule",{value:!0});Te.createMessageConnection=Te.ConnectionOptions=Te.MessageStrategy=Te.CancellationStrategy=Te.CancellationSenderStrategy=Te.CancellationReceiverStrategy=Te.RequestCancellationReceiverStrategy=Te.IdCancellationReceiverStrategy=Te.ConnectionStrategy=Te.ConnectionError=Te.ConnectionErrors=Te.LogTraceNotification=Te.SetTraceNotification=Te.TraceFormat=Te.TraceValues=Te.Trace=Te.NullLogger=Te.ProgressType=Te.ProgressToken=void 0;var xk=Xi(),Nt=xo(),de=Cg(),Mk=Ag(),_c=Lo(),Jg=md(),Rc;(function(t){t.type=new de.NotificationType("$/cancelRequest")})(Rc||(Rc={}));var Qg;(function(t){function e(r){return typeof r=="string"||typeof r=="number"}t.is=e})(Qg||(Te.ProgressToken=Qg={}));var kc;(function(t){t.type=new de.NotificationType("$/progress")})(kc||(kc={}));var Zg=class{constructor(){}};Te.ProgressType=Zg;var ey;(function(t){function e(r){return Nt.func(r)}t.is=e})(ey||(ey={}));Te.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}});var Ge;(function(t){t[t.Off=0]="Off",t[t.Messages=1]="Messages",t[t.Compact=2]="Compact",t[t.Verbose=3]="Verbose"})(Ge||(Te.Trace=Ge={}));var Lk;(function(t){t.Off="off",t.Messages="messages",t.Compact="compact",t.Verbose="verbose"})(Lk||(Te.TraceValues=Lk={}));(function(t){function e(n){if(!Nt.string(n))return t.Off;switch(n=n.toLowerCase(),n){case"off":return t.Off;case"messages":return t.Messages;case"compact":return t.Compact;case"verbose":return t.Verbose;default:return t.Off}}t.fromString=e;function r(n){switch(n){case t.Off:return"off";case t.Messages:return"messages";case t.Compact:return"compact";case t.Verbose:return"verbose";default:return"off"}}t.toString=r})(Ge||(Te.Trace=Ge={}));var Qr;(function(t){t.Text="text",t.JSON="json"})(Qr||(Te.TraceFormat=Qr={}));(function(t){function e(r){return Nt.string(r)?(r=r.toLowerCase(),r==="json"?t.JSON:t.Text):t.Text}t.fromString=e})(Qr||(Te.TraceFormat=Qr={}));var ty;(function(t){t.type=new de.NotificationType("$/setTrace")})(ty||(Te.SetTraceNotification=ty={}));var bd;(function(t){t.type=new de.NotificationType("$/logTrace")})(bd||(Te.LogTraceNotification=bd={}));var Nc;(function(t){t[t.Closed=1]="Closed",t[t.Disposed=2]="Disposed",t[t.AlreadyListening=3]="AlreadyListening"})(Nc||(Te.ConnectionErrors=Nc={}));var Bo=class t extends Error{constructor(e,r){super(r),this.code=e,Object.setPrototypeOf(this,t.prototype)}};Te.ConnectionError=Bo;var ry;(function(t){function e(r){let n=r;return n&&Nt.func(n.cancelUndispatched)}t.is=e})(ry||(Te.ConnectionStrategy=ry={}));var Sd;(function(t){function e(r){let n=r;return n&&(n.kind===void 0||n.kind==="id")&&Nt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Nt.func(n.dispose))}t.is=e})(Sd||(Te.IdCancellationReceiverStrategy=Sd={}));var ny;(function(t){function e(r){let n=r;return n&&n.kind==="request"&&Nt.func(n.createCancellationTokenSource)&&(n.dispose===void 0||Nt.func(n.dispose))}t.is=e})(ny||(Te.RequestCancellationReceiverStrategy=ny={}));var _d;(function(t){t.Message=Object.freeze({createCancellationTokenSource(r){return new Jg.CancellationTokenSource}});function e(r){return Sd.is(r)||ny.is(r)}t.is=e})(_d||(Te.CancellationReceiverStrategy=_d={}));var kd;(function(t){t.Message=Object.freeze({sendCancellation(r,n){return r.sendNotification(Rc.type,{id:n})},cleanup(r){}});function e(r){let n=r;return n&&Nt.func(n.sendCancellation)&&Nt.func(n.cleanup)}t.is=e})(kd||(Te.CancellationSenderStrategy=kd={}));var Nd;(function(t){t.Message=Object.freeze({receiver:_d.Message,sender:kd.Message});function e(r){let n=r;return n&&_d.is(n.receiver)&&kd.is(n.sender)}t.is=e})(Nd||(Te.CancellationStrategy=Nd={}));var Rd;(function(t){function e(r){let n=r;return n&&Nt.func(n.handleMessage)}t.is=e})(Rd||(Te.MessageStrategy=Rd={}));var qk;(function(t){function e(r){let n=r;return n&&(Nd.is(n.cancellationStrategy)||ry.is(n.connectionStrategy)||Rd.is(n.messageStrategy))}t.is=e})(qk||(Te.ConnectionOptions=qk={}));var Fn;(function(t){t[t.New=1]="New",t[t.Listening=2]="Listening",t[t.Closed=3]="Closed",t[t.Disposed=4]="Disposed"})(Fn||(Fn={}));function kB(t,e,r,n){let i=r!==void 0?r:Te.NullLogger,s=0,o=0,a=0,c="2.0",l,u=new Map,d,f=new Map,p=new Map,m,h=new Mk.LinkedMap,T=new Map,_=new Set,b=new Map,v=Ge.Off,k=Qr.Text,w,H=Fn.New,O=new _c.Emitter,B=new _c.Emitter,De=new _c.Emitter,lt=new _c.Emitter,Ht=new _c.Emitter,Ne=n&&n.cancellationStrategy?n.cancellationStrategy:Nd.Message;function un(P){if(P===null)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+P.toString()}function Gi(P){return P===null?"res-unknown-"+(++a).toString():"res-"+P.toString()}function Gu(){return"not-"+(++o).toString()}function ng(P,L){de.Message.isRequest(L)?P.set(un(L.id),L):de.Message.isResponse(L)?P.set(Gi(L.id),L):P.set(Gu(),L)}function Ku(P){}function hc(){return H===Fn.Listening}function Fs(){return H===Fn.Closed}function Ni(){return H===Fn.Disposed}function Co(){(H===Fn.New||H===Fn.Listening)&&(H=Fn.Closed,B.fire(void 0))}function Bs(P){O.fire([P,void 0,void 0])}function Yu(P){O.fire(P)}t.onClose(Co),t.onError(Bs),e.onClose(Co),e.onError(Yu);function mc(){m||h.size===0||(m=(0,xk.default)().timer.setImmediate(()=>{m=void 0,Xu()}))}function gc(P){de.Message.isRequest(P)?Qu(P):de.Message.isNotification(P)?ed(P):de.Message.isResponse(P)?Zu(P):Do(P)}function Xu(){if(h.size===0)return;let P=h.shift();try{let L=n?.messageStrategy;Rd.is(L)?L.handleMessage(P,gc):gc(P)}finally{mc()}}let Ju=P=>{try{if(de.Message.isNotification(P)&&P.method===Rc.type.method){let L=P.params.id,G=un(L),re=h.get(G);if(de.Message.isRequest(re)){let Ye=n?.connectionStrategy,ht=Ye&&Ye.cancelUndispatched?Ye.cancelUndispatched(re,Ku):void 0;if(ht&&(ht.error!==void 0||ht.result!==void 0)){h.delete(G),b.delete(L),ht.id=re.id,js(ht,P.method,Date.now()),e.write(ht).catch(()=>i.error("Sending response for canceled message failed."));return}}let et=b.get(L);if(et!==void 0){et.cancel(),Ao(P);return}else _.add(L)}ng(h,P)}finally{mc()}};function Qu(P){if(Ni())return;function L(Re,it,Ve){let wt={jsonrpc:c,id:P.id};Re instanceof de.ResponseError?wt.error=Re.toJson():wt.result=Re===void 0?null:Re,js(wt,it,Ve),e.write(wt).catch(()=>i.error("Sending response failed."))}function G(Re,it,Ve){let wt={jsonrpc:c,id:P.id,error:Re.toJson()};js(wt,it,Ve),e.write(wt).catch(()=>i.error("Sending response failed."))}function re(Re,it,Ve){Re===void 0&&(Re=null);let wt={jsonrpc:c,id:P.id,result:Re};js(wt,it,Ve),e.write(wt).catch(()=>i.error("Sending response failed."))}nd(P);let et=u.get(P.method),Ye,ht;et&&(Ye=et.type,ht=et.handler);let St=Date.now();if(ht||l){let Re=P.id??String(Date.now()),it=Sd.is(Ne.receiver)?Ne.receiver.createCancellationTokenSource(Re):Ne.receiver.createCancellationTokenSource(P);P.id!==null&&_.has(P.id)&&it.cancel(),P.id!==null&&b.set(Re,it);try{let Ve;if(ht)if(P.params===void 0){if(Ye!==void 0&&Ye.numberOfParams!==0){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines ${Ye.numberOfParams} params but received none.`),P.method,St);return}Ve=ht(it.token)}else if(Array.isArray(P.params)){if(Ye!==void 0&&Ye.parameterStructures===de.ParameterStructures.byName){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by name but received parameters by position`),P.method,St);return}Ve=ht(...P.params,it.token)}else{if(Ye!==void 0&&Ye.parameterStructures===de.ParameterStructures.byPosition){G(new de.ResponseError(de.ErrorCodes.InvalidParams,`Request ${P.method} defines parameters by position but received parameters by name`),P.method,St);return}Ve=ht(P.params,it.token)}else l&&(Ve=l(P.method,P.params,it.token));let wt=Ve;Ve?wt.then?wt.then(Wt=>{b.delete(Re),L(Wt,P.method,St)},Wt=>{b.delete(Re),Wt instanceof de.ResponseError?G(Wt,P.method,St):Wt&&Nt.string(Wt.message)?G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${Wt.message}`),P.method,St):G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,St)}):(b.delete(Re),L(Ve,P.method,St)):(b.delete(Re),re(Ve,P.method,St))}catch(Ve){b.delete(Re),Ve instanceof de.ResponseError?L(Ve,P.method,St):Ve&&Nt.string(Ve.message)?G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed with message: ${Ve.message}`),P.method,St):G(new de.ResponseError(de.ErrorCodes.InternalError,`Request ${P.method} failed unexpectedly without providing any details.`),P.method,St)}}else G(new de.ResponseError(de.ErrorCodes.MethodNotFound,`Unhandled method ${P.method}`),P.method,St)}function Zu(P){if(!Ni())if(P.id===null)P.error?i.error(`Received response message without id: Error is:
|
|
7
7
|
${JSON.stringify(P.error,void 0,4)}`):i.error("Received response message without id. No further error information provided.");else{let L=P.id,G=T.get(L);if(id(P,G),G!==void 0){T.delete(L);try{if(P.error){let re=P.error;G.reject(new de.ResponseError(re.code,re.message,re.data))}else if(P.result!==void 0)G.resolve(P.result);else throw new Error("Should never happen.")}catch(re){re.message?i.error(`Response handler '${G.method}' failed with message: ${re.message}`):i.error(`Response handler '${G.method}' failed unexpectedly.`)}}}}function ed(P){if(Ni())return;let L,G;if(P.method===Rc.type.method){let re=P.params.id;_.delete(re),Ao(P);return}else{let re=f.get(P.method);re&&(G=re.handler,L=re.type)}if(G||d)try{if(Ao(P),G)if(P.params===void 0)L!==void 0&&L.numberOfParams!==0&&L.parameterStructures!==de.ParameterStructures.byName&&i.error(`Notification ${P.method} defines ${L.numberOfParams} params but received none.`),G();else if(Array.isArray(P.params)){let re=P.params;P.method===kc.type.method&&re.length===2&&Qg.is(re[0])?G({token:re[0],value:re[1]}):(L!==void 0&&(L.parameterStructures===de.ParameterStructures.byName&&i.error(`Notification ${P.method} defines parameters by name but received parameters by position`),L.numberOfParams!==P.params.length&&i.error(`Notification ${P.method} defines ${L.numberOfParams} params but received ${re.length} arguments`)),G(...re))}else L!==void 0&&L.parameterStructures===de.ParameterStructures.byPosition&&i.error(`Notification ${P.method} defines parameters by position but received parameters by name`),G(P.params);else d&&d(P.method,P.params)}catch(re){re.message?i.error(`Notification handler '${P.method}' failed with message: ${re.message}`):i.error(`Notification handler '${P.method}' failed unexpectedly.`)}else De.fire(P)}function Do(P){if(!P){i.error("Received empty message.");return}i.error(`Received message which is neither a response nor a notification message:
|
|
8
|
-
${JSON.stringify(P,null,4)}`);let L=P;if(Nt.string(L.id)||Nt.number(L.id)){let G=L.id,re=T.get(G);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function
|
|
8
|
+
${JSON.stringify(P,null,4)}`);let L=P;if(Nt.string(L.id)||Nt.number(L.id)){let G=L.id,re=T.get(G);re&&re.reject(new Error("The received response has neither a result nor an error property."))}}function Ln(P){if(P!=null)switch(v){case Ge.Verbose:return JSON.stringify(P,null,4);case Ge.Compact:return JSON.stringify(P);default:return}}function td(P){if(!(v===Ge.Off||!w))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&P.params&&(L=`Params: ${Ln(P.params)}
|
|
9
9
|
|
|
10
|
-
`),w.log(`Sending request '${P.method} - (${P.id})'.`,L)}else Ri("send-request",P)}function rd(P){if(!(v===Ge.Off||!w))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&(P.params?L=`Params: ${
|
|
10
|
+
`),w.log(`Sending request '${P.method} - (${P.id})'.`,L)}else Ri("send-request",P)}function rd(P){if(!(v===Ge.Off||!w))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&(P.params?L=`Params: ${Ln(P.params)}
|
|
11
11
|
|
|
12
12
|
`:L=`No parameters provided.
|
|
13
13
|
|
|
14
|
-
`),w.log(`Sending notification '${P.method}'.`,L)}else Ri("send-notification",P)}function js(P,L,G){if(!(v===Ge.Off||!w))if(k===Qr.Text){let re;(v===Ge.Verbose||v===Ge.Compact)&&(P.error&&P.error.data?re=`Error data: ${
|
|
14
|
+
`),w.log(`Sending notification '${P.method}'.`,L)}else Ri("send-notification",P)}function js(P,L,G){if(!(v===Ge.Off||!w))if(k===Qr.Text){let re;(v===Ge.Verbose||v===Ge.Compact)&&(P.error&&P.error.data?re=`Error data: ${Ln(P.error.data)}
|
|
15
15
|
|
|
16
|
-
`:P.result?re=`Result: ${
|
|
16
|
+
`:P.result?re=`Result: ${Ln(P.result)}
|
|
17
17
|
|
|
18
18
|
`:P.error===void 0&&(re=`No result returned.
|
|
19
19
|
|
|
20
|
-
`)),w.log(`Sending response '${L} - (${P.id})'. Processing request took ${Date.now()-G}ms`,re)}else Ri("send-response",P)}function nd(P){if(!(v===Ge.Off||!w))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&P.params&&(L=`Params: ${
|
|
20
|
+
`)),w.log(`Sending response '${L} - (${P.id})'. Processing request took ${Date.now()-G}ms`,re)}else Ri("send-response",P)}function nd(P){if(!(v===Ge.Off||!w))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&P.params&&(L=`Params: ${Ln(P.params)}
|
|
21
21
|
|
|
22
|
-
`),w.log(`Received request '${P.method} - (${P.id})'.`,L)}else Ri("receive-request",P)}function Ao(P){if(!(v===Ge.Off||!w||P.method===bd.type.method))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&(P.params?L=`Params: ${
|
|
22
|
+
`),w.log(`Received request '${P.method} - (${P.id})'.`,L)}else Ri("receive-request",P)}function Ao(P){if(!(v===Ge.Off||!w||P.method===bd.type.method))if(k===Qr.Text){let L;(v===Ge.Verbose||v===Ge.Compact)&&(P.params?L=`Params: ${Ln(P.params)}
|
|
23
23
|
|
|
24
24
|
`:L=`No parameters provided.
|
|
25
25
|
|
|
26
|
-
`),w.log(`Received notification '${P.method}'.`,L)}else Ri("receive-notification",P)}function id(P,L){if(!(v===Ge.Off||!w))if(k===Qr.Text){let G;if((v===Ge.Verbose||v===Ge.Compact)&&(P.error&&P.error.data?G=`Error data: ${
|
|
26
|
+
`),w.log(`Received notification '${P.method}'.`,L)}else Ri("receive-notification",P)}function id(P,L){if(!(v===Ge.Off||!w))if(k===Qr.Text){let G;if((v===Ge.Verbose||v===Ge.Compact)&&(P.error&&P.error.data?G=`Error data: ${Ln(P.error.data)}
|
|
27
27
|
|
|
28
|
-
`:P.result?G=`Result: ${
|
|
28
|
+
`:P.result?G=`Result: ${Ln(P.result)}
|
|
29
29
|
|
|
30
30
|
`:P.error===void 0&&(G=`No result returned.
|
|
31
31
|
|
|
32
|
-
`)),L){let re=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";w.log(`Received response '${L.method} - (${P.id})' in ${Date.now()-L.timerStart}ms.${re}`,G)}else w.log(`Received response ${P.id} without active response promise.`,G)}else Ri("receive-response",P)}function Ri(P,L){if(!w||v===Ge.Off)return;let G={isLSPMessage:!0,type:P,message:L,timestamp:Date.now()};w.log(G)}function Ki(){if(Fs())throw new Bo(Nc.Closed,"Connection is closed.");if(Ni())throw new Bo(Nc.Disposed,"Connection is disposed.")}function sd(){if(hc())throw new Bo(Nc.AlreadyListening,"Connection is already listening")}function od(){if(!hc())throw new Error("Call listen() first.")}function ii(P){return P===void 0?null:P}function yc(P){if(P!==null)return P}function Tc(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Io(P,L){switch(P){case de.ParameterStructures.auto:return Tc(L)?yc(L):[ii(L)];case de.ParameterStructures.byName:if(!Tc(L))throw new Error("Received parameters by name but param is not an object literal.");return yc(L);case de.ParameterStructures.byPosition:return[ii(L)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function vc(P,L){let G,re=P.numberOfParams;switch(re){case 0:G=void 0;break;case 1:G=Io(P.parameterStructures,L[0]);break;default:G=[];for(let et=0;et<L.length&&et<re;et++)G.push(ii(L[et]));if(L.length<re)for(let et=L.length;et<re;et++)G.push(null);break}return G}let Pi={sendNotification:(P,...L)=>{Ki();let G,re;if(Nt.string(P)){G=P;let Ye=L[0],ht=0,St=de.ParameterStructures.auto;de.ParameterStructures.is(Ye)&&(ht=1,St=Ye);let Re=L.length,it=Re-ht;switch(it){case 0:re=void 0;break;case 1:re=Io(St,L[ht]);break;default:if(St===de.ParameterStructures.byName)throw new Error(`Received ${it} parameters for 'by Name' notification parameter structure.`);re=L.slice(ht,Re).map(Ve=>ii(Ve));break}}else{let Ye=L;G=P.method,re=vc(P,Ye)}let et={jsonrpc:c,method:G,params:re};return rd(et),e.write(et).catch(Ye=>{throw i.error("Sending notification failed."),Ye})},onNotification:(P,L)=>{Ki();let G;return Nt.func(P)?d=P:L&&(Nt.string(P)?(G=P,f.set(P,{type:void 0,handler:L})):(G=P.method,f.set(P.method,{type:P,handler:L}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(P,L,G)=>{if(p.has(L))throw new Error(`Progress handler for token ${L} already registered`);return p.set(L,G),{dispose:()=>{p.delete(L)}}},sendProgress:(P,L,G)=>Pi.sendNotification(kc.type,{token:L,value:G}),onUnhandledProgress:lt.event,sendRequest:(P,...L)=>{Ki(),od();let G,re,et;if(Nt.string(P)){G=P;let Re=L[0],it=L[L.length-1],Ve=0,wt=de.ParameterStructures.auto;de.ParameterStructures.is(Re)&&(Ve=1,wt=Re);let Wt=L.length;Jg.CancellationToken.is(it)&&(Wt=Wt-1,et=it);let Jr=Wt-Ve;switch(Jr){case 0:re=void 0;break;case 1:re=Io(wt,L[Ve]);break;default:if(wt===de.ParameterStructures.byName)throw new Error(`Received ${Jr} parameters for 'by Name' request parameter structure.`);re=L.slice(Ve,Wt).map(ad=>ii(ad));break}}else{let Re=L;G=P.method,re=vc(P,Re);let it=P.numberOfParams;et=Jg.CancellationToken.is(Re[it])?Re[it]:void 0}let Ye=s++,ht;et&&(ht=et.onCancellationRequested(()=>{let Re=Ne.sender.sendCancellation(Pi,Ye);return Re===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ye}`),Promise.resolve()):Re.catch(()=>{i.log(`Sending cancellation messages for id ${Ye} failed`)})}));let St={jsonrpc:c,id:Ye,method:G,params:re};return td(St),typeof Ne.sender.enableCancellation=="function"&&Ne.sender.enableCancellation(St),new Promise(async(Re,it)=>{let Ve=Jr=>{Re(Jr),Ne.sender.cleanup(Ye),ht?.dispose()},wt=Jr=>{it(Jr),Ne.sender.cleanup(Ye),ht?.dispose()},Wt={method:G,timerStart:Date.now(),resolve:Ve,reject:wt};try{await e.write(St),T.set(Ye,Wt)}catch(Jr){throw i.error("Sending request failed."),Wt.reject(new de.ResponseError(de.ErrorCodes.MessageWriteError,Jr.message?Jr.message:"Unknown reason")),Jr}})},onRequest:(P,L)=>{Ki();let G=null;return ey.is(P)?(G=void 0,l=P):Nt.string(P)?(G=null,L!==void 0&&(G=P,u.set(P,{handler:L,type:void 0}))):L!==void 0&&(G=P.method,u.set(P.method,{type:P,handler:L})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>T.size>0,trace:async(P,L,G)=>{let re=!1,et=Qr.Text;G!==void 0&&(Nt.boolean(G)?re=G:(re=G.sendNotification||!1,et=G.traceFormat||Qr.Text)),v=P,k=et,v===Ge.Off?w=void 0:w=L,re&&!Fs()&&!Ni()&&await Pi.sendNotification(ty.type,{value:Ge.toString(P)})},onError:O.event,onClose:B.event,onUnhandledNotification:De.event,onDispose:Ht.event,end:()=>{e.end()},dispose:()=>{if(Ni())return;H=$n.Disposed,Ht.fire(void 0);let P=new de.ResponseError(de.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let L of T.values())L.reject(P);T=new Map,b=new Map,_=new Set,h=new Mk.LinkedMap,Nt.func(e.dispose)&&e.dispose(),Nt.func(t.dispose)&&t.dispose()},listen:()=>{Ki(),sd(),H=$n.Listening,t.listen(Ju)},inspect:()=>{(0,xk.default)().console.log("inspect")}};return Pi.onNotification(bd.type,P=>{if(v===Ge.Off||!w)return;let L=v===Ge.Verbose||v===Ge.Compact;w.log(P.message,L?P.verbose:void 0)}),Pi.onNotification(kc.type,P=>{let L=p.get(P.token);L?L(P.value):lt.fire(P)}),Pi}Te.createMessageConnection=kB});var Pd=R(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.ProgressType=x.ProgressToken=x.createMessageConnection=x.NullLogger=x.ConnectionOptions=x.ConnectionStrategy=x.AbstractMessageBuffer=x.WriteableStreamMessageWriter=x.AbstractMessageWriter=x.MessageWriter=x.ReadableStreamMessageReader=x.AbstractMessageReader=x.MessageReader=x.SharedArrayReceiverStrategy=x.SharedArraySenderStrategy=x.CancellationToken=x.CancellationTokenSource=x.Emitter=x.Event=x.Disposable=x.LRUCache=x.Touch=x.LinkedMap=x.ParameterStructures=x.NotificationType9=x.NotificationType8=x.NotificationType7=x.NotificationType6=x.NotificationType5=x.NotificationType4=x.NotificationType3=x.NotificationType2=x.NotificationType1=x.NotificationType0=x.NotificationType=x.ErrorCodes=x.ResponseError=x.RequestType9=x.RequestType8=x.RequestType7=x.RequestType6=x.RequestType5=x.RequestType4=x.RequestType3=x.RequestType2=x.RequestType1=x.RequestType0=x.RequestType=x.Message=x.RAL=void 0;x.MessageStrategy=x.CancellationStrategy=x.CancellationSenderStrategy=x.CancellationReceiverStrategy=x.ConnectionError=x.ConnectionErrors=x.LogTraceNotification=x.SetTraceNotification=x.TraceFormat=x.TraceValues=x.Trace=void 0;var dt=Cg();Object.defineProperty(x,"Message",{enumerable:!0,get:function(){return dt.Message}});Object.defineProperty(x,"RequestType",{enumerable:!0,get:function(){return dt.RequestType}});Object.defineProperty(x,"RequestType0",{enumerable:!0,get:function(){return dt.RequestType0}});Object.defineProperty(x,"RequestType1",{enumerable:!0,get:function(){return dt.RequestType1}});Object.defineProperty(x,"RequestType2",{enumerable:!0,get:function(){return dt.RequestType2}});Object.defineProperty(x,"RequestType3",{enumerable:!0,get:function(){return dt.RequestType3}});Object.defineProperty(x,"RequestType4",{enumerable:!0,get:function(){return dt.RequestType4}});Object.defineProperty(x,"RequestType5",{enumerable:!0,get:function(){return dt.RequestType5}});Object.defineProperty(x,"RequestType6",{enumerable:!0,get:function(){return dt.RequestType6}});Object.defineProperty(x,"RequestType7",{enumerable:!0,get:function(){return dt.RequestType7}});Object.defineProperty(x,"RequestType8",{enumerable:!0,get:function(){return dt.RequestType8}});Object.defineProperty(x,"RequestType9",{enumerable:!0,get:function(){return dt.RequestType9}});Object.defineProperty(x,"ResponseError",{enumerable:!0,get:function(){return dt.ResponseError}});Object.defineProperty(x,"ErrorCodes",{enumerable:!0,get:function(){return dt.ErrorCodes}});Object.defineProperty(x,"NotificationType",{enumerable:!0,get:function(){return dt.NotificationType}});Object.defineProperty(x,"NotificationType0",{enumerable:!0,get:function(){return dt.NotificationType0}});Object.defineProperty(x,"NotificationType1",{enumerable:!0,get:function(){return dt.NotificationType1}});Object.defineProperty(x,"NotificationType2",{enumerable:!0,get:function(){return dt.NotificationType2}});Object.defineProperty(x,"NotificationType3",{enumerable:!0,get:function(){return dt.NotificationType3}});Object.defineProperty(x,"NotificationType4",{enumerable:!0,get:function(){return dt.NotificationType4}});Object.defineProperty(x,"NotificationType5",{enumerable:!0,get:function(){return dt.NotificationType5}});Object.defineProperty(x,"NotificationType6",{enumerable:!0,get:function(){return dt.NotificationType6}});Object.defineProperty(x,"NotificationType7",{enumerable:!0,get:function(){return dt.NotificationType7}});Object.defineProperty(x,"NotificationType8",{enumerable:!0,get:function(){return dt.NotificationType8}});Object.defineProperty(x,"NotificationType9",{enumerable:!0,get:function(){return dt.NotificationType9}});Object.defineProperty(x,"ParameterStructures",{enumerable:!0,get:function(){return dt.ParameterStructures}});var iy=Ag();Object.defineProperty(x,"LinkedMap",{enumerable:!0,get:function(){return iy.LinkedMap}});Object.defineProperty(x,"LRUCache",{enumerable:!0,get:function(){return iy.LRUCache}});Object.defineProperty(x,"Touch",{enumerable:!0,get:function(){return iy.Touch}});var NB=kk();Object.defineProperty(x,"Disposable",{enumerable:!0,get:function(){return NB.Disposable}});var Fk=Lo();Object.defineProperty(x,"Event",{enumerable:!0,get:function(){return Fk.Event}});Object.defineProperty(x,"Emitter",{enumerable:!0,get:function(){return Fk.Emitter}});var Bk=md();Object.defineProperty(x,"CancellationTokenSource",{enumerable:!0,get:function(){return Bk.CancellationTokenSource}});Object.defineProperty(x,"CancellationToken",{enumerable:!0,get:function(){return Bk.CancellationToken}});var jk=Rk();Object.defineProperty(x,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return jk.SharedArraySenderStrategy}});Object.defineProperty(x,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return jk.SharedArrayReceiverStrategy}});var sy=Ek();Object.defineProperty(x,"MessageReader",{enumerable:!0,get:function(){return sy.MessageReader}});Object.defineProperty(x,"AbstractMessageReader",{enumerable:!0,get:function(){return sy.AbstractMessageReader}});Object.defineProperty(x,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return sy.ReadableStreamMessageReader}});var oy=Ik();Object.defineProperty(x,"MessageWriter",{enumerable:!0,get:function(){return oy.MessageWriter}});Object.defineProperty(x,"AbstractMessageWriter",{enumerable:!0,get:function(){return oy.AbstractMessageWriter}});Object.defineProperty(x,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return oy.WriteableStreamMessageWriter}});var RB=Ok();Object.defineProperty(x,"AbstractMessageBuffer",{enumerable:!0,get:function(){return RB.AbstractMessageBuffer}});var tr=$k();Object.defineProperty(x,"ConnectionStrategy",{enumerable:!0,get:function(){return tr.ConnectionStrategy}});Object.defineProperty(x,"ConnectionOptions",{enumerable:!0,get:function(){return tr.ConnectionOptions}});Object.defineProperty(x,"NullLogger",{enumerable:!0,get:function(){return tr.NullLogger}});Object.defineProperty(x,"createMessageConnection",{enumerable:!0,get:function(){return tr.createMessageConnection}});Object.defineProperty(x,"ProgressToken",{enumerable:!0,get:function(){return tr.ProgressToken}});Object.defineProperty(x,"ProgressType",{enumerable:!0,get:function(){return tr.ProgressType}});Object.defineProperty(x,"Trace",{enumerable:!0,get:function(){return tr.Trace}});Object.defineProperty(x,"TraceValues",{enumerable:!0,get:function(){return tr.TraceValues}});Object.defineProperty(x,"TraceFormat",{enumerable:!0,get:function(){return tr.TraceFormat}});Object.defineProperty(x,"SetTraceNotification",{enumerable:!0,get:function(){return tr.SetTraceNotification}});Object.defineProperty(x,"LogTraceNotification",{enumerable:!0,get:function(){return tr.LogTraceNotification}});Object.defineProperty(x,"ConnectionErrors",{enumerable:!0,get:function(){return tr.ConnectionErrors}});Object.defineProperty(x,"ConnectionError",{enumerable:!0,get:function(){return tr.ConnectionError}});Object.defineProperty(x,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return tr.CancellationReceiverStrategy}});Object.defineProperty(x,"CancellationSenderStrategy",{enumerable:!0,get:function(){return tr.CancellationSenderStrategy}});Object.defineProperty(x,"CancellationStrategy",{enumerable:!0,get:function(){return tr.CancellationStrategy}});Object.defineProperty(x,"MessageStrategy",{enumerable:!0,get:function(){return tr.MessageStrategy}});var PB=Xi();x.RAL=PB.default});var Vk=R(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var Uk=require("util"),wi=Pd(),Ed=class t extends wi.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new Uk.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};Ed.emptyBuffer=Buffer.allocUnsafe(0);var ay=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),wi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),wi.Disposable.create(()=>this.stream.off("data",e))}},cy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),wi.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let s=o=>{o==null?n():i(o)};typeof e=="string"?this.stream.write(e,r,s):this.stream.write(e,s)})}end(){this.stream.end()}},Hk=Object.freeze({messageBuffer:Object.freeze({create:t=>new Ed(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new Uk.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new ay(t),asWritableStream:t=>new cy(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function ly(){return Hk}(function(t){function e(){wi.RAL.install(Hk)}t.install=e})(ly||(ly={}));uy.default=ly});var zs=R(Ie=>{"use strict";var EB=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wB=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EB(e,t,r)};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createMessageConnection=Ie.createServerSocketTransport=Ie.createClientSocketTransport=Ie.createServerPipeTransport=Ie.createClientPipeTransport=Ie.generateRandomPipeName=Ie.StreamMessageWriter=Ie.StreamMessageReader=Ie.SocketMessageWriter=Ie.SocketMessageReader=Ie.PortMessageWriter=Ie.PortMessageReader=Ie.IPCMessageWriter=Ie.IPCMessageReader=void 0;var jo=Vk();jo.default.install();var zk=require("path"),CB=require("os"),DB=require("crypto"),Dd=require("net"),Zr=Pd();wB(Pd(),Ie);var dy=class extends Zr.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Zr.Disposable.create(()=>this.process.off("message",e))}};Ie.IPCMessageReader=dy;var fy=class extends Zr.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Ie.IPCMessageWriter=fy;var py=class extends Zr.AbstractMessageReader{constructor(e){super(),this.onData=new Zr.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};Ie.PortMessageReader=py;var hy=class extends Zr.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Ie.PortMessageWriter=hy;var Hs=class extends Zr.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,jo.default)().stream.asReadableStream(e),r)}};Ie.SocketMessageReader=Hs;var Vs=class extends Zr.WriteableStreamMessageWriter{constructor(e,r){super((0,jo.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Ie.SocketMessageWriter=Vs;var wd=class extends Zr.ReadableStreamMessageReader{constructor(e,r){super((0,jo.default)().stream.asReadableStream(e),r)}};Ie.StreamMessageReader=wd;var Cd=class extends Zr.WriteableStreamMessageWriter{constructor(e,r){super((0,jo.default)().stream.asWritableStream(e),r)}};Ie.StreamMessageWriter=Cd;var Wk=process.env.XDG_RUNTIME_DIR,AB=new Map([["linux",107],["darwin",103]]);function IB(){let t=(0,DB.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;Wk?e=zk.join(Wk,`vscode-ipc-${t}.sock`):e=zk.join(CB.tmpdir(),`vscode-${t}.sock`);let r=AB.get(process.platform);return r!==void 0&&e.length>r&&(0,jo.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Ie.generateRandomPipeName=IB;function OB(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Dd.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientPipeTransport=OB;function xB(t,e="utf-8"){let r=(0,Dd.createConnection)(t);return[new Hs(r,e),new Vs(r,e)]}Ie.createServerPipeTransport=xB;function MB(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Dd.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientSocketTransport=MB;function LB(t,e="utf-8"){let r=(0,Dd.createConnection)(t,"127.0.0.1");return[new Hs(r,e),new Vs(r,e)]}Ie.createServerSocketTransport=LB;function qB(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function $B(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function FB(t,e,r,n){r||(r=Zr.NullLogger);let i=qB(t)?new wd(t):t,s=$B(e)?new Cd(e):e;return Zr.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Zr.createMessageConnection)(i,s,r,n)}Ie.createMessageConnection=FB});var my=R((rQ,Gk)=>{"use strict";Gk.exports=zs()});var Id=R((Kk,Ad)=>{(function(t){if(typeof Ad=="object"&&typeof Ad.exports=="object"){var e=t(require,Kk);e!==void 0&&(Ad.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(y){function E(C){return typeof C=="string"}y.is=E})(r||(e.DocumentUri=r={}));var n;(function(y){function E(C){return typeof C=="string"}y.is=E})(n||(e.URI=n={}));var i;(function(y){y.MIN_VALUE=-2147483648,y.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&y.MIN_VALUE<=C&&C<=y.MAX_VALUE}y.is=E})(i||(e.integer=i={}));var s;(function(y){y.MIN_VALUE=0,y.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&y.MIN_VALUE<=C&&C<=y.MAX_VALUE}y.is=E})(s||(e.uinteger=s={}));var o;(function(y){function E(S,g){return S===Number.MAX_VALUE&&(S=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:S,character:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}y.is=C})(o||(e.Position=o={}));var a;(function(y){function E(S,g,D,$){if(A.uinteger(S)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger($))return{start:o.create(S,g),end:o.create(D,$)};if(o.is(S)&&o.is(g))return{start:S,end:g};throw new Error("Range#create called with invalid arguments[".concat(S,", ").concat(g,", ").concat(D,", ").concat($,"]"))}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}y.is=C})(a||(e.Range=a={}));var c;(function(y){function E(S,g){return{uri:S,range:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}y.is=C})(c||(e.Location=c={}));var l;(function(y){function E(S,g,D,$){return{targetUri:S,targetRange:g,targetSelectionRange:D,originSelectionRange:$}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}y.is=C})(l||(e.LocationLink=l={}));var u;(function(y){function E(S,g,D,$){return{red:S,green:g,blue:D,alpha:$}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.numberRange(g.red,0,1)&&A.numberRange(g.green,0,1)&&A.numberRange(g.blue,0,1)&&A.numberRange(g.alpha,0,1)}y.is=C})(u||(e.Color=u={}));var d;(function(y){function E(S,g){return{range:S,color:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}y.is=C})(d||(e.ColorInformation=d={}));var f;(function(y){function E(S,g,D){return{label:S,textEdit:g,additionalTextEdits:D}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||w.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,w.is))}y.is=C})(f||(e.ColorPresentation=f={}));var p;(function(y){y.Comment="comment",y.Imports="imports",y.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(y){function E(S,g,D,$,ye,Ct){var ut={startLine:S,endLine:g};return A.defined(D)&&(ut.startCharacter=D),A.defined($)&&(ut.endCharacter=$),A.defined(ye)&&(ut.kind=ye),A.defined(Ct)&&(ut.collapsedText=Ct),ut}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.startLine)&&A.uinteger(g.startLine)&&(A.undefined(g.startCharacter)||A.uinteger(g.startCharacter))&&(A.undefined(g.endCharacter)||A.uinteger(g.endCharacter))&&(A.undefined(g.kind)||A.string(g.kind))}y.is=C})(m||(e.FoldingRange=m={}));var h;(function(y){function E(S,g){return{location:S,message:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}y.is=C})(h||(e.DiagnosticRelatedInformation=h={}));var T;(function(y){y.Error=1,y.Warning=2,y.Information=3,y.Hint=4})(T||(e.DiagnosticSeverity=T={}));var _;(function(y){y.Unnecessary=1,y.Deprecated=2})(_||(e.DiagnosticTag=_={}));var b;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&A.string(S.href)}y.is=E})(b||(e.CodeDescription=b={}));var v;(function(y){function E(S,g,D,$,ye,Ct){var ut={range:S,message:g};return A.defined(D)&&(ut.severity=D),A.defined($)&&(ut.code=$),A.defined(ye)&&(ut.source=ye),A.defined(Ct)&&(ut.relatedInformation=Ct),ut}y.create=E;function C(S){var g,D=S;return A.defined(D)&&a.is(D.range)&&A.string(D.message)&&(A.number(D.severity)||A.undefined(D.severity))&&(A.integer(D.code)||A.string(D.code)||A.undefined(D.code))&&(A.undefined(D.codeDescription)||A.string((g=D.codeDescription)===null||g===void 0?void 0:g.href))&&(A.string(D.source)||A.undefined(D.source))&&(A.undefined(D.relatedInformation)||A.typedArray(D.relatedInformation,h.is))}y.is=C})(v||(e.Diagnostic=v={}));var k;(function(y){function E(S,g){for(var D=[],$=2;$<arguments.length;$++)D[$-2]=arguments[$];var ye={title:S,command:g};return A.defined(D)&&D.length>0&&(ye.arguments=D),ye}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}y.is=C})(k||(e.Command=k={}));var w;(function(y){function E(D,$){return{range:D,newText:$}}y.replace=E;function C(D,$){return{range:{start:D,end:D},newText:$}}y.insert=C;function S(D){return{range:D,newText:""}}y.del=S;function g(D){var $=D;return A.objectLiteral($)&&A.string($.newText)&&a.is($.range)}y.is=g})(w||(e.TextEdit=w={}));var H;(function(y){function E(S,g,D){var $={label:S};return g!==void 0&&($.needsConfirmation=g),D!==void 0&&($.description=D),$}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}y.is=C})(H||(e.ChangeAnnotation=H={}));var O;(function(y){function E(C){var S=C;return A.string(S)}y.is=E})(O||(e.ChangeAnnotationIdentifier=O={}));var B;(function(y){function E(D,$,ye){return{range:D,newText:$,annotationId:ye}}y.replace=E;function C(D,$,ye){return{range:{start:D,end:D},newText:$,annotationId:ye}}y.insert=C;function S(D,$){return{range:D,newText:"",annotationId:$}}y.del=S;function g(D){var $=D;return w.is($)&&(H.is($.annotationId)||O.is($.annotationId))}y.is=g})(B||(e.AnnotatedTextEdit=B={}));var De;(function(y){function E(S,g){return{textDocument:S,edits:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&Fs.is(g.textDocument)&&Array.isArray(g.edits)}y.is=C})(De||(e.TextDocumentEdit=De={}));var lt;(function(y){function E(S,g,D){var $={kind:"create",uri:S};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&($.options=g),D!==void 0&&($.annotationId=D),$}y.create=E;function C(S){var g=S;return g&&g.kind==="create"&&A.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(lt||(e.CreateFile=lt={}));var Ht;(function(y){function E(S,g,D,$){var ye={kind:"rename",oldUri:S,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(ye.options=D),$!==void 0&&(ye.annotationId=$),ye}y.create=E;function C(S){var g=S;return g&&g.kind==="rename"&&A.string(g.oldUri)&&A.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(Ht||(e.RenameFile=Ht={}));var Ne;(function(y){function E(S,g,D){var $={kind:"delete",uri:S};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&($.options=g),D!==void 0&&($.annotationId=D),$}y.create=E;function C(S){var g=S;return g&&g.kind==="delete"&&A.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||A.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||A.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(Ne||(e.DeleteFile=Ne={}));var un;(function(y){function E(C){var S=C;return S&&(S.changes!==void 0||S.documentChanges!==void 0)&&(S.documentChanges===void 0||S.documentChanges.every(function(g){return A.string(g.kind)?lt.is(g)||Ht.is(g)||Ne.is(g):De.is(g)}))}y.is=E})(un||(e.WorkspaceEdit=un={}));var Gi=function(){function y(E,C){this.edits=E,this.changeAnnotations=C}return y.prototype.insert=function(E,C,S){var g,D;if(S===void 0?g=w.insert(E,C):O.is(S)?(D=S,g=B.insert(E,C,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=B.insert(E,C,D)),this.edits.push(g),D!==void 0)return D},y.prototype.replace=function(E,C,S){var g,D;if(S===void 0?g=w.replace(E,C):O.is(S)?(D=S,g=B.replace(E,C,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=B.replace(E,C,D)),this.edits.push(g),D!==void 0)return D},y.prototype.delete=function(E,C){var S,g;if(C===void 0?S=w.del(E):O.is(C)?(g=C,S=B.del(E,C)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(C),S=B.del(E,g)),this.edits.push(S),g!==void 0)return g},y.prototype.add=function(E){this.edits.push(E)},y.prototype.all=function(){return this.edits},y.prototype.clear=function(){this.edits.splice(0,this.edits.length)},y.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},y}(),Gu=function(){function y(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return y.prototype.all=function(){return this._annotations},Object.defineProperty(y.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),y.prototype.manage=function(E,C){var S;if(O.is(E)?S=E:(S=this.nextId(),C=E),this._annotations[S]!==void 0)throw new Error("Id ".concat(S," is already in use."));if(C===void 0)throw new Error("No annotation provided for id ".concat(S));return this._annotations[S]=C,this._size++,S},y.prototype.nextId=function(){return this._counter++,this._counter.toString()},y}(),ng=function(){function y(E){var C=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new Gu(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(S){if(De.is(S)){var g=new Gi(S.edits,C._changeAnnotations);C._textEditChanges[S.textDocument.uri]=g}})):E.changes&&Object.keys(E.changes).forEach(function(S){var g=new Gi(E.changes[S]);C._textEditChanges[S]=g})):this._workspaceEdit={}}return Object.defineProperty(y.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),y.prototype.getTextEditChange=function(E){if(Fs.is(E)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var C={uri:E.uri,version:E.version},S=this._textEditChanges[C.uri];if(!S){var g=[],D={textDocument:C,edits:g};this._workspaceEdit.documentChanges.push(D),S=new Gi(g,this._changeAnnotations),this._textEditChanges[C.uri]=S}return S}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var S=this._textEditChanges[E];if(!S){var g=[];this._workspaceEdit.changes[E]=g,S=new Gi(g),this._textEditChanges[E]=S}return S}},y.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Gu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},y.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},y.prototype.createFile=function(E,C,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(C)||O.is(C)?g=C:S=C;var D,$;if(g===void 0?D=lt.create(E,S):($=O.is(g)?g:this._changeAnnotations.manage(g),D=lt.create(E,S,$)),this._workspaceEdit.documentChanges.push(D),$!==void 0)return $},y.prototype.renameFile=function(E,C,S,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;H.is(S)||O.is(S)?D=S:g=S;var $,ye;if(D===void 0?$=Ht.create(E,C,g):(ye=O.is(D)?D:this._changeAnnotations.manage(D),$=Ht.create(E,C,g,ye)),this._workspaceEdit.documentChanges.push($),ye!==void 0)return ye},y.prototype.deleteFile=function(E,C,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(C)||O.is(C)?g=C:S=C;var D,$;if(g===void 0?D=Ne.create(E,S):($=O.is(g)?g:this._changeAnnotations.manage(g),D=Ne.create(E,S,$)),this._workspaceEdit.documentChanges.push(D),$!==void 0)return $},y}();e.WorkspaceChange=ng;var Ku;(function(y){function E(S){return{uri:S}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)}y.is=C})(Ku||(e.TextDocumentIdentifier=Ku={}));var hc;(function(y){function E(S,g){return{uri:S,version:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}y.is=C})(hc||(e.VersionedTextDocumentIdentifier=hc={}));var Fs;(function(y){function E(S,g){return{uri:S,version:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}y.is=C})(Fs||(e.OptionalVersionedTextDocumentIdentifier=Fs={}));var Ni;(function(y){function E(S,g,D,$){return{uri:S,languageId:g,version:D,text:$}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}y.is=C})(Ni||(e.TextDocumentItem=Ni={}));var Co;(function(y){y.PlainText="plaintext",y.Markdown="markdown";function E(C){var S=C;return S===y.PlainText||S===y.Markdown}y.is=E})(Co||(e.MarkupKind=Co={}));var Bs;(function(y){function E(C){var S=C;return A.objectLiteral(C)&&Co.is(S.kind)&&A.string(S.value)}y.is=E})(Bs||(e.MarkupContent=Bs={}));var Yu;(function(y){y.Text=1,y.Method=2,y.Function=3,y.Constructor=4,y.Field=5,y.Variable=6,y.Class=7,y.Interface=8,y.Module=9,y.Property=10,y.Unit=11,y.Value=12,y.Enum=13,y.Keyword=14,y.Snippet=15,y.Color=16,y.File=17,y.Reference=18,y.Folder=19,y.EnumMember=20,y.Constant=21,y.Struct=22,y.Event=23,y.Operator=24,y.TypeParameter=25})(Yu||(e.CompletionItemKind=Yu={}));var mc;(function(y){y.PlainText=1,y.Snippet=2})(mc||(e.InsertTextFormat=mc={}));var gc;(function(y){y.Deprecated=1})(gc||(e.CompletionItemTag=gc={}));var Xu;(function(y){function E(S,g,D){return{newText:S,insert:g,replace:D}}y.create=E;function C(S){var g=S;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}y.is=C})(Xu||(e.InsertReplaceEdit=Xu={}));var Ju;(function(y){y.asIs=1,y.adjustIndentation=2})(Ju||(e.InsertTextMode=Ju={}));var Qu;(function(y){function E(C){var S=C;return S&&(A.string(S.detail)||S.detail===void 0)&&(A.string(S.description)||S.description===void 0)}y.is=E})(Qu||(e.CompletionItemLabelDetails=Qu={}));var Zu;(function(y){function E(C){return{label:C}}y.create=E})(Zu||(e.CompletionItem=Zu={}));var ed;(function(y){function E(C,S){return{items:C||[],isIncomplete:!!S}}y.create=E})(ed||(e.CompletionList=ed={}));var Do;(function(y){function E(S){return S.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}y.fromPlainText=E;function C(S){var g=S;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}y.is=C})(Do||(e.MarkedString=Do={}));var Mn;(function(y){function E(C){var S=C;return!!S&&A.objectLiteral(S)&&(Bs.is(S.contents)||Do.is(S.contents)||A.typedArray(S.contents,Do.is))&&(C.range===void 0||a.is(C.range))}y.is=E})(Mn||(e.Hover=Mn={}));var td;(function(y){function E(C,S){return S?{label:C,documentation:S}:{label:C}}y.create=E})(td||(e.ParameterInformation=td={}));var rd;(function(y){function E(C,S){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var $={label:C};return A.defined(S)&&($.documentation=S),A.defined(g)?$.parameters=g:$.parameters=[],$}y.create=E})(rd||(e.SignatureInformation=rd={}));var js;(function(y){y.Text=1,y.Read=2,y.Write=3})(js||(e.DocumentHighlightKind=js={}));var nd;(function(y){function E(C,S){var g={range:C};return A.number(S)&&(g.kind=S),g}y.create=E})(nd||(e.DocumentHighlight=nd={}));var Ao;(function(y){y.File=1,y.Module=2,y.Namespace=3,y.Package=4,y.Class=5,y.Method=6,y.Property=7,y.Field=8,y.Constructor=9,y.Enum=10,y.Interface=11,y.Function=12,y.Variable=13,y.Constant=14,y.String=15,y.Number=16,y.Boolean=17,y.Array=18,y.Object=19,y.Key=20,y.Null=21,y.EnumMember=22,y.Struct=23,y.Event=24,y.Operator=25,y.TypeParameter=26})(Ao||(e.SymbolKind=Ao={}));var id;(function(y){y.Deprecated=1})(id||(e.SymbolTag=id={}));var Ri;(function(y){function E(C,S,g,D,$){var ye={name:C,kind:S,location:{uri:D,range:g}};return $&&(ye.containerName=$),ye}y.create=E})(Ri||(e.SymbolInformation=Ri={}));var Ki;(function(y){function E(C,S,g,D){return D!==void 0?{name:C,kind:S,location:{uri:g,range:D}}:{name:C,kind:S,location:{uri:g}}}y.create=E})(Ki||(e.WorkspaceSymbol=Ki={}));var sd;(function(y){function E(S,g,D,$,ye,Ct){var ut={name:S,detail:g,kind:D,range:$,selectionRange:ye};return Ct!==void 0&&(ut.children=Ct),ut}y.create=E;function C(S){var g=S;return g&&A.string(g.name)&&A.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||A.string(g.detail))&&(g.deprecated===void 0||A.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}y.is=C})(sd||(e.DocumentSymbol=sd={}));var od;(function(y){y.Empty="",y.QuickFix="quickfix",y.Refactor="refactor",y.RefactorExtract="refactor.extract",y.RefactorInline="refactor.inline",y.RefactorRewrite="refactor.rewrite",y.Source="source",y.SourceOrganizeImports="source.organizeImports",y.SourceFixAll="source.fixAll"})(od||(e.CodeActionKind=od={}));var ii;(function(y){y.Invoked=1,y.Automatic=2})(ii||(e.CodeActionTriggerKind=ii={}));var yc;(function(y){function E(S,g,D){var $={diagnostics:S};return g!=null&&($.only=g),D!=null&&($.triggerKind=D),$}y.create=E;function C(S){var g=S;return A.defined(g)&&A.typedArray(g.diagnostics,v.is)&&(g.only===void 0||A.typedArray(g.only,A.string))&&(g.triggerKind===void 0||g.triggerKind===ii.Invoked||g.triggerKind===ii.Automatic)}y.is=C})(yc||(e.CodeActionContext=yc={}));var Tc;(function(y){function E(S,g,D){var $={title:S},ye=!0;return typeof g=="string"?(ye=!1,$.kind=g):k.is(g)?$.command=g:$.edit=g,ye&&D!==void 0&&($.kind=D),$}y.create=E;function C(S){var g=S;return g&&A.string(g.title)&&(g.diagnostics===void 0||A.typedArray(g.diagnostics,v.is))&&(g.kind===void 0||A.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||k.is(g.command))&&(g.isPreferred===void 0||A.boolean(g.isPreferred))&&(g.edit===void 0||un.is(g.edit))}y.is=C})(Tc||(e.CodeAction=Tc={}));var Io;(function(y){function E(S,g){var D={range:S};return A.defined(g)&&(D.data=g),D}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||k.is(g.command))}y.is=C})(Io||(e.CodeLens=Io={}));var vc;(function(y){function E(S,g){return{tabSize:S,insertSpaces:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}y.is=C})(vc||(e.FormattingOptions=vc={}));var Pi;(function(y){function E(S,g,D){return{range:S,target:g,data:D}}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}y.is=C})(Pi||(e.DocumentLink=Pi={}));var P;(function(y){function E(S,g){return{range:S,parent:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||y.is(g.parent))}y.is=C})(P||(e.SelectionRange=P={}));var L;(function(y){y.namespace="namespace",y.type="type",y.class="class",y.enum="enum",y.interface="interface",y.struct="struct",y.typeParameter="typeParameter",y.parameter="parameter",y.variable="variable",y.property="property",y.enumMember="enumMember",y.event="event",y.function="function",y.method="method",y.macro="macro",y.keyword="keyword",y.modifier="modifier",y.comment="comment",y.string="string",y.number="number",y.regexp="regexp",y.operator="operator",y.decorator="decorator"})(L||(e.SemanticTokenTypes=L={}));var G;(function(y){y.declaration="declaration",y.definition="definition",y.readonly="readonly",y.static="static",y.deprecated="deprecated",y.abstract="abstract",y.async="async",y.modification="modification",y.documentation="documentation",y.defaultLibrary="defaultLibrary"})(G||(e.SemanticTokenModifiers=G={}));var re;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&(S.resultId===void 0||typeof S.resultId=="string")&&Array.isArray(S.data)&&(S.data.length===0||typeof S.data[0]=="number")}y.is=E})(re||(e.SemanticTokens=re={}));var et;(function(y){function E(S,g){return{range:S,text:g}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&A.string(g.text)}y.is=C})(et||(e.InlineValueText=et={}));var Ye;(function(y){function E(S,g,D){return{range:S,variableName:g,caseSensitiveLookup:D}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}y.is=C})(Ye||(e.InlineValueVariableLookup=Ye={}));var ht;(function(y){function E(S,g){return{range:S,expression:g}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}y.is=C})(ht||(e.InlineValueEvaluatableExpression=ht={}));var St;(function(y){function E(S,g){return{frameId:S,stoppedLocation:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(S.stoppedLocation)}y.is=C})(St||(e.InlineValueContext=St={}));var Re;(function(y){y.Type=1,y.Parameter=2;function E(C){return C===1||C===2}y.is=E})(Re||(e.InlayHintKind=Re={}));var it;(function(y){function E(S){return{value:S}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||Bs.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||k.is(g.command))}y.is=C})(it||(e.InlayHintLabelPart=it={}));var Ve;(function(y){function E(S,g,D){var $={position:S,label:g};return D!==void 0&&($.kind=D),$}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,it.is))&&(g.kind===void 0||Re.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,w.is)&&(g.tooltip===void 0||A.string(g.tooltip)||Bs.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}y.is=C})(Ve||(e.InlayHint=Ve={}));var wt;(function(y){function E(C){return{kind:"snippet",value:C}}y.createSnippet=E})(wt||(e.StringValue=wt={}));var Wt;(function(y){function E(C,S,g,D){return{insertText:C,filterText:S,range:g,command:D}}y.create=E})(Wt||(e.InlineCompletionItem=Wt={}));var Jr;(function(y){function E(C){return{items:C}}y.create=E})(Jr||(e.InlineCompletionList=Jr={}));var ad;(function(y){y.Invoked=0,y.Automatic=1})(ad||(e.InlineCompletionTriggerKind=ad={}));var uk;(function(y){function E(C,S){return{range:C,text:S}}y.create=E})(uk||(e.SelectedCompletionInfo=uk={}));var dk;(function(y){function E(C,S){return{triggerKind:C,selectedCompletionInfo:S}}y.create=E})(dk||(e.InlineCompletionContext=dk={}));var fk;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&n.is(S.uri)&&A.string(S.name)}y.is=E})(fk||(e.WorkspaceFolder=fk={})),e.EOL=[`
|
|
32
|
+
`)),L){let re=P.error?` Request failed: ${P.error.message} (${P.error.code}).`:"";w.log(`Received response '${L.method} - (${P.id})' in ${Date.now()-L.timerStart}ms.${re}`,G)}else w.log(`Received response ${P.id} without active response promise.`,G)}else Ri("receive-response",P)}function Ri(P,L){if(!w||v===Ge.Off)return;let G={isLSPMessage:!0,type:P,message:L,timestamp:Date.now()};w.log(G)}function Ki(){if(Fs())throw new Bo(Nc.Closed,"Connection is closed.");if(Ni())throw new Bo(Nc.Disposed,"Connection is disposed.")}function sd(){if(hc())throw new Bo(Nc.AlreadyListening,"Connection is already listening")}function od(){if(!hc())throw new Error("Call listen() first.")}function si(P){return P===void 0?null:P}function yc(P){if(P!==null)return P}function Tc(P){return P!=null&&!Array.isArray(P)&&typeof P=="object"}function Io(P,L){switch(P){case de.ParameterStructures.auto:return Tc(L)?yc(L):[si(L)];case de.ParameterStructures.byName:if(!Tc(L))throw new Error("Received parameters by name but param is not an object literal.");return yc(L);case de.ParameterStructures.byPosition:return[si(L)];default:throw new Error(`Unknown parameter structure ${P.toString()}`)}}function vc(P,L){let G,re=P.numberOfParams;switch(re){case 0:G=void 0;break;case 1:G=Io(P.parameterStructures,L[0]);break;default:G=[];for(let et=0;et<L.length&&et<re;et++)G.push(si(L[et]));if(L.length<re)for(let et=L.length;et<re;et++)G.push(null);break}return G}let Pi={sendNotification:(P,...L)=>{Ki();let G,re;if(Nt.string(P)){G=P;let Ye=L[0],ht=0,St=de.ParameterStructures.auto;de.ParameterStructures.is(Ye)&&(ht=1,St=Ye);let Re=L.length,it=Re-ht;switch(it){case 0:re=void 0;break;case 1:re=Io(St,L[ht]);break;default:if(St===de.ParameterStructures.byName)throw new Error(`Received ${it} parameters for 'by Name' notification parameter structure.`);re=L.slice(ht,Re).map(Ve=>si(Ve));break}}else{let Ye=L;G=P.method,re=vc(P,Ye)}let et={jsonrpc:c,method:G,params:re};return rd(et),e.write(et).catch(Ye=>{throw i.error("Sending notification failed."),Ye})},onNotification:(P,L)=>{Ki();let G;return Nt.func(P)?d=P:L&&(Nt.string(P)?(G=P,f.set(P,{type:void 0,handler:L})):(G=P.method,f.set(P.method,{type:P,handler:L}))),{dispose:()=>{G!==void 0?f.delete(G):d=void 0}}},onProgress:(P,L,G)=>{if(p.has(L))throw new Error(`Progress handler for token ${L} already registered`);return p.set(L,G),{dispose:()=>{p.delete(L)}}},sendProgress:(P,L,G)=>Pi.sendNotification(kc.type,{token:L,value:G}),onUnhandledProgress:lt.event,sendRequest:(P,...L)=>{Ki(),od();let G,re,et;if(Nt.string(P)){G=P;let Re=L[0],it=L[L.length-1],Ve=0,wt=de.ParameterStructures.auto;de.ParameterStructures.is(Re)&&(Ve=1,wt=Re);let Wt=L.length;Jg.CancellationToken.is(it)&&(Wt=Wt-1,et=it);let Jr=Wt-Ve;switch(Jr){case 0:re=void 0;break;case 1:re=Io(wt,L[Ve]);break;default:if(wt===de.ParameterStructures.byName)throw new Error(`Received ${Jr} parameters for 'by Name' request parameter structure.`);re=L.slice(Ve,Wt).map(ad=>si(ad));break}}else{let Re=L;G=P.method,re=vc(P,Re);let it=P.numberOfParams;et=Jg.CancellationToken.is(Re[it])?Re[it]:void 0}let Ye=s++,ht;et&&(ht=et.onCancellationRequested(()=>{let Re=Ne.sender.sendCancellation(Pi,Ye);return Re===void 0?(i.log(`Received no promise from cancellation strategy when cancelling id ${Ye}`),Promise.resolve()):Re.catch(()=>{i.log(`Sending cancellation messages for id ${Ye} failed`)})}));let St={jsonrpc:c,id:Ye,method:G,params:re};return td(St),typeof Ne.sender.enableCancellation=="function"&&Ne.sender.enableCancellation(St),new Promise(async(Re,it)=>{let Ve=Jr=>{Re(Jr),Ne.sender.cleanup(Ye),ht?.dispose()},wt=Jr=>{it(Jr),Ne.sender.cleanup(Ye),ht?.dispose()},Wt={method:G,timerStart:Date.now(),resolve:Ve,reject:wt};try{await e.write(St),T.set(Ye,Wt)}catch(Jr){throw i.error("Sending request failed."),Wt.reject(new de.ResponseError(de.ErrorCodes.MessageWriteError,Jr.message?Jr.message:"Unknown reason")),Jr}})},onRequest:(P,L)=>{Ki();let G=null;return ey.is(P)?(G=void 0,l=P):Nt.string(P)?(G=null,L!==void 0&&(G=P,u.set(P,{handler:L,type:void 0}))):L!==void 0&&(G=P.method,u.set(P.method,{type:P,handler:L})),{dispose:()=>{G!==null&&(G!==void 0?u.delete(G):l=void 0)}}},hasPendingResponse:()=>T.size>0,trace:async(P,L,G)=>{let re=!1,et=Qr.Text;G!==void 0&&(Nt.boolean(G)?re=G:(re=G.sendNotification||!1,et=G.traceFormat||Qr.Text)),v=P,k=et,v===Ge.Off?w=void 0:w=L,re&&!Fs()&&!Ni()&&await Pi.sendNotification(ty.type,{value:Ge.toString(P)})},onError:O.event,onClose:B.event,onUnhandledNotification:De.event,onDispose:Ht.event,end:()=>{e.end()},dispose:()=>{if(Ni())return;H=Fn.Disposed,Ht.fire(void 0);let P=new de.ResponseError(de.ErrorCodes.PendingResponseRejected,"Pending response rejected since connection got disposed");for(let L of T.values())L.reject(P);T=new Map,b=new Map,_=new Set,h=new Mk.LinkedMap,Nt.func(e.dispose)&&e.dispose(),Nt.func(t.dispose)&&t.dispose()},listen:()=>{Ki(),sd(),H=Fn.Listening,t.listen(Ju)},inspect:()=>{(0,xk.default)().console.log("inspect")}};return Pi.onNotification(bd.type,P=>{if(v===Ge.Off||!w)return;let L=v===Ge.Verbose||v===Ge.Compact;w.log(P.message,L?P.verbose:void 0)}),Pi.onNotification(kc.type,P=>{let L=p.get(P.token);L?L(P.value):lt.fire(P)}),Pi}Te.createMessageConnection=kB});var Pd=R(x=>{"use strict";Object.defineProperty(x,"__esModule",{value:!0});x.ProgressType=x.ProgressToken=x.createMessageConnection=x.NullLogger=x.ConnectionOptions=x.ConnectionStrategy=x.AbstractMessageBuffer=x.WriteableStreamMessageWriter=x.AbstractMessageWriter=x.MessageWriter=x.ReadableStreamMessageReader=x.AbstractMessageReader=x.MessageReader=x.SharedArrayReceiverStrategy=x.SharedArraySenderStrategy=x.CancellationToken=x.CancellationTokenSource=x.Emitter=x.Event=x.Disposable=x.LRUCache=x.Touch=x.LinkedMap=x.ParameterStructures=x.NotificationType9=x.NotificationType8=x.NotificationType7=x.NotificationType6=x.NotificationType5=x.NotificationType4=x.NotificationType3=x.NotificationType2=x.NotificationType1=x.NotificationType0=x.NotificationType=x.ErrorCodes=x.ResponseError=x.RequestType9=x.RequestType8=x.RequestType7=x.RequestType6=x.RequestType5=x.RequestType4=x.RequestType3=x.RequestType2=x.RequestType1=x.RequestType0=x.RequestType=x.Message=x.RAL=void 0;x.MessageStrategy=x.CancellationStrategy=x.CancellationSenderStrategy=x.CancellationReceiverStrategy=x.ConnectionError=x.ConnectionErrors=x.LogTraceNotification=x.SetTraceNotification=x.TraceFormat=x.TraceValues=x.Trace=void 0;var dt=Cg();Object.defineProperty(x,"Message",{enumerable:!0,get:function(){return dt.Message}});Object.defineProperty(x,"RequestType",{enumerable:!0,get:function(){return dt.RequestType}});Object.defineProperty(x,"RequestType0",{enumerable:!0,get:function(){return dt.RequestType0}});Object.defineProperty(x,"RequestType1",{enumerable:!0,get:function(){return dt.RequestType1}});Object.defineProperty(x,"RequestType2",{enumerable:!0,get:function(){return dt.RequestType2}});Object.defineProperty(x,"RequestType3",{enumerable:!0,get:function(){return dt.RequestType3}});Object.defineProperty(x,"RequestType4",{enumerable:!0,get:function(){return dt.RequestType4}});Object.defineProperty(x,"RequestType5",{enumerable:!0,get:function(){return dt.RequestType5}});Object.defineProperty(x,"RequestType6",{enumerable:!0,get:function(){return dt.RequestType6}});Object.defineProperty(x,"RequestType7",{enumerable:!0,get:function(){return dt.RequestType7}});Object.defineProperty(x,"RequestType8",{enumerable:!0,get:function(){return dt.RequestType8}});Object.defineProperty(x,"RequestType9",{enumerable:!0,get:function(){return dt.RequestType9}});Object.defineProperty(x,"ResponseError",{enumerable:!0,get:function(){return dt.ResponseError}});Object.defineProperty(x,"ErrorCodes",{enumerable:!0,get:function(){return dt.ErrorCodes}});Object.defineProperty(x,"NotificationType",{enumerable:!0,get:function(){return dt.NotificationType}});Object.defineProperty(x,"NotificationType0",{enumerable:!0,get:function(){return dt.NotificationType0}});Object.defineProperty(x,"NotificationType1",{enumerable:!0,get:function(){return dt.NotificationType1}});Object.defineProperty(x,"NotificationType2",{enumerable:!0,get:function(){return dt.NotificationType2}});Object.defineProperty(x,"NotificationType3",{enumerable:!0,get:function(){return dt.NotificationType3}});Object.defineProperty(x,"NotificationType4",{enumerable:!0,get:function(){return dt.NotificationType4}});Object.defineProperty(x,"NotificationType5",{enumerable:!0,get:function(){return dt.NotificationType5}});Object.defineProperty(x,"NotificationType6",{enumerable:!0,get:function(){return dt.NotificationType6}});Object.defineProperty(x,"NotificationType7",{enumerable:!0,get:function(){return dt.NotificationType7}});Object.defineProperty(x,"NotificationType8",{enumerable:!0,get:function(){return dt.NotificationType8}});Object.defineProperty(x,"NotificationType9",{enumerable:!0,get:function(){return dt.NotificationType9}});Object.defineProperty(x,"ParameterStructures",{enumerable:!0,get:function(){return dt.ParameterStructures}});var iy=Ag();Object.defineProperty(x,"LinkedMap",{enumerable:!0,get:function(){return iy.LinkedMap}});Object.defineProperty(x,"LRUCache",{enumerable:!0,get:function(){return iy.LRUCache}});Object.defineProperty(x,"Touch",{enumerable:!0,get:function(){return iy.Touch}});var NB=kk();Object.defineProperty(x,"Disposable",{enumerable:!0,get:function(){return NB.Disposable}});var Fk=Lo();Object.defineProperty(x,"Event",{enumerable:!0,get:function(){return Fk.Event}});Object.defineProperty(x,"Emitter",{enumerable:!0,get:function(){return Fk.Emitter}});var Bk=md();Object.defineProperty(x,"CancellationTokenSource",{enumerable:!0,get:function(){return Bk.CancellationTokenSource}});Object.defineProperty(x,"CancellationToken",{enumerable:!0,get:function(){return Bk.CancellationToken}});var jk=Rk();Object.defineProperty(x,"SharedArraySenderStrategy",{enumerable:!0,get:function(){return jk.SharedArraySenderStrategy}});Object.defineProperty(x,"SharedArrayReceiverStrategy",{enumerable:!0,get:function(){return jk.SharedArrayReceiverStrategy}});var sy=Ek();Object.defineProperty(x,"MessageReader",{enumerable:!0,get:function(){return sy.MessageReader}});Object.defineProperty(x,"AbstractMessageReader",{enumerable:!0,get:function(){return sy.AbstractMessageReader}});Object.defineProperty(x,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return sy.ReadableStreamMessageReader}});var oy=Ik();Object.defineProperty(x,"MessageWriter",{enumerable:!0,get:function(){return oy.MessageWriter}});Object.defineProperty(x,"AbstractMessageWriter",{enumerable:!0,get:function(){return oy.AbstractMessageWriter}});Object.defineProperty(x,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return oy.WriteableStreamMessageWriter}});var RB=Ok();Object.defineProperty(x,"AbstractMessageBuffer",{enumerable:!0,get:function(){return RB.AbstractMessageBuffer}});var tr=$k();Object.defineProperty(x,"ConnectionStrategy",{enumerable:!0,get:function(){return tr.ConnectionStrategy}});Object.defineProperty(x,"ConnectionOptions",{enumerable:!0,get:function(){return tr.ConnectionOptions}});Object.defineProperty(x,"NullLogger",{enumerable:!0,get:function(){return tr.NullLogger}});Object.defineProperty(x,"createMessageConnection",{enumerable:!0,get:function(){return tr.createMessageConnection}});Object.defineProperty(x,"ProgressToken",{enumerable:!0,get:function(){return tr.ProgressToken}});Object.defineProperty(x,"ProgressType",{enumerable:!0,get:function(){return tr.ProgressType}});Object.defineProperty(x,"Trace",{enumerable:!0,get:function(){return tr.Trace}});Object.defineProperty(x,"TraceValues",{enumerable:!0,get:function(){return tr.TraceValues}});Object.defineProperty(x,"TraceFormat",{enumerable:!0,get:function(){return tr.TraceFormat}});Object.defineProperty(x,"SetTraceNotification",{enumerable:!0,get:function(){return tr.SetTraceNotification}});Object.defineProperty(x,"LogTraceNotification",{enumerable:!0,get:function(){return tr.LogTraceNotification}});Object.defineProperty(x,"ConnectionErrors",{enumerable:!0,get:function(){return tr.ConnectionErrors}});Object.defineProperty(x,"ConnectionError",{enumerable:!0,get:function(){return tr.ConnectionError}});Object.defineProperty(x,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return tr.CancellationReceiverStrategy}});Object.defineProperty(x,"CancellationSenderStrategy",{enumerable:!0,get:function(){return tr.CancellationSenderStrategy}});Object.defineProperty(x,"CancellationStrategy",{enumerable:!0,get:function(){return tr.CancellationStrategy}});Object.defineProperty(x,"MessageStrategy",{enumerable:!0,get:function(){return tr.MessageStrategy}});var PB=Xi();x.RAL=PB.default});var Vk=R(uy=>{"use strict";Object.defineProperty(uy,"__esModule",{value:!0});var Uk=require("util"),wi=Pd(),Ed=class t extends wi.AbstractMessageBuffer{constructor(e="utf-8"){super(e)}emptyBuffer(){return t.emptyBuffer}fromString(e,r){return Buffer.from(e,r)}toString(e,r){return e instanceof Buffer?e.toString(r):new Uk.TextDecoder(r).decode(e)}asNative(e,r){return r===void 0?e instanceof Buffer?e:Buffer.from(e):e instanceof Buffer?e.slice(0,r):Buffer.from(e,0,r)}allocNative(e){return Buffer.allocUnsafe(e)}};Ed.emptyBuffer=Buffer.allocUnsafe(0);var ay=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),wi.Disposable.create(()=>this.stream.off("end",e))}onData(e){return this.stream.on("data",e),wi.Disposable.create(()=>this.stream.off("data",e))}},cy=class{constructor(e){this.stream=e}onClose(e){return this.stream.on("close",e),wi.Disposable.create(()=>this.stream.off("close",e))}onError(e){return this.stream.on("error",e),wi.Disposable.create(()=>this.stream.off("error",e))}onEnd(e){return this.stream.on("end",e),wi.Disposable.create(()=>this.stream.off("end",e))}write(e,r){return new Promise((n,i)=>{let s=o=>{o==null?n():i(o)};typeof e=="string"?this.stream.write(e,r,s):this.stream.write(e,s)})}end(){this.stream.end()}},Hk=Object.freeze({messageBuffer:Object.freeze({create:t=>new Ed(t)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(t,e)=>{try{return Promise.resolve(Buffer.from(JSON.stringify(t,void 0,0),e.charset))}catch(r){return Promise.reject(r)}}}),decoder:Object.freeze({name:"application/json",decode:(t,e)=>{try{return t instanceof Buffer?Promise.resolve(JSON.parse(t.toString(e.charset))):Promise.resolve(JSON.parse(new Uk.TextDecoder(e.charset).decode(t)))}catch(r){return Promise.reject(r)}}})}),stream:Object.freeze({asReadableStream:t=>new ay(t),asWritableStream:t=>new cy(t)}),console,timer:Object.freeze({setTimeout(t,e,...r){let n=setTimeout(t,e,...r);return{dispose:()=>clearTimeout(n)}},setImmediate(t,...e){let r=setImmediate(t,...e);return{dispose:()=>clearImmediate(r)}},setInterval(t,e,...r){let n=setInterval(t,e,...r);return{dispose:()=>clearInterval(n)}}})});function ly(){return Hk}(function(t){function e(){wi.RAL.install(Hk)}t.install=e})(ly||(ly={}));uy.default=ly});var zs=R(Ie=>{"use strict";var EB=Ie&&Ie.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),wB=Ie&&Ie.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&EB(e,t,r)};Object.defineProperty(Ie,"__esModule",{value:!0});Ie.createMessageConnection=Ie.createServerSocketTransport=Ie.createClientSocketTransport=Ie.createServerPipeTransport=Ie.createClientPipeTransport=Ie.generateRandomPipeName=Ie.StreamMessageWriter=Ie.StreamMessageReader=Ie.SocketMessageWriter=Ie.SocketMessageReader=Ie.PortMessageWriter=Ie.PortMessageReader=Ie.IPCMessageWriter=Ie.IPCMessageReader=void 0;var jo=Vk();jo.default.install();var zk=require("path"),CB=require("os"),DB=require("crypto"),Dd=require("net"),Zr=Pd();wB(Pd(),Ie);var dy=class extends Zr.AbstractMessageReader{constructor(e){super(),this.process=e;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose())}listen(e){return this.process.on("message",e),Zr.Disposable.create(()=>this.process.off("message",e))}};Ie.IPCMessageReader=dy;var fy=class extends Zr.AbstractMessageWriter{constructor(e){super(),this.process=e,this.errorCount=0;let r=this.process;r.on("error",n=>this.fireError(n)),r.on("close",()=>this.fireClose)}write(e){try{return typeof this.process.send=="function"&&this.process.send(e,void 0,void 0,r=>{r?(this.errorCount++,this.handleError(r,e)):this.errorCount=0}),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Ie.IPCMessageWriter=fy;var py=class extends Zr.AbstractMessageReader{constructor(e){super(),this.onData=new Zr.Emitter,e.on("close",()=>this.fireClose),e.on("error",r=>this.fireError(r)),e.on("message",r=>{this.onData.fire(r)})}listen(e){return this.onData.event(e)}};Ie.PortMessageReader=py;var hy=class extends Zr.AbstractMessageWriter{constructor(e){super(),this.port=e,this.errorCount=0,e.on("close",()=>this.fireClose()),e.on("error",r=>this.fireError(r))}write(e){try{return this.port.postMessage(e),Promise.resolve()}catch(r){return this.handleError(r,e),Promise.reject(r)}}handleError(e,r){this.errorCount++,this.fireError(e,r,this.errorCount)}end(){}};Ie.PortMessageWriter=hy;var Hs=class extends Zr.ReadableStreamMessageReader{constructor(e,r="utf-8"){super((0,jo.default)().stream.asReadableStream(e),r)}};Ie.SocketMessageReader=Hs;var Vs=class extends Zr.WriteableStreamMessageWriter{constructor(e,r){super((0,jo.default)().stream.asWritableStream(e),r),this.socket=e}dispose(){super.dispose(),this.socket.destroy()}};Ie.SocketMessageWriter=Vs;var wd=class extends Zr.ReadableStreamMessageReader{constructor(e,r){super((0,jo.default)().stream.asReadableStream(e),r)}};Ie.StreamMessageReader=wd;var Cd=class extends Zr.WriteableStreamMessageWriter{constructor(e,r){super((0,jo.default)().stream.asWritableStream(e),r)}};Ie.StreamMessageWriter=Cd;var Wk=process.env.XDG_RUNTIME_DIR,AB=new Map([["linux",107],["darwin",103]]);function IB(){let t=(0,DB.randomBytes)(21).toString("hex");if(process.platform==="win32")return`\\\\.\\pipe\\vscode-jsonrpc-${t}-sock`;let e;Wk?e=zk.join(Wk,`vscode-ipc-${t}.sock`):e=zk.join(CB.tmpdir(),`vscode-${t}.sock`);let r=AB.get(process.platform);return r!==void 0&&e.length>r&&(0,jo.default)().console.warn(`WARNING: IPC handle "${e}" is longer than ${r} characters.`),e}Ie.generateRandomPipeName=IB;function OB(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Dd.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientPipeTransport=OB;function xB(t,e="utf-8"){let r=(0,Dd.createConnection)(t);return[new Hs(r,e),new Vs(r,e)]}Ie.createServerPipeTransport=xB;function MB(t,e="utf-8"){let r,n=new Promise((i,s)=>{r=i});return new Promise((i,s)=>{let o=(0,Dd.createServer)(a=>{o.close(),r([new Hs(a,e),new Vs(a,e)])});o.on("error",s),o.listen(t,"127.0.0.1",()=>{o.removeListener("error",s),i({onConnected:()=>n})})})}Ie.createClientSocketTransport=MB;function LB(t,e="utf-8"){let r=(0,Dd.createConnection)(t,"127.0.0.1");return[new Hs(r,e),new Vs(r,e)]}Ie.createServerSocketTransport=LB;function qB(t){let e=t;return e.read!==void 0&&e.addListener!==void 0}function $B(t){let e=t;return e.write!==void 0&&e.addListener!==void 0}function FB(t,e,r,n){r||(r=Zr.NullLogger);let i=qB(t)?new wd(t):t,s=$B(e)?new Cd(e):e;return Zr.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,Zr.createMessageConnection)(i,s,r,n)}Ie.createMessageConnection=FB});var my=R((rQ,Gk)=>{"use strict";Gk.exports=zs()});var Id=R((Kk,Ad)=>{(function(t){if(typeof Ad=="object"&&typeof Ad.exports=="object"){var e=t(require,Kk);e!==void 0&&(Ad.exports=e)}else typeof define=="function"&&define.amd&&define(["require","exports"],t)})(function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.TextDocument=e.EOL=e.WorkspaceFolder=e.InlineCompletionContext=e.SelectedCompletionInfo=e.InlineCompletionTriggerKind=e.InlineCompletionList=e.InlineCompletionItem=e.StringValue=e.InlayHint=e.InlayHintLabelPart=e.InlayHintKind=e.InlineValueContext=e.InlineValueEvaluatableExpression=e.InlineValueVariableLookup=e.InlineValueText=e.SemanticTokens=e.SemanticTokenModifiers=e.SemanticTokenTypes=e.SelectionRange=e.DocumentLink=e.FormattingOptions=e.CodeLens=e.CodeAction=e.CodeActionContext=e.CodeActionTriggerKind=e.CodeActionKind=e.DocumentSymbol=e.WorkspaceSymbol=e.SymbolInformation=e.SymbolTag=e.SymbolKind=e.DocumentHighlight=e.DocumentHighlightKind=e.SignatureInformation=e.ParameterInformation=e.Hover=e.MarkedString=e.CompletionList=e.CompletionItem=e.CompletionItemLabelDetails=e.InsertTextMode=e.InsertReplaceEdit=e.CompletionItemTag=e.InsertTextFormat=e.CompletionItemKind=e.MarkupContent=e.MarkupKind=e.TextDocumentItem=e.OptionalVersionedTextDocumentIdentifier=e.VersionedTextDocumentIdentifier=e.TextDocumentIdentifier=e.WorkspaceChange=e.WorkspaceEdit=e.DeleteFile=e.RenameFile=e.CreateFile=e.TextDocumentEdit=e.AnnotatedTextEdit=e.ChangeAnnotationIdentifier=e.ChangeAnnotation=e.TextEdit=e.Command=e.Diagnostic=e.CodeDescription=e.DiagnosticTag=e.DiagnosticSeverity=e.DiagnosticRelatedInformation=e.FoldingRange=e.FoldingRangeKind=e.ColorPresentation=e.ColorInformation=e.Color=e.LocationLink=e.Location=e.Range=e.Position=e.uinteger=e.integer=e.URI=e.DocumentUri=void 0;var r;(function(y){function E(C){return typeof C=="string"}y.is=E})(r||(e.DocumentUri=r={}));var n;(function(y){function E(C){return typeof C=="string"}y.is=E})(n||(e.URI=n={}));var i;(function(y){y.MIN_VALUE=-2147483648,y.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&y.MIN_VALUE<=C&&C<=y.MAX_VALUE}y.is=E})(i||(e.integer=i={}));var s;(function(y){y.MIN_VALUE=0,y.MAX_VALUE=2147483647;function E(C){return typeof C=="number"&&y.MIN_VALUE<=C&&C<=y.MAX_VALUE}y.is=E})(s||(e.uinteger=s={}));var o;(function(y){function E(S,g){return S===Number.MAX_VALUE&&(S=s.MAX_VALUE),g===Number.MAX_VALUE&&(g=s.MAX_VALUE),{line:S,character:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.line)&&A.uinteger(g.character)}y.is=C})(o||(e.Position=o={}));var a;(function(y){function E(S,g,D,$){if(A.uinteger(S)&&A.uinteger(g)&&A.uinteger(D)&&A.uinteger($))return{start:o.create(S,g),end:o.create(D,$)};if(o.is(S)&&o.is(g))return{start:S,end:g};throw new Error("Range#create called with invalid arguments[".concat(S,", ").concat(g,", ").concat(D,", ").concat($,"]"))}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&o.is(g.start)&&o.is(g.end)}y.is=C})(a||(e.Range=a={}));var c;(function(y){function E(S,g){return{uri:S,range:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(A.string(g.uri)||A.undefined(g.uri))}y.is=C})(c||(e.Location=c={}));var l;(function(y){function E(S,g,D,$){return{targetUri:S,targetRange:g,targetSelectionRange:D,originSelectionRange:$}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.targetRange)&&A.string(g.targetUri)&&a.is(g.targetSelectionRange)&&(a.is(g.originSelectionRange)||A.undefined(g.originSelectionRange))}y.is=C})(l||(e.LocationLink=l={}));var u;(function(y){function E(S,g,D,$){return{red:S,green:g,blue:D,alpha:$}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.numberRange(g.red,0,1)&&A.numberRange(g.green,0,1)&&A.numberRange(g.blue,0,1)&&A.numberRange(g.alpha,0,1)}y.is=C})(u||(e.Color=u={}));var d;(function(y){function E(S,g){return{range:S,color:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&u.is(g.color)}y.is=C})(d||(e.ColorInformation=d={}));var f;(function(y){function E(S,g,D){return{label:S,textEdit:g,additionalTextEdits:D}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.undefined(g.textEdit)||w.is(g))&&(A.undefined(g.additionalTextEdits)||A.typedArray(g.additionalTextEdits,w.is))}y.is=C})(f||(e.ColorPresentation=f={}));var p;(function(y){y.Comment="comment",y.Imports="imports",y.Region="region"})(p||(e.FoldingRangeKind=p={}));var m;(function(y){function E(S,g,D,$,ye,Ct){var ut={startLine:S,endLine:g};return A.defined(D)&&(ut.startCharacter=D),A.defined($)&&(ut.endCharacter=$),A.defined(ye)&&(ut.kind=ye),A.defined(Ct)&&(ut.collapsedText=Ct),ut}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.uinteger(g.startLine)&&A.uinteger(g.startLine)&&(A.undefined(g.startCharacter)||A.uinteger(g.startCharacter))&&(A.undefined(g.endCharacter)||A.uinteger(g.endCharacter))&&(A.undefined(g.kind)||A.string(g.kind))}y.is=C})(m||(e.FoldingRange=m={}));var h;(function(y){function E(S,g){return{location:S,message:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&c.is(g.location)&&A.string(g.message)}y.is=C})(h||(e.DiagnosticRelatedInformation=h={}));var T;(function(y){y.Error=1,y.Warning=2,y.Information=3,y.Hint=4})(T||(e.DiagnosticSeverity=T={}));var _;(function(y){y.Unnecessary=1,y.Deprecated=2})(_||(e.DiagnosticTag=_={}));var b;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&A.string(S.href)}y.is=E})(b||(e.CodeDescription=b={}));var v;(function(y){function E(S,g,D,$,ye,Ct){var ut={range:S,message:g};return A.defined(D)&&(ut.severity=D),A.defined($)&&(ut.code=$),A.defined(ye)&&(ut.source=ye),A.defined(Ct)&&(ut.relatedInformation=Ct),ut}y.create=E;function C(S){var g,D=S;return A.defined(D)&&a.is(D.range)&&A.string(D.message)&&(A.number(D.severity)||A.undefined(D.severity))&&(A.integer(D.code)||A.string(D.code)||A.undefined(D.code))&&(A.undefined(D.codeDescription)||A.string((g=D.codeDescription)===null||g===void 0?void 0:g.href))&&(A.string(D.source)||A.undefined(D.source))&&(A.undefined(D.relatedInformation)||A.typedArray(D.relatedInformation,h.is))}y.is=C})(v||(e.Diagnostic=v={}));var k;(function(y){function E(S,g){for(var D=[],$=2;$<arguments.length;$++)D[$-2]=arguments[$];var ye={title:S,command:g};return A.defined(D)&&D.length>0&&(ye.arguments=D),ye}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.title)&&A.string(g.command)}y.is=C})(k||(e.Command=k={}));var w;(function(y){function E(D,$){return{range:D,newText:$}}y.replace=E;function C(D,$){return{range:{start:D,end:D},newText:$}}y.insert=C;function S(D){return{range:D,newText:""}}y.del=S;function g(D){var $=D;return A.objectLiteral($)&&A.string($.newText)&&a.is($.range)}y.is=g})(w||(e.TextEdit=w={}));var H;(function(y){function E(S,g,D){var $={label:S};return g!==void 0&&($.needsConfirmation=g),D!==void 0&&($.description=D),$}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&A.string(g.label)&&(A.boolean(g.needsConfirmation)||g.needsConfirmation===void 0)&&(A.string(g.description)||g.description===void 0)}y.is=C})(H||(e.ChangeAnnotation=H={}));var O;(function(y){function E(C){var S=C;return A.string(S)}y.is=E})(O||(e.ChangeAnnotationIdentifier=O={}));var B;(function(y){function E(D,$,ye){return{range:D,newText:$,annotationId:ye}}y.replace=E;function C(D,$,ye){return{range:{start:D,end:D},newText:$,annotationId:ye}}y.insert=C;function S(D,$){return{range:D,newText:"",annotationId:$}}y.del=S;function g(D){var $=D;return w.is($)&&(H.is($.annotationId)||O.is($.annotationId))}y.is=g})(B||(e.AnnotatedTextEdit=B={}));var De;(function(y){function E(S,g){return{textDocument:S,edits:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&Fs.is(g.textDocument)&&Array.isArray(g.edits)}y.is=C})(De||(e.TextDocumentEdit=De={}));var lt;(function(y){function E(S,g,D){var $={kind:"create",uri:S};return g!==void 0&&(g.overwrite!==void 0||g.ignoreIfExists!==void 0)&&($.options=g),D!==void 0&&($.annotationId=D),$}y.create=E;function C(S){var g=S;return g&&g.kind==="create"&&A.string(g.uri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(lt||(e.CreateFile=lt={}));var Ht;(function(y){function E(S,g,D,$){var ye={kind:"rename",oldUri:S,newUri:g};return D!==void 0&&(D.overwrite!==void 0||D.ignoreIfExists!==void 0)&&(ye.options=D),$!==void 0&&(ye.annotationId=$),ye}y.create=E;function C(S){var g=S;return g&&g.kind==="rename"&&A.string(g.oldUri)&&A.string(g.newUri)&&(g.options===void 0||(g.options.overwrite===void 0||A.boolean(g.options.overwrite))&&(g.options.ignoreIfExists===void 0||A.boolean(g.options.ignoreIfExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(Ht||(e.RenameFile=Ht={}));var Ne;(function(y){function E(S,g,D){var $={kind:"delete",uri:S};return g!==void 0&&(g.recursive!==void 0||g.ignoreIfNotExists!==void 0)&&($.options=g),D!==void 0&&($.annotationId=D),$}y.create=E;function C(S){var g=S;return g&&g.kind==="delete"&&A.string(g.uri)&&(g.options===void 0||(g.options.recursive===void 0||A.boolean(g.options.recursive))&&(g.options.ignoreIfNotExists===void 0||A.boolean(g.options.ignoreIfNotExists)))&&(g.annotationId===void 0||O.is(g.annotationId))}y.is=C})(Ne||(e.DeleteFile=Ne={}));var un;(function(y){function E(C){var S=C;return S&&(S.changes!==void 0||S.documentChanges!==void 0)&&(S.documentChanges===void 0||S.documentChanges.every(function(g){return A.string(g.kind)?lt.is(g)||Ht.is(g)||Ne.is(g):De.is(g)}))}y.is=E})(un||(e.WorkspaceEdit=un={}));var Gi=function(){function y(E,C){this.edits=E,this.changeAnnotations=C}return y.prototype.insert=function(E,C,S){var g,D;if(S===void 0?g=w.insert(E,C):O.is(S)?(D=S,g=B.insert(E,C,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=B.insert(E,C,D)),this.edits.push(g),D!==void 0)return D},y.prototype.replace=function(E,C,S){var g,D;if(S===void 0?g=w.replace(E,C):O.is(S)?(D=S,g=B.replace(E,C,S)):(this.assertChangeAnnotations(this.changeAnnotations),D=this.changeAnnotations.manage(S),g=B.replace(E,C,D)),this.edits.push(g),D!==void 0)return D},y.prototype.delete=function(E,C){var S,g;if(C===void 0?S=w.del(E):O.is(C)?(g=C,S=B.del(E,C)):(this.assertChangeAnnotations(this.changeAnnotations),g=this.changeAnnotations.manage(C),S=B.del(E,g)),this.edits.push(S),g!==void 0)return g},y.prototype.add=function(E){this.edits.push(E)},y.prototype.all=function(){return this.edits},y.prototype.clear=function(){this.edits.splice(0,this.edits.length)},y.prototype.assertChangeAnnotations=function(E){if(E===void 0)throw new Error("Text edit change is not configured to manage change annotations.")},y}(),Gu=function(){function y(E){this._annotations=E===void 0?Object.create(null):E,this._counter=0,this._size=0}return y.prototype.all=function(){return this._annotations},Object.defineProperty(y.prototype,"size",{get:function(){return this._size},enumerable:!1,configurable:!0}),y.prototype.manage=function(E,C){var S;if(O.is(E)?S=E:(S=this.nextId(),C=E),this._annotations[S]!==void 0)throw new Error("Id ".concat(S," is already in use."));if(C===void 0)throw new Error("No annotation provided for id ".concat(S));return this._annotations[S]=C,this._size++,S},y.prototype.nextId=function(){return this._counter++,this._counter.toString()},y}(),ng=function(){function y(E){var C=this;this._textEditChanges=Object.create(null),E!==void 0?(this._workspaceEdit=E,E.documentChanges?(this._changeAnnotations=new Gu(E.changeAnnotations),E.changeAnnotations=this._changeAnnotations.all(),E.documentChanges.forEach(function(S){if(De.is(S)){var g=new Gi(S.edits,C._changeAnnotations);C._textEditChanges[S.textDocument.uri]=g}})):E.changes&&Object.keys(E.changes).forEach(function(S){var g=new Gi(E.changes[S]);C._textEditChanges[S]=g})):this._workspaceEdit={}}return Object.defineProperty(y.prototype,"edit",{get:function(){return this.initDocumentChanges(),this._changeAnnotations!==void 0&&(this._changeAnnotations.size===0?this._workspaceEdit.changeAnnotations=void 0:this._workspaceEdit.changeAnnotations=this._changeAnnotations.all()),this._workspaceEdit},enumerable:!1,configurable:!0}),y.prototype.getTextEditChange=function(E){if(Fs.is(E)){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var C={uri:E.uri,version:E.version},S=this._textEditChanges[C.uri];if(!S){var g=[],D={textDocument:C,edits:g};this._workspaceEdit.documentChanges.push(D),S=new Gi(g,this._changeAnnotations),this._textEditChanges[C.uri]=S}return S}else{if(this.initChanges(),this._workspaceEdit.changes===void 0)throw new Error("Workspace edit is not configured for normal text edit changes.");var S=this._textEditChanges[E];if(!S){var g=[];this._workspaceEdit.changes[E]=g,S=new Gi(g),this._textEditChanges[E]=S}return S}},y.prototype.initDocumentChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._changeAnnotations=new Gu,this._workspaceEdit.documentChanges=[],this._workspaceEdit.changeAnnotations=this._changeAnnotations.all())},y.prototype.initChanges=function(){this._workspaceEdit.documentChanges===void 0&&this._workspaceEdit.changes===void 0&&(this._workspaceEdit.changes=Object.create(null))},y.prototype.createFile=function(E,C,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(C)||O.is(C)?g=C:S=C;var D,$;if(g===void 0?D=lt.create(E,S):($=O.is(g)?g:this._changeAnnotations.manage(g),D=lt.create(E,S,$)),this._workspaceEdit.documentChanges.push(D),$!==void 0)return $},y.prototype.renameFile=function(E,C,S,g){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var D;H.is(S)||O.is(S)?D=S:g=S;var $,ye;if(D===void 0?$=Ht.create(E,C,g):(ye=O.is(D)?D:this._changeAnnotations.manage(D),$=Ht.create(E,C,g,ye)),this._workspaceEdit.documentChanges.push($),ye!==void 0)return ye},y.prototype.deleteFile=function(E,C,S){if(this.initDocumentChanges(),this._workspaceEdit.documentChanges===void 0)throw new Error("Workspace edit is not configured for document changes.");var g;H.is(C)||O.is(C)?g=C:S=C;var D,$;if(g===void 0?D=Ne.create(E,S):($=O.is(g)?g:this._changeAnnotations.manage(g),D=Ne.create(E,S,$)),this._workspaceEdit.documentChanges.push(D),$!==void 0)return $},y}();e.WorkspaceChange=ng;var Ku;(function(y){function E(S){return{uri:S}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)}y.is=C})(Ku||(e.TextDocumentIdentifier=Ku={}));var hc;(function(y){function E(S,g){return{uri:S,version:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.integer(g.version)}y.is=C})(hc||(e.VersionedTextDocumentIdentifier=hc={}));var Fs;(function(y){function E(S,g){return{uri:S,version:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&(g.version===null||A.integer(g.version))}y.is=C})(Fs||(e.OptionalVersionedTextDocumentIdentifier=Fs={}));var Ni;(function(y){function E(S,g,D,$){return{uri:S,languageId:g,version:D,text:$}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.string(g.uri)&&A.string(g.languageId)&&A.integer(g.version)&&A.string(g.text)}y.is=C})(Ni||(e.TextDocumentItem=Ni={}));var Co;(function(y){y.PlainText="plaintext",y.Markdown="markdown";function E(C){var S=C;return S===y.PlainText||S===y.Markdown}y.is=E})(Co||(e.MarkupKind=Co={}));var Bs;(function(y){function E(C){var S=C;return A.objectLiteral(C)&&Co.is(S.kind)&&A.string(S.value)}y.is=E})(Bs||(e.MarkupContent=Bs={}));var Yu;(function(y){y.Text=1,y.Method=2,y.Function=3,y.Constructor=4,y.Field=5,y.Variable=6,y.Class=7,y.Interface=8,y.Module=9,y.Property=10,y.Unit=11,y.Value=12,y.Enum=13,y.Keyword=14,y.Snippet=15,y.Color=16,y.File=17,y.Reference=18,y.Folder=19,y.EnumMember=20,y.Constant=21,y.Struct=22,y.Event=23,y.Operator=24,y.TypeParameter=25})(Yu||(e.CompletionItemKind=Yu={}));var mc;(function(y){y.PlainText=1,y.Snippet=2})(mc||(e.InsertTextFormat=mc={}));var gc;(function(y){y.Deprecated=1})(gc||(e.CompletionItemTag=gc={}));var Xu;(function(y){function E(S,g,D){return{newText:S,insert:g,replace:D}}y.create=E;function C(S){var g=S;return g&&A.string(g.newText)&&a.is(g.insert)&&a.is(g.replace)}y.is=C})(Xu||(e.InsertReplaceEdit=Xu={}));var Ju;(function(y){y.asIs=1,y.adjustIndentation=2})(Ju||(e.InsertTextMode=Ju={}));var Qu;(function(y){function E(C){var S=C;return S&&(A.string(S.detail)||S.detail===void 0)&&(A.string(S.description)||S.description===void 0)}y.is=E})(Qu||(e.CompletionItemLabelDetails=Qu={}));var Zu;(function(y){function E(C){return{label:C}}y.create=E})(Zu||(e.CompletionItem=Zu={}));var ed;(function(y){function E(C,S){return{items:C||[],isIncomplete:!!S}}y.create=E})(ed||(e.CompletionList=ed={}));var Do;(function(y){function E(S){return S.replace(/[\\`*_{}[\]()#+\-.!]/g,"\\$&")}y.fromPlainText=E;function C(S){var g=S;return A.string(g)||A.objectLiteral(g)&&A.string(g.language)&&A.string(g.value)}y.is=C})(Do||(e.MarkedString=Do={}));var Ln;(function(y){function E(C){var S=C;return!!S&&A.objectLiteral(S)&&(Bs.is(S.contents)||Do.is(S.contents)||A.typedArray(S.contents,Do.is))&&(C.range===void 0||a.is(C.range))}y.is=E})(Ln||(e.Hover=Ln={}));var td;(function(y){function E(C,S){return S?{label:C,documentation:S}:{label:C}}y.create=E})(td||(e.ParameterInformation=td={}));var rd;(function(y){function E(C,S){for(var g=[],D=2;D<arguments.length;D++)g[D-2]=arguments[D];var $={label:C};return A.defined(S)&&($.documentation=S),A.defined(g)?$.parameters=g:$.parameters=[],$}y.create=E})(rd||(e.SignatureInformation=rd={}));var js;(function(y){y.Text=1,y.Read=2,y.Write=3})(js||(e.DocumentHighlightKind=js={}));var nd;(function(y){function E(C,S){var g={range:C};return A.number(S)&&(g.kind=S),g}y.create=E})(nd||(e.DocumentHighlight=nd={}));var Ao;(function(y){y.File=1,y.Module=2,y.Namespace=3,y.Package=4,y.Class=5,y.Method=6,y.Property=7,y.Field=8,y.Constructor=9,y.Enum=10,y.Interface=11,y.Function=12,y.Variable=13,y.Constant=14,y.String=15,y.Number=16,y.Boolean=17,y.Array=18,y.Object=19,y.Key=20,y.Null=21,y.EnumMember=22,y.Struct=23,y.Event=24,y.Operator=25,y.TypeParameter=26})(Ao||(e.SymbolKind=Ao={}));var id;(function(y){y.Deprecated=1})(id||(e.SymbolTag=id={}));var Ri;(function(y){function E(C,S,g,D,$){var ye={name:C,kind:S,location:{uri:D,range:g}};return $&&(ye.containerName=$),ye}y.create=E})(Ri||(e.SymbolInformation=Ri={}));var Ki;(function(y){function E(C,S,g,D){return D!==void 0?{name:C,kind:S,location:{uri:g,range:D}}:{name:C,kind:S,location:{uri:g}}}y.create=E})(Ki||(e.WorkspaceSymbol=Ki={}));var sd;(function(y){function E(S,g,D,$,ye,Ct){var ut={name:S,detail:g,kind:D,range:$,selectionRange:ye};return Ct!==void 0&&(ut.children=Ct),ut}y.create=E;function C(S){var g=S;return g&&A.string(g.name)&&A.number(g.kind)&&a.is(g.range)&&a.is(g.selectionRange)&&(g.detail===void 0||A.string(g.detail))&&(g.deprecated===void 0||A.boolean(g.deprecated))&&(g.children===void 0||Array.isArray(g.children))&&(g.tags===void 0||Array.isArray(g.tags))}y.is=C})(sd||(e.DocumentSymbol=sd={}));var od;(function(y){y.Empty="",y.QuickFix="quickfix",y.Refactor="refactor",y.RefactorExtract="refactor.extract",y.RefactorInline="refactor.inline",y.RefactorRewrite="refactor.rewrite",y.Source="source",y.SourceOrganizeImports="source.organizeImports",y.SourceFixAll="source.fixAll"})(od||(e.CodeActionKind=od={}));var si;(function(y){y.Invoked=1,y.Automatic=2})(si||(e.CodeActionTriggerKind=si={}));var yc;(function(y){function E(S,g,D){var $={diagnostics:S};return g!=null&&($.only=g),D!=null&&($.triggerKind=D),$}y.create=E;function C(S){var g=S;return A.defined(g)&&A.typedArray(g.diagnostics,v.is)&&(g.only===void 0||A.typedArray(g.only,A.string))&&(g.triggerKind===void 0||g.triggerKind===si.Invoked||g.triggerKind===si.Automatic)}y.is=C})(yc||(e.CodeActionContext=yc={}));var Tc;(function(y){function E(S,g,D){var $={title:S},ye=!0;return typeof g=="string"?(ye=!1,$.kind=g):k.is(g)?$.command=g:$.edit=g,ye&&D!==void 0&&($.kind=D),$}y.create=E;function C(S){var g=S;return g&&A.string(g.title)&&(g.diagnostics===void 0||A.typedArray(g.diagnostics,v.is))&&(g.kind===void 0||A.string(g.kind))&&(g.edit!==void 0||g.command!==void 0)&&(g.command===void 0||k.is(g.command))&&(g.isPreferred===void 0||A.boolean(g.isPreferred))&&(g.edit===void 0||un.is(g.edit))}y.is=C})(Tc||(e.CodeAction=Tc={}));var Io;(function(y){function E(S,g){var D={range:S};return A.defined(g)&&(D.data=g),D}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.command)||k.is(g.command))}y.is=C})(Io||(e.CodeLens=Io={}));var vc;(function(y){function E(S,g){return{tabSize:S,insertSpaces:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&A.uinteger(g.tabSize)&&A.boolean(g.insertSpaces)}y.is=C})(vc||(e.FormattingOptions=vc={}));var Pi;(function(y){function E(S,g,D){return{range:S,target:g,data:D}}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(g.range)&&(A.undefined(g.target)||A.string(g.target))}y.is=C})(Pi||(e.DocumentLink=Pi={}));var P;(function(y){function E(S,g){return{range:S,parent:g}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&a.is(g.range)&&(g.parent===void 0||y.is(g.parent))}y.is=C})(P||(e.SelectionRange=P={}));var L;(function(y){y.namespace="namespace",y.type="type",y.class="class",y.enum="enum",y.interface="interface",y.struct="struct",y.typeParameter="typeParameter",y.parameter="parameter",y.variable="variable",y.property="property",y.enumMember="enumMember",y.event="event",y.function="function",y.method="method",y.macro="macro",y.keyword="keyword",y.modifier="modifier",y.comment="comment",y.string="string",y.number="number",y.regexp="regexp",y.operator="operator",y.decorator="decorator"})(L||(e.SemanticTokenTypes=L={}));var G;(function(y){y.declaration="declaration",y.definition="definition",y.readonly="readonly",y.static="static",y.deprecated="deprecated",y.abstract="abstract",y.async="async",y.modification="modification",y.documentation="documentation",y.defaultLibrary="defaultLibrary"})(G||(e.SemanticTokenModifiers=G={}));var re;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&(S.resultId===void 0||typeof S.resultId=="string")&&Array.isArray(S.data)&&(S.data.length===0||typeof S.data[0]=="number")}y.is=E})(re||(e.SemanticTokens=re={}));var et;(function(y){function E(S,g){return{range:S,text:g}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&A.string(g.text)}y.is=C})(et||(e.InlineValueText=et={}));var Ye;(function(y){function E(S,g,D){return{range:S,variableName:g,caseSensitiveLookup:D}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&A.boolean(g.caseSensitiveLookup)&&(A.string(g.variableName)||g.variableName===void 0)}y.is=C})(Ye||(e.InlineValueVariableLookup=Ye={}));var ht;(function(y){function E(S,g){return{range:S,expression:g}}y.create=E;function C(S){var g=S;return g!=null&&a.is(g.range)&&(A.string(g.expression)||g.expression===void 0)}y.is=C})(ht||(e.InlineValueEvaluatableExpression=ht={}));var St;(function(y){function E(S,g){return{frameId:S,stoppedLocation:g}}y.create=E;function C(S){var g=S;return A.defined(g)&&a.is(S.stoppedLocation)}y.is=C})(St||(e.InlineValueContext=St={}));var Re;(function(y){y.Type=1,y.Parameter=2;function E(C){return C===1||C===2}y.is=E})(Re||(e.InlayHintKind=Re={}));var it;(function(y){function E(S){return{value:S}}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&(g.tooltip===void 0||A.string(g.tooltip)||Bs.is(g.tooltip))&&(g.location===void 0||c.is(g.location))&&(g.command===void 0||k.is(g.command))}y.is=C})(it||(e.InlayHintLabelPart=it={}));var Ve;(function(y){function E(S,g,D){var $={position:S,label:g};return D!==void 0&&($.kind=D),$}y.create=E;function C(S){var g=S;return A.objectLiteral(g)&&o.is(g.position)&&(A.string(g.label)||A.typedArray(g.label,it.is))&&(g.kind===void 0||Re.is(g.kind))&&g.textEdits===void 0||A.typedArray(g.textEdits,w.is)&&(g.tooltip===void 0||A.string(g.tooltip)||Bs.is(g.tooltip))&&(g.paddingLeft===void 0||A.boolean(g.paddingLeft))&&(g.paddingRight===void 0||A.boolean(g.paddingRight))}y.is=C})(Ve||(e.InlayHint=Ve={}));var wt;(function(y){function E(C){return{kind:"snippet",value:C}}y.createSnippet=E})(wt||(e.StringValue=wt={}));var Wt;(function(y){function E(C,S,g,D){return{insertText:C,filterText:S,range:g,command:D}}y.create=E})(Wt||(e.InlineCompletionItem=Wt={}));var Jr;(function(y){function E(C){return{items:C}}y.create=E})(Jr||(e.InlineCompletionList=Jr={}));var ad;(function(y){y.Invoked=0,y.Automatic=1})(ad||(e.InlineCompletionTriggerKind=ad={}));var uk;(function(y){function E(C,S){return{range:C,text:S}}y.create=E})(uk||(e.SelectedCompletionInfo=uk={}));var dk;(function(y){function E(C,S){return{triggerKind:C,selectedCompletionInfo:S}}y.create=E})(dk||(e.InlineCompletionContext=dk={}));var fk;(function(y){function E(C){var S=C;return A.objectLiteral(S)&&n.is(S.uri)&&A.string(S.name)}y.is=E})(fk||(e.WorkspaceFolder=fk={})),e.EOL=[`
|
|
33
33
|
`,`\r
|
|
34
|
-
`,"\r"];var pk;(function(y){function E(D,$,ye,Ct){return new WF(D,$,ye,Ct)}y.create=E;function C(D){var $=D;return!!(A.defined($)&&A.string($.uri)&&(A.undefined($.languageId)||A.string($.languageId))&&A.uinteger($.lineCount)&&A.func($.getText)&&A.func($.positionAt)&&A.func($.offsetAt))}y.is=C;function S(D,$){for(var ye=D.getText(),Ct=g($,function(Oo,cd){var hk=Oo.range.start.line-cd.range.start.line;return hk===0?Oo.range.start.character-cd.range.start.character:hk}),ut=ye.length,
|
|
34
|
+
`,"\r"];var pk;(function(y){function E(D,$,ye,Ct){return new WF(D,$,ye,Ct)}y.create=E;function C(D){var $=D;return!!(A.defined($)&&A.string($.uri)&&(A.undefined($.languageId)||A.string($.languageId))&&A.uinteger($.lineCount)&&A.func($.getText)&&A.func($.positionAt)&&A.func($.offsetAt))}y.is=C;function S(D,$){for(var ye=D.getText(),Ct=g($,function(Oo,cd){var hk=Oo.range.start.line-cd.range.start.line;return hk===0?Oo.range.start.character-cd.range.start.character:hk}),ut=ye.length,qn=Ct.length-1;qn>=0;qn--){var $n=Ct[qn],Ei=D.offsetAt($n.range.start),Ae=D.offsetAt($n.range.end);if(Ae<=ut)ye=ye.substring(0,Ei)+$n.newText+ye.substring(Ae,ye.length);else throw new Error("Overlapping edit");ut=Ei}return ye}y.applyEdits=S;function g(D,$){if(D.length<=1)return D;var ye=D.length/2|0,Ct=D.slice(0,ye),ut=D.slice(ye);g(Ct,$),g(ut,$);for(var qn=0,$n=0,Ei=0;qn<Ct.length&&$n<ut.length;){var Ae=$(Ct[qn],ut[$n]);Ae<=0?D[Ei++]=Ct[qn++]:D[Ei++]=ut[$n++]}for(;qn<Ct.length;)D[Ei++]=Ct[qn++];for(;$n<ut.length;)D[Ei++]=ut[$n++];return D}})(pk||(e.TextDocument=pk={}));var WF=function(){function y(E,C,S,g){this._uri=E,this._languageId=C,this._version=S,this._content=g,this._lineOffsets=void 0}return Object.defineProperty(y.prototype,"uri",{get:function(){return this._uri},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"languageId",{get:function(){return this._languageId},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"version",{get:function(){return this._version},enumerable:!1,configurable:!0}),y.prototype.getText=function(E){if(E){var C=this.offsetAt(E.start),S=this.offsetAt(E.end);return this._content.substring(C,S)}return this._content},y.prototype.update=function(E,C){this._content=E.text,this._version=C,this._lineOffsets=void 0},y.prototype.getLineOffsets=function(){if(this._lineOffsets===void 0){for(var E=[],C=this._content,S=!0,g=0;g<C.length;g++){S&&(E.push(g),S=!1);var D=C.charAt(g);S=D==="\r"||D===`
|
|
35
35
|
`,D==="\r"&&g+1<C.length&&C.charAt(g+1)===`
|
|
36
|
-
`&&g++}S&&C.length>0&&E.push(C.length),this._lineOffsets=E}return this._lineOffsets},y.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var C=this.getLineOffsets(),S=0,g=C.length;if(g===0)return o.create(0,E);for(;S<g;){var D=Math.floor((S+g)/2);C[D]>E?g=D:S=D+1}var $=S-1;return o.create($,E-C[$])},y.prototype.offsetAt=function(E){var C=this.getLineOffsets();if(E.line>=C.length)return this._content.length;if(E.line<0)return 0;var S=C[E.line],g=E.line+1<C.length?C[E.line+1]:this._content.length;return Math.max(Math.min(S+E.character,g),S)},Object.defineProperty(y.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),y}(),A;(function(y){var E=Object.prototype.toString;function C(Ae){return typeof Ae<"u"}y.defined=C;function S(Ae){return typeof Ae>"u"}y.undefined=S;function g(Ae){return Ae===!0||Ae===!1}y.boolean=g;function D(Ae){return E.call(Ae)==="[object String]"}y.string=D;function $(Ae){return E.call(Ae)==="[object Number]"}y.number=$;function ye(Ae,Oo,cd){return E.call(Ae)==="[object Number]"&&Oo<=Ae&&Ae<=cd}y.numberRange=ye;function Ct(Ae){return E.call(Ae)==="[object Number]"&&-2147483648<=Ae&&Ae<=2147483647}y.integer=Ct;function ut(Ae){return E.call(Ae)==="[object Number]"&&0<=Ae&&Ae<=2147483647}y.uinteger=ut;function Ln(Ae){return E.call(Ae)==="[object Function]"}y.func=Ln;function qn(Ae){return Ae!==null&&typeof Ae=="object"}y.objectLiteral=qn;function Ei(Ae,Oo){return Array.isArray(Ae)&&Ae.every(Oo)}y.typedArray=Ei})(A||(A={}))})});var _t=R(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.ProtocolNotificationType=xr.ProtocolNotificationType0=xr.ProtocolRequestType=xr.ProtocolRequestType0=xr.RegistrationType=xr.MessageDirection=void 0;var Uo=zs(),Yk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Yk||(xr.MessageDirection=Yk={}));var gy=class{constructor(e){this.method=e}};xr.RegistrationType=gy;var yy=class extends Uo.RequestType0{constructor(e){super(e)}};xr.ProtocolRequestType0=yy;var Ty=class extends Uo.RequestType{constructor(e){super(e,Uo.ParameterStructures.byName)}};xr.ProtocolRequestType=Ty;var vy=class extends Uo.NotificationType0{constructor(e){super(e)}};xr.ProtocolNotificationType0=vy;var by=class extends Uo.NotificationType{constructor(e){super(e,Uo.ParameterStructures.byName)}};xr.ProtocolNotificationType=by});var Od=R($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.objectLiteral=$t.typedArray=$t.stringArray=$t.array=$t.func=$t.error=$t.number=$t.string=$t.boolean=void 0;function BB(t){return t===!0||t===!1}$t.boolean=BB;function Xk(t){return typeof t=="string"||t instanceof String}$t.string=Xk;function jB(t){return typeof t=="number"||t instanceof Number}$t.number=jB;function UB(t){return t instanceof Error}$t.error=UB;function HB(t){return typeof t=="function"}$t.func=HB;function Jk(t){return Array.isArray(t)}$t.array=Jk;function VB(t){return Jk(t)&&t.every(e=>Xk(e))}$t.stringArray=VB;function zB(t,e){return Array.isArray(t)&&t.every(e)}$t.typedArray=zB;function WB(t){return t!==null&&typeof t=="object"}$t.objectLiteral=WB});var eN=R(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.ImplementationRequest=void 0;var Qk=_t(),Zk;(function(t){t.method="textDocument/implementation",t.messageDirection=Qk.MessageDirection.clientToServer,t.type=new Qk.ProtocolRequestType(t.method)})(Zk||(xd.ImplementationRequest=Zk={}))});var nN=R(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.TypeDefinitionRequest=void 0;var tN=_t(),rN;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=tN.MessageDirection.clientToServer,t.type=new tN.ProtocolRequestType(t.method)})(rN||(Md.TypeDefinitionRequest=rN={}))});var oN=R(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.DidChangeWorkspaceFoldersNotification=Ho.WorkspaceFoldersRequest=void 0;var Ld=_t(),iN;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Ld.MessageDirection.serverToClient,t.type=new Ld.ProtocolRequestType0(t.method)})(iN||(Ho.WorkspaceFoldersRequest=iN={}));var sN;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Ld.MessageDirection.clientToServer,t.type=new Ld.ProtocolNotificationType(t.method)})(sN||(Ho.DidChangeWorkspaceFoldersNotification=sN={}))});var lN=R(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.ConfigurationRequest=void 0;var aN=_t(),cN;(function(t){t.method="workspace/configuration",t.messageDirection=aN.MessageDirection.serverToClient,t.type=new aN.ProtocolRequestType(t.method)})(cN||(qd.ConfigurationRequest=cN={}))});var fN=R(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.ColorPresentationRequest=Vo.DocumentColorRequest=void 0;var $d=_t(),uN;(function(t){t.method="textDocument/documentColor",t.messageDirection=$d.MessageDirection.clientToServer,t.type=new $d.ProtocolRequestType(t.method)})(uN||(Vo.DocumentColorRequest=uN={}));var dN;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=$d.MessageDirection.clientToServer,t.type=new $d.ProtocolRequestType(t.method)})(dN||(Vo.ColorPresentationRequest=dN={}))});var mN=R(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.FoldingRangeRefreshRequest=zo.FoldingRangeRequest=void 0;var Fd=_t(),pN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Fd.MessageDirection.clientToServer,t.type=new Fd.ProtocolRequestType(t.method)})(pN||(zo.FoldingRangeRequest=pN={}));var hN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Fd.MessageDirection.serverToClient,t.type=new Fd.ProtocolRequestType0(t.method)})(hN||(zo.FoldingRangeRefreshRequest=hN={}))});var TN=R(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.DeclarationRequest=void 0;var gN=_t(),yN;(function(t){t.method="textDocument/declaration",t.messageDirection=gN.MessageDirection.clientToServer,t.type=new gN.ProtocolRequestType(t.method)})(yN||(Bd.DeclarationRequest=yN={}))});var SN=R(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.SelectionRangeRequest=void 0;var vN=_t(),bN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=vN.MessageDirection.clientToServer,t.type=new vN.ProtocolRequestType(t.method)})(bN||(jd.SelectionRangeRequest=bN={}))});var RN=R(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.WorkDoneProgressCancelNotification=Zi.WorkDoneProgressCreateRequest=Zi.WorkDoneProgress=void 0;var GB=zs(),Ud=_t(),_N;(function(t){t.type=new GB.ProgressType;function e(r){return r===t.type}t.is=e})(_N||(Zi.WorkDoneProgress=_N={}));var kN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Ud.MessageDirection.serverToClient,t.type=new Ud.ProtocolRequestType(t.method)})(kN||(Zi.WorkDoneProgressCreateRequest=kN={}));var NN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Ud.MessageDirection.clientToServer,t.type=new Ud.ProtocolNotificationType(t.method)})(NN||(Zi.WorkDoneProgressCancelNotification=NN={}))});var CN=R(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.CallHierarchyOutgoingCallsRequest=es.CallHierarchyIncomingCallsRequest=es.CallHierarchyPrepareRequest=void 0;var Wo=_t(),PN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(PN||(es.CallHierarchyPrepareRequest=PN={}));var EN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(EN||(es.CallHierarchyIncomingCallsRequest=EN={}));var wN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(wN||(es.CallHierarchyOutgoingCallsRequest=wN={}))});var MN=R(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.SemanticTokensRefreshRequest=Mr.SemanticTokensRangeRequest=Mr.SemanticTokensDeltaRequest=Mr.SemanticTokensRequest=Mr.SemanticTokensRegistrationType=Mr.TokenFormat=void 0;var Ci=_t(),DN;(function(t){t.Relative="relative"})(DN||(Mr.TokenFormat=DN={}));var Pc;(function(t){t.method="textDocument/semanticTokens",t.type=new Ci.RegistrationType(t.method)})(Pc||(Mr.SemanticTokensRegistrationType=Pc={}));var AN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(AN||(Mr.SemanticTokensRequest=AN={}));var IN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(IN||(Mr.SemanticTokensDeltaRequest=IN={}));var ON;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(ON||(Mr.SemanticTokensRangeRequest=ON={}));var xN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Ci.MessageDirection.serverToClient,t.type=new Ci.ProtocolRequestType0(t.method)})(xN||(Mr.SemanticTokensRefreshRequest=xN={}))});var $N=R(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ShowDocumentRequest=void 0;var LN=_t(),qN;(function(t){t.method="window/showDocument",t.messageDirection=LN.MessageDirection.serverToClient,t.type=new LN.ProtocolRequestType(t.method)})(qN||(Hd.ShowDocumentRequest=qN={}))});var jN=R(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.LinkedEditingRangeRequest=void 0;var FN=_t(),BN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=FN.MessageDirection.clientToServer,t.type=new FN.ProtocolRequestType(t.method)})(BN||(Vd.LinkedEditingRangeRequest=BN={}))});var YN=R(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.WillDeleteFilesRequest=fr.DidDeleteFilesNotification=fr.DidRenameFilesNotification=fr.WillRenameFilesRequest=fr.DidCreateFilesNotification=fr.WillCreateFilesRequest=fr.FileOperationPatternKind=void 0;var dn=_t(),UN;(function(t){t.file="file",t.folder="folder"})(UN||(fr.FileOperationPatternKind=UN={}));var HN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(HN||(fr.WillCreateFilesRequest=HN={}));var VN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(VN||(fr.DidCreateFilesNotification=VN={}));var zN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(zN||(fr.WillRenameFilesRequest=zN={}));var WN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(WN||(fr.DidRenameFilesNotification=WN={}));var GN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(GN||(fr.DidDeleteFilesNotification=GN={}));var KN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(KN||(fr.WillDeleteFilesRequest=KN={}))});var eR=R(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.MonikerRequest=ts.MonikerKind=ts.UniquenessLevel=void 0;var XN=_t(),JN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(JN||(ts.UniquenessLevel=JN={}));var QN;(function(t){t.$import="import",t.$export="export",t.local="local"})(QN||(ts.MonikerKind=QN={}));var ZN;(function(t){t.method="textDocument/moniker",t.messageDirection=XN.MessageDirection.clientToServer,t.type=new XN.ProtocolRequestType(t.method)})(ZN||(ts.MonikerRequest=ZN={}))});var iR=R(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.TypeHierarchySubtypesRequest=rs.TypeHierarchySupertypesRequest=rs.TypeHierarchyPrepareRequest=void 0;var Go=_t(),tR;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(tR||(rs.TypeHierarchyPrepareRequest=tR={}));var rR;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(rR||(rs.TypeHierarchySupertypesRequest=rR={}));var nR;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(nR||(rs.TypeHierarchySubtypesRequest=nR={}))});var aR=R(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.InlineValueRefreshRequest=Ko.InlineValueRequest=void 0;var zd=_t(),sR;(function(t){t.method="textDocument/inlineValue",t.messageDirection=zd.MessageDirection.clientToServer,t.type=new zd.ProtocolRequestType(t.method)})(sR||(Ko.InlineValueRequest=sR={}));var oR;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=zd.MessageDirection.serverToClient,t.type=new zd.ProtocolRequestType0(t.method)})(oR||(Ko.InlineValueRefreshRequest=oR={}))});var dR=R(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.InlayHintRefreshRequest=ns.InlayHintResolveRequest=ns.InlayHintRequest=void 0;var Yo=_t(),cR;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Yo.MessageDirection.clientToServer,t.type=new Yo.ProtocolRequestType(t.method)})(cR||(ns.InlayHintRequest=cR={}));var lR;(function(t){t.method="inlayHint/resolve",t.messageDirection=Yo.MessageDirection.clientToServer,t.type=new Yo.ProtocolRequestType(t.method)})(lR||(ns.InlayHintResolveRequest=lR={}));var uR;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Yo.MessageDirection.serverToClient,t.type=new Yo.ProtocolRequestType0(t.method)})(uR||(ns.InlayHintRefreshRequest=uR={}))});var TR=R(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.DiagnosticRefreshRequest=fn.WorkspaceDiagnosticRequest=fn.DocumentDiagnosticRequest=fn.DocumentDiagnosticReportKind=fn.DiagnosticServerCancellationData=void 0;var yR=zs(),KB=Od(),Xo=_t(),fR;(function(t){function e(r){let n=r;return n&&KB.boolean(n.retriggerRequest)}t.is=e})(fR||(fn.DiagnosticServerCancellationData=fR={}));var pR;(function(t){t.Full="full",t.Unchanged="unchanged"})(pR||(fn.DocumentDiagnosticReportKind=pR={}));var hR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method),t.partialResult=new yR.ProgressType})(hR||(fn.DocumentDiagnosticRequest=hR={}));var mR;(function(t){t.method="workspace/diagnostic",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method),t.partialResult=new yR.ProgressType})(mR||(fn.WorkspaceDiagnosticRequest=mR={}));var gR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Xo.MessageDirection.serverToClient,t.type=new Xo.ProtocolRequestType0(t.method)})(gR||(fn.DiagnosticRefreshRequest=gR={}))});var RR=R(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.DidCloseNotebookDocumentNotification=Dt.DidSaveNotebookDocumentNotification=Dt.DidChangeNotebookDocumentNotification=Dt.NotebookCellArrayChange=Dt.DidOpenNotebookDocumentNotification=Dt.NotebookDocumentSyncRegistrationType=Dt.NotebookDocument=Dt.NotebookCell=Dt.ExecutionSummary=Dt.NotebookCellKind=void 0;var Ec=Id(),Fn=Od(),si=_t(),Sy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Sy||(Dt.NotebookCellKind=Sy={}));var _y;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function r(i){let s=i;return Fn.objectLiteral(s)&&Ec.uinteger.is(s.executionOrder)&&(s.success===void 0||Fn.boolean(s.success))}t.is=r;function n(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=n})(_y||(Dt.ExecutionSummary=_y={}));var Wd;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return Fn.objectLiteral(o)&&Sy.is(o.kind)&&Ec.DocumentUri.is(o.document)&&(o.metadata===void 0||Fn.objectLiteral(o.metadata))}t.is=r;function n(s,o){let a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!_y.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;let a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(Fn.objectLiteral(s)&&Fn.objectLiteral(o)){let l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){let f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(Wd||(Dt.NotebookCell=Wd={}));var vR;(function(t){function e(n,i,s,o){return{uri:n,notebookType:i,version:s,cells:o}}t.create=e;function r(n){let i=n;return Fn.objectLiteral(i)&&Fn.string(i.uri)&&Ec.integer.is(i.version)&&Fn.typedArray(i.cells,Wd.is)}t.is=r})(vR||(Dt.NotebookDocument=vR={}));var Jo;(function(t){t.method="notebookDocument/sync",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.RegistrationType(t.method)})(Jo||(Dt.NotebookDocumentSyncRegistrationType=Jo={}));var bR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(bR||(Dt.DidOpenNotebookDocumentNotification=bR={}));var SR;(function(t){function e(n){let i=n;return Fn.objectLiteral(i)&&Ec.uinteger.is(i.start)&&Ec.uinteger.is(i.deleteCount)&&(i.cells===void 0||Fn.typedArray(i.cells,Wd.is))}t.is=e;function r(n,i,s){let o={start:n,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=r})(SR||(Dt.NotebookCellArrayChange=SR={}));var _R;(function(t){t.method="notebookDocument/didChange",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(_R||(Dt.DidChangeNotebookDocumentNotification=_R={}));var kR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(kR||(Dt.DidSaveNotebookDocumentNotification=kR={}));var NR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=si.MessageDirection.clientToServer,t.type=new si.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(NR||(Dt.DidCloseNotebookDocumentNotification=NR={}))});var wR=R(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.InlineCompletionRequest=void 0;var PR=_t(),ER;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=PR.MessageDirection.clientToServer,t.type=new PR.ProtocolRequestType(t.method)})(ER||(Gd.InlineCompletionRequest=ER={}))});var jP=R(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.WorkspaceSymbolRequest=N.CodeActionResolveRequest=N.CodeActionRequest=N.DocumentSymbolRequest=N.DocumentHighlightRequest=N.ReferencesRequest=N.DefinitionRequest=N.SignatureHelpRequest=N.SignatureHelpTriggerKind=N.HoverRequest=N.CompletionResolveRequest=N.CompletionRequest=N.CompletionTriggerKind=N.PublishDiagnosticsNotification=N.WatchKind=N.RelativePattern=N.FileChangeType=N.DidChangeWatchedFilesNotification=N.WillSaveTextDocumentWaitUntilRequest=N.WillSaveTextDocumentNotification=N.TextDocumentSaveReason=N.DidSaveTextDocumentNotification=N.DidCloseTextDocumentNotification=N.DidChangeTextDocumentNotification=N.TextDocumentContentChangeEvent=N.DidOpenTextDocumentNotification=N.TextDocumentSyncKind=N.TelemetryEventNotification=N.LogMessageNotification=N.ShowMessageRequest=N.ShowMessageNotification=N.MessageType=N.DidChangeConfigurationNotification=N.ExitNotification=N.ShutdownRequest=N.InitializedNotification=N.InitializeErrorCodes=N.InitializeRequest=N.WorkDoneProgressOptions=N.TextDocumentRegistrationOptions=N.StaticRegistrationOptions=N.PositionEncodingKind=N.FailureHandlingKind=N.ResourceOperationKind=N.UnregistrationRequest=N.RegistrationRequest=N.DocumentSelector=N.NotebookCellTextDocumentFilter=N.NotebookDocumentFilter=N.TextDocumentFilter=void 0;N.MonikerRequest=N.MonikerKind=N.UniquenessLevel=N.WillDeleteFilesRequest=N.DidDeleteFilesNotification=N.WillRenameFilesRequest=N.DidRenameFilesNotification=N.WillCreateFilesRequest=N.DidCreateFilesNotification=N.FileOperationPatternKind=N.LinkedEditingRangeRequest=N.ShowDocumentRequest=N.SemanticTokensRegistrationType=N.SemanticTokensRefreshRequest=N.SemanticTokensRangeRequest=N.SemanticTokensDeltaRequest=N.SemanticTokensRequest=N.TokenFormat=N.CallHierarchyPrepareRequest=N.CallHierarchyOutgoingCallsRequest=N.CallHierarchyIncomingCallsRequest=N.WorkDoneProgressCancelNotification=N.WorkDoneProgressCreateRequest=N.WorkDoneProgress=N.SelectionRangeRequest=N.DeclarationRequest=N.FoldingRangeRefreshRequest=N.FoldingRangeRequest=N.ColorPresentationRequest=N.DocumentColorRequest=N.ConfigurationRequest=N.DidChangeWorkspaceFoldersNotification=N.WorkspaceFoldersRequest=N.TypeDefinitionRequest=N.ImplementationRequest=N.ApplyWorkspaceEditRequest=N.ExecuteCommandRequest=N.PrepareRenameRequest=N.RenameRequest=N.PrepareSupportDefaultBehavior=N.DocumentOnTypeFormattingRequest=N.DocumentRangesFormattingRequest=N.DocumentRangeFormattingRequest=N.DocumentFormattingRequest=N.DocumentLinkResolveRequest=N.DocumentLinkRequest=N.CodeLensRefreshRequest=N.CodeLensResolveRequest=N.CodeLensRequest=N.WorkspaceSymbolResolveRequest=void 0;N.InlineCompletionRequest=N.DidCloseNotebookDocumentNotification=N.DidSaveNotebookDocumentNotification=N.DidChangeNotebookDocumentNotification=N.NotebookCellArrayChange=N.DidOpenNotebookDocumentNotification=N.NotebookDocumentSyncRegistrationType=N.NotebookDocument=N.NotebookCell=N.ExecutionSummary=N.NotebookCellKind=N.DiagnosticRefreshRequest=N.WorkspaceDiagnosticRequest=N.DocumentDiagnosticRequest=N.DocumentDiagnosticReportKind=N.DiagnosticServerCancellationData=N.InlayHintRefreshRequest=N.InlayHintResolveRequest=N.InlayHintRequest=N.InlineValueRefreshRequest=N.InlineValueRequest=N.TypeHierarchySupertypesRequest=N.TypeHierarchySubtypesRequest=N.TypeHierarchyPrepareRequest=void 0;var V=_t(),CR=Id(),Gt=Od(),YB=eN();Object.defineProperty(N,"ImplementationRequest",{enumerable:!0,get:function(){return YB.ImplementationRequest}});var XB=nN();Object.defineProperty(N,"TypeDefinitionRequest",{enumerable:!0,get:function(){return XB.TypeDefinitionRequest}});var qP=oN();Object.defineProperty(N,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return qP.WorkspaceFoldersRequest}});Object.defineProperty(N,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return qP.DidChangeWorkspaceFoldersNotification}});var JB=lN();Object.defineProperty(N,"ConfigurationRequest",{enumerable:!0,get:function(){return JB.ConfigurationRequest}});var $P=fN();Object.defineProperty(N,"DocumentColorRequest",{enumerable:!0,get:function(){return $P.DocumentColorRequest}});Object.defineProperty(N,"ColorPresentationRequest",{enumerable:!0,get:function(){return $P.ColorPresentationRequest}});var FP=mN();Object.defineProperty(N,"FoldingRangeRequest",{enumerable:!0,get:function(){return FP.FoldingRangeRequest}});Object.defineProperty(N,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return FP.FoldingRangeRefreshRequest}});var QB=TN();Object.defineProperty(N,"DeclarationRequest",{enumerable:!0,get:function(){return QB.DeclarationRequest}});var ZB=SN();Object.defineProperty(N,"SelectionRangeRequest",{enumerable:!0,get:function(){return ZB.SelectionRangeRequest}});var Ey=RN();Object.defineProperty(N,"WorkDoneProgress",{enumerable:!0,get:function(){return Ey.WorkDoneProgress}});Object.defineProperty(N,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Ey.WorkDoneProgressCreateRequest}});Object.defineProperty(N,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Ey.WorkDoneProgressCancelNotification}});var wy=CN();Object.defineProperty(N,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return wy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(N,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return wy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(N,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return wy.CallHierarchyPrepareRequest}});var Qo=MN();Object.defineProperty(N,"TokenFormat",{enumerable:!0,get:function(){return Qo.TokenFormat}});Object.defineProperty(N,"SemanticTokensRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRequest}});Object.defineProperty(N,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensDeltaRequest}});Object.defineProperty(N,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRangeRequest}});Object.defineProperty(N,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRefreshRequest}});Object.defineProperty(N,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Qo.SemanticTokensRegistrationType}});var ej=$N();Object.defineProperty(N,"ShowDocumentRequest",{enumerable:!0,get:function(){return ej.ShowDocumentRequest}});var tj=jN();Object.defineProperty(N,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return tj.LinkedEditingRangeRequest}});var Ws=YN();Object.defineProperty(N,"FileOperationPatternKind",{enumerable:!0,get:function(){return Ws.FileOperationPatternKind}});Object.defineProperty(N,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Ws.DidCreateFilesNotification}});Object.defineProperty(N,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Ws.WillCreateFilesRequest}});Object.defineProperty(N,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Ws.DidRenameFilesNotification}});Object.defineProperty(N,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Ws.WillRenameFilesRequest}});Object.defineProperty(N,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Ws.DidDeleteFilesNotification}});Object.defineProperty(N,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Ws.WillDeleteFilesRequest}});var Cy=eR();Object.defineProperty(N,"UniquenessLevel",{enumerable:!0,get:function(){return Cy.UniquenessLevel}});Object.defineProperty(N,"MonikerKind",{enumerable:!0,get:function(){return Cy.MonikerKind}});Object.defineProperty(N,"MonikerRequest",{enumerable:!0,get:function(){return Cy.MonikerRequest}});var Dy=iR();Object.defineProperty(N,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchyPrepareRequest}});Object.defineProperty(N,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchySubtypesRequest}});Object.defineProperty(N,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchySupertypesRequest}});var BP=aR();Object.defineProperty(N,"InlineValueRequest",{enumerable:!0,get:function(){return BP.InlineValueRequest}});Object.defineProperty(N,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return BP.InlineValueRefreshRequest}});var Ay=dR();Object.defineProperty(N,"InlayHintRequest",{enumerable:!0,get:function(){return Ay.InlayHintRequest}});Object.defineProperty(N,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Ay.InlayHintResolveRequest}});Object.defineProperty(N,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Ay.InlayHintRefreshRequest}});var wc=TR();Object.defineProperty(N,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return wc.DiagnosticServerCancellationData}});Object.defineProperty(N,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return wc.DocumentDiagnosticReportKind}});Object.defineProperty(N,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return wc.DocumentDiagnosticRequest}});Object.defineProperty(N,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return wc.WorkspaceDiagnosticRequest}});Object.defineProperty(N,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return wc.DiagnosticRefreshRequest}});var oi=RR();Object.defineProperty(N,"NotebookCellKind",{enumerable:!0,get:function(){return oi.NotebookCellKind}});Object.defineProperty(N,"ExecutionSummary",{enumerable:!0,get:function(){return oi.ExecutionSummary}});Object.defineProperty(N,"NotebookCell",{enumerable:!0,get:function(){return oi.NotebookCell}});Object.defineProperty(N,"NotebookDocument",{enumerable:!0,get:function(){return oi.NotebookDocument}});Object.defineProperty(N,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return oi.NotebookDocumentSyncRegistrationType}});Object.defineProperty(N,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidOpenNotebookDocumentNotification}});Object.defineProperty(N,"NotebookCellArrayChange",{enumerable:!0,get:function(){return oi.NotebookCellArrayChange}});Object.defineProperty(N,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidChangeNotebookDocumentNotification}});Object.defineProperty(N,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidSaveNotebookDocumentNotification}});Object.defineProperty(N,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return oi.DidCloseNotebookDocumentNotification}});var rj=wR();Object.defineProperty(N,"InlineCompletionRequest",{enumerable:!0,get:function(){return rj.InlineCompletionRequest}});var ky;(function(t){function e(r){let n=r;return Gt.string(n)||Gt.string(n.language)||Gt.string(n.scheme)||Gt.string(n.pattern)}t.is=e})(ky||(N.TextDocumentFilter=ky={}));var Ny;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebookType)||Gt.string(n.scheme)||Gt.string(n.pattern))}t.is=e})(Ny||(N.NotebookDocumentFilter=Ny={}));var Ry;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebook)||Ny.is(n.notebook))&&(n.language===void 0||Gt.string(n.language))}t.is=e})(Ry||(N.NotebookCellTextDocumentFilter=Ry={}));var Py;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Gt.string(n)&&!ky.is(n)&&!Ry.is(n))return!1;return!0}t.is=e})(Py||(N.DocumentSelector=Py={}));var DR;(function(t){t.method="client/registerCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(DR||(N.RegistrationRequest=DR={}));var AR;(function(t){t.method="client/unregisterCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(AR||(N.UnregistrationRequest=AR={}));var IR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(IR||(N.ResourceOperationKind=IR={}));var OR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(OR||(N.FailureHandlingKind=OR={}));var xR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(xR||(N.PositionEncodingKind=xR={}));var MR;(function(t){function e(r){let n=r;return n&&Gt.string(n.id)&&n.id.length>0}t.hasId=e})(MR||(N.StaticRegistrationOptions=MR={}));var LR;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Py.is(n.documentSelector))}t.is=e})(LR||(N.TextDocumentRegistrationOptions=LR={}));var qR;(function(t){function e(n){let i=n;return Gt.objectLiteral(i)&&(i.workDoneProgress===void 0||Gt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Gt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(qR||(N.WorkDoneProgressOptions=qR={}));var $R;(function(t){t.method="initialize",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})($R||(N.InitializeRequest=$R={}));var FR;(function(t){t.unknownProtocolVersion=1})(FR||(N.InitializeErrorCodes=FR={}));var BR;(function(t){t.method="initialized",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(BR||(N.InitializedNotification=BR={}));var jR;(function(t){t.method="shutdown",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType0(t.method)})(jR||(N.ShutdownRequest=jR={}));var UR;(function(t){t.method="exit",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType0(t.method)})(UR||(N.ExitNotification=UR={}));var HR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(HR||(N.DidChangeConfigurationNotification=HR={}));var VR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(VR||(N.MessageType=VR={}));var zR;(function(t){t.method="window/showMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(zR||(N.ShowMessageNotification=zR={}));var WR;(function(t){t.method="window/showMessageRequest",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(WR||(N.ShowMessageRequest=WR={}));var GR;(function(t){t.method="window/logMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(GR||(N.LogMessageNotification=GR={}));var KR;(function(t){t.method="telemetry/event",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(KR||(N.TelemetryEventNotification=KR={}));var YR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(YR||(N.TextDocumentSyncKind=YR={}));var XR;(function(t){t.method="textDocument/didOpen",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(XR||(N.DidOpenTextDocumentNotification=XR={}));var JR;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(JR||(N.TextDocumentContentChangeEvent=JR={}));var QR;(function(t){t.method="textDocument/didChange",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(QR||(N.DidChangeTextDocumentNotification=QR={}));var ZR;(function(t){t.method="textDocument/didClose",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(ZR||(N.DidCloseTextDocumentNotification=ZR={}));var eP;(function(t){t.method="textDocument/didSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(eP||(N.DidSaveTextDocumentNotification=eP={}));var tP;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(tP||(N.TextDocumentSaveReason=tP={}));var rP;(function(t){t.method="textDocument/willSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(rP||(N.WillSaveTextDocumentNotification=rP={}));var nP;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(nP||(N.WillSaveTextDocumentWaitUntilRequest=nP={}));var iP;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(iP||(N.DidChangeWatchedFilesNotification=iP={}));var sP;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(sP||(N.FileChangeType=sP={}));var oP;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(CR.URI.is(n.baseUri)||CR.WorkspaceFolder.is(n.baseUri))&&Gt.string(n.pattern)}t.is=e})(oP||(N.RelativePattern=oP={}));var aP;(function(t){t.Create=1,t.Change=2,t.Delete=4})(aP||(N.WatchKind=aP={}));var cP;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(cP||(N.PublishDiagnosticsNotification=cP={}));var lP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(lP||(N.CompletionTriggerKind=lP={}));var uP;(function(t){t.method="textDocument/completion",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(uP||(N.CompletionRequest=uP={}));var dP;(function(t){t.method="completionItem/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(dP||(N.CompletionResolveRequest=dP={}));var fP;(function(t){t.method="textDocument/hover",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(fP||(N.HoverRequest=fP={}));var pP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(pP||(N.SignatureHelpTriggerKind=pP={}));var hP;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(hP||(N.SignatureHelpRequest=hP={}));var mP;(function(t){t.method="textDocument/definition",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(mP||(N.DefinitionRequest=mP={}));var gP;(function(t){t.method="textDocument/references",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(gP||(N.ReferencesRequest=gP={}));var yP;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(yP||(N.DocumentHighlightRequest=yP={}));var TP;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(TP||(N.DocumentSymbolRequest=TP={}));var vP;(function(t){t.method="textDocument/codeAction",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(vP||(N.CodeActionRequest=vP={}));var bP;(function(t){t.method="codeAction/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(bP||(N.CodeActionResolveRequest=bP={}));var SP;(function(t){t.method="workspace/symbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(SP||(N.WorkspaceSymbolRequest=SP={}));var _P;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(_P||(N.WorkspaceSymbolResolveRequest=_P={}));var kP;(function(t){t.method="textDocument/codeLens",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(kP||(N.CodeLensRequest=kP={}));var NP;(function(t){t.method="codeLens/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(NP||(N.CodeLensResolveRequest=NP={}));var RP;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType0(t.method)})(RP||(N.CodeLensRefreshRequest=RP={}));var PP;(function(t){t.method="textDocument/documentLink",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(PP||(N.DocumentLinkRequest=PP={}));var EP;(function(t){t.method="documentLink/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(EP||(N.DocumentLinkResolveRequest=EP={}));var wP;(function(t){t.method="textDocument/formatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(wP||(N.DocumentFormattingRequest=wP={}));var CP;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(CP||(N.DocumentRangeFormattingRequest=CP={}));var DP;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(DP||(N.DocumentRangesFormattingRequest=DP={}));var AP;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(AP||(N.DocumentOnTypeFormattingRequest=AP={}));var IP;(function(t){t.Identifier=1})(IP||(N.PrepareSupportDefaultBehavior=IP={}));var OP;(function(t){t.method="textDocument/rename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(OP||(N.RenameRequest=OP={}));var xP;(function(t){t.method="textDocument/prepareRename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(xP||(N.PrepareRenameRequest=xP={}));var MP;(function(t){t.method="workspace/executeCommand",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(MP||(N.ExecuteCommandRequest=MP={}));var LP;(function(t){t.method="workspace/applyEdit",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType("workspace/applyEdit")})(LP||(N.ApplyWorkspaceEditRequest=LP={}))});var HP=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.createProtocolConnection=void 0;var UP=zs();function nj(t,e,r,n){return UP.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,UP.createMessageConnection)(t,e,r,n)}Kd.createProtocolConnection=nj});var zP=R(Lr=>{"use strict";var ij=Lr&&Lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yd=Lr&&Lr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ij(e,t,r)};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.LSPErrorCodes=Lr.createProtocolConnection=void 0;Yd(zs(),Lr);Yd(Id(),Lr);Yd(_t(),Lr);Yd(jP(),Lr);var sj=HP();Object.defineProperty(Lr,"createProtocolConnection",{enumerable:!0,get:function(){return sj.createProtocolConnection}});var VP;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(VP||(Lr.LSPErrorCodes=VP={}))});var It=R(ai=>{"use strict";var oj=ai&&ai.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WP=ai&&ai.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oj(e,t,r)};Object.defineProperty(ai,"__esModule",{value:!0});ai.createProtocolConnection=void 0;var aj=my();WP(my(),ai);WP(zP(),ai);function cj(t,e,r,n){return(0,aj.createMessageConnection)(t,e,r,n)}ai.createProtocolConnection=cj});var Iy=R(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.generateUuid=pn.parse=pn.isUUID=pn.v4=pn.empty=void 0;var Cc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Dc=class t extends Cc{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};Dc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Dc._timeHighBits=["8","9","a","b"];pn.empty=new Cc("00000000-0000-0000-0000-000000000000");function GP(){return new Dc}pn.v4=GP;var lj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function KP(t){return lj.test(t)}pn.isUUID=KP;function uj(t){if(!KP(t))throw new Error("invalid uuid");return new Cc(t)}pn.parse=uj;function dj(){return GP().asHex()}pn.generateUuid=dj});var YP=R(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.attachPartialResult=ss.ProgressFeature=ss.attachWorkDone=void 0;var is=It(),fj=Iy(),Gs=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let s={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(is.WorkDoneProgress.type,this._token,s)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(is.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(is.WorkDoneProgress.type,this._token,{kind:"end"})}};Gs.Instances=new Map;var Xd=class extends Gs{constructor(e,r){super(e,r),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Ac=class{constructor(){}begin(){}report(){}done(){}},Jd=class extends Ac{constructor(){super(),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function pj(t,e){if(e===void 0||e.workDoneToken===void 0)return new Ac;let r=e.workDoneToken;return delete e.workDoneToken,new Gs(t,r)}ss.attachWorkDone=pj;var hj=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(is.WorkDoneProgressCancelNotification.type,r=>{let n=Gs.Instances.get(r.token);(n instanceof Xd||n instanceof Jd)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Ac:new Gs(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,fj.generateUuid)();return this.connection.sendRequest(is.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Xd(this.connection,e))}else return Promise.resolve(new Jd)}};ss.ProgressFeature=hj;var Oy;(function(t){t.type=new is.ProgressType})(Oy||(Oy={}));var xy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(Oy.type,this._token,e)}};function mj(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new xy(t,r)}ss.attachPartialResult=mj});var XP=R(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ConfigurationFeature=void 0;var gj=It(),yj=ld(),Tj=t=>class extends t{getConfiguration(e){return e?yj.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(gj.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Qd.ConfigurationFeature=Tj});var JP=R(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.WorkspaceFoldersFeature=void 0;var Zd=It(),vj=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Zd.Emitter,this.connection.onNotification(Zd.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Zd.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Zd.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};ef.WorkspaceFoldersFeature=vj});var QP=R(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.CallHierarchyFeature=void 0;var My=It(),bj=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(My.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=My.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=My.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};tf.CallHierarchyFeature=bj});var qy=R(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.SemanticTokensBuilder=os.SemanticTokensDiff=os.SemanticTokensFeature=void 0;var rf=It(),Sj=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(rf.SemanticTokensRefreshRequest.type),on:e=>{let r=rf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=rf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=rf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};os.SemanticTokensFeature=Sj;var nf=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,s=r-1;for(;i>=n&&s>=n&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<n||s<n)&&(i++,s++);let o=i-n+1,a=this.modifiedSequence.slice(n,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:o-1}]:[{start:n,deleteCount:o,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};os.SemanticTokensDiff=nf;var Ly=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,r,n,i,s){let o=e,a=r;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=r}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new nf(this._prevData,this._data).computeDiff()}:this.build()}};os.SemanticTokensBuilder=Ly});var ZP=R(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShowDocumentFeature=void 0;var _j=It(),kj=t=>class extends t{showDocument(e){return this.connection.sendRequest(_j.ShowDocumentRequest.type,e)}};sf.ShowDocumentFeature=kj});var eE=R(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.FileOperationsFeature=void 0;var Zo=It(),Nj=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Zo.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Zo.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Zo.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Zo.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Zo.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Zo.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};of.FileOperationsFeature=Nj});var tE=R(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.LinkedEditingRangeFeature=void 0;var Rj=It(),Pj=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(Rj.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};af.LinkedEditingRangeFeature=Pj});var rE=R(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.TypeHierarchyFeature=void 0;var $y=It(),Ej=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest($y.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=$y.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=$y.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};cf.TypeHierarchyFeature=Ej});var iE=R(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InlineValueFeature=void 0;var nE=It(),wj=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(nE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(nE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};lf.InlineValueFeature=wj});var oE=R(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.FoldingRangeFeature=void 0;var sE=It(),Cj=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(sE.FoldingRangeRefreshRequest.type),on:e=>{let r=sE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};uf.FoldingRangeFeature=Cj});var aE=R(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.InlayHintFeature=void 0;var Fy=It(),Dj=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Fy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Fy.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Fy.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};df.InlayHintFeature=Dj});var cE=R(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.DiagnosticFeature=void 0;var Ic=It(),Aj=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ic.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ic.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ic.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Ic.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ic.WorkspaceDiagnosticRequest.partialResult,r)))}}};ff.DiagnosticFeature=Aj});var jy=R(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.TextDocuments=void 0;var Ks=It(),By=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ks.Emitter,this._onDidOpen=new Ks.Emitter,this._onDidClose=new Ks.Emitter,this._onDidSave=new Ks.Emitter,this._onWillSave=new Ks.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Ks.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);let o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges;if(s.length===0)return;let{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,s,o),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let s=this._syncedDocuments.get(n.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Ks.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};pf.TextDocuments=By});var Hy=R(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.NotebookDocuments=ea.NotebookSyncFeature=void 0;var hn=It(),lE=jy(),Ij=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(hn.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(hn.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(hn.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(hn.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};ea.NotebookSyncFeature=Ij;var hf=class t{onDidOpenTextDocument(e){return this.openHandler=e,hn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,hn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,hn.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};hf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Uy=class{constructor(e){e instanceof lE.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new lE.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new hn.Emitter,this._onDidChange=new hn.Emitter,this._onDidSave=new hn.Emitter,this._onDidClose=new hn.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new hf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;let o=s.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);let l=[],u=[],d=[],f=[];if(c.cells!==void 0){let _=c.cells;if(_.structure!==void 0){let b=_.structure.array;if(s.cells.splice(b.start,b.deleteCount,...b.cells!==void 0?b.cells:[]),_.structure.didOpen!==void 0)for(let v of _.structure.didOpen)r.openTextDocument({textDocument:v}),l.push(v.uri);if(_.structure.didClose)for(let v of _.structure.didClose)r.closeTextDocument({textDocument:v}),u.push(v.uri)}if(_.data!==void 0){let b=new Map(_.data.map(v=>[v.document,v]));for(let v=0;v<=s.cells.length;v++){let k=b.get(s.cells[v].document);if(k!==void 0){let w=s.cells.splice(v,1,k);if(d.push({old:w[0],new:k}),b.delete(k.document),b.size===0)break}}}if(_.textContent!==void 0)for(let b of _.textContent)r.changeTextDocument({textDocument:b.document,contentChanges:b.changes}),f.push(b.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let _ of l)m.push(this.getNotebookCell(_));let h=[];for(let _ of u)h.push(this.getNotebookCell(_));let T=[];for(let _ of f)T.push(this.getNotebookCell(_));(m.length>0||h.length>0||d.length>0||T.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:T}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let o of i.cellTextDocuments)r.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),hn.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};ea.NotebookDocuments=Uy});var uE=R(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.MonikerFeature=void 0;var Oj=It(),xj=t=>class extends t{get moniker(){return{on:e=>{let r=Oj.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};mf.MonikerFeature=xj});var Yy=R(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.createConnection=ze.combineFeatures=ze.combineNotebooksFeatures=ze.combineLanguagesFeatures=ze.combineWorkspaceFeatures=ze.combineWindowFeatures=ze.combineClientFeatures=ze.combineTracerFeatures=ze.combineTelemetryFeatures=ze.combineConsoleFeatures=ze._NotebooksImpl=ze._LanguagesImpl=ze.BulkUnregistration=ze.BulkRegistration=ze.ErrorMessageTracker=void 0;var K=It(),mn=ld(),zy=Iy(),me=YP(),Mj=XP(),Lj=JP(),qj=QP(),$j=qy(),Fj=ZP(),Bj=eE(),jj=tE(),Uj=rE(),Hj=iE(),Vj=oE(),zj=aE(),Wj=cE(),Gj=Hy(),Kj=uE();function Vy(t){if(t!==null)return t}var Wy=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};ze.ErrorMessageTracker=Wy;var gf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(K.MessageType.Error,e)}warn(e){this.send(K.MessageType.Warning,e)}info(e){this.send(K.MessageType.Info,e)}log(e){this.send(K.MessageType.Log,e)}debug(e){this.send(K.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},Gy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:K.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}showWarningMessage(e,...r){let n={type:K.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}showInformationMessage(e,...r){let n={type:K.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}},dE=(0,Fj.ShowDocumentFeature)((0,me.ProgressFeature)(Gy)),fE;(function(t){function e(){return new yf}t.create=e})(fE||(ze.BulkRegistration=fE={}));var yf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=mn.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=zy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},pE;(function(t){function e(){return new Oc(void 0,[])}t.create=e})(pE||(ze.BulkUnregistration=pE={}));var Oc=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(K.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=mn.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},s=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Tf=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof yf?this.registerMany(e):e instanceof Oc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=mn.string(r)?r:r.method,s=zy.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(K.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=mn.string(e)?e:e.method,i=zy.generateUuid(),s={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(o)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(K.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(K.RegistrationRequest.type,r).then(()=>new Oc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Ky=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(K.ApplyWorkspaceEditRequest.type,n)}},hE=(0,Bj.FileOperationsFeature)((0,Lj.WorkspaceFoldersFeature)((0,Mj.ConfigurationFeature)(Ky))),vf=class{constructor(){this._trace=K.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?r:void 0}).catch(()=>{})}},bf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(K.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Sf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};ze._LanguagesImpl=Sf;var mE=(0,Vj.FoldingRangeFeature)((0,Kj.MonikerFeature)((0,Wj.DiagnosticFeature)((0,zj.InlayHintFeature)((0,Hj.InlineValueFeature)((0,Uj.TypeHierarchyFeature)((0,jj.LinkedEditingRangeFeature)((0,$j.SemanticTokensFeature)((0,qj.CallHierarchyFeature)(Sf))))))))),_f=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};ze._NotebooksImpl=_f;var gE=(0,Gj.NotebookSyncFeature)(_f);function yE(t,e){return function(r){return e(t(r))}}ze.combineConsoleFeatures=yE;function TE(t,e){return function(r){return e(t(r))}}ze.combineTelemetryFeatures=TE;function vE(t,e){return function(r){return e(t(r))}}ze.combineTracerFeatures=vE;function bE(t,e){return function(r){return e(t(r))}}ze.combineClientFeatures=bE;function SE(t,e){return function(r){return e(t(r))}}ze.combineWindowFeatures=SE;function _E(t,e){return function(r){return e(t(r))}}ze.combineWorkspaceFeatures=_E;function kE(t,e){return function(r){return e(t(r))}}ze.combineLanguagesFeatures=kE;function NE(t,e){return function(r){return e(t(r))}}ze.combineNotebooksFeatures=NE;function Yj(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,yE),tracer:r(t.tracer,e.tracer,vE),telemetry:r(t.telemetry,e.telemetry,TE),client:r(t.client,e.client,bE),window:r(t.window,e.window,SE),workspace:r(t.workspace,e.workspace,_E),languages:r(t.languages,e.languages,kE),notebooks:r(t.notebooks,e.notebooks,NE)}}ze.combineFeatures=Yj;function Xj(t,e,r){let n=r&&r.console?new(r.console(gf)):new gf,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(vf)):new vf,o=r&&r.telemetry?new(r.telemetry(bf)):new bf,a=r&&r.client?new(r.client(Tf)):new Tf,c=r&&r.window?new(r.window(dE)):new dE,l=r&&r.workspace?new(r.workspace(hE)):new hE,u=r&&r.languages?new(r.languages(mE)):new mE,d=r&&r.notebooks?new(r.notebooks(gE)):new gE,f=[n,s,o,a,c,l,u,d];function p(b){return b instanceof Promise?b:mn.thenable(b)?new Promise((v,k)=>{b.then(w=>v(w),w=>k(w))}):Promise.resolve(b)}let m,h,T,_={listen:()=>i.listen(),sendRequest:(b,...v)=>i.sendRequest(mn.string(b)?b:b.method,...v),onRequest:(b,v)=>i.onRequest(b,v),sendNotification:(b,v)=>{let k=mn.string(b)?b:b.method;return i.sendNotification(k,v)},onNotification:(b,v)=>i.onNotification(b,v),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:b=>(h=b,{dispose:()=>{h=void 0}}),onInitialized:b=>i.onNotification(K.InitializedNotification.type,b),onShutdown:b=>(m=b,{dispose:()=>{m=void 0}}),onExit:b=>(T=b,{dispose:()=>{T=void 0}}),get console(){return n},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:b=>i.onNotification(K.DidChangeConfigurationNotification.type,b),onDidChangeWatchedFiles:b=>i.onNotification(K.DidChangeWatchedFilesNotification.type,b),__textDocumentSync:void 0,onDidOpenTextDocument:b=>i.onNotification(K.DidOpenTextDocumentNotification.type,b),onDidChangeTextDocument:b=>i.onNotification(K.DidChangeTextDocumentNotification.type,b),onDidCloseTextDocument:b=>i.onNotification(K.DidCloseTextDocumentNotification.type,b),onWillSaveTextDocument:b=>i.onNotification(K.WillSaveTextDocumentNotification.type,b),onWillSaveTextDocumentWaitUntil:b=>i.onRequest(K.WillSaveTextDocumentWaitUntilRequest.type,b),onDidSaveTextDocument:b=>i.onNotification(K.DidSaveTextDocumentNotification.type,b),sendDiagnostics:b=>i.sendNotification(K.PublishDiagnosticsNotification.type,b),onHover:b=>i.onRequest(K.HoverRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onCompletion:b=>i.onRequest(K.CompletionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCompletionResolve:b=>i.onRequest(K.CompletionResolveRequest.type,b),onSignatureHelp:b=>i.onRequest(K.SignatureHelpRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDeclaration:b=>i.onRequest(K.DeclarationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDefinition:b=>i.onRequest(K.DefinitionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onTypeDefinition:b=>i.onRequest(K.TypeDefinitionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onImplementation:b=>i.onRequest(K.ImplementationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onReferences:b=>i.onRequest(K.ReferencesRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentHighlight:b=>i.onRequest(K.DocumentHighlightRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentSymbol:b=>i.onRequest(K.DocumentSymbolRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbol:b=>i.onRequest(K.WorkspaceSymbolRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:b=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,b),onCodeAction:b=>i.onRequest(K.CodeActionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeActionResolve:b=>i.onRequest(K.CodeActionResolveRequest.type,(v,k)=>b(v,k)),onCodeLens:b=>i.onRequest(K.CodeLensRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeLensResolve:b=>i.onRequest(K.CodeLensResolveRequest.type,(v,k)=>b(v,k)),onDocumentFormatting:b=>i.onRequest(K.DocumentFormattingRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:b=>i.onRequest(K.DocumentRangeFormattingRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDocumentOnTypeFormatting:b=>i.onRequest(K.DocumentOnTypeFormattingRequest.type,(v,k)=>b(v,k)),onRenameRequest:b=>i.onRequest(K.RenameRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onPrepareRename:b=>i.onRequest(K.PrepareRenameRequest.type,(v,k)=>b(v,k)),onDocumentLinks:b=>i.onRequest(K.DocumentLinkRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentLinkResolve:b=>i.onRequest(K.DocumentLinkResolveRequest.type,(v,k)=>b(v,k)),onDocumentColor:b=>i.onRequest(K.DocumentColorRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onColorPresentation:b=>i.onRequest(K.ColorPresentationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onFoldingRanges:b=>i.onRequest(K.FoldingRangeRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onSelectionRanges:b=>i.onRequest(K.SelectionRangeRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onExecuteCommand:b=>i.onRequest(K.ExecuteCommandRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let b of f)b.attach(_);return i.onRequest(K.InitializeRequest.type,b=>{e.initialize(b),mn.string(b.trace)&&(s.trace=K.Trace.fromString(b.trace));for(let v of f)v.initialize(b.capabilities);if(h){let v=h(b,new K.CancellationTokenSource().token,(0,me.attachWorkDone)(i,b),void 0);return p(v).then(k=>{if(k instanceof K.ResponseError)return k;let w=k;w||(w={capabilities:{}});let H=w.capabilities;H||(H={},w.capabilities=H),H.textDocumentSync===void 0||H.textDocumentSync===null?H.textDocumentSync=mn.number(_.__textDocumentSync)?_.__textDocumentSync:K.TextDocumentSyncKind.None:!mn.number(H.textDocumentSync)&&!mn.number(H.textDocumentSync.change)&&(H.textDocumentSync.change=mn.number(_.__textDocumentSync)?_.__textDocumentSync:K.TextDocumentSyncKind.None);for(let O of f)O.fillServerCapabilities(H);return w})}else{let v={capabilities:{textDocumentSync:K.TextDocumentSyncKind.None}};for(let k of f)k.fillServerCapabilities(v.capabilities);return v}}),i.onRequest(K.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new K.CancellationTokenSource().token)}),i.onNotification(K.ExitNotification.type,()=>{try{T&&T()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,b=>{s.trace=K.Trace.fromString(b.value)}),_}ze.createConnection=Xj});var RE=R(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.resolveModulePath=qr.FileSystem=qr.resolveGlobalYarnPath=qr.resolveGlobalNodePath=qr.resolve=qr.uriToFilePath=void 0;var Jj=require("url"),Bn=require("path"),Xy=require("fs"),eT=require("child_process");function Qj(t){let e=Jj.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let s=r[0],o=r[1];s.length===0&&o.length>1&&o[1]===":"&&r.shift()}return Bn.normalize(r.join("/"))}qr.uriToFilePath=Qj;function Jy(){return process.platform==="win32"}function kf(t,e,r,n){let i="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&Xy.existsSync(e)&&(l[i]?l[i]=e+Bn.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,eT.fork)("",[],{cwd:r,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}qr.resolve=kf;function Qy(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(s=>r[s]=process.env[s]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};Jy()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,eT.spawnSync)(e,["config","get","prefix"],n).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?Jy()?Bn.join(o,"node_modules"):Bn.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}qr.resolveGlobalNodePath=Qy;function Zj(t){let e="yarn",r={encoding:"utf8"};Jy()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,eT.spawnSync)(e,["global","dir","--json"],r),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return Bn.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}qr.resolveGlobalYarnPath=Zj;var Zy;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Xy.existsSync(__filename.toUpperCase())||!Xy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?Bn.normalize(s).indexOf(Bn.normalize(i))===0:Bn.normalize(s).toLowerCase().indexOf(Bn.normalize(i).toLowerCase())===0}t.isParent=n})(Zy||(qr.FileSystem=Zy={}));function eU(t,e,r,n){return r?(Bn.isAbsolute(r)||(r=Bn.join(t,r)),kf(e,r,r,n).then(i=>Zy.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>kf(e,Qy(n),t,n))):kf(e,Qy(n),t,n)}qr.resolveModulePath=eU});var tT=R((u8,PE)=>{"use strict";PE.exports=It()});var EE=R(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.InlineCompletionFeature=void 0;var tU=It(),rU=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(tU.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Nf.InlineCompletionFeature=rU});var DE=R(pr=>{"use strict";var nU=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CE=pr&&pr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nU(e,t,r)};Object.defineProperty(pr,"__esModule",{value:!0});pr.ProposedFeatures=pr.NotebookDocuments=pr.TextDocuments=pr.SemanticTokensBuilder=void 0;var iU=qy();Object.defineProperty(pr,"SemanticTokensBuilder",{enumerable:!0,get:function(){return iU.SemanticTokensBuilder}});var sU=EE();CE(It(),pr);var oU=jy();Object.defineProperty(pr,"TextDocuments",{enumerable:!0,get:function(){return oU.TextDocuments}});var aU=Hy();Object.defineProperty(pr,"NotebookDocuments",{enumerable:!0,get:function(){return aU.NotebookDocuments}});CE(Yy(),pr);var wE;(function(t){t.all={__brand:"features",languages:sU.InlineCompletionFeature}})(wE||(pr.ProposedFeatures=wE={}))});var j=R(gn=>{"use strict";var cU=gn&&gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xE=gn&&gn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cU(e,t,r)};Object.defineProperty(gn,"__esModule",{value:!0});gn.createConnection=gn.Files=void 0;var AE=require("node:util"),rT=ld(),lU=Yy(),xc=RE(),Ys=tT();xE(tT(),gn);xE(DE(),gn);var IE;(function(t){t.uriToFilePath=xc.uriToFilePath,t.resolveGlobalNodePath=xc.resolveGlobalNodePath,t.resolveGlobalYarnPath=xc.resolveGlobalYarnPath,t.resolve=xc.resolve,t.resolveModulePath=xc.resolveModulePath})(IE||(gn.Files=IE={}));var OE;function Rf(){if(OE!==void 0)try{OE.end()}catch{}}var ta=!1,ME;function uU(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(ME=setInterval(()=>{try{process.kill(n,0)}catch{Rf(),process.exit(ta?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}uU();var dU={initialize:t=>{let e=t.processId;rT.number(e)&&ME===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(ta?0:1)}},3e3)},get shutdownReceived(){return ta},set shutdownReceived(t){ta=t},exit:t=>{Rf(),process.exit(t)}};function fU(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Ys.ConnectionStrategy.is(t)||Ys.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),pU(s,o,a,i)}gn.createConnection=fU;function pU(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){t=new Ys.IPCMessageReader(process),e=new Ys.IPCMessageWriter(process);break}else if(f==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{var s=f.split("=");if(s[0]==="--socket"){c=parseInt(s[1]);break}else if(s[0]==="--pipe"){l=s[1];break}}}if(c){let d=(0,Ys.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,Ys.createServerPipeTransport)(l);t=d[0],e=d[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(rT.func(t.read)&&rT.func(t.on)){let c=t;c.on("end",()=>{Rf(),process.exit(ta?0:1)}),c.on("close",()=>{Rf(),process.exit(ta?0:1)})}let a=c=>{let l=(0,Ys.createProtocolConnection)(t,e,c,r);return i&&hU(c),l};return(0,lU.createConnection)(a,dU,n)}function hU(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,AE.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...s){if(!i)if(s.length===0)t.error("Assertion failed");else{let[o,...a]=s;t.error(`Assertion failed: ${o} ${e(a)}`)}},console.count=function(i="default"){let s=String(i),o=r.get(s)??0;o+=1,r.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,AE.inspect)(i,s))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let s=new Error().stack.replace(/(.+\n){2}/,""),o="Trace";i.length!==0&&(o+=`: ${e(i)}`),t.log(`${o}
|
|
36
|
+
`&&g++}S&&C.length>0&&E.push(C.length),this._lineOffsets=E}return this._lineOffsets},y.prototype.positionAt=function(E){E=Math.max(Math.min(E,this._content.length),0);var C=this.getLineOffsets(),S=0,g=C.length;if(g===0)return o.create(0,E);for(;S<g;){var D=Math.floor((S+g)/2);C[D]>E?g=D:S=D+1}var $=S-1;return o.create($,E-C[$])},y.prototype.offsetAt=function(E){var C=this.getLineOffsets();if(E.line>=C.length)return this._content.length;if(E.line<0)return 0;var S=C[E.line],g=E.line+1<C.length?C[E.line+1]:this._content.length;return Math.max(Math.min(S+E.character,g),S)},Object.defineProperty(y.prototype,"lineCount",{get:function(){return this.getLineOffsets().length},enumerable:!1,configurable:!0}),y}(),A;(function(y){var E=Object.prototype.toString;function C(Ae){return typeof Ae<"u"}y.defined=C;function S(Ae){return typeof Ae>"u"}y.undefined=S;function g(Ae){return Ae===!0||Ae===!1}y.boolean=g;function D(Ae){return E.call(Ae)==="[object String]"}y.string=D;function $(Ae){return E.call(Ae)==="[object Number]"}y.number=$;function ye(Ae,Oo,cd){return E.call(Ae)==="[object Number]"&&Oo<=Ae&&Ae<=cd}y.numberRange=ye;function Ct(Ae){return E.call(Ae)==="[object Number]"&&-2147483648<=Ae&&Ae<=2147483647}y.integer=Ct;function ut(Ae){return E.call(Ae)==="[object Number]"&&0<=Ae&&Ae<=2147483647}y.uinteger=ut;function qn(Ae){return E.call(Ae)==="[object Function]"}y.func=qn;function $n(Ae){return Ae!==null&&typeof Ae=="object"}y.objectLiteral=$n;function Ei(Ae,Oo){return Array.isArray(Ae)&&Ae.every(Oo)}y.typedArray=Ei})(A||(A={}))})});var _t=R(xr=>{"use strict";Object.defineProperty(xr,"__esModule",{value:!0});xr.ProtocolNotificationType=xr.ProtocolNotificationType0=xr.ProtocolRequestType=xr.ProtocolRequestType0=xr.RegistrationType=xr.MessageDirection=void 0;var Uo=zs(),Yk;(function(t){t.clientToServer="clientToServer",t.serverToClient="serverToClient",t.both="both"})(Yk||(xr.MessageDirection=Yk={}));var gy=class{constructor(e){this.method=e}};xr.RegistrationType=gy;var yy=class extends Uo.RequestType0{constructor(e){super(e)}};xr.ProtocolRequestType0=yy;var Ty=class extends Uo.RequestType{constructor(e){super(e,Uo.ParameterStructures.byName)}};xr.ProtocolRequestType=Ty;var vy=class extends Uo.NotificationType0{constructor(e){super(e)}};xr.ProtocolNotificationType0=vy;var by=class extends Uo.NotificationType{constructor(e){super(e,Uo.ParameterStructures.byName)}};xr.ProtocolNotificationType=by});var Od=R($t=>{"use strict";Object.defineProperty($t,"__esModule",{value:!0});$t.objectLiteral=$t.typedArray=$t.stringArray=$t.array=$t.func=$t.error=$t.number=$t.string=$t.boolean=void 0;function BB(t){return t===!0||t===!1}$t.boolean=BB;function Xk(t){return typeof t=="string"||t instanceof String}$t.string=Xk;function jB(t){return typeof t=="number"||t instanceof Number}$t.number=jB;function UB(t){return t instanceof Error}$t.error=UB;function HB(t){return typeof t=="function"}$t.func=HB;function Jk(t){return Array.isArray(t)}$t.array=Jk;function VB(t){return Jk(t)&&t.every(e=>Xk(e))}$t.stringArray=VB;function zB(t,e){return Array.isArray(t)&&t.every(e)}$t.typedArray=zB;function WB(t){return t!==null&&typeof t=="object"}$t.objectLiteral=WB});var eN=R(xd=>{"use strict";Object.defineProperty(xd,"__esModule",{value:!0});xd.ImplementationRequest=void 0;var Qk=_t(),Zk;(function(t){t.method="textDocument/implementation",t.messageDirection=Qk.MessageDirection.clientToServer,t.type=new Qk.ProtocolRequestType(t.method)})(Zk||(xd.ImplementationRequest=Zk={}))});var nN=R(Md=>{"use strict";Object.defineProperty(Md,"__esModule",{value:!0});Md.TypeDefinitionRequest=void 0;var tN=_t(),rN;(function(t){t.method="textDocument/typeDefinition",t.messageDirection=tN.MessageDirection.clientToServer,t.type=new tN.ProtocolRequestType(t.method)})(rN||(Md.TypeDefinitionRequest=rN={}))});var oN=R(Ho=>{"use strict";Object.defineProperty(Ho,"__esModule",{value:!0});Ho.DidChangeWorkspaceFoldersNotification=Ho.WorkspaceFoldersRequest=void 0;var Ld=_t(),iN;(function(t){t.method="workspace/workspaceFolders",t.messageDirection=Ld.MessageDirection.serverToClient,t.type=new Ld.ProtocolRequestType0(t.method)})(iN||(Ho.WorkspaceFoldersRequest=iN={}));var sN;(function(t){t.method="workspace/didChangeWorkspaceFolders",t.messageDirection=Ld.MessageDirection.clientToServer,t.type=new Ld.ProtocolNotificationType(t.method)})(sN||(Ho.DidChangeWorkspaceFoldersNotification=sN={}))});var lN=R(qd=>{"use strict";Object.defineProperty(qd,"__esModule",{value:!0});qd.ConfigurationRequest=void 0;var aN=_t(),cN;(function(t){t.method="workspace/configuration",t.messageDirection=aN.MessageDirection.serverToClient,t.type=new aN.ProtocolRequestType(t.method)})(cN||(qd.ConfigurationRequest=cN={}))});var fN=R(Vo=>{"use strict";Object.defineProperty(Vo,"__esModule",{value:!0});Vo.ColorPresentationRequest=Vo.DocumentColorRequest=void 0;var $d=_t(),uN;(function(t){t.method="textDocument/documentColor",t.messageDirection=$d.MessageDirection.clientToServer,t.type=new $d.ProtocolRequestType(t.method)})(uN||(Vo.DocumentColorRequest=uN={}));var dN;(function(t){t.method="textDocument/colorPresentation",t.messageDirection=$d.MessageDirection.clientToServer,t.type=new $d.ProtocolRequestType(t.method)})(dN||(Vo.ColorPresentationRequest=dN={}))});var mN=R(zo=>{"use strict";Object.defineProperty(zo,"__esModule",{value:!0});zo.FoldingRangeRefreshRequest=zo.FoldingRangeRequest=void 0;var Fd=_t(),pN;(function(t){t.method="textDocument/foldingRange",t.messageDirection=Fd.MessageDirection.clientToServer,t.type=new Fd.ProtocolRequestType(t.method)})(pN||(zo.FoldingRangeRequest=pN={}));var hN;(function(t){t.method="workspace/foldingRange/refresh",t.messageDirection=Fd.MessageDirection.serverToClient,t.type=new Fd.ProtocolRequestType0(t.method)})(hN||(zo.FoldingRangeRefreshRequest=hN={}))});var TN=R(Bd=>{"use strict";Object.defineProperty(Bd,"__esModule",{value:!0});Bd.DeclarationRequest=void 0;var gN=_t(),yN;(function(t){t.method="textDocument/declaration",t.messageDirection=gN.MessageDirection.clientToServer,t.type=new gN.ProtocolRequestType(t.method)})(yN||(Bd.DeclarationRequest=yN={}))});var SN=R(jd=>{"use strict";Object.defineProperty(jd,"__esModule",{value:!0});jd.SelectionRangeRequest=void 0;var vN=_t(),bN;(function(t){t.method="textDocument/selectionRange",t.messageDirection=vN.MessageDirection.clientToServer,t.type=new vN.ProtocolRequestType(t.method)})(bN||(jd.SelectionRangeRequest=bN={}))});var RN=R(Zi=>{"use strict";Object.defineProperty(Zi,"__esModule",{value:!0});Zi.WorkDoneProgressCancelNotification=Zi.WorkDoneProgressCreateRequest=Zi.WorkDoneProgress=void 0;var GB=zs(),Ud=_t(),_N;(function(t){t.type=new GB.ProgressType;function e(r){return r===t.type}t.is=e})(_N||(Zi.WorkDoneProgress=_N={}));var kN;(function(t){t.method="window/workDoneProgress/create",t.messageDirection=Ud.MessageDirection.serverToClient,t.type=new Ud.ProtocolRequestType(t.method)})(kN||(Zi.WorkDoneProgressCreateRequest=kN={}));var NN;(function(t){t.method="window/workDoneProgress/cancel",t.messageDirection=Ud.MessageDirection.clientToServer,t.type=new Ud.ProtocolNotificationType(t.method)})(NN||(Zi.WorkDoneProgressCancelNotification=NN={}))});var CN=R(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.CallHierarchyOutgoingCallsRequest=es.CallHierarchyIncomingCallsRequest=es.CallHierarchyPrepareRequest=void 0;var Wo=_t(),PN;(function(t){t.method="textDocument/prepareCallHierarchy",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(PN||(es.CallHierarchyPrepareRequest=PN={}));var EN;(function(t){t.method="callHierarchy/incomingCalls",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(EN||(es.CallHierarchyIncomingCallsRequest=EN={}));var wN;(function(t){t.method="callHierarchy/outgoingCalls",t.messageDirection=Wo.MessageDirection.clientToServer,t.type=new Wo.ProtocolRequestType(t.method)})(wN||(es.CallHierarchyOutgoingCallsRequest=wN={}))});var MN=R(Mr=>{"use strict";Object.defineProperty(Mr,"__esModule",{value:!0});Mr.SemanticTokensRefreshRequest=Mr.SemanticTokensRangeRequest=Mr.SemanticTokensDeltaRequest=Mr.SemanticTokensRequest=Mr.SemanticTokensRegistrationType=Mr.TokenFormat=void 0;var Ci=_t(),DN;(function(t){t.Relative="relative"})(DN||(Mr.TokenFormat=DN={}));var Pc;(function(t){t.method="textDocument/semanticTokens",t.type=new Ci.RegistrationType(t.method)})(Pc||(Mr.SemanticTokensRegistrationType=Pc={}));var AN;(function(t){t.method="textDocument/semanticTokens/full",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(AN||(Mr.SemanticTokensRequest=AN={}));var IN;(function(t){t.method="textDocument/semanticTokens/full/delta",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(IN||(Mr.SemanticTokensDeltaRequest=IN={}));var ON;(function(t){t.method="textDocument/semanticTokens/range",t.messageDirection=Ci.MessageDirection.clientToServer,t.type=new Ci.ProtocolRequestType(t.method),t.registrationMethod=Pc.method})(ON||(Mr.SemanticTokensRangeRequest=ON={}));var xN;(function(t){t.method="workspace/semanticTokens/refresh",t.messageDirection=Ci.MessageDirection.serverToClient,t.type=new Ci.ProtocolRequestType0(t.method)})(xN||(Mr.SemanticTokensRefreshRequest=xN={}))});var $N=R(Hd=>{"use strict";Object.defineProperty(Hd,"__esModule",{value:!0});Hd.ShowDocumentRequest=void 0;var LN=_t(),qN;(function(t){t.method="window/showDocument",t.messageDirection=LN.MessageDirection.serverToClient,t.type=new LN.ProtocolRequestType(t.method)})(qN||(Hd.ShowDocumentRequest=qN={}))});var jN=R(Vd=>{"use strict";Object.defineProperty(Vd,"__esModule",{value:!0});Vd.LinkedEditingRangeRequest=void 0;var FN=_t(),BN;(function(t){t.method="textDocument/linkedEditingRange",t.messageDirection=FN.MessageDirection.clientToServer,t.type=new FN.ProtocolRequestType(t.method)})(BN||(Vd.LinkedEditingRangeRequest=BN={}))});var YN=R(fr=>{"use strict";Object.defineProperty(fr,"__esModule",{value:!0});fr.WillDeleteFilesRequest=fr.DidDeleteFilesNotification=fr.DidRenameFilesNotification=fr.WillRenameFilesRequest=fr.DidCreateFilesNotification=fr.WillCreateFilesRequest=fr.FileOperationPatternKind=void 0;var dn=_t(),UN;(function(t){t.file="file",t.folder="folder"})(UN||(fr.FileOperationPatternKind=UN={}));var HN;(function(t){t.method="workspace/willCreateFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(HN||(fr.WillCreateFilesRequest=HN={}));var VN;(function(t){t.method="workspace/didCreateFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(VN||(fr.DidCreateFilesNotification=VN={}));var zN;(function(t){t.method="workspace/willRenameFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(zN||(fr.WillRenameFilesRequest=zN={}));var WN;(function(t){t.method="workspace/didRenameFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(WN||(fr.DidRenameFilesNotification=WN={}));var GN;(function(t){t.method="workspace/didDeleteFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolNotificationType(t.method)})(GN||(fr.DidDeleteFilesNotification=GN={}));var KN;(function(t){t.method="workspace/willDeleteFiles",t.messageDirection=dn.MessageDirection.clientToServer,t.type=new dn.ProtocolRequestType(t.method)})(KN||(fr.WillDeleteFilesRequest=KN={}))});var eR=R(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:!0});ts.MonikerRequest=ts.MonikerKind=ts.UniquenessLevel=void 0;var XN=_t(),JN;(function(t){t.document="document",t.project="project",t.group="group",t.scheme="scheme",t.global="global"})(JN||(ts.UniquenessLevel=JN={}));var QN;(function(t){t.$import="import",t.$export="export",t.local="local"})(QN||(ts.MonikerKind=QN={}));var ZN;(function(t){t.method="textDocument/moniker",t.messageDirection=XN.MessageDirection.clientToServer,t.type=new XN.ProtocolRequestType(t.method)})(ZN||(ts.MonikerRequest=ZN={}))});var iR=R(rs=>{"use strict";Object.defineProperty(rs,"__esModule",{value:!0});rs.TypeHierarchySubtypesRequest=rs.TypeHierarchySupertypesRequest=rs.TypeHierarchyPrepareRequest=void 0;var Go=_t(),tR;(function(t){t.method="textDocument/prepareTypeHierarchy",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(tR||(rs.TypeHierarchyPrepareRequest=tR={}));var rR;(function(t){t.method="typeHierarchy/supertypes",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(rR||(rs.TypeHierarchySupertypesRequest=rR={}));var nR;(function(t){t.method="typeHierarchy/subtypes",t.messageDirection=Go.MessageDirection.clientToServer,t.type=new Go.ProtocolRequestType(t.method)})(nR||(rs.TypeHierarchySubtypesRequest=nR={}))});var aR=R(Ko=>{"use strict";Object.defineProperty(Ko,"__esModule",{value:!0});Ko.InlineValueRefreshRequest=Ko.InlineValueRequest=void 0;var zd=_t(),sR;(function(t){t.method="textDocument/inlineValue",t.messageDirection=zd.MessageDirection.clientToServer,t.type=new zd.ProtocolRequestType(t.method)})(sR||(Ko.InlineValueRequest=sR={}));var oR;(function(t){t.method="workspace/inlineValue/refresh",t.messageDirection=zd.MessageDirection.serverToClient,t.type=new zd.ProtocolRequestType0(t.method)})(oR||(Ko.InlineValueRefreshRequest=oR={}))});var dR=R(ns=>{"use strict";Object.defineProperty(ns,"__esModule",{value:!0});ns.InlayHintRefreshRequest=ns.InlayHintResolveRequest=ns.InlayHintRequest=void 0;var Yo=_t(),cR;(function(t){t.method="textDocument/inlayHint",t.messageDirection=Yo.MessageDirection.clientToServer,t.type=new Yo.ProtocolRequestType(t.method)})(cR||(ns.InlayHintRequest=cR={}));var lR;(function(t){t.method="inlayHint/resolve",t.messageDirection=Yo.MessageDirection.clientToServer,t.type=new Yo.ProtocolRequestType(t.method)})(lR||(ns.InlayHintResolveRequest=lR={}));var uR;(function(t){t.method="workspace/inlayHint/refresh",t.messageDirection=Yo.MessageDirection.serverToClient,t.type=new Yo.ProtocolRequestType0(t.method)})(uR||(ns.InlayHintRefreshRequest=uR={}))});var TR=R(fn=>{"use strict";Object.defineProperty(fn,"__esModule",{value:!0});fn.DiagnosticRefreshRequest=fn.WorkspaceDiagnosticRequest=fn.DocumentDiagnosticRequest=fn.DocumentDiagnosticReportKind=fn.DiagnosticServerCancellationData=void 0;var yR=zs(),KB=Od(),Xo=_t(),fR;(function(t){function e(r){let n=r;return n&&KB.boolean(n.retriggerRequest)}t.is=e})(fR||(fn.DiagnosticServerCancellationData=fR={}));var pR;(function(t){t.Full="full",t.Unchanged="unchanged"})(pR||(fn.DocumentDiagnosticReportKind=pR={}));var hR;(function(t){t.method="textDocument/diagnostic",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method),t.partialResult=new yR.ProgressType})(hR||(fn.DocumentDiagnosticRequest=hR={}));var mR;(function(t){t.method="workspace/diagnostic",t.messageDirection=Xo.MessageDirection.clientToServer,t.type=new Xo.ProtocolRequestType(t.method),t.partialResult=new yR.ProgressType})(mR||(fn.WorkspaceDiagnosticRequest=mR={}));var gR;(function(t){t.method="workspace/diagnostic/refresh",t.messageDirection=Xo.MessageDirection.serverToClient,t.type=new Xo.ProtocolRequestType0(t.method)})(gR||(fn.DiagnosticRefreshRequest=gR={}))});var RR=R(Dt=>{"use strict";Object.defineProperty(Dt,"__esModule",{value:!0});Dt.DidCloseNotebookDocumentNotification=Dt.DidSaveNotebookDocumentNotification=Dt.DidChangeNotebookDocumentNotification=Dt.NotebookCellArrayChange=Dt.DidOpenNotebookDocumentNotification=Dt.NotebookDocumentSyncRegistrationType=Dt.NotebookDocument=Dt.NotebookCell=Dt.ExecutionSummary=Dt.NotebookCellKind=void 0;var Ec=Id(),Bn=Od(),oi=_t(),Sy;(function(t){t.Markup=1,t.Code=2;function e(r){return r===1||r===2}t.is=e})(Sy||(Dt.NotebookCellKind=Sy={}));var _y;(function(t){function e(i,s){let o={executionOrder:i};return(s===!0||s===!1)&&(o.success=s),o}t.create=e;function r(i){let s=i;return Bn.objectLiteral(s)&&Ec.uinteger.is(s.executionOrder)&&(s.success===void 0||Bn.boolean(s.success))}t.is=r;function n(i,s){return i===s?!0:i==null||s===null||s===void 0?!1:i.executionOrder===s.executionOrder&&i.success===s.success}t.equals=n})(_y||(Dt.ExecutionSummary=_y={}));var Wd;(function(t){function e(s,o){return{kind:s,document:o}}t.create=e;function r(s){let o=s;return Bn.objectLiteral(o)&&Sy.is(o.kind)&&Ec.DocumentUri.is(o.document)&&(o.metadata===void 0||Bn.objectLiteral(o.metadata))}t.is=r;function n(s,o){let a=new Set;return s.document!==o.document&&a.add("document"),s.kind!==o.kind&&a.add("kind"),s.executionSummary!==o.executionSummary&&a.add("executionSummary"),(s.metadata!==void 0||o.metadata!==void 0)&&!i(s.metadata,o.metadata)&&a.add("metadata"),(s.executionSummary!==void 0||o.executionSummary!==void 0)&&!_y.equals(s.executionSummary,o.executionSummary)&&a.add("executionSummary"),a}t.diff=n;function i(s,o){if(s===o)return!0;if(s==null||o===null||o===void 0||typeof s!=typeof o||typeof s!="object")return!1;let a=Array.isArray(s),c=Array.isArray(o);if(a!==c)return!1;if(a&&c){if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1}if(Bn.objectLiteral(s)&&Bn.objectLiteral(o)){let l=Object.keys(s),u=Object.keys(o);if(l.length!==u.length||(l.sort(),u.sort(),!i(l,u)))return!1;for(let d=0;d<l.length;d++){let f=l[d];if(!i(s[f],o[f]))return!1}}return!0}})(Wd||(Dt.NotebookCell=Wd={}));var vR;(function(t){function e(n,i,s,o){return{uri:n,notebookType:i,version:s,cells:o}}t.create=e;function r(n){let i=n;return Bn.objectLiteral(i)&&Bn.string(i.uri)&&Ec.integer.is(i.version)&&Bn.typedArray(i.cells,Wd.is)}t.is=r})(vR||(Dt.NotebookDocument=vR={}));var Jo;(function(t){t.method="notebookDocument/sync",t.messageDirection=oi.MessageDirection.clientToServer,t.type=new oi.RegistrationType(t.method)})(Jo||(Dt.NotebookDocumentSyncRegistrationType=Jo={}));var bR;(function(t){t.method="notebookDocument/didOpen",t.messageDirection=oi.MessageDirection.clientToServer,t.type=new oi.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(bR||(Dt.DidOpenNotebookDocumentNotification=bR={}));var SR;(function(t){function e(n){let i=n;return Bn.objectLiteral(i)&&Ec.uinteger.is(i.start)&&Ec.uinteger.is(i.deleteCount)&&(i.cells===void 0||Bn.typedArray(i.cells,Wd.is))}t.is=e;function r(n,i,s){let o={start:n,deleteCount:i};return s!==void 0&&(o.cells=s),o}t.create=r})(SR||(Dt.NotebookCellArrayChange=SR={}));var _R;(function(t){t.method="notebookDocument/didChange",t.messageDirection=oi.MessageDirection.clientToServer,t.type=new oi.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(_R||(Dt.DidChangeNotebookDocumentNotification=_R={}));var kR;(function(t){t.method="notebookDocument/didSave",t.messageDirection=oi.MessageDirection.clientToServer,t.type=new oi.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(kR||(Dt.DidSaveNotebookDocumentNotification=kR={}));var NR;(function(t){t.method="notebookDocument/didClose",t.messageDirection=oi.MessageDirection.clientToServer,t.type=new oi.ProtocolNotificationType(t.method),t.registrationMethod=Jo.method})(NR||(Dt.DidCloseNotebookDocumentNotification=NR={}))});var wR=R(Gd=>{"use strict";Object.defineProperty(Gd,"__esModule",{value:!0});Gd.InlineCompletionRequest=void 0;var PR=_t(),ER;(function(t){t.method="textDocument/inlineCompletion",t.messageDirection=PR.MessageDirection.clientToServer,t.type=new PR.ProtocolRequestType(t.method)})(ER||(Gd.InlineCompletionRequest=ER={}))});var jP=R(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.WorkspaceSymbolRequest=N.CodeActionResolveRequest=N.CodeActionRequest=N.DocumentSymbolRequest=N.DocumentHighlightRequest=N.ReferencesRequest=N.DefinitionRequest=N.SignatureHelpRequest=N.SignatureHelpTriggerKind=N.HoverRequest=N.CompletionResolveRequest=N.CompletionRequest=N.CompletionTriggerKind=N.PublishDiagnosticsNotification=N.WatchKind=N.RelativePattern=N.FileChangeType=N.DidChangeWatchedFilesNotification=N.WillSaveTextDocumentWaitUntilRequest=N.WillSaveTextDocumentNotification=N.TextDocumentSaveReason=N.DidSaveTextDocumentNotification=N.DidCloseTextDocumentNotification=N.DidChangeTextDocumentNotification=N.TextDocumentContentChangeEvent=N.DidOpenTextDocumentNotification=N.TextDocumentSyncKind=N.TelemetryEventNotification=N.LogMessageNotification=N.ShowMessageRequest=N.ShowMessageNotification=N.MessageType=N.DidChangeConfigurationNotification=N.ExitNotification=N.ShutdownRequest=N.InitializedNotification=N.InitializeErrorCodes=N.InitializeRequest=N.WorkDoneProgressOptions=N.TextDocumentRegistrationOptions=N.StaticRegistrationOptions=N.PositionEncodingKind=N.FailureHandlingKind=N.ResourceOperationKind=N.UnregistrationRequest=N.RegistrationRequest=N.DocumentSelector=N.NotebookCellTextDocumentFilter=N.NotebookDocumentFilter=N.TextDocumentFilter=void 0;N.MonikerRequest=N.MonikerKind=N.UniquenessLevel=N.WillDeleteFilesRequest=N.DidDeleteFilesNotification=N.WillRenameFilesRequest=N.DidRenameFilesNotification=N.WillCreateFilesRequest=N.DidCreateFilesNotification=N.FileOperationPatternKind=N.LinkedEditingRangeRequest=N.ShowDocumentRequest=N.SemanticTokensRegistrationType=N.SemanticTokensRefreshRequest=N.SemanticTokensRangeRequest=N.SemanticTokensDeltaRequest=N.SemanticTokensRequest=N.TokenFormat=N.CallHierarchyPrepareRequest=N.CallHierarchyOutgoingCallsRequest=N.CallHierarchyIncomingCallsRequest=N.WorkDoneProgressCancelNotification=N.WorkDoneProgressCreateRequest=N.WorkDoneProgress=N.SelectionRangeRequest=N.DeclarationRequest=N.FoldingRangeRefreshRequest=N.FoldingRangeRequest=N.ColorPresentationRequest=N.DocumentColorRequest=N.ConfigurationRequest=N.DidChangeWorkspaceFoldersNotification=N.WorkspaceFoldersRequest=N.TypeDefinitionRequest=N.ImplementationRequest=N.ApplyWorkspaceEditRequest=N.ExecuteCommandRequest=N.PrepareRenameRequest=N.RenameRequest=N.PrepareSupportDefaultBehavior=N.DocumentOnTypeFormattingRequest=N.DocumentRangesFormattingRequest=N.DocumentRangeFormattingRequest=N.DocumentFormattingRequest=N.DocumentLinkResolveRequest=N.DocumentLinkRequest=N.CodeLensRefreshRequest=N.CodeLensResolveRequest=N.CodeLensRequest=N.WorkspaceSymbolResolveRequest=void 0;N.InlineCompletionRequest=N.DidCloseNotebookDocumentNotification=N.DidSaveNotebookDocumentNotification=N.DidChangeNotebookDocumentNotification=N.NotebookCellArrayChange=N.DidOpenNotebookDocumentNotification=N.NotebookDocumentSyncRegistrationType=N.NotebookDocument=N.NotebookCell=N.ExecutionSummary=N.NotebookCellKind=N.DiagnosticRefreshRequest=N.WorkspaceDiagnosticRequest=N.DocumentDiagnosticRequest=N.DocumentDiagnosticReportKind=N.DiagnosticServerCancellationData=N.InlayHintRefreshRequest=N.InlayHintResolveRequest=N.InlayHintRequest=N.InlineValueRefreshRequest=N.InlineValueRequest=N.TypeHierarchySupertypesRequest=N.TypeHierarchySubtypesRequest=N.TypeHierarchyPrepareRequest=void 0;var V=_t(),CR=Id(),Gt=Od(),YB=eN();Object.defineProperty(N,"ImplementationRequest",{enumerable:!0,get:function(){return YB.ImplementationRequest}});var XB=nN();Object.defineProperty(N,"TypeDefinitionRequest",{enumerable:!0,get:function(){return XB.TypeDefinitionRequest}});var qP=oN();Object.defineProperty(N,"WorkspaceFoldersRequest",{enumerable:!0,get:function(){return qP.WorkspaceFoldersRequest}});Object.defineProperty(N,"DidChangeWorkspaceFoldersNotification",{enumerable:!0,get:function(){return qP.DidChangeWorkspaceFoldersNotification}});var JB=lN();Object.defineProperty(N,"ConfigurationRequest",{enumerable:!0,get:function(){return JB.ConfigurationRequest}});var $P=fN();Object.defineProperty(N,"DocumentColorRequest",{enumerable:!0,get:function(){return $P.DocumentColorRequest}});Object.defineProperty(N,"ColorPresentationRequest",{enumerable:!0,get:function(){return $P.ColorPresentationRequest}});var FP=mN();Object.defineProperty(N,"FoldingRangeRequest",{enumerable:!0,get:function(){return FP.FoldingRangeRequest}});Object.defineProperty(N,"FoldingRangeRefreshRequest",{enumerable:!0,get:function(){return FP.FoldingRangeRefreshRequest}});var QB=TN();Object.defineProperty(N,"DeclarationRequest",{enumerable:!0,get:function(){return QB.DeclarationRequest}});var ZB=SN();Object.defineProperty(N,"SelectionRangeRequest",{enumerable:!0,get:function(){return ZB.SelectionRangeRequest}});var Ey=RN();Object.defineProperty(N,"WorkDoneProgress",{enumerable:!0,get:function(){return Ey.WorkDoneProgress}});Object.defineProperty(N,"WorkDoneProgressCreateRequest",{enumerable:!0,get:function(){return Ey.WorkDoneProgressCreateRequest}});Object.defineProperty(N,"WorkDoneProgressCancelNotification",{enumerable:!0,get:function(){return Ey.WorkDoneProgressCancelNotification}});var wy=CN();Object.defineProperty(N,"CallHierarchyIncomingCallsRequest",{enumerable:!0,get:function(){return wy.CallHierarchyIncomingCallsRequest}});Object.defineProperty(N,"CallHierarchyOutgoingCallsRequest",{enumerable:!0,get:function(){return wy.CallHierarchyOutgoingCallsRequest}});Object.defineProperty(N,"CallHierarchyPrepareRequest",{enumerable:!0,get:function(){return wy.CallHierarchyPrepareRequest}});var Qo=MN();Object.defineProperty(N,"TokenFormat",{enumerable:!0,get:function(){return Qo.TokenFormat}});Object.defineProperty(N,"SemanticTokensRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRequest}});Object.defineProperty(N,"SemanticTokensDeltaRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensDeltaRequest}});Object.defineProperty(N,"SemanticTokensRangeRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRangeRequest}});Object.defineProperty(N,"SemanticTokensRefreshRequest",{enumerable:!0,get:function(){return Qo.SemanticTokensRefreshRequest}});Object.defineProperty(N,"SemanticTokensRegistrationType",{enumerable:!0,get:function(){return Qo.SemanticTokensRegistrationType}});var ej=$N();Object.defineProperty(N,"ShowDocumentRequest",{enumerable:!0,get:function(){return ej.ShowDocumentRequest}});var tj=jN();Object.defineProperty(N,"LinkedEditingRangeRequest",{enumerable:!0,get:function(){return tj.LinkedEditingRangeRequest}});var Ws=YN();Object.defineProperty(N,"FileOperationPatternKind",{enumerable:!0,get:function(){return Ws.FileOperationPatternKind}});Object.defineProperty(N,"DidCreateFilesNotification",{enumerable:!0,get:function(){return Ws.DidCreateFilesNotification}});Object.defineProperty(N,"WillCreateFilesRequest",{enumerable:!0,get:function(){return Ws.WillCreateFilesRequest}});Object.defineProperty(N,"DidRenameFilesNotification",{enumerable:!0,get:function(){return Ws.DidRenameFilesNotification}});Object.defineProperty(N,"WillRenameFilesRequest",{enumerable:!0,get:function(){return Ws.WillRenameFilesRequest}});Object.defineProperty(N,"DidDeleteFilesNotification",{enumerable:!0,get:function(){return Ws.DidDeleteFilesNotification}});Object.defineProperty(N,"WillDeleteFilesRequest",{enumerable:!0,get:function(){return Ws.WillDeleteFilesRequest}});var Cy=eR();Object.defineProperty(N,"UniquenessLevel",{enumerable:!0,get:function(){return Cy.UniquenessLevel}});Object.defineProperty(N,"MonikerKind",{enumerable:!0,get:function(){return Cy.MonikerKind}});Object.defineProperty(N,"MonikerRequest",{enumerable:!0,get:function(){return Cy.MonikerRequest}});var Dy=iR();Object.defineProperty(N,"TypeHierarchyPrepareRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchyPrepareRequest}});Object.defineProperty(N,"TypeHierarchySubtypesRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchySubtypesRequest}});Object.defineProperty(N,"TypeHierarchySupertypesRequest",{enumerable:!0,get:function(){return Dy.TypeHierarchySupertypesRequest}});var BP=aR();Object.defineProperty(N,"InlineValueRequest",{enumerable:!0,get:function(){return BP.InlineValueRequest}});Object.defineProperty(N,"InlineValueRefreshRequest",{enumerable:!0,get:function(){return BP.InlineValueRefreshRequest}});var Ay=dR();Object.defineProperty(N,"InlayHintRequest",{enumerable:!0,get:function(){return Ay.InlayHintRequest}});Object.defineProperty(N,"InlayHintResolveRequest",{enumerable:!0,get:function(){return Ay.InlayHintResolveRequest}});Object.defineProperty(N,"InlayHintRefreshRequest",{enumerable:!0,get:function(){return Ay.InlayHintRefreshRequest}});var wc=TR();Object.defineProperty(N,"DiagnosticServerCancellationData",{enumerable:!0,get:function(){return wc.DiagnosticServerCancellationData}});Object.defineProperty(N,"DocumentDiagnosticReportKind",{enumerable:!0,get:function(){return wc.DocumentDiagnosticReportKind}});Object.defineProperty(N,"DocumentDiagnosticRequest",{enumerable:!0,get:function(){return wc.DocumentDiagnosticRequest}});Object.defineProperty(N,"WorkspaceDiagnosticRequest",{enumerable:!0,get:function(){return wc.WorkspaceDiagnosticRequest}});Object.defineProperty(N,"DiagnosticRefreshRequest",{enumerable:!0,get:function(){return wc.DiagnosticRefreshRequest}});var ai=RR();Object.defineProperty(N,"NotebookCellKind",{enumerable:!0,get:function(){return ai.NotebookCellKind}});Object.defineProperty(N,"ExecutionSummary",{enumerable:!0,get:function(){return ai.ExecutionSummary}});Object.defineProperty(N,"NotebookCell",{enumerable:!0,get:function(){return ai.NotebookCell}});Object.defineProperty(N,"NotebookDocument",{enumerable:!0,get:function(){return ai.NotebookDocument}});Object.defineProperty(N,"NotebookDocumentSyncRegistrationType",{enumerable:!0,get:function(){return ai.NotebookDocumentSyncRegistrationType}});Object.defineProperty(N,"DidOpenNotebookDocumentNotification",{enumerable:!0,get:function(){return ai.DidOpenNotebookDocumentNotification}});Object.defineProperty(N,"NotebookCellArrayChange",{enumerable:!0,get:function(){return ai.NotebookCellArrayChange}});Object.defineProperty(N,"DidChangeNotebookDocumentNotification",{enumerable:!0,get:function(){return ai.DidChangeNotebookDocumentNotification}});Object.defineProperty(N,"DidSaveNotebookDocumentNotification",{enumerable:!0,get:function(){return ai.DidSaveNotebookDocumentNotification}});Object.defineProperty(N,"DidCloseNotebookDocumentNotification",{enumerable:!0,get:function(){return ai.DidCloseNotebookDocumentNotification}});var rj=wR();Object.defineProperty(N,"InlineCompletionRequest",{enumerable:!0,get:function(){return rj.InlineCompletionRequest}});var ky;(function(t){function e(r){let n=r;return Gt.string(n)||Gt.string(n.language)||Gt.string(n.scheme)||Gt.string(n.pattern)}t.is=e})(ky||(N.TextDocumentFilter=ky={}));var Ny;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebookType)||Gt.string(n.scheme)||Gt.string(n.pattern))}t.is=e})(Ny||(N.NotebookDocumentFilter=Ny={}));var Ry;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(Gt.string(n.notebook)||Ny.is(n.notebook))&&(n.language===void 0||Gt.string(n.language))}t.is=e})(Ry||(N.NotebookCellTextDocumentFilter=Ry={}));var Py;(function(t){function e(r){if(!Array.isArray(r))return!1;for(let n of r)if(!Gt.string(n)&&!ky.is(n)&&!Ry.is(n))return!1;return!0}t.is=e})(Py||(N.DocumentSelector=Py={}));var DR;(function(t){t.method="client/registerCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(DR||(N.RegistrationRequest=DR={}));var AR;(function(t){t.method="client/unregisterCapability",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(AR||(N.UnregistrationRequest=AR={}));var IR;(function(t){t.Create="create",t.Rename="rename",t.Delete="delete"})(IR||(N.ResourceOperationKind=IR={}));var OR;(function(t){t.Abort="abort",t.Transactional="transactional",t.TextOnlyTransactional="textOnlyTransactional",t.Undo="undo"})(OR||(N.FailureHandlingKind=OR={}));var xR;(function(t){t.UTF8="utf-8",t.UTF16="utf-16",t.UTF32="utf-32"})(xR||(N.PositionEncodingKind=xR={}));var MR;(function(t){function e(r){let n=r;return n&&Gt.string(n.id)&&n.id.length>0}t.hasId=e})(MR||(N.StaticRegistrationOptions=MR={}));var LR;(function(t){function e(r){let n=r;return n&&(n.documentSelector===null||Py.is(n.documentSelector))}t.is=e})(LR||(N.TextDocumentRegistrationOptions=LR={}));var qR;(function(t){function e(n){let i=n;return Gt.objectLiteral(i)&&(i.workDoneProgress===void 0||Gt.boolean(i.workDoneProgress))}t.is=e;function r(n){let i=n;return i&&Gt.boolean(i.workDoneProgress)}t.hasWorkDoneProgress=r})(qR||(N.WorkDoneProgressOptions=qR={}));var $R;(function(t){t.method="initialize",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})($R||(N.InitializeRequest=$R={}));var FR;(function(t){t.unknownProtocolVersion=1})(FR||(N.InitializeErrorCodes=FR={}));var BR;(function(t){t.method="initialized",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(BR||(N.InitializedNotification=BR={}));var jR;(function(t){t.method="shutdown",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType0(t.method)})(jR||(N.ShutdownRequest=jR={}));var UR;(function(t){t.method="exit",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType0(t.method)})(UR||(N.ExitNotification=UR={}));var HR;(function(t){t.method="workspace/didChangeConfiguration",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(HR||(N.DidChangeConfigurationNotification=HR={}));var VR;(function(t){t.Error=1,t.Warning=2,t.Info=3,t.Log=4,t.Debug=5})(VR||(N.MessageType=VR={}));var zR;(function(t){t.method="window/showMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(zR||(N.ShowMessageNotification=zR={}));var WR;(function(t){t.method="window/showMessageRequest",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType(t.method)})(WR||(N.ShowMessageRequest=WR={}));var GR;(function(t){t.method="window/logMessage",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(GR||(N.LogMessageNotification=GR={}));var KR;(function(t){t.method="telemetry/event",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(KR||(N.TelemetryEventNotification=KR={}));var YR;(function(t){t.None=0,t.Full=1,t.Incremental=2})(YR||(N.TextDocumentSyncKind=YR={}));var XR;(function(t){t.method="textDocument/didOpen",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(XR||(N.DidOpenTextDocumentNotification=XR={}));var JR;(function(t){function e(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range!==void 0&&(i.rangeLength===void 0||typeof i.rangeLength=="number")}t.isIncremental=e;function r(n){let i=n;return i!=null&&typeof i.text=="string"&&i.range===void 0&&i.rangeLength===void 0}t.isFull=r})(JR||(N.TextDocumentContentChangeEvent=JR={}));var QR;(function(t){t.method="textDocument/didChange",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(QR||(N.DidChangeTextDocumentNotification=QR={}));var ZR;(function(t){t.method="textDocument/didClose",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(ZR||(N.DidCloseTextDocumentNotification=ZR={}));var eP;(function(t){t.method="textDocument/didSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(eP||(N.DidSaveTextDocumentNotification=eP={}));var tP;(function(t){t.Manual=1,t.AfterDelay=2,t.FocusOut=3})(tP||(N.TextDocumentSaveReason=tP={}));var rP;(function(t){t.method="textDocument/willSave",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(rP||(N.WillSaveTextDocumentNotification=rP={}));var nP;(function(t){t.method="textDocument/willSaveWaitUntil",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(nP||(N.WillSaveTextDocumentWaitUntilRequest=nP={}));var iP;(function(t){t.method="workspace/didChangeWatchedFiles",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolNotificationType(t.method)})(iP||(N.DidChangeWatchedFilesNotification=iP={}));var sP;(function(t){t.Created=1,t.Changed=2,t.Deleted=3})(sP||(N.FileChangeType=sP={}));var oP;(function(t){function e(r){let n=r;return Gt.objectLiteral(n)&&(CR.URI.is(n.baseUri)||CR.WorkspaceFolder.is(n.baseUri))&&Gt.string(n.pattern)}t.is=e})(oP||(N.RelativePattern=oP={}));var aP;(function(t){t.Create=1,t.Change=2,t.Delete=4})(aP||(N.WatchKind=aP={}));var cP;(function(t){t.method="textDocument/publishDiagnostics",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolNotificationType(t.method)})(cP||(N.PublishDiagnosticsNotification=cP={}));var lP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.TriggerForIncompleteCompletions=3})(lP||(N.CompletionTriggerKind=lP={}));var uP;(function(t){t.method="textDocument/completion",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(uP||(N.CompletionRequest=uP={}));var dP;(function(t){t.method="completionItem/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(dP||(N.CompletionResolveRequest=dP={}));var fP;(function(t){t.method="textDocument/hover",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(fP||(N.HoverRequest=fP={}));var pP;(function(t){t.Invoked=1,t.TriggerCharacter=2,t.ContentChange=3})(pP||(N.SignatureHelpTriggerKind=pP={}));var hP;(function(t){t.method="textDocument/signatureHelp",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(hP||(N.SignatureHelpRequest=hP={}));var mP;(function(t){t.method="textDocument/definition",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(mP||(N.DefinitionRequest=mP={}));var gP;(function(t){t.method="textDocument/references",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(gP||(N.ReferencesRequest=gP={}));var yP;(function(t){t.method="textDocument/documentHighlight",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(yP||(N.DocumentHighlightRequest=yP={}));var TP;(function(t){t.method="textDocument/documentSymbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(TP||(N.DocumentSymbolRequest=TP={}));var vP;(function(t){t.method="textDocument/codeAction",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(vP||(N.CodeActionRequest=vP={}));var bP;(function(t){t.method="codeAction/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(bP||(N.CodeActionResolveRequest=bP={}));var SP;(function(t){t.method="workspace/symbol",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(SP||(N.WorkspaceSymbolRequest=SP={}));var _P;(function(t){t.method="workspaceSymbol/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(_P||(N.WorkspaceSymbolResolveRequest=_P={}));var kP;(function(t){t.method="textDocument/codeLens",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(kP||(N.CodeLensRequest=kP={}));var NP;(function(t){t.method="codeLens/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(NP||(N.CodeLensResolveRequest=NP={}));var RP;(function(t){t.method="workspace/codeLens/refresh",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType0(t.method)})(RP||(N.CodeLensRefreshRequest=RP={}));var PP;(function(t){t.method="textDocument/documentLink",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(PP||(N.DocumentLinkRequest=PP={}));var EP;(function(t){t.method="documentLink/resolve",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(EP||(N.DocumentLinkResolveRequest=EP={}));var wP;(function(t){t.method="textDocument/formatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(wP||(N.DocumentFormattingRequest=wP={}));var CP;(function(t){t.method="textDocument/rangeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(CP||(N.DocumentRangeFormattingRequest=CP={}));var DP;(function(t){t.method="textDocument/rangesFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(DP||(N.DocumentRangesFormattingRequest=DP={}));var AP;(function(t){t.method="textDocument/onTypeFormatting",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(AP||(N.DocumentOnTypeFormattingRequest=AP={}));var IP;(function(t){t.Identifier=1})(IP||(N.PrepareSupportDefaultBehavior=IP={}));var OP;(function(t){t.method="textDocument/rename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(OP||(N.RenameRequest=OP={}));var xP;(function(t){t.method="textDocument/prepareRename",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(xP||(N.PrepareRenameRequest=xP={}));var MP;(function(t){t.method="workspace/executeCommand",t.messageDirection=V.MessageDirection.clientToServer,t.type=new V.ProtocolRequestType(t.method)})(MP||(N.ExecuteCommandRequest=MP={}));var LP;(function(t){t.method="workspace/applyEdit",t.messageDirection=V.MessageDirection.serverToClient,t.type=new V.ProtocolRequestType("workspace/applyEdit")})(LP||(N.ApplyWorkspaceEditRequest=LP={}))});var HP=R(Kd=>{"use strict";Object.defineProperty(Kd,"__esModule",{value:!0});Kd.createProtocolConnection=void 0;var UP=zs();function nj(t,e,r,n){return UP.ConnectionStrategy.is(n)&&(n={connectionStrategy:n}),(0,UP.createMessageConnection)(t,e,r,n)}Kd.createProtocolConnection=nj});var zP=R(Lr=>{"use strict";var ij=Lr&&Lr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),Yd=Lr&&Lr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&ij(e,t,r)};Object.defineProperty(Lr,"__esModule",{value:!0});Lr.LSPErrorCodes=Lr.createProtocolConnection=void 0;Yd(zs(),Lr);Yd(Id(),Lr);Yd(_t(),Lr);Yd(jP(),Lr);var sj=HP();Object.defineProperty(Lr,"createProtocolConnection",{enumerable:!0,get:function(){return sj.createProtocolConnection}});var VP;(function(t){t.lspReservedErrorRangeStart=-32899,t.RequestFailed=-32803,t.ServerCancelled=-32802,t.ContentModified=-32801,t.RequestCancelled=-32800,t.lspReservedErrorRangeEnd=-32800})(VP||(Lr.LSPErrorCodes=VP={}))});var It=R(ci=>{"use strict";var oj=ci&&ci.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),WP=ci&&ci.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&oj(e,t,r)};Object.defineProperty(ci,"__esModule",{value:!0});ci.createProtocolConnection=void 0;var aj=my();WP(my(),ci);WP(zP(),ci);function cj(t,e,r,n){return(0,aj.createMessageConnection)(t,e,r,n)}ci.createProtocolConnection=cj});var Iy=R(pn=>{"use strict";Object.defineProperty(pn,"__esModule",{value:!0});pn.generateUuid=pn.parse=pn.isUUID=pn.v4=pn.empty=void 0;var Cc=class{constructor(e){this._value=e}asHex(){return this._value}equals(e){return this.asHex()===e.asHex()}},Dc=class t extends Cc{static _oneOf(e){return e[Math.floor(e.length*Math.random())]}static _randomHex(){return t._oneOf(t._chars)}constructor(){super([t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),"-","4",t._randomHex(),t._randomHex(),t._randomHex(),"-",t._oneOf(t._timeHighBits),t._randomHex(),t._randomHex(),t._randomHex(),"-",t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex(),t._randomHex()].join(""))}};Dc._chars=["0","1","2","3","4","5","6","6","7","8","9","a","b","c","d","e","f"];Dc._timeHighBits=["8","9","a","b"];pn.empty=new Cc("00000000-0000-0000-0000-000000000000");function GP(){return new Dc}pn.v4=GP;var lj=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function KP(t){return lj.test(t)}pn.isUUID=KP;function uj(t){if(!KP(t))throw new Error("invalid uuid");return new Cc(t)}pn.parse=uj;function dj(){return GP().asHex()}pn.generateUuid=dj});var YP=R(ss=>{"use strict";Object.defineProperty(ss,"__esModule",{value:!0});ss.attachPartialResult=ss.ProgressFeature=ss.attachWorkDone=void 0;var is=It(),fj=Iy(),Gs=class t{constructor(e,r){this._connection=e,this._token=r,t.Instances.set(this._token,this)}begin(e,r,n,i){let s={kind:"begin",title:e,percentage:r,message:n,cancellable:i};this._connection.sendProgress(is.WorkDoneProgress.type,this._token,s)}report(e,r){let n={kind:"report"};typeof e=="number"?(n.percentage=e,r!==void 0&&(n.message=r)):n.message=e,this._connection.sendProgress(is.WorkDoneProgress.type,this._token,n)}done(){t.Instances.delete(this._token),this._connection.sendProgress(is.WorkDoneProgress.type,this._token,{kind:"end"})}};Gs.Instances=new Map;var Xd=class extends Gs{constructor(e,r){super(e,r),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose(),super.done()}cancel(){this._source.cancel()}},Ac=class{constructor(){}begin(){}report(){}done(){}},Jd=class extends Ac{constructor(){super(),this._source=new is.CancellationTokenSource}get token(){return this._source.token}done(){this._source.dispose()}cancel(){this._source.cancel()}};function pj(t,e){if(e===void 0||e.workDoneToken===void 0)return new Ac;let r=e.workDoneToken;return delete e.workDoneToken,new Gs(t,r)}ss.attachWorkDone=pj;var hj=t=>class extends t{constructor(){super(),this._progressSupported=!1}initialize(e){super.initialize(e),e?.window?.workDoneProgress===!0&&(this._progressSupported=!0,this.connection.onNotification(is.WorkDoneProgressCancelNotification.type,r=>{let n=Gs.Instances.get(r.token);(n instanceof Xd||n instanceof Jd)&&n.cancel()}))}attachWorkDoneProgress(e){return e===void 0?new Ac:new Gs(this.connection,e)}createWorkDoneProgress(){if(this._progressSupported){let e=(0,fj.generateUuid)();return this.connection.sendRequest(is.WorkDoneProgressCreateRequest.type,{token:e}).then(()=>new Xd(this.connection,e))}else return Promise.resolve(new Jd)}};ss.ProgressFeature=hj;var Oy;(function(t){t.type=new is.ProgressType})(Oy||(Oy={}));var xy=class{constructor(e,r){this._connection=e,this._token=r}report(e){this._connection.sendProgress(Oy.type,this._token,e)}};function mj(t,e){if(e===void 0||e.partialResultToken===void 0)return;let r=e.partialResultToken;return delete e.partialResultToken,new xy(t,r)}ss.attachPartialResult=mj});var XP=R(Qd=>{"use strict";Object.defineProperty(Qd,"__esModule",{value:!0});Qd.ConfigurationFeature=void 0;var gj=It(),yj=ld(),Tj=t=>class extends t{getConfiguration(e){return e?yj.string(e)?this._getConfiguration({section:e}):this._getConfiguration(e):this._getConfiguration({})}_getConfiguration(e){let r={items:Array.isArray(e)?e:[e]};return this.connection.sendRequest(gj.ConfigurationRequest.type,r).then(n=>Array.isArray(n)?Array.isArray(e)?n:n[0]:Array.isArray(e)?[]:null)}};Qd.ConfigurationFeature=Tj});var JP=R(ef=>{"use strict";Object.defineProperty(ef,"__esModule",{value:!0});ef.WorkspaceFoldersFeature=void 0;var Zd=It(),vj=t=>class extends t{constructor(){super(),this._notificationIsAutoRegistered=!1}initialize(e){super.initialize(e);let r=e.workspace;r&&r.workspaceFolders&&(this._onDidChangeWorkspaceFolders=new Zd.Emitter,this.connection.onNotification(Zd.DidChangeWorkspaceFoldersNotification.type,n=>{this._onDidChangeWorkspaceFolders.fire(n.event)}))}fillServerCapabilities(e){super.fillServerCapabilities(e);let r=e.workspace?.workspaceFolders?.changeNotifications;this._notificationIsAutoRegistered=r===!0||typeof r=="string"}getWorkspaceFolders(){return this.connection.sendRequest(Zd.WorkspaceFoldersRequest.type)}get onDidChangeWorkspaceFolders(){if(!this._onDidChangeWorkspaceFolders)throw new Error("Client doesn't support sending workspace folder change events.");return!this._notificationIsAutoRegistered&&!this._unregistration&&(this._unregistration=this.connection.client.register(Zd.DidChangeWorkspaceFoldersNotification.type)),this._onDidChangeWorkspaceFolders.event}};ef.WorkspaceFoldersFeature=vj});var QP=R(tf=>{"use strict";Object.defineProperty(tf,"__esModule",{value:!0});tf.CallHierarchyFeature=void 0;var My=It(),bj=t=>class extends t{get callHierarchy(){return{onPrepare:e=>this.connection.onRequest(My.CallHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onIncomingCalls:e=>{let r=My.CallHierarchyIncomingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onOutgoingCalls:e=>{let r=My.CallHierarchyOutgoingCallsRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};tf.CallHierarchyFeature=bj});var qy=R(os=>{"use strict";Object.defineProperty(os,"__esModule",{value:!0});os.SemanticTokensBuilder=os.SemanticTokensDiff=os.SemanticTokensFeature=void 0;var rf=It(),Sj=t=>class extends t{get semanticTokens(){return{refresh:()=>this.connection.sendRequest(rf.SemanticTokensRefreshRequest.type),on:e=>{let r=rf.SemanticTokensRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onDelta:e=>{let r=rf.SemanticTokensDeltaRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onRange:e=>{let r=rf.SemanticTokensRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};os.SemanticTokensFeature=Sj;var nf=class{constructor(e,r){this.originalSequence=e,this.modifiedSequence=r}computeDiff(){let e=this.originalSequence.length,r=this.modifiedSequence.length,n=0;for(;n<r&&n<e&&this.originalSequence[n]===this.modifiedSequence[n];)n++;if(n<r&&n<e){let i=e-1,s=r-1;for(;i>=n&&s>=n&&this.originalSequence[i]===this.modifiedSequence[s];)i--,s--;(i<n||s<n)&&(i++,s++);let o=i-n+1,a=this.modifiedSequence.slice(n,s+1);return a.length===1&&a[0]===this.originalSequence[i]?[{start:n,deleteCount:o-1}]:[{start:n,deleteCount:o,data:a}]}else return n<r?[{start:n,deleteCount:0,data:this.modifiedSequence.slice(n)}]:n<e?[{start:n,deleteCount:e-n}]:[]}};os.SemanticTokensDiff=nf;var Ly=class{constructor(){this._prevData=void 0,this.initialize()}initialize(){this._id=Date.now(),this._prevLine=0,this._prevChar=0,this._data=[],this._dataLen=0}push(e,r,n,i,s){let o=e,a=r;this._dataLen>0&&(o-=this._prevLine,o===0&&(a-=this._prevChar)),this._data[this._dataLen++]=o,this._data[this._dataLen++]=a,this._data[this._dataLen++]=n,this._data[this._dataLen++]=i,this._data[this._dataLen++]=s,this._prevLine=e,this._prevChar=r}get id(){return this._id.toString()}previousResult(e){this.id===e&&(this._prevData=this._data),this.initialize()}build(){return this._prevData=void 0,{resultId:this.id,data:this._data}}canBuildEdits(){return this._prevData!==void 0}buildEdits(){return this._prevData!==void 0?{resultId:this.id,edits:new nf(this._prevData,this._data).computeDiff()}:this.build()}};os.SemanticTokensBuilder=Ly});var ZP=R(sf=>{"use strict";Object.defineProperty(sf,"__esModule",{value:!0});sf.ShowDocumentFeature=void 0;var _j=It(),kj=t=>class extends t{showDocument(e){return this.connection.sendRequest(_j.ShowDocumentRequest.type,e)}};sf.ShowDocumentFeature=kj});var eE=R(of=>{"use strict";Object.defineProperty(of,"__esModule",{value:!0});of.FileOperationsFeature=void 0;var Zo=It(),Nj=t=>class extends t{onDidCreateFiles(e){return this.connection.onNotification(Zo.DidCreateFilesNotification.type,r=>{e(r)})}onDidRenameFiles(e){return this.connection.onNotification(Zo.DidRenameFilesNotification.type,r=>{e(r)})}onDidDeleteFiles(e){return this.connection.onNotification(Zo.DidDeleteFilesNotification.type,r=>{e(r)})}onWillCreateFiles(e){return this.connection.onRequest(Zo.WillCreateFilesRequest.type,(r,n)=>e(r,n))}onWillRenameFiles(e){return this.connection.onRequest(Zo.WillRenameFilesRequest.type,(r,n)=>e(r,n))}onWillDeleteFiles(e){return this.connection.onRequest(Zo.WillDeleteFilesRequest.type,(r,n)=>e(r,n))}};of.FileOperationsFeature=Nj});var tE=R(af=>{"use strict";Object.defineProperty(af,"__esModule",{value:!0});af.LinkedEditingRangeFeature=void 0;var Rj=It(),Pj=t=>class extends t{onLinkedEditingRange(e){return this.connection.onRequest(Rj.LinkedEditingRangeRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0))}};af.LinkedEditingRangeFeature=Pj});var rE=R(cf=>{"use strict";Object.defineProperty(cf,"__esModule",{value:!0});cf.TypeHierarchyFeature=void 0;var $y=It(),Ej=t=>class extends t{get typeHierarchy(){return{onPrepare:e=>this.connection.onRequest($y.TypeHierarchyPrepareRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),void 0)),onSupertypes:e=>{let r=$y.TypeHierarchySupertypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))},onSubtypes:e=>{let r=$y.TypeHierarchySubtypesRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};cf.TypeHierarchyFeature=Ej});var iE=R(lf=>{"use strict";Object.defineProperty(lf,"__esModule",{value:!0});lf.InlineValueFeature=void 0;var nE=It(),wj=t=>class extends t{get inlineValue(){return{refresh:()=>this.connection.sendRequest(nE.InlineValueRefreshRequest.type),on:e=>this.connection.onRequest(nE.InlineValueRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};lf.InlineValueFeature=wj});var oE=R(uf=>{"use strict";Object.defineProperty(uf,"__esModule",{value:!0});uf.FoldingRangeFeature=void 0;var sE=It(),Cj=t=>class extends t{get foldingRange(){return{refresh:()=>this.connection.sendRequest(sE.FoldingRangeRefreshRequest.type),on:e=>{let r=sE.FoldingRangeRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};uf.FoldingRangeFeature=Cj});var aE=R(df=>{"use strict";Object.defineProperty(df,"__esModule",{value:!0});df.InlayHintFeature=void 0;var Fy=It(),Dj=t=>class extends t{get inlayHint(){return{refresh:()=>this.connection.sendRequest(Fy.InlayHintRefreshRequest.type),on:e=>this.connection.onRequest(Fy.InlayHintRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r))),resolve:e=>this.connection.onRequest(Fy.InlayHintResolveRequest.type,(r,n)=>e(r,n))}}};df.InlayHintFeature=Dj});var cE=R(ff=>{"use strict";Object.defineProperty(ff,"__esModule",{value:!0});ff.DiagnosticFeature=void 0;var Ic=It(),Aj=t=>class extends t{get diagnostics(){return{refresh:()=>this.connection.sendRequest(Ic.DiagnosticRefreshRequest.type),on:e=>this.connection.onRequest(Ic.DocumentDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ic.DocumentDiagnosticRequest.partialResult,r))),onWorkspace:e=>this.connection.onRequest(Ic.WorkspaceDiagnosticRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r),this.attachPartialResultProgress(Ic.WorkspaceDiagnosticRequest.partialResult,r)))}}};ff.DiagnosticFeature=Aj});var jy=R(pf=>{"use strict";Object.defineProperty(pf,"__esModule",{value:!0});pf.TextDocuments=void 0;var Ks=It(),By=class{constructor(e){this._configuration=e,this._syncedDocuments=new Map,this._onDidChangeContent=new Ks.Emitter,this._onDidOpen=new Ks.Emitter,this._onDidClose=new Ks.Emitter,this._onDidSave=new Ks.Emitter,this._onWillSave=new Ks.Emitter}get onDidOpen(){return this._onDidOpen.event}get onDidChangeContent(){return this._onDidChangeContent.event}get onWillSave(){return this._onWillSave.event}onWillSaveWaitUntil(e){this._willSaveWaitUntil=e}get onDidSave(){return this._onDidSave.event}get onDidClose(){return this._onDidClose.event}get(e){return this._syncedDocuments.get(e)}all(){return Array.from(this._syncedDocuments.values())}keys(){return Array.from(this._syncedDocuments.keys())}listen(e){e.__textDocumentSync=Ks.TextDocumentSyncKind.Incremental;let r=[];return r.push(e.onDidOpenTextDocument(n=>{let i=n.textDocument,s=this._configuration.create(i.uri,i.languageId,i.version,i.text);this._syncedDocuments.set(i.uri,s);let o=Object.freeze({document:s});this._onDidOpen.fire(o),this._onDidChangeContent.fire(o)})),r.push(e.onDidChangeTextDocument(n=>{let i=n.textDocument,s=n.contentChanges;if(s.length===0)return;let{version:o}=i;if(o==null)throw new Error(`Received document change event for ${i.uri} without valid version identifier`);let a=this._syncedDocuments.get(i.uri);a!==void 0&&(a=this._configuration.update(a,s,o),this._syncedDocuments.set(i.uri,a),this._onDidChangeContent.fire(Object.freeze({document:a})))})),r.push(e.onDidCloseTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&(this._syncedDocuments.delete(n.textDocument.uri),this._onDidClose.fire(Object.freeze({document:i})))})),r.push(e.onWillSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onWillSave.fire(Object.freeze({document:i,reason:n.reason}))})),r.push(e.onWillSaveTextDocumentWaitUntil((n,i)=>{let s=this._syncedDocuments.get(n.textDocument.uri);return s!==void 0&&this._willSaveWaitUntil?this._willSaveWaitUntil(Object.freeze({document:s,reason:n.reason}),i):[]})),r.push(e.onDidSaveTextDocument(n=>{let i=this._syncedDocuments.get(n.textDocument.uri);i!==void 0&&this._onDidSave.fire(Object.freeze({document:i}))})),Ks.Disposable.create(()=>{r.forEach(n=>n.dispose())})}};pf.TextDocuments=By});var Hy=R(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.NotebookDocuments=ea.NotebookSyncFeature=void 0;var hn=It(),lE=jy(),Ij=t=>class extends t{get synchronization(){return{onDidOpenNotebookDocument:e=>this.connection.onNotification(hn.DidOpenNotebookDocumentNotification.type,r=>{e(r)}),onDidChangeNotebookDocument:e=>this.connection.onNotification(hn.DidChangeNotebookDocumentNotification.type,r=>{e(r)}),onDidSaveNotebookDocument:e=>this.connection.onNotification(hn.DidSaveNotebookDocumentNotification.type,r=>{e(r)}),onDidCloseNotebookDocument:e=>this.connection.onNotification(hn.DidCloseNotebookDocumentNotification.type,r=>{e(r)})}}};ea.NotebookSyncFeature=Ij;var hf=class t{onDidOpenTextDocument(e){return this.openHandler=e,hn.Disposable.create(()=>{this.openHandler=void 0})}openTextDocument(e){this.openHandler&&this.openHandler(e)}onDidChangeTextDocument(e){return this.changeHandler=e,hn.Disposable.create(()=>{this.changeHandler=e})}changeTextDocument(e){this.changeHandler&&this.changeHandler(e)}onDidCloseTextDocument(e){return this.closeHandler=e,hn.Disposable.create(()=>{this.closeHandler=void 0})}closeTextDocument(e){this.closeHandler&&this.closeHandler(e)}onWillSaveTextDocument(){return t.NULL_DISPOSE}onWillSaveTextDocumentWaitUntil(){return t.NULL_DISPOSE}onDidSaveTextDocument(){return t.NULL_DISPOSE}};hf.NULL_DISPOSE=Object.freeze({dispose:()=>{}});var Uy=class{constructor(e){e instanceof lE.TextDocuments?this._cellTextDocuments=e:this._cellTextDocuments=new lE.TextDocuments(e),this.notebookDocuments=new Map,this.notebookCellMap=new Map,this._onDidOpen=new hn.Emitter,this._onDidChange=new hn.Emitter,this._onDidSave=new hn.Emitter,this._onDidClose=new hn.Emitter}get cellTextDocuments(){return this._cellTextDocuments}getCellTextDocument(e){return this._cellTextDocuments.get(e.document)}getNotebookDocument(e){return this.notebookDocuments.get(e)}getNotebookCell(e){let r=this.notebookCellMap.get(e);return r&&r[0]}findNotebookDocumentForCell(e){let r=typeof e=="string"?e:e.document,n=this.notebookCellMap.get(r);return n&&n[1]}get onDidOpen(){return this._onDidOpen.event}get onDidSave(){return this._onDidSave.event}get onDidChange(){return this._onDidChange.event}get onDidClose(){return this._onDidClose.event}listen(e){let r=new hf,n=[];return n.push(this.cellTextDocuments.listen(r)),n.push(e.notebooks.synchronization.onDidOpenNotebookDocument(i=>{this.notebookDocuments.set(i.notebookDocument.uri,i.notebookDocument);for(let s of i.cellTextDocuments)r.openTextDocument({textDocument:s});this.updateCellMap(i.notebookDocument),this._onDidOpen.fire(i.notebookDocument)})),n.push(e.notebooks.synchronization.onDidChangeNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s===void 0)return;s.version=i.notebookDocument.version;let o=s.metadata,a=!1,c=i.change;c.metadata!==void 0&&(a=!0,s.metadata=c.metadata);let l=[],u=[],d=[],f=[];if(c.cells!==void 0){let _=c.cells;if(_.structure!==void 0){let b=_.structure.array;if(s.cells.splice(b.start,b.deleteCount,...b.cells!==void 0?b.cells:[]),_.structure.didOpen!==void 0)for(let v of _.structure.didOpen)r.openTextDocument({textDocument:v}),l.push(v.uri);if(_.structure.didClose)for(let v of _.structure.didClose)r.closeTextDocument({textDocument:v}),u.push(v.uri)}if(_.data!==void 0){let b=new Map(_.data.map(v=>[v.document,v]));for(let v=0;v<=s.cells.length;v++){let k=b.get(s.cells[v].document);if(k!==void 0){let w=s.cells.splice(v,1,k);if(d.push({old:w[0],new:k}),b.delete(k.document),b.size===0)break}}}if(_.textContent!==void 0)for(let b of _.textContent)r.changeTextDocument({textDocument:b.document,contentChanges:b.changes}),f.push(b.document.uri)}this.updateCellMap(s);let p={notebookDocument:s};a&&(p.metadata={old:o,new:s.metadata});let m=[];for(let _ of l)m.push(this.getNotebookCell(_));let h=[];for(let _ of u)h.push(this.getNotebookCell(_));let T=[];for(let _ of f)T.push(this.getNotebookCell(_));(m.length>0||h.length>0||d.length>0||T.length>0)&&(p.cells={added:m,removed:h,changed:{data:d,textContent:T}}),(p.metadata!==void 0||p.cells!==void 0)&&this._onDidChange.fire(p)})),n.push(e.notebooks.synchronization.onDidSaveNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);s!==void 0&&this._onDidSave.fire(s)})),n.push(e.notebooks.synchronization.onDidCloseNotebookDocument(i=>{let s=this.notebookDocuments.get(i.notebookDocument.uri);if(s!==void 0){this._onDidClose.fire(s);for(let o of i.cellTextDocuments)r.closeTextDocument({textDocument:o});this.notebookDocuments.delete(i.notebookDocument.uri);for(let o of s.cells)this.notebookCellMap.delete(o.document)}})),hn.Disposable.create(()=>{n.forEach(i=>i.dispose())})}updateCellMap(e){for(let r of e.cells)this.notebookCellMap.set(r.document,[r,e])}};ea.NotebookDocuments=Uy});var uE=R(mf=>{"use strict";Object.defineProperty(mf,"__esModule",{value:!0});mf.MonikerFeature=void 0;var Oj=It(),xj=t=>class extends t{get moniker(){return{on:e=>{let r=Oj.MonikerRequest.type;return this.connection.onRequest(r,(n,i)=>e(n,i,this.attachWorkDoneProgress(n),this.attachPartialResultProgress(r,n)))}}}};mf.MonikerFeature=xj});var Yy=R(ze=>{"use strict";Object.defineProperty(ze,"__esModule",{value:!0});ze.createConnection=ze.combineFeatures=ze.combineNotebooksFeatures=ze.combineLanguagesFeatures=ze.combineWorkspaceFeatures=ze.combineWindowFeatures=ze.combineClientFeatures=ze.combineTracerFeatures=ze.combineTelemetryFeatures=ze.combineConsoleFeatures=ze._NotebooksImpl=ze._LanguagesImpl=ze.BulkUnregistration=ze.BulkRegistration=ze.ErrorMessageTracker=void 0;var K=It(),mn=ld(),zy=Iy(),me=YP(),Mj=XP(),Lj=JP(),qj=QP(),$j=qy(),Fj=ZP(),Bj=eE(),jj=tE(),Uj=rE(),Hj=iE(),Vj=oE(),zj=aE(),Wj=cE(),Gj=Hy(),Kj=uE();function Vy(t){if(t!==null)return t}var Wy=class{constructor(){this._messages=Object.create(null)}add(e){let r=this._messages[e];r||(r=0),r++,this._messages[e]=r}sendErrors(e){Object.keys(this._messages).forEach(r=>{e.window.showErrorMessage(r)})}};ze.ErrorMessageTracker=Wy;var gf=class{constructor(){}rawAttach(e){this._rawConnection=e}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}fillServerCapabilities(e){}initialize(e){}error(e){this.send(K.MessageType.Error,e)}warn(e){this.send(K.MessageType.Warning,e)}info(e){this.send(K.MessageType.Info,e)}log(e){this.send(K.MessageType.Log,e)}debug(e){this.send(K.MessageType.Debug,e)}send(e,r){this._rawConnection&&this._rawConnection.sendNotification(K.LogMessageNotification.type,{type:e,message:r}).catch(()=>{(0,K.RAL)().console.error("Sending log message failed")})}},Gy=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}showErrorMessage(e,...r){let n={type:K.MessageType.Error,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}showWarningMessage(e,...r){let n={type:K.MessageType.Warning,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}showInformationMessage(e,...r){let n={type:K.MessageType.Info,message:e,actions:r};return this.connection.sendRequest(K.ShowMessageRequest.type,n).then(Vy)}},dE=(0,Fj.ShowDocumentFeature)((0,me.ProgressFeature)(Gy)),fE;(function(t){function e(){return new yf}t.create=e})(fE||(ze.BulkRegistration=fE={}));var yf=class{constructor(){this._registrations=[],this._registered=new Set}add(e,r){let n=mn.string(e)?e:e.method;if(this._registered.has(n))throw new Error(`${n} is already added to this registration`);let i=zy.generateUuid();this._registrations.push({id:i,method:n,registerOptions:r||{}}),this._registered.add(n)}asRegistrationParams(){return{registrations:this._registrations}}},pE;(function(t){function e(){return new Oc(void 0,[])}t.create=e})(pE||(ze.BulkUnregistration=pE={}));var Oc=class{constructor(e,r){this._connection=e,this._unregistrations=new Map,r.forEach(n=>{this._unregistrations.set(n.method,n)})}get isAttached(){return!!this._connection}attach(e){this._connection=e}add(e){this._unregistrations.set(e.method,e)}dispose(){let e=[];for(let n of this._unregistrations.values())e.push(n);let r={unregisterations:e};this._connection.sendRequest(K.UnregistrationRequest.type,r).catch(()=>{this._connection.console.info("Bulk unregistration failed.")})}disposeSingle(e){let r=mn.string(e)?e:e.method,n=this._unregistrations.get(r);if(!n)return!1;let i={unregisterations:[n]};return this._connection.sendRequest(K.UnregistrationRequest.type,i).then(()=>{this._unregistrations.delete(r)},s=>{this._connection.console.info(`Un-registering request handler for ${n.id} failed.`)}),!0}},Tf=class{attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}register(e,r,n){return e instanceof yf?this.registerMany(e):e instanceof Oc?this.registerSingle1(e,r,n):this.registerSingle2(e,r)}registerSingle1(e,r,n){let i=mn.string(r)?r:r.method,s=zy.generateUuid(),o={registrations:[{id:s,method:i,registerOptions:n||{}}]};return e.isAttached||e.attach(this.connection),this.connection.sendRequest(K.RegistrationRequest.type,o).then(a=>(e.add({id:s,method:i}),e),a=>(this.connection.console.info(`Registering request handler for ${i} failed.`),Promise.reject(a)))}registerSingle2(e,r){let n=mn.string(e)?e:e.method,i=zy.generateUuid(),s={registrations:[{id:i,method:n,registerOptions:r||{}}]};return this.connection.sendRequest(K.RegistrationRequest.type,s).then(o=>K.Disposable.create(()=>{this.unregisterSingle(i,n).catch(()=>{this.connection.console.info(`Un-registering capability with id ${i} failed.`)})}),o=>(this.connection.console.info(`Registering request handler for ${n} failed.`),Promise.reject(o)))}unregisterSingle(e,r){let n={unregisterations:[{id:e,method:r}]};return this.connection.sendRequest(K.UnregistrationRequest.type,n).catch(()=>{this.connection.console.info(`Un-registering request handler for ${e} failed.`)})}registerMany(e){let r=e.asRegistrationParams();return this.connection.sendRequest(K.RegistrationRequest.type,r).then(()=>new Oc(this._connection,r.registrations.map(n=>({id:n.id,method:n.method}))),n=>(this.connection.console.info("Bulk registration failed."),Promise.reject(n)))}},Ky=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}applyEdit(e){function r(i){return i&&!!i.edit}let n=r(e)?e:{edit:e};return this.connection.sendRequest(K.ApplyWorkspaceEditRequest.type,n)}},hE=(0,Bj.FileOperationsFeature)((0,Lj.WorkspaceFoldersFeature)((0,Mj.ConfigurationFeature)(Ky))),vf=class{constructor(){this._trace=K.Trace.Off}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}set trace(e){this._trace=e}log(e,r){this._trace!==K.Trace.Off&&this.connection.sendNotification(K.LogTraceNotification.type,{message:e,verbose:this._trace===K.Trace.Verbose?r:void 0}).catch(()=>{})}},bf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}logEvent(e){this.connection.sendNotification(K.TelemetryEventNotification.type,e).catch(()=>{this.connection.console.log("Sending TelemetryEventNotification failed")})}},Sf=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};ze._LanguagesImpl=Sf;var mE=(0,Vj.FoldingRangeFeature)((0,Kj.MonikerFeature)((0,Wj.DiagnosticFeature)((0,zj.InlayHintFeature)((0,Hj.InlineValueFeature)((0,Uj.TypeHierarchyFeature)((0,jj.LinkedEditingRangeFeature)((0,$j.SemanticTokensFeature)((0,qj.CallHierarchyFeature)(Sf))))))))),_f=class{constructor(){}attach(e){this._connection=e}get connection(){if(!this._connection)throw new Error("Remote is not attached to a connection yet.");return this._connection}initialize(e){}fillServerCapabilities(e){}attachWorkDoneProgress(e){return(0,me.attachWorkDone)(this.connection,e)}attachPartialResultProgress(e,r){return(0,me.attachPartialResult)(this.connection,r)}};ze._NotebooksImpl=_f;var gE=(0,Gj.NotebookSyncFeature)(_f);function yE(t,e){return function(r){return e(t(r))}}ze.combineConsoleFeatures=yE;function TE(t,e){return function(r){return e(t(r))}}ze.combineTelemetryFeatures=TE;function vE(t,e){return function(r){return e(t(r))}}ze.combineTracerFeatures=vE;function bE(t,e){return function(r){return e(t(r))}}ze.combineClientFeatures=bE;function SE(t,e){return function(r){return e(t(r))}}ze.combineWindowFeatures=SE;function _E(t,e){return function(r){return e(t(r))}}ze.combineWorkspaceFeatures=_E;function kE(t,e){return function(r){return e(t(r))}}ze.combineLanguagesFeatures=kE;function NE(t,e){return function(r){return e(t(r))}}ze.combineNotebooksFeatures=NE;function Yj(t,e){function r(i,s,o){return i&&s?o(i,s):i||s}return{__brand:"features",console:r(t.console,e.console,yE),tracer:r(t.tracer,e.tracer,vE),telemetry:r(t.telemetry,e.telemetry,TE),client:r(t.client,e.client,bE),window:r(t.window,e.window,SE),workspace:r(t.workspace,e.workspace,_E),languages:r(t.languages,e.languages,kE),notebooks:r(t.notebooks,e.notebooks,NE)}}ze.combineFeatures=Yj;function Xj(t,e,r){let n=r&&r.console?new(r.console(gf)):new gf,i=t(n);n.rawAttach(i);let s=r&&r.tracer?new(r.tracer(vf)):new vf,o=r&&r.telemetry?new(r.telemetry(bf)):new bf,a=r&&r.client?new(r.client(Tf)):new Tf,c=r&&r.window?new(r.window(dE)):new dE,l=r&&r.workspace?new(r.workspace(hE)):new hE,u=r&&r.languages?new(r.languages(mE)):new mE,d=r&&r.notebooks?new(r.notebooks(gE)):new gE,f=[n,s,o,a,c,l,u,d];function p(b){return b instanceof Promise?b:mn.thenable(b)?new Promise((v,k)=>{b.then(w=>v(w),w=>k(w))}):Promise.resolve(b)}let m,h,T,_={listen:()=>i.listen(),sendRequest:(b,...v)=>i.sendRequest(mn.string(b)?b:b.method,...v),onRequest:(b,v)=>i.onRequest(b,v),sendNotification:(b,v)=>{let k=mn.string(b)?b:b.method;return i.sendNotification(k,v)},onNotification:(b,v)=>i.onNotification(b,v),onProgress:i.onProgress,sendProgress:i.sendProgress,onInitialize:b=>(h=b,{dispose:()=>{h=void 0}}),onInitialized:b=>i.onNotification(K.InitializedNotification.type,b),onShutdown:b=>(m=b,{dispose:()=>{m=void 0}}),onExit:b=>(T=b,{dispose:()=>{T=void 0}}),get console(){return n},get telemetry(){return o},get tracer(){return s},get client(){return a},get window(){return c},get workspace(){return l},get languages(){return u},get notebooks(){return d},onDidChangeConfiguration:b=>i.onNotification(K.DidChangeConfigurationNotification.type,b),onDidChangeWatchedFiles:b=>i.onNotification(K.DidChangeWatchedFilesNotification.type,b),__textDocumentSync:void 0,onDidOpenTextDocument:b=>i.onNotification(K.DidOpenTextDocumentNotification.type,b),onDidChangeTextDocument:b=>i.onNotification(K.DidChangeTextDocumentNotification.type,b),onDidCloseTextDocument:b=>i.onNotification(K.DidCloseTextDocumentNotification.type,b),onWillSaveTextDocument:b=>i.onNotification(K.WillSaveTextDocumentNotification.type,b),onWillSaveTextDocumentWaitUntil:b=>i.onRequest(K.WillSaveTextDocumentWaitUntilRequest.type,b),onDidSaveTextDocument:b=>i.onNotification(K.DidSaveTextDocumentNotification.type,b),sendDiagnostics:b=>i.sendNotification(K.PublishDiagnosticsNotification.type,b),onHover:b=>i.onRequest(K.HoverRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onCompletion:b=>i.onRequest(K.CompletionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCompletionResolve:b=>i.onRequest(K.CompletionResolveRequest.type,b),onSignatureHelp:b=>i.onRequest(K.SignatureHelpRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDeclaration:b=>i.onRequest(K.DeclarationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDefinition:b=>i.onRequest(K.DefinitionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onTypeDefinition:b=>i.onRequest(K.TypeDefinitionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onImplementation:b=>i.onRequest(K.ImplementationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onReferences:b=>i.onRequest(K.ReferencesRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentHighlight:b=>i.onRequest(K.DocumentHighlightRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentSymbol:b=>i.onRequest(K.DocumentSymbolRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbol:b=>i.onRequest(K.WorkspaceSymbolRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onWorkspaceSymbolResolve:b=>i.onRequest(K.WorkspaceSymbolResolveRequest.type,b),onCodeAction:b=>i.onRequest(K.CodeActionRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeActionResolve:b=>i.onRequest(K.CodeActionResolveRequest.type,(v,k)=>b(v,k)),onCodeLens:b=>i.onRequest(K.CodeLensRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onCodeLensResolve:b=>i.onRequest(K.CodeLensResolveRequest.type,(v,k)=>b(v,k)),onDocumentFormatting:b=>i.onRequest(K.DocumentFormattingRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDocumentRangeFormatting:b=>i.onRequest(K.DocumentRangeFormattingRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onDocumentOnTypeFormatting:b=>i.onRequest(K.DocumentOnTypeFormattingRequest.type,(v,k)=>b(v,k)),onRenameRequest:b=>i.onRequest(K.RenameRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),onPrepareRename:b=>i.onRequest(K.PrepareRenameRequest.type,(v,k)=>b(v,k)),onDocumentLinks:b=>i.onRequest(K.DocumentLinkRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onDocumentLinkResolve:b=>i.onRequest(K.DocumentLinkResolveRequest.type,(v,k)=>b(v,k)),onDocumentColor:b=>i.onRequest(K.DocumentColorRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onColorPresentation:b=>i.onRequest(K.ColorPresentationRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onFoldingRanges:b=>i.onRequest(K.FoldingRangeRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onSelectionRanges:b=>i.onRequest(K.SelectionRangeRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),(0,me.attachPartialResult)(i,v))),onExecuteCommand:b=>i.onRequest(K.ExecuteCommandRequest.type,(v,k)=>b(v,k,(0,me.attachWorkDone)(i,v),void 0)),dispose:()=>i.dispose()};for(let b of f)b.attach(_);return i.onRequest(K.InitializeRequest.type,b=>{e.initialize(b),mn.string(b.trace)&&(s.trace=K.Trace.fromString(b.trace));for(let v of f)v.initialize(b.capabilities);if(h){let v=h(b,new K.CancellationTokenSource().token,(0,me.attachWorkDone)(i,b),void 0);return p(v).then(k=>{if(k instanceof K.ResponseError)return k;let w=k;w||(w={capabilities:{}});let H=w.capabilities;H||(H={},w.capabilities=H),H.textDocumentSync===void 0||H.textDocumentSync===null?H.textDocumentSync=mn.number(_.__textDocumentSync)?_.__textDocumentSync:K.TextDocumentSyncKind.None:!mn.number(H.textDocumentSync)&&!mn.number(H.textDocumentSync.change)&&(H.textDocumentSync.change=mn.number(_.__textDocumentSync)?_.__textDocumentSync:K.TextDocumentSyncKind.None);for(let O of f)O.fillServerCapabilities(H);return w})}else{let v={capabilities:{textDocumentSync:K.TextDocumentSyncKind.None}};for(let k of f)k.fillServerCapabilities(v.capabilities);return v}}),i.onRequest(K.ShutdownRequest.type,()=>{if(e.shutdownReceived=!0,m)return m(new K.CancellationTokenSource().token)}),i.onNotification(K.ExitNotification.type,()=>{try{T&&T()}finally{e.shutdownReceived?e.exit(0):e.exit(1)}}),i.onNotification(K.SetTraceNotification.type,b=>{s.trace=K.Trace.fromString(b.value)}),_}ze.createConnection=Xj});var RE=R(qr=>{"use strict";Object.defineProperty(qr,"__esModule",{value:!0});qr.resolveModulePath=qr.FileSystem=qr.resolveGlobalYarnPath=qr.resolveGlobalNodePath=qr.resolve=qr.uriToFilePath=void 0;var Jj=require("url"),jn=require("path"),Xy=require("fs"),eT=require("child_process");function Qj(t){let e=Jj.parse(t);if(e.protocol!=="file:"||!e.path)return;let r=e.path.split("/");for(var n=0,i=r.length;n<i;n++)r[n]=decodeURIComponent(r[n]);if(process.platform==="win32"&&r.length>1){let s=r[0],o=r[1];s.length===0&&o.length>1&&o[1]===":"&&r.shift()}return jn.normalize(r.join("/"))}qr.uriToFilePath=Qj;function Jy(){return process.platform==="win32"}function kf(t,e,r,n){let i="NODE_PATH",s=["var p = process;","p.on('message',function(m){","if(m.c==='e'){","p.exit(0);","}","else if(m.c==='rs'){","try{","var r=require.resolve(m.a);","p.send({c:'r',s:true,r:r});","}","catch(err){","p.send({c:'r',s:false});","}","}","});"].join("");return new Promise((o,a)=>{let c=process.env,l=Object.create(null);Object.keys(c).forEach(u=>l[u]=c[u]),e&&Xy.existsSync(e)&&(l[i]?l[i]=e+jn.delimiter+l[i]:l[i]=e,n&&n(`NODE_PATH value is: ${l[i]}`)),l.ELECTRON_RUN_AS_NODE="1";try{let u=(0,eT.fork)("",[],{cwd:r,env:l,execArgv:["-e",s]});if(u.pid===void 0){a(new Error(`Starting process to resolve node module ${t} failed`));return}u.on("error",f=>{a(f)}),u.on("message",f=>{f.c==="r"&&(u.send({c:"e"}),f.s?o(f.r):a(new Error(`Failed to resolve module: ${t}`)))});let d={c:"rs",a:t};u.send(d)}catch(u){a(u)}})}qr.resolve=kf;function Qy(t){let e="npm",r=Object.create(null);Object.keys(process.env).forEach(s=>r[s]=process.env[s]),r.NO_UPDATE_NOTIFIER="true";let n={encoding:"utf8",env:r};Jy()&&(e="npm.cmd",n.shell=!0);let i=()=>{};try{process.on("SIGPIPE",i);let s=(0,eT.spawnSync)(e,["config","get","prefix"],n).stdout;if(!s){t&&t("'npm config get prefix' didn't return a value.");return}let o=s.trim();return t&&t(`'npm config get prefix' value is: ${o}`),o.length>0?Jy()?jn.join(o,"node_modules"):jn.join(o,"lib","node_modules"):void 0}catch{return}finally{process.removeListener("SIGPIPE",i)}}qr.resolveGlobalNodePath=Qy;function Zj(t){let e="yarn",r={encoding:"utf8"};Jy()&&(e="yarn.cmd",r.shell=!0);let n=()=>{};try{process.on("SIGPIPE",n);let i=(0,eT.spawnSync)(e,["global","dir","--json"],r),s=i.stdout;if(!s){t&&(t("'yarn global dir' didn't return a value."),i.stderr&&t(i.stderr));return}let o=s.trim().split(/\r?\n/);for(let a of o)try{let c=JSON.parse(a);if(c.type==="log")return jn.join(c.data,"node_modules")}catch{}return}catch{return}finally{process.removeListener("SIGPIPE",n)}}qr.resolveGlobalYarnPath=Zj;var Zy;(function(t){let e;function r(){return e!==void 0||(process.platform==="win32"?e=!1:e=!Xy.existsSync(__filename.toUpperCase())||!Xy.existsSync(__filename.toLowerCase())),e}t.isCaseSensitive=r;function n(i,s){return r()?jn.normalize(s).indexOf(jn.normalize(i))===0:jn.normalize(s).toLowerCase().indexOf(jn.normalize(i).toLowerCase())===0}t.isParent=n})(Zy||(qr.FileSystem=Zy={}));function eU(t,e,r,n){return r?(jn.isAbsolute(r)||(r=jn.join(t,r)),kf(e,r,r,n).then(i=>Zy.isParent(r,i)?i:Promise.reject(new Error(`Failed to load ${e} from node path location.`))).then(void 0,i=>kf(e,Qy(n),t,n))):kf(e,Qy(n),t,n)}qr.resolveModulePath=eU});var tT=R((u8,PE)=>{"use strict";PE.exports=It()});var EE=R(Nf=>{"use strict";Object.defineProperty(Nf,"__esModule",{value:!0});Nf.InlineCompletionFeature=void 0;var tU=It(),rU=t=>class extends t{get inlineCompletion(){return{on:e=>this.connection.onRequest(tU.InlineCompletionRequest.type,(r,n)=>e(r,n,this.attachWorkDoneProgress(r)))}}};Nf.InlineCompletionFeature=rU});var DE=R(pr=>{"use strict";var nU=pr&&pr.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),CE=pr&&pr.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&nU(e,t,r)};Object.defineProperty(pr,"__esModule",{value:!0});pr.ProposedFeatures=pr.NotebookDocuments=pr.TextDocuments=pr.SemanticTokensBuilder=void 0;var iU=qy();Object.defineProperty(pr,"SemanticTokensBuilder",{enumerable:!0,get:function(){return iU.SemanticTokensBuilder}});var sU=EE();CE(It(),pr);var oU=jy();Object.defineProperty(pr,"TextDocuments",{enumerable:!0,get:function(){return oU.TextDocuments}});var aU=Hy();Object.defineProperty(pr,"NotebookDocuments",{enumerable:!0,get:function(){return aU.NotebookDocuments}});CE(Yy(),pr);var wE;(function(t){t.all={__brand:"features",languages:sU.InlineCompletionFeature}})(wE||(pr.ProposedFeatures=wE={}))});var j=R(gn=>{"use strict";var cU=gn&&gn.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),xE=gn&&gn.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&cU(e,t,r)};Object.defineProperty(gn,"__esModule",{value:!0});gn.createConnection=gn.Files=void 0;var AE=require("node:util"),rT=ld(),lU=Yy(),xc=RE(),Ys=tT();xE(tT(),gn);xE(DE(),gn);var IE;(function(t){t.uriToFilePath=xc.uriToFilePath,t.resolveGlobalNodePath=xc.resolveGlobalNodePath,t.resolveGlobalYarnPath=xc.resolveGlobalYarnPath,t.resolve=xc.resolve,t.resolveModulePath=xc.resolveModulePath})(IE||(gn.Files=IE={}));var OE;function Rf(){if(OE!==void 0)try{OE.end()}catch{}}var ta=!1,ME;function uU(){let t="--clientProcessId";function e(r){try{let n=parseInt(r);isNaN(n)||(ME=setInterval(()=>{try{process.kill(n,0)}catch{Rf(),process.exit(ta?0:1)}},3e3))}catch{}}for(let r=2;r<process.argv.length;r++){let n=process.argv[r];if(n===t&&r+1<process.argv.length){e(process.argv[r+1]);return}else{let i=n.split("=");i[0]===t&&e(i[1])}}}uU();var dU={initialize:t=>{let e=t.processId;rT.number(e)&&ME===void 0&&setInterval(()=>{try{process.kill(e,0)}catch{process.exit(ta?0:1)}},3e3)},get shutdownReceived(){return ta},set shutdownReceived(t){ta=t},exit:t=>{Rf(),process.exit(t)}};function fU(t,e,r,n){let i,s,o,a;return t!==void 0&&t.__brand==="features"&&(i=t,t=e,e=r,r=n),Ys.ConnectionStrategy.is(t)||Ys.ConnectionOptions.is(t)?a=t:(s=t,o=e,a=r),pU(s,o,a,i)}gn.createConnection=fU;function pU(t,e,r,n){let i=!1;if(!t&&!e&&process.argv.length>2){let c,l,u=process.argv.slice(2);for(let d=0;d<u.length;d++){let f=u[d];if(f==="--node-ipc"){t=new Ys.IPCMessageReader(process),e=new Ys.IPCMessageWriter(process);break}else if(f==="--stdio"){i=!0,t=process.stdin,e=process.stdout;break}else if(f==="--socket"){c=parseInt(u[d+1]);break}else if(f==="--pipe"){l=u[d+1];break}else{var s=f.split("=");if(s[0]==="--socket"){c=parseInt(s[1]);break}else if(s[0]==="--pipe"){l=s[1];break}}}if(c){let d=(0,Ys.createServerSocketTransport)(c);t=d[0],e=d[1]}else if(l){let d=(0,Ys.createServerPipeTransport)(l);t=d[0],e=d[1]}}var o="Use arguments of createConnection or set command line parameters: '--node-ipc', '--stdio' or '--socket={number}'";if(!t)throw new Error("Connection input stream is not set. "+o);if(!e)throw new Error("Connection output stream is not set. "+o);if(rT.func(t.read)&&rT.func(t.on)){let c=t;c.on("end",()=>{Rf(),process.exit(ta?0:1)}),c.on("close",()=>{Rf(),process.exit(ta?0:1)})}let a=c=>{let l=(0,Ys.createProtocolConnection)(t,e,c,r);return i&&hU(c),l};return(0,lU.createConnection)(a,dU,n)}function hU(t){function e(n){return n.map(i=>typeof i=="string"?i:(0,AE.inspect)(i)).join(" ")}let r=new Map;console.assert=function(i,...s){if(!i)if(s.length===0)t.error("Assertion failed");else{let[o,...a]=s;t.error(`Assertion failed: ${o} ${e(a)}`)}},console.count=function(i="default"){let s=String(i),o=r.get(s)??0;o+=1,r.set(s,o),t.log(`${s}: ${s}`)},console.countReset=function(i){i===void 0?r.clear():r.delete(String(i))},console.debug=function(...i){t.log(e(i))},console.dir=function(i,s){t.log((0,AE.inspect)(i,s))},console.log=function(...i){t.log(e(i))},console.error=function(...i){t.error(e(i))},console.trace=function(...i){let s=new Error().stack.replace(/(.+\n){2}/,""),o="Trace";i.length!==0&&(o+=`: ${e(i)}`),t.log(`${o}
|
|
37
37
|
${s}`)},console.warn=function(...i){t.warn(e(i))}}});var qE=R((m8,LE)=>{"use strict";LE.exports=j()});var qe=R(or=>{"use strict";var lv=Symbol.for("yaml.alias"),mx=Symbol.for("yaml.document"),Th=Symbol.for("yaml.map"),gx=Symbol.for("yaml.pair"),uv=Symbol.for("yaml.scalar"),vh=Symbol.for("yaml.seq"),ji=Symbol.for("yaml.node.type"),fz=t=>!!t&&typeof t=="object"&&t[ji]===lv,pz=t=>!!t&&typeof t=="object"&&t[ji]===mx,hz=t=>!!t&&typeof t=="object"&&t[ji]===Th,mz=t=>!!t&&typeof t=="object"&&t[ji]===gx,yx=t=>!!t&&typeof t=="object"&&t[ji]===uv,gz=t=>!!t&&typeof t=="object"&&t[ji]===vh;function Tx(t){if(t&&typeof t=="object")switch(t[ji]){case Th:case vh:return!0}return!1}function yz(t){if(t&&typeof t=="object")switch(t[ji]){case lv:case Th:case uv:case vh:return!0}return!1}var Tz=t=>(yx(t)||Tx(t))&&!!t.anchor;or.ALIAS=lv;or.DOC=mx;or.MAP=Th;or.NODE_TYPE=ji;or.PAIR=gx;or.SCALAR=uv;or.SEQ=vh;or.hasAnchor=Tz;or.isAlias=fz;or.isCollection=Tx;or.isDocument=pz;or.isMap=hz;or.isNode=yz;or.isPair=mz;or.isScalar=yx;or.isSeq=gz});var Dl=R(dv=>{"use strict";var zt=qe(),zr=Symbol("break visit"),vx=Symbol("skip children"),Ti=Symbol("remove node");function bh(t,e){let r=bx(e);zt.isDocument(t)?ja(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):ja(null,t,r,Object.freeze([]))}bh.BREAK=zr;bh.SKIP=vx;bh.REMOVE=Ti;function ja(t,e,r,n){let i=Sx(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return _x(t,n,i),ja(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=ja(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===zr)return zr;o===Ti&&(e.items.splice(s,1),s-=1)}}}else if(zt.isPair(e)){n=Object.freeze(n.concat(e));let s=ja("key",e.key,r,n);if(s===zr)return zr;s===Ti&&(e.key=null);let o=ja("value",e.value,r,n);if(o===zr)return zr;o===Ti&&(e.value=null)}}return i}async function Sh(t,e){let r=bx(e);zt.isDocument(t)?await Ua(null,t.contents,r,Object.freeze([t]))===Ti&&(t.contents=null):await Ua(null,t,r,Object.freeze([]))}Sh.BREAK=zr;Sh.SKIP=vx;Sh.REMOVE=Ti;async function Ua(t,e,r,n){let i=await Sx(t,e,r,n);if(zt.isNode(i)||zt.isPair(i))return _x(t,n,i),Ua(t,i,r,n);if(typeof i!="symbol"){if(zt.isCollection(e)){n=Object.freeze(n.concat(e));for(let s=0;s<e.items.length;++s){let o=await Ua(s,e.items[s],r,n);if(typeof o=="number")s=o-1;else{if(o===zr)return zr;o===Ti&&(e.items.splice(s,1),s-=1)}}}else if(zt.isPair(e)){n=Object.freeze(n.concat(e));let s=await Ua("key",e.key,r,n);if(s===zr)return zr;s===Ti&&(e.key=null);let o=await Ua("value",e.value,r,n);if(o===zr)return zr;o===Ti&&(e.value=null)}}return i}function bx(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function Sx(t,e,r,n){if(typeof r=="function")return r(t,e,n);if(zt.isMap(e))return r.Map?.(t,e,n);if(zt.isSeq(e))return r.Seq?.(t,e,n);if(zt.isPair(e))return r.Pair?.(t,e,n);if(zt.isScalar(e))return r.Scalar?.(t,e,n);if(zt.isAlias(e))return r.Alias?.(t,e,n)}function _x(t,e,r){let n=e[e.length-1];if(zt.isCollection(n))n.items[t]=r;else if(zt.isPair(n))t==="key"?n.key=r:n.value=r;else if(zt.isDocument(n))n.contents=r;else{let i=zt.isAlias(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}dv.visit=bh;dv.visitAsync=Sh});var fv=R(Nx=>{"use strict";var kx=qe(),vz=Dl(),bz={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Sz=t=>t.replace(/[!,[\]{}]/g,e=>bz[e]),Al=class t{constructor(e,r){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,r)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,r){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(r(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;let[s,o]=n;return this.tags[s]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return r(0,"%YAML directive should contain exactly one part"),!1;let[s]=n;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let o=/^\d+\.\d+$/.test(s);return r(6,`Unsupported YAML version ${s}`,o),!1}}default:return r(0,`Unknown directive ${i}`,!0),!1}}tagName(e,r){if(e==="!")return"!";if(e[0]!=="!")return r(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(r(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&r("Verbatim tags must end with a >"),o)}let[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||r(`The ${e} tag has no suffix`);let s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(o){return r(String(o)),null}return n==="!"?e:(r(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[r,n]of Object.entries(this.tags))if(e.startsWith(n))return r+Sz(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let r=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags),i;if(e&&n.length>0&&kx.isNode(e.contents)){let s={};vz.visit(e.contents,(o,a)=>{kx.isNode(a)&&a.tag&&(s[a.tag]=!0)}),i=Object.keys(s)}else i=[];for(let[s,o]of n)s==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&r.push(`%TAG ${s} ${o}`);return r.join(`
|
|
38
38
|
`)}};Al.defaultYaml={explicit:!1,version:"1.2"};Al.defaultTags={"!!":"tag:yaml.org,2002:"};Nx.Directives=Al});var _h=R(Il=>{"use strict";var Rx=qe(),_z=Dl();function kz(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let r=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(r)}return!0}function Px(t){let e=new Set;return _z.visit(t,{Value(r,n){n.anchor&&e.add(n.anchor)}}),e}function Ex(t,e){for(let r=1;;++r){let n=`${t}${r}`;if(!e.has(n))return n}}function Nz(t,e){let r=[],n=new Map,i=null;return{onAnchor:s=>{r.push(s),i||(i=Px(t));let o=Ex(e,i);return i.add(o),o},setAnchors:()=>{for(let s of r){let o=n.get(s);if(typeof o=="object"&&o.anchor&&(Rx.isScalar(o.node)||Rx.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:n}}Il.anchorIsValid=kz;Il.anchorNames=Px;Il.createNodeAnchors=Nz;Il.findNewAnchor=Ex});var pv=R(wx=>{"use strict";function Ol(t,e,r,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,s=n.length;i<s;++i){let o=n[i],a=Ol(t,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(let i of Array.from(n.keys())){let s=n.get(i),o=Ol(t,n,i,s);o===void 0?n.delete(i):o!==s&&n.set(i,o)}else if(n instanceof Set)for(let i of Array.from(n)){let s=Ol(t,n,i,i);s===void 0?n.delete(i):s!==i&&(n.delete(i),n.add(s))}else for(let[i,s]of Object.entries(n)){let o=Ol(t,n,i,s);o===void 0?delete n[i]:o!==s&&(n[i]=o)}return t.call(e,r,n)}wx.applyReviver=Ol});var vs=R(Dx=>{"use strict";var Rz=qe();function Cx(t,e,r){if(Array.isArray(t))return t.map((n,i)=>Cx(n,String(i),r));if(t&&typeof t.toJSON=="function"){if(!r||!Rz.hasAnchor(t))return t.toJSON(e,r);let n={aliasCount:0,count:1,res:void 0};r.anchors.set(t,n),r.onCreate=s=>{n.res=s,delete r.onCreate};let i=t.toJSON(e,r);return r.onCreate&&r.onCreate(i),i}return typeof t=="bigint"&&!r?.keep?Number(t):t}Dx.toJS=Cx});var kh=R(Ix=>{"use strict";var Pz=pv(),Ax=qe(),Ez=vs(),hv=class{constructor(e){Object.defineProperty(this,Ax.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:r,maxAliasCount:n,onAnchor:i,reviver:s}={}){if(!Ax.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=Ez.toJS(this,"",o);if(typeof i=="function")for(let{count:c,res:l}of o.anchors.values())i(l,c);return typeof s=="function"?Pz.applyReviver(s,{"":a},"",a):a}};Ix.NodeBase=hv});var xl=R(xx=>{"use strict";var wz=_h(),Ox=Dl(),Nh=qe(),Cz=kh(),Dz=vs(),mv=class extends Cz.NodeBase{constructor(e){super(Nh.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let r;return Ox.visit(e,{Node:(n,i)=>{if(i===this)return Ox.visit.BREAK;i.anchor===this.source&&(r=i)}}),r}toJSON(e,r){if(!r)return{source:this.source};let{anchors:n,doc:i,maxAliasCount:s}=r,o=this.resolve(i);if(!o){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=n.get(o);if(a||(Dz.toJS(o,null,r),a=n.get(o)),!a||a.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Rh(i,o,n)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,r,n){let i=`*${this.source}`;if(e){if(wz.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${i} `}return i}};function Rh(t,e,r){if(Nh.isAlias(e)){let n=e.resolve(t),i=r&&n&&r.get(n);return i?i.count*i.aliasCount:0}else if(Nh.isCollection(e)){let n=0;for(let i of e.items){let s=Rh(t,i,r);s>n&&(n=s)}return n}else if(Nh.isPair(e)){let n=Rh(t,e.key,r),i=Rh(t,e.value,r);return Math.max(n,i)}return 1}xx.Alias=mv});var jt=R(gv=>{"use strict";var Az=qe(),Iz=kh(),Oz=vs(),xz=t=>!t||typeof t!="function"&&typeof t!="object",bs=class extends Iz.NodeBase{constructor(e){super(Az.SCALAR),this.value=e}toJSON(e,r){return r?.keep?this.value:Oz.toJS(this.value,e,r)}toString(){return String(this.value)}};bs.BLOCK_FOLDED="BLOCK_FOLDED";bs.BLOCK_LITERAL="BLOCK_LITERAL";bs.PLAIN="PLAIN";bs.QUOTE_DOUBLE="QUOTE_DOUBLE";bs.QUOTE_SINGLE="QUOTE_SINGLE";gv.Scalar=bs;gv.isScalarValue=xz});var Ml=R(Lx=>{"use strict";var Mz=xl(),oo=qe(),Mx=jt(),Lz="tag:yaml.org,2002:";function qz(t,e,r){if(e){let n=r.filter(s=>s.tag===e),i=n.find(s=>!s.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return r.find(n=>n.identify?.(t)&&!n.format)}function $z(t,e,r){if(oo.isDocument(t)&&(t=t.contents),oo.isNode(t))return t;if(oo.isPair(t)){let d=r.schema[oo.MAP].createNode?.(r.schema,null,r);return d.items.push(t),d}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:n,onAnchor:i,onTagObj:s,schema:o,sourceObjects:a}=r,c;if(n&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor||(c.anchor=i(t)),new Mz.Alias(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Lz+e.slice(2));let l=qz(t,e,o.tags);if(!l){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let d=new Mx.Scalar(t);return c&&(c.node=d),d}l=t instanceof Map?o[oo.MAP]:Symbol.iterator in Object(t)?o[oo.SEQ]:o[oo.MAP]}s&&(s(l),delete r.onTagObj);let u=l?.createNode?l.createNode(r.schema,t,r):typeof l?.nodeClass?.from=="function"?l.nodeClass.from(r.schema,t,r):new Mx.Scalar(t);return e?u.tag=e:l.default||(u.tag=l.tag),c&&(c.node=u),u}Lx.createNode=$z});var Eh=R(Ph=>{"use strict";var Fz=Ml(),vi=qe(),Bz=kh();function yv(t,e,r){let n=r;for(let i=e.length-1;i>=0;--i){let s=e[i];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let o=[];o[s]=n,n=o}else n=new Map([[s,n]])}return Fz.createNode(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var qx=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Tv=class extends Bz.NodeBase{constructor(e,r){super(e),Object.defineProperty(this,"schema",{value:r,configurable:!0,enumerable:!1,writable:!0})}clone(e){let r=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(r.schema=e),r.items=r.items.map(n=>vi.isNode(n)||vi.isPair(n)?n.clone(e):n),this.range&&(r.range=this.range.slice()),r}addIn(e,r){if(qx(e))this.add(r);else{let[n,...i]=e,s=this.get(n,!0);if(vi.isCollection(s))s.addIn(i,r);else if(s===void 0&&this.schema)this.set(n,yv(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){let[r,...n]=e;if(n.length===0)return this.delete(r);let i=this.get(r,!0);if(vi.isCollection(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${r}. Remaining path: ${n}`)}getIn(e,r){let[n,...i]=e,s=this.get(n,!0);return i.length===0?!r&&vi.isScalar(s)?s.value:s:vi.isCollection(s)?s.getIn(i,r):void 0}hasAllNullValues(e){return this.items.every(r=>{if(!vi.isPair(r))return!1;let n=r.value;return n==null||e&&vi.isScalar(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[r,...n]=e;if(n.length===0)return this.has(r);let i=this.get(r,!0);return vi.isCollection(i)?i.hasIn(n):!1}setIn(e,r){let[n,...i]=e;if(i.length===0)this.set(n,r);else{let s=this.get(n,!0);if(vi.isCollection(s))s.setIn(i,r);else if(s===void 0&&this.schema)this.set(n,yv(this.schema,i,r));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}};Ph.Collection=Tv;Ph.collectionFromPath=yv;Ph.isEmptyPath=qx});var Ll=R(wh=>{"use strict";var jz=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function vv(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Uz=(t,e,r)=>t.endsWith(`
|
|
39
39
|
`)?vv(r,e):r.includes(`
|
|
@@ -44,7 +44,7 @@ ${s}`)},console.warn=function(...i){t.warn(e(i))}}});var qE=R((m8,LE)=>{"use str
|
|
|
44
44
|
`&&k!==" "&&(f=h)}if(h>=d)if(f)l.push(f),d=f+c,f=void 0;else if(r===Ch){for(;p===" "||p===" ";)p=v,v=t[h+=1],m=!0;let k=h>_+1?h-2:T-1;if(u[k])return t;l.push(k),u[k]=!0,d=k+c,f=void 0}else m=!0}p=v}if(m&&a&&a(),l.length===0)return t;o&&o();let b=t.slice(0,l[0]);for(let v=0;v<l.length;++v){let k=l[v],w=l[v+1]||t.length;k===0?b=`
|
|
45
45
|
${e}${t.slice(0,w)}`:(r===Ch&&u[k]&&(b+=`${t[k]}\\`),b+=`
|
|
46
46
|
${e}${t.slice(k+1,w)}`)}return b}function $x(t,e,r){let n=e,i=e+1,s=t[i];for(;s===" "||s===" ";)if(e<i+r)s=t[++e];else{do s=t[++e];while(s&&s!==`
|
|
47
|
-
`);n=e,i=e+1,s=t[i]}return n}ql.FOLD_BLOCK=bv;ql.FOLD_FLOW=Hz;ql.FOLD_QUOTED=Ch;ql.foldFlowLines=Vz});var Fl=R(Bx=>{"use strict";var
|
|
47
|
+
`);n=e,i=e+1,s=t[i]}return n}ql.FOLD_BLOCK=bv;ql.FOLD_FLOW=Hz;ql.FOLD_QUOTED=Ch;ql.foldFlowLines=Vz});var Fl=R(Bx=>{"use strict";var Qn=jt(),Ss=Fx(),Ah=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),Ih=t=>/^(%|---|\.\.\.)/m.test(t);function zz(t,e,r){if(!e||e<0)return!1;let n=e-r,i=t.length;if(i<=n)return!1;for(let s=0,o=0;s<i;++s)if(t[s]===`
|
|
48
48
|
`){if(s-o>n)return!0;if(o=s+1,i-o<=n)return!1}return!0}function $l(t,e){let r=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return r;let{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(Ih(t)?" ":""),o="",a=0;for(let c=0,l=r[c];l;l=r[++c])if(l===" "&&r[c+1]==="\\"&&r[c+2]==="n"&&(o+=r.slice(a,c)+"\\ ",c+=1,a=c,l="\\"),l==="\\")switch(r[c+1]){case"u":{o+=r.slice(a,c);let u=r.substr(c+2,4);switch(u){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:u.substr(0,2)==="00"?o+="\\x"+u.substr(2):o+=r.substr(c,6)}c+=5,a=c+1}break;case"n":if(n||r[c+2]==='"'||r.length<i)c+=1;else{for(o+=r.slice(a,c)+`
|
|
49
49
|
|
|
50
50
|
`;r[c+2]==="\\"&&r[c+3]==="n"&&r[c+4]!=='"';)o+=`
|
|
@@ -53,20 +53,20 @@ ${e}${t.slice(k+1,w)}`)}return b}function $x(t,e,r){let n=e,i=e+1,s=t[i];for(;s=
|
|
|
53
53
|
${r}`)+"'";return e.implicitKey?n:Ss.foldFlowLines(n,r,Ss.FOLD_FLOW,Ah(e,!1))}function Ha(t,e){let{singleQuote:r}=e.options,n;if(r===!1)n=$l;else{let i=t.includes('"'),s=t.includes("'");i&&!s?n=Sv:s&&!i?n=$l:n=r?Sv:$l}return n(t,e)}var _v;try{_v=new RegExp(`(^|(?<!
|
|
54
54
|
))
|
|
55
55
|
+(?!
|
|
56
|
-
|$)`,"g")}catch{_v=/\n+(?!\n|$)/g}function Dh({comment:t,type:e,value:r},n,i,s){let{blockQuote:o,commentString:a,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(r)||/^\s*$/.test(r))return Ha(r,n);let l=n.indent||(n.forceBlockIndent||Ih(r)?" ":""),u=o==="literal"?!0:o==="folded"||e===
|
|
56
|
+
|$)`,"g")}catch{_v=/\n+(?!\n|$)/g}function Dh({comment:t,type:e,value:r},n,i,s){let{blockQuote:o,commentString:a,lineWidth:c}=n.options;if(!o||/\n[\t ]+$/.test(r)||/^\s*$/.test(r))return Ha(r,n);let l=n.indent||(n.forceBlockIndent||Ih(r)?" ":""),u=o==="literal"?!0:o==="folded"||e===Qn.Scalar.BLOCK_FOLDED?!1:e===Qn.Scalar.BLOCK_LITERAL?!0:!zz(r,c,l.length);if(!r)return u?`|
|
|
57
57
|
`:`>
|
|
58
58
|
`;let d,f;for(f=r.length;f>0;--f){let w=r[f-1];if(w!==`
|
|
59
59
|
`&&w!==" "&&w!==" ")break}let p=r.substring(f),m=p.indexOf(`
|
|
60
60
|
`);m===-1?d="-":r===p||m!==p.length-1?(d="+",s&&s()):d="",p&&(r=r.slice(0,-p.length),p[p.length-1]===`
|
|
61
61
|
`&&(p=p.slice(0,-1)),p=p.replace(_v,`$&${l}`));let h=!1,T,_=-1;for(T=0;T<r.length;++T){let w=r[T];if(w===" ")h=!0;else if(w===`
|
|
62
62
|
`)_=T;else break}let b=r.substring(0,_<T?_+1:T);b&&(r=r.substring(b.length),b=b.replace(/\n+/g,`$&${l}`));let k=(h?l?"2":"1":"")+d;if(t&&(k+=" "+a(t.replace(/ ?[\r\n]+/g," ")),i&&i()),!u){let w=r.replace(/\n+/g,`
|
|
63
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,O=Ah(n,!0);o!=="folded"&&e!==
|
|
63
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${l}`),H=!1,O=Ah(n,!0);o!=="folded"&&e!==Qn.Scalar.BLOCK_FOLDED&&(O.onOverflow=()=>{H=!0});let B=Ss.foldFlowLines(`${b}${w}${p}`,l,Ss.FOLD_BLOCK,O);if(!H)return`>${k}
|
|
64
64
|
${l}${B}`}return r=r.replace(/\n+/g,`$&${l}`),`|${k}
|
|
65
65
|
${l}${b}${r}${p}`}function Wz(t,e,r,n){let{type:i,value:s}=t,{actualString:o,implicitKey:a,indent:c,indentStep:l,inFlow:u}=e;if(a&&s.includes(`
|
|
66
66
|
`)||u&&/[[\]{},]/.test(s))return Ha(s,e);if(!s||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||u||!s.includes(`
|
|
67
|
-
`)?Ha(s,e):Dh(t,e,r,n);if(!a&&!u&&i!==
|
|
67
|
+
`)?Ha(s,e):Dh(t,e,r,n);if(!a&&!u&&i!==Qn.Scalar.PLAIN&&s.includes(`
|
|
68
68
|
`))return Dh(t,e,r,n);if(Ih(s)){if(c==="")return e.forceBlockIndent=!0,Dh(t,e,r,n);if(a&&c===l)return Ha(s,e)}let d=s.replace(/\n+/g,`$&
|
|
69
|
-
${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Ha(s,e)}return a?d:Ss.foldFlowLines(d,c,Ss.FOLD_FLOW,Ah(e,!1))}function Gz(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==
|
|
69
|
+
${c}`);if(o){let f=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(d),{compat:p,tags:m}=e.doc.schema;if(m.some(f)||p?.some(f))return Ha(s,e)}return a?d:Ss.foldFlowLines(d,c,Ss.FOLD_FLOW,Ah(e,!1))}function Gz(t,e,r,n){let{implicitKey:i,inFlow:s}=e,o=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==Qn.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Qn.Scalar.QUOTE_DOUBLE);let c=u=>{switch(u){case Qn.Scalar.BLOCK_FOLDED:case Qn.Scalar.BLOCK_LITERAL:return i||s?Ha(o.value,e):Dh(o,e,r,n);case Qn.Scalar.QUOTE_DOUBLE:return $l(o.value,e);case Qn.Scalar.QUOTE_SINGLE:return Sv(o.value,e);case Qn.Scalar.PLAIN:return Wz(o,e,r,n);default:return null}},l=c(a);if(l===null){let{defaultKeyType:u,defaultStringType:d}=e.options,f=i&&u||d;if(l=c(f),l===null)throw new Error(`Unsupported default string type ${f}`)}return l}Bx.stringifyString=Gz});var Bl=R(kv=>{"use strict";var Kz=_h(),_s=qe(),Yz=Ll(),Xz=Fl();function Jz(t,e){let r=Object.assign({blockQuote:!0,commentString:Yz.stringifyComment,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trueStr:"true",verifyAliasOrder:!0},t.schema.toStringOptions,e),n;switch(r.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:t,flowCollectionPadding:r.flowCollectionPadding?" ":"",indent:"",indentStep:typeof r.indent=="number"?" ".repeat(r.indent):" ",inFlow:n,options:r}}function Qz(t,e){if(e.tag){let i=t.filter(s=>s.tag===e.tag);if(i.length>0)return i.find(s=>s.format===e.format)??i[0]}let r,n;if(_s.isScalar(e)){n=e.value;let i=t.filter(s=>s.identify?.(n));if(i.length>1){let s=i.filter(o=>o.test);s.length>0&&(i=s)}r=i.find(s=>s.format===e.format)??i.find(s=>!s.format)}else n=e,r=t.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!r){let i=n?.constructor?.name??typeof n;throw new Error(`Tag not resolved for ${i} value`)}return r}function Zz(t,e,{anchors:r,doc:n}){if(!n.directives)return"";let i=[],s=(_s.isScalar(t)||_s.isCollection(t))&&t.anchor;s&&Kz.anchorIsValid(s)&&(r.add(s),i.push(`&${s}`));let o=t.tag?t.tag:e.default?null:e.tag;return o&&i.push(n.directives.tagString(o)),i.join(" ")}function eW(t,e,r,n){if(_s.isPair(t))return t.toString(e,r,n);if(_s.isAlias(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let i,s=_s.isNode(t)?t:e.doc.createNode(t,{onTagObj:c=>i=c});i||(i=Qz(e.doc.schema.tags,s));let o=Zz(s,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof i.stringify=="function"?i.stringify(s,e,r,n):_s.isScalar(s)?Xz.stringifyString(s,e,r,n):s.toString(e,r,n);return o?_s.isScalar(s)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
70
70
|
${e.indent}${a}`:a}kv.createStringifyContext=Jz;kv.stringify=eW});var Vx=R(Hx=>{"use strict";var Ui=qe(),jx=jt(),Ux=Bl(),jl=Ll();function tW({key:t,value:e},r,n,i){let{allNullValues:s,doc:o,indent:a,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=r,f=Ui.isNode(t)&&t.comment||null;if(d){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(Ui.isCollection(t)||!Ui.isNode(t)&&typeof t=="object"){let O="With simple keys, collection cannot be used as a key value";throw new Error(O)}}let p=!d&&(!t||f&&e==null&&!r.inFlow||Ui.isCollection(t)||(Ui.isScalar(t)?t.type===jx.Scalar.BLOCK_FOLDED||t.type===jx.Scalar.BLOCK_LITERAL:typeof t=="object"));r=Object.assign({},r,{allNullValues:!1,implicitKey:!p&&(d||!s),indent:a+c});let m=!1,h=!1,T=Ux.stringify(t,r,()=>m=!0,()=>h=!0);if(!p&&!r.inFlow&&T.length>1024){if(d)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(r.inFlow){if(s||e==null)return m&&n&&n(),T===""?"?":p?`? ${T}`:T}else if(s&&!d||e==null&&p)return T=`? ${T}`,f&&!m?T+=jl.lineComment(T,r.indent,l(f)):h&&i&&i(),T;m&&(f=null),p?(f&&(T+=jl.lineComment(T,r.indent,l(f))),T=`? ${T}
|
|
71
71
|
${a}:`):(T=`${T}:`,f&&(T+=jl.lineComment(T,r.indent,l(f))));let _,b,v;Ui.isNode(e)?(_=!!e.spaceBefore,b=e.commentBefore,v=e.comment):(_=!1,b=null,v=null,e&&typeof e=="object"&&(e=o.createNode(e))),r.implicitKey=!1,!p&&!f&&Ui.isScalar(e)&&(r.indentAtStart=T.length+1),h=!1,!u&&c.length>=2&&!r.inFlow&&!p&&Ui.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(r.indent=r.indent.substring(2));let k=!1,w=Ux.stringify(e,r,()=>k=!0,()=>h=!0),H=" ";if(f||_||b){if(H=_?`
|
|
72
72
|
`:"",b){let O=l(b);H+=`
|
|
@@ -90,7 +90,7 @@ ${i.key.commentBefore}`:n.commentBefore),n.comment){let s=i.value??i.key;s.comme
|
|
|
90
90
|
${s.comment}`:n.comment}n=i}t.items[r]=Yh.isPair(n)?n:new Hv.Pair(n)}}else e("Expected a sequence for this tag");return t}function bM(t,e,r){let{replacer:n}=r,i=new e2.YAMLSeq(t);i.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(s++),o));let a,c;if(Array.isArray(o))if(o.length===2)a=o[0],c=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){let l=Object.keys(o);if(l.length===1)a=l[0],c=o[a];else throw new TypeError(`Expected tuple with one key, not ${l.length} keys`)}else a=o;i.items.push(Hv.createPair(a,c,r))}return i}var t2={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:vM,createNode:bM};Xh.createPairs=bM;Xh.pairs=t2;Xh.resolvePairs=vM});var Wv=R(zv=>{"use strict";var SM=qe(),Vv=vs(),zl=Rs(),r2=Ps(),_M=Jh(),co=class t extends r2.YAMLSeq{constructor(){super(),this.add=zl.YAMLMap.prototype.add.bind(this),this.delete=zl.YAMLMap.prototype.delete.bind(this),this.get=zl.YAMLMap.prototype.get.bind(this),this.has=zl.YAMLMap.prototype.has.bind(this),this.set=zl.YAMLMap.prototype.set.bind(this),this.tag=t.tag}toJSON(e,r){if(!r)return super.toJSON(e);let n=new Map;r?.onCreate&&r.onCreate(n);for(let i of this.items){let s,o;if(SM.isPair(i)?(s=Vv.toJS(i.key,"",r),o=Vv.toJS(i.value,s,r)):s=Vv.toJS(i,"",r),n.has(s))throw new Error("Ordered maps must not include duplicate keys");n.set(s,o)}return n}static from(e,r,n){let i=_M.createPairs(e,r,n),s=new this;return s.items=i.items,s}};co.tag="tag:yaml.org,2002:omap";var n2={collection:"seq",identify:t=>t instanceof Map,nodeClass:co,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let r=_M.resolvePairs(t,e),n=[];for(let{key:i}of r.items)SM.isScalar(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new co,r)},createNode:(t,e,r)=>co.from(t,e,r)};zv.YAMLOMap=co;zv.omap=n2});var EM=R(Gv=>{"use strict";var kM=jt();function NM({value:t,source:e},r){return e&&(t?RM:PM).test.test(e)?e:t?r.options.trueStr:r.options.falseStr}var RM={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new kM.Scalar(!0),stringify:NM},PM={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new kM.Scalar(!1),stringify:NM};Gv.falseTag=PM;Gv.trueTag=RM});var wM=R(Qh=>{"use strict";var i2=jt(),Kv=Wa(),s2={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:Kv.stringifyNumber},o2={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():Kv.stringifyNumber(t)}},a2={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new i2.Scalar(parseFloat(t.replace(/_/g,""))),r=t.indexOf(".");if(r!==-1){let n=t.substring(r+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:Kv.stringifyNumber};Qh.float=a2;Qh.floatExp=o2;Qh.floatNaN=s2});var DM=R(Gl=>{"use strict";var CM=Wa(),Wl=t=>typeof t=="bigint"||Number.isInteger(t);function Zh(t,e,r,{intAsBigInt:n}){let i=t[0];if((i==="-"||i==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),n){switch(r){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let o=BigInt(t);return i==="-"?BigInt(-1)*o:o}let s=parseInt(t,r);return i==="-"?-1*s:s}function Yv(t,e,r){let{value:n}=t;if(Wl(n)){let i=n.toString(e);return n<0?"-"+r+i.substr(1):r+i}return CM.stringifyNumber(t)}var c2={identify:Wl,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,r)=>Zh(t,2,2,r),stringify:t=>Yv(t,2,"0b")},l2={identify:Wl,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,r)=>Zh(t,1,8,r),stringify:t=>Yv(t,8,"0")},u2={identify:Wl,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,r)=>Zh(t,0,10,r),stringify:CM.stringifyNumber},d2={identify:Wl,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,r)=>Zh(t,2,16,r),stringify:t=>Yv(t,16,"0x")};Gl.int=u2;Gl.intBin=c2;Gl.intHex=d2;Gl.intOct=l2});var Jv=R(Xv=>{"use strict";var rm=qe(),em=ks(),tm=Rs(),lo=class t extends tm.YAMLMap{constructor(e){super(e),this.tag=t.tag}add(e){let r;rm.isPair(e)?r=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?r=new em.Pair(e.key,null):r=new em.Pair(e,null),tm.findPair(this.items,r.key)||this.items.push(r)}get(e,r){let n=tm.findPair(this.items,e);return!r&&rm.isPair(n)?rm.isScalar(n.key)?n.key.value:n.key:n}set(e,r){if(typeof r!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof r}`);let n=tm.findPair(this.items,e);n&&!r?this.items.splice(this.items.indexOf(n),1):!n&&r&&this.items.push(new em.Pair(e))}toJSON(e,r){return super.toJSON(e,r,Set)}toString(e,r,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),r,n);throw new Error("Set items must all have null values")}static from(e,r,n){let{replacer:i}=n,s=new this(e);if(r&&Symbol.iterator in Object(r))for(let o of r)typeof i=="function"&&(o=i.call(r,o,o)),s.items.push(em.createPair(o,null,n));return s}};lo.tag="tag:yaml.org,2002:set";var f2={collection:"map",identify:t=>t instanceof Set,nodeClass:lo,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,r)=>lo.from(t,e,r),resolve(t,e){if(rm.isMap(t)){if(t.hasAllNullValues(!0))return Object.assign(new lo,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};Xv.YAMLSet=lo;Xv.set=f2});var Zv=R(nm=>{"use strict";var p2=Wa();function Qv(t,e){let r=t[0],n=r==="-"||r==="+"?t.substring(1):t,i=o=>e?BigInt(o):Number(o),s=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return r==="-"?i(-1)*s:s}function AM(t){let{value:e}=t,r=o=>o;if(typeof e=="bigint")r=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return p2.stringifyNumber(t);let n="";e<0&&(n="-",e*=r(-1));let i=r(60),s=[e%i];return e<60?s.unshift(0):(e=(e-s[0])/i,s.unshift(e%i),e>=60&&(e=(e-s[0])/i,s.unshift(e))),n+s.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var h2={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:r})=>Qv(t,r),stringify:AM},m2={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Qv(t,!1),stringify:AM},IM={identify:t=>t instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(t){let e=t.match(IM.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,r,n,i,s,o,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,l=Date.UTC(r,n-1,i,s||0,o||0,a||0,c),u=e[8];if(u&&u!=="Z"){let d=Qv(u,!1);Math.abs(d)<30&&(d*=60),l-=6e4*d}return new Date(l)},stringify:({value:t})=>t.toISOString().replace(/(T00:00:00)?\.000Z$/,"")};nm.floatTime=m2;nm.intTime=h2;nm.timestamp=IM});var MM=R(xM=>{"use strict";var g2=Va(),y2=Vh(),T2=za(),v2=Vl(),b2=Uv(),OM=EM(),eb=wM(),im=DM(),S2=Lh(),_2=Wv(),k2=Jh(),N2=Jv(),tb=Zv(),R2=[g2.map,T2.seq,v2.string,y2.nullTag,OM.trueTag,OM.falseTag,im.intBin,im.intOct,im.int,im.intHex,eb.floatNaN,eb.floatExp,eb.float,b2.binary,S2.merge,_2.omap,k2.pairs,N2.set,tb.intTime,tb.floatTime,tb.timestamp];xM.schema=R2});var zM=R(ib=>{"use strict";var FM=Va(),P2=Vh(),BM=za(),E2=Vl(),w2=xv(),rb=Lv(),nb=$v(),C2=hM(),D2=yM(),jM=Uv(),Kl=Lh(),UM=Wv(),HM=Jh(),LM=MM(),VM=Jv(),sm=Zv(),qM=new Map([["core",C2.schema],["failsafe",[FM.map,BM.seq,E2.string]],["json",D2.schema],["yaml11",LM.schema],["yaml-1.1",LM.schema]]),$M={binary:jM.binary,bool:w2.boolTag,float:rb.float,floatExp:rb.floatExp,floatNaN:rb.floatNaN,floatTime:sm.floatTime,int:nb.int,intHex:nb.intHex,intOct:nb.intOct,intTime:sm.intTime,map:FM.map,merge:Kl.merge,null:P2.nullTag,omap:UM.omap,pairs:HM.pairs,seq:BM.seq,set:VM.set,timestamp:sm.timestamp},A2={"tag:yaml.org,2002:binary":jM.binary,"tag:yaml.org,2002:merge":Kl.merge,"tag:yaml.org,2002:omap":UM.omap,"tag:yaml.org,2002:pairs":HM.pairs,"tag:yaml.org,2002:set":VM.set,"tag:yaml.org,2002:timestamp":sm.timestamp};function I2(t,e,r){let n=qM.get(e);if(n&&!t)return r&&!n.includes(Kl.merge)?n.concat(Kl.merge):n.slice();let i=n;if(!i)if(Array.isArray(t))i=[];else{let s=Array.from(qM.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)i=i.concat(s);else typeof t=="function"&&(i=t(i.slice()));return r&&(i=i.concat(Kl.merge)),i.reduce((s,o)=>{let a=typeof o=="string"?$M[o]:o;if(!a){let c=JSON.stringify(o),l=Object.keys($M).map(u=>JSON.stringify(u)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${l}`)}return s.includes(a)||s.push(a),s},[])}ib.coreKnownTags=A2;ib.getTags=I2});var ab=R(WM=>{"use strict";var sb=qe(),O2=Va(),x2=za(),M2=Vl(),om=zM(),L2=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,ob=class t{constructor({compat:e,customTags:r,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?om.getTags(e,"compat"):e?om.getTags(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=i?om.coreKnownTags:{},this.tags=om.getTags(r,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,sb.MAP,{value:O2.map}),Object.defineProperty(this,sb.SCALAR,{value:M2.string}),Object.defineProperty(this,sb.SEQ,{value:x2.seq}),this.sortMapEntries=typeof o=="function"?o:o===!0?L2:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};WM.Schema=ob});var KM=R(GM=>{"use strict";var q2=qe(),cb=Bl(),Yl=Ll();function $2(t,e){let r=[],n=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(r.push(c),n=!0):t.directives.docStart&&(n=!0)}n&&r.push("---");let i=cb.createStringifyContext(t,e),{commentString:s}=i.options;if(t.commentBefore){r.length!==1&&r.unshift("");let c=s(t.commentBefore);r.unshift(Yl.indentComment(c,""))}let o=!1,a=null;if(t.contents){if(q2.isNode(t.contents)){if(t.contents.spaceBefore&&n&&r.push(""),t.contents.commentBefore){let u=s(t.contents.commentBefore);r.push(Yl.indentComment(u,""))}i.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>o=!0,l=cb.stringify(t.contents,i,()=>a=null,c);a&&(l+=Yl.lineComment(l,"",s(a))),(l[0]==="|"||l[0]===">")&&r[r.length-1]==="---"?r[r.length-1]=`--- ${l}`:r.push(l)}else r.push(cb.stringify(t.contents,i));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
|
|
91
91
|
`)?(r.push("..."),r.push(Yl.indentComment(c,""))):r.push(`... ${c}`)}else r.push("...");else{let c=t.comment;c&&o&&(c=c.replace(/^\n+/,"")),c&&((!o||a)&&r[r.length-1]!==""&&r.push(""),r.push(Yl.indentComment(s(c),"")))}return r.join(`
|
|
92
92
|
`)+`
|
|
93
|
-
`}GM.stringifyDocument=$2});var Xl=R(YM=>{"use strict";var F2=xl(),Ga=Eh(),
|
|
93
|
+
`}GM.stringifyDocument=$2});var Xl=R(YM=>{"use strict";var F2=xl(),Ga=Eh(),En=qe(),B2=ks(),j2=vs(),U2=ab(),H2=KM(),lb=_h(),V2=pv(),z2=Ml(),ub=fv(),db=class t{constructor(e,r,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,En.NODE_TYPE,{value:En.DOC});let i=null;typeof r=="function"||Array.isArray(r)?i=r:n===void 0&&r&&(n=r,r=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:o}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new ub.Directives({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){let e=Object.create(t.prototype,{[En.NODE_TYPE]:{value:En.DOC}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=En.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Ka(this.contents)&&this.contents.add(e)}addIn(e,r){Ka(this.contents)&&this.contents.addIn(e,r)}createAlias(e,r){if(!e.anchor){let n=lb.anchorNames(this);e.anchor=!r||n.has(r)?lb.findNewAnchor(r||"a",n):r}return new F2.Alias(e.anchor)}createNode(e,r,n){let i;if(typeof r=="function")e=r.call({"":e},"",e),i=r;else if(Array.isArray(r)){let T=b=>typeof b=="number"||b instanceof String||b instanceof Number,_=r.filter(T).map(String);_.length>0&&(r=r.concat(_)),i=r}else n===void 0&&r&&(n=r,r=void 0);let{aliasDuplicateObjects:s,anchorPrefix:o,flow:a,keepUndefined:c,onTagObj:l,tag:u}=n??{},{onAnchor:d,setAnchors:f,sourceObjects:p}=lb.createNodeAnchors(this,o||"a"),m={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:d,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:p},h=z2.createNode(e,u,m);return a&&En.isCollection(h)&&(h.flow=!0),f(),h}createPair(e,r,n={}){let i=this.createNode(e,null,n),s=this.createNode(r,null,n);return new B2.Pair(i,s)}delete(e){return Ka(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Ga.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Ka(this.contents)?this.contents.deleteIn(e):!1}get(e,r){return En.isCollection(this.contents)?this.contents.get(e,r):void 0}getIn(e,r){return Ga.isEmptyPath(e)?!r&&En.isScalar(this.contents)?this.contents.value:this.contents:En.isCollection(this.contents)?this.contents.getIn(e,r):void 0}has(e){return En.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Ga.isEmptyPath(e)?this.contents!==void 0:En.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,r){this.contents==null?this.contents=Ga.collectionFromPath(this.schema,[e],r):Ka(this.contents)&&this.contents.set(e,r)}setIn(e,r){Ga.isEmptyPath(e)?this.contents=r:this.contents==null?this.contents=Ga.collectionFromPath(this.schema,Array.from(e),r):Ka(this.contents)&&this.contents.setIn(e,r)}setSchema(e,r={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new ub.Directives({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new ub.Directives({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{let i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(r.schema instanceof Object)this.schema=r.schema;else if(n)this.schema=new U2.Schema(Object.assign(n,r));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:r,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},c=j2.toJS(this.contents,r??"",a);if(typeof s=="function")for(let{count:l,res:u}of a.anchors.values())s(u,l);return typeof o=="function"?V2.applyReviver(o,{"":c},"",c):c}toJSON(e,r){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:r})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let r=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${r}`)}return H2.stringifyDocument(this,e)}};function Ka(t){if(En.isCollection(t))return!0;throw new Error("Expected a YAML collection as document contents")}YM.Document=db});var Zl=R(Ql=>{"use strict";var Jl=class extends Error{constructor(e,r,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=r}},fb=class extends Jl{constructor(e,r,n){super("YAMLParseError",e,r,n)}},pb=class extends Jl{constructor(e,r,n){super("YAMLWarning",e,r,n)}},W2=(t,e)=>r=>{if(r.pos[0]===-1)return;r.linePos=r.pos.map(a=>e.linePos(a));let{line:n,col:i}=r.linePos[0];r.message+=` at line ${n}, column ${i}`;let s=i-1,o=t.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(s>=60&&o.length>80){let a=Math.min(s-39,o.length-79);o="\u2026"+o.substring(a),s-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),n>1&&/^ *$/.test(o.substring(0,s))){let a=t.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
|
|
94
94
|
`),o=a+o}if(/[^ ]/.test(o)){let a=1,c=r.linePos[1];c&&c.line===n&&c.col>i&&(a=Math.max(1,Math.min(c.col-i,80-s)));let l=" ".repeat(s)+"^".repeat(a);r.message+=`:
|
|
95
95
|
|
|
96
96
|
${o}
|
|
@@ -149,37 +149,37 @@ ${r.comment}`:r.comment}this.doc.range[2]=r.offset;break}default:this.errors.pus
|
|
|
149
149
|
`});for(let c of Object.keys(t))c!=="type"&&c!=="offset"&&delete t[c];Object.assign(t,{type:"block-scalar",indent:o,props:a,source:i})}}function xL(t,e){if(e)for(let r of e)switch(r.type){case"space":case"comment":t.push(r);break;case"newline":return t.push(r),!0}return!1}function wb(t,e,r){switch(t.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":t.type=r,t.source=e;break;case"block-scalar":{let n=t.props.slice(1),i=e.length;t.props[0].type==="block-scalar-header"&&(i-=t.props[0].source.length);for(let s of n)s.offset+=i;delete t.props,Object.assign(t,{type:r,source:e,end:n});break}case"block-map":case"block-seq":{let i={type:"newline",offset:t.offset+e.length,indent:t.indent,source:`
|
|
150
150
|
`};delete t.items,Object.assign(t,{type:r,source:e,end:[i]});break}default:{let n="indent"in t?t.indent:-1,i="end"in t&&Array.isArray(t.end)?t.end.filter(s=>s.type==="space"||s.type==="comment"||s.type==="newline"):[];for(let s of Object.keys(t))s!=="type"&&s!=="offset"&&delete t[s];Object.assign(t,{type:r,indent:n,source:e,end:i})}}}cm.createScalarToken=nK;cm.resolveAsScalar=rK;cm.setScalarValue=iK});var qL=R(LL=>{"use strict";var oK=t=>"type"in t?um(t):lm(t);function um(t){switch(t.type){case"block-scalar":{let e="";for(let r of t.props)e+=um(r);return e+t.source}case"block-map":case"block-seq":{let e="";for(let r of t.items)e+=lm(r);return e}case"flow-collection":{let e=t.start.source;for(let r of t.items)e+=lm(r);for(let r of t.end)e+=r.source;return e}case"document":{let e=lm(t);if(t.end)for(let r of t.end)e+=r.source;return e}default:{let e=t.source;if("end"in t&&t.end)for(let r of t.end)e+=r.source;return e}}}function lm({start:t,key:e,sep:r,value:n}){let i="";for(let s of t)i+=s.source;if(e&&(i+=um(e)),r)for(let s of r)i+=s.source;return n&&(i+=um(n)),i}LL.stringify=oK});var jL=R(BL=>{"use strict";var Cb=Symbol("break visit"),aK=Symbol("skip children"),$L=Symbol("remove item");function fo(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),FL(Object.freeze([]),t,e)}fo.BREAK=Cb;fo.SKIP=aK;fo.REMOVE=$L;fo.itemAtPath=(t,e)=>{let r=t;for(let[n,i]of e){let s=r?.[n];if(s&&"items"in s)r=s.items[i];else return}return r};fo.parentCollection=(t,e)=>{let r=fo.itemAtPath(t,e.slice(0,-1)),n=e[e.length-1][0],i=r?.[n];if(i&&"items"in i)return i;throw new Error("Parent collection not found")};function FL(t,e,r){let n=r(e,t);if(typeof n=="symbol")return n;for(let i of["key","value"]){let s=e[i];if(s&&"items"in s){for(let o=0;o<s.items.length;++o){let a=FL(Object.freeze(t.concat([[i,o]])),s.items[o],r);if(typeof a=="number")o=a-1;else{if(a===Cb)return Cb;a===$L&&(s.items.splice(o,1),o-=1)}}typeof n=="function"&&i==="key"&&(n=n(e,t))}}return typeof n=="function"?n(e,t):n}BL.visit=fo});var dm=R(Wr=>{"use strict";var Db=ML(),cK=qL(),lK=jL(),Ab="\uFEFF",Ib="",Ob="",xb="",uK=t=>!!t&&"items"in t,dK=t=>!!t&&(t.type==="scalar"||t.type==="single-quoted-scalar"||t.type==="double-quoted-scalar"||t.type==="block-scalar");function fK(t){switch(t){case Ab:return"<BOM>";case Ib:return"<DOC>";case Ob:return"<FLOW_END>";case xb:return"<SCALAR>";default:return JSON.stringify(t)}}function pK(t){switch(t){case Ab:return"byte-order-mark";case Ib:return"doc-mode";case Ob:return"flow-error-end";case xb:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
151
151
|
`:case`\r
|
|
152
|
-
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Wr.createScalarToken=Db.createScalarToken;Wr.resolveAsScalar=Db.resolveAsScalar;Wr.setScalarValue=Db.setScalarValue;Wr.stringify=cK.stringify;Wr.visit=lK.visit;Wr.BOM=Ab;Wr.DOCUMENT=Ib;Wr.FLOW_END=Ob;Wr.SCALAR=xb;Wr.isCollection=uK;Wr.isScalar=dK;Wr.prettyToken=fK;Wr.tokenType=pK});var qb=R(HL=>{"use strict";var nu=dm();function
|
|
152
|
+
`:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}Wr.createScalarToken=Db.createScalarToken;Wr.resolveAsScalar=Db.resolveAsScalar;Wr.setScalarValue=Db.setScalarValue;Wr.stringify=cK.stringify;Wr.visit=lK.visit;Wr.BOM=Ab;Wr.DOCUMENT=Ib;Wr.FLOW_END=Ob;Wr.SCALAR=xb;Wr.isCollection=uK;Wr.isScalar=dK;Wr.prettyToken=fK;Wr.tokenType=pK});var qb=R(HL=>{"use strict";var nu=dm();function Zn(t){switch(t){case void 0:case" ":case`
|
|
153
153
|
`:case"\r":case" ":return!0;default:return!1}}var UL=new Set("0123456789ABCDEFabcdef"),hK=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),fm=new Set(",[]{}"),mK=new Set(` ,[]{}
|
|
154
154
|
\r `),Mb=t=>!t||mK.has(t),Lb=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,r=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!r;let n=this.next??"stream";for(;n&&(r||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,r=this.buffer[e];for(;r===" "||r===" ";)r=this.buffer[++e];return!r||r==="#"||r===`
|
|
155
155
|
`?!0:r==="\r"?this.buffer[e+1]===`
|
|
156
156
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let r=this.buffer[e];if(this.indentNext>0){let n=0;for(;r===" ";)r=this.buffer[++n+e];if(r==="\r"){let i=this.buffer[n+e+1];if(i===`
|
|
157
157
|
`||!i&&!this.atEnd)return e+n+1}return r===`
|
|
158
|
-
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&
|
|
159
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===nu.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let s=e[n-1];if(s===" "||s===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let s=e[r-1];if(s===" "||s===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield nu.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&
|
|
158
|
+
`||n>=this.indentNext||!r&&!this.atEnd?e+n:-1}if(r==="-"||r==="."){let n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&Zn(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
159
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===nu.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let r=e.length,n=e.indexOf("#");for(;n!==-1;){let s=e[n-1];if(s===" "||s===" "){r=n-1;break}else n=e.indexOf("#",n+1)}for(;;){let s=e[r-1];if(s===" "||s===" ")r-=1;else break}let i=(yield*this.pushCount(r))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){let r=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-r),yield*this.pushNewline(),"stream"}return yield nu.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let r=this.peek(3);if((r==="---"||r==="...")&&Zn(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,r==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Zn(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,r]=this.peek(2);if(!r&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&Zn(r)){let n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let r=yield*this.pushIndicators();switch(e[r]){case"#":yield*this.pushCount(e.length-r);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(Mb),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return r+=yield*this.parseBlockScalarHeader(),r+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-r),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,r,n=-1;do e=yield*this.pushNewline(),e>0?(r=yield*this.pushSpaces(!1),this.indentValue=n=r):r=0,r+=yield*this.pushSpaces(!0);while(e+r>0);let i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&Zn(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield nu.FLOW_END,yield*this.parseLineStart();let s=0;for(;i[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(Mb),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||Zn(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),r=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;r!==-1&&this.buffer[r+1]==="'";)r=this.buffer.indexOf("'",r+2);else for(;r!==-1;){let s=0;for(;this.buffer[r-1-s]==="\\";)s+=1;if(s%2===0)break;r=this.buffer.indexOf('"',r+1)}let n=this.buffer.substring(0,r),i=n.indexOf(`
|
|
160
160
|
`,this.pos);if(i!==-1){for(;i!==-1;){let s=this.continueScalar(i+1);if(s===-1)break;i=n.indexOf(`
|
|
161
|
-
`,s)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>
|
|
161
|
+
`,s)}i!==-1&&(r=i-(n[i-1]==="\r"?2:1))}if(r===-1){if(!this.atEnd)return this.setNext("quoted-scalar");r=this.buffer.length}return yield*this.pushToIndex(r+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let r=this.buffer[++e];if(r==="+")this.blockScalarKeep=!0;else if(r>"0"&&r<="9")this.blockScalarIndent=Number(r)-1;else if(r!=="-")break}return yield*this.pushUntil(r=>Zn(r)||r==="#")}*parseBlockScalar(){let e=this.pos-1,r=0,n;e:for(let s=this.pos;n=this.buffer[s];++s)switch(n){case" ":r+=1;break;case`
|
|
162
162
|
`:e=s,r=0;break;case"\r":{let o=this.buffer[s+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
163
163
|
`)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(r>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=r:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
|
|
164
164
|
`,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
|
|
165
165
|
`;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let s=e-1,o=this.buffer[s];o==="\r"&&(o=this.buffer[--s]);let a=s;for(;o===" ";)o=this.buffer[--s];if(o===`
|
|
166
|
-
`&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield nu.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let s=this.buffer[n+1];if(
|
|
166
|
+
`&&s>=this.pos&&s+1+r>a)e=s;else break}while(!0);return yield nu.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,r=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){let s=this.buffer[n+1];if(Zn(s)||e&&fm.has(s))break;r=n}else if(Zn(i)){let s=this.buffer[n+1];if(i==="\r"&&(s===`
|
|
167
167
|
`?(n+=1,i=`
|
|
168
168
|
`,s=this.buffer[n+1]):r=n),s==="#"||e&&fm.has(s))break;if(i===`
|
|
169
|
-
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&fm.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield nu.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Mb))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(
|
|
169
|
+
`){let o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&fm.has(i))break;r=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield nu.SCALAR,yield*this.pushToIndex(r+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,r){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(r&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(Mb))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,r=this.charAt(1);if(Zn(r)||e&&fm.has(r))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,r=this.buffer[e];for(;!Zn(r)&&r!==">";)r=this.buffer[++e];return yield*this.pushToIndex(r===">"?e+1:e,!1)}else{let e=this.pos+1,r=this.buffer[e];for(;r;)if(hK.has(r))r=this.buffer[++e];else if(r==="%"&&UL.has(this.buffer[e+1])&&UL.has(this.buffer[e+2]))r=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
170
170
|
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
171
171
|
`?yield*this.pushCount(2):0}*pushSpaces(e){let r=this.pos-1,n;do n=this.buffer[++r];while(n===" "||e&&n===" ");let i=r-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=r),i}*pushUntil(e){let r=this.pos,n=this.buffer[r];for(;!e(n);)n=this.buffer[++r];return yield*this.pushToIndex(r,!1)}};HL.Lexer=Lb});var Fb=R(VL=>{"use strict";var $b=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let r=0,n=this.lineStarts.length;for(;r<n;){let s=r+n>>1;this.lineStarts[s]<e?r=s+1:n=s}if(this.lineStarts[r]===e)return{line:r+1,col:1};if(r===0)return{line:0,col:e};let i=this.lineStarts[r-1];return{line:r,col:e-i+1}}}};VL.LineCounter=$b});var jb=R(YL=>{"use strict";var zL=dm(),gK=qb();function po(t,e){for(let r=0;r<t.length;++r)if(t[r].type===e)return!0;return!1}function WL(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function KL(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function pm(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Xa(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function GL(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!po(e.start,"explicit-key-ind")&&!po(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,KL(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var Bb=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new gK.Lexer,this.onNewLine=e}*parse(e,r=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,r))yield*this.next(n);r||(yield*this.end())}*next(e){if(this.source=e,process.env.LOG_TOKENS&&console.log("|",zL.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let r=zL.tokenType(e);if(r)if(r==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=r,yield*this.step(),r){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type==="doc-end"&&(!e||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let r=e??this.stack.pop();if(!r)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield r;else{let n=this.peek(1);switch(r.type==="block-scalar"?r.indent="indent"in n?n.indent:0:r.type==="flow-collection"&&n.type==="document"&&(r.indent=0),r.type==="flow-collection"&&GL(r),n.type){case"document":n.value=r;break;case"block-scalar":n.props.push(r);break;case"block-map":{let i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:r,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=r;else{Object.assign(i,{key:r,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{let i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:r}):i.value=r;break}case"flow-collection":{let i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:r,sep:[]}):i.sep?i.value=r:Object.assign(i,{key:r,sep:[]});return}default:yield*this.pop(),yield*this.pop(r)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(r.type==="block-map"||r.type==="block-seq")){let i=r.items[r.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&WL(i.start)===-1&&(r.indent===0||i.start.every(s=>s.type!=="comment"||s.indent<r.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),r.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{WL(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let r=pm(this.peek(2)),n=Xa(r),i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let r=this.source.indexOf(`
|
|
172
172
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
173
173
|
`,r)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else if(r.sep)r.sep.push(this.sourceToken);else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,i=n&&(r.sep||r.explicitKey)&&this.type!=="seq-item-ind",s=[];if(i&&r.sep&&!r.value){let o=[];for(let a=0;a<r.sep.length;++a){let c=r.sep[a];switch(c.type){case"newline":o.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(s=r.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||r.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"explicit-key-ind":!r.sep&&!r.explicitKey?(r.start.push(this.sourceToken),r.explicitKey=!0):i||r.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(r.explicitKey)if(r.sep)if(r.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(po(r.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(KL(r.key)&&!po(r.sep,"newline")){let o=Xa(r.start),a=r.key,c=r.sep;c.push(this.sourceToken),delete r.key,delete r.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:c}]})}else s.length>0?r.sep=r.sep.concat(s,this.sourceToken):r.sep.push(this.sourceToken);else if(po(r.start,"newline"))Object.assign(r,{key:null,sep:[this.sourceToken]});else{let o=Xa(r.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else r.sep?r.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):po(r.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);i||r.value?(e.items.push({start:s,key:o,sep:[]}),this.onKeyLine=!0):r.sep?this.stack.push(o):(Object.assign(r,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){n&&o.type!=="block-seq"&&e.items.push({start:s}),this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let r=e.items[e.items.length-1];switch(this.type){case"newline":if(r.value){let n="end"in r.value?r.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else r.start.push(this.sourceToken);return;case"space":case"comment":if(r.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(r.start,e.indent)){let i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,r.start),i.push(this.sourceToken),e.items.pop();return}}r.start.push(this.sourceToken)}return;case"anchor":case"tag":if(r.value||this.indent<=e.indent)break;r.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;r.value||po(r.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let r=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!r||r.sep?e.items.push({start:[this.sourceToken]}):r.start.push(this.sourceToken);return;case"map-value-ind":!r||r.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):Object.assign(r,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!r||r.value?e.items.push({start:[this.sourceToken]}):r.sep?r.sep.push(this.sourceToken):r.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);!r||r.value?e.items.push({start:[],key:i,sep:[]}):r.sep?this.stack.push(i):Object.assign(r,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let i=pm(n),s=Xa(i);GL(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let r=this.source.indexOf(`
|
|
174
174
|
`)+1;for(;r!==0;)this.onNewLine(this.offset+r),r=this.source.indexOf(`
|
|
175
|
-
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=pm(e),n=Xa(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=pm(e),n=Xa(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};YL.Parser=Bb});var eq=R(su=>{"use strict";var XL=Eb(),yK=Xl(),iu=Zl(),TK=Rv(),vK=qe(),bK=Fb(),JL=jb();function QL(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bK.LineCounter||null,prettyErrors:e}}function SK(t,e={}){let{lineCounter:r,prettyErrors:n}=QL(e),i=new JL.Parser(r?.addNewLine),s=new XL.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(iu.prettifyError(t,r)),a.warnings.forEach(iu.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function ZL(t,e={}){let{lineCounter:r,prettyErrors:n}=QL(e),i=new JL.Parser(r?.addNewLine),s=new XL.Composer(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new iu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(iu.prettifyError(t,r)),o.warnings.forEach(iu.prettifyError(t,r))),o}function _K(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=ZL(t,r);if(!i)return null;if(i.warnings.forEach(s=>TK.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function kK(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return vK.isDocument(t)&&!n?t.toString(r):new yK.Document(t,n,r).toString(r)}su.parse=_K;su.parseAllDocuments=SK;su.parseDocument=ZL;su.stringify=kK});var Hb=R(Qe=>{"use strict";var NK=Eb(),RK=Xl(),PK=ab(),Ub=Zl(),EK=xl(),Es=qe(),wK=ks(),CK=jt(),DK=Rs(),AK=Ps(),IK=dm(),OK=qb(),xK=Fb(),MK=jb(),hm=eq(),tq=Dl();Qe.Composer=NK.Composer;Qe.Document=RK.Document;Qe.Schema=PK.Schema;Qe.YAMLError=Ub.YAMLError;Qe.YAMLParseError=Ub.YAMLParseError;Qe.YAMLWarning=Ub.YAMLWarning;Qe.Alias=EK.Alias;Qe.isAlias=Es.isAlias;Qe.isCollection=Es.isCollection;Qe.isDocument=Es.isDocument;Qe.isMap=Es.isMap;Qe.isNode=Es.isNode;Qe.isPair=Es.isPair;Qe.isScalar=Es.isScalar;Qe.isSeq=Es.isSeq;Qe.Pair=wK.Pair;Qe.Scalar=CK.Scalar;Qe.YAMLMap=DK.YAMLMap;Qe.YAMLSeq=AK.YAMLSeq;Qe.CST=IK;Qe.Lexer=OK.Lexer;Qe.LineCounter=xK.LineCounter;Qe.Parser=MK.Parser;Qe.parse=hm.parse;Qe.parseAllDocuments=hm.parseAllDocuments;Qe.parseDocument=hm.parseDocument;Qe.stringify=hm.stringify;Qe.visit=tq.visit;Qe.visitAsync=tq.visitAsync});var cu=R(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.regexpCode=je.getEsmExportName=je.getProperty=je.safeStringify=je.stringify=je.strConcat=je.addCodeArg=je.str=je._=je.nil=je._Code=je.Name=je.IDENTIFIER=je._CodeOrName=void 0;var ou=class{};je._CodeOrName=ou;je.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ho=class extends ou{constructor(e){if(super(),!je.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};je.Name=ho;var En=class extends ou{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof ho&&(r[n.str]=(r[n.str]||0)+1),r),{})}};je._Code=En;je.nil=new En("");function rq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)zb(r,e[n]),r.push(t[++n]);return new En(r)}je._=rq;var Vb=new En("+");function nq(t,...e){let r=[au(t[0])],n=0;for(;n<e.length;)r.push(Vb),zb(r,e[n]),r.push(Vb,au(t[++n]));return LK(r),new En(r)}je.str=nq;function zb(t,e){e instanceof En?t.push(...e._items):e instanceof ho?t.push(e):t.push(FK(e))}je.addCodeArg=zb;function LK(t){let e=1;for(;e<t.length-1;){if(t[e]===Vb){let r=qK(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function qK(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof ho||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof ho))return`"${t}${e.slice(1)}`}function $K(t,e){return e.emptyStr()?t:t.emptyStr()?e:nq`${t}${e}`}je.strConcat=$K;function FK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:au(Array.isArray(t)?t.join(","):t)}function BK(t){return new En(au(t))}je.stringify=BK;function au(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}je.safeStringify=au;function jK(t){return typeof t=="string"&&je.IDENTIFIER.test(t)?new En(`.${t}`):rq`[${t}]`}je.getProperty=jK;function UK(t){if(typeof t=="string"&&je.IDENTIFIER.test(t))return new En(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}je.getEsmExportName=UK;function HK(t){return new En(t.toString())}je.regexpCode=HK});var Kb=R(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.ValueScope=Kr.ValueScopeName=Kr.Scope=Kr.varKinds=Kr.UsedValueState=void 0;var Gr=cu(),Wb=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},mm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(mm||(Kr.UsedValueState=mm={}));Kr.varKinds={const:new Gr.Name("const"),let:new Gr.Name("let"),var:new Gr.Name("var")};var gm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Gr.Name?e:this.name(e)}name(e){return new Gr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Kr.Scope=gm;var ym=class extends Gr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Gr._)`.${new Gr.Name(r)}[${n}]`}};Kr.ValueScopeName=ym;var VK=(0,Gr._)`\n`,Gb=class extends gm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?VK:Gr.nil}}get(){return this._scope}name(e){return new ym(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Gr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=Gr.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,mm.Started);let u=r(l);if(u){let d=this.opts.es5?Kr.varKinds.var:Kr.varKinds.const;s=(0,Gr._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,Gr._)`${s}${u}${this.opts._n}`;else throw new Wb(l);c.set(l,mm.Completed)})}return s}};Kr.ValueScope=Gb});var ve=R(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.or=_e.and=_e.not=_e.CodeGen=_e.operators=_e.varKinds=_e.ValueScopeName=_e.ValueScope=_e.Scope=_e.Name=_e.regexpCode=_e.stringify=_e.getProperty=_e.nil=_e.strConcat=_e.str=_e._=void 0;var Oe=cu(),Zn=Kb(),ws=cu();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return ws._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return ws.str}});Object.defineProperty(_e,"strConcat",{enumerable:!0,get:function(){return ws.strConcat}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return ws.nil}});Object.defineProperty(_e,"getProperty",{enumerable:!0,get:function(){return ws.getProperty}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return ws.stringify}});Object.defineProperty(_e,"regexpCode",{enumerable:!0,get:function(){return ws.regexpCode}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return ws.Name}});var Sm=Kb();Object.defineProperty(_e,"Scope",{enumerable:!0,get:function(){return Sm.Scope}});Object.defineProperty(_e,"ValueScope",{enumerable:!0,get:function(){return Sm.ValueScope}});Object.defineProperty(_e,"ValueScopeName",{enumerable:!0,get:function(){return Sm.ValueScopeName}});Object.defineProperty(_e,"varKinds",{enumerable:!0,get:function(){return Sm.varKinds}});_e.operators={GT:new Oe._Code(">"),GTE:new Oe._Code(">="),LT:new Oe._Code("<"),LTE:new Oe._Code("<="),EQ:new Oe._Code("==="),NEQ:new Oe._Code("!=="),NOT:new Oe._Code("!"),OR:new Oe._Code("||"),AND:new Oe._Code("&&"),ADD:new Oe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Yb=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?Zn.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Qa(this.rhs,e,r)),this}get names(){return this.rhs instanceof Oe._CodeOrName?this.rhs.names:{}}},Tm=class extends Hi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Oe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Qa(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Oe.Name?{}:{...this.lhs.names};return bm(e,this.rhs)}},Xb=class extends Tm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Jb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Qb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Zb=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},eS=class extends Hi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Qa(this.code,e,r),this}get names(){return this.code instanceof Oe._CodeOrName?this.code.names:{}}},lu=class extends Hi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(zK(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>yo(e,r.names),{})}},Vi=class extends lu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},tS=class extends lu{},Ja=class extends Vi{};Ja.kind="else";var mo=class t extends Vi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ja(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(iq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Qa(this.condition,e,r),this}get names(){let e=super.names;return bm(e,this.condition),this.else&&yo(e,this.else.names),e}};mo.kind="if";var go=class extends Vi{};go.kind="for";var rS=class extends go{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Qa(this.iteration,e,r),this}get names(){return yo(super.names,this.iteration.names)}},nS=class extends go{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?Zn.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=bm(super.names,this.from);return bm(e,this.to)}},vm=class extends go{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Qa(this.iterable,e,r),this}get names(){return yo(super.names,this.iterable.names)}},uu=class extends Vi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};uu.kind="func";var du=class extends lu{render(e){return"return "+super.render(e)}};du.kind="return";var iS=class extends Vi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&yo(e,this.catch.names),this.finally&&yo(e,this.finally.names),e}},fu=class extends Vi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};fu.kind="catch";var pu=class extends Vi{render(e){return"finally"+super.render(e)}};pu.kind="finally";var sS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
176
|
-
`:""},this._extScope=e,this._scope=new Zn.Scope({parent:e}),this._nodes=[new tS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new Yb(e,s,n)),s}const(e,r,n){return this._def(Zn.varKinds.const,e,r,n)}let(e,r,n){return this._def(Zn.varKinds.let,e,r,n)}var(e,r,n){return this._def(Zn.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Tm(e,r,n))}add(e,r){return this._leafNode(new Xb(e,_e.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Oe.nil&&this._leafNode(new eS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Oe.addCodeArg)(r,i));return r.push("}"),new Oe._Code(r)}if(e,r,n){if(this._blockNode(new mo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mo(e))}else(){return this._elseNode(new Ja)}endIf(){return this._endBlockNode(mo,Ja)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new rS(e),r)}forRange(e,r,n,i,s=this.opts.es5?Zn.varKinds.var:Zn.varKinds.let){let o=this._scope.toName(e);return this._for(new nS(s,o,r,n),()=>i(o))}forOf(e,r,n,i=Zn.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Oe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Oe._)`${o}.length`,a=>{this.var(s,(0,Oe._)`${o}[${a}]`),n(s)})}return this._for(new vm("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?Zn.varKinds.var:Zn.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Oe._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new vm("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(go)}label(e){return this._leafNode(new Jb(e))}break(e){return this._leafNode(new Qb(e))}return(e){let r=new du;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(du)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new iS;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new fu(s),r(s)}return n&&(this._currNode=i.finally=new pu,this.code(n)),this._endBlockNode(fu,pu)}throw(e){return this._leafNode(new Zb(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Oe.nil,n,i){return this._blockNode(new uu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(uu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};_e.CodeGen=sS;function yo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function bm(t,e){return e instanceof Oe._CodeOrName?yo(t,e.names):t}function Qa(t,e,r){if(t instanceof Oe.Name)return n(t);if(!i(t))return t;return new Oe._Code(t._items.reduce((s,o)=>(o instanceof Oe.Name&&(o=n(o)),o instanceof Oe._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof Oe._Code&&s._items.some(o=>o instanceof Oe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function zK(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function iq(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Oe._)`!${oS(t)}`}_e.not=iq;var WK=sq(_e.operators.AND);function GK(...t){return t.reduce(WK)}_e.and=GK;var KK=sq(_e.operators.OR);function YK(...t){return t.reduce(KK)}_e.or=YK;function sq(t){return(e,r)=>e===Oe.nil?r:r===Oe.nil?e:(0,Oe._)`${oS(e)} ${t} ${oS(r)}`}function oS(t){return t instanceof Oe.Name?t:(0,Oe._)`(${t})`}});var we=R(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.checkStrictMode=ke.getErrorPath=ke.Type=ke.useFunc=ke.setEvaluated=ke.evaluatedPropsToName=ke.mergeEvaluated=ke.eachItem=ke.unescapeJsonPointer=ke.escapeJsonPointer=ke.escapeFragment=ke.unescapeFragment=ke.schemaRefOrVal=ke.schemaHasRulesButRef=ke.schemaHasRules=ke.checkUnknownRules=ke.alwaysValidSchema=ke.toHash=void 0;var ct=ve(),XK=cu();function JK(t){let e={};for(let r of t)e[r]=!0;return e}ke.toHash=JK;function QK(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(cq(t,e),!lq(e,t.self.RULES.all))}ke.alwaysValidSchema=QK;function cq(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||fq(t,`unknown keyword: "${s}"`)}ke.checkUnknownRules=cq;function lq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ke.schemaHasRules=lq;function ZK(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ke.schemaHasRulesButRef=ZK;function eY({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${t}${e}${(0,ct.getProperty)(n)}`}ke.schemaRefOrVal=eY;function tY(t){return uq(decodeURIComponent(t))}ke.unescapeFragment=tY;function rY(t){return encodeURIComponent(cS(t))}ke.escapeFragment=rY;function cS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ke.escapeJsonPointer=cS;function uq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ke.unescapeJsonPointer=uq;function nY(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ke.eachItem=nY;function oq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof ct.Name?(s instanceof ct.Name?t(i,s,o):e(i,s,o),o):s instanceof ct.Name?(e(i,o,s),s):r(s,o);return a===ct.Name&&!(c instanceof ct.Name)?n(i,c):c}}ke.mergeEvaluated={props:oq({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ct._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ct._)`${r} || {}`),lS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:dq}),items:oq({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ct._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ct._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function dq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ct._)`{}`);return e!==void 0&&lS(t,r,e),r}ke.evaluatedPropsToName=dq;function lS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ct._)`${e}${(0,ct.getProperty)(n)}`,!0))}ke.setEvaluated=lS;var aq={};function iY(t,e){return t.scopeValue("func",{ref:e,code:aq[e.code]||(aq[e.code]=new XK._Code(e.code))})}ke.useFunc=iY;var aS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(aS||(ke.Type=aS={}));function sY(t,e,r){if(t instanceof ct.Name){let n=e===aS.Num;return r?n?(0,ct._)`"[" + ${t} + "]"`:(0,ct._)`"['" + ${t} + "']"`:n?(0,ct._)`"/" + ${t}`:(0,ct._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(t).toString():"/"+cS(t)}ke.getErrorPath=sY;function fq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ke.checkStrictMode=fq});var wn=R(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var Sr=ve(),oY={data:new Sr.Name("data"),valCxt:new Sr.Name("valCxt"),instancePath:new Sr.Name("instancePath"),parentData:new Sr.Name("parentData"),parentDataProperty:new Sr.Name("parentDataProperty"),rootData:new Sr.Name("rootData"),dynamicAnchors:new Sr.Name("dynamicAnchors"),vErrors:new Sr.Name("vErrors"),errors:new Sr.Name("errors"),this:new Sr.Name("this"),self:new Sr.Name("self"),scope:new Sr.Name("scope"),json:new Sr.Name("json"),jsonPos:new Sr.Name("jsonPos"),jsonLen:new Sr.Name("jsonLen"),jsonPart:new Sr.Name("jsonPart")};uS.default=oY});var hu=R(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendErrors=_r.resetErrorsCount=_r.reportExtraError=_r.reportError=_r.keyword$DataError=_r.keywordError=void 0;var $e=ve(),_m=we(),Dr=wn();_r.keywordError={message:({keyword:t})=>(0,$e.str)`must pass "${t}" keyword validation`};_r.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,$e.str)`"${t}" keyword must be ${e} ($data)`:(0,$e.str)`"${t}" keyword is invalid ($data)`};function aY(t,e=_r.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=mq(t,e,r);n??(o||a)?pq(s,c):hq(i,(0,$e._)`[${c}]`)}_r.reportError=aY;function cY(t,e=_r.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=mq(t,e,r);pq(i,a),s||o||hq(n,Dr.default.vErrors)}_r.reportExtraError=cY;function lY(t,e){t.assign(Dr.default.errors,e),t.if((0,$e._)`${Dr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,$e._)`${Dr.default.vErrors}.length`,e),()=>t.assign(Dr.default.vErrors,null)))}_r.resetErrorsCount=lY;function uY({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Dr.default.errors,a=>{t.const(o,(0,$e._)`${Dr.default.vErrors}[${a}]`),t.if((0,$e._)`${o}.instancePath === undefined`,()=>t.assign((0,$e._)`${o}.instancePath`,(0,$e.strConcat)(Dr.default.instancePath,s.errorPath))),t.assign((0,$e._)`${o}.schemaPath`,(0,$e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,$e._)`${o}.schema`,r),t.assign((0,$e._)`${o}.data`,n))})}_r.extendErrors=uY;function pq(t,e){let r=t.const("err",e);t.if((0,$e._)`${Dr.default.vErrors} === null`,()=>t.assign(Dr.default.vErrors,(0,$e._)`[${r}]`),(0,$e._)`${Dr.default.vErrors}.push(${r})`),t.code((0,$e._)`${Dr.default.errors}++`)}function hq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,$e._)`new ${t.ValidationError}(${e})`):(r.assign((0,$e._)`${n}.errors`,e),r.return(!1))}var To={keyword:new $e.Name("keyword"),schemaPath:new $e.Name("schemaPath"),params:new $e.Name("params"),propertyName:new $e.Name("propertyName"),message:new $e.Name("message"),schema:new $e.Name("schema"),parentSchema:new $e.Name("parentSchema")};function mq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,$e._)`{}`:dY(t,e,r)}function dY(t,e,r={}){let{gen:n,it:i}=t,s=[fY(i,r),pY(t,r)];return hY(t,e,s),n.object(...s)}function fY({errorPath:t},{instancePath:e}){let r=e?(0,$e.str)`${t}${(0,_m.getErrorPath)(e,_m.Type.Str)}`:t;return[Dr.default.instancePath,(0,$e.strConcat)(Dr.default.instancePath,r)]}function pY({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,$e.str)`${e}/${t}`;return r&&(i=(0,$e.str)`${i}${(0,_m.getErrorPath)(r,_m.Type.Str)}`),[To.schemaPath,i]}function hY(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([To.keyword,i],[To.params,typeof e=="function"?e(t):e||(0,$e._)`{}`]),c.messages&&n.push([To.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([To.schema,o],[To.parentSchema,(0,$e._)`${u}${d}`],[Dr.default.data,s]),l&&n.push([To.propertyName,l])}});var yq=R(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.boolOrEmptySchema=Za.topBoolOrEmptySchema=void 0;var mY=hu(),gY=ve(),yY=wn(),TY={message:"boolean schema is false"};function vY(t){let{gen:e,schema:r,validateName:n}=t;r===!1?gq(t,!1):typeof r=="object"&&r.$async===!0?e.return(yY.default.data):(e.assign((0,gY._)`${n}.errors`,null),e.return(!0))}Za.topBoolOrEmptySchema=vY;function bY(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),gq(t)):r.var(e,!0)}Za.boolOrEmptySchema=bY;function gq(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,mY.reportError)(i,TY,void 0,e)}});var dS=R(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.getRules=ec.isJSONType=void 0;var SY=["string","number","integer","boolean","null","object","array"],_Y=new Set(SY);function kY(t){return typeof t=="string"&&_Y.has(t)}ec.isJSONType=kY;function NY(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ec.getRules=NY});var fS=R(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.shouldUseRule=Cs.shouldUseGroup=Cs.schemaHasRulesForType=void 0;function RY({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Tq(t,n)}Cs.schemaHasRulesForType=RY;function Tq(t,e){return e.rules.some(r=>vq(t,r))}Cs.shouldUseGroup=Tq;function vq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Cs.shouldUseRule=vq});var mu=R(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.reportTypeError=kr.checkDataTypes=kr.checkDataType=kr.coerceAndCheckDataType=kr.getJSONTypes=kr.getSchemaTypes=kr.DataType=void 0;var PY=dS(),EY=fS(),wY=hu(),be=ve(),bq=we(),tc;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(tc||(kr.DataType=tc={}));function CY(t){let e=Sq(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}kr.getSchemaTypes=CY;function Sq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(PY.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}kr.getJSONTypes=Sq;function DY(t,e){let{gen:r,data:n,opts:i}=t,s=AY(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,EY.schemaHasRulesForType)(t,e[0]));if(o){let a=hS(e,n,i.strictNumbers,tc.Wrong);r.if(a,()=>{s.length?IY(t,e,s):mS(t)})}return o}kr.coerceAndCheckDataType=DY;var _q=new Set(["string","number","integer","boolean","null"]);function AY(t,e){return e?t.filter(r=>_q.has(r)||e==="array"&&r==="array"):[]}function IY(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,be._)`typeof ${i}`),a=n.let("coerced",(0,be._)`undefined`);s.coerceTypes==="array"&&n.if((0,be._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,be._)`${i}[0]`).assign(o,(0,be._)`typeof ${i}`).if(hS(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,be._)`${a} !== undefined`);for(let l of r)(_q.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),mS(t),n.endIf(),n.if((0,be._)`${a} !== undefined`,()=>{n.assign(i,a),OY(t,a)});function c(l){switch(l){case"string":n.elseIf((0,be._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,be._)`"" + ${i}`).elseIf((0,be._)`${i} === null`).assign(a,(0,be._)`""`);return;case"number":n.elseIf((0,be._)`${o} == "boolean" || ${i} === null
|
|
175
|
+
`,r)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let r=pm(e),n=Xa(r);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let r=pm(e),n=Xa(r);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,r){return this.type!=="comment"||this.indent<=r?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};YL.Parser=Bb});var eq=R(su=>{"use strict";var XL=Eb(),yK=Xl(),iu=Zl(),TK=Rv(),vK=qe(),bK=Fb(),JL=jb();function QL(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new bK.LineCounter||null,prettyErrors:e}}function SK(t,e={}){let{lineCounter:r,prettyErrors:n}=QL(e),i=new JL.Parser(r?.addNewLine),s=new XL.Composer(e),o=Array.from(s.compose(i.parse(t)));if(n&&r)for(let a of o)a.errors.forEach(iu.prettifyError(t,r)),a.warnings.forEach(iu.prettifyError(t,r));return o.length>0?o:Object.assign([],{empty:!0},s.streamInfo())}function ZL(t,e={}){let{lineCounter:r,prettyErrors:n}=QL(e),i=new JL.Parser(r?.addNewLine),s=new XL.Composer(e),o=null;for(let a of s.compose(i.parse(t),!0,t.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new iu.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&r&&(o.errors.forEach(iu.prettifyError(t,r)),o.warnings.forEach(iu.prettifyError(t,r))),o}function _K(t,e,r){let n;typeof e=="function"?n=e:r===void 0&&e&&typeof e=="object"&&(r=e);let i=ZL(t,r);if(!i)return null;if(i.warnings.forEach(s=>TK.warn(i.options.logLevel,s)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},r))}function kK(t,e,r){let n=null;if(typeof e=="function"||Array.isArray(e)?n=e:r===void 0&&e&&(r=e),typeof r=="string"&&(r=r.length),typeof r=="number"){let i=Math.round(r);r=i<1?void 0:i>8?{indent:8}:{indent:i}}if(t===void 0){let{keepUndefined:i}=r??e??{};if(!i)return}return vK.isDocument(t)&&!n?t.toString(r):new yK.Document(t,n,r).toString(r)}su.parse=_K;su.parseAllDocuments=SK;su.parseDocument=ZL;su.stringify=kK});var Hb=R(Qe=>{"use strict";var NK=Eb(),RK=Xl(),PK=ab(),Ub=Zl(),EK=xl(),Es=qe(),wK=ks(),CK=jt(),DK=Rs(),AK=Ps(),IK=dm(),OK=qb(),xK=Fb(),MK=jb(),hm=eq(),tq=Dl();Qe.Composer=NK.Composer;Qe.Document=RK.Document;Qe.Schema=PK.Schema;Qe.YAMLError=Ub.YAMLError;Qe.YAMLParseError=Ub.YAMLParseError;Qe.YAMLWarning=Ub.YAMLWarning;Qe.Alias=EK.Alias;Qe.isAlias=Es.isAlias;Qe.isCollection=Es.isCollection;Qe.isDocument=Es.isDocument;Qe.isMap=Es.isMap;Qe.isNode=Es.isNode;Qe.isPair=Es.isPair;Qe.isScalar=Es.isScalar;Qe.isSeq=Es.isSeq;Qe.Pair=wK.Pair;Qe.Scalar=CK.Scalar;Qe.YAMLMap=DK.YAMLMap;Qe.YAMLSeq=AK.YAMLSeq;Qe.CST=IK;Qe.Lexer=OK.Lexer;Qe.LineCounter=xK.LineCounter;Qe.Parser=MK.Parser;Qe.parse=hm.parse;Qe.parseAllDocuments=hm.parseAllDocuments;Qe.parseDocument=hm.parseDocument;Qe.stringify=hm.stringify;Qe.visit=tq.visit;Qe.visitAsync=tq.visitAsync});var cu=R(je=>{"use strict";Object.defineProperty(je,"__esModule",{value:!0});je.regexpCode=je.getEsmExportName=je.getProperty=je.safeStringify=je.stringify=je.strConcat=je.addCodeArg=je.str=je._=je.nil=je._Code=je.Name=je.IDENTIFIER=je._CodeOrName=void 0;var ou=class{};je._CodeOrName=ou;je.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var ho=class extends ou{constructor(e){if(super(),!je.IDENTIFIER.test(e))throw new Error("CodeGen: name must be a valid identifier");this.str=e}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};je.Name=ho;var wn=class extends ou{constructor(e){super(),this._items=typeof e=="string"?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let e=this._items[0];return e===""||e==='""'}get str(){var e;return(e=this._str)!==null&&e!==void 0?e:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var e;return(e=this._names)!==null&&e!==void 0?e:this._names=this._items.reduce((r,n)=>(n instanceof ho&&(r[n.str]=(r[n.str]||0)+1),r),{})}};je._Code=wn;je.nil=new wn("");function rq(t,...e){let r=[t[0]],n=0;for(;n<e.length;)zb(r,e[n]),r.push(t[++n]);return new wn(r)}je._=rq;var Vb=new wn("+");function nq(t,...e){let r=[au(t[0])],n=0;for(;n<e.length;)r.push(Vb),zb(r,e[n]),r.push(Vb,au(t[++n]));return LK(r),new wn(r)}je.str=nq;function zb(t,e){e instanceof wn?t.push(...e._items):e instanceof ho?t.push(e):t.push(FK(e))}je.addCodeArg=zb;function LK(t){let e=1;for(;e<t.length-1;){if(t[e]===Vb){let r=qK(t[e-1],t[e+1]);if(r!==void 0){t.splice(e-1,3,r);continue}t[e++]="+"}e++}}function qK(t,e){if(e==='""')return t;if(t==='""')return e;if(typeof t=="string")return e instanceof ho||t[t.length-1]!=='"'?void 0:typeof e!="string"?`${t.slice(0,-1)}${e}"`:e[0]==='"'?t.slice(0,-1)+e.slice(1):void 0;if(typeof e=="string"&&e[0]==='"'&&!(t instanceof ho))return`"${t}${e.slice(1)}`}function $K(t,e){return e.emptyStr()?t:t.emptyStr()?e:nq`${t}${e}`}je.strConcat=$K;function FK(t){return typeof t=="number"||typeof t=="boolean"||t===null?t:au(Array.isArray(t)?t.join(","):t)}function BK(t){return new wn(au(t))}je.stringify=BK;function au(t){return JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}je.safeStringify=au;function jK(t){return typeof t=="string"&&je.IDENTIFIER.test(t)?new wn(`.${t}`):rq`[${t}]`}je.getProperty=jK;function UK(t){if(typeof t=="string"&&je.IDENTIFIER.test(t))return new wn(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)}je.getEsmExportName=UK;function HK(t){return new wn(t.toString())}je.regexpCode=HK});var Kb=R(Kr=>{"use strict";Object.defineProperty(Kr,"__esModule",{value:!0});Kr.ValueScope=Kr.ValueScopeName=Kr.Scope=Kr.varKinds=Kr.UsedValueState=void 0;var Gr=cu(),Wb=class extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}},mm;(function(t){t[t.Started=0]="Started",t[t.Completed=1]="Completed"})(mm||(Kr.UsedValueState=mm={}));Kr.varKinds={const:new Gr.Name("const"),let:new Gr.Name("let"),var:new Gr.Name("var")};var gm=class{constructor({prefixes:e,parent:r}={}){this._names={},this._prefixes=e,this._parent=r}toName(e){return e instanceof Gr.Name?e:this.name(e)}name(e){return new Gr.Name(this._newName(e))}_newName(e){let r=this._names[e]||this._nameGroup(e);return`${e}${r.index++}`}_nameGroup(e){var r,n;if(!((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0)&&n.has(e)||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}};Kr.Scope=gm;var ym=class extends Gr.Name{constructor(e,r){super(r),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=(0,Gr._)`.${new Gr.Name(r)}[${n}]`}};Kr.ValueScopeName=ym;var VK=(0,Gr._)`\n`,Gb=class extends gm{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?VK:Gr.nil}}get(){return this._scope}name(e){return new ym(e,this._newName(e))}value(e,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");let i=this.toName(e),{prefix:s}=i,o=(n=r.key)!==null&&n!==void 0?n:r.ref,a=this._values[s];if(a){let u=a.get(o);if(u)return u}else a=this._values[s]=new Map;a.set(o,i);let c=this._scope[s]||(this._scope[s]=[]),l=c.length;return c[l]=r.ref,i.setValue(r,{property:s,itemIndex:l}),i}getValue(e,r){let n=this._values[e];if(n)return n.get(r)}scopeRefs(e,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Gr._)`${e}${n.scopePath}`})}scopeCode(e=this._values,r,n){return this._reduceValues(e,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(e,r,n={},i){let s=Gr.nil;for(let o in e){let a=e[o];if(!a)continue;let c=n[o]=n[o]||new Map;a.forEach(l=>{if(c.has(l))return;c.set(l,mm.Started);let u=r(l);if(u){let d=this.opts.es5?Kr.varKinds.var:Kr.varKinds.const;s=(0,Gr._)`${s}${d} ${l} = ${u};${this.opts._n}`}else if(u=i?.(l))s=(0,Gr._)`${s}${u}${this.opts._n}`;else throw new Wb(l);c.set(l,mm.Completed)})}return s}};Kr.ValueScope=Gb});var ve=R(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});_e.or=_e.and=_e.not=_e.CodeGen=_e.operators=_e.varKinds=_e.ValueScopeName=_e.ValueScope=_e.Scope=_e.Name=_e.regexpCode=_e.stringify=_e.getProperty=_e.nil=_e.strConcat=_e.str=_e._=void 0;var Oe=cu(),ei=Kb(),ws=cu();Object.defineProperty(_e,"_",{enumerable:!0,get:function(){return ws._}});Object.defineProperty(_e,"str",{enumerable:!0,get:function(){return ws.str}});Object.defineProperty(_e,"strConcat",{enumerable:!0,get:function(){return ws.strConcat}});Object.defineProperty(_e,"nil",{enumerable:!0,get:function(){return ws.nil}});Object.defineProperty(_e,"getProperty",{enumerable:!0,get:function(){return ws.getProperty}});Object.defineProperty(_e,"stringify",{enumerable:!0,get:function(){return ws.stringify}});Object.defineProperty(_e,"regexpCode",{enumerable:!0,get:function(){return ws.regexpCode}});Object.defineProperty(_e,"Name",{enumerable:!0,get:function(){return ws.Name}});var Sm=Kb();Object.defineProperty(_e,"Scope",{enumerable:!0,get:function(){return Sm.Scope}});Object.defineProperty(_e,"ValueScope",{enumerable:!0,get:function(){return Sm.ValueScope}});Object.defineProperty(_e,"ValueScopeName",{enumerable:!0,get:function(){return Sm.ValueScopeName}});Object.defineProperty(_e,"varKinds",{enumerable:!0,get:function(){return Sm.varKinds}});_e.operators={GT:new Oe._Code(">"),GTE:new Oe._Code(">="),LT:new Oe._Code("<"),LTE:new Oe._Code("<="),EQ:new Oe._Code("==="),NEQ:new Oe._Code("!=="),NOT:new Oe._Code("!"),OR:new Oe._Code("||"),AND:new Oe._Code("&&"),ADD:new Oe._Code("+")};var Hi=class{optimizeNodes(){return this}optimizeNames(e,r){return this}},Yb=class extends Hi{constructor(e,r,n){super(),this.varKind=e,this.name=r,this.rhs=n}render({es5:e,_n:r}){let n=e?ei.varKinds.var:this.varKind,i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(e,r){if(e[this.name.str])return this.rhs&&(this.rhs=Qa(this.rhs,e,r)),this}get names(){return this.rhs instanceof Oe._CodeOrName?this.rhs.names:{}}},Tm=class extends Hi{constructor(e,r,n){super(),this.lhs=e,this.rhs=r,this.sideEffects=n}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof Oe.Name&&!e[this.lhs.str]&&!this.sideEffects))return this.rhs=Qa(this.rhs,e,r),this}get names(){let e=this.lhs instanceof Oe.Name?{}:{...this.lhs.names};return bm(e,this.rhs)}},Xb=class extends Tm{constructor(e,r,n,i){super(e,n,i),this.op=r}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}},Jb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}},Qb=class extends Hi{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}},Zb=class extends Hi{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}},eS=class extends Hi{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,r){return this.code=Qa(this.code,e,r),this}get names(){return this.code instanceof Oe._CodeOrName?this.code.names:{}}},lu=class extends Hi{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((r,n)=>r+n.render(e),"")}optimizeNodes(){let{nodes:e}=this,r=e.length;for(;r--;){let n=e[r].optimizeNodes();Array.isArray(n)?e.splice(r,1,...n):n?e[r]=n:e.splice(r,1)}return e.length>0?this:void 0}optimizeNames(e,r){let{nodes:n}=this,i=n.length;for(;i--;){let s=n[i];s.optimizeNames(e,r)||(zK(e,s.names),n.splice(i,1))}return n.length>0?this:void 0}get names(){return this.nodes.reduce((e,r)=>yo(e,r.names),{})}},Vi=class extends lu{render(e){return"{"+e._n+super.render(e)+"}"+e._n}},tS=class extends lu{},Ja=class extends Vi{};Ja.kind="else";var mo=class t extends Vi{constructor(e,r){super(r),this.condition=e}render(e){let r=`if(${this.condition})`+super.render(e);return this.else&&(r+="else "+this.else.render(e)),r}optimizeNodes(){super.optimizeNodes();let e=this.condition;if(e===!0)return this.nodes;let r=this.else;if(r){let n=r.optimizeNodes();r=this.else=Array.isArray(n)?new Ja(n):n}if(r)return e===!1?r instanceof t?r:r.nodes:this.nodes.length?this:new t(iq(e),r instanceof t?[r]:r.nodes);if(!(e===!1||!this.nodes.length))return this}optimizeNames(e,r){var n;if(this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(e,r),!!(super.optimizeNames(e,r)||this.else))return this.condition=Qa(this.condition,e,r),this}get names(){let e=super.names;return bm(e,this.condition),this.else&&yo(e,this.else.names),e}};mo.kind="if";var go=class extends Vi{};go.kind="for";var rS=class extends go{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iteration=Qa(this.iteration,e,r),this}get names(){return yo(super.names,this.iteration.names)}},nS=class extends go{constructor(e,r,n,i){super(),this.varKind=e,this.name=r,this.from=n,this.to=i}render(e){let r=e.es5?ei.varKinds.var:this.varKind,{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(e)}get names(){let e=bm(super.names,this.from);return bm(e,this.to)}},vm=class extends go{constructor(e,r,n,i){super(),this.loop=e,this.varKind=r,this.name=n,this.iterable=i}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,r){if(super.optimizeNames(e,r))return this.iterable=Qa(this.iterable,e,r),this}get names(){return yo(super.names,this.iterable.names)}},uu=class extends Vi{constructor(e,r,n){super(),this.name=e,this.args=r,this.async=n}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}};uu.kind="func";var du=class extends lu{render(e){return"return "+super.render(e)}};du.kind="return";var iS=class extends Vi{render(e){let r="try"+super.render(e);return this.catch&&(r+=this.catch.render(e)),this.finally&&(r+=this.finally.render(e)),r}optimizeNodes(){var e,r;return super.optimizeNodes(),(e=this.catch)===null||e===void 0||e.optimizeNodes(),(r=this.finally)===null||r===void 0||r.optimizeNodes(),this}optimizeNames(e,r){var n,i;return super.optimizeNames(e,r),(n=this.catch)===null||n===void 0||n.optimizeNames(e,r),(i=this.finally)===null||i===void 0||i.optimizeNames(e,r),this}get names(){let e=super.names;return this.catch&&yo(e,this.catch.names),this.finally&&yo(e,this.finally.names),e}},fu=class extends Vi{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}};fu.kind="catch";var pu=class extends Vi{render(e){return"finally"+super.render(e)}};pu.kind="finally";var sS=class{constructor(e,r={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...r,_n:r.lines?`
|
|
176
|
+
`:""},this._extScope=e,this._scope=new ei.Scope({parent:e}),this._nodes=[new tS]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,r){let n=this._extScope.value(e,r);return(this._values[n.prefix]||(this._values[n.prefix]=new Set)).add(n),n}getScopeValue(e,r){return this._extScope.getValue(e,r)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,r,n,i){let s=this._scope.toName(r);return n!==void 0&&i&&(this._constants[s.str]=n),this._leafNode(new Yb(e,s,n)),s}const(e,r,n){return this._def(ei.varKinds.const,e,r,n)}let(e,r,n){return this._def(ei.varKinds.let,e,r,n)}var(e,r,n){return this._def(ei.varKinds.var,e,r,n)}assign(e,r,n){return this._leafNode(new Tm(e,r,n))}add(e,r){return this._leafNode(new Xb(e,_e.operators.ADD,r))}code(e){return typeof e=="function"?e():e!==Oe.nil&&this._leafNode(new eS(e)),this}object(...e){let r=["{"];for(let[n,i]of e)r.length>1&&r.push(","),r.push(n),(n!==i||this.opts.es5)&&(r.push(":"),(0,Oe.addCodeArg)(r,i));return r.push("}"),new Oe._Code(r)}if(e,r,n){if(this._blockNode(new mo(e)),r&&n)this.code(r).else().code(n).endIf();else if(r)this.code(r).endIf();else if(n)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new mo(e))}else(){return this._elseNode(new Ja)}endIf(){return this._endBlockNode(mo,Ja)}_for(e,r){return this._blockNode(e),r&&this.code(r).endFor(),this}for(e,r){return this._for(new rS(e),r)}forRange(e,r,n,i,s=this.opts.es5?ei.varKinds.var:ei.varKinds.let){let o=this._scope.toName(e);return this._for(new nS(s,o,r,n),()=>i(o))}forOf(e,r,n,i=ei.varKinds.const){let s=this._scope.toName(e);if(this.opts.es5){let o=r instanceof Oe.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,Oe._)`${o}.length`,a=>{this.var(s,(0,Oe._)`${o}[${a}]`),n(s)})}return this._for(new vm("of",i,s,r),()=>n(s))}forIn(e,r,n,i=this.opts.es5?ei.varKinds.var:ei.varKinds.const){if(this.opts.ownProperties)return this.forOf(e,(0,Oe._)`Object.keys(${r})`,n);let s=this._scope.toName(e);return this._for(new vm("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(go)}label(e){return this._leafNode(new Jb(e))}break(e){return this._leafNode(new Qb(e))}return(e){let r=new du;if(this._blockNode(r),this.code(e),r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(du)}try(e,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');let i=new iS;if(this._blockNode(i),this.code(e),r){let s=this.name("e");this._currNode=i.catch=new fu(s),r(s)}return n&&(this._currNode=i.finally=new pu,this.code(n)),this._endBlockNode(fu,pu)}throw(e){return this._leafNode(new Zb(e))}block(e,r){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(r),this}endBlock(e){let r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");let n=this._nodes.length-r;if(n<0||e!==void 0&&n!==e)throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${e} expected`);return this._nodes.length=r,this}func(e,r=Oe.nil,n,i){return this._blockNode(new uu(e,r,n)),i&&this.code(i).endFunc(),this}endFunc(){return this._endBlockNode(uu)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,r){let n=this._currNode;if(n instanceof e||r&&n instanceof r)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${r?`${e.kind}/${r.kind}`:e.kind}"`)}_elseNode(e){let r=this._currNode;if(!(r instanceof mo))throw new Error('CodeGen: "else" without "if"');return this._currNode=r.else=e,this}get _root(){return this._nodes[0]}get _currNode(){let e=this._nodes;return e[e.length-1]}set _currNode(e){let r=this._nodes;r[r.length-1]=e}};_e.CodeGen=sS;function yo(t,e){for(let r in e)t[r]=(t[r]||0)+(e[r]||0);return t}function bm(t,e){return e instanceof Oe._CodeOrName?yo(t,e.names):t}function Qa(t,e,r){if(t instanceof Oe.Name)return n(t);if(!i(t))return t;return new Oe._Code(t._items.reduce((s,o)=>(o instanceof Oe.Name&&(o=n(o)),o instanceof Oe._Code?s.push(...o._items):s.push(o),s),[]));function n(s){let o=r[s.str];return o===void 0||e[s.str]!==1?s:(delete e[s.str],o)}function i(s){return s instanceof Oe._Code&&s._items.some(o=>o instanceof Oe.Name&&e[o.str]===1&&r[o.str]!==void 0)}}function zK(t,e){for(let r in e)t[r]=(t[r]||0)-(e[r]||0)}function iq(t){return typeof t=="boolean"||typeof t=="number"||t===null?!t:(0,Oe._)`!${oS(t)}`}_e.not=iq;var WK=sq(_e.operators.AND);function GK(...t){return t.reduce(WK)}_e.and=GK;var KK=sq(_e.operators.OR);function YK(...t){return t.reduce(KK)}_e.or=YK;function sq(t){return(e,r)=>e===Oe.nil?r:r===Oe.nil?e:(0,Oe._)`${oS(e)} ${t} ${oS(r)}`}function oS(t){return t instanceof Oe.Name?t:(0,Oe._)`(${t})`}});var we=R(ke=>{"use strict";Object.defineProperty(ke,"__esModule",{value:!0});ke.checkStrictMode=ke.getErrorPath=ke.Type=ke.useFunc=ke.setEvaluated=ke.evaluatedPropsToName=ke.mergeEvaluated=ke.eachItem=ke.unescapeJsonPointer=ke.escapeJsonPointer=ke.escapeFragment=ke.unescapeFragment=ke.schemaRefOrVal=ke.schemaHasRulesButRef=ke.schemaHasRules=ke.checkUnknownRules=ke.alwaysValidSchema=ke.toHash=void 0;var ct=ve(),XK=cu();function JK(t){let e={};for(let r of t)e[r]=!0;return e}ke.toHash=JK;function QK(t,e){return typeof e=="boolean"?e:Object.keys(e).length===0?!0:(cq(t,e),!lq(e,t.self.RULES.all))}ke.alwaysValidSchema=QK;function cq(t,e=t.schema){let{opts:r,self:n}=t;if(!r.strictSchema||typeof e=="boolean")return;let i=n.RULES.keywords;for(let s in e)i[s]||fq(t,`unknown keyword: "${s}"`)}ke.checkUnknownRules=cq;function lq(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(e[r])return!0;return!1}ke.schemaHasRules=lq;function ZK(t,e){if(typeof t=="boolean")return!t;for(let r in t)if(r!=="$ref"&&e.all[r])return!0;return!1}ke.schemaHasRulesButRef=ZK;function eY({topSchemaRef:t,schemaPath:e},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,ct._)`${r}`}return(0,ct._)`${t}${e}${(0,ct.getProperty)(n)}`}ke.schemaRefOrVal=eY;function tY(t){return uq(decodeURIComponent(t))}ke.unescapeFragment=tY;function rY(t){return encodeURIComponent(cS(t))}ke.escapeFragment=rY;function cS(t){return typeof t=="number"?`${t}`:t.replace(/~/g,"~0").replace(/\//g,"~1")}ke.escapeJsonPointer=cS;function uq(t){return t.replace(/~1/g,"/").replace(/~0/g,"~")}ke.unescapeJsonPointer=uq;function nY(t,e){if(Array.isArray(t))for(let r of t)e(r);else e(t)}ke.eachItem=nY;function oq({mergeNames:t,mergeToName:e,mergeValues:r,resultToName:n}){return(i,s,o,a)=>{let c=o===void 0?s:o instanceof ct.Name?(s instanceof ct.Name?t(i,s,o):e(i,s,o),o):s instanceof ct.Name?(e(i,o,s),s):r(s,o);return a===ct.Name&&!(c instanceof ct.Name)?n(i,c):c}}ke.mergeEvaluated={props:oq({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>{t.if((0,ct._)`${e} === true`,()=>t.assign(r,!0),()=>t.assign(r,(0,ct._)`${r} || {}`).code((0,ct._)`Object.assign(${r}, ${e})`))}),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>{e===!0?t.assign(r,!0):(t.assign(r,(0,ct._)`${r} || {}`),lS(t,r,e))}),mergeValues:(t,e)=>t===!0?!0:{...t,...e},resultToName:dq}),items:oq({mergeNames:(t,e,r)=>t.if((0,ct._)`${r} !== true && ${e} !== undefined`,()=>t.assign(r,(0,ct._)`${e} === true ? true : ${r} > ${e} ? ${r} : ${e}`)),mergeToName:(t,e,r)=>t.if((0,ct._)`${r} !== true`,()=>t.assign(r,e===!0?!0:(0,ct._)`${r} > ${e} ? ${r} : ${e}`)),mergeValues:(t,e)=>t===!0?!0:Math.max(t,e),resultToName:(t,e)=>t.var("items",e)})};function dq(t,e){if(e===!0)return t.var("props",!0);let r=t.var("props",(0,ct._)`{}`);return e!==void 0&&lS(t,r,e),r}ke.evaluatedPropsToName=dq;function lS(t,e,r){Object.keys(r).forEach(n=>t.assign((0,ct._)`${e}${(0,ct.getProperty)(n)}`,!0))}ke.setEvaluated=lS;var aq={};function iY(t,e){return t.scopeValue("func",{ref:e,code:aq[e.code]||(aq[e.code]=new XK._Code(e.code))})}ke.useFunc=iY;var aS;(function(t){t[t.Num=0]="Num",t[t.Str=1]="Str"})(aS||(ke.Type=aS={}));function sY(t,e,r){if(t instanceof ct.Name){let n=e===aS.Num;return r?n?(0,ct._)`"[" + ${t} + "]"`:(0,ct._)`"['" + ${t} + "']"`:n?(0,ct._)`"/" + ${t}`:(0,ct._)`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,ct.getProperty)(t).toString():"/"+cS(t)}ke.getErrorPath=sY;function fq(t,e,r=t.opts.strictSchema){if(r){if(e=`strict mode: ${e}`,r===!0)throw new Error(e);t.self.logger.warn(e)}}ke.checkStrictMode=fq});var Cn=R(uS=>{"use strict";Object.defineProperty(uS,"__esModule",{value:!0});var Sr=ve(),oY={data:new Sr.Name("data"),valCxt:new Sr.Name("valCxt"),instancePath:new Sr.Name("instancePath"),parentData:new Sr.Name("parentData"),parentDataProperty:new Sr.Name("parentDataProperty"),rootData:new Sr.Name("rootData"),dynamicAnchors:new Sr.Name("dynamicAnchors"),vErrors:new Sr.Name("vErrors"),errors:new Sr.Name("errors"),this:new Sr.Name("this"),self:new Sr.Name("self"),scope:new Sr.Name("scope"),json:new Sr.Name("json"),jsonPos:new Sr.Name("jsonPos"),jsonLen:new Sr.Name("jsonLen"),jsonPart:new Sr.Name("jsonPart")};uS.default=oY});var hu=R(_r=>{"use strict";Object.defineProperty(_r,"__esModule",{value:!0});_r.extendErrors=_r.resetErrorsCount=_r.reportExtraError=_r.reportError=_r.keyword$DataError=_r.keywordError=void 0;var $e=ve(),_m=we(),Dr=Cn();_r.keywordError={message:({keyword:t})=>(0,$e.str)`must pass "${t}" keyword validation`};_r.keyword$DataError={message:({keyword:t,schemaType:e})=>e?(0,$e.str)`"${t}" keyword must be ${e} ($data)`:(0,$e.str)`"${t}" keyword is invalid ($data)`};function aY(t,e=_r.keywordError,r,n){let{it:i}=t,{gen:s,compositeRule:o,allErrors:a}=i,c=mq(t,e,r);n??(o||a)?pq(s,c):hq(i,(0,$e._)`[${c}]`)}_r.reportError=aY;function cY(t,e=_r.keywordError,r){let{it:n}=t,{gen:i,compositeRule:s,allErrors:o}=n,a=mq(t,e,r);pq(i,a),s||o||hq(n,Dr.default.vErrors)}_r.reportExtraError=cY;function lY(t,e){t.assign(Dr.default.errors,e),t.if((0,$e._)`${Dr.default.vErrors} !== null`,()=>t.if(e,()=>t.assign((0,$e._)`${Dr.default.vErrors}.length`,e),()=>t.assign(Dr.default.vErrors,null)))}_r.resetErrorsCount=lY;function uY({gen:t,keyword:e,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");let o=t.name("err");t.forRange("i",i,Dr.default.errors,a=>{t.const(o,(0,$e._)`${Dr.default.vErrors}[${a}]`),t.if((0,$e._)`${o}.instancePath === undefined`,()=>t.assign((0,$e._)`${o}.instancePath`,(0,$e.strConcat)(Dr.default.instancePath,s.errorPath))),t.assign((0,$e._)`${o}.schemaPath`,(0,$e.str)`${s.errSchemaPath}/${e}`),s.opts.verbose&&(t.assign((0,$e._)`${o}.schema`,r),t.assign((0,$e._)`${o}.data`,n))})}_r.extendErrors=uY;function pq(t,e){let r=t.const("err",e);t.if((0,$e._)`${Dr.default.vErrors} === null`,()=>t.assign(Dr.default.vErrors,(0,$e._)`[${r}]`),(0,$e._)`${Dr.default.vErrors}.push(${r})`),t.code((0,$e._)`${Dr.default.errors}++`)}function hq(t,e){let{gen:r,validateName:n,schemaEnv:i}=t;i.$async?r.throw((0,$e._)`new ${t.ValidationError}(${e})`):(r.assign((0,$e._)`${n}.errors`,e),r.return(!1))}var To={keyword:new $e.Name("keyword"),schemaPath:new $e.Name("schemaPath"),params:new $e.Name("params"),propertyName:new $e.Name("propertyName"),message:new $e.Name("message"),schema:new $e.Name("schema"),parentSchema:new $e.Name("parentSchema")};function mq(t,e,r){let{createErrors:n}=t.it;return n===!1?(0,$e._)`{}`:dY(t,e,r)}function dY(t,e,r={}){let{gen:n,it:i}=t,s=[fY(i,r),pY(t,r)];return hY(t,e,s),n.object(...s)}function fY({errorPath:t},{instancePath:e}){let r=e?(0,$e.str)`${t}${(0,_m.getErrorPath)(e,_m.Type.Str)}`:t;return[Dr.default.instancePath,(0,$e.strConcat)(Dr.default.instancePath,r)]}function pY({keyword:t,it:{errSchemaPath:e}},{schemaPath:r,parentSchema:n}){let i=n?e:(0,$e.str)`${e}/${t}`;return r&&(i=(0,$e.str)`${i}${(0,_m.getErrorPath)(r,_m.Type.Str)}`),[To.schemaPath,i]}function hY(t,{params:e,message:r},n){let{keyword:i,data:s,schemaValue:o,it:a}=t,{opts:c,propertyName:l,topSchemaRef:u,schemaPath:d}=a;n.push([To.keyword,i],[To.params,typeof e=="function"?e(t):e||(0,$e._)`{}`]),c.messages&&n.push([To.message,typeof r=="function"?r(t):r]),c.verbose&&n.push([To.schema,o],[To.parentSchema,(0,$e._)`${u}${d}`],[Dr.default.data,s]),l&&n.push([To.propertyName,l])}});var yq=R(Za=>{"use strict";Object.defineProperty(Za,"__esModule",{value:!0});Za.boolOrEmptySchema=Za.topBoolOrEmptySchema=void 0;var mY=hu(),gY=ve(),yY=Cn(),TY={message:"boolean schema is false"};function vY(t){let{gen:e,schema:r,validateName:n}=t;r===!1?gq(t,!1):typeof r=="object"&&r.$async===!0?e.return(yY.default.data):(e.assign((0,gY._)`${n}.errors`,null),e.return(!0))}Za.topBoolOrEmptySchema=vY;function bY(t,e){let{gen:r,schema:n}=t;n===!1?(r.var(e,!1),gq(t)):r.var(e,!0)}Za.boolOrEmptySchema=bY;function gq(t,e){let{gen:r,data:n}=t,i={gen:r,keyword:"false schema",data:n,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,mY.reportError)(i,TY,void 0,e)}});var dS=R(ec=>{"use strict";Object.defineProperty(ec,"__esModule",{value:!0});ec.getRules=ec.isJSONType=void 0;var SY=["string","number","integer","boolean","null","object","array"],_Y=new Set(SY);function kY(t){return typeof t=="string"&&_Y.has(t)}ec.isJSONType=kY;function NY(){let t={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...t,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},t.number,t.string,t.array,t.object],post:{rules:[]},all:{},keywords:{}}}ec.getRules=NY});var fS=R(Cs=>{"use strict";Object.defineProperty(Cs,"__esModule",{value:!0});Cs.shouldUseRule=Cs.shouldUseGroup=Cs.schemaHasRulesForType=void 0;function RY({schema:t,self:e},r){let n=e.RULES.types[r];return n&&n!==!0&&Tq(t,n)}Cs.schemaHasRulesForType=RY;function Tq(t,e){return e.rules.some(r=>vq(t,r))}Cs.shouldUseGroup=Tq;function vq(t,e){var r;return t[e.keyword]!==void 0||((r=e.definition.implements)===null||r===void 0?void 0:r.some(n=>t[n]!==void 0))}Cs.shouldUseRule=vq});var mu=R(kr=>{"use strict";Object.defineProperty(kr,"__esModule",{value:!0});kr.reportTypeError=kr.checkDataTypes=kr.checkDataType=kr.coerceAndCheckDataType=kr.getJSONTypes=kr.getSchemaTypes=kr.DataType=void 0;var PY=dS(),EY=fS(),wY=hu(),be=ve(),bq=we(),tc;(function(t){t[t.Correct=0]="Correct",t[t.Wrong=1]="Wrong"})(tc||(kr.DataType=tc={}));function CY(t){let e=Sq(t.type);if(e.includes("null")){if(t.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!e.length&&t.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');t.nullable===!0&&e.push("null")}return e}kr.getSchemaTypes=CY;function Sq(t){let e=Array.isArray(t)?t:t?[t]:[];if(e.every(PY.isJSONType))return e;throw new Error("type must be JSONType or JSONType[]: "+e.join(","))}kr.getJSONTypes=Sq;function DY(t,e){let{gen:r,data:n,opts:i}=t,s=AY(e,i.coerceTypes),o=e.length>0&&!(s.length===0&&e.length===1&&(0,EY.schemaHasRulesForType)(t,e[0]));if(o){let a=hS(e,n,i.strictNumbers,tc.Wrong);r.if(a,()=>{s.length?IY(t,e,s):mS(t)})}return o}kr.coerceAndCheckDataType=DY;var _q=new Set(["string","number","integer","boolean","null"]);function AY(t,e){return e?t.filter(r=>_q.has(r)||e==="array"&&r==="array"):[]}function IY(t,e,r){let{gen:n,data:i,opts:s}=t,o=n.let("dataType",(0,be._)`typeof ${i}`),a=n.let("coerced",(0,be._)`undefined`);s.coerceTypes==="array"&&n.if((0,be._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,be._)`${i}[0]`).assign(o,(0,be._)`typeof ${i}`).if(hS(e,i,s.strictNumbers),()=>n.assign(a,i))),n.if((0,be._)`${a} !== undefined`);for(let l of r)(_q.has(l)||l==="array"&&s.coerceTypes==="array")&&c(l);n.else(),mS(t),n.endIf(),n.if((0,be._)`${a} !== undefined`,()=>{n.assign(i,a),OY(t,a)});function c(l){switch(l){case"string":n.elseIf((0,be._)`${o} == "number" || ${o} == "boolean"`).assign(a,(0,be._)`"" + ${i}`).elseIf((0,be._)`${i} === null`).assign(a,(0,be._)`""`);return;case"number":n.elseIf((0,be._)`${o} == "boolean" || ${i} === null
|
|
177
177
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(a,(0,be._)`+${i}`);return;case"integer":n.elseIf((0,be._)`${o} === "boolean" || ${i} === null
|
|
178
178
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(a,(0,be._)`+${i}`);return;case"boolean":n.elseIf((0,be._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(a,!1).elseIf((0,be._)`${i} === "true" || ${i} === 1`).assign(a,!0);return;case"null":n.elseIf((0,be._)`${i} === "" || ${i} === 0 || ${i} === false`),n.assign(a,null);return;case"array":n.elseIf((0,be._)`${o} === "string" || ${o} === "number"
|
|
179
|
-
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,be._)`[${i}]`)}}}function OY({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,be._)`${e} !== undefined`,()=>t.assign((0,be._)`${e}[${r}]`,n))}function pS(t,e,r,n=tc.Correct){let i=n===tc.Correct?be.operators.EQ:be.operators.NEQ,s;switch(t){case"null":return(0,be._)`${e} ${i} null`;case"array":s=(0,be._)`Array.isArray(${e})`;break;case"object":s=(0,be._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,be._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,be._)`typeof ${e} ${i} ${t}`}return n===tc.Correct?s:(0,be.not)(s);function o(a=be.nil){return(0,be.and)((0,be._)`typeof ${e} == "number"`,a,r?(0,be._)`isFinite(${e})`:be.nil)}}kr.checkDataType=pS;function hS(t,e,r,n){if(t.length===1)return pS(t[0],e,r,n);let i,s=(0,bq.toHash)(t);if(s.array&&s.object){let o=(0,be._)`typeof ${e} != "object"`;i=s.null?o:(0,be._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=be.nil;s.number&&delete s.integer;for(let o in s)i=(0,be.and)(i,pS(o,e,r,n));return i}kr.checkDataTypes=hS;var xY={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,be._)`{type: ${t}}`:(0,be._)`{type: ${e}}`};function mS(t){let e=MY(t);(0,wY.reportError)(e,xY)}kr.reportTypeError=mS;function MY(t){let{gen:e,data:r,schema:n}=t,i=(0,bq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Nq=R(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.assignDefaults=void 0;var rc=ve(),LY=we();function qY(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)kq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>kq(t,s,i.default))}km.assignDefaults=qY;function kq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,rc._)`${s}${(0,rc.getProperty)(e)}`;if(i){(0,LY.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,rc._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,rc._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,rc._)`${a} = ${(0,rc.stringify)(r)}`)}});var Cn=R(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateUnion=nt.validateArray=nt.usePattern=nt.callValidateCode=nt.schemaProperties=nt.allSchemaProperties=nt.noPropertyInData=nt.propertyInData=nt.isOwnProperty=nt.hasPropFunc=nt.reportMissingProp=nt.checkMissingProp=nt.checkReportMissingProp=void 0;var vt=ve(),gS=we(),Ds=wn(),$Y=we();function FY(t,e){let{gen:r,data:n,it:i}=t;r.if(TS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,vt._)`${e}`},!0),t.error()})}nt.checkReportMissingProp=FY;function BY({gen:t,data:e,it:{opts:r}},n,i){return(0,vt.or)(...n.map(s=>(0,vt.and)(TS(t,e,s,r.ownProperties),(0,vt._)`${i} = ${s}`)))}nt.checkMissingProp=BY;function jY(t,e){t.setParams({missingProperty:e},!0),t.error()}nt.reportMissingProp=jY;function Rq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,vt._)`Object.prototype.hasOwnProperty`})}nt.hasPropFunc=Rq;function yS(t,e,r){return(0,vt._)`${Rq(t)}.call(${e}, ${r})`}nt.isOwnProperty=yS;function UY(t,e,r,n){let i=(0,vt._)`${e}${(0,vt.getProperty)(r)} !== undefined`;return n?(0,vt._)`${i} && ${yS(t,e,r)}`:i}nt.propertyInData=UY;function TS(t,e,r,n){let i=(0,vt._)`${e}${(0,vt.getProperty)(r)} === undefined`;return n?(0,vt.or)(i,(0,vt.not)(yS(t,e,r))):i}nt.noPropertyInData=TS;function Pq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}nt.allSchemaProperties=Pq;function HY(t,e){return Pq(e).filter(r=>!(0,gS.alwaysValidSchema)(t,e[r]))}nt.schemaProperties=HY;function VY({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,vt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ds.default.instancePath,(0,vt.strConcat)(Ds.default.instancePath,s)],[Ds.default.parentData,o.parentData],[Ds.default.parentDataProperty,o.parentDataProperty],[Ds.default.rootData,Ds.default.rootData]];o.opts.dynamicRef&&d.push([Ds.default.dynamicAnchors,Ds.default.dynamicAnchors]);let f=(0,vt._)`${u}, ${r.object(...d)}`;return c!==vt.nil?(0,vt._)`${a}.call(${c}, ${f})`:(0,vt._)`${a}(${f})`}nt.callValidateCode=VY;var zY=(0,vt._)`new RegExp`;function WY({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,vt._)`${i.code==="new RegExp"?zY:(0,$Y.useFunc)(t,i)}(${r}, ${n})`})}nt.usePattern=WY;function GY(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,vt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:gS.Type.Num},s),e.if((0,vt.not)(s),a)})}}nt.validateArray=GY;function KY(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,gS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,vt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,vt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}nt.validateUnion=KY});var Cq=R(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.validateKeywordUsage=bi.validSchemaType=bi.funcKeywordCode=bi.macroKeywordCode=void 0;var Ar=ve(),vo=wn(),YY=Cn(),XY=hu();function JY(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=wq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Ar.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}bi.macroKeywordCode=JY;function QY(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;e3(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=wq(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Eq(t),T(()=>t.error());else{let _=e.async?p():m();e.modifying&&Eq(t),T(()=>ZY(t,_))}}function p(){let _=n.let("ruleErrs",null);return n.try(()=>h((0,Ar._)`await `),b=>n.assign(d,!1).if((0,Ar._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Ar._)`${b}.errors`),()=>n.throw(b))),_}function m(){let _=(0,Ar._)`${u}.errors`;return n.assign(_,null),h(Ar.nil),_}function h(_=e.async?(0,Ar._)`await `:Ar.nil){let b=c.opts.passContext?vo.default.this:vo.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Ar._)`${_}${(0,YY.callValidateCode)(t,u,b,v)}`,e.modifying)}function T(_){var b;n.if((0,Ar.not)((b=e.valid)!==null&&b!==void 0?b:d),_)}}bi.funcKeywordCode=QY;function Eq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ar._)`${n.parentData}[${n.parentDataProperty}]`))}function ZY(t,e){let{gen:r}=t;r.if((0,Ar._)`Array.isArray(${e})`,()=>{r.assign(vo.default.vErrors,(0,Ar._)`${vo.default.vErrors} === null ? ${e} : ${vo.default.vErrors}.concat(${e})`).assign(vo.default.errors,(0,Ar._)`${vo.default.vErrors}.length`),(0,XY.extendErrors)(t)},()=>t.error())}function e3({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function wq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ar.stringify)(r)})}function t3(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}bi.validSchemaType=t3;function r3({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}bi.validateKeywordUsage=r3});var Aq=R(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.extendSubschemaMode=As.extendSubschemaData=As.getSubschema=void 0;var Si=ve(),Dq=we();function n3(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Si._)`${t.schemaPath}${(0,Si.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Si._)`${t.schemaPath}${(0,Si.getProperty)(e)}${(0,Si.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Dq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}As.getSubschema=n3;function i3(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,Si._)`${e.data}${(0,Si.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Si.str)`${l}${(0,Dq.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Si._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof Si.Name?i:a.let("data",i,!0);c(l),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}As.extendSubschemaData=i3;function s3(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}As.extendSubschemaMode=s3});var vS=R((rEe,Iq)=>{"use strict";Iq.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var xq=R((nEe,Oq)=>{"use strict";var Is=Oq.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Nm(e,n,i,t,"",t)};Is.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Is.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Is.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Is.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Nm(t,e,r,n,i,s,o,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Is.arrayKeywords)for(var f=0;f<d.length;f++)Nm(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Is.propsKeywords){if(d&&typeof d=="object")for(var p in d)Nm(t,e,r,d[p],i+"/"+u+"/"+o3(p),s,i,u,n,p)}else(u in Is.keywords||t.allKeys&&!(u in Is.skipKeywords))&&Nm(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function o3(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var gu=R(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;var a3=we(),c3=vS(),l3=xq(),u3=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function d3(t,e=!0){return typeof t=="boolean"?!0:e===!0?!bS(t):e?Mq(t)<=e:!1}Yr.inlineRef=d3;var f3=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function bS(t){for(let e in t){if(f3.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(bS)||typeof r=="object"&&bS(r))return!0}return!1}function Mq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!u3.has(r)&&(typeof t[r]=="object"&&(0,a3.eachItem)(t[r],n=>e+=Mq(n)),e===1/0))return 1/0}return e}function Lq(t,e="",r){r!==!1&&(e=nc(e));let n=t.parse(e);return qq(t,n)}Yr.getFullPath=Lq;function qq(t,e){return t.serialize(e).split("#")[0]+"#"}Yr._getFullPath=qq;var p3=/#\/?$/;function nc(t){return t?t.replace(p3,""):""}Yr.normalizeId=nc;function h3(t,e,r){return r=nc(r),t.resolve(e,r)}Yr.resolveUrl=h3;var m3=/^[a-z_][-a-z0-9._]*$/i;function g3(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=nc(t[r]||e),s={"":i},o=Lq(n,i,!1),a={},c=new Set;return l3(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,T=s[m];typeof d[r]=="string"&&(T=_.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[f]=T;function _(v){let k=this.opts.uriResolver.resolve;if(v=nc(T?k(T,v):v),c.has(v))throw u(v);c.add(v);let w=this.refs[v];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,v):v!==nc(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!m3.test(v))throw new Error(`invalid anchor "${v}"`);_.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!c3(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Yr.getSchemaRefs=g3});var vu=R(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.getData=Os.KeywordCxt=Os.validateFunctionCode=void 0;var Uq=yq(),$q=mu(),_S=fS(),Rm=mu(),y3=Nq(),Tu=Cq(),SS=Aq(),se=ve(),he=wn(),T3=gu(),zi=we(),yu=hu();function v3(t){if(zq(t)&&(Wq(t),Vq(t))){_3(t);return}Hq(t,()=>(0,Uq.topBoolOrEmptySchema)(t))}Os.validateFunctionCode=v3;function Hq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,se._)`${he.default.data}, ${he.default.valCxt}`,n.$async,()=>{t.code((0,se._)`"use strict"; ${Fq(r,i)}`),S3(t,i),t.code(s)}):t.func(e,(0,se._)`${he.default.data}, ${b3(i)}`,n.$async,()=>t.code(Fq(r,i)).code(s))}function b3(t){return(0,se._)`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${t.dynamicRef?(0,se._)`, ${he.default.dynamicAnchors}={}`:se.nil}}={}`}function S3(t,e){t.if(he.default.valCxt,()=>{t.var(he.default.instancePath,(0,se._)`${he.default.valCxt}.${he.default.instancePath}`),t.var(he.default.parentData,(0,se._)`${he.default.valCxt}.${he.default.parentData}`),t.var(he.default.parentDataProperty,(0,se._)`${he.default.valCxt}.${he.default.parentDataProperty}`),t.var(he.default.rootData,(0,se._)`${he.default.valCxt}.${he.default.rootData}`),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{t.var(he.default.instancePath,(0,se._)`""`),t.var(he.default.parentData,(0,se._)`undefined`),t.var(he.default.parentDataProperty,(0,se._)`undefined`),t.var(he.default.rootData,he.default.data),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`{}`)})}function _3(t){let{schema:e,opts:r,gen:n}=t;Hq(t,()=>{r.$comment&&e.$comment&&Kq(t),E3(t),n.let(he.default.vErrors,null),n.let(he.default.errors,0),r.unevaluated&&k3(t),Gq(t),D3(t)})}function k3(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,se._)`${r}.evaluated`),e.if((0,se._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,se._)`${t.evaluated}.props`,(0,se._)`undefined`)),e.if((0,se._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,se._)`${t.evaluated}.items`,(0,se._)`undefined`))}function Fq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,se._)`/*# sourceURL=${r} */`:se.nil}function N3(t,e){if(zq(t)&&(Wq(t),Vq(t))){R3(t,e);return}(0,Uq.boolOrEmptySchema)(t,e)}function Vq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function zq(t){return typeof t.schema!="boolean"}function R3(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Kq(t),w3(t),C3(t);let s=n.const("_errs",he.default.errors);Gq(t,s),n.var(e,(0,se._)`${s} === ${he.default.errors}`)}function Wq(t){(0,zi.checkUnknownRules)(t),P3(t)}function Gq(t,e){if(t.opts.jtd)return Bq(t,[],!1,e);let r=(0,$q.getSchemaTypes)(t.schema),n=(0,$q.coerceAndCheckDataType)(t,r);Bq(t,r,!n,e)}function P3(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function E3(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zi.checkStrictMode)(t,"default is ignored in the schema root")}function w3(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,T3.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function C3(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Kq({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,se._)`${he.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,se.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,se._)`${he.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function D3(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,se._)`${he.default.errors} === 0`,()=>e.return(he.default.data),()=>e.throw((0,se._)`new ${i}(${he.default.vErrors})`)):(e.assign((0,se._)`${n}.errors`,he.default.vErrors),s.unevaluated&&A3(t),e.return((0,se._)`${he.default.errors} === 0`))}function A3({gen:t,evaluated:e,props:r,items:n}){r instanceof se.Name&&t.assign((0,se._)`${e}.props`,r),n instanceof se.Name&&t.assign((0,se._)`${e}.items`,n)}function Bq(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,zi.schemaHasRulesButRef)(s,u))){i.block(()=>Xq(t,"$ref",u.all.$ref.definition));return}c.jtd||I3(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,_S.shouldUseGroup)(s,f)&&(f.type?(i.if((0,Rm.checkDataType)(f.type,o,c.strictNumbers)),jq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,Rm.reportTypeError)(t)),i.endIf()):jq(t,f),a||i.if((0,se._)`${he.default.errors} === ${n||0}`))}}function jq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,y3.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,_S.shouldUseRule)(n,s)&&Xq(t,s.keyword,s.definition,e.type)})}function I3(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(O3(t,e),t.opts.allowUnionTypes||x3(t,e),M3(t,t.dataTypes))}function O3(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Yq(t.dataTypes,r)||kS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),q3(t,e)}}function x3(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&kS(t,"use allowUnionTypes to allow union type keyword")}function M3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,_S.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>L3(e,o))&&kS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function L3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Yq(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function q3(t,e){let r=[];for(let n of t.dataTypes)Yq(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function kS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,zi.checkStrictMode)(t,e,t.opts.strictTypes)}var Pm=class{constructor(e,r,n){if((0,Tu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,zi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Jq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Tu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",he.default.errors))}result(e,r,n){this.failResult((0,se.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,se.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,se._)`${r} !== undefined && (${(0,se.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?yu.reportExtraError:yu.reportError)(this,this.def.error,r)}$dataError(){(0,yu.reportError)(this,this.def.$dataError||yu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,yu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=se.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=se.nil,r=se.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,se.or)((0,se._)`${i} === undefined`,r)),e!==se.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==se.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,se.or)(o(),a());function o(){if(n.length){if(!(r instanceof se.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,se._)`${(0,Rm.checkDataTypes)(c,r,s.opts.strictNumbers,Rm.DataType.Wrong)}`}return se.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,se._)`!${c}(${r})`}return se.nil}}subschema(e,r){let n=(0,SS.getSubschema)(this.it,e);(0,SS.extendSubschemaData)(n,this.it,e),(0,SS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return N3(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=zi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,se.Name)),!0}};Os.KeywordCxt=Pm;function Xq(t,e,r,n){let i=new Pm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Tu.funcKeywordCode)(i,r):"macro"in r?(0,Tu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Tu.funcKeywordCode)(i,r)}var $3=/^\/(?:[^~]|~0|~1)*$/,F3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Jq(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return he.default.rootData;if(t[0]==="/"){if(!$3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=he.default.rootData}else{let l=F3.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(s=r[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,se._)`${s}${(0,se.getProperty)((0,zi.unescapeJsonPointer)(l))}`,o=(0,se._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Os.getData=Jq});var Em=R(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var NS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};RS.default=NS});var bu=R(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var PS=gu(),ES=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,PS.resolveUrl)(e,r,n),this.missingSchema=(0,PS.normalizeId)((0,PS.getFullPath)(e,this.missingRef))}};wS.default=ES});var Su=R(Dn=>{"use strict";Object.defineProperty(Dn,"__esModule",{value:!0});Dn.resolveSchema=Dn.getCompilingSchema=Dn.resolveRef=Dn.compileSchema=Dn.SchemaEnv=void 0;var ei=ve(),B3=Em(),bo=wn(),ti=gu(),Qq=we(),j3=vu(),ic=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ti.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};Dn.SchemaEnv=ic;function DS(t){let e=Zq.call(this,t);if(e)return e;let r=(0,ti.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new ei.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:B3.default,code:(0,ei._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[ei.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ei.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ei.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ei._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,j3.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(bo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${bo.default.self}`,`${bo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof ei.Name?void 0:m,items:h instanceof ei.Name?void 0:h,dynamicProps:m instanceof ei.Name,dynamicItems:h instanceof ei.Name},p.source&&(p.source.evaluated=(0,ei.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}Dn.compileSchema=DS;function U3(t,e,r){var n;r=(0,ti.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=z3.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new ic({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=H3.call(this,s)}Dn.resolveRef=U3;function H3(t){return(0,ti.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:DS.call(this,t)}function Zq(t){for(let e of this._compilations)if(V3(e,t))return e}Dn.getCompilingSchema=Zq;function V3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function z3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||wm.call(this,t,e)}function wm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ti._getFullPath)(this.opts.uriResolver,r),i=(0,ti.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return CS.call(this,r,t);let s=(0,ti.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=wm.call(this,t,o);return typeof a?.schema!="object"?void 0:CS.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||DS.call(this,o),s===(0,ti.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,ti.resolveUrl)(this.opts.uriResolver,i,l)),new ic({schema:a,schemaId:c,root:t,baseId:i})}return CS.call(this,r,o)}}Dn.resolveSchema=wm;var W3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function CS(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Qq.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!W3.has(a)&&l&&(e=(0,ti.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Qq.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ti.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=wm.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new ic({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var e1=R((lEe,G3)=>{G3.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var r1=R((uEe,t1)=>{"use strict";var K3={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t1.exports={HEX:K3}});var u1=R((dEe,l1)=>{"use strict";var{HEX:Y3}=r1(),X3=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function o1(t){if(c1(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(X3)||[],[r]=e;return r?{host:Q3(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function AS(t,e=!1){let r="",n=!0;for(let i of t){if(Y3[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function J3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let l=AS(i);if(l!==void 0)n.push(l);else return r.error=!0,!1}i.length=0}return!0}for(let l=0;l<t.length;l++){let u=t[l];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}l-1>=0&&t[l-1]===":"&&(o=!0);continue}else if(u==="%"){if(!c())break;s=!0}else{i.push(u);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(AS(i))),r.address=n.join(""),r}function a1(t){if(c1(t,":")<2)return{host:t,isIPV6:!1};let e=J3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function Q3(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function c1(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var n1=/^\.\.?\//u,i1=/^\/\.(?:\/|$)/u,s1=/^\/\.\.(?:\/|$)/u,Z3=/^\/?(?:.|\n)*?(?=\/|$)/u;function eX(t){let e=[];for(;t.length;)if(t.match(n1))t=t.replace(n1,"");else if(t.match(i1))t=t.replace(i1,"/");else if(t.match(s1))t=t.replace(s1,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(Z3);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function tX(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function rX(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=o1(r);if(n.isIPV4)r=n.host;else{let i=a1(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}l1.exports={recomposeAuthority:rX,normalizeComponentEncoding:tX,removeDotSegments:eX,normalizeIPv4:o1,normalizeIPv6:a1,stringArrayToHexStripped:AS}});var g1=R((fEe,m1)=>{"use strict";var nX=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,iX=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function d1(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function f1(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function p1(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function sX(t){return t.secure=d1(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function oX(t){if((t.port===(d1(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function aX(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(iX);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=IS[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function cX(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=IS[i];s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function lX(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!nX.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uX(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var h1={scheme:"http",domainHost:!0,parse:f1,serialize:p1},dX={scheme:"https",domainHost:h1.domainHost,parse:f1,serialize:p1},Cm={scheme:"ws",domainHost:!0,parse:sX,serialize:oX},fX={scheme:"wss",domainHost:Cm.domainHost,parse:Cm.parse,serialize:Cm.serialize},pX={scheme:"urn",parse:aX,serialize:cX,skipNormalize:!0},hX={scheme:"urn:uuid",parse:lX,serialize:uX,skipNormalize:!0},IS={http:h1,https:dX,ws:Cm,wss:fX,urn:pX,"urn:uuid":hX};m1.exports=IS});var T1=R((pEe,Am)=>{"use strict";var{normalizeIPv6:mX,normalizeIPv4:gX,removeDotSegments:_u,recomposeAuthority:yX,normalizeComponentEncoding:Dm}=u1(),OS=g1();function TX(t,e){return typeof t=="string"?t=_i(Wi(t,e),e):typeof t=="object"&&(t=Wi(_i(t,e),e)),t}function vX(t,e,r){let n=Object.assign({scheme:"null"},r),i=y1(Wi(t,n),Wi(e,n),n,!0);return _i(i,{...n,skipEscape:!0})}function y1(t,e,r,n){let i={};return n||(t=Wi(_i(t,r),r),e=Wi(_i(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=_u(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=_u(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=_u(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=_u(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function bX(t,e,r){return typeof t=="string"?(t=unescape(t),t=_i(Dm(Wi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=_i(Dm(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=_i(Dm(Wi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=_i(Dm(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function _i(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=OS[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=yX(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=_u(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var SX=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function _X(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||SX[e])return!0;return!1}var kX=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Wi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(kX);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=gX(n.host);if(c.isIPV4===!1){let l=mX(c.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=OS[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&_X(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var xS={SCHEMES:OS,normalize:TX,resolve:vX,resolveComponents:y1,equal:bX,serialize:_i,parse:Wi};Am.exports=xS;Am.exports.default=xS;Am.exports.fastUri=xS});var b1=R(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var v1=T1();v1.code='require("ajv/dist/runtime/uri").default';MS.default=v1});var w1=R(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.CodeGen=ar.Name=ar.nil=ar.stringify=ar.str=ar._=ar.KeywordCxt=void 0;var NX=vu();Object.defineProperty(ar,"KeywordCxt",{enumerable:!0,get:function(){return NX.KeywordCxt}});var sc=ve();Object.defineProperty(ar,"_",{enumerable:!0,get:function(){return sc._}});Object.defineProperty(ar,"str",{enumerable:!0,get:function(){return sc.str}});Object.defineProperty(ar,"stringify",{enumerable:!0,get:function(){return sc.stringify}});Object.defineProperty(ar,"nil",{enumerable:!0,get:function(){return sc.nil}});Object.defineProperty(ar,"Name",{enumerable:!0,get:function(){return sc.Name}});Object.defineProperty(ar,"CodeGen",{enumerable:!0,get:function(){return sc.CodeGen}});var RX=Em(),R1=bu(),PX=dS(),ku=Su(),EX=ve(),Nu=gu(),Im=mu(),qS=we(),S1=e1(),wX=b1(),P1=(t,e)=>new RegExp(t,e);P1.code="new RegExp";var CX=["removeAdditional","useDefaults","coerceTypes"],DX=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),AX={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IX={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_1=200;function OX(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,T,_,b,v,k,w,H,O,B,De;let lt=t.strict,Ht=(e=t.code)===null||e===void 0?void 0:e.optimize,Ne=Ht===!0||Ht===void 0?1:Ht||0,un=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:P1,Gi=(i=t.uriResolver)!==null&&i!==void 0?i:wX.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:lt)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:lt)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:lt)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:lt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:lt)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Ne,regExp:un}:{optimize:Ne,regExp:un},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:_1,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:_1,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(H=t.validateSchema)!==null&&H!==void 0?H:!0,validateFormats:(O=t.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:!0,int32range:(De=t.int32range)!==null&&De!==void 0?De:!0,uriResolver:Gi}}var Ru=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...OX(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new EX.ValueScope({scope:{},prefixes:DX,es5:r,lines:n}),this.logger=FX(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,PX.getRules)(),k1.call(this,AX,e,"NOT SUPPORTED"),k1.call(this,IX,e,"DEPRECATED","warn"),this._metaOpts=qX.call(this),e.formats&&MX.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&LX.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),xX.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=S1;n==="id"&&(i={...S1},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await s.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||o.call(this,f)}async function s(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof R1.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),o.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Nu.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=N1.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new ku.SchemaEnv({schema:{},schemaId:n});if(r=ku.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=N1.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Nu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(jX.call(this,n,r),!r)return(0,qS.eachItem)(n,s=>LS.call(this,s)),this;HX.call(this,r);let i={...r,type:(0,Im.getJSONTypes)(r.type),schemaType:(0,Im.getJSONTypes)(r.schemaType)};return(0,qS.eachItem)(n,i.type.length===0?s=>LS.call(this,s,i):s=>i.type.forEach(o=>LS.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=E1(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Nu.normalizeId)(o||n);let l=Nu.getSchemaRefs.call(this,e,n);return c=new ku.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):ku.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{ku.compileSchema.call(this,e)}finally{this.opts=r}}};Ru.ValidationError=RX.default;Ru.MissingRefError=R1.default;ar.default=Ru;function k1(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function N1(t){return t=(0,Nu.normalizeId)(t),this.schemas[t]||this.refs[t]}function xX(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function MX(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function LX(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function qX(){let t={...this.opts};for(let e of CX)delete t[e];return t}var $X={log(){},warn(){},error(){}};function FX(t){if(t===!1)return $X;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var BX=/^[a-z_$][a-z0-9_$:-]*$/i;function jX(t,e){let{RULES:r}=this;if((0,qS.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!BX.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function LS(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Im.getJSONTypes)(e.type),schemaType:(0,Im.getJSONTypes)(e.schemaType)}};e.before?UX.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function UX(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function HX(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=E1(e)),t.validateSchema=this.compile(e,!0))}var VX={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function E1(t){return{anyOf:[t,VX]}}});var C1=R($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var zX={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$S.default=zX});var Mm=R(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.callRef=So.getValidate=void 0;var WX=bu(),D1=Cn(),Xr=ve(),oc=wn(),A1=Su(),Om=we(),GX={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=A1.resolveRef.call(c,l,i,r);if(u===void 0)throw new WX.default(n.opts.uriResolver,i,r);if(u instanceof A1.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return xm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return xm(t,(0,Xr._)`${m}.validate`,l,l.$async)}function f(m){let h=I1(t,m);xm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Xr.stringify)(m)}:{ref:m}),T=e.name("valid"),_=t.subschema({schema:m,dataTypes:[],schemaPath:Xr.nil,topSchemaRef:h,errSchemaPath:r},T);t.mergeEvaluated(_),t.ok(T)}}};function I1(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Xr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}So.getValidate=I1;function xm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?oc.default.this:Xr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Xr._)`await ${(0,D1.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,Xr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,D1.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Xr._)`${m}.errors`;i.assign(oc.default.vErrors,(0,Xr._)`${oc.default.vErrors} === null ? ${h} : ${oc.default.vErrors}.concat(${h})`),i.assign(oc.default.errors,(0,Xr._)`${oc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let T=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(s.props=Om.mergeEvaluated.props(i,T.props,s.props));else{let _=i.var("props",(0,Xr._)`${m}.evaluated.props`);s.props=Om.mergeEvaluated.props(i,_,s.props,Xr.Name)}if(s.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(s.items=Om.mergeEvaluated.items(i,T.items,s.items));else{let _=i.var("items",(0,Xr._)`${m}.evaluated.items`);s.items=Om.mergeEvaluated.items(i,_,s.items,Xr.Name)}}}So.callRef=xm;So.default=GX});var O1=R(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var KX=C1(),YX=Mm(),XX=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",KX.default,YX.default];FS.default=XX});var x1=R(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var Lm=ve(),xs=Lm.operators,qm={maximum:{okStr:"<=",ok:xs.LTE,fail:xs.GT},minimum:{okStr:">=",ok:xs.GTE,fail:xs.LT},exclusiveMaximum:{okStr:"<",ok:xs.LT,fail:xs.GTE},exclusiveMinimum:{okStr:">",ok:xs.GT,fail:xs.LTE}},JX={message:({keyword:t,schemaCode:e})=>(0,Lm.str)`must be ${qm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Lm._)`{comparison: ${qm[t].okStr}, limit: ${e}}`},QX={keyword:Object.keys(qm),type:"number",schemaType:"number",$data:!0,error:JX,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Lm._)`${r} ${qm[e].fail} ${n} || isNaN(${r})`)}};BS.default=QX});var M1=R(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});var Pu=ve(),ZX={message:({schemaCode:t})=>(0,Pu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Pu._)`{multipleOf: ${t}}`},e4={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZX,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,Pu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Pu._)`${o} !== parseInt(${o})`;t.fail$data((0,Pu._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};jS.default=e4});var q1=R(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});function L1(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}US.default=L1;L1.code='require("ajv/dist/runtime/ucs2length").default'});var $1=R(HS=>{"use strict";Object.defineProperty(HS,"__esModule",{value:!0});var _o=ve(),t4=we(),r4=q1(),n4={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_o.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_o._)`{limit: ${t}}`},i4={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n4,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?_o.operators.GT:_o.operators.LT,o=i.opts.unicode===!1?(0,_o._)`${r}.length`:(0,_o._)`${(0,t4.useFunc)(t.gen,r4.default)}(${r})`;t.fail$data((0,_o._)`${o} ${s} ${n}`)}};HS.default=i4});var F1=R(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});var s4=Cn(),$m=ve(),o4={message:({schemaCode:t})=>(0,$m.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,$m._)`{pattern: ${t}}`},a4={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:o4,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,$m._)`(new RegExp(${i}, ${o}))`:(0,s4.usePattern)(t,n);t.fail$data((0,$m._)`!${a}.test(${e})`)}};VS.default=a4});var B1=R(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var Eu=ve(),c4={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Eu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Eu._)`{limit: ${t}}`},l4={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:c4,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Eu.operators.GT:Eu.operators.LT;t.fail$data((0,Eu._)`Object.keys(${r}).length ${i} ${n}`)}};zS.default=l4});var j1=R(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var wu=Cn(),Cu=ve(),u4=we(),d4={message:({params:{missingProperty:t}})=>(0,Cu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Cu._)`{missingProperty: ${t}}`},f4={keyword:"required",type:"object",schemaType:"array",$data:!0,error:d4,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let T=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${h}" is not defined at "${T}" (strictRequired)`;(0,u4.checkStrictMode)(o,_,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(Cu.nil,d);else for(let p of r)(0,wu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,wu.checkMissingProp)(t,r,p)),(0,wu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,wu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,wu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Cu.not)(m),()=>{t.error(),e.break()})},Cu.nil)}}};WS.default=f4});var U1=R(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0});var Du=ve(),p4={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Du.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Du._)`{limit: ${t}}`},h4={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:p4,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Du.operators.GT:Du.operators.LT;t.fail$data((0,Du._)`${r}.length ${i} ${n}`)}};GS.default=h4});var Fm=R(KS=>{"use strict";Object.defineProperty(KS,"__esModule",{value:!0});var H1=vS();H1.code='require("ajv/dist/runtime/equal").default';KS.default=H1});var V1=R(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});var YS=mu(),cr=ve(),m4=we(),g4=Fm(),y4={message:({params:{i:t,j:e}})=>(0,cr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,cr._)`{i: ${t}, j: ${e}}`},T4={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:y4,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=s.items?(0,YS.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,cr._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,cr._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,cr._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let T=e.name("item"),_=(0,YS.checkDataTypes)(l,T,a.opts.strictNumbers,YS.DataType.Wrong),b=e.const("indices",(0,cr._)`{}`);e.for((0,cr._)`;${m}--;`,()=>{e.let(T,(0,cr._)`${r}[${m}]`),e.if(_,(0,cr._)`continue`),l.length>1&&e.if((0,cr._)`typeof ${T} == "string"`,(0,cr._)`${T} += "_"`),e.if((0,cr._)`typeof ${b}[${T}] == "number"`,()=>{e.assign(h,(0,cr._)`${b}[${T}]`),t.error(),e.assign(c,!1).break()}).code((0,cr._)`${b}[${T}] = ${m}`)})}function p(m,h){let T=(0,m4.useFunc)(e,g4.default),_=e.name("outer");e.label(_).for((0,cr._)`;${m}--;`,()=>e.for((0,cr._)`${h} = ${m}; ${h}--;`,()=>e.if((0,cr._)`${T}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};XS.default=T4});var z1=R(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var JS=ve(),v4=we(),b4=Fm(),S4={message:"must be equal to constant",params:({schemaCode:t})=>(0,JS._)`{allowedValue: ${t}}`},_4={keyword:"const",$data:!0,error:S4,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,JS._)`!${(0,v4.useFunc)(e,b4.default)}(${r}, ${i})`):t.fail((0,JS._)`${s} !== ${r}`)}};QS.default=_4});var W1=R(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var Au=ve(),k4=we(),N4=Fm(),R4={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Au._)`{allowedValues: ${t}}`},P4={keyword:"enum",schemaType:"array",$data:!0,error:R4,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,k4.useFunc)(e,N4.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",s);u=(0,Au.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",s,p=>e.if((0,Au._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Au._)`${l()}(${r}, ${p}[${m}])`:(0,Au._)`${r} === ${h}`}}};ZS.default=P4});var G1=R(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var E4=x1(),w4=M1(),C4=$1(),D4=F1(),A4=B1(),I4=j1(),O4=U1(),x4=V1(),M4=z1(),L4=W1(),q4=[E4.default,w4.default,C4.default,D4.default,A4.default,I4.default,O4.default,x4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},M4.default,L4.default];e_.default=q4});var r_=R(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.validateAdditionalItems=void 0;var ko=ve(),t_=we(),$4={message:({params:{len:t}})=>(0,ko.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ko._)`{limit: ${t}}`},F4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:$4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,t_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}K1(t,n)}};function K1(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,ko._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,ko._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,t_.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,ko._)`${a} <= ${e.length}`);r.if((0,ko.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:t_.Type.Num},l),o.allErrors||r.if((0,ko.not)(l),()=>r.break())})}}Iu.validateAdditionalItems=K1;Iu.default=F4});var n_=R(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.validateTuple=void 0;var Y1=ve(),Bm=we(),B4=Cn(),j4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return X1(t,"additionalItems",e);r.items=!0,!(0,Bm.alwaysValidSchema)(r,e)&&t.ok((0,B4.validateArray)(t))}};function X1(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Bm.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,Y1._)`${s}.length`);r.forEach((d,f)=>{(0,Bm.alwaysValidSchema)(a,d)||(n.if((0,Y1._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let T=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Bm.checkStrictMode)(a,T,f.strictTuples)}}}Ou.validateTuple=X1;Ou.default=j4});var J1=R(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var U4=n_(),H4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,U4.validateTuple)(t,"items")};i_.default=H4});var Z1=R(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Q1=ve(),V4=we(),z4=Cn(),W4=r_(),G4={message:({params:{len:t}})=>(0,Q1.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Q1._)`{limit: ${t}}`},K4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:G4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,V4.alwaysValidSchema)(n,e)&&(i?(0,W4.validateAdditionalItems)(t,i):t.ok((0,z4.validateArray)(t)))}};s_.default=K4});var e$=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var An=ve(),jm=we(),Y4={message:({params:{min:t,max:e}})=>e===void 0?(0,An.str)`must contain at least ${t} valid item(s)`:(0,An.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,An._)`{minContains: ${t}}`:(0,An._)`{minContains: ${t}, maxContains: ${e}}`},X4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Y4,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=n;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,An._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,jm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,jm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,jm.alwaysValidSchema)(s,r)){let h=(0,An._)`${u} >= ${o}`;a!==void 0&&(h=(0,An._)`${h} && ${u} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),a!==void 0&&e.if((0,An._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),T=e.let("count",0);p(h,()=>e.if(h,()=>m(T)))}function p(h,T){e.forRange("i",0,u,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:jm.Type.Num,compositeRule:!0},h),T()})}function m(h){e.code((0,An._)`${h}++`),a===void 0?e.if((0,An._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,An._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,An._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};o_.default=X4});var Um=R(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.validateSchemaDeps=ki.validatePropertyDeps=ki.error=void 0;var a_=ve(),J4=we(),xu=Cn();ki.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,a_.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,a_._)`{property: ${t},
|
|
179
|
+
|| ${o} === "boolean" || ${i} === null`).assign(a,(0,be._)`[${i}]`)}}}function OY({gen:t,parentData:e,parentDataProperty:r},n){t.if((0,be._)`${e} !== undefined`,()=>t.assign((0,be._)`${e}[${r}]`,n))}function pS(t,e,r,n=tc.Correct){let i=n===tc.Correct?be.operators.EQ:be.operators.NEQ,s;switch(t){case"null":return(0,be._)`${e} ${i} null`;case"array":s=(0,be._)`Array.isArray(${e})`;break;case"object":s=(0,be._)`${e} && typeof ${e} == "object" && !Array.isArray(${e})`;break;case"integer":s=o((0,be._)`!(${e} % 1) && !isNaN(${e})`);break;case"number":s=o();break;default:return(0,be._)`typeof ${e} ${i} ${t}`}return n===tc.Correct?s:(0,be.not)(s);function o(a=be.nil){return(0,be.and)((0,be._)`typeof ${e} == "number"`,a,r?(0,be._)`isFinite(${e})`:be.nil)}}kr.checkDataType=pS;function hS(t,e,r,n){if(t.length===1)return pS(t[0],e,r,n);let i,s=(0,bq.toHash)(t);if(s.array&&s.object){let o=(0,be._)`typeof ${e} != "object"`;i=s.null?o:(0,be._)`!${e} || ${o}`,delete s.null,delete s.array,delete s.object}else i=be.nil;s.number&&delete s.integer;for(let o in s)i=(0,be.and)(i,pS(o,e,r,n));return i}kr.checkDataTypes=hS;var xY={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:e})=>typeof t=="string"?(0,be._)`{type: ${t}}`:(0,be._)`{type: ${e}}`};function mS(t){let e=MY(t);(0,wY.reportError)(e,xY)}kr.reportTypeError=mS;function MY(t){let{gen:e,data:r,schema:n}=t,i=(0,bq.schemaRefOrVal)(t,n,"type");return{gen:e,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:t}}});var Nq=R(km=>{"use strict";Object.defineProperty(km,"__esModule",{value:!0});km.assignDefaults=void 0;var rc=ve(),LY=we();function qY(t,e){let{properties:r,items:n}=t.schema;if(e==="object"&&r)for(let i in r)kq(t,i,r[i].default);else e==="array"&&Array.isArray(n)&&n.forEach((i,s)=>kq(t,s,i.default))}km.assignDefaults=qY;function kq(t,e,r){let{gen:n,compositeRule:i,data:s,opts:o}=t;if(r===void 0)return;let a=(0,rc._)`${s}${(0,rc.getProperty)(e)}`;if(i){(0,LY.checkStrictMode)(t,`default is ignored for: ${a}`);return}let c=(0,rc._)`${a} === undefined`;o.useDefaults==="empty"&&(c=(0,rc._)`${c} || ${a} === null || ${a} === ""`),n.if(c,(0,rc._)`${a} = ${(0,rc.stringify)(r)}`)}});var Dn=R(nt=>{"use strict";Object.defineProperty(nt,"__esModule",{value:!0});nt.validateUnion=nt.validateArray=nt.usePattern=nt.callValidateCode=nt.schemaProperties=nt.allSchemaProperties=nt.noPropertyInData=nt.propertyInData=nt.isOwnProperty=nt.hasPropFunc=nt.reportMissingProp=nt.checkMissingProp=nt.checkReportMissingProp=void 0;var vt=ve(),gS=we(),Ds=Cn(),$Y=we();function FY(t,e){let{gen:r,data:n,it:i}=t;r.if(TS(r,n,e,i.opts.ownProperties),()=>{t.setParams({missingProperty:(0,vt._)`${e}`},!0),t.error()})}nt.checkReportMissingProp=FY;function BY({gen:t,data:e,it:{opts:r}},n,i){return(0,vt.or)(...n.map(s=>(0,vt.and)(TS(t,e,s,r.ownProperties),(0,vt._)`${i} = ${s}`)))}nt.checkMissingProp=BY;function jY(t,e){t.setParams({missingProperty:e},!0),t.error()}nt.reportMissingProp=jY;function Rq(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,vt._)`Object.prototype.hasOwnProperty`})}nt.hasPropFunc=Rq;function yS(t,e,r){return(0,vt._)`${Rq(t)}.call(${e}, ${r})`}nt.isOwnProperty=yS;function UY(t,e,r,n){let i=(0,vt._)`${e}${(0,vt.getProperty)(r)} !== undefined`;return n?(0,vt._)`${i} && ${yS(t,e,r)}`:i}nt.propertyInData=UY;function TS(t,e,r,n){let i=(0,vt._)`${e}${(0,vt.getProperty)(r)} === undefined`;return n?(0,vt.or)(i,(0,vt.not)(yS(t,e,r))):i}nt.noPropertyInData=TS;function Pq(t){return t?Object.keys(t).filter(e=>e!=="__proto__"):[]}nt.allSchemaProperties=Pq;function HY(t,e){return Pq(e).filter(r=>!(0,gS.alwaysValidSchema)(t,e[r]))}nt.schemaProperties=HY;function VY({schemaCode:t,data:e,it:{gen:r,topSchemaRef:n,schemaPath:i,errorPath:s},it:o},a,c,l){let u=l?(0,vt._)`${t}, ${e}, ${n}${i}`:e,d=[[Ds.default.instancePath,(0,vt.strConcat)(Ds.default.instancePath,s)],[Ds.default.parentData,o.parentData],[Ds.default.parentDataProperty,o.parentDataProperty],[Ds.default.rootData,Ds.default.rootData]];o.opts.dynamicRef&&d.push([Ds.default.dynamicAnchors,Ds.default.dynamicAnchors]);let f=(0,vt._)`${u}, ${r.object(...d)}`;return c!==vt.nil?(0,vt._)`${a}.call(${c}, ${f})`:(0,vt._)`${a}(${f})`}nt.callValidateCode=VY;var zY=(0,vt._)`new RegExp`;function WY({gen:t,it:{opts:e}},r){let n=e.unicodeRegExp?"u":"",{regExp:i}=e.code,s=i(r,n);return t.scopeValue("pattern",{key:s.toString(),ref:s,code:(0,vt._)`${i.code==="new RegExp"?zY:(0,$Y.useFunc)(t,i)}(${r}, ${n})`})}nt.usePattern=WY;function GY(t){let{gen:e,data:r,keyword:n,it:i}=t,s=e.name("valid");if(i.allErrors){let a=e.let("valid",!0);return o(()=>e.assign(a,!1)),a}return e.var(s,!0),o(()=>e.break()),s;function o(a){let c=e.const("len",(0,vt._)`${r}.length`);e.forRange("i",0,c,l=>{t.subschema({keyword:n,dataProp:l,dataPropType:gS.Type.Num},s),e.if((0,vt.not)(s),a)})}}nt.validateArray=GY;function KY(t){let{gen:e,schema:r,keyword:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(r.some(c=>(0,gS.alwaysValidSchema)(i,c))&&!i.opts.unevaluated)return;let o=e.let("valid",!1),a=e.name("_valid");e.block(()=>r.forEach((c,l)=>{let u=t.subschema({keyword:n,schemaProp:l,compositeRule:!0},a);e.assign(o,(0,vt._)`${o} || ${a}`),t.mergeValidEvaluated(u,a)||e.if((0,vt.not)(o))})),t.result(o,()=>t.reset(),()=>t.error(!0))}nt.validateUnion=KY});var Cq=R(bi=>{"use strict";Object.defineProperty(bi,"__esModule",{value:!0});bi.validateKeywordUsage=bi.validSchemaType=bi.funcKeywordCode=bi.macroKeywordCode=void 0;var Ar=ve(),vo=Cn(),YY=Dn(),XY=hu();function JY(t,e){let{gen:r,keyword:n,schema:i,parentSchema:s,it:o}=t,a=e.macro.call(o.self,i,s,o),c=wq(r,n,a);o.opts.validateSchema!==!1&&o.self.validateSchema(a,!0);let l=r.name("valid");t.subschema({schema:a,schemaPath:Ar.nil,errSchemaPath:`${o.errSchemaPath}/${n}`,topSchemaRef:c,compositeRule:!0},l),t.pass(l,()=>t.error(!0))}bi.macroKeywordCode=JY;function QY(t,e){var r;let{gen:n,keyword:i,schema:s,parentSchema:o,$data:a,it:c}=t;e3(c,e);let l=!a&&e.compile?e.compile.call(c.self,s,o,c):e.validate,u=wq(n,i,l),d=n.let("valid");t.block$data(d,f),t.ok((r=e.valid)!==null&&r!==void 0?r:d);function f(){if(e.errors===!1)h(),e.modifying&&Eq(t),T(()=>t.error());else{let _=e.async?p():m();e.modifying&&Eq(t),T(()=>ZY(t,_))}}function p(){let _=n.let("ruleErrs",null);return n.try(()=>h((0,Ar._)`await `),b=>n.assign(d,!1).if((0,Ar._)`${b} instanceof ${c.ValidationError}`,()=>n.assign(_,(0,Ar._)`${b}.errors`),()=>n.throw(b))),_}function m(){let _=(0,Ar._)`${u}.errors`;return n.assign(_,null),h(Ar.nil),_}function h(_=e.async?(0,Ar._)`await `:Ar.nil){let b=c.opts.passContext?vo.default.this:vo.default.self,v=!("compile"in e&&!a||e.schema===!1);n.assign(d,(0,Ar._)`${_}${(0,YY.callValidateCode)(t,u,b,v)}`,e.modifying)}function T(_){var b;n.if((0,Ar.not)((b=e.valid)!==null&&b!==void 0?b:d),_)}}bi.funcKeywordCode=QY;function Eq(t){let{gen:e,data:r,it:n}=t;e.if(n.parentData,()=>e.assign(r,(0,Ar._)`${n.parentData}[${n.parentDataProperty}]`))}function ZY(t,e){let{gen:r}=t;r.if((0,Ar._)`Array.isArray(${e})`,()=>{r.assign(vo.default.vErrors,(0,Ar._)`${vo.default.vErrors} === null ? ${e} : ${vo.default.vErrors}.concat(${e})`).assign(vo.default.errors,(0,Ar._)`${vo.default.vErrors}.length`),(0,XY.extendErrors)(t)},()=>t.error())}function e3({schemaEnv:t},e){if(e.async&&!t.$async)throw new Error("async keyword in sync schema")}function wq(t,e,r){if(r===void 0)throw new Error(`keyword "${e}" failed to compile`);return t.scopeValue("keyword",typeof r=="function"?{ref:r}:{ref:r,code:(0,Ar.stringify)(r)})}function t3(t,e,r=!1){return!e.length||e.some(n=>n==="array"?Array.isArray(t):n==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==n||r&&typeof t>"u")}bi.validSchemaType=t3;function r3({schema:t,opts:e,self:r,errSchemaPath:n},i,s){if(Array.isArray(i.keyword)?!i.keyword.includes(s):i.keyword!==s)throw new Error("ajv implementation error");let o=i.dependencies;if(o?.some(a=>!Object.prototype.hasOwnProperty.call(t,a)))throw new Error(`parent schema must have dependencies of ${s}: ${o.join(",")}`);if(i.validateSchema&&!i.validateSchema(t[s])){let c=`keyword "${s}" value is invalid at path "${n}": `+r.errorsText(i.validateSchema.errors);if(e.validateSchema==="log")r.logger.error(c);else throw new Error(c)}}bi.validateKeywordUsage=r3});var Aq=R(As=>{"use strict";Object.defineProperty(As,"__esModule",{value:!0});As.extendSubschemaMode=As.extendSubschemaData=As.getSubschema=void 0;var Si=ve(),Dq=we();function n3(t,{keyword:e,schemaProp:r,schema:n,schemaPath:i,errSchemaPath:s,topSchemaRef:o}){if(e!==void 0&&n!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(e!==void 0){let a=t.schema[e];return r===void 0?{schema:a,schemaPath:(0,Si._)`${t.schemaPath}${(0,Si.getProperty)(e)}`,errSchemaPath:`${t.errSchemaPath}/${e}`}:{schema:a[r],schemaPath:(0,Si._)`${t.schemaPath}${(0,Si.getProperty)(e)}${(0,Si.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${e}/${(0,Dq.escapeFragment)(r)}`}}if(n!==void 0){if(i===void 0||s===void 0||o===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:n,schemaPath:i,topSchemaRef:o,errSchemaPath:s}}throw new Error('either "keyword" or "schema" must be passed')}As.getSubschema=n3;function i3(t,e,{dataProp:r,dataPropType:n,data:i,dataTypes:s,propertyName:o}){if(i!==void 0&&r!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');let{gen:a}=e;if(r!==void 0){let{errorPath:l,dataPathArr:u,opts:d}=e,f=a.let("data",(0,Si._)`${e.data}${(0,Si.getProperty)(r)}`,!0);c(f),t.errorPath=(0,Si.str)`${l}${(0,Dq.getErrorPath)(r,n,d.jsPropertySyntax)}`,t.parentDataProperty=(0,Si._)`${r}`,t.dataPathArr=[...u,t.parentDataProperty]}if(i!==void 0){let l=i instanceof Si.Name?i:a.let("data",i,!0);c(l),o!==void 0&&(t.propertyName=o)}s&&(t.dataTypes=s);function c(l){t.data=l,t.dataLevel=e.dataLevel+1,t.dataTypes=[],e.definedProperties=new Set,t.parentData=e.data,t.dataNames=[...e.dataNames,l]}}As.extendSubschemaData=i3;function s3(t,{jtdDiscriminator:e,jtdMetadata:r,compositeRule:n,createErrors:i,allErrors:s}){n!==void 0&&(t.compositeRule=n),i!==void 0&&(t.createErrors=i),s!==void 0&&(t.allErrors=s),t.jtdDiscriminator=e,t.jtdMetadata=r}As.extendSubschemaMode=s3});var vS=R((rEe,Iq)=>{"use strict";Iq.exports=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,i,s;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(i=n;i--!==0;)if(!t(e[i],r[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(s=Object.keys(e),n=s.length,n!==Object.keys(r).length)return!1;for(i=n;i--!==0;)if(!Object.prototype.hasOwnProperty.call(r,s[i]))return!1;for(i=n;i--!==0;){var o=s[i];if(!t(e[o],r[o]))return!1}return!0}return e!==e&&r!==r}});var xq=R((nEe,Oq)=>{"use strict";var Is=Oq.exports=function(t,e,r){typeof e=="function"&&(r=e,e={}),r=e.cb||r;var n=typeof r=="function"?r:r.pre||function(){},i=r.post||function(){};Nm(e,n,i,t,"",t)};Is.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};Is.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};Is.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};Is.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Nm(t,e,r,n,i,s,o,a,c,l){if(n&&typeof n=="object"&&!Array.isArray(n)){e(n,i,s,o,a,c,l);for(var u in n){var d=n[u];if(Array.isArray(d)){if(u in Is.arrayKeywords)for(var f=0;f<d.length;f++)Nm(t,e,r,d[f],i+"/"+u+"/"+f,s,i,u,n,f)}else if(u in Is.propsKeywords){if(d&&typeof d=="object")for(var p in d)Nm(t,e,r,d[p],i+"/"+u+"/"+o3(p),s,i,u,n,p)}else(u in Is.keywords||t.allKeys&&!(u in Is.skipKeywords))&&Nm(t,e,r,d,i+"/"+u,s,i,u,n)}r(n,i,s,o,a,c,l)}}function o3(t){return t.replace(/~/g,"~0").replace(/\//g,"~1")}});var gu=R(Yr=>{"use strict";Object.defineProperty(Yr,"__esModule",{value:!0});Yr.getSchemaRefs=Yr.resolveUrl=Yr.normalizeId=Yr._getFullPath=Yr.getFullPath=Yr.inlineRef=void 0;var a3=we(),c3=vS(),l3=xq(),u3=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);function d3(t,e=!0){return typeof t=="boolean"?!0:e===!0?!bS(t):e?Mq(t)<=e:!1}Yr.inlineRef=d3;var f3=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function bS(t){for(let e in t){if(f3.has(e))return!0;let r=t[e];if(Array.isArray(r)&&r.some(bS)||typeof r=="object"&&bS(r))return!0}return!1}function Mq(t){let e=0;for(let r in t){if(r==="$ref")return 1/0;if(e++,!u3.has(r)&&(typeof t[r]=="object"&&(0,a3.eachItem)(t[r],n=>e+=Mq(n)),e===1/0))return 1/0}return e}function Lq(t,e="",r){r!==!1&&(e=nc(e));let n=t.parse(e);return qq(t,n)}Yr.getFullPath=Lq;function qq(t,e){return t.serialize(e).split("#")[0]+"#"}Yr._getFullPath=qq;var p3=/#\/?$/;function nc(t){return t?t.replace(p3,""):""}Yr.normalizeId=nc;function h3(t,e,r){return r=nc(r),t.resolve(e,r)}Yr.resolveUrl=h3;var m3=/^[a-z_][-a-z0-9._]*$/i;function g3(t,e){if(typeof t=="boolean")return{};let{schemaId:r,uriResolver:n}=this.opts,i=nc(t[r]||e),s={"":i},o=Lq(n,i,!1),a={},c=new Set;return l3(t,{allKeys:!0},(d,f,p,m)=>{if(m===void 0)return;let h=o+f,T=s[m];typeof d[r]=="string"&&(T=_.call(this,d[r])),b.call(this,d.$anchor),b.call(this,d.$dynamicAnchor),s[f]=T;function _(v){let k=this.opts.uriResolver.resolve;if(v=nc(T?k(T,v):v),c.has(v))throw u(v);c.add(v);let w=this.refs[v];return typeof w=="string"&&(w=this.refs[w]),typeof w=="object"?l(d,w.schema,v):v!==nc(h)&&(v[0]==="#"?(l(d,a[v],v),a[v]=d):this.refs[v]=h),v}function b(v){if(typeof v=="string"){if(!m3.test(v))throw new Error(`invalid anchor "${v}"`);_.call(this,`#${v}`)}}}),a;function l(d,f,p){if(f!==void 0&&!c3(d,f))throw u(p)}function u(d){return new Error(`reference "${d}" resolves to more than one schema`)}}Yr.getSchemaRefs=g3});var vu=R(Os=>{"use strict";Object.defineProperty(Os,"__esModule",{value:!0});Os.getData=Os.KeywordCxt=Os.validateFunctionCode=void 0;var Uq=yq(),$q=mu(),_S=fS(),Rm=mu(),y3=Nq(),Tu=Cq(),SS=Aq(),se=ve(),he=Cn(),T3=gu(),zi=we(),yu=hu();function v3(t){if(zq(t)&&(Wq(t),Vq(t))){_3(t);return}Hq(t,()=>(0,Uq.topBoolOrEmptySchema)(t))}Os.validateFunctionCode=v3;function Hq({gen:t,validateName:e,schema:r,schemaEnv:n,opts:i},s){i.code.es5?t.func(e,(0,se._)`${he.default.data}, ${he.default.valCxt}`,n.$async,()=>{t.code((0,se._)`"use strict"; ${Fq(r,i)}`),S3(t,i),t.code(s)}):t.func(e,(0,se._)`${he.default.data}, ${b3(i)}`,n.$async,()=>t.code(Fq(r,i)).code(s))}function b3(t){return(0,se._)`{${he.default.instancePath}="", ${he.default.parentData}, ${he.default.parentDataProperty}, ${he.default.rootData}=${he.default.data}${t.dynamicRef?(0,se._)`, ${he.default.dynamicAnchors}={}`:se.nil}}={}`}function S3(t,e){t.if(he.default.valCxt,()=>{t.var(he.default.instancePath,(0,se._)`${he.default.valCxt}.${he.default.instancePath}`),t.var(he.default.parentData,(0,se._)`${he.default.valCxt}.${he.default.parentData}`),t.var(he.default.parentDataProperty,(0,se._)`${he.default.valCxt}.${he.default.parentDataProperty}`),t.var(he.default.rootData,(0,se._)`${he.default.valCxt}.${he.default.rootData}`),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`${he.default.valCxt}.${he.default.dynamicAnchors}`)},()=>{t.var(he.default.instancePath,(0,se._)`""`),t.var(he.default.parentData,(0,se._)`undefined`),t.var(he.default.parentDataProperty,(0,se._)`undefined`),t.var(he.default.rootData,he.default.data),e.dynamicRef&&t.var(he.default.dynamicAnchors,(0,se._)`{}`)})}function _3(t){let{schema:e,opts:r,gen:n}=t;Hq(t,()=>{r.$comment&&e.$comment&&Kq(t),E3(t),n.let(he.default.vErrors,null),n.let(he.default.errors,0),r.unevaluated&&k3(t),Gq(t),D3(t)})}function k3(t){let{gen:e,validateName:r}=t;t.evaluated=e.const("evaluated",(0,se._)`${r}.evaluated`),e.if((0,se._)`${t.evaluated}.dynamicProps`,()=>e.assign((0,se._)`${t.evaluated}.props`,(0,se._)`undefined`)),e.if((0,se._)`${t.evaluated}.dynamicItems`,()=>e.assign((0,se._)`${t.evaluated}.items`,(0,se._)`undefined`))}function Fq(t,e){let r=typeof t=="object"&&t[e.schemaId];return r&&(e.code.source||e.code.process)?(0,se._)`/*# sourceURL=${r} */`:se.nil}function N3(t,e){if(zq(t)&&(Wq(t),Vq(t))){R3(t,e);return}(0,Uq.boolOrEmptySchema)(t,e)}function Vq({schema:t,self:e}){if(typeof t=="boolean")return!t;for(let r in t)if(e.RULES.all[r])return!0;return!1}function zq(t){return typeof t.schema!="boolean"}function R3(t,e){let{schema:r,gen:n,opts:i}=t;i.$comment&&r.$comment&&Kq(t),w3(t),C3(t);let s=n.const("_errs",he.default.errors);Gq(t,s),n.var(e,(0,se._)`${s} === ${he.default.errors}`)}function Wq(t){(0,zi.checkUnknownRules)(t),P3(t)}function Gq(t,e){if(t.opts.jtd)return Bq(t,[],!1,e);let r=(0,$q.getSchemaTypes)(t.schema),n=(0,$q.coerceAndCheckDataType)(t,r);Bq(t,r,!n,e)}function P3(t){let{schema:e,errSchemaPath:r,opts:n,self:i}=t;e.$ref&&n.ignoreKeywordsWithRef&&(0,zi.schemaHasRulesButRef)(e,i.RULES)&&i.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}function E3(t){let{schema:e,opts:r}=t;e.default!==void 0&&r.useDefaults&&r.strictSchema&&(0,zi.checkStrictMode)(t,"default is ignored in the schema root")}function w3(t){let e=t.schema[t.opts.schemaId];e&&(t.baseId=(0,T3.resolveUrl)(t.opts.uriResolver,t.baseId,e))}function C3(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function Kq({gen:t,schemaEnv:e,schema:r,errSchemaPath:n,opts:i}){let s=r.$comment;if(i.$comment===!0)t.code((0,se._)`${he.default.self}.logger.log(${s})`);else if(typeof i.$comment=="function"){let o=(0,se.str)`${n}/$comment`,a=t.scopeValue("root",{ref:e.root});t.code((0,se._)`${he.default.self}.opts.$comment(${s}, ${o}, ${a}.schema)`)}}function D3(t){let{gen:e,schemaEnv:r,validateName:n,ValidationError:i,opts:s}=t;r.$async?e.if((0,se._)`${he.default.errors} === 0`,()=>e.return(he.default.data),()=>e.throw((0,se._)`new ${i}(${he.default.vErrors})`)):(e.assign((0,se._)`${n}.errors`,he.default.vErrors),s.unevaluated&&A3(t),e.return((0,se._)`${he.default.errors} === 0`))}function A3({gen:t,evaluated:e,props:r,items:n}){r instanceof se.Name&&t.assign((0,se._)`${e}.props`,r),n instanceof se.Name&&t.assign((0,se._)`${e}.items`,n)}function Bq(t,e,r,n){let{gen:i,schema:s,data:o,allErrors:a,opts:c,self:l}=t,{RULES:u}=l;if(s.$ref&&(c.ignoreKeywordsWithRef||!(0,zi.schemaHasRulesButRef)(s,u))){i.block(()=>Xq(t,"$ref",u.all.$ref.definition));return}c.jtd||I3(t,e),i.block(()=>{for(let f of u.rules)d(f);d(u.post)});function d(f){(0,_S.shouldUseGroup)(s,f)&&(f.type?(i.if((0,Rm.checkDataType)(f.type,o,c.strictNumbers)),jq(t,f),e.length===1&&e[0]===f.type&&r&&(i.else(),(0,Rm.reportTypeError)(t)),i.endIf()):jq(t,f),a||i.if((0,se._)`${he.default.errors} === ${n||0}`))}}function jq(t,e){let{gen:r,schema:n,opts:{useDefaults:i}}=t;i&&(0,y3.assignDefaults)(t,e.type),r.block(()=>{for(let s of e.rules)(0,_S.shouldUseRule)(n,s)&&Xq(t,s.keyword,s.definition,e.type)})}function I3(t,e){t.schemaEnv.meta||!t.opts.strictTypes||(O3(t,e),t.opts.allowUnionTypes||x3(t,e),M3(t,t.dataTypes))}function O3(t,e){if(e.length){if(!t.dataTypes.length){t.dataTypes=e;return}e.forEach(r=>{Yq(t.dataTypes,r)||kS(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}),q3(t,e)}}function x3(t,e){e.length>1&&!(e.length===2&&e.includes("null"))&&kS(t,"use allowUnionTypes to allow union type keyword")}function M3(t,e){let r=t.self.RULES.all;for(let n in r){let i=r[n];if(typeof i=="object"&&(0,_S.shouldUseRule)(t.schema,i)){let{type:s}=i.definition;s.length&&!s.some(o=>L3(e,o))&&kS(t,`missing type "${s.join(",")}" for keyword "${n}"`)}}}function L3(t,e){return t.includes(e)||e==="number"&&t.includes("integer")}function Yq(t,e){return t.includes(e)||e==="integer"&&t.includes("number")}function q3(t,e){let r=[];for(let n of t.dataTypes)Yq(e,n)?r.push(n):e.includes("integer")&&n==="number"&&r.push("integer");t.dataTypes=r}function kS(t,e){let r=t.schemaEnv.baseId+t.errSchemaPath;e+=` at "${r}" (strictTypes)`,(0,zi.checkStrictMode)(t,e,t.opts.strictTypes)}var Pm=class{constructor(e,r,n){if((0,Tu.validateKeywordUsage)(e,r,n),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=n,this.data=e.data,this.schema=e.schema[n],this.$data=r.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,zi.schemaRefOrVal)(e,this.schema,n,this.$data),this.schemaType=r.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=r,this.$data)this.schemaCode=e.gen.const("vSchema",Jq(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,Tu.validSchemaType)(this.schema,r.schemaType,r.allowUndefined))throw new Error(`${n} value must be ${JSON.stringify(r.schemaType)}`);("code"in r?r.trackErrors:r.errors!==!1)&&(this.errsCount=e.gen.const("_errs",he.default.errors))}result(e,r,n){this.failResult((0,se.not)(e),r,n)}failResult(e,r,n){this.gen.if(e),n?n():this.error(),r?(this.gen.else(),r(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,r){this.failResult((0,se.not)(e),void 0,r)}fail(e){if(e===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);let{schemaCode:r}=this;this.fail((0,se._)`${r} !== undefined && (${(0,se.or)(this.invalid$data(),e)})`)}error(e,r,n){if(r){this.setParams(r),this._error(e,n),this.setParams({});return}this._error(e,n)}_error(e,r){(e?yu.reportExtraError:yu.reportError)(this,this.def.error,r)}$dataError(){(0,yu.reportError)(this,this.def.$dataError||yu.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,yu.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,r){r?Object.assign(this.params,e):this.params=e}block$data(e,r,n=se.nil){this.gen.block(()=>{this.check$data(e,n),r()})}check$data(e=se.nil,r=se.nil){if(!this.$data)return;let{gen:n,schemaCode:i,schemaType:s,def:o}=this;n.if((0,se.or)((0,se._)`${i} === undefined`,r)),e!==se.nil&&n.assign(e,!0),(s.length||o.validateSchema)&&(n.elseIf(this.invalid$data()),this.$dataError(),e!==se.nil&&n.assign(e,!1)),n.else()}invalid$data(){let{gen:e,schemaCode:r,schemaType:n,def:i,it:s}=this;return(0,se.or)(o(),a());function o(){if(n.length){if(!(r instanceof se.Name))throw new Error("ajv implementation error");let c=Array.isArray(n)?n:[n];return(0,se._)`${(0,Rm.checkDataTypes)(c,r,s.opts.strictNumbers,Rm.DataType.Wrong)}`}return se.nil}function a(){if(i.validateSchema){let c=e.scopeValue("validate$data",{ref:i.validateSchema});return(0,se._)`!${c}(${r})`}return se.nil}}subschema(e,r){let n=(0,SS.getSubschema)(this.it,e);(0,SS.extendSubschemaData)(n,this.it,e),(0,SS.extendSubschemaMode)(n,e);let i={...this.it,...n,items:void 0,props:void 0};return N3(i,r),i}mergeEvaluated(e,r){let{it:n,gen:i}=this;n.opts.unevaluated&&(n.props!==!0&&e.props!==void 0&&(n.props=zi.mergeEvaluated.props(i,e.props,n.props,r)),n.items!==!0&&e.items!==void 0&&(n.items=zi.mergeEvaluated.items(i,e.items,n.items,r)))}mergeValidEvaluated(e,r){let{it:n,gen:i}=this;if(n.opts.unevaluated&&(n.props!==!0||n.items!==!0))return i.if(r,()=>this.mergeEvaluated(e,se.Name)),!0}};Os.KeywordCxt=Pm;function Xq(t,e,r,n){let i=new Pm(t,r,e);"code"in r?r.code(i,n):i.$data&&r.validate?(0,Tu.funcKeywordCode)(i,r):"macro"in r?(0,Tu.macroKeywordCode)(i,r):(r.compile||r.validate)&&(0,Tu.funcKeywordCode)(i,r)}var $3=/^\/(?:[^~]|~0|~1)*$/,F3=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function Jq(t,{dataLevel:e,dataNames:r,dataPathArr:n}){let i,s;if(t==="")return he.default.rootData;if(t[0]==="/"){if(!$3.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);i=t,s=he.default.rootData}else{let l=F3.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);let u=+l[1];if(i=l[2],i==="#"){if(u>=e)throw new Error(c("property/index",u));return n[e-u]}if(u>e)throw new Error(c("data",u));if(s=r[e-u],!i)return s}let o=s,a=i.split("/");for(let l of a)l&&(s=(0,se._)`${s}${(0,se.getProperty)((0,zi.unescapeJsonPointer)(l))}`,o=(0,se._)`${o} && ${s}`);return o;function c(l,u){return`Cannot access ${l} ${u} levels up, current level is ${e}`}}Os.getData=Jq});var Em=R(RS=>{"use strict";Object.defineProperty(RS,"__esModule",{value:!0});var NS=class extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}};RS.default=NS});var bu=R(wS=>{"use strict";Object.defineProperty(wS,"__esModule",{value:!0});var PS=gu(),ES=class extends Error{constructor(e,r,n,i){super(i||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,PS.resolveUrl)(e,r,n),this.missingSchema=(0,PS.normalizeId)((0,PS.getFullPath)(e,this.missingRef))}};wS.default=ES});var Su=R(An=>{"use strict";Object.defineProperty(An,"__esModule",{value:!0});An.resolveSchema=An.getCompilingSchema=An.resolveRef=An.compileSchema=An.SchemaEnv=void 0;var ti=ve(),B3=Em(),bo=Cn(),ri=gu(),Qq=we(),j3=vu(),ic=class{constructor(e){var r;this.refs={},this.dynamicAnchors={};let n;typeof e.schema=="object"&&(n=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=(r=e.baseId)!==null&&r!==void 0?r:(0,ri.normalizeId)(n?.[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=n?.$async,this.refs={}}};An.SchemaEnv=ic;function DS(t){let e=Zq.call(this,t);if(e)return e;let r=(0,ri.getFullPath)(this.opts.uriResolver,t.root.baseId),{es5:n,lines:i}=this.opts.code,{ownProperties:s}=this.opts,o=new ti.CodeGen(this.scope,{es5:n,lines:i,ownProperties:s}),a;t.$async&&(a=o.scopeValue("Error",{ref:B3.default,code:(0,ti._)`require("ajv/dist/runtime/validation_error").default`}));let c=o.scopeName("validate");t.validateName=c;let l={gen:o,allErrors:this.opts.allErrors,data:bo.default.data,parentData:bo.default.parentData,parentDataProperty:bo.default.parentDataProperty,dataNames:[bo.default.data],dataPathArr:[ti.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:o.scopeValue("schema",this.opts.code.source===!0?{ref:t.schema,code:(0,ti.stringify)(t.schema)}:{ref:t.schema}),validateName:c,ValidationError:a,schema:t.schema,schemaEnv:t,rootId:r,baseId:t.baseId||r,schemaPath:ti.nil,errSchemaPath:t.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,ti._)`""`,opts:this.opts,self:this},u;try{this._compilations.add(t),(0,j3.validateFunctionCode)(l),o.optimize(this.opts.code.optimize);let d=o.toString();u=`${o.scopeRefs(bo.default.scope)}return ${d}`,this.opts.code.process&&(u=this.opts.code.process(u,t));let p=new Function(`${bo.default.self}`,`${bo.default.scope}`,u)(this,this.scope.get());if(this.scope.value(c,{ref:p}),p.errors=null,p.schema=t.schema,p.schemaEnv=t,t.$async&&(p.$async=!0),this.opts.code.source===!0&&(p.source={validateName:c,validateCode:d,scopeValues:o._values}),this.opts.unevaluated){let{props:m,items:h}=l;p.evaluated={props:m instanceof ti.Name?void 0:m,items:h instanceof ti.Name?void 0:h,dynamicProps:m instanceof ti.Name,dynamicItems:h instanceof ti.Name},p.source&&(p.source.evaluated=(0,ti.stringify)(p.evaluated))}return t.validate=p,t}catch(d){throw delete t.validate,delete t.validateName,u&&this.logger.error("Error compiling schema, function code:",u),d}finally{this._compilations.delete(t)}}An.compileSchema=DS;function U3(t,e,r){var n;r=(0,ri.resolveUrl)(this.opts.uriResolver,e,r);let i=t.refs[r];if(i)return i;let s=z3.call(this,t,r);if(s===void 0){let o=(n=t.localRefs)===null||n===void 0?void 0:n[r],{schemaId:a}=this.opts;o&&(s=new ic({schema:o,schemaId:a,root:t,baseId:e}))}if(s!==void 0)return t.refs[r]=H3.call(this,s)}An.resolveRef=U3;function H3(t){return(0,ri.inlineRef)(t.schema,this.opts.inlineRefs)?t.schema:t.validate?t:DS.call(this,t)}function Zq(t){for(let e of this._compilations)if(V3(e,t))return e}An.getCompilingSchema=Zq;function V3(t,e){return t.schema===e.schema&&t.root===e.root&&t.baseId===e.baseId}function z3(t,e){let r;for(;typeof(r=this.refs[e])=="string";)e=r;return r||this.schemas[e]||wm.call(this,t,e)}function wm(t,e){let r=this.opts.uriResolver.parse(e),n=(0,ri._getFullPath)(this.opts.uriResolver,r),i=(0,ri.getFullPath)(this.opts.uriResolver,t.baseId,void 0);if(Object.keys(t.schema).length>0&&n===i)return CS.call(this,r,t);let s=(0,ri.normalizeId)(n),o=this.refs[s]||this.schemas[s];if(typeof o=="string"){let a=wm.call(this,t,o);return typeof a?.schema!="object"?void 0:CS.call(this,r,a)}if(typeof o?.schema=="object"){if(o.validate||DS.call(this,o),s===(0,ri.normalizeId)(e)){let{schema:a}=o,{schemaId:c}=this.opts,l=a[c];return l&&(i=(0,ri.resolveUrl)(this.opts.uriResolver,i,l)),new ic({schema:a,schemaId:c,root:t,baseId:i})}return CS.call(this,r,o)}}An.resolveSchema=wm;var W3=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function CS(t,{baseId:e,schema:r,root:n}){var i;if(((i=t.fragment)===null||i===void 0?void 0:i[0])!=="/")return;for(let a of t.fragment.slice(1).split("/")){if(typeof r=="boolean")return;let c=r[(0,Qq.unescapeFragment)(a)];if(c===void 0)return;r=c;let l=typeof r=="object"&&r[this.opts.schemaId];!W3.has(a)&&l&&(e=(0,ri.resolveUrl)(this.opts.uriResolver,e,l))}let s;if(typeof r!="boolean"&&r.$ref&&!(0,Qq.schemaHasRulesButRef)(r,this.RULES)){let a=(0,ri.resolveUrl)(this.opts.uriResolver,e,r.$ref);s=wm.call(this,n,a)}let{schemaId:o}=this.opts;if(s=s||new ic({schema:r,schemaId:o,root:n,baseId:e}),s.schema!==s.root.schema)return s}});var e1=R((lEe,G3)=>{G3.exports={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1}});var r1=R((uEe,t1)=>{"use strict";var K3={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t1.exports={HEX:K3}});var u1=R((dEe,l1)=>{"use strict";var{HEX:Y3}=r1(),X3=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function o1(t){if(c1(t,".")<3)return{host:t,isIPV4:!1};let e=t.match(X3)||[],[r]=e;return r?{host:Q3(r,"."),isIPV4:!0}:{host:t,isIPV4:!1}}function AS(t,e=!1){let r="",n=!0;for(let i of t){if(Y3[i]===void 0)return;i!=="0"&&n===!0&&(n=!1),n||(r+=i)}return e&&r.length===0&&(r="0"),r}function J3(t){let e=0,r={error:!1,address:"",zone:""},n=[],i=[],s=!1,o=!1,a=!1;function c(){if(i.length){if(s===!1){let l=AS(i);if(l!==void 0)n.push(l);else return r.error=!0,!1}i.length=0}return!0}for(let l=0;l<t.length;l++){let u=t[l];if(!(u==="["||u==="]"))if(u===":"){if(o===!0&&(a=!0),!c())break;if(e++,n.push(":"),e>7){r.error=!0;break}l-1>=0&&t[l-1]===":"&&(o=!0);continue}else if(u==="%"){if(!c())break;s=!0}else{i.push(u);continue}}return i.length&&(s?r.zone=i.join(""):a?n.push(i.join("")):n.push(AS(i))),r.address=n.join(""),r}function a1(t){if(c1(t,":")<2)return{host:t,isIPV6:!1};let e=J3(t);if(e.error)return{host:t,isIPV6:!1};{let r=e.address,n=e.address;return e.zone&&(r+="%"+e.zone,n+="%25"+e.zone),{host:r,escapedHost:n,isIPV6:!0}}}function Q3(t,e){let r="",n=!0,i=t.length;for(let s=0;s<i;s++){let o=t[s];o==="0"&&n?(s+1<=i&&t[s+1]===e||s+1===i)&&(r+=o,n=!1):(o===e?n=!0:n=!1,r+=o)}return r}function c1(t,e){let r=0;for(let n=0;n<t.length;n++)t[n]===e&&r++;return r}var n1=/^\.\.?\//u,i1=/^\/\.(?:\/|$)/u,s1=/^\/\.\.(?:\/|$)/u,Z3=/^\/?(?:.|\n)*?(?=\/|$)/u;function eX(t){let e=[];for(;t.length;)if(t.match(n1))t=t.replace(n1,"");else if(t.match(i1))t=t.replace(i1,"/");else if(t.match(s1))t=t.replace(s1,"/"),e.pop();else if(t==="."||t==="..")t="";else{let r=t.match(Z3);if(r){let n=r[0];t=t.slice(n.length),e.push(n)}else throw new Error("Unexpected dot segment condition")}return e.join("")}function tX(t,e){let r=e!==!0?escape:unescape;return t.scheme!==void 0&&(t.scheme=r(t.scheme)),t.userinfo!==void 0&&(t.userinfo=r(t.userinfo)),t.host!==void 0&&(t.host=r(t.host)),t.path!==void 0&&(t.path=r(t.path)),t.query!==void 0&&(t.query=r(t.query)),t.fragment!==void 0&&(t.fragment=r(t.fragment)),t}function rX(t){let e=[];if(t.userinfo!==void 0&&(e.push(t.userinfo),e.push("@")),t.host!==void 0){let r=unescape(t.host),n=o1(r);if(n.isIPV4)r=n.host;else{let i=a1(n.host);i.isIPV6===!0?r=`[${i.escapedHost}]`:r=t.host}e.push(r)}return(typeof t.port=="number"||typeof t.port=="string")&&(e.push(":"),e.push(String(t.port))),e.length?e.join(""):void 0}l1.exports={recomposeAuthority:rX,normalizeComponentEncoding:tX,removeDotSegments:eX,normalizeIPv4:o1,normalizeIPv6:a1,stringArrayToHexStripped:AS}});var g1=R((fEe,m1)=>{"use strict";var nX=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,iX=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function d1(t){return typeof t.secure=="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function f1(t){return t.host||(t.error=t.error||"HTTP URIs must have a host."),t}function p1(t){let e=String(t.scheme).toLowerCase()==="https";return(t.port===(e?443:80)||t.port==="")&&(t.port=void 0),t.path||(t.path="/"),t}function sX(t){return t.secure=d1(t),t.resourceName=(t.path||"/")+(t.query?"?"+t.query:""),t.path=void 0,t.query=void 0,t}function oX(t){if((t.port===(d1(t)?443:80)||t.port==="")&&(t.port=void 0),typeof t.secure=="boolean"&&(t.scheme=t.secure?"wss":"ws",t.secure=void 0),t.resourceName){let[e,r]=t.resourceName.split("?");t.path=e&&e!=="/"?e:void 0,t.query=r,t.resourceName=void 0}return t.fragment=void 0,t}function aX(t,e){if(!t.path)return t.error="URN can not be parsed",t;let r=t.path.match(iX);if(r){let n=e.scheme||t.scheme||"urn";t.nid=r[1].toLowerCase(),t.nss=r[2];let i=`${n}:${e.nid||t.nid}`,s=IS[i];t.path=void 0,s&&(t=s.parse(t,e))}else t.error=t.error||"URN can not be parsed.";return t}function cX(t,e){let r=e.scheme||t.scheme||"urn",n=t.nid.toLowerCase(),i=`${r}:${e.nid||n}`,s=IS[i];s&&(t=s.serialize(t,e));let o=t,a=t.nss;return o.path=`${n||e.nid}:${a}`,e.skipEscape=!0,o}function lX(t,e){let r=t;return r.uuid=r.nss,r.nss=void 0,!e.tolerant&&(!r.uuid||!nX.test(r.uuid))&&(r.error=r.error||"UUID is not valid."),r}function uX(t){let e=t;return e.nss=(t.uuid||"").toLowerCase(),e}var h1={scheme:"http",domainHost:!0,parse:f1,serialize:p1},dX={scheme:"https",domainHost:h1.domainHost,parse:f1,serialize:p1},Cm={scheme:"ws",domainHost:!0,parse:sX,serialize:oX},fX={scheme:"wss",domainHost:Cm.domainHost,parse:Cm.parse,serialize:Cm.serialize},pX={scheme:"urn",parse:aX,serialize:cX,skipNormalize:!0},hX={scheme:"urn:uuid",parse:lX,serialize:uX,skipNormalize:!0},IS={http:h1,https:dX,ws:Cm,wss:fX,urn:pX,"urn:uuid":hX};m1.exports=IS});var T1=R((pEe,Am)=>{"use strict";var{normalizeIPv6:mX,normalizeIPv4:gX,removeDotSegments:_u,recomposeAuthority:yX,normalizeComponentEncoding:Dm}=u1(),OS=g1();function TX(t,e){return typeof t=="string"?t=_i(Wi(t,e),e):typeof t=="object"&&(t=Wi(_i(t,e),e)),t}function vX(t,e,r){let n=Object.assign({scheme:"null"},r),i=y1(Wi(t,n),Wi(e,n),n,!0);return _i(i,{...n,skipEscape:!0})}function y1(t,e,r,n){let i={};return n||(t=Wi(_i(t,r),r),e=Wi(_i(e,r),r)),r=r||{},!r.tolerant&&e.scheme?(i.scheme=e.scheme,i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=_u(e.path||""),i.query=e.query):(e.userinfo!==void 0||e.host!==void 0||e.port!==void 0?(i.userinfo=e.userinfo,i.host=e.host,i.port=e.port,i.path=_u(e.path||""),i.query=e.query):(e.path?(e.path.charAt(0)==="/"?i.path=_u(e.path):((t.userinfo!==void 0||t.host!==void 0||t.port!==void 0)&&!t.path?i.path="/"+e.path:t.path?i.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+e.path:i.path=e.path,i.path=_u(i.path)),i.query=e.query):(i.path=t.path,e.query!==void 0?i.query=e.query:i.query=t.query),i.userinfo=t.userinfo,i.host=t.host,i.port=t.port),i.scheme=t.scheme),i.fragment=e.fragment,i}function bX(t,e,r){return typeof t=="string"?(t=unescape(t),t=_i(Dm(Wi(t,r),!0),{...r,skipEscape:!0})):typeof t=="object"&&(t=_i(Dm(t,!0),{...r,skipEscape:!0})),typeof e=="string"?(e=unescape(e),e=_i(Dm(Wi(e,r),!0),{...r,skipEscape:!0})):typeof e=="object"&&(e=_i(Dm(e,!0),{...r,skipEscape:!0})),t.toLowerCase()===e.toLowerCase()}function _i(t,e){let r={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""},n=Object.assign({},e),i=[],s=OS[(n.scheme||r.scheme||"").toLowerCase()];s&&s.serialize&&s.serialize(r,n),r.path!==void 0&&(n.skipEscape?r.path=unescape(r.path):(r.path=escape(r.path),r.scheme!==void 0&&(r.path=r.path.split("%3A").join(":")))),n.reference!=="suffix"&&r.scheme&&i.push(r.scheme,":");let o=yX(r);if(o!==void 0&&(n.reference!=="suffix"&&i.push("//"),i.push(o),r.path&&r.path.charAt(0)!=="/"&&i.push("/")),r.path!==void 0){let a=r.path;!n.absolutePath&&(!s||!s.absolutePath)&&(a=_u(a)),o===void 0&&(a=a.replace(/^\/\//u,"/%2F")),i.push(a)}return r.query!==void 0&&i.push("?",r.query),r.fragment!==void 0&&i.push("#",r.fragment),i.join("")}var SX=Array.from({length:127},(t,e)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(e)));function _X(t){let e=0;for(let r=0,n=t.length;r<n;++r)if(e=t.charCodeAt(r),e>126||SX[e])return!0;return!1}var kX=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function Wi(t,e){let r=Object.assign({},e),n={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=t.indexOf("%")!==-1,s=!1;r.reference==="suffix"&&(t=(r.scheme?r.scheme+":":"")+"//"+t);let o=t.match(kX);if(o){if(n.scheme=o[1],n.userinfo=o[3],n.host=o[4],n.port=parseInt(o[5],10),n.path=o[6]||"",n.query=o[7],n.fragment=o[8],isNaN(n.port)&&(n.port=o[5]),n.host){let c=gX(n.host);if(c.isIPV4===!1){let l=mX(c.host);n.host=l.host.toLowerCase(),s=l.isIPV6}else n.host=c.host,s=!0}n.scheme===void 0&&n.userinfo===void 0&&n.host===void 0&&n.port===void 0&&n.query===void 0&&!n.path?n.reference="same-document":n.scheme===void 0?n.reference="relative":n.fragment===void 0?n.reference="absolute":n.reference="uri",r.reference&&r.reference!=="suffix"&&r.reference!==n.reference&&(n.error=n.error||"URI is not a "+r.reference+" reference.");let a=OS[(r.scheme||n.scheme||"").toLowerCase()];if(!r.unicodeSupport&&(!a||!a.unicodeSupport)&&n.host&&(r.domainHost||a&&a.domainHost)&&s===!1&&_X(n.host))try{n.host=URL.domainToASCII(n.host.toLowerCase())}catch(c){n.error=n.error||"Host's domain name can not be converted to ASCII: "+c}(!a||a&&!a.skipNormalize)&&(i&&n.scheme!==void 0&&(n.scheme=unescape(n.scheme)),i&&n.host!==void 0&&(n.host=unescape(n.host)),n.path&&(n.path=escape(unescape(n.path))),n.fragment&&(n.fragment=encodeURI(decodeURIComponent(n.fragment)))),a&&a.parse&&a.parse(n,r)}else n.error=n.error||"URI can not be parsed.";return n}var xS={SCHEMES:OS,normalize:TX,resolve:vX,resolveComponents:y1,equal:bX,serialize:_i,parse:Wi};Am.exports=xS;Am.exports.default=xS;Am.exports.fastUri=xS});var b1=R(MS=>{"use strict";Object.defineProperty(MS,"__esModule",{value:!0});var v1=T1();v1.code='require("ajv/dist/runtime/uri").default';MS.default=v1});var w1=R(ar=>{"use strict";Object.defineProperty(ar,"__esModule",{value:!0});ar.CodeGen=ar.Name=ar.nil=ar.stringify=ar.str=ar._=ar.KeywordCxt=void 0;var NX=vu();Object.defineProperty(ar,"KeywordCxt",{enumerable:!0,get:function(){return NX.KeywordCxt}});var sc=ve();Object.defineProperty(ar,"_",{enumerable:!0,get:function(){return sc._}});Object.defineProperty(ar,"str",{enumerable:!0,get:function(){return sc.str}});Object.defineProperty(ar,"stringify",{enumerable:!0,get:function(){return sc.stringify}});Object.defineProperty(ar,"nil",{enumerable:!0,get:function(){return sc.nil}});Object.defineProperty(ar,"Name",{enumerable:!0,get:function(){return sc.Name}});Object.defineProperty(ar,"CodeGen",{enumerable:!0,get:function(){return sc.CodeGen}});var RX=Em(),R1=bu(),PX=dS(),ku=Su(),EX=ve(),Nu=gu(),Im=mu(),qS=we(),S1=e1(),wX=b1(),P1=(t,e)=>new RegExp(t,e);P1.code="new RegExp";var CX=["removeAdditional","useDefaults","coerceTypes"],DX=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),AX={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},IX={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},_1=200;function OX(t){var e,r,n,i,s,o,a,c,l,u,d,f,p,m,h,T,_,b,v,k,w,H,O,B,De;let lt=t.strict,Ht=(e=t.code)===null||e===void 0?void 0:e.optimize,Ne=Ht===!0||Ht===void 0?1:Ht||0,un=(n=(r=t.code)===null||r===void 0?void 0:r.regExp)!==null&&n!==void 0?n:P1,Gi=(i=t.uriResolver)!==null&&i!==void 0?i:wX.default;return{strictSchema:(o=(s=t.strictSchema)!==null&&s!==void 0?s:lt)!==null&&o!==void 0?o:!0,strictNumbers:(c=(a=t.strictNumbers)!==null&&a!==void 0?a:lt)!==null&&c!==void 0?c:!0,strictTypes:(u=(l=t.strictTypes)!==null&&l!==void 0?l:lt)!==null&&u!==void 0?u:"log",strictTuples:(f=(d=t.strictTuples)!==null&&d!==void 0?d:lt)!==null&&f!==void 0?f:"log",strictRequired:(m=(p=t.strictRequired)!==null&&p!==void 0?p:lt)!==null&&m!==void 0?m:!1,code:t.code?{...t.code,optimize:Ne,regExp:un}:{optimize:Ne,regExp:un},loopRequired:(h=t.loopRequired)!==null&&h!==void 0?h:_1,loopEnum:(T=t.loopEnum)!==null&&T!==void 0?T:_1,meta:(_=t.meta)!==null&&_!==void 0?_:!0,messages:(b=t.messages)!==null&&b!==void 0?b:!0,inlineRefs:(v=t.inlineRefs)!==null&&v!==void 0?v:!0,schemaId:(k=t.schemaId)!==null&&k!==void 0?k:"$id",addUsedSchema:(w=t.addUsedSchema)!==null&&w!==void 0?w:!0,validateSchema:(H=t.validateSchema)!==null&&H!==void 0?H:!0,validateFormats:(O=t.validateFormats)!==null&&O!==void 0?O:!0,unicodeRegExp:(B=t.unicodeRegExp)!==null&&B!==void 0?B:!0,int32range:(De=t.int32range)!==null&&De!==void 0?De:!0,uriResolver:Gi}}var Ru=class{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...OX(e)};let{es5:r,lines:n}=this.opts.code;this.scope=new EX.ValueScope({scope:{},prefixes:DX,es5:r,lines:n}),this.logger=FX(e.logger);let i=e.validateFormats;e.validateFormats=!1,this.RULES=(0,PX.getRules)(),k1.call(this,AX,e,"NOT SUPPORTED"),k1.call(this,IX,e,"DEPRECATED","warn"),this._metaOpts=qX.call(this),e.formats&&MX.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&LX.call(this,e.keywords),typeof e.meta=="object"&&this.addMetaSchema(e.meta),xX.call(this),e.validateFormats=i}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){let{$data:e,meta:r,schemaId:n}=this.opts,i=S1;n==="id"&&(i={...S1},i.id=i.$id,delete i.$id),r&&e&&this.addMetaSchema(i,i[n],!1)}defaultMeta(){let{meta:e,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof e=="object"?e[r]||e:void 0}validate(e,r){let n;if(typeof e=="string"){if(n=this.getSchema(e),!n)throw new Error(`no schema with key or ref "${e}"`)}else n=this.compile(e);let i=n(r);return"$async"in n||(this.errors=n.errors),i}compile(e,r){let n=this._addSchema(e,r);return n.validate||this._compileSchemaEnv(n)}compileAsync(e,r){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");let{loadSchema:n}=this.opts;return i.call(this,e,r);async function i(u,d){await s.call(this,u.$schema);let f=this._addSchema(u,d);return f.validate||o.call(this,f)}async function s(u){u&&!this.getSchema(u)&&await i.call(this,{$ref:u},!0)}async function o(u){try{return this._compileSchemaEnv(u)}catch(d){if(!(d instanceof R1.default))throw d;return a.call(this,d),await c.call(this,d.missingSchema),o.call(this,u)}}function a({missingSchema:u,missingRef:d}){if(this.refs[u])throw new Error(`AnySchema ${u} is loaded but ${d} cannot be resolved`)}async function c(u){let d=await l.call(this,u);this.refs[u]||await s.call(this,d.$schema),this.refs[u]||this.addSchema(d,u,r)}async function l(u){let d=this._loading[u];if(d)return d;try{return await(this._loading[u]=n(u))}finally{delete this._loading[u]}}}addSchema(e,r,n,i=this.opts.validateSchema){if(Array.isArray(e)){for(let o of e)this.addSchema(o,void 0,n,i);return this}let s;if(typeof e=="object"){let{schemaId:o}=this.opts;if(s=e[o],s!==void 0&&typeof s!="string")throw new Error(`schema ${o} must be string`)}return r=(0,Nu.normalizeId)(r||s),this._checkUnique(r),this.schemas[r]=this._addSchema(e,n,r,i,!0),this}addMetaSchema(e,r,n=this.opts.validateSchema){return this.addSchema(e,r,!0,n),this}validateSchema(e,r){if(typeof e=="boolean")return!0;let n;if(n=e.$schema,n!==void 0&&typeof n!="string")throw new Error("$schema must be a string");if(n=n||this.opts.defaultMeta||this.defaultMeta(),!n)return this.logger.warn("meta-schema not available"),this.errors=null,!0;let i=this.validate(n,e);if(!i&&r){let s="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(s);else throw new Error(s)}return i}getSchema(e){let r;for(;typeof(r=N1.call(this,e))=="string";)e=r;if(r===void 0){let{schemaId:n}=this.opts,i=new ku.SchemaEnv({schema:{},schemaId:n});if(r=ku.resolveSchema.call(this,i,e),!r)return;this.refs[e]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{let r=N1.call(this,e);return typeof r=="object"&&this._cache.delete(r.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{let r=e;this._cache.delete(r);let n=e[this.opts.schemaId];return n&&(n=(0,Nu.normalizeId)(n),delete this.schemas[n],delete this.refs[n]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(let r of e)this.addKeyword(r);return this}addKeyword(e,r){let n;if(typeof e=="string")n=e,typeof r=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),r.keyword=n);else if(typeof e=="object"&&r===void 0){if(r=e,n=r.keyword,Array.isArray(n)&&!n.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(jX.call(this,n,r),!r)return(0,qS.eachItem)(n,s=>LS.call(this,s)),this;HX.call(this,r);let i={...r,type:(0,Im.getJSONTypes)(r.type),schemaType:(0,Im.getJSONTypes)(r.schemaType)};return(0,qS.eachItem)(n,i.type.length===0?s=>LS.call(this,s,i):s=>i.type.forEach(o=>LS.call(this,s,i,o))),this}getKeyword(e){let r=this.RULES.all[e];return typeof r=="object"?r.definition:!!r}removeKeyword(e){let{RULES:r}=this;delete r.keywords[e],delete r.all[e];for(let n of r.rules){let i=n.rules.findIndex(s=>s.keyword===e);i>=0&&n.rules.splice(i,1)}return this}addFormat(e,r){return typeof r=="string"&&(r=new RegExp(r)),this.formats[e]=r,this}errorsText(e=this.errors,{separator:r=", ",dataVar:n="data"}={}){return!e||e.length===0?"No errors":e.map(i=>`${n}${i.instancePath} ${i.message}`).reduce((i,s)=>i+r+s)}$dataMetaSchema(e,r){let n=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(let i of r){let s=i.split("/").slice(1),o=e;for(let a of s)o=o[a];for(let a in n){let c=n[a];if(typeof c!="object")continue;let{$data:l}=c.definition,u=o[a];l&&u&&(o[a]=E1(u))}}return e}_removeAllSchemas(e,r){for(let n in e){let i=e[n];(!r||r.test(n))&&(typeof i=="string"?delete e[n]:i&&!i.meta&&(this._cache.delete(i.schema),delete e[n]))}}_addSchema(e,r,n,i=this.opts.validateSchema,s=this.opts.addUsedSchema){let o,{schemaId:a}=this.opts;if(typeof e=="object")o=e[a];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof e!="boolean")throw new Error("schema must be object or boolean")}let c=this._cache.get(e);if(c!==void 0)return c;n=(0,Nu.normalizeId)(o||n);let l=Nu.getSchemaRefs.call(this,e,n);return c=new ku.SchemaEnv({schema:e,schemaId:a,meta:r,baseId:n,localRefs:l}),this._cache.set(c.schema,c),s&&!n.startsWith("#")&&(n&&this._checkUnique(n),this.refs[n]=c),i&&this.validateSchema(e,!0),c}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):ku.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){let r=this.opts;this.opts=this._metaOpts;try{ku.compileSchema.call(this,e)}finally{this.opts=r}}};Ru.ValidationError=RX.default;Ru.MissingRefError=R1.default;ar.default=Ru;function k1(t,e,r,n="error"){for(let i in t){let s=i;s in e&&this.logger[n](`${r}: option ${i}. ${t[s]}`)}}function N1(t){return t=(0,Nu.normalizeId)(t),this.schemas[t]||this.refs[t]}function xX(){let t=this.opts.schemas;if(t)if(Array.isArray(t))this.addSchema(t);else for(let e in t)this.addSchema(t[e],e)}function MX(){for(let t in this.opts.formats){let e=this.opts.formats[t];e&&this.addFormat(t,e)}}function LX(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(let e in t){let r=t[e];r.keyword||(r.keyword=e),this.addKeyword(r)}}function qX(){let t={...this.opts};for(let e of CX)delete t[e];return t}var $X={log(){},warn(){},error(){}};function FX(t){if(t===!1)return $X;if(t===void 0)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}var BX=/^[a-z_$][a-z0-9_$:-]*$/i;function jX(t,e){let{RULES:r}=this;if((0,qS.eachItem)(t,n=>{if(r.keywords[n])throw new Error(`Keyword ${n} is already defined`);if(!BX.test(n))throw new Error(`Keyword ${n} has invalid name`)}),!!e&&e.$data&&!("code"in e||"validate"in e))throw new Error('$data keyword must have "code" or "validate" function')}function LS(t,e,r){var n;let i=e?.post;if(r&&i)throw new Error('keyword with "post" flag cannot have "type"');let{RULES:s}=this,o=i?s.post:s.rules.find(({type:c})=>c===r);if(o||(o={type:r,rules:[]},s.rules.push(o)),s.keywords[t]=!0,!e)return;let a={keyword:t,definition:{...e,type:(0,Im.getJSONTypes)(e.type),schemaType:(0,Im.getJSONTypes)(e.schemaType)}};e.before?UX.call(this,o,a,e.before):o.rules.push(a),s.all[t]=a,(n=e.implements)===null||n===void 0||n.forEach(c=>this.addKeyword(c))}function UX(t,e,r){let n=t.rules.findIndex(i=>i.keyword===r);n>=0?t.rules.splice(n,0,e):(t.rules.push(e),this.logger.warn(`rule ${r} is not defined`))}function HX(t){let{metaSchema:e}=t;e!==void 0&&(t.$data&&this.opts.$data&&(e=E1(e)),t.validateSchema=this.compile(e,!0))}var VX={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function E1(t){return{anyOf:[t,VX]}}});var C1=R($S=>{"use strict";Object.defineProperty($S,"__esModule",{value:!0});var zX={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};$S.default=zX});var Mm=R(So=>{"use strict";Object.defineProperty(So,"__esModule",{value:!0});So.callRef=So.getValidate=void 0;var WX=bu(),D1=Dn(),Xr=ve(),oc=Cn(),A1=Su(),Om=we(),GX={keyword:"$ref",schemaType:"string",code(t){let{gen:e,schema:r,it:n}=t,{baseId:i,schemaEnv:s,validateName:o,opts:a,self:c}=n,{root:l}=s;if((r==="#"||r==="#/")&&i===l.baseId)return d();let u=A1.resolveRef.call(c,l,i,r);if(u===void 0)throw new WX.default(n.opts.uriResolver,i,r);if(u instanceof A1.SchemaEnv)return f(u);return p(u);function d(){if(s===l)return xm(t,o,s,s.$async);let m=e.scopeValue("root",{ref:l});return xm(t,(0,Xr._)`${m}.validate`,l,l.$async)}function f(m){let h=I1(t,m);xm(t,h,m,m.$async)}function p(m){let h=e.scopeValue("schema",a.code.source===!0?{ref:m,code:(0,Xr.stringify)(m)}:{ref:m}),T=e.name("valid"),_=t.subschema({schema:m,dataTypes:[],schemaPath:Xr.nil,topSchemaRef:h,errSchemaPath:r},T);t.mergeEvaluated(_),t.ok(T)}}};function I1(t,e){let{gen:r}=t;return e.validate?r.scopeValue("validate",{ref:e.validate}):(0,Xr._)`${r.scopeValue("wrapper",{ref:e})}.validate`}So.getValidate=I1;function xm(t,e,r,n){let{gen:i,it:s}=t,{allErrors:o,schemaEnv:a,opts:c}=s,l=c.passContext?oc.default.this:Xr.nil;n?u():d();function u(){if(!a.$async)throw new Error("async schema referenced by sync schema");let m=i.let("valid");i.try(()=>{i.code((0,Xr._)`await ${(0,D1.callValidateCode)(t,e,l)}`),p(e),o||i.assign(m,!0)},h=>{i.if((0,Xr._)`!(${h} instanceof ${s.ValidationError})`,()=>i.throw(h)),f(h),o||i.assign(m,!1)}),t.ok(m)}function d(){t.result((0,D1.callValidateCode)(t,e,l),()=>p(e),()=>f(e))}function f(m){let h=(0,Xr._)`${m}.errors`;i.assign(oc.default.vErrors,(0,Xr._)`${oc.default.vErrors} === null ? ${h} : ${oc.default.vErrors}.concat(${h})`),i.assign(oc.default.errors,(0,Xr._)`${oc.default.vErrors}.length`)}function p(m){var h;if(!s.opts.unevaluated)return;let T=(h=r?.validate)===null||h===void 0?void 0:h.evaluated;if(s.props!==!0)if(T&&!T.dynamicProps)T.props!==void 0&&(s.props=Om.mergeEvaluated.props(i,T.props,s.props));else{let _=i.var("props",(0,Xr._)`${m}.evaluated.props`);s.props=Om.mergeEvaluated.props(i,_,s.props,Xr.Name)}if(s.items!==!0)if(T&&!T.dynamicItems)T.items!==void 0&&(s.items=Om.mergeEvaluated.items(i,T.items,s.items));else{let _=i.var("items",(0,Xr._)`${m}.evaluated.items`);s.items=Om.mergeEvaluated.items(i,_,s.items,Xr.Name)}}}So.callRef=xm;So.default=GX});var O1=R(FS=>{"use strict";Object.defineProperty(FS,"__esModule",{value:!0});var KX=C1(),YX=Mm(),XX=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",KX.default,YX.default];FS.default=XX});var x1=R(BS=>{"use strict";Object.defineProperty(BS,"__esModule",{value:!0});var Lm=ve(),xs=Lm.operators,qm={maximum:{okStr:"<=",ok:xs.LTE,fail:xs.GT},minimum:{okStr:">=",ok:xs.GTE,fail:xs.LT},exclusiveMaximum:{okStr:"<",ok:xs.LT,fail:xs.GTE},exclusiveMinimum:{okStr:">",ok:xs.GT,fail:xs.LTE}},JX={message:({keyword:t,schemaCode:e})=>(0,Lm.str)`must be ${qm[t].okStr} ${e}`,params:({keyword:t,schemaCode:e})=>(0,Lm._)`{comparison: ${qm[t].okStr}, limit: ${e}}`},QX={keyword:Object.keys(qm),type:"number",schemaType:"number",$data:!0,error:JX,code(t){let{keyword:e,data:r,schemaCode:n}=t;t.fail$data((0,Lm._)`${r} ${qm[e].fail} ${n} || isNaN(${r})`)}};BS.default=QX});var M1=R(jS=>{"use strict";Object.defineProperty(jS,"__esModule",{value:!0});var Pu=ve(),ZX={message:({schemaCode:t})=>(0,Pu.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,Pu._)`{multipleOf: ${t}}`},e4={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ZX,code(t){let{gen:e,data:r,schemaCode:n,it:i}=t,s=i.opts.multipleOfPrecision,o=e.let("res"),a=s?(0,Pu._)`Math.abs(Math.round(${o}) - ${o}) > 1e-${s}`:(0,Pu._)`${o} !== parseInt(${o})`;t.fail$data((0,Pu._)`(${n} === 0 || (${o} = ${r}/${n}, ${a}))`)}};jS.default=e4});var q1=R(US=>{"use strict";Object.defineProperty(US,"__esModule",{value:!0});function L1(t){let e=t.length,r=0,n=0,i;for(;n<e;)r++,i=t.charCodeAt(n++),i>=55296&&i<=56319&&n<e&&(i=t.charCodeAt(n),(i&64512)===56320&&n++);return r}US.default=L1;L1.code='require("ajv/dist/runtime/ucs2length").default'});var $1=R(HS=>{"use strict";Object.defineProperty(HS,"__esModule",{value:!0});var _o=ve(),t4=we(),r4=q1(),n4={message({keyword:t,schemaCode:e}){let r=t==="maxLength"?"more":"fewer";return(0,_o.str)`must NOT have ${r} than ${e} characters`},params:({schemaCode:t})=>(0,_o._)`{limit: ${t}}`},i4={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n4,code(t){let{keyword:e,data:r,schemaCode:n,it:i}=t,s=e==="maxLength"?_o.operators.GT:_o.operators.LT,o=i.opts.unicode===!1?(0,_o._)`${r}.length`:(0,_o._)`${(0,t4.useFunc)(t.gen,r4.default)}(${r})`;t.fail$data((0,_o._)`${o} ${s} ${n}`)}};HS.default=i4});var F1=R(VS=>{"use strict";Object.defineProperty(VS,"__esModule",{value:!0});var s4=Dn(),$m=ve(),o4={message:({schemaCode:t})=>(0,$m.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,$m._)`{pattern: ${t}}`},a4={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:o4,code(t){let{data:e,$data:r,schema:n,schemaCode:i,it:s}=t,o=s.opts.unicodeRegExp?"u":"",a=r?(0,$m._)`(new RegExp(${i}, ${o}))`:(0,s4.usePattern)(t,n);t.fail$data((0,$m._)`!${a}.test(${e})`)}};VS.default=a4});var B1=R(zS=>{"use strict";Object.defineProperty(zS,"__esModule",{value:!0});var Eu=ve(),c4={message({keyword:t,schemaCode:e}){let r=t==="maxProperties"?"more":"fewer";return(0,Eu.str)`must NOT have ${r} than ${e} properties`},params:({schemaCode:t})=>(0,Eu._)`{limit: ${t}}`},l4={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:c4,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxProperties"?Eu.operators.GT:Eu.operators.LT;t.fail$data((0,Eu._)`Object.keys(${r}).length ${i} ${n}`)}};zS.default=l4});var j1=R(WS=>{"use strict";Object.defineProperty(WS,"__esModule",{value:!0});var wu=Dn(),Cu=ve(),u4=we(),d4={message:({params:{missingProperty:t}})=>(0,Cu.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,Cu._)`{missingProperty: ${t}}`},f4={keyword:"required",type:"object",schemaType:"array",$data:!0,error:d4,code(t){let{gen:e,schema:r,schemaCode:n,data:i,$data:s,it:o}=t,{opts:a}=o;if(!s&&r.length===0)return;let c=r.length>=a.loopRequired;if(o.allErrors?l():u(),a.strictRequired){let p=t.parentSchema.properties,{definedProperties:m}=t.it;for(let h of r)if(p?.[h]===void 0&&!m.has(h)){let T=o.schemaEnv.baseId+o.errSchemaPath,_=`required property "${h}" is not defined at "${T}" (strictRequired)`;(0,u4.checkStrictMode)(o,_,o.opts.strictRequired)}}function l(){if(c||s)t.block$data(Cu.nil,d);else for(let p of r)(0,wu.checkReportMissingProp)(t,p)}function u(){let p=e.let("missing");if(c||s){let m=e.let("valid",!0);t.block$data(m,()=>f(p,m)),t.ok(m)}else e.if((0,wu.checkMissingProp)(t,r,p)),(0,wu.reportMissingProp)(t,p),e.else()}function d(){e.forOf("prop",n,p=>{t.setParams({missingProperty:p}),e.if((0,wu.noPropertyInData)(e,i,p,a.ownProperties),()=>t.error())})}function f(p,m){t.setParams({missingProperty:p}),e.forOf(p,n,()=>{e.assign(m,(0,wu.propertyInData)(e,i,p,a.ownProperties)),e.if((0,Cu.not)(m),()=>{t.error(),e.break()})},Cu.nil)}}};WS.default=f4});var U1=R(GS=>{"use strict";Object.defineProperty(GS,"__esModule",{value:!0});var Du=ve(),p4={message({keyword:t,schemaCode:e}){let r=t==="maxItems"?"more":"fewer";return(0,Du.str)`must NOT have ${r} than ${e} items`},params:({schemaCode:t})=>(0,Du._)`{limit: ${t}}`},h4={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:p4,code(t){let{keyword:e,data:r,schemaCode:n}=t,i=e==="maxItems"?Du.operators.GT:Du.operators.LT;t.fail$data((0,Du._)`${r}.length ${i} ${n}`)}};GS.default=h4});var Fm=R(KS=>{"use strict";Object.defineProperty(KS,"__esModule",{value:!0});var H1=vS();H1.code='require("ajv/dist/runtime/equal").default';KS.default=H1});var V1=R(XS=>{"use strict";Object.defineProperty(XS,"__esModule",{value:!0});var YS=mu(),cr=ve(),m4=we(),g4=Fm(),y4={message:({params:{i:t,j:e}})=>(0,cr.str)`must NOT have duplicate items (items ## ${e} and ${t} are identical)`,params:({params:{i:t,j:e}})=>(0,cr._)`{i: ${t}, j: ${e}}`},T4={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:y4,code(t){let{gen:e,data:r,$data:n,schema:i,parentSchema:s,schemaCode:o,it:a}=t;if(!n&&!i)return;let c=e.let("valid"),l=s.items?(0,YS.getSchemaTypes)(s.items):[];t.block$data(c,u,(0,cr._)`${o} === false`),t.ok(c);function u(){let m=e.let("i",(0,cr._)`${r}.length`),h=e.let("j");t.setParams({i:m,j:h}),e.assign(c,!0),e.if((0,cr._)`${m} > 1`,()=>(d()?f:p)(m,h))}function d(){return l.length>0&&!l.some(m=>m==="object"||m==="array")}function f(m,h){let T=e.name("item"),_=(0,YS.checkDataTypes)(l,T,a.opts.strictNumbers,YS.DataType.Wrong),b=e.const("indices",(0,cr._)`{}`);e.for((0,cr._)`;${m}--;`,()=>{e.let(T,(0,cr._)`${r}[${m}]`),e.if(_,(0,cr._)`continue`),l.length>1&&e.if((0,cr._)`typeof ${T} == "string"`,(0,cr._)`${T} += "_"`),e.if((0,cr._)`typeof ${b}[${T}] == "number"`,()=>{e.assign(h,(0,cr._)`${b}[${T}]`),t.error(),e.assign(c,!1).break()}).code((0,cr._)`${b}[${T}] = ${m}`)})}function p(m,h){let T=(0,m4.useFunc)(e,g4.default),_=e.name("outer");e.label(_).for((0,cr._)`;${m}--;`,()=>e.for((0,cr._)`${h} = ${m}; ${h}--;`,()=>e.if((0,cr._)`${T}(${r}[${m}], ${r}[${h}])`,()=>{t.error(),e.assign(c,!1).break(_)})))}}};XS.default=T4});var z1=R(QS=>{"use strict";Object.defineProperty(QS,"__esModule",{value:!0});var JS=ve(),v4=we(),b4=Fm(),S4={message:"must be equal to constant",params:({schemaCode:t})=>(0,JS._)`{allowedValue: ${t}}`},_4={keyword:"const",$data:!0,error:S4,code(t){let{gen:e,data:r,$data:n,schemaCode:i,schema:s}=t;n||s&&typeof s=="object"?t.fail$data((0,JS._)`!${(0,v4.useFunc)(e,b4.default)}(${r}, ${i})`):t.fail((0,JS._)`${s} !== ${r}`)}};QS.default=_4});var W1=R(ZS=>{"use strict";Object.defineProperty(ZS,"__esModule",{value:!0});var Au=ve(),k4=we(),N4=Fm(),R4={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,Au._)`{allowedValues: ${t}}`},P4={keyword:"enum",schemaType:"array",$data:!0,error:R4,code(t){let{gen:e,data:r,$data:n,schema:i,schemaCode:s,it:o}=t;if(!n&&i.length===0)throw new Error("enum must have non-empty array");let a=i.length>=o.opts.loopEnum,c,l=()=>c??(c=(0,k4.useFunc)(e,N4.default)),u;if(a||n)u=e.let("valid"),t.block$data(u,d);else{if(!Array.isArray(i))throw new Error("ajv implementation error");let p=e.const("vSchema",s);u=(0,Au.or)(...i.map((m,h)=>f(p,h)))}t.pass(u);function d(){e.assign(u,!1),e.forOf("v",s,p=>e.if((0,Au._)`${l()}(${r}, ${p})`,()=>e.assign(u,!0).break()))}function f(p,m){let h=i[m];return typeof h=="object"&&h!==null?(0,Au._)`${l()}(${r}, ${p}[${m}])`:(0,Au._)`${r} === ${h}`}}};ZS.default=P4});var G1=R(e_=>{"use strict";Object.defineProperty(e_,"__esModule",{value:!0});var E4=x1(),w4=M1(),C4=$1(),D4=F1(),A4=B1(),I4=j1(),O4=U1(),x4=V1(),M4=z1(),L4=W1(),q4=[E4.default,w4.default,C4.default,D4.default,A4.default,I4.default,O4.default,x4.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},M4.default,L4.default];e_.default=q4});var r_=R(Iu=>{"use strict";Object.defineProperty(Iu,"__esModule",{value:!0});Iu.validateAdditionalItems=void 0;var ko=ve(),t_=we(),$4={message:({params:{len:t}})=>(0,ko.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,ko._)`{limit: ${t}}`},F4={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:$4,code(t){let{parentSchema:e,it:r}=t,{items:n}=e;if(!Array.isArray(n)){(0,t_.checkStrictMode)(r,'"additionalItems" is ignored when "items" is not an array of schemas');return}K1(t,n)}};function K1(t,e){let{gen:r,schema:n,data:i,keyword:s,it:o}=t;o.items=!0;let a=r.const("len",(0,ko._)`${i}.length`);if(n===!1)t.setParams({len:e.length}),t.pass((0,ko._)`${a} <= ${e.length}`);else if(typeof n=="object"&&!(0,t_.alwaysValidSchema)(o,n)){let l=r.var("valid",(0,ko._)`${a} <= ${e.length}`);r.if((0,ko.not)(l),()=>c(l)),t.ok(l)}function c(l){r.forRange("i",e.length,a,u=>{t.subschema({keyword:s,dataProp:u,dataPropType:t_.Type.Num},l),o.allErrors||r.if((0,ko.not)(l),()=>r.break())})}}Iu.validateAdditionalItems=K1;Iu.default=F4});var n_=R(Ou=>{"use strict";Object.defineProperty(Ou,"__esModule",{value:!0});Ou.validateTuple=void 0;var Y1=ve(),Bm=we(),B4=Dn(),j4={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){let{schema:e,it:r}=t;if(Array.isArray(e))return X1(t,"additionalItems",e);r.items=!0,!(0,Bm.alwaysValidSchema)(r,e)&&t.ok((0,B4.validateArray)(t))}};function X1(t,e,r=t.schema){let{gen:n,parentSchema:i,data:s,keyword:o,it:a}=t;u(i),a.opts.unevaluated&&r.length&&a.items!==!0&&(a.items=Bm.mergeEvaluated.items(n,r.length,a.items));let c=n.name("valid"),l=n.const("len",(0,Y1._)`${s}.length`);r.forEach((d,f)=>{(0,Bm.alwaysValidSchema)(a,d)||(n.if((0,Y1._)`${l} > ${f}`,()=>t.subschema({keyword:o,schemaProp:f,dataProp:f},c)),t.ok(c))});function u(d){let{opts:f,errSchemaPath:p}=a,m=r.length,h=m===d.minItems&&(m===d.maxItems||d[e]===!1);if(f.strictTuples&&!h){let T=`"${o}" is ${m}-tuple, but minItems or maxItems/${e} are not specified or different at path "${p}"`;(0,Bm.checkStrictMode)(a,T,f.strictTuples)}}}Ou.validateTuple=X1;Ou.default=j4});var J1=R(i_=>{"use strict";Object.defineProperty(i_,"__esModule",{value:!0});var U4=n_(),H4={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,U4.validateTuple)(t,"items")};i_.default=H4});var Z1=R(s_=>{"use strict";Object.defineProperty(s_,"__esModule",{value:!0});var Q1=ve(),V4=we(),z4=Dn(),W4=r_(),G4={message:({params:{len:t}})=>(0,Q1.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,Q1._)`{limit: ${t}}`},K4={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:G4,code(t){let{schema:e,parentSchema:r,it:n}=t,{prefixItems:i}=r;n.items=!0,!(0,V4.alwaysValidSchema)(n,e)&&(i?(0,W4.validateAdditionalItems)(t,i):t.ok((0,z4.validateArray)(t)))}};s_.default=K4});var e$=R(o_=>{"use strict";Object.defineProperty(o_,"__esModule",{value:!0});var In=ve(),jm=we(),Y4={message:({params:{min:t,max:e}})=>e===void 0?(0,In.str)`must contain at least ${t} valid item(s)`:(0,In.str)`must contain at least ${t} and no more than ${e} valid item(s)`,params:({params:{min:t,max:e}})=>e===void 0?(0,In._)`{minContains: ${t}}`:(0,In._)`{minContains: ${t}, maxContains: ${e}}`},X4={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:Y4,code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t,o,a,{minContains:c,maxContains:l}=n;s.opts.next?(o=c===void 0?1:c,a=l):o=1;let u=e.const("len",(0,In._)`${i}.length`);if(t.setParams({min:o,max:a}),a===void 0&&o===0){(0,jm.checkStrictMode)(s,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(a!==void 0&&o>a){(0,jm.checkStrictMode)(s,'"minContains" > "maxContains" is always invalid'),t.fail();return}if((0,jm.alwaysValidSchema)(s,r)){let h=(0,In._)`${u} >= ${o}`;a!==void 0&&(h=(0,In._)`${h} && ${u} <= ${a}`),t.pass(h);return}s.items=!0;let d=e.name("valid");a===void 0&&o===1?p(d,()=>e.if(d,()=>e.break())):o===0?(e.let(d,!0),a!==void 0&&e.if((0,In._)`${i}.length > 0`,f)):(e.let(d,!1),f()),t.result(d,()=>t.reset());function f(){let h=e.name("_valid"),T=e.let("count",0);p(h,()=>e.if(h,()=>m(T)))}function p(h,T){e.forRange("i",0,u,_=>{t.subschema({keyword:"contains",dataProp:_,dataPropType:jm.Type.Num,compositeRule:!0},h),T()})}function m(h){e.code((0,In._)`${h}++`),a===void 0?e.if((0,In._)`${h} >= ${o}`,()=>e.assign(d,!0).break()):(e.if((0,In._)`${h} > ${a}`,()=>e.assign(d,!1).break()),o===1?e.assign(d,!0):e.if((0,In._)`${h} >= ${o}`,()=>e.assign(d,!0)))}}};o_.default=X4});var Um=R(ki=>{"use strict";Object.defineProperty(ki,"__esModule",{value:!0});ki.validateSchemaDeps=ki.validatePropertyDeps=ki.error=void 0;var a_=ve(),J4=we(),xu=Dn();ki.error={message:({params:{property:t,depsCount:e,deps:r}})=>{let n=e===1?"property":"properties";return(0,a_.str)`must have ${n} ${r} when property ${t} is present`},params:({params:{property:t,depsCount:e,deps:r,missingProperty:n}})=>(0,a_._)`{property: ${t},
|
|
180
180
|
missingProperty: ${n},
|
|
181
181
|
depsCount: ${e},
|
|
182
|
-
deps: ${r}}`};var Q4={keyword:"dependencies",type:"object",schemaType:"object",error:ki.error,code(t){let[e,r]=Z4(t);t$(t,e),r$(t,r)}};function Z4({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function t$(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,xu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,xu.checkReportMissingProp)(t,l)}):(r.if((0,a_._)`${c} && (${(0,xu.checkMissingProp)(t,a,s)})`),(0,xu.reportMissingProp)(t,s),r.else())}}ki.validatePropertyDeps=t$;function r$(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,J4.alwaysValidSchema)(s,e[a])||(r.if((0,xu.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}ki.validateSchemaDeps=r$;ki.default=Q4});var i$=R(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var n$=ve(),e9=we(),t9={message:"property name must be valid",params:({params:t})=>(0,n$._)`{propertyName: ${t.propertyName}}`},r9={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:t9,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,e9.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,n$.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};c_.default=r9});var u_=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var Hm=Cn(),ri=ve(),n9=wn(),Vm=we(),i9={message:"must NOT have additional properties",params:({params:t})=>(0,ri._)`{additionalProperty: ${t.additionalProperty}}`},s9={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:i9,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,Vm.alwaysValidSchema)(o,r))return;let l=(0,Hm.allSchemaProperties)(n.properties),u=(0,Hm.allSchemaProperties)(n.patternProperties);d(),t.ok((0,ri._)`${s} === ${n9.default.errors}`);function d(){e.forIn("key",i,T=>{!l.length&&!u.length?m(T):e.if(f(T),()=>m(T))})}function f(T){let _;if(l.length>8){let b=(0,Vm.schemaRefOrVal)(o,n.properties,"properties");_=(0,Hm.isOwnProperty)(e,b,T)}else l.length?_=(0,ri.or)(...l.map(b=>(0,ri._)`${T} === ${b}`)):_=ri.nil;return u.length&&(_=(0,ri.or)(_,...u.map(b=>(0,ri._)`${(0,Hm.usePattern)(t,b)}.test(${T})`))),(0,ri.not)(_)}function p(T){e.code((0,ri._)`delete ${i}[${T}]`)}function m(T){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(T);return}if(r===!1){t.setParams({additionalProperty:T}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Vm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(h(T,_,!1),e.if((0,ri.not)(_),()=>{t.reset(),p(T)})):(h(T,_),a||e.if((0,ri.not)(_),()=>e.break()))}}function h(T,_,b){let v={keyword:"additionalProperties",dataProp:T,dataPropType:Vm.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,_)}}};l_.default=s9});var a$=R(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var o9=vu(),s$=Cn(),d_=we(),o$=u_(),a9={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&o$.default.code(new o9.KeywordCxt(s,o$.default,"additionalProperties"));let o=(0,s$.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=d_.mergeEvaluated.props(e,(0,d_.toHash)(o),s.props));let a=o.filter(d=>!(0,d_.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,s$.propertyInData)(e,i,d,s.opts.ownProperties)),u(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};f_.default=a9});var d$=R(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var c$=Cn(),zm=ve(),l$=we(),u$=we(),c9={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,c$.allSchemaProperties)(r),c=a.filter(h=>(0,l$.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");s.props!==!0&&!(s.props instanceof zm.Name)&&(s.props=(0,u$.evaluatedPropsToName)(e,s.props));let{props:d}=s;f();function f(){for(let h of a)l&&p(h),s.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let T in l)new RegExp(h).test(T)&&(0,l$.checkStrictMode)(s,`property ${T} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,T=>{e.if((0,zm._)`${(0,c$.usePattern)(t,h)}.test(${T})`,()=>{let _=c.includes(h);_||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:T,dataPropType:u$.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,zm._)`${d}[${T}]`,!0):!_&&!s.allErrors&&e.if((0,zm.not)(u),()=>e.break())})})}}};p_.default=c9});var f$=R(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var l9=we(),u9={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,l9.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};h_.default=u9});var p$=R(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var d9=Cn(),f9={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:d9.validateUnion,error:{message:"must match a schema in anyOf"}};m_.default=f9});var h$=R(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var Wm=ve(),p9=we(),h9={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Wm._)`{passingSchemas: ${t.passing}}`},m9={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:h9,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(o,()=>t.reset(),()=>t.error(!0));function l(){s.forEach((u,d)=>{let f;(0,p9.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Wm._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Wm._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Wm.Name)})})}}};g_.default=m9});var m$=R(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var g9=we(),y9={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,g9.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};y_.default=y9});var T$=R(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var Gm=ve(),y$=we(),T9={message:({params:t})=>(0,Gm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Gm._)`{failingKeyword: ${t.ifClause}}`},v9={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:T9,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,y$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=g$(n,"then"),s=g$(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,Gm.not)(a),l("else"));t.pass(o,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(o,a),t.mergeValidEvaluated(f,o),d?e.assign(d,(0,Gm._)`${u}`):t.setParams({ifClause:u})}}}};function g$(t,e){let r=t.schema[e];return r!==void 0&&!(0,y$.alwaysValidSchema)(t,r)}T_.default=v9});var v$=R(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var b9=we(),S9={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,b9.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};v_.default=S9});var b$=R(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var _9=r_(),k9=J1(),N9=n_(),R9=Z1(),P9=e$(),E9=Um(),w9=i$(),C9=u_(),D9=a$(),A9=d$(),I9=f$(),O9=p$(),x9=h$(),M9=m$(),L9=T$(),q9=v$();function $9(t=!1){let e=[I9.default,O9.default,x9.default,M9.default,L9.default,q9.default,w9.default,C9.default,E9.default,D9.default,A9.default];return t?e.push(k9.default,R9.default):e.push(_9.default,N9.default),e.push(P9.default),e}b_.default=$9});var S$=R(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var Lt=ve(),F9={message:({schemaCode:t})=>(0,Lt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Lt._)`{format: ${t}}`},B9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:F9,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Lt._)`${m}[${o}]`),T=r.let("fType"),_=r.let("format");r.if((0,Lt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(T,(0,Lt._)`${h}.type || "string"`).assign(_,(0,Lt._)`${h}.validate`),()=>r.assign(T,(0,Lt._)`"string"`).assign(_,h)),t.fail$data((0,Lt.or)(b(),v()));function b(){return c.strictSchema===!1?Lt.nil:(0,Lt._)`${o} && !${_}`}function v(){let k=u.$async?(0,Lt._)`(${h}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Lt._)`${_}(${n})`,w=(0,Lt._)`(typeof ${_} == "function" ? ${k} : ${_}.test(${n}))`;return(0,Lt._)`${_} && ${_} !== true && ${T} === ${e} && !${w}`}}function p(){let m=d.formats[s];if(!m){b();return}if(m===!0)return;let[h,T,_]=v(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(w){let H=w instanceof RegExp?(0,Lt.regexpCode)(w):c.code.formats?(0,Lt._)`${c.code.formats}${(0,Lt.getProperty)(s)}`:void 0,O=r.scopeValue("formats",{key:s,ref:w,code:H});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,Lt._)`${O}.validate`]:["string",w,O]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Lt._)`await ${_}(${n})`}return typeof T=="function"?(0,Lt._)`${_}(${n})`:(0,Lt._)`${_}.test(${n})`}}}};S_.default=B9});var _$=R(__=>{"use strict";Object.defineProperty(__,"__esModule",{value:!0});var j9=S$(),U9=[j9.default];__.default=U9});var k$=R(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.contentVocabulary=ac.metadataVocabulary=void 0;ac.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ac.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var R$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var H9=O1(),V9=G1(),z9=b$(),W9=_$(),N$=k$(),G9=[H9.default,V9.default,(0,z9.default)(),W9.default,N$.metadataVocabulary,N$.contentVocabulary];k_.default=G9});var R_=R(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.dynamicAnchor=void 0;var N_=ve(),K9=wn(),P$=Su(),Y9=Mm(),X9={keyword:"$dynamicAnchor",schemaType:"string",code:t=>E$(t,t.schema)};function E$(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,N_._)`${K9.default.dynamicAnchors}${(0,N_.getProperty)(e)}`,s=n.errSchemaPath==="#"?n.validateName:J9(t);r.if((0,N_._)`!${i}`,()=>r.assign(i,s))}Mu.dynamicAnchor=E$;function J9(t){let{schemaEnv:e,schema:r,self:n}=t.it,{root:i,baseId:s,localRefs:o,meta:a}=e.root,{schemaId:c}=n.opts,l=new P$.SchemaEnv({schema:r,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return P$.compileSchema.call(n,l),(0,Y9.getValidate)(t,l)}Mu.default=X9});var P_=R(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.dynamicRef=void 0;var w$=ve(),Q9=wn(),C$=Mm(),Z9={keyword:"$dynamicRef",schemaType:"string",code:t=>D$(t,t.schema)};function D$(t,e){let{gen:r,keyword:n,it:i}=t;if(e[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let s=e.slice(1);if(i.allErrors)o();else{let c=r.let("valid",!1);o(c),t.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[s]){let l=r.let("_v",(0,w$._)`${Q9.default.dynamicAnchors}${(0,w$.getProperty)(s)}`);r.if(l,a(l,c),a(i.validateName,c))}else a(i.validateName,c)()}function a(c,l){return l?()=>r.block(()=>{(0,C$.callRef)(t,c),r.let(l,!0)}):()=>(0,C$.callRef)(t,c)}}Lu.dynamicRef=D$;Lu.default=Z9});var A$=R(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var eJ=R_(),tJ=we(),rJ={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,eJ.dynamicAnchor)(t,""):(0,tJ.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};E_.default=rJ});var I$=R(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var nJ=P_(),iJ={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,nJ.dynamicRef)(t,t.schema)};w_.default=iJ});var O$=R(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var sJ=R_(),oJ=P_(),aJ=A$(),cJ=I$(),lJ=[sJ.default,oJ.default,aJ.default,cJ.default];C_.default=lJ});var M$=R(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var x$=Um(),uJ={keyword:"dependentRequired",type:"object",schemaType:"object",error:x$.error,code:t=>(0,x$.validatePropertyDeps)(t)};D_.default=uJ});var L$=R(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var dJ=Um(),fJ={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,dJ.validateSchemaDeps)(t)};A_.default=fJ});var q$=R(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});var pJ=we(),hJ={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,pJ.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};I_.default=hJ});var $$=R(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var mJ=M$(),gJ=L$(),yJ=q$(),TJ=[mJ.default,gJ.default,yJ.default];O_.default=TJ});var B$=R(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var Ms=ve(),F$=we(),vJ=wn(),bJ={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Ms._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},SJ={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:bJ,code(t){let{gen:e,schema:r,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:a}=s;a instanceof Ms.Name?e.if((0,Ms._)`${a} !== true`,()=>e.forIn("key",n,d=>e.if(l(a,d),()=>c(d)))):a!==!0&&e.forIn("key",n,d=>a===void 0?c(d):e.if(u(a,d),()=>c(d))),s.props=!0,t.ok((0,Ms._)`${i} === ${vJ.default.errors}`);function c(d){if(r===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,F$.alwaysValidSchema)(s,r)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:F$.Type.Str},f),o||e.if((0,Ms.not)(f),()=>e.break())}}function l(d,f){return(0,Ms._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Ms._)`${f} !== ${m}`);return(0,Ms.and)(...p)}}};x_.default=SJ});var U$=R(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var No=ve(),j$=we(),_J={message:({params:{len:t}})=>(0,No.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,No._)`{limit: ${t}}`},kJ={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:_J,code(t){let{gen:e,schema:r,data:n,it:i}=t,s=i.items||0;if(s===!0)return;let o=e.const("len",(0,No._)`${n}.length`);if(r===!1)t.setParams({len:s}),t.fail((0,No._)`${o} > ${s}`);else if(typeof r=="object"&&!(0,j$.alwaysValidSchema)(i,r)){let c=e.var("valid",(0,No._)`${o} <= ${s}`);e.if((0,No.not)(c),()=>a(c,s)),t.ok(c)}i.items=!0;function a(c,l){e.forRange("i",l,o,u=>{t.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:j$.Type.Num},c),i.allErrors||e.if((0,No.not)(c),()=>e.break())})}}};M_.default=kJ});var H$=R(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var NJ=B$(),RJ=U$(),PJ=[NJ.default,RJ.default];L_.default=PJ});var z$=R(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.DiscrError=void 0;var V$;(function(t){t.Tag="tag",t.Mapping="mapping"})(V$||(Km.DiscrError=V$={}))});var G$=R($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var cc=ve(),q_=z$(),W$=Su(),EJ=bu(),wJ=we(),CJ={message:({params:{discrError:t,tagName:e}})=>t===q_.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,cc._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},DJ={keyword:"discriminator",type:"object",schemaType:"object",error:CJ,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,cc._)`${r}${(0,cc.getProperty)(a)}`);e.if((0,cc._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:q_.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,cc._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:q_.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,cc.Name),m}function f(){var p;let m={},h=_(i),T=!0;for(let k=0;k<o.length;k++){let w=o[k];if(w?.$ref&&!(0,wJ.schemaHasRulesButRef)(w,s.self.RULES)){let O=w.$ref;if(w=W$.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,O),w instanceof W$.SchemaEnv&&(w=w.schema),w===void 0)throw new EJ.default(s.opts.uriResolver,s.baseId,O)}let H=(p=w?.properties)===null||p===void 0?void 0:p[a];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);T=T&&(h||_(w)),b(H,k)}if(!T)throw new Error(`discriminator: "${a}" must be required`);return m;function _({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,w){if(k.const)v(k.const,w);else if(k.enum)for(let H of k.enum)v(H,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(k,w){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=w}}}};$_.default=DJ});var K$=R((pwe,AJ)=>{AJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}});var Y$=R((hwe,IJ)=>{IJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}});var X$=R((mwe,OJ)=>{OJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}});var J$=R((gwe,xJ)=>{xJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}});var Q$=R((ywe,MJ)=>{MJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}});var Z$=R((Twe,LJ)=>{LJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var eF=R((vwe,qJ)=>{qJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var tF=R(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var $J=K$(),FJ=Y$(),BJ=X$(),jJ=J$(),UJ=Q$(),HJ=Z$(),VJ=eF(),zJ=["/properties"];function WJ(t){return[$J,FJ,BJ,jJ,e(this,UJ),HJ,e(this,VJ)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,zJ):n}}F_.default=WJ});var rF=R((bt,j_)=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.MissingRefError=bt.ValidationError=bt.CodeGen=bt.Name=bt.nil=bt.stringify=bt.str=bt._=bt.KeywordCxt=bt.Ajv2019=void 0;var GJ=w1(),KJ=R$(),YJ=O$(),XJ=$$(),JJ=H$(),QJ=G$(),ZJ=tF(),B_="https://json-schema.org/draft/2019-09/schema",lc=class extends GJ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(YJ.default),KJ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(XJ.default),this.addVocabulary(JJ.default),this.opts.discriminator&&this.addKeyword(QJ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(ZJ.default.call(this,e),this.refs["http://json-schema.org/schema"]=B_)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(B_)?B_:void 0)}};bt.Ajv2019=lc;j_.exports=bt=lc;j_.exports.Ajv2019=lc;Object.defineProperty(bt,"__esModule",{value:!0});bt.default=lc;var e6=vu();Object.defineProperty(bt,"KeywordCxt",{enumerable:!0,get:function(){return e6.KeywordCxt}});var uc=ve();Object.defineProperty(bt,"_",{enumerable:!0,get:function(){return uc._}});Object.defineProperty(bt,"str",{enumerable:!0,get:function(){return uc.str}});Object.defineProperty(bt,"stringify",{enumerable:!0,get:function(){return uc.stringify}});Object.defineProperty(bt,"nil",{enumerable:!0,get:function(){return uc.nil}});Object.defineProperty(bt,"Name",{enumerable:!0,get:function(){return uc.Name}});Object.defineProperty(bt,"CodeGen",{enumerable:!0,get:function(){return uc.CodeGen}});var t6=Em();Object.defineProperty(bt,"ValidationError",{enumerable:!0,get:function(){return t6.default}});var r6=bu();Object.defineProperty(bt,"MissingRefError",{enumerable:!0,get:function(){return r6.default}})});var pc=require("path"),Ke=q(qE());var Pf=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=FE(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),l=this._lineOffsets,u=$E(n.text,!1,s);if(c-a===u.length)for(let f=0,p=u.length;f<p;f++)l[f+a+1]=u[f];else u.length<1e4?l.splice(a+1,c-a,...u):this._lineOffsets=l=l.slice(0,a+1).concat(u,l.slice(c+1));let d=n.text.length-(o-s);if(d!==0)for(let f=a+1+u.length,p=l.length;f<p;f++)l[f]=l[f]+d}else if(t.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=$E(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let o=Math.floor((n+i)/2);r[o]>e?i=o:n=o+1}let s=n-1;return{line:s,character:e-r[s]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},$r;(function(t){function e(i,s,o,a){return new Pf(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof Pf)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,s){let o=i.getText(),a=nT(s.map(mU),(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=0,l=[];for(let u of a){let d=i.offsetAt(u.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&l.push(o.substring(c,d)),u.newText.length&&l.push(u.newText),c=i.offsetAt(u.range.end)}return l.push(o.substr(c)),l.join("")}t.applyEdits=n})($r||($r={}));function nT(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);nT(n,e),nT(i,e);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;)e(n[s],i[o])<=0?t[a++]=n[s++]:t[a++]=i[o++];for(;s<n.length;)t[a++]=n[s++];for(;o<i.length;)t[a++]=i[o++];return t}function $E(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function FE(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function mU(t){let e=FE(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Ef=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],wf=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var oT=q(require("url")),KE=require("crypto"),na=require("path"),rr=q(j());var iT=q(j());var Fr=q(j());var Q=class{constructor(e){this._children=[];this.syntaxIssues=[];this.resettableIssues=[];this._firstToken=e?.start,this._lastToken=e?.end}get issues(){return[...this.syntaxIssues,...this.resettableIssues]}resetIssues(){this.resettableIssues=[],this.children.forEach(e=>e.resetIssues())}get serializeIssues(){return this.issues.map(e=>e())}get firstToken(){return this._firstToken??this._children[0].firstToken}set firstToken(e){this._firstToken=e}get lastToken(){return this._lastToken??this._children[this._children.length-1]?.lastToken??this.firstToken}set lastToken(e){this._lastToken=e}get uri(){return this.firstToken.uri}getTopMostAstNodeForFile(e){return pe(e,this.uri)?[this]:this.children.flatMap(r=>r.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(n=>n.getDocumentSymbols(e)??[]);if(!pe(this.uri,e))return[];let r=fe(this);return[{name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind,range:r,selectionRange:r,children:[...this.children.flatMap(n=>n.getDocumentSymbols(e)??[])]}]}getWorkspaceSymbols(){if(!this.docSymbolsMeta)return this.children.flatMap(i=>i.getWorkspaceSymbols()??[]);let e=this.docSymbolsMeta.kind;if(![Fr.SymbolKind.File,Fr.SymbolKind.Class,Fr.SymbolKind.Constant].some(i=>i===e))return[];let r=Br(this.uri),n=r?.range??fe(this);return[{location:Fr.Location.create(ue(r?.docUri??this.uri),n),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Fr.SymbolKind.File||i.kind===Fr.SymbolKind.Class||i.kind===Fr.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(r=>r.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Di(this.semanticTokenType),Ai(this.semanticTokenModifiers),this.firstToken,this.lastToken)}get children(){return this._children}get allDescendants(){return this.allDescendantsCache??=[...this._children,...this._children.flatMap(e=>e.allDescendants)],this.allDescendantsCache}addChild(e){e&&(e.parentNode=this,this._children.push(e)),this.allDescendantsCache=void 0}isAncestorOf(e){return this.children.some(r=>r===e||r.isAncestorOf(e))}toPrettyString(e){return this.toString()}toString(e){return"TODO"}get range(){return Fr.Range.create(Fr.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Fr.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeUri(){return ue(this.uri)}serialize(e){return{uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var ge=class extends Q{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=Mc(this.toString(),e),this.#e}#t;evaluate(e){return this.#t??=Ce(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#t}#n;isTrue(e){return this.#n??=Ce(`!!(${this.operator?this.operator.toString():""}${this.resolve(e)})`),typeof this.#n=="boolean"&&this.#n}toPrettyString(e){let r=this.evaluate(e);return`${r.toString()} /* ${this.toString()}${typeof r=="number"?` = 0x${r.toString(16)}`:""} */`}serialize(e){return{type:"EXPRESSION",value:this.toString(),evaluated:this.evaluate(e),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Kt=class t extends ge{constructor(r,n,i){super();this.expression=r;this.wrapped=n;this.addChild(r),i&&(this.addChild(i.operator),this.addChild(i.expression),this.join=[],this.join?.push(i))}get firstToken(){return this.openBracket?this.openBracket:super.firstToken}get lastToken(){return this.closeBracket?this.closeBracket:super.lastToken}addExpression(r,n){this.addChild(r),this.addChild(n),this.join??=[],this.join?.push({operator:r,expression:n})}toString(){let r=this.children.map(n=>"radix"in n&&n.radix===16?`0x${n.toString()}`:n.toString()).join(" ");return this.wrapped?`(${r})`:`${r}`}isTrue(r){let n=`(${this.children.map(i=>i instanceof ge?i.resolve(r):i.toString()).join(" ")})`;return Ce(`!!(${this.operator?this.operator.toString():""}${n})`)}get flatJoin(){return this.wrapped?this.join??(this.expression instanceof t?this.expression.flatJoin:[]):[...this.expression instanceof t?this.expression.flatJoin:[],...this.join?.flatMap(r=>[{operator:r.operator,expression:r.expression instanceof t?r.expression.expression:r.expression},...r.expression instanceof t?r.expression.flatJoin:[]])??[]]}};var ci=class extends ge{constructor(r,n,i){super(n);this.value=r;this.docSymbolsMeta={name:`param${i+1}`,kind:iT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},hr=class extends ge{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:iT.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n?.getDocumentSymbols(r)??[])}]:[]}toString(){return`${this.functionName.toString()}(${this.params.map(r=>r?.toString()??"").join(",")})`}isTrue(r){if(this.functionName.name==="defined"){let n=!!(this.params.length===1&&this.params[0]&&r.has(this.params[0].value));return this.operator?Ce(`!!(${this.operator}${n})`):n}return super.isTrue(r)}};var jn=q(j());var VE=q(j());var BE=q(j());var ne=class extends Q{constructor(r,n){super(n);this.value=r;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:BE.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var UE=q(j());var jE=q(j());var Yt=class extends ge{constructor(r,n,i=10){super(n);this.value=r;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:jE.SymbolKind.Number},this.semanticTokenType="number",this.semanticTokenModifiers="declaration"}resolve(r){return this.value.toString()}evaluate(r){return this.value}isTrue(r){return!!this.value}toString(r){return this.value.toString(r??this.radix)}toJson(){return this.value}toPrettyString(r){let n=this.value;return this.radix===16?`0x${n.toString(16)} /* ${typeof n=="number"?`${n.toString(10)}`:""} */`:`${n.toString(10)} /* ${typeof n=="number"?`0x${n.toString(16)}`:""} */`}serialize(){return{type:"NUMBER_VALUE",value:`${this.radix===16?"0x":""}${this.toString()}`,evaluated:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var gt=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Cell Array",kind:UE.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`<${this.values.map(r=>r.toString()).join(" ")}>`}toPrettyString(r){return`<${this.values.map(n=>n.toPrettyString(r)).join(" ")}>`}toJson(){if(this.values.length===1)return this.values[0].value?.toJson();if(this.values.length===2&&this.values.every(r=>r.value instanceof Yt)){let r=new ArrayBuffer(8),n=new DataView(r);return this.values.map(i=>i.value.value).forEach((i,s)=>{n.setUint32(s*4,i)}),n.getBigUint64(0)}return this.values.map(r=>r.value?.toJson()??NaN)}serialize(r){return{type:"ARRAY_VALUE",value:this.values.map(n=>n.value?.serialize(r)??null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var HE=q(j());var en=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Byte String Value",kind:HE.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`[${this.values.map(r=>r.toString(16).padStart(2,"0")).join(" ")}]`}toJson(){return this.values.map(r=>r.value?.toJson()??NaN)}serialize(){return{type:"BYTESTRING",values:this.values.map(r=>r.value?{value:r.value.toString(16),range:r.value.range,evaluated:r.value.value}:null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tt=class extends Q{constructor(r,n){super(n);this.name=r;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},We=class extends Q{constructor(r,n=[]){super();this.propertyName=r;this.labels=n;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:VE.SymbolKind.Property},this.labels.forEach(i=>this.addChild(i)),this.addChild(r)}set values(r){if(this._values)throw new Error("Only one property name is allowed");this._values=r,this.addChild(r)}get values(){return this._values}get quickValues(){return this.values?.values.map(r=>r?r.value instanceof ne?r.value.value:r.value instanceof gt?r.value.values.map(n=>n.value instanceof Yt?n.value.value:NaN):r.value instanceof en?r.value.values.map(n=>n.value?.value??NaN):NaN:null)}getFlatAstValues(){return this.values?.values.flatMap(r=>r?r.value instanceof ne?r.value:r.value instanceof gt?r.value.values.map(n=>n.value):r.value instanceof en?r.value.values.map(n=>n.value):r.value:null)}toString(){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(r=>r?.toString()??"NULL").join(", ")??"NULL"}`:""};`}toPrettyString(r){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toPrettyString(r)??"NULL").join(", ")??"NULL"}`:""};`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var zE=q(j());var Rr=class extends Q{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:zE.SymbolKind.Function}}};var jr=class extends Rr{constructor(r){super("Delete Node",r);this._nodeNameOrRef=null}set nodeNameOrRef(r){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=r,this.addChild(r)}get nodeNameOrRef(){return this._nodeNameOrRef}};var yt=class extends Rr{constructor(r){super("Delete Property",r);this._propertyName=null}set propertyName(r){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=r,this.addChild(r)}get propertyName(){return this._propertyName}};var WE=q(j());var ie=class extends Q{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:WE.SymbolKind.Key},this.addChild(r)}get value(){return this.label?.value}toString(){return`&${this.label?.value??"NULL"}`}toJson(){return-1}serialize(){return{type:"LABEL_REF",label:this.label?.toString()??null,nodePath:this.linksTo?.pathString??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Fe=class t extends Q{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof Ot)return[this.pathName];if(!(this.parentNode instanceof t))return;let e=this.parentNode.path;return e?[...e,this.pathName]:[this.pathName]}get pathName(){}get nodes(){return this.children.filter(e=>e instanceof t)}get deleteNodes(){return this.children.filter(e=>e instanceof jr)}addNodeChild(e){this.addChild(e)}},Ot=class extends Fe{constructor(){super(),this.docSymbolsMeta={name:"/",kind:jn.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof We)}get name(){return new xe("/",oe(this.firstToken))}get deleteProperties(){return this.children.filter(e=>e instanceof yt)}get nodes(){return this.children.filter(e=>e instanceof Xe)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},mr=class extends Fe{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:jn.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}set reference(r){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=r;let n;r instanceof ie?n=r.value:n=r?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:n??"DTC Name",kind:jn.SymbolKind.Class},this.addChild(r)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(r=>r instanceof Xe)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(r=>r instanceof We)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"REF",name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Xe=class t extends Fe{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:jn.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(r=>r())}set name(r){if(this._name)throw new Error("Only on label reference is allowed");this._name=r,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:jn.SymbolKind.Class},this.addChild(r)}get name(){return this._name}get nodes(){return this.children.filter(r=>r instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(r=>r instanceof We)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"CHILD",name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Lc=class extends Q{constructor(r,n){super(n);this.address=r;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((r,n)=>r.toString(16).padStart(n?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},xe=class extends Q{constructor(r,n,i){super(n);this.name=r;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(r){if(this._address)throw new Error("Address can only be set once");r&&(this.lastToken=void 0,this._address=r,r.forEach(n=>this.addChild(n)))}get fullAddress(){return this._address?[...this._address.flatMap(r=>r.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(r=>r.toString()).join(",")}`:this.name}buildSemanticTokens(r){let n=this.firstToken;if(!n.value)return;let i={...n,pos:{...n.pos,len:this.name.length}};r(Di("type"),Ai("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(Di("decorator"),Ai("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(r)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(r=>r.issues)??[]].map(r=>r())}serialize(){let r=this.firstToken;return{fullName:this.toString(),name:{name:this.name,uri:this.serializeUri,range:jn.Range.create(jn.Position.create(r.pos.line,r.pos.col),jn.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tn=(t,e,r=!0,n=!0)=>({start:{line:t?.pos.line??0,character:r?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:n?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var Se=(t,e=!0)=>rr.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),fe=t=>tn(t.firstToken,t.lastToken),Di=t=>Ef.findIndex(e=>e===t),Ai=t=>wf.findIndex(e=>e===t),aT=(t,e,r)=>!pe(t.uri,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,gU=(t,e,r)=>pe(t.uri,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,Pr=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!((n.pos.line<r.line||n.pos.line===r.line&&n.pos.col<=r.character)&&(i.pos.line>r.line||i.pos.line===r.line&&i.pos.colEnd>=r.character)&&pe(t.uri,e))},Af=(t,e)=>{let r=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,n=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return r(t.start,e.start)&&n(t.end,e.end)},YE=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(n.pos.line===r.line||i.pos.line===r.line)&&r.character>=i.pos.colEnd&&pe(t.uri,e))},XE=(t,e,r)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===r.line).at(-1);return i&&i.pos.col>=r.character?!1:e.lastToken===i};var Un=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Pr(s,e,r));return n},qc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>gU(s.lastToken,e,r));return n===t?void 0:n},$c=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>aT(s.firstToken,e,r));return n===t?void 0:n},If="#virtual#",Fc=t=>t.includes(If),Br=t=>{if(!Fc(t))return;let[e,r]=t.split(If),[n,i]=r.split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{docUri:e,range:rr.Range.create(rr.Position.create(Number.parseInt(s),Number.parseInt(o)),rr.Position.create(Number.parseInt(a),Number.parseInt(c)))}},cT=t=>{let e=Br(t.uri);e&&(t.range=e.range,t.uri=e?.docUri,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,uri:n})=>{let i=Br(n);return{range:i?.range??r,uri:i?.docUri??n,templateStrings:[]}}))},W=(t,e,r=e,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:tn(e,r,u,d),uri:e.uri,severity:i,linkedTo:s.map(({range:h,uri:T})=>({range:h,uri:T,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(bU).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return n?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Ft=(t,e,r,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:tn(e,r),uri:e.uri,severity:i,linkedTo:s.map(({range:m,uri:h},T)=>({range:m,uri:h,templateStrings:u.at(T)??[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:SU(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>_U(h,m.templateStrings)).join(" or "),location:{uri:ue(m.uri),range:m.range}}))]},f);return n?.resettableIssues.push(p),{raw:d,diagnostic:p}},F=(t,e,r,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:tn(e,r),severity:i,uri:e.uri,linkedTo:s.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:kU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(NU).join(" or "),location:{uri:ue(p.uri),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return n?.resettableIssues.push(f),{raw:u,diagnostic:f}};function Rt(t,e,r,{severity:n=rr.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:rr.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:rr.Range.create(r,l),severity:n,uri:e,linkedTo:i.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:RU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(PU).join(" or "),location:{uri:ue(p.uri),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"FormattingIssues",items:u.issues,edit:u.edit,codeActionTitle:u.codeActionTitle,virtual:!!u.virtual}},d)}}var JE=(t,e)=>[...t].sort((n,i)=>{let s=e.getSortKey(n),o=e.getSortKey(i);if(s===void 0||o===void 0)throw new Error("Sort keys must be set");if(s!==o)return s-o;let a=n.lastToken,c=i.lastToken;return a.pos.line!==c.pos.line?a.pos.line-c.pos.line:a.pos.col-c.pos.col});async function Pt(t,e,r){let n=Pe(t.textDocument.uri);if(!e)return[];let i=performance.now(),s=await e.getRuntime(),o,a,c=s.context.allParsers.flatMap(u=>u.injectedMacros).find(u=>Pr(u,n,t.position));return c&&(o={runtime:s,item:null,ast:Un(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(pe(u.uri,n)){let f=u.lastToken;return f.pos.line<d.line||f.pos.line===d.line&&f.pos.colEnd<=d.character}return a!==void 0&&(e.getSortKey(u)??-1)<=a})}function oe(t,e){return{start:t,end:e??t}}var U=(t,e)=>t?.tokens.some(r=>r===e),rt=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?yU(t)(r):"no",Me=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",yU=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",nr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&pe(t.uri,e.uri),Bt=(t,e)=>t?.tokens[0]===21&&e?.tokens[0]===21&&(t?.prevToken&&t.prevToken.value===e?.value||e?.prevToken&&e.prevToken.value===t?.value)?!0:!!t&&!!e&&t.pos.colEnd===e.pos.col&&nr(t,e),Of=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),Tn=(t,e,r,n)=>{if("id"in e){let s=t?.find(o=>o.id===e.id);return s||void 0}if("name"in e){let s=t?.find(o=>o.ctxNames.includes(e.name));return s||void 0}return r?.getContextFiles().find(s=>pe(s,e.uri))?r:Of(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>pe(o,e.uri)))?.context},lT=(t,e)=>Of(t).filter(n=>n.files.some(i=>pe(i,e))).map(n=>n.context),QE=t=>{let e=/^(\w+)\s+(.*)$/,r=/^(\w+)\(([^)]*)\)\s+(.*)$/,n=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=n.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l=l.replace(/__VA_ARGS__/g,c.slice(a.length).join(", ")),l}}else if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l}}else if(i=e.exec(t)){let[,,s]=i;return s.trim()}};function TU(t){if(!t.trim())return[];let e=[],r="",n=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&n===0?(e.push(r.trim()),r=""):(s==="("?n++:s===")"&&n--,r+=s)}return r.trim()&&e.push(r.trim()),e}var vU=0,Mc=(t,e)=>{let r=o=>o.replace(/\s*##\s*/g,""),n=o=>o.replace(/#(\w+)/g,(a,c)=>`"${c}"`),i=t,s;do s=i,i=r(s),i=n(i),i=i.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(o,a,c,l)=>{if(a==="defined"){let u=c.split(",").map(d=>d.trim());return u[0]?e.get(u[0])?.resolver:u}else if(a&&typeof e.get(a)?.resolver=="function"){let u=TU(c).map(d=>d.trim()).map(d=>d==="__COUNTER__"?(vU++).toString():d).map(d=>Mc(d,e));return(e.get(a)?.resolver)(...u)}else if(l&&typeof e.get(l)?.resolver=="string")return e.get(l)?.resolver;return o});while(i!==s);return i};function uT(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Ce(t){try{return(0,eval)(uT(t))}catch{}return t}var ue=t=>oT.default.pathToFileURL(t).toString(),Pe=t=>st(oT.default.fileURLToPath(t)),ZE=(t,e)=>{let r=(0,na.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,na.isAbsolute)(r)},pe=(t,e)=>!t||!e?!1:t===e,st=t=>(0,na.normalize)(process.platform==="win32"?t.toLowerCase():t),Ii=t=>(0,KE.createHash)("sha256").update([st(t.dtsFile),...t.includePaths.map(st),...t.overlays.map(st),t.bindingType,...t.zephyrBindings.map(st),...t.deviceOrgBindingsMetaSchema.map(st),...t.deviceOrgTreeBindings.map(st),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),bU=t=>{switch(t){case 0:return"Expected value";case 1:return"Expected ';'";case 2:return"Expected '{'";case 3:return"Expected '}'";case 4:return"Expected '['";case 5:return"Expected ']'";case 12:return"Expected '>'";case 13:return"Expected '<'";case 16:return`Expected '"'`;case 17:return`Expected "'"\\`;case 24:return"Missing ':'";case 21:return"Missing '/'";case 26:return'Expected ")"';case 28:return'Missing ","';case 6:return"Expected property name";case 7:return"Expected node name";case 49:return"Node name shall start with a lower or upper case character";case 50:return"Node unit address should not start with 0x";case 51:return"Node unit address should not end with with ULL";case 8:return"Expected node address";case 9:return"Expected node path";case 48:return"Expected node path reference";case 10:return"Expected node reference";case 11:return"Expected root node name";case 14:return"Expected bytestring";case 15:return"Expected two digits for each byte in bytestring";case 20:return"Hex values are not allowed";case 18:return"Expected label name";case 19:return"Expected '/' at the start of a node path";case 23:return"Found ';' without a statement";case 25:return"Did you mean /delete-node/ or /delete-property/?";case 34:return"Did you mean /delete-node/?";case 35:return"Did you mean /delete-property/?";case 22:return"Unknown syntax";case 27:return"Expected expression";case 31:return"Expected macro identifier";case 30:return"Expected macro identifier or function like macro";case 29:return"White space is not allowed";case 32:return"Properties can only be defined in a node";case 53:return"Node name syntax can only be used inside a node definition.";case 33:return"Properties can only be deleted inside a node";case 36:return"Unable to resolve include";case 52:return"Unknown Node Address syntax";case 37:return"Expected start address";case 38:return"Expected end address";case 39:case 40:return"Expected 8|16|32|64";case 42:return"Unknown macro name";case 43:return"Expected function like macro";case 44:return"Macro expects less arguments";case 45:return"Macro expects more arguments";case 46:return"Missing #ENDIF";case 47:return"Block Unused";case 41:return"This syntax is not officially part of the DTS V0.4 standard"}},SU=t=>t.issues.map(e=>{switch(e){case 0:return`Property "${t.templateStrings[0]}" is replaced by a later definition`;case 1:return"Cannot delete a property before it has been defined";case 2:return"Node name already defined";case 5:return"Cannot delete a node before it has been defined";case 3:return`No node with that reference "${t.templateStrings[0]}" has been defined`;case 8:return`No node with name "${t.templateStrings[0]}" could be found in "/${t.templateStrings[1]}".`;case 4:return`Label name "${t.templateStrings[0]}" already defined`;case 6:return`Property "${t.templateStrings[0]}" was deleted`;case 7:return`Node "${t.templateStrings[0]}" was deleted`;case 9:return`The following node "${t.templateStrings[1]}" shall be present in "${t.templateStrings[0]}" node.`;case 10:return`The following node "${t.templateStrings[0]}" address range collides with another node. Address start: "${t.templateStrings[1]}", end: "${t.templateStrings[2]}".`}}).join(" or "),_U=(t,e)=>{switch(t){case 0:return"Property name already defined.";case 2:return"Defined here";case 4:return"Defined here";case 7:case 6:return"Deleted here";case 9:return"Node";case 10:return`Node "${e[0]}". Address start: "${e[1]}", end: "${e[2]}".`;default:return"TODO"}},kU=t=>t.issues.map(e=>{switch(e){case 9:return`Only these value are allowed ${t.templateStrings[0]}`;case 1:return"INTRO should be empty";case 8:return"INTRO can only be assigned one value";case 5:return"INTRO should be assigned a U32";case 6:return"INTRO should be assigned a U64";case 7:return"INTRO should be assigned a 'property encoded array'";case 2:return"INTRO should be assigned a string";case 3:return"INTRO should be assigned a string list";case 4:return`INTRO expects ${t.templateStrings[1]} values`;case 0:return"INTRO is required";case 11:return"INTRO should be omitted";case 27:return"INTRO name is not permitted under this node";case 34:return"INTRO name is not defined in the type binding for this node";case 10:return"INTRO address value must match node address";case 12:return"INTRO should be 'cpu'";case 13:return"INTRO should be 'memory'";case 14:return"INTRO is deprecated and should not be used'";case 15:return`INTRO ${t.templateStrings[1]}'`;case 18:return"INTRO value must be unique in the entire Devicetree";case 19:return`INTRO should have format ${t.templateStrings[1]}`;case 16:return`INTRO requires property "${t.templateStrings[1]}" in node path "${t.templateStrings[2]}"`;case 17:return"Unable to resolve interrupt parent node";case 20:return`INTRO should have format ${t.templateStrings[1]}`;case 21:return"Node is disabled";case 22:return"Unable to resolve handle";case 23:return`Unable to find "${t.templateStrings[0]}" in ${t.templateStrings[1]}`;case 24:return t.templateStrings[0];case 25:return t.templateStrings[0];case 26:return t.templateStrings[0];case 28:return t.templateStrings[0];case 35:return"Unable to find mapping range for address";case 29:return`INTRO exceeds address space available for this mapping. The range ends at ${t.templateStrings[2]}, the node ends at ${t.templateStrings[1]}`;case 30:return"Map entry overlaps with others entries";case 31:return"Unable to match to a nexus map entry";case 32:return`Unknown node type "${t.templateStrings[0]}"`;case 33:return`Missing name for "${t.templateStrings[0]}" index ${t.templateStrings[1]}"`;case 36:return"Node address is missing";case 37:return`Binding should be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),NU=t=>{switch(t){case 16:case 0:return"Node";case 15:return"Ignored reason";case 18:return"Conflicting properties";case 8:return"Additional value";case 21:return"Disabled by";case 29:return"Mapping range";case 30:return"Map entry";case 31:return"Nexus map entries";case 33:return"Names property";case 35:return"Range property";default:return"TODO"}},RU=t=>t.issues.map(e=>{switch(e){case 4:return"Add end of line to end of file";case 1:return`${t.codeActionTitle}. Expecting ${t.templateStrings[0]}.`;case 0:return"Move to a new line";case 3:return"Remove trailing whitespace at the end of file.";case 2:return"Remove trailing whitespace at the end of the line.";case 5:return`Fix indentation. ${t.templateStrings.at(0)?.length===0?"No indentation expected":`Expecting ${t.templateStrings[0]}`}`;case 6:return`Move token "${t.templateStrings[0]}" next to expression`;case 7:return"Remove (...) enclosure. This expression should only be enclosed in the #define of the macro";case 8:return`Line is too long. ${t.codeActionTitle}`;case 9:return`Hex values must be lowercase. ${t.codeActionTitle}`}}).join(" or "),PU=t=>"TODO",yn=(t,e)=>{let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[t.length-r+n]??0,s=e[e.length-r+n]??0;if(i<s)return-1;if(i>s)return 1}return 0},as=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;n[r-1-s]=c>>>0,i=c>4294967295?1:0}return i&&n.unshift(1),n},EU=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0;o-=i,o<a?(o+=4294967296,i=1):i=0,n[r-1-s]=o-a>>>0}for(;n.length>1&&n[0]===0;)n.shift();return n},wU=(t,e)=>as(t,e),ew=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=as(i,s);if(yn(e,i)>=0&&yn(e,o)<0){let a=EU(e,i),c=n.parentAddress,l=wU(c,a),u=as(c,s);r.push({start:l,end:u,range:tn(n.rangeTokens.start,n.rangeTokens.end),uri:n.rangeTokens.start.uri})}}return r};function tw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Bc(t){return!t||t instanceof hr?t:Bc(t.parentNode)}function ia(t,e){let r=t.getText(),n=e.slice().sort((s,o)=>{let a=t.offsetAt(s.range.start),c=t.offsetAt(o.range.start);if(a!==c)return c-a;let l=t.offsetAt(s.range.end),u=t.offsetAt(o.range.end);if(l!==u)return u-l;let d=a===l&&s.newText.length>0,f=c===u&&o.newText.length>0;return d!==f?d?1:-1:0}),i=r;for(let s of n){let o=t.offsetAt(s.range.start),a=t.offsetAt(s.range.end);i=i.slice(0,o)+s.newText+i.slice(a)}return i}function GE(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}function rw(t,e){return GE(t.end,e.start)>0&&GE(t.start,e.end)<0}var nw=(t,e)=>{let r=iw(t,e),n=sw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},iw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.lastToken===t.firstToken.prevToken&&(i.lastToken.pos.line===t.firstToken.pos.line||i.lastToken.pos.line+1===t.firstToken.pos.line));if(!r||r.astBeforeComment)return;r.astAfterComment=t;let n=iw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},sw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!r)return;r.astBeforeComment=t;let n=sw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},Xs=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===rr.DiagnosticSeverity.Error&&pe(t.uri,e)&&!n.some(i=>t.issues.includes(i))};function xf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var Mf=t=>{if(t)return t instanceof Fe?t:Mf(t?.parentNode)},Js=(t,e,r=0)=>{if(!e||!e.parentNode?.uri)return r;let n=Mf(e.parentNode);return Js(t,n,r+1)};function ow(t,e,r,n){let i=r-e,s=n.length,o=t.length-i+s,a=new Array(o),c=0;for(let l=0;l<e;l++,c++)a[c]=t[l];for(let l=0;l<s;l++,c++)a[c]=n[l];for(let l=r;l<t.length;l++,c++)a[c]=t[l];return a}var Zc=require("fs"),ha=require("path"),to=q(j());var JC=require("path"),bn=q(j());var Er=class extends Q{constructor(r,n,i,s){super();this.startLabels=r;this.value=n;this.endLabels=i;this.bits=s;this.startLabels.forEach(o=>{this.addChild(o)}),this.addChild(s),this.addChild(n),this.endLabels.forEach(o=>{this.addChild(o)})}toString(){return`${[this.value?.toString()??"NULL",...this.endLabels.map(r=>r.toString())].join(" ")}`}toPrettyString(r){return`${[this.value?.toPrettyString(r)??"NULL",...this.endLabels.map(n=>n.toString())].join(" ")}`}toJson(){return this.value?.toJson()}};var Vt=t=>t instanceof Rr?!0:t instanceof Fe?!1:t.parentNode?Vt(t.parentNode):!1;var dT=t=>{if(t instanceof We)return t;if(!(t instanceof Fe))return t.parentNode?dT(t.parentNode):void 0},Qs=t=>!t||t instanceof We?!1:t instanceof Er||Qs(t.parentNode),sa=t=>[...t.map(e=>{if(e instanceof Xe||e instanceof Ot)return e.name;if(e instanceof mr)return e.reference})].filter(e=>!!e),fT=(t,e)=>e?e.parentNode===t||fT(t,e.parentNode):!1;var At=q(j());var aw=q(j());var Hn=class extends Q{constructor(){super();this._pathParts=[]}addPath(r,n){this._pathParts.push(r),n&&this.addChild(n),this.addChild(r)}get pathParts(){return[...this._pathParts]}toString(){return this._pathParts.map(r=>r?.toString()??"<NULL>").join("/")}buildSemanticTokens(r){this._children.forEach(n=>{n instanceof xe?n.buildSemanticTokens(r):r(Di("operator"),Ai("declaration"),n.firstToken,n.lastToken)})}},ot=class extends Q{constructor(r){super();this.path=r;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:aw.SymbolKind.Namespace},this.addChild(r)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){return{type:"NODE_PATH",nodePath:this.path?.toString()??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};function CU(t){switch(t){case"EMPTY":return"EMPTY";case"U32":return"U32";case"U64":return"U64";case"STRING":return"STRING";case"PROP_ENCODED_ARRAY":return"PROP_ENCODED_ARRAY";case"STRINGLIST":return"STRINGLIST";case"BYTESTRING":return"BYTESTRING";case"ANY":return"ANY";case"UNKNOWN":return"UNKNOWN"}}var Y=class{constructor(e,r,n="optional",i=void 0,s,o){this.name=e;this.type=r;this.def=i;this.additionalTypeCheck=o;this.hideAutoComplete=!1;this.list=!1;this.onHover=()=>({kind:At.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.map(CU).join(" or ")).join(",")}
|
|
182
|
+
deps: ${r}}`};var Q4={keyword:"dependencies",type:"object",schemaType:"object",error:ki.error,code(t){let[e,r]=Z4(t);t$(t,e),r$(t,r)}};function Z4({schema:t}){let e={},r={};for(let n in t){if(n==="__proto__")continue;let i=Array.isArray(t[n])?e:r;i[n]=t[n]}return[e,r]}function t$(t,e=t.schema){let{gen:r,data:n,it:i}=t;if(Object.keys(e).length===0)return;let s=r.let("missing");for(let o in e){let a=e[o];if(a.length===0)continue;let c=(0,xu.propertyInData)(r,n,o,i.opts.ownProperties);t.setParams({property:o,depsCount:a.length,deps:a.join(", ")}),i.allErrors?r.if(c,()=>{for(let l of a)(0,xu.checkReportMissingProp)(t,l)}):(r.if((0,a_._)`${c} && (${(0,xu.checkMissingProp)(t,a,s)})`),(0,xu.reportMissingProp)(t,s),r.else())}}ki.validatePropertyDeps=t$;function r$(t,e=t.schema){let{gen:r,data:n,keyword:i,it:s}=t,o=r.name("valid");for(let a in e)(0,J4.alwaysValidSchema)(s,e[a])||(r.if((0,xu.propertyInData)(r,n,a,s.opts.ownProperties),()=>{let c=t.subschema({keyword:i,schemaProp:a},o);t.mergeValidEvaluated(c,o)},()=>r.var(o,!0)),t.ok(o))}ki.validateSchemaDeps=r$;ki.default=Q4});var i$=R(c_=>{"use strict";Object.defineProperty(c_,"__esModule",{value:!0});var n$=ve(),e9=we(),t9={message:"property name must be valid",params:({params:t})=>(0,n$._)`{propertyName: ${t.propertyName}}`},r9={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:t9,code(t){let{gen:e,schema:r,data:n,it:i}=t;if((0,e9.alwaysValidSchema)(i,r))return;let s=e.name("valid");e.forIn("key",n,o=>{t.setParams({propertyName:o}),t.subschema({keyword:"propertyNames",data:o,dataTypes:["string"],propertyName:o,compositeRule:!0},s),e.if((0,n$.not)(s),()=>{t.error(!0),i.allErrors||e.break()})}),t.ok(s)}};c_.default=r9});var u_=R(l_=>{"use strict";Object.defineProperty(l_,"__esModule",{value:!0});var Hm=Dn(),ni=ve(),n9=Cn(),Vm=we(),i9={message:"must NOT have additional properties",params:({params:t})=>(0,ni._)`{additionalProperty: ${t.additionalProperty}}`},s9={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:i9,code(t){let{gen:e,schema:r,parentSchema:n,data:i,errsCount:s,it:o}=t;if(!s)throw new Error("ajv implementation error");let{allErrors:a,opts:c}=o;if(o.props=!0,c.removeAdditional!=="all"&&(0,Vm.alwaysValidSchema)(o,r))return;let l=(0,Hm.allSchemaProperties)(n.properties),u=(0,Hm.allSchemaProperties)(n.patternProperties);d(),t.ok((0,ni._)`${s} === ${n9.default.errors}`);function d(){e.forIn("key",i,T=>{!l.length&&!u.length?m(T):e.if(f(T),()=>m(T))})}function f(T){let _;if(l.length>8){let b=(0,Vm.schemaRefOrVal)(o,n.properties,"properties");_=(0,Hm.isOwnProperty)(e,b,T)}else l.length?_=(0,ni.or)(...l.map(b=>(0,ni._)`${T} === ${b}`)):_=ni.nil;return u.length&&(_=(0,ni.or)(_,...u.map(b=>(0,ni._)`${(0,Hm.usePattern)(t,b)}.test(${T})`))),(0,ni.not)(_)}function p(T){e.code((0,ni._)`delete ${i}[${T}]`)}function m(T){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){p(T);return}if(r===!1){t.setParams({additionalProperty:T}),t.error(),a||e.break();return}if(typeof r=="object"&&!(0,Vm.alwaysValidSchema)(o,r)){let _=e.name("valid");c.removeAdditional==="failing"?(h(T,_,!1),e.if((0,ni.not)(_),()=>{t.reset(),p(T)})):(h(T,_),a||e.if((0,ni.not)(_),()=>e.break()))}}function h(T,_,b){let v={keyword:"additionalProperties",dataProp:T,dataPropType:Vm.Type.Str};b===!1&&Object.assign(v,{compositeRule:!0,createErrors:!1,allErrors:!1}),t.subschema(v,_)}}};l_.default=s9});var a$=R(f_=>{"use strict";Object.defineProperty(f_,"__esModule",{value:!0});var o9=vu(),s$=Dn(),d_=we(),o$=u_(),a9={keyword:"properties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,parentSchema:n,data:i,it:s}=t;s.opts.removeAdditional==="all"&&n.additionalProperties===void 0&&o$.default.code(new o9.KeywordCxt(s,o$.default,"additionalProperties"));let o=(0,s$.allSchemaProperties)(r);for(let d of o)s.definedProperties.add(d);s.opts.unevaluated&&o.length&&s.props!==!0&&(s.props=d_.mergeEvaluated.props(e,(0,d_.toHash)(o),s.props));let a=o.filter(d=>!(0,d_.alwaysValidSchema)(s,r[d]));if(a.length===0)return;let c=e.name("valid");for(let d of a)l(d)?u(d):(e.if((0,s$.propertyInData)(e,i,d,s.opts.ownProperties)),u(d),s.allErrors||e.else().var(c,!0),e.endIf()),t.it.definedProperties.add(d),t.ok(c);function l(d){return s.opts.useDefaults&&!s.compositeRule&&r[d].default!==void 0}function u(d){t.subschema({keyword:"properties",schemaProp:d,dataProp:d},c)}}};f_.default=a9});var d$=R(p_=>{"use strict";Object.defineProperty(p_,"__esModule",{value:!0});var c$=Dn(),zm=ve(),l$=we(),u$=we(),c9={keyword:"patternProperties",type:"object",schemaType:"object",code(t){let{gen:e,schema:r,data:n,parentSchema:i,it:s}=t,{opts:o}=s,a=(0,c$.allSchemaProperties)(r),c=a.filter(h=>(0,l$.alwaysValidSchema)(s,r[h]));if(a.length===0||c.length===a.length&&(!s.opts.unevaluated||s.props===!0))return;let l=o.strictSchema&&!o.allowMatchingProperties&&i.properties,u=e.name("valid");s.props!==!0&&!(s.props instanceof zm.Name)&&(s.props=(0,u$.evaluatedPropsToName)(e,s.props));let{props:d}=s;f();function f(){for(let h of a)l&&p(h),s.allErrors?m(h):(e.var(u,!0),m(h),e.if(u))}function p(h){for(let T in l)new RegExp(h).test(T)&&(0,l$.checkStrictMode)(s,`property ${T} matches pattern ${h} (use allowMatchingProperties)`)}function m(h){e.forIn("key",n,T=>{e.if((0,zm._)`${(0,c$.usePattern)(t,h)}.test(${T})`,()=>{let _=c.includes(h);_||t.subschema({keyword:"patternProperties",schemaProp:h,dataProp:T,dataPropType:u$.Type.Str},u),s.opts.unevaluated&&d!==!0?e.assign((0,zm._)`${d}[${T}]`,!0):!_&&!s.allErrors&&e.if((0,zm.not)(u),()=>e.break())})})}}};p_.default=c9});var f$=R(h_=>{"use strict";Object.defineProperty(h_,"__esModule",{value:!0});var l9=we(),u9={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){let{gen:e,schema:r,it:n}=t;if((0,l9.alwaysValidSchema)(n,r)){t.fail();return}let i=e.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};h_.default=u9});var p$=R(m_=>{"use strict";Object.defineProperty(m_,"__esModule",{value:!0});var d9=Dn(),f9={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:d9.validateUnion,error:{message:"must match a schema in anyOf"}};m_.default=f9});var h$=R(g_=>{"use strict";Object.defineProperty(g_,"__esModule",{value:!0});var Wm=ve(),p9=we(),h9={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,Wm._)`{passingSchemas: ${t.passing}}`},m9={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:h9,code(t){let{gen:e,schema:r,parentSchema:n,it:i}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");if(i.opts.discriminator&&n.discriminator)return;let s=r,o=e.let("valid",!1),a=e.let("passing",null),c=e.name("_valid");t.setParams({passing:a}),e.block(l),t.result(o,()=>t.reset(),()=>t.error(!0));function l(){s.forEach((u,d)=>{let f;(0,p9.alwaysValidSchema)(i,u)?e.var(c,!0):f=t.subschema({keyword:"oneOf",schemaProp:d,compositeRule:!0},c),d>0&&e.if((0,Wm._)`${c} && ${o}`).assign(o,!1).assign(a,(0,Wm._)`[${a}, ${d}]`).else(),e.if(c,()=>{e.assign(o,!0),e.assign(a,d),f&&t.mergeEvaluated(f,Wm.Name)})})}}};g_.default=m9});var m$=R(y_=>{"use strict";Object.defineProperty(y_,"__esModule",{value:!0});var g9=we(),y9={keyword:"allOf",schemaType:"array",code(t){let{gen:e,schema:r,it:n}=t;if(!Array.isArray(r))throw new Error("ajv implementation error");let i=e.name("valid");r.forEach((s,o)=>{if((0,g9.alwaysValidSchema)(n,s))return;let a=t.subschema({keyword:"allOf",schemaProp:o},i);t.ok(i),t.mergeEvaluated(a)})}};y_.default=y9});var T$=R(T_=>{"use strict";Object.defineProperty(T_,"__esModule",{value:!0});var Gm=ve(),y$=we(),T9={message:({params:t})=>(0,Gm.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,Gm._)`{failingKeyword: ${t.ifClause}}`},v9={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:T9,code(t){let{gen:e,parentSchema:r,it:n}=t;r.then===void 0&&r.else===void 0&&(0,y$.checkStrictMode)(n,'"if" without "then" and "else" is ignored');let i=g$(n,"then"),s=g$(n,"else");if(!i&&!s)return;let o=e.let("valid",!0),a=e.name("_valid");if(c(),t.reset(),i&&s){let u=e.let("ifClause");t.setParams({ifClause:u}),e.if(a,l("then",u),l("else",u))}else i?e.if(a,l("then")):e.if((0,Gm.not)(a),l("else"));t.pass(o,()=>t.error(!0));function c(){let u=t.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);t.mergeEvaluated(u)}function l(u,d){return()=>{let f=t.subschema({keyword:u},a);e.assign(o,a),t.mergeValidEvaluated(f,o),d?e.assign(d,(0,Gm._)`${u}`):t.setParams({ifClause:u})}}}};function g$(t,e){let r=t.schema[e];return r!==void 0&&!(0,y$.alwaysValidSchema)(t,r)}T_.default=v9});var v$=R(v_=>{"use strict";Object.defineProperty(v_,"__esModule",{value:!0});var b9=we(),S9={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:e,it:r}){e.if===void 0&&(0,b9.checkStrictMode)(r,`"${t}" without "if" is ignored`)}};v_.default=S9});var b$=R(b_=>{"use strict";Object.defineProperty(b_,"__esModule",{value:!0});var _9=r_(),k9=J1(),N9=n_(),R9=Z1(),P9=e$(),E9=Um(),w9=i$(),C9=u_(),D9=a$(),A9=d$(),I9=f$(),O9=p$(),x9=h$(),M9=m$(),L9=T$(),q9=v$();function $9(t=!1){let e=[I9.default,O9.default,x9.default,M9.default,L9.default,q9.default,w9.default,C9.default,E9.default,D9.default,A9.default];return t?e.push(k9.default,R9.default):e.push(_9.default,N9.default),e.push(P9.default),e}b_.default=$9});var S$=R(S_=>{"use strict";Object.defineProperty(S_,"__esModule",{value:!0});var Lt=ve(),F9={message:({schemaCode:t})=>(0,Lt.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,Lt._)`{format: ${t}}`},B9={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:F9,code(t,e){let{gen:r,data:n,$data:i,schema:s,schemaCode:o,it:a}=t,{opts:c,errSchemaPath:l,schemaEnv:u,self:d}=a;if(!c.validateFormats)return;i?f():p();function f(){let m=r.scopeValue("formats",{ref:d.formats,code:c.code.formats}),h=r.const("fDef",(0,Lt._)`${m}[${o}]`),T=r.let("fType"),_=r.let("format");r.if((0,Lt._)`typeof ${h} == "object" && !(${h} instanceof RegExp)`,()=>r.assign(T,(0,Lt._)`${h}.type || "string"`).assign(_,(0,Lt._)`${h}.validate`),()=>r.assign(T,(0,Lt._)`"string"`).assign(_,h)),t.fail$data((0,Lt.or)(b(),v()));function b(){return c.strictSchema===!1?Lt.nil:(0,Lt._)`${o} && !${_}`}function v(){let k=u.$async?(0,Lt._)`(${h}.async ? await ${_}(${n}) : ${_}(${n}))`:(0,Lt._)`${_}(${n})`,w=(0,Lt._)`(typeof ${_} == "function" ? ${k} : ${_}.test(${n}))`;return(0,Lt._)`${_} && ${_} !== true && ${T} === ${e} && !${w}`}}function p(){let m=d.formats[s];if(!m){b();return}if(m===!0)return;let[h,T,_]=v(m);h===e&&t.pass(k());function b(){if(c.strictSchema===!1){d.logger.warn(w());return}throw new Error(w());function w(){return`unknown format "${s}" ignored in schema at path "${l}"`}}function v(w){let H=w instanceof RegExp?(0,Lt.regexpCode)(w):c.code.formats?(0,Lt._)`${c.code.formats}${(0,Lt.getProperty)(s)}`:void 0,O=r.scopeValue("formats",{key:s,ref:w,code:H});return typeof w=="object"&&!(w instanceof RegExp)?[w.type||"string",w.validate,(0,Lt._)`${O}.validate`]:["string",w,O]}function k(){if(typeof m=="object"&&!(m instanceof RegExp)&&m.async){if(!u.$async)throw new Error("async format in sync schema");return(0,Lt._)`await ${_}(${n})`}return typeof T=="function"?(0,Lt._)`${_}(${n})`:(0,Lt._)`${_}.test(${n})`}}}};S_.default=B9});var _$=R(__=>{"use strict";Object.defineProperty(__,"__esModule",{value:!0});var j9=S$(),U9=[j9.default];__.default=U9});var k$=R(ac=>{"use strict";Object.defineProperty(ac,"__esModule",{value:!0});ac.contentVocabulary=ac.metadataVocabulary=void 0;ac.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];ac.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var R$=R(k_=>{"use strict";Object.defineProperty(k_,"__esModule",{value:!0});var H9=O1(),V9=G1(),z9=b$(),W9=_$(),N$=k$(),G9=[H9.default,V9.default,(0,z9.default)(),W9.default,N$.metadataVocabulary,N$.contentVocabulary];k_.default=G9});var R_=R(Mu=>{"use strict";Object.defineProperty(Mu,"__esModule",{value:!0});Mu.dynamicAnchor=void 0;var N_=ve(),K9=Cn(),P$=Su(),Y9=Mm(),X9={keyword:"$dynamicAnchor",schemaType:"string",code:t=>E$(t,t.schema)};function E$(t,e){let{gen:r,it:n}=t;n.schemaEnv.root.dynamicAnchors[e]=!0;let i=(0,N_._)`${K9.default.dynamicAnchors}${(0,N_.getProperty)(e)}`,s=n.errSchemaPath==="#"?n.validateName:J9(t);r.if((0,N_._)`!${i}`,()=>r.assign(i,s))}Mu.dynamicAnchor=E$;function J9(t){let{schemaEnv:e,schema:r,self:n}=t.it,{root:i,baseId:s,localRefs:o,meta:a}=e.root,{schemaId:c}=n.opts,l=new P$.SchemaEnv({schema:r,schemaId:c,root:i,baseId:s,localRefs:o,meta:a});return P$.compileSchema.call(n,l),(0,Y9.getValidate)(t,l)}Mu.default=X9});var P_=R(Lu=>{"use strict";Object.defineProperty(Lu,"__esModule",{value:!0});Lu.dynamicRef=void 0;var w$=ve(),Q9=Cn(),C$=Mm(),Z9={keyword:"$dynamicRef",schemaType:"string",code:t=>D$(t,t.schema)};function D$(t,e){let{gen:r,keyword:n,it:i}=t;if(e[0]!=="#")throw new Error(`"${n}" only supports hash fragment reference`);let s=e.slice(1);if(i.allErrors)o();else{let c=r.let("valid",!1);o(c),t.ok(c)}function o(c){if(i.schemaEnv.root.dynamicAnchors[s]){let l=r.let("_v",(0,w$._)`${Q9.default.dynamicAnchors}${(0,w$.getProperty)(s)}`);r.if(l,a(l,c),a(i.validateName,c))}else a(i.validateName,c)()}function a(c,l){return l?()=>r.block(()=>{(0,C$.callRef)(t,c),r.let(l,!0)}):()=>(0,C$.callRef)(t,c)}}Lu.dynamicRef=D$;Lu.default=Z9});var A$=R(E_=>{"use strict";Object.defineProperty(E_,"__esModule",{value:!0});var eJ=R_(),tJ=we(),rJ={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){t.schema?(0,eJ.dynamicAnchor)(t,""):(0,tJ.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};E_.default=rJ});var I$=R(w_=>{"use strict";Object.defineProperty(w_,"__esModule",{value:!0});var nJ=P_(),iJ={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,nJ.dynamicRef)(t,t.schema)};w_.default=iJ});var O$=R(C_=>{"use strict";Object.defineProperty(C_,"__esModule",{value:!0});var sJ=R_(),oJ=P_(),aJ=A$(),cJ=I$(),lJ=[sJ.default,oJ.default,aJ.default,cJ.default];C_.default=lJ});var M$=R(D_=>{"use strict";Object.defineProperty(D_,"__esModule",{value:!0});var x$=Um(),uJ={keyword:"dependentRequired",type:"object",schemaType:"object",error:x$.error,code:t=>(0,x$.validatePropertyDeps)(t)};D_.default=uJ});var L$=R(A_=>{"use strict";Object.defineProperty(A_,"__esModule",{value:!0});var dJ=Um(),fJ={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,dJ.validateSchemaDeps)(t)};A_.default=fJ});var q$=R(I_=>{"use strict";Object.defineProperty(I_,"__esModule",{value:!0});var pJ=we(),hJ={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:e,it:r}){e.contains===void 0&&(0,pJ.checkStrictMode)(r,`"${t}" without "contains" is ignored`)}};I_.default=hJ});var $$=R(O_=>{"use strict";Object.defineProperty(O_,"__esModule",{value:!0});var mJ=M$(),gJ=L$(),yJ=q$(),TJ=[mJ.default,gJ.default,yJ.default];O_.default=TJ});var B$=R(x_=>{"use strict";Object.defineProperty(x_,"__esModule",{value:!0});var Ms=ve(),F$=we(),vJ=Cn(),bJ={message:"must NOT have unevaluated properties",params:({params:t})=>(0,Ms._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`},SJ={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:bJ,code(t){let{gen:e,schema:r,data:n,errsCount:i,it:s}=t;if(!i)throw new Error("ajv implementation error");let{allErrors:o,props:a}=s;a instanceof Ms.Name?e.if((0,Ms._)`${a} !== true`,()=>e.forIn("key",n,d=>e.if(l(a,d),()=>c(d)))):a!==!0&&e.forIn("key",n,d=>a===void 0?c(d):e.if(u(a,d),()=>c(d))),s.props=!0,t.ok((0,Ms._)`${i} === ${vJ.default.errors}`);function c(d){if(r===!1){t.setParams({unevaluatedProperty:d}),t.error(),o||e.break();return}if(!(0,F$.alwaysValidSchema)(s,r)){let f=e.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:d,dataPropType:F$.Type.Str},f),o||e.if((0,Ms.not)(f),()=>e.break())}}function l(d,f){return(0,Ms._)`!${d} || !${d}[${f}]`}function u(d,f){let p=[];for(let m in d)d[m]===!0&&p.push((0,Ms._)`${f} !== ${m}`);return(0,Ms.and)(...p)}}};x_.default=SJ});var U$=R(M_=>{"use strict";Object.defineProperty(M_,"__esModule",{value:!0});var No=ve(),j$=we(),_J={message:({params:{len:t}})=>(0,No.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,No._)`{limit: ${t}}`},kJ={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:_J,code(t){let{gen:e,schema:r,data:n,it:i}=t,s=i.items||0;if(s===!0)return;let o=e.const("len",(0,No._)`${n}.length`);if(r===!1)t.setParams({len:s}),t.fail((0,No._)`${o} > ${s}`);else if(typeof r=="object"&&!(0,j$.alwaysValidSchema)(i,r)){let c=e.var("valid",(0,No._)`${o} <= ${s}`);e.if((0,No.not)(c),()=>a(c,s)),t.ok(c)}i.items=!0;function a(c,l){e.forRange("i",l,o,u=>{t.subschema({keyword:"unevaluatedItems",dataProp:u,dataPropType:j$.Type.Num},c),i.allErrors||e.if((0,No.not)(c),()=>e.break())})}}};M_.default=kJ});var H$=R(L_=>{"use strict";Object.defineProperty(L_,"__esModule",{value:!0});var NJ=B$(),RJ=U$(),PJ=[NJ.default,RJ.default];L_.default=PJ});var z$=R(Km=>{"use strict";Object.defineProperty(Km,"__esModule",{value:!0});Km.DiscrError=void 0;var V$;(function(t){t.Tag="tag",t.Mapping="mapping"})(V$||(Km.DiscrError=V$={}))});var G$=R($_=>{"use strict";Object.defineProperty($_,"__esModule",{value:!0});var cc=ve(),q_=z$(),W$=Su(),EJ=bu(),wJ=we(),CJ={message:({params:{discrError:t,tagName:e}})=>t===q_.DiscrError.Tag?`tag "${e}" must be string`:`value of tag "${e}" must be in oneOf`,params:({params:{discrError:t,tag:e,tagName:r}})=>(0,cc._)`{error: ${t}, tag: ${r}, tagValue: ${e}}`},DJ={keyword:"discriminator",type:"object",schemaType:"object",error:CJ,code(t){let{gen:e,data:r,schema:n,parentSchema:i,it:s}=t,{oneOf:o}=i;if(!s.opts.discriminator)throw new Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw new Error("discriminator: requires propertyName");if(n.mapping)throw new Error("discriminator: mapping is not supported");if(!o)throw new Error("discriminator: requires oneOf keyword");let c=e.let("valid",!1),l=e.const("tag",(0,cc._)`${r}${(0,cc.getProperty)(a)}`);e.if((0,cc._)`typeof ${l} == "string"`,()=>u(),()=>t.error(!1,{discrError:q_.DiscrError.Tag,tag:l,tagName:a})),t.ok(c);function u(){let p=f();e.if(!1);for(let m in p)e.elseIf((0,cc._)`${l} === ${m}`),e.assign(c,d(p[m]));e.else(),t.error(!1,{discrError:q_.DiscrError.Mapping,tag:l,tagName:a}),e.endIf()}function d(p){let m=e.name("valid"),h=t.subschema({keyword:"oneOf",schemaProp:p},m);return t.mergeEvaluated(h,cc.Name),m}function f(){var p;let m={},h=_(i),T=!0;for(let k=0;k<o.length;k++){let w=o[k];if(w?.$ref&&!(0,wJ.schemaHasRulesButRef)(w,s.self.RULES)){let O=w.$ref;if(w=W$.resolveRef.call(s.self,s.schemaEnv.root,s.baseId,O),w instanceof W$.SchemaEnv&&(w=w.schema),w===void 0)throw new EJ.default(s.opts.uriResolver,s.baseId,O)}let H=(p=w?.properties)===null||p===void 0?void 0:p[a];if(typeof H!="object")throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);T=T&&(h||_(w)),b(H,k)}if(!T)throw new Error(`discriminator: "${a}" must be required`);return m;function _({required:k}){return Array.isArray(k)&&k.includes(a)}function b(k,w){if(k.const)v(k.const,w);else if(k.enum)for(let H of k.enum)v(H,w);else throw new Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function v(k,w){if(typeof k!="string"||k in m)throw new Error(`discriminator: "${a}" values must be unique strings`);m[k]=w}}}};$_.default=DJ});var K$=R((pwe,AJ)=>{AJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/schema",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0,"https://json-schema.org/draft/2019-09/vocab/applicator":!0,"https://json-schema.org/draft/2019-09/vocab/validation":!0,"https://json-schema.org/draft/2019-09/vocab/meta-data":!0,"https://json-schema.org/draft/2019-09/vocab/format":!1,"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format"},{$ref:"meta/content"}],type:["object","boolean"],properties:{definitions:{$comment:"While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.",type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},dependencies:{$comment:'"dependencies" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to "dependentSchemas" and "dependentRequired"',type:"object",additionalProperties:{anyOf:[{$recursiveRef:"#"},{$ref:"meta/validation#/$defs/stringArray"}]}}}}});var Y$=R((hwe,IJ)=>{IJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/applicator":!0},$recursiveAnchor:!0,title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{additionalItems:{$recursiveRef:"#"},unevaluatedItems:{$recursiveRef:"#"},items:{anyOf:[{$recursiveRef:"#"},{$ref:"#/$defs/schemaArray"}]},contains:{$recursiveRef:"#"},additionalProperties:{$recursiveRef:"#"},unevaluatedProperties:{$recursiveRef:"#"},properties:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$recursiveRef:"#"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$recursiveRef:"#"}},propertyNames:{$recursiveRef:"#"},if:{$recursiveRef:"#"},then:{$recursiveRef:"#"},else:{$recursiveRef:"#"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$recursiveRef:"#"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$recursiveRef:"#"}}}}});var X$=R((mwe,OJ)=>{OJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/content",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/content":!0},$recursiveAnchor:!0,title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentMediaType:{type:"string"},contentEncoding:{type:"string"},contentSchema:{$recursiveRef:"#"}}}});var J$=R((gwe,xJ)=>{xJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/core",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/core":!0},$recursiveAnchor:!0,title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{type:"string",format:"uri-reference",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{type:"string",format:"uri"},$anchor:{type:"string",pattern:"^[A-Za-z][-A-Za-z0-9.:_]*$"},$ref:{type:"string",format:"uri-reference"},$recursiveRef:{type:"string",format:"uri-reference"},$recursiveAnchor:{type:"boolean",default:!1},$vocabulary:{type:"object",propertyNames:{type:"string",format:"uri"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$recursiveRef:"#"},default:{}}}}});var Q$=R((ywe,MJ)=>{MJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/format",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/format":!0},$recursiveAnchor:!0,title:"Format vocabulary meta-schema",type:["object","boolean"],properties:{format:{type:"string"}}}});var Z$=R((Twe,LJ)=>{LJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/meta-data":!0},$recursiveAnchor:!0,title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}}});var eF=R((vwe,qJ)=>{qJ.exports={$schema:"https://json-schema.org/draft/2019-09/schema",$id:"https://json-schema.org/draft/2019-09/meta/validation",$vocabulary:{"https://json-schema.org/draft/2019-09/vocab/validation":!0},$recursiveAnchor:!0,title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}},const:!0,enum:{type:"array",items:!0},type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}}});var tF=R(F_=>{"use strict";Object.defineProperty(F_,"__esModule",{value:!0});var $J=K$(),FJ=Y$(),BJ=X$(),jJ=J$(),UJ=Q$(),HJ=Z$(),VJ=eF(),zJ=["/properties"];function WJ(t){return[$J,FJ,BJ,jJ,e(this,UJ),HJ,e(this,VJ)].forEach(r=>this.addMetaSchema(r,void 0,!1)),this;function e(r,n){return t?r.$dataMetaSchema(n,zJ):n}}F_.default=WJ});var rF=R((bt,j_)=>{"use strict";Object.defineProperty(bt,"__esModule",{value:!0});bt.MissingRefError=bt.ValidationError=bt.CodeGen=bt.Name=bt.nil=bt.stringify=bt.str=bt._=bt.KeywordCxt=bt.Ajv2019=void 0;var GJ=w1(),KJ=R$(),YJ=O$(),XJ=$$(),JJ=H$(),QJ=G$(),ZJ=tF(),B_="https://json-schema.org/draft/2019-09/schema",lc=class extends GJ.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),this.addVocabulary(YJ.default),KJ.default.forEach(e=>this.addVocabulary(e)),this.addVocabulary(XJ.default),this.addVocabulary(JJ.default),this.opts.discriminator&&this.addKeyword(QJ.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();let{$data:e,meta:r}=this.opts;r&&(ZJ.default.call(this,e),this.refs["http://json-schema.org/schema"]=B_)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(B_)?B_:void 0)}};bt.Ajv2019=lc;j_.exports=bt=lc;j_.exports.Ajv2019=lc;Object.defineProperty(bt,"__esModule",{value:!0});bt.default=lc;var e6=vu();Object.defineProperty(bt,"KeywordCxt",{enumerable:!0,get:function(){return e6.KeywordCxt}});var uc=ve();Object.defineProperty(bt,"_",{enumerable:!0,get:function(){return uc._}});Object.defineProperty(bt,"str",{enumerable:!0,get:function(){return uc.str}});Object.defineProperty(bt,"stringify",{enumerable:!0,get:function(){return uc.stringify}});Object.defineProperty(bt,"nil",{enumerable:!0,get:function(){return uc.nil}});Object.defineProperty(bt,"Name",{enumerable:!0,get:function(){return uc.Name}});Object.defineProperty(bt,"CodeGen",{enumerable:!0,get:function(){return uc.CodeGen}});var t6=Em();Object.defineProperty(bt,"ValidationError",{enumerable:!0,get:function(){return t6.default}});var r6=bu();Object.defineProperty(bt,"MissingRefError",{enumerable:!0,get:function(){return r6.default}})});var pc=require("path"),Ke=q(qE());var Pf=class t{constructor(e,r,n,i){this._uri=e,this._languageId=r,this._version=n,this._content=i,this._lineOffsets=void 0}get uri(){return this._uri}get languageId(){return this._languageId}get version(){return this._version}getText(e){if(e){let r=this.offsetAt(e.start),n=this.offsetAt(e.end);return this._content.substring(r,n)}return this._content}update(e,r){for(let n of e)if(t.isIncremental(n)){let i=FE(n.range),s=this.offsetAt(i.start),o=this.offsetAt(i.end);this._content=this._content.substring(0,s)+n.text+this._content.substring(o,this._content.length);let a=Math.max(i.start.line,0),c=Math.max(i.end.line,0),l=this._lineOffsets,u=$E(n.text,!1,s);if(c-a===u.length)for(let f=0,p=u.length;f<p;f++)l[f+a+1]=u[f];else u.length<1e4?l.splice(a+1,c-a,...u):this._lineOffsets=l=l.slice(0,a+1).concat(u,l.slice(c+1));let d=n.text.length-(o-s);if(d!==0)for(let f=a+1+u.length,p=l.length;f<p;f++)l[f]=l[f]+d}else if(t.isFull(n))this._content=n.text,this._lineOffsets=void 0;else throw new Error("Unknown change event received");this._version=r}getLineOffsets(){return this._lineOffsets===void 0&&(this._lineOffsets=$E(this._content,!0)),this._lineOffsets}positionAt(e){e=Math.max(Math.min(e,this._content.length),0);let r=this.getLineOffsets(),n=0,i=r.length;if(i===0)return{line:0,character:e};for(;n<i;){let o=Math.floor((n+i)/2);r[o]>e?i=o:n=o+1}let s=n-1;return{line:s,character:e-r[s]}}offsetAt(e){let r=this.getLineOffsets();if(e.line>=r.length)return this._content.length;if(e.line<0)return 0;let n=r[e.line],i=e.line+1<r.length?r[e.line+1]:this._content.length;return Math.max(Math.min(n+e.character,i),n)}get lineCount(){return this.getLineOffsets().length}static isIncremental(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range!==void 0&&(r.rangeLength===void 0||typeof r.rangeLength=="number")}static isFull(e){let r=e;return r!=null&&typeof r.text=="string"&&r.range===void 0&&r.rangeLength===void 0}},$r;(function(t){function e(i,s,o,a){return new Pf(i,s,o,a)}t.create=e;function r(i,s,o){if(i instanceof Pf)return i.update(s,o),i;throw new Error("TextDocument.update: document must be created by TextDocument.create")}t.update=r;function n(i,s){let o=i.getText(),a=nT(s.map(mU),(u,d)=>{let f=u.range.start.line-d.range.start.line;return f===0?u.range.start.character-d.range.start.character:f}),c=0,l=[];for(let u of a){let d=i.offsetAt(u.range.start);if(d<c)throw new Error("Overlapping edit");d>c&&l.push(o.substring(c,d)),u.newText.length&&l.push(u.newText),c=i.offsetAt(u.range.end)}return l.push(o.substr(c)),l.join("")}t.applyEdits=n})($r||($r={}));function nT(t,e){if(t.length<=1)return t;let r=t.length/2|0,n=t.slice(0,r),i=t.slice(r);nT(n,e),nT(i,e);let s=0,o=0,a=0;for(;s<n.length&&o<i.length;)e(n[s],i[o])<=0?t[a++]=n[s++]:t[a++]=i[o++];for(;s<n.length;)t[a++]=n[s++];for(;o<i.length;)t[a++]=i[o++];return t}function $E(t,e,r=0){let n=e?[r]:[];for(let i=0;i<t.length;i++){let s=t.charCodeAt(i);(s===13||s===10)&&(s===13&&i+1<t.length&&t.charCodeAt(i+1)===10&&i++,n.push(r+i+1))}return n}function FE(t){let e=t.start,r=t.end;return e.line>r.line||e.line===r.line&&e.character>r.character?{start:r,end:e}:t}function mU(t){let e=FE(t.range);return e!==t.range?{newText:t.newText,range:e}:t}var Ef=["namespace","class","enum","interface","struct","typeParameter","type","parameter","variable","property","enumMember","decorator","event","function","method","macro","label","comment","string","keyword","number","regexp","operator"],wf=["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"];var oT=q(require("url")),KE=require("crypto"),na=require("path"),rr=q(j());var iT=q(j());var Fr=q(j());var Q=class{constructor(e){this._children=[];this.syntaxIssues=[];this.resettableIssues=[];this._firstToken=e?.start,this._lastToken=e?.end}get issues(){return[...this.syntaxIssues,...this.resettableIssues]}resetIssues(){this.resettableIssues=[],this.children.forEach(e=>e.resetIssues())}get serializeIssues(){return this.issues.map(e=>e())}get firstToken(){return this._firstToken??this._children[0].firstToken}set firstToken(e){this._firstToken=e}get lastToken(){return this._lastToken??this._children[this._children.length-1]?.lastToken??this.firstToken}set lastToken(e){this._lastToken=e}get uri(){return this.firstToken.uri}getTopMostAstNodeForFile(e){return pe(e,this.uri)?[this]:this.children.flatMap(r=>r.getTopMostAstNodeForFile(e))}getDocumentSymbols(e){if(!this.docSymbolsMeta)return this.children.flatMap(n=>n.getDocumentSymbols(e)??[]);if(!pe(this.uri,e))return[];let r=fe(this);return[{name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind,range:r,selectionRange:r,children:[...this.children.flatMap(n=>n.getDocumentSymbols(e)??[])]}]}getWorkspaceSymbols(){if(!this.docSymbolsMeta)return this.children.flatMap(i=>i.getWorkspaceSymbols()??[]);let e=this.docSymbolsMeta.kind;if(![Fr.SymbolKind.File,Fr.SymbolKind.Class,Fr.SymbolKind.Constant].some(i=>i===e))return[];let r=Br(this.uri),n=r?.range??fe(this);return[{location:Fr.Location.create(ue(r?.docUri??this.uri),n),name:this.docSymbolsMeta.name?this.docSymbolsMeta.name:"__UNSET__",kind:this.docSymbolsMeta.kind},...this.children.flatMap(i=>i.getWorkspaceSymbols()??[]).filter(i=>i.kind===Fr.SymbolKind.File||i.kind===Fr.SymbolKind.Class||i.kind===Fr.SymbolKind.Constant)]}buildSemanticTokens(e){this._children.forEach(r=>r.buildSemanticTokens(e)),!(!this.semanticTokenType||!this.semanticTokenModifiers)&&e(Di(this.semanticTokenType),Ai(this.semanticTokenModifiers),this.firstToken,this.lastToken)}get children(){return this._children}get allDescendants(){return this.allDescendantsCache??=[...this._children,...this._children.flatMap(e=>e.allDescendants)],this.allDescendantsCache}addChild(e){e&&(e.parentNode=this,this._children.push(e)),this.allDescendantsCache=void 0}isAncestorOf(e){return this.children.some(r=>r===e||r.isAncestorOf(e))}toPrettyString(e){return this.toString()}toString(e){return"TODO"}get range(){return Fr.Range.create(Fr.Position.create(this.firstToken.pos.line,this.firstToken.pos.col),Fr.Position.create(this.lastToken.pos.line,this.lastToken.pos.colEnd))}get serializeUri(){return ue(this.uri)}serialize(e){return{uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var ge=class extends Q{get firstToken(){return this.operator?this.operator.firstToken:super.firstToken}toJson(){return-1}#e;resolve(e){return this.#e??=Mc(this.toString(),e),this.#e}#t;evaluate(e){return this.#t??=Ce(`${this.operator?this.operator.toString():""}${this.resolve(e)}`),this.#t}#n;isTrue(e){return this.#n??=Ce(`!!(${this.operator?this.operator.toString():""}${this.resolve(e)})`),typeof this.#n=="boolean"&&this.#n}toPrettyString(e){let r=this.evaluate(e);return`${r.toString()} /* ${this.toString()}${typeof r=="number"?` = 0x${r.toString(16)}`:""} */`}serialize(e){return{type:"EXPRESSION",value:this.toString(),evaluated:this.evaluate(e),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Kt=class t extends ge{constructor(r,n,i){super();this.expression=r;this.wrapped=n;this.addChild(r),i&&(this.addChild(i.operator),this.addChild(i.expression),this.join=[],this.join?.push(i))}get firstToken(){return this.openBracket?this.openBracket:super.firstToken}get lastToken(){return this.closeBracket?this.closeBracket:super.lastToken}addExpression(r,n){this.addChild(r),this.addChild(n),this.join??=[],this.join?.push({operator:r,expression:n})}toString(){let r=this.children.map(n=>"radix"in n&&n.radix===16?`0x${n.toString()}`:n.toString()).join(" ");return this.wrapped?`(${r})`:`${r}`}isTrue(r){let n=`(${this.children.map(i=>i instanceof ge?i.resolve(r):i.toString()).join(" ")})`;return Ce(`!!(${this.operator?this.operator.toString():""}${n})`)}get flatJoin(){return this.wrapped?this.join??(this.expression instanceof t?this.expression.flatJoin:[]):[...this.expression instanceof t?this.expression.flatJoin:[],...this.join?.flatMap(r=>[{operator:r.operator,expression:r.expression instanceof t?r.expression.expression:r.expression},...r.expression instanceof t?r.expression.flatJoin:[]])??[]]}};var li=class extends ge{constructor(r,n,i){super(n);this.value=r;this.docSymbolsMeta={name:`param${i+1}`,kind:iT.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.value}},hr=class extends ge{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:iT.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n?.getDocumentSymbols(r)??[])}]:[]}toString(){return`${this.functionName.toString()}(${this.params.map(r=>r?.toString()??"").join(",")})`}isTrue(r){if(this.functionName.name==="defined"){let n=!!(this.params.length===1&&this.params[0]&&r.has(this.params[0].value));return this.operator?Ce(`!!(${this.operator}${n})`):n}return super.isTrue(r)}};var Un=q(j());var VE=q(j());var BE=q(j());var ne=class extends Q{constructor(r,n){super(n);this.value=r;this.semanticTokenType="string",this.semanticTokenModifiers="declaration",this.docSymbolsMeta={name:this.value,kind:BE.SymbolKind.String}}toString(){return`"${this.value.toString()}"`}toJson(){return this.value}serialize(){return{type:"STRING",value:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var UE=q(j());var jE=q(j());var Yt=class extends ge{constructor(r,n,i=10){super(n);this.value=r;this.radix=i;this.docSymbolsMeta={name:this.value.toString(),kind:jE.SymbolKind.Number},this.semanticTokenType="number",this.semanticTokenModifiers="declaration"}resolve(r){return this.value.toString()}evaluate(r){return this.value}isTrue(r){return!!this.value}toString(r){return this.value.toString(r??this.radix)}toJson(){return this.value}toPrettyString(r){let n=this.value;return this.radix===16?`0x${n.toString(16)} /* ${typeof n=="number"?`${n.toString(10)}`:""} */`:`${n.toString(10)} /* ${typeof n=="number"?`0x${n.toString(16)}`:""} */`}serialize(){return{type:"NUMBER_VALUE",value:`${this.radix===16?"0x":""}${this.toString()}`,evaluated:this.value,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var gt=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Cell Array",kind:UE.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`<${this.values.map(r=>r.toString()).join(" ")}>`}toPrettyString(r){return`<${this.values.map(n=>n.toPrettyString(r)).join(" ")}>`}toJson(){if(this.values.length===1)return this.values[0].value?.toJson();if(this.values.length===2&&this.values.every(r=>r.value instanceof Yt)){let r=new ArrayBuffer(8),n=new DataView(r);return this.values.map(i=>i.value.value).forEach((i,s)=>{n.setUint32(s*4,i)}),n.getBigUint64(0)}return this.values.map(r=>r.value?.toJson()??NaN)}serialize(r){return{type:"ARRAY_VALUE",value:this.values.map(n=>n.value?.serialize(r)??null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var HE=q(j());var en=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Byte String Value",kind:HE.SymbolKind.Array},this.values.forEach(n=>this.addChild(n))}toString(){return`[${this.values.map(r=>r.toString(16).padStart(2,"0")).join(" ")}]`}toJson(){return this.values.map(r=>r.value?.toJson()??NaN)}serialize(){return{type:"BYTESTRING",values:this.values.map(r=>r.value?{value:r.value.toString(16),range:r.value.range,evaluated:r.value.value}:null),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tt=class extends Q{constructor(r,n){super(n);this.name=r;this.semanticTokenType="property",this.semanticTokenModifiers="declaration"}toString(){return this.name}serialize(){return{value:this.name,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},We=class extends Q{constructor(r,n=[]){super();this.propertyName=r;this.labels=n;this._values=void 0;this.docSymbolsMeta={name:this.propertyName?.name??"Unknown",kind:VE.SymbolKind.Property},this.labels.forEach(i=>this.addChild(i)),this.addChild(r)}set values(r){if(this._values)throw new Error("Only one property name is allowed");this._values=r,this.addChild(r)}get values(){return this._values}get quickValues(){return this.values?.values.map(r=>r?r.value instanceof ne?r.value.value:r.value instanceof gt?r.value.values.map(n=>n.value instanceof Yt?n.value.value:NaN):r.value instanceof en?r.value.values.map(n=>n.value?.value??NaN):NaN:null)}getFlatAstValues(){return this.values?.values.flatMap(r=>r?r.value instanceof ne?r.value:r.value instanceof gt?r.value.values.map(n=>n.value):r.value instanceof en?r.value.values.map(n=>n.value):r.value:null)}toString(){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(r=>r?.toString()??"NULL").join(", ")??"NULL"}`:""};`}toPrettyString(r){return`${this.propertyName?.toString()??"__UNSET__"}${this.assignOperatorToken?` = ${this._values?.values.map(n=>n?.toPrettyString(r)??"NULL").join(", ")??"NULL"}`:""};`}serialize(r){return{name:this.propertyName?.serialize()??null,values:this.values?.values.map(n=>n?.value?.serialize(r)??null)??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var zE=q(j());var Rr=class extends Q{constructor(r,n){super();this.keyword=n;this.addChild(n),this.docSymbolsMeta={name:r,kind:zE.SymbolKind.Function}}};var jr=class extends Rr{constructor(r){super("Delete Node",r);this._nodeNameOrRef=null}set nodeNameOrRef(r){if(this._nodeNameOrRef)throw new Error("Only one property name is allowed");this._nodeNameOrRef=r,this.addChild(r)}get nodeNameOrRef(){return this._nodeNameOrRef}};var yt=class extends Rr{constructor(r){super("Delete Property",r);this._propertyName=null}set propertyName(r){if(this._propertyName)throw new Error("Only only property name is allowed");this._propertyName=r,this.addChild(r)}get propertyName(){return this._propertyName}};var WE=q(j());var ie=class extends Q{constructor(r){super();this.label=r;this.docSymbolsMeta={name:`&${this.label?.value??"NULL"}`,kind:WE.SymbolKind.Key},this.addChild(r)}get value(){return this.label?.value}toString(){return`&${this.label?.value??"NULL"}`}toJson(){return-1}serialize(){return{type:"LABEL_REF",label:this.label?.toString()??null,nodePath:this.linksTo?.pathString??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var Fe=class t extends Q{constructor(){super()}get path(){if(!this.pathName)return["__UNDEFINED__"];if(!this.parentNode||this instanceof Ot)return[this.pathName];if(!(this.parentNode instanceof t))return;let e=this.parentNode.path;return e?[...e,this.pathName]:[this.pathName]}get pathName(){}get nodes(){return this.children.filter(e=>e instanceof t)}get deleteNodes(){return this.children.filter(e=>e instanceof jr)}addNodeChild(e){this.addChild(e)}},Ot=class extends Fe{constructor(){super(),this.docSymbolsMeta={name:"/",kind:Un.SymbolKind.Class}}get properties(){return this.children.filter(e=>e instanceof We)}get name(){return new xe("/",oe(this.firstToken))}get deleteProperties(){return this.children.filter(e=>e instanceof yt)}get nodes(){return this.children.filter(e=>e instanceof Xe)}get pathName(){return"/"}serialize(e){return{type:"ROOT",properties:this.properties.map(r=>r.serialize(e)),nodes:this.nodes.map(r=>r.serialize(e)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},mr=class extends Fe{constructor(r=[]){super();this.labels=r;this._reference=null;this.docSymbolsMeta={name:"DTC Name",kind:Un.SymbolKind.Class},r.forEach(n=>{super.addChild(n)})}get serializeIssues(){return[...this.issues,...this.reference?.issues??[]].map(r=>r())}set reference(r){if(this._reference)throw new Error("Only on label reference is allowed");this._reference=r;let n;r instanceof ie?n=r.value:n=r?.path?.pathParts.at(-1)?.name??"DTC Name",this.docSymbolsMeta={name:n??"DTC Name",kind:Un.SymbolKind.Class},this.addChild(r)}get path(){return this.resolveNodePath?this.resolveNodePath:super.path}get reference(){return this._reference}get nodes(){return this.children.filter(r=>r instanceof Xe)}get pathName(){if(this.reference instanceof ie&&this.reference.label?.value)return`&${this.reference.label.value}`}get properties(){return this.children.filter(r=>r instanceof We)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"REF",name:this.reference?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Xe=class t extends Fe{constructor(r=[],n){super();this.labels=r;this.omitIfNoRef=n;this._name=null;this.docSymbolsMeta={name:"DTC Name",kind:Un.SymbolKind.Class},n&&this.addChild(n),r.forEach(i=>{this.addChild(i)})}get serializeIssues(){return[...this.issues,...this.name?.issues??[]].map(r=>r())}set name(r){if(this._name)throw new Error("Only on label reference is allowed");this._name=r,this.docSymbolsMeta={name:this._name?.toString()??"DTC Name",kind:Un.SymbolKind.Class},this.addChild(r)}get name(){return this._name}get nodes(){return this.children.filter(r=>r instanceof t)}get pathName(){return this._name?.toString()}get properties(){return this.children.filter(r=>r instanceof We)}get deleteProperties(){return this.children.filter(r=>r instanceof yt)}serialize(r){return{type:"CHILD",name:this.name?.serialize()??null,properties:this.properties.map(n=>n.serialize(r)),nodes:this.nodes.map(n=>n.serialize(r)),uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},Lc=class extends Q{constructor(r,n){super(n);this.address=r;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}toString(){return this.address?.map((r,n)=>r.toString(16).padStart(n?8:0,"0")).join("")??"NaN"}serialize(){return{address:this.address,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}},xe=class extends Q{constructor(r,n,i){super(n);this.name=r;this._address=i;this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}get value(){return this.name}get address(){return this._address}set address(r){if(this._address)throw new Error("Address can only be set once");r&&(this.lastToken=void 0,this._address=r,r.forEach(n=>this.addChild(n)))}get fullAddress(){return this._address?[...this._address.flatMap(r=>r.address)]:void 0}toString(){return this._address!==void 0?`${this.name}@${this._address.map(r=>r.toString()).join(",")}`:this.name}buildSemanticTokens(r){let n=this.firstToken;if(!n.value)return;let i={...n,pos:{...n.pos,len:this.name.length}};r(Di("type"),Ai("declaration"),i,i),this.address!==void 0&&this.address.forEach(s=>{r(Di("decorator"),Ai("declaration"),s.firstToken,s.lastToken),s.buildSemanticTokens(r)})}get serializeIssues(){return[...this.issues,...this._address?.flatMap(r=>r.issues)??[]].map(r=>r())}serialize(){let r=this.firstToken;return{fullName:this.toString(),name:{name:this.name,uri:this.serializeUri,range:Un.Range.create(Un.Position.create(r.pos.line,r.pos.col),Un.Position.create(r.pos.line,r.pos.colEnd)),issues:this.serializeIssues},address:this.address?.map(n=>n.serialize())??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};var tn=(t,e,r=!0,n=!0)=>({start:{line:t?.pos.line??0,character:r?t?.pos.col??0:(t?.pos.col??0)+(t?.pos.len??0)},end:{line:e?.pos.line??0,character:n?(e?.pos.col??0)+(e?.pos.len??0):e?.pos.col??0}});var Se=(t,e=!0)=>rr.Position.create(t.pos.line,e?t.pos.colEnd:t.pos.col),fe=t=>tn(t.firstToken,t.lastToken),Di=t=>Ef.findIndex(e=>e===t),Ai=t=>wf.findIndex(e=>e===t),aT=(t,e,r)=>!pe(t.uri,e)||r.line<t.pos.line?!1:r.line>t.pos.line?!0:r.character>=t.pos.colEnd,gU=(t,e,r)=>pe(t.uri,e)?r.line<t.pos.line?!0:r.line>t.pos.line?!1:r.character<t.pos.col:!1,Pr=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!((n.pos.line<r.line||n.pos.line===r.line&&n.pos.col<=r.character)&&(i.pos.line>r.line||i.pos.line===r.line&&i.pos.colEnd>=r.character)&&pe(t.uri,e))},Af=(t,e)=>{let r=(i,s)=>i.line<s.line||i.line===s.line&&i.character<=s.character,n=(i,s)=>i.line>s.line||i.line===s.line&&i.character>=s.character;return r(t.start,e.start)&&n(t.end,e.end)},YE=(t,e,r)=>{let n=t.firstToken,i=t.lastToken;return!!(t.lastToken.value!==";"&&(n.pos.line===r.line||i.pos.line===r.line)&&r.character>=i.pos.colEnd&&pe(t.uri,e))},XE=(t,e,r)=>{if(!t)return!1;let i=t.filter(s=>s.pos.line===r.line).at(-1);return i&&i.pos.col>=r.character?!1:e.lastToken===i};var Hn=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>Pr(s,e,r));return n},qc=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].find(s=>gU(s.lastToken,e,r));return n===t?void 0:n},$c=(t,e,r)=>{let n=t,i=t;for(;i;)n=i,i=[...n.children].reverse().find(s=>aT(s.firstToken,e,r));return n===t?void 0:n},If="#virtual#",Fc=t=>t.includes(If),Br=t=>{if(!Fc(t))return;let[e,r]=t.split(If),[n,i]=r.split("-"),[s,o]=n.split(":"),[a,c]=i.split(":");return{docUri:e,range:rr.Range.create(rr.Position.create(Number.parseInt(s),Number.parseInt(o)),rr.Position.create(Number.parseInt(a),Number.parseInt(c)))}},cT=t=>{let e=Br(t.uri);e&&(t.range=e.range,t.uri=e?.docUri,t.virtual=!0,t.linkedTo=t.linkedTo.map(({range:r,uri:n})=>{let i=Br(n);return{range:i?.range??r,uri:i?.docUri??n,templateStrings:[]}}))},W=(t,e,r=e,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,inclusiveStart:u,inclusiveEnd:d}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let f={issues:Array.isArray(t)?t:[t],range:tn(e,r,u,d),uri:e.uri,severity:i,linkedTo:s.map(({range:h,uri:T})=>({range:h,uri:T,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(f);let p,m=()=>(p??={severity:f.severity,range:f.range,message:f.issues?f.issues.map(bU).join(" or "):"",source:"devicetree",tags:f.tags,data:{firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},type:"SyntaxIssue",items:f.issues,edit:f.edit,codeActionTitle:f.codeActionTitle,virtual:!!f.virtual}},p);return n?.syntaxIssues.push(m),{raw:f,diagnostic:m}},Ft=(t,e,r,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l,linkedToTemplateStrings:u=[]}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[],linkedToTemplateStrings:[]})=>{let d={issues:Array.isArray(t)?t:[t],range:tn(e,r),uri:e.uri,severity:i,linkedTo:s.map(({range:m,uri:h},T)=>({range:m,uri:h,templateStrings:u.at(T)??[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(d);let f,p=()=>(f??={severity:d.severity,range:d.range,message:SU(d),source:"devicetree",tags:d.tags,relatedInformation:[...d.linkedTo.map(m=>({message:d.issues.map(h=>_U(h,m.templateStrings)).join(" or "),location:{uri:ue(m.uri),range:m.range}}))]},f);return n?.resettableIssues.push(p),{raw:d,diagnostic:p}},F=(t,e,r,n,{severity:i=rr.DiagnosticSeverity.Error,linkedTo:s=[],tags:o,templateStrings:a=[],edit:c,codeActionTitle:l}={severity:rr.DiagnosticSeverity.Error,linkedTo:[],templateStrings:[]})=>{let u={issues:Array.isArray(t)?t:[t],range:tn(e,r),severity:i,uri:e.uri,linkedTo:s.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:o,templateStrings:a,edit:c,codeActionTitle:l};cT(u);let d,f=()=>(d??={severity:u.severity,range:u.range,message:kU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(NU).join(" or "),location:{uri:ue(p.uri),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"StandardTypeIssue",firstToken:{pos:e.pos,tokens:e.tokens,value:e.value},lastToken:{pos:r.pos,tokens:r.tokens,value:r.value},edit:u.edit,codeActionTitle:u.codeActionTitle,items:u.issues,virtual:!!u.virtual}},d);return n?.resettableIssues.push(f),{raw:u,diagnostic:f}};function Rt(t,e,r,{severity:n=rr.DiagnosticSeverity.Warning,linkedTo:i=[],tags:s,templateStrings:o=[],edit:a,codeActionTitle:c}={severity:rr.DiagnosticSeverity.Warning,linkedTo:[],templateStrings:[],edit:[],codeActionTitle:void 0},l=r){let u={issues:Array.isArray(t)?t:[t],range:rr.Range.create(r,l),severity:n,uri:e,linkedTo:i.map(({range:p,uri:m})=>({range:p,uri:m,templateStrings:[]})),tags:s,templateStrings:o,edit:a,codeActionTitle:c},d;return{raw:u,diagnostic:()=>(d??={severity:u.severity,range:u.range,message:RU(u),relatedInformation:[...u.linkedTo.map(p=>({message:u.issues.map(PU).join(" or "),location:{uri:ue(p.uri),range:p.range}}))],source:"devicetree",tags:u.tags,data:{type:"FormattingIssues",items:u.issues,edit:u.edit,codeActionTitle:u.codeActionTitle,virtual:!!u.virtual}},d)}}var JE=(t,e)=>[...t].sort((n,i)=>{let s=e.getSortKey(n),o=e.getSortKey(i);if(s===void 0||o===void 0)throw new Error("Sort keys must be set");if(s!==o)return s-o;let a=n.lastToken,c=i.lastToken;return a.pos.line!==c.pos.line?a.pos.line-c.pos.line:a.pos.col-c.pos.col});async function Pt(t,e,r){let n=Pe(t.textDocument.uri);if(!e)return[];let i=performance.now(),s=await e.getRuntime(),o,a,c=s.context.allParsers.flatMap(u=>u.injectedMacros).find(u=>Pr(u,n,t.position));return c&&(o={runtime:s,item:null,ast:Hn(c,n,t.position)},a=Number.MAX_SAFE_INTEGER),o||(o=s.getDeepestAstNode(n,t.position),a=e.getSortKey(o?.ast)),console.log(`search: ${performance.now()-i}ms`),r(o,u=>{let d=t.position;if(pe(u.uri,n)){let f=u.lastToken;return f.pos.line<d.line||f.pos.line===d.line&&f.pos.colEnd<=d.character}return a!==void 0&&(e.getSortKey(u)??-1)<=a})}function oe(t,e){return{start:t,end:e??t}}var U=(t,e)=>t?.tokens.some(r=>r===e),rt=(t,e)=>r=>r?.value&&(e?.caseInsensitive?t.toLowerCase()===r.value.toLowerCase():t===r.value)?"yes":e?.allowPartial?yU(t)(r):"no",Me=t=>e=>e?.tokens.some(r=>r===t)?"yes":"no",yU=t=>e=>e?.value&&t.startsWith(e.value)?"partial":"no",nr=(t,e)=>!!t&&!!e&&t.pos.line===e.pos.line&&pe(t.uri,e.uri),Bt=(t,e)=>t?.tokens[0]===21&&e?.tokens[0]===21&&(t?.prevToken&&t.prevToken.value===e?.value||e?.prevToken&&e.prevToken.value===t?.value)?!0:!!t&&!!e&&t.pos.colEnd===e.pos.col&&nr(t,e),Of=t=>t.map((e,r)=>({index:r,context:e,files:e.getContextFiles()})),Tn=(t,e,r,n)=>{if("id"in e){let s=t?.find(o=>o.id===e.id);return s||void 0}if("name"in e){let s=t?.find(o=>o.ctxNames.includes(e.name));return s||void 0}return r?.getContextFiles().find(s=>pe(s,e.uri))?r:Of(t).sort(s=>s.context.id===n?-1:0).find(s=>s.files.some(o=>pe(o,e.uri)))?.context},lT=(t,e)=>Of(t).filter(n=>n.files.some(i=>pe(i,e))).map(n=>n.context),QE=t=>{let e=/^(\w+)\s+(.*)$/,r=/^(\w+)\(([^)]*)\)\s+(.*)$/,n=/^(\w+)\(([^)]*),\s*\.\.\.\)\s+(.*)$/,i;if(i=n.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l=l.replace(/__VA_ARGS__/g,c.slice(a.length).join(", ")),l}}else if(i=r.exec(t)){let[,,s,o]=i,a=s.split(",").map(c=>c.trim());return(...c)=>{let l=o;return a.forEach((u,d)=>{let f=new RegExp(`\\b${u}\\b`,"g");l=l.replace(f,c[d])}),l}}else if(i=e.exec(t)){let[,,s]=i;return s.trim()}};function TU(t){if(!t.trim())return[];let e=[],r="",n=0;for(let i=0;i<t.length;i++){let s=t[i];s===","&&n===0?(e.push(r.trim()),r=""):(s==="("?n++:s===")"&&n--,r+=s)}return r.trim()&&e.push(r.trim()),e}var vU=0,Mc=(t,e)=>{let r=o=>o.replace(/\s*##\s*/g,""),n=o=>o.replace(/#(\w+)/g,(a,c)=>`"${c}"`),i=t,s;do s=i,i=r(s),i=n(i),i=i.replace(/\b(\w+)\(([^()]*(?:\([^()]*\)[^()]*)*)\)|\b(\w+)\b/g,(o,a,c,l)=>{if(a==="defined"){let u=c.split(",").map(d=>d.trim());return u[0]?e.get(u[0])?.resolver:u}else if(a&&typeof e.get(a)?.resolver=="function"){let u=TU(c).map(d=>d.trim()).map(d=>d==="__COUNTER__"?(vU++).toString():d).map(d=>Mc(d,e));return(e.get(a)?.resolver)(...u)}else if(l&&typeof e.get(l)?.resolver=="string")return e.get(l)?.resolver;return o});while(i!==s);return i};function uT(t){return t.replace(/'(.)'/g,(e,r)=>r.charCodeAt(0).toString()).replace(/(0x[a-f\d]+|\d+)[ul]*/gi,"$1")}function Ce(t){try{return(0,eval)(uT(t))}catch{}return t}var ue=t=>oT.default.pathToFileURL(t).toString(),Pe=t=>st(oT.default.fileURLToPath(t)),ZE=(t,e)=>{let r=(0,na.relative)(t,e);return!!r&&!r.startsWith("..")&&!(0,na.isAbsolute)(r)},pe=(t,e)=>!t||!e?!1:t===e,st=t=>(0,na.normalize)(process.platform==="win32"?t.toLowerCase():t),Ii=t=>(0,KE.createHash)("sha256").update([st(t.dtsFile),...t.includePaths.map(st),...t.overlays.map(st),t.bindingType,...t.zephyrBindings.map(st),...t.deviceOrgBindingsMetaSchema.map(st),...t.deviceOrgTreeBindings.map(st),`showFormattingErrorAsDiagnostics-${t.showFormattingErrorAsDiagnostics}`,`disableFileWatchers-${t.disableFileWatchers}`].join(":")).digest("hex"),bU=t=>{switch(t){case 0:return"Expected value";case 1:return"Expected ';'";case 2:return"Expected '{'";case 3:return"Expected '}'";case 4:return"Expected '['";case 5:return"Expected ']'";case 12:return"Expected '>'";case 13:return"Expected '<'";case 16:return`Expected '"'`;case 17:return`Expected "'"\\`;case 24:return"Missing ':'";case 21:return"Missing '/'";case 26:return'Expected ")"';case 28:return'Missing ","';case 6:return"Expected property name";case 7:return"Expected node name";case 49:return"Node name shall start with a lower or upper case character";case 50:return"Node unit address should not start with 0x";case 51:return"Node unit address should not end with with ULL";case 8:return"Expected node address";case 9:return"Expected node path";case 48:return"Expected node path reference";case 10:return"Expected node reference";case 11:return"Expected root node name";case 14:return"Expected bytestring";case 15:return"Expected two digits for each byte in bytestring";case 20:return"Hex values are not allowed";case 18:return"Expected label name";case 19:return"Expected '/' at the start of a node path";case 23:return"Found ';' without a statement";case 25:return"Did you mean /delete-node/ or /delete-property/?";case 34:return"Did you mean /delete-node/?";case 35:return"Did you mean /delete-property/?";case 22:return"Unknown syntax";case 27:return"Expected expression";case 31:return"Expected macro identifier";case 30:return"Expected macro identifier or function like macro";case 29:return"White space is not allowed";case 32:return"Properties can only be defined in a node";case 53:return"Node name syntax can only be used inside a node definition.";case 33:return"Properties can only be deleted inside a node";case 36:return"Unable to resolve include";case 52:return"Unknown Node Address syntax";case 37:return"Expected start address";case 38:return"Expected end address";case 39:case 40:return"Expected 8|16|32|64";case 42:return"Unknown macro name";case 43:return"Expected function like macro";case 44:return"Macro expects less arguments";case 45:return"Macro expects more arguments";case 46:return"Missing #ENDIF";case 47:return"Block Unused";case 41:return"This syntax is not officially part of the DTS V0.4 standard"}},SU=t=>t.issues.map(e=>{switch(e){case 0:return`Property "${t.templateStrings[0]}" is replaced by a later definition`;case 1:return"Cannot delete a property before it has been defined";case 2:return"Node name already defined";case 5:return"Cannot delete a node before it has been defined";case 3:return`No node with that reference "${t.templateStrings[0]}" has been defined`;case 8:return`No node with name "${t.templateStrings[0]}" could be found in "/${t.templateStrings[1]}".`;case 4:return`Label name "${t.templateStrings[0]}" already defined`;case 6:return`Property "${t.templateStrings[0]}" was deleted`;case 7:return`Node "${t.templateStrings[0]}" was deleted`;case 9:return`The following node "${t.templateStrings[1]}" shall be present in "${t.templateStrings[0]}" node.`;case 10:return`The following node "${t.templateStrings[0]}" address range collides with another node. Address start: "${t.templateStrings[1]}", end: "${t.templateStrings[2]}".`}}).join(" or "),_U=(t,e)=>{switch(t){case 0:return"Property name already defined.";case 2:return"Defined here";case 4:return"Defined here";case 7:case 6:return"Deleted here";case 9:return"Node";case 10:return`Node "${e[0]}". Address start: "${e[1]}", end: "${e[2]}".`;default:return"TODO"}},kU=t=>t.issues.map(e=>{switch(e){case 9:return`Only these value are allowed ${t.templateStrings[0]}`;case 1:return"INTRO should be empty";case 8:return"INTRO can only be assigned one value";case 5:return"INTRO should be assigned a U32";case 6:return"INTRO should be assigned a U64";case 7:return"INTRO should be assigned a 'property encoded array'";case 2:return"INTRO should be assigned a string";case 3:return"INTRO should be assigned a string list";case 4:return`INTRO expects ${t.templateStrings[1]} values`;case 0:return"INTRO is required";case 11:return"INTRO should be omitted";case 27:return"INTRO name is not permitted under this node";case 34:return"INTRO name is not defined in the type binding for this node";case 10:return"INTRO address value must match node address";case 12:return"INTRO should be 'cpu'";case 13:return"INTRO should be 'memory'";case 14:return"INTRO is deprecated and should not be used'";case 15:return`INTRO ${t.templateStrings[1]}'`;case 18:return"INTRO value must be unique in the entire Devicetree";case 19:return`INTRO should have format ${t.templateStrings[1]}`;case 16:return`INTRO requires property "${t.templateStrings[1]}" in node path "${t.templateStrings[2]}"`;case 17:return"Unable to resolve interrupt parent node";case 20:return`INTRO should have format ${t.templateStrings[1]}`;case 21:return"Node is disabled";case 22:return"Unable to resolve handle";case 23:return`Unable to find "${t.templateStrings[0]}" in ${t.templateStrings[1]}`;case 24:return t.templateStrings[0];case 25:return t.templateStrings[0];case 26:return t.templateStrings[0];case 28:return t.templateStrings[0];case 35:return"Unable to find mapping range for address";case 29:return`INTRO exceeds address space available for this mapping. The range ends at ${t.templateStrings[2]}, the node ends at ${t.templateStrings[1]}`;case 30:return"Map entry overlaps with others entries";case 31:return"Unable to match to a nexus map entry";case 32:return`Unknown node type "${t.templateStrings[0]}"`;case 33:return`Missing name for "${t.templateStrings[0]}" index ${t.templateStrings[1]}"`;case 36:return"Node address is missing";case 37:return`Binding should be used on bus type${t.templateStrings.length?"s":""}: ${t.templateStrings.join(" or ")}`}}).join(" or ").replace("INTRO",`Property "${t.templateStrings[0]}"`).replaceAll("INTRO ",""),NU=t=>{switch(t){case 16:case 0:return"Node";case 15:return"Ignored reason";case 18:return"Conflicting properties";case 8:return"Additional value";case 21:return"Disabled by";case 29:return"Mapping range";case 30:return"Map entry";case 31:return"Nexus map entries";case 33:return"Names property";case 35:return"Range property";default:return"TODO"}},RU=t=>t.issues.map(e=>{switch(e){case 4:return"Add end of line to end of file";case 1:return`${t.codeActionTitle}. Expecting ${t.templateStrings[0]}.`;case 0:return"Move to a new line";case 3:return"Remove trailing whitespace at the end of file.";case 2:return"Remove trailing whitespace at the end of the line.";case 5:return`Fix indentation. ${t.templateStrings.at(0)?.length===0?"No indentation expected":`Expecting ${t.templateStrings[0]}`}`;case 6:return`Move token "${t.templateStrings[0]}" next to expression`;case 7:return"Remove (...) enclosure. This expression should only be enclosed in the #define of the macro";case 8:return`Line is too long. ${t.codeActionTitle}`;case 9:return`Hex values must be lowercase. ${t.codeActionTitle}`}}).join(" or "),PU=t=>"TODO",yn=(t,e)=>{let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[t.length-r+n]??0,s=e[e.length-r+n]??0;if(i<s)return-1;if(i>s)return 1}return 0},as=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0,c=o+a+i;n[r-1-s]=c>>>0,i=c>4294967295?1:0}return i&&n.unshift(1),n},EU=(t,e)=>{let r=Math.max(t.length,e.length),n=new Array(r).fill(0),i=0;for(let s=0;s<r;s++){let o=t[t.length-1-s]??0,a=e[e.length-1-s]??0;o-=i,o<a?(o+=4294967296,i=1):i=0,n[r-1-s]=o-a>>>0}for(;n.length>1&&n[0]===0;)n.shift();return n},wU=(t,e)=>as(t,e),ew=(t,e)=>{let r=[];for(let n of t){let i=n.childAddress,s=n.length,o=as(i,s);if(yn(e,i)>=0&&yn(e,o)<0){let a=EU(e,i),c=n.parentAddress,l=wU(c,a),u=as(c,s);r.push({start:l,end:u,range:tn(n.rangeTokens.start,n.rangeTokens.end),uri:n.rangeTokens.start.uri})}}return r};function tw(t){return Array.isArray(t)&&Array.isArray(t[0])}function Bc(t){return!t||t instanceof hr?t:Bc(t.parentNode)}function ia(t,e){let r=t.getText(),n=e.slice().sort((s,o)=>{let a=t.offsetAt(s.range.start),c=t.offsetAt(o.range.start);if(a!==c)return c-a;let l=t.offsetAt(s.range.end),u=t.offsetAt(o.range.end);if(l!==u)return u-l;let d=a===l&&s.newText.length>0,f=c===u&&o.newText.length>0;return d!==f?d?1:-1:0}),i=r;for(let s of n){let o=t.offsetAt(s.range.start),a=t.offsetAt(s.range.end);i=i.slice(0,o)+s.newText+i.slice(a)}return i}function GE(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}function rw(t,e){return GE(t.end,e.start)>0&&GE(t.start,e.end)<0}var nw=(t,e)=>{let r=iw(t,e),n=sw(t,e);r&&(t.topComment=r),n&&(t.endComment=n)},iw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.lastToken===t.firstToken.prevToken&&(i.lastToken.pos.line===t.firstToken.pos.line||i.lastToken.pos.line+1===t.firstToken.pos.line));if(!r||r.astBeforeComment)return;r.astAfterComment=t;let n=iw(r,e);return n&&(n.astAfterComment=t,r.astAfterComment=void 0),n??r},sw=(t,e)=>{let r=e.find(i=>!i.disabled&&i.firstToken.prevToken===t.lastToken&&i.firstToken.pos.line===t.lastToken.pos.line);if(!r)return;r.astBeforeComment=t;let n=sw(r,e);return n&&(n.astBeforeComment=t,r.astBeforeComment=void 0),n??r},Xs=(t,e,r)=>{let n=[42,44,45,36];return r||n.push(52,32,53,8,49),t.severity===rr.DiagnosticSeverity.Error&&pe(t.uri,e)&&!n.some(i=>t.issues.includes(i))};function xf(t){let e=t?.charAt(0);return!!e&&(e>="A"&&e<="Z"||e>="a"&&e<="z")}var Mf=t=>{if(t)return t instanceof Fe?t:Mf(t?.parentNode)},Js=(t,e,r=0)=>{if(!e||!e.parentNode?.uri)return r;let n=Mf(e.parentNode);return Js(t,n,r+1)};function ow(t,e,r,n){let i=r-e,s=n.length,o=t.length-i+s,a=new Array(o),c=0;for(let l=0;l<e;l++,c++)a[c]=t[l];for(let l=0;l<s;l++,c++)a[c]=n[l];for(let l=r;l<t.length;l++,c++)a[c]=t[l];return a}var Zc=require("fs"),ha=require("path"),to=q(j());var JC=require("path"),bn=q(j());var Er=class extends Q{constructor(r,n,i,s){super();this.startLabels=r;this.value=n;this.endLabels=i;this.bits=s;this.startLabels.forEach(o=>{this.addChild(o)}),this.addChild(s),this.addChild(n),this.endLabels.forEach(o=>{this.addChild(o)})}toString(){return`${[this.value?.toString()??"NULL",...this.endLabels.map(r=>r.toString())].join(" ")}`}toPrettyString(r){return`${[this.value?.toPrettyString(r)??"NULL",...this.endLabels.map(n=>n.toString())].join(" ")}`}toJson(){return this.value?.toJson()}};var Vt=t=>t instanceof Rr?!0:t instanceof Fe?!1:t.parentNode?Vt(t.parentNode):!1;var dT=t=>{if(t instanceof We)return t;if(!(t instanceof Fe))return t.parentNode?dT(t.parentNode):void 0},Qs=t=>!t||t instanceof We?!1:t instanceof Er||Qs(t.parentNode),sa=t=>[...t.map(e=>{if(e instanceof Xe||e instanceof Ot)return e.name;if(e instanceof mr)return e.reference})].filter(e=>!!e),fT=(t,e)=>e?e.parentNode===t||fT(t,e.parentNode):!1;var At=q(j());var aw=q(j());var Vn=class extends Q{constructor(){super();this._pathParts=[]}addPath(r,n){this._pathParts.push(r),n&&this.addChild(n),this.addChild(r)}get pathParts(){return[...this._pathParts]}toString(){return this._pathParts.map(r=>r?.toString()??"<NULL>").join("/")}buildSemanticTokens(r){this._children.forEach(n=>{n instanceof xe?n.buildSemanticTokens(r):r(Di("operator"),Ai("declaration"),n.firstToken,n.lastToken)})}},ot=class extends Q{constructor(r){super();this.path=r;this.docSymbolsMeta={name:`/${this.path?.toString()??""}`,kind:aw.SymbolKind.Namespace},this.addChild(r)}toString(){return`&${this.path?.toString()??"NULL"}`}toJson(){return-1}serialize(){return{type:"NODE_PATH",nodePath:this.path?.toString()??null,uri:this.serializeUri,range:this.range,issues:this.serializeIssues}}};function CU(t){switch(t){case"EMPTY":return"EMPTY";case"U32":return"U32";case"U64":return"U64";case"STRING":return"STRING";case"PROP_ENCODED_ARRAY":return"PROP_ENCODED_ARRAY";case"STRINGLIST":return"STRINGLIST";case"BYTESTRING":return"BYTESTRING";case"ANY":return"ANY";case"UNKNOWN":return"UNKNOWN"}}var Y=class{constructor(e,r,n="optional",i=void 0,s,o){this.name=e;this.type=r;this.def=i;this.additionalTypeCheck=o;this.hideAutoComplete=!1;this.list=!1;this.onHover=()=>({kind:At.MarkupKind.Markdown,value:["### Type","**DTS native type** ",`${this.type.map(e=>e.types.map(CU).join(" or ")).join(",")}
|
|
183
183
|
|
|
184
184
|
`,...this.bindingType?["**Binding type** ",`${this.bindingType}
|
|
185
185
|
|
|
@@ -248,7 +248,7 @@ If a CPU/thread can be the target of an external interrupt the reg property valu
|
|
|
248
248
|
If a CPU/thread cannot be the target of an external interrupt, then reg must be unique and out of bounds of the range addressed by the interrupt controller
|
|
249
249
|
If a CPU/thread's PIR (pending interrupt reg-ister) is modifiable, a client program should modify PIR to match the reg property value.
|
|
250
250
|
If PIR cannot be modified and the PIR value is distinct from the interrupt controller number space, the CPUs binding may define a binding-specific representation of PIR values if desired.`],t}var zC=()=>{let t=new Y("alignment",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Ur.create(a)),i?.length!==s){let a=e.ast.values??e.ast;n.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:e.parent.sizeCells(r)},()=>"size")}>`]}))}return n});return t.description=["Address boundary for alignment of allocation."],t};var WC=()=>{let t=new Y("alloc-ranges",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=e.parent.addressCells(r),s=e.parent.sizeCells(r),o=[...Array.from({length:i},(c,l)=>`address${i>1?l:""}`),...Array.from({length:s},(c,l)=>`size${s>1?l:""}`)];t.signatureArgs=o.map(c=>Ur.create(c)),t.signatureArgsCyclic=!0;let a=Le(e.ast.values);if(!a)return[];if(a.length===0||a.length%(i+s)!==0){let c=a.at(a.length-a.length%(s+i))??e.ast;return n.push(F(19,c.firstToken,c.lastToken,c,{templateStrings:[e.name,`<${[...Array.from({length:i},()=>"address"),...Array.from({length:s},()=>"size")].join(" ")}>`]})),n}return n});return t.description=["Specifies regions of memory that are acceptable to allocate from"],t};var GC=()=>{let t=new Y("no-map",z("EMPTY"),"optional");return t.description=[`Indicates the operating system must not create a virtual mapping of the region as part of its standard mapping of system memory, nor permit speculative access to it under
|
|
251
|
-
any circumstances other than under the control of the device driver using the region.`],t};var KC=()=>{let t=new Y("reusable",z("EMPTY"),"optional");return t.description=["The operating system can use the memory in this region with the limitation that the device driver(s) owning the region need to be able to reclaim it back. Typically that means that the operating system can use that region to store volatile or cached data that can be otherwise regenerated or migrated elsewhere."],t};var YC=()=>{let t=new Y("size",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Ur.create(a)),i?.length!==e.parent.sizeCells(r)){let a=e.ast.values??e.ast;n.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return n});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function XC(){let t=gr(),e=t.properties.find(r=>r.name==="reg");return e.required=()=>"optional",t.addProperty([YC(),zC(),WC(),GC(),KC()]),t}function Zs(t){switch(t?.name){case"/":return LC();case"aliases":return $C();case"memory":return FC();case"reserved-memory":return jC();case"chosen":return UC();case"cpus":return HC();case"cpu":return VC()}return t?.parent?.name==="reserved-memory"?XC():gr()}var X=class t{constructor(e,r,n,i=null){this.bindingLoader=e;this.name=r;this.address=n;this.parent=i;this.referencedBy=[];this.definitions=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}static toJson(e){let r={};return e.properties.forEach(n=>r[n.name]=n.ast.values?.toJson()??!0),e.nodes.forEach(n=>r[n.fullName]=t.toJson(n)),r}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;let e=this.parent?.nodeType?.childNodeType?.(this);return e?(this._nodeTypes=[e],this._nodeTypes):(this._nodeTypes=this.bindingLoader?.getNodeTypes(this).type??[Zs(this)],this._nodeTypes)}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(r=>r===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.referencedBy.some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return sa([...this.definitions,...this.referencedBy])}getDeepestAstNode(e,r){let n=[...this.definitions,...this.referencedBy].find(i=>Pr(i,e,r));if(n){let i=this.deletes.map(c=>({item:this,ast:Un(c,e,r),beforeAst:$c(c,e,r),afterAst:qc(c,e,r)})).find(c=>Pr(c.ast,e,r));if(i)return i;let s=[...this._properties.flatMap(c=>[c,...c.allReplaced]),...this._deletedProperties.flatMap(c=>[c.property,...c.property.allReplaced])].map(c=>({item:c,ast:c.ast})).find(c=>Pr(c.ast,e,r)||c.ast.lastToken.value!==";"&&YE(c.ast,e,r));if(s)return s.item.getDeepestAstNode(e,r);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,r)).find(c=>c);if(o)return o;let a=Un(n,e,r);return{item:this,ast:a,beforeAst:$c(a,e,r),afterAst:qc(a,e,r)}}}get labels(){return[...this.referencedBy.flatMap(e=>e.labels),...this.definitions.filter(e=>e instanceof Xe).flatMap(e=>e.labels)]}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this}))}get allBindingsProperties(){return[...this.properties.filter(e=>e.name==="compatible"),...this._nodes.flatMap(e=>e.allBindingsProperties)]}get allDescendantsLabels(){return[...this.labels,...this._nodes.flatMap(e=>e.allDescendantsLabels)]}get allDescendantsLabelsMapped(){return[...this.labelsMapped,...this.properties.flatMap(e=>e.labelsMapped),...this._nodes.flatMap(e=>e.allDescendantsLabelsMapped)]}getOverlappingNodeAddressesIssues(e){return this._nodes.filter(r=>!r.disabled).flatMap(r=>{let n=r.regArray(e),i=this._nodes.filter(s=>s!==r&&!s.disabled);return n?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>yn(c.startAddress,s.endAddress)<0&&yn(s.startAddress,c.endAddress)<0).flatMap(c=>({reg:c,node:a}))).filter(a=>!!a);return o.length?Ft(10,s.rangeTokens.start,s.rangeTokens.end,r.definitions[0],{severity:bn.DiagnosticSeverity.Information,linkedTo:o.map(a=>({range:tn(a.reg.rangeTokens.start,a.reg.rangeTokens.end),uri:a.reg.rangeTokens.start.uri})),templateStrings:[r.fullName,`0x${s.startAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`,`0x${s.endAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`],linkedToTemplateStrings:o.map(a=>[a.node.fullName,`0x${a.reg.startAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`,`0x${a.reg.endAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`])}):[]})??[]})}getIssues(e){let r=[...this.properties.flatMap(n=>n.issues),...this._nodes.flatMap(n=>n.getIssues(e)),...this._deletedNodes.flatMap(n=>n.node.getIssues(e)),...this.deletedPropertiesIssues,...this.deletedNodesIssues,...this.missingBinding,...this.getOverlappingNodeAddressesIssues(e)];if(this.name==="/"&&this.definitions.length&&!this._nodes.some(n=>n.name==="cpus")){let n=this.definitions[this.definitions.length-1],i=n.name??n;r.push(Ft(9,i.firstToken,i.lastToken,i,{severity:bn.DiagnosticSeverity.Error,linkedTo:this.definitions.slice(0,-1),templateStrings:["/","cpus"]}))}return r}get deletedPropertiesIssues(){return[...this._deletedProperties.flatMap(e=>[Ft(6,e.property.ast.firstToken,e.property.ast.lastToken,e.property.ast,{severity:bn.DiagnosticSeverity.Hint,tags:[bn.DiagnosticTag.Deprecated],linkedTo:[e.by],templateStrings:[e.property.name]}),...e.property.allReplaced.map(r=>Ft(6,r.ast.firstToken,r.ast.lastToken,r.ast,{severity:bn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[bn.DiagnosticTag.Deprecated],templateStrings:[e.property.name]})),...e.property.issues])]}get deletedNodesIssues(){return this._deletedNodes.flatMap(e=>[...[...e.node.definitions.filter(r=>r instanceof Xe),...e.node.referencedBy].flatMap(r=>{let n;return r instanceof Xe?n=r.name.toString():r.reference instanceof ie?n=r.reference.label.value:n=r.reference.path.pathParts.at(-1).name,Ft(7,r.firstToken,r.lastToken,r,{severity:bn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[bn.DiagnosticTag.Deprecated],templateStrings:[n]})})])}get path(){return this.parent?[...this.parent.path,this.fullName]:[this.fullName]}get pathString(){return`/${this.path.slice(1).join("/")}`}get properties(){return this._properties}get deletedProperties(){return this._deletedProperties}get nodes(){return this._nodes}get deletedNodes(){return this._deletedNodes}get propertyNames(){return this._properties.map(e=>e.name)}hasNode(e,r){return this._nodes.some(n=>n.name===e&&(n.address===r||n.address?.every((i,s)=>r?.at(s)===i)))}hasProperty(e){return this._properties.some(r=>r.name===e)}getProperty(e){return this._properties.find(r=>r.name===e)}deleteNode(e,r,n){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===n||n?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:r}),this._nodes.splice(i,1))}get root(){return this.parent?this.parent.root:this}#e;get phandle(){if(this.#e!==void 0)return this.#e;let e=this.getProperty("phandle")?.ast.values?.values.at(0)?.value;if(e instanceof gt){let r=e.values.at(0)?.value;if(r instanceof Yt)return this.#e=r.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(r=>r.getAllPhandle(e))]:this._nodes.flatMap(r=>r.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let r of this._nodes){let n=r.getPhandle(e);if(n)return n}}getNode(e,r,n=!0){let i=n||!!r||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===r||o.address?.every((a,c)=>r?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,r){let n=this._properties.findIndex(i=>i.name===e);n!==-1&&(this._deletedProperties.push({property:this._properties[n],by:r}),this._properties.splice(n,1))}addNode(e){this._nodes.push(e)}addProperty(e){let r=this._properties.findIndex(n=>n.name===e.name);if(r===-1)this._properties.push(e);else{let n=this._properties.splice(r,1)[0];this._properties.push(e),e.replaces=n,n.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let n=this.bindingLoader.getNodeTypes(this);this._nodeTypes=n.type,this.missingBinding.push(...n.issues)}else this._nodeTypes=[Zs(this)]}getChild(e,r=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let n=[...e];n.splice(0,1);let i=n[0].split("@"),s=i[0],o=i[1]!==void 0?i[1].split(",").map(c=>Number.parseInt(c,16)):void 0,a=this.getNode(s,o,r);return n.length===1||!a?a:a.getChild(n)}getChildFromScope(e,r){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let n=[...e];return n.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!r(s.by)).map(s=>s.node)].find(s=>s.fullName===n[0])?.getChildFromScope(n,r)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#t;regArray(e){if(this.#t!==void 0)return this.#t;let r=this.getProperty("reg");if(!r){this.#t=null;return}let n=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Le(r.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:n}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof ge))continue;let l=a.map(f=>f.evaluate(e)),u=c.map(f=>f.evaluate(e)),d=a.at(0)?.firstToken;!d||![...l,...u].every(f=>typeof f=="number")||s.push({startAddress:l,endAddress:as(l,u),size:u,rangeTokens:oe(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#t=s,this.#t}#n;rangeMap(e){if(this.#n!==void 0)return this.#n;let r=this.getProperty("ranges");if(!r){this.#n=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof ge))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#n=o,this.#n}#r;dmaRangeMap(e){if(this.#r!==void 0)return this.#r;let r=this.getProperty("dma-ranges");if(!r){this.#r=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof ge))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#r=o,this.#r}parentAddressCells(e){return this.parent?.addressCells(e)??2}parentSizeCells(e){return this.parent?.sizeCells(e)??1}#o;addressCells(e){if(this.#o!==void 0)return this.#o;let r=this?.getProperty("#address-cells");return this.#o=r?Be(r,0,0,e)??2:2,this.#o}#f;sizeCells(e){if(this.#f!==void 0)return this.#f;let r=this.getProperty("#size-cells");return this.#f=r?Be(r,0,0,e)??1:1,this.#f}#a;mappedReg(e){if(this.#a!==void 0)return this.#a;let r=this.parent?.rangeMap(e),n=this.regArray(e);return this.#a=n?.flatMap(i=>{let s=i.startAddress,o=i.size,a=as(s,o),c={startAddress:s,startAddressRaw:s,size:o,endAddress:a,endAddressRaw:a,inMappingRange:!1,regRangeTokens:{start:i.rangeTokens.start,end:i.rangeTokens.end},missingMapping:!1};if(!r)return[c];let l=ew(r,s);return l.length?l.map(u=>(c.mappedAst={range:u.range,uri:u.uri},c.startAddress=u.start,c.endAddress=as(u.start,o),c.inMappingRange=yn(c.endAddress,u.end)<=0,c.mappingEnd=u.end,{...c,mappedAst:{range:u.range,uri:u.uri},startAddress:u.start,endAddress:as(u.start,o),inMappingRange:yn(c.endAddress,u.end)<=0,mappingEnd:u.end})):(c.missingMapping=!0,[c])}).sort((i,s)=>yn(i.endAddress,s.endAddress))??[],this.#a}get interruptsParent(){if(this.getProperty("interrupts-extended"))return null;let e=this.bindingLoader?.type==="Zephyr",r=this.getProperty("interrupt-parent"),n=r?vn(r?.ast.values?.values.at(0),this.root):e?void 0:this.parent;return!e||r?{interruptParent:r,parentInterruptNode:n??null}:n?{interruptParent:r,parentInterruptNode:n??null}:this.parent?this.parent.interruptsParent:{parentInterruptNode:this}}getNexusMapEntryMatch(e,r,n,i=[]){let s=new Q(oe(n[0].firstToken,n.at(-1).lastToken)),o=this.getNexusMap(e,r);if(o){let a=[...i.map((l,u)=>l&(o.mapMask.at(u)??4294967295)),...n.map((l,u)=>{let d=l instanceof ge?l.evaluate(r):l;return(typeof d=="number"?d&(o.mapMask.at(u+i.length)??4294967295):d).toString()})].join(":"),c=o.map.find(l=>l.mappingValues.map(u=>(u instanceof ge?u.evaluate(r):u).toString()).join(":")===a);return{entry:s,match:c}}return{entry:s}}getNexusMap(e,r){let n=this.getProperty(`${e}-map`),i=Le(n?.ast.values);if(!i?.length)return;let s=this.root,o=this.getProperty(`#${e}-cells`);if(!o)return;let a=Be(o,0,0,r);if(a==null)return;e==="interrupt"&&(a+=this.addressCells(r));let c=[],l=0;for(;l<i.length;){let f=i.slice(l,a+l);if(l+=a,i.length<l+1)break;let p=vn(i[l],s);if(!p)break;let m=p.getProperty(`#${e}-cells`);if(!m)return;l++;let h=Be(m,0,0,r);if(h==null||(e==="interrupt"&&(h+=p.addressCells(r)),l+=h,i.length<l))break;let T=i.slice(l-h,l);c.push({mappingValues:f,node:p,parentValues:T})}let u=this.getProperty(`${e}-map-mask`);return{mapMask:Array.from({length:a}).map((f,p)=>(u?Be(u,0,p,r):void 0)??4294967295),map:c}}uniqueLabels(){return Array.from(new Set(this.labels.map(e=>e.toString())))}toTooltipString(e){return`${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
|
|
251
|
+
any circumstances other than under the control of the device driver using the region.`],t};var KC=()=>{let t=new Y("reusable",z("EMPTY"),"optional");return t.description=["The operating system can use the memory in this region with the limitation that the device driver(s) owning the region need to be able to reclaim it back. Typically that means that the operating system can use that region to store volatile or cached data that can be otherwise regenerated or migrated elsewhere."],t};var YC=()=>{let t=new Y("size",z("PROP_ENCODED_ARRAY"),"optional",void 0,[],(e,r)=>{let n=[],i=Le(e.ast.values),s=e.parent.sizeCells(r),o=[...Array.from({length:s},(a,c)=>`size${s>1?c:""}`)];if(t.signatureArgs=o.map(a=>Ur.create(a)),i?.length!==e.parent.sizeCells(r)){let a=e.ast.values??e.ast;n.push(F(19,a.firstToken,a.lastToken,a,{templateStrings:[e.name,`<${Array.from({length:s},()=>"size")}>`]}))}return n});return t.description=["Size in bytes of memory to reserve for dynamically allocated regions."],t};function XC(){let t=gr(),e=t.properties.find(r=>r.name==="reg");return e.required=()=>"optional",t.addProperty([YC(),zC(),WC(),GC(),KC()]),t}function Zs(t){switch(t?.name){case"/":return LC();case"aliases":return $C();case"memory":return FC();case"reserved-memory":return jC();case"chosen":return UC();case"cpus":return HC();case"cpu":return VC()}return t?.parent?.name==="reserved-memory"?XC():gr()}var X=class t{constructor(e,r,n,i=null){this.bindingLoader=e;this.name=r;this.address=n;this.parent=i;this.referencedBy=[];this.definitions=[];this._properties=[];this._deletedProperties=[];this._deletedNodes=[];this.deletes=[];this._nodes=[];this.linkedNodeNamePaths=[];this.linkedRefLabels=[];this.interrupControlerMapping=[];this.spesifierNexusMapping=[];this.missingBinding=[];i?.addNode(this)}static toJson(e){let r={};return e.properties.forEach(n=>r[n.name]=n.ast.values?.toJson()??!0),e.nodes.forEach(n=>r[n.fullName]=t.toJson(n)),r}get disabled(){return this.getProperty("status")?.ast.quickValues?.at(0)==="disabled"}get nodeTypes(){if(this._nodeTypes)return this._nodeTypes;let e=this.parent?.nodeType?.childNodeType?.(this);return e?(this._nodeTypes=[e],this._nodeTypes):(this._nodeTypes=this.bindingLoader?.getNodeTypes(this).type??[Zs(this)],this._nodeTypes)}get nodeType(){return this.nodeTypes.find(e=>!e.onBus||this.parent?.nodeType?.bus?.some(r=>r===e.onBus))}isChildOf(e){return this.parent?this.parent===e?!0:this.parent.isChildOf(e):!1}getReferenceBy(e){return this.referencedBy.some(r=>r===e)?this:[...this._nodes,...this._deletedNodes.map(r=>r.node)].map(r=>r.getReferenceBy(e)).find(r=>r)}get nodeNameOrLabelRef(){return sa([...this.definitions,...this.referencedBy])}getDeepestAstNode(e,r){let n=[...this.definitions,...this.referencedBy].find(i=>Pr(i,e,r));if(n){let i=this.deletes.map(c=>({item:this,ast:Hn(c,e,r),beforeAst:$c(c,e,r),afterAst:qc(c,e,r)})).find(c=>Pr(c.ast,e,r));if(i)return i;let s=[...this._properties.flatMap(c=>[c,...c.allReplaced]),...this._deletedProperties.flatMap(c=>[c.property,...c.property.allReplaced])].map(c=>({item:c,ast:c.ast})).find(c=>Pr(c.ast,e,r)||c.ast.lastToken.value!==";"&&YE(c.ast,e,r));if(s)return s.item.getDeepestAstNode(e,r);let o=[...this._nodes,...this._deletedNodes.map(c=>c.node)].map(c=>c.getDeepestAstNode(e,r)).find(c=>c);if(o)return o;let a=Hn(n,e,r);return{item:this,ast:a,beforeAst:$c(a,e,r),afterAst:qc(a,e,r)}}}get labels(){return[...this.referencedBy.flatMap(e=>e.labels),...this.definitions.filter(e=>e instanceof Xe).flatMap(e=>e.labels)]}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this}))}get allBindingsProperties(){return[...this.properties.filter(e=>e.name==="compatible"),...this._nodes.flatMap(e=>e.allBindingsProperties)]}get allDescendantsLabels(){return[...this.labels,...this._nodes.flatMap(e=>e.allDescendantsLabels)]}get allDescendantsLabelsMapped(){return[...this.labelsMapped,...this.properties.flatMap(e=>e.labelsMapped),...this._nodes.flatMap(e=>e.allDescendantsLabelsMapped)]}getOverlappingNodeAddressesIssues(e){return this._nodes.filter(r=>!r.disabled).flatMap(r=>{let n=r.regArray(e),i=this._nodes.filter(s=>s!==r&&!s.disabled);return n?.flatMap(s=>{let o=i.flatMap(a=>a.regArray(e)?.filter(c=>yn(c.startAddress,s.endAddress)<0&&yn(s.startAddress,c.endAddress)<0).flatMap(c=>({reg:c,node:a}))).filter(a=>!!a);return o.length?Ft(10,s.rangeTokens.start,s.rangeTokens.end,r.definitions[0],{severity:bn.DiagnosticSeverity.Information,linkedTo:o.map(a=>({range:tn(a.reg.rangeTokens.start,a.reg.rangeTokens.end),uri:a.reg.rangeTokens.start.uri})),templateStrings:[r.fullName,`0x${s.startAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`,`0x${s.endAddress.map((a,c)=>a.toString(16).padStart(c?8:0,"0")).join("")}`],linkedToTemplateStrings:o.map(a=>[a.node.fullName,`0x${a.reg.startAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`,`0x${a.reg.endAddress.map((c,l)=>c.toString(16).padStart(l?8:0,"0")).join("")}`])}):[]})??[]})}getIssues(e){let r=[...this.properties.flatMap(n=>n.issues),...this._nodes.flatMap(n=>n.getIssues(e)),...this._deletedNodes.flatMap(n=>n.node.getIssues(e)),...this.deletedPropertiesIssues,...this.deletedNodesIssues,...this.missingBinding,...this.getOverlappingNodeAddressesIssues(e)];if(this.name==="/"&&this.definitions.length&&!this._nodes.some(n=>n.name==="cpus")){let n=this.definitions[this.definitions.length-1],i=n.name??n;r.push(Ft(9,i.firstToken,i.lastToken,i,{severity:bn.DiagnosticSeverity.Error,linkedTo:this.definitions.slice(0,-1),templateStrings:["/","cpus"]}))}return r}get deletedPropertiesIssues(){return[...this._deletedProperties.flatMap(e=>[Ft(6,e.property.ast.firstToken,e.property.ast.lastToken,e.property.ast,{severity:bn.DiagnosticSeverity.Hint,tags:[bn.DiagnosticTag.Deprecated],linkedTo:[e.by],templateStrings:[e.property.name]}),...e.property.allReplaced.map(r=>Ft(6,r.ast.firstToken,r.ast.lastToken,r.ast,{severity:bn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[bn.DiagnosticTag.Deprecated],templateStrings:[e.property.name]})),...e.property.issues])]}get deletedNodesIssues(){return this._deletedNodes.flatMap(e=>[...[...e.node.definitions.filter(r=>r instanceof Xe),...e.node.referencedBy].flatMap(r=>{let n;return r instanceof Xe?n=r.name.toString():r.reference instanceof ie?n=r.reference.label.value:n=r.reference.path.pathParts.at(-1).name,Ft(7,r.firstToken,r.lastToken,r,{severity:bn.DiagnosticSeverity.Hint,linkedTo:[e.by],tags:[bn.DiagnosticTag.Deprecated],templateStrings:[n]})})])}get path(){return this.parent?[...this.parent.path,this.fullName]:[this.fullName]}get pathString(){return`/${this.path.slice(1).join("/")}`}get properties(){return this._properties}get deletedProperties(){return this._deletedProperties}get nodes(){return this._nodes}get deletedNodes(){return this._deletedNodes}get propertyNames(){return this._properties.map(e=>e.name)}hasNode(e,r){return this._nodes.some(n=>n.name===e&&(n.address===r||n.address?.every((i,s)=>r?.at(s)===i)))}hasProperty(e){return this._properties.some(r=>r.name===e)}getProperty(e){return this._properties.find(r=>r.name===e)}deleteNode(e,r,n){let i=this._nodes.findIndex(s=>s.name===e&&(s.address===n||n?.every((o,a)=>s.address?.at(a)===o)));i!==-1&&(this._deletedNodes.push({node:this._nodes[i],by:r}),this._nodes.splice(i,1))}get root(){return this.parent?this.parent.root:this}#e;get phandle(){if(this.#e!==void 0)return this.#e;let e=this.getProperty("phandle")?.ast.values?.values.at(0)?.value;if(e instanceof gt){let r=e.values.at(0)?.value;if(r instanceof Yt)return this.#e=r.value,this.#e}}getAllPhandle(e){return e===this.phandle?[this,...this._nodes.flatMap(r=>r.getAllPhandle(e))]:this._nodes.flatMap(r=>r.getAllPhandle(e))}getPhandle(e){if(this.phandle===e)return this;for(let r of this._nodes){let n=r.getPhandle(e);if(n)return n}}getNode(e,r,n=!0){let i=n||!!r||this._nodes.filter(o=>o.name===e).length>1,s=this._nodes.findIndex(o=>o.name===e&&(!i||o.address===r||o.address?.every((a,c)=>r?.at(c)===a)));if(s!==-1)return this._nodes[s]}deleteProperty(e,r){let n=this._properties.findIndex(i=>i.name===e);n!==-1&&(this._deletedProperties.push({property:this._properties[n],by:r}),this._properties.splice(n,1))}addNode(e){this._nodes.push(e)}addProperty(e){let r=this._properties.findIndex(n=>n.name===e.name);if(r===-1)this._properties.push(e);else{let n=this._properties.splice(r,1)[0];this._properties.push(e),e.replaces=n,n.replacedBy=e}if(e.name==="compatible")if(this.bindingLoader){let n=this.bindingLoader.getNodeTypes(this);this._nodeTypes=n.type,this.missingBinding.push(...n.issues)}else this._nodeTypes=[Zs(this)]}getChild(e,r=!0){if(e.length===1&&e[0]==="/"&&this.name==="/")return this;let n=[...e];n.splice(0,1);let i=n[0].split("@"),s=i[0],o=i[1]!==void 0?i[1].split(",").map(c=>Number.parseInt(c,16)):void 0,a=this.getNode(s,o,r);return n.length===1||!a?a:a.getChild(n)}getChildFromScope(e,r){if(e.length===1&&e[0]===this.fullName)return this;if(e[0]!==this.fullName)return;let n=[...e];return n.splice(0,1),[...this._nodes,...this._deletedNodes.filter(s=>!r(s.by)).map(s=>s.node)].find(s=>s.fullName===n[0])?.getChildFromScope(n,r)}get fullName(){return this.address!==void 0?`${this.name}@${this.address.map(e=>e.toString(16)).join(",")}`:this.name}#t;regArray(e){if(this.#t!==void 0)return this.#t;let r=this.getProperty("reg");if(!r){this.#t=null;return}let n=this.parentAddressCells(e),i=this.parentSizeCells(e),s=[],o=Le(r.ast.values)?.reverse();for(;o?.length;){let a=Array.from({length:n}).map(()=>o.pop()),c=Array.from({length:i}).map(()=>o.pop());if(![...a,...c].every(f=>f instanceof ge))continue;let l=a.map(f=>f.evaluate(e)),u=c.map(f=>f.evaluate(e)),d=a.at(0)?.firstToken;!d||![...l,...u].every(f=>typeof f=="number")||s.push({startAddress:l,endAddress:as(l,u),size:u,rangeTokens:oe(d,c.at(-1)?.lastToken??a.at(-1)?.lastToken)})}return this.#t=s,this.#t}#n;rangeMap(e){if(this.#n!==void 0)return this.#n;let r=this.getProperty("ranges");if(!r){this.#n=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof ge))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#n=o,this.#n}#r;dmaRangeMap(e){if(this.#r!==void 0)return this.#r;let r=this.getProperty("dma-ranges");if(!r){this.#r=null;return}let n=this.sizeCells(e),i=this.addressCells(e),s=this.parentAddressCells(e),o=[],a=Le(r.ast.values)?.reverse();for(;a?.length;){let c=Array.from({length:i}).map(()=>a.pop()),l=Array.from({length:s}).map(()=>a.pop()),u=Array.from({length:n}).map(()=>a.pop());if(![...c,...l,...u].every(h=>h instanceof ge))continue;let d=c.map(h=>h.evaluate(e)),f=l.map(h=>h.evaluate(e)),p=u.map(h=>h.evaluate(e)),m=c.at(0)?.firstToken;!m||![...d,...f,...p].every(h=>typeof h=="number")||o.push({childAddress:d,parentAddress:f,length:p,rangeTokens:oe(m,u.at(-1).lastToken)})}return this.#r=o,this.#r}parentAddressCells(e){return this.parent?.addressCells(e)??2}parentSizeCells(e){return this.parent?.sizeCells(e)??1}#o;addressCells(e){if(this.#o!==void 0)return this.#o;let r=this?.getProperty("#address-cells");return this.#o=r?Be(r,0,0,e)??2:2,this.#o}#f;sizeCells(e){if(this.#f!==void 0)return this.#f;let r=this.getProperty("#size-cells");return this.#f=r?Be(r,0,0,e)??1:1,this.#f}#a;mappedReg(e){if(this.#a!==void 0)return this.#a;let r=this.parent?.rangeMap(e),n=this.regArray(e);return this.#a=n?.flatMap(i=>{let s=i.startAddress,o=i.size,a=as(s,o),c={startAddress:s,startAddressRaw:s,size:o,endAddress:a,endAddressRaw:a,inMappingRange:!1,regRangeTokens:{start:i.rangeTokens.start,end:i.rangeTokens.end},missingMapping:!1};if(!r)return[c];let l=ew(r,s);return l.length?l.map(u=>(c.mappedAst={range:u.range,uri:u.uri},c.startAddress=u.start,c.endAddress=as(u.start,o),c.inMappingRange=yn(c.endAddress,u.end)<=0,c.mappingEnd=u.end,{...c,mappedAst:{range:u.range,uri:u.uri},startAddress:u.start,endAddress:as(u.start,o),inMappingRange:yn(c.endAddress,u.end)<=0,mappingEnd:u.end})):(c.missingMapping=!0,[c])}).sort((i,s)=>yn(i.endAddress,s.endAddress))??[],this.#a}get interruptsParent(){if(this.getProperty("interrupts-extended"))return null;let e=this.bindingLoader?.type==="Zephyr",r=this.getProperty("interrupt-parent"),n=r?vn(r?.ast.values?.values.at(0),this.root):e?void 0:this.parent;return!e||r?{interruptParent:r,parentInterruptNode:n??null}:n?{interruptParent:r,parentInterruptNode:n??null}:this.parent?this.parent.interruptsParent:{parentInterruptNode:this}}getNexusMapEntryMatch(e,r,n,i=[]){let s=new Q(oe(n[0].firstToken,n.at(-1).lastToken)),o=this.getNexusMap(e,r);if(o){let a=[...i.map((l,u)=>l&(o.mapMask.at(u)??4294967295)),...n.map((l,u)=>{let d=l instanceof ge?l.evaluate(r):l;return(typeof d=="number"?d&(o.mapMask.at(u+i.length)??4294967295):d).toString()})].join(":"),c=o.map.find(l=>l.mappingValues.map(u=>(u instanceof ge?u.evaluate(r):u).toString()).join(":")===a);return{entry:s,match:c}}return{entry:s}}getNexusMap(e,r){let n=this.getProperty(`${e}-map`),i=Le(n?.ast.values);if(!i?.length)return;let s=this.root,o=this.getProperty(`#${e}-cells`);if(!o)return;let a=Be(o,0,0,r);if(a==null)return;e==="interrupt"&&(a+=this.addressCells(r));let c=[],l=0;for(;l<i.length;){let f=i.slice(l,a+l);if(l+=a,i.length<l+1)break;let p=vn(i[l],s);if(!p)break;let m=p.getProperty(`#${e}-cells`);if(!m)return;l++;let h=Be(m,0,0,r);if(h==null||(e==="interrupt"&&(h+=p.addressCells(r)),l+=h,i.length<l))break;let T=i.slice(l-h,l);c.push({mappingValues:f,node:p,parentValues:T})}let u=this.getProperty(`${e}-map-mask`);return{mapMask:Array.from({length:a}).map((f,p)=>(u?Be(u,0,p,r):void 0)??4294967295),map:c}}uniqueLabels(){return Array.from(new Set(this.labels.map(e=>e.toString())))}toTooltipString(e){return`${this.uniqueLabels().join(" ")}${this.labels.length?" ":""}${this.fullName} {${this.properties.length?`
|
|
252
252
|
`:""}${this.properties.map(r=>r.toPrettyString(e)).join(`
|
|
253
253
|
`)}${this.nodes.length?`
|
|
254
254
|
${this.nodes.map(r=>`${r.fullName}{ /* ... */ };`).join(`
|
|
@@ -266,30 +266,30 @@ ${" ".repeat(n)}`)}${this.nodes.length?`
|
|
|
266
266
|
${" ".repeat(n)}${this.nodes.map(o=>o.toFullString(e,r,n+1)).join(`
|
|
267
267
|
${" ".repeat(n)}`)}`:""}
|
|
268
268
|
${" ".repeat(n-1)}};`}serialize(e){let r=this.mappedReg(e),n=[...this.definitions,...this.referencedBy],i=this.nodeType;return{nodeType:i instanceof Et?{...this.nodeType,extends:Array.from(this.nodeType?.extends??[]),properties:i.properties.map(s=>({name:typeof s.name=="string"?s.name:s.name.toString(),nameIsRegex:typeof s.name!="string",allowedValues:s.allowedValues,type:s.type,description:s.description?.join(`
|
|
269
|
-
`),required:s.required(this)==="required"}))}:void 0,issues:n.flatMap(s=>s.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.fullName,labels:this.labels.map(s=>s.label.value),nodes:n.map(s=>s.serialize(e)),properties:this.properties.map(s=>({...s.ast.serialize(e),nexusMapEnty:s.nexusMapsTo.map(o=>({mappingValuesAst:o.mappingValuesAst.map(a=>a.serialize(e)),specifierSpace:o.specifierSpace,target:o.target.pathString,mapItem:o.mapItem?{parentValues:o.mapItem?.parentValues.map(a=>a.serialize(e)),target:o.mapItem.node.pathString,mappingValues:o.mapItem.mappingValues.map(a=>a.serialize(e))}:void 0}))})),childNodes:this.nodes.map(s=>s.serialize(e)),reg:r?.map(s=>({mappedStartAddress:s?.startAddress,mappedEndAddress:s?.endAddress,startAddress:s?.startAddressRaw,endAddress:s?.endAddressRaw,size:s?.size,inMappingRange:s?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)})),specifierNexusMappings:this.spesifierNexusMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)}))}}};var la=q(j());var ET=q(j());var ls=class extends Q{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:ET.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}},ir=class extends Q{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:ET.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(r){let n=this.parentNode;if(!(n instanceof ie&&n.linksTo)){super.buildSemanticTokens(r);return}r(Di("type"),Ai("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var Ze=class{constructor(e,r){this.ast=e;this.parent=r;this.nexusMapsTo=[]}getDeepestAstNode(e,r){let n=
|
|
269
|
+
`),required:s.required(this)==="required"}))}:void 0,issues:n.flatMap(s=>s.serializeIssues),path:this.pathString,disabled:this.disabled,name:this.fullName,labels:this.labels.map(s=>s.label.value),nodes:n.map(s=>s.serialize(e)),properties:this.properties.map(s=>({...s.ast.serialize(e),nexusMapEnty:s.nexusMapsTo.map(o=>({mappingValuesAst:o.mappingValuesAst.map(a=>a.serialize(e)),specifierSpace:o.specifierSpace,target:o.target.pathString,mapItem:o.mapItem?{parentValues:o.mapItem?.parentValues.map(a=>a.serialize(e)),target:o.mapItem.node.pathString,mappingValues:o.mapItem.mappingValues.map(a=>a.serialize(e))}:void 0}))})),childNodes:this.nodes.map(s=>s.serialize(e)),reg:r?.map(s=>({mappedStartAddress:s?.startAddress,mappedEndAddress:s?.endAddress,startAddress:s?.startAddressRaw,endAddress:s?.endAddressRaw,size:s?.size,inMappingRange:s?.inMappingRange})),interruptControllerMappings:this.interrupControlerMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)})),specifierNexusMappings:this.spesifierNexusMapping.map(s=>({cells:s.expressions.map(o=>o.serialize(e)),path:s.node.pathString,property:s.property.ast.serialize(e)}))}}};var la=q(j());var ET=q(j());var ls=class extends Q{constructor(r,n){super(n);this.label=r;this.docSymbolsMeta={name:this.label.value,kind:ET.SymbolKind.Constant},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration",this.addChild(r)}toString(){return`${this.label.toString()}:`}},ir=class extends Q{constructor(r,n){super(n);this.value=r;this.docSymbolsMeta={name:this.value,kind:ET.SymbolKind.Variable},this.semanticTokenType="variable",this.semanticTokenModifiers="declaration"}buildSemanticTokens(r){let n=this.parentNode;if(!(n instanceof ie&&n.linksTo)){super.buildSemanticTokens(r);return}r(Di("type"),Ai("declaration"),this.firstToken,this.lastToken)}toString(){return`${this.value}`}};var Ze=class{constructor(e,r){this.ast=e;this.parent=r;this.nexusMapsTo=[]}getDeepestAstNode(e,r){let n=Hn(this.ast,e,r);return this.ast.assignOperatorToken&&aT(this.ast.assignOperatorToken,e,r)?{item:this,ast:n,beforeAst:$c(this.ast,e,r),afterAst:qc(this.ast,e,r)}:{item:this,ast:n}}get name(){return this.ast.propertyName?.name??"[UNSET]"}get labels(){return this.ast.allDescendants.filter(e=>e instanceof ls)}get labelsMapped(){return this.labels.map(e=>({label:e,owner:this.ast.labels.some(r=>r===e)?this:null}))}getArgumentIndex(e){if(!e)return;let r=this.ast.getFlatAstValues()?.findIndex(n=>n===e||n?.isAncestorOf(e));return r===-1?void 0:r}get issues(){return this.replacedIssues}get replacedIssues(){return[...this.replaces?.replacedIssues??[],...this.replaces?[Ft(0,this.replaces.ast.firstToken,this.replaces.ast.lastToken,this.replaces.ast,{severity:la.DiagnosticSeverity.Hint,linkedTo:[this.ast],tags:[la.DiagnosticTag.Unnecessary],templateStrings:[this.name]})]:[]]}onHover(){if(this.nexusMapsTo.length)return{kind:la.MarkupKind.Markdown,value:["### Nexus mappings",...this.nexusMapsTo.filter(e=>!!e.mapItem).flatMap(e=>["```",`${this.name} = <... ${e.mappingValuesAst.map(r=>r.toString()).join(" ")} ...> maps to <... ${e.mapItem.mappingValues.map(r=>r.toString()).join(" ")} ...>;`,"```",`[Mapping (${e.mappingValuesAst.map(r=>r.toString()).join(" ")})](${`${e.mapItem.mappingValues[0].uri}#L${e.mapItem.mappingValues[0].firstToken.pos.line+1}`})`])].join(`
|
|
270
270
|
`)}}get allReplaced(){return this.replaces?[this.replaces,...this.replaces.allReplaced]:[]}toString(){return this.ast.toString()}toPrettyString(e){return this.ast.toPrettyString(e)}};var Jc=require("fs");var Oi=class t{constructor(e,r){this.text=e;this.uri=r;this.inComment=!1;this.lineNumber=0;this.columnNumber=0;this._tokens=[];let n=this.text.replace(/\r\n/g,`
|
|
271
271
|
`).trimEnd();this.lines=n.split(`
|
|
272
272
|
`);for(let i=0;i<this.lines.length;i++)this.lines[i]+=`
|
|
273
273
|
`;this.lexIt()}get tokens(){return this._tokens}isWhiteSpace(){let e=this.currentChar;if(!e)return!1;let r=e.charCodeAt(0);return r===32||r===9||r===10||r===13||r===12||r===11}get endOfFile(){return this.isOnLastLine&&this.isOnLastCharOfLine}get isOnLastLine(){return this.lineNumber===this.lines.length-1}get isOnLastCharOfLine(){return this.lines[this.lineNumber].length<=this.columnNumber}moveToNextLine(){for(;!this.isOnLastLine;)if(this.columnNumber=0,this.lineNumber++,this.lines[this.lineNumber].length>0)return!0;return!1}moveOnLine(){let r=this.lines[this.lineNumber].length;return this.columnNumber>=r?this.moveToNextLine():(this.columnNumber++,this.columnNumber>=r&&this.moveToNextLine(),!0)}move(){return this.lineNumber>=this.lines.length?!1:this.moveOnLine()}get currentChar(){if(this.lineNumber>=this.lines.length)return null;let e=this.lines[this.lineNumber];return this.columnNumber>=e.length?null:e[this.columnNumber]}static{this.SYNTAX_CHARS=new Set(["^","~","|","!","\\","<",">",";","=","/","{","}","[","]","(",")","*","%","&",".",":","+","@","-","_",",","x","X","?"])}static isSyntaxChar(e){return e?t.SYNTAX_CHARS.has(e):!1}static isLetterCode(e){return e>=65&&e<=90||e>=97&&e<=122}getWord(){let e="";for(;!this.isWhiteSpace()&&(e.length&&!t.isSyntaxChar(this.currentChar)||!e.length);){if(e+=this.currentChar??"",e.length===1&&t.isSyntaxChar(this.currentChar)){this.move();break}let r=this.lineNumber;if(!this.move()||this.lineNumber!==r)return e}return this.inComment&&e==="*"&&this.currentChar==="/"&&(this.inComment=!1),this.inCommentLineStart!==void 0&&this.lineNumber!==this.inCommentLineStart&&(this.inCommentLineStart=void 0,this.inComment=!1),!this.inComment&&e==="/"&&this.currentChar==="*"&&(this.inCommentLineStart=void 0,this.inComment=!0),!this.inComment&&e==="/"&&this.currentChar==="/"&&(this.inCommentLineStart=this.lineNumber,this.inComment=!0),e}getString(e){let r=e;for(;this.currentChar!==e;){if(this.currentChar===`
|
|
274
|
-
`){let o=this.lineNumber,a=this.columnNumber,c=r.length;this.pushToken({tokens:[21],value:r,pos:{col:a-c,line:o,len:c,colEnd:a}}),r=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(r+=this.currentChar??"",this.move())o===this.lineNumber&&(r+=this.currentChar??"");else break}else r+=this.currentChar??"";if(!this.move())break}r+=e;let n=this.lineNumber,i=this.columnNumber+1,s=r.length;this.pushToken({tokens:[21],value:r,pos:{col:i-s,line:n,len:s,colEnd:i}}),this.move()}lexIt(){for(;!this.endOfFile;){for(;this.isWhiteSpace();)this.move();let e=this.getWord();e&&this.process(e)}}static{this.SINGLE_CHAR_TOKENS=new Map([["{",[2]],["}",[3]],["(",[42]],[")",[43]],["[",[11]],["]",[12]],[";",[1]],[":",[50]],["=",[0]],[">",[4]],["<",[5]],["!",[6]],["|",[8]],["^",[9]],["&",[40,7]],["~",[10]],["/",[13]],["\\",[14]],["+",[15]],["-",[16]],["*",[17]],["%",[18]],["?",[44]],[".",[45]],["_",[48]],["@",[49]],[",",[24]]])}static{this.KEYWORD_TOKENS=new Map([["true",38],["false",39],["#define",25],["#include",26],["#line",27],["#undef",28],["#error",29],["#pragma",30],["#defined",31],["#if",32],["#ifdef",33],["#ifndef",34],["#elif",35],["#else",36],["#endif",37]])}process(e){let r=this.isString(e);if(!r){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(r=!0,this.pushToken({tokens:[i],value:e.toLowerCase(),pos:this.generatePos(e,e.toLowerCase())}),i===39||i===38)){let s=this.tokens.length-1;if(Bt(this.tokens[s-1],this.tokens[s]))r=!1,this.tokens.pop();else return!0}}if(r||(r=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!r&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return r=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(r||(r=this.isHash(e)||this.unknownToken(e)),!r)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let n=this._tokens[this._tokens.length-1];return r&&!n?.tokens.some(i=>i===21)&&n&&n.pos.len<e.length?this.process(e.slice(n.pos.len)):!0}pushToken(e){let r={tokens:e.tokens,pos:e.pos,value:e.value,uri:this.uri},n=this._tokens[this._tokens.length-1];r.prevToken=n,n&&(n.nextToken=r),this._tokens.push(r)}isLetters(e){let r=e[0]?.charCodeAt(0);if(t.isLetterCode(r)){let n="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))n+=e[i];else break}return this.pushToken({tokens:[47],value:n,pos:this.generatePos(e,n)}),!0}return!1}isDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=48&&n<=57?(this.pushToken({tokens:[20,19],value:r,pos:this.generatePos(e,r)}),!0):!1}isHexDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=65&&n<=70||n>=97&&n<=102?(this.pushToken({tokens:[20,47],value:r,pos:this.generatePos(e,r)}),!0):!1}isHash(e){let r="#";return e.startsWith(r)?(this.pushToken({tokens:[46],pos:this.generatePos(e,r),value:r}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let r=e[0];if(r==='"'||r==="'"){let n=e.length-1;if(this.columnNumber+1<n)throw new Error("Error while rewinding");return this.columnNumber-=n,this.getString(r),!0}return!1}generatePos(e,r){let n=this.columnNumber-e.length,i=r.length;return{line:this.lineNumber,col:n,len:i,colEnd:n+i}}};var wT=require("fs"),fa=require("path"),Yc=q(j());var ft=class extends Q{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var QC=require("path"),Wf=q(j());var li=class extends Q{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:Wf.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:Wf.SymbolKind.File},this._resolvedPath=r}},ua=class extends Q{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,QC.basename)(this.path),kind:Wf.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var ZC=q(j());var pt=class extends ge{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:ZC.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var Gf=class extends Q{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var eD=q(j());var da=class extends ft{toString(){return"..."}},ui=class extends Q{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:eD.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var xi=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,r=!0,n=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!pe(this.currentToken?.uri,e.uri))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&pe(this.currentToken?.uri,e.uri);)o=this.moveToNextToken;return r&&this._issues.push(W(22,s,o,null)),n&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,r):o};this.parsing=new Promise(e=>{setTimeout(()=>{this.parse().then(e)})})}reset(){this.issueLengthPositionStack=[],this.positionStack=[],this._issues=[]}get issues(){return this._issues}get stable(){return this.parsing}get done(){return this.peekIndex()>=this.tokens.length}get moveToNextToken(){let e=this.currentToken;if(e)return this.moveStackIndex(),e}enqueueToStack(){this.issueLengthPositionStack.push(this._issues.length),this.positionStack.push(this.peekIndex())}popStack(){let e=this.issueLengthPositionStack.pop()??0;e!==this._issues.length&&this._issues.splice(e),this.positionStack.pop()}mergeStack(){let e=this.issueLengthPositionStack.pop(),r=this.positionStack.pop();if(r===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=r}peekIndex(e=1){let r=this.positionStack.at(-1*e);if(r===void 0)throw new Error("Index out of bounds");return r}get currentToken(){return this.tokens.at(this.peekIndex())}get prevToken(){let e=this.peekIndex()-1;if(e!==-1)return this.tokens[e]}moveStackIndex(){let e=this.positionStack.length-1;if(this.positionStack[e]===void 0)throw new Error("Index out of bounds");this.positionStack[e]!==this.tokens.length&&this.positionStack[e]++}checkConcurrentTokens(e){this.enqueueToStack();let r=[];return e.every(n=>{let i=this.currentToken,s=n(i),o=!1;return s!=="no"&&i&&(r.push(i),this.moveToNextToken,o=Bt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),r}consumeAnyConcurrentTokens(e){this.enqueueToStack();let r=[],n,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)r.push(this.currentToken),n=this.moveToNextToken,i=Bt(n,this.currentToken);return this.mergeStack(),r}getDocumentSymbols(e){return this.allAstItems.flatMap(r=>r.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,r,n,i,s,o){if(!n||!i||!pe(n.uri,s)||!pe(i.uri,s))return;let a=i.pos.colEnd-n.pos.col;o.push({line:n.pos.line,char:n.pos.col,length:i===n?i.pos.len:a,tokenType:e,tokenModifiers:r})}buildSemanticTokens(e,r,n=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,r,n))}),n.sort((i,s)=>i.line===s.line?i.char-s.char:i.line-s.line).forEach(i=>e.push(i.line,i.char,i.length,i.tokenType,i.tokenModifiers))}processCIdentifier(e,r,n=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!i.length){this.popStack();return}if(!i?.[0]?.value.match(/^[_A-Za-z]/)){this.popStack();return}let s=i.map(a=>a.value).join(""),o=new pt(s,oe(i[0],i.at(-1)));if(n&&!e.has(o.name)){this.popStack();return}return!r&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(W(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let r=e,n;if(U(e,40)?(n="&",U(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):U(e,6)?(n="!",U(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):U(e,10)?n="~":U(e,8)?(n="|",U(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):U(e,9)?n="^":U(e,4)?(n=">",U(this.currentToken,4)?(n=">>",r=this.moveToNextToken):U(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):U(e,5)?(n="<",U(this.currentToken,5)?(n="<<",r=this.moveToNextToken):U(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):U(e,15)?n="+":U(e,16)?n="-":U(e,17)?n="*":U(e,13)?n="/":U(e,18)?n="%":U(e,46)?U(this.currentToken,46)&&(n="##",r=this.moveToNextToken):U(e,0)&&U(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new Gf(n,oe(e,r));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,r,n){this.enqueueToStack();let i=this.moveToNextToken;if(!i||!e(i)){this.popStack();return}let s=this.peekIndex(),o=()=>{this.positionStack[this.positionStack.length-1]=s},a=m=>m.flatMap(h=>"items"in h?a(h.items):h),c=[i],l=[],u=[];u[0]={rewind:o,tokens:[]};let d=this.currentToken;for(;d&&!r(d);){if(n?.(d)){let m=this.peekIndex()+1,h=()=>{this.positionStack[this.positionStack.length-1]=m};c.push(d),l.push(d),u[u.length]={rewind:h,tokens:[]}}else if(e(d)){let m=this.parseScopedBlock(e,r,n);m&&(c.push(m),u[u.length-1].tokens.push(...a(m.items))),d=this.currentToken;continue}else c.push(d),u[u.length-1].tokens.push(d);this.moveToNextToken,d=this.currentToken}let f=d;f&&r(f)&&(this.moveToNextToken,c.push(f));let p={startToken:i,items:c,splitTokens:u,endToken:f,separatorTokens:l};return this.mergeStack(),p}isFunctionCall(e){this.enqueueToStack();let r=this.processCIdentifier(e,!1);if(!r){this.popStack();return}if(!Bt(r.lastToken,this.currentToken)){this.popStack();return}let n=this.processMacroCallParams();if(!n){this.popStack();return}if(r.name==="defined")n.length>1?this._issues.push(W(44,r.firstToken,r.lastToken,r)):n.length<1&&this._issues.push(W(45,r.firstToken,r.lastToken,r));else{let s=e.get(r.name)?.macro;s&&(s?.identifier instanceof ui?s.identifier.params.at(-1)instanceof da||(n.length>s.identifier.params.length?this._issues.push(W(44,r.firstToken,r.lastToken,r,{linkedTo:[s]})):n.length<s.identifier.params.length&&this._issues.push(W(45,r.firstToken,r.lastToken,r,{linkedTo:[s]}))):this._issues.push(W(43,r.firstToken,r.lastToken,r)))}let i=new hr(r,n);return i.lastToken=this.prevToken,this.mergeStack(),i}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([rt("0"),rt("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(Me));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new Yt(n,oe(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(U(this.currentToken,16)||U(this.currentToken,15))&&Bt(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&U(r,16)&&(i=4294967295-i);let s=new Yt(i,oe(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(U(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new Kt(o,!0),o=new Kt(s,!1),s.openBracket=n),U(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(W(26,n,n,r)),this.mergeStack(),o}this.popStack()}processExpression(e,r,n=!1){this.enqueueToStack();let i,s;if(n&&(s=this.isOperator()),i=this.processEnclosedExpression(e,r)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),n){let o=this.isOperator();for(;o;){let a=this.processExpression(e,r,!0);a?i instanceof Kt?i.addExpression(o,a):i=new Kt(i,!1,{operator:o,expression:a}):this._issues.push(W(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!U(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!U(n,42),n=>!!U(n,43),n=>!!U(n,24));return e?.items.length===2&&U(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new ci(n.tokens.map((o,a)=>{let c=o.value;return o.pos.line===n.tokens.at(a+1)?.pos.line?c=c.padEnd(n.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),oe(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var rn=class extends Q{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
|
|
274
|
+
`){let o=this.lineNumber,a=this.columnNumber,c=r.length;this.pushToken({tokens:[21],value:r,pos:{col:a-c,line:o,len:c,colEnd:a}}),r=""}else if(this.currentChar==="\\"){let o=this.lineNumber;if(r+=this.currentChar??"",this.move())o===this.lineNumber&&(r+=this.currentChar??"");else break}else r+=this.currentChar??"";if(!this.move())break}r+=e;let n=this.lineNumber,i=this.columnNumber+1,s=r.length;this.pushToken({tokens:[21],value:r,pos:{col:i-s,line:n,len:s,colEnd:i}}),this.move()}lexIt(){for(;!this.endOfFile;){for(;this.isWhiteSpace();)this.move();let e=this.getWord();e&&this.process(e)}}static{this.SINGLE_CHAR_TOKENS=new Map([["{",[2]],["}",[3]],["(",[42]],[")",[43]],["[",[11]],["]",[12]],[";",[1]],[":",[50]],["=",[0]],[">",[4]],["<",[5]],["!",[6]],["|",[8]],["^",[9]],["&",[40,7]],["~",[10]],["/",[13]],["\\",[14]],["+",[15]],["-",[16]],["*",[17]],["%",[18]],["?",[44]],[".",[45]],["_",[48]],["@",[49]],[",",[24]]])}static{this.KEYWORD_TOKENS=new Map([["true",38],["false",39],["#define",25],["#include",26],["#line",27],["#undef",28],["#error",29],["#pragma",30],["#defined",31],["#if",32],["#ifdef",33],["#ifndef",34],["#elif",35],["#else",36],["#endif",37]])}process(e){let r=this.isString(e);if(!r){let i=t.KEYWORD_TOKENS.get(e.toLowerCase());if(i&&(r=!0,this.pushToken({tokens:[i],value:e.toLowerCase(),pos:this.generatePos(e,e.toLowerCase())}),i===39||i===38)){let s=this.tokens.length-1;if(Bt(this.tokens[s-1],this.tokens[s]))r=!1,this.tokens.pop();else return!0}}if(r||(r=this.isDigit(e)||this.isHexDigit(e)||this.isLetters(e)),!r&&e.length===1){let i=t.SINGLE_CHAR_TOKENS.get(e);if(i)return r=!0,this.pushToken({tokens:i,value:e,pos:this.generatePos(e,e)}),!0}if(r||(r=this.isHash(e)||this.unknownToken(e)),!r)throw new Error(`Lexer is not complete!!! Could not find token for "${e}"`);let n=this._tokens[this._tokens.length-1];return r&&!n?.tokens.some(i=>i===21)&&n&&n.pos.len<e.length?this.process(e.slice(n.pos.len)):!0}pushToken(e){let r={tokens:e.tokens,pos:e.pos,value:e.value,uri:this.uri},n=this._tokens[this._tokens.length-1];r.prevToken=n,n&&(n.nextToken=r),this._tokens.push(r)}isLetters(e){let r=e[0]?.charCodeAt(0);if(t.isLetterCode(r)){let n="";for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);if(t.isLetterCode(s))n+=e[i];else break}return this.pushToken({tokens:[47],value:n,pos:this.generatePos(e,n)}),!0}return!1}isDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=48&&n<=57?(this.pushToken({tokens:[20,19],value:r,pos:this.generatePos(e,r)}),!0):!1}isHexDigit(e){let r=e[0],n=r?.charCodeAt(0);return n>=65&&n<=70||n>=97&&n<=102?(this.pushToken({tokens:[20,47],value:r,pos:this.generatePos(e,r)}),!0):!1}isHash(e){let r="#";return e.startsWith(r)?(this.pushToken({tokens:[46],pos:this.generatePos(e,r),value:r}),!0):!1}unknownToken(e){return this.pushToken({tokens:[41],pos:this.generatePos(e," "),value:e}),!0}isString(e){if(this.inComment)return!1;let r=e[0];if(r==='"'||r==="'"){let n=e.length-1;if(this.columnNumber+1<n)throw new Error("Error while rewinding");return this.columnNumber-=n,this.getString(r),!0}return!1}generatePos(e,r){let n=this.columnNumber-e.length,i=r.length;return{line:this.lineNumber,col:n,len:i,colEnd:n+i}}};var wT=require("fs"),fa=require("path"),Yc=q(j());var ft=class extends Q{constructor(e){super(e),this.semanticTokenType="keyword",this.semanticTokenModifiers="declaration"}};var QC=require("path"),Wf=q(j());var Sn=class extends Q{constructor(r,n){super();this.keyword=r;this.path=n;this.docSymbolsMeta={name:`Include ${n}`,kind:Wf.SymbolKind.File},this.addChild(r),this.addChild(n)}get resolvedPath(){return this._resolvedPath}set resolvedPath(r){this.docSymbolsMeta={name:`Include ${r}`,kind:Wf.SymbolKind.File},this._resolvedPath=r}},ua=class extends Q{constructor(r,n,i){super(i);this._path=r;this.relative=n;this.docSymbolsMeta={name:(0,QC.basename)(this.path),kind:Wf.SymbolKind.File},this.semanticTokenType="string",this.semanticTokenModifiers="declaration"}get path(){return this.relative?this._path.slice(1,-1):this._path}};var ZC=q(j());var pt=class extends ge{constructor(r,n){super(n);this.name=r;this.docSymbolsMeta={name:this.name.toString(),kind:ZC.SymbolKind.Variable},this.semanticTokenType="macro",this.semanticTokenModifiers="declaration"}toString(){return this.name}};var Gf=class extends Q{constructor(r,n){super(n);this.operator=r;this.semanticTokenType="operator",this.semanticTokenModifiers="declaration"}toString(){return this.operator}};var eD=q(j());var da=class extends ft{toString(){return"..."}},ui=class extends Q{constructor(r,n){super();this.functionName=r;this.params=n;this.addChild(r),this.params.forEach(i=>this.addChild(i))}getDocumentSymbols(r){return pe(this.uri,r)?[{name:this.functionName.name,kind:eD.SymbolKind.Function,range:fe(this),selectionRange:fe(this),children:this.params.flatMap(n=>n.getDocumentSymbols(r))}]:[]}toString(){return`${this.functionName}(${this.params.map(r=>r.toString()).join(",")})`}};var xi=class t{constructor(){this.positionStack=[];this._issues=[];this.issueLengthPositionStack=[];this.moveEndOfLine=(e,r=!0,n=!1)=>{let i=e.pos.line;if(this.currentToken?.pos.line!==i||!pe(this.currentToken?.uri,e.uri))return;let s=this.currentToken,o=s;for(;this.currentToken?.pos.line===i&&pe(this.currentToken?.uri,e.uri);)o=this.moveToNextToken;return r&&this._issues.push(W(22,s,o,null)),n&&o?.value==="\\"&&o.nextToken?this.moveEndOfLine(o.nextToken,r):o};this.parsing=new Promise(e=>{setTimeout(()=>{this.parse().then(e)})})}reset(){this.issueLengthPositionStack=[],this.positionStack=[],this._issues=[]}get issues(){return this._issues}get stable(){return this.parsing}get done(){return this.peekIndex()>=this.tokens.length}get moveToNextToken(){let e=this.currentToken;if(e)return this.moveStackIndex(),e}enqueueToStack(){this.issueLengthPositionStack.push(this._issues.length),this.positionStack.push(this.peekIndex())}popStack(){let e=this.issueLengthPositionStack.pop()??0;e!==this._issues.length&&this._issues.splice(e),this.positionStack.pop()}mergeStack(){let e=this.issueLengthPositionStack.pop(),r=this.positionStack.pop();if(r===void 0||e===void 0)throw new Error("Index out of bounds");this.positionStack[this.positionStack.length-1]=r}peekIndex(e=1){let r=this.positionStack.at(-1*e);if(r===void 0)throw new Error("Index out of bounds");return r}get currentToken(){return this.tokens.at(this.peekIndex())}get prevToken(){let e=this.peekIndex()-1;if(e!==-1)return this.tokens[e]}moveStackIndex(){let e=this.positionStack.length-1;if(this.positionStack[e]===void 0)throw new Error("Index out of bounds");this.positionStack[e]!==this.tokens.length&&this.positionStack[e]++}checkConcurrentTokens(e){this.enqueueToStack();let r=[];return e.every(n=>{let i=this.currentToken,s=n(i),o=!1;return s!=="no"&&i&&(r.push(i),this.moveToNextToken,o=Bt(i,this.currentToken)),s==="yes"&&o}),this.mergeStack(),r}consumeAnyConcurrentTokens(e){this.enqueueToStack();let r=[],n,i=!0;for(;e.some(s=>s(this.currentToken)==="yes"&&i);)r.push(this.currentToken),n=this.moveToNextToken,i=Bt(n,this.currentToken);return this.mergeStack(),r}getDocumentSymbols(e){return this.allAstItems.flatMap(r=>r.getDocumentSymbols(e))}getWorkspaceSymbols(){return this.allAstItems.flatMap(e=>e.getWorkspaceSymbols())}static push(e,r,n,i,s,o){if(!n||!i||!pe(n.uri,s)||!pe(i.uri,s))return;let a=i.pos.colEnd-n.pos.col;o.push({line:n.pos.line,char:n.pos.col,length:i===n?i.pos.len:a,tokenType:e,tokenModifiers:r})}buildSemanticTokens(e,r,n=[]){this.allAstItems.forEach(i=>{i.buildSemanticTokens((...s)=>t.push(...s,r,n))}),n.sort((i,s)=>i.line===s.line?i.char-s.char:i.line-s.line).forEach(i=>e.push(i.line,i.char,i.length,i.tokenType,i.tokenModifiers))}processCIdentifier(e,r,n=!1){this.enqueueToStack();let i=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!i.length){this.popStack();return}if(!i?.[0]?.value.match(/^[_A-Za-z]/)){this.popStack();return}let s=i.map(a=>a.value).join(""),o=new pt(s,oe(i[0],i.at(-1)));if(n&&!e.has(o.name)){this.popStack();return}return!r&&o.firstToken!==o.lastToken&&o.name!=="defined"&&(e.get(o.name)||this._issues.push(W(42,o.firstToken,o.lastToken,o))),this.mergeStack(),o}isOperator(){this.enqueueToStack();let e=this.moveToNextToken;if(!e){this.popStack();return}let r=e,n;if(U(e,40)?(n="&",U(this.currentToken,40)&&(n="&&",r=this.moveToNextToken)):U(e,6)?(n="!",U(this.currentToken,0)&&(n="!=",r=this.moveToNextToken)):U(e,10)?n="~":U(e,8)?(n="|",U(this.currentToken,8)&&(n="||",r=this.moveToNextToken)):U(e,9)?n="^":U(e,4)?(n=">",U(this.currentToken,4)?(n=">>",r=this.moveToNextToken):U(this.currentToken,0)&&(n=">=",r=this.moveToNextToken)):U(e,5)?(n="<",U(this.currentToken,5)?(n="<<",r=this.moveToNextToken):U(this.currentToken,0)&&(n="<=",r=this.moveToNextToken)):U(e,15)?n="+":U(e,16)?n="-":U(e,17)?n="*":U(e,13)?n="/":U(e,18)?n="%":U(e,46)?U(this.currentToken,46)&&(n="##",r=this.moveToNextToken):U(e,0)&&U(this.currentToken,0)&&(n="==",r=this.moveToNextToken),n){let i=new Gf(n,oe(e,r));return this.mergeStack(),i}this.popStack()}parseScopedBlock(e,r,n){this.enqueueToStack();let i=this.moveToNextToken;if(!i||!e(i)){this.popStack();return}let s=this.peekIndex(),o=()=>{this.positionStack[this.positionStack.length-1]=s},a=m=>m.flatMap(h=>"items"in h?a(h.items):h),c=[i],l=[],u=[];u[0]={rewind:o,tokens:[]};let d=this.currentToken;for(;d&&!r(d);){if(n?.(d)){let m=this.peekIndex()+1,h=()=>{this.positionStack[this.positionStack.length-1]=m};c.push(d),l.push(d),u[u.length]={rewind:h,tokens:[]}}else if(e(d)){let m=this.parseScopedBlock(e,r,n);m&&(c.push(m),u[u.length-1].tokens.push(...a(m.items))),d=this.currentToken;continue}else c.push(d),u[u.length-1].tokens.push(d);this.moveToNextToken,d=this.currentToken}let f=d;f&&r(f)&&(this.moveToNextToken,c.push(f));let p={startToken:i,items:c,splitTokens:u,endToken:f,separatorTokens:l};return this.mergeStack(),p}isFunctionCall(e){this.enqueueToStack();let r=this.processCIdentifier(e,!1);if(!r){this.popStack();return}if(!Bt(r.lastToken,this.currentToken)){this.popStack();return}let n=this.processMacroCallParams();if(!n){this.popStack();return}if(r.name==="defined")n.length>1?this._issues.push(W(44,r.firstToken,r.lastToken,r)):n.length<1&&this._issues.push(W(45,r.firstToken,r.lastToken,r));else{let s=e.get(r.name)?.macro;s&&(s?.identifier instanceof ui?s.identifier.params.at(-1)instanceof da||(n.length>s.identifier.params.length?this._issues.push(W(44,r.firstToken,r.lastToken,r,{linkedTo:[s]})):n.length<s.identifier.params.length&&this._issues.push(W(45,r.firstToken,r.lastToken,r,{linkedTo:[s]}))):this._issues.push(W(43,r.firstToken,r.lastToken,r)))}let i=new hr(r,n);return i.lastToken=this.prevToken,this.mergeStack(),i}processHex(){this.enqueueToStack();let e=this.checkConcurrentTokens([rt("0"),rt("x",{caseInsensitive:!0})]);if(e.length!==2){this.popStack();return}let r=this.consumeAnyConcurrentTokens([19,20].map(Me));if(!r.length){this.popStack();return}let n=Number.parseInt(r.map(s=>s.value).join(""),16),i=new Yt(n,oe(e[0],r.at(-1)),16);return this.mergeStack(),i}processDec(e=!1){this.enqueueToStack();let r;e&&(U(this.currentToken,16)||U(this.currentToken,15))&&Bt(this.currentToken,this.currentToken?.nextToken)&&(r=this.moveToNextToken);let n=this.consumeAnyConcurrentTokens([19].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(o=>o.value).join(""),10);r&&U(r,16)&&(i=4294967295-i);let s=new Yt(i,oe(r??n[0],n.at(-1)),10);return this.mergeStack(),s}processEnclosedExpression(e,r){this.enqueueToStack();let n,i;if(U(this.currentToken,42)){let s;n=this.moveToNextToken,i=n;let o=this.processExpression(e,r,!0);return o&&(s=new Kt(o,!0),o=new Kt(s,!1),s.openBracket=n),U(this.currentToken,43)?(i=this.moveToNextToken,s&&(s.closeBracket=i)):n&&this._issues.push(W(26,n,n,r)),this.mergeStack(),o}this.popStack()}processExpression(e,r,n=!1){this.enqueueToStack();let i,s;if(n&&(s=this.isOperator()),i=this.processEnclosedExpression(e,r)||this.isFunctionCall(e)||this.processCIdentifier(e,!1)||this.processHex()||this.processDec(!0),!i){this.popStack();return}if(s&&(i.operator=s),n){let o=this.isOperator();for(;o;){let a=this.processExpression(e,r,!0);a?i instanceof Kt?i.addExpression(o,a):i=new Kt(i,!1,{operator:o,expression:a}):this._issues.push(W(27,o.firstToken,o.lastToken,r)),o=this.isOperator()}}return this.mergeStack(),i}processMacroCallParams(){if(!U(this.currentToken,42))return;let e=this.parseScopedBlock(n=>!!U(n,42),n=>!!U(n,43),n=>!!U(n,24));return e?.items.length===2&&U(e.endToken,43)?[]:e?.splitTokens.map((n,i)=>{if(n.tokens.length===0)return null;let s=new li(n.tokens.map((o,a)=>{let c=o.value;return o.pos.line===n.tokens.at(a+1)?.pos.line?c=c.padEnd(n.tokens[a+1].pos.col-o.pos.col," "):o.value==="\\"&&(c=c.slice(0,-1)),c}).join(""),oe(n.tokens[0],n.tokens.at(-1)),i);return s.splitToken=e.separatorTokens.at(i),s})}};var rn=class extends Q{constructor(r){super();this.comments=r;this.disabled=!1;r.forEach(this.addChild.bind(this))}toString(){return this.comments.map(r=>r.toString()).join(`
|
|
275
275
|
`)}},nn=class extends Q{constructor(r){super(r);this.disabled=!1;this.semanticTokenType="comment",this.semanticTokenModifiers="documentation"}toString(){let r,n=this.firstToken,i="";for(;n!==this.lastToken;)i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "),r=n,n=n?.nextToken;n&&(i+=n?.value.padStart(n.value.length+(r?n.pos.col-r.pos.colEnd:0)," "));let s=i.match(/^\s*(?:(?:\/\/|\/\*+)\s*)?(.*?)\s*(?:\*\/)?\s*$/s);return s?s[1]:""}};var Kf=class t extends xi{constructor(r,n=()=>Hr().requestTokens(this.uri,!0)){super();this.uri=r;this.getTokens=n;this.comments=[];this.tokens=[]}cleanUpComments(){let r=[];for(let n=0;n<this.tokens.length;n++){let i=t.processBlockComment(this.tokens,n)||t.processLineComment(this.tokens,n);i&&(n=i.index,r.push(...i.tokenUsed),this.comments.push(i.comment))}if(r.length>0){let n=new Set(r),i=[];for(let s=0;s<this.tokens.length;s++)n.has(s)||i.push(this.tokens[s]);this.tokens=i}}get allAstItems(){return this.comments}reset(){super.reset(),this.comments=[]}reparse(){return this.reset(),this.parse()}async parse(){this.tokens=this.getTokens(),this.cleanUpComments()}static processBlockComment(r,n){let i=[],s=()=>(i.push(n++),r[n]),o=()=>r[n],a=()=>r[n-1],c=o(),l=c;if(!c||!U(c,13)||(l=s(),!U(l,17)||c.pos.line!==l.pos.line||c.pos.col+1!==l.pos.col))return;let u=()=>!(!U(a(),17)||!U(o(),13)||!Bt(a(),o())),d=l.pos.line,f=c,p=[];l=s();do{if(o()?.pos.line!==d){let T=new nn(oe(f,a()));p.push(T),d=o().pos.line??0,f=o()}l=s()}while(n<r.length&&!u());let m=new nn(oe(f,o()));p.push(m);let h=new rn(p);return s(),{comment:h,tokenUsed:i,index:n-1}}static processLineComment(r,n){let i=[];if(!U(r[n],13)||r.length===n+1||!U(r[n+1],13)||!Bt(r[n],r[n+1]))return;for(;r[n].pos.line===r.at(n+1)?.pos.line;)i.push(n++);return i.push(n++),{comment:new nn(oe(r[i[0]],r[i.at(-1)])),tokenUsed:i,index:n-1}}};var tD=q(j());var Yf=class extends Q{constructor(r,n){super(r);this.content=n}toString(){let r=this.content.filter(n=>!U(n,14));return r.map((n,i)=>{let s=n.value;return n.pos.line===r.at(i+1)?.pos.line?s=s.padEnd(r[i+1].pos.col-n.pos.col," "):r.at(i+1)&&(s=s.padEnd(s.length+1," ")),s}).join("")}},zc=class extends Q{constructor(r,n,i){super();this.keyword=r;this.identifier=n;this.content=i;this.addChild(r),this.addChild(this.identifier),this.content&&this.addChild(this.content)}get name(){return this.identifier instanceof pt?this.identifier.name:this.identifier.functionName.name}toString(){return this.toStringCache??=[this.identifier.toString(),...this.content?[this.content?.toString()]:[]].join(" "),this.toStringCache}toMarkupContent(){return{kind:tD.MarkupKind.Markdown,value:["```cpp",`#define ${this.toString()}`,"```"].join(`
|
|
276
|
-
`)}}};var eo=class extends Q{constructor(e){super(e)}},Wc=class extends Q{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},Gc=class extends Wc{constructor(r,n,i){super(r,i);this.identifier=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.identifier&&r.has(this.identifier.name)}},Xf=class extends Wc{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},Jf=class extends Gc{useBlock(e){return this.identifier&&!e.has(this.identifier.name)}},Kc=class extends Wc{};var Vn=(t,e)=>{let r=t,n=[];for(;r&&(n.push(r),r!==e);)r=r.nextToken;return n},zn=class extends Q{constructor(r,n,i){super();this.ifDef=r;this.endIf=n;this.elseOption=i;this.addChild(r),i&&this.addChild(i),this.addChild(n)}get inactiveRanges(){if(this.elseOption&&!this.elseOption.active){let r=this.elseOption.firstToken,n=this.elseOption.content?.lastToken??this.endIf?.firstToken??this.lastToken;return[Je.create(Se(r),Se(n))]}if(!this.ifDef.active){let r=this.ifDef.firstToken,n=this.ifDef.content?this.ifDef.content?.lastToken:this.elseOption?this.elseOption.firstToken:this.endIf?.lastToken;return[Je.create(Se(r),Se(n??this.ifDef.lastToken))]}return[]}getInValidTokenRange(r){if(!this.ifDef.identifier)return new WeakSet(Vn(this.firstToken,this.lastToken));let n=this.ifDef.useBlock(r);return n?this.ifDef.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n?this.ifDef:this.elseOption)}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=(this.ifDef.identifier??this.ifDef.keyword).lastToken;Vn(this.ifDef.firstToken,i).forEach(o=>n.add(o));let s=this.ifDef===r;return!s&&this.ifDef.content&&Vn(this.ifDef.content.firstToken,this.ifDef.content.lastToken).forEach(o=>n.add(o)),this.elseOption&&(Vn(this.elseOption.firstToken,this.elseOption.keyword.lastToken).forEach(o=>n.add(o)),s&&this.elseOption.content&&Vn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(o=>n.add(o))),this.endIf&&Vn(this.endIf.firstToken,this.endIf.lastToken).forEach(o=>n.add(o)),n}},Sn=class extends Q{constructor(r,n,i){super();this.ifBlocks=r;this.endIf=n;this.elseOption=i;r.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(n)}getInValidTokenRange(r){let n=this.ifBlocks.find(i=>i.useBlock(r));return n?n.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n||this.elseOption)}get inactiveRanges(){let r=[],n=!!this.elseOption;if(this.ifBlocks.forEach((o,a)=>{if(o.active)return;let c=a===this.ifBlocks.length-1,l=o.firstToken,u=c?n?this.elseOption.firstToken:this.lastToken:o.content?.lastToken??this.ifBlocks[a+1].firstToken??o.lastToken;r.push(Je.create(Se(l),Se(u)))}),this.elseOption&&r.length){let o=this.elseOption.firstToken,a=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return[Je.create(Se(o),Se(a))]}let i=this.firstToken,s=this.lastToken;return[Je.create(Se(i),Se(s))]}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;Vn(s.firstToken,o).forEach(a=>n.add(a)),!i&&s===r?i=!0:s.content&&Vn(s.content.firstToken,s.content.lastToken).forEach(a=>n.add(a))}),this.elseOption&&(Vn(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>n.add(s)),i&&this.elseOption.content&&Vn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>n.add(s))),this.endIf&&Vn(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>n.add(s)),n}};var pa=class extends xi{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.getTokens=s;this.optimizeForFormatting=o;this.tokens=[];this.nodes=[];this._comments=[];this.dtsIncludes=[];this.macroSnapShot=new Map;this.macros=new Map;this.rangesToClean=new Set;this.macroStart=!1;i&&(Array.from(i).forEach(([a,c])=>this.macroSnapShot.set(a,c)),Array.from(i).forEach(([a,c])=>this.macros.set(a,c)))}get comments(){return this._comments}removeComments(r){this._comments=this._comments.filter(n=>!r.has(n))}get currentToken(){let r=this.prevToken,n=this.peekIndex(),i=this.tokens.at(n),s=nr(r,i)||!r||U(r,14)&&r.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&U(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(r){super.reset(),this.macros.clear(),r?(this.macroSnapShot.clear(),Array.from(r).forEach(([n,i])=>this.macroSnapShot.set(n,i)),Array.from(r).forEach(([n,i])=>this.macros.set(n,i))):Array.from(this.macroSnapShot).forEach(([n,i])=>this.macros.set(n,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(r){let n=this.stable;return this.parsing=new Promise(i=>{n.then(()=>{if(r&&r.size===this.macroSnapShot.size){let s=Array.from(r);if(Array.from(this.macroSnapShot).every(([o,a],c)=>{let[l,u]=s[c];return l===o&&u.macro.toString()===a.macro.toString()})){console.log("header file cache hit",this.uri),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new Kf(this.uri,this.getTokens);if(await r.stable,this.tokens=r.tokens,this._comments=r.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.uri.endsWith(".h")&&(this.tokens=this.tokens.filter(n=>!this.rangesToClean.has(n))),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}}async lineProcessor(){if(this.enqueueToStack(),!(!this.prevToken||this.prevToken.pos.line!==this.currentToken?.pos.line||!pe(this.prevToken.uri,this.currentToken.uri))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let n=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),n&&this.moveEndOfLine(n,!!i),this.mergeStack()}addTokensToClean(r){for(let n=r.start;n<r.start+r.count;n++){let i=this.tokens[n];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new Yf(oe(o[0],o.at(-1)),o));let c=new zc(i,s,a);this.macros.set(c.name,{macro:c,resolver:QE(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:r,count:l-r}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new zc(i,s);this.macros.delete(s.name),this.nodes.push(o);let a=this.peekIndex();return this.addTokensToClean({start:r,count:a-r}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,29))return this.popStack(),!1;this.moveEndOfLine(n,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:r,count:i-r}),this.mergeStack(),!0}consumeDefinitionContent(){let r=[];for(;this.currentToken;){let n=this.moveToNextToken;n&&r.push(n)}return r}isFunctionDefinition(){this.enqueueToStack();let r=this.processCIdentifier(this.macros,!0);if(!r){this.popStack();return}let n=this.moveToNextToken;if(!U(n,42)||!Bt(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!U(this.currentToken,24)&&!U(this.currentToken,43)?this._issues.push(W(28,s.firstToken,s.lastToken,s)):U(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ui(r,i);if(U(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(W(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(45),Me(45),Me(45)]);if(r.length!==3){this.popStack();return}let n=new da(oe(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>U(a,c))&&!nr(a.prevToken,a),a=>!!a&&[37].some(c=>U(a,c))&&!nr(a.prevToken,a),a=>!!a&&[36,35].some(c=>U(a,c))&&!nr(a.prevToken,a));if(!n)return;let i;U(n.startToken,32)?i=this.processIfBlock(n,(a,c,l)=>new Xf(a,c??null,l)):i=this.processIfDefBlock(n,(a,c,l)=>U(n.startToken,33)?new Gc(a,c??null,l):new Jf(a,c??null,l)),this.nodes.push(i);let s=i.getInValidTokenRange(this.macros);this.tokens=this.tokens.filter(a=>!s.has(a));let o=i.inactiveRanges;this._comments.forEach(a=>{o.some(c=>Af(c,a.range))&&(a.disabled=!0)}),[...i instanceof Sn?i.ifBlocks:[i.ifDef],...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(W(47,a.content.firstToken,a.content.lastToken,a.content,{severity:Yc.DiagnosticSeverity.Hint,tags:[Yc.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfDefBlock(r,n){this.enqueueToStack(),this.macroStart=!0;let i=new ft(oe(r.startToken));r.splitTokens[0].rewind();let s=this.processCIdentifier(this.macros,!0);s||this._issues.push(W(31,i.firstToken,i.lastToken,i)),this.macroStart=!1;let o,a=r.splitTokens[0].tokens.indexOf(s?.lastToken??i.lastToken)+1,c=r.splitTokens[0].tokens[a];a&&c&&(o=new eo(oe(c,r.splitTokens[0].tokens.at(-1))));let l=n(i,s??null,o??null),u;if(r.splitTokens.length>1){let p=r.separatorTokens[0],m=new ft(oe(p)),h;r.splitTokens[1].tokens.length&&(h=new eo(oe(r.splitTokens[1].tokens[0],r.splitTokens[1].tokens.at(-1)))),u=new Kc(m,h??null)}let d;r.endToken?d=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let f=new zn(l,d??null,u);return this.mergeStack(),f}processIfBlock(r,n){this.enqueueToStack();let i=new ft(oe(r.startToken)),s=[],o;r.splitTokens.forEach((l,u)=>{l.rewind();let d=this.prevToken,f=new ft(oe(d));this.macroStart=!0;let p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0);if(p instanceof pt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0)),this.macroStart=!1,u===r.splitTokens.length-1&&U(d,36)){let h=d,T=new ft(oe(h)),_;l.tokens.length&&(_=new eo(oe(l.tokens[0],l.tokens.at(-1)))),o=new Kc(T,_??null)}else{p||this._issues.push(W(31,i.firstToken,i.lastToken,i));let h,T=r.splitTokens[0].tokens.indexOf(p?.lastToken??i.lastToken)+1,_=r.splitTokens[0].tokens[T];T&&_&&(h=new eo(oe(_,r.splitTokens[u].tokens.at(-1))));let b=n(f,p??null,h??null);s.push(b)}});let a;r.endToken?a=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let c=new Sn(s,a??null,o);return this.mergeStack(),c}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,fa.resolve)((0,fa.dirname)(r.uri),r.path.path),...this.incudes.map(n=>(0,fa.resolve)(n,r.path.path))].find(n=>(0,wT.existsSync)(n)):this.incudes.map(n=>(0,fa.resolve)(n,r.path.path)).find(n=>(0,wT.existsSync)(n))}async processInclude(){this.enqueueToStack();let r=this.peekIndex(),n=this.currentToken;if(!n)return this.popStack(),!1;let i=n,s=n;if(U(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Me(13),rt("include"),Me(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new ft(oe(i,s));n=this.moveToNextToken;let c=n,l=!!U(n,21);if(!c||!l&&!U(n,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=n?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!U(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new ua(u,l,oe(c,n)),f=new li(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!U(this.currentToken,4)?this._issues.push(W(12,f.firstToken,f.lastToken,f)):(n=this.moveToNextToken,d.lastToken=n)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(W(36,f.path.firstToken,f.path.lastToken,f.path,{severity:Yc.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){Hr().requestTokens(m,!0);let h=Xc().getCPreprocessorParser(m,this.incudes,this.macros,this.uri);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([T,_])=>this.macros.set(T,_)),m.endsWith(".h")?this.addTokensToClean({start:r,count:p-r}):(this.tokens=ow(this.tokens,r,p,h.tokens),this.positionStack[this.positionStack.length-1]=r),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:r,count:p-r});return!0}};var CT,Qf=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=st(e);let s=`${Array.from(n).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(n),o;console.log("No c-preprocessor cache",e);let a=new pa(e,r,n),c=this.includeOwners.get(a)??new Set;return c.add(i),this.includeOwners.set(a,c),this.headerFiles.has(e)||this.headerFiles.set(e,new Map),this.headerFiles.get(e)?.set(s,a),a}reset(e){e=st(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(([n,i])=>{console.log("disposing c-preprocessor cache for",e),Array.from(this.includeOwners.get(i)??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e)})}};function Xc(){return CT??=new Qf,CT}function rD(){CT=new Qf}var DT,Zf=class t{constructor(){this.fileMap=new Map}static clone(e){let r=e.length;if(r===0)return[];let n=new Array(r),i;for(let s=0;s<r;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,uri:o.uri,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=st(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return $r.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,Jc.readFileSync)(e).toString())}renewLexer(e,r){if(e=st(e),Xc().reset(e),!r&&!(0,Jc.existsSync)(e))return[];try{r??=(0,Jc.readFileSync)(e).toString();let n=new Oi(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=st(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=st(e),Xc().reset(e),this.fileMap.delete(e)}};function Hr(){return DT??=new Zf,DT}function nD(){DT=new Zf}var di=class t{constructor(e){this.context=e;this.comments=[];this.includes=[];this.roots=[];this.references=[];this.unlinkedDeletes=[];this.unlinkedRefNodes=[];this.globalDeletes=[];this.rootNode=new X(this.context.bindingLoader,"/");this.labelsUsedCache=new Map;this.fileTopMostAstCache=new Map}fileTopMostAsts(e){let r=this.fileTopMostAstCache.get(e);if(r)return r;let n=[...this.roots,...this.references,...this.unlinkedDeletes,...this.unlinkedRefNodes,...this.globalDeletes,...this.context.overlayParsers.flatMap(i=>[...i.cPreprocessorParser.allAstItems,...i.unhandledStatements.children]),...this.context.parser.cPreprocessorParser.allAstItems,...this.context.parser.unhandledStatements.children].flatMap(i=>i.getTopMostAstNodeForFile(e));return this.fileTopMostAstCache.set(e,n),n}getDeepestAstNode(e,r){let i=this.fileTopMostAsts(e).find(s=>Pr(s,e,r)||XE(Hr().requestTokens(e,!1),s,r));if(i instanceof mr){let o=this.rootNode.getReferenceBy(i)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:{item:null,runtime:this,ast:Un(i,e,r)}}else if(i instanceof Ot&&i.path){let s=this.rootNode.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i instanceof Xe&&i.path){let s=t.getNodeFromPath(i.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i)return{runtime:this,item:null,ast:Un(i,e,r)}}static getNodeFromPath(e,r,n=!0){if(e.length===0)return r;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=r.getNode(s,a,n);return l?t.getNodeFromPath(c,l,n):void 0}resolvePath(e,r){if(!e.at(0)?.startsWith("&"))return e;let n=this.labelsUsedCache.get(e[0].slice(1));return n||(r??=this.rootNode.allDescendantsLabels,r.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof Fe)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}labelIssues(){let e=[],r=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(n=>{r.has(n.label.label.value)?r.get(n.label.label.value)?.push(n):r.set(n.label.label.value,[n])}),Array.from(r).forEach(n=>{let i=n[1];if(i.length>1){let s=i.find(a=>a.owner instanceof X);if(!i.every(a=>a&&a.owner===s?.owner)||!s){let a=i[i.length-1].label;e.push(Ft(4,a.firstToken,a.lastToken,a,{linkedTo:i.slice(0,-1).map(c=>c.label),templateStrings:[i.at(0).label.label.value]}))}}}),e}get typesIssues(){let e=r=>[...r.nodeType?.getIssue(this,r)??[],...r.nodes.flatMap(n=>e(n))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return JE([...e.definitions,...e.referencedBy],this.context)}};var Qc=q(j());var iD=q(j());var ep=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:iD.SymbolKind.String},this.values.forEach(n=>this.addChild(n))}toString(){return this.values.map(r=>r?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(r=>r?.toJson())}};var sD=q(j());var tp=class extends Q{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:sD.SymbolKind.Function}}};var fi=class extends Q{constructor(r,n){super();this.value=r;this.labels=n;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toString(r)??"NULL"}`}toPrettyString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toPrettyString(r)??"NULL"}`}};var oD=q(j());var rp=class extends Q{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:oD.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var aD=q(j());var np=class extends Q{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:aD.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var us=class extends xi{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new Fe;this.unhandledStatements=new Ot;this.injectedMacros=[];this.cPreprocessorParser=new pa(this.uri,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.uri,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new Fe,this._issues=[],this.unhandledStatements=new Ot}async reparse(){let r=performance.now(),n=this.stable;return this.parsing=new Promise(i=>{n.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-r),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,st(this.uri).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let r=async()=>{if(!(this.isDtsDocumentVersion()||this.isMemreserve()||this.isPlugin()||this.isRootNodeDefinition(this.rootDocument)||this.isDeleteNode(this.rootDocument,"Ref")||this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros)||this.isChildNode(this.rootDocument,"Ref")||this.isProperty(this.unhandledStatements)||this.isDeleteProperty(this.unhandledStatements)||this.isChildNode(this.unhandledStatements,"Name"))){let s=this.moveToNextToken;s&&(this._issues.push(W(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.uri.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(W(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(W(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(W(33,s.firstToken,s.lastToken,s))}));let n=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&n.forEach(s=>{(s instanceof Fe||s instanceof We)&&nw(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(r){let n=this.peekIndex(),i=this.isFunctionCall(r)||this.processCIdentifier(r,!0,!0);return this.injectPreProcessorResults(r,i,n)}injectPreProcessorResults(r,n,i){let s=n?.resolve(r);if(n&&typeof s=="string"){s=uT(s);let o=`${n.uri}${If}${n.firstToken.pos.line}:${n.firstToken.pos.col}-${n.lastToken.pos.line}:${n.firstToken.pos.col}`,a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Pr(n,n.uri,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof pt&&s.includes(n.name)||n instanceof hr&&s.includes(n.functionName.name))return!0;let c=new Oi(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!n||!U(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!U(i,2))return this.popStack(),!1;let s=new Ot;s.openScope=i,r.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=n,s.lastToken=o,this.mergeStack(),!0}nodeEnd(r){let n=this.currentToken;if(U(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(W(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return U(this.currentToken,3)||U(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!U(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(W(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;U(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(W(23,r,r,null))}}processNode(r,n){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(r,n)||this.isProperty(r)||this.isDeleteNode(r,n)||this.isDeleteProperty(r),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(W(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(r=!1){let n=[],i=this.isLabelAssign(r);for(;i;)n.push(i),i=this.isLabelAssign(r);return n}isChildNode(r,n){this.enqueueToStack();let i;n==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=n==="Ref"?new mr(s):new Xe(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!U(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!U(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(W(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof mr?(c.reference=a,l=!0):o&&c instanceof Xe&&(l=o.address!==void 0,c.name=o),U(this.currentToken,2)){c.openScope=this.moveToNextToken;let u=!1;do u=this.processNode(c,"Name");while(u);let d=this.nodeEnd(c);c.lastToken=d}else if(l){let u=a??o;u&&this._issues.push(W(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return r.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(r){let n=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([rt("0"),rt("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(W(50,i[0],i[1],r,{severity:Qc.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Me)),o=l=>{l.length%8!==0&&(l=l.padStart(Math.ceil(l.length/8)*8,"0"));let u=[];for(let d=0;d<l.length;d+=8){let f=l.slice(d,d+8);u.push(parseInt(f,16)>>>0)}return u},a=s.length?o(s.filter(l=>l.value!=="_").map(l=>l.value).join("")):[NaN];return n&&(a.some(l=>Number.isNaN(l))?this._issues.push(W(8,n,n,r)):!Number.isNaN(a)&&!Bt(n,s[0])&&!Fc(s[0].uri)&&this._issues.push(W(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(W(51,this.currentToken,this.currentToken,r,{severity:Qc.DiagnosticSeverity.Warning})),this.moveToNextToken),new Lc(a,oe(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Me(49)]);if(n.length){Bt(r.lastToken,n[0])||this._issues.push(W(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(r)),U(this.currentToken,24)&&(this.prevToken&&!Bt(this.prevToken,this.currentToken)&&this._issues.push(W(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!U(this.currentToken,2)&&!U(this.currentToken,1)&&!U(this.currentToken,3)&&!U(this.currentToken,13)&&nr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(W(52,o,this.currentToken,r));let a=new Lc([],oe(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Me));if(!r.length){this.popStack();return}let n=r.map(o=>o.value).join(""),i=new xe(n,oe(r[0],r.at(-1))),s=this.processNodeAddresses(i);return i.address=s,xf(n)||this._issues.push(W(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Me));if(!r.length){this.popStack();return}let n=new tt(r.map(i=>i.value).join(""),oe(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!r.length){this.popStack();return}if(!xf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new ir(n,oe(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!n.length){this.popStack();return}if(!xf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&U(s,50),a=new ls(new ir(i,oe(n[0],n.at(-1))),oe(n[0],o?s:n.at(-1)));if(o){let c=n.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(W(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(W(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(U(this.currentToken,2)||U(this.currentToken,49))return this.popStack(),!1;let s=new We(i,n),o;U(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(W(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,r.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("d"),rt("ts"),Me(16),rt("v"),rt("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new ft;s.firstToken=n;let o=new tp(s);if(this.others.push(o),U(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(W(21,o.firstToken,o.lastToken,o)),this.mergeStack(),!0;return s.lastToken=i,o.lastToken=this.endStatement(o),this.mergeStack(),!0}isMemreserve(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new rp(n,o,a);if(this.others.push(c),o||this._issues.push(W(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(W(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("plugin"),Me(13)]);if(r.length!==3)return this.popStack(),!1;let n=new ft(oe(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("b"),rt("its")]);if(r.length!==3){this.popStack();return}let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new np(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(W(40,o.firstToken,o.lastToken,o)):this._issues.push(W(39,n.firstToken,n.lastToken,n)),this._issues.push(W(41,a.firstToken,a.lastToken,a,{severity:Qc.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("omit"),Me(16),rt("if"),Me(16),rt("no"),Me(16),rt("ref"),Me(13)]);if(r.length!==9){this.popStack();return}let n=new ft(oe(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([Me(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),Me(16),rt("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new ft;if(a.firstToken=s,i.length===1&&!U(this.currentToken,2)){this._issues.push(W(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new jr(a);return r.addNodeChild(d),this.mergeStack(),!0}let c=i.map(d=>d.value??"").join("");if(!"/delete-node/".startsWith(c)||c.endsWith("-"))return this.popStack(),!1;a.lastToken=i.at(-1),c!=="/delete-node"?this._issues.push(W(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):U(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(W(21,a.firstToken,a.lastToken,a));let l=new jr(a);if(nr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(W(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(W(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(W(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(W([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(W(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(W(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,r.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Me(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),Me(16),rt("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new ft;if(o.firstToken=i,n.length===1&&!U(this.currentToken,2)){this._issues.push(W(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new yt(o);return r.addNodeChild(u),this.mergeStack(),!0}let a=n.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=n.at(-1),a!=="/delete-property"?this._issues.push(W(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):U(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(W(21,o.firstToken,o.lastToken,o));let c=new yt(o);if(nr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(W(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(W(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,r.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&s.push(...this.processOptionalLabelAssign(!0));let o=new Er(n,i,s);return this.mergeStack(),o}processValue(r){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(r)||this.isLabelRefValue(r)||this.arrayValues(r)||this.processByteStringValue()||this.isExpressionValue(r))??null,a=o();if(!a)return[];let c=[a];for(;!U(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=U(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!nr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new Q(oe(u,this.currentToken));this._issues.push(W(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new Q(oe(l));this._issues.push(W(28,h.firstToken,h.lastToken,h))}let m=c.at(-1);m&&(m.nextValueSeparator??=d),c.push(p)}return c})();if(i.length===0){this.popStack();return}return this.mergeStack(),new ep(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([Me(21)]);if(!n.length){this.popStack();return}if(n.some(u=>u.value===void 0))throw new Error("Token must have value");let i=n.map(u=>u.value).join(`
|
|
277
|
-
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,oe(n[0],n.at(-1)));o||this._issues.push(W(i.startsWith('"')?16:17,a.firstToken,a.lastToken,a));let c=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(c=this.processOptionalLabelAssign(!0));let l=new Er(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(U(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new Er(n,o,a,i);if(!U(this.currentToken,4))this._issues.push(W(12,c.firstToken,c.lastToken,c));else{let u=this.moveToNextToken;o&&(o.closeBracket=u)}let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=s,c.lastToken=this.prevToken,c}processByteStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.moveToNextToken,i=n;if(!U(i,11)){this.popStack();return}let s=this.processLabeledValue(()=>this.processHexString()),o=this.processOptionalLabelAssign(!0)??[];s.forEach(u=>{let d=0;u.value&&u.value.firstToken===u.value.lastToken&&(d=u.value.firstToken.pos.len),d%2!==0&&this._issues.push(W(15,u.firstToken,u.lastToken,u))});let a=new en(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(W(14,a.firstToken,a.lastToken,a,{severity:Qc.DiagnosticSeverity.Information})));let c=new Er(r,a,o);U(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(W(5,c.firstToken,c.lastToken,c));let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=n,a.lastToken=this.prevToken,c}processLabeledValue(r){this.enqueueToStack();let n=r(),i=[];if(!n)return this.popStack(),[];for(;n;)i.push(n),n=r();if(i.length){let s=r();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(r){this.enqueueToStack();let n=this.processLabeledValue(()=>{let s=()=>this.processRefValue(r,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,r),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof hr&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof pt&&this.cPreprocessorParser.macros.has(a.value.name))&&typeof a.value.evaluate(this.cPreprocessorParser.macros)=="string"?(this.injectPreProcessorResults(this.cPreprocessorParser.macros,a.value,o),s()):a}),i=new gt(n);return n.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processHex();if(!i){this.popStack();return}let s=new fi(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new Yt(i,oe(n[0],n.at(-1)),16),o=new fi(s,r);return this.mergeStack(),o}processLabeledDec(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processDec();if(!i){this.popStack();return}let s=new fi(i,n);return this.mergeStack(),s}processLabeledExpression(r=!0,n=r,i){this.enqueueToStack();let s=[];r&&(s=this.processOptionalLabelAssign(n));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new fi(o,s);return this.mergeStack(),a}isExpressionValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,r);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new Er(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!U(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(W(18,n,n,r)),o.firstToken=n,this.mergeStack(),o}n&&(i.firstToken.pos.line!==n.pos.line||i.firstToken.pos.col!==n.pos.colEnd)&&this._issues.push(W(29,n,i.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=n,this.mergeStack(),s}isLabelRefValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.isLabelRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(s=this.processOptionalLabelAssign(!0));let o=new Er(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!U(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new fi(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(W([18,9],s,s,r));let l=new fi(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new fi(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new Hn){this.enqueueToStack();let i;if(U(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(W(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(W(7,o,o,n)),!r||s?n.addPath(s??null,i?new Q(oe(i)):void 0):r&&!s&&i&&(n.addPath(new xe("/",oe(i))),n.firstToken=i),r&&!i&&n.children.length===0){this.mergeStack();return}return this.processNodePath(!1,n),this.mergeStack(),n}processNodePathRef(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!U(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!U(i,2)){this.popStack();return}n&&!Bt(n,s)&&this._issues.push(W(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new ot(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Bt(u.lastToken,l)){this._issues.push(W(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Bt(s,u?.firstToken)){this._issues.push(W(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Bt(u.lastToken,f.firstToken)&&this._issues.push(W(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),U(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(W(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.allAstItems.filter(r=>r instanceof li)}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>xi.push(...o,n,i))}),super.buildSemanticTokens(r,n,i)}};var ip=class t{constructor(e,r,n){this.settings=e;this.formattingOptions=r;this.bindingLoader=n;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleUri=new Set;let i={includePaths:[],overlays:[],zephyrBindings:[],deviceOrgTreeBindings:[],deviceOrgBindingsMetaSchema:[],...e,ctxName:e.ctxName??(0,ha.basename)(e.dtsFile),lockRenameEdits:[],showFormattingErrorAsDiagnostics:e.showFormattingErrorAsDiagnostics??!0,disableFileWatchers:e.disableFileWatchers??!1};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(Zc.existsSync);let s=this.isFullContext&&n?.type==="Zephyr"?[(0,ha.join)((0,ha.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new us(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Ii(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new us(o,s,this.parser.cPreprocessorParser.macros))??[]})}get macros(){return this.allParsers.at(-1).cPreprocessorParser.macros}get ctxNames(){return Array.from(this.ctxNames_)}addCtxName(e){this.ctxNames_.add(e)}removeCtxName(e){this.ctxNames_.delete(e)}async getContextIssues(){return[...(await this.getRuntime()).issues,...this._issues]}async getFileTree(){let e=new Map,r=i=>({file:i,includes:(e.get(i)??[]).map(s=>r(s.resolvedPath??s.path))});return(await this.getRuntime()).includes.forEach(i=>{let s=e.get(i.uri);s||(s=[],e.set(i.uri,s)),s.push({path:i.path.path,resolvedPath:i.resolvedPath})}),{mainDtsPath:r(this.parser.uri),overlays:this.overlays.map(r)}}async stable(){await Promise.all([this.parser.stable,...this.overlayParsers.map(e=>e.stable)])}async getRuntime(){return await this.stable(),this._runtime??=this.evaluate(),this._runtime}getContextFiles(){return[...this.overlayParsers.flatMap(e=>e.getFiles()),...this.parser.getFiles()]}isInContext(e){return this.getContextFiles().some(r=>pe(r,e))}getUriParser(e){let r=this.overlayParsers.find(n=>n.getFiles().some(i=>pe(i,e)));return r??=this.parser.getFiles().some(n=>pe(n,e))?this.parser:void 0,r}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,r){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>pe(s.ast.uri,e)&&(!r||Pr(s.ast,e,r))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof ne&&l.compatible===o.value.value);return c?{range:fe(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...this.parser.cPreprocessorParser.dtsIncludes.filter(s=>pe(s.uri,e)&&(!r||Pr(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:fe(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let r=s=>[...s.properties,...s.nodes.flatMap(r)],n=r(e.rootNode),i=e.rootNode.allDescendantsLabels;n.forEach(s=>s.ast.allDescendants.forEach(o=>{if(o instanceof ie){let a=e.resolvePath([`&${o.label?.value}`],i);if(a){let c=e.rootNode.getChild(a);o.linksTo=c,c?.linkedRefLabels.push(o)}else o.value&&this._issues.push(Ft(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value]}))}else o instanceof Hn&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,r){let n=r,i=e.pathParts;for(let s=0;s<i.length&&i[s];s++){let o=!1,a=i[s];if(a){let c=s===0&&a.name==="/"?r:n?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Ft(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`]}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleUri(e){this.staleUri.add(e)}async reevaluate(e){this.setStaleUri(e);let r=new Set;return this.staleUri.forEach(n=>{let i=this.getUriParser(n);i&&r.add(i)}),r.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(r).map(n=>n.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e){if(e)return this.sortKeys.get(e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new di(this);this.staleUri.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let n=0;n<this.overlayParsers.length;n++)this.overlayParsers[n].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[n].rootDocument,r);return r.includes=this.parser.includes,r.comments=this.parser.cPreprocessorParser.allAstItems.filter(n=>n instanceof nn),(await this.getAllStableParsers()).flatMap(n=>n.tokens).forEach((n,i)=>this.sortKeys.set(n,i)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}reportNodeNameAndPropertyClashes(e){let r=n=>{n.properties.forEach(i=>{n.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions[o.definitions.length-1].name;this._issues.push(Ft(2,a.firstToken,a.lastToken,a,{linkedTo:[i.ast,...i.allReplaced.map(c=>c.ast)]}))})}),n.nodes.forEach(r)};r(e.rootNode)}processRoot(e,r){for(let n=0;n<e.children.length;n++){let i=e.children[n];this.processChild(i,r.rootNode,r)}}processChild(e,r,n){e instanceof Fe?this.processDtcBaseNode(e,r,n):e instanceof We?this.processDtcProperty(e,r,n):e instanceof jr?this.processDeleteNode(e,r,n):e instanceof yt&&this.processDeleteProperty(e,r,n)}checkNodeUniqueNames(e,r){let n=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||yn(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>({name:o.name,address:o.address,issueAst:o.definitions[0].name??o.definitions[0]})),s=[];e.children.forEach(o=>{if(o instanceof Xe&&o.name){let a=n(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Ft(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof jr&&o.nodeNameOrRef instanceof xe){let a=o.nodeNameOrRef;n(i,a)&&(s=s.filter(c=>n(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,Zc.existsSync)(this.settings.compileCommands)))return JSON.parse((0,Zc.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof Ot?this.processDtcRootNode(e,n):e instanceof Xe?this.processDtcChildNode(e,r,n):e instanceof mr&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.roots.push(e),r.rootNode.definitions.push(e),this.checkNodeUniqueNames(e,r.rootNode),e.children.forEach(n=>this.processChild(n,r.rootNode,r))}processDtcChildNode(e,r,n){if(e.name?.name){let i=e.path?n.resolvePath(e.path):void 0,o=(i?n.rootNode.getChild(i):void 0)??new X(this.bindingLoader,e.name.name,e.name.fullAddress,r);o.definitions.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),r=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,r,n))}processDtcRefNodeLabelRef(e,r,n){let i,s=e.resolveNodePath??(e.pathName?n.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=n.rootNode.getChild(s),r.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(r),i?.referencedBy.push(e),e.labels.forEach(o=>{n.labelsUsedCache.set(o.label.value,s)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):(this._issues.push(Ft(3,r.firstToken,r.lastToken,r,{templateStrings:[r.label?.value??""]})),n.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,r,n){let i;r.path&&this.linkNodePath(r.path,n.rootNode);let o=r.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=n.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.referencedBy.push(e),e.labels.forEach(a=>{n.labelsUsedCache.set(a.label.value,o)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):n.unlinkedRefNodes.push(e),i}processDtcRefNode(e,r){let n;e.reference?e.reference instanceof ie?n=this.processDtcRefNodeLabelRef(e,e.reference,r):n=this.processDtcRefNodeNodePathRef(e,e.reference,r):r.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,n??new X(this.bindingLoader,""),r))}processDtcProperty(e,r,n){e.propertyName?.name&&r.addProperty(new Ze(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof xe&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!r.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Ft(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{r.deletes.push(e);let i=r.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,r.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{n.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=n.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=n.rootNode.getChild(i),r.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{n.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof Fe&&!e.parentNode.pathName&&n.globalDeletes.push(e)):(n.unlinkedDeletes.push(e),this._issues.push(Ft(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value]})))}else if(e.nodeNameOrRef instanceof ot&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=n.rootNode,s=e.nodeNameOrRef.path.pathParts;for(let c=0;c<s.length&&s[c];c++){let l=s[c];if(l){let u=i?.getNode(l.name,l.fullAddress,!1);l.linksTo=u,u?.linkedNodeNamePaths.push(l),i=u}}let o=e.nodeNameOrRef.path.pathParts.find(c=>c&&!c.linksTo),a=e.nodeNameOrRef.path.pathParts.at(-1)?.linksTo;a||(n.unlinkedDeletes.push(e),o&&this._issues.push(Ft(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`]}))),r.deletes.push(e),a?.labels.forEach(c=>{n.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof Fe&&!e.parentNode.pathName&&n.globalDeletes.push(e)}else n.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,r,n))}processDeleteProperty(e,r,n){e.propertyName?.name&&!r.hasProperty(e.propertyName.name)?this._issues.push(Ft(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(r.deletes.push(e),r.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,r,n))}static#e(e,r,n){let i=n.get(r);i||(i=[],n.set(r,i)),i.push(e)}getIssues(e,r=new Map,n=i=>{if(!(i.raw.severity===to.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===to.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=to.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.uri,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===to.DiagnosticSeverity.Error&&!this.isFullContext&&!Xs(n.raw,n.raw.uri,!1)&&(n.raw.severity=to.DiagnosticSeverity.Warning),!(n.raw.severity===to.DiagnosticSeverity.Hint&&n.raw.virtual))return n}){return(await this.getAllStableParsers()).forEach(n=>this.getIssues(n.issues,e,r)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let r=await this.getContextIssues()??[];this.getIssues(r,e);let n=await this.getRuntime();return this.getIssues(n.typesIssues,e),e}catch(r){throw console.error(r),r}}async toFullString(){return`/dts-v1/;
|
|
276
|
+
`)}}};var eo=class extends Q{constructor(e){super(e)}},Wc=class extends Q{constructor(r,n){super();this.keyword=r;this.content=n;this.active=!1;this.addChild(r)}},Gc=class extends Wc{constructor(r,n,i){super(r,i);this.identifier=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.identifier&&r.has(this.identifier.name)}},Xf=class extends Wc{constructor(r,n,i){super(r,i);this.expression=n;this.addChild(n),this.addChild(i)}useBlock(r){return this.expression?.isTrue(r)}},Jf=class extends Gc{useBlock(e){return this.identifier&&!e.has(this.identifier.name)}},Kc=class extends Wc{};var zn=(t,e)=>{let r=t,n=[];for(;r&&(n.push(r),r!==e);)r=r.nextToken;return n},Wn=class extends Q{constructor(r,n,i){super();this.ifDef=r;this.endIf=n;this.elseOption=i;this.addChild(r),i&&this.addChild(i),this.addChild(n)}get inactiveRanges(){if(this.elseOption&&!this.elseOption.active){let r=this.elseOption.firstToken,n=this.elseOption.content?.lastToken??this.endIf?.firstToken??this.lastToken;return[Je.create(Se(r),Se(n))]}if(!this.ifDef.active){let r=this.ifDef.firstToken,n=this.ifDef.content?this.ifDef.content?.lastToken:this.elseOption?this.elseOption.firstToken:this.endIf?.lastToken;return[Je.create(Se(r),Se(n??this.ifDef.lastToken))]}return[]}getInValidTokenRange(r){if(!this.ifDef.identifier)return new WeakSet(zn(this.firstToken,this.lastToken));let n=this.ifDef.useBlock(r);return n?this.ifDef.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n?this.ifDef:this.elseOption)}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=(this.ifDef.identifier??this.ifDef.keyword).lastToken;zn(this.ifDef.firstToken,i).forEach(o=>n.add(o));let s=this.ifDef===r;return!s&&this.ifDef.content&&zn(this.ifDef.content.firstToken,this.ifDef.content.lastToken).forEach(o=>n.add(o)),this.elseOption&&(zn(this.elseOption.firstToken,this.elseOption.keyword.lastToken).forEach(o=>n.add(o)),s&&this.elseOption.content&&zn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(o=>n.add(o))),this.endIf&&zn(this.endIf.firstToken,this.endIf.lastToken).forEach(o=>n.add(o)),n}},_n=class extends Q{constructor(r,n,i){super();this.ifBlocks=r;this.endIf=n;this.elseOption=i;r.forEach(s=>this.addChild(s)),i&&this.addChild(i),this.addChild(n)}getInValidTokenRange(r){let n=this.ifBlocks.find(i=>i.useBlock(r));return n?n.active=!0:this.elseOption&&(this.elseOption.active=!0),this.getInValidTokenRangeWhenActiveBlock(n||this.elseOption)}get inactiveRanges(){let r=[],n=!!this.elseOption;if(this.ifBlocks.forEach((o,a)=>{if(o.active)return;let c=a===this.ifBlocks.length-1,l=o.firstToken,u=c?n?this.elseOption.firstToken:this.lastToken:o.content?.lastToken??this.ifBlocks[a+1].firstToken??o.lastToken;r.push(Je.create(Se(l),Se(u)))}),this.elseOption&&r.length){let o=this.elseOption.firstToken,a=this.elseOption.content?.lastToken??this.endIf?.lastToken??this.lastToken;return[Je.create(Se(o),Se(a))]}let i=this.firstToken,s=this.lastToken;return[Je.create(Se(i),Se(s))]}getInValidTokenRangeWhenActiveBlock(r){let n=new WeakSet,i=!1;return this.ifBlocks.forEach(s=>{let o=s.expression?.lastToken??s.keyword.lastToken;zn(s.firstToken,o).forEach(a=>n.add(a)),!i&&s===r?i=!0:s.content&&zn(s.content.firstToken,s.content.lastToken).forEach(a=>n.add(a))}),this.elseOption&&(zn(this.elseOption.keyword.firstToken,this.elseOption.keyword.lastToken).forEach(s=>n.add(s)),i&&this.elseOption.content&&zn(this.elseOption.content.firstToken,this.elseOption.content.lastToken).forEach(s=>n.add(s))),this.endIf&&zn(this.endIf.firstToken,this.endIf.lastToken).forEach(s=>n.add(s)),n}};var pa=class extends xi{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.getTokens=s;this.optimizeForFormatting=o;this.tokens=[];this.nodes=[];this._comments=[];this.dtsIncludes=[];this.macroSnapShot=new Map;this.macros=new Map;this.rangesToClean=new Set;this.macroStart=!1;i&&(Array.from(i).forEach(([a,c])=>this.macroSnapShot.set(a,c)),Array.from(i).forEach(([a,c])=>this.macros.set(a,c)))}get comments(){return this._comments}removeComments(r){this._comments=this._comments.filter(n=>!r.has(n))}get currentToken(){let r=this.prevToken,n=this.peekIndex(),i=this.tokens.at(n),s=nr(r,i)||!r||U(r,14)&&r.pos.line+1===i?.pos.line;if(!(this.macroStart&&!s))return this.macroStart&&U(i,14)?(this.moveStackIndex(),this.currentToken):i}reset(r){super.reset(),this.macros.clear(),r?(this.macroSnapShot.clear(),Array.from(r).forEach(([n,i])=>this.macroSnapShot.set(n,i)),Array.from(r).forEach(([n,i])=>this.macros.set(n,i))):Array.from(this.macroSnapShot).forEach(([n,i])=>this.macros.set(n,i)),this.nodes=[],this.dtsIncludes=[],this.rangesToClean=new Set}async reparse(r){let n=this.stable;return this.parsing=new Promise(i=>{n.then(()=>{if(r&&r.size===this.macroSnapShot.size){let s=Array.from(r);if(Array.from(this.macroSnapShot).every(([o,a],c)=>{let[l,u]=s[c];return l===o&&u.macro.toString()===a.macro.toString()})){console.log("header file cache hit",this.uri),i();return}}this.reset(r),this.parse().then(i)})}),this.parsing}async parse(){let r=new Kf(this.uri,this.getTokens);if(await r.stable,this.tokens=r.tokens,this._comments=r.allAstItems,this.positionStack.push(0),this.tokens.length!==0){for(;!this.done;)await this.lineProcessor();if(this.rangesToClean.size&&!this.uri.endsWith(".h")&&(this.tokens=this.tokens.filter(n=>!this.rangesToClean.has(n))),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}}async lineProcessor(){if(this.enqueueToStack(),!(!this.prevToken||this.prevToken.pos.line!==this.currentToken?.pos.line||!pe(this.prevToken.uri,this.currentToken.uri))){this.moveEndOfLine(this.prevToken,!1),this.mergeStack();return}let n=this.currentToken,i=await this.processInclude()||this.processDefinitions()||this.processUndef()||this.processError();this.processIfDefBlocks(),n&&this.moveEndOfLine(n,!!i),this.mergeStack()}addTokensToClean(r){for(let n=r.start;n<r.start+r.count;n++){let i=this.tokens[n];i&&this.rangesToClean.add(i)}}processDefinitions(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,25))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.isFunctionDefinition()||this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=this.consumeDefinitionContent(),a;o.length&&(a=new Yf(oe(o[0],o.at(-1)),o));let c=new zc(i,s,a);this.macros.set(c.name,{macro:c,resolver:QE(c.toString())}),this.nodes.push(c);let l=this.peekIndex();return this.addTokensToClean({start:r,count:l-r}),this.mergeStack(),this.macroStart=!1,!0}processUndef(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,28))return this.popStack(),!1;this.macroStart=!0;let i=new ft(oe(n)),s=this.processCIdentifier(this.macros,!0);if(!s)return this._issues.push(W(30,i.firstToken,i.lastToken,i)),this.mergeStack(),this.macroStart=!1,!0;let o=new zc(i,s);this.macros.delete(s.name),this.nodes.push(o);let a=this.peekIndex();return this.addTokensToClean({start:r,count:a-r}),this.mergeStack(),this.macroStart=!1,!0}processError(){this.enqueueToStack();let r=this.peekIndex(),n=this.moveToNextToken;if(!n||!U(n,29))return this.popStack(),!1;this.moveEndOfLine(n,!1,!0);let i=this.peekIndex();return this.addTokensToClean({start:r,count:i-r}),this.mergeStack(),!0}consumeDefinitionContent(){let r=[];for(;this.currentToken;){let n=this.moveToNextToken;n&&r.push(n)}return r}isFunctionDefinition(){this.enqueueToStack();let r=this.processCIdentifier(this.macros,!0);if(!r){this.popStack();return}let n=this.moveToNextToken;if(!U(n,42)||!Bt(r.lastToken,n)){this.popStack();return}let i=[],s=this.processCIdentifier(this.macros,!0)||this.processVariadic();for(;s;)i.push(s),!U(this.currentToken,24)&&!U(this.currentToken,43)?this._issues.push(W(28,s.firstToken,s.lastToken,s)):U(this.currentToken,43)||(n=this.moveToNextToken),s=this.processCIdentifier(this.macros,!0)||this.processVariadic();let o=new ui(r,i);if(U(this.currentToken,43))n=this.moveToNextToken,o.lastToken=n;else{o.lastToken=this.prevToken;let a=i.at(-1)??o;this._issues.push(W(26,a.firstToken,a.lastToken,a))}return this.mergeStack(),o}processVariadic(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(45),Me(45),Me(45)]);if(r.length!==3){this.popStack();return}let n=new da(oe(r[0],r.at(-1)));return this.mergeStack(),n}processIfDefBlocks(){let r=this.peekIndex(),n=this.parseScopedBlock(a=>!!a&&[33,34,32].some(c=>U(a,c))&&!nr(a.prevToken,a),a=>!!a&&[37].some(c=>U(a,c))&&!nr(a.prevToken,a),a=>!!a&&[36,35].some(c=>U(a,c))&&!nr(a.prevToken,a));if(!n)return;let i;U(n.startToken,32)?i=this.processIfBlock(n,(a,c,l)=>new Xf(a,c??null,l)):i=this.processIfDefBlock(n,(a,c,l)=>U(n.startToken,33)?new Gc(a,c??null,l):new Jf(a,c??null,l)),this.nodes.push(i);let s=i.getInValidTokenRange(this.macros);this.tokens=this.tokens.filter(a=>!s.has(a));let o=i.inactiveRanges;this._comments.forEach(a=>{o.some(c=>Af(c,a.range))&&(a.disabled=!0)}),[...i instanceof _n?i.ifBlocks:[i.ifDef],...i.elseOption?[i.elseOption]:[]].forEach(a=>{!a.active&&a.content&&this._issues.push(W(47,a.content.firstToken,a.content.lastToken,a.content,{severity:Yc.DiagnosticSeverity.Hint,tags:[Yc.DiagnosticTag.Unnecessary]}))}),this.positionStack[this.positionStack.length-1]=r}processIfDefBlock(r,n){this.enqueueToStack(),this.macroStart=!0;let i=new ft(oe(r.startToken));r.splitTokens[0].rewind();let s=this.processCIdentifier(this.macros,!0);s||this._issues.push(W(31,i.firstToken,i.lastToken,i)),this.macroStart=!1;let o,a=r.splitTokens[0].tokens.indexOf(s?.lastToken??i.lastToken)+1,c=r.splitTokens[0].tokens[a];a&&c&&(o=new eo(oe(c,r.splitTokens[0].tokens.at(-1))));let l=n(i,s??null,o??null),u;if(r.splitTokens.length>1){let p=r.separatorTokens[0],m=new ft(oe(p)),h;r.splitTokens[1].tokens.length&&(h=new eo(oe(r.splitTokens[1].tokens[0],r.splitTokens[1].tokens.at(-1)))),u=new Kc(m,h??null)}let d;r.endToken?d=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let f=new Wn(l,d??null,u);return this.mergeStack(),f}processIfBlock(r,n){this.enqueueToStack();let i=new ft(oe(r.startToken)),s=[],o;r.splitTokens.forEach((l,u)=>{l.rewind();let d=this.prevToken,f=new ft(oe(d));this.macroStart=!0;let p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0);if(p instanceof pt&&p.name.toLowerCase()==="defined"&&(p=this.processExpression(this.macros,f,!0)||this.processCIdentifier(this.macros,!0)),this.macroStart=!1,u===r.splitTokens.length-1&&U(d,36)){let h=d,T=new ft(oe(h)),_;l.tokens.length&&(_=new eo(oe(l.tokens[0],l.tokens.at(-1)))),o=new Kc(T,_??null)}else{p||this._issues.push(W(31,i.firstToken,i.lastToken,i));let h,T=r.splitTokens[0].tokens.indexOf(p?.lastToken??i.lastToken)+1,_=r.splitTokens[0].tokens[T];T&&_&&(h=new eo(oe(_,r.splitTokens[u].tokens.at(-1))));let b=n(f,p??null,h??null);s.push(b)}});let a;r.endToken?a=new ft(oe(r.endToken)):this._issues.push(W(46,i.firstToken,i.lastToken,i));let c=new _n(s,a??null,o);return this.mergeStack(),c}get allAstItems(){return[...this.dtsIncludes,...this.nodes,...this.comments]}resolveInclude(r){if(r.path.path)return r.path.relative?[(0,fa.resolve)((0,fa.dirname)(r.uri),r.path.path),...this.incudes.map(n=>(0,fa.resolve)(n,r.path.path))].find(n=>(0,wT.existsSync)(n)):this.incudes.map(n=>(0,fa.resolve)(n,r.path.path)).find(n=>(0,wT.existsSync)(n))}async processInclude(){this.enqueueToStack();let r=this.peekIndex(),n=this.currentToken;if(!n)return this.popStack(),!1;let i=n,s=n;if(U(n,26))this.moveToNextToken;else{let h=this.checkConcurrentTokens([Me(13),rt("include"),Me(13)]);if(h.length!==3)return this.popStack(),!1;i=h[0],s=h.at(-1)}let o=i,a=new ft(oe(i,s));n=this.moveToNextToken;let c=n,l=!!U(n,21);if(!c||!l&&!U(n,5))return o&&this.moveEndOfLine(o),this.mergeStack(),!0;let u="";if(l)u=n?.value??"";else for(;this.currentToken?.pos.line===o.pos.line&&!U(this.currentToken,4);)u+=this.currentToken?.value??"",n=this.moveToNextToken;let d=new ua(u,l,oe(c,n)),f=new Sn(a,d);this.dtsIncludes.push(f),l||(this.currentToken?.pos.line!==o.pos.line||!U(this.currentToken,4)?this._issues.push(W(12,f.firstToken,f.lastToken,f)):(n=this.moveToNextToken,d.lastToken=n)),this.mergeStack();let p=this.peekIndex(),m=this.resolveInclude(f);if(f.resolvedPath=m,m||this._issues.push(W(36,f.path.firstToken,f.path.lastToken,f.path,{severity:Yc.DiagnosticSeverity.Warning})),m&&!this.optimizeForFormatting){Hr().requestTokens(m,!0);let h=Xc().getCPreprocessorParser(m,this.incudes,this.macros,this.uri);await h.stable,this._issues.push(...h.issues),this.macros.clear(),Array.from(h.macros).forEach(([T,_])=>this.macros.set(T,_)),m.endsWith(".h")?this.addTokensToClean({start:r,count:p-r}):(this.tokens=ow(this.tokens,r,p,h.tokens),this.positionStack[this.positionStack.length-1]=r),this.nodes.push(...h.nodes),this.dtsIncludes.push(...h.dtsIncludes)}else this.addTokensToClean({start:r,count:p-r});return!0}};var CT,Qf=class{constructor(){this.headerFiles=new Map;this.includeOwners=new WeakMap}getCPreprocessorParser(e,r,n,i){e=st(e);let s=`${Array.from(n).map(l=>l[1].macro.toString()).join("::")}`,o=this.headerFiles.get(e)?.get(s);if(o)return o.reparse(n),o;console.log("No c-preprocessor cache",e);let a=new pa(e,r,n),c=this.includeOwners.get(a)??new Set;return c.add(i),this.includeOwners.set(a,c),this.headerFiles.has(e)||this.headerFiles.set(e,new Map),this.headerFiles.get(e)?.set(s,a),a}reset(e){e=st(e);let r=this.headerFiles.get(e);r&&Array.from(r).forEach(([n,i])=>{console.log("disposing c-preprocessor cache for",e),Array.from(this.includeOwners.get(i)??[]).forEach(this.reset.bind(this)),this.headerFiles.delete(e)})}};function Xc(){return CT??=new Qf,CT}function rD(){CT=new Qf}var DT,Zf=class t{constructor(){this.fileMap=new Map}static clone(e){let r=e.length;if(r===0)return[];let n=new Array(r),i;for(let s=0;s<r;s++){let o=e[s],a={tokens:o.tokens,pos:o.pos,value:o.value,uri:o.uri,prevToken:i,nextToken:void 0};i&&(i.nextToken=a),n[s]=a,i=a}return n}needsRenew(e,r){return e=st(e),this.fileMap.get(e)?.text!==r}getDocument(e,r){return $r.create(e,"devicetree",0,r??this.fileMap.get(e)?.text??(0,Jc.readFileSync)(e).toString())}renewLexer(e,r){if(e=st(e),Xc().reset(e),!r&&!(0,Jc.existsSync)(e))return[];try{r??=(0,Jc.readFileSync)(e).toString();let n=new Oi(r,e);return this.fileMap.set(e,n),t.clone(n.tokens)}catch{}return[]}requestTokens(e,r){e=st(e);let n=this.fileMap.get(e)?.tokens;return!n&&r?[...this.renewLexer(e)]:t.clone(n??[])}reset(e){e=st(e),Xc().reset(e),this.fileMap.delete(e)}};function Hr(){return DT??=new Zf,DT}function nD(){DT=new Zf}var di=class t{constructor(e){this.context=e;this.comments=[];this.includes=[];this.roots=[];this.references=[];this.unlinkedDeletes=[];this.unlinkedRefNodes=[];this.globalDeletes=[];this.rootNode=new X(this.context.bindingLoader,"/");this.labelsUsedCache=new Map;this.fileTopMostAstCache=new Map}fileTopMostAsts(e){let r=this.fileTopMostAstCache.get(e);if(r)return r;let n=[...this.roots,...this.references,...this.unlinkedDeletes,...this.unlinkedRefNodes,...this.globalDeletes,...this.context.overlayParsers.flatMap(i=>[...i.cPreprocessorParser.allAstItems,...i.unhandledStatements.children]),...this.context.parser.cPreprocessorParser.allAstItems,...this.context.parser.unhandledStatements.children].flatMap(i=>i.getTopMostAstNodeForFile(e));return this.fileTopMostAstCache.set(e,n),n}getDeepestAstNode(e,r){let i=this.fileTopMostAsts(e).find(s=>Pr(s,e,r)||XE(Hr().requestTokens(e,!1),s,r));if(i instanceof mr){let o=this.rootNode.getReferenceBy(i)?.getDeepestAstNode(e,r);return o?{...o,runtime:this}:{item:null,runtime:this,ast:Hn(i,e,r)}}else if(i instanceof Ot&&i.path){let s=this.rootNode.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i instanceof Xe&&i.path){let s=t.getNodeFromPath(i.path.slice(1),this.rootNode)?.getDeepestAstNode(e,r);return s?{...s,runtime:this}:void 0}else if(i)return{runtime:this,item:null,ast:Hn(i,e,r)}}static getNodeFromPath(e,r,n=!0){if(e.length===0)return r;let i=e[0].split("@"),s=i[0],a=i.at(1)?.split(",").map(u=>Number.parseInt(u,16)),c=e.slice(1),l=r.getNode(s,a,n);return l?t.getNodeFromPath(c,l,n):void 0}resolvePath(e,r){if(!e.at(0)?.startsWith("&"))return e;let n=this.labelsUsedCache.get(e[0].slice(1));return n||(r??=this.rootNode.allDescendantsLabels,r.find(s=>s.label.value===e.at(0)?.slice(1)&&s.parentNode instanceof Fe)?.lastLinkedTo?.path)}get issues(){return this.issuesCache??=[...this.labelIssues(),...this.rootNode.getIssues(this.context.macros)],this.issuesCache}labelIssues(){let e=[],r=new Map;return this.rootNode.allDescendantsLabelsMapped.forEach(n=>{r.has(n.label.label.value)?r.get(n.label.label.value)?.push(n):r.set(n.label.label.value,[n])}),Array.from(r).forEach(n=>{let i=n[1];if(i.length>1){let s=i.find(a=>a.owner instanceof X);if(!i.every(a=>a&&a.owner===s?.owner)||!s){let a=i[i.length-1].label;e.push(Ft(4,a.firstToken,a.lastToken,a,{linkedTo:i.slice(0,-1).map(c=>c.label),templateStrings:[i.at(0).label.label.value]}))}}}),e}get typesIssues(){let e=r=>[...r.nodeType?.getIssue(this,r)??[],...r.nodes.flatMap(n=>e(n))];return this.typesIssuesCache??=e(this.rootNode),this.typesIssuesCache}getOrderedNodeAst(e){return JE([...e.definitions,...e.referencedBy],this.context)}};var Qc=q(j());var iD=q(j());var ep=class extends Q{constructor(r){super();this.values=r;this.docSymbolsMeta={name:"Values",kind:iD.SymbolKind.String},this.values.forEach(n=>this.addChild(n))}toString(){return this.values.map(r=>r?.toString()).join(",")}toJson(){return this.values.length===1?this.values[0]?.toJson():this.values.map(r=>r?.toJson())}};var sD=q(j());var tp=class extends Q{constructor(r){super();this.keyword=r;this.addChild(r),this.docSymbolsMeta={name:"DTS Document version",kind:sD.SymbolKind.Function}}};var fi=class extends Q{constructor(r,n){super();this.value=r;this.labels=n;this.labels.forEach(i=>{this.addChild(i)}),this.addChild(this.value)}toString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toString(r)??"NULL"}`}toPrettyString(r){return`${this.labels.map(n=>n.toString()).join(" ")}${this.value?.toPrettyString(r)??"NULL"}`}};var oD=q(j());var rp=class extends Q{constructor(r,n,i){super();this.keyword=r;this.startAddress=n;this.endAddress=i;this.addChild(r),this.docSymbolsMeta={name:"Memreserve",kind:oD.SymbolKind.Function},this.addChild(n),this.addChild(i)}toString(){return`/memreserve/ 0x${this.startAddress?.value?.toString(16)} 0x${this.endAddress?.value?.toString(16)}`}};var aD=q(j());var np=class extends Q{constructor(r,n){super();this.keyword=r;this.bitsSize=n;this.addChild(r),this.docSymbolsMeta={name:"bits",kind:aD.SymbolKind.Function},this.addChild(n)}toString(){return`/bits/ ${this.bitsSize?.value?.toString()}`}};var us=class extends xi{constructor(r,n,i,s,o){super();this.uri=r;this.incudes=n;this.tokens=[];this.others=[];this.rootDocument=new Fe;this.unhandledStatements=new Ot;this.injectedMacros=[];this.cPreprocessorParser=new pa(this.uri,this.incudes,i,s,o)}get issues(){return[...this._issues,...this.cPreprocessorParser.issues]}getFiles(){return[this.uri,...this.cPreprocessorParser.dtsIncludes.flatMap(r=>r.resolvedPath).filter(r=>!!r)]}reset(){super.reset(),this.others=[],this.rootDocument=new Fe,this._issues=[],this.unhandledStatements=new Ot}async reparse(){let r=performance.now(),n=this.stable;return this.parsing=new Promise(i=>{n.then(async()=>{this.reset(),await this.cPreprocessorParser.reparse(),await this.parse(),console.log("parsing",performance.now()-r),i()})}),this.parsing}async parse(){if(await this.cPreprocessorParser.stable,this.tokens=this.cPreprocessorParser.tokens,st(this.uri).endsWith(".h")||(this.positionStack.push(0),this.tokens.length===0))return;let r=async()=>{if(!(this.isDtsDocumentVersion()||this.isMemreserve()||this.isPlugin()||this.isRootNodeDefinition(this.rootDocument)||this.isDeleteNode(this.rootDocument,"Ref")||this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros)||this.isChildNode(this.rootDocument,"Ref")||this.isProperty(this.unhandledStatements)||this.isDeleteProperty(this.unhandledStatements)||this.isChildNode(this.unhandledStatements,"Name"))){let s=this.moveToNextToken;s&&(this._issues.push(W(22,s,s,null)),this.reportExtraEndStatements())}};for(;!this.done;)await r();this.uri.endsWith(".dtsi")||(this.unhandledStatements.nodes.forEach(s=>{this._issues.push(W(53,s.firstToken,s.lastToken,s))}),this.unhandledStatements.properties.forEach(s=>{this._issues.push(W(32,s.firstToken,s.lastToken,s))}),this.unhandledStatements.deleteProperties.forEach(s=>{this._issues.push(W(33,s.firstToken,s.lastToken,s))}));let n=this.allAstItems.flatMap(s=>[s,...s.allDescendants]),i=this.cPreprocessorParser.comments;if(i.length&&n.forEach(s=>{(s instanceof Fe||s instanceof We||s instanceof Sn)&&nw(s,i)}),this.positionStack.length!==1)throw new Error("Incorrect final stack size")}processInjectPreProcessorMacros(r){let n=this.peekIndex(),i=this.isFunctionCall(r)||this.processCIdentifier(r,!0,!0);return this.injectPreProcessorResults(r,i,n)}injectPreProcessorResults(r,n,i){let s=n?.resolve(r);if(n&&typeof s=="string"){s=uT(s);let o=`${n.uri}${If}${n.firstToken.pos.line}:${n.firstToken.pos.col}-${n.lastToken.pos.line}:${n.firstToken.pos.col}`,a=new Set;if(this.cPreprocessorParser.comments.forEach(l=>{Pr(n,n.uri,l.range.start)&&a.add(l)}),this.cPreprocessorParser.removeComments(a),this.injectedMacros.push(n),n instanceof pt&&s.includes(n.name)||n instanceof hr&&s.includes(n.functionName.name))return!0;let c=new Oi(s,o);return this.tokens.splice(i,this.peekIndex()-i,...c.tokens),this.positionStack[this.positionStack.length-1]=i,!0}}isRootNodeDefinition(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!n||!U(n,13))return this.popStack(),!1;if(i=this.moveToNextToken,!i||!U(i,2))return this.popStack(),!1;let s=new Ot;s.openScope=i,r.addNodeChild(s),this.processNode(s,"Name");let o=this.nodeEnd(s)??i;return s.firstToken=n,s.lastToken=o,this.mergeStack(),!0}nodeEnd(r){let n=this.currentToken;if(U(n,3))this.moveToNextToken;else{let i=this.prevToken;return i&&this._issues.push(W(3,i,i,r)),this.endStatement(r,!1)}return this.prevToken?.value==="}"&&(r.closeScope=this.prevToken),this.endStatement(r)}isNodeEnd(){return U(this.currentToken,3)||U(this.currentToken,1)}endStatement(r,n=!0){let i=this.currentToken;if(!U(i,1)){let s=this.prevToken;if(s&&n)return this._issues.push(W(1,s,s,r)),s}return this.moveToNextToken,this.reportExtraEndStatements(),i}reportExtraEndStatements(){for(;U(this.currentToken,1);){let r=this.moveToNextToken;r&&this._issues.push(W(23,r,r,null))}}processNode(r,n){if(this.done)return!1;let i=!1,s=!1;do{for(;this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros););if(s=this.isChildNode(r,n)||this.isProperty(r)||this.isDeleteNode(r,n)||this.isDeleteProperty(r),!s&&!this.isNodeEnd()&&!this.done){let o=this.moveToNextToken;o&&(this._issues.push(W(22,o,o,null)),this.reportExtraEndStatements())}else if(this.done)break;i=i||s}while(!this.isNodeEnd());return i}processOptionalLabelAssign(r=!1){let n=[],i=this.isLabelAssign(r);for(;i;)n.push(i),i=this.isLabelAssign(r);return n}isChildNode(r,n){this.enqueueToStack();let i;n==="Name"&&(i=this.isOmitIfNoRefNode());let s=this.processOptionalLabelAssign(),o,a,c=n==="Ref"?new mr(s):new Xe(s,i);if(n==="Ref"?(this.enqueueToStack(),a=this.processNodePathRef(c),!a||!U(this.currentToken,2)?(this.popStack(),a=void 0):this.mergeStack(),a??=this.isLabelRef(c)):n==="Name"&&(o=this.isNodeName()),!a&&!o){if(!U(this.currentToken,2))return this.popStack(),!1;c.firstToken=this.currentToken,this._issues.push(W(n==="Name"?[7]:[10,48,11],c.firstToken,this.currentToken?.nextToken,c))}let l=!1;if(a&&c instanceof mr?(c.reference=a,l=!0):o&&c instanceof Xe&&(l=o.address!==void 0,c.name=o),U(this.currentToken,2)){c.openScope=this.moveToNextToken;let u=!1;do u=this.processNode(c,"Name");while(u);let d=this.nodeEnd(c);c.lastToken=d}else if(l){let u=a??o;u&&this._issues.push(W(2,u.firstToken,u.lastToken,u))}else return this.popStack(),!1;return r.addNodeChild(c),this.mergeStack(),!0}processNodeAddress(r){let n=this.prevToken;this.enqueueToStack();let i=this.checkConcurrentTokens([rt("0"),rt("x",{caseInsensitive:!0})]);i.length!==2?(i=[],this.popStack()):(this._issues.push(W(50,i[0],i[1],r,{severity:Qc.DiagnosticSeverity.Warning})),n=i.at(-1),this.mergeStack());let s=this.consumeAnyConcurrentTokens([19,20,48].map(Me)),o=l=>{l.length%8!==0&&(l=l.padStart(Math.ceil(l.length/8)*8,"0"));let u=[];for(let d=0;d<l.length;d+=8){let f=l.slice(d,d+8);u.push(parseInt(f,16)>>>0)}return u},a=s.length?o(s.filter(l=>l.value!=="_").map(l=>l.value).join("")):[NaN];return n&&(a.some(l=>Number.isNaN(l))?this._issues.push(W(8,n,n,r)):!Number.isNaN(a)&&!Bt(n,s[0])&&!Fc(s[0].uri)&&this._issues.push(W(29,n,s[0],r,{inclusiveStart:!1,inclusiveEnd:!1}))),this.currentToken?.value.toUpperCase()==="ULL"&&(this._issues.push(W(51,this.currentToken,this.currentToken,r,{severity:Qc.DiagnosticSeverity.Warning})),this.moveToNextToken),new Lc(a,oe(i.at(0)??s[0]??this.prevToken,this.prevToken))}processNodeAddresses(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Me(49)]);if(n.length){Bt(r.lastToken,n[0])||this._issues.push(W(29,r.lastToken,n[0],r,{inclusiveStart:!1,inclusiveEnd:!1}));let i=[],s=()=>{this.processInjectPreProcessorMacros(this.cPreprocessorParser.macros),i.push(this.processNodeAddress(r)),U(this.currentToken,24)&&(this.prevToken&&!Bt(this.prevToken,this.currentToken)&&this._issues.push(W(29,this.prevToken,this.currentToken,r,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken,s())};s();let o=this.currentToken;for(;!U(this.currentToken,2)&&!U(this.currentToken,1)&&!U(this.currentToken,3)&&!U(this.currentToken,13)&&nr(this.currentToken,i.at(-1)?.lastToken);)this.moveToNextToken;if(o&&o!==this.currentToken){this._issues.push(W(52,o,this.currentToken,r));let a=new Lc([],oe(o,this.prevToken));i.push(a)}return this.mergeStack(),i}this.popStack()}isNodeName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16].map(Me));if(!r.length){this.popStack();return}let n=r.map(o=>o.value).join(""),i=new xe(n,oe(r[0],r.at(-1))),s=this.processNodeAddresses(i);return i.address=s,xf(n)||this._issues.push(W(49,i.firstToken,i.lastToken,i)),this.mergeStack(),i}isPropertyName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,24,45,48,15,16,44,46].map(Me));if(!r.length){this.popStack();return}let n=new tt(r.map(i=>i.value).join(""),oe(r[0],r.at(-1)));return this.mergeStack(),n}isLabelName(){this.enqueueToStack();let r=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!r.length){this.popStack();return}if(!xf(r?.[0].value)){this.popStack();return}let n=r.map(s=>s.value).join(""),i=new ir(n,oe(r[0],r[r.length-1]));return this.mergeStack(),i}isLabelAssign(r){this.enqueueToStack();let n=this.consumeAnyConcurrentTokens([19,47,48].map(Me));if(!n.length){this.popStack();return}if(!xf(n?.[0].value)){this.popStack();return}let i=n.map(c=>c.value).join(""),s=this.currentToken,o=s&&U(s,50),a=new ls(new ir(i,oe(n[0],n.at(-1))),oe(n[0],o?s:n.at(-1)));if(o){let c=n.at(-1);c&&(s.pos.line!==a.firstToken.pos.line||s.pos.col!==c.pos.colEnd)&&this._issues.push(W(29,c,s,a,{inclusiveStart:!1,inclusiveEnd:!1})),this.moveToNextToken}else if(r)this._issues.push(W(24,a.firstToken,a.lastToken,a));else{this.popStack();return}return this.mergeStack(),a}isProperty(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(),i=this.isPropertyName();if(!i)return this.popStack(),!1;if(U(this.currentToken,2)||U(this.currentToken,49))return this.popStack(),!1;let s=new We(i,n),o;U(this.currentToken,0)?(s.assignOperatorToken=this.moveToNextToken,o=this.processValue(r),o?.values.filter(c=>!!c).length||this._issues.push(W(0,s.firstToken,s.lastToken,s)),s.values=o??null):s.values=void 0;let a=this.endStatement(s);return s.lastToken=a,r.addNodeChild(s),this.mergeStack(),!0}isDtsDocumentVersion(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("d"),rt("ts"),Me(16),rt("v"),rt("1")]);if(r.length!==6)return this.popStack(),!1;let n=r[0],i=n,s=new ft;s.firstToken=n;let o=new tp(s);if(this.others.push(o),U(this.currentToken,13))i=this.moveToNextToken;else return s.lastToken=r.at(-1),this._issues.push(W(21,o.firstToken,o.lastToken,o)),this.mergeStack(),!0;return s.lastToken=i,o.lastToken=this.endStatement(o),this.mergeStack(),!0}isMemreserve(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("memreserve")]);if(r.length!==2)return this.popStack(),!1;let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processHex()||this.processDec(),a=o&&(this.processHex()||this.processDec()),c=new rp(n,o,a);if(this.others.push(c),o||this._issues.push(W(37,n.firstToken,n.lastToken,n)),!a){let l=o??n;this._issues.push(W(38,l.firstToken,l.lastToken,c))}return c.lastToken=this.endStatement(c),this.mergeStack(),!0}isPlugin(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("plugin"),Me(13)]);if(r.length!==3)return this.popStack(),!1;let n=new ft(oe(r[0],r.at(-1)));return n.lastToken=this.endStatement(n),this.mergeStack(),this.others.push(n),!0}processBits(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("b"),rt("its")]);if(r.length!==3){this.popStack();return}let n=new ft;n.firstToken=r[0];let s=r[0];U(this.currentToken,13)?(s=this.moveToNextToken,n.lastToken=s):(n.lastToken=r.at(-1),this._issues.push(W(21,n.firstToken,n.lastToken,n)));let o=this.processDec(),a=new np(n,o);return this.others.push(a),o?o.value!==8&&o.value!==16&&o.value!==32&&o.value!==64&&this._issues.push(W(40,o.firstToken,o.lastToken,o)):this._issues.push(W(39,n.firstToken,n.lastToken,n)),this._issues.push(W(41,a.firstToken,a.lastToken,a,{severity:Qc.DiagnosticSeverity.Warning})),this.mergeStack(),a}isOmitIfNoRefNode(){this.enqueueToStack();let r=this.checkConcurrentTokens([Me(13),rt("omit"),Me(16),rt("if"),Me(16),rt("no"),Me(16),rt("ref"),Me(13)]);if(r.length!==9){this.popStack();return}let n=new ft(oe(r[0],r.at(-1)));return this.mergeStack(),n}isDeleteNode(r,n){this.enqueueToStack();let i=this.checkConcurrentTokens([Me(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),Me(16),rt("node",{allowPartial:!0})]);if(!i.length)return this.popStack(),!1;let s=i[0],o=s,a=new ft;if(a.firstToken=s,i.length===1&&!U(this.currentToken,2)){this._issues.push(W(25,a.firstToken,a.lastToken,a)),a.lastToken=i.at(-1);let d=new jr(a);return r.addNodeChild(d),this.mergeStack(),!0}let c=i.map(d=>d.value??"").join("");if(!"/delete-node/".startsWith(c)||c.endsWith("-"))return this.popStack(),!1;a.lastToken=i.at(-1),c!=="/delete-node"?this._issues.push(W(c.startsWith("/delete-n")?34:25,a.firstToken,a.lastToken,a)):U(this.currentToken,13)?(o=this.moveToNextToken,a.lastToken=o):this._issues.push(W(21,a.firstToken,a.lastToken,a));let l=new jr(a);if(nr(a.lastToken,s)){let d=this.processNodePathRef(r);d&&n==="Name"&&this._issues.push(W(7,d.firstToken,d.lastToken,d));let f=d?void 0:this.isLabelRef(r);f&&n==="Name"&&this._issues.push(W(7,f.firstToken,f.lastToken,f));let p=d||f?void 0:this.isNodeName();p&&n==="Ref"&&this._issues.push(W(10,p.firstToken,p.lastToken,p)),!d&&!p&&!f&&this._issues.push(W([7,10],l.firstToken,l.lastToken,l)),l.nodeNameOrRef=d??f??p??null}else n==="Name"?this._issues.push(W(7,a.firstToken,a.lastToken,a)):n==="Ref"&&this._issues.push(W(10,a.firstToken,a.lastToken,a));let u=this.endStatement(l);return l.lastToken=u,r.addNodeChild(l),this.mergeStack(),!0}isDeleteProperty(r){this.enqueueToStack();let n=this.checkConcurrentTokens([Me(13),rt("d"),rt("e"),rt("lete",{allowPartial:!0}),Me(16),rt("property",{allowPartial:!0})]);if(!n.length)return this.popStack(),!1;let i=n[0],s=i,o=new ft;if(o.firstToken=i,n.length===1&&!U(this.currentToken,2)){this._issues.push(W(25,o.firstToken,o.lastToken,o)),o.lastToken=n.at(-1);let u=new yt(o);return r.addNodeChild(u),this.mergeStack(),!0}let a=n.map(u=>u.value??"").join("");if(!"/delete-property/".startsWith(a)||a.endsWith("-"))return this.popStack(),!1;o.lastToken=n.at(-1),a!=="/delete-property"?this._issues.push(W(a.startsWith("/delete-p")?35:25,o.firstToken,o.lastToken,o)):U(this.currentToken,13)?(s=this.moveToNextToken,o.lastToken=s):this._issues.push(W(21,o.firstToken,o.lastToken,o));let c=new yt(o);if(nr(o.lastToken,i)){let u=this.isPropertyName();u||this._issues.push(W(6,c.firstToken,c.lastToken,c)),c.propertyName=u??null}else this._issues.push(W(6,o.firstToken,o.lastToken,o));let l=this.endStatement(c);return c.lastToken=l,r.addNodeChild(c),this.mergeStack(),!0}isNodePathRef(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processNodePathRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&s.push(...this.processOptionalLabelAssign(!0));let o=new Er(n,i,s);return this.mergeStack(),o}processValue(r){this.enqueueToStack();let i=(()=>{let o=()=>(this.processStringValue()||this.isNodePathRef(r)||this.isLabelRefValue(r)||this.arrayValues(r)||this.processByteStringValue()||this.isExpressionValue(r))??null,a=o();if(!a)return[];let c=[a];for(;!U(this.currentToken,1);){let l=this.prevToken,u=this.currentToken,d,f=U(this.currentToken,24);if(f)d=this.currentToken,this.moveToNextToken;else if(!nr(this.prevToken,this.currentToken))break;let p=o();if(u&&p===null&&f){let h=new Q(oe(u,this.currentToken));this._issues.push(W(0,h.firstToken,h.lastToken,h))}if(!f&&p===null)break;if(l&&!f&&p){let h=new Q(oe(l));this._issues.push(W(28,h.firstToken,h.lastToken,h))}let m=c.at(-1);m&&(m.nextValueSeparator??=d),c.push(p)}return c})();if(i.length===0){this.popStack();return}return this.mergeStack(),new ep(i)}processStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.consumeAnyConcurrentTokens([Me(21)]);if(!n.length){this.popStack();return}if(n.some(u=>u.value===void 0))throw new Error("Token must have value");let i=n.map(u=>u.value).join(`
|
|
277
|
+
`),s=i,o=['"',"'"].some(u=>s.endsWith(u));o&&(s=s.slice(1,-1));let a=new ne(s,oe(n[0],n.at(-1)));o||this._issues.push(W(i.startsWith('"')?16:17,a.firstToken,a.lastToken,a));let c=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(c=this.processOptionalLabelAssign(!0));let l=new Er(r,a,c);return this.mergeStack(),l}arrayValues(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.processBits(),s=this.currentToken;if(U(s,5))this.moveToNextToken;else{this.popStack();return}let o=this.processArrayValues(r)??null;o.openBracket=s;let a=this.processOptionalLabelAssign(!0)??[],c=new Er(n,o,a,i);if(!U(this.currentToken,4))this._issues.push(W(12,c.firstToken,c.lastToken,c));else{let u=this.moveToNextToken;o&&(o.closeBracket=u)}let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=s,c.lastToken=this.prevToken,c}processByteStringValue(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!0),n=this.moveToNextToken,i=n;if(!U(i,11)){this.popStack();return}let s=this.processLabeledValue(()=>this.processHexString()),o=this.processOptionalLabelAssign(!0)??[];s.forEach(u=>{let d=0;u.value&&u.value.firstToken===u.value.lastToken&&(d=u.value.firstToken.pos.len),d%2!==0&&this._issues.push(W(15,u.firstToken,u.lastToken,u))});let a=new en(s??[]);a.openBracket=i,a.values.length===0&&(a.firstToken=n,this._issues.push(W(14,a.firstToken,a.lastToken,a,{severity:Qc.DiagnosticSeverity.Information})));let c=new Er(r,a,o);U(this.currentToken,12)?a.closeBracket=this.moveToNextToken:this._issues.push(W(5,c.firstToken,c.lastToken,c));let l=[];return this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(l=this.processOptionalLabelAssign(!0)),this.mergeStack(),c.endLabels.push(...l),c.firstToken=n,a.lastToken=this.prevToken,c}processLabeledValue(r){this.enqueueToStack();let n=r(),i=[];if(!n)return this.popStack(),[];for(;n;)i.push(n),n=r();if(i.length){let s=r();s&&i.push(s)}return this.mergeStack(),i}processArrayValues(r){this.enqueueToStack();let n=this.processLabeledValue(()=>{let s=()=>this.processRefValue(r,!1)||this.processLabeledHex(!1)||this.processLabeledDec(!1)||this.processLabeledExpression(!0,!1,r),o=this.peekIndex(),a=s();return a&&!this.cPreprocessorParser.optimizeForFormatting&&(a.value instanceof hr&&a.value.params.every(c=>!!c)&&this.cPreprocessorParser.macros.has(a.value.functionName.name)||a.value instanceof pt&&this.cPreprocessorParser.macros.has(a.value.name))&&typeof a.value.evaluate(this.cPreprocessorParser.macros)=="string"?(this.injectPreProcessorResults(this.cPreprocessorParser.macros,a.value,o),s()):a}),i=new gt(n);return n.length===0&&(i.firstToken=this.currentToken),this.mergeStack(),i}processLabeledHex(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processHex();if(!i){this.popStack();return}let s=new fi(i,n);return this.mergeStack(),s}processHexString(){this.enqueueToStack();let r=this.processOptionalLabelAssign(!1),n=this.checkConcurrentTokens([20,20].map(Me));if(!n.length){this.popStack();return}let i=Number.parseInt(n.map(a=>a.value).join(""),16),s=new Yt(i,oe(n[0],n.at(-1)),16),o=new fi(s,r);return this.mergeStack(),o}processLabeledDec(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(r),i=this.processDec();if(!i){this.popStack();return}let s=new fi(i,n);return this.mergeStack(),s}processLabeledExpression(r=!0,n=r,i){this.enqueueToStack();let s=[];r&&(s=this.processOptionalLabelAssign(n));let o=this.processExpression(this.cPreprocessorParser.macros,i);if(!o){this.popStack();return}let a=new fi(o,s);return this.mergeStack(),a}isExpressionValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!1),i=this.processExpression(this.cPreprocessorParser.macros,r);if(!i){this.popStack();return}let s=this.processOptionalLabelAssign(!0),o=new Er(n,i,s);return this.mergeStack(),o}isLabelRef(r){this.enqueueToStack();let n=this.currentToken;if(!n||!U(n,40)){this.popStack();return}else this.moveToNextToken;let i=this.isLabelName();if(!i){let o=new ie(null);return this._issues.push(W(18,n,n,r)),o.firstToken=n,this.mergeStack(),o}n&&(i.firstToken.pos.line!==n.pos.line||i.firstToken.pos.col!==n.pos.colEnd)&&this._issues.push(W(29,n,i.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));let s=new ie(i);return s.firstToken=n,this.mergeStack(),s}isLabelRefValue(r){this.enqueueToStack();let n=this.processOptionalLabelAssign(!0),i=this.isLabelRef(r);if(!i){this.popStack();return}let s=[];this.currentToken&&this.currentToken.pos.line===this.currentToken.prevToken?.pos.line&&(s=this.processOptionalLabelAssign(!0));let o=new Er(n,i,s);return this.mergeStack(),o}processRefValue(r,n){this.enqueueToStack();let i=this.processOptionalLabelAssign(n),s=this.currentToken;if(!s||!U(s,40)){this.popStack();return}let o=this.processNodePathRef(r);if(o!==void 0){let l=new fi(o,i);return this.mergeStack(),l}let a=this.isLabelRef(r);if(a===void 0){this._issues.push(W([18,9],s,s,r));let l=new fi(null,i);return l.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),l}let c=new fi(a,i);return c.firstToken=i.at(0)?.firstToken??s,this.mergeStack(),c}processNodePath(r=!0,n=new Vn){this.enqueueToStack();let i;if(U(this.currentToken,13))i=this.moveToNextToken;else{if(!r){this.popStack();return}this.prevToken&&this._issues.push(W(19,this.prevToken,this.prevToken,n))}let s=this.isNodeName(),o=i??this.prevToken;if(!s&&o&&!r&&this._issues.push(W(7,o,o,n)),!r||s?n.addPath(s??null,i?new Q(oe(i)):void 0):r&&!s&&i&&(n.addPath(new xe("/",oe(i))),n.firstToken=i),r&&!i&&n.children.length===0){this.mergeStack();return}return this.processNodePath(!1,n),this.mergeStack(),n}processNodePathRef(r){this.enqueueToStack();let n=this.moveToNextToken,i=n;if(!U(i,40)){this.popStack();return}let s=this.moveToNextToken;if(i=s,!U(i,2)){this.popStack();return}n&&!Bt(n,s)&&this._issues.push(W(29,n,s,r,{inclusiveStart:!1,inclusiveEnd:!1}));let o=this.processNodePath(),a=new ot(o??null),c=this.currentToken??this.prevToken,l=c;return o?.children.forEach((u,d)=>{if(d===o?.children.length-1&&u&&l&&!Bt(u.lastToken,l)){this._issues.push(W(29,u.lastToken,l,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}if(d===0&&s&&!Bt(s,u?.firstToken)){this._issues.push(W(29,s,u?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}));return}let f=o?.children[d+1];u&&f&&!Bt(u.lastToken,f.firstToken)&&this._issues.push(W(29,u.lastToken,f?.firstToken,r,{inclusiveStart:!1,inclusiveEnd:!1}))}),U(c,3)?this.moveToNextToken:this.prevToken&&this._issues.push(W(3,this.prevToken,this.prevToken,r)),a.firstToken=n,a.lastToken=c??this.prevToken,this.mergeStack(),a}get includes(){return this.allAstItems.filter(r=>r instanceof Sn)}get allAstItems(){return[...this.cPreprocessorParser.allAstItems,...this.rootDocument.children,...this.others,...this.unhandledStatements.properties,...this.unhandledStatements.deleteProperties,...this.unhandledStatements.nodes]}buildSemanticTokens(r,n){let i=[];this.injectedMacros.forEach(s=>{s.buildSemanticTokens((...o)=>xi.push(...o,n,i))}),super.buildSemanticTokens(r,n,i)}};var ip=class t{constructor(e,r,n){this.settings=e;this.formattingOptions=r;this.bindingLoader=n;this._issues=[];this.overlayParsers=[];this.overlays=[];this.ctxNames_=new Set;this.sortKeys=new WeakMap;this.staleUri=new Set;let i={includePaths:[],overlays:[],zephyrBindings:[],deviceOrgTreeBindings:[],deviceOrgBindingsMetaSchema:[],...e,ctxName:e.ctxName??(0,ha.basename)(e.dtsFile),lockRenameEdits:[],showFormattingErrorAsDiagnostics:e.showFormattingErrorAsDiagnostics??!0,disableFileWatchers:e.disableFileWatchers??!1};this.isFullContext=this.settings.dtsFile.toLowerCase().endsWith(".dts"),this.overlays=i.overlays,this.overlays.filter(Zc.existsSync);let s=this.isFullContext&&n?.type==="Zephyr"?[(0,ha.join)((0,ha.dirname)(this.settings.dtsFile),"dts"),...i.includePaths]:i.includePaths;this.parser=new us(i.dtsFile,s),this.ctxNames_.add(i.ctxName),this.id=Ii(i),this.parser.stable.then(()=>{this.overlayParsers=this.overlays?.map(o=>new us(o,s,this.parser.cPreprocessorParser.macros))??[]})}get macros(){return this.allParsers.at(-1).cPreprocessorParser.macros}get ctxNames(){return Array.from(this.ctxNames_)}addCtxName(e){this.ctxNames_.add(e)}removeCtxName(e){this.ctxNames_.delete(e)}async getContextIssues(){return[...(await this.getRuntime()).issues,...this._issues]}async getFileTree(){let e=new Map,r=i=>({file:i,includes:(e.get(i)??[]).map(s=>r(s.resolvedPath??s.path))});return(await this.getRuntime()).includes.forEach(i=>{let s=e.get(i.uri);s||(s=[],e.set(i.uri,s)),s.push({path:i.path.path,resolvedPath:i.resolvedPath})}),{mainDtsPath:r(this.parser.uri),overlays:this.overlays.map(r)}}async stable(){await Promise.all([this.parser.stable,...this.overlayParsers.map(e=>e.stable)])}async getRuntime(){return await this.stable(),this._runtime??=this.evaluate(),this._runtime}getContextFiles(){return[...this.overlayParsers.flatMap(e=>e.getFiles()),...this.parser.getFiles()]}isInContext(e){return this.getContextFiles().some(r=>pe(r,e))}getUriParser(e){let r=this.overlayParsers.find(n=>n.getFiles().some(i=>pe(i,e)));return r??=this.parser.getFiles().some(n=>pe(n,e))?this.parser:void 0,r}async getAllStableParsers(){return await this.stable(),this.allParsers}get allParsers(){return[this.parser,...this.overlayParsers]}async getDocumentLinks(e,r){if(!this.isInContext(e))return[];let i=(await this.getRuntime()).rootNode.allBindingsProperties.filter(s=>pe(s.ast.uri,e)&&(!r||Pr(s.ast,e,r))).flatMap(s=>s.ast.values?.values.flatMap(o=>{let c=s.parent?.nodeTypes.find(l=>o?.value instanceof ne&&l.compatible===o.value.value);return c?{range:fe(o.value),target:ue(c.bindingsPath)}:void 0})).filter(s=>!!s)??[];return[...this.parser.cPreprocessorParser.dtsIncludes.filter(s=>pe(s.uri,e)&&(!r||Pr(s,e,r))).map(s=>{let o=this.parser.cPreprocessorParser.resolveInclude(s);if(o)return{range:fe(s.path),target:ue(o)}}).filter(s=>!!s)??[],...i]}linkPropertiesLabelsAndNodePaths(e){let r=s=>[...s.properties,...s.nodes.flatMap(r)],n=r(e.rootNode),i=e.rootNode.allDescendantsLabels;n.forEach(s=>s.ast.allDescendants.forEach(o=>{if(o instanceof ie){let a=e.resolvePath([`&${o.label?.value}`],i);if(a){let c=e.rootNode.getChild(a);o.linksTo=c,c?.linkedRefLabels.push(o)}else o.value&&this._issues.push(Ft(3,o.firstToken,o.lastToken,o,{templateStrings:[o.value]}))}else o instanceof Vn&&this.linkNodePath(o,e.rootNode)}))}linkNodePath(e,r){let n=r,i=e.pathParts;for(let s=0;s<i.length&&i[s];s++){let o=!1,a=i[s];if(a){let c=s===0&&a.name==="/"?r:n?.getNode(a.name,a.fullAddress,!1);a.linksTo=c,!o&&!c&&(o=!0,this._issues.push(Ft(8,a.firstToken,a.lastToken,a,{templateStrings:[a.toString(),`${e.pathParts.filter(l=>l?.linksTo).map(l=>l?.toString()).join("/")}`]}))),c?.linkedNodeNamePaths.push(a),n=c}else break}}setStaleUri(e){this.staleUri.add(e)}async reevaluate(e){this.setStaleUri(e);let r=new Set;return this.staleUri.forEach(n=>{let i=this.getUriParser(n);i&&r.add(i)}),r.size?(this.sortKeys=new WeakMap,await Promise.all(Array.from(r).map(n=>n.reparse())),this._runtime=this.evaluate(),this._runtime):this._runtime}getSortKey(e){if(e)return this.sortKeys.get(e.firstToken)}async evaluate(){let e=performance.now();await this.stable();let r=new di(this);this.staleUri.clear(),this._issues=[],this.parser.rootDocument.resetIssues(),this.processRoot(this.parser.rootDocument,r);for(let n=0;n<this.overlayParsers.length;n++)this.overlayParsers[n].rootDocument.resetIssues(),this.processRoot(this.overlayParsers[n].rootDocument,r);return r.includes=this.parser.includes,r.comments=this.parser.cPreprocessorParser.allAstItems.filter(n=>n instanceof nn),(await this.getAllStableParsers()).flatMap(n=>n.tokens).forEach((n,i)=>this.sortKeys.set(n,i)),this.linkPropertiesLabelsAndNodePaths(r),this.reportNodeNameAndPropertyClashes(r),console.log(`(ID: ${this.id}) evaluate`,performance.now()-e),r}reportNodeNameAndPropertyClashes(e){let r=n=>{n.properties.forEach(i=>{n.nodes.filter(o=>o.address===void 0&&o.name===i.ast.propertyName?.name&&o.definitions.at(-1)?.name).forEach(o=>{let a=o.definitions[o.definitions.length-1].name;this._issues.push(Ft(2,a.firstToken,a.lastToken,a,{linkedTo:[i.ast,...i.allReplaced.map(c=>c.ast)]}))})}),n.nodes.forEach(r)};r(e.rootNode)}processRoot(e,r){for(let n=0;n<e.children.length;n++){let i=e.children[n];this.processChild(i,r.rootNode,r)}}processChild(e,r,n){e instanceof Fe?this.processDtcBaseNode(e,r,n):e instanceof We?this.processDtcProperty(e,r,n):e instanceof jr?this.processDeleteNode(e,r,n):e instanceof yt&&this.processDeleteProperty(e,r,n)}checkNodeUniqueNames(e,r){let n=(o,a)=>o.filter(c=>c.name===a.name&&(c.address===a.fullAddress&&c.address===void 0||yn(c.address??[],a.fullAddress??[])===0)).map(c=>c.issueAst),i=r.nodes.map(o=>({name:o.name,address:o.address,issueAst:o.definitions[0].name??o.definitions[0]})),s=[];e.children.forEach(o=>{if(o instanceof Xe&&o.name){let a=n(s.map(c=>({name:c.name,address:c.fullAddress,issueAst:c})),o.name);a.length&&this._issues.push(Ft(2,o.name.firstToken,o.name.lastToken,o.name,{linkedTo:a})),s.push(o.name)}else if(o instanceof jr&&o.nodeNameOrRef instanceof xe){let a=o.nodeNameOrRef;n(i,a)&&(s=s.filter(c=>n(s.map(l=>({name:l.name,address:l.fullAddress,issueAst:l})),c).length))}})}getCompileCommands(){if(!(!this.settings.compileCommands||!(0,Zc.existsSync)(this.settings.compileCommands)))return JSON.parse((0,Zc.readFileSync)(this.settings.compileCommands).toString())}processDtcBaseNode(e,r,n){e instanceof Ot?this.processDtcRootNode(e,n):e instanceof Xe?this.processDtcChildNode(e,r,n):e instanceof mr&&this.processDtcRefNode(e,n)}processDtcRootNode(e,r){r.roots.push(e),r.rootNode.definitions.push(e),this.checkNodeUniqueNames(e,r.rootNode),e.children.forEach(n=>this.processChild(n,r.rootNode,r))}processDtcChildNode(e,r,n){if(e.name?.name){let i=e.path?n.resolvePath(e.path):void 0,o=(i?n.rootNode.getChild(i):void 0)??new X(this.bindingLoader,e.name.name,e.name.fullAddress,r);o.definitions.push(e),e.labels.forEach(a=>a.lastLinkedTo=o),r=o,this.checkNodeUniqueNames(e,o)}e.children.forEach(i=>this.processChild(i,r,n))}processDtcRefNodeLabelRef(e,r,n){let i,s=e.resolveNodePath??(e.pathName?n.resolvePath([e.pathName]):void 0);return s?(e.resolveNodePath??=[...s],i=n.rootNode.getChild(s),r.linksTo=i,e.labels.forEach(o=>o.lastLinkedTo=i),i?.linkedRefLabels.push(r),i?.referencedBy.push(e),e.labels.forEach(o=>{n.labelsUsedCache.set(o.label.value,s)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):(this._issues.push(Ft(3,r.firstToken,r.lastToken,r,{templateStrings:[r.label?.value??""]})),n.unlinkedRefNodes.push(e)),i}processDtcRefNodeNodePathRef(e,r,n){let i;r.path&&this.linkNodePath(r.path,n.rootNode);let o=r.path?.pathParts.at(-1)?.linksTo?.path;return o?(e.resolveNodePath??=o,i=n.rootNode.getChild(o),e.labels.forEach(a=>a.lastLinkedTo=i),i?.referencedBy.push(e),e.labels.forEach(a=>{n.labelsUsedCache.set(a.label.value,o)}),i?(n.references.push(e),this.checkNodeUniqueNames(e,i)):n.unlinkedRefNodes.push(e)):n.unlinkedRefNodes.push(e),i}processDtcRefNode(e,r){let n;e.reference?e.reference instanceof ie?n=this.processDtcRefNodeLabelRef(e,e.reference,r):n=this.processDtcRefNodeNodePathRef(e,e.reference,r):r.unlinkedRefNodes.push(e),e.children.forEach(i=>this.processChild(i,n??new X(this.bindingLoader,""),r))}processDtcProperty(e,r,n){e.propertyName?.name&&r.addProperty(new Ze(e,r)),e.children.forEach(i=>this.processChild(i,r,n))}processDeleteNode(e,r,n){if(e.nodeNameOrRef instanceof xe&&e.nodeNameOrRef.value){if(e.parentNode?.parentNode)if(!r.hasNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress))this._issues.push(Ft(5,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef));else{r.deletes.push(e);let i=r.getNode(e.nodeNameOrRef.name,e.nodeNameOrRef.fullAddress);e.nodeNameOrRef.linksTo=i,r.deleteNode(e.nodeNameOrRef.name,e,e.nodeNameOrRef.fullAddress),i?.labels.forEach(s=>{n.labelsUsedCache.delete(s.label.value)})}}else if(e.nodeNameOrRef instanceof ie&&e.nodeNameOrRef.value){let i=n.resolvePath([`&${e.nodeNameOrRef.value}`]),s;i?(s=n.rootNode.getChild(i),r.deletes.push(e),e.nodeNameOrRef.linksTo=s,s?.labels.forEach(o=>{n.labelsUsedCache.delete(o.label.value)}),s?.linkedRefLabels.push(e.nodeNameOrRef),s?.parent?.deleteNode(s.name,e,s.address),e.parentNode instanceof Fe&&!e.parentNode.pathName&&n.globalDeletes.push(e)):(n.unlinkedDeletes.push(e),this._issues.push(Ft(3,e.nodeNameOrRef.firstToken,e.nodeNameOrRef.lastToken,e.nodeNameOrRef,{templateStrings:[e.nodeNameOrRef.value]})))}else if(e.nodeNameOrRef instanceof ot&&e.nodeNameOrRef.path&&!e.nodeNameOrRef.path.pathParts.some(i=>!i)){let i=n.rootNode,s=e.nodeNameOrRef.path.pathParts;for(let c=0;c<s.length&&s[c];c++){let l=s[c];if(l){let u=i?.getNode(l.name,l.fullAddress,!1);l.linksTo=u,u?.linkedNodeNamePaths.push(l),i=u}}let o=e.nodeNameOrRef.path.pathParts.find(c=>c&&!c.linksTo),a=e.nodeNameOrRef.path.pathParts.at(-1)?.linksTo;a||(n.unlinkedDeletes.push(e),o&&this._issues.push(Ft(8,o.firstToken,o.lastToken,o,{templateStrings:[o.toString(),`${e.nodeNameOrRef.path.pathParts.filter(c=>c?.linksTo).map(c=>c?.toString()).join("/")}`]}))),r.deletes.push(e),a?.labels.forEach(c=>{n.labelsUsedCache.delete(c.label.value)}),a?.parent?.deleteNode(a.name,e,a.address),e.parentNode instanceof Fe&&!e.parentNode.pathName&&n.globalDeletes.push(e)}else n.unlinkedDeletes.push(e);e.children.forEach(i=>this.processChild(i,r,n))}processDeleteProperty(e,r,n){e.propertyName?.name&&!r.hasProperty(e.propertyName.name)?this._issues.push(Ft(1,e.propertyName.firstToken,e.propertyName.lastToken,e.propertyName)):e.propertyName?.name&&(r.deletes.push(e),r.deleteProperty(e.propertyName.name,e)),e.children.forEach(i=>this.processChild(i,r,n))}static#e(e,r,n){let i=n.get(r);i||(i=[],n.set(r,i)),i.push(e)}getIssues(e,r=new Map,n=i=>{if(!(i.raw.severity===to.DiagnosticSeverity.Hint&&i.raw.virtual))return i.raw.severity===to.DiagnosticSeverity.Error&&!this.isFullContext&&(i.raw.severity=to.DiagnosticSeverity.Warning),i}){return e.forEach(i=>{let s=n(i);s&&t.#e(s.diagnostic(),s.raw.uri,r)}),r}async getSyntaxIssues(e=new Map,r=n=>{if(n.raw.severity===to.DiagnosticSeverity.Error&&!this.isFullContext&&!Xs(n.raw,n.raw.uri,!1)&&(n.raw.severity=to.DiagnosticSeverity.Warning),!(n.raw.severity===to.DiagnosticSeverity.Hint&&n.raw.virtual))return n}){return(await this.getAllStableParsers()).forEach(n=>this.getIssues(n.issues,e,r)),e}async getDiagnostics(){let e=new Map;try{await this.getSyntaxIssues(e);let r=await this.getContextIssues()??[];this.getIssues(r,e);let n=await this.getRuntime();return this.getIssues(n.typesIssues,e),e}catch(r){throw console.error(r),r}}async toFullString(){return`/dts-v1/;
|
|
278
278
|
${(await this.getRuntime()).rootNode.toFullString((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros,this.settings.cwd)}`}async serialize(){return await this.stable,await this.getDiagnostics(),(await this?.getRuntime())?.rootNode.serialize((await this.getAllStableParsers()).at(-1).cPreprocessorParser.macros)}};var cD=require("fs"),ma=require("path"),xt=q(j());function IU(t){if(!t||!(t.ast instanceof ua))return[];let e=n=>n.flatMap(i=>{try{return(0,cD.readdirSync)(i,{withFileTypes:!0,recursive:!0}).filter(s=>s.name.toLowerCase().endsWith(".dtsi")||s.name.toLowerCase().endsWith(".h")).map(s=>({label:`${(0,ma.join)((0,ma.relative)(i,s.parentPath),s.name)}`,kind:xt.CompletionItemKind.File}))}catch{return[]}});if(t.ast.relative)return e([(0,ma.dirname)(t.ast.uri)]);let r=t.runtime.context.settings.includePaths??[];return e(r)}var sp=(t,e)=>[...t.labels.filter(e),...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>sp(r.node,e)),...t.nodes.flatMap(r=>sp(r,e))],AT=(t,e)=>[...t.labels,...t.deletedNodes.filter(r=>!e(r.by)).flatMap(r=>AT(r.node,e)),...t.nodes.flatMap(r=>AT(r,e))];function OU(t,e){if(!t||!(t.item instanceof Ze)||!(t.ast instanceof ie))return[];let r=i=>AT(i,e),n=new Map;return r(t.runtime.rootNode).forEach(i=>n.set(i.label.value,i)),Array.from(n).map(([,i])=>({label:`${i.label.value}`,kind:xt.CompletionItemKind.Method,documentation:i.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function xU(t,e){if(!t||t.item!==null||!(t.ast instanceof ie)||!(t.ast.parentNode instanceof mr))return[];let r=n=>sp(n,e).filter(i=>e(i));return[...Array.from(new Set(r(t.runtime.rootNode).map(n=>n.label.value))).map(n=>({label:n,insertText:t.ast.lastToken.nextToken?.value==="{"?n:`${n} {
|
|
279
279
|
$1
|
|
280
|
-
};`,kind:xt.CompletionItemKind.Value,insertTextFormat:xt.InsertTextFormat.Snippet}))]}function MU(t,e){let r=s=>s?s.parentNode instanceof mr||s.parentNode instanceof Ot||s.parentNode instanceof Xe?!1:r(s.parentNode):!0;if(!t||t.item!==null||!Vt(t.ast)||!r(t.ast))return[];let n=s=>sp(s,e).filter(o=>e(o));if(t.ast instanceof ft)return n(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:t.runtime.rootNode.nodes.length?[{label:"/delete-node/ &{}",insertText:"/delete-node/ {/$1};",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[];let i=new Map;return n(t.runtime.rootNode).forEach(s=>i.set(s.label.value,s)),Array.from(i).map(([,s])=>({label:t.ast instanceof ie?`${s.label.value}`:`&${s.label.value}`,kind:xt.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function LU(t,e){if(!t||!(t.item instanceof X)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Rr)||t.beforeAst?.parentNode instanceof yt))return[];let r=n=>[...n.nodes,...n.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.definitions.filter(s=>s instanceof Xe)})).filter(i=>i.astNodes.some(e));return t.ast instanceof xe||t.ast instanceof jr||t.beforeAst?.parentNode instanceof jr?r(t.item).map(n=>({label:`${n.astNodes.at(0)?.name?.toString()}`,kind:xt.CompletionItemKind.Variable,documentation:n.node.toMarkupContent(t.runtime.context.macros)})):r(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function qU(t,e){if(!t||!(t.item instanceof X)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Rr)||t.beforeAst?.parentNode instanceof jr))return[];let r=n=>[...n.properties,...n.deletedProperties.filter(i=>!e(i.by)).map(i=>i.property)].flatMap(i=>[i,...i.allReplaced]).filter(i=>e(i.ast));if(t.ast instanceof tt||t.ast instanceof yt||t.beforeAst?.parentNode instanceof yt){let n=new Map;return r(t.item).forEach(i=>n.set(i.name,i)),Array.from(n).map(([,i])=>({label:`${i.name}`,kind:xt.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return r(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:xt.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:xt.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function $U(t,e){let r=t?.ast instanceof Hn?t.ast:t?.ast.parentNode;if(!t||!r||!(r instanceof Hn))return[];let n=r.pathParts.slice(0,-1);if(n.some(o=>!o))return[];let i=n.map(o=>o.toString());return(()=>{let o=t.runtime.rootNode.getChildFromScope(["/",...i],e);return[...o?.nodes.filter(a=>!Vt(t.ast)||a.definitions.some(e))??[],...o?.deletedNodes.filter(a=>!e(a.by)).map(a=>a.node)??[]]})().map(o=>({label:`/${[...i,o.fullName].join("/")}`,kind:xt.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function FU(t){return!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken)||t.ast instanceof ne?[]:!Qs(t?.ast)&&!(t.ast instanceof We&&t.item.ast.values===null)&&!Qs(t.beforeAst)&&!Qs(t.afterAst)?[]:t.item.parent.nodeType instanceof Et?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,n])=>n.macro.identifier instanceof ui?{label:`${n.macro.identifier.toString()}`,insertText:`${n.macro.name}(${n.macro.identifier.params.map((i,s)=>i instanceof pt?`$${s+1}`:"").join(", ")})`,kind:xt.CompletionItemKind.Function,sortText:`~${n.macro.name}`,insertTextFormat:xt.InsertTextFormat.Snippet}:{label:n.macro.identifier.name,kind:xt.CompletionItemKind.Variable,sortText:`~${n.macro.name}`}):[]}async function lD(t,e){return Pt(t,e,(r,n)=>[...qU(r,n),...LU(r,n),...MU(r,n),...$U(r,n),...xU(r,n),...OU(r,n),...IU(r),...FU(r)])}var Fp=q(j());var dD=require("child_process");var IT=t=>/[A-Za-z0-9_]/.test(t);function BU(t,e){let r=[];for(let n=0;n<e;n++){let i=t[n];i==="("?r.push(n):i===")"&&r.pop()}return r.length?r[r.length-1]:void 0}function uD(t,e){let r=1;for(let n=e+1;n<t.length;n++){let i=t[n];if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}}function fD(t,e,r){let n=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<r;f++){let p=t[f];if(p==="'"&&!o)s=!s;else if(p==='"'&&!s)o=!o;else if(!s&&!o){if(p==="(")i++;else if(p===")")i--;else if(p===","&&i===0){let m=a,h=f,T=m,_=h;for(;T<_&&/\s/.test(t[T]);)T++;for(;_>T&&/\s/.test(t[_-1]);)_--;n.push({start:m,end:h,text:t.slice(T,_)}),a=f+1}}}let c=a,l=r,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return n.push({start:c,end:l,text:t.slice(u,d)}),n}function OT(t){let e=t.trim(),r=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!r)return{macro:e};let n=r[1],i=r[2],s=fD(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=OT(a.text);return c.parent=o,c}),o}function Mi(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&IT(r[i-1]);)i--;for(;s<r.length&&IT(r[s]);)s++;if(r[s]==="("){let T=uD(r,s);T!==void 0&&(s=T+1)}let o=r.slice(i,s),a=o.trim().length?OT(o):void 0,c=BU(r,n);if(c===void 0)return a;let l=uD(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&IT(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=fD(r,c+1,l),m={macro:f,args:[]};m.args=p.map(T=>{let _=OT(T.text);return _.parent=m,_});let h=-1;for(let T=0;T<p.length;T++){let _=p[T];if(n>=_.start&&n<=_.end){h=T;break}}if(h>=0){let T=m.args[h];return T.argIndexInParent=h,T}return m}function jU(t,e,r){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(r.line,i.length-1);o>=0;o--){let a=i[o],c=s.exec(a);if(c){let l=a.indexOf(c[0]),u=a.indexOf(c[3],l);return Xt.create(o,u>=0?u:a.length)}}}async function ds(t,e,r,n){let i=pD(t,e,r);if(i)return i;let s=await HU(e,n,Pe(t.uri));if(s)return[s,r]}function pD(t,e,r){if(e.startsWith("DT_"))return;let n=jU(t,e,r);if(!n)return;let i=Mi(t,n);if(i)return[i,n]}var UU=(t,e)=>new Promise(r=>{let n=(0,dD.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";n.stdout.on("data",s=>{i+=s.toString()}),n.on("close",s=>{r(s?"":i)})});async function HU(t,e,r){let n=e.getCompileCommands()?.find(s=>pe(s.file,r));if(!n)return;let i=`${n.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${n.file}`;try{let[s,...o]=i.split(" "),a=await UU(s,o.filter(u=>!!u)),c=$r.create(`macros://${n.file}`,"devicetree",0,a),l=pD(c,t,c.positionAt(a.length-1));if(l)return l[0]}catch(s){console.error(s)}}function Z(t){return t.toLowerCase().replace(/[@,-\.]/g,"_")}var el=q(j());async function hD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:el.CompletionItemKind.Function,insertTextFormat:el.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let r=await e.getRuntime();return r.rootNode.getNode("aliases")?.properties.map(n=>{let i=n.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof Hn&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(n.name),kind:el.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var tl=q(j());async function yr(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();return i?.length===0?!0:i?.map(s=>{if(s instanceof ot)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof ge){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function op({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?yr(o,s[1].macro,r):void 0}async function mD(t,e){let r=await op(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function gD(t,e,r,n){if(r=typeof r=="number"?r:Ce(r),typeof r!="number")return;let i=await yr(t,e,n);if(i===!0)return!0;if(!i)return;let s=i.at(r);if(s)return i.length===1&&i[0]instanceof X?i[0]:s}async function ap({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return gD(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function yD(t,e){let r=await ap(t,e);if(typeof r!="boolean"&&r instanceof X)return r}async function Vr(t,{document:e,context:r,macro:n,position:i},s){return t||(await s({document:e,macro:n,context:r,position:i})??n.macro)}async function cp(t,e,r,n){return Vr(await yr(t,e,r.context),r,n)}async function ga({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_OR"||e.args?.length!==3)return;let[s,o,a]=e.args,c=await i({document:t,macro:s,context:r,position:n});return await cp(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function TD(t,e){let r=await ga(t,e);if(r instanceof X)return r;if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function vD(t){let e=t?.nodeType?.onBus,r=t?.parent?.nodeType?.bus;return t&&r?.length&&r?.some(n=>n===e)?t.parent??void 0:void 0}async function lp(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_BUS"||r?.length!==1)return;let n=await e({...t,macro:r[0]});return await vD(n)}async function up(t,e){let r=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!r)return;let s=r?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof ot)return s.path?.pathParts.at(-1)?.linksTo}async function dp(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await up(t.context,e[0].macro)}async function fp(t,e){let r=await e?.getRuntime();if(r){let n=di.getNodeFromPath(["aliases"],r.rootNode,!0),i=n?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof ne?n=r.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?n=s[0].linksTo:s?.[0]instanceof ot&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function pp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return fp(t.args[0].macro,e)}async function bD(t,e){return t?.nodes.find(r=>Z(r.name)===e)}async function hp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return bD(s,e.args[1].macro)}var xT=(t,e)=>t.nodes.filter(r=>!r.disabled&&r.nodeType).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...xT(r,e)]:xT(r,e));async function SD(t,e){let r=await e?.getRuntime();if(r)return xT(r.rootNode,t)}async function MT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return SD(t.args[0].macro,e)}async function _D(t){return(await MT(t))?.at(0)}async function kD(t){return t?.parent?.parent??void 0}async function mp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return kD(s)}var LT=(t,e)=>t.nodes.filter(r=>r.nodeType).sort((r,n)=>r.disabled===n.disabled?0:r.disabled?1:-1).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...LT(r,e)]:LT(r,e));async function ND(t,e,r){let n=await r?.getRuntime();if(n)return LT(n.rootNode,e).at(t)}async function gp({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Ce(t.args[0].macro);if(typeof r=="number")return ND(r,t.args[1].macro,e)}async function RD(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return di.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function yp({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return RD(t.args[0].macro,e)}async function PD(t){return t?.parent??void 0}async function Tp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return PD(s)}var ED=(t,e)=>{if(!e.length)return t;let r=e.splice(0,1)[0],n=t.nodes.find(i=>Z(i.fullName)===r);return n?ED(n,e):void 0};async function vp(t,e){let r=await e?.getRuntime();if(r)return ED(r.rootNode,t)}async function bp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return vp(r.map(n=>n.macro),e)}async function Sp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function ya(t,e,r){let n=t?.properties.find(c=>Z(c.name)===e);if(!n)return;let i=n?.ast.quickValues?.at(r),s=n.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof Et))return;let a=s.properties.find(c=>c.getNameMatch(n.name))?.values(n).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function _p(t,e,r,n,i){return Vr(await ya(t,e,r),n,i)}async function kp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await _p(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function Np({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await _p(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function fs(t,e,r,n,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof Et))return;if(typeof r=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(r=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===r)??-1,r===-1)return}let a=s.nexusMapsTo.at(r),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(n);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof ge){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function Ta(t,e,r,n,i,s){return Vr(await fs(t,e,r,n,i.context),i,s)}async function Rp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return Ta(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Pp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ta(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function pi(t,e,r=0){let n=t?.properties.find(s=>Z(s.name)===e);if(r=typeof r=="number"?r:Ce(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof ot)return i.path?.pathParts.at(-1)?.linksTo}async function ps({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return pi(o,s[1].macro,0)}async function hi({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return pi(o,s[1].macro,s.at(2)?.macro)}async function wD(t,e,r){let n=t?.properties.find(l=>Z(l.name)===e);if(!n)return;let i=n.parent.nodeType;if(!i||!(i instanceof Et))return;let s=n.nexusMapsTo.at(0)?.specifierSpace,a=(s?n.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===r)??-1;return a===-1?void 0:n.nexusMapsTo.at(a)?.target}async function Ep({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_NAME"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await wD(o,s[1].macro,s[2].macro)}async function wp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ta(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function Cp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return cp(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function Dp(t,e){if(!t)return;let r=t?.properties.find(n=>Z(n.name)===e);return r?.nexusMapsTo.length?r.nexusMapsTo.length:r?.ast.getFlatAstValues()?.length}async function CD(t,e,r,n){if(t)return Vr(await Dp(t,e),r,n)}async function Ap({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?CD(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function va(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return Z(n[0].value)}async function DD(t,e,r,n){if(t)return Vr(await va(t,e),r,n)}async function Ip({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return DD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Op(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return n[0].value}async function AD(t,e,r,n){if(t)return Vr(await Op(t,e),r,n)}async function xp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return AD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Mp(t,e){return(await va(t,e))?.toUpperCase()}async function ID(t,e,r,n){if(t)return Vr(await Mp(t,e),r,n)}async function Lp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return ID(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function Wn(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof X)return n}}async function M({macro:t,document:e,context:r,position:n}){["DT_ALIAS","DT_NODELABEL"].some(a=>a===t.parent?.macro)||t.parent?.macro==="DT_CHILD"&&t.argIndexInParent===1?t=t.parent:t.parent?.macro==="DT_HAS_ALIAS"?(t=t.parent,t.macro="DT_ALIAS"):t.parent?.macro==="DT_PATH"&&(t.parent.args=t.parent.args?.slice(0,(t.argIndexInParent??0)+1)??[],t=t.parent);let s=await[lp,dp,pp,hp,_D,mp,gp,yp,Tp,bp,ps,hi,Ep,yD,mD,TD,Sp,Wn(kp),Wn(Np),Wn(Rp),Wn(Pp),Wn(wp),Wn(Cp),Wn(Ap),Wn(ga),Wn(Ip),Wn(xp),Wn(Lp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},M)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ds(e,t.macro,n,r);if(o)return M({document:e,macro:o[0],context:r,position:n})}async function OD({macro:t,document:e,context:r,position:n}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:tl.CompletionItemKind.Function,insertTextFormat:tl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:Z(s.fullName),kind:tl.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var rl=q(j());function xD({macro:t,context:e}){return t.macro&&"DT_COMPAT_GET_ANY_STATUS_OKAY".startsWith(t.macro)?[{label:"DT_COMPAT_GET_ANY_STATUS_OKAY(...)",insertText:"DT_COMPAT_GET_ANY_STATUS_OKAY($1)",kind:rl.CompletionItemKind.Function,insertTextFormat:rl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:rl.CompletionItemKind.Property}))??[]}var nl=q(j());function MD({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:nl.CompletionItemKind.Function,insertTextFormat:nl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:nl.CompletionItemKind.Property}))??[]}var il=q(j());async function LD({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:il.CompletionItemKind.Function,insertTextFormat:il.InsertTextFormat.Snippet}];let r=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(r.rootNode.allDescendantsLabels.map(async n=>({label:n.label.value,kind:il.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var sl=q(j());async function qD({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:sl.CompletionItemKind.Function,insertTextFormat:sl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await vp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:Z(n.fullName),kind:sl.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var $D=q(j());async function FD({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:$D.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var qp=q(j());function BD({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:qp.CompletionItemKind.Snippet,insertTextFormat:qp.InsertTextFormat.Snippet}]:[]}var ol=q(j());async function J({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>M({document:e,macro:l,context:n,position:r})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:ol.CompletionItemKind.Function,insertTextFormat:ol.InsertTextFormat.Snippet}];if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let l=await c(t.parent.args[0]);return(a?l?.properties.filter(a):l?.properties)?.map(d=>({label:Z(d.name),kind:ol.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function jD(t){return J(t,"DT_ENUM_HAS_VALUE",1,3)}async function UD(t){return J(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function HD(t){return J(t,"DT_ENUM_IDX",1,2)}async function VD(t){return J(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function zD(t){return J(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function WD(t){return J(t,"DT_ENUM_IDX_OR",1,3)}var GD=q(j());async function Li({macro:t,document:e,context:r,position:n},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.properties.find(f=>Z(f.name)===t.parent?.args?.at(1)?.macro),l=0;if(typeof o=="string"){let f=c?.nexusMapsTo.at(0)?.specifierSpace;if(l=(f?c.parent.getProperty(`${f}-names`)?.ast.quickValues:void 0)?.findIndex(m=>typeof m=="string"&&m.toLowerCase()===o)??-1,l===-1)return[]}let u=c?.nexusMapsTo.at(l);return u?.target.nodeType?.cellsValues?.find(f=>u.specifierSpace&&f.specifier===u.specifierSpace)?.values.map(f=>({label:Z(f),kind:GD.CompletionItemKind.Property}))??[]}async function KD(t){return t.macro.argIndexInParent===2?Li(t,"DT_PHA",2,0):J(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var YD=q(j());async function VU({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:n,position:r}))?.properties.find(a=>Z(a.name)===e.parent?.args?.at(1)?.macro);return Array(o?.nexusMapsTo.length??0)?.map((a,c)=>({label:c.toString(),kind:YD.CompletionItemKind.Property}))??[]}async function XD(t){if(t.macro.argIndexInParent===2)return VU(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Ce(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Li(t,"DT_PHA_BY_IDX",3,e)}return J(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var JD=q(j());async function al({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:r,position:n}))?.properties.find(l=>Z(l.name)===e.parent?.args?.at(1)?.macro),a=o?.nexusMapsTo.at(0)?.specifierSpace;return(a?o.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.filter(l=>typeof l=="string")?.map(l=>({label:l,kind:JD.CompletionItemKind.Property}))??[]}async function QD(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Li(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:J(t,"DT_PHA_BY_NAME",1,3,r=>!!r.nexusMapsTo.length)}async function ZD(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Li(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:J(t,"DT_PHA_BY_NAME_OR",1,3,r=>!!r.nexusMapsTo.length)}async function eA(t){let{macro:e}=t;return e.argIndexInParent===2?Li(t,"DT_PHA_OR",2,0):J(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function $p(t){return J(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function ba(t){return J(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function tA(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHANDLE_BY_NAME"):J(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof ot))}async function rA(t){return J(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function nA(t){return J(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function iA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?ba({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX",3,4,r=>!r.nexusMapsTo.length,()=>hi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function sA(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?$p({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE",2,3,r=>!r.nexusMapsTo.length,()=>ps({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},M))}async function oA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?ba({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,r=>!r.nexusMapsTo.length,()=>hi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function aA(t){return J(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function cA(t){return J(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function lA(t){return J(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function uA(t){return J(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function dA(t){return J(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function fA(t){return J(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function pA(t){return J(t,"DT_STRING_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function hA(t){return J(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function mA(t){return J(t,"DT_STRING_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function gA(t){return J(t,"DT_STRING_UNQUOTED",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function yA(t){return J(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function TA(t){return J(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function vA(t){return J(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function bA(t){return J(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function SA(t){return J(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}var cl=q(j());async function _A({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:Z(r),kind:cl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:cl.CompletionItemKind.Function,insertTextFormat:cl.InsertTextFormat.Snippet}]:[]}async function kA(t){return J(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function NA(t){return J(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var zU=["DT_BUS","DT_CHILD_NUM","DT_CHILD_NUM_STATUS_OKAY","DT_GPARENT","DT_HAS_ALIAS","DT_NODE_CHILD_IDX","DT_NODE_FULL_NAME","DT_NODE_FULL_NAME_TOKEN","DT_NODE_FULL_NAME_UNQUOTED","DT_NODE_FULL_NAME_UPPER_TOKEN","DT_NODE_HASH","DT_NODE_PATH","DT_NODELABEL_STRING_ARRAY","DT_PARENT"];async function RA(t,e,r){if(!r)return[];let n=Mi(r,t.position);return n?(await Promise.all([_A,kA,NA,hD,OD,xD,MD,WU,LD,qD,FD,BD,UD,jD,VD,zD,HD,WD,XD,QD,ZD,KD,ba,tA,$p,eA,nA,sA,iA,oA,rA,aA,cA,lA,uA,dA,fA,pA,hA,mA,gA,yA,TA,vA,bA,SA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function WU({macro:t}){return t.macro?zU.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Fp.CompletionItemKind.Function,insertTextFormat:Fp.InsertTextFormat.Snippet})):[]}var _n=q(j());function GU(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>{let i=n.parent.deletedProperties.find(s=>s.property===n)?.by;return[n.ast,...n.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=Br(s.uri);if(o)return _n.Location.create(ue(o.docUri),o.range);if(s instanceof We)return _n.Location.create(ue(s.uri),fe(s.propertyName??s));if(s instanceof yt)return _n.Location.create(ue(s.uri),fe(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function KU(t){if(!t)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"&&t.runtime.rootNode.getChild(a[0].split("/"))===r)return!0}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&(o.by.nodeNameOrRef instanceof xe?o.by.nodeNameOrRef!==t.ast:!r.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedRefLabels,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{let a=o&&Br(o?.uri);if(a)return _n.Location.create(ue(a.docUri),a.range);if(o instanceof Ot)return _n.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof Xe)return _n.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof xe)return _n.Location.create(ue(o.uri),fe(o));if(o instanceof xe)return _n.Location.create(ue(o.uri),fe(o));if(o instanceof ie)return _n.Location.create(ue(o.uri),fe(o.label??o));if(o instanceof We)return _n.Location.create(ue((o.values??o)?.uri),fe(o.values??o))}).filter(o=>o)};if(t.item instanceof X&&!Vt(t.ast))return e(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return Vt(t.ast)?[...e(t.ast.linksTo),_n.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function PA(t,e){return Pt(t,e,r=>[...KU(r),...GU(r)])}var qi=q(j());function EA(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>[n.ast,...n.allReplaced.map(i=>i.ast),n.parent.deletedProperties.find(i=>i.property===n)?.by??[]].map(i=>{if((i instanceof We||i instanceof yt)&&i.propertyName)return qi.Location.create(ue(i.uri),fe(i.propertyName))}).filter(i=>i);if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function wA(t,e){if(!e||!(e.ast instanceof ir))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof ls&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.definitions.filter(s=>s instanceof Xe).flatMap(s=>s.labels.map(o=>o.label)),...i.referencedBy.flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return qi.Location.create(ue(s.uri),fe(s))}).filter(s=>s);return e.item instanceof X&&!Vt(e.ast)?n(e.item):e.ast instanceof ir&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function CA(t){if(!t||!(t.ast instanceof xe)||t.ast instanceof xe&&t.ast.linksTo===t.runtime.rootNode)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"){let c=t.runtime.rootNode.getChild(a[0].split("/"));if(c?.isChildOf(r)||c===r)return!0}}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{if(o instanceof Xe&&o.name)return qi.Location.create(ue(o.uri),fe(o.name));if(o instanceof xe)return qi.Location.create(ue(o.uri),fe(o));if(o instanceof We&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=fe(a),l=a.value.split("/"),u=r.path,d=l.slice(0,u.length-1).join("/").length+1,f=a.value.length-l.slice(0,u.length).join("/").length;return c.start.character+=1+d,c.end.character-=1+f,qi.Location.create(ue(o.values.values[0].uri),c)}}).filter(o=>o)};return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof xe&&t.ast.linksTo?Vt(t.ast)?[...e(t.ast.linksTo),qi.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo):[]}async function DA(t,e){let r={};return(await Pt(t,e,i=>[...CA(i),...wA(t,i),...EA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push(qi.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function AA(t,e){let r=await Pt(t,e,n=>[...CA(n),...wA(t,n),...EA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Pe(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>Fc(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var _a=q(j());var Sa=t=>[...t.definitions,...t.referencedBy].map(e=>{let r=Br(e.uri);return r?_a.Location.create(ue(r.docUri),r.range):_a.Location.create(ue(e.uri),fe(e))}).filter(e=>e),IA=t=>t.replacedBy?IA(t.replacedBy):t,Bp=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=Br(e.uri);return r?_a.Location.create(ue(r.docUri),r.range):_a.Location.create(ue(e.uri),fe(e.propertyName??e))}).filter(e=>e);function YU(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];if(t.item instanceof Ze&&t.ast instanceof tt)return Bp(IA(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return Bp(e)}return[]}function XU(t){if(!t)return[];if(t.item instanceof X&&!Vt(t.ast))return Sa(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Sa(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return Sa(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Sa(e)}return[]}function JU(t){if(t?.ast instanceof pt||t?.ast instanceof ci){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return[_a.Location.create(ue(e.macro.uri),fe(e.macro.identifier))]}return[]}async function OA(t,e){return Pt(t,e,r=>[...XU(r),...YU(r),...JU(r)])}var QU=["DT_PROP","DT_PROP_LEN","DT_PROP_LEN_OR","DT_PROP_HAS_IDX","DT_PROP_HAS_NAME","DT_PROP_BY_IDX","DT_PROP_LAST","DT_PROP_OR","DT_ENUM_IDX_BY_IDX","DT_ENUM_IDX","DT_ENUM_IDX_BY_IDX_OR","DT_ENUM_IDX_OR","DT_ENUM_HAS_VALUE_BY_IDX","DT_ENUM_HAS_VALUE","DT_STRING_TOKEN","DT_STRING_TOKEN_OR","DT_STRING_UPPER_TOKEN","DT_STRING_UPPER_TOKEN_OR","DT_STRING_UNQUOTED","DT_STRING_UNQUOTED_OR","DT_STRING_TOKEN_BY_IDX","DT_STRING_UPPER_TOKEN_BY_IDX","DT_STRING_UNQUOTED_BY_IDX","DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR","DT_PROP_BY_PHANDLE","DT_PHA_BY_IDX","DT_PHA_BY_IDX_OR","DT_PHA","DT_PHA_OR","DT_PHA_BY_NAME","DT_PHA_BY_NAME_OR","DT_PHANDLE_BY_NAME","DT_PHANDLE_BY_IDX","DT_PHANDLE"];async function jp({macro:t,document:e,context:r,position:n}){if(QU.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await M({document:e,context:r,position:n,macro:t.parent.args[0]}))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===2&&t.parent?.args?.[0]&&t.parent?.args?.[1])return(await ps({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===3&&t.parent?.args?.[0]&&t.parent?.args?.[1]&&t.parent?.args?.[3])return(await hi({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_CHOSEN","DT_HAS_CHOSEN"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===0&&t.parent?.args?.[0])return(await r.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function xA(t,e,r){if(!r)return;let n=Mi(r,t.position);return MA(n,t.position,e,r)}async function MA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return Sa(i);let s=await jp({document:n,macro:t,context:r,position:e});if(s)return Bp(s);let o=await ds(n,t.macro,e,r);if(o)return MA(o[0],o[1],r,n)}var hs=q(j());var ka=t=>{let e=t.definitions.at(0),r=e&&Br(e.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.uri),fe(e)):void 0},Up=t=>t.replaces?Up(t.replaces):t,LA=t=>{let e=Up(t),r=Br(e.ast.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.ast.uri),fe(e.ast)):void 0};function ZU(t){if(!t||t.item===null||!(t.ast instanceof tt))return;let e=r=>{let n=Br(r.ast.uri);return n?hs.Location.create(ue(n.docUri),n.range):hs.Location.create(ue(r.ast.uri),fe(r.ast.propertyName??r.ast))};if(t.item instanceof Ze&&t.ast instanceof tt)return e(Up(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(Up(r))}}function eH(t){if(t){if(t.item instanceof X&&!Vt(t.ast))return ka(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return ka(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return ka(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return ka(e)}}}function tH(t){if(t?.ast instanceof pt||t?.ast instanceof ci){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return hs.Location.create(ue(e.macro.uri),fe(e.macro.identifier))}}async function qA(t,e){return(await Pt(t,e,r=>[eH(r)||ZU(r)||tH(r)])).at(0)}async function $A(t,e,r){if(!r)return;let n=Mi(r,t.position);return FA(n,t.position,e,r)}async function FA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return ka(i);let s=await jp({document:n,macro:t,context:r,position:e});if(s)return LA(s);let o=await ds(n,t.macro,e,r);if(o)return FA(o[0],o[1],r,n)}var le=q(j());var rH=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(le.Range.create(le.Position.create(n.range.start.line,t.pos.colEnd),le.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},nH=(t,e,r,n,i)=>{if(!n?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${n[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},iH=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function BA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return iH(a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle);case"SyntaxIssue":return c?.items.flatMap(l=>rH(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>nH(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),r=e.filter(a=>a.kind===le.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==le.CodeActionKind.SourceFixAll),s=r.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return n.forEach(a=>{let c=a.edit.changes[t.textDocument.uri][0],l=c.range.start.line,u=c.range.start.character;o.has(`${l}:${u}`)||o.set(`${l}:${u}`,[]),o.get(`${l}:${u}`)?.push(c)}),[...i,...r.map(a=>({...a,kind:le.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:s}}}]:[],...Array.from(o.values()).flatMap(a=>a.length>1?{title:"Add All Missing Properties",kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=q(j());function jA(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}var UA=(t,e)=>e.some(r=>jA(t,r.start)>=0&&jA(t,r.end)<=0),sH=async(t,e,r)=>{let n=Xt.create(t.pos.line,t.pos.col),i=r.find(s=>Pr(s,e,n));if(i)return Un(i,e,n)},Na=(t,e)=>{let r=Xt.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof rn||o instanceof nn)&&/^dts-format (on|off)$/.test(o.toString().trim())).sort((o,a)=>o.firstToken.pos.line-a.firstToken.pos.line).forEach(o=>{let a=o.toString().trim();if(a==="dts-format off")i={start:Xt.create(o.firstToken.pos.line,o instanceof rn?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=Xt.create(o.lastToken.pos.line,o instanceof rn?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(Je.create(i.start,c)),i=void 0}}),i&&n.push(Je.create(i.start,r)),n},Ra=(t,e,r)=>{let n=t.length?r.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!UA(o.range.start,t)&&!UA(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>Af(e.range,i.raw.range))),n},Pa=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof li)&&!(a instanceof nn)&&!(a instanceof rn)&&!(a instanceof zn)&&!(a instanceof Sn)),i=await sH(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=Mf(i);return{level:Js(e,s),inAst:i}},sn=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},$i=(t,e,r)=>`${"".padStart(t*e.length,e)}${r}`,HA=t=>{let e=t.parentNode;if(!(!e||!(e instanceof ge)))return!(e instanceof Kt)||!e.openBracket?HA(e):e};function Ea(t,e,r,n,i,s,o=!1){if(!o&&nr(e.firstToken,t.firstToken))return n[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(r.tabSize))).length-r.tabSize*i;let a=HA(e);if(!a)return s;let l=Ea(t,a,r,n,i,s);return!o&&nr(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof Kt&&a.openBracket&&++l,l}var Tr=q(j());function wa(t,e,r,n){if(!nr(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&nr(t,o)&&wa(t,o,r,n))return!0;o=o?.prevToken}return null}return n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn}async function ll(t,e,r,n,i,s,o=[]){let a=n.split(`
|
|
280
|
+
};`,kind:xt.CompletionItemKind.Value,insertTextFormat:xt.InsertTextFormat.Snippet}))]}function MU(t,e){let r=s=>s?s.parentNode instanceof mr||s.parentNode instanceof Ot||s.parentNode instanceof Xe?!1:r(s.parentNode):!0;if(!t||t.item!==null||!Vt(t.ast)||!r(t.ast))return[];let n=s=>sp(s,e).filter(o=>e(o));if(t.ast instanceof ft)return n(t.runtime.rootNode).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:t.runtime.rootNode.nodes.length?[{label:"/delete-node/ &{}",insertText:"/delete-node/ {/$1};",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[];let i=new Map;return n(t.runtime.rootNode).forEach(s=>i.set(s.label.value,s)),Array.from(i).map(([,s])=>({label:t.ast instanceof ie?`${s.label.value}`:`&${s.label.value}`,kind:xt.CompletionItemKind.Variable,documentation:s.lastLinkedTo?.toMarkupContent(t.runtime.context.macros)}))}function LU(t,e){if(!t||!(t.item instanceof X)||t.item===null||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Rr)||t.beforeAst?.parentNode instanceof yt))return[];let r=n=>[...n.nodes,...n.deletedNodes.filter(i=>!e(i.by)).map(i=>i.node)].flatMap(i=>({node:i,astNodes:i.definitions.filter(s=>s instanceof Xe)})).filter(i=>i.astNodes.some(e));return t.ast instanceof xe||t.ast instanceof jr||t.beforeAst?.parentNode instanceof jr?r(t.item).map(n=>({label:`${n.astNodes.at(0)?.name?.toString()}`,kind:xt.CompletionItemKind.Variable,documentation:n.node.toMarkupContent(t.runtime.context.macros)})):r(t.item).length?[{label:"/delete-node/",insertText:"/delete-node/ $1;",kind:xt.CompletionItemKind.Keyword,insertTextFormat:xt.InsertTextFormat.Snippet,sortText:"~",command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function qU(t,e){if(!t||!(t.item instanceof X)||t.beforeAst&&(!(t.beforeAst?.parentNode instanceof Rr)||t.beforeAst?.parentNode instanceof jr))return[];let r=n=>[...n.properties,...n.deletedProperties.filter(i=>!e(i.by)).map(i=>i.property)].flatMap(i=>[i,...i.allReplaced]).filter(i=>e(i.ast));if(t.ast instanceof tt||t.ast instanceof yt||t.beforeAst?.parentNode instanceof yt){let n=new Map;return r(t.item).forEach(i=>n.set(i.name,i)),Array.from(n).map(([,i])=>({label:`${i.name}`,kind:xt.CompletionItemKind.Variable,documentation:i.ast.toPrettyString(t.runtime.context.macros)}))}return r(t.item).length?[{label:"/delete-property/",insertText:"/delete-property/ $1;",kind:xt.CompletionItemKind.Keyword,sortText:"~",insertTextFormat:xt.InsertTextFormat.Snippet,command:{command:"editor.action.triggerSuggest",title:"Re-trigger suggestions"}}]:[]}function $U(t,e){let r=t?.ast instanceof Vn?t.ast:t?.ast.parentNode;if(!t||!r||!(r instanceof Vn))return[];let n=r.pathParts.slice(0,-1);if(n.some(o=>!o))return[];let i=n.map(o=>o.toString());return(()=>{let o=t.runtime.rootNode.getChildFromScope(["/",...i],e);return[...o?.nodes.filter(a=>!Vt(t.ast)||a.definitions.some(e))??[],...o?.deletedNodes.filter(a=>!e(a.by)).map(a=>a.node)??[]]})().map(o=>({label:`/${[...i,o.fullName].join("/")}`,kind:xt.CompletionItemKind.Variable,documentation:o.toMarkupContent(t.runtime.context.macros)}))}function FU(t){return!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken)||t.ast instanceof ne?[]:!Qs(t?.ast)&&!(t.ast instanceof We&&t.item.ast.values===null)&&!Qs(t.beforeAst)&&!Qs(t.afterAst)?[]:t.item.parent.nodeType instanceof Et?Array.from([t.runtime.context.parser,...t.runtime.context.overlayParsers].at(-1)?.cPreprocessorParser.macros??[]).map(([,n])=>n.macro.identifier instanceof ui?{label:`${n.macro.identifier.toString()}`,insertText:`${n.macro.name}(${n.macro.identifier.params.map((i,s)=>i instanceof pt?`$${s+1}`:"").join(", ")})`,kind:xt.CompletionItemKind.Function,sortText:`~${n.macro.name}`,insertTextFormat:xt.InsertTextFormat.Snippet}:{label:n.macro.identifier.name,kind:xt.CompletionItemKind.Variable,sortText:`~${n.macro.name}`}):[]}async function lD(t,e){return Pt(t,e,(r,n)=>[...qU(r,n),...LU(r,n),...MU(r,n),...$U(r,n),...xU(r,n),...OU(r,n),...IU(r),...FU(r)])}var Fp=q(j());var dD=require("child_process");var IT=t=>/[A-Za-z0-9_]/.test(t);function BU(t,e){let r=[];for(let n=0;n<e;n++){let i=t[n];i==="("?r.push(n):i===")"&&r.pop()}return r.length?r[r.length-1]:void 0}function uD(t,e){let r=1;for(let n=e+1;n<t.length;n++){let i=t[n];if(i==="(")r++;else if(i===")"&&(r--,r===0))return n}}function fD(t,e,r){let n=[],i=0,s=!1,o=!1,a=e;for(let f=e;f<r;f++){let p=t[f];if(p==="'"&&!o)s=!s;else if(p==='"'&&!s)o=!o;else if(!s&&!o){if(p==="(")i++;else if(p===")")i--;else if(p===","&&i===0){let m=a,h=f,T=m,_=h;for(;T<_&&/\s/.test(t[T]);)T++;for(;_>T&&/\s/.test(t[_-1]);)_--;n.push({start:m,end:h,text:t.slice(T,_)}),a=f+1}}}let c=a,l=r,u=c,d=l;for(;u<d&&/\s/.test(t[u]);)u++;for(;d>u&&/\s/.test(t[d-1]);)d--;return n.push({start:c,end:l,text:t.slice(u,d)}),n}function OT(t){let e=t.trim(),r=/^([A-Za-z_][A-Za-z0-9_]*)\s*\(([\s\S]*)\)$/.exec(e);if(!r)return{macro:e};let n=r[1],i=r[2],s=fD(i,0,i.length),o={macro:n,args:[]};return o.args=s.map(a=>{let c=OT(a.text);return c.parent=o,c}),o}function Mi(t,e){let r=t.getText(),n=t.offsetAt(e),i=n,s=n;for(;i>0&&IT(r[i-1]);)i--;for(;s<r.length&&IT(r[s]);)s++;if(r[s]==="("){let T=uD(r,s);T!==void 0&&(s=T+1)}let o=r.slice(i,s),a=o.trim().length?OT(o):void 0,c=BU(r,n);if(c===void 0)return a;let l=uD(r,c);if(l===void 0||!(c<n&&n<=l))return a;let u=c,d=u;for(;d>0&&IT(r[d-1]);)d--;let f=r.slice(d,u);if(!f)return a;let p=fD(r,c+1,l),m={macro:f,args:[]};m.args=p.map(T=>{let _=OT(T.text);return _.parent=m,_});let h=-1;for(let T=0;T<p.length;T++){let _=p[T];if(n>=_.start&&n<=_.end){h=T;break}}if(h>=0){let T=m.args[h];return T.argIndexInParent=h,T}return m}function jU(t,e,r){let i=t.getText().split(/\r?\n/),s=new RegExp(`^\\s*#\\s*define\\s+(${e})\\b(\\s*\\([^)]*\\))?\\s*(.*)$`);for(let o=Math.min(r.line,i.length-1);o>=0;o--){let a=i[o],c=s.exec(a);if(c){let l=a.indexOf(c[0]),u=a.indexOf(c[3],l);return Xt.create(o,u>=0?u:a.length)}}}async function ds(t,e,r,n){let i=pD(t,e,r);if(i)return i;let s=await HU(e,n,Pe(t.uri));if(s)return[s,r]}function pD(t,e,r){if(e.startsWith("DT_"))return;let n=jU(t,e,r);if(!n)return;let i=Mi(t,n);if(i)return[i,n]}var UU=(t,e)=>new Promise(r=>{let n=(0,dD.spawn)(t,e,{stdio:["ignore","pipe","pipe"]}),i="";n.stdout.on("data",s=>{i+=s.toString()}),n.on("close",s=>{r(s?"":i)})});async function HU(t,e,r){let n=e.getCompileCommands()?.find(s=>pe(s.file,r));if(!n)return;let i=`${n.command.replace(/-(o|c)\s+\S+/g,"")} -E -dM ${n.file}`;try{let[s,...o]=i.split(" "),a=await UU(s,o.filter(u=>!!u)),c=$r.create(`macros://${n.file}`,"devicetree",0,a),l=pD(c,t,c.positionAt(a.length-1));if(l)return l[0]}catch(s){console.error(s)}}function Z(t){return t.toLowerCase().replace(/[@,-\.]/g,"_")}var el=q(j());async function hD({macro:t,context:e}){if(t.macro&&"DT_ALIAS".startsWith(t.macro))return[{label:"DT_ALIAS(...)",insertText:"DT_ALIAS($1)",kind:el.CompletionItemKind.Function,insertTextFormat:el.InsertTextFormat.Snippet}];if(t.parent?.macro!=="DT_ALIAS"||t.argIndexInParent!==0)return[];let r=await e.getRuntime();return r.rootNode.getNode("aliases")?.properties.map(n=>{let i=n.ast.getFlatAstValues()?.at(0),s;return i instanceof ie?s=i.linksTo:i instanceof Vn&&(s=i.pathParts.at(-1)?.linksTo),{label:Z(n.name),kind:el.CompletionItemKind.Property,documentation:s?.toMarkupContent(r.context.macros)}})??[]}var tl=q(j());async function yr(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();return i?.length===0?!0:i?.map(s=>{if(s instanceof ot)return s.path?.pathParts.at(-1)?.linksTo;if(s instanceof ie)return s.linksTo;if(s instanceof ne)return s.value;if(s instanceof ge){let o=s.evaluate(r.macros);return typeof o=="number"?o:s.toString()}})}async function op({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?yr(o,s[1].macro,r):void 0}async function mD(t,e){let r=await op(t,e);if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function gD(t,e,r,n){if(r=typeof r=="number"?r:Ce(r),typeof r!="number")return;let i=await yr(t,e,n);if(i===!0)return!0;if(!i)return;let s=i.at(r);if(s)return i.length===1&&i[0]instanceof X?i[0]:s}async function ap({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_BY_IDX"||e.args?.length!==3))return gD(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro,r)}async function yD(t,e){let r=await ap(t,e);if(typeof r!="boolean"&&r instanceof X)return r}async function Vr(t,{document:e,context:r,macro:n,position:i},s){return t||(await s({document:e,macro:n,context:r,position:i})??n.macro)}async function cp(t,e,r,n){return Vr(await yr(t,e,r.context),r,n)}async function ga({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_OR"||e.args?.length!==3)return;let[s,o,a]=e.args,c=await i({document:t,macro:s,context:r,position:n});return await cp(c,o.macro,{macro:a,document:t,context:r,position:n},i)}async function TD(t,e){let r=await ga(t,e);if(r instanceof X)return r;if(typeof r=="boolean")return;let n=r?.at(0);if(r?.length===1&&n instanceof X)return n}async function vD(t){let e=t?.nodeType?.onBus,r=t?.parent?.nodeType?.bus;return t&&r?.length&&r?.some(n=>n===e)?t.parent??void 0:void 0}async function lp(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_BUS"||r?.length!==1)return;let n=await e({...t,macro:r[0]});return await vD(n)}async function up(t,e){let r=(await t.getRuntime()).rootNode.getChild(["/","chosen"]);if(!r)return;let s=r?.properties.find(o=>Z(o.name)===e)?.ast.getFlatAstValues()?.at(0);if(s instanceof ie)return s.linksTo;if(s instanceof ot)return s.path?.pathParts.at(-1)?.linksTo}async function dp(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_CHOSEN"||e?.length!==1))return await up(t.context,e[0].macro)}async function fp(t,e){let r=await e?.getRuntime();if(r){let n=di.getNodeFromPath(["aliases"],r.rootNode,!0),i=n?.properties.find(o=>Z(o.name)===t);if(!i)return;let s=i.ast.getFlatAstValues();return s?.[0]instanceof ne?n=r.rootNode.getChild(s[0].value.split("/")):s?.[0]instanceof ie?n=s[0].linksTo:s?.[0]instanceof ot&&(n=s[0].path?.pathParts.at(-1)?.linksTo),n}}async function pp({macro:t,context:e}){if(!(t.macro!=="DT_ALIAS"||t.args?.length!==1))return fp(t.args[0].macro,e)}async function bD(t,e){return t?.nodes.find(r=>Z(r.name)===e)}async function hp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD"||e.args?.length!==2)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return bD(s,e.args[1].macro)}var xT=(t,e)=>t.nodes.filter(r=>!r.disabled&&r.nodeType).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...xT(r,e)]:xT(r,e));async function SD(t,e){let r=await e?.getRuntime();if(r)return xT(r.rootNode,t)}async function MT({macro:t,context:e}){if(!(t.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.args?.length!==1))return SD(t.args[0].macro,e)}async function _D(t){return(await MT(t))?.at(0)}async function kD(t){return t?.parent?.parent??void 0}async function mp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_GPARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return kD(s)}var LT=(t,e)=>t.nodes.filter(r=>r.nodeType).sort((r,n)=>r.disabled===n.disabled?0:r.disabled?1:-1).flatMap(r=>[r.nodeType.compatible,...Array.from(r.nodeType.extends)].filter(n=>!!n).map(n=>Z(n)).includes(e)?[r,...LT(r,e)]:LT(r,e));async function ND(t,e,r){let n=await r?.getRuntime();if(n)return LT(n.rootNode,e).at(t)}async function gp({macro:t,context:e}){if(t.macro!=="DT_INST"||t.args?.length!==2)return;let r=Ce(t.args[0].macro);if(typeof r=="number")return ND(r,t.args[1].macro,e)}async function RD(t,e){let r=await e?.getRuntime(),n=r?.resolvePath([`&${t.trim()}`]);if(r&&n)return di.getNodeFromPath(n.slice(1),r.rootNode,!0)}async function yp({macro:t,context:e}){if(!(t.macro!=="DT_NODELABEL"||t.args?.length!==1))return RD(t.args[0].macro,e)}async function PD(t){return t?.parent??void 0}async function Tp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PARENT"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return PD(s)}var ED=(t,e)=>{if(!e.length)return t;let r=e.splice(0,1)[0],n=t.nodes.find(i=>Z(i.fullName)===r);return n?ED(n,e):void 0};async function vp(t,e){let r=await e?.getRuntime();if(r)return ED(r.rootNode,t)}async function bp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_PATH"||!r?.length))return vp(r.map(n=>n.macro),e)}async function Sp({macro:t,context:e}){let r=t.args;if(!(t.macro!=="DT_ROOT"||r?.length))return(await e.getRuntime()).rootNode}async function ya(t,e,r){let n=t?.properties.find(c=>Z(c.name)===e);if(!n)return;let i=n?.ast.quickValues?.at(r),s=n.parent.nodeType;if(Array.isArray(i)||!s||!(s instanceof Et))return;let a=s.properties.find(c=>c.getNameMatch(n.name))?.values(n).findIndex(c=>c===i)??-1;return a===-1?void 0:a}async function _p(t,e,r,n,i){return Vr(await ya(t,e,r),n,i)}async function kp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await _p(o,s[1].macro,a,{macro:s[3],document:t,context:r,position:n},i)}async function Np({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await _p(o,s[1].macro,0,{macro:s[2],document:t,context:r,position:n},i)}async function fs(t,e,r,n,i){let s=t?.properties.find(d=>Z(d.name)===e),o=s?.parent.nodeType;if(!o||!(o instanceof Et))return;if(typeof r=="string"){let d=s.nexusMapsTo.at(0)?.specifierSpace;if(r=(d?s.parent.getProperty(`${d}-names`)?.ast.quickValues:void 0)?.findIndex(p=>typeof p=="string"&&p.toLowerCase()===r)??-1,r===-1)return}let a=s.nexusMapsTo.at(r),l=a?.target.nodeType?.cellsValues?.find(d=>a.specifierSpace&&d.specifier===a.specifierSpace)?.values?.indexOf(n);if(l===void 0||l===-1)return;let u=a?.mappingValuesAst.at(l);if(u instanceof ge){let d=u.evaluate(i.macros);return typeof d!="number"?u.toString():d}}async function Ta(t,e,r,n,i,s){return Vr(await fs(t,e,r,n,i.context),i,s)}async function Rp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return Ta(o,s[1].macro,a,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function Pp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME_OR"||s?.length!==5)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ta(o,s[1].macro,s[2].macro,s[3].macro,{macro:s[4],document:t,context:r,position:n},i)}async function pi(t,e,r=0){let n=t?.properties.find(s=>Z(s.name)===e);if(r=typeof r=="number"?r:Ce(r??"0"),typeof r!="number")return;let i=n?.ast.getFlatAstValues()?.at(r);if(i instanceof ie)return i.linksTo;if(i instanceof ot)return i.path?.pathParts.at(-1)?.linksTo}async function ps({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return pi(o,s[1].macro,0)}async function hi({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return pi(o,s[1].macro,s.at(2)?.macro)}async function wD(t,e,r){let n=t?.properties.find(l=>Z(l.name)===e);if(!n)return;let i=n.parent.nodeType;if(!i||!(i instanceof Et))return;let s=n.nexusMapsTo.at(0)?.specifierSpace,a=(s?n.parent.getProperty(`${s}-names`)?.ast.quickValues:void 0)?.findIndex(l=>typeof l=="string"&&l.toLowerCase()===r)??-1;return a===-1?void 0:n.nexusMapsTo.at(a)?.target}async function Ep({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHANDLE_BY_NAME"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await wD(o,s[1].macro,s[2].macro)}async function wp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_OR"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return Ta(o,s[1].macro,0,s[2].macro,{macro:s[3],document:t,context:r,position:n},i)}async function Cp({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX_OR"||e.args?.length!==5)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return cp(s,e.args[3].macro,{macro:e.args[4],document:t,context:r,position:n},i)}async function Dp(t,e){if(!t)return;let r=t?.properties.find(n=>Z(n.name)===e);return r?.nexusMapsTo.length?r.nexusMapsTo.length:r?.ast.getFlatAstValues()?.length}async function CD(t,e,r,n){if(t)return Vr(await Dp(t,e),r,n)}async function Ap({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?CD(o,s[1].macro,{macro:s[2],document:t,context:r,position:n},i):void 0}async function va(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return Z(n[0].value)}async function DD(t,e,r,n){if(t)return Vr(await va(t,e),r,n)}async function Ip({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return DD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Op(t,e){if(!t)return;let n=t?.properties.find(i=>Z(i.name)===e)?.ast.getFlatAstValues();if(n?.length===1&&n[0]instanceof ne)return n[0].value}async function AD(t,e,r,n){if(t)return Vr(await Op(t,e),r,n)}async function xp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return AD(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}async function Mp(t,e){return(await va(t,e))?.toUpperCase()}async function ID(t,e,r,n){if(t)return Vr(await Mp(t,e),r,n)}async function Lp({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_OR"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return ID(o,s[1].macro,{document:t,macro:s[2],context:r,position:n},i)}function Gn(t){return async(e,r)=>{let n=await t(e,r);if(n instanceof X)return n}}async function M({macro:t,document:e,context:r,position:n}){["DT_ALIAS","DT_NODELABEL"].some(a=>a===t.parent?.macro)||t.parent?.macro==="DT_CHILD"&&t.argIndexInParent===1?t=t.parent:t.parent?.macro==="DT_HAS_ALIAS"?(t=t.parent,t.macro="DT_ALIAS"):t.parent?.macro==="DT_PATH"&&(t.parent.args=t.parent.args?.slice(0,(t.argIndexInParent??0)+1)??[],t=t.parent);let s=await[lp,dp,pp,hp,_D,mp,gp,yp,Tp,bp,ps,hi,Ep,yD,mD,TD,Sp,Gn(kp),Gn(Np),Gn(Rp),Gn(Pp),Gn(wp),Gn(Cp),Gn(Ap),Gn(ga),Gn(Ip),Gn(xp),Gn(Lp)].reduce((a,c)=>a.then(l=>l||c({macro:t,document:e,context:r,position:n},M)),Promise.resolve(void 0));if(s)return Array.isArray(s)?s.at(0):s;let o=await ds(e,t.macro,n,r);if(o)return M({document:e,macro:o[0],context:r,position:n})}async function OD({macro:t,document:e,context:r,position:n}){return t.macro&&t.macro&&"DT_CHILD".startsWith(t.macro)?[{label:"DT_CHILD(...)",insertText:"DT_CHILD($1, $2)",kind:tl.CompletionItemKind.Function,insertTextFormat:tl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_CHILD"||t.argIndexInParent!==1||!t.parent.args?.length?[]:(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.nodes.map(s=>({label:Z(s.fullName),kind:tl.CompletionItemKind.Class,documentation:s.toMarkupContent(r.macros)}))??[]}var rl=q(j());function xD({macro:t,context:e}){return t.macro&&"DT_COMPAT_GET_ANY_STATUS_OKAY".startsWith(t.macro)?[{label:"DT_COMPAT_GET_ANY_STATUS_OKAY(...)",insertText:"DT_COMPAT_GET_ANY_STATUS_OKAY($1)",kind:rl.CompletionItemKind.Function,insertTextFormat:rl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_COMPAT_GET_ANY_STATUS_OKAY"||t.argIndexInParent!==0?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:rl.CompletionItemKind.Property}))??[]}var nl=q(j());function MD({macro:t,context:e}){return t.macro&&"DT_INST".startsWith(t.macro)?[{label:"DT_INST(...)",insertText:"DT_INST($1, $2)",kind:nl.CompletionItemKind.Function,insertTextFormat:nl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_INST"||t.argIndexInParent!==1?[]:e.bindingLoader?.getBindings().map(r=>({label:Z(r),kind:nl.CompletionItemKind.Property}))??[]}var il=q(j());async function LD({macro:t,context:e}){if(t.macro&&"DT_NODELABEL".startsWith(t.macro))return[{label:"DT_NODELABEL(...)",insertText:"DT_NODELABEL($1)",kind:il.CompletionItemKind.Function,insertTextFormat:il.InsertTextFormat.Snippet}];let r=await e.getRuntime();return t.parent?.macro!=="DT_NODELABEL"||t.argIndexInParent!==0?[]:await Promise.all(r.rootNode.allDescendantsLabels.map(async n=>({label:n.label.value,kind:il.CompletionItemKind.Property,documentation:n.lastLinkedTo?.toMarkupContent(r.context.macros)}))??[])}var sl=q(j());async function qD({macro:t,context:e}){return t.macro&&t.macro&&"DT_PATH".startsWith(t.macro)?[{label:"DT_PATH(...)",insertText:"DT_PATH($1)",kind:sl.CompletionItemKind.Function,insertTextFormat:sl.InsertTextFormat.Snippet}]:t.parent?.macro!=="DT_PATH"||!t.parent.args?.length?[]:(await vp(t.parent.args.slice(0,-1).map(n=>n.macro),e))?.nodes.map(n=>({label:Z(n.fullName),kind:sl.CompletionItemKind.Class,documentation:n.toMarkupContent(e.macros)}))??[]}var $D=q(j());async function FD({macro:t,context:e}){if(t.macro&&t.macro&&"DT_ROOT".startsWith(t.macro)){let r=await e.getRuntime();return[{label:"DT_ROOT",kind:$D.CompletionItemKind.Class,documentation:r.rootNode.toMarkupContent(r.context.macros)}]}return[]}var qp=q(j());function BD({macro:t}){return t.macro&&t.macro&&"DT_SAME_NODE".startsWith(t.macro)?[{label:"DT_SAME_NODE(...)",insertText:"DT_SAME_NODE($1, $2)",kind:qp.CompletionItemKind.Snippet,insertTextFormat:qp.InsertTextFormat.Snippet}]:[]}var ol=q(j());async function J({macro:t,document:e,position:r,context:n},i,s,o,a,c=l=>M({document:e,macro:l,context:n,position:r})){if(t.macro&&t.macro&&i.startsWith(t.macro))return[{label:`${i}(...)`,insertText:`${i}(${Array(o).map((d,f)=>`${f+1}`).join(", ")})`,kind:ol.CompletionItemKind.Function,insertTextFormat:ol.InsertTextFormat.Snippet}];if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let l=await c(t.parent.args[0]);return(a?l?.properties.filter(a):l?.properties)?.map(d=>({label:Z(d.name),kind:ol.CompletionItemKind.Property,documentation:d.toPrettyString(n.macros)}))??[]}async function jD(t){return J(t,"DT_ENUM_HAS_VALUE",1,3)}async function UD(t){return J(t,"DT_ENUM_HAS_VALUE_BY_IDX",1,4)}async function HD(t){return J(t,"DT_ENUM_IDX",1,2)}async function VD(t){return J(t,"DT_ENUM_IDX_BY_IDX",1,3)}async function zD(t){return J(t,"DT_ENUM_IDX_BY_IDX_OR",1,4)}async function WD(t){return J(t,"DT_ENUM_IDX_OR",1,3)}var GD=q(j());async function Li({macro:t,document:e,context:r,position:n},i,s,o){if(t.parent?.macro!==i||t.argIndexInParent!==s||!t.parent.args?.length)return[];let c=(await M({document:e,macro:t.parent.args[0],context:r,position:n}))?.properties.find(f=>Z(f.name)===t.parent?.args?.at(1)?.macro),l=0;if(typeof o=="string"){let f=c?.nexusMapsTo.at(0)?.specifierSpace;if(l=(f?c.parent.getProperty(`${f}-names`)?.ast.quickValues:void 0)?.findIndex(m=>typeof m=="string"&&m.toLowerCase()===o)??-1,l===-1)return[]}let u=c?.nexusMapsTo.at(l);return u?.target.nodeType?.cellsValues?.find(f=>u.specifierSpace&&f.specifier===u.specifierSpace)?.values.map(f=>({label:Z(f),kind:GD.CompletionItemKind.Property}))??[]}async function KD(t){return t.macro.argIndexInParent===2?Li(t,"DT_PHA",2,0):J(t,"DT_PHA",1,3,e=>!!e.nexusMapsTo.length)}var YD=q(j());async function VU({document:t,macro:e,position:r,context:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:n,position:r}))?.properties.find(a=>Z(a.name)===e.parent?.args?.at(1)?.macro);return Array(o?.nexusMapsTo.length??0)?.map((a,c)=>({label:c.toString(),kind:YD.CompletionItemKind.Property}))??[]}async function XD(t){if(t.macro.argIndexInParent===2)return VU(t,"DT_PHA_BY_IDX");if(t.macro.argIndexInParent===3){let e=t.macro.parent?.args?Ce(t.macro.parent.args[2].macro):void 0;return typeof e!="number"?[]:Li(t,"DT_PHA_BY_IDX",3,e)}return J(t,"DT_PHA_BY_IDX",1,3,e=>!!e.nexusMapsTo.length)}var JD=q(j());async function al({document:t,macro:e,context:r,position:n},i){if(e.parent?.macro!==i||!e.parent.args?.length)return[];let o=(await M({document:t,macro:e.parent.args[0],context:r,position:n}))?.properties.find(l=>Z(l.name)===e.parent?.args?.at(1)?.macro),a=o?.nexusMapsTo.at(0)?.specifierSpace;return(a?o.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.filter(l=>typeof l=="string")?.map(l=>({label:l,kind:JD.CompletionItemKind.Property}))??[]}async function QD(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHA_BY_NAME"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Li(t,"DT_PHA_BY_NAME",3,e.parent.args[2].macro):[]:J(t,"DT_PHA_BY_NAME",1,3,r=>!!r.nexusMapsTo.length)}async function ZD(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHA_BY_NAME_OR"):e.argIndexInParent===3?e.parent?.args?.[2]?.macro?Li(t,"DT_PHA_BY_NAME_OR",3,e.parent.args[2].macro):[]:J(t,"DT_PHA_BY_NAME_OR",1,3,r=>!!r.nexusMapsTo.length)}async function eA(t){let{macro:e}=t;return e.argIndexInParent===2?Li(t,"DT_PHA_OR",2,0):J(t,"DT_PHA_OR",1,3,r=>!!r.nexusMapsTo.length)}async function $p(t){return J(t,"DT_PHANDLE",1,2,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function ba(t){return J(t,"DT_PHANDLE_BY_IDX",1,3,e=>!!e.ast.getFlatAstValues()?.some(r=>r instanceof ie||r instanceof ot))}async function tA(t){let{macro:e}=t;return e.argIndexInParent===2?al(t,"DT_PHANDLE_BY_NAME"):J(t,"DT_PHANDLE_BY_NAME",1,3,r=>!!r.ast.getFlatAstValues()?.some(n=>n instanceof ie||n instanceof ot))}async function rA(t){return J(t,"DT_PROP",1,2,e=>!e.nexusMapsTo.length)}async function nA(t){return J(t,"DT_PROP_BY_IDX",1,3,e=>!e.nexusMapsTo.length)}async function iA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX"?ba({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX",3,4,r=>!r.nexusMapsTo.length,()=>hi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function sA(t){let{macro:e}=t;return e.argIndexInParent===1&&e.parent?.macro==="DT_PROP_BY_PHANDLE"?$p({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE",2,3,r=>!r.nexusMapsTo.length,()=>ps({...t,macro:{macro:"DT_PHANDLE",args:e.parent?.args?.slice(0,2)}},M))}async function oA(t){let{macro:e}=t;return(e.argIndexInParent===1||e.argIndexInParent===2)&&e.parent?.macro==="DT_PROP_BY_PHANDLE_IDX_OR"?ba({...t,macro:{...e,parent:e.parent?{...e.parent,macro:"DT_PHANDLE_BY_IDX"}:void 0}}):J(t,"DT_PROP_BY_PHANDLE_IDX_OR",3,5,r=>!r.nexusMapsTo.length,()=>hi({...t,macro:{macro:"DT_PHANDLE_BY_IDX",args:e.parent?.args?.slice(0,3)}},M))}async function aA(t){return J(t,"DT_PROP_HAS_IDX",1,3,e=>!e.nexusMapsTo.length)}async function cA(t){return J(t,"DT_PROP_HAS_NAME",1,3,e=>!e.nexusMapsTo.length)}async function lA(t){return J(t,"DT_PROP_LAST",1,2,e=>!e.nexusMapsTo.length)}async function uA(t){return J(t,"DT_PROP_LEN",1,2,e=>!e.nexusMapsTo.length)}async function dA(t){return J(t,"DT_PROP_LEN_OR",1,2,e=>!e.nexusMapsTo.length)}async function fA(t){return J(t,"DT_PROP_OR",1,2,e=>!e.nexusMapsTo.length)}async function pA(t){return J(t,"DT_STRING_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function hA(t){return J(t,"DT_STRING_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function mA(t){return J(t,"DT_STRING_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function gA(t){return J(t,"DT_STRING_UNQUOTED",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function yA(t){return J(t,"DT_STRING_UNQUOTED_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function TA(t){return J(t,"DT_STRING_UNQUOTED_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function vA(t){return J(t,"DT_STRING_UPPER_TOKEN",1,2,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}async function bA(t){return J(t,"DT_STRING_UPPER_TOKEN_BY_IDX",1,3,e=>{let r=e.ast.getFlatAstValues();return!!r?.length&&r.every(n=>n instanceof ne)})}async function SA(t){return J(t,"DT_STRING_UPPER_TOKEN_OR",1,3,e=>{let r=e.ast.getFlatAstValues();return r?.length===1&&r[0]instanceof ne})}var cl=q(j());async function _A({macro:t,context:e}){return t.parent?.macro==="DT_ON_BUS"&&t.argIndexInParent===1?e.bindingLoader?.getBusTypes().map(r=>({label:Z(r),kind:cl.CompletionItemKind.Enum}))??[]:t.macro&&"DT_ON_BUS".startsWith(t.macro)?[{label:"DT_ON_BUS(...)",insertText:"DT_ON_BUS($1, $2)",kind:cl.CompletionItemKind.Function,insertTextFormat:cl.InsertTextFormat.Snippet}]:[]}async function kA(t){return J(t,"DT_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}async function NA(t){return J(t,"DT_HAS_CHOSEN",0,1,void 0,async()=>(await t.context.getRuntime()).rootNode.getChild(["/","chosen"]))}var zU=["DT_BUS","DT_CHILD_NUM","DT_CHILD_NUM_STATUS_OKAY","DT_GPARENT","DT_HAS_ALIAS","DT_NODE_CHILD_IDX","DT_NODE_FULL_NAME","DT_NODE_FULL_NAME_TOKEN","DT_NODE_FULL_NAME_UNQUOTED","DT_NODE_FULL_NAME_UPPER_TOKEN","DT_NODE_HASH","DT_NODE_PATH","DT_NODELABEL_STRING_ARRAY","DT_PARENT"];async function RA(t,e,r){if(!r)return[];let n=Mi(r,t.position);return n?(await Promise.all([_A,kA,NA,hD,OD,xD,MD,WU,LD,qD,FD,BD,UD,jD,VD,zD,HD,WD,XD,QD,ZD,KD,ba,tA,$p,eA,nA,sA,iA,oA,rA,aA,cA,lA,uA,dA,fA,pA,hA,mA,gA,yA,TA,vA,bA,SA].flatMap(async i=>await i({document:r,context:e,macro:n,position:t.position})))).flat():[]}function WU({macro:t}){return t.macro?zU.filter(e=>e.startsWith(t.macro)).map(e=>({label:`${e}(...)`,insertText:`${e}($1)`,kind:Fp.CompletionItemKind.Function,insertTextFormat:Fp.InsertTextFormat.Snippet})):[]}var kn=q(j());function GU(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>{let i=n.parent.deletedProperties.find(s=>s.property===n)?.by;return[n.ast,...n.allReplaced.map(s=>s.ast),...i?[i]:[]].map(s=>{let o=Br(s.uri);if(o)return kn.Location.create(ue(o.docUri),o.range);if(s instanceof We)return kn.Location.create(ue(s.uri),fe(s.propertyName??s));if(s instanceof yt)return kn.Location.create(ue(s.uri),fe(s.propertyName??s))}).filter(s=>s)};if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function KU(t){if(!t)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"&&t.runtime.rootNode.getChild(a[0].split("/"))===r)return!0}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&(o.by.nodeNameOrRef instanceof xe?o.by.nodeNameOrRef!==t.ast:!r.linkedRefLabels.some(a=>a!==t.ast))).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedRefLabels,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{let a=o&&Br(o?.uri);if(a)return kn.Location.create(ue(a.docUri),a.range);if(o instanceof Ot)return kn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof Xe)return kn.Location.create(ue(o.uri),fe(o.name??o));if(o instanceof xe)return kn.Location.create(ue(o.uri),fe(o));if(o instanceof xe)return kn.Location.create(ue(o.uri),fe(o));if(o instanceof ie)return kn.Location.create(ue(o.uri),fe(o.label??o));if(o instanceof We)return kn.Location.create(ue((o.values??o)?.uri),fe(o.values??o))}).filter(o=>o)};if(t.item instanceof X&&!Vt(t.ast))return e(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return e(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return Vt(t.ast)?[...e(t.ast.linksTo),kn.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return e(r)}return[]}async function PA(t,e){return Pt(t,e,r=>[...KU(r),...GU(r)])}var qi=q(j());function EA(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];let e=n=>n.replacedBy?e(n.replacedBy):n,r=n=>[n.ast,...n.allReplaced.map(i=>i.ast),n.parent.deletedProperties.find(i=>i.property===n)?.by??[]].map(i=>{if((i instanceof We||i instanceof yt)&&i.propertyName)return qi.Location.create(ue(i.uri),fe(i.propertyName))}).filter(i=>i);if(t.item instanceof Ze&&t.ast instanceof tt)return r(e(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let n=t.item.deletedProperties.find(i=>i.by===t.ast.parentNode)?.property;if(n)return r(n)}return[]}function wA(t,e){if(!e||!(e.ast instanceof ir))return[];"newName"in t&&(e.ast.parentNode instanceof ie&&t.newName.startsWith("&")?t.newName=t.newName.slice(1):e.ast.parentNode instanceof ls&&t.newName.endsWith(":")&&(t.newName=t.newName.slice(0,-1)));let r=e.ast.value,n=i=>[...i.definitions.filter(s=>s instanceof Xe).flatMap(s=>s.labels.map(o=>o.label)),...i.referencedBy.flatMap(s=>s.labels.map(o=>o.label)),...i.linkedRefLabels.map(s=>s.label)].filter(s=>s?.value===r).map(s=>{if(s)return qi.Location.create(ue(s.uri),fe(s))}).filter(s=>s);return e.item instanceof X&&!Vt(e.ast)?n(e.item):e.ast instanceof ir&&e.ast.parentNode instanceof ie&&e.ast.parentNode.linksTo?n(e.ast.parentNode.linksTo):[]}function CA(t){if(!t||!(t.ast instanceof xe)||t.ast instanceof xe&&t.ast.linksTo===t.runtime.rootNode)return[];let e=r=>{let i=t.runtime.rootNode.getNode("aliases")?.properties.filter(o=>{let a=o.ast.quickValues;if(a?.length===1&&typeof a[0]=="string"){let c=t.runtime.rootNode.getChild(a[0].split("/"));if(c?.isChildOf(r)||c===r)return!0}}).map(o=>o.ast)??[],s=r.parent?.deletedNodes.filter(o=>o.node===r&&o.by.nodeNameOrRef!==t.ast).map(o=>o.by.nodeNameOrRef)??[];return[...i,...r.linkedNodeNamePaths,...r.definitions,...s].map(o=>{if(o instanceof Xe&&o.name)return qi.Location.create(ue(o.uri),fe(o.name));if(o instanceof xe)return qi.Location.create(ue(o.uri),fe(o));if(o instanceof We&&o.values?.values[0]?.value&&o.values?.values[0]?.value instanceof ne){let a=o.values.values[0].value,c=fe(a),l=a.value.split("/"),u=r.path,d=l.slice(0,u.length-1).join("/").length+1,f=a.value.length-l.slice(0,u.length).join("/").length;return c.start.character+=1+d,c.end.character-=1+f,qi.Location.create(ue(o.values.values[0].uri),c)}}).filter(o=>o)};return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof xe&&t.ast.linksTo?Vt(t.ast)?[...e(t.ast.linksTo),qi.Location.create(ue(t.ast.uri),fe(t.ast))]:e(t.ast.linksTo):[]}async function DA(t,e){let r={};return(await Pt(t,e,i=>[...CA(i),...wA(t,i),...EA(i)])).forEach(i=>{r[i.uri]??=[],r[i.uri].push(qi.TextEdit.replace(i.range,t.newName))}),{changes:r}}async function AA(t,e){let r=await Pt(t,e,n=>[...CA(n),...wA(t,n),...EA(n)]);if(r.some(n=>e?.settings.lockRenameEdits?.some(i=>Pe(n.uri).startsWith(i))))throw new Error('Path is locked by user setting "lockRenameEdits"');if(r.some(n=>Fc(n.uri)))throw new Error("Item was generated using a MACRO.");return{defaultBehavior:!!r.length}}var _a=q(j());var Sa=t=>[...t.definitions,...t.referencedBy].map(e=>{let r=Br(e.uri);return r?_a.Location.create(ue(r.docUri),r.range):_a.Location.create(ue(e.uri),fe(e))}).filter(e=>e),IA=t=>t.replacedBy?IA(t.replacedBy):t,Bp=t=>[t.ast,...t.allReplaced.map(e=>e.ast)].map(e=>{let r=Br(e.uri);return r?_a.Location.create(ue(r.docUri),r.range):_a.Location.create(ue(e.uri),fe(e.propertyName??e))}).filter(e=>e);function YU(t){if(!t||t.item===null||!(t.ast instanceof tt))return[];if(t.item instanceof Ze&&t.ast instanceof tt)return Bp(IA(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let e=t.item.deletedProperties.find(r=>r.by===t.ast.parentNode)?.property;if(e)return Bp(e)}return[]}function XU(t){if(!t)return[];if(t.item instanceof X&&!Vt(t.ast))return Sa(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return Sa(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return Sa(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return Sa(e)}return[]}function JU(t){if(t?.ast instanceof pt||t?.ast instanceof li){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return[_a.Location.create(ue(e.macro.uri),fe(e.macro.identifier))]}return[]}async function OA(t,e){return Pt(t,e,r=>[...XU(r),...YU(r),...JU(r)])}var QU=["DT_PROP","DT_PROP_LEN","DT_PROP_LEN_OR","DT_PROP_HAS_IDX","DT_PROP_HAS_NAME","DT_PROP_BY_IDX","DT_PROP_LAST","DT_PROP_OR","DT_ENUM_IDX_BY_IDX","DT_ENUM_IDX","DT_ENUM_IDX_BY_IDX_OR","DT_ENUM_IDX_OR","DT_ENUM_HAS_VALUE_BY_IDX","DT_ENUM_HAS_VALUE","DT_STRING_TOKEN","DT_STRING_TOKEN_OR","DT_STRING_UPPER_TOKEN","DT_STRING_UPPER_TOKEN_OR","DT_STRING_UNQUOTED","DT_STRING_UNQUOTED_OR","DT_STRING_TOKEN_BY_IDX","DT_STRING_UPPER_TOKEN_BY_IDX","DT_STRING_UNQUOTED_BY_IDX","DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR","DT_PROP_BY_PHANDLE","DT_PHA_BY_IDX","DT_PHA_BY_IDX_OR","DT_PHA","DT_PHA_OR","DT_PHA_BY_NAME","DT_PHA_BY_NAME_OR","DT_PHANDLE_BY_NAME","DT_PHANDLE_BY_IDX","DT_PHANDLE"];async function jp({macro:t,document:e,context:r,position:n}){if(QU.some(i=>i===t.parent?.macro)&&t.argIndexInParent===1&&t.parent?.args?.[0])return(await M({document:e,context:r,position:n,macro:t.parent.args[0]}))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===2&&t.parent?.args?.[0]&&t.parent?.args?.[1])return(await ps({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE",args:t.parent.args.slice(0,2)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_PROP_BY_PHANDLE_IDX","DT_PROP_BY_PHANDLE_IDX_OR"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===3&&t.parent?.args?.[0]&&t.parent?.args?.[1]&&t.parent?.args?.[3])return(await hi({document:e,context:r,position:n,macro:{macro:"DT_PHANDLE_BY_IDX",args:t.parent.args.slice(0,3)}},M))?.properties.find(s=>Z(s.name)===t.macro);if(["DT_CHOSEN","DT_HAS_CHOSEN"].some(i=>i===t.parent?.macro)&&t.argIndexInParent===0&&t.parent?.args?.[0])return(await r.getRuntime()).rootNode.getChild(["/","chosen"])?.properties.find(i=>Z(i.name)===t.macro)}async function xA(t,e,r){if(!r)return;let n=Mi(r,t.position);return MA(n,t.position,e,r)}async function MA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return Sa(i);let s=await jp({document:n,macro:t,context:r,position:e});if(s)return Bp(s);let o=await ds(n,t.macro,e,r);if(o)return MA(o[0],o[1],r,n)}var hs=q(j());var ka=t=>{let e=t.definitions.at(0),r=e&&Br(e.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.uri),fe(e)):void 0},Up=t=>t.replaces?Up(t.replaces):t,LA=t=>{let e=Up(t),r=Br(e.ast.uri);return r?hs.Location.create(ue(r.docUri),r.range):e?hs.Location.create(ue(e.ast.uri),fe(e.ast)):void 0};function ZU(t){if(!t||t.item===null||!(t.ast instanceof tt))return;let e=r=>{let n=Br(r.ast.uri);return n?hs.Location.create(ue(n.docUri),n.range):hs.Location.create(ue(r.ast.uri),fe(r.ast.propertyName??r.ast))};if(t.item instanceof Ze&&t.ast instanceof tt)return e(Up(t.item));if(t.item instanceof X&&t.ast instanceof tt&&t.ast.parentNode instanceof yt){let r=t.item.deletedProperties.find(n=>n.by===t.ast.parentNode)?.property;if(r)return e(Up(r))}}function eH(t){if(t){if(t.item instanceof X&&!Vt(t.ast))return ka(t.item);if(t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo)return ka(t.ast.parentNode.linksTo);if(t.ast instanceof xe&&t.ast.linksTo)return ka(t.ast.linksTo);if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let e=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(e)return ka(e)}}}function tH(t){if(t?.ast instanceof pt||t?.ast instanceof li){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t.ast instanceof pt?t.ast.name:t.ast.value);if(e)return hs.Location.create(ue(e.macro.uri),fe(e.macro.identifier))}}async function qA(t,e){return(await Pt(t,e,r=>[eH(r)||ZU(r)||tH(r)])).at(0)}async function $A(t,e,r){if(!r)return;let n=Mi(r,t.position);return FA(n,t.position,e,r)}async function FA(t,e,r,n){if(!t?.macro)return;let i=await M({document:n,macro:t,context:r,position:e});if(i)return ka(i);let s=await jp({document:n,macro:t,context:r,position:e});if(s)return LA(s);let o=await ds(n,t.macro,e,r);if(o)return FA(o[0],o[1],r,n)}var le=q(j());var rH=(t,e,r,n,i)=>{switch(r){case 1:return[{title:"Add semicolon",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),";")]}}}];case 2:return[{title:"Add open curly",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character)," {")]}}}];case 29:return[{title:"Remove white space",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(le.Range.create(le.Position.create(n.range.start.line,t.pos.colEnd),le.Position.create(n.range.end.line,e.pos.col)),"")]}}}];case 3:return[{title:"Add close curly",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"}")]}}}];case 19:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 28:return[{title:"Add comma",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),",")]}}}];case 21:return[{title:"Add '/'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),"/")]}}}];case 23:return[{title:"Remove ';'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.del(n.range)]}}}];case 34:return[{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 35:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}}];case 25:return[{title:"Complete Keyword '/delete-property/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-property/")]}}},{title:"Complete Keyword '/delete-node/",diagnostics:[n],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.replace(n.range,"/delete-node/")]}}}];case 12:return[{title:"Add '>'",diagnostics:[n],kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[i]:[le.TextEdit.insert(le.Position.create(n.range.end.line,n.range.end.character),">")]}}}];default:return}},nH=(t,e,r,n,i)=>{if(!n?.length)return[];switch(t){case 0:return[{title:i??`Add Property "${n[0].newText.split("=",1)[0].replace(";","").trim()}"`,diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 27:return[{title:i??"Remove Property",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 26:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 36:return[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}];case 25:return n?[{title:i??"TODO",diagnostics:[e],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[r]:n}}}]:[];default:return}},iH=(t,e,r,n)=>r?.length?[{title:n??"TODO",diagnostics:[t],kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[e]:r}}}]:[];function BA(t){let e=t.context.diagnostics.flatMap(a=>{let c=a.data;if(c?.virtual)return[];switch(c?.type){case"FormattingIssues":return iH(a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle);case"SyntaxIssue":return c?.items.flatMap(l=>rH(c.firstToken,c.lastToken,l,a,t.textDocument.uri));case"StandardTypeIssue":return c?.items.flatMap(l=>nH(l,a,t.textDocument.uri,c.edit?Array.isArray(c.edit)?c.edit:[c.edit]:void 0,c.codeActionTitle))}}).filter(a=>!!a),r=e.filter(a=>a.kind===le.CodeActionKind.SourceFixAll),n=e.filter(a=>a.title.startsWith("Add Property")),i=e.filter(a=>a.kind!==le.CodeActionKind.SourceFixAll),s=r.flatMap(a=>a.edit?.changes?.[t.textDocument.uri]??[]),o=new Map;return n.forEach(a=>{let c=a.edit.changes[t.textDocument.uri][0],l=c.range.start.line,u=c.range.start.character;o.has(`${l}:${u}`)||o.set(`${l}:${u}`,[]),o.get(`${l}:${u}`)?.push(c)}),[...i,...r.map(a=>({...a,kind:le.CodeActionKind.QuickFix})),...s.length?[{title:"Fix All",kind:le.CodeActionKind.SourceFixAll,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:s}}}]:[],...Array.from(o.values()).flatMap(a=>a.length>1?{title:"Add All Missing Properties",kind:le.CodeActionKind.QuickFix,isPreferred:!0,edit:{changes:{[t.textDocument.uri]:a}}}:[])]}var ee=q(j());function jA(t,e){return t.line<e.line?-1:t.line>e.line?1:t.character<e.character?-1:t.character>e.character?1:0}var UA=(t,e)=>e.some(r=>jA(t,r.start)>=0&&jA(t,r.end)<=0),sH=async(t,e,r)=>{let n=Xt.create(t.pos.line,t.pos.col),i=r.find(s=>Pr(s,e,n));if(i)return Hn(i,e,n)},Na=(t,e)=>{let r=Xt.create(e.length-1,e.at(-1)?.length??0),n=[],i;return t.filter(o=>(o instanceof rn||o instanceof nn)&&/^dts-format (on|off)$/.test(o.toString().trim())).sort((o,a)=>o.firstToken.pos.line-a.firstToken.pos.line).forEach(o=>{let a=o.toString().trim();if(a==="dts-format off")i={start:Xt.create(o.firstToken.pos.line,o instanceof rn?o.firstToken.pos.colEnd:0)};else if(a==="dts-format on"&&i){let c=Xt.create(o.lastToken.pos.line,o instanceof rn?o.lastToken.pos.colEnd-1:e[o.lastToken.pos.line-1].length);n.push(Je.create(i.start,c)),i=void 0}}),i&&n.push(Je.create(i.start,r)),n},Ra=(t,e,r)=>{let n=t.length?r.filter(i=>(Array.isArray(i.raw.edit)?i.raw.edit:i.raw.edit?[i.raw.edit]:void 0)?.every(o=>!UA(o.range.start,t)&&!UA(o.range.end,t))):r;return"range"in e&&(n=n.filter(i=>Af(e.range,i.raw.range))),n},Pa=(t,e)=>async r=>{let n=t.filter(a=>!(a instanceof Sn)&&!(a instanceof nn)&&!(a instanceof rn)&&!(a instanceof Wn)&&!(a instanceof _n)),i=await sH(r.firstToken,e,n);if(!i||i===r||r.allDescendants.some(a=>a===i))return{level:0};let s=Mf(i);return{level:Js(e,s),inAst:i}},sn=(t,e)=>{if(t.insertSpaces)return"".padStart(e," ");let r=Math.floor(e/t.tabSize),n=e%t.tabSize;return`${"".padStart(r," ")}${"".padStart(n," ")}`},$i=(t,e,r)=>`${"".padStart(t*e.length,e)}${r}`,HA=t=>{let e=t.parentNode;if(!(!e||!(e instanceof ge)))return!(e instanceof Kt)||!e.openBracket?HA(e):e};function Ea(t,e,r,n,i,s,o=!1){if(!o&&nr(e.firstToken,t.firstToken))return n[e.firstToken.pos.line].slice(0,e.firstToken.pos.col).replace(/^\s+/,f=>f.replace(/\t/g," ".repeat(r.tabSize))).length-r.tabSize*i;let a=HA(e);if(!a)return s;let l=Ea(t,a,r,n,i,s);return!o&&nr(e.firstToken,a.firstToken)?l+=e.firstToken.pos.col-a.firstToken.pos.col:a instanceof Kt&&a.openBracket&&++l,l}var Tr=q(j());function wa(t,e,r,n){if(!nr(t,e)){let o=e.prevToken;for(;t!==o;){if(o&&nr(t,o)&&wa(t,o,r,n))return!0;o=o?.prevToken}return null}return n[t.pos.line].slice(0,e.pos.colEnd).replace(/^\s+/,o=>o.replace(/\t/g," ".repeat(r.tabSize))).length>r.wordWrapColumn}async function ll(t,e,r,n,i,s,o=[]){let a=n.split(`
|
|
281
281
|
`),c=Na(e,a),l=n;o.push(...await oH(t,e,r,a,s));let u=Ra(c,t,o);switch(l=ia($r.create(r,"devicetree",0,n),u.flatMap(d=>d.raw.edit).filter(d=>!!d)),i){case"New Text":return l;case"File Diagnostics":return u}}async function oH(t,e,r,n,i){let s=Pa(e,r);return(await Promise.all(e.flatMap(async a=>await zA(t,a,r,s,n,i)))).flat()}var zA=async(t,e,r,n,i,s,o=0)=>{let a=t.options.tabSize,c=t.options.insertSpaces,l=c?" ".repeat(a):" ",u={tabSize:a,insertSpaces:c,singleIndent:l,wordWrapColumn:t.options.wordWrapColumn};return e instanceof Fe?aH(t,e,r,o,s,i,n):e instanceof We?cH(e,o,u,s,i,l):[]},aH=async(t,e,r,n,i,s,o)=>{let a=[];return a.push(...(await Promise.all(e.children.flatMap(c=>zA(t,c,r,o,s,i,n+1)))).flat()),a},cH=(t,e,r,n,i,s)=>wa(t.firstToken,t.lastToken,r,i)===!1?[]:t.values?lH(t,t.propertyName?.name.length??0,t.values,e,r,n,i,s,t.lastToken):[],lH=(t,e,r,n,i,s,o,a,c)=>{for(let[l,u]of r.values.entries()){if(!u)continue;let d=uH(e,u,r.values,l,n,i,s,o,a,l===r.values.length-1&&u.lastToken.nextToken===c?c:void 0);if(d)return d}return[]},Hp=t=>t instanceof gt||t instanceof en&&t.openBracket?t.openBracket??t.firstToken:t.firstToken,uH=(t,e,r,n,i,s,o,a,c,l)=>{let u=e.nextValueSeparator??l??e.lastToken,d=wa(e.firstToken,u,s,a);if(d===!1)return;if(d===null){let b=e.value;return b instanceof gt||b instanceof en?VA(e,t,b,i,s,o,a,c,u):b instanceof ge?Vp(e,t,b,i,s,o,a,c):[]}let f=a[e.firstToken.pos.line].substring(0,e.firstToken.pos.col),p=Math.trunc((t+3)/s.tabSize),m=(t+3)%s.tabSize,h=p+m+i,T=f.trimStart()!==""?i+t+3:h;if(e.firstToken.pos.col===T){let b=e.value;return b instanceof gt||b instanceof en?VA(e,t,b,i,s,o,a,c,u):b instanceof ge?Vp(e,t,b,i,s,o,a,c):void 0}let _=r.slice(n).find(b=>b?.firstToken.pos.line!==e.firstToken.pos.line);return[Rt(8,e.firstToken.uri,Se(e.firstToken,!1),{edit:[Tr.TextEdit.replace(Tr.Range.create(Se(e.firstToken.prevToken),Se(e.firstToken,!1)),`
|
|
282
282
|
${$i(i,c,sn(s,t+3))}`),..._?[Tr.TextEdit.replace(Tr.Range.create(Se(Hp(_).prevToken),Se(Hp(_),!1))," ")]:[]],codeActionTitle:`Move ...${e.toString()}... to a new line`},Se(e.lastToken))]},VA=(t,e,r,n,i,s,o,a,c)=>{for(let[l,u]of r.values.entries()){if(wa(u.firstToken,l===r.values.length-1?c??u.lastToken:u.lastToken,i,o)===!1)continue;if(u.value instanceof Kt)return Vp(t,e,u.value,n,i,s,o,a,l!==0);if(l===0)return[];let p=r.values.slice(l).find(m=>m?.firstToken.pos.line!==u.firstToken.pos.line);return[Rt(8,u.firstToken.uri,Se(u.firstToken,!1),{edit:[Tr.TextEdit.replace(Tr.Range.create(Se(u.firstToken.prevToken),Se(u.firstToken,!1)),`
|
|
283
283
|
${$i(n,a,sn(i,e+4))}`),...p?[Tr.TextEdit.replace(Tr.Range.create(Se(Hp(p).prevToken),Se(Hp(p),!1))," ")]:[]],codeActionTitle:`Move ...${u.toString()}... to a new line`},Se(u.lastToken))]}},Vp=(t,e,r,n,i,s,o,a,c=!1,l=0)=>{let u=new Map;r.allDescendants.forEach(v=>{v instanceof ge&&!(v.parentNode instanceof hr)&&u.set(v.firstToken,v)});let d=Array.from(u.values()).find(v=>wa(v.firstToken,v.lastToken,i,o));if(!d)return;let f=o[d.firstToken.pos.line].substring(0,d.firstToken.pos.col),p=s.runExpressionIndentationCheck?Ea(t,d,i,o,n,e+4,!0):e+4,m=Math.trunc(p/i.tabSize),h=p%i.tabSize,T=m+h+n,_=f.trimStart()!==""?n+p:T;if(c&&d.firstToken.pos.col!==_)return[Rt(8,d.firstToken.uri,Se(d.firstToken,!1),{edit:[Tr.TextEdit.replace(Tr.Range.create(Se(d.firstToken.prevToken),Se(d.firstToken,!1)),`
|
|
284
284
|
${$i(n,a,sn(i,p))}`)],codeActionTitle:`Move ...${d.toString()}... to a new line`},Se(d.lastToken))];if(!(d instanceof Kt))return[];let b=d.flatJoin;for(let[v,k]of b.entries()){let w=wa(k.expression.firstToken,b?.at(v+1)?.operator.lastToken??d.expression.lastToken,i,o);if(w===!1)continue;let H=s.runExpressionIndentationCheck?Ea(t,k.expression,i,o,n,e+4,!!w):e+4;if(w===null)return Vp(t,e,k.expression,n,i,s,o,a,v!==0,l+1);let O=b.slice(v).find(B=>B.expression.firstToken.pos.line!==k.expression.firstToken.pos.line);return[Rt(8,k.expression.firstToken.uri,Se(k.expression.firstToken,!1),{edit:[Tr.TextEdit.replace(Tr.Range.create(Se(k.expression.firstToken.prevToken),Se(k.expression.firstToken,!1)),`
|
|
285
285
|
${$i(n,a,sn(i,H))}`),...O?[Tr.TextEdit.replace(Tr.Range.create(Se(O.expression.firstToken.prevToken),Se(O.expression.firstToken,!1))," ")]:[]],codeActionTitle:`Move ...${k.expression.toString()}... to a new line`},Se(k.expression.lastToken))]}};var ro=q(j());async function ul(t,e,r,n,i,s){let o=n.split(`
|
|
286
286
|
`),a=Na(e,o),c=n,l=await dH(t,o,e,r,s),u=Ra(a,t,l);switch(c=ia($r.create(r,"devicetree",0,n),u.flatMap(d=>d.raw.edit).filter(d=>!!d)),i){case"New Text":return c;case"File Diagnostics":return u;case"Both":return{text:c,diagnostic:u}}}async function dH(t,e,r,n,i){let s=Pa(r,n);return(await Promise.all(r.flatMap(async a=>await WA(t,e,a,n,s,i)))).flat()}var WA=async(t,e,r,n,i,s,o=0)=>{let a=t.options.tabSize,c=t.options.insertSpaces,l=c?" ".repeat(a):" ",u={tabSize:a,insertSpaces:c,singleIndent:l,wordWrapColumn:t.options.wordWrapColumn};return r instanceof Fe?fH(t,e,r,n,o,s,i):r instanceof We?pH(r,o,u,e,l):[]},fH=async(t,e,r,n,i,s,o)=>{let a=[];return a.push(...(await Promise.all(r.children.flatMap(c=>WA(t,e,c,n,o,s,i+1)))).flat()),a},pH=(t,e,r,n,i)=>t.firstToken.pos.line===t.lastToken.pos.line?[]:t.values?hH(t.propertyName?.name.length??0,t.values,e,r,n,i):[],hH=(t,e,r,n,i,s)=>e.values.flatMap(o=>o?mH(t,o,r,n,i,s):[]),mH=(t,e,r,n,i,s)=>{let o=e.value;return o instanceof gt?gH(e,t,o,r,n,i,s)??[]:[]},gH=(t,e,r,n,i,s,o)=>{for(let[a,c]of r.values.entries())if(c.value instanceof Kt){let u=new Map;return c.value.allDescendants.forEach(f=>{f instanceof ge&&!(f.parentNode instanceof hr)&&u.set(f.firstToken,f)}),Array.from(u.values()).flatMap(f=>yH(t,e,f,i,s,o,n))}return[]},yH=(t,e,r,n,i,s,o)=>{if(r.firstToken.pos.line===r.firstToken.prevToken?.pos.line)return[];let a=Ea(t,r,n,i,o,e+4);if(!a)return[];let c=$i(o,s,sn(n,a));if(i[r.firstToken.pos.line].slice(0,r.firstToken.pos.col)===c)return[];let u=ro.Position.create(r.firstToken.pos.line,0),d=ro.Position.create(r.firstToken.pos.line,r.firstToken.pos.col),f=ro.Range.create(u,d),p=ro.TextEdit.replace(f,c);return[Rt(5,r.uri,u,{edit:p,codeActionTitle:"Fix indentation",templateStrings:[c.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},d)]};var qT=(t,e,r)=>!!t.split(`
|
|
287
|
-
`).find(n=>n.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>r),zp=async(t,e,r)=>{if(e!==r){let n=new us(t,[],void 0,()=>new Oi(r,t).tokens,!0);return await n.stable,n.allAstItems}};async function Ca(t,e,r,n={runBaseCheck:!0,runLongLineCheck:!0,runExpressionIndentationCheck:!0},i,s=[],o=[]){let a=Pe(t.textDocument.uri);i??=new Oi(e,a).tokens;let c=[...i],l=new us(a,[],void 0,()=>i,!0);await l.stable;let u=l.issues.filter(m=>Xs(m.raw,a,!1));if(u?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",u.map(m=>m.diagnostic()));let d=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,f=await TH({...t,options:{...t.options,wordWrapColumn:d}},l,s,o,c,e,n);if(r==="New Text"){let m=e;if(n.runBaseCheck){let h=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,f);f=[],m=h}if(n.runExpressionIndentationCheck){let h=await zp(a,e,m)??l.allAstItems;m=await ul({...t,options:{...t.options,wordWrapColumn:d}},h,a,m,r,n)}if(n.runLongLineCheck&&qT(m,t.options.tabSize,d)){let h="";do{h=m;let T=await zp(a,e,h)??l.allAstItems;m=await ll({...t,options:{...t.options,wordWrapColumn:d}},T,a,h,"New Text",n,[...f])}while(h!==m)}return m}if(r==="Both"){let m=e,h=[];if(n.runBaseCheck){let T=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);m=T.text,h.push(...T.diagnostic)}if(n.runExpressionIndentationCheck){h.push(...await ul({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,m,"File Diagnostics",n));let T=await zp(a,e,m)??l.allAstItems;m=(await ul({...t,options:{...t.options,wordWrapColumn:d}},T,a,m,r,n)).text}if(n.runLongLineCheck&&qT(m,t.options.tabSize,d)){h.push(...await ll({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,"File Diagnostics",n,[...f]));let T="";do{T=m;let _=await zp(a,e,T)??l.allAstItems;m=await ll({...t,options:{...t.options,wordWrapColumn:d}},_,a,T,"New Text",n,[...f])}while(T!==m)}return{text:m,diagnostic:h}}let p=[];if(n.runBaseCheck){let m=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);p.push(...m)}if(n.runExpressionIndentationCheck){let m=await ul({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n);p.push(...m)}return n.runLongLineCheck&&qT(e,t.options.tabSize,d)&&p.push(...await ll({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n,[...f])),p}var TH=async(t,e,r,n,i,s,o)=>{let a=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof
|
|
287
|
+
`).find(n=>n.replace(/^\s+/,i=>i.replace(/\t/g," ".repeat(e))).trimEnd().length>r),zp=async(t,e,r)=>{if(e!==r){let n=new us(t,[],void 0,()=>new Oi(r,t).tokens,!0);return await n.stable,n.allAstItems}};async function Ca(t,e,r,n={runBaseCheck:!0,runLongLineCheck:!0,runExpressionIndentationCheck:!0},i,s=[],o=[]){let a=Pe(t.textDocument.uri);i??=new Oi(e,a).tokens;let c=[...i],l=new us(a,[],void 0,()=>i,!0);await l.stable;let u=l.issues.filter(m=>Xs(m.raw,a,!1));if(u?.length)throw new ee.ResponseError(ee.ErrorCodes.InternalError,"Unable to format. File has syntax issues.",u.map(m=>m.diagnostic()));let d=typeof t.options.wordWrapColumn=="number"?t.options.wordWrapColumn:100,f=await TH({...t,options:{...t.options,wordWrapColumn:d}},l,s,o,c,e,n);if(r==="New Text"){let m=e;if(n.runBaseCheck){let h=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,f);f=[],m=h}if(n.runExpressionIndentationCheck){let h=await zp(a,e,m)??l.allAstItems;m=await ul({...t,options:{...t.options,wordWrapColumn:d}},h,a,m,r,n)}if(n.runLongLineCheck&&qT(m,t.options.tabSize,d)){let h="";do{h=m;let T=await zp(a,e,h)??l.allAstItems;m=await ll({...t,options:{...t.options,wordWrapColumn:d}},T,a,h,"New Text",n,[...f])}while(h!==m)}return m}if(r==="Both"){let m=e,h=[];if(n.runBaseCheck){let T=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);m=T.text,h.push(...T.diagnostic)}if(n.runExpressionIndentationCheck){h.push(...await ul({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,m,"File Diagnostics",n));let T=await zp(a,e,m)??l.allAstItems;m=(await ul({...t,options:{...t.options,wordWrapColumn:d}},T,a,m,r,n)).text}if(n.runLongLineCheck&&qT(m,t.options.tabSize,d)){h.push(...await ll({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,"File Diagnostics",n,[...f]));let T="";do{T=m;let _=await zp(a,e,T)??l.allAstItems;m=await ll({...t,options:{...t.options,wordWrapColumn:d}},_,a,T,"New Text",n,[...f])}while(T!==m)}return{text:m,diagnostic:h}}let p=[];if(n.runBaseCheck){let m=await $T({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,l.includes,s,a,e,r,n,[...f]);p.push(...m)}if(n.runExpressionIndentationCheck){let m=await ul({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n);p.push(...m)}return n.runLongLineCheck&&qT(e,t.options.tabSize,d)&&p.push(...await ll({...t,options:{...t.options,wordWrapColumn:d}},l.allAstItems,a,e,r,n,[...f])),p}var TH=async(t,e,r,n,i,s,o)=>{let a=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof Wn),c=e.cPreprocessorParser.allAstItems.filter(m=>m instanceof _n),l=a.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line)),u=c.filter(m=>r.every(h=>m.firstToken.pos.line!==h.firstToken.pos.line));r.push(...l),r.push(...u);let d=[...a.map(m=>m.ifDef.active?m.elseOption?{block:m,branch:m.elseOption}:void 0:{block:m,branch:m.ifDef}),...c.flatMap(m=>{let h=m.ifBlocks.find(_=>_.active),T=m.ifBlocks.filter(_=>!_.active).map(_=>({block:m,branch:_}));return!h&&m.elseOption&&T.push({block:m,branch:m.elseOption}),T})].filter(m=>!!m),f=m=>{let h=m.block.getInValidTokenRangeWhenActiveBlock(m.branch),T=i.filter(b=>!h.has(b)),_=m.block.range;return n.push(m.branch),Ca({...t,range:_},s,"File Diagnostics",o,T,r,n)},p=[];return await d.filter(m=>n.every(h=>h.firstToken.pos.line!==m.block.firstToken.pos.line)).reduce((m,h)=>m.then(async()=>{p.push(...await f(h))}),Promise.resolve()),p};async function $T(t,e,r,n,i,s,o,a,c=[]){let l=s.split(`
|
|
288
288
|
`),u=Na(e,l),d=s;c.push(...await vH(t,e,r,n,i,l,a));let f=Ra(u,t,c);switch(d=ia($r.create(i,"devicetree",0,s),f.flatMap(p=>p.raw.edit).filter(p=>!!p)),o){case"New Text":return d;case"File Diagnostics":return f;case"Both":return{text:d,diagnostic:f}}}async function vH(t,e,r,n,i,s,o){let a=Pa(e,i),c=(await Promise.all(e.flatMap(async u=>await XA(t,u,i,a,s,r,n,o)))).flat();if(t.options.insertFinalNewline&&s.at(-1)?.trim()!==""){let u=ee.TextEdit.insert(ee.Position.create(s.length,s[s.length-1].length),`
|
|
289
289
|
`);c.push(Rt(4,i,ee.Position.create(s.length,0),{edit:u,codeActionTitle:"Insert new line"}))}if(t.options.trimFinalNewlines){let u=0;for(;s.at(-(1+u))?.trim()==="";)u++;if(u>1){let d=s.length-1,f=ee.TextEdit.del(ee.Range.create(ee.Position.create(s.length-u,0),ee.Position.create(d,0)));c.push(Rt(3,i,ee.Position.create(d,0),{edit:f,codeActionTitle:"Remove trailing EOF lines"}))}}let l=c.flatMap(u=>u.raw.edit).filter(u=>!!u);if(t.options.trimTrailingWhitespace){let u=bH(s,l,i);c.push(...u)}return c}var bH=(t,e,r)=>{let n=[];return t.forEach((i,s)=>{let o=i.endsWith("\r")?i.slice(0,-1):i,a=o.trimEnd();if(a.length!==o.length){let c=ee.Range.create(ee.Position.create(s,a.length),ee.Position.create(s,o.length));e.some(l=>rw(c,l.range))||n.push(Rt(2,r,c.start,{edit:ee.TextEdit.del(c),codeActionTitle:"Remove whitespace"},c.end))}}),n},Gp=(t,e=1,r=!1,n=t.prevToken)=>{if(n){let i=t.pos.line-n.pos.line,s=i-e;if(s&&(i!==2&&e!==0||e===0||r)){let o=ee.Position.create(n.pos.line,n.pos.colEnd),a=ee.Position.create(t.pos.line,e?0:t.pos.col),c=ee.TextEdit.replace(ee.Range.create(o,a),`
|
|
290
290
|
`.repeat(e));return Rt(1,t.uri,o,{edit:c,codeActionTitle:s<0?"Insert new lines":"Remove unnecessary new lines",templateStrings:[e.toString()]},a)}}else if(t.pos.line){let i=ee.Position.create(0,0),s=ee.Position.create(t.pos.line,0),o=ee.TextEdit.del(ee.Range.create(i,s));return Rt(1,t.uri,i,{edit:o,codeActionTitle:"Remove unnecessary new lines",templateStrings:["0"]},s)}},GA=(t,e,r,n="",i=1)=>{let s=t.pos.line===t.prevToken?.pos.line;if(t.prevToken&&s){let o=ee.Position.create(t.prevToken.pos.line,t.prevToken.pos.colEnd),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.TextEdit.replace(ee.Range.create(o,a),`${`
|
|
291
|
-
`.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return Rt(0,t.uri,o,{edit:c,codeActionTitle:"Move to new line"},a)}},FT=(t,e,r,n,i="")=>{let s=$i(e,r,i),o=ee.Position.create(t.pos.line,0),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.Range.create(o,a),l=xH(n,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[Rt(5,t.uri,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},kt=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=Gp(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return r&&(c.raw.edit.newText=`${" ".repeat(r)}${c.raw.edit.newText}`),[c]}if(r===0){if(t.nextToken.pos.col===t.pos.colEnd)return[];let c=ee.Position.create(t.pos.line,t.pos.colEnd),l=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),u=ee.TextEdit.del(ee.Range.create(c,l));return[Rt(1,t.uri,c,{edit:u,codeActionTitle:"Remove space(s)",templateStrings:["0"]},l)]}if(t.pos.colEnd===t.nextToken.pos.col){let c=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),l=ee.TextEdit.insert(c," ".repeat(r));return[Rt(1,t.uri,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[r.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===r&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(r))return[];let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),a=ee.TextEdit.replace(ee.Range.create(s,o)," ".repeat(r));return[Rt(1,t.uri,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},dl=(t,e)=>t.slice(1).flatMap(r=>r.firstToken.prevToken?kt(r.firstToken.prevToken,e):[]),SH=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:BT(e.firstToken,n);if(u.push(...on(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Xe||e instanceof mr)if(u.push(...dl(e.labels,c)),e instanceof Xe){e.name?.address?.length&&e.name.address.every(p=>p.toString()!=="")&&e.name.address.forEach(p=>{let m=c[p.firstToken.pos.line].slice(p.firstToken.pos.col,p.lastToken.pos.colEnd),h=m.toLowerCase();h!==m&&u.push(Rt(9,p.uri,Se(p.firstToken,!1),{edit:ee.TextEdit.replace(fe(p),h),codeActionTitle:`Change to '${h}'`},Se(p.lastToken)))}),e.labels.length&&e.name&&e.name.firstToken.prevToken&&u.push(...kt(e.name.firstToken.prevToken,c));let f=e.name&&e.openScope?kt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...kt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?kt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof Ot&&e.firstToken.value==="/"&&e.openScope&&u.push(...kt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>XA(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...kt(e.openScope,c,0)):u.push(...on(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...Kp(e.closeScope,e.lastToken)),u},_H=(t,e,r,n,i,s,o)=>{let a=[];if(a.push(...dl(e.labels,o)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...kt(e.value.firstToken.prevToken,o)),e.value instanceof Yt){let c=o[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),l=c.toLowerCase();l!==c&&a.push(Rt(9,e.value.uri,Se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(fe(e.value),l),codeActionTitle:`Change to '${l}'`},Se(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==s){let c=Gp(e.firstToken,1,!0);c&&a.push(c),a.push(...FT(e.firstToken,r,n.singleIndent,o,sn(n,t+4)))}else a.push(...kt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof ge&&a.push(...Wp(e.value,o,r,n,i,t+4)),a},kH=(t,e,r,n,i,s)=>{let o=[];return e instanceof gt||e instanceof en?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...kt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>_H(t,a,r,n,i,e.openBracket,s))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?o.push(...kt(e.closeBracket.prevToken,s,e.closeBracket.prevToken===e.values.at(-1)?.lastToken?0:1)):o.push(...on(e.closeBracket,r,n.singleIndent,s)))):e instanceof ge&&o.push(...Wp(e,s,r,n,i,t)),o},Wp=(t,e,r,n,i,s)=>t instanceof hr?NH(t,e):t instanceof Kt?RH(t,e,r,n,i,s):[],NH=(t,e)=>{let r=[];return r.push(...kt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(...kt(t.lastToken.prevToken,e,0)),r},RH=(t,e,r,n,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...kt(t.openBracket,e,0)),o.push(...Wp(t.expression,e,r,n,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...kt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...kt(a.expression.firstToken.prevToken,e)):o.push(...on(a.expression.firstToken,r,n.singleIndent,e,sn(n,s),void 0,void 0,!i.runExpressionIndentationCheck)),o.push(...Wp(a.expression,e,r,n,i,s))}),!t.join?.length&&!(t.expression instanceof Kt)&&(t.expression instanceof hr||t.expression instanceof pt)){let a=[];if(t.openBracket){let c=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),l=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}if(t.closeBracket){let c=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),l=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}o.push(Rt(7,t.uri,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...kt(t.closeBracket.prevToken,e,0)),o},PH=(t,e,r,n,i,s)=>{let o=[];return o.push(...dl(e.startLabels,s)),o.push(...kH(t,e.value,r,n,i,s)),o.push(...dl(e.endLabels,s)),o},EH=(t,e,r,n,i,s,o)=>{let a=[];return e.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?e.values.at(l-1):void 0;if(u)if(u.pos.line===c.firstToken.pos.line)if(u.value===","&&d?.lastToken.pos.line!==c.firstToken.pos.line&&u.prevToken?.pos.line!==c.firstToken.pos.line){let f=GA(c.firstToken,r,n.singleIndent,sn(n,t+3));f&&a.push(f)}else a.push(...kt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...kt(o,s));else{let f=Gp(c.firstToken,1,!0);f&&a.push(f),a.push(...FT(c.firstToken,r,n.singleIndent,s,sn(n,t+3)))}a.push(...PH(t,c,r,n,i,s)),c.nextValueSeparator&&a.push(...Kp(c.lastToken,c.nextValueSeparator))}),a},wH=(t,e,r,n,i)=>{let s=[],{force:o,newLines:a}=YA(t,t.firstToken);return s.push(...on(t.firstToken,e,r.singleIndent,i,void 0,a,o)),s.push(...dl(t.labels,i)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...kt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...kt(t.propertyName?.lastToken,i)),s.push(...EH(t.propertyName?.name.length??0,t.values,e,r,n,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...Kp(t.children[t.children.length-1].lastToken,t.lastToken)),s},on=(t,e,r,n,i,s,o,a=!0)=>{let c=[],l=GA(t,e,r,i,s);if(l)c.push(l);else{let u=Gp(t,s,o);u&&c.push(u),a&&c.push(...FT(t,e,r,n,i))}return c},Kp=(t,e)=>{if(t.pos.line===e.pos.line&&t.pos.colEnd+1===e.pos.colEnd)return[];if(t.nextToken===e){let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(e.pos.line,e.pos.col),a=ee.TextEdit.del(ee.Range.create(s,o));return[Rt(1,t.uri,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let r=ee.Position.create(t.pos.line,t.pos.colEnd),n=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(r,e.value),ee.TextEdit.del(ee.Range.create(ee.Position.create(e.prevToken?.pos.line??e.pos.line,e.prevToken?.pos.colEnd??e.pos.col),n))];return[Rt(6,t.uri,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},CH=(t,e,r,n)=>{let i=[];i.push(...on(t.firstToken,e,r,n));let s=kt(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...Kp(t.children[t.children.length-1].lastToken,t.lastToken)),i},DH=(t,e,r,n)=>{if(!pe(t.uri,e))return[];let i=[];i.push(...on(t.firstToken,0,r,n));let s=kt(t.keyword.lastToken,n);return i.push(...s),i},AH=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>IH(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),KA=(t,e,r="")=>{let n=e?dT(e):void 0;if(!n)return r;let i=Qs(e),s=n.propertyName?.name.length??0;return`${`${sn(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},BT=(t,e)=>{let r=e.flatMap(n=>n instanceof zn?[n.ifDef.identifier?.lastToken.nextToken,n.elseOption?.keyword.lastToken.nextToken]:[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},YA=(t,e)=>{let r=t.parentNode instanceof Fe?t.parentNode:void 0,n=r?.children.indexOf(t)??-1;if(n===0&&r?.openScope===e.prevToken)return{newLines:1,force:!0};let i=n>0&&r?.children[n-1];return i instanceof Fe&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},IH=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return on(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return kt(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Fe)c=!0,l=BT(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof We){let{force:p,newLines:m}=YA(e.astAfterComment,e.firstToken);c=p,l=m}let u=[],d="",f=t.toString();switch(o==="last"&&f.trim()!==""&&t.lastToken.prevToken&&(o="comment",u.push(...on(t.lastToken.prevToken,n?.level??0,i,s," "))),o){case"comment":d=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":d=" ";break}return n?.inAst instanceof Fe?u.push(...on(t.firstToken,n?.level??0,i,s,d,l,c)):u.push(...on(t.firstToken,n?.level??0,i,s,KA(a,n?.inAst,d),l,c)),u},OH=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return on(t.firstToken,r?.level??0,n,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof Fe&&(a=!0,c=BT(t.firstToken,e)),on(t.firstToken,r?.level??0,n,i,KA(s,r?.inAst),c,a)},XA=async(t,e,r,n,i,s,o,a,c=0)=>{let l=t.options.tabSize,u=t.options.insertSpaces,d=u?" ".repeat(l):" ",f={tabSize:l,insertSpaces:u,singleIndent:d,wordWrapColumn:t.options.wordWrapColumn};return e instanceof Fe?SH(t,e,s,o,r,c,d,a,i,n):e instanceof We?wH(e,c,f,a,i):e instanceof Rr?CH(e,c,d,i):e instanceof li?DH(e,r,d,i):e instanceof nn&&!e.disabled?OH(e,o,await n(e),d,i,f):e instanceof rn&&!e.disabled?AH(e,o,await n(e),d,i,f):[]};function xH(t,e){let r=t[e.start.line],n=t[e.end.line];if(e.start.line===e.end.line)return r.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[r.substring(e.start.character),...i,n.substring(0,e.end.character)].join(`
|
|
292
|
-
`)}var JA=q(j());var Yp=t=>!t||t instanceof We?!1:t instanceof Er||Yp(t.parentNode);function MH(t){if(!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken))return[];let e=Yp(t?.ast);if(!e&&!(t.ast instanceof We&&t.item.ast.values===null)&&!Yp(t.beforeAst)&&!Yp(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&fT(i,t.beforeAst))??-1)+1,r===-1&&(r=0),t.item.name==="compatible"){let s=t.item.parent.nodeTypes.filter(c=>c).at(-1),o=t.item.ast.quickValues,a;return s instanceof Et&&s.extends.size&&(a=Array.from(s.extends).filter(c=>!o||!o.includes(c))),o?.filter(c=>c)?.length&&!a?[]:(a??=t.runtime.context.bindingLoader?.getBindings()??[],a.filter(c=>!o||!o.includes(c)).map(c=>({label:`"${c}"`,kind:JA.CompletionItemKind.Variable,insertText:e?c:`"${c}"`})))}let n=t.item.parent.nodeType;return n instanceof Et?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function LH(t){if(!t||!(t.item instanceof Ze&&t.ast instanceof tt&&t.item.ast.values==null||t.item instanceof X)||Vt(t.ast)||t.beforeAst?.parentNode instanceof Rr)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof Ze?e(t.item.parent):e(t.item)}async function QA(t,e){return Pt(t,e,r=>[...MH(r),...LH(r)])}var Xp=q(j());async function qH(t){if(t?.ast instanceof pt||t?.ast instanceof
|
|
291
|
+
`.repeat(i)}${"".padStart(e*r.length,r)}${n}`);return Rt(0,t.uri,o,{edit:c,codeActionTitle:"Move to new line"},a)}},FT=(t,e,r,n,i="")=>{let s=$i(e,r,i),o=ee.Position.create(t.pos.line,0),a=ee.Position.create(t.pos.line,t.pos.col),c=ee.Range.create(o,a),l=xH(n,c);if(s===l)return[];let u=ee.TextEdit.replace(c,s);return[Rt(5,t.uri,o,{edit:u,codeActionTitle:"Fix indentation",templateStrings:[s.replaceAll(" ","\xB7").replaceAll(" ","\u2192")]},a)]},kt=(t,e,r=1,n=!1)=>{if(!t.nextToken)return[];if(t.nextToken?.pos.line!==t.pos.line){if(n)return[];let c=Gp(t.nextToken,0);if(!c)throw new Error("remove new LinesEdit must be defined");return r&&(c.raw.edit.newText=`${" ".repeat(r)}${c.raw.edit.newText}`),[c]}if(r===0){if(t.nextToken.pos.col===t.pos.colEnd)return[];let c=ee.Position.create(t.pos.line,t.pos.colEnd),l=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),u=ee.TextEdit.del(ee.Range.create(c,l));return[Rt(1,t.uri,c,{edit:u,codeActionTitle:"Remove space(s)",templateStrings:["0"]},l)]}if(t.pos.colEnd===t.nextToken.pos.col){let c=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),l=ee.TextEdit.insert(c," ".repeat(r));return[Rt(1,t.uri,c,{edit:l,codeActionTitle:"Insert Space(s)",templateStrings:[r.toString()]})]}let i=t.nextToken.pos.col-t.pos.colEnd;if(i===r&&e[t.pos.line].slice(t.pos.colEnd,t.nextToken.pos.col)===" ".repeat(r))return[];let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(t.nextToken.pos.line,t.nextToken.pos.col),a=ee.TextEdit.replace(ee.Range.create(s,o)," ".repeat(r));return[Rt(1,t.uri,s,{edit:a,codeActionTitle:i>r?"Remove space(s)":"Insert space(s)",templateStrings:[r.toString()]},o)]},dl=(t,e)=>t.slice(1).flatMap(r=>r.firstToken.prevToken?kt(r.firstToken.prevToken,e):[]),SH=async(t,e,r,n,i,s,o,a,c,l)=>{let u=[],d=e.topComment||e.firstToken.prevToken?.value==="{"&&!e.topComment?1:BT(e.firstToken,n);if(u.push(...on(e.firstToken,s,o,c,void 0,d,!0)),e instanceof Xe||e instanceof mr)if(u.push(...dl(e.labels,c)),e instanceof Xe){e.name?.address?.length&&e.name.address.every(p=>p.toString()!=="")&&e.name.address.forEach(p=>{let m=c[p.firstToken.pos.line].slice(p.firstToken.pos.col,p.lastToken.pos.colEnd),h=m.toLowerCase();h!==m&&u.push(Rt(9,p.uri,Se(p.firstToken,!1),{edit:ee.TextEdit.replace(fe(p),h),codeActionTitle:`Change to '${h}'`},Se(p.lastToken)))}),e.labels.length&&e.name&&e.name.firstToken.prevToken&&u.push(...kt(e.name.firstToken.prevToken,c));let f=e.name&&e.openScope?kt(e.name.lastToken,c):[];u.push(...f)}else{e.labels.length&&e.reference?.firstToken.prevToken&&u.push(...kt(e.reference.firstToken.prevToken,c));let f=e.reference&&e.openScope?kt(e.reference.lastToken,c):[];u.push(...f)}else e instanceof Ot&&e.firstToken.value==="/"&&e.openScope&&u.push(...kt(e.firstToken,c,1));return u.push(...(await Promise.all(e.children.flatMap(f=>XA(t,f,i,l,c,r,n,a,s+1)))).flat()),e.closeScope&&(e.openScope&&e.closeScope.prevToken===e.openScope?u.push(...kt(e.openScope,c,0)):u.push(...on(e.closeScope,s,o,c,void 0,1,!0))),e.lastToken.value===";"&&e.closeScope&&u.push(...Kp(e.closeScope,e.lastToken)),u},_H=(t,e,r,n,i,s,o)=>{let a=[];if(a.push(...dl(e.labels,o)),e.labels.length&&e.value?.firstToken.prevToken&&a.push(...kt(e.value.firstToken.prevToken,o)),e.value instanceof Yt){let c=o[e.value.firstToken.pos.line].slice(e.value.firstToken.pos.col,e.value.lastToken.pos.colEnd),l=c.toLowerCase();l!==c&&a.push(Rt(9,e.value.uri,Se(e.value.firstToken,!1),{edit:ee.TextEdit.replace(fe(e.value),l),codeActionTitle:`Change to '${l}'`},Se(e.value.lastToken)))}if(e.firstToken.prevToken)if(e.firstToken.pos.line!==e.firstToken.prevToken?.pos.line&&e.firstToken.prevToken!==s){let c=Gp(e.firstToken,1,!0);c&&a.push(c),a.push(...FT(e.firstToken,r,n.singleIndent,o,sn(n,t+4)))}else a.push(...kt(e.firstToken.prevToken,o,s&&e.firstToken.prevToken===s?0:1));return e.value instanceof ge&&a.push(...Wp(e.value,o,r,n,i,t+4)),a},kH=(t,e,r,n,i,s)=>{let o=[];return e instanceof gt||e instanceof en?e.openBracket&&e.openBracket?.nextToken===e.closeBracket?o.push(...kt(e.openBracket,s,0)):(o.push(...e.values.flatMap(a=>_H(t,a,r,n,i,e.openBracket,s))),e.closeBracket?.prevToken&&(e.values.at(-1)?.lastToken===e.closeBracket?.prevToken||e.closeBracket?.prevToken.value==="/"&&e.closeBracket?.prevToken?.prevToken?.value==="*"?o.push(...kt(e.closeBracket.prevToken,s,e.closeBracket.prevToken===e.values.at(-1)?.lastToken?0:1)):o.push(...on(e.closeBracket,r,n.singleIndent,s)))):e instanceof ge&&o.push(...Wp(e,s,r,n,i,t)),o},Wp=(t,e,r,n,i,s)=>t instanceof hr?NH(t,e):t instanceof Kt?RH(t,e,r,n,i,s):[],NH=(t,e)=>{let r=[];return r.push(...kt(t.functionName.lastToken,e,0)),t.lastToken.value===")"&&t.lastToken.prevToken&&r.push(...kt(t.lastToken.prevToken,e,0)),r},RH=(t,e,r,n,i,s)=>{let o=[];if(t.openBracket&&t.openBracket.nextToken&&o.push(...kt(t.openBracket,e,0)),o.push(...Wp(t.expression,e,r,n,i,s)),t.join?.forEach(a=>{a.operator.firstToken.prevToken&&o.push(...kt(a.operator.firstToken.prevToken,e)),a.expression.firstToken.prevToken?.pos.line===a.expression.firstToken.pos.line?o.push(...kt(a.expression.firstToken.prevToken,e)):o.push(...on(a.expression.firstToken,r,n.singleIndent,e,sn(n,s),void 0,void 0,!i.runExpressionIndentationCheck)),o.push(...Wp(a.expression,e,r,n,i,s))}),!t.join?.length&&!(t.expression instanceof Kt)&&(t.expression instanceof hr||t.expression instanceof pt)){let a=[];if(t.openBracket){let c=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.col),l=ee.Position.create(t.openBracket.pos.line,t.openBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}if(t.closeBracket){let c=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.col),l=ee.Position.create(t.closeBracket.pos.line,t.closeBracket.pos.colEnd);a.push(ee.TextEdit.del(ee.Range.create(c,l)))}o.push(Rt(7,t.uri,a[0].range.start,{edit:a,codeActionTitle:"Remove (...)"},a[a.length-1].range.end))}return t.closeBracket&&t.closeBracket.prevToken&&o.push(...kt(t.closeBracket.prevToken,e,0)),o},PH=(t,e,r,n,i,s)=>{let o=[];return o.push(...dl(e.startLabels,s)),o.push(...kH(t,e.value,r,n,i,s)),o.push(...dl(e.endLabels,s)),o},EH=(t,e,r,n,i,s,o)=>{let a=[];return e.values.forEach((c,l)=>{if(!c)return[];let u=c.firstToken.prevToken,d=l?e.values.at(l-1):void 0;if(u)if(u.pos.line===c.firstToken.pos.line)if(u.value===","&&d?.lastToken.pos.line!==c.firstToken.pos.line&&u.prevToken?.pos.line!==c.firstToken.pos.line){let f=GA(c.firstToken,r,n.singleIndent,sn(n,t+3));f&&a.push(f)}else a.push(...kt(u,s,1));else if(o&&c.firstToken.prevToken===o)a.push(...kt(o,s));else{let f=Gp(c.firstToken,1,!0);f&&a.push(f),a.push(...FT(c.firstToken,r,n.singleIndent,s,sn(n,t+3)))}a.push(...PH(t,c,r,n,i,s)),c.nextValueSeparator&&a.push(...Kp(c.lastToken,c.nextValueSeparator))}),a},wH=(t,e,r,n,i)=>{let s=[],{force:o,newLines:a}=YA(t,t.firstToken);return s.push(...on(t.firstToken,e,r.singleIndent,i,void 0,a,o)),s.push(...dl(t.labels,i)),t.labels.length&&t.propertyName?.firstToken.prevToken&&s.push(...kt(t.propertyName.firstToken.prevToken,i)),t.values&&(t.propertyName&&s.push(...kt(t.propertyName?.lastToken,i)),s.push(...EH(t.propertyName?.name.length??0,t.values,e,r,n,i,t.assignOperatorToken))),t.lastToken.value===";"&&s.push(...Kp(t.children[t.children.length-1].lastToken,t.lastToken)),s},on=(t,e,r,n,i,s,o,a=!0)=>{let c=[],l=GA(t,e,r,i,s);if(l)c.push(l);else{let u=Gp(t,s,o);u&&c.push(u),a&&c.push(...FT(t,e,r,n,i))}return c},Kp=(t,e)=>{if(t.pos.line===e.pos.line&&t.pos.colEnd+1===e.pos.colEnd)return[];if(t.nextToken===e){let s=ee.Position.create(t.pos.line,t.pos.colEnd),o=ee.Position.create(e.pos.line,e.pos.col),a=ee.TextEdit.del(ee.Range.create(s,o));return[Rt(1,t.uri,s,{edit:a,codeActionTitle:"Remove white space",templateStrings:["0"]},o)]}let r=ee.Position.create(t.pos.line,t.pos.colEnd),n=ee.Position.create(e.pos.line,e.pos.colEnd),i=[ee.TextEdit.insert(r,e.value),ee.TextEdit.del(ee.Range.create(ee.Position.create(e.prevToken?.pos.line??e.pos.line,e.prevToken?.pos.colEnd??e.pos.col),n))];return[Rt(6,t.uri,r,{edit:i,codeActionTitle:"Move token",templateStrings:[e.value]},n)]},CH=(t,e,r,n)=>{let i=[];i.push(...on(t.firstToken,e,r,n));let s=kt(t.keyword.lastToken,n);return i.push(...s),t.lastToken.value===";"&&i.push(...Kp(t.children[t.children.length-1].lastToken,t.lastToken)),i},DH=(t,e,r,n)=>{if(!pe(t.uri,e))return[];let i=[];i.push(...on(t.firstToken,0,r,n));let s=kt(t.keyword.lastToken,n);return i.push(...s),i},AH=(t,e,r,n,i,s)=>t.comments.length===1&&t.firstToken.pos.line===t.firstToken.prevToken?.pos.line?[]:t.comments.flatMap((o,a)=>IH(o,t,e,r,n,i,a?a===t.comments.length-1?"last":"comment":"first",s)),KA=(t,e,r="")=>{let n=e?dT(e):void 0;if(!n)return r;let i=Qs(e),s=n.propertyName?.name.length??0;return`${`${sn(t,s+(i?4:3)+(r.length-r.trimStart().length))}`}${r.trimStart()}`},BT=(t,e)=>{let r=e.flatMap(n=>n instanceof Wn?[n.ifDef.identifier?.lastToken.nextToken,n.elseOption?.keyword.lastToken.nextToken]:[...n.ifBlocks.map(i=>i.expression?.lastToken.nextToken),n.elseOption?.lastToken.nextToken]).some(n=>n===t);return t.prevToken?.value==="{"||r?1:2},YA=(t,e)=>{let r=t.parentNode instanceof Fe?t.parentNode:void 0,n=r?.children.indexOf(t)??-1;if(n===0&&r?.openScope===e.prevToken)return{newLines:1,force:!0};let i=n>0&&r?.children[n-1];return i instanceof Fe&&t.firstToken.prevToken===(i.endComment??i).lastToken?{newLines:2,force:!0}:{newLines:void 0,force:void 0}},IH=(t,e,r,n,i,s,o,a)=>{if(!t.firstToken.prevToken)return on(t.firstToken,n?.level??0,i,s);if(t.firstToken.pos.line===t.firstToken.prevToken?.pos.line)return kt(t.firstToken.prevToken,s,1);if(n===void 0)return[];let c,l;if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof Fe)c=!0,l=BT(e.firstToken,r);else if(o==="first"&&!e.astBeforeComment&&e.astAfterComment instanceof We){let{force:m,newLines:h}=YA(e.astAfterComment,e.firstToken);c=m,l=h}let u=e.astAfterComment instanceof Sn?0:n.level,d=[],f="",p=t.toString();switch(o==="last"&&p.trim()!==""&&t.lastToken.prevToken&&(o="comment",d.push(...on(t.lastToken.prevToken,u,i,s," "))),o){case"comment":f=t.firstToken.value==="*"?" ":" * ";break;case"first":break;case"last":f=" ";break}return n?.inAst instanceof Fe?d.push(...on(t.firstToken,u,i,s,f,l,c)):d.push(...on(t.firstToken,u,i,s,KA(a,n?.inAst,f),l,c)),d},OH=(t,e,r,n,i,s)=>{if(!t.firstToken.prevToken)return on(t.firstToken,r?.level??0,n,i);if(t.firstToken.pos.line===t.firstToken.prevToken.pos.line)return[];let a,c;return!t.astBeforeComment&&t.astAfterComment instanceof Fe&&(a=!0,c=BT(t.firstToken,e)),on(t.firstToken,r?.level??0,n,i,KA(s,r?.inAst),c,a)},XA=async(t,e,r,n,i,s,o,a,c=0)=>{let l=t.options.tabSize,u=t.options.insertSpaces,d=u?" ".repeat(l):" ",f={tabSize:l,insertSpaces:u,singleIndent:d,wordWrapColumn:t.options.wordWrapColumn};return e instanceof Fe?SH(t,e,s,o,r,c,d,a,i,n):e instanceof We?wH(e,c,f,a,i):e instanceof Rr?CH(e,c,d,i):e instanceof Sn?DH(e,r,d,i):e instanceof nn&&!e.disabled?OH(e,o,await n(e),d,i,f):e instanceof rn&&!e.disabled?AH(e,o,await n(e),d,i,f):[]};function xH(t,e){let r=t[e.start.line],n=t[e.end.line];if(e.start.line===e.end.line)return r.substring(e.start.character,e.end.character);let i=t.slice(e.start.line+1,e.end.line);return[r.substring(e.start.character),...i,n.substring(0,e.end.character)].join(`
|
|
292
|
+
`)}var JA=q(j());var Yp=t=>!t||t instanceof We?!1:t instanceof Er||Yp(t.parentNode);function MH(t){if(!t||!(t.item instanceof Ze&&t.item.ast.assignOperatorToken))return[];let e=Yp(t?.ast);if(!e&&!(t.ast instanceof We&&t.item.ast.values===null)&&!Yp(t.beforeAst)&&!Yp(t.afterAst))return[];let r=-1;if(t.item.ast.values===null?r=0:r=(t.item.ast.values?.values.findIndex(i=>i&&fT(i,t.beforeAst))??-1)+1,r===-1&&(r=0),t.item.name==="compatible"){let s=t.item.parent.nodeTypes.filter(c=>c).at(-1),o=t.item.ast.quickValues,a;return s instanceof Et&&s.extends.size&&(a=Array.from(s.extends).filter(c=>!o||!o.includes(c))),o?.filter(c=>c)?.length&&!a?[]:(a??=t.runtime.context.bindingLoader?.getBindings()??[],a.filter(c=>!o||!o.includes(c)).map(c=>({label:`"${c}"`,kind:JA.CompletionItemKind.Variable,insertText:e?c:`"${c}"`})))}let n=t.item.parent.nodeType;return n instanceof Et?n.properties.find(i=>i.name===t.item?.name)?.getPropertyCompletionItems(t.item,r,e)??[]:[]}function LH(t){if(!t||!(t.item instanceof Ze&&t.ast instanceof tt&&t.item.ast.values==null||t.item instanceof X)||Vt(t.ast)||t.beforeAst?.parentNode instanceof Rr)return[];let e=r=>r.nodeType?.getPropertyListCompletionItems(r)??[];return t.item instanceof Ze?e(t.item.parent):e(t.item)}async function QA(t,e){return Pt(t,e,r=>[...MH(r),...LH(r)])}var Xp=q(j());async function qH(t){if(t?.ast instanceof pt||t?.ast instanceof li){let e=t.runtime.context.parser.cPreprocessorParser.macros.get(t?.ast instanceof pt?t.ast.name:t.ast.value);if(e){let r=Bc(t.ast),n=(await t.runtime.context.getAllStableParsers()).at(-1);if(r){let i=r?.evaluate(n.cPreprocessorParser.macros);return{contents:{kind:Xp.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${i}${typeof i=="number"?` (0x${i.toString(16)})`:""}`,"```"].join(`
|
|
293
293
|
`)},range:fe(t.ast)}}return{contents:{kind:Xp.MarkupKind.Markdown,value:["```cpp",`#define ${e.macro.toString()} // = ${t.ast?.evaluate(n.cPreprocessorParser.macros)}`,"```"].join(`
|
|
294
294
|
`)},range:fe(t.ast)}}}}async function $H(t){if(!t)return;let e=(await t.runtime.context.getAllStableParsers()).at(-1);if(t?.ast instanceof xe){let r=t.ast.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}if(t?.ast.parentNode instanceof ie){let r=t.ast.parentNode.linksTo;if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}if(t?.ast instanceof ne&&t.item instanceof Ze&&t.item.parent.name==="aliases"){let r=t.runtime.rootNode.getChild(t.ast.value.split("/"));if(r)return{contents:r.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}if(t?.item instanceof X)return{contents:t.item.toMarkupContent(e.cPreprocessorParser.macros),range:fe(t.ast)}}function FH(t){if(t?.item instanceof Ze&&t.ast instanceof tt){let e=t.item.onHover(),r=t.item.parent.nodeType?.getOnPropertyHover(t.item.name);if(e||r)return{contents:{kind:Xp.MarkupKind.Markdown,value:`${e?.value??""}
|
|
295
295
|
${r?.value??""}`},range:fe(t.ast)}}}function ZA(t,e){return Pt(t,e,async r=>[await $H(r)||FH(r)||await qH(r)])}async function e0(t){let e=await pp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function t0(t){let e=await hp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var i0=q(j());async function r0(t){return t?.nodes.length??0}async function n0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return r0(s)}async function s0(t){let e=await n0(t,M);return e!==void 0?{contents:{kind:i0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function o0(t){let e=await MT(t);if(e)return e?.length?{contents:{kind:cs.Markdown,value:e.map((r,n)=>{let i=r.toMarkupContent(t.context.macros);return`## Node ${n+1}
|
|
@@ -297,9 +297,9 @@ ${r?.value??""}`},range:fe(t.ast)}}}function ZA(t,e){return Pt(t,e,async r=>[awa
|
|
|
297
297
|
${i.value}
|
|
298
298
|
`}).join(`
|
|
299
299
|
|
|
300
|
-
`)}}:{contents:{kind:cs.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function a0(t){let e=await mp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function c0(t,e){return!!await fp(t,e)}async function l0({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return c0(t.args[0].macro,e)}async function u0(t){let e=await l0(t);if(e!==void 0)return{contents:{kind:cs.Markdown,value:e?"1":"0"}}}var f0=q(j());async function fl(t,e){if(t)switch(e){case"Unquoted":return t.fullName;case"Quoted":return`"${t.fullName}"`;case"Token":return Z(t.fullName);case"Upper Token":return Z(t.fullName).toUpperCase()}}async function d0({document:t,macro:e,context:r,position:n},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});switch(e.macro){case"DT_NODE_FULL_NAME":return fl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return fl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return fl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return fl(s,"Upper Token")}}async function p0(t){let e=await d0(t,M);if(e)return{contents:{kind:f0.MarkupKind.Markdown,value:e}}}var g0=q(j());async function h0(t){return t?.pathString}async function m0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return h0(s)}async function y0(t){let e=await m0(t,M);if(e)return{contents:{kind:g0.MarkupKind.Markdown,value:`"${e}"`}}}async function T0(t){let e=await yp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var S0=q(j());async function v0(t){return t?.labels.map(e=>e.label)}async function b0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return v0(s)}async function _0(t){let e=await b0(t,M);if(e)return{contents:{kind:S0.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function k0(t){let e=await Tp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function N0(t){let e=await bp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var P0=q(j());async function R0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await r?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:r,position:n}),a=await i({document:t,macro:e.args[1],context:r,position:n});return!!a&&!!o&&a===o}}async function E0(t){let e=await R0(t,M);if(e!==void 0)return{contents:{kind:P0.MarkupKind.Markdown,value:e?"1":"0"}}}var C0=q(j());async function w0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await ya(o,s[1].macro,a)}async function D0(t){let e=await w0(t,M);return e?{contents:{kind:C0.MarkupKind.Markdown,value:e.toString()}}:void 0}var I0=q(j());async function A0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return fs(o,s[1].macro,a,s[3].macro,r)}async function O0(t){let e=await A0(t,M);return e?{contents:{kind:I0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function x0(t){let e=await hi(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function M0(t){let e=await Ep(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var pl=q(j());async function at(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:pl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:pl.MarkupKind.Markdown,value:e}};if(e instanceof X)return{contents:e.toMarkupContent(t.macros)};if(e.length===1&&e[0]instanceof X)return{contents:e[0].toMarkupContent(t.macros)};if(e.every(r=>typeof r=="number"))return{contents:{kind:pl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:pl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function L0(t){let e=await op(t,M);return at(t.context,e)}var jT=q(j());async function q0(t){let e=await ap(t,M);if(e===!0)return{contents:{kind:jT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:jT.MarkupKind.Markdown,value:e.toString()}}}async function $0(t){let e=await ga(t,M);return at(t.context,e)}async function F0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await yr(s,e.args[3].macro,r)}async function B0(t){return at(t.context,await F0(t,M))}async function j0(t){let e=await Sp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var V0=q(j());async function U0(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function H0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM_STATUS_OKAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return U0(s)}async function z0(t){let e=await H0(t,M);return e!==void 0?{contents:{kind:V0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function W0(t){let e=await ps(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var K0=q(j());async function G0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return fs(o,s[1].macro,0,s[2].macro,r)}async function Y0(t){let e=await G0(t,M);return e?{contents:{kind:K0.MarkupKind.Markdown,value:e.toString()}}:void 0}var X0=q(j());async function J0(t){let e=await Rp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:X0.MarkupKind.Markdown,value:e.toString()}}:void 0}var Z0=q(j());async function Q0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return fs(o,s[1].macro,s[2].macro,s[3].macro,r)}async function eI(t){let e=await Q0(t,M);return e?{contents:{kind:Z0.MarkupKind.Markdown,value:e.toString()}}:void 0}var tI=q(j());async function rI(t){let e=await Pp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:tI.MarkupKind.Markdown,value:e.toString()}}:void 0}var nI=q(j());async function iI(t){let e=await wp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:nI.MarkupKind.Markdown,value:e.toString()}}:void 0}var sI=q(j());async function oI(t){let e=await kp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:sI.MarkupKind.Markdown,value:e.toString()}}:void 0}var cI=q(j());async function aI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await ya(o,s[1].macro,0)}async function lI(t){let e=await aI(t,M);return e?{contents:{kind:cI.MarkupKind.Markdown,value:e.toString()}}:void 0}var uI=q(j());async function dI(t){let e=await Np(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:uI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function fI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return yr(s,e.args[2].macro,r)}async function pI(t){return at(t.context,await fI(t,M))}async function hI(t){return at(t.context,await Cp(t,M))}var yI=q(j());var mI=q(require("util"));async function Jp(t,e,r,n){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(r);if(s!==void 0)return mI.default.isDeepStrictEqual(Ce(n),s)}async function gI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await Jp(o,s[1].macro,0,s[2].macro)}async function TI(t){let e=await gI(t,M);return e!==void 0?{contents:{kind:yI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var bI=q(j());async function vI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await Jp(o,s[1].macro,a,s[3].macro)}async function SI(t){let e=await vI(t,M);return e!==void 0?{contents:{kind:bI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var NI=q(j());async function _I(t,e,r,n){let i=await yr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Ce(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function kI({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await _I(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function RI(t){let e=await kI(t,M);return e===void 0?void 0:{contents:{kind:NI.MarkupKind.Markdown,value:e?"1":"0"}}}var wI=q(j());async function PI(t,e,r,n){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof Et)||await yr(t,e,n)===void 0)return;let a=i.nexusMapsTo.at(0)?.specifierSpace,l=(a?i.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.findIndex(u=>typeof u=="string"&&u.toLowerCase()===r)??-1;return l===-1?void 0:l}async function EI({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await PI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function CI(t){let e=await EI(t,M);return e===void 0?void 0:{contents:{kind:wI.MarkupKind.Markdown,value:e?"1":"0"}}}async function DI(t){let e=await gp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var II=q(j());async function AI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Dp(o,s[1].macro):void 0}async function OI(t){let e=await AI(t,M);return e?{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}:void 0}var xI=q(j());async function MI(t){let e=await Ap(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:xI.MarkupKind.Markdown,value:e.toString()}}:void 0}var UT=q(j());async function LI(t,e,r){let n=await yr(t,e,r);if(n===!0)return!0;if(!n)return;let i=n.at(-1);if(i)return n.length===1&&n[0]instanceof X?n[0]:i}async function qI({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return LI(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function $I(t){let e=await qI(t,M);if(e===!0)return{contents:{kind:UT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:UT.MarkupKind.Markdown,value:e.toString()}}}var BI=q(j());async function FI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?va(o,s[1].macro):void 0}async function jI(t){let e=await FI(t,M);if(e)return{contents:{kind:BI.MarkupKind.Markdown,value:e.toString()}}}var HI=q(j());async function Qp(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return Z(i[r].value)}async function UI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?Qp(o,s[1].macro,a):void 0}async function VI(t){let e=await UI(t,M);if(e)return{contents:{kind:HI.MarkupKind.Markdown,value:e.toString()}}}var zI=q(j());async function WI(t){let e=await Ip(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:zI.MarkupKind.Markdown,value:e.toString()}}}var YI=q(j());async function GI(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return i[r].value}async function KI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?GI(o,s[1].macro,a):void 0}async function XI(t){let e=await KI(t,M);if(e)return{contents:{kind:YI.MarkupKind.Markdown,value:e.toString()}}}var QI=q(j());async function JI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Op(o,s[1].macro):void 0}async function ZI(t){let e=await JI(t,M);if(e)return{contents:{kind:QI.MarkupKind.Markdown,value:e.toString()}}}var eO=q(j());async function tO(t){let e=await xp(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:eO.MarkupKind.Markdown,value:e.toString()}}}var iO=q(j());async function rO(t,e,r){return(await Qp(t,e,r))?.toUpperCase()}async function nO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?rO(o,s[1].macro,a):void 0}async function sO(t){let e=await nO(t,M);if(e)return{contents:{kind:iO.MarkupKind.Markdown,value:e.toString()}}}var aO=q(j());async function oO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Mp(o,s[1].macro):void 0}async function cO(t){let e=await oO(t,M);if(e)return{contents:{kind:aO.MarkupKind.Markdown,value:e.toString()}}}var lO=q(j());async function uO(t){let e=await Lp(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:lO.MarkupKind.Markdown,value:e.toString()}}}async function dO(t){let e=await lp(t,M);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var hO=q(j());async function fO(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?Z(r)===e:!1}async function pO(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||r?.length!==2)return;let n=await e({...t,macro:r[0]});return await fO(n,r[1].macro)}async function mO(t){let e=await pO(t,M);return e!==void 0?{contents:{kind:hO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function gO(t){let e=await dp(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var vO=q(j());async function yO(t,e){return!!await up(t,e)}async function TO(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await yO(t.context,e[0].macro)}async function bO(t){let e=await TO(t);return e!==void 0?{contents:{kind:vO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function BH(t){return[dO,mO,gO,bO,e0,t0,s0,z0,o0,a0,u0,DI,j0,N0,y0,p0,T0,_0,k0,E0].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function jH(t){return[SI,TI,D0,oI,lI,dI,O0,J0,eI,rI,Y0,x0,M0,W0,iI,q0,pI,B0,hI,RI,CI,L0,$I,OI,MI,$0,VI,jI,WI,XI,ZI,tO,sO,cO,uO].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function SO(t,e,r){if(!r)return;let n=Mi(r,t.position);return _O(n,t.position,e,r)}async function _O(t,e,r,n){if(!t?.macro)return;let i=await BH({position:e,context:r,document:n,macro:t})||await jH({position:e,context:r,document:n,macro:t});if(i)return i;let s=await M({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ds(n,t.macro,e,r);if(o)return _O(o[0],o[1],r,n)}var H_=require("path"),V_=require("fs");var HT=(t,e,r)=>{let n=t instanceof RegExp?kO(t,r):t,i=e instanceof RegExp?kO(e,r):e,s=n!==null&&i!=null&&UH(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},kO=(t,e)=>{let r=e.match(t);return r?r[0]:null},UH=(t,e,r)=>{let n,i,s,o,a,c=r.indexOf(t),l=r.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(n=[],s=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(t,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=r.indexOf(e,u+1);u=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[s,o])}return a};var NO="\0SLASH"+Math.random()+"\0",RO="\0OPEN"+Math.random()+"\0",zT="\0CLOSE"+Math.random()+"\0",PO="\0COMMA"+Math.random()+"\0",EO="\0PERIOD"+Math.random()+"\0",HH=new RegExp(NO,"g"),VH=new RegExp(RO,"g"),zH=new RegExp(zT,"g"),WH=new RegExp(PO,"g"),GH=new RegExp(EO,"g"),KH=/\\\\/g,YH=/\\{/g,XH=/\\}/g,JH=/\\,/g,QH=/\\./g;function VT(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function ZH(t){return t.replace(KH,NO).replace(YH,RO).replace(XH,zT).replace(JH,PO).replace(QH,EO)}function eV(t){return t.replace(HH,"\\").replace(VH,"{").replace(zH,"}").replace(WH,",").replace(GH,".")}function wO(t){if(!t)return[""];let e=[],r=HT("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=wO(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function CO(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),hl(ZH(t),!0).map(eV)):[]}function tV(t){return"{"+t+"}"}function rV(t){return/^-?0\d/.test(t)}function nV(t,e){return t<=e}function iV(t,e){return t>=e}function hl(t,e){let r=[],n=HT("{","}",t);if(!n)return[t];let i=n.pre,s=n.post.length?hl(n.post,!1):[""];if(/\$$/.test(n.pre))for(let o=0;o<s.length;o++){let a=i+"{"+n.body+"}"+s[o];r.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=o||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(t=n.pre+"{"+n.body+zT+n.post,hl(t)):[t];let u;if(c)u=n.body.split(/\.\./);else if(u=wO(n.body),u.length===1&&u[0]!==void 0&&(u=hl(u[0],!1).map(tV),u.length===1))return s.map(f=>n.pre+u[0]+f);let d;if(c&&u[0]!==void 0&&u[1]!==void 0){let f=VT(u[0]),p=VT(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(VT(u[2])):1,T=nV;p<f&&(h*=-1,T=iV);let b=u.some(rV);d=[];for(let v=f;T(v,p);v+=h){let k;if(a)k=String.fromCharCode(v),k==="\\"&&(k="");else if(k=String(v),b){let w=m-k.length;if(w>0){let H=new Array(w+1).join("0");v<0?k="-"+H+k.slice(1):k=H+k}}d.push(k)}}else{d=[];for(let f=0;f<u.length;f++)d.push.apply(d,hl(u[f],!1))}for(let f=0;f<d.length;f++)for(let p=0;p<s.length;p++){let m=i+d[f]+s[p];(!e||c||m)&&r.push(m)}}return r}var ml=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var sV={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},gl=t=>t.replace(/[[\]\\-]/g,"\\$&"),oV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),DO=t=>t.join(""),AO=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,l=!1,u=r,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===r+1){l=!0,s++;continue}if(h==="]"&&o&&!c){u=s+1;break}if(o=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[_,b,v]]of Object.entries(sV))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-r,!0];s+=T.length,v?i.push(_):n.push(_),a=a||b;continue e}}if(c=!1,d){h>d?n.push(gl(d)+"-"+gl(h)):h===d&&n.push(gl(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(gl(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(gl(h)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[oV(h),!1,u-r,!1]}let f="["+(l?"^":"")+DO(n)+"]",p="["+(l?"":"^")+DO(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var Gn=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var aV=new Set(["!","?","+","*","@"]),IO=t=>aV.has(t),cV="(?!(?:^|/)\\.\\.?(?:$|/))",Zp="(?!\\.)",lV=new Set(["[","."]),uV=new Set(["..","."]),dV=new Set("().*{}+?[]^$\\!"),fV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),WT="[^/]",OO=WT+"*?",xO=WT+"+?",Da=class t{type;#e;#t;#n=!1;#r=[];#o;#f;#a;#d=!1;#c;#l;#s=!1;constructor(e,r,n={}){this.type=e,e&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#f=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#r.map(e=>String(e)).join("|")+")":this.#l=this.#r.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let e;for(;e=this.#a.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#f+1;!n.type&&i<n.#r.length;i++)for(let s of e.#r){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof t&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let e=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#f===0)return!0;let e=this.#o;for(let r=0;r<this.#f;r++){let n=e.#r[r];if(!(n instanceof t&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#r.length:0;return this.#f===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new t(this.type,e);for(let n of this.#r)r.copyIn(n);return r}static#T(e,r,n,i){let s=!1,o=!1,a=-1,c=!1;if(r.type===null){let p=n,m="";for(;p<e.length;){let h=e.charAt(p++);if(s||h==="\\"){s=!s,m+=h;continue}if(o){p===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(p===a+2&&c)&&(o=!1),m+=h;continue}else if(h==="["){o=!0,a=p,c=!1,m+=h;continue}if(!i.noext&&IO(h)&&e.charAt(p)==="("){r.push(m),m="";let T=new t(h,r);p=t.#T(e,T,p,i),r.push(T);continue}m+=h}return r.push(m),p}let l=n+1,u=new t(null,r),d=[],f="";for(;l<e.length;){let p=e.charAt(l++);if(s||p==="\\"){s=!s,f+=p;continue}if(o){l===a+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(l===a+2&&c)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,a=l,c=!1,f+=p;continue}if(IO(p)&&e.charAt(l)==="("){u.push(f),f="";let m=new t(p,u);u.push(m),l=t.#T(e,m,l,i);continue}if(p==="|"){u.push(f),f="",d.push(u),u=new t(null,r);continue}if(p===")")return f===""&&r.#r.length===0&&(r.#s=!0),u.push(f),f="",r.push(...d,u),l;f+=p}return r.type=null,r.#t=void 0,r.#r=[e.substring(n-1)],l}static fromGlob(e,r={}){let n=new t(null,void 0,r);return t.#T(e,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#c}toRegExpSource(e){let r=e??!!this.#c.dot;if(this.#e===this&&this.#y(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),l=this.#r.map(p=>{let[m,h,T,_]=typeof p=="string"?t.#p(p,this.#t,c):p.toRegExpSource(e);return this.#t=this.#t||T,this.#n=this.#n||_,m}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&uV.has(this.#r[0]))){let m=lV,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!r&&!e&&m.has(l.charAt(0));u=h?cV:T?Zp:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,Gn(l),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString();return this.#r=[c],this.type=null,this.#t=void 0,[c,Gn(this.toString()),!1,!1]}let o=!n||e||r||!Zp?"":this.#h(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!r?Zp:"")+xO;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Zp:"")+OO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Gn(s),this.#t=!!this.#t,this.#n]}#h(e){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#p(e,r,n=!1){let i=!1,s="",o=!1;for(let a=0;a<e.length;a++){let c=e.charAt(a);if(i){i=!1,s+=(dV.has(c)?"\\":"")+c;continue}if(c==="\\"){a===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[l,u,d,f]=AO(e,a);if(d){s+=l,o=o||u,a+=d-1,r=r||f;continue}}if(c==="*"){s+=n&&e==="*"?xO:OO,r=!0;continue}if(c==="?"){s+=WT,r=!0;continue}s+=fV(c)}return[s,Gn(e),!!r,o]}};var Aa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var wr=(t,e,r={})=>(ml(e),!r.nocomment&&e.charAt(0)==="#"?!1:new an(e,r).match(t)),pV=/^\*+([^+@!?\*\[\(]*)$/,hV=t=>e=>!e.startsWith(".")&&e.endsWith(t),mV=t=>e=>e.endsWith(t),gV=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),yV=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),TV=/^\*+\.\*+$/,vV=t=>!t.startsWith(".")&&t.includes("."),bV=t=>t!=="."&&t!==".."&&t.includes("."),SV=/^\.\*+$/,_V=t=>t!=="."&&t!==".."&&t.startsWith("."),kV=/^\*+$/,NV=t=>t.length!==0&&!t.startsWith("."),RV=t=>t.length!==0&&t!=="."&&t!=="..",PV=/^\?+([^+@!?\*\[\(]*)?$/,EV=([t,e=""])=>{let r=qO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},wV=([t,e=""])=>{let r=$O([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},CV=([t,e=""])=>{let r=$O([t]);return e?n=>r(n)&&n.endsWith(e):r},DV=([t,e=""])=>{let r=qO([t]);return e?n=>r(n)&&n.endsWith(e):r},qO=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},$O=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},FO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",MO={win32:{sep:"\\"},posix:{sep:"/"}},AV=FO==="win32"?MO.win32.sep:MO.posix.sep;wr.sep=AV;var sr=Symbol("globstar **");wr.GLOBSTAR=sr;var IV="[^/]",OV=IV+"*?",xV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",MV="(?:(?!(?:\\/|^)\\.).)*?",LV=(t,e={})=>r=>wr(r,t,e);wr.filter=LV;var kn=(t,e={})=>Object.assign({},t,e),qV=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return wr;let e=wr;return Object.assign((n,i,s={})=>e(n,i,kn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,kn(t,s))}static defaults(i){return e.defaults(kn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,kn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,kn(t,s))}},unescape:(n,i={})=>e.unescape(n,kn(t,i)),escape:(n,i={})=>e.escape(n,kn(t,i)),filter:(n,i={})=>e.filter(n,kn(t,i)),defaults:n=>e.defaults(kn(t,n)),makeRe:(n,i={})=>e.makeRe(n,kn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,kn(t,i)),match:(n,i,s={})=>e.match(n,i,kn(t,s)),sep:e.sep,GLOBSTAR:sr})};wr.defaults=qV;var BO=(t,e={})=>(ml(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:CO(t));wr.braceExpand=BO;var $V=(t,e={})=>new an(t,e).makeRe();wr.makeRe=$V;var FV=(t,e,r={})=>{let n=new an(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};wr.match=FV;var LO=/[?*]|[+@!]\(.*?\)|\[|\]/,BV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),an=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){ml(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||FO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!LO.test(s[2]))&&!LO.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(l)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],l=n[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=this.options;if(this.isWindows){let h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),_=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),b=!_&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),v=T?3:h?0:void 0,k=b?3:_?0:void 0;if(typeof v=="number"&&typeof k=="number"){let[w,H]=[e[v],r[k]];w.toLowerCase()===H.toLowerCase()&&(r[k]=w,k>v?r=r.slice(k):v>k&&(e=e.slice(v)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var o=0,a=0,c=e.length,l=r.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");var u=r[a],d=e[o];if(this.debug(r,u,d),u===!1)return!1;if(u===sr){this.debug("GLOBSTAR",[r,u,d]);var f=o,p=a+1;if(p===l){for(this.debug("** at the end");o<c;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;f<c;){var m=e[f];if(this.debug(`
|
|
300
|
+
`)}}:{contents:{kind:cs.Markdown,value:`No node matched compat ${t.macro.args[0].macro}`}}}async function a0(t){let e=await mp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function c0(t,e){return!!await fp(t,e)}async function l0({macro:t,context:e}){if(!(t.macro!=="DT_HAS_ALIAS"||t.args?.length!==1))return c0(t.args[0].macro,e)}async function u0(t){let e=await l0(t);if(e!==void 0)return{contents:{kind:cs.Markdown,value:e?"1":"0"}}}var f0=q(j());async function fl(t,e){if(t)switch(e){case"Unquoted":return t.fullName;case"Quoted":return`"${t.fullName}"`;case"Token":return Z(t.fullName);case"Upper Token":return Z(t.fullName).toUpperCase()}}async function d0({document:t,macro:e,context:r,position:n},i){if(e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});switch(e.macro){case"DT_NODE_FULL_NAME":return fl(s,"Quoted");case"DT_NODE_FULL_NAME_TOKEN":return fl(s,"Token");case"DT_NODE_FULL_NAME_UNQUOTED":return fl(s,"Unquoted");case"DT_NODE_FULL_NAME_UPPER_TOKEN":return fl(s,"Upper Token")}}async function p0(t){let e=await d0(t,M);if(e)return{contents:{kind:f0.MarkupKind.Markdown,value:e}}}var g0=q(j());async function h0(t){return t?.pathString}async function m0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODE_PATH"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return h0(s)}async function y0(t){let e=await m0(t,M);if(e)return{contents:{kind:g0.MarkupKind.Markdown,value:`"${e}"`}}}async function T0(t){let e=await yp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var S0=q(j());async function v0(t){return t?.labels.map(e=>e.label)}async function b0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_NODELABEL_STRING_ARRAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return v0(s)}async function _0(t){let e=await b0(t,M);if(e)return{contents:{kind:S0.MarkupKind.Markdown,value:`{ ${e.map(r=>`"${r}"`).join(", ")} }`}}}async function k0(t){let e=await Tp(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function N0(t){let e=await bp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var P0=q(j());async function R0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_SAME_NODE"||e.args?.length!==2)return;if(await r?.getRuntime()){let o=await i({document:t,macro:e.args[0],context:r,position:n}),a=await i({document:t,macro:e.args[1],context:r,position:n});return!!a&&!!o&&a===o}}async function E0(t){let e=await R0(t,M);if(e!==void 0)return{contents:{kind:P0.MarkupKind.Markdown,value:e?"1":"0"}}}var C0=q(j());async function w0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await ya(o,s[1].macro,a)}async function D0(t){let e=await w0(t,M);return e?{contents:{kind:C0.MarkupKind.Markdown,value:e.toString()}}:void 0}var I0=q(j());async function A0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return fs(o,s[1].macro,a,s[3].macro,r)}async function O0(t){let e=await A0(t,M);return e?{contents:{kind:I0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function x0(t){let e=await hi(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}async function M0(t){let e=await Ep(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var pl=q(j());async function at(t,e){if(e){if(typeof e=="boolean")return{contents:{kind:pl.MarkupKind.Markdown,value:e?"1":"0"}};if(typeof e=="string")return{contents:{kind:pl.MarkupKind.Markdown,value:e}};if(e instanceof X)return{contents:e.toMarkupContent(t.macros)};if(e.length===1&&e[0]instanceof X)return{contents:e[0].toMarkupContent(t.macros)};if(e.every(r=>typeof r=="number"))return{contents:{kind:pl.MarkupKind.Markdown,value:e.length===1?e[0].toString():`{${e.join(", ")}}`}};if(e.every(r=>typeof r=="string"))return{contents:{kind:pl.MarkupKind.Markdown,value:e.length===1?`"${e[0]}"`:`{${e.map(r=>`"${r}"`).join(", ")}}`}}}}async function L0(t){let e=await op(t,M);return at(t.context,e)}var jT=q(j());async function q0(t){let e=await ap(t,M);if(e===!0)return{contents:{kind:jT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:jT.MarkupKind.Markdown,value:e.toString()}}}async function $0(t){let e=await ga(t,M);return at(t.context,e)}async function F0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE_IDX"||e.args?.length!==4)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,e.args[2].macro);return await yr(s,e.args[3].macro,r)}async function B0(t){return at(t.context,await F0(t,M))}async function j0(t){let e=await Sp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var V0=q(j());async function U0(t){return t?.nodes.filter(e=>!e.disabled).length??0}async function H0({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_CHILD_NUM_STATUS_OKAY"||e.args?.length!==1)return;let s=await i({document:t,macro:e.args[0],context:r,position:n});return U0(s)}async function z0(t){let e=await H0(t,M);return e!==void 0?{contents:{kind:V0.MarkupKind.Markdown,value:e.toString()}}:void 0}async function W0(t){let e=await ps(t,M);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var K0=q(j());async function G0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return fs(o,s[1].macro,0,s[2].macro,r)}async function Y0(t){let e=await G0(t,M);return e?{contents:{kind:K0.MarkupKind.Markdown,value:e.toString()}}:void 0}var X0=q(j());async function J0(t){let e=await Rp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:X0.MarkupKind.Markdown,value:e.toString()}}:void 0}var Z0=q(j());async function Q0({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PHA_BY_NAME"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n});return fs(o,s[1].macro,s[2].macro,s[3].macro,r)}async function eI(t){let e=await Q0(t,M);return e?{contents:{kind:Z0.MarkupKind.Markdown,value:e.toString()}}:void 0}var tI=q(j());async function rI(t){let e=await Pp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:tI.MarkupKind.Markdown,value:e.toString()}}:void 0}var nI=q(j());async function iI(t){let e=await wp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:nI.MarkupKind.Markdown,value:e.toString()}}:void 0}var sI=q(j());async function oI(t){let e=await kp(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:sI.MarkupKind.Markdown,value:e.toString()}}:void 0}var cI=q(j());async function aI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_IDX"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await ya(o,s[1].macro,0)}async function lI(t){let e=await aI(t,M);return e?{contents:{kind:cI.MarkupKind.Markdown,value:e.toString()}}:void 0}var uI=q(j());async function dI(t){let e=await Np(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:uI.MarkupKind.Markdown,value:e.toString()}}:void 0}async function fI({document:t,macro:e,context:r,position:n},i){if(e.macro!=="DT_PROP_BY_PHANDLE"||e.args?.length!==3)return;let s=await pi(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro);return yr(s,e.args[2].macro,r)}async function pI(t){return at(t.context,await fI(t,M))}async function hI(t){return at(t.context,await Cp(t,M))}var yI=q(j());var mI=q(require("util"));async function Jp(t,e,r,n){let i=t?.properties.find(o=>Z(o.name)===e);if(!i)return;let s=i?.ast.quickValues?.at(r);if(s!==void 0)return mI.default.isDeepStrictEqual(Ce(n),s)}async function gI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n});return await Jp(o,s[1].macro,0,s[2].macro)}async function TI(t){let e=await gI(t,M);return e!==void 0?{contents:{kind:yI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var bI=q(j());async function vI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_ENUM_HAS_VALUE_BY_IDX"||s?.length!==4)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return await Jp(o,s[1].macro,a,s[3].macro)}async function SI(t){let e=await vI(t,M);return e!==void 0?{contents:{kind:bI.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}var NI=q(j());async function _I(t,e,r,n){let i=await yr(t,e,n);if(i===void 0)return!1;if(r=typeof r=="number"?r:Ce(r??"0"),typeof r=="number")return Array.isArray(i)?i.length<r:r===0}async function kI({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_IDX"||s?.length!==3?void 0:!!await _I(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function RI(t){let e=await kI(t,M);return e===void 0?void 0:{contents:{kind:NI.MarkupKind.Markdown,value:e?"1":"0"}}}var wI=q(j());async function PI(t,e,r,n){let i=t?.properties.find(u=>Z(u.name)===e),s=i?.parent.nodeType;if(!s||!(s instanceof Et)||await yr(t,e,n)===void 0)return;let a=i.nexusMapsTo.at(0)?.specifierSpace,l=(a?i.parent.getProperty(`${a}-names`)?.ast.quickValues:void 0)?.findIndex(u=>typeof u=="string"&&u.toLowerCase()===r)??-1;return l===-1?void 0:l}async function EI({document:t,macro:e,context:r,position:n},i){let s=e.args;return e.macro!=="DT_PROP_HAS_NAME"||s?.length!==3?void 0:!!await PI(await i({document:t,macro:s[0],context:r,position:n}),s[1].macro,s[2].macro,r)}async function CI(t){let e=await EI(t,M);return e===void 0?void 0:{contents:{kind:wI.MarkupKind.Markdown,value:e?"1":"0"}}}async function DI(t){let e=await gp(t);if(e)return{contents:e.toMarkupContent(t.context.macros)}}var II=q(j());async function AI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_PROP_LEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Dp(o,s[1].macro):void 0}async function OI(t){let e=await AI(t,M);return e?{contents:{kind:II.MarkupKind.Markdown,value:e.toString()}}:void 0}var xI=q(j());async function MI(t){let e=await Ap(t,M);return e instanceof X?at(t.context,e):e?{contents:{kind:xI.MarkupKind.Markdown,value:e.toString()}}:void 0}var UT=q(j());async function LI(t,e,r){let n=await yr(t,e,r);if(n===!0)return!0;if(!n)return;let i=n.at(-1);if(i)return n.length===1&&n[0]instanceof X?n[0]:i}async function qI({document:t,macro:e,context:r,position:n},i){if(!(e.macro!=="DT_PROP_LAST"||e.args?.length!==2))return LI(await i({document:t,macro:e.args[0],context:r,position:n}),e.args[1].macro,r)}async function $I(t){let e=await qI(t,M);if(e===!0)return{contents:{kind:UT.MarkupKind.Markdown,value:"1"}};if(e)return e instanceof X?{contents:e.toMarkupContent(t.context.macros)}:{contents:{kind:UT.MarkupKind.Markdown,value:e.toString()}}}var BI=q(j());async function FI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?va(o,s[1].macro):void 0}async function jI(t){let e=await FI(t,M);if(e)return{contents:{kind:BI.MarkupKind.Markdown,value:e.toString()}}}var HI=q(j());async function Qp(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return Z(i[r].value)}async function UI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?Qp(o,s[1].macro,a):void 0}async function VI(t){let e=await UI(t,M);if(e)return{contents:{kind:HI.MarkupKind.Markdown,value:e.toString()}}}var zI=q(j());async function WI(t){let e=await Ip(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:zI.MarkupKind.Markdown,value:e.toString()}}}var YI=q(j());async function GI(t,e,r){if(!t)return;let i=t?.properties.find(s=>Z(s.name)===e)?.ast.getFlatAstValues();if(!(!i||i.length<=1)&&i[r]instanceof ne)return i[r].value}async function KI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?GI(o,s[1].macro,a):void 0}async function XI(t){let e=await KI(t,M);if(e)return{contents:{kind:YI.MarkupKind.Markdown,value:e.toString()}}}var QI=q(j());async function JI({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UNQUOTED"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Op(o,s[1].macro):void 0}async function ZI(t){let e=await JI(t,M);if(e)return{contents:{kind:QI.MarkupKind.Markdown,value:e.toString()}}}var eO=q(j());async function tO(t){let e=await xp(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:eO.MarkupKind.Markdown,value:e.toString()}}}var iO=q(j());async function rO(t,e,r){return(await Qp(t,e,r))?.toUpperCase()}async function nO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN_BY_IDX"||s?.length!==3)return;let o=await i({document:t,macro:s[0],context:r,position:n}),a=Ce(s[2].macro);if(typeof a=="number")return o?rO(o,s[1].macro,a):void 0}async function sO(t){let e=await nO(t,M);if(e)return{contents:{kind:iO.MarkupKind.Markdown,value:e.toString()}}}var aO=q(j());async function oO({document:t,macro:e,context:r,position:n},i){let s=e.args;if(e.macro!=="DT_STRING_UPPER_TOKEN"||s?.length!==2)return;let o=await i({document:t,macro:s[0],context:r,position:n});return o?Mp(o,s[1].macro):void 0}async function cO(t){let e=await oO(t,M);if(e)return{contents:{kind:aO.MarkupKind.Markdown,value:e.toString()}}}var lO=q(j());async function uO(t){let e=await Lp(t,M);if(e)return e instanceof X?at(t.context,e):{contents:{kind:lO.MarkupKind.Markdown,value:e.toString()}}}async function dO(t){let e=await lp(t,M);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var hO=q(j());async function fO(t,e){if(!t)return;let r=t.nodeType?.onBus;return r?Z(r)===e:!1}async function pO(t,e){let r=t.macro.args;if(t.macro.macro!=="DT_ON_BUS"||r?.length!==2)return;let n=await e({...t,macro:r[0]});return await fO(n,r[1].macro)}async function mO(t){let e=await pO(t,M);return e!==void 0?{contents:{kind:hO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function gO(t){let e=await dp(t);return e?{contents:e.toMarkupContent(t.context.macros)}:void 0}var vO=q(j());async function yO(t,e){return!!await up(t,e)}async function TO(t){let e=t.macro.args;if(!(t.macro.macro!=="DT_HAS_CHOSEN"||e?.length!==1))return await yO(t.context,e[0].macro)}async function bO(t){let e=await TO(t);return e!==void 0?{contents:{kind:vO.MarkupKind.Markdown,value:e?"1":"0"}}:void 0}async function BH(t){return[dO,mO,gO,bO,e0,t0,s0,z0,o0,a0,u0,DI,j0,N0,y0,p0,T0,_0,k0,E0].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function jH(t){return[SI,TI,D0,oI,lI,dI,O0,J0,eI,rI,Y0,x0,M0,W0,iI,q0,pI,B0,hI,RI,CI,L0,$I,OI,MI,$0,VI,jI,WI,XI,ZI,tO,sO,cO,uO].reduce((e,r)=>e.then(n=>n||r(t)),Promise.resolve(void 0))}async function SO(t,e,r){if(!r)return;let n=Mi(r,t.position);return _O(n,t.position,e,r)}async function _O(t,e,r,n){if(!t?.macro)return;let i=await BH({position:e,context:r,document:n,macro:t})||await jH({position:e,context:r,document:n,macro:t});if(i)return i;let s=await M({document:n,macro:t,context:r,position:e});if(s)return{contents:s.toMarkupContent(r.macros)};let o=await ds(n,t.macro,e,r);if(o)return _O(o[0],o[1],r,n)}var H_=require("path"),V_=require("fs");var HT=(t,e,r)=>{let n=t instanceof RegExp?kO(t,r):t,i=e instanceof RegExp?kO(e,r):e,s=n!==null&&i!=null&&UH(n,i,r);return s&&{start:s[0],end:s[1],pre:r.slice(0,s[0]),body:r.slice(s[0]+n.length,s[1]),post:r.slice(s[1]+i.length)}},kO=(t,e)=>{let r=e.match(t);return r?r[0]:null},UH=(t,e,r)=>{let n,i,s,o,a,c=r.indexOf(t),l=r.indexOf(e,c+1),u=c;if(c>=0&&l>0){if(t===e)return[c,l];for(n=[],s=r.length;u>=0&&!a;){if(u===c)n.push(u),c=r.indexOf(t,u+1);else if(n.length===1){let d=n.pop();d!==void 0&&(a=[d,l])}else i=n.pop(),i!==void 0&&i<s&&(s=i,o=l),l=r.indexOf(e,u+1);u=c<l&&c>=0?c:l}n.length&&o!==void 0&&(a=[s,o])}return a};var NO="\0SLASH"+Math.random()+"\0",RO="\0OPEN"+Math.random()+"\0",zT="\0CLOSE"+Math.random()+"\0",PO="\0COMMA"+Math.random()+"\0",EO="\0PERIOD"+Math.random()+"\0",HH=new RegExp(NO,"g"),VH=new RegExp(RO,"g"),zH=new RegExp(zT,"g"),WH=new RegExp(PO,"g"),GH=new RegExp(EO,"g"),KH=/\\\\/g,YH=/\\{/g,XH=/\\}/g,JH=/\\,/g,QH=/\\./g;function VT(t){return isNaN(t)?t.charCodeAt(0):parseInt(t,10)}function ZH(t){return t.replace(KH,NO).replace(YH,RO).replace(XH,zT).replace(JH,PO).replace(QH,EO)}function eV(t){return t.replace(HH,"\\").replace(VH,"{").replace(zH,"}").replace(WH,",").replace(GH,".")}function wO(t){if(!t)return[""];let e=[],r=HT("{","}",t);if(!r)return t.split(",");let{pre:n,body:i,post:s}=r,o=n.split(",");o[o.length-1]+="{"+i+"}";let a=wO(s);return s.length&&(o[o.length-1]+=a.shift(),o.push.apply(o,a)),e.push.apply(e,o),e}function CO(t){return t?(t.slice(0,2)==="{}"&&(t="\\{\\}"+t.slice(2)),hl(ZH(t),!0).map(eV)):[]}function tV(t){return"{"+t+"}"}function rV(t){return/^-?0\d/.test(t)}function nV(t,e){return t<=e}function iV(t,e){return t>=e}function hl(t,e){let r=[],n=HT("{","}",t);if(!n)return[t];let i=n.pre,s=n.post.length?hl(n.post,!1):[""];if(/\$$/.test(n.pre))for(let o=0;o<s.length;o++){let a=i+"{"+n.body+"}"+s[o];r.push(a)}else{let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),a=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),c=o||a,l=n.body.indexOf(",")>=0;if(!c&&!l)return n.post.match(/,(?!,).*\}/)?(t=n.pre+"{"+n.body+zT+n.post,hl(t)):[t];let u;if(c)u=n.body.split(/\.\./);else if(u=wO(n.body),u.length===1&&u[0]!==void 0&&(u=hl(u[0],!1).map(tV),u.length===1))return s.map(f=>n.pre+u[0]+f);let d;if(c&&u[0]!==void 0&&u[1]!==void 0){let f=VT(u[0]),p=VT(u[1]),m=Math.max(u[0].length,u[1].length),h=u.length===3&&u[2]!==void 0?Math.abs(VT(u[2])):1,T=nV;p<f&&(h*=-1,T=iV);let b=u.some(rV);d=[];for(let v=f;T(v,p);v+=h){let k;if(a)k=String.fromCharCode(v),k==="\\"&&(k="");else if(k=String(v),b){let w=m-k.length;if(w>0){let H=new Array(w+1).join("0");v<0?k="-"+H+k.slice(1):k=H+k}}d.push(k)}}else{d=[];for(let f=0;f<u.length;f++)d.push.apply(d,hl(u[f],!1))}for(let f=0;f<d.length;f++)for(let p=0;p<s.length;p++){let m=i+d[f]+s[p];(!e||c||m)&&r.push(m)}}return r}var ml=t=>{if(typeof t!="string")throw new TypeError("invalid pattern");if(t.length>65536)throw new TypeError("pattern is too long")};var sV={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},gl=t=>t.replace(/[[\]\\-]/g,"\\$&"),oV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),DO=t=>t.join(""),AO=(t,e)=>{let r=e;if(t.charAt(r)!=="[")throw new Error("not in a brace expression");let n=[],i=[],s=r+1,o=!1,a=!1,c=!1,l=!1,u=r,d="";e:for(;s<t.length;){let h=t.charAt(s);if((h==="!"||h==="^")&&s===r+1){l=!0,s++;continue}if(h==="]"&&o&&!c){u=s+1;break}if(o=!0,h==="\\"&&!c){c=!0,s++;continue}if(h==="["&&!c){for(let[T,[_,b,v]]of Object.entries(sV))if(t.startsWith(T,s)){if(d)return["$.",!1,t.length-r,!0];s+=T.length,v?i.push(_):n.push(_),a=a||b;continue e}}if(c=!1,d){h>d?n.push(gl(d)+"-"+gl(h)):h===d&&n.push(gl(h)),d="",s++;continue}if(t.startsWith("-]",s+1)){n.push(gl(h+"-")),s+=2;continue}if(t.startsWith("-",s+1)){d=h,s+=2;continue}n.push(gl(h)),s++}if(u<s)return["",!1,0,!1];if(!n.length&&!i.length)return["$.",!1,t.length-r,!0];if(i.length===0&&n.length===1&&/^\\?.$/.test(n[0])&&!l){let h=n[0].length===2?n[0].slice(-1):n[0];return[oV(h),!1,u-r,!1]}let f="["+(l?"^":"")+DO(n)+"]",p="["+(l?"":"^")+DO(i)+"]";return[n.length&&i.length?"("+f+"|"+p+")":n.length?f:p,a,u-r,!0]};var Kn=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!0}={})=>r?e?t.replace(/\[([^\/\\])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"):e?t.replace(/\[([^\/\\{}])\]/g,"$1"):t.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1");var aV=new Set(["!","?","+","*","@"]),IO=t=>aV.has(t),cV="(?!(?:^|/)\\.\\.?(?:$|/))",Zp="(?!\\.)",lV=new Set(["[","."]),uV=new Set(["..","."]),dV=new Set("().*{}+?[]^$\\!"),fV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),WT="[^/]",OO=WT+"*?",xO=WT+"+?",Da=class t{type;#e;#t;#n=!1;#r=[];#o;#f;#a;#d=!1;#c;#l;#s=!1;constructor(e,r,n={}){this.type=e,e&&(this.#t=!0),this.#o=r,this.#e=this.#o?this.#o.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#a=this.#e===this?[]:this.#e.#a,e==="!"&&!this.#e.#d&&this.#a.push(this),this.#f=this.#o?this.#o.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!="string"&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l!==void 0?this.#l:this.type?this.#l=this.type+"("+this.#r.map(e=>String(e)).join("|")+")":this.#l=this.#r.map(e=>String(e)).join("")}#y(){if(this!==this.#e)throw new Error("should only call on root");if(this.#d)return this;this.toString(),this.#d=!0;let e;for(;e=this.#a.pop();){if(e.type!=="!")continue;let r=e,n=r.#o;for(;n;){for(let i=r.#f+1;!n.type&&i<n.#r.length;i++)for(let s of e.#r){if(typeof s=="string")throw new Error("string part in extglob AST??");s.copyIn(n.#r[i])}r=n,n=r.#o}}return this}push(...e){for(let r of e)if(r!==""){if(typeof r!="string"&&!(r instanceof t&&r.#o===this))throw new Error("invalid part: "+r);this.#r.push(r)}}toJSON(){let e=this.type===null?this.#r.slice().map(r=>typeof r=="string"?r:r.toJSON()):[this.type,...this.#r.map(r=>r.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#d&&this.#o?.type==="!")&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#o?.isStart())return!1;if(this.#f===0)return!0;let e=this.#o;for(let r=0;r<this.#f;r++){let n=e.#r[r];if(!(n instanceof t&&n.type==="!"))return!1}return!0}isEnd(){if(this.#e===this||this.#o?.type==="!")return!0;if(!this.#o?.isEnd())return!1;if(!this.type)return this.#o?.isEnd();let e=this.#o?this.#o.#r.length:0;return this.#f===e-1}copyIn(e){typeof e=="string"?this.push(e):this.push(e.clone(this))}clone(e){let r=new t(this.type,e);for(let n of this.#r)r.copyIn(n);return r}static#T(e,r,n,i){let s=!1,o=!1,a=-1,c=!1;if(r.type===null){let p=n,m="";for(;p<e.length;){let h=e.charAt(p++);if(s||h==="\\"){s=!s,m+=h;continue}if(o){p===a+1?(h==="^"||h==="!")&&(c=!0):h==="]"&&!(p===a+2&&c)&&(o=!1),m+=h;continue}else if(h==="["){o=!0,a=p,c=!1,m+=h;continue}if(!i.noext&&IO(h)&&e.charAt(p)==="("){r.push(m),m="";let T=new t(h,r);p=t.#T(e,T,p,i),r.push(T);continue}m+=h}return r.push(m),p}let l=n+1,u=new t(null,r),d=[],f="";for(;l<e.length;){let p=e.charAt(l++);if(s||p==="\\"){s=!s,f+=p;continue}if(o){l===a+1?(p==="^"||p==="!")&&(c=!0):p==="]"&&!(l===a+2&&c)&&(o=!1),f+=p;continue}else if(p==="["){o=!0,a=l,c=!1,f+=p;continue}if(IO(p)&&e.charAt(l)==="("){u.push(f),f="";let m=new t(p,u);u.push(m),l=t.#T(e,m,l,i);continue}if(p==="|"){u.push(f),f="",d.push(u),u=new t(null,r);continue}if(p===")")return f===""&&r.#r.length===0&&(r.#s=!0),u.push(f),f="",r.push(...d,u),l;f+=p}return r.type=null,r.#t=void 0,r.#r=[e.substring(n-1)],l}static fromGlob(e,r={}){let n=new t(null,void 0,r);return t.#T(e,n,0,r),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[r,n,i,s]=this.toRegExpSource();if(!(i||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?"i":"")+(s?"u":"");return Object.assign(new RegExp(`^${r}$`,a),{_src:r,_glob:e})}get options(){return this.#c}toRegExpSource(e){let r=e??!!this.#c.dot;if(this.#e===this&&this.#y(),!this.type){let c=this.isStart()&&this.isEnd()&&!this.#r.some(p=>typeof p!="string"),l=this.#r.map(p=>{let[m,h,T,_]=typeof p=="string"?t.#p(p,this.#t,c):p.toRegExpSource(e);return this.#t=this.#t||T,this.#n=this.#n||_,m}).join(""),u="";if(this.isStart()&&typeof this.#r[0]=="string"&&!(this.#r.length===1&&uV.has(this.#r[0]))){let m=lV,h=r&&m.has(l.charAt(0))||l.startsWith("\\.")&&m.has(l.charAt(2))||l.startsWith("\\.\\.")&&m.has(l.charAt(4)),T=!r&&!e&&m.has(l.charAt(0));u=h?cV:T?Zp:""}let d="";return this.isEnd()&&this.#e.#d&&this.#o?.type==="!"&&(d="(?:$|\\/)"),[u+l+d,Kn(l),this.#t=!!this.#t,this.#n]}let n=this.type==="*"||this.type==="+",i=this.type==="!"?"(?:(?!(?:":"(?:",s=this.#h(r);if(this.isStart()&&this.isEnd()&&!s&&this.type!=="!"){let c=this.toString();return this.#r=[c],this.type=null,this.#t=void 0,[c,Kn(this.toString()),!1,!1]}let o=!n||e||r||!Zp?"":this.#h(!0);o===s&&(o=""),o&&(s=`(?:${s})(?:${o})*?`);let a="";if(this.type==="!"&&this.#s)a=(this.isStart()&&!r?Zp:"")+xO;else{let c=this.type==="!"?"))"+(this.isStart()&&!r&&!e?Zp:"")+OO+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&o?")":this.type==="*"&&o?")?":`)${this.type}`;a=i+s+c}return[a,Kn(s),this.#t=!!this.#t,this.#n]}#h(e){return this.#r.map(r=>{if(typeof r=="string")throw new Error("string type in extglob ast??");let[n,i,s,o]=r.toRegExpSource(e);return this.#n=this.#n||o,n}).filter(r=>!(this.isStart()&&this.isEnd())||!!r).join("|")}static#p(e,r,n=!1){let i=!1,s="",o=!1;for(let a=0;a<e.length;a++){let c=e.charAt(a);if(i){i=!1,s+=(dV.has(c)?"\\":"")+c;continue}if(c==="\\"){a===e.length-1?s+="\\\\":i=!0;continue}if(c==="["){let[l,u,d,f]=AO(e,a);if(d){s+=l,o=o||u,a+=d-1,r=r||f;continue}}if(c==="*"){s+=n&&e==="*"?xO:OO,r=!0;continue}if(c==="?"){s+=WT,r=!0;continue}s+=fV(c)}return[s,Kn(e),!!r,o]}};var Aa=(t,{windowsPathsNoEscape:e=!1,magicalBraces:r=!1}={})=>r?e?t.replace(/[?*()[\]{}]/g,"[$&]"):t.replace(/[?*()[\]\\{}]/g,"\\$&"):e?t.replace(/[?*()[\]]/g,"[$&]"):t.replace(/[?*()[\]\\]/g,"\\$&");var wr=(t,e,r={})=>(ml(e),!r.nocomment&&e.charAt(0)==="#"?!1:new an(e,r).match(t)),pV=/^\*+([^+@!?\*\[\(]*)$/,hV=t=>e=>!e.startsWith(".")&&e.endsWith(t),mV=t=>e=>e.endsWith(t),gV=t=>(t=t.toLowerCase(),e=>!e.startsWith(".")&&e.toLowerCase().endsWith(t)),yV=t=>(t=t.toLowerCase(),e=>e.toLowerCase().endsWith(t)),TV=/^\*+\.\*+$/,vV=t=>!t.startsWith(".")&&t.includes("."),bV=t=>t!=="."&&t!==".."&&t.includes("."),SV=/^\.\*+$/,_V=t=>t!=="."&&t!==".."&&t.startsWith("."),kV=/^\*+$/,NV=t=>t.length!==0&&!t.startsWith("."),RV=t=>t.length!==0&&t!=="."&&t!=="..",PV=/^\?+([^+@!?\*\[\(]*)?$/,EV=([t,e=""])=>{let r=qO([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},wV=([t,e=""])=>{let r=$O([t]);return e?(e=e.toLowerCase(),n=>r(n)&&n.toLowerCase().endsWith(e)):r},CV=([t,e=""])=>{let r=$O([t]);return e?n=>r(n)&&n.endsWith(e):r},DV=([t,e=""])=>{let r=qO([t]);return e?n=>r(n)&&n.endsWith(e):r},qO=([t])=>{let e=t.length;return r=>r.length===e&&!r.startsWith(".")},$O=([t])=>{let e=t.length;return r=>r.length===e&&r!=="."&&r!==".."},FO=typeof process=="object"&&process?typeof process.env=="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",MO={win32:{sep:"\\"},posix:{sep:"/"}},AV=FO==="win32"?MO.win32.sep:MO.posix.sep;wr.sep=AV;var sr=Symbol("globstar **");wr.GLOBSTAR=sr;var IV="[^/]",OV=IV+"*?",xV="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",MV="(?:(?!(?:\\/|^)\\.).)*?",LV=(t,e={})=>r=>wr(r,t,e);wr.filter=LV;var Nn=(t,e={})=>Object.assign({},t,e),qV=t=>{if(!t||typeof t!="object"||!Object.keys(t).length)return wr;let e=wr;return Object.assign((n,i,s={})=>e(n,i,Nn(t,s)),{Minimatch:class extends e.Minimatch{constructor(i,s={}){super(i,Nn(t,s))}static defaults(i){return e.defaults(Nn(t,i)).Minimatch}},AST:class extends e.AST{constructor(i,s,o={}){super(i,s,Nn(t,o))}static fromGlob(i,s={}){return e.AST.fromGlob(i,Nn(t,s))}},unescape:(n,i={})=>e.unescape(n,Nn(t,i)),escape:(n,i={})=>e.escape(n,Nn(t,i)),filter:(n,i={})=>e.filter(n,Nn(t,i)),defaults:n=>e.defaults(Nn(t,n)),makeRe:(n,i={})=>e.makeRe(n,Nn(t,i)),braceExpand:(n,i={})=>e.braceExpand(n,Nn(t,i)),match:(n,i,s={})=>e.match(n,i,Nn(t,s)),sep:e.sep,GLOBSTAR:sr})};wr.defaults=qV;var BO=(t,e={})=>(ml(t),e.nobrace||!/\{(?:(?!\{).)*\}/.test(t)?[t]:CO(t));wr.braceExpand=BO;var $V=(t,e={})=>new an(t,e).makeRe();wr.makeRe=$V;var FV=(t,e,r={})=>{let n=new an(e,r);return t=t.filter(i=>n.match(i)),n.options.nonull&&!t.length&&t.push(e),t};wr.match=FV;var LO=/[?*]|[+@!]\(.*?\)|\[|\]/,BV=t=>t.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),an=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,r={}){ml(e),r=r||{},this.options=r,this.pattern=e,this.platform=r.platform||FO,this.isWindows=this.platform==="win32",this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!r.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!r.nonegate,this.comment=!1,this.empty=!1,this.partial=!!r.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=r.windowsNoMagicRoot!==void 0?r.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let r of e)if(typeof r!="string")return!0;return!1}debug(...e){}make(){let e=this.pattern,r=this.options;if(!r.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],r.debug&&(this.debug=(...s)=>console.error(...s)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(s=>this.slashSplit(s));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let i=this.globParts.map((s,o,a)=>{if(this.isWindows&&this.windowsNoMagicRoot){let c=s[0]===""&&s[1]===""&&(s[2]==="?"||!LO.test(s[2]))&&!LO.test(s[3]),l=/^[a-z]:/i.test(s[0]);if(c)return[...s.slice(0,4),...s.slice(4).map(u=>this.parse(u))];if(l)return[s[0],...s.slice(1).map(u=>this.parse(u))]}return s.map(c=>this.parse(c))});if(this.debug(this.pattern,i),this.set=i.filter(s=>s.indexOf(!1)===-1),this.isWindows)for(let s=0;s<this.set.length;s++){let o=this.set[s];o[0]===""&&o[1]===""&&this.globParts[s][2]==="?"&&typeof o[3]=="string"&&/^[a-z]:$/i.test(o[3])&&(o[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let n=0;n<e.length;n++)for(let i=0;i<e[n].length;i++)e[n][i]==="**"&&(e[n][i]="*");let{optimizationLevel:r=1}=this.options;return r>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):r>=1?e=this.levelOneOptimize(e):e=this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(r=>{let n=-1;for(;(n=r.indexOf("**",n+1))!==-1;){let i=n;for(;r[i+1]==="**";)i++;i!==n&&r.splice(n,i-n)}return r})}levelOneOptimize(e){return e.map(r=>(r=r.reduce((n,i)=>{let s=n[n.length-1];return i==="**"&&s==="**"?n:i===".."&&s&&s!==".."&&s!=="."&&s!=="**"?(n.pop(),n):(n.push(i),n)},[]),r.length===0?[""]:r))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let r=!1;do{if(r=!1,!this.preserveMultipleSlashes){for(let i=1;i<e.length-1;i++){let s=e[i];i===1&&s===""&&e[0]===""||(s==="."||s==="")&&(r=!0,e.splice(i,1),i--)}e[0]==="."&&e.length===2&&(e[1]==="."||e[1]==="")&&(r=!0,e.pop())}let n=0;for(;(n=e.indexOf("..",n+1))!==-1;){let i=e[n-1];i&&i!=="."&&i!==".."&&i!=="**"&&(r=!0,e.splice(n-1,2),n-=2)}}while(r);return e.length===0?[""]:e}firstPhasePreProcess(e){let r=!1;do{r=!1;for(let n of e){let i=-1;for(;(i=n.indexOf("**",i+1))!==-1;){let o=i;for(;n[o+1]==="**";)o++;o>i&&n.splice(i+1,o-i);let a=n[i+1],c=n[i+2],l=n[i+3];if(a!==".."||!c||c==="."||c===".."||!l||l==="."||l==="..")continue;r=!0,n.splice(i,1);let u=n.slice(0);u[i]="**",e.push(u),i--}if(!this.preserveMultipleSlashes){for(let o=1;o<n.length-1;o++){let a=n[o];o===1&&a===""&&n[0]===""||(a==="."||a==="")&&(r=!0,n.splice(o,1),o--)}n[0]==="."&&n.length===2&&(n[1]==="."||n[1]==="")&&(r=!0,n.pop())}let s=0;for(;(s=n.indexOf("..",s+1))!==-1;){let o=n[s-1];if(o&&o!=="."&&o!==".."&&o!=="**"){r=!0;let c=s===1&&n[s+1]==="**"?["."]:[];n.splice(s-1,2,...c),n.length===0&&n.push(""),s-=2}}}}while(r);return e}secondPhasePreProcess(e){for(let r=0;r<e.length-1;r++)for(let n=r+1;n<e.length;n++){let i=this.partsMatch(e[r],e[n],!this.preserveMultipleSlashes);if(i){e[r]=[],e[n]=i;break}}return e.filter(r=>r.length)}partsMatch(e,r,n=!1){let i=0,s=0,o=[],a="";for(;i<e.length&&s<r.length;)if(e[i]===r[s])o.push(a==="b"?r[s]:e[i]),i++,s++;else if(n&&e[i]==="**"&&r[s]===e[i+1])o.push(e[i]),i++;else if(n&&r[s]==="**"&&e[i]===r[s+1])o.push(r[s]),s++;else if(e[i]==="*"&&r[s]&&(this.options.dot||!r[s].startsWith("."))&&r[s]!=="**"){if(a==="b")return!1;a="a",o.push(e[i]),i++,s++}else if(r[s]==="*"&&e[i]&&(this.options.dot||!e[i].startsWith("."))&&e[i]!=="**"){if(a==="a")return!1;a="b",o.push(r[s]),i++,s++}else return!1;return e.length===r.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,r=!1,n=0;for(let i=0;i<e.length&&e.charAt(i)==="!";i++)r=!r,n++;n&&(this.pattern=e.slice(n)),this.negate=r}matchOne(e,r,n=!1){let i=this.options;if(this.isWindows){let h=typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0]),T=!h&&e[0]===""&&e[1]===""&&e[2]==="?"&&/^[a-z]:$/i.test(e[3]),_=typeof r[0]=="string"&&/^[a-z]:$/i.test(r[0]),b=!_&&r[0]===""&&r[1]===""&&r[2]==="?"&&typeof r[3]=="string"&&/^[a-z]:$/i.test(r[3]),v=T?3:h?0:void 0,k=b?3:_?0:void 0;if(typeof v=="number"&&typeof k=="number"){let[w,H]=[e[v],r[k]];w.toLowerCase()===H.toLowerCase()&&(r[k]=w,k>v?r=r.slice(k):v>k&&(e=e.slice(v)))}}let{optimizationLevel:s=1}=this.options;s>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:r}),this.debug("matchOne",e.length,r.length);for(var o=0,a=0,c=e.length,l=r.length;o<c&&a<l;o++,a++){this.debug("matchOne loop");var u=r[a],d=e[o];if(this.debug(r,u,d),u===!1)return!1;if(u===sr){this.debug("GLOBSTAR",[r,u,d]);var f=o,p=a+1;if(p===l){for(this.debug("** at the end");o<c;o++)if(e[o]==="."||e[o]===".."||!i.dot&&e[o].charAt(0)===".")return!1;return!0}for(;f<c;){var m=e[f];if(this.debug(`
|
|
301
301
|
globstar while`,e,f,r,p,m),this.matchOne(e.slice(f),r.slice(p),n))return this.debug("globstar found match!",f,c,m),!0;if(m==="."||m===".."||!i.dot&&m.charAt(0)==="."){this.debug("dot detected!",e,f,r,p);break}this.debug("globstar swallow a segment, and continue"),f++}return!!(n&&(this.debug(`
|
|
302
|
-
>>> no match, partial?`,e,f,r,p),f===c))}let h;if(typeof u=="string"?(h=d===u,this.debug("string match",u,d,h)):(h=u.test(d),this.debug("pattern match",u,d,h)),!h)return!1}if(o===c&&a===l)return!0;if(o===c)return n;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return BO(this.pattern,this.options)}parse(e){ml(e);let r=this.options;if(e==="**")return sr;if(e==="")return"";let n,i=null;(n=e.match(kV))?i=r.dot?RV:NV:(n=e.match(pV))?i=(r.nocase?r.dot?yV:gV:r.dot?mV:hV)(n[1]):(n=e.match(PV))?i=(r.nocase?r.dot?wV:EV:r.dot?CV:DV)(n):(n=e.match(TV))?i=r.dot?bV:vV:(n=e.match(SV))&&(i=_V);let s=Da.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?OV:r.dot?xV:MV,i=new Set(r.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))i.add(f);return typeof d=="string"?BV(d):d===sr?sr:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==sr||m===sr||(m===void 0?p!==void 0&&p!==sr?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==sr&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=sr))});let u=l.filter(d=>d!==sr);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let c=s[a],l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return wr.defaults(e).Minimatch}};wr.AST=Da;wr.Minimatch=an;wr.escape=Aa;wr.unescape=Gn;var ux=require("node:url");var Ia=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,UO=new Set,GT=typeof process=="object"&&process?process:{},HO=(t,e,r,n)=>{typeof GT.emitWarning=="function"?GT.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},eh=globalThis.AbortController,jO=globalThis.AbortSignal;if(typeof eh>"u"){jO=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},eh=class{constructor(){e()}signal=new jO;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=GT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,HO("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var jV=t=>!UO.has(t),zNe=Symbol("type"),ms=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),VO=t=>ms(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Oa:null:null,Oa=class extends Array{constructor(e){super(e),this.fill(0)}},KT=class t{heap;length;static#e=!1;static create(e){let r=VO(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},yl=class t{#e;#t;#n;#r;#o;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#c;#l;#s;#y;#T;#h;#p;#k;#g;#N;#R;#b;#S;#_;#m;static unsafeExposeInternals(e){return{starts:e.#R,ttls:e.#b,sizes:e.#N,keyMap:e.#c,keyList:e.#l,valList:e.#s,next:e.#y,prev:e.#T,get head(){return e.#h},get tail(){return e.#p},free:e.#k,isBackgroundFetch:r=>e.#u(r),backgroundFetch:(r,n,i,s)=>e.#$(r,n,i,s),moveToTail:r=>e.#B(r),indexes:r=>e.#E(r),rindexes:r=>e.#w(r),isStale:r=>e.#v(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#f}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:T,memoMethod:_,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:w,ignoreFetchAbort:H}=e;if(r!==0&&!ms(r))throw new TypeError("max option must be a nonnegative integer");let O=r?VO(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=p,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=_,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=T,this.#_=!!T,this.#c=new Map,this.#l=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new O(r),this.#T=new O(r),this.#h=0,this.#p=0,this.#k=KT.create(r),this.#a=0,this.#d=0,typeof l=="function"&&(this.#n=l),typeof u=="function"?(this.#r=u,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#S=!!this.#n,this.#m=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#t!==0&&!ms(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!ms(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#D()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ms(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ms(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let B="LRU_CACHE_UNBOUNDED";jV(B)&&(UO.add(B),HO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,t))}}getRemainingTTL(e){return this.#c.has(e)?1/0:0}#C(){let e=new Oa(this.#e),r=new Oa(this.#e);this.#b=e,this.#R=r,this.#I=(s,o,a=Ia.now())=>{if(r[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#v(s)&&this.#A(this.#l[s],"expire")},o+1);c.unref&&c.unref()}},this.#P=s=>{r[s]=e[s]!==0?Ia.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=r[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=n||i();let l=s.now-c;s.remainingTTL=a-l}};let n=0,i=()=>{let s=Ia.now();if(this.ttlResolution>0){n=s;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#c.get(s);if(o===void 0)return 0;let a=e[o],c=r[o];if(!a||!c)return 1/0;let l=(n||i())-c;return a-l},this.#v=s=>{let o=r[s],a=e[s];return!!a&&!!o&&(n||i())-o>a}}#P=()=>{};#i=()=>{};#I=()=>{};#v=()=>!1;#D(){let e=new Oa(this.#e);this.#d=0,this.#N=e,this.#O=r=>{this.#d-=e[r],e[r]=0},this.#M=(r,n,i,s)=>{if(this.#u(n))return 0;if(!ms(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!ms(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#x=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#d>s;)this.#q(!0)}this.#d+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#d)}}#O=e=>{};#x=(e,r,n)=>{};#M=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#p;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#h));)r=this.#T[r]}*#w({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#p));)r=this.#y[r]}#L(e){return e!==void 0&&this.#c.get(this.#l[e])===e}*entries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#w())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#E()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*rkeys(){for(let e of this.#w()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*values(){for(let e of this.#E())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#w())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.get(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#w({allowStale:!0}))this.#v(r)&&(this.#A(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#c.get(e);if(r===void 0)return;let n=this.#s[r],i=this.#u(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#b&&this.#R){let o=this.#b[r],a=this.#R[r];if(o&&a){let c=o-(Ia.now()-a);s.ttl=c,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#E({allowStale:!0})){let n=this.#l[r],i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#b&&this.#R){o.ttl=this.#b[r];let a=Ia.now()-this.#R[r];o.start=Math.floor(Date.now()-a)}this.#N&&(o.size=this.#N[r]),e.unshift([n,o])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=Ia.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#M(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let d=this.#a===0?void 0:this.#c.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#k.length!==0?this.#k.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#l[d]=e,this.#s[d]=r,this.#c.set(e,d),this.#y[this.#p]=d,this.#T[d]=this.#p,this.#p=d,this.#a++,this.#x(d,u,c),c&&(c.set="add"),l=!1;else{this.#B(d);let f=this.#s[d];if(r!==f){if(this.#_&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#S&&this.#n?.(p,e,"set"),this.#m&&this.#g?.push([p,e,"set"]))}else o||(this.#S&&this.#n?.(f,e,"set"),this.#m&&this.#g?.push([f,e,"set"]));if(this.#O(d),this.#x(d,u,c),this.#s[d]=r,c){c.set="replace";let p=f&&this.#u(f)?f.__staleWhileFetching:f;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(i!==0&&!this.#b&&this.#C(),this.#b&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#m&&this.#g){let f=this.#g,p;for(;p=f?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#h];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#m&&this.#g){let e=this.#g,r;for(;r=e?.shift();)this.#r?.(...r)}}}#q(e){let r=this.#h,n=this.#l[r],i=this.#s[r];return this.#_&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(i,n,"evict"),this.#m&&this.#g?.push([i,n,"evict"])),this.#O(r),e&&(this.#l[r]=void 0,this.#s[r]=void 0,this.#k.push(r)),this.#a===1?(this.#h=this.#p=0,this.#k.length=0):this.#h=this.#y[r],this.#c.delete(n),this.#a--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#c.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(s))i&&(i.has="stale",this.#i(i,s));else return n&&this.#P(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#c.get(e);if(i===void 0||!n&&this.#v(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,r,n,i){let s=r===void 0?void 0:this.#s[r];if(this.#u(s))return s;let o=new eh,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,T=!1)=>{let{aborted:_}=o.signal,b=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(_&&!T?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),_&&!b&&!T)return d(o.signal.reason);let v=p;return this.#s[r]===p&&(h===void 0?v.__staleWhileFetching?this.#s[r]=v.__staleWhileFetching:this.#A(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h)),d=h=>{let{aborted:T}=o.signal,_=T&&n.allowStaleOnFetchAbort,b=_||n.allowStaleOnFetchRejection,v=b||n.noDeleteOnFetchRejection,k=p;if(this.#s[r]===p&&(!v||k.__staleWhileFetching===void 0?this.#A(e,"fetch"):_||(this.#s[r]=k.__staleWhileFetching)),b)return n.status&&k.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw h},f=(h,T)=>{let _=this.#o?.(e,s,c);_&&_ instanceof Promise&&_.then(b=>h(b===void 0?void 0:b),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=b=>l(b,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,m,{...c.options,status:void 0}),r=this.#c.get(e)):this.#s[r]=m,m}#u(e){if(!this.#_)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof eh}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:T=!1,status:_,signal:b}=r;if(!this.#_)return _&&(_.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:_});let v={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:_,signal:b},k=this.#c.get(e);if(k===void 0){_&&(_.fetch="miss");let w=this.#$(e,k,v,h);return w.__returned=w}else{let w=this.#s[k];if(this.#u(w)){let lt=n&&w.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",lt&&(_.returnedStale=!0)),lt?w.__staleWhileFetching:w.__returned=w}let H=this.#v(k);if(!T&&!H)return _&&(_.fetch="hit"),this.#B(k),i&&this.#P(k),_&&this.#i(_,k),w;let O=this.#$(e,k,v,h),De=O.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=H?"stale":"refresh",De&&H&&(_.returnedStale=!0)),De?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#f;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=r,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=n(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#c.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#B(a),i&&this.#P(a),c))}else o&&(o.get="miss")}#F(e,r){this.#T[r]=e,this.#y[e]=r}#B(e){e!==this.#p&&(e===this.#h?this.#h=this.#y[e]:this.#F(this.#T[e],this.#y[e]),this.#F(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let n=!1;if(this.#a!==0){let i=this.#c.get(e);if(i!==void 0)if(n=!0,this.#a===1)this.#j(r);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(s,e,r),this.#m&&this.#g?.push([s,e,r])),this.#c.delete(e),this.#l[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#T[i];else if(i===this.#h)this.#h=this.#y[i];else{let o=this.#T[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#T[a]=this.#T[i]}this.#a--,this.#k.push(i)}}if(this.#m&&this.#g?.length){let i=this.#g,s;for(;s=i?.shift();)this.#r?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#w({allowStale:!0})){let n=this.#s[r];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#m&&this.#g?.push([n,i,e])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#b&&this.#R&&(this.#b.fill(0),this.#R.fill(0)),this.#N&&this.#N.fill(0),this.#h=0,this.#p=0,this.#k.length=0,this.#d=0,this.#a=0,this.#m&&this.#g){let r=this.#g,n;for(;n=r?.shift();)this.#r?.(...n)}}};var La=require("node:path"),ex=require("node:url"),yi=require("fs"),JV=q(require("node:fs"),1),Ts=require("node:fs/promises");var ah=require("node:events"),tv=q(require("node:stream"),1),YO=require("node:string_decoder"),zO=typeof process=="object"&&process?process:{stdout:null,stderr:null},UV=t=>!!t&&typeof t=="object"&&(t instanceof ys||t instanceof tv.default||HV(t)||VV(t)),HV=t=>!!t&&typeof t=="object"&&t instanceof ah.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==tv.default.Writable.prototype.pipe,VV=t=>!!t&&typeof t=="object"&&t instanceof ah.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Fi=Symbol("EOF"),Bi=Symbol("maybeEmitEnd"),gs=Symbol("emittedEnd"),th=Symbol("emittingEnd"),Tl=Symbol("emittedError"),rh=Symbol("closed"),WO=Symbol("read"),nh=Symbol("flush"),GO=Symbol("flushChunk"),Kn=Symbol("encoding"),xa=Symbol("decoder"),Jt=Symbol("flowing"),vl=Symbol("paused"),Ma=Symbol("resume"),Qt=Symbol("buffer"),Cr=Symbol("pipes"),Zt=Symbol("bufferLength"),YT=Symbol("bufferPush"),ih=Symbol("bufferShift"),vr=Symbol("objectMode"),Mt=Symbol("destroyed"),XT=Symbol("error"),JT=Symbol("emitData"),KO=Symbol("emitEnd"),QT=Symbol("emitEnd2"),mi=Symbol("async"),ZT=Symbol("abort"),sh=Symbol("aborted"),bl=Symbol("signal"),no=Symbol("dataListeners"),cn=Symbol("discarded"),Sl=t=>Promise.resolve().then(t),zV=t=>t(),WV=t=>t==="end"||t==="finish"||t==="prefinish",GV=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,KV=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),oh=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ma](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ev=class extends oh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},YV=t=>!!t.objectMode,XV=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ys=class extends ah.EventEmitter{[Jt]=!1;[vl]=!1;[Cr]=[];[Qt]=[];[vr];[Kn];[mi];[xa];[Fi]=!1;[gs]=!1;[th]=!1;[rh]=!1;[Tl]=null;[Zt]=0;[Mt]=!1;[bl];[sh]=!1;[no]=0;[cn]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");YV(r)?(this[vr]=!0,this[Kn]=null):XV(r)?(this[Kn]=r.encoding,this[vr]=!1):(this[vr]=!1,this[Kn]=null),this[mi]=!!r.async,this[xa]=this[Kn]?new YO.StringDecoder(this[Kn]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Qt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Cr]});let{signal:n}=r;n&&(this[bl]=n,n.aborted?this[ZT]():n.addEventListener("abort",()=>this[ZT]()))}get bufferLength(){return this[Zt]}get encoding(){return this[Kn]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[vr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[mi]}set async(e){this[mi]=this[mi]||!!e}[ZT](){this[sh]=!0,this.emit("abort",this[bl]?.reason),this.destroy(this[bl]?.reason)}get aborted(){return this[sh]}set aborted(e){}write(e,r,n){if(this[sh])return!1;if(this[Fi])throw new Error("write after end");if(this[Mt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let i=this[mi]?Sl:zV;if(!this[vr]&&!Buffer.isBuffer(e)){if(KV(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(GV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[vr]?(this[Jt]&&this[Zt]!==0&&this[nh](!0),this[Jt]?this.emit("data",e):this[YT](e),this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt]):e.length?(typeof e=="string"&&!(r===this[Kn]&&!this[xa]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Kn]&&(e=this[xa].write(e)),this[Jt]&&this[Zt]!==0&&this[nh](!0),this[Jt]?this.emit("data",e):this[YT](e),this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt]):(this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt])}read(e){if(this[Mt])return null;if(this[cn]=!1,this[Zt]===0||e===0||e&&e>this[Zt])return this[Bi](),null;this[vr]&&(e=null),this[Qt].length>1&&!this[vr]&&(this[Qt]=[this[Kn]?this[Qt].join(""):Buffer.concat(this[Qt],this[Zt])]);let r=this[WO](e||null,this[Qt][0]);return this[Bi](),r}[WO](e,r){if(this[vr])this[ih]();else{let n=r;e===n.length||e===null?this[ih]():typeof n=="string"?(this[Qt][0]=n.slice(e),r=n.slice(0,e),this[Zt]-=e):(this[Qt][0]=n.subarray(e),r=n.subarray(0,e),this[Zt]-=e)}return this.emit("data",r),!this[Qt].length&&!this[Fi]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[Fi]=!0,this.writable=!1,(this[Jt]||!this[vl])&&this[Bi](),this}[Ma](){this[Mt]||(!this[no]&&!this[Cr].length&&(this[cn]=!0),this[vl]=!1,this[Jt]=!0,this.emit("resume"),this[Qt].length?this[nh]():this[Fi]?this[Bi]():this.emit("drain"))}resume(){return this[Ma]()}pause(){this[Jt]=!1,this[vl]=!0,this[cn]=!1}get destroyed(){return this[Mt]}get flowing(){return this[Jt]}get paused(){return this[vl]}[YT](e){this[vr]?this[Zt]+=1:this[Zt]+=e.length,this[Qt].push(e)}[ih](){return this[vr]?this[Zt]-=1:this[Zt]-=this[Qt][0].length,this[Qt].shift()}[nh](e=!1){do;while(this[GO](this[ih]())&&this[Qt].length);!e&&!this[Qt].length&&!this[Fi]&&this.emit("drain")}[GO](e){return this.emit("data",e),this[Jt]}pipe(e,r){if(this[Mt])return e;this[cn]=!1;let n=this[gs];return r=r||{},e===zO.stdout||e===zO.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Cr].push(r.proxyErrors?new ev(this,e,r):new oh(this,e,r)),this[mi]?Sl(()=>this[Ma]()):this[Ma]()),e}unpipe(e){let r=this[Cr].find(n=>n.dest===e);r&&(this[Cr].length===1?(this[Jt]&&this[no]===0&&(this[Jt]=!1),this[Cr]=[]):this[Cr].splice(this[Cr].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[cn]=!1,this[no]++,!this[Cr].length&&!this[Jt]&&this[Ma]();else if(e==="readable"&&this[Zt]!==0)super.emit("readable");else if(WV(e)&&this[gs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Tl]){let i=r;this[mi]?Sl(()=>i.call(this,this[Tl])):i.call(this,this[Tl])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[no]=this.listeners("data").length,this[no]===0&&!this[cn]&&!this[Cr].length&&(this[Jt]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[no]=0,!this[cn]&&!this[Cr].length&&(this[Jt]=!1)),r}get emittedEnd(){return this[gs]}[Bi](){!this[th]&&!this[gs]&&!this[Mt]&&this[Qt].length===0&&this[Fi]&&(this[th]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[rh]&&this.emit("close"),this[th]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Mt&&this[Mt])return!1;if(e==="data")return!this[vr]&&!n?!1:this[mi]?(Sl(()=>this[JT](n)),!0):this[JT](n);if(e==="end")return this[KO]();if(e==="close"){if(this[rh]=!0,!this[gs]&&!this[Mt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Tl]=n,super.emit(XT,n);let s=!this[bl]||this.listeners("error").length?super.emit("error",n):!1;return this[Bi](),s}else if(e==="resume"){let s=super.emit("resume");return this[Bi](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...r);return this[Bi](),i}[JT](e){for(let n of this[Cr])n.dest.write(e)===!1&&this.pause();let r=this[cn]?!1:super.emit("data",e);return this[Bi](),r}[KO](){return this[gs]?!1:(this[gs]=!0,this.readable=!1,this[mi]?(Sl(()=>this[QT]()),!0):this[QT]())}[QT](){if(this[xa]){let r=this[xa].end();if(r){for(let n of this[Cr])n.dest.write(r);this[cn]||super.emit("data",r)}}for(let r of this[Cr])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[vr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[vr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[vr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Kn]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(Mt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[cn]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Fi])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Mt,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Mt,u),this.pause(),s({value:d,done:!!this[Fi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Mt,u),r(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Mt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[cn]=!1;let e=!1,r=()=>(this.pause(),this.off(XT,r),this.off(Mt,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let i=this.read();return i===null?r():{done:!1,value:i}};return this.once("end",r),this.once(XT,r),this.once(Mt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[Mt])return e?this.emit("error",e):this.emit(Mt),this;this[Mt]=!0,this[cn]=!0,this[Qt].length=0,this[Zt]=0;let r=this;return typeof r.close=="function"&&!this[rh]&&r.close(),e?this.emit("error",e):this.emit(Mt),this}static get isStream(){return UV}};var QV=yi.realpathSync.native,kl={lstatSync:yi.lstatSync,readdir:yi.readdir,readdirSync:yi.readdirSync,readlinkSync:yi.readlinkSync,realpathSync:QV,promises:{lstat:Ts.lstat,readdir:Ts.readdir,readlink:Ts.readlink,realpath:Ts.realpath}},tx=t=>!t||t===kl||t===JV?kl:{...kl,...t,promises:{...kl.promises,...t.promises||{}}},rx=/^\\\\\?\\([a-z]:)\\?$/i,ZV=t=>t.replace(/\//g,"\\").replace(rx,"$1\\"),ez=/[\\\/]/,Rn=0,nx=1,ix=2,gi=4,sx=6,ox=8,io=10,ax=12,Nn=15,_l=~Nn,rv=16,XO=32,Nl=64,Yn=128,ch=256,uh=512,JO=Nl|Yn|uh,tz=1023,nv=t=>t.isFile()?ox:t.isDirectory()?gi:t.isSymbolicLink()?io:t.isCharacterDevice()?ix:t.isBlockDevice()?sx:t.isSocket()?ax:t.isFIFO()?nx:Rn,QO=new Map,Rl=t=>{let e=QO.get(t);if(e)return e;let r=t.normalize("NFKD");return QO.set(t,r),r},ZO=new Map,lh=t=>{let e=ZO.get(t);if(e)return e;let r=Rl(t.toLowerCase());return ZO.set(t,r),r},dh=class extends yl{constructor(){super({max:256})}},iv=class extends yl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},cx=Symbol("PathScurry setAsCwd"),br=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#f;get gid(){return this.#f}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#c;get ino(){return this.#c}#l;get size(){return this.#l}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#T;get mtimeMs(){return this.#T}#h;get ctimeMs(){return this.#h}#p;get birthtimeMs(){return this.#p}#k;get atime(){return this.#k}#g;get mtime(){return this.#g}#N;get ctime(){return this.#N}#R;get birthtime(){return this.#R}#b;#S;#_;#m;#C;#P;#i;#I;#v;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Rn,n,i,s,o,a){this.name=e,this.#b=s?lh(e):Rl(e),this.#i=r&tz,this.nocase=s,this.roots=i,this.root=n||this,this.#I=o,this.#_=a.fullpath,this.#C=a.relative,this.#P=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=tx(a.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#I}resolve(e){if(!e)return this;let r=this.getRootString(e),i=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(i):this.#O(i)}#O(e){let r=this;for(let n of e)r=r.child(n);return r}children(){let e=this.#I.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#I.set(this,r),this.#i&=~rv,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?lh(e):Rl(e);for(let c of n)if(c.#b===i)return c;let s=this.parent?this.sep:"",o=this.#_?this.#_+s+e:void 0,a=this.newChild(e,Rn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=Yn),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,r=this.parent;if(!r)return this.#C=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#P!==void 0)return this.#P;let e=this.name,r=this.parent;if(!r)return this.#P=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#_!==void 0)return this.#_;let e=this.name,r=this.parent;if(!r)return this.#_=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#_=i}fullpathPosix(){if(this.#m!==void 0)return this.#m;if(this.sep==="/")return this.#m=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#m=`//?/${i}`:this.#m=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#m=n}isUnknown(){return(this.#i&Nn)===Rn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&Nn)===ox}isDirectory(){return(this.#i&Nn)===gi}isCharacterDevice(){return(this.#i&Nn)===ix}isBlockDevice(){return(this.#i&Nn)===sx}isFIFO(){return(this.#i&Nn)===nx}isSocket(){return(this.#i&Nn)===ax}isSymbolicLink(){return(this.#i&io)===io}lstatCached(){return this.#i&XO?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&Nn;return!(e!==Rn&&e!==io||this.#i&ch||this.#i&Yn)}calledReaddir(){return!!(this.#i&rv)}isENOENT(){return!!(this.#i&Yn)}isNamed(e){return this.nocase?this.#b===lh(e):this.#b===Rl(e)}async readlink(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#v=n}catch(r){this.#u(r.code);return}}readlinkSync(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#v=n}catch(r){this.#u(r.code);return}}#x(e){this.#i|=rv;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#M()}}#M(){this.#i&Yn||(this.#i=(this.#i|Yn)&_l,this.#E())}#E(){let e=this.children();e.provisional=0;for(let r of e)r.#M()}#w(){this.#i|=uh,this.#L()}#L(){if(this.#i&Nl)return;let e=this.#i;(e&Nn)===gi&&(e&=_l),this.#i=e|Nl,this.#E()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#M():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#M()}#u(e=""){let r=this.#i;r|=ch,e==="ENOENT"&&(r|=Yn),(e==="EINVAL"||e==="UNKNOWN")&&(r&=_l),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#F(e,r){return this.#A(e,r)||this.#B(e,r)}#B(e,r){let n=nv(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&Nn;return s!==gi&&s!==io&&s!==Rn&&(i.#i|=Nl),r.unshift(i),r.provisional++,i}#A(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?lh(e.name):Rl(e.name))===i.#b)return this.#j(e,i,n,r)}}#j(e,r,n,i){let s=r.name;return r.#i=r.#i&_l|nv(e),s!==e.name&&(r.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(r)),i.provisional++,r}async lstat(){if((this.#i&Yn)===0)try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&Yn)===0)try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#z(e){let{atime:r,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:d,ino:f,mode:p,mtime:m,mtimeMs:h,nlink:T,rdev:_,size:b,uid:v}=e;this.#k=r,this.#y=n,this.#R=i,this.#p=s,this.#d=o,this.#s=a,this.#N=c,this.#h=l,this.#t=u,this.#f=d,this.#c=f,this.#n=p,this.#g=m,this.#T=h,this.#r=T,this.#a=_,this.#l=b,this.#o=v;let k=nv(e);this.#i=this.#i&_l|k|XO,k!==Rn&&k!==gi&&k!==io&&(this.#i|=Nl)}#H=[];#V=!1;#W(e){this.#V=!1;let r=this.#H.slice();this.#H.length=0,r.forEach(n=>n(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);r?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#H.push(e),this.#V)return;this.#V=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#q(s.code),n.provisional=0;else{for(let a of o)this.#F(a,n);this.#x(n)}this.#W(n.slice(0,n.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let n=()=>{};this.#U=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#F(i,e);this.#x(e)}catch(i){this.#q(i.code),e.provisional=0}this.#U=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let n of this.#e.readdirSync(r,{withFileTypes:!0}))this.#F(n,e);this.#x(e)}catch(n){this.#q(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&JO)return!1;let e=Nn&this.#i;return e===Rn||e===gi||e===io}shouldWalk(e,r){return(this.#i&gi)===gi&&!(this.#i&JO)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#D)return this.#D;if(!((uh|ch|Yn)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#w()}}realpathSync(){if(this.#D)return this.#D;if(!((uh|ch|Yn)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#w()}}[cx](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],i=this;for(;i&&i.parent;)r.add(i),i.#C=n.join(this.sep),i.#P=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#C=void 0,i.#P=void 0,i=i.parent}},fh=class t extends br{sep="\\";splitSep=ez;constructor(e,r=Rn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Rn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return La.win32.parse(e).root}getRoot(e){if(e=ZV(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=n;return this.roots[e]=new qa(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(rx,"$1\\"),e===r}},ph=class t extends br{splitSep="/";sep="/";constructor(e,r=Rn,n,i,s,o,a){super(e,r,n,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Rn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},hh=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=kl}={}){this.#r=tx(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,ex.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new dh,this.#t=new dh,this.#n=new iv(s);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=r.sep,f=this.rootPath,p=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(d),relativePosix:new Array(h).fill("..").join("/"),fullpath:f+=(p?"":d)+m}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#e.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpath();return this.#e.set(r,i),i}resolvePosix(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#t.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#t.set(r,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n}=r;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0}=r;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=await e.readlink();return r?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return r?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=await e.realpath();return r?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return r?n:n?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(d,f)=>{c.add(d),d.readdirCB((p,m)=>{if(p)return f(p);let h=m.length;if(!h)return f();let T=()=>{--h===0&&f()};for(let _ of m)(!s||s(_))&&a.push(n?_:_.fullpath()),i&&_.isSymbolicLink()?_.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(c,o)?l(b,T):T()):_.shouldWalk(c,o)?l(_,T):T()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let d of u){(!s||s(d))&&a.push(n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(i&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,o)&&c.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r;(!s||s(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let u of l){(!s||s(u))&&(yield n?u:u.fullpath());let d=u;if(u.isSymbolicLink()){if(!(i&&(d=u.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,o)&&a.add(d)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({objectMode:!0});(!s||s(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=(T,_,b=!1)=>{if(T)return a.emit("error",T);if(i&&!b){let v=[];for(let k of _)k.isSymbolicLink()&&v.push(k.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(v.length){Promise.all(v).then(()=>m(null,_,!0));return}}for(let v of _)v&&(!s||s(v))&&(a.write(n?v:v.fullpath())||(f=!0));u--;for(let v of _){let k=v.realpathCached()||v;k.shouldWalk(c,o)&&l.push(k)}f&&!a.flowing?a.once("drain",d):h||d()},h=!0;p.readdirCB(m,!0),h=!1}};return d(),a}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(n?e:e.fullpath());let l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=p.readdirSync();for(let h of m)(!s||s(h))&&(a.write(n?h:h.fullpath())||(f=!0));u--;for(let h of m){let T=h;if(h.isSymbolicLink()){if(!(i&&(T=h.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(c,o)&&l.push(T)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[cx](r)}},qa=class extends hh{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,La.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return La.win32.parse(e).root.toUpperCase()}newRoot(e){return new fh(this.rootPath,gi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},$a=class extends hh{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,La.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new ph(this.rootPath,gi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Pl=class extends $a{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},XNe=process.platform==="win32"?fh:ph,lx=process.platform==="win32"?qa:process.platform==="darwin"?Pl:$a;var rz=t=>t.length>=1,nz=t=>t.length>=1,Fa=class t{#e;#t;#n;length;#r;#o;#f;#a;#d;#c;#l=!0;constructor(e,r,n,i){if(!rz(e))throw new TypeError("empty pattern list");if(!nz(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#t=r,this.#n=n,this.#r=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#t;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),T=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#t=[T,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#t;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#t=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===sr}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#f=this.#f||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#t,this.#n+1,this.#r),this.#o.#c=this.#c,this.#o.#d=this.#d,this.#o.#a=this.#a,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#d!==void 0?this.#d:this.#d=this.#r==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var iz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ba=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=iz}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let r=new an(e,this.mmopts);for(let n=0;n<r.set.length;n++){let i=r.set[n],s=r.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new Fa(i,s,0,this.platform),a=new an(o.globString(),this.mmopts),c=s[s.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let r=e.fullpath(),n=`${r}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(r)||o.match(n))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(r))return!0;return!1}};var sv=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let n=e.fullpath(),i=this.store.get(n);i?i.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},ov=class{store=new Map;add(e,r,n){let i=(r?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},av=class{store=new Map;add(e,r){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===r.globString())||n.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},El=class t{hasWalkedCache;matches=new ov;subwalks=new av;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new sv}processPatterns(e,r){this.patterns=r;let n=r.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),a=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,l,u=!1;for(;typeof(c=s.pattern())=="string"&&(l=s.rest());)i=i.resolve(c),s=l,u=!0;if(c=s.pattern(),l=s.rest(),u){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof c=="string"){let d=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,d);continue}else if(c===sr){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=l?.pattern(),f=l?.rest();if(!l||(d===""||d===".")&&!f)this.matches.add(i,a,d===""||d===".");else if(d===".."){let p=i.parent||i;f?this.hasWalkedCache.hasWalked(p,f)||this.subwalks.add(p,f):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let n=this.subwalks.get(e),i=this.child();for(let s of r)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===sr?i.testGlobstar(s,o,l,a):c instanceof RegExp?i.testRegExp(s,c,l,a):i.testString(s,c,l,a)}return i}testGlobstar(e,r,n,i){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(e,n):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,r,n,i){r.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,r,n,i){e.isNamed(r)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};var sz=(t,e)=>typeof t=="string"?new Ba([t],e):Array.isArray(t)?new Ba(t,e):t,mh=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,r,n){if(this.patterns=e,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=sz(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#o(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,r)}matchFinish(e,r){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let s=`${e.relativePosix()}/**`;this.#t.add(s)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,r,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,r)}matchSync(e,r,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,r)}walkCB(e,r,n){this.signal?.aborted&&n(),this.walkCB2(e,r,new El(this.opts),n)}walkCB2(e,r,n,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,u)=>this.walkCB3(a,u,n,o),!0)}o()}walkCB3(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())s++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,r,new El(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},wl=class extends mh{matches=new Set;constructor(e,r,n){super(e,r,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Cl=class extends mh{results;constructor(e,r,n){super(e,r,n),this.results=new ys({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var oz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Xn=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,ux.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=r.platform||oz,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?qa:r.platform==="darwin"?Pl:r.platform?$a:lx;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(c=>new an(c,i)),[o,a]=s.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new Fa(c,u,0,this.platform)})}async walk(){return[...await new wl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new wl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Cl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Cl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var cv=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new an(r,e).hasMagic())return!0;return!1};function gh(t,e={}){return new Xn(t,e).streamSync()}function fx(t,e={}){return new Xn(t,e).stream()}function px(t,e={}){return new Xn(t,e).walkSync()}async function dx(t,e={}){return new Xn(t,e).walk()}function yh(t,e={}){return new Xn(t,e).iterateSync()}function hx(t,e={}){return new Xn(t,e).iterate()}var az=gh,cz=Object.assign(fx,{sync:gh}),lz=yh,uz=Object.assign(hx,{sync:yh}),dz=Object.assign(px,{stream:gh,iterate:yh}),so=Object.assign(dx,{glob:dx,globSync:px,sync:dz,globStream:fx,stream:cz,globStreamSync:gh,streamSync:az,globIterate:hx,iterate:uz,globIterateSync:yh,iterateSync:lz,Glob:Xn,hasMagic:cv,escape:Aa,unescape:Gn});so.glob=so;var z_=q(Hb()),sF=q(rF());var U_={};QF(U_,{$id:()=>i6,$schema:()=>n6,default:()=>l6,definitions:()=>o6,properties:()=>c6,title:()=>s6,type:()=>a6});var n6="http://json-schema.org/draft-07/schema#",i6="http://json-schema.org/draft-07/schema#",s6="Core schema meta-schema",o6={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},a6=["object","boolean"],c6={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},l6={$schema:n6,$id:i6,title:s6,definitions:o6,type:a6,properties:c6,default:!0};var ln=q(j());var Ym=class extends jc{constructor(r,n){super();this.ajv=r;this.schemaKey=n;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(r,n){let i=[];if(n.disabled){let o=n.getProperty("status");return[...n.definitions,...n.referencedBy].forEach(a=>i.push(F(21,a.firstToken,a.lastToken,a,{severity:ln.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[ln.DiagnosticTag.Unnecessary]}))),i}let s=X.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...u6(r,o,n,this.schemaKey))),console.log(this.schemaKey,`${n.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${n.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(r){let n=(this.validate?.schema).properties?.[r];if(n&&typeof n=="object"&&"description"in n)return{kind:ln.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
|
|
302
|
+
>>> no match, partial?`,e,f,r,p),f===c))}let h;if(typeof u=="string"?(h=d===u,this.debug("string match",u,d,h)):(h=u.test(d),this.debug("pattern match",u,d,h)),!h)return!1}if(o===c&&a===l)return!0;if(o===c)return n;if(a===l)return o===c-1&&e[o]==="";throw new Error("wtf?")}braceExpand(){return BO(this.pattern,this.options)}parse(e){ml(e);let r=this.options;if(e==="**")return sr;if(e==="")return"";let n,i=null;(n=e.match(kV))?i=r.dot?RV:NV:(n=e.match(pV))?i=(r.nocase?r.dot?yV:gV:r.dot?mV:hV)(n[1]):(n=e.match(PV))?i=(r.nocase?r.dot?wV:EV:r.dot?CV:DV)(n):(n=e.match(TV))?i=r.dot?bV:vV:(n=e.match(SV))&&(i=_V);let s=Da.fromGlob(e,this.options).toMMPattern();return i&&typeof s=="object"&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let r=this.options,n=r.noglobstar?OV:r.dot?xV:MV,i=new Set(r.nocase?["i"]:[]),s=e.map(c=>{let l=c.map(d=>{if(d instanceof RegExp)for(let f of d.flags.split(""))i.add(f);return typeof d=="string"?BV(d):d===sr?sr:d._src});l.forEach((d,f)=>{let p=l[f+1],m=l[f-1];d!==sr||m===sr||(m===void 0?p!==void 0&&p!==sr?l[f+1]="(?:\\/|"+n+"\\/)?"+p:l[f]=n:p===void 0?l[f-1]=m+"(?:\\/|\\/"+n+")?":p!==sr&&(l[f-1]=m+"(?:\\/|\\/"+n+"\\/)"+p,l[f+1]=sr))});let u=l.filter(d=>d!==sr);if(this.partial&&u.length>=1){let d=[];for(let f=1;f<=u.length;f++)d.push(u.slice(0,f).join("/"));return"(?:"+d.join("|")+")"}return u.join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];s="^"+o+s+a+"$",this.partial&&(s="^(?:\\/|"+o+s.slice(1,-1)+a+")$"),this.negate&&(s="^(?!"+s+").+$");try{this.regexp=new RegExp(s,[...i].join(""))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,r=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&r)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let i=this.slashSplit(e);this.debug(this.pattern,"split",i);let s=this.set;this.debug(this.pattern,"set",s);let o=i[i.length-1];if(!o)for(let a=i.length-2;!o&&a>=0;a--)o=i[a];for(let a=0;a<s.length;a++){let c=s[a],l=i;if(n.matchBase&&c.length===1&&(l=[o]),this.matchOne(l,c,r))return n.flipNegate?!0:!this.negate}return n.flipNegate?!1:this.negate}static defaults(e){return wr.defaults(e).Minimatch}};wr.AST=Da;wr.Minimatch=an;wr.escape=Aa;wr.unescape=Kn;var ux=require("node:url");var Ia=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,UO=new Set,GT=typeof process=="object"&&process?process:{},HO=(t,e,r,n)=>{typeof GT.emitWarning=="function"?GT.emitWarning(t,e,r,n):console.error(`[${r}] ${e}: ${t}`)},eh=globalThis.AbortController,jO=globalThis.AbortSignal;if(typeof eh>"u"){jO=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(n,i){this._onabort.push(i)}},eh=class{constructor(){e()}signal=new jO;abort(n){if(!this.signal.aborted){this.signal.reason=n,this.signal.aborted=!0;for(let i of this.signal._onabort)i(n);this.signal.onabort?.(n)}}};let t=GT.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,HO("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var jV=t=>!UO.has(t),zNe=Symbol("type"),ms=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),VO=t=>ms(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?Oa:null:null,Oa=class extends Array{constructor(e){super(e),this.fill(0)}},KT=class t{heap;length;static#e=!1;static create(e){let r=VO(e);if(!r)return[];t.#e=!0;let n=new t(e,r);return t.#e=!1,n}constructor(e,r){if(!t.#e)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new r(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},yl=class t{#e;#t;#n;#r;#o;#f;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#d;#c;#l;#s;#y;#T;#h;#p;#k;#g;#N;#R;#b;#S;#_;#m;static unsafeExposeInternals(e){return{starts:e.#R,ttls:e.#b,sizes:e.#N,keyMap:e.#c,keyList:e.#l,valList:e.#s,next:e.#y,prev:e.#T,get head(){return e.#h},get tail(){return e.#p},free:e.#k,isBackgroundFetch:r=>e.#u(r),backgroundFetch:(r,n,i,s)=>e.#$(r,n,i,s),moveToTail:r=>e.#B(r),indexes:r=>e.#E(r),rindexes:r=>e.#w(r),isStale:r=>e.#v(r)}}get max(){return this.#e}get maxSize(){return this.#t}get calculatedSize(){return this.#d}get size(){return this.#a}get fetchMethod(){return this.#o}get memoMethod(){return this.#f}get dispose(){return this.#n}get disposeAfter(){return this.#r}constructor(e){let{max:r=0,ttl:n,ttlResolution:i=1,ttlAutopurge:s,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:c,dispose:l,disposeAfter:u,noDisposeOnSet:d,noUpdateTTL:f,maxSize:p=0,maxEntrySize:m=0,sizeCalculation:h,fetchMethod:T,memoMethod:_,noDeleteOnFetchRejection:b,noDeleteOnStaleGet:v,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:w,ignoreFetchAbort:H}=e;if(r!==0&&!ms(r))throw new TypeError("max option must be a nonnegative integer");let O=r?VO(r):Array;if(!O)throw new Error("invalid max value: "+r);if(this.#e=r,this.#t=p,this.maxEntrySize=m||this.#t,this.sizeCalculation=h,this.sizeCalculation){if(!this.#t&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(_!==void 0&&typeof _!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#f=_,T!==void 0&&typeof T!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#o=T,this.#_=!!T,this.#c=new Map,this.#l=new Array(r).fill(void 0),this.#s=new Array(r).fill(void 0),this.#y=new O(r),this.#T=new O(r),this.#h=0,this.#p=0,this.#k=KT.create(r),this.#a=0,this.#d=0,typeof l=="function"&&(this.#n=l),typeof u=="function"?(this.#r=u,this.#g=[]):(this.#r=void 0,this.#g=void 0),this.#S=!!this.#n,this.#m=!!this.#r,this.noDisposeOnSet=!!d,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!b,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!H,this.maxEntrySize!==0){if(this.#t!==0&&!ms(this.#t))throw new TypeError("maxSize must be a positive integer if specified");if(!ms(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#D()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!v,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=ms(i)||i===0?i:1,this.ttlAutopurge=!!s,this.ttl=n||0,this.ttl){if(!ms(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#C()}if(this.#e===0&&this.ttl===0&&this.#t===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#e&&!this.#t){let B="LRU_CACHE_UNBOUNDED";jV(B)&&(UO.add(B),HO("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",B,t))}}getRemainingTTL(e){return this.#c.has(e)?1/0:0}#C(){let e=new Oa(this.#e),r=new Oa(this.#e);this.#b=e,this.#R=r,this.#I=(s,o,a=Ia.now())=>{if(r[s]=o!==0?a:0,e[s]=o,o!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#v(s)&&this.#A(this.#l[s],"expire")},o+1);c.unref&&c.unref()}},this.#P=s=>{r[s]=e[s]!==0?Ia.now():0},this.#i=(s,o)=>{if(e[o]){let a=e[o],c=r[o];if(!a||!c)return;s.ttl=a,s.start=c,s.now=n||i();let l=s.now-c;s.remainingTTL=a-l}};let n=0,i=()=>{let s=Ia.now();if(this.ttlResolution>0){n=s;let o=setTimeout(()=>n=0,this.ttlResolution);o.unref&&o.unref()}return s};this.getRemainingTTL=s=>{let o=this.#c.get(s);if(o===void 0)return 0;let a=e[o],c=r[o];if(!a||!c)return 1/0;let l=(n||i())-c;return a-l},this.#v=s=>{let o=r[s],a=e[s];return!!a&&!!o&&(n||i())-o>a}}#P=()=>{};#i=()=>{};#I=()=>{};#v=()=>!1;#D(){let e=new Oa(this.#e);this.#d=0,this.#N=e,this.#O=r=>{this.#d-=e[r],e[r]=0},this.#M=(r,n,i,s)=>{if(this.#u(n))return 0;if(!ms(i))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(i=s(n,r),!ms(i))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return i},this.#x=(r,n,i)=>{if(e[r]=n,this.#t){let s=this.#t-e[r];for(;this.#d>s;)this.#q(!0)}this.#d+=e[r],i&&(i.entrySize=n,i.totalCalculatedSize=this.#d)}}#O=e=>{};#x=(e,r,n)=>{};#M=(e,r,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#p;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#h));)r=this.#T[r]}*#w({allowStale:e=this.allowStale}={}){if(this.#a)for(let r=this.#h;!(!this.#L(r)||((e||!this.#v(r))&&(yield r),r===this.#p));)r=this.#y[r]}#L(e){return e!==void 0&&this.#c.get(this.#l[e])===e}*entries(){for(let e of this.#E())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*rentries(){for(let e of this.#w())this.#s[e]!==void 0&&this.#l[e]!==void 0&&!this.#u(this.#s[e])&&(yield[this.#l[e],this.#s[e]])}*keys(){for(let e of this.#E()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*rkeys(){for(let e of this.#w()){let r=this.#l[e];r!==void 0&&!this.#u(this.#s[e])&&(yield r)}}*values(){for(let e of this.#E())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}*rvalues(){for(let e of this.#w())this.#s[e]!==void 0&&!this.#u(this.#s[e])&&(yield this.#s[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,r={}){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;if(s!==void 0&&e(s,this.#l[n],this))return this.get(this.#l[n],r)}}forEach(e,r=this){for(let n of this.#E()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}rforEach(e,r=this){for(let n of this.#w()){let i=this.#s[n],s=this.#u(i)?i.__staleWhileFetching:i;s!==void 0&&e.call(r,s,this.#l[n],this)}}purgeStale(){let e=!1;for(let r of this.#w({allowStale:!0}))this.#v(r)&&(this.#A(this.#l[r],"expire"),e=!0);return e}info(e){let r=this.#c.get(e);if(r===void 0)return;let n=this.#s[r],i=this.#u(n)?n.__staleWhileFetching:n;if(i===void 0)return;let s={value:i};if(this.#b&&this.#R){let o=this.#b[r],a=this.#R[r];if(o&&a){let c=o-(Ia.now()-a);s.ttl=c,s.start=Date.now()}}return this.#N&&(s.size=this.#N[r]),s}dump(){let e=[];for(let r of this.#E({allowStale:!0})){let n=this.#l[r],i=this.#s[r],s=this.#u(i)?i.__staleWhileFetching:i;if(s===void 0||n===void 0)continue;let o={value:s};if(this.#b&&this.#R){o.ttl=this.#b[r];let a=Ia.now()-this.#R[r];o.start=Math.floor(Date.now()-a)}this.#N&&(o.size=this.#N[r]),e.unshift([n,o])}return e}load(e){this.clear();for(let[r,n]of e){if(n.start){let i=Date.now()-n.start;n.start=Ia.now()-i}this.set(r,n.value,n)}}set(e,r,n={}){if(r===void 0)return this.delete(e),this;let{ttl:i=this.ttl,start:s,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,u=this.#M(e,r,n.size||0,a);if(this.maxEntrySize&&u>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let d=this.#a===0?void 0:this.#c.get(e);if(d===void 0)d=this.#a===0?this.#p:this.#k.length!==0?this.#k.pop():this.#a===this.#e?this.#q(!1):this.#a,this.#l[d]=e,this.#s[d]=r,this.#c.set(e,d),this.#y[this.#p]=d,this.#T[d]=this.#p,this.#p=d,this.#a++,this.#x(d,u,c),c&&(c.set="add"),l=!1;else{this.#B(d);let f=this.#s[d];if(r!==f){if(this.#_&&this.#u(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!o&&(this.#S&&this.#n?.(p,e,"set"),this.#m&&this.#g?.push([p,e,"set"]))}else o||(this.#S&&this.#n?.(f,e,"set"),this.#m&&this.#g?.push([f,e,"set"]));if(this.#O(d),this.#x(d,u,c),this.#s[d]=r,c){c.set="replace";let p=f&&this.#u(f)?f.__staleWhileFetching:f;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(i!==0&&!this.#b&&this.#C(),this.#b&&(l||this.#I(d,i,s),c&&this.#i(c,d)),!o&&this.#m&&this.#g){let f=this.#g,p;for(;p=f?.shift();)this.#r?.(...p)}return this}pop(){try{for(;this.#a;){let e=this.#s[this.#h];if(this.#q(!0),this.#u(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#m&&this.#g){let e=this.#g,r;for(;r=e?.shift();)this.#r?.(...r)}}}#q(e){let r=this.#h,n=this.#l[r],i=this.#s[r];return this.#_&&this.#u(i)?i.__abortController.abort(new Error("evicted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(i,n,"evict"),this.#m&&this.#g?.push([i,n,"evict"])),this.#O(r),e&&(this.#l[r]=void 0,this.#s[r]=void 0,this.#k.push(r)),this.#a===1?(this.#h=this.#p=0,this.#k.length=0):this.#h=this.#y[r],this.#c.delete(n),this.#a--,r}has(e,r={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=r,s=this.#c.get(e);if(s!==void 0){let o=this.#s[s];if(this.#u(o)&&o.__staleWhileFetching===void 0)return!1;if(this.#v(s))i&&(i.has="stale",this.#i(i,s));else return n&&this.#P(s),i&&(i.has="hit",this.#i(i,s)),!0}else i&&(i.has="miss");return!1}peek(e,r={}){let{allowStale:n=this.allowStale}=r,i=this.#c.get(e);if(i===void 0||!n&&this.#v(i))return;let s=this.#s[i];return this.#u(s)?s.__staleWhileFetching:s}#$(e,r,n,i){let s=r===void 0?void 0:this.#s[r];if(this.#u(s))return s;let o=new eh,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let c={signal:o.signal,options:n,context:i},l=(h,T=!1)=>{let{aborted:_}=o.signal,b=n.ignoreFetchAbort&&h!==void 0;if(n.status&&(_&&!T?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),_&&!b&&!T)return d(o.signal.reason);let v=p;return this.#s[r]===p&&(h===void 0?v.__staleWhileFetching?this.#s[r]=v.__staleWhileFetching:this.#A(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,h,c.options))),h},u=h=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=h),d(h)),d=h=>{let{aborted:T}=o.signal,_=T&&n.allowStaleOnFetchAbort,b=_||n.allowStaleOnFetchRejection,v=b||n.noDeleteOnFetchRejection,k=p;if(this.#s[r]===p&&(!v||k.__staleWhileFetching===void 0?this.#A(e,"fetch"):_||(this.#s[r]=k.__staleWhileFetching)),b)return n.status&&k.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),k.__staleWhileFetching;if(k.__returned===k)throw h},f=(h,T)=>{let _=this.#o?.(e,s,c);_&&_ instanceof Promise&&_.then(b=>h(b===void 0?void 0:b),T),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(h(void 0),n.allowStaleOnFetchAbort&&(h=b=>l(b,!0)))})};n.status&&(n.status.fetchDispatched=!0);let p=new Promise(f).then(l,u),m=Object.assign(p,{__abortController:o,__staleWhileFetching:s,__returned:void 0});return r===void 0?(this.set(e,m,{...c.options,status:void 0}),r=this.#c.get(e)):this.#s[r]=m,m}#u(e){if(!this.#_)return!1;let r=e;return!!r&&r instanceof Promise&&r.hasOwnProperty("__staleWhileFetching")&&r.__abortController instanceof eh}async fetch(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:m=this.allowStaleOnFetchAbort,context:h,forceRefresh:T=!1,status:_,signal:b}=r;if(!this.#_)return _&&(_.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,status:_});let v={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:s,ttl:o,noDisposeOnSet:a,size:c,sizeCalculation:l,noUpdateTTL:u,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:m,ignoreFetchAbort:p,status:_,signal:b},k=this.#c.get(e);if(k===void 0){_&&(_.fetch="miss");let w=this.#$(e,k,v,h);return w.__returned=w}else{let w=this.#s[k];if(this.#u(w)){let lt=n&&w.__staleWhileFetching!==void 0;return _&&(_.fetch="inflight",lt&&(_.returnedStale=!0)),lt?w.__staleWhileFetching:w.__returned=w}let H=this.#v(k);if(!T&&!H)return _&&(_.fetch="hit"),this.#B(k),i&&this.#P(k),_&&this.#i(_,k),w;let O=this.#$(e,k,v,h),De=O.__staleWhileFetching!==void 0&&n;return _&&(_.fetch=H?"stale":"refresh",De&&H&&(_.returnedStale=!0)),De?O.__staleWhileFetching:O.__returned=O}}async forceFetch(e,r={}){let n=await this.fetch(e,r);if(n===void 0)throw new Error("fetch() returned undefined");return n}memo(e,r={}){let n=this.#f;if(!n)throw new Error("no memoMethod provided to constructor");let{context:i,forceRefresh:s,...o}=r,a=this.get(e,o);if(!s&&a!==void 0)return a;let c=n(e,a,{options:o,context:i});return this.set(e,c,o),c}get(e,r={}){let{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:o}=r,a=this.#c.get(e);if(a!==void 0){let c=this.#s[a],l=this.#u(c);return o&&this.#i(o,a),this.#v(a)?(o&&(o.get="stale"),l?(o&&n&&c.__staleWhileFetching!==void 0&&(o.returnedStale=!0),n?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),o&&n&&(o.returnedStale=!0),n?c:void 0)):(o&&(o.get="hit"),l?c.__staleWhileFetching:(this.#B(a),i&&this.#P(a),c))}else o&&(o.get="miss")}#F(e,r){this.#T[r]=e,this.#y[e]=r}#B(e){e!==this.#p&&(e===this.#h?this.#h=this.#y[e]:this.#F(this.#T[e],this.#y[e]),this.#F(this.#p,e),this.#p=e)}delete(e){return this.#A(e,"delete")}#A(e,r){let n=!1;if(this.#a!==0){let i=this.#c.get(e);if(i!==void 0)if(n=!0,this.#a===1)this.#j(r);else{this.#O(i);let s=this.#s[i];if(this.#u(s)?s.__abortController.abort(new Error("deleted")):(this.#S||this.#m)&&(this.#S&&this.#n?.(s,e,r),this.#m&&this.#g?.push([s,e,r])),this.#c.delete(e),this.#l[i]=void 0,this.#s[i]=void 0,i===this.#p)this.#p=this.#T[i];else if(i===this.#h)this.#h=this.#y[i];else{let o=this.#T[i];this.#y[o]=this.#y[i];let a=this.#y[i];this.#T[a]=this.#T[i]}this.#a--,this.#k.push(i)}}if(this.#m&&this.#g?.length){let i=this.#g,s;for(;s=i?.shift();)this.#r?.(...s)}return n}clear(){return this.#j("delete")}#j(e){for(let r of this.#w({allowStale:!0})){let n=this.#s[r];if(this.#u(n))n.__abortController.abort(new Error("deleted"));else{let i=this.#l[r];this.#S&&this.#n?.(n,i,e),this.#m&&this.#g?.push([n,i,e])}}if(this.#c.clear(),this.#s.fill(void 0),this.#l.fill(void 0),this.#b&&this.#R&&(this.#b.fill(0),this.#R.fill(0)),this.#N&&this.#N.fill(0),this.#h=0,this.#p=0,this.#k.length=0,this.#d=0,this.#a=0,this.#m&&this.#g){let r=this.#g,n;for(;n=r?.shift();)this.#r?.(...n)}}};var La=require("node:path"),ex=require("node:url"),yi=require("fs"),JV=q(require("node:fs"),1),Ts=require("node:fs/promises");var ah=require("node:events"),tv=q(require("node:stream"),1),YO=require("node:string_decoder"),zO=typeof process=="object"&&process?process:{stdout:null,stderr:null},UV=t=>!!t&&typeof t=="object"&&(t instanceof ys||t instanceof tv.default||HV(t)||VV(t)),HV=t=>!!t&&typeof t=="object"&&t instanceof ah.EventEmitter&&typeof t.pipe=="function"&&t.pipe!==tv.default.Writable.prototype.pipe,VV=t=>!!t&&typeof t=="object"&&t instanceof ah.EventEmitter&&typeof t.write=="function"&&typeof t.end=="function",Fi=Symbol("EOF"),Bi=Symbol("maybeEmitEnd"),gs=Symbol("emittedEnd"),th=Symbol("emittingEnd"),Tl=Symbol("emittedError"),rh=Symbol("closed"),WO=Symbol("read"),nh=Symbol("flush"),GO=Symbol("flushChunk"),Yn=Symbol("encoding"),xa=Symbol("decoder"),Jt=Symbol("flowing"),vl=Symbol("paused"),Ma=Symbol("resume"),Qt=Symbol("buffer"),Cr=Symbol("pipes"),Zt=Symbol("bufferLength"),YT=Symbol("bufferPush"),ih=Symbol("bufferShift"),vr=Symbol("objectMode"),Mt=Symbol("destroyed"),XT=Symbol("error"),JT=Symbol("emitData"),KO=Symbol("emitEnd"),QT=Symbol("emitEnd2"),mi=Symbol("async"),ZT=Symbol("abort"),sh=Symbol("aborted"),bl=Symbol("signal"),no=Symbol("dataListeners"),cn=Symbol("discarded"),Sl=t=>Promise.resolve().then(t),zV=t=>t(),WV=t=>t==="end"||t==="finish"||t==="prefinish",GV=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,KV=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),oh=class{src;dest;opts;ondrain;constructor(e,r,n){this.src=e,this.dest=r,this.opts=n,this.ondrain=()=>e[Ma](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ev=class extends oh{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,r,n){super(e,r,n),this.proxyErrors=i=>r.emit("error",i),e.on("error",this.proxyErrors)}},YV=t=>!!t.objectMode,XV=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",ys=class extends ah.EventEmitter{[Jt]=!1;[vl]=!1;[Cr]=[];[Qt]=[];[vr];[Yn];[mi];[xa];[Fi]=!1;[gs]=!1;[th]=!1;[rh]=!1;[Tl]=null;[Zt]=0;[Mt]=!1;[bl];[sh]=!1;[no]=0;[cn]=!1;writable=!0;readable=!0;constructor(...e){let r=e[0]||{};if(super(),r.objectMode&&typeof r.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");YV(r)?(this[vr]=!0,this[Yn]=null):XV(r)?(this[Yn]=r.encoding,this[vr]=!1):(this[vr]=!1,this[Yn]=null),this[mi]=!!r.async,this[xa]=this[Yn]?new YO.StringDecoder(this[Yn]):null,r&&r.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Qt]}),r&&r.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[Cr]});let{signal:n}=r;n&&(this[bl]=n,n.aborted?this[ZT]():n.addEventListener("abort",()=>this[ZT]()))}get bufferLength(){return this[Zt]}get encoding(){return this[Yn]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[vr]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[mi]}set async(e){this[mi]=this[mi]||!!e}[ZT](){this[sh]=!0,this.emit("abort",this[bl]?.reason),this.destroy(this[bl]?.reason)}get aborted(){return this[sh]}set aborted(e){}write(e,r,n){if(this[sh])return!1;if(this[Fi])throw new Error("write after end");if(this[Mt])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof r=="function"&&(n=r,r="utf8"),r||(r="utf8");let i=this[mi]?Sl:zV;if(!this[vr]&&!Buffer.isBuffer(e)){if(KV(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(GV(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[vr]?(this[Jt]&&this[Zt]!==0&&this[nh](!0),this[Jt]?this.emit("data",e):this[YT](e),this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt]):e.length?(typeof e=="string"&&!(r===this[Yn]&&!this[xa]?.lastNeed)&&(e=Buffer.from(e,r)),Buffer.isBuffer(e)&&this[Yn]&&(e=this[xa].write(e)),this[Jt]&&this[Zt]!==0&&this[nh](!0),this[Jt]?this.emit("data",e):this[YT](e),this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt]):(this[Zt]!==0&&this.emit("readable"),n&&i(n),this[Jt])}read(e){if(this[Mt])return null;if(this[cn]=!1,this[Zt]===0||e===0||e&&e>this[Zt])return this[Bi](),null;this[vr]&&(e=null),this[Qt].length>1&&!this[vr]&&(this[Qt]=[this[Yn]?this[Qt].join(""):Buffer.concat(this[Qt],this[Zt])]);let r=this[WO](e||null,this[Qt][0]);return this[Bi](),r}[WO](e,r){if(this[vr])this[ih]();else{let n=r;e===n.length||e===null?this[ih]():typeof n=="string"?(this[Qt][0]=n.slice(e),r=n.slice(0,e),this[Zt]-=e):(this[Qt][0]=n.subarray(e),r=n.subarray(0,e),this[Zt]-=e)}return this.emit("data",r),!this[Qt].length&&!this[Fi]&&this.emit("drain"),r}end(e,r,n){return typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r="utf8"),e!==void 0&&this.write(e,r),n&&this.once("end",n),this[Fi]=!0,this.writable=!1,(this[Jt]||!this[vl])&&this[Bi](),this}[Ma](){this[Mt]||(!this[no]&&!this[Cr].length&&(this[cn]=!0),this[vl]=!1,this[Jt]=!0,this.emit("resume"),this[Qt].length?this[nh]():this[Fi]?this[Bi]():this.emit("drain"))}resume(){return this[Ma]()}pause(){this[Jt]=!1,this[vl]=!0,this[cn]=!1}get destroyed(){return this[Mt]}get flowing(){return this[Jt]}get paused(){return this[vl]}[YT](e){this[vr]?this[Zt]+=1:this[Zt]+=e.length,this[Qt].push(e)}[ih](){return this[vr]?this[Zt]-=1:this[Zt]-=this[Qt][0].length,this[Qt].shift()}[nh](e=!1){do;while(this[GO](this[ih]())&&this[Qt].length);!e&&!this[Qt].length&&!this[Fi]&&this.emit("drain")}[GO](e){return this.emit("data",e),this[Jt]}pipe(e,r){if(this[Mt])return e;this[cn]=!1;let n=this[gs];return r=r||{},e===zO.stdout||e===zO.stderr?r.end=!1:r.end=r.end!==!1,r.proxyErrors=!!r.proxyErrors,n?r.end&&e.end():(this[Cr].push(r.proxyErrors?new ev(this,e,r):new oh(this,e,r)),this[mi]?Sl(()=>this[Ma]()):this[Ma]()),e}unpipe(e){let r=this[Cr].find(n=>n.dest===e);r&&(this[Cr].length===1?(this[Jt]&&this[no]===0&&(this[Jt]=!1),this[Cr]=[]):this[Cr].splice(this[Cr].indexOf(r),1),r.unpipe())}addListener(e,r){return this.on(e,r)}on(e,r){let n=super.on(e,r);if(e==="data")this[cn]=!1,this[no]++,!this[Cr].length&&!this[Jt]&&this[Ma]();else if(e==="readable"&&this[Zt]!==0)super.emit("readable");else if(WV(e)&&this[gs])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[Tl]){let i=r;this[mi]?Sl(()=>i.call(this,this[Tl])):i.call(this,this[Tl])}return n}removeListener(e,r){return this.off(e,r)}off(e,r){let n=super.off(e,r);return e==="data"&&(this[no]=this.listeners("data").length,this[no]===0&&!this[cn]&&!this[Cr].length&&(this[Jt]=!1)),n}removeAllListeners(e){let r=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[no]=0,!this[cn]&&!this[Cr].length&&(this[Jt]=!1)),r}get emittedEnd(){return this[gs]}[Bi](){!this[th]&&!this[gs]&&!this[Mt]&&this[Qt].length===0&&this[Fi]&&(this[th]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[rh]&&this.emit("close"),this[th]=!1)}emit(e,...r){let n=r[0];if(e!=="error"&&e!=="close"&&e!==Mt&&this[Mt])return!1;if(e==="data")return!this[vr]&&!n?!1:this[mi]?(Sl(()=>this[JT](n)),!0):this[JT](n);if(e==="end")return this[KO]();if(e==="close"){if(this[rh]=!0,!this[gs]&&!this[Mt])return!1;let s=super.emit("close");return this.removeAllListeners("close"),s}else if(e==="error"){this[Tl]=n,super.emit(XT,n);let s=!this[bl]||this.listeners("error").length?super.emit("error",n):!1;return this[Bi](),s}else if(e==="resume"){let s=super.emit("resume");return this[Bi](),s}else if(e==="finish"||e==="prefinish"){let s=super.emit(e);return this.removeAllListeners(e),s}let i=super.emit(e,...r);return this[Bi](),i}[JT](e){for(let n of this[Cr])n.dest.write(e)===!1&&this.pause();let r=this[cn]?!1:super.emit("data",e);return this[Bi](),r}[KO](){return this[gs]?!1:(this[gs]=!0,this.readable=!1,this[mi]?(Sl(()=>this[QT]()),!0):this[QT]())}[QT](){if(this[xa]){let r=this[xa].end();if(r){for(let n of this[Cr])n.dest.write(r);this[cn]||super.emit("data",r)}}for(let r of this[Cr])r.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[vr]||(e.dataLength=0);let r=this.promise();return this.on("data",n=>{e.push(n),this[vr]||(e.dataLength+=n.length)}),await r,e}async concat(){if(this[vr])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Yn]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,r)=>{this.on(Mt,()=>r(new Error("stream destroyed"))),this.on("error",n=>r(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[cn]=!1;let e=!1,r=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return r();let i=this.read();if(i!==null)return Promise.resolve({done:!1,value:i});if(this[Fi])return r();let s,o,a=d=>{this.off("data",c),this.off("end",l),this.off(Mt,u),r(),o(d)},c=d=>{this.off("error",a),this.off("end",l),this.off(Mt,u),this.pause(),s({value:d,done:!!this[Fi]})},l=()=>{this.off("error",a),this.off("data",c),this.off(Mt,u),r(),s({done:!0,value:void 0})},u=()=>a(new Error("stream destroyed"));return new Promise((d,f)=>{o=f,s=d,this.once(Mt,u),this.once("error",a),this.once("end",l),this.once("data",c)})},throw:r,return:r,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[cn]=!1;let e=!1,r=()=>(this.pause(),this.off(XT,r),this.off(Mt,r),this.off("end",r),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return r();let i=this.read();return i===null?r():{done:!1,value:i}};return this.once("end",r),this.once(XT,r),this.once(Mt,r),{next:n,throw:r,return:r,[Symbol.iterator](){return this}}}destroy(e){if(this[Mt])return e?this.emit("error",e):this.emit(Mt),this;this[Mt]=!0,this[cn]=!0,this[Qt].length=0,this[Zt]=0;let r=this;return typeof r.close=="function"&&!this[rh]&&r.close(),e?this.emit("error",e):this.emit(Mt),this}static get isStream(){return UV}};var QV=yi.realpathSync.native,kl={lstatSync:yi.lstatSync,readdir:yi.readdir,readdirSync:yi.readdirSync,readlinkSync:yi.readlinkSync,realpathSync:QV,promises:{lstat:Ts.lstat,readdir:Ts.readdir,readlink:Ts.readlink,realpath:Ts.realpath}},tx=t=>!t||t===kl||t===JV?kl:{...kl,...t,promises:{...kl.promises,...t.promises||{}}},rx=/^\\\\\?\\([a-z]:)\\?$/i,ZV=t=>t.replace(/\//g,"\\").replace(rx,"$1\\"),ez=/[\\\/]/,Pn=0,nx=1,ix=2,gi=4,sx=6,ox=8,io=10,ax=12,Rn=15,_l=~Rn,rv=16,XO=32,Nl=64,Xn=128,ch=256,uh=512,JO=Nl|Xn|uh,tz=1023,nv=t=>t.isFile()?ox:t.isDirectory()?gi:t.isSymbolicLink()?io:t.isCharacterDevice()?ix:t.isBlockDevice()?sx:t.isSocket()?ax:t.isFIFO()?nx:Pn,QO=new Map,Rl=t=>{let e=QO.get(t);if(e)return e;let r=t.normalize("NFKD");return QO.set(t,r),r},ZO=new Map,lh=t=>{let e=ZO.get(t);if(e)return e;let r=Rl(t.toLowerCase());return ZO.set(t,r),r},dh=class extends yl{constructor(){super({max:256})}},iv=class extends yl{constructor(e=16*1024){super({maxSize:e,sizeCalculation:r=>r.length+1})}},cx=Symbol("PathScurry setAsCwd"),br=class{name;root;roots;parent;nocase;isCWD=!1;#e;#t;get dev(){return this.#t}#n;get mode(){return this.#n}#r;get nlink(){return this.#r}#o;get uid(){return this.#o}#f;get gid(){return this.#f}#a;get rdev(){return this.#a}#d;get blksize(){return this.#d}#c;get ino(){return this.#c}#l;get size(){return this.#l}#s;get blocks(){return this.#s}#y;get atimeMs(){return this.#y}#T;get mtimeMs(){return this.#T}#h;get ctimeMs(){return this.#h}#p;get birthtimeMs(){return this.#p}#k;get atime(){return this.#k}#g;get mtime(){return this.#g}#N;get ctime(){return this.#N}#R;get birthtime(){return this.#R}#b;#S;#_;#m;#C;#P;#i;#I;#v;#D;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,r=Pn,n,i,s,o,a){this.name=e,this.#b=s?lh(e):Rl(e),this.#i=r&tz,this.nocase=s,this.roots=i,this.root=n||this,this.#I=o,this.#_=a.fullpath,this.#C=a.relative,this.#P=a.relativePosix,this.parent=a.parent,this.parent?this.#e=this.parent.#e:this.#e=tx(a.fs)}depth(){return this.#S!==void 0?this.#S:this.parent?this.#S=this.parent.depth()+1:this.#S=0}childrenCache(){return this.#I}resolve(e){if(!e)return this;let r=this.getRootString(e),i=e.substring(r.length).split(this.splitSep);return r?this.getRoot(r).#O(i):this.#O(i)}#O(e){let r=this;for(let n of e)r=r.child(n);return r}children(){let e=this.#I.get(this);if(e)return e;let r=Object.assign([],{provisional:0});return this.#I.set(this,r),this.#i&=~rv,r}child(e,r){if(e===""||e===".")return this;if(e==="..")return this.parent||this;let n=this.children(),i=this.nocase?lh(e):Rl(e);for(let c of n)if(c.#b===i)return c;let s=this.parent?this.sep:"",o=this.#_?this.#_+s+e:void 0,a=this.newChild(e,Pn,{...r,parent:this,fullpath:o});return this.canReaddir()||(a.#i|=Xn),n.push(a),a}relative(){if(this.isCWD)return"";if(this.#C!==void 0)return this.#C;let e=this.name,r=this.parent;if(!r)return this.#C=this.name;let n=r.relative();return n+(!n||!r.parent?"":this.sep)+e}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#P!==void 0)return this.#P;let e=this.name,r=this.parent;if(!r)return this.#P=this.fullpathPosix();let n=r.relativePosix();return n+(!n||!r.parent?"":"/")+e}fullpath(){if(this.#_!==void 0)return this.#_;let e=this.name,r=this.parent;if(!r)return this.#_=this.name;let i=r.fullpath()+(r.parent?this.sep:"")+e;return this.#_=i}fullpathPosix(){if(this.#m!==void 0)return this.#m;if(this.sep==="/")return this.#m=this.fullpath();if(!this.parent){let i=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(i)?this.#m=`//?/${i}`:this.#m=i}let e=this.parent,r=e.fullpathPosix(),n=r+(!r||!e.parent?"":"/")+this.name;return this.#m=n}isUnknown(){return(this.#i&Rn)===Pn}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#i&Rn)===ox}isDirectory(){return(this.#i&Rn)===gi}isCharacterDevice(){return(this.#i&Rn)===ix}isBlockDevice(){return(this.#i&Rn)===sx}isFIFO(){return(this.#i&Rn)===nx}isSocket(){return(this.#i&Rn)===ax}isSymbolicLink(){return(this.#i&io)===io}lstatCached(){return this.#i&XO?this:void 0}readlinkCached(){return this.#v}realpathCached(){return this.#D}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#v)return!0;if(!this.parent)return!1;let e=this.#i&Rn;return!(e!==Pn&&e!==io||this.#i&ch||this.#i&Xn)}calledReaddir(){return!!(this.#i&rv)}isENOENT(){return!!(this.#i&Xn)}isNamed(e){return this.nocase?this.#b===lh(e):this.#b===Rl(e)}async readlink(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=await this.#e.promises.readlink(this.fullpath()),n=(await this.parent.realpath())?.resolve(r);if(n)return this.#v=n}catch(r){this.#u(r.code);return}}readlinkSync(){let e=this.#v;if(e)return e;if(this.canReadlink()&&this.parent)try{let r=this.#e.readlinkSync(this.fullpath()),n=this.parent.realpathSync()?.resolve(r);if(n)return this.#v=n}catch(r){this.#u(r.code);return}}#x(e){this.#i|=rv;for(let r=e.provisional;r<e.length;r++){let n=e[r];n&&n.#M()}}#M(){this.#i&Xn||(this.#i=(this.#i|Xn)&_l,this.#E())}#E(){let e=this.children();e.provisional=0;for(let r of e)r.#M()}#w(){this.#i|=uh,this.#L()}#L(){if(this.#i&Nl)return;let e=this.#i;(e&Rn)===gi&&(e&=_l),this.#i=e|Nl,this.#E()}#q(e=""){e==="ENOTDIR"||e==="EPERM"?this.#L():e==="ENOENT"?this.#M():this.children().provisional=0}#$(e=""){e==="ENOTDIR"?this.parent.#L():e==="ENOENT"&&this.#M()}#u(e=""){let r=this.#i;r|=ch,e==="ENOENT"&&(r|=Xn),(e==="EINVAL"||e==="UNKNOWN")&&(r&=_l),this.#i=r,e==="ENOTDIR"&&this.parent&&this.parent.#L()}#F(e,r){return this.#A(e,r)||this.#B(e,r)}#B(e,r){let n=nv(e),i=this.newChild(e.name,n,{parent:this}),s=i.#i&Rn;return s!==gi&&s!==io&&s!==Pn&&(i.#i|=Nl),r.unshift(i),r.provisional++,i}#A(e,r){for(let n=r.provisional;n<r.length;n++){let i=r[n];if((this.nocase?lh(e.name):Rl(e.name))===i.#b)return this.#j(e,i,n,r)}}#j(e,r,n,i){let s=r.name;return r.#i=r.#i&_l|nv(e),s!==e.name&&(r.name=e.name),n!==i.provisional&&(n===i.length-1?i.pop():i.splice(n,1),i.unshift(r)),i.provisional++,r}async lstat(){if((this.#i&Xn)===0)try{return this.#z(await this.#e.promises.lstat(this.fullpath())),this}catch(e){this.#$(e.code)}}lstatSync(){if((this.#i&Xn)===0)try{return this.#z(this.#e.lstatSync(this.fullpath())),this}catch(e){this.#$(e.code)}}#z(e){let{atime:r,atimeMs:n,birthtime:i,birthtimeMs:s,blksize:o,blocks:a,ctime:c,ctimeMs:l,dev:u,gid:d,ino:f,mode:p,mtime:m,mtimeMs:h,nlink:T,rdev:_,size:b,uid:v}=e;this.#k=r,this.#y=n,this.#R=i,this.#p=s,this.#d=o,this.#s=a,this.#N=c,this.#h=l,this.#t=u,this.#f=d,this.#c=f,this.#n=p,this.#g=m,this.#T=h,this.#r=T,this.#a=_,this.#l=b,this.#o=v;let k=nv(e);this.#i=this.#i&_l|k|XO,k!==Pn&&k!==gi&&k!==io&&(this.#i|=Nl)}#H=[];#V=!1;#W(e){this.#V=!1;let r=this.#H.slice();this.#H.length=0,r.forEach(n=>n(null,e))}readdirCB(e,r=!1){if(!this.canReaddir()){r?e(null,[]):queueMicrotask(()=>e(null,[]));return}let n=this.children();if(this.calledReaddir()){let s=n.slice(0,n.provisional);r?e(null,s):queueMicrotask(()=>e(null,s));return}if(this.#H.push(e),this.#V)return;this.#V=!0;let i=this.fullpath();this.#e.readdir(i,{withFileTypes:!0},(s,o)=>{if(s)this.#q(s.code),n.provisional=0;else{for(let a of o)this.#F(a,n);this.#x(n)}this.#W(n.slice(0,n.provisional))})}#U;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();if(this.#U)await this.#U;else{let n=()=>{};this.#U=new Promise(i=>n=i);try{for(let i of await this.#e.promises.readdir(r,{withFileTypes:!0}))this.#F(i,e);this.#x(e)}catch(i){this.#q(i.code),e.provisional=0}this.#U=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let r=this.fullpath();try{for(let n of this.#e.readdirSync(r,{withFileTypes:!0}))this.#F(n,e);this.#x(e)}catch(n){this.#q(n.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#i&JO)return!1;let e=Rn&this.#i;return e===Pn||e===gi||e===io}shouldWalk(e,r){return(this.#i&gi)===gi&&!(this.#i&JO)&&!e.has(this)&&(!r||r(this))}async realpath(){if(this.#D)return this.#D;if(!((uh|ch|Xn)&this.#i))try{let e=await this.#e.promises.realpath(this.fullpath());return this.#D=this.resolve(e)}catch{this.#w()}}realpathSync(){if(this.#D)return this.#D;if(!((uh|ch|Xn)&this.#i))try{let e=this.#e.realpathSync(this.fullpath());return this.#D=this.resolve(e)}catch{this.#w()}}[cx](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let r=new Set([]),n=[],i=this;for(;i&&i.parent;)r.add(i),i.#C=n.join(this.sep),i.#P=n.join("/"),i=i.parent,n.push("..");for(i=e;i&&i.parent&&!r.has(i);)i.#C=void 0,i.#P=void 0,i=i.parent}},fh=class t extends br{sep="\\";splitSep=ez;constructor(e,r=Pn,n,i,s,o,a){super(e,r,n,i,s,o,a)}newChild(e,r=Pn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return La.win32.parse(e).root}getRoot(e){if(e=ZV(e.toUpperCase()),e===this.root.name)return this.root;for(let[r,n]of Object.entries(this.roots))if(this.sameRoot(e,r))return this.roots[e]=n;return this.roots[e]=new qa(e,this).root}sameRoot(e,r=this.root.name){return e=e.toUpperCase().replace(/\//g,"\\").replace(rx,"$1\\"),e===r}},ph=class t extends br{splitSep="/";sep="/";constructor(e,r=Pn,n,i,s,o,a){super(e,r,n,i,s,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,r=Pn,n={}){return new t(e,r,this.root,this.roots,this.nocase,this.childrenCache(),n)}},hh=class{root;rootPath;roots;cwd;#e;#t;#n;nocase;#r;constructor(e=process.cwd(),r,n,{nocase:i,childrenCacheSize:s=16*1024,fs:o=kl}={}){this.#r=tx(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,ex.fileURLToPath)(e));let a=r.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#e=new dh,this.#t=new dh,this.#n=new iv(s);let c=a.substring(this.rootPath.length).split(n);if(c.length===1&&!c[0]&&c.pop(),i===void 0)throw new TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=i,this.root=this.newRoot(this.#r),this.roots[this.rootPath]=this.root;let l=this.root,u=c.length-1,d=r.sep,f=this.rootPath,p=!1;for(let m of c){let h=u--;l=l.child(m,{relative:new Array(h).fill("..").join(d),relativePosix:new Array(h).fill("..").join("/"),fullpath:f+=(p?"":d)+m}),p=!0}this.cwd=l}depth(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#n}resolve(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#e.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpath();return this.#e.set(r,i),i}resolvePosix(...e){let r="";for(let s=e.length-1;s>=0;s--){let o=e[s];if(!(!o||o===".")&&(r=r?`${o}/${r}`:o,this.isAbsolute(o)))break}let n=this.#t.get(r);if(n!==void 0)return n;let i=this.cwd.resolve(r).fullpathPosix();return this.#t.set(r,i),i}relative(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n}=r;if(e.canReaddir()){let i=await e.readdir();return n?i:i.map(s=>s.name)}else return[]}readdirSync(e=this.cwd,r={withFileTypes:!0}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0}=r;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(i=>i.name):[]}async lstat(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return typeof e=="string"&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=await e.readlink();return r?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return r?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=await e.realpath();return r?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:r}={withFileTypes:!1}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return r?n:n?.fullpath()}async walk(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set,l=(d,f)=>{c.add(d),d.readdirCB((p,m)=>{if(p)return f(p);let h=m.length;if(!h)return f();let T=()=>{--h===0&&f()};for(let _ of m)(!s||s(_))&&a.push(n?_:_.fullpath()),i&&_.isSymbolicLink()?_.realpath().then(b=>b?.isUnknown()?b.lstat():b).then(b=>b?.shouldWalk(c,o)?l(b,T):T()):_.shouldWalk(c,o)?l(_,T):T()},!0)},u=e;return new Promise((d,f)=>{l(u,p=>{if(p)return f(p);d(a)})})}walkSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=[];(!s||s(e))&&a.push(n?e:e.fullpath());let c=new Set([e]);for(let l of c){let u=l.readdirSync();for(let d of u){(!s||s(d))&&a.push(n?d:d.fullpath());let f=d;if(d.isSymbolicLink()){if(!(i&&(f=d.realpathSync())))continue;f.isUnknown()&&f.lstatSync()}f.shouldWalk(c,o)&&c.add(f)}}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,r={}){return typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd),this.stream(e,r)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r;(!s||s(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let c of a){let l=c.readdirSync();for(let u of l){(!s||s(u))&&(yield n?u:u.fullpath());let d=u;if(u.isSymbolicLink()){if(!(i&&(d=u.realpathSync())))continue;d.isUnknown()&&d.lstatSync()}d.shouldWalk(a,o)&&a.add(d)}}}stream(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({objectMode:!0});(!s||s(e))&&a.write(n?e:e.fullpath());let c=new Set,l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=(T,_,b=!1)=>{if(T)return a.emit("error",T);if(i&&!b){let v=[];for(let k of _)k.isSymbolicLink()&&v.push(k.realpath().then(w=>w?.isUnknown()?w.lstat():w));if(v.length){Promise.all(v).then(()=>m(null,_,!0));return}}for(let v of _)v&&(!s||s(v))&&(a.write(n?v:v.fullpath())||(f=!0));u--;for(let v of _){let k=v.realpathCached()||v;k.shouldWalk(c,o)&&l.push(k)}f&&!a.flowing?a.once("drain",d):h||d()},h=!0;p.readdirCB(m,!0),h=!1}};return d(),a}streamSync(e=this.cwd,r={}){typeof e=="string"?e=this.cwd.resolve(e):e instanceof br||(r=e,e=this.cwd);let{withFileTypes:n=!0,follow:i=!1,filter:s,walkFilter:o}=r,a=new ys({objectMode:!0}),c=new Set;(!s||s(e))&&a.write(n?e:e.fullpath());let l=[e],u=0,d=()=>{let f=!1;for(;!f;){let p=l.shift();if(!p){u===0&&a.end();return}u++,c.add(p);let m=p.readdirSync();for(let h of m)(!s||s(h))&&(a.write(n?h:h.fullpath())||(f=!0));u--;for(let h of m){let T=h;if(h.isSymbolicLink()){if(!(i&&(T=h.realpathSync())))continue;T.isUnknown()&&T.lstatSync()}T.shouldWalk(c,o)&&l.push(T)}}f&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let r=this.cwd;this.cwd=typeof e=="string"?this.cwd.resolve(e):e,this.cwd[cx](r)}},qa=class extends hh{sep="\\";constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,La.win32,"\\",{...r,nocase:n}),this.nocase=n;for(let i=this.cwd;i;i=i.parent)i.nocase=this.nocase}parseRootPath(e){return La.win32.parse(e).root.toUpperCase()}newRoot(e){return new fh(this.rootPath,gi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}},$a=class extends hh{sep="/";constructor(e=process.cwd(),r={}){let{nocase:n=!1}=r;super(e,La.posix,"/",{...r,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new ph(this.rootPath,gi,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}},Pl=class extends $a{constructor(e=process.cwd(),r={}){let{nocase:n=!0}=r;super(e,{...r,nocase:n})}},XNe=process.platform==="win32"?fh:ph,lx=process.platform==="win32"?qa:process.platform==="darwin"?Pl:$a;var rz=t=>t.length>=1,nz=t=>t.length>=1,Fa=class t{#e;#t;#n;length;#r;#o;#f;#a;#d;#c;#l=!0;constructor(e,r,n,i){if(!rz(e))throw new TypeError("empty pattern list");if(!nz(r))throw new TypeError("empty glob list");if(r.length!==e.length)throw new TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw new TypeError("index out of range");if(this.#e=e,this.#t=r,this.#n=n,this.#r=i,this.#n===0){if(this.isUNC()){let[s,o,a,c,...l]=this.#e,[u,d,f,p,...m]=this.#t;l[0]===""&&(l.shift(),m.shift());let h=[s,o,a,c,""].join("/"),T=[u,d,f,p,""].join("/");this.#e=[h,...l],this.#t=[T,...m],this.length=this.#e.length}else if(this.isDrive()||this.isAbsolute()){let[s,...o]=this.#e,[a,...c]=this.#t;o[0]===""&&(o.shift(),c.shift());let l=s+"/",u=a+"/";this.#e=[l,...o],this.#t=[u,...c],this.length=this.#e.length}}}pattern(){return this.#e[this.#n]}isString(){return typeof this.#e[this.#n]=="string"}isGlobstar(){return this.#e[this.#n]===sr}isRegExp(){return this.#e[this.#n]instanceof RegExp}globString(){return this.#f=this.#f||(this.#n===0?this.isAbsolute()?this.#t[0]+this.#t.slice(1).join("/"):this.#t.join("/"):this.#t.slice(this.#n).join("/"))}hasMore(){return this.length>this.#n+1}rest(){return this.#o!==void 0?this.#o:this.hasMore()?(this.#o=new t(this.#e,this.#t,this.#n+1,this.#r),this.#o.#c=this.#c,this.#o.#d=this.#d,this.#o.#a=this.#a,this.#o):this.#o=null}isUNC(){let e=this.#e;return this.#d!==void 0?this.#d:this.#d=this.#r==="win32"&&this.#n===0&&e[0]===""&&e[1]===""&&typeof e[2]=="string"&&!!e[2]&&typeof e[3]=="string"&&!!e[3]}isDrive(){let e=this.#e;return this.#a!==void 0?this.#a:this.#a=this.#r==="win32"&&this.#n===0&&this.length>1&&typeof e[0]=="string"&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#e;return this.#c!==void 0?this.#c:this.#c=e[0]===""&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#e[0];return typeof e=="string"&&this.isAbsolute()&&this.#n===0?e:""}checkFollowGlobstar(){return!(this.#n===0||!this.isGlobstar()||!this.#l)}markFollowGlobstar(){return this.#n===0||!this.isGlobstar()||!this.#l?!1:(this.#l=!1,!0)}};var iz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Ba=class{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:r,nocase:n,noext:i,noglobstar:s,platform:o=iz}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:r,nocase:n,noext:i,noglobstar:s,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0};for(let a of e)this.add(a)}add(e){let r=new an(e,this.mmopts);for(let n=0;n<r.set.length;n++){let i=r.set[n],s=r.globParts[n];if(!i||!s)throw new Error("invalid pattern object");for(;i[0]==="."&&s[0]===".";)i.shift(),s.shift();let o=new Fa(i,s,0,this.platform),a=new an(o.globString(),this.mmopts),c=s[s.length-1]==="**",l=o.isAbsolute();l?this.absolute.push(a):this.relative.push(a),c&&(l?this.absoluteChildren.push(a):this.relativeChildren.push(a))}}ignored(e){let r=e.fullpath(),n=`${r}/`,i=e.relative()||".",s=`${i}/`;for(let o of this.relative)if(o.match(i)||o.match(s))return!0;for(let o of this.absolute)if(o.match(r)||o.match(n))return!0;return!1}childrenIgnored(e){let r=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let i of this.relativeChildren)if(i.match(n))return!0;for(let i of this.absoluteChildren)if(i.match(r))return!0;return!1}};var sv=class t{store;constructor(e=new Map){this.store=e}copy(){return new t(new Map(this.store))}hasWalked(e,r){return this.store.get(e.fullpath())?.has(r.globString())}storeWalked(e,r){let n=e.fullpath(),i=this.store.get(n);i?i.add(r.globString()):this.store.set(n,new Set([r.globString()]))}},ov=class{store=new Map;add(e,r,n){let i=(r?2:0)|(n?1:0),s=this.store.get(e);this.store.set(e,s===void 0?i:i&s)}entries(){return[...this.store.entries()].map(([e,r])=>[e,!!(r&2),!!(r&1)])}},av=class{store=new Map;add(e,r){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(i=>i.globString()===r.globString())||n.push(r):this.store.set(e,[r])}get(e){let r=this.store.get(e);if(!r)throw new Error("attempting to walk unknown path");return r}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}},El=class t{hasWalkedCache;matches=new ov;subwalks=new av;patterns;follow;dot;opts;constructor(e,r){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=r?r.copy():new sv}processPatterns(e,r){this.patterns=r;let n=r.map(i=>[e,i]);for(let[i,s]of n){this.hasWalkedCache.storeWalked(i,s);let o=s.root(),a=s.isAbsolute()&&this.opts.absolute!==!1;if(o){i=i.resolve(o==="/"&&this.opts.root!==void 0?this.opts.root:o);let d=s.rest();if(d)s=d;else{this.matches.add(i,!0,!1);continue}}if(i.isENOENT())continue;let c,l,u=!1;for(;typeof(c=s.pattern())=="string"&&(l=s.rest());)i=i.resolve(c),s=l,u=!0;if(c=s.pattern(),l=s.rest(),u){if(this.hasWalkedCache.hasWalked(i,s))continue;this.hasWalkedCache.storeWalked(i,s)}if(typeof c=="string"){let d=c===".."||c===""||c===".";this.matches.add(i.resolve(c),a,d);continue}else if(c===sr){(!i.isSymbolicLink()||this.follow||s.checkFollowGlobstar())&&this.subwalks.add(i,s);let d=l?.pattern(),f=l?.rest();if(!l||(d===""||d===".")&&!f)this.matches.add(i,a,d===""||d===".");else if(d===".."){let p=i.parent||i;f?this.hasWalkedCache.hasWalked(p,f)||this.subwalks.add(p,f):this.matches.add(p,a,!0)}}else c instanceof RegExp&&this.subwalks.add(i,s)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new t(this.opts,this.hasWalkedCache)}filterEntries(e,r){let n=this.subwalks.get(e),i=this.child();for(let s of r)for(let o of n){let a=o.isAbsolute(),c=o.pattern(),l=o.rest();c===sr?i.testGlobstar(s,o,l,a):c instanceof RegExp?i.testRegExp(s,c,l,a):i.testString(s,c,l,a)}return i}testGlobstar(e,r,n,i){if((this.dot||!e.name.startsWith("."))&&(r.hasMore()||this.matches.add(e,i,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,r):e.isSymbolicLink()&&(n&&r.checkFollowGlobstar()?this.subwalks.add(e,n):r.markFollowGlobstar()&&this.subwalks.add(e,r)))),n){let s=n.pattern();if(typeof s=="string"&&s!==".."&&s!==""&&s!==".")this.testString(e,s,n.rest(),i);else if(s===".."){let o=e.parent||e;this.subwalks.add(o,n)}else s instanceof RegExp&&this.testRegExp(e,s,n.rest(),i)}}testRegExp(e,r,n,i){r.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}testString(e,r,n,i){e.isNamed(r)&&(n?this.subwalks.add(e,n):this.matches.add(e,i,!1))}};var sz=(t,e)=>typeof t=="string"?new Ba([t],e):Array.isArray(t)?new Ba(t,e):t,mh=class{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#e=[];#t;#n;signal;maxDepth;includeChildMatches;constructor(e,r,n){if(this.patterns=e,this.path=r,this.opts=n,this.#n=!n.posix&&n.platform==="win32"?"\\":"/",this.includeChildMatches=n.includeChildMatches!==!1,(n.ignore||!this.includeChildMatches)&&(this.#t=sz(n.ignore??[],n),!this.includeChildMatches&&typeof this.#t.add!="function")){let i="cannot ignore child matches, ignore lacks add() method.";throw new Error(i)}this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#e.length=0}))}#r(e){return this.seen.has(e)||!!this.#t?.ignored?.(e)}#o(e){return!!this.#t?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let e;for(;!this.paused&&(e=this.#e.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#e.push(e):e())}async matchCheck(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||await e.realpath(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=await s.realpath();o&&(o.isUnknown()||this.opts.stat)&&await o.lstat()}return this.matchCheckTest(s,r)}matchCheckTest(e,r){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!r||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#r(e)?e:void 0}matchCheckSync(e,r){if(r&&this.opts.nodir)return;let n;if(this.opts.realpath){if(n=e.realpathCached()||e.realpathSync(),!n)return;e=n}let s=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&s?.isSymbolicLink()){let o=s.realpathSync();o&&(o?.isUnknown()||this.opts.stat)&&o.lstatSync()}return this.matchCheckTest(s,r)}matchFinish(e,r){if(this.#r(e))return;if(!this.includeChildMatches&&this.#t?.add){let s=`${e.relativePosix()}/**`;this.#t.add(s)}let n=this.opts.absolute===void 0?r:this.opts.absolute;this.seen.add(e);let i=this.opts.mark&&e.isDirectory()?this.#n:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let s=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(s+i)}else{let s=this.opts.posix?e.relativePosix():e.relative(),o=this.opts.dotRelative&&!s.startsWith(".."+this.#n)?"."+this.#n:"";this.matchEmit(s?o+s+i:"."+i)}}async match(e,r,n){let i=await this.matchCheck(e,n);i&&this.matchFinish(i,r)}matchSync(e,r,n){let i=this.matchCheckSync(e,n);i&&this.matchFinish(i,r)}walkCB(e,r,n){this.signal?.aborted&&n(),this.walkCB2(e,r,new El(this.opts),n)}walkCB2(e,r,n,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||(s++,this.match(a,c,l).then(()=>o()));for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirCached();a.calledReaddir()?this.walkCB3(a,c,n,o):a.readdirCB((l,u)=>this.walkCB3(a,u,n,o),!0)}o()}walkCB3(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||(s++,this.match(a,c,l).then(()=>o()));for(let[a,c]of n.subwalks.entries())s++,this.walkCB2(a,c,n.child(),o);o()}walkCBSync(e,r,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,r,new El(this.opts),n)}walkCB2Sync(e,r,n,i){if(this.#o(e))return i();if(this.signal?.aborted&&i(),this.paused){this.onResume(()=>this.walkCB2Sync(e,r,n,i));return}n.processPatterns(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||this.matchSync(a,c,l);for(let a of n.subwalkTargets()){if(this.maxDepth!==1/0&&a.depth()>=this.maxDepth)continue;s++;let c=a.readdirSync();this.walkCB3Sync(a,c,n,o)}o()}walkCB3Sync(e,r,n,i){n=n.filterEntries(e,r);let s=1,o=()=>{--s===0&&i()};for(let[a,c,l]of n.matches.entries())this.#r(a)||this.matchSync(a,c,l);for(let[a,c]of n.subwalks.entries())s++,this.walkCB2Sync(a,c,n.child(),o);o()}},wl=class extends mh{matches=new Set;constructor(e,r,n){super(e,r,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,r)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?r(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}},Cl=class extends mh{results;constructor(e,r,n){super(e,r,n),this.results=new ys({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}};var oz=typeof process=="object"&&process&&typeof process.platform=="string"?process.platform:"linux",Jn=class{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,r){if(!r)throw new TypeError("glob options required");if(this.withFileTypes=!!r.withFileTypes,this.signal=r.signal,this.follow=!!r.follow,this.dot=!!r.dot,this.dotRelative=!!r.dotRelative,this.nodir=!!r.nodir,this.mark=!!r.mark,r.cwd?(r.cwd instanceof URL||r.cwd.startsWith("file://"))&&(r.cwd=(0,ux.fileURLToPath)(r.cwd)):this.cwd="",this.cwd=r.cwd||"",this.root=r.root,this.magicalBraces=!!r.magicalBraces,this.nobrace=!!r.nobrace,this.noext=!!r.noext,this.realpath=!!r.realpath,this.absolute=r.absolute,this.includeChildMatches=r.includeChildMatches!==!1,this.noglobstar=!!r.noglobstar,this.matchBase=!!r.matchBase,this.maxDepth=typeof r.maxDepth=="number"?r.maxDepth:1/0,this.stat=!!r.stat,this.ignore=r.ignore,this.withFileTypes&&this.absolute!==void 0)throw new Error("cannot set absolute and withFileTypes:true");if(typeof e=="string"&&(e=[e]),this.windowsPathsNoEscape=!!r.windowsPathsNoEscape||r.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(e=e.map(c=>c.replace(/\\/g,"/"))),this.matchBase){if(r.noglobstar)throw new TypeError("base matching requires globstar");e=e.map(c=>c.includes("/")?c:`./**/${c}`)}if(this.pattern=e,this.platform=r.platform||oz,this.opts={...r,platform:this.platform},r.scurry){if(this.scurry=r.scurry,r.nocase!==void 0&&r.nocase!==r.scurry.nocase)throw new Error("nocase option contradicts provided scurry option")}else{let c=r.platform==="win32"?qa:r.platform==="darwin"?Pl:r.platform?$a:lx;this.scurry=new c(this.cwd,{nocase:r.nocase,fs:r.fs})}this.nocase=this.scurry.nocase;let n=this.platform==="darwin"||this.platform==="win32",i={...r,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},s=this.pattern.map(c=>new an(c,i)),[o,a]=s.reduce((c,l)=>(c[0].push(...l.set),c[1].push(...l.globParts),c),[[],[]]);this.patterns=o.map((c,l)=>{let u=a[l];if(!u)throw new Error("invalid pattern object");return new Fa(c,u,0,this.platform)})}async walk(){return[...await new wl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new wl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new Cl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new Cl(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}};var cv=(t,e={})=>{Array.isArray(t)||(t=[t]);for(let r of t)if(new an(r,e).hasMagic())return!0;return!1};function gh(t,e={}){return new Jn(t,e).streamSync()}function fx(t,e={}){return new Jn(t,e).stream()}function px(t,e={}){return new Jn(t,e).walkSync()}async function dx(t,e={}){return new Jn(t,e).walk()}function yh(t,e={}){return new Jn(t,e).iterateSync()}function hx(t,e={}){return new Jn(t,e).iterate()}var az=gh,cz=Object.assign(fx,{sync:gh}),lz=yh,uz=Object.assign(hx,{sync:yh}),dz=Object.assign(px,{stream:gh,iterate:yh}),so=Object.assign(dx,{glob:dx,globSync:px,sync:dz,globStream:fx,stream:cz,globStreamSync:gh,streamSync:az,globIterate:hx,iterate:uz,globIterateSync:yh,iterateSync:lz,Glob:Jn,hasMagic:cv,escape:Aa,unescape:Kn});so.glob=so;var z_=q(Hb()),sF=q(rF());var U_={};QF(U_,{$id:()=>i6,$schema:()=>n6,default:()=>l6,definitions:()=>o6,properties:()=>c6,title:()=>s6,type:()=>a6});var n6="http://json-schema.org/draft-07/schema#",i6="http://json-schema.org/draft-07/schema#",s6="Core schema meta-schema",o6={schemaArray:{type:"array",minItems:1,items:{$ref:"#"}},nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{allOf:[{$ref:"#/definitions/nonNegativeInteger"},{default:0}]},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}},a6=["object","boolean"],c6={$id:{type:"string",format:"uri-reference"},$schema:{type:"string",format:"uri"},$ref:{type:"string",format:"uri-reference"},$comment:{type:"string"},title:{type:"string"},description:{type:"string"},default:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/definitions/nonNegativeInteger"},minLength:{$ref:"#/definitions/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},additionalItems:{$ref:"#"},items:{anyOf:[{$ref:"#"},{$ref:"#/definitions/schemaArray"}],default:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},contains:{$ref:"#"},maxProperties:{$ref:"#/definitions/nonNegativeInteger"},minProperties:{$ref:"#/definitions/nonNegativeIntegerDefault0"},required:{$ref:"#/definitions/stringArray"},additionalProperties:{$ref:"#"},definitions:{type:"object",additionalProperties:{$ref:"#"},default:{}},properties:{type:"object",additionalProperties:{$ref:"#"},default:{}},patternProperties:{type:"object",additionalProperties:{$ref:"#"},propertyNames:{format:"regex"},default:{}},dependencies:{type:"object",additionalProperties:{anyOf:[{$ref:"#"},{$ref:"#/definitions/stringArray"}]}},propertyNames:{$ref:"#"},const:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},format:{type:"string"},contentMediaType:{type:"string"},contentEncoding:{type:"string"},if:{$ref:"#"},then:{$ref:"#"},else:{$ref:"#"},allOf:{$ref:"#/definitions/schemaArray"},anyOf:{$ref:"#/definitions/schemaArray"},oneOf:{$ref:"#/definitions/schemaArray"},not:{$ref:"#"}},l6={$schema:n6,$id:i6,title:s6,definitions:o6,type:a6,properties:c6,default:!0};var ln=q(j());var Ym=class extends jc{constructor(r,n){super();this.ajv=r;this.schemaKey=n;this.validate=this.ajv.getSchema(this.schemaKey)}getIssue(r,n){let i=[];if(n.disabled){let o=n.getProperty("status");return[...n.definitions,...n.referencedBy].forEach(a=>i.push(F(21,a.firstToken,a.lastToken,a,{severity:ln.DiagnosticSeverity.Hint,linkedTo:[...o?.ast?[o?.ast]:[]],tags:[ln.DiagnosticTag.Unnecessary]}))),i}let s=X.toJson(n);try{this.validate?(this.validate(s),this.validate.errors&&(this.validate.errors.forEach(o=>i.push(...u6(r,o,n,this.schemaKey))),console.log(this.schemaKey,`${n.pathString}`,this.validate.errors,s))):console.log("no validate")}catch(o){console.log(this.schemaKey,`${n.pathString}`,this.schemaKey,o)}return i}getOnPropertyHover(r){let n=(this.validate?.schema).properties?.[r];if(n&&typeof n=="object"&&"description"in n)return{kind:ln.MarkupKind.Markdown,value:[...n.description?["### Description",Array.isArray(n.description)?n.description.join(`
|
|
303
303
|
|
|
304
304
|
`):n.description]:[]].join(`
|
|
305
305
|
`)}}getSignatureHelp(){}getPropertyListCompletionItems(r){let n=Object.keys((this.validate?.schema).properties),i=(this.validate?.schema).required;return n.map(s=>{let o=r&&i.some(l=>l===s),a=!!r.properties.some(l=>s===l.name),c="a";return o?c=a?"Y":"!":c=a?"Z":"B",{label:`${s}`,kind:ln.CompletionItemKind.Property,sortText:`${c}${s}`}})??[]}},u6=(t,e,r,n)=>{let i=d6(r,e.instancePath),s=i.node;if(e.keyword==="additionalProperties"){let a=s.getProperty(e.params.additionalProperty);return a?[F(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`Node "${s.name}" ${e.message}: ${a.name}`],edit:ln.TextEdit.del(tn(a.ast.firstToken.prevToken,a.ast.lastToken,!1)),codeActionTitle:"Remove property"})]:[]}else if(e.keyword==="type"){let a=s.getProperty(e.instancePath.split("/")[1]);return a?[F(25,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:[`"${a.name}" ${e.message??"NO MESSAGE"}`]})]:(console.warn("unable to find property in node",e),[])}else if(e.keyword==="required"){let a=e.params.missingProperty,c=t.getOrderedNodeAst(s),l=sa(c);return c.map((u,d)=>{let f=l[d],p=u.openScope??f.lastToken;return F(0,f.firstToken,f.lastToken,f,{templateStrings:[a],edit:ln.TextEdit.insert(ln.Position.create(p.pos.line,p.pos.col+1),`
|
|
@@ -310,4 +310,4 @@ ${n}`]})]:[]}else if(e.keyword==="maxItems"||e.keyword==="minItems"){let a=s.get
|
|
|
310
310
|
${JSON.stringify(e)}
|
|
311
311
|
${n}`]})];let o=i.node.definitions[0]instanceof Ot?i.node.definitions[0]:i.node.definitions[0].name??i.node.definitions[0];return[F(25,o.firstToken,o.lastToken,o,{templateStrings:[`${e.message??"NO MESSAGE"}:
|
|
312
312
|
${JSON.stringify(e)}
|
|
313
|
-
${n}`]})]},d6=(t,e)=>nF(t,e.split("/").filter(r=>r)),nF=(t,e)=>{if(e.length===0)return{node:t,remainingInstancePath:""};let r=e[0].split("@"),n=r[0],i=r.at(1)?.split(",").map(o=>Number.parseInt(o,16)),s=t.getNode(n,i);return s?nF(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var W_=class t{constructor(){this.schemaIdValidators=new Map;this.ajvMap=new Map}static getNodeCompatible(e){let n=e.getProperty("compatible")?.ast.values;if(!n?.values.some(i=>!(i?.value instanceof ne)))return n?.values.map(i=>(i?.value).value)}parseMetaSchema(e,r){so.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,H_.resolve)(e,i);try{let s=z_.default.parse((0,V_.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){so.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,H_.resolve)(e,i);try{let s=z_.default.parse((0,V_.readFileSync)(i,"utf-8"));r.addSchema(s),this.schemaIdValidators.set(s.$id,i)}catch(s){console.warn(i,s.message)}})}getNodeTypes(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);return s||(s=new sF.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(U_),this.ajvMap.set(i,s),e.forEach(c=>this.parseMetaSchema(c,s)),r.forEach(c=>this.parseBindings(c,s))),t.getNodeCompatible(n)?.map(c=>{try{let l=Array.from(this.schemaIdValidators.keys()).find(f=>f.endsWith(`/${c}.yaml#`));if(!l)return;let u=new Ym(s,l);u.bindingsPath=this.schemaIdValidators.get(l),u.compatible=c;let d=s.getSchema(l);return u.description=(d?.schema).description,u.examples=(d?.schema).examples,u.maintainers=(d?.schema).maintainers,u}catch(l){console.warn(l.message)}}).filter(c=>c)??[]}getBindings(){return Array.from(this.schemaIdValidators.keys())}},iF,G_=()=>(iF??=new W_,iF);var Po=q(require("path")),fF=require("fs"),pF=q(require("path")),hF=q(Hb());var In=q(j());var oF=()=>{let t=new Y("nonposted-mmio",z("EMPTY"),"optional");return t.description=["Specifies that direct children of this bus should use non-posted memory accesses (i.e. a non-posted mapping mode) for MMIO ranges."],t};function aF(){let t=gr();t.noMismatchPropertiesAllowed=!0;let e=t.properties.find(n=>n.name==="compatible");e.required=()=>"required";let r=t.properties.find(n=>n.name==="ranges");return r.required=()=>"required",t.addProperty(oF()),t}var cF=t=>{switch(t){case"string":return z("STRING");case"int":return z("U32");case"boolean":return z("EMPTY");case"array":return z("PROP_ENCODED_ARRAY");case"uint8-array":return z("BYTESTRING");case"string-array":return z("STRINGLIST");case"phandle":return z("U32");case"phandles":return z("PROP_ENCODED_ARRAY");case"phandle-array":return z("PROP_ENCODED_ARRAY");case"path":return z(["STRING","U32"]);case"compound":return z("ANY");default:return z("ANY")}},lF=(t,e)=>{switch(t){case"string":return typeof e=="string"?e:void 0;case"int":return typeof e=="number"?e:void 0;case"boolean":return;case"array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"uint8-array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"string-array":return Array.isArray(e)&&e.every(r=>typeof r=="string")?e:void 0;case"phandle":return;case"phandles":return;case"phandle-array":return;case"path":return;case"compound":return}},Xm=(t,e)=>{if(e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,Po.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];e.extends?.push(...r.include.map(c=>(0,Po.basename)(c.name,".yaml")));let a=n["child-binding"];return r.include=r.include.filter(c=>c!==n),mF(t,i,r,s,o,a)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]&&(e["child-binding"].include=gF(e["child-binding"].include),e["child-binding"]=Xm(t,e["child-binding"])),!e.include.length)return e},mF=(t,e,r,n=[],i,s)=>{let o=Xm(t,e),a=Xm(t,r);if(!o||!a)return;let c=new Set;Object.keys(o?.properties??{}).forEach(p=>c.add(p)),Object.keys(a?.properties??{}).forEach(p=>c.add(p));let l={};Array.from(c).forEach(p=>{let m=n?.some(T=>T===p)||i&&!i.some(T=>T===p)?void 0:o.properties?.[p]??void 0,h=a.properties?.[p]??void 0;(m||h)&&(l={...l,[p]:{...m??{},...h}})}),a.properties=l,a.extends??=[],a.extends.push(...o.extends??[]);let u=new Set;return Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Array.from(u).forEach(p=>{let m=o[p]??[],h=a[p]??[];a[p]=Array.from([...m,...h])}),a["on-bus"]??=o["on-bus"],a.bus?a.bus.push(...o.bus??[]):a.bus=o.bus,o["child-binding"]&&(a["child-binding"]??={filePath:a.filePath,include:[],rawInclude:[]},mF(t,o["child-binding"],a["child-binding"],s?.["property-blocklist"],s?.["property-allowlist"],s?.["child-binding"])),a},gF=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],K_=class t{constructor(){this.typeCache=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}getBaseZephyrType(e){let r=e.split(":");return Array.from(this.zephyrBindingCache.keys()).filter(i=>r.some(s=>i.startsWith(s))).flatMap(i=>this.zephyrBindingCache.get(i)).find(i=>i.filePath.endsWith(`${Po.default.sep}base.yaml`))}getBaseNodeType(e,r){let n=this.getBaseZephyrType(r),i=n?Jm(n,e):void 0;if(i){i.warnMismatchProperties=!1;let s=i.properties.find(o=>o.name==="compatible");s&&(s.required=()=>"optional")}return i}static getNodeCompatible(e){let i=e.getProperty("compatible")?.ast.values?.values.filter(s=>s&&s.value instanceof ne);if(i?.length)return i.map(s=>s?.value?{name:s.value.value,ast:s.value}:void 0)}getNodeTypes(e,r){let n=t.getNodeCompatible(e)?.filter(a=>a),i=n?.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c))??[];if(i.length===0){let a=r.split(":"),l=Array.from(this.zephyrBindingCache.keys()).filter(d=>a.some(f=>d.startsWith(f))).flatMap(d=>this.zephyrBindingCache.get(d)).find(d=>d.filePath.endsWith("/base.yaml")),u=l?Jm(l,e):void 0;if(u){u.warnMismatchProperties=!1;let d=u.properties.find(f=>f.name==="compatible");d&&(d.required=()=>"optional")}return{type:[u??Zs(e)],issues:[]}}let s=this.getBusTypes(),o=n?.flatMap(a=>{let c=t.getCompatibleKeys(a.name,e.parent).some(l=>this.typeCache.get(r)?.has(l));if(!c){let l=s.filter(u=>this.typeCache.get(r)?.has(`${a.name}::${u}`));if(l.length)return F(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[F(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:In.DiagnosticSeverity.Hint,tags:[In.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]})??[];return{type:i.length?i:[Zs(e)],issues:o}}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(o=>this.processedFolders.has(o)).flatMap(o=>Array.from(this.zephyrBindingCache.entries()).flatMap(([a,c])=>a.startsWith(o)?[c]:[]));n.push(...e.filter(o=>!this.processedFolders.has(o)).flatMap(o=>(this.processedFolders.add(o),so.sync("**/*.yaml",{cwd:o,ignore:"test/*"}).map(c=>{if(c=(0,Po.resolve)(o,c),this.zephyrBindingCache.has(c))return this.zephyrBindingCache.get(c);try{let l=hF.default.parse((0,fF.readFileSync)(c,"utf-8")),u=gF(l?.include),d={...l,bus:l.bus?Array.isArray(l.bus)?l.bus:[l.bus]:void 0,include:u,rawInclude:[...u],filePath:c};return this.zephyrBindingCache.set(c,d),d}catch(l){console.warn(l)}}).filter(c=>!!c))));let i=n.map(o=>Xm(n,o)).filter(o=>!!o&&!o.include.length),s=this.typeCache.get(r);if(s||(s=new Map,this.typeCache.set(r,s)),f6(i,s),!s.has("simple-bus")){let o=this.getBaseZephyrType(r);if(o)return{type:[p6(o)],issues:[]}}}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(r=>r.bus?.filter(n=>!!n)??[]).filter(r=>!!r);return Array.from(new Set(e))}getDocumentLinks(e,r){let n=this.zephyrBindingCache.get(Pe(e.uri));if(!n)return[];let i=e.getText();return n.rawInclude.map(o=>{let c=new RegExp(o.name).exec(i);if(c){let l=e.positionAt(c.index),u=e.positionAt(c.index+c[0].length),d=Array.from(this.zephyrBindingCache.keys()).find(f=>f.endsWith(`${pF.default.sep}${o.name}`)&&r.some(p=>f.startsWith(p)));return d?{range:In.Range.create(l,u),target:ue(d)}:void 0}}).filter(o=>!!o)}resetCache(e){this.typeCache.delete(e)}},uF,Eo=()=>(uF??=new K_,uF),f6=(t,e)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,n=>Jm(r,n))}),Jm=(t,e)=>{let r=Zs(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(s=>r.extends.add(s)),r.warnMismatchProperties=!0;let i=Object.keys(t).filter(s=>s.endsWith("-cells")).map(s=>({specifier:s.replace(/-cells$/,""),values:t[s]}));if(r.cellsValues=i,Object.entries(t.properties??{}).forEach(([s,o])=>{yF(r,s,o)}),t["child-binding"]){let s=t["child-binding"];r.childNodeType=o=>Jm(s,o)}return r},p6=t=>{let e=aF();e.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),e.onBus=t["on-bus"],t.extends?.forEach(i=>e.extends.add(i)),e.warnMismatchProperties=!0;let n=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=n,Object.entries(t.properties??{}).forEach(([i,s])=>{yF(e,i,s)}),e},yF=(t,e,r)=>{let n=t.properties.find(i=>i.getNameMatch(e));if(n&&typeof n.name=="string"){n.name!=="reg"?n.required=()=>r.required?"required":"optional":r.required&&(n.required=()=>"required"),n.values=()=>r.enum??[],n.constValue=lF(r.type,r.const),n.bindingType=r.type;let i=n.additionalTypeCheck;n.additionalTypeCheck=(s,o)=>[...dF(r,e,n)(s,o),...i?.(s,o)??[]]}else{let i=r.type==="compound"?n?.type:cF(r.type);i??=cF(r.type);let s=new Y(e,i,r.required?"required":"optional",void 0,r.enum);s.additionalTypeCheck=(o,a)=>{let c=[...n?.additionalTypeCheck?.(o,a)??[],...dF(r,e,s)(o,a)];return s.signatureArgs??=n?.signatureArgs,s.signatureArgsCyclic??=!!n?.signatureArgsCyclic,c},s.description=r.description?[r.description]:n?.description,s.bindingType=r.type,s.constValue=lF(r.type,r.const),t.addProperty(s)}},dF=(t,e,r)=>{let n=t;return(i,s)=>{let o=i.parent.root,a=[];if(n.const){let l=i.ast.quickValues;if(l?.length==1){let u=Array.isArray(n.const)?n.const:[n.const];if(!(Array.isArray(l[0])&&u.length===l[0].length&&l[0].every((f,p)=>typeof f=="number"&&Number.isNaN(f)||u[p]===f))){let f=i.ast.values??i.ast;a.push(F(24,f.firstToken,f.lastToken,f,{templateStrings:[`Binding expects values to be "${n.type}" with value: ${n.const}`]}))}}}if(n.deprecated&&a.push(F(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:In.DiagnosticSeverity.Warning,tags:[In.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="phandle"||n.type==="phandles"||n.type==="path")&&Le(i.ast.values)?.forEach(u=>{vn(u,o)||a.push(F(22,u.firstToken,u.lastToken,u))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let l=i.ast.values?.values.at(0)?.value,u=[];l.value.split("/").every(d=>{let f=o.getNode(d);return f?u.push(d):a.push(F(23,l.firstToken,l.lastToken,l,{templateStrings:[d,`/${u.join("/")}`]})),!f})}let c=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=n["specifier-space"]??c[1];let u=Number.parseInt(c[2],10),d=i.parent.getProperty(`${l}-names`);d&&(d.ast.quickValues?.at(u)||a.push(F(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:In.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(n.type==="phandle-array"){let l=Le(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=vn(p,o);if(!m){let O=p??i.ast;a.push(F(22,O.firstToken,O.lastToken,O));break}let h="";e.endsWith("-gpios")?h="gpio":h=n["specifier-space"]??e.slice(0,-1);let T=m.getProperty(`#${h}-cells`);if(!T){a.push(F(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...m.nodeNameOrLabelRef],templateStrings:[i.name,`#${h}-cells`,`/${m.path.slice(1).join("/")}`]}));break}let _=T?Be(T,0,0,s)??0:0,b=m.nodeType?.cellsValues?.find(O=>O.specifier===h)?.values;if(d.push([`${f}_phandle`,...b?.map(O=>`${f}_${O}`)??[],...Array.from({length:_-(b?.length??0)},(O,B)=>`${f}_cell${_-(b?.length??0)?B:""}`)]),1+_>l.length-u){let O=p??i.ast;a.push(F(19,O.firstToken,O.lastToken,O,{templateStrings:[i.name,`<${d.at(-1).join(" ")}>`]}));break}u+=1+_;let v=l.slice(u-_,u),k={mappingValuesAst:v,specifierSpace:h,target:m};i.nexusMapsTo.push(k);let w=m.getProperty(`${h}-map`);if(w){let O=m.getNexusMapEntryMatch(h,s,v);O?.match?k.mapItem=O.match:a.push(F(31,O.entry.firstToken,O.entry.lastToken,O.entry,{linkedTo:[w.ast]}))}v.every(O=>O instanceof ge)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i});let H=i.parent.getProperty(`${h}-names`);p&&H&&(H.ast.quickValues?.at(f)||a.push(F(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:In.DiagnosticSeverity.Warning,linkedTo:[H.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),r.signatureArgs=d.map(p=>p.map(m=>In.ParameterInformation.create(m)))}return a}};var qu=new Map,TF=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&(qu.set(r,(qu.get(r)??0)+1),Eo().loadTypeAndCache(t.zephyrBindings,r)),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return Eo().getNodeTypes(n,r);case"DevicetreeOrg":return{type:G_().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Eo().getBindings(r);case"DevicetreeOrg":return G_().getBindings()}},getBusTypes:()=>{switch(e){case"Zephyr":return Eo().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return Eo().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}},dispose:()=>{if(e==="Zephyr"){let n=qu.get(r)??0;n<=1?(qu.delete(r),Eo().resetCache(r)):qu.set(r,n-1)}}}};var Qm=q(j());var h6=t=>!t.lastToken.prevToken||!t.lastToken.prevToken.prevToken?[]:[{startLine:t.firstToken.pos.line,startCharacter:t.firstToken.pos.col,endLine:t.lastToken.prevToken.prevToken.pos.line,endCharacter:t.lastToken.prevToken.prevToken.pos.col,kind:Qm.FoldingRangeKind.Comment}],Y_=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(Y_):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:Qm.FoldingRangeKind.Region},...t.nodes.flatMap(Y_)],vF=t=>{let e=[];return[...t instanceof Sn?t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})):[{start:(t.ifDef.identifier??t.ifDef.keyword).lastToken,end:t.ifDef.content?.lastToken}],t.elseOption?{start:t.elseOption.keyword.lastToken,end:t.elseOption.content?.lastToken}:null].forEach(r=>{!r||!r.end||e.push({startLine:r.start.pos.line,startCharacter:r.start.pos.col,endLine:r.end.pos.line,endCharacter:r.end.pos.colEnd,kind:Qm.FoldingRangeKind.Region})}),e},m6=t=>t instanceof Fe?Y_(t):t instanceof zn||t instanceof Sn?vF(t):t instanceof rn?h6(t):[];function bF(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>pe(r.uri,t)).flatMap(m6)}var wo=q(j());function g6(t){if(!t||!(t.ast instanceof xe)&&!(t.ast instanceof ir))return[];let e=r=>r.nodeType?.bindingsPath?[wo.Location.create(ue(r.nodeType.bindingsPath),wo.Range.create(wo.Position.create(0,0),wo.Position.create(0,0)))]:[];return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof xe&&t.ast.linksTo?e(t.ast.linksTo):[]}async function SF(t,e){return Pt(t,e,r=>[...g6(r)])}var eg=require("fs");var y6=(t,e)=>{Hr().reset(t),Hr().requestTokens(t,!0),e(t)},Zm=class{constructor(e,r,n){this.file=e;this.cb=r;this.hasDocumentOpen=n}#e=0;watch(){if(this.count++,this.count===1){console.log("create watch for",this.file);let e=this.file,r=this.cb;this.onChange=()=>{if(this.hasDocumentOpen(e)){console.log("skipping on change document is open",e);return}console.log("onChange",e),y6(e,r)},(0,eg.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,eg.unwatchFile)(this.file,this.onChange),this.onChange=void 0),this.count--}get count(){return this.#e}set count(e){this.#e=e,e<0&&(this.#e=0,console.warn("unwatching an un watched file",this.file))}};var er=q(require("path")),X_=require("fs");var ni=t=>{if(t)return Array.isArray(t)?t:[t]},T6=t=>({...t,deviceOrgBindingsMetaSchema:ni(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:ni(t.deviceOrgTreeBindings),includePaths:ni(t.includePaths),lockRenameEdits:ni(t.lockRenameEdits),zephyrBindings:ni(t.zephyrBindings),overlays:ni(t.overlays)}),_F=t=>({...t,defaultDeviceOrgBindingsMetaSchema:ni(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:ni(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:ni(t.defaultIncludePaths),defaultLockRenameEdits:ni(t.defaultLockRenameEdits),defaultZephyrBindings:ni(t.defaultZephyrBindings),contexts:t.contexts?.map(T6)}),On=async(t,e=[],r)=>{let n=r?e.map(s=>Pe(s.uri)).find(s=>ZE(s,r)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",uri:n??Pe(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,uri:Pe(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.uri)),t},Ls={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0,disableFileWatchers:!1},J_=async(t,e,r)=>{let n=await On(t.cwd??"${workspaceFolder}",r,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>On(p,r,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>On(p,r,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>On(p,r,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>On(p,r,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>On(p,r,t.dtsFile)));n&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]);let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return n&&(s=s.map(p=>(0,er.resolve)(n,p)).filter(p=>(0,X_.existsSync)(p)),a=a?.map(p=>(0,er.resolve)(n,p)),c=c.map(p=>(0,er.resolve)(n,p)),i=i.map(p=>(0,er.resolve)(n,p)),u=(0,er.resolve)(n,u),d=d.map(p=>(0,er.resolve)(n,p)),l=l.map(p=>(0,er.resolve)(n,p)),f=f?(0,er.resolve)(n,f):void 0),{ctxName:t.ctxName??(0,er.basename)(u),cwd:n?st(n):void 0,includePaths:i.map(st),zephyrBindings:s.map(st),bindingType:o,deviceOrgTreeBindings:a.map(st),deviceOrgBindingsMetaSchema:c.map(st),dtsFile:st(u),overlays:d.map(st),lockRenameEdits:l.map(st),compileCommands:f?st(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??e.disableFileWatchers}},$u=async(t,e)=>{let r=t.cwd?await On(t.cwd,e):void 0,n=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>On(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>On(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>On(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>On(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>On(d,e)));r&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,er.resolve)(r,d)),n==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,er.resolve)(r,d)),i=i.map(d=>(0,er.resolve)(r,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,er.resolve)(r,d)),c=c.map(d=>(0,er.resolve)(r,d)));let l={cwd:r,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:n,autoChangeContext:t.autoChangeContext??Ls.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??Ls.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??Ls.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??!1},u=(await Promise.all(t.contexts?.map(d=>J_(d,l,e))??[])).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,X_.existsSync)(f)&&er.default.isAbsolute(f)));return{...l,contexts:u}};var kF=t=>`DT_PROP(${Q_(t.parent)}, ${t.name.replaceAll("-","_")}))`,NF=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var Q_=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,RF=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),PF=t=>{let e=[];return di.getNodeFromPath(["aliases"],t.root)?.properties.filter(i=>{if(i.ast.quickValues?.at(0)===t.pathString)return!0;let s=i.ast.values?.values.at(0)?.value;if(s instanceof ie&&s.linksTo===t||s instanceof ot&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function v6(t,e){if(!t||!(t.item instanceof Ze)||!(t.ast instanceof tt))return[];let r=[];return e.settings.bindingType==="Zephyr"&&(r.push({type:"dt_zephyr_macro_prop_node_path",data:kF(t.item)}),NF(t.item).forEach(n=>{r.push({type:"dt_zephyr_macro_prop_node_label",data:n})})),r}function b6(t,e){if(!t||t.item===null)return[];let r;if(t.item instanceof X?r=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?r=t.ast.parentNode.linksTo:t.ast instanceof xe&&t.ast.linksTo&&(r=t.ast.linksTo),!r)return[];let n=[{type:"path",data:r.pathString}];return e.settings.bindingType==="Zephyr"&&(RF(r).forEach(i=>{n.push({type:"dt_zephyr_macro_node_label",data:i})}),n.push({type:"dt_zephyr_macro_node_path",data:Q_(r)}),PF(r).forEach(i=>{n.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),n}async function EF(t,e){return e?Pt(t,e,r=>[...b6(r,e),...v6(r,e)]):[]}var wF=q(j());function S6(t){return!t||!(t.item instanceof Ze)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function _6(t){let e=Bc(t?.ast);if(!e||!e.params.length||!t?.ast||t.ast===e.functionName)return;let n=(await t.runtime.context.getAllStableParsers()).at(-1).cPreprocessorParser.macros.get(e.functionName.name)?.macro.identifier;if(!n||!(n instanceof ui))return;let i=n.params.map(o=>({label:o instanceof pt?o.name:"..."})),s=e.params.find(o=>o&&(t.ast===o||o.isAncestorOf(t.ast)));return s??=t.afterAst?e.params.find(o=>o&&(t.afterAst===o||o.isAncestorOf(t.afterAst))):void 0,s??=t.beforeAst?e.params.find(o=>o&&(t.beforeAst===o||o.isAncestorOf(t.beforeAst))):void 0,{signatures:[wF.SignatureInformation.create(`${e.functionName.name}(${i.map(o=>o.label).join(", ")})`,void 0,...i.flat())],activeSignature:0,activeParameter:s?e.params.indexOf(s):void 0}}async function CF(t,e){if(e)return(await Pt(t,e,async r=>[await _6(r)||S6(r)])).at(0)}var DF=require("timers"),AF=require("events");var Z_=class extends AF.EventEmitter{constructor(e=3e3,r=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,DF.setInterval)(()=>{let n=process.memoryUsage().heapUsed;n>this.thresholdBytes&&this.emit("thresholdExceeded",{usedMb:(n/1024/1024).toFixed(2),thresholdMb:e})},r)}stop(){clearInterval(this.interval)}},k6=new Z_(3e3),IF=()=>{k6.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),nD(),rD()})};var Ue=[],ce,fc,tg=new WeakMap,Fu=new Map;IF();var xF=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{Fu.has(e)||Fu.set(e,new Zm(e,sk,r=>!!zu(r))),Fu.get(e)?.watch()})},nk=async t=>{let e=Ue.indexOf(t);if(e===-1)return;ju(t,void 0,!0),tg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await $s(t);if(te.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:r.type}),Ue.splice(e,1),await ck(),t===ce&&(ce=void 0,Ue.length)){let n=fc?Tn(Ue,{uri:fc}):void 0;n??=Ue[0],console.log("Active context was deleted. Forcing active to",n.id),await lr({id:n.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(n=>{Fu.get(n)?.unwatch()}),setTimeout(async()=>{await He();let n=new Set(Ue.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{n.has(i)||Hr().reset(i)})},2e3),t.bindingLoader?.dispose()},N6=t=>{let e=tg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},He=async()=>{await Promise.all(Ue.map(N6))},ik=async t=>(await MF()).indexOf(t)!==-1,MF=async()=>{let t=await LF();return Ue.filter(e=>!t.some(r=>r===e))},LF=async()=>{let t=await rk();return Ue.filter(e=>t.contexts.find(r=>Ii(r)===e.id))},R6=async()=>{let t=await A6();return Ue.filter(e=>t.contexts.find(r=>Ii(r)===e.id))},P6=async t=>(await R6()).indexOf(t)!==-1,E6=async(t,e)=>{if(t===e)return!0;let r=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),n=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return n.some(i=>pe(i.resolvedPath,t.parser.uri))&&r.length?r.every(i=>n.some(s=>s.resolvedPath===i.resolvedPath&&s.firstToken.pos.col===i.firstToken.pos.col&&s.firstToken.pos.len===i.firstToken.pos.len&&s.firstToken.pos.line===i.firstToken.pos.line&&s.lastToken.pos.col===i.lastToken.pos.col&&s.lastToken.pos.len===i.lastToken.pos.len&&s.lastToken.pos.line===i.lastToken.pos.line)):e.getContextFiles().some(i=>pe(i,t.parser.uri))},w6=async t=>{if(!await ik(t))return;let e=await MF(),r=await LF(),n=await Of(e);if(Ue.indexOf(t)===-1)return;let i=await Promise.all(n.flatMap(a=>[...r,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await E6(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&pe(a.context.parser.uri,t.parser.uri)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(nk))},te=(0,Ke.createConnection)(Ke.ProposedFeatures.all),Nr=new Ke.TextDocuments($r),qF=!1,rg=!1,$F=!1,FF=!1,BF=!1,ek;te.onInitialize(async t=>{ek=t.workspaceFolders??[],te.console.log(`[Server(${process.pid}) ${ek?.at(0)?.uri} Version 0.8.0-beta2 ] Started and initialize received`);let e=t.capabilities;qF=!!(e.workspace&&e.workspace.configuration),rg=!!(e.workspace&&e.workspace.workspaceFolders),$F=!!e.workspace?.diagnostics?.refreshSupport,FF=!!e.workspace?.semanticTokens?.refreshSupport,BF=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:Ke.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[Ke.CodeActionKind.QuickFix,Ke.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:Ef,tokenModifiers:wf},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return rg&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await VF(t.initializationOptions),r});var tk,C6={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100};te.onInitialized(async()=>{if(qF&&(te.client.register(Ke.DidChangeConfigurationNotification.type,{}),!tk)){let t=await te.workspace.getConfiguration("editor").catch(()=>{}),e=await te.workspace.getConfiguration("[devicetree]").catch(()=>{}),r={tabSize:e?.["editor.tabSize"],insertSpaces:e?.["editor.insertSpaces"],trimFinalNewlines:e?.["editor.trimFinalNewlines"],trimTrailingWhitespace:e?.["editor.trimTrailingWhitespace"],insertFinalNewline:e?.["editor.insertFinalNewline"],wordWrapColumn:e?.["editor.wordWrapColumn"]};(t||r)&&(tk={...t,...r})}rg&&te.workspace.onDidChangeWorkspaceFolders(async t=>{te.console.log("Workspace folder change event received"),await Vu()})});te.onRequest("workspace/workspaceFolders",async()=>ek??null);var D6=async()=>{let t=jF();return t={...Ls,...t},$u(t,await Hu())},rk=async()=>{let t=O6();return t={...Ls,...t},$u(t,await Hu())},A6=async()=>{let t=x6();return t={...Ls,...t},$u(t,await Hu())},Uu=async()=>{let t=I6();return t={...Ls,...t},$u(t,await Hu())},Hu=async()=>rg?await te.workspace.getWorkspaceFolders()??[]:[],OF=async t=>{let e=Tn(Ue,{id:Ii(t)});if(e)return e.ctxNames.includes(t.ctxName)||console.log(`(ID: ${e.id}) Adding name ${t.ctxName} for [${e.ctxNames.join(",")}]`),e.addCtxName(t.ctxName),e;let r=Ii(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,pc.join)((0,pc.dirname)(t.dtsFile),"dts","bindings"),i=new ip(t,tk??C6,t.bindingType?TF({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);Ue.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${r}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),xF(i);let o=await $s(i);return te.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===ce,type:o.type}),await w6(i),await ck(),i},Vu=async()=>{let t=await rk(),e=await Uu();e.allowAdhocContexts||(e=await rk());let r=e.contexts.map(Ii),n=Ue.filter(i=>!r.includes(i.id));await Promise.all(n.map(nk)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await OF(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await D6()).contexts?.reduce((s,o)=>s.then(async()=>{Tn(Ue,{uri:o.dtsFile})||await OF(o)}),Promise.resolve()),fc?await lr({uri:fc}):!ce&&Ue.length&&(console.log(`No active context using first context (ID: ${Ue[0].id}) [${Ue[0].ctxNames.join(",")}]`),await lr({id:Ue[0].id}))},xn,qs,Bu=new Map,dc=new Map,I6=()=>!qs&&!xn?void 0:{...qs,...xn,contexts:[...xn?.contexts??[],...Array.from(dc.values()),...Array.from(Bu.values())]},jF=()=>!qs&&!xn?void 0:{...qs,...xn,contexts:[...Array.from(Bu.values())]},O6=()=>!qs&&!xn?void 0:{...qs,...xn,contexts:[...xn?.contexts??[],...Array.from(dc.values())]},x6=()=>!qs&&!xn?void 0:{...xn,contexts:[...xn?.contexts??[]]};function M6(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var UF=async()=>{let t=await Uu();console.log("Resolved settings",JSON.stringify(t,void 0," ")),te.sendNotification("devicetree/settingsChanged",t),await Vu(),He().then(()=>{$F&&te.languages.diagnostics.refresh()})},L6=async()=>{let t=ce?.getContextFiles();await Promise.all(Array.from(Nr.keys()).filter(Ut).map(async e=>{t?.some(r=>pe(r,Pe(e)))||await te.sendDiagnostics({uri:e,version:Nr.get(e)?.version,diagnostics:[{severity:Ke.DiagnosticSeverity.Information,range:Ke.Range.create(Ke.Position.create(0,0),Ke.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},sk=async t=>{let e=lT(Ue,t);if(e.length)e.sort((r,n)=>r===ce?-1:n===ce?1:0).forEach(r=>{tg.get(r)?.abort.abort();let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleUri(t),n.signal.aborted){s();return}let o=performance.now(),a=ce===r,c=a?HF(r):[],l=r.getContextFiles();await r.reevaluate(t),xF(r),l.forEach(p=>Fu.get(p)?.unwatch()),a&&lk(r)?.length&&ok(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));ju(r,c.filter(h=>m.every(T=>T.uri!==h.uri))),m.forEach(h=>{te.sendDiagnostics(h)}),Wu.set(r,!0)});let[u,d]=await Promise.all([$s(r),r.getFileTree()]),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};ce===r&&te.sendNotification("devicetree/activeContextStableNotification",f),te.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)},50)});tg.set(r,{abort:n,promise:i})});else{if((await Uu()).allowAdhocContexts===!1)return;await Vu(),await lr({uri:t})}},q6=t=>Nr.keys().find(e=>pe(Pe(e),t)),zu=t=>{let e=q6(t);if(e)return Nr.get(e)},HF=t=>t.getContextFiles().map(e=>({uri:ue(e),version:zu(e)?.version,diagnostics:[]})),Wu=new WeakMap,ju=async(t,e=HF(t),r=!1)=>{if(!r&&t!==ce)return;let n=performance.now();await Promise.all(e.filter(i=>t===ce||!ce?.getContextFiles().some(s=>pe(Pe(i.uri),s))).map(i=>te.sendDiagnostics({uri:i.uri,version:Nr.get(i.uri)?.version,diagnostics:[]}))),Wu.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},ok=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=zu(i),o=[];return s&&t.settings.showFormattingErrorAsDiagnostics&&o.push(...(await Ca({textDocument:s,options:t.formattingOptions},s?.getText(),"File Diagnostics").catch(()=>[])).map(a=>a.diagnostic())),{uri:ue(i),kind:Ke.DocumentDiagnosticReportKind.Full,items:[...r.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...n]}},ak=async t=>{let{items:e}=await ok(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{te.sendDiagnostics(r)}),Wu.set(t,!0)},ck=async()=>{let t=await Promise.all(Ue.map($s));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,ce===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},$s=async t=>{let e=await ik(t),r=!e&&await P6(t);return{ctx:t,type:e?"Ad Hoc":r?"User":"3rd Party"}},lr=async(t,e=!1)=>{if("uri"in t){if(!Ut(t.uri))return!1;fc=t.uri,console.log("Active File Uri",fc)}let r=await Uu();if(ce&&!e&&!r.autoChangeContext||(await He(),!e&&ce?.getContextFiles().find(o=>"uri"in t&&pe(o,t.uri))))return!1;let n=ce,i=Tn(Ue,t),s=n!==i;return s&&(n&&ju(n),ce=i,i?($s(i).then(async o=>{let a=await i.getFileTree();!i||i!==ce&&!Ue.includes(i)||te.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:ce===i,type:o.type})}),lk(i)?.length&&ak(i),await ck()):te.sendNotification("devicetree/newActiveContext",void 0)),BF&&te.languages.foldingRange.refresh(),FF&&te.languages.semanticTokens.refresh(),s},Ut=t=>[".dts",".dtsi",".dtso",".overlay"].some(e=>t.endsWith(e));Nr.listen(te);var lk=t=>t?.getContextFiles()?.filter(e=>zu(e));Nr.onDidClose(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=lT(Ue,e);if(r.length===0){Bu.delete(e),te.sendDiagnostics({uri:t.document.uri,version:Nr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!lk(n)?.filter(s=>s!==e).length?ce?.getContextFiles().some(s=>pe(s,e))?ce?.getContextFiles().some(s=>pe(s,e))&&(await ju(ce),await ak(ce)):te.sendDiagnostics({uri:t.document.uri,version:Nr.get(t.document.uri)?.version,diagnostics:[]}):await ik(n)?(await nk(n),Bu.delete(n.settings.dtsFile)):ju(n)}))});Nr.onDidOpen(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;await He(),L6();let r=Tn(Ue,{uri:e});if(console.log("onDidOpen",r?.id,e),r)r!==ce?await lr({id:r.id}):r===ce&&(!Wu.get(r)||r.getContextFiles().some(n=>!pe(n,e)))&&await ak(r);else{let n={ctxName:(0,pc.basename)(e),dtsFile:e};Bu.set(e,n),await sk(e)}});Nr.onDidChangeContent(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=t.document.getText(),n=Hr();n.needsRenew(e,r)&&(console.log("Content changed"),n.renewLexer(e,r),await sk(e))});var VF=async t=>{t?.settings?.devicetree&&(xn=_F(M6(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await UF())};te.onDidChangeConfiguration(async t=>{await VF(t)});te.listen();te.languages.diagnostics.onWorkspace(async()=>{await He();let t=ce;return t?ok(t).finally(()=>{Wu.set(t,!0)}):{items:[]}});te.onDidChangeWatchedFiles(t=>{te.console.log("We received a file change event")});te.onCompletion(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return RA(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return[];await He(),lr({uri:e});let r=Ir(e);return r?[...await lD(t,r),...await QA(t,r)]:[]});te.onCompletionResolve(t=>t);var Ir=t=>{let e=jF();return Tn(Ue,{uri:t},ce,e?.preferredContext)};te.onDocumentSymbol(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return[];await He();let r=Ir(e);return r?r.getUriParser(e)?.getDocumentSymbols(e):[]});te.onWorkspaceSymbol(async()=>{await He();let t=ce;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});te.languages.semanticTokens.on(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return{data:[]};try{await He();let r=Ir(e),n=new Ke.SemanticTokensBuilder,i=r?.isInContext(e);return!r||!i?{data:[]}:((await r.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(n,e)),n.build())}catch(r){throw console.log(r),r}});te.onDocumentLinks(async t=>{await He();let e=Pe(t.textDocument.uri);return Ut(e)?Ir(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&ce?ce.bindingLoader?.getDocumentLinks?.(Nr.get(t.textDocument.uri))??[]:[]});te.onPrepareRename(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return AA(t,r)});te.onRenameRequest(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return DA(t,r)});te.onReferences(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return PA(t,r)});te.onDefinition(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return xA(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>Ke.Location.create(i.target,i.range))??[];return n.length?n:OA(t,r)});te.onDeclaration(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return $A(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return qA(t,r)});te.onCodeAction(async t=>{let e=Pe(t.textDocument.uri);if(Ut(e))return BA(t)});var zF=async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>Xs(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=Hr().getDocument(e),s=i.getText(),o=await Ca(t,s,"New Text").catch(()=>s);if(o===s)return[];let a=i.lineCount-1,c=i.getText({start:{line:a,character:0},end:{line:a+1,character:0}}).length;return[Ke.TextEdit.replace(Ke.Range.create(Ke.Position.create(0,0),Ke.Position.create(i.lineCount,c)),o)]};te.onDocumentRangeFormatting(zF);te.onDocumentFormatting(zF);te.onHover(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return SO(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He();let r=Ir(e);return(await ZA(t,r)).at(0)});te.onFoldingRanges(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He();let r=Ir(e),n=r?.isInContext(e);if(!r||!n)return[];let i=(await r.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?bF(e,i):[]});te.onTypeDefinition(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return SF(t,r)});te.onSignatureHelp(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return CF(t,r)});te.onRequest("devicetree/getContexts",async()=>(await He(),Promise.all(Ue.map(async t=>{let e=await $s(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:e.type}}))));te.onRequest("devicetree/setActive",async t=>(await He(),console.log("devicetree/setActive",t),await lr(t,!0)));te.onRequest("devicetree/getActiveContext",async()=>{if(await He(),console.log("devicetree/getActiveContext"),!ce)return;let t=await $s(ce);return ce?{ctxNames:ce.ctxNames.map(e=>e.toString()),id:ce.id,...await ce.getFileTree(),settings:ce.settings,active:!0,type:t.type}:void 0});te.onRequest("devicetree/setDefaultSettings",async t=>{await He(),qs=t,console.log("Integration Settings",t),await UF()});te.onRequest("devicetree/requestContext",async t=>{await He();let e=await Uu(),r=await J_(t,e,await Hu());console.log("devicetree/requestContext",r);let n=Ii(r),i=Array.from(dc).find(([,a])=>a.ctxName===t.ctxName);if(i){let a=i[0].split(":",1)[0];Tn(Ue,{name:t.ctxName.toString()})?.removeCtxName(t.ctxName),console.log(`Removing integration context with ID ${a} and name ${t.ctxName}`),dc.delete(i[0])}dc.set(`${n}:${t.ctxName}`,t),await Vu();let s=Ue.find(a=>a.id===n);if(!s)throw new Error("Failed to create context");let o=await $s(s);return{ctxNames:s.ctxNames.map(a=>a.toString()),id:n,...await s.getFileTree(),settings:s.settings,active:!0,type:o.type}});te.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await He(),dc.delete(`${t}:${e}`);let r=Tn(Ue,{id:t});if(r){if(r.removeCtxName(e),r.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await Vu()}});te.onRequest("devicetree/compiledDtsOutput",async t=>{if(await He(),!t)return;let e=Tn(Ue,{id:t});if(!e)return;let r=await e.toFullString();return Ca({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});te.onRequest("devicetree/serializedContext",async t=>{if(await He(),!t)return;let e=Tn(Ue,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});te.onRequest("devicetree/activePath",async t=>{if(await He(),!ce)return;let e=r=>{if(r?.item)return r.item instanceof X?{nodePath:r.item.pathString}:{nodePath:r.item.parent.pathString,propertyName:r.item.name}};return(await Pt(t,ce,r=>[e(r)])).at(0)});te.onRequest("devicetree/customActions",async t=>(await He(),EF(t,ce)));te.onRequest("devicetree/activeFileUri",async t=>{await He(),lr({uri:t})});te.onRequest("devicetree/formattingText",async t=>{let e=Pe(t.textDocument.uri),r=zu(e)??Hr().getDocument(e,t.text),n=await Ca(t,r.getText(),"Both");return{text:n.text,diagnostics:n.diagnostic.map(i=>i.diagnostic())}});te.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await He();let r=Pe(t);lr({uri:r});let n=Ir(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>Xs(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});te.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await He();let r=Tn(Ue,{id:e});return r?t.map(n=>{let i=Mc(n,r.macros),s=Ce(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});
|
|
313
|
+
${n}`]})]},d6=(t,e)=>nF(t,e.split("/").filter(r=>r)),nF=(t,e)=>{if(e.length===0)return{node:t,remainingInstancePath:""};let r=e[0].split("@"),n=r[0],i=r.at(1)?.split(",").map(o=>Number.parseInt(o,16)),s=t.getNode(n,i);return s?nF(s,e.slice(1)):{node:t,property:t.getProperty(e[0]),remainingInstancePath:e.slice(1).join("/")}};var W_=class t{constructor(){this.schemaIdValidators=new Map;this.ajvMap=new Map}static getNodeCompatible(e){let n=e.getProperty("compatible")?.ast.values;if(!n?.values.some(i=>!(i?.value instanceof ne)))return n?.values.map(i=>(i?.value).value)}parseMetaSchema(e,r){so.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,H_.resolve)(e,i);try{let s=z_.default.parse((0,V_.readFileSync)(i,"utf-8"));r.addMetaSchema(s),this.schemaIdValidators.set(s.$id,i)}catch{}})}parseBindings(e,r){so.sync("**/*.yaml",{cwd:e}).forEach(i=>{i=(0,H_.resolve)(e,i);try{let s=z_.default.parse((0,V_.readFileSync)(i,"utf-8"));r.addSchema(s),this.schemaIdValidators.set(s.$id,i)}catch(s){console.warn(i,s.message)}})}getNodeTypes(e,r,n){let i=`${e.join(";")}::${r.join(";")}`,s=this.ajvMap.get(i);return s||(s=new sF.default({strict:!1,strictSchema:!1,strictNumbers:!1}),s.addMetaSchema(U_),this.ajvMap.set(i,s),e.forEach(c=>this.parseMetaSchema(c,s)),r.forEach(c=>this.parseBindings(c,s))),t.getNodeCompatible(n)?.map(c=>{try{let l=Array.from(this.schemaIdValidators.keys()).find(f=>f.endsWith(`/${c}.yaml#`));if(!l)return;let u=new Ym(s,l);u.bindingsPath=this.schemaIdValidators.get(l),u.compatible=c;let d=s.getSchema(l);return u.description=(d?.schema).description,u.examples=(d?.schema).examples,u.maintainers=(d?.schema).maintainers,u}catch(l){console.warn(l.message)}}).filter(c=>c)??[]}getBindings(){return Array.from(this.schemaIdValidators.keys())}},iF,G_=()=>(iF??=new W_,iF);var Po=q(require("path")),fF=require("fs"),pF=q(require("path")),hF=q(Hb());var On=q(j());var oF=()=>{let t=new Y("nonposted-mmio",z("EMPTY"),"optional");return t.description=["Specifies that direct children of this bus should use non-posted memory accesses (i.e. a non-posted mapping mode) for MMIO ranges."],t};function aF(){let t=gr();t.noMismatchPropertiesAllowed=!0;let e=t.properties.find(n=>n.name==="compatible");e.required=()=>"required";let r=t.properties.find(n=>n.name==="ranges");return r.required=()=>"required",t.addProperty(oF()),t}var cF=t=>{switch(t){case"string":return z("STRING");case"int":return z("U32");case"boolean":return z("EMPTY");case"array":return z("PROP_ENCODED_ARRAY");case"uint8-array":return z("BYTESTRING");case"string-array":return z("STRINGLIST");case"phandle":return z("U32");case"phandles":return z("PROP_ENCODED_ARRAY");case"phandle-array":return z("PROP_ENCODED_ARRAY");case"path":return z(["STRING","U32"]);case"compound":return z("ANY");default:return z("ANY")}},lF=(t,e)=>{switch(t){case"string":return typeof e=="string"?e:void 0;case"int":return typeof e=="number"?e:void 0;case"boolean":return;case"array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"uint8-array":return Array.isArray(e)&&e.every(r=>typeof r=="number")?e:void 0;case"string-array":return Array.isArray(e)&&e.every(r=>typeof r=="string")?e:void 0;case"phandle":return;case"phandles":return;case"phandle-array":return;case"path":return;case"compound":return}},Xm=(t,e)=>{if(e.extends??=[],e=e.include.reduce((r,n)=>{let i=t.find(s=>(0,Po.basename)(s.filePath)===n.name);if(i){let s=n["property-blocklist"],o=n["property-allowlist"];e.extends?.push(...r.include.map(c=>(0,Po.basename)(c.name,".yaml")));let a=n["child-binding"];return r.include=r.include.filter(c=>c!==n),mF(t,i,r,s,o,a)??r}return console.warn(`Unable to find ${n.name}`),r},e),e["child-binding"]&&(e["child-binding"].include=gF(e["child-binding"].include),e["child-binding"]=Xm(t,e["child-binding"])),!e.include.length)return e},mF=(t,e,r,n=[],i,s)=>{let o=Xm(t,e),a=Xm(t,r);if(!o||!a)return;let c=new Set;Object.keys(o?.properties??{}).forEach(p=>c.add(p)),Object.keys(a?.properties??{}).forEach(p=>c.add(p));let l={};Array.from(c).forEach(p=>{let m=n?.some(T=>T===p)||i&&!i.some(T=>T===p)?void 0:o.properties?.[p]??void 0,h=a.properties?.[p]??void 0;(m||h)&&(l={...l,[p]:{...m??{},...h}})}),a.properties=l,a.extends??=[],a.extends.push(...o.extends??[]);let u=new Set;return Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Object.keys(o).filter(p=>p.endsWith("-cells")).forEach(p=>u.add(p)),Array.from(u).forEach(p=>{let m=o[p]??[],h=a[p]??[];a[p]=Array.from([...m,...h])}),a["on-bus"]??=o["on-bus"],a.bus?a.bus.push(...o.bus??[]):a.bus=o.bus,o["child-binding"]&&(a["child-binding"]??={filePath:a.filePath,include:[],rawInclude:[]},mF(t,o["child-binding"],a["child-binding"],s?.["property-blocklist"],s?.["property-allowlist"],s?.["child-binding"])),a},gF=t=>t?typeof t=="string"?[{name:t}]:t.map(e=>typeof e!="string"?e:{name:e}):[],K_=class t{constructor(){this.typeCache=new Map;this.processedFolders=new Set;this.zephyrBindingCache=new Map}static getCompatibleKeys(e,r){return!r||!r.nodeType?.bus?.length?[e]:[...r.nodeType.bus.map(n=>`${e}::${n}`),e]}getBaseZephyrType(e){let r=e.split(":");return Array.from(this.zephyrBindingCache.keys()).filter(i=>r.some(s=>i.startsWith(s))).flatMap(i=>this.zephyrBindingCache.get(i)).find(i=>i.filePath.endsWith(`${Po.default.sep}base.yaml`))}getBaseNodeType(e,r){let n=this.getBaseZephyrType(r),i=n?Jm(n,e):void 0;if(i){i.warnMismatchProperties=!1;let s=i.properties.find(o=>o.name==="compatible");s&&(s.required=()=>"optional")}return i}static getNodeCompatible(e){let i=e.getProperty("compatible")?.ast.values?.values.filter(s=>s&&s.value instanceof ne);if(i?.length)return i.map(s=>s?.value?{name:s.value.value,ast:s.value}:void 0)}getNodeTypes(e,r){let n=t.getNodeCompatible(e)?.filter(a=>a),i=n?.flatMap(a=>t.getCompatibleKeys(a.name,e.parent).map(c=>this.typeCache.get(r)?.get(c)?.(e)).filter(c=>!!c))??[];if(i.length===0){let a=r.split(":"),l=Array.from(this.zephyrBindingCache.keys()).filter(d=>a.some(f=>d.startsWith(f))).flatMap(d=>this.zephyrBindingCache.get(d)).find(d=>d.filePath.endsWith("/base.yaml")),u=l?Jm(l,e):void 0;if(u){u.warnMismatchProperties=!1;let d=u.properties.find(f=>f.name==="compatible");d&&(d.required=()=>"optional")}return{type:[u??Zs(e)],issues:[]}}let s=this.getBusTypes(),o=n?.flatMap(a=>{let c=t.getCompatibleKeys(a.name,e.parent).some(l=>this.typeCache.get(r)?.has(l));if(!c){let l=s.filter(u=>this.typeCache.get(r)?.has(`${a.name}::${u}`));if(l.length)return F(37,a.ast.firstToken,a.ast.lastToken,a.ast,{templateStrings:l})}return c?[]:[F(32,a.ast.firstToken,a.ast.lastToken,a.ast,{severity:On.DiagnosticSeverity.Hint,tags:[On.DiagnosticTag.Unnecessary],templateStrings:[a.name]})]})??[];return{type:i.length?i:[Zs(e)],issues:o}}loadTypeAndCache(e,r){e=Array.isArray(e)?e:[e];let n=e.filter(o=>this.processedFolders.has(o)).flatMap(o=>Array.from(this.zephyrBindingCache.entries()).flatMap(([a,c])=>a.startsWith(o)?[c]:[]));n.push(...e.filter(o=>!this.processedFolders.has(o)).flatMap(o=>(this.processedFolders.add(o),so.sync("**/*.yaml",{cwd:o,ignore:"test/*"}).map(c=>{if(c=(0,Po.resolve)(o,c),this.zephyrBindingCache.has(c))return this.zephyrBindingCache.get(c);try{let l=hF.default.parse((0,fF.readFileSync)(c,"utf-8")),u=gF(l?.include),d={...l,bus:l.bus?Array.isArray(l.bus)?l.bus:[l.bus]:void 0,include:u,rawInclude:[...u],filePath:c};return this.zephyrBindingCache.set(c,d),d}catch(l){console.warn(l)}}).filter(c=>!!c))));let i=n.map(o=>Xm(n,o)).filter(o=>!!o&&!o.include.length),s=this.typeCache.get(r);if(s||(s=new Map,this.typeCache.set(r,s)),f6(i,s),!s.has("simple-bus")){let o=this.getBaseZephyrType(r);if(o)return{type:[p6(o)],issues:[]}}}getBindings(e){return Array.from(this.typeCache.get(e)?.keys()??[]).map(r=>r.split("::",1)[0])}getBusTypes(){let e=Array.from(this.zephyrBindingCache.values()).flatMap(r=>r.bus?.filter(n=>!!n)??[]).filter(r=>!!r);return Array.from(new Set(e))}getDocumentLinks(e,r){let n=this.zephyrBindingCache.get(Pe(e.uri));if(!n)return[];let i=e.getText();return n.rawInclude.map(o=>{let c=new RegExp(o.name).exec(i);if(c){let l=e.positionAt(c.index),u=e.positionAt(c.index+c[0].length),d=Array.from(this.zephyrBindingCache.keys()).find(f=>f.endsWith(`${pF.default.sep}${o.name}`)&&r.some(p=>f.startsWith(p)));return d?{range:On.Range.create(l,u),target:ue(d)}:void 0}}).filter(o=>!!o)}resetCache(e){this.typeCache.delete(e)}},uF,Eo=()=>(uF??=new K_,uF),f6=(t,e)=>t.forEach(r=>{r.compatible&&e.set(r["on-bus"]?`${r.compatible}::${r["on-bus"]}`:r.compatible,n=>Jm(r,n))}),Jm=(t,e)=>{let r=Zs(e);r.compatible=t.compatible,r.description=t.description,r.bindingsPath=t.filePath,r.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),r.onBus=t["on-bus"],t.extends?.forEach(s=>r.extends.add(s)),r.warnMismatchProperties=!0;let i=Object.keys(t).filter(s=>s.endsWith("-cells")).map(s=>({specifier:s.replace(/-cells$/,""),values:t[s]}));if(r.cellsValues=i,Object.entries(t.properties??{}).forEach(([s,o])=>{yF(r,s,o)}),t["child-binding"]){let s=t["child-binding"];r.childNodeType=o=>Jm(s,o)}return r},p6=t=>{let e=aF();e.bus=typeof t.bus=="string"?[t.bus]:Array.from(new Set(t.bus)),e.onBus=t["on-bus"],t.extends?.forEach(i=>e.extends.add(i)),e.warnMismatchProperties=!0;let n=Object.keys(t).filter(i=>i.endsWith("-cells")).map(i=>({specifier:i.replace(/-cells$/,""),values:t[i]}));return e.cellsValues=n,Object.entries(t.properties??{}).forEach(([i,s])=>{yF(e,i,s)}),e},yF=(t,e,r)=>{let n=t.properties.find(i=>i.getNameMatch(e));if(n&&typeof n.name=="string"){n.name!=="reg"?n.required=()=>r.required?"required":"optional":r.required&&(n.required=()=>"required"),n.values=()=>r.enum??[],n.constValue=lF(r.type,r.const),n.bindingType=r.type;let i=n.additionalTypeCheck;n.additionalTypeCheck=(s,o)=>[...dF(r,e,n)(s,o),...i?.(s,o)??[]]}else{let i=r.type==="compound"?n?.type:cF(r.type);i??=cF(r.type);let s=new Y(e,i,r.required?"required":"optional",void 0,r.enum);s.additionalTypeCheck=(o,a)=>{let c=[...n?.additionalTypeCheck?.(o,a)??[],...dF(r,e,s)(o,a)];return s.signatureArgs??=n?.signatureArgs,s.signatureArgsCyclic??=!!n?.signatureArgsCyclic,c},s.description=r.description?[r.description]:n?.description,s.bindingType=r.type,s.constValue=lF(r.type,r.const),t.addProperty(s)}},dF=(t,e,r)=>{let n=t;return(i,s)=>{let o=i.parent.root,a=[];if(n.const){let l=i.ast.quickValues;if(l?.length==1){let u=Array.isArray(n.const)?n.const:[n.const];if(!(Array.isArray(l[0])&&u.length===l[0].length&&l[0].every((f,p)=>typeof f=="number"&&Number.isNaN(f)||u[p]===f))){let f=i.ast.values??i.ast;a.push(F(24,f.firstToken,f.lastToken,f,{templateStrings:[`Binding expects values to be "${n.type}" with value: ${n.const}`]}))}}}if(n.deprecated&&a.push(F(14,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:On.DiagnosticSeverity.Warning,tags:[On.DiagnosticTag.Deprecated],templateStrings:[i.name]})),(n.type==="phandle"||n.type==="phandles"||n.type==="path")&&Le(i.ast.values)?.forEach(u=>{vn(u,o)||a.push(F(22,u.firstToken,u.lastToken,u))}),n.type==="path"&&i.ast.values?.values.at(0)?.value instanceof ne){let l=i.ast.values?.values.at(0)?.value,u=[];l.value.split("/").every(d=>{let f=o.getNode(d);return f?u.push(d):a.push(F(23,l.firstToken,l.lastToken,l,{templateStrings:[d,`/${u.join("/")}`]})),!f})}let c=i.name.match(/^(.*)-(\d+)$/);if(n.type==="phandles"&&c){let l="";e.endsWith("-gpios")?l="gpio":l=n["specifier-space"]??c[1];let u=Number.parseInt(c[2],10),d=i.parent.getProperty(`${l}-names`);d&&(d.ast.quickValues?.at(u)||a.push(F(33,i.ast.firstToken,i.ast.lastToken,i.ast,{severity:On.DiagnosticSeverity.Warning,linkedTo:[d.ast],templateStrings:[i.name,u.toString()]})))}if(n.type==="phandle-array"){let l=Le(i.ast.values),u=0,d=[],f=0;for(;l&&u<l.length;){let p=l.at(u),m=vn(p,o);if(!m){let O=p??i.ast;a.push(F(22,O.firstToken,O.lastToken,O));break}let h="";e.endsWith("-gpios")?h="gpio":h=n["specifier-space"]??e.slice(0,-1);let T=m.getProperty(`#${h}-cells`);if(!T){a.push(F(16,i.ast.firstToken,i.ast.lastToken,i.ast,{linkedTo:[...m.nodeNameOrLabelRef],templateStrings:[i.name,`#${h}-cells`,`/${m.path.slice(1).join("/")}`]}));break}let _=T?Be(T,0,0,s)??0:0,b=m.nodeType?.cellsValues?.find(O=>O.specifier===h)?.values;if(d.push([`${f}_phandle`,...b?.map(O=>`${f}_${O}`)??[],...Array.from({length:_-(b?.length??0)},(O,B)=>`${f}_cell${_-(b?.length??0)?B:""}`)]),1+_>l.length-u){let O=p??i.ast;a.push(F(19,O.firstToken,O.lastToken,O,{templateStrings:[i.name,`<${d.at(-1).join(" ")}>`]}));break}u+=1+_;let v=l.slice(u-_,u),k={mappingValuesAst:v,specifierSpace:h,target:m};i.nexusMapsTo.push(k);let w=m.getProperty(`${h}-map`);if(w){let O=m.getNexusMapEntryMatch(h,s,v);O?.match?k.mapItem=O.match:a.push(F(31,O.entry.firstToken,O.entry.lastToken,O.entry,{linkedTo:[w.ast]}))}v.every(O=>O instanceof ge)&&m.spesifierNexusMapping.push({expressions:v,node:i.parent,property:i});let H=i.parent.getProperty(`${h}-names`);p&&H&&(H.ast.quickValues?.at(f)||a.push(F(33,p.firstToken,l[u-1]?.lastToken,i.ast,{severity:On.DiagnosticSeverity.Warning,linkedTo:[H.ast],templateStrings:[i.name,f.toString()]}))),f++}d.push([`${f}_phandle`,`${f}_cell...`]),r.signatureArgs=d.map(p=>p.map(m=>On.ParameterInformation.create(m)))}return a}};var qu=new Map,TF=(t,e)=>{let r=t.zephyrBindings.join(":");return e==="Zephyr"&&(qu.set(r,(qu.get(r)??0)+1),Eo().loadTypeAndCache(t.zephyrBindings,r)),{files:t,type:e,getNodeTypes:n=>{switch(e){case"Zephyr":return Eo().getNodeTypes(n,r);case"DevicetreeOrg":return{type:G_().getNodeTypes(t.deviceOrgBindingsMetaSchema,t.deviceOrgTreeBindings,n),issues:[]}}},getBindings:()=>{switch(e){case"Zephyr":return Eo().getBindings(r);case"DevicetreeOrg":return G_().getBindings()}},getBusTypes:()=>{switch(e){case"Zephyr":return Eo().getBusTypes();case"DevicetreeOrg":return[]}},getDocumentLinks(n){if(!n)return[];switch(e){case"Zephyr":return Eo().getDocumentLinks(n,t.zephyrBindings);case"DevicetreeOrg":return[]}},dispose:()=>{if(e==="Zephyr"){let n=qu.get(r)??0;n<=1?(qu.delete(r),Eo().resetCache(r)):qu.set(r,n-1)}}}};var Qm=q(j());var h6=t=>!t.lastToken.prevToken||!t.lastToken.prevToken.prevToken?[]:[{startLine:t.firstToken.pos.line,startCharacter:t.firstToken.pos.col,endLine:t.lastToken.prevToken.prevToken.pos.line,endCharacter:t.lastToken.prevToken.prevToken.pos.col,kind:Qm.FoldingRangeKind.Comment}],Y_=t=>!t.openScope||!t.closeScope?.prevToken?t.nodes.flatMap(Y_):[{startLine:t.openScope.pos.line,startCharacter:t.openScope.pos.col,endLine:t.closeScope.prevToken.pos.line,endCharacter:t.closeScope.prevToken.pos.col,kind:Qm.FoldingRangeKind.Region},...t.nodes.flatMap(Y_)],vF=t=>{let e=[];return[...t instanceof _n?t.ifBlocks.map(r=>({start:(r.expression??r.keyword).lastToken,end:r.content?.lastToken??(r.expression??r.keyword).lastToken})):[{start:(t.ifDef.identifier??t.ifDef.keyword).lastToken,end:t.ifDef.content?.lastToken}],t.elseOption?{start:t.elseOption.keyword.lastToken,end:t.elseOption.content?.lastToken}:null].forEach(r=>{!r||!r.end||e.push({startLine:r.start.pos.line,startCharacter:r.start.pos.col,endLine:r.end.pos.line,endCharacter:r.end.pos.colEnd,kind:Qm.FoldingRangeKind.Region})}),e},m6=t=>t instanceof Fe?Y_(t):t instanceof Wn||t instanceof _n?vF(t):t instanceof rn?h6(t):[];function bF(t,e){return e.allAstItems.flatMap(r=>[r,...r.allDescendants]).filter(r=>pe(r.uri,t)).flatMap(m6)}var wo=q(j());function g6(t){if(!t||!(t.ast instanceof xe)&&!(t.ast instanceof ir))return[];let e=r=>r.nodeType?.bindingsPath?[wo.Location.create(ue(r.nodeType.bindingsPath),wo.Range.create(wo.Position.create(0,0),wo.Position.create(0,0)))]:[];return t.item instanceof X&&!Vt(t.ast)?e(t.item):t.ast instanceof ir&&t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?e(t.ast.parentNode.linksTo):t.ast instanceof xe&&t.ast.linksTo?e(t.ast.linksTo):[]}async function SF(t,e){return Pt(t,e,r=>[...g6(r)])}var eg=require("fs");var y6=(t,e)=>{Hr().reset(t),Hr().requestTokens(t,!0),e(t)},Zm=class{constructor(e,r,n){this.file=e;this.cb=r;this.hasDocumentOpen=n}#e=0;watch(){if(this.count++,this.count===1){console.log("create watch for",this.file);let e=this.file,r=this.cb;this.onChange=()=>{if(this.hasDocumentOpen(e)){console.log("skipping on change document is open",e);return}console.log("onChange",e),y6(e,r)},(0,eg.watchFile)(e,this.onChange)}}unwatch(){this.count===1&&(console.log("dispose watch for",this.file),(0,eg.unwatchFile)(this.file,this.onChange),this.onChange=void 0),this.count--}get count(){return this.#e}set count(e){this.#e=e,e<0&&(this.#e=0,console.warn("unwatching an un watched file",this.file))}};var er=q(require("path")),X_=require("fs");var ii=t=>{if(t)return Array.isArray(t)?t:[t]},T6=t=>({...t,deviceOrgBindingsMetaSchema:ii(t.deviceOrgBindingsMetaSchema),deviceOrgTreeBindings:ii(t.deviceOrgTreeBindings),includePaths:ii(t.includePaths),lockRenameEdits:ii(t.lockRenameEdits),zephyrBindings:ii(t.zephyrBindings),overlays:ii(t.overlays)}),_F=t=>({...t,defaultDeviceOrgBindingsMetaSchema:ii(t.defaultDeviceOrgBindingsMetaSchema),defaultDeviceOrgTreeBindings:ii(t.defaultDeviceOrgTreeBindings),defaultIncludePaths:ii(t.defaultIncludePaths),defaultLockRenameEdits:ii(t.defaultLockRenameEdits),defaultZephyrBindings:ii(t.defaultZephyrBindings),contexts:t.contexts?.map(T6)}),xn=async(t,e=[],r)=>{let n=r?e.map(s=>Pe(s.uri)).find(s=>ZE(s,r)):void 0;return[...e.at(0)?[{replace:"${workspaceFolder}",uri:n??Pe(e[0].uri)}]:[],...e.map(s=>({replace:`\${workspaceFolder:${s.name}}`,uri:Pe(s.uri)}))].forEach(s=>t=t.replaceAll(s.replace,s.uri)),t},Ls={defaultBindingType:"Zephyr",defaultZephyrBindings:[],defaultIncludePaths:[],defaultDeviceOrgBindingsMetaSchema:[],defaultDeviceOrgTreeBindings:[],contexts:[],defaultLockRenameEdits:[],allowAdhocContexts:!0,autoChangeContext:!0,defaultShowFormattingErrorAsDiagnostics:!0,disableFileWatchers:!1},J_=async(t,e,r)=>{let n=await xn(t.cwd??"${workspaceFolder}",r,t.dtsFile)??e.cwd,i=await Promise.all((t.includePaths??e.defaultIncludePaths).map(p=>xn(p,r,t.dtsFile))),s=await Promise.all((t.zephyrBindings??e.defaultZephyrBindings).map(p=>xn(p,r,t.dtsFile))),o=t.bindingType??e.defaultBindingType,a=await Promise.all((t.deviceOrgTreeBindings??e.defaultDeviceOrgTreeBindings).map(p=>xn(p,r,t.dtsFile))),c=await Promise.all((t.deviceOrgBindingsMetaSchema??e.defaultDeviceOrgBindingsMetaSchema).map(p=>xn(p,r,t.dtsFile))),l=await Promise.all((t.lockRenameEdits??e.defaultLockRenameEdits).map(p=>xn(p,r,t.dtsFile)));n&&o==="Zephyr"&&(!s||s.length===0)&&(s=["./zephyr/dts/bindings"]);let u=t.dtsFile,d=t.overlays??[],f=t.compileCommands;return n&&(s=s.map(p=>(0,er.resolve)(n,p)).filter(p=>(0,X_.existsSync)(p)),a=a?.map(p=>(0,er.resolve)(n,p)),c=c.map(p=>(0,er.resolve)(n,p)),i=i.map(p=>(0,er.resolve)(n,p)),u=(0,er.resolve)(n,u),d=d.map(p=>(0,er.resolve)(n,p)),l=l.map(p=>(0,er.resolve)(n,p)),f=f?(0,er.resolve)(n,f):void 0),{ctxName:t.ctxName??(0,er.basename)(u),cwd:n?st(n):void 0,includePaths:i.map(st),zephyrBindings:s.map(st),bindingType:o,deviceOrgTreeBindings:a.map(st),deviceOrgBindingsMetaSchema:c.map(st),dtsFile:st(u),overlays:d.map(st),lockRenameEdits:l.map(st),compileCommands:f?st(f):void 0,showFormattingErrorAsDiagnostics:t.showFormattingErrorAsDiagnostics??e.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??e.disableFileWatchers}},$u=async(t,e)=>{let r=t.cwd?await xn(t.cwd,e):void 0,n=t.defaultBindingType,i=t.defaultDeviceOrgBindingsMetaSchema=await Promise.all((t.defaultDeviceOrgBindingsMetaSchema??[]).map(d=>xn(d,e))),s=t.defaultDeviceOrgTreeBindings=await Promise.all((t.defaultDeviceOrgTreeBindings??[]).map(d=>xn(d,e))),o=t.defaultIncludePaths=await Promise.all((t.defaultIncludePaths??[]).map(d=>xn(d,e))),a=t.defaultZephyrBindings=await Promise.all((t.defaultZephyrBindings??[]).map(d=>xn(d,e))),c=t.defaultLockRenameEdits=await Promise.all((t.defaultLockRenameEdits??[]).map(d=>xn(d,e)));r&&(o=t.defaultIncludePaths=(t.defaultIncludePaths??[]).map(d=>(0,er.resolve)(r,d)),n==="Zephyr"&&!t.defaultZephyrBindings&&(a=["./zephyr/dts/bindings"]),a=a.map(d=>(0,er.resolve)(r,d)),i=i.map(d=>(0,er.resolve)(r,d)),s=(t.defaultDeviceOrgTreeBindings??[]).map(d=>(0,er.resolve)(r,d)),c=c.map(d=>(0,er.resolve)(r,d)));let l={cwd:r,defaultDeviceOrgBindingsMetaSchema:i,defaultDeviceOrgTreeBindings:s,defaultIncludePaths:o,defaultZephyrBindings:a,defaultLockRenameEdits:c,defaultBindingType:n,autoChangeContext:t.autoChangeContext??Ls.autoChangeContext,allowAdhocContexts:t.allowAdhocContexts??Ls.allowAdhocContexts,defaultShowFormattingErrorAsDiagnostics:t.defaultShowFormattingErrorAsDiagnostics??Ls.defaultShowFormattingErrorAsDiagnostics,disableFileWatchers:t.disableFileWatchers??!1},u=(await Promise.all(t.contexts?.map(d=>J_(d,l,e))??[])).filter(d=>[d.dtsFile,...d.overlays].every(f=>(0,X_.existsSync)(f)&&er.default.isAbsolute(f)));return{...l,contexts:u}};var kF=t=>`DT_PROP(${Q_(t.parent)}, ${t.name.replaceAll("-","_")}))`,NF=t=>t.parent.labels.map(e=>`DT_PROP(DT_NODELABEL(${e.label.toString()}), ${t.name.replaceAll("-","_")})`);var Q_=t=>`DT_PATH(${t.path.slice(1).map(e=>e.replace("@","_").replaceAll("-","_")).join(",")})`,RF=t=>t.labels.map(e=>`DT_NODELABEL(${e.label.toString()})`),PF=t=>{let e=[];return di.getNodeFromPath(["aliases"],t.root)?.properties.filter(i=>{if(i.ast.quickValues?.at(0)===t.pathString)return!0;let s=i.ast.values?.values.at(0)?.value;if(s instanceof ie&&s.linksTo===t||s instanceof ot&&s.path?.pathParts.at(-1)?.linksTo===t)return!0})?.forEach(i=>e.push(`DT_ALIAS(${i.name.replaceAll("-","_")})`)),e};function v6(t,e){if(!t||!(t.item instanceof Ze)||!(t.ast instanceof tt))return[];let r=[];return e.settings.bindingType==="Zephyr"&&(r.push({type:"dt_zephyr_macro_prop_node_path",data:kF(t.item)}),NF(t.item).forEach(n=>{r.push({type:"dt_zephyr_macro_prop_node_label",data:n})})),r}function b6(t,e){if(!t||t.item===null)return[];let r;if(t.item instanceof X?r=t.item:t.ast.parentNode instanceof ie&&t.ast.parentNode.linksTo?r=t.ast.parentNode.linksTo:t.ast instanceof xe&&t.ast.linksTo&&(r=t.ast.linksTo),!r)return[];let n=[{type:"path",data:r.pathString}];return e.settings.bindingType==="Zephyr"&&(RF(r).forEach(i=>{n.push({type:"dt_zephyr_macro_node_label",data:i})}),n.push({type:"dt_zephyr_macro_node_path",data:Q_(r)}),PF(r).forEach(i=>{n.push({type:"dt_zephyr_macro_prop_node_alias",data:i})})),n}async function EF(t,e){return e?Pt(t,e,r=>[...b6(r,e),...v6(r,e)]):[]}var wF=q(j());function S6(t){return!t||!(t.item instanceof Ze)?void 0:t.item.parent.nodeType?.getSignatureHelp?.(t.item,t.ast,t.beforeAst,t.afterAst)}async function _6(t){let e=Bc(t?.ast);if(!e||!e.params.length||!t?.ast||t.ast===e.functionName)return;let n=(await t.runtime.context.getAllStableParsers()).at(-1).cPreprocessorParser.macros.get(e.functionName.name)?.macro.identifier;if(!n||!(n instanceof ui))return;let i=n.params.map(o=>({label:o instanceof pt?o.name:"..."})),s=e.params.find(o=>o&&(t.ast===o||o.isAncestorOf(t.ast)));return s??=t.afterAst?e.params.find(o=>o&&(t.afterAst===o||o.isAncestorOf(t.afterAst))):void 0,s??=t.beforeAst?e.params.find(o=>o&&(t.beforeAst===o||o.isAncestorOf(t.beforeAst))):void 0,{signatures:[wF.SignatureInformation.create(`${e.functionName.name}(${i.map(o=>o.label).join(", ")})`,void 0,...i.flat())],activeSignature:0,activeParameter:s?e.params.indexOf(s):void 0}}async function CF(t,e){if(e)return(await Pt(t,e,async r=>[await _6(r)||S6(r)])).at(0)}var DF=require("timers"),AF=require("events");var Z_=class extends AF.EventEmitter{constructor(e=3e3,r=1e3){super(),this.thresholdBytes=e*1024*1024,this.interval=(0,DF.setInterval)(()=>{let n=process.memoryUsage().heapUsed;n>this.thresholdBytes&&this.emit("thresholdExceeded",{usedMb:(n/1024/1024).toFixed(2),thresholdMb:e})},r)}stop(){clearInterval(this.interval)}},k6=new Z_(3e3),IF=()=>{k6.on("thresholdExceeded",({usedMb:t,thresholdMb:e})=>{console.warn(`[HeapMonitor] Heap usage exceeded ${e}MB: ${t}MB used`),nD(),rD()})};var Ue=[],ce,fc,tg=new WeakMap,Fu=new Map;IF();var xF=t=>{t.settings.disableFileWatchers||t.getContextFiles().forEach(e=>{Fu.has(e)||Fu.set(e,new Zm(e,sk,r=>!!zu(r))),Fu.get(e)?.watch()})},nk=async t=>{let e=Ue.indexOf(t);if(e===-1)return;ju(t,void 0,!0),tg.delete(t),console.log(`(ID: ${t.id}) cleaning Context for [${t.ctxNames.join(",")}]`);let r=await $s(t);if(te.sendNotification("devicetree/contextDeleted",{ctxNames:t.ctxNames.map(n=>n.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:r.type}),Ue.splice(e,1),await ck(),t===ce&&(ce=void 0,Ue.length)){let n=fc?Tn(Ue,{uri:fc}):void 0;n??=Ue[0],console.log("Active context was deleted. Forcing active to",n.id),await lr({id:n.id},!0)}t.settings.disableFileWatchers||t.getContextFiles().map(n=>{Fu.get(n)?.unwatch()}),setTimeout(async()=>{await He();let n=new Set(Ue.flatMap(i=>i.getContextFiles()));t.getContextFiles().map(i=>{n.has(i)||Hr().reset(i)})},2e3),t.bindingLoader?.dispose()},N6=t=>{let e=tg.get(t);if(!e?.abort.signal.aborted)return Promise.all([e?.promise,t.getRuntime()])},He=async()=>{await Promise.all(Ue.map(N6))},ik=async t=>(await MF()).indexOf(t)!==-1,MF=async()=>{let t=await LF();return Ue.filter(e=>!t.some(r=>r===e))},LF=async()=>{let t=await rk();return Ue.filter(e=>t.contexts.find(r=>Ii(r)===e.id))},R6=async()=>{let t=await A6();return Ue.filter(e=>t.contexts.find(r=>Ii(r)===e.id))},P6=async t=>(await R6()).indexOf(t)!==-1,E6=async(t,e)=>{if(t===e)return!0;let r=(await t.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath),n=(await e.getAllStableParsers()).flatMap(i=>i.cPreprocessorParser.dtsIncludes).filter(i=>i.resolvedPath);return n.some(i=>pe(i.resolvedPath,t.parser.uri))&&r.length?r.every(i=>n.some(s=>s.resolvedPath===i.resolvedPath&&s.firstToken.pos.col===i.firstToken.pos.col&&s.firstToken.pos.len===i.firstToken.pos.len&&s.firstToken.pos.line===i.firstToken.pos.line&&s.lastToken.pos.col===i.lastToken.pos.col&&s.lastToken.pos.len===i.lastToken.pos.len&&s.lastToken.pos.line===i.lastToken.pos.line)):e.getContextFiles().some(i=>pe(i,t.parser.uri))},w6=async t=>{if(!await ik(t))return;let e=await MF(),r=await LF(),n=await Of(e);if(Ue.indexOf(t)===-1)return;let i=await Promise.all(n.flatMap(a=>[...r,...e.filter(c=>c!==a.context)].map(async c=>({context:a.context,same:await E6(a.context,c)})))),s=t.getContextFiles(),o=n.filter(a=>i.some(c=>c.context===a.context&&c.same)||a.context!==t&&pe(a.context.parser.uri,t.parser.uri)&&s.some(c=>c&&a.files.indexOf(c)!==-1)).map(a=>a.context);o.length&&await Promise.all(o.map(nk))},te=(0,Ke.createConnection)(Ke.ProposedFeatures.all),Nr=new Ke.TextDocuments($r),qF=!1,rg=!1,$F=!1,FF=!1,BF=!1,ek;te.onInitialize(async t=>{ek=t.workspaceFolders??[],te.console.log(`[Server(${process.pid}) ${ek?.at(0)?.uri} Version 0.8.0-beta3 ] Started and initialize received`);let e=t.capabilities;qF=!!(e.workspace&&e.workspace.configuration),rg=!!(e.workspace&&e.workspace.workspaceFolders),$F=!!e.workspace?.diagnostics?.refreshSupport,FF=!!e.workspace?.semanticTokens?.refreshSupport,BF=!!e.workspace?.foldingRange?.refreshSupport;let r={capabilities:{typeDefinitionProvider:!0,workspaceSymbolProvider:!0,textDocumentSync:Ke.TextDocumentSyncKind.Incremental,renameProvider:{prepareProvider:!0},completionProvider:{resolveProvider:!0,triggerCharacters:["&","="," ",'"',"(",","]},codeActionProvider:{codeActionKinds:[Ke.CodeActionKind.QuickFix,Ke.CodeActionKind.SourceFixAll]},documentSymbolProvider:!0,semanticTokensProvider:{legend:{tokenTypes:Ef,tokenModifiers:wf},full:!0},documentLinkProvider:{resolveProvider:!1},foldingRangeProvider:!0,definitionProvider:!0,declarationProvider:!0,referencesProvider:!0,documentFormattingProvider:!0,documentRangeFormattingProvider:!0,hoverProvider:!0,signatureHelpProvider:{triggerCharacters:["<","("],retriggerCharacters:[" ",","]}}};return rg&&(r.capabilities.workspace={workspaceFolders:{changeNotifications:!0,supported:!0}}),await VF(t.initializationOptions),r});var tk,C6={tabSize:8,insertSpaces:!1,trimTrailingWhitespace:!0,insertFinalNewline:!0,wordWrapColumn:100};te.onInitialized(async()=>{if(qF&&(te.client.register(Ke.DidChangeConfigurationNotification.type,{}),!tk)){let t=await te.workspace.getConfiguration("editor").catch(()=>{}),e=await te.workspace.getConfiguration("[devicetree]").catch(()=>{}),r={tabSize:e?.["editor.tabSize"],insertSpaces:e?.["editor.insertSpaces"],trimFinalNewlines:e?.["editor.trimFinalNewlines"],trimTrailingWhitespace:e?.["editor.trimTrailingWhitespace"],insertFinalNewline:e?.["editor.insertFinalNewline"],wordWrapColumn:e?.["editor.wordWrapColumn"]};(t||r)&&(tk={...t,...r})}rg&&te.workspace.onDidChangeWorkspaceFolders(async t=>{te.console.log("Workspace folder change event received"),await Vu()})});te.onRequest("workspace/workspaceFolders",async()=>ek??null);var D6=async()=>{let t=jF();return t={...Ls,...t},$u(t,await Hu())},rk=async()=>{let t=O6();return t={...Ls,...t},$u(t,await Hu())},A6=async()=>{let t=x6();return t={...Ls,...t},$u(t,await Hu())},Uu=async()=>{let t=I6();return t={...Ls,...t},$u(t,await Hu())},Hu=async()=>rg?await te.workspace.getWorkspaceFolders()??[]:[],OF=async t=>{let e=Tn(Ue,{id:Ii(t)});if(e)return e.ctxNames.includes(t.ctxName)||console.log(`(ID: ${e.id}) Adding name ${t.ctxName} for [${e.ctxNames.join(",")}]`),e.addCtxName(t.ctxName),e;let r=Ii(t);console.log(`(ID: ${r}) New context [${t.ctxName}]`),console.log(`(ID: ${r}) Settings: ${JSON.stringify(t,void 0," ")}`);let n=(0,pc.join)((0,pc.dirname)(t.dtsFile),"dts","bindings"),i=new ip(t,tk??C6,t.bindingType?TF({zephyrBindings:t.zephyrBindings?[n,...t.zephyrBindings]:[n],deviceOrgBindingsMetaSchema:t.deviceOrgBindingsMetaSchema??[],deviceOrgTreeBindings:t.deviceOrgTreeBindings??[]},t.bindingType):void 0);Ue.push(i);let s=performance.now();await i.stable(),console.log(`(ID: ${r}) New context took ${performance.now()-s}ms to start [${t.ctxName}]`),xF(i);let o=await $s(i);return te.sendNotification("devicetree/contextCreated",{ctxNames:i.ctxNames.map(a=>a.toString()),id:i.id,...await i.getFileTree(),settings:i.settings,active:i===ce,type:o.type}),await w6(i),await ck(),i},Vu=async()=>{let t=await rk(),e=await Uu();e.allowAdhocContexts||(e=await rk());let r=e.contexts.map(Ii),n=Ue.filter(i=>!r.includes(i.id));await Promise.all(n.map(nk)),await t.contexts?.reduce((i,s)=>i.then(async()=>{await OF(s)}),Promise.resolve()),e.allowAdhocContexts&&await(await D6()).contexts?.reduce((s,o)=>s.then(async()=>{Tn(Ue,{uri:o.dtsFile})||await OF(o)}),Promise.resolve()),fc?await lr({uri:fc}):!ce&&Ue.length&&(console.log(`No active context using first context (ID: ${Ue[0].id}) [${Ue[0].ctxNames.join(",")}]`),await lr({id:Ue[0].id}))},Mn,qs,Bu=new Map,dc=new Map,I6=()=>!qs&&!Mn?void 0:{...qs,...Mn,contexts:[...Mn?.contexts??[],...Array.from(dc.values()),...Array.from(Bu.values())]},jF=()=>!qs&&!Mn?void 0:{...qs,...Mn,contexts:[...Array.from(Bu.values())]},O6=()=>!qs&&!Mn?void 0:{...qs,...Mn,contexts:[...Mn?.contexts??[],...Array.from(dc.values())]},x6=()=>!qs&&!Mn?void 0:{...Mn,contexts:[...Mn?.contexts??[]]};function M6(t){let e={...t};for(let r in e)e[r]===null&&delete e[r];return e}var UF=async()=>{let t=await Uu();console.log("Resolved settings",JSON.stringify(t,void 0," ")),te.sendNotification("devicetree/settingsChanged",t),await Vu(),He().then(()=>{$F&&te.languages.diagnostics.refresh()})},L6=async()=>{let t=ce?.getContextFiles();await Promise.all(Array.from(Nr.keys()).filter(Ut).map(async e=>{t?.some(r=>pe(r,Pe(e)))||await te.sendDiagnostics({uri:e,version:Nr.get(e)?.version,diagnostics:[{severity:Ke.DiagnosticSeverity.Information,range:Ke.Range.create(Ke.Position.create(0,0),Ke.Position.create(0,0)),message:"File not in active context",source:"devicetree"}]})}))},sk=async t=>{let e=lT(Ue,t);if(e.length)e.sort((r,n)=>r===ce?-1:n===ce?1:0).forEach(r=>{tg.get(r)?.abort.abort();let n=new AbortController,i=new Promise(s=>{setTimeout(async()=>{if(r.setStaleUri(t),n.signal.aborted){s();return}let o=performance.now(),a=ce===r,c=a?HF(r):[],l=r.getContextFiles();await r.reevaluate(t),xF(r),l.forEach(p=>Fu.get(p)?.unwatch()),a&&lk(r)?.length&&ok(r).then(p=>{let m=p.items.map(h=>({uri:h.uri,version:h.version??void 0,diagnostics:h.items}));ju(r,c.filter(h=>m.every(T=>T.uri!==h.uri))),m.forEach(h=>{te.sendDiagnostics(h)}),Wu.set(r,!0)});let[u,d]=await Promise.all([$s(r),r.getFileTree()]),f={ctxNames:r.ctxNames.map(p=>p.toString()),id:r.id,...d,settings:r.settings,active:a,type:u.type};ce===r&&te.sendNotification("devicetree/activeContextStableNotification",f),te.sendNotification("devicetree/contextStableNotification",f),s(),console.log("reevaluate",performance.now()-o)},50)});tg.set(r,{abort:n,promise:i})});else{if((await Uu()).allowAdhocContexts===!1)return;await Vu(),await lr({uri:t})}},q6=t=>Nr.keys().find(e=>pe(Pe(e),t)),zu=t=>{let e=q6(t);if(e)return Nr.get(e)},HF=t=>t.getContextFiles().map(e=>({uri:ue(e),version:zu(e)?.version,diagnostics:[]})),Wu=new WeakMap,ju=async(t,e=HF(t),r=!1)=>{if(!r&&t!==ce)return;let n=performance.now();await Promise.all(e.filter(i=>t===ce||!ce?.getContextFiles().some(s=>pe(Pe(i.uri),s))).map(i=>te.sendDiagnostics({uri:i.uri,version:Nr.get(i.uri)?.version,diagnostics:[]}))),Wu.delete(t),console.log(`(ID: ${t.id})`,"clear workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-n)},ok=async t=>{await t.stable();let e=performance.now(),r=await t.getDiagnostics(),n=await Promise.all(t.getContextFiles().map(async i=>{let s=zu(i),o=[];return s&&t.settings.showFormattingErrorAsDiagnostics&&o.push(...(await Ca({textDocument:s,options:t.formattingOptions},s?.getText(),"File Diagnostics").catch(()=>[])).map(a=>a.diagnostic())),{uri:ue(i),kind:Ke.DocumentDiagnosticReportKind.Full,items:[...r.get(i)??[],...o],version:s?.version??null}}));return console.log(`(ID: ${t.id})`,"workspace diagnostics",`[${t.ctxNames.join(",")}]`,performance.now()-e),{items:[...n]}},ak=async t=>{let{items:e}=await ok(t);e.map(r=>({uri:r.uri,version:r.version??void 0,diagnostics:r.items})).forEach(async r=>{te.sendDiagnostics(r)}),Wu.set(t,!0)},ck=async()=>{let t=await Promise.all(Ue.map($s));console.log("======== Context List ========"),t.forEach(e=>{console.log(`(ID: ${e.ctx.id}) [${e.ctx.ctxNames.join(",")}]`,`[${e.type}]`,ce===e.ctx?" [ACTIVE]":"")}),console.log("==============================")},$s=async t=>{let e=await ik(t),r=!e&&await P6(t);return{ctx:t,type:e?"Ad Hoc":r?"User":"3rd Party"}},lr=async(t,e=!1)=>{if("uri"in t){if(!Ut(t.uri))return!1;fc=t.uri,console.log("Active File Uri",fc)}let r=await Uu();if(ce&&!e&&!r.autoChangeContext||(await He(),!e&&ce?.getContextFiles().find(o=>"uri"in t&&pe(o,t.uri))))return!1;let n=ce,i=Tn(Ue,t),s=n!==i;return s&&(n&&ju(n),ce=i,i?($s(i).then(async o=>{let a=await i.getFileTree();!i||i!==ce&&!Ue.includes(i)||te.sendNotification("devicetree/newActiveContext",{ctxNames:i.ctxNames.map(c=>c.toString()),id:i.id,...a,settings:i.settings,active:ce===i,type:o.type})}),lk(i)?.length&&ak(i),await ck()):te.sendNotification("devicetree/newActiveContext",void 0)),BF&&te.languages.foldingRange.refresh(),FF&&te.languages.semanticTokens.refresh(),s},Ut=t=>[".dts",".dtsi",".dtso",".overlay"].some(e=>t.endsWith(e));Nr.listen(te);var lk=t=>t?.getContextFiles()?.filter(e=>zu(e));Nr.onDidClose(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=lT(Ue,e);if(r.length===0){Bu.delete(e),te.sendDiagnostics({uri:t.document.uri,version:Nr.get(t.document.uri)?.version,diagnostics:[]});return}await Promise.all(r.map(async n=>{!!lk(n)?.filter(s=>s!==e).length?ce?.getContextFiles().some(s=>pe(s,e))?ce?.getContextFiles().some(s=>pe(s,e))&&(await ju(ce),await ak(ce)):te.sendDiagnostics({uri:t.document.uri,version:Nr.get(t.document.uri)?.version,diagnostics:[]}):await ik(n)?(await nk(n),Bu.delete(n.settings.dtsFile)):ju(n)}))});Nr.onDidOpen(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;await He(),L6();let r=Tn(Ue,{uri:e});if(console.log("onDidOpen",r?.id,e),r)r!==ce?await lr({id:r.id}):r===ce&&(!Wu.get(r)||r.getContextFiles().some(n=>!pe(n,e)))&&await ak(r);else{let n={ctxName:(0,pc.basename)(e),dtsFile:e};Bu.set(e,n),await sk(e)}});Nr.onDidChangeContent(async t=>{let e=Pe(t.document.uri);if(!Ut(e))return;let r=t.document.getText(),n=Hr();n.needsRenew(e,r)&&(console.log("Content changed"),n.renewLexer(e,r),await sk(e))});var VF=async t=>{t?.settings?.devicetree&&(Mn=_F(M6(t.settings.devicetree)),console.log("Configuration changed",JSON.stringify(t,void 0," ")),await UF())};te.onDidChangeConfiguration(async t=>{await VF(t)});te.listen();te.languages.diagnostics.onWorkspace(async()=>{await He();let t=ce;return t?ok(t).finally(()=>{Wu.set(t,!0)}):{items:[]}});te.onDidChangeWatchedFiles(t=>{te.console.log("We received a file change event")});te.onCompletion(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return RA(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return[];await He(),lr({uri:e});let r=Ir(e);return r?[...await lD(t,r),...await QA(t,r)]:[]});te.onCompletionResolve(t=>t);var Ir=t=>{let e=jF();return Tn(Ue,{uri:t},ce,e?.preferredContext)};te.onDocumentSymbol(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return[];await He();let r=Ir(e);return r?r.getUriParser(e)?.getDocumentSymbols(e):[]});te.onWorkspaceSymbol(async()=>{await He();let t=ce;return t?(await t.getAllStableParsers()).flatMap(e=>e.getWorkspaceSymbols()):[]});te.languages.semanticTokens.on(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return{data:[]};try{await He();let r=Ir(e),n=new Ke.SemanticTokensBuilder,i=r?.isInContext(e);return!r||!i?{data:[]}:((await r.getAllStableParsers()).forEach(s=>s.buildSemanticTokens(n,e)),n.build())}catch(r){throw console.log(r),r}});te.onDocumentLinks(async t=>{await He();let e=Pe(t.textDocument.uri);return Ut(e)?Ir(e)?.getDocumentLinks(e):e.endsWith(".yaml")&&ce?ce.bindingLoader?.getDocumentLinks?.(Nr.get(t.textDocument.uri))??[]:[]});te.onPrepareRename(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return AA(t,r)});te.onRenameRequest(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return DA(t,r)});te.onReferences(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return PA(t,r)});te.onDefinition(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return xA(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e),n=(await r?.getDocumentLinks(e,t.position))?.filter(i=>i.target).map(i=>Ke.Location.create(i.target,i.range))??[];return n.length?n:OA(t,r)});te.onDeclaration(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return $A(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return qA(t,r)});te.onCodeAction(async t=>{let e=Pe(t.textDocument.uri);if(Ut(e))return BA(t)});var zF=async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);if(!r)return[];if((await r.getSyntaxIssues(void 0,l=>Xs(l.raw,e,!1)?l:void 0)).get(e)?.length)return[];let i=Hr().getDocument(e),s=i.getText(),o=await Ca(t,s,"New Text").catch(()=>s);if(o===s)return[];let a=i.lineCount-1,c=i.getText({start:{line:a,character:0},end:{line:a+1,character:0}}).length;return[Ke.TextEdit.replace(Ke.Range.create(Ke.Position.create(0,0),Ke.Position.create(i.lineCount,c)),o)]};te.onDocumentRangeFormatting(zF);te.onDocumentFormatting(zF);te.onHover(async t=>{let e=Pe(t.textDocument.uri);if((e.endsWith(".c")||e.endsWith(".cpp"))&&ce&&ce.bindingLoader?.type==="Zephyr")return SO(t,ce,Nr.get(t.textDocument.uri));if(!Ut(e))return;await He();let r=Ir(e);return(await ZA(t,r)).at(0)});te.onFoldingRanges(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He();let r=Ir(e),n=r?.isInContext(e);if(!r||!n)return[];let i=(await r.getAllStableParsers()).find(s=>s.getFiles().some(o=>o===e));return i?bF(e,i):[]});te.onTypeDefinition(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return SF(t,r)});te.onSignatureHelp(async t=>{let e=Pe(t.textDocument.uri);if(!Ut(e))return;await He(),lr({uri:e});let r=Ir(e);return CF(t,r)});te.onRequest("devicetree/getContexts",async()=>(await He(),Promise.all(Ue.map(async t=>{let e=await $s(t);return{ctxNames:t.ctxNames.map(r=>r.toString()),id:t.id,...await t.getFileTree(),settings:t.settings,active:ce===t,type:e.type}}))));te.onRequest("devicetree/setActive",async t=>(await He(),console.log("devicetree/setActive",t),await lr(t,!0)));te.onRequest("devicetree/getActiveContext",async()=>{if(await He(),console.log("devicetree/getActiveContext"),!ce)return;let t=await $s(ce);return ce?{ctxNames:ce.ctxNames.map(e=>e.toString()),id:ce.id,...await ce.getFileTree(),settings:ce.settings,active:!0,type:t.type}:void 0});te.onRequest("devicetree/setDefaultSettings",async t=>{await He(),qs=t,console.log("Integration Settings",t),await UF()});te.onRequest("devicetree/requestContext",async t=>{await He();let e=await Uu(),r=await J_(t,e,await Hu());console.log("devicetree/requestContext",r);let n=Ii(r),i=Array.from(dc).find(([,a])=>a.ctxName===t.ctxName);if(i){let a=i[0].split(":",1)[0];Tn(Ue,{name:t.ctxName.toString()})?.removeCtxName(t.ctxName),console.log(`Removing integration context with ID ${a} and name ${t.ctxName}`),dc.delete(i[0])}dc.set(`${n}:${t.ctxName}`,t),await Vu();let s=Ue.find(a=>a.id===n);if(!s)throw new Error("Failed to create context");let o=await $s(s);return{ctxNames:s.ctxNames.map(a=>a.toString()),id:n,...await s.getFileTree(),settings:s.settings,active:!0,type:o.type}});te.onRequest("devicetree/removeContext",async({id:t,name:e})=>{await He(),dc.delete(`${t}:${e}`);let r=Tn(Ue,{id:t});if(r){if(r.removeCtxName(e),r.ctxNames.length){console.log("Context will not be deleted as it is still in use by others");return}await Vu()}});te.onRequest("devicetree/compiledDtsOutput",async t=>{if(await He(),!t)return;let e=Tn(Ue,{id:t});if(!e)return;let r=await e.toFullString();return Ca({textDocument:{uri:ue(e.settings.dtsFile)},options:e.formattingOptions},r,"New Text").catch(()=>r)});te.onRequest("devicetree/serializedContext",async t=>{if(await He(),!t)return;let e=Tn(Ue,{id:t}),r=performance.now();return e?.serialize().finally(()=>{console.info("serializedContext",performance.now()-r)})});te.onRequest("devicetree/activePath",async t=>{if(await He(),!ce)return;let e=r=>{if(r?.item)return r.item instanceof X?{nodePath:r.item.pathString}:{nodePath:r.item.parent.pathString,propertyName:r.item.name}};return(await Pt(t,ce,r=>[e(r)])).at(0)});te.onRequest("devicetree/customActions",async t=>(await He(),EF(t,ce)));te.onRequest("devicetree/activeFileUri",async t=>{await He(),lr({uri:t})});te.onRequest("devicetree/formattingText",async t=>{let e=Pe(t.textDocument.uri),r=zu(e)??Hr().getDocument(e,t.text),n=await Ca(t,r.getText(),"Both");return{text:n.text,diagnostics:n.diagnostic.map(i=>i.diagnostic())}});te.onRequest("devicetree/diagnosticIssues",async({uri:t,full:e})=>{await He();let r=Pe(t);lr({uri:r});let n=Ir(r);if(!n)return[];let i=e?(await n.getDiagnostics()).get(r):(await n.getSyntaxIssues(void 0,s=>Xs(s.raw,r,!!e)?s:void 0)).get(r);if(i?.length)return i});te.onRequest("devicetree/evalMacros",async({macros:t,ctxId:e})=>{await He();let r=Tn(Ue,{id:e});return r?t.map(n=>{let i=Mc(n,r.macros),s=Ce(i);return{macro:n,evaluated:typeof s=="number"?s:i}}):[]});
|